mov r0,z80sp\r
readmem16\r
add z80sp,z80sp,#2\r
+ bic z80sp,z80sp,#1<<16\r
.endif\r
.endm\r
\r
.else\r
mov r0,\reg\r
subs z80sp,z80sp,#2\r
- @ addcc z80sp,z80sp,#1<<16\r
+ addcc z80sp,z80sp,#1<<16\r
mov r1,z80sp\r
writemem16\r
.endif\r
.else\r
mov r0,\reg,lsr #16\r
subs z80sp,z80sp,#2\r
- @ addcc z80sp,z80sp,#1<<16\r
+ addcc z80sp,z80sp,#1<<16\r
mov r1,z80sp\r
writemem16\r
.endif\r
strb r0,[z80sp,#-1]!\r
.else\r
subs z80sp,z80sp,#2\r
- @ addcc z80sp,z80sp,#1<<16\r
+ addcc z80sp,z80sp,#1<<16\r
mov r1,z80sp\r
writemem16\r
ldr r2,[cpucontext, #z80irqvector]\r
;@INC SP\r
opcode_3_3:\r
add z80sp,z80sp,#1\r
+.if !FAST_Z80SP\r
+ bic z80sp,z80sp,#1<<16\r
+.endif\r
fetch 6\r
;@INC (HL)\r
opcode_3_4:\r
fetch 13\r
;@DEC SP\r
opcode_3_B:\r
- sub z80sp,z80sp,#1\r
+ subs z80sp,z80sp,#1\r
+.if !FAST_Z80SP\r
+ addcc z80sp,z80sp,#1<<16\r
+.endif\r
fetch 6\r
;@INC A\r
opcode_3_C:\r
mov r0,z80sp\r
readmem16\r
add z80sp,z80sp,#2\r
+ bic z80sp,z80sp,#1<<16\r
and z80a,r0,#0xFF00\r
mov z80a,z80a,lsl#16\r
and z80f,r0,#0xFF\r
readmem16\r
ldmfd sp!,{r2,z80xx}\r
add z80sp,z80sp,#2\r
+ bic z80sp,z80sp,#1<<16\r
.endif\r
strh r0,[z80xx,#2]\r
fetch 14\r
{\r
// I, R, CPU and interrupts logic is reset, registers are untouched\r
memset(&CPU->R, 0, (FPTR)&CPU->BasePC - (FPTR)&CPU->R);\r
- Cz80_Set_Reg(CPU, CZ80_FA, 0xffff);\r
- Cz80_Set_Reg(CPU, CZ80_SP, 0xffff);\r
Cz80_Set_Reg(CPU, CZ80_PC, 0);\r
}\r
\r
drZ80.Z80IF = 0;
drZ80.z80irqvector = 0xff0000; // RST 38h
drZ80.Z80PC_BASE = drZ80.Z80PC = z80_read_map[0] << 1;
- drZ80.Z80SP = 0xffff;
- drZ80.Z80F = 0xff;
- drZ80.Z80A = 0xff << 24;
// others not changed, undefined on cold boot
-/*
- drZ80.Z80IX = 0xFFFF << 16;
- drZ80.Z80IY = 0xFFFF << 16;
-*/
#ifdef FAST_Z80SP
// drZ80 is locked in single bank
drz80_sp_base = (PicoIn.AHW & PAHW_SMS) ? 0xc000 : 0x0000;