notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lots of win32 port work
[picodrive.git]
/
Pico
/
cd
/
Pico.s
diff --git
a/Pico/cd/Pico.s
b/Pico/cd/Pico.s
index
24e4d1c
..
87e8554
100644
(file)
--- a/
Pico/cd/Pico.s
+++ b/
Pico/cd/Pico.s
@@
-1,6
+1,6
@@
@ vim:filetype=armasm
@ vim:filetype=armasm
-@ SekRunPS runs PicoCpu
and PicoCpu
S68k interleaved in steps of PS_STEP_M68K
+@ SekRunPS runs PicoCpu
CM68k and PicoCpuC
S68k interleaved in steps of PS_STEP_M68K
@ cycles. This is done without calling CycloneRun and jumping directly to
@ Cyclone code to avoid pushing/popping all the registers every time.
@ cycles. This is done without calling CycloneRun and jumping directly to
@ Cyclone code to avoid pushing/popping all the registers every time.
@@
-13,8
+13,8
@@
@ .extern is ignored by gas, we add these here just to see what we depend on.
.extern CycloneJumpTab
.extern CycloneDoInterrupt
@ .extern is ignored by gas, we add these here just to see what we depend on.
.extern CycloneJumpTab
.extern CycloneDoInterrupt
-.extern PicoCpu
-.extern PicoCpuS68k
+.extern PicoCpu
CM68k
+.extern PicoCpu
C
S68k
.extern SekCycleAim
.extern SekCycleCnt
.extern SekCycleAimS68k
.extern SekCycleAim
.extern SekCycleCnt
.extern SekCycleAimS68k
@@
-32,12
+32,12
@@
SekRunPS:
sub sp, sp, #2*4 @ sp[0] = main_cycle_cnt, sp[4] = run_cycle_cnt
@ override CycloneEnd for both contexts
sub sp, sp, #2*4 @ sp[0] = main_cycle_cnt, sp[4] = run_cycle_cnt
@ override CycloneEnd for both contexts
- ldr r7, =PicoCpu
- ldr lr, =PicoCpuS68k
+ ldr r7, =PicoCpu
CM68k
+ ldr lr, =PicoCpu
C
S68k
ldr r2, =CycloneEnd_M68k
ldr r3, =CycloneEnd_S68k
ldr r2, =CycloneEnd_M68k
ldr r3, =CycloneEnd_S68k
- str r2, [r7,#0x
54
]
- str r3, [lr,#0x
54
]
+ str r2, [r7,#0x
98
]
+ str r3, [lr,#0x
98
]
@ update aims
ldr r8, =SekCycleAim
@ update aims
ldr r8, =SekCycleAim
@@
-83,13
+83,14
@@
schedule_s68k:
ldr r9, [r9]
sub r0, r9, r8
ldr r9, [r9]
sub r0, r9, r8
- add r3, r3, r3, asr #1
- add r3, r3, r3, asr #3 @ cycn_s68k = (cycn + cycn/2 + cycn/8)
+ mov r2, r3
+ add r3, r3, r2, asr #1
+ add r3, r3, r2, asr #3 @ cycn_s68k = (cycn + cycn/2 + cycn/8)
subs r5, r0, r3, asr #16
ble schedule_m68k @ s68k has not enough cycles
subs r5, r0, r3, asr #16
ble schedule_m68k @ s68k has not enough cycles
- ldr r7, =PicoCpuS68k
+ ldr r7, =PicoCpu
C
S68k
str r5, [sp,#4] @ run_cycle_cnt
b CycloneRunLocal
str r5, [sp,#4] @ run_cycle_cnt
b CycloneRunLocal
@@
-121,25
+122,24
@@
schedule_m68k:
subs r5, r0, r3, asr #16
ble schedule_s68k @ m68k has not enough cycles
subs r5, r0, r3, asr #16
ble schedule_s68k @ m68k has not enough cycles
- ldr r7, =PicoCpu
+ ldr r7, =PicoCpu
CM68k
str r5, [sp,#4] @ run_cycle_cnt
b CycloneRunLocal
SekRunPS_end:
str r5, [sp,#4] @ run_cycle_cnt
b CycloneRunLocal
SekRunPS_end:
- ldr r7, =PicoCpu
- ldr lr, =PicoCpuS68k
+ ldr r7, =PicoCpu
CM68k
+ ldr lr, =PicoCpu
C
S68k
mov r0, #0
mov r0, #0
- str r0, [r7,#0x
54
] @ remove CycloneEnd handler
- str r0, [lr,#0x
54
]
+ str r0, [r7,#0x
98
] @ remove CycloneEnd handler
+ str r0, [lr,#0x
98
]
@ return
add sp, sp, #2*4
ldmfd sp!, {r4-r11,pc}
@ return
add sp, sp, #2*4
ldmfd sp!, {r4-r11,pc}
-
CycloneRunLocal:
;@ r0-3 = Temporary registers
ldr r4,[r7,#0x40] ;@ r4 = Current PC + Memory Base
CycloneRunLocal:
;@ r0-3 = Temporary registers
ldr r4,[r7,#0x40] ;@ r4 = Current PC + Memory Base
@@
-148,32
+148,33
@@
CycloneRunLocal:
;@ r7 = Pointer to Cpu Context
;@ r8 = Current Opcode
ldrb r9,[r7,#0x46] ;@ r9 = Flags (NZCV)
;@ r7 = Pointer to Cpu Context
;@ r8 = Current Opcode
ldrb r9,[r7,#0x46] ;@ r9 = Flags (NZCV)
- ldr r
0,[r7,#0x44]
-
mov r9,r9,lsl #28
;@ r9 = Flags 0xf0000000, cpsr format
+ ldr r
1,[r7,#0x44] ;@ get SR high and IRQ level
+
orr r9,r9,r9,lsl #28
;@ r9 = Flags 0xf0000000, cpsr format
;@ r10 = Source value / Memory Base
;@ CheckInterrupt:
;@ r10 = Source value / Memory Base
;@ CheckInterrupt:
- movs r0,r
0
,lsr #24 ;@ Get IRQ level
+ movs r0,r
1
,lsr #24 ;@ Get IRQ level
beq NoIntsLocal
cmp r0,#6 ;@ irq>6 ?
beq NoIntsLocal
cmp r0,#6 ;@ irq>6 ?
- ldrleb r1,[r7,#0x44] ;@ Get SR high: T_S__III
andle r1,r1,#7 ;@ Get interrupt mask
cmple r0,r1 ;@ irq<=6: Is irq<=mask ?
andle r1,r1,#7 ;@ Get interrupt mask
cmple r0,r1 ;@ irq<=6: Is irq<=mask ?
- blgt CycloneDoInterrupt
-;@ Check if interrupt used up all the cycles:
- subs r5,r5,#0
- ldrlt r1,[r7,#0x54]
- bxlt r1 ;@ jump to alternative CycloneEnd
+ bgt CycloneDoInterrupt
NoIntsLocal:
NoIntsLocal:
-;@ Check if our processor is in stopped state and jump to opcode handler if not
- ldr r0,[r7,#0x58]
+;@ Check if our processor is in special state
+;@ and jump to opcode handler if not
+ ldr r0,[r7,#0x58] ;@ state_flags
ldrh r8,[r4],#2 ;@ Fetch first opcode
ldrh r8,[r4],#2 ;@ Fetch first opcode
- tst r0,r0 ;@ stopped?
+ tst r0,#0x03 ;@ special state?
+ andeq r9,r9,#0xf0000000
ldreq pc,[r6,r8,asl #2] ;@ Jump to opcode handler
ldreq pc,[r6,r8,asl #2] ;@ Jump to opcode handler
- @ stopped
- ldr r1,[r7,#0x54]
+CycloneSpecial2:
+ tst r0,#2 ;@ tracing?
+ bne CycloneDoTrace
+;@ stopped or halted
+ sub r4,r4,#2
+ ldr r1,[r7,#0x98]
mov r5,#0
bx r1
mov r5,#0
bx r1