jsmolka / gba-tests

A collection of Game Boy Advance tests.
MIT License
101 stars 9 forks source link

Question about arm test 254 after 253 #13

Closed lemoncmd closed 10 months ago

lemoncmd commented 10 months ago

Test 254 reads from and writes to SPSR, but it is supposed to be in system mode while the test since test 253 changes to it. ARM Architecture Reference Manual says that system mode does not have SPSR. Should my emulator have SPSR for system mode? Which behavior is correct?

jsmolka commented 10 months ago

The test passes on real hardware so it's correct. But you are also right, the ARM specification mentions that system and user mode have no SPSR.

fleroviux commented 10 months ago

In user and system modes reads from SPSR read CPSR but writes to SPSR appear to be ignored.

jsmolka commented 10 months ago

That would explain why the test works.

mrs     r0, cpsr
msr     spsr, r0
mrs     r1, spsr
cmp     r1, r0

Because it does nothing.

jsmolka commented 10 months ago

The test is now performed in FIQ mode to prevent confusion.