1 /******************************************************************************
\r
5 CZ80
\8ae
\8eí
\83}
\83N
\83\8d\r
7 ******************************************************************************/
\r
9 #if CZ80_USE_JUMPTABLE
\r
10 #define _SSOP(A,B) A##B
\r
11 #define OP(A) _SSOP(OP,A)
\r
12 #define OPCB(A) _SSOP(OPCB,A)
\r
13 #define OPED(A) _SSOP(OPED,A)
\r
14 #define OPXY(A) _SSOP(OPXY,A)
\r
15 #define OPXYCB(A) _SSOP(OPXYCB,A)
\r
17 #define OP(A) case A
\r
18 #define OPCB(A) case A
\r
19 #define OPED(A) case A
\r
20 #define OPXY(A) case A
\r
21 #define OPXYCB(A) case A
\r
24 #define USE_CYCLES(A) CPU->ICount -= (A);
\r
25 #define ADD_CYCLES(A) CPU->ICount += (A);
\r
27 #define RET(A) { USE_CYCLES(A) goto Cz80_Exec; }
\r
29 #if CZ80_ENCRYPTED_ROM
\r
32 CPU->BasePC = CPU->Fetch[(A) >> CZ80_FETCH_SFT]; \
\r
33 OPBase = CPU->OPFetch[(A) >> CZ80_FETCH_SFT]; \
\r
34 PC = (A) + CPU->BasePC;
\r
36 #define GET_OP() (*(UINT8 *)(OPBase + PC))
\r
41 CPU->BasePC = CPU->Fetch[(A) >> CZ80_FETCH_SFT]; \
\r
42 PC = (A) + CPU->BasePC;
\r
44 #define GET_OP() (*(UINT8 *)PC)
\r
48 #define READ_OP() GET_OP(); PC++
\r
50 #define READ_ARG() (*(UINT8 *)PC++)
\r
51 #if CZ80_LITTLE_ENDIAN
\r
52 #define READ_ARG16() (*(UINT8 *)PC | (*(UINT8 *)(PC + 1) << 8)); PC += 2
\r
54 #define READ_ARG16() (*(UINT8 *)(PC + 1) | (*(UINT8 *)PC << 8)); PC += 2
\r
57 //#ifndef BUILD_CPS1PSP
\r
58 //#define READ_MEM8(A) memory_region_cpu2[(A)]
\r
61 #define READ_MEM8(A) picodrive_read(A)
\r
63 #define READ_MEM8(A) CPU->Read_Byte(A)
\r
66 #if CZ80_LITTLE_ENDIAN
\r
67 #define READ_MEM16(A) (READ_MEM8(A) | (READ_MEM8((A) + 1) << 8))
\r
69 #define READ_MEM16(A) ((READ_MEM8(A) << 8) | READ_MEM8((A) + 1))
\r
73 #define WRITE_MEM8(A, D) { \
\r
74 unsigned short a = A; \
\r
75 unsigned char d = D; \
\r
76 if (a < 0x4000) Pico.zram[a&0x1fff] = d; \
\r
77 else z80_write(a, d); \
\r
80 #define WRITE_MEM8(A, D) CPU->Write_Byte(A, D);
\r
82 #if CZ80_LITTLE_ENDIAN
\r
83 #define WRITE_MEM16(A, D) { WRITE_MEM8(A, D); WRITE_MEM8((A) + 1, (D) >> 8); }
\r
85 #define WRITE_MEM16(A, D) { WRITE_MEM8((A) + 1, D); WRITE_MEM8(A, (D) >> 8); }
\r
88 #define PUSH_16(A) { UINT32 sp; zSP -= 2; sp = zSP; WRITE_MEM16(sp, A); }
\r
89 #define POP_16(A) { UINT32 sp; sp = zSP; A = READ_MEM16(sp); zSP = sp + 2; }
\r
91 #define IN(A) CPU->IN_Port(A)
\r
92 #define OUT(A, D) CPU->OUT_Port(A, D)
\r
99 if (CPU->IRQState == HOLD_LINE) \
\r
100 CPU->IRQState = CLEAR_LINE; \
\r
102 CPU->HaltState = 0; \
\r
103 zIFF1 = zIFF2 = 0; \
\r
104 IntVect = CPU->Interrupt_Callback(CPU->IRQLine); \
\r
110 IntVect = (IntVect & 0xff) | (zI << 8); \
\r
111 PC = READ_MEM16(IntVect); \
\r
112 CPU->ExtraCycles += 17; \
\r
114 else if (zIM == 1) \
\r
117 CPU->ExtraCycles += 13; \
\r
121 PC = IntVect & 0x38; \
\r
122 CPU->ExtraCycles += 13; \
\r