|
I've run across something that seems inconsistent on different emulators, so I'd like some opinions on which behavior is most correct.
In my NES programming, I've been accessing ports, such as $4016, using indexed addressing. For example:
ldx #$0 ;Read controller 0 first lda #$1 ;Strobe controller port sta $4016, x lda #$0 sta $4016, x lda $4016, x ;Read a button ...
I had found this handy for writing tight code, for instance, to read both controllers at once.
This works on some emulators (Nesten, Nesticle), but has disasterous consequences on other emulators (Nestopia, Nintendulator). For instance, somehow the code above causes the status for the A button to be skipped on the first read, instead returning the status of the B button. If I remove the indexing, the code works fine for all emulators. These same conditions seem to be true for any memory-mapped port that I access.
Which set of emulators is being more true to the NES hardware? Is this some arcane behavior of the 6502 that is emulated by Nintendulator and Nestopia that I am encountering? Or is this an emulator bug?
Thanks, Phoenix
|