Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
05259 Core Major Always Aug 9, 2013, 01:50 Aug 12, 2013, 02:30
Tester Robert Gault View Status Public Platform MESS (Official Binary)
Assigned To Bletch Resolution Fixed OS Windows XP
Status [?] Resolved Driver
Version 0.149u1 Fixed in Version Build Normal
Fixed in Git Commit Github Pull Request #
Summary MESS-specific 05259: H6309 opcode muld does not work
Description At least one opcode for the Hitachi 6309 is not working, muld. There may be others but I have not done testing. This could make NitrOS-9 6309 systems fail to function.
Steps To Reproduce Run some program that will permit creating assembly language code. It might be possible to do this with the MESS debugger.
A simple test program follows.

start ldd #$10
           muld #$1234
          swi

The swi is the equivalent of a breakpoint. Check the registers after the muld instruction. They should be
regA =0
regB=1
regE=$23
regF=$40

The actual binary code for this program is
 $CC,$00,$11,$8F,$12,$34,$3f
Additional Information There are many other addressing modes for the muld opcode and they all fail.
ex
 muld 1,y
 muld address

The instuction should multiply the 16-bit content of regD by a 16-bit number and store the 32-bit result in regQ which consists of
regA regB regE regF. Now the one big problem is that this instruction, divd, and divq is that they are twos complement signed operations. That means for large numbers, the results are not usable. Generally one needs to insure that there is no overflow and that the numbers stay positive.

Older versions of MESS worked correctly.

I believe this should addressed in mess\src\emu\cpu\m6809\ where one of h6309.c h6309.h or h6309.ops, but I'm not sure just what code is used in coco3h emulation.
Github Commit
Flags
Regression Version
Affected Sets / Systems
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
2
User avatar
No.09716
Robert Gault
Tester
Aug 9, 2013, 11:38
edited on: Aug 9, 2013, 21:23
Here is more data for the instructions LDD #n MULD #m
n m regD regW regCC
2 2 0 4 EZ
-2 2 $FFFF $FFFC EN -2=$FFFE
$7FFF $7FFF $3FFF 1 E
$8000 2 $FFFF 0 EN $8000 is a negative number so the answer is a -$10000 which isn't expressed well.
$8001 2 $FFFF 2 EN result -$10002 Easier to understand as a negative number
User avatar
No.09729
Bletch
Developer
Aug 12, 2013, 02:30
The 6809/6309/Konami CPU cores were rewritten (by me) a few months ago in order to:
* Merge them into a single code bases
* Support intra-instruction timing (so Dragon Fire could work correctly)
* Run faster

This MULD regression was almost certainly introduced during that rewrite. I believe that I've fixed it - let me know if there are further problems.