diff options
Diffstat (limited to 'z80_private.h')
-rw-r--r-- | z80_private.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/z80_private.h b/z80_private.h index ae0ec8c..26adbbb 100644 --- a/z80_private.h +++ b/z80_private.h @@ -60,10 +60,10 @@ struct Z80 Z80Reg DE; Z80Reg HL; - Z80Reg AF_; - Z80Reg BC_; - Z80Reg DE_; - Z80Reg HL_; + Z80Word AF_; + Z80Word BC_; + Z80Word DE_; + Z80Word HL_; Z80Reg IX; Z80Reg IY; @@ -77,9 +77,6 @@ struct Z80 Z80Byte R; int halt; - int use_cb_off; - Z80Relative cb_off; - Z80Byte shift; int raise; @@ -145,7 +142,7 @@ struct Z80 #define CLRFLAG(f) CLR(cpu->AF.b[LO],f) #define PEEK(addr) (cpu->memory[addr]) -#define PEEKW(addr) (PEEK(addr) | (Z80Word)PEEK(addr+1)<<8) +#define PEEKW(addr) FPEEKW(cpu,addr) #define POKE(addr,val) do \ { \ @@ -157,8 +154,9 @@ struct Z80 #define POKEW(addr,val) do \ { \ Z80Word once=val; \ - POKE(addr,once); \ - POKE(addr+1,once>>8); \ + Z80Word once_addr=addr; \ + POKE(once_addr,once); \ + POKE(once_addr+1,once>>8); \ } while(0) #define FETCH_BYTE (cpu->memory[cpu->PC++]) @@ -175,6 +173,9 @@ struct Z80 #define CARRY IS_C +#define IS_IX_IY (cpu->shift==0xdd || cpu->shift==0xfd) +#define OFFSET(off) off=(IS_IX_IY ? (Z80Relative)FETCH_BYTE:0) + #define TSTATE(n) cpu->cycle+=n #define ADD_R(v) cpu->R=((cpu->R&0x80)|((cpu->R+(v))&0x7f)) @@ -205,11 +206,14 @@ struct Z80 #define JR cpu->PC+=(Z80Relative)PEEK(cpu->PC)+1 #define NOJR cpu->PC++ -#define IN(PORT) (cpu->pread ? cpu->pread(cpu,PORT) : 0) -#define OUT(PORT,VAL) if (cpu->pwrite) \ +#define OUT(P,V) do \ { \ - cpu->pwrite(cpu,PORT,VAL); \ - } + if (cpu->pwrite) \ + cpu->pwrite(cpu,P,V); \ + } while(0) + +#define IN(P) (cpu->pread?cpu->pread(cpu,P):0) + /* ---------------------------------------- FLAG TABLES |