This project is read-only.
1

Resolved

6800 instruction BLS takes the wrong branch

description

6800 instruction Branch on Less or Same (BLS) is not emulated correctly.
0001   0000                 .org    $0000
0002   0000             
0003   0000 86 00   MAIN    LDAA    #0
0004   0002 81 04           CMPA    #4
0005   0004 23 02           BLS     LBL1    ; branch if ACCA <= 4
0006   0006             
0007   0006 86 01           LDAA    #1
0008   0008             
0009   0008 39      LBL1    RTS             ; ACCA should be 0, not 1.
0010   0009             
0011   0009                 .END
Enter the above code into a real ET-3400 and the Sharp6800 emulator (RESET AUTO 0000 86 00 81 04 23 02 86 01 39 RESET). Set a breakpoint at LBL1 (BR 0008). Execute (DO 0000, and see "0008 39" as the breakpoint is encountered). Look at accumulator A (ACCA). The real ET-3400 correctly shows "Acca 00" while Sharp6800 shows "Acca 01". This took me significant time to find and reduce to the above code snippet. It brings into question what other of the 197 valid 6800 opcodes are mis-implemented. At least the 14 conditional branch instructions are in question.

comments

RupertAvery wrote Jan 7, 2015 at 1:29 AM

Yes, this was incorrectly implemented. Caused by misinterpretation of original C code to C#. Should be fixed now. I am checking the other conditional branch instructions. Probably best if I come up with a set of proper unit tests.