fix for load-state-after-load crash
[picodrive.git] / Pico / cd / Pico.s
index 0fe4689..a51590f 100644 (file)
@@ -28,7 +28,7 @@
 .global SekRunPS @ cyc_m68k, cyc_s68k
 
 SekRunPS:
-    stmfd   sp!, {r4-r11,lr}
+    stmfd   sp!, {r4-r8,r10,r11,lr}
     sub     sp, sp, #2*4          @ sp[0] = main_cycle_cnt, sp[4] = run_cycle_cnt
 
     @ override CycloneEnd for both contexts
@@ -49,9 +49,11 @@ SekRunPS:
     str     r2, [r8]
     str     r3, [r10]
 
+    ldr     r6, =CycloneJumpTab
     ldr     r1, =SekCycleCnt
     ldr     r0, =((488<<16)-PS_STEP_M68K)
-    ldr     r6, =CycloneJumpTab
+    str     r6, [r7,#0x54]
+    str     r6, [lr,#0x54]            @ make copies to avoid literal pools
 
     @ schedule m68k for the first time..
     ldr     r1, [r1]
@@ -136,7 +138,7 @@ SekRunPS_end:
     str     r0, [lr,#0x98]
     @ return
     add     sp, sp, #2*4
-    ldmfd   sp!, {r4-r11,pc}
+    ldmfd   sp!, {r4-r8,r10,r11,pc}