ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
705 stars 202 forks source link

Musashi incorrectly implements bra.l and bsr.l on 68000 #46

Closed GerbilSoft closed 9 years ago

GerbilSoft commented 9 years ago

While looking through the Musashi code, I noticed that it incorrectly generates opcodes for bra.l and bsr.l when targetting 68000. These instructions were introduced on 68020, and are invalid on 68000. They should act like bra.s $1, which ends up getting trapped as an Address Error.

To fix this, in m68ki_instruction_jump_table.h, change the following:

ekeeke commented 9 years ago

If you look closer to m68k_op_b**_32 functions in m68kops.h, you can see it's already the case and they all behave like their 8-bit counterpart.

I agree duplicate functions doing the same thing are not necessary but it's a left over from the original Musashi code which has support for 680xx.

GerbilSoft commented 9 years ago

I see that now. Oops. :V

Looking at the upstream Musashi code on https://github.com/kstenerud/Musashi/blob/master/m68k_in.c, it seems to generate an illegal instruction exception rather than address error, which is probably wrong.