Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext Thread**


SubjectProblem with R9 and R10 on PalmOS Reply to this message
Posted byfinaldave
Posted on05/13/04 03:08 PM



Hi folks,

News of Cyclone, seems there is an issue (which has been temporarily patched by the Zodiac guys) on PalmOS.
r4-r11 in the ARM docs are meant to be preserved across function calls, and Cyclone used this fact to do stuff like this:

;@ ---------- [0010] ori.b #$33, (a0) uses Op0010 ----------
Op0010
;@ EaCalc : Get '#$33' into r10:
ldrsb r10,[r4],#2 ;@ Fetch immediate value
;@ EaRead : Read '#$33' (address in r10) into r10:
mov r10,r10,asl #24

;@ EaCalc : Get '(a0)' into r11:
and r2,r8,#0x000f
mov r2,r2,lsl #2
orr r2,r2,#0x20 ;@ A0-7
ldr r11,[r7,r2]
;@ EaRead : Read '(a0)' (address in r11) into r0:
mov r0,r11
mov lr,pc
ldr pc,[r7,#0x68] ;@ Call read8(r0) handler
mov r0,r0,asl #24

;@ Do arithmetic:
orr r1,r0,r10
adds r1,r1,#0 ;@ Defines NZ, clears CV
mrs r9,cpsr ;@ r9=flags



However it seems PalmOS expects r10 to be a pointer to global data, and r9 is used for PalmOS calls. r9 isn't a big problem since memory handler won't use PalmOS calls hopefully.

But r10 it seems I can't use for Cyclone on PalmOS. Will have to have a rethink! I think the temporary fix is to use r12 on the Zodiac.


Just to let everyone know in case anyone is ARMing any chips! Dammit why did Sony have to go for another MIPS - ARMs are cool!


Ah - I have a cunning plan, r8 is used for the opcode BUT that's a slight waste of a permanent register - it doesn't really need to be, if I'm careful I could use r3 or maybe r12. And it's only used at the start of a function. I just have to make sure I don't use the opcode register r3/r12 after a handler has been called
Thus I might be able to use r8 instead of r10 with a bit of tweaking.





You learn something old everyday...