Menu

#13 wrong emulation of illegal opcode ANE/XAA

closed-fixed
None
2016-04-24
2008-09-14
Anonymous
No

The Mastertronic Burner variant loader does not load properly in VICE. Works perfectly on a "real" PAL C-64.
An example of the loader can be retrieved here: http://c64tapes.org/taps/Spectipede_1006.zip

Contact me if you need more info or examples.

peepo64@gmail.com

Discussion

  • Andreas Matthies

    >
    > Very interesting stuff. The loader starts at 02A7 using some illegal
    > opcodes. One of them ANE (as known as XAA) is reported to be highly unstable and
    > it seems that the most common reported behaviour A = (A | #$EE) & X &
    > #byte will corrupt the vector at $0328. Here's the debug:
    >
    > .02A7 015 050 33534131 64 AE NOOP $AE A=$00 X=$FA Y=$01 SP=$FA
    > .02A9 015 053 33534134 4E BF 02 LSR $02BF A=$00 X=$FA Y=$01 SP=$FA
    > .02AC 015 059 33534140 14 CC NOOP $CC,X A=$00 X=$FA Y=$01 SP=$FA
    > .02AE 016 000 33534144 A2 FF LDX #$FF A=$00 X=$FA Y=$01 SP=$FA
    > .02B0 016 002 33534146 8B 51 ANE #$51 A=$00 X=$FF Y=$01 SP=$FA
    > .02B2 016 004 33534148 87 FB SAX $FB A=$40 X=$FF Y=$01 SP=$FA
    > .02B4 016 007 33534151 04 4C NOOP $4C A=$40 X=$FF Y=$01 SP=$FA
    > .02B6 016 010 33534154 8B E1 ANE #$E1 A=$40 X=$FF Y=$01 SP=$FA
    > .02B8 016 012 33534156 54 CC NOOP $CC,X A=$E0 X=$FF Y=$01 SP=$FA
    > .02BA 016 016 33534160 8F 28 03 SAX $0328 A=$E0 X=$FF Y=$01 SP=$FA
    >
    > A needs to be #$ED for original correct vector. Maybe I will write some
    > test prog to verify the ANE/XAA behaviour...
    >
    Update:
    It seems that value #$E1 stored to $0328 will also make the game run so the known variation of the influence of bit 0 and 4 in the opcode behaviour is used here. But the exact reason for this variation is unknown and obviously not emulated by any emulator so far.

     
  • gpz

    gpz - 2011-07-04

    fixed in r24251

    what i did was changing the magic const to 0xff. if you look at the table at http://visual6502.org/wiki/index.php?title=6502_Opcode_8B_\(XAA,_ANE) that value is just as valid as the previously used 0xee - and it makes this loader work :)

    please retest, and reopen if other code surfaces which might need a different value... then it might get tricky =P

     
  • Leandro Nini

    Leandro Nini - 2016-04-24

    Just stumbled across this one due to a recent commit and I think it is worth mentioning that the aneb test from the Lorentz's suite currently fails as it is based on the assumption that the magic const value is $ee

     
  • gpz

    gpz - 2016-04-24

    ah, thanks for reminding.... its fixed in r31071 :)

     

Log in to post a comment.