From: kub Date: Mon, 3 Jul 2023 21:37:22 +0000 (+0200) Subject: z80, minor fixes to drz80 + cz80 to bring them in sync X-Git-Tag: v2.00~194 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f061b89d256eefe2cf4f04c6ebdae20f172d19b6;p=picodrive.git z80, minor fixes to drz80 + cz80 to bring them in sync --- diff --git a/cpu/DrZ80/drz80.S b/cpu/DrZ80/drz80.S index 518bb729..edcebb8b 100644 --- a/cpu/DrZ80/drz80.S +++ b/cpu/DrZ80/drz80.S @@ -286,9 +286,9 @@ z80_xmap_rebase_sp: sub r2,z80pc,r1 str r2,[cpucontext,#previouspc] .endif - ldrplb r0,[z80pc],#1 - ldrpl pc,[opcodes,r0, lsl #2] - bmi z80_execute_end + ldrgtb r0,[z80pc],#1 + ldrgt pc,[opcodes,r0, lsl #2] + ble z80_execute_end .endm .macro eatcycles cycs @@ -1442,8 +1442,8 @@ DrZ80Run: PIC_LDR(opcodes, r0, MAIN_opcodes) cmp z80_icount,#0 ;@ irq might have used all cycles - ldrplb r0,[z80pc],#1 - ldrpl pc,[opcodes,r0, lsl #2] + ldrgtb r0,[z80pc],#1 + ldrgt pc,[opcodes,r0, lsl #2] z80_execute_end: diff --git a/cpu/cz80/cz80_opXY.c b/cpu/cz80/cz80_opXY.c index a73c3fc9..fb53c072 100644 --- a/cpu/cz80/cz80_opXY.c +++ b/cpu/cz80/cz80_opXY.c @@ -70,7 +70,7 @@ switch (Opcode) OPXY(0x5c): // LD E,HX OPXY(0x7c): // LD A,HX zR8((Opcode >> 3) & 7) = data->B.H; - RET(5) + RET(4) OPXY(0x45): // LD B,LX OPXY(0x4d): // LD C,LX @@ -78,7 +78,7 @@ switch (Opcode) OPXY(0x5d): // LD E,LX OPXY(0x7d): // LD A,LX zR8((Opcode >> 3) & 7) = data->B.L; - RET(5) + RET(4) OPXY(0x60): // LD HX,B OPXY(0x61): // LD HX,C @@ -86,7 +86,7 @@ switch (Opcode) OPXY(0x63): // LD HX,E OPXY(0x67): // LD HX,A data->B.H = zR8(Opcode & 7); - RET(5) + RET(4) OPXY(0x68): // LD LX,B OPXY(0x69): // LD LX,C @@ -94,15 +94,15 @@ switch (Opcode) OPXY(0x6b): // LD LX,E OPXY(0x6f): // LD LX,A data->B.L = zR8(Opcode & 7); - RET(5) + RET(4) OPXY(0x65): // LD HX,LX data->B.H = data->B.L; - RET(5) + RET(4) OPXY(0x6c): // LD LX,HX data->B.L = data->B.H; - RET(5) + RET(4) OPXY(0x06): // LD B,#imm OPXY(0x0e): // LD C,#imm @@ -113,11 +113,11 @@ switch (Opcode) OPXY(0x26): // LD HX,#imm data->B.H = READ_ARG(); - RET(5) + RET(4) OPXY(0x2e): // LD LX,#imm data->B.L = READ_ARG(); - RET(5) + RET(4) OPXY(0x0a): // LD A,(BC) goto OP_LOAD_A_mBC; @@ -244,12 +244,12 @@ switch (Opcode) OPXY(0x24): // INC HX data->B.H++; zF = (zF & CF) | SZHV_inc[data->B.H]; - RET(5) + RET(4) OPXY(0x2c): // INC LX data->B.L++; zF = (zF & CF) | SZHV_inc[data->B.L]; - RET(5) + RET(4) OPXY(0x34): // INC (IX+o) adr = data->W + (INT8)READ_ARG(); @@ -270,12 +270,12 @@ switch (Opcode) OPXY(0x25): // DEC HX data->B.H--; zF = (zF & CF) | SZHV_dec[data->B.H]; - RET(5) + RET(4) OPXY(0x2d): // DEC LX data->B.L--; zF = (zF & CF) | SZHV_dec[data->B.L]; - RET(5) + RET(4) OPXY(0x35): // DEC (IX+o) adr = data->W + (INT8)READ_ARG(); @@ -298,12 +298,10 @@ switch (Opcode) OPXY(0x84): // ADD A,HX val = data->B.H; - USE_CYCLES(1) goto OP_ADD; OPXY(0x85): // ADD A,LX val = data->B.L; - USE_CYCLES(1) goto OP_ADD; OPXY(0x86): // ADD A,(IX+o) @@ -328,12 +326,10 @@ switch (Opcode) OPXY(0x8c): // ADC A,HX val = data->B.H; - USE_CYCLES(1) goto OP_ADC; OPXY(0x8d): // ADC A,LX val = data->B.L; - USE_CYCLES(1) goto OP_ADC; OPXY(0x8e): // ADC A,(IX+o) @@ -358,12 +354,10 @@ switch (Opcode) OPXY(0x94): // SUB HX val = data->B.H; - USE_CYCLES(1) goto OP_SUB; OPXY(0x95): // SUB LX val = data->B.L; - USE_CYCLES(1) goto OP_SUB; OPXY(0x96): // SUB (IX+o) @@ -388,12 +382,10 @@ switch (Opcode) OPXY(0x9c): // SBC A,HX val = data->B.H; - USE_CYCLES(1) goto OP_SBC; OPXY(0x9d): // SBC A,LX val = data->B.L; - USE_CYCLES(1) goto OP_SBC; OPXY(0x9e): // SBC A,(IX+o) @@ -418,12 +410,10 @@ switch (Opcode) OPXY(0xbc): // CP HX val = data->B.H; - USE_CYCLES(1) goto OP_CP; OPXY(0xbd): // CP LX val = data->B.L; - USE_CYCLES(1) goto OP_CP; OPXY(0xbe): // CP (IX+o) @@ -448,12 +438,10 @@ switch (Opcode) OPXY(0xa4): // AND HX val = data->B.H; - USE_CYCLES(1) goto OP_AND; OPXY(0xa5): // AND LX val = data->B.L; - USE_CYCLES(1) goto OP_AND; OPXY(0xa6): // AND (IX+o) @@ -478,12 +466,10 @@ switch (Opcode) OPXY(0xac): // XOR HX val = data->B.H; - USE_CYCLES(1) goto OP_XOR; OPXY(0xad): // XOR LX val = data->B.L; - USE_CYCLES(1) goto OP_XOR; OPXY(0xae): // XOR (IX+o) @@ -508,12 +494,10 @@ switch (Opcode) OPXY(0xb4): // OR HX val = data->B.H; - USE_CYCLES(1) goto OP_OR; OPXY(0xb5): // OR LX val = data->B.L; - USE_CYCLES(1) goto OP_OR; OPXY(0xb6): // OR (IX+o)