robinsonb5 / minimig_tc64

MiniMig for TurboChameleon64
16 stars 7 forks source link

Bug in TG68 core regarding movem.l and blank opcodes list #6

Closed robinsonb5 closed 11 years ago

robinsonb5 commented 12 years ago

[Reported by Gerhard Suttner]

there is a bug in the TG68 softcore concerning the following opcodes:

MOVEM.L ,-(A7) (hex 48E7 0000) and MOVEM.L (A7)+, (hex 4CDF 0000)

There seems to be no sense in these opcodes, but the Aztec-C-compiler generates these codes when there are no registeres to be saved in a subroutine.

On original 68000 hardware both instructions have no effect. The softcore instead thrashes the stack when executing MOVEM.L ,-(A7) and overwrites the opcode when executing MOVEM.L (A7)+, .

robinsonb5 commented 12 years ago

The microcode seems to attempt to avoid running when the 2ndOPC is set to zero, but enough of the movem operation runs to cause havok.

On write, the stack pointer seems to get replaced with the Program Counter!

On read, if the existing test for zero 2nd-opcode is removed, it appears to work as expected.

robinsonb5 commented 11 years ago

Fixed by TobiFlexx's recent updates to the CPU core.