8086-Emulator
8086-Emulator copied to clipboard
next doesn't print some instructions correctly
Normally next will print the instruction about to be executed, but for some instructions (maybe the "singleton data" family?) it prints the following one instead. (It does seem to execute the correct one.)
Given the following input file:
start: pushf
add bx, 1
pushf
add bx, 2
pushf
add bx, 3
popf
add bx, 4
lahf
add bx, 5
sahf
add bx, 6
xlat
add bx, 7
Running with -i and entering n every time (e.g. by piping in yes n), the output is:
About to execute line 2 : add bx, 1
>>> About to execute line 2 : add bx, 1
>>> About to execute line 4 : add bx, 2
>>> About to execute line 4 : add bx, 2
>>> About to execute line 6 : add bx, 3
>>> About to execute line 6 : add bx, 3
>>> About to execute line 8 : add bx, 4
>>> About to execute line 8 : add bx, 4
>>> About to execute line 10 : add bx, 5
>>> About to execute line 10 : add bx, 5
>>> About to execute line 12 : add bx, 6
>>> About to execute line 12 : add bx, 6
>>> About to execute line 14 : add bx, 7
>>> About to execute line 14 : add bx, 7
>>>
Hey, the instruction mapping for the emulator was always a bit buggy and had off-by-one errors, even after fixing stuff several times in the original development. I'm inclined towards not fixing this now, but instead take this up in #6