diff options
author | Ian C <ianc@noddybox.co.uk> | 2021-08-20 21:32:55 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2021-08-20 21:32:55 +0000 |
commit | 40121879f3dfaedce310fbc543589ff6aab3a398 (patch) | |
tree | b35afaf9a528a58703e24f4085587357c623e7f6 /z80_decode.c | |
parent | 66d4bb423e981aece8c5590eb2a5968a5d874c9f (diff) |
Updated with latest Z80 core from 3dsspec
Diffstat (limited to 'z80_decode.c')
-rw-r--r-- | z80_decode.c | 544 |
1 files changed, 262 insertions, 282 deletions
diff --git a/z80_decode.c b/z80_decode.c index a8f66ca..c642783 100644 --- a/z80_decode.c +++ b/z80_decode.c @@ -2,11 +2,11 @@ z80 - Z80 Emulator - Copyright (C) 2006 Ian Cowburn <ianc@noddybox.co.uk> + Copyright (C) 2021 Ian Cowburn <ianc@noddybox.co.uk> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + along with this program; if not, see <http://www.gnu.org/licenses/> ------------------------------------------------------------------------- @@ -29,8 +28,6 @@ #include "z80.h" #include "z80_private.h" -static const char ident[]="$Id$"; - /* ---------------------------------------- TABLES AND INIT */ static Z80Byte PSZtable[512]; @@ -39,13 +36,6 @@ static Z80Byte Ptable[512]; static Z80Byte Stable[512]; static Z80Byte Ztable[512]; - -int Z80_HI_WORD; -int Z80_LO_WORD; - -#define HI Z80_HI_WORD -#define LO Z80_LO_WORD - /* ---------------------------------------- MISC FUNCTIONS */ void Z80_InitialiseInternals(void) @@ -57,17 +47,7 @@ void Z80_InitialiseInternals(void) */ r.w=0x1234; - if (r.b[0] == 0x12) - { - HI=0; - LO=1; - } - else if (r.b[1] == 0x12) - { - HI=1; - LO=0; - } - else + if (r.b.hi != 0x12 || r.b.lo != 0x34) { exit(1); } @@ -153,12 +133,12 @@ do { \ do { \ Z80Byte VAL=ONCE; \ unsigned w; \ - w=cpu->AF.b[HI]+(unsigned)VAL; \ - cpu->AF.b[LO]=SZtable[w]; \ - if ((cpu->AF.b[HI]^w^VAL)&H_Z80) cpu->AF.b[LO]|=H_Z80; \ - if ((VAL^cpu->AF.b[HI]^0x80)&(VAL^w)&0x80) cpu->AF.b[LO]|=P_Z80; \ + w=cpu->AF.b.hi+(unsigned)VAL; \ + cpu->AF.b.lo=SZtable[w]; \ + if ((cpu->AF.b.hi^w^VAL)&H_Z80) cpu->AF.b.lo|=H_Z80; \ + if ((VAL^cpu->AF.b.hi^0x80)&(VAL^w)&0x80) cpu->AF.b.lo|=P_Z80; \ SETHIDDEN(w); \ - cpu->AF.b[HI]=w; \ + cpu->AF.b.hi=w; \ } while(0) @@ -166,12 +146,12 @@ do { \ do { \ Z80Byte VAL=ONCE; \ unsigned w; \ - w=(cpu->AF.b[HI]+(unsigned)VAL+CARRY)&0x1ff; \ - cpu->AF.b[LO]=SZtable[w]; \ - if ((cpu->AF.b[HI]^w^VAL)&H_Z80) cpu->AF.b[LO]|=H_Z80; \ - if ((VAL^cpu->AF.b[HI]^0x80)&(VAL^w)&0x80) cpu->AF.b[LO]|=P_Z80; \ + w=(cpu->AF.b.hi+(unsigned)VAL+CARRY)&0x1ff; \ + cpu->AF.b.lo=SZtable[w]; \ + if ((cpu->AF.b.hi^w^VAL)&H_Z80) cpu->AF.b.lo|=H_Z80; \ + if ((VAL^cpu->AF.b.hi^0x80)&(VAL^w)&0x80) cpu->AF.b.lo|=P_Z80; \ SETHIDDEN(w); \ - cpu->AF.b[HI]=w; \ + cpu->AF.b.hi=w; \ } while(0) @@ -179,12 +159,12 @@ do { \ do { \ Z80Byte VAL=ONCE; \ unsigned w; \ - w=(cpu->AF.b[HI]-(unsigned)VAL)&0x1ff; \ - cpu->AF.b[LO]=SZtable[w]|N_Z80; \ - if ((cpu->AF.b[HI]^w^VAL)&H_Z80) cpu->AF.b[LO]|=H_Z80; \ - if ((VAL^cpu->AF.b[HI])&(cpu->AF.b[HI]^w)&0x80) cpu->AF.b[LO]|=P_Z80; \ + w=(cpu->AF.b.hi-(unsigned)VAL)&0x1ff; \ + cpu->AF.b.lo=SZtable[w]|N_Z80; \ + if ((cpu->AF.b.hi^w^VAL)&H_Z80) cpu->AF.b.lo|=H_Z80; \ + if ((VAL^cpu->AF.b.hi)&(cpu->AF.b.hi^w)&0x80) cpu->AF.b.lo|=P_Z80; \ SETHIDDEN(w); \ - cpu->AF.b[HI]=w; \ + cpu->AF.b.hi=w; \ } while(0) @@ -192,10 +172,10 @@ do { \ do { \ Z80Byte VAL=ONCE; \ unsigned w; \ - w=(cpu->AF.b[HI]-(unsigned)VAL)&0x1ff; \ - cpu->AF.b[LO]=SZtable[w]|N_Z80; \ - if ((cpu->AF.b[HI]^w^VAL)&H_Z80) cpu->AF.b[LO]|=H_Z80; \ - if ((VAL^cpu->AF.b[HI])&(cpu->AF.b[HI]^w)&0x80) cpu->AF.b[LO]|=P_Z80; \ + w=(cpu->AF.b.hi-(unsigned)VAL)&0x1ff; \ + cpu->AF.b.lo=SZtable[w]|N_Z80; \ + if ((cpu->AF.b.hi^w^VAL)&H_Z80) cpu->AF.b.lo|=H_Z80; \ + if ((VAL^cpu->AF.b.hi)&(cpu->AF.b.hi^w)&0x80) cpu->AF.b.lo|=P_Z80; \ SETHIDDEN(VAL); \ } while(0) @@ -204,12 +184,12 @@ do { \ do { \ Z80Byte VAL=ONCE; \ unsigned w; \ - w=(cpu->AF.b[HI]-(unsigned)VAL-CARRY)&0x1ff; \ - cpu->AF.b[LO]=SZtable[w]|N_Z80; \ - if ((cpu->AF.b[HI]^w^VAL)&H_Z80) cpu->AF.b[LO]|=H_Z80; \ - if ((VAL^cpu->AF.b[HI])&(cpu->AF.b[HI]^w)&0x80) cpu->AF.b[LO]|=P_Z80; \ + w=(cpu->AF.b.hi-(unsigned)VAL-CARRY)&0x1ff; \ + cpu->AF.b.lo=SZtable[w]|N_Z80; \ + if ((cpu->AF.b.hi^w^VAL)&H_Z80) cpu->AF.b.lo|=H_Z80; \ + if ((VAL^cpu->AF.b.hi)&(cpu->AF.b.hi^w)&0x80) cpu->AF.b.lo|=P_Z80; \ SETHIDDEN(w); \ - cpu->AF.b[HI]=w; \ + cpu->AF.b.hi=w; \ } while(0) @@ -218,9 +198,9 @@ do { \ Z80Word VAL=ONCE; \ Z80Val w; \ w=(REG)+(Z80Val)VAL; \ - cpu->AF.b[LO]&=(S_Z80|Z_Z80|V_Z80); \ - if (w>0xffff) cpu->AF.b[LO]|=C_Z80; \ - if (((REG)^w^VAL)&0x1000) cpu->AF.b[LO]|=H_Z80; \ + cpu->AF.b.lo&=(S_Z80|Z_Z80|V_Z80); \ + if (w>0xffff) cpu->AF.b.lo|=C_Z80; \ + if (((REG)^w^VAL)&0x1000) cpu->AF.b.lo|=H_Z80; \ SETHIDDEN(w>>8); \ (REG)=w; \ } while(0) @@ -231,12 +211,12 @@ do { \ Z80Word VAL=ONCE; \ Z80Val w; \ w=(REG)+(Z80Val)VAL+CARRY; \ - cpu->AF.b[LO]=0; \ - if ((w&0xffff)==0) cpu->AF.b[LO]=Z_Z80; \ - if (w&0x8000) cpu->AF.b[LO]|=S_Z80; \ - if (w>0xffff) cpu->AF.b[LO]|=C_Z80; \ - if ((VAL^(REG)^0x8000)&((REG)^w)&0x8000) cpu->AF.b[LO]|=P_Z80; \ - if (((REG)^w^VAL)&0x1000) cpu->AF.b[LO]|=H_Z80; \ + cpu->AF.b.lo=0; \ + if ((w&0xffff)==0) cpu->AF.b.lo=Z_Z80; \ + if (w&0x8000) cpu->AF.b.lo|=S_Z80; \ + if (w>0xffff) cpu->AF.b.lo|=C_Z80; \ + if ((VAL^(REG)^0x8000)&((REG)^w)&0x8000) cpu->AF.b.lo|=P_Z80; \ + if (((REG)^w^VAL)&0x1000) cpu->AF.b.lo|=H_Z80; \ SETHIDDEN(w>>8); \ (REG)=w; \ } while(0) @@ -247,12 +227,12 @@ do { \ Z80Word VAL=ONCE; \ Z80Val w; \ w=(REG)-(Z80Val)VAL-CARRY; \ - cpu->AF.b[LO]=N_Z80; \ - if (w&0x8000) cpu->AF.b[LO]|=S_Z80; \ - if ((w&0xffff)==0) cpu->AF.b[LO]|=Z_Z80; \ - if (w>0xffff) cpu->AF.b[LO]|=C_Z80; \ - if ((VAL^(REG))&((REG)^w)&0x8000) cpu->AF.b[LO]|=P_Z80; \ - if (((REG)^w^VAL)&0x1000) cpu->AF.b[LO]|=H_Z80; \ + cpu->AF.b.lo=N_Z80; \ + if (w&0x8000) cpu->AF.b.lo|=S_Z80; \ + if ((w&0xffff)==0) cpu->AF.b.lo|=Z_Z80; \ + if (w>0xffff) cpu->AF.b.lo|=C_Z80; \ + if ((VAL^(REG))&((REG)^w)&0x8000) cpu->AF.b.lo|=P_Z80; \ + if (((REG)^w^VAL)&0x1000) cpu->AF.b.lo|=H_Z80; \ SETHIDDEN(w>>8); \ (REG)=w; \ } while(0) @@ -261,19 +241,19 @@ do { \ #define INC8(REG) \ do { \ (REG)++; \ - cpu->AF.b[LO]=CARRY|SZtable[(REG)]; \ - if ((REG)==0x80) cpu->AF.b[LO]|=P_Z80; \ - if (((REG)&0x0f)==0) cpu->AF.b[LO]|=H_Z80; \ + cpu->AF.b.lo=CARRY|SZtable[(REG)]; \ + if ((REG)==0x80) cpu->AF.b.lo|=P_Z80; \ + if (((REG)&0x0f)==0) cpu->AF.b.lo|=H_Z80; \ } while(0) #define DEC8(REG) \ do { \ (REG)--; \ - cpu->AF.b[LO]=N_Z80|CARRY; \ - if ((REG)==0x7f) cpu->AF.b[LO]|=P_Z80; \ - if (((REG)&0x0f)==0x0f) cpu->AF.b[LO]|=H_Z80; \ - cpu->AF.b[LO]|=SZtable[(REG)]; \ + cpu->AF.b.lo=N_Z80|CARRY; \ + if ((REG)==0x7f) cpu->AF.b.lo|=P_Z80; \ + if (((REG)&0x0f)==0x0f) cpu->AF.b.lo|=H_Z80; \ + cpu->AF.b.lo|=SZtable[(REG)]; \ } while(0) @@ -315,9 +295,9 @@ do { \ */ #define RRCA \ do { \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]&C_Z80); \ - cpu->AF.b[HI]=(cpu->AF.b[HI]>>1)|(cpu->AF.b[HI]<<7); \ - SETHIDDEN(cpu->AF.b[HI]); \ + cpu->AF.b.lo=(cpu->AF.b.lo&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b.hi&C_Z80); \ + cpu->AF.b.hi=(cpu->AF.b.hi>>1)|(cpu->AF.b.hi<<7); \ + SETHIDDEN(cpu->AF.b.hi); \ } while(0) @@ -325,9 +305,9 @@ do { \ do { \ Z80Byte c; \ c=CARRY; \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]&C_Z80); \ - cpu->AF.b[HI]=(cpu->AF.b[HI]>>1)|(c<<7); \ - SETHIDDEN(cpu->AF.b[HI]); \ + cpu->AF.b.lo=(cpu->AF.b.lo&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b.hi&C_Z80); \ + cpu->AF.b.hi=(cpu->AF.b.hi>>1)|(c<<7); \ + SETHIDDEN(cpu->AF.b.hi); \ } while(0) @@ -336,7 +316,7 @@ do { \ Z80Byte c; \ c=(REG)&C_Z80; \ (REG)=((REG)>>1)|((REG)<<7); \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) @@ -346,16 +326,16 @@ do { \ Z80Byte c; \ c=(REG)&C_Z80; \ (REG)=((REG)>>1)|(CARRY<<7); \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) #define RLCA \ do { \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]>>7); \ - cpu->AF.b[HI]=(cpu->AF.b[HI]<<1)|(cpu->AF.b[HI]>>7); \ - SETHIDDEN(cpu->AF.b[HI]); \ + cpu->AF.b.lo=(cpu->AF.b.lo&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b.hi>>7); \ + cpu->AF.b.hi=(cpu->AF.b.hi<<1)|(cpu->AF.b.hi>>7); \ + SETHIDDEN(cpu->AF.b.hi); \ } while(0) @@ -363,9 +343,9 @@ do { \ do { \ Z80Byte c; \ c=CARRY; \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]>>7); \ - cpu->AF.b[HI]=(cpu->AF.b[HI]<<1)|c; \ - SETHIDDEN(cpu->AF.b[HI]); \ + cpu->AF.b.lo=(cpu->AF.b.lo&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b.hi>>7); \ + cpu->AF.b.hi=(cpu->AF.b.hi<<1)|c; \ + SETHIDDEN(cpu->AF.b.hi); \ } while(0) @@ -374,7 +354,7 @@ do { \ Z80Byte c; \ c=(REG)>>7; \ (REG)=((REG)<<1)|c; \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) @@ -384,7 +364,7 @@ do { \ Z80Byte c; \ c=(REG)>>7; \ (REG)=((REG)<<1)|CARRY; \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) @@ -394,7 +374,7 @@ do { \ Z80Byte c; \ c=(REG)&C_Z80; \ (REG)>>=1; \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) @@ -404,7 +384,7 @@ do { \ Z80Byte c; \ c=(REG)&C_Z80; \ (REG)=((REG)>>1)|((REG)&0x80); \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) @@ -414,7 +394,7 @@ do { \ Z80Byte c; \ c=(REG)>>7; \ (REG)=((REG)<<1)|1; \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) @@ -424,7 +404,7 @@ do { \ Z80Byte c; \ c=(REG)>>7; \ (REG)=(REG)<<1; \ - cpu->AF.b[LO]=PSZtable[(REG)]|c; \ + cpu->AF.b.lo=PSZtable[(REG)]|c; \ SETHIDDEN(REG); \ } while(0) @@ -433,41 +413,41 @@ do { \ */ #define AND(VAL) \ do { \ - cpu->AF.b[HI]&=VAL; \ - cpu->AF.b[LO]=PSZtable[cpu->AF.b[HI]]|H_Z80; \ - SETHIDDEN(cpu->AF.b[HI]); \ + cpu->AF.b.hi&=VAL; \ + cpu->AF.b.lo=PSZtable[cpu->AF.b.hi]|H_Z80; \ + SETHIDDEN(cpu->AF.b.hi); \ } while(0) #define OR(VAL) \ do { \ - cpu->AF.b[HI]|=VAL; \ - cpu->AF.b[LO]=PSZtable[cpu->AF.b[HI]]; \ - SETHIDDEN(cpu->AF.b[HI]); \ + cpu->AF.b.hi|=VAL; \ + cpu->AF.b.lo=PSZtable[cpu->AF.b.hi]; \ + SETHIDDEN(cpu->AF.b.hi); \ } while(0) #define XOR(VAL) \ do { \ - cpu->AF.b[HI]^=VAL; \ - cpu->AF.b[LO]=PSZtable[cpu->AF.b[HI]]; \ - SETHIDDEN(cpu->AF.b[HI]); \ + cpu->AF.b.hi^=VAL; \ + cpu->AF.b.lo=PSZtable[cpu->AF.b.hi]; \ + SETHIDDEN(cpu->AF.b.hi); \ } while(0) #define BIT(REG,B) \ do { \ - cpu->AF.b[LO]=CARRY|H_Z80; \ + cpu->AF.b.lo=CARRY|H_Z80; \ if ((REG)&(1<<B)) \ { \ - if (B==7 && (REG&S_Z80)) cpu->AF.b[LO]|=S_Z80; \ - if (B==5 && (REG&B5_Z80)) cpu->AF.b[LO]|=B5_Z80; \ - if (B==3 && (REG&B3_Z80)) cpu->AF.b[LO]|=B3_Z80; \ + if (B==7 && (REG&S_Z80)) cpu->AF.b.lo|=S_Z80; \ + if (B==5 && (REG&B5_Z80)) cpu->AF.b.lo|=B5_Z80; \ + if (B==3 && (REG&B3_Z80)) cpu->AF.b.lo|=B3_Z80; \ } \ else \ { \ - cpu->AF.b[LO]|=Z_Z80; \ - cpu->AF.b[LO]|=P_Z80; \ + cpu->AF.b.lo|=Z_Z80; \ + cpu->AF.b.lo|=P_Z80; \ } \ } while(0) @@ -560,7 +540,7 @@ do { \ else \ CLRFLAG(P_Z80); \ \ - SETHIDDEN(cpu->AF.b[HI]+b); \ + SETHIDDEN(cpu->AF.b.hi+b); \ } while(0) #define LDD \ @@ -581,7 +561,7 @@ do { \ else \ CLRFLAG(P_Z80); \ \ - SETHIDDEN(cpu->AF.b[HI]+b); \ + SETHIDDEN(cpu->AF.b.hi+b); \ } while(0) #define CPI \ @@ -638,13 +618,13 @@ do { \ b=IN(cpu->BC.w); \ POKE(cpu->HL.w,b); \ \ - cpu->BC.b[HI]--; \ + cpu->BC.b.hi--; \ cpu->HL.w++; \ \ - cpu->AF.b[LO]=SZtable[cpu->BC.b[HI]]; \ - SETHIDDEN(cpu->BC.b[HI]); \ + cpu->AF.b.lo=SZtable[cpu->BC.b.hi]; \ + SETHIDDEN(cpu->BC.b.hi); \ \ - w=(((Z80Word)cpu->BC.b[LO])&0xff)+b; \ + w=(((Z80Word)cpu->BC.b.lo)&0xff)+b; \ \ if (b&0x80) \ SETFLAG(N_Z80); \ @@ -669,13 +649,13 @@ do { \ b=IN(cpu->BC.w); \ POKE(cpu->HL.w,b); \ \ - cpu->BC.b[HI]--; \ + cpu->BC.b.hi--; \ cpu->HL.w--; \ \ - cpu->AF.b[LO]=SZtable[cpu->BC.b[HI]]; \ - SETHIDDEN(cpu->BC.b[HI]); \ + cpu->AF.b.lo=SZtable[cpu->BC.b.hi]; \ + SETHIDDEN(cpu->BC.b.hi); \ \ - w=(((Z80Word)cpu->BC.b[LO])&0xff)+b; \ + w=(((Z80Word)cpu->BC.b.lo)&0xff)+b; \ \ if (b&0x80) \ SETFLAG(N_Z80); \ @@ -697,10 +677,10 @@ do { \ OUT(cpu->BC.w,PEEK(cpu->HL.w)); \ \ cpu->HL.w++; \ - cpu->BC.b[HI]--; \ + cpu->BC.b.hi--; \ \ - cpu->AF.b[LO]=SZtable[cpu->BC.b[HI]]; \ - SETHIDDEN(cpu->BC.b[HI]); \ + cpu->AF.b.lo=SZtable[cpu->BC.b.hi]; \ + SETHIDDEN(cpu->BC.b.hi); \ } while(0) #define OUTD \ @@ -708,11 +688,11 @@ do { \ OUT(cpu->BC.w,PEEK(cpu->HL.w)); \ \ cpu->HL.w--; \ - cpu->BC.b[HI]--; \ + cpu->BC.b.hi--; \ \ - cpu->AF.b[LO]=SZtable[cpu->BC.b[HI]]; \ + cpu->AF.b.lo=SZtable[cpu->BC.b.hi]; \ SETFLAG(N_Z80); \ - SETHIDDEN(cpu->BC.b[HI]); \ + SETHIDDEN(cpu->BC.b.hi); \ } while(0) @@ -722,22 +702,22 @@ do { \ #define LD_BLOCK(BASE,DEST,DEST2) \ case BASE: /* LD DEST,B */ \ TSTATE(4); \ - DEST=cpu->BC.b[HI]; \ + DEST=cpu->BC.b.hi; \ break; \ \ case BASE+1: /* LD DEST,C */ \ TSTATE(4); \ - DEST=cpu->BC.b[LO]; \ + DEST=cpu->BC.b.lo; \ break; \ \ case BASE+2: /* LD DEST,D */ \ TSTATE(4); \ - DEST=cpu->DE.b[HI]; \ + DEST=cpu->DE.b.hi; \ break; \ \ case BASE+3: /* LD DEST,E */ \ TSTATE(4); \ - DEST=cpu->DE.b[LO]; \ + DEST=cpu->DE.b.lo; \ break; \ \ case BASE+4: /* LD DEST,H */ \ @@ -758,28 +738,28 @@ do { \ \ case BASE+7: /* LD DEST,A */ \ TSTATE(4); \ - DEST=cpu->AF.b[HI]; \ + DEST=cpu->AF.b.hi; \ break; #define ALU_BLOCK(BASE,OP) \ case BASE: /* OP A,B */ \ TSTATE(4); \ - OP(cpu->BC.b[HI]); \ + OP(cpu->BC.b.hi); \ break; \ \ case BASE+1: /* OP A,C */ \ TSTATE(4); \ - OP(cpu->BC.b[LO]); \ + OP(cpu->BC.b.lo); \ break; \ \ case BASE+2: /* OP A,D */ \ TSTATE(4); \ - OP(cpu->DE.b[HI]); \ + OP(cpu->DE.b.hi); \ break; \ \ case BASE+3: /* OP A,E */ \ TSTATE(4); \ - OP(cpu->DE.b[LO]); \ + OP(cpu->DE.b.lo); \ break; \ \ case BASE+4: /* OP A,H */ \ @@ -800,7 +780,7 @@ do { \ \ case BASE+7: /* OP A,A */ \ TSTATE(4); \ - OP(cpu->AF.b[HI]); \ + OP(cpu->AF.b.hi); \ break; @@ -810,32 +790,32 @@ do { \ #define CB_ALU_BLOCK(BASE,OP) \ case BASE: /* OP B */ \ TSTATE(8); \ - OP(cpu->BC.b[HI]); \ + OP(cpu->BC.b.hi); \ break; \ \ case BASE+1: /* OP C */ \ TSTATE(8); \ - OP(cpu->BC.b[LO]); \ + OP(cpu->BC.b.lo); \ break; \ \ case BASE+2: /* OP D */ \ TSTATE(8); \ - OP(cpu->DE.b[HI]); \ + OP(cpu->DE.b.hi); \ break; \ \ case BASE+3: /* OP E */ \ TSTATE(8); \ - OP(cpu->DE.b[LO]); \ + OP(cpu->DE.b.lo); \ break; \ \ case BASE+4: /* OP H */ \ TSTATE(8); \ - OP(cpu->HL.b[HI]); \ + OP(cpu->HL.b.hi); \ break; \ \ case BASE+5: /* OP L */ \ TSTATE(8); \ - OP(cpu->HL.b[LO]); \ + OP(cpu->HL.b.lo); \ break; \ \ case BASE+6: /* OP (HL) */ \ @@ -845,38 +825,38 @@ do { \ \ case BASE+7: /* OP A */ \ TSTATE(8); \ - OP(cpu->AF.b[HI]); \ + OP(cpu->AF.b.hi); \ break; #define CB_BITMANIP_BLOCK(BASE,OP,BIT_NO) \ case BASE: /* OP B */ \ TSTATE(8); \ - OP(cpu->BC.b[HI],BIT_NO); \ + OP(cpu->BC.b.hi,BIT_NO); \ break; \ \ case BASE+1: /* OP C */ \ TSTATE(8); \ - OP(cpu->BC.b[LO],BIT_NO); \ + OP(cpu->BC.b.lo,BIT_NO); \ break; \ \ case BASE+2: /* OP D */ \ TSTATE(8); \ - OP(cpu->DE.b[HI],BIT_NO); \ + OP(cpu->DE.b.hi,BIT_NO); \ break; \ \ case BASE+3: /* OP E */ \ TSTATE(8); \ - OP(cpu->DE.b[LO],BIT_NO); \ + OP(cpu->DE.b.lo,BIT_NO); \ break; \ \ case BASE+4: /* OP H */ \ TSTATE(8); \ - OP(cpu->HL.b[HI],BIT_NO); \ + OP(cpu->HL.b.hi,BIT_NO); \ break; \ \ case BASE+5: /* OP L */ \ TSTATE(8); \ - OP(cpu->HL.b[LO],BIT_NO); \ + OP(cpu->HL.b.lo,BIT_NO); \ break; \ \ case BASE+6: /* OP (HL) */ \ @@ -886,7 +866,7 @@ do { \ \ case BASE+7: /* OP A */ \ TSTATE(8); \ - OP(cpu->AF.b[HI],BIT_NO); \ + OP(cpu->AF.b.hi,BIT_NO); \ break; /* ---------------------------------------- SHIFTED CB OPCODE SHORT-HAND BLOCKS @@ -895,32 +875,32 @@ do { \ #define SHIFTED_CB_ALU_BLOCK(BASE,OP) \ case BASE: /* OP B */ \ TSTATE(8); \ - OP_ON_MEM_WITH_COPY(OP,addr,cpu->BC.b[HI]); \ + OP_ON_MEM_WITH_COPY(OP,addr,cpu->BC.b.hi); \ break; \ \ case BASE+1: /* OP C */ \ TSTATE(8); \ - OP_ON_MEM_WITH_COPY(OP,addr,cpu->BC.b[LO]); \ + OP_ON_MEM_WITH_COPY(OP,addr,cpu->BC.b.lo); \ break; \ \ case BASE+2: /* OP D */ \ TSTATE(8); \ - OP_ON_MEM_WITH_COPY(OP,addr,cpu->DE.b[HI]); \ + OP_ON_MEM_WITH_COPY(OP,addr,cpu->DE.b.hi); \ break; \ \ case BASE+3: /* OP E */ \ TSTATE(8); \ - OP_ON_MEM_WITH_COPY(OP,addr,cpu->DE.b[LO]); \ + OP_ON_MEM_WITH_COPY(OP,addr,cpu->DE.b.lo); \ break; \ \ case BASE+4: /* OP H */ \ TSTATE(8); \ - OP_ON_MEM_WITH_COPY(OP,addr,cpu->HL.b[HI]); \ + OP_ON_MEM_WITH_COPY(OP,addr,cpu->HL.b.hi); \ break; \ \ case BASE+5: /* OP L */ \ TSTATE(8); \ - OP_ON_MEM_WITH_COPY(OP,addr,cpu->HL.b[LO]); \ + OP_ON_MEM_WITH_COPY(OP,addr,cpu->HL.b.lo); \ break; \ \ case BASE+6: /* OP (HL) */ \ @@ -930,38 +910,38 @@ do { \ \ case BASE+7: /* OP A */ \ TSTATE(8); \ - OP_ON_MEM_WITH_COPY(OP,addr,cpu->AF.b[HI]); \ + OP_ON_MEM_WITH_COPY(OP,addr,cpu->AF.b.hi); \ break; #define SHIFTED_CB_BITMANIP_BLOCK(BASE,OP,BIT_NO) \ case BASE: /* OP B */ \ TSTATE(8); \ - OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->BC.b[HI]); \ + OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->BC.b.hi); \ break; \ \ case BASE+1: /* OP C */ \ TSTATE(8); \ - OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->BC.b[LO]); \ + OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->BC.b.lo); \ break; \ \ case BASE+2: /* OP D */ \ TSTATE(8); \ - OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->DE.b[HI]); \ + OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->DE.b.hi); \ break; \ \ case BASE+3: /* OP E */ \ TSTATE(8); \ - OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->DE.b[LO]); \ + OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->DE.b.lo); \ break; \ \ case BASE+4: /* OP H */ \ TSTATE(8); \ - OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->HL.b[HI]); \ + OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->HL.b.hi); \ break; \ \ case BASE+5: /* OP L */ \ TSTATE(8); \ - OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->HL.b[LO]); \ + OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->HL.b.lo); \ break; \ \ case BASE+6: /* OP (HL) */ \ @@ -971,7 +951,7 @@ do { \ \ case BASE+7: /* OP A */ \ TSTATE(8); \ - OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->AF.b[HI]); \ + OP_ON_MEM_WITH_ARG_AND_COPY(OP,addr,BIT_NO,cpu->AF.b.hi); \ break; /* ---------------------------------------- DAA @@ -984,8 +964,8 @@ static void DAA (Z80 *cpu) { Z80Byte add=0; Z80Byte carry=0; - Z80Byte nf=cpu->AF.b[LO]&N_Z80; - Z80Byte acc=cpu->AF.b[HI]; + Z80Byte nf=cpu->AF.b.lo&N_Z80; + Z80Byte acc=cpu->AF.b.hi; if (acc>0x99 || IS_C) { @@ -1000,18 +980,18 @@ static void DAA (Z80 *cpu) if (nf) { - cpu->AF.b[HI]-=add; + cpu->AF.b.hi-=add; } else { - cpu->AF.b[HI]+=add; + cpu->AF.b.hi+=add; } - cpu->AF.b[LO]=PSZtable[cpu->AF.b[HI]] + cpu->AF.b.lo=PSZtable[cpu->AF.b.hi] | carry | nf - | ((acc^cpu->AF.b[HI])&H_Z80) - | (cpu->AF.b[HI]&(B3_Z80|B5_Z80)); + | ((acc^cpu->AF.b.hi)&H_Z80) + | (cpu->AF.b.hi&(B3_Z80|B5_Z80)); } /* ---------------------------------------- HANDLERS FOR ED OPCODES @@ -1025,20 +1005,20 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) if (PRIV->pread) { - cpu->BC.b[HI]=PRIV->pread(cpu,cpu->BC.w); + cpu->BC.b.hi=PRIV->pread(cpu,cpu->BC.w); } else { - cpu->BC.b[HI]=0; + cpu->BC.b.hi=0; } - cpu->AF.b[LO]=CARRY|PSZtable[cpu->BC.b[HI]]; - SETHIDDEN(cpu->BC.b[HI]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->BC.b.hi]; + SETHIDDEN(cpu->BC.b.hi); break; case 0x41: /* OUT (C),B */ TSTATE(12); - if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->BC.b[HI]); + if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->BC.b.hi); break; case 0x42: /* SBC HL,BC */ @@ -1057,8 +1037,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1076,7 +1056,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) case 0x47: /* LD I,A */ TSTATE(9); - cpu->I=cpu->AF.b[HI]; + cpu->I=cpu->AF.b.hi; break; case 0x48: /* IN C,(C) */ @@ -1084,20 +1064,20 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) if (PRIV->pread) { - cpu->BC.b[LO]=PRIV->pread(cpu,cpu->BC.w); + cpu->BC.b.lo=PRIV->pread(cpu,cpu->BC.w); } else { - cpu->BC.b[LO]=0; + cpu->BC.b.lo=0; } - cpu->AF.b[LO]=CARRY|PSZtable[cpu->BC.b[LO]]; - SETHIDDEN(cpu->BC.b[LO]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->BC.b.lo]; + SETHIDDEN(cpu->BC.b.lo); break; case 0x49: /* OUT (C),C */ TSTATE(12); - if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->BC.b[LO]); + if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->BC.b.lo); break; case 0x4a: /* ADC HL,BC */ @@ -1116,8 +1096,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1136,7 +1116,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) case 0x4f: /* LD R,A */ TSTATE(9); - cpu->R=cpu->AF.b[HI]; + cpu->R=cpu->AF.b.hi; break; case 0x50: /* IN D,(C) */ @@ -1144,20 +1124,20 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) if (PRIV->pread) { - cpu->DE.b[HI]=PRIV->pread(cpu,cpu->BC.w); + cpu->DE.b.hi=PRIV->pread(cpu,cpu->BC.w); } else { - cpu->DE.b[HI]=0; + cpu->DE.b.hi=0; } - cpu->AF.b[LO]=CARRY|PSZtable[cpu->DE.b[HI]]; - SETHIDDEN(cpu->BC.b[HI]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->DE.b.hi]; + SETHIDDEN(cpu->BC.b.hi); break; case 0x51: /* OUT (C),D */ TSTATE(12); - if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->DE.b[HI]); + if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->DE.b.hi); break; case 0x52: /* SBC HL,DE */ @@ -1176,8 +1156,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1195,7 +1175,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) case 0x57: /* LD A,I */ TSTATE(9); - cpu->AF.b[HI]=cpu->I; + cpu->AF.b.hi=cpu->I; break; case 0x58: /* IN E,(C) */ @@ -1203,20 +1183,20 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) if (PRIV->pread) { - cpu->DE.b[LO]=PRIV->pread(cpu,cpu->BC.w); + cpu->DE.b.lo=PRIV->pread(cpu,cpu->BC.w); } else { - cpu->BC.b[LO]=0; + cpu->BC.b.lo=0; } - cpu->AF.b[LO]=CARRY|PSZtable[cpu->DE.b[LO]]; - SETHIDDEN(cpu->DE.b[LO]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->DE.b.lo]; + SETHIDDEN(cpu->DE.b.lo); break; case 0x59: /* OUT (C),E */ TSTATE(12); - if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->DE.b[LO]); + if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->DE.b.lo); break; case 0x5a: /* ADC HL,DE */ @@ -1235,8 +1215,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1254,7 +1234,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) case 0x5f: /* LD A,R */ TSTATE(9); - cpu->AF.b[HI]=cpu->R; + cpu->AF.b.hi=cpu->R; break; case 0x60: /* IN H,(C) */ @@ -1262,20 +1242,20 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) if (PRIV->pread) { - cpu->HL.b[HI]=PRIV->pread(cpu,cpu->BC.w); + cpu->HL.b.hi=PRIV->pread(cpu,cpu->BC.w); } else { - cpu->HL.b[HI]=0; + cpu->HL.b.hi=0; } - cpu->AF.b[LO]=CARRY|PSZtable[cpu->HL.b[HI]]; - SETHIDDEN(cpu->HL.b[HI]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->HL.b.hi]; + SETHIDDEN(cpu->HL.b.hi); break; case 0x61: /* OUT (C),H */ TSTATE(12); - if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->HL.b[HI]); + if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->HL.b.hi); break; case 0x62: /* SBC HL,HL */ @@ -1294,8 +1274,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1319,11 +1299,11 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) b=PEEK(cpu->HL.w); - POKE(cpu->HL.w,(b>>4)|(cpu->AF.b[HI]<<4)); - cpu->AF.b[HI]=(cpu->AF.b[HI]&0xf0)|(b&0x0f); + POKE(cpu->HL.w,(b>>4)|(cpu->AF.b.hi<<4)); + cpu->AF.b.hi=(cpu->AF.b.hi&0xf0)|(b&0x0f); - cpu->AF.b[LO]=CARRY|PSZtable[cpu->AF.b[HI]]; - SETHIDDEN(cpu->AF.b[HI]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->AF.b.hi]; + SETHIDDEN(cpu->AF.b.hi); break; } @@ -1332,20 +1312,20 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) if (PRIV->pread) { - cpu->HL.b[LO]=PRIV->pread(cpu,cpu->BC.w); + cpu->HL.b.lo=PRIV->pread(cpu,cpu->BC.w); } else { - cpu->HL.b[LO]=0; + cpu->HL.b.lo=0; } - cpu->AF.b[LO]=CARRY|PSZtable[cpu->HL.b[LO]]; - SETHIDDEN(cpu->HL.b[LO]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->HL.b.lo]; + SETHIDDEN(cpu->HL.b.lo); break; case 0x69: /* OUT (C),L */ TSTATE(12); - if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->HL.b[LO]); + if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->HL.b.lo); break; case 0x6a: /* ADC HL,HL */ @@ -1364,8 +1344,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1389,11 +1369,11 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) b=PEEK(cpu->HL.w); - POKE(cpu->HL.w,(b<<4)|(cpu->AF.b[HI]&0x0f)); - cpu->AF.b[HI]=(cpu->AF.b[HI]&0xf0)|(b>>4); + POKE(cpu->HL.w,(b<<4)|(cpu->AF.b.hi&0x0f)); + cpu->AF.b.hi=(cpu->AF.b.hi&0xf0)|(b>>4); - cpu->AF.b[LO]=CARRY|PSZtable[cpu->AF.b[HI]]; - SETHIDDEN(cpu->AF.b[HI]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->AF.b.hi]; + SETHIDDEN(cpu->AF.b.hi); break; } @@ -1412,7 +1392,7 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) b=0; } - cpu->AF.b[LO]=CARRY|PSZtable[b]; + cpu->AF.b.lo=CARRY|PSZtable[b]; SETHIDDEN(b); break; } @@ -1438,8 +1418,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1465,20 +1445,20 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) if (PRIV->pread) { - cpu->AF.b[HI]=PRIV->pread(cpu,cpu->BC.w); + cpu->AF.b.hi=PRIV->pread(cpu,cpu->BC.w); } else { - cpu->AF.b[HI]=0; + cpu->AF.b.hi=0; } - cpu->AF.b[LO]=CARRY|PSZtable[cpu->AF.b[HI]]; - SETHIDDEN(cpu->AF.b[HI]); + cpu->AF.b.lo=CARRY|PSZtable[cpu->AF.b.hi]; + SETHIDDEN(cpu->AF.b.hi); break; case 0x79: /* OUT (C),A */ TSTATE(12); - if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->AF.b[HI]); + if (PRIV->pwrite) PRIV->pwrite(cpu,cpu->BC.w,cpu->AF.b.hi); break; case 0x7a: /* ADC HL,SP */ @@ -1497,8 +1477,8 @@ static void DecodeED(Z80 *cpu, Z80Byte opcode) TSTATE(8); - b=cpu->AF.b[HI]; - cpu->AF.b[HI]=0; + b=cpu->AF.b.hi; + cpu->AF.b.hi=0; SUB8(b); break; } @@ -1769,18 +1749,18 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) { case 0xdd: HL=&(cpu->IX.w); - L=cpu->IX.b+LO; - H=cpu->IX.b+HI; + L=&(cpu->IX.b.lo); + H=&(cpu->IX.b.hi); break; case 0xfd: HL=&(cpu->IY.w); - L=cpu->IY.b+LO; - H=cpu->IY.b+HI; + L=&(cpu->IY.b.lo); + H=&(cpu->IY.b.hi); break; default: HL=&(cpu->HL.w); - L=cpu->HL.b+LO; - H=cpu->HL.b+HI; + L=&(cpu->HL.b.lo); + H=&(cpu->HL.b.hi); break; } @@ -1797,7 +1777,7 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x02: /* LD (BC),A */ TSTATE(7); - POKE(cpu->BC.w,cpu->AF.b[HI]); + POKE(cpu->BC.w,cpu->AF.b.hi); break; case 0x03: /* INC BC */ @@ -1807,17 +1787,17 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x04: /* INC B */ TSTATE(4); - INC8(cpu->BC.b[HI]); + INC8(cpu->BC.b.hi); break; case 0x05: /* DEC B */ TSTATE(4); - DEC8(cpu->BC.b[HI]); + DEC8(cpu->BC.b.hi); break; case 0x06: /* LD B,n */ TSTATE(7); - cpu->BC.b[HI]=FETCH_BYTE; + cpu->BC.b.hi=FETCH_BYTE; break; case 0x07: /* RLCA */ @@ -1837,7 +1817,7 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x0a: /* LD A,(BC) */ TSTATE(7); - cpu->AF.b[HI]=PEEK(cpu->BC.w); + cpu->AF.b.hi=PEEK(cpu->BC.w); break; case 0x0b: /* DEC BC */ @@ -1847,17 +1827,17 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x0c: /* INC C */ TSTATE(4); - INC8(cpu->BC.b[LO]); + INC8(cpu->BC.b.lo); break; case 0x0d: /* DEC C */ TSTATE(4); - DEC8(cpu->BC.b[LO]); + DEC8(cpu->BC.b.lo); break; case 0x0e: /* LD C,n */ TSTATE(7); - cpu->BC.b[LO]=FETCH_BYTE; + cpu->BC.b.lo=FETCH_BYTE; break; case 0x0f: /* RRCA */ @@ -1866,7 +1846,7 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) break; case 0x10: /* DJNZ */ - if (--(cpu->BC.b[HI])) + if (--(cpu->BC.b.hi)) { TSTATE(13); JR; @@ -1885,7 +1865,7 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x12: /* LD (DE),A */ TSTATE(7); - POKE(cpu->DE.w,cpu->AF.b[HI]); + POKE(cpu->DE.w,cpu->AF.b.hi); break; case 0x13: /* INC DE */ @@ -1895,17 +1875,17 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x14: /* INC D */ TSTATE(4); - INC8(cpu->DE.b[HI]); + INC8(cpu->DE.b.hi); break; case 0x15: /* DEC D */ TSTATE(4); - DEC8(cpu->DE.b[HI]); + DEC8(cpu->DE.b.hi); break; case 0x16: /* LD D,n */ TSTATE(7); - cpu->DE.b[HI]=FETCH_BYTE; + cpu->DE.b.hi=FETCH_BYTE; break; case 0x17: /* RLA */ @@ -1925,7 +1905,7 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x1a: /* LD A,(DE) */ TSTATE(7); - cpu->AF.b[HI]=PEEK(cpu->DE.w); + cpu->AF.b.hi=PEEK(cpu->DE.w); break; case 0x1b: /* DEC DE */ @@ -1935,17 +1915,17 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x1c: /* INC E */ TSTATE(4); - INC8(cpu->DE.b[LO]); + INC8(cpu->DE.b.lo); break; case 0x1d: /* DEC E */ TSTATE(4); - DEC8(cpu->DE.b[LO]); + DEC8(cpu->DE.b.lo); break; case 0x1e: /* LD E,n */ TSTATE(7); - cpu->DE.b[LO]=FETCH_BYTE; + cpu->DE.b.lo=FETCH_BYTE; break; case 0x1f: /* RRA */ @@ -2028,10 +2008,10 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x2f: /* CPL */ TSTATE(4); - cpu->AF.b[HI]^=0xff; + cpu->AF.b.hi^=0xff; SETFLAG(H_Z80); SETFLAG(N_Z80); - SETHIDDEN(cpu->AF.b[HI]); + SETHIDDEN(cpu->AF.b.hi); break; case 0x30: /* JR NC,d */ @@ -2045,7 +2025,7 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x32: /* LD (nnnn),A */ TSTATE(13); - POKE(FETCH_WORD,cpu->AF.b[HI]); + POKE(FETCH_WORD,cpu->AF.b.hi); break; case 0x33: /* INC SP */ @@ -2073,9 +2053,9 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x37: /* SCF */ TSTATE(4); - cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80)) + cpu->AF.b.lo=(cpu->AF.b.lo&(S_Z80|Z_Z80|P_Z80)) | C_Z80 - | (cpu->AF.b[HI]&(B3_Z80|B5_Z80)); + | (cpu->AF.b.hi&(B3_Z80|B5_Z80)); break; case 0x38: /* JR C,d */ @@ -2089,7 +2069,7 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x3a: /* LD A,(nnnn) */ TSTATE(13); - cpu->AF.b[HI]=PEEK(FETCH_WORD); + cpu->AF.b.hi=PEEK(FETCH_WORD); break; case 0x3b: /* DEC SP */ @@ -2099,17 +2079,17 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x3c: /* INC A */ TSTATE(4); - INC8(cpu->AF.b[HI]); + INC8(cpu->AF.b.hi); break; case 0x3d: /* DEC A */ TSTATE(4); - DEC8(cpu->AF.b[HI]); + DEC8(cpu->AF.b.hi); break; case 0x3e: /* LD A,n */ TSTATE(7); - cpu->AF.b[HI]=FETCH_BYTE; + cpu->AF.b.hi=FETCH_BYTE; break; case 0x3f: /* CCF */ @@ -2120,51 +2100,51 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) else CLRFLAG(H_Z80); - cpu->AF.b[LO]^=C_Z80; - SETHIDDEN(cpu->AF.b[HI]); + cpu->AF.b.lo^=C_Z80; + SETHIDDEN(cpu->AF.b.hi); break; - LD_BLOCK(0x40,cpu->BC.b[HI],cpu->BC.b[HI]) - LD_BLOCK(0x48,cpu->BC.b[LO],cpu->BC.b[LO]) - LD_BLOCK(0x50,cpu->DE.b[HI],cpu->DE.b[HI]) - LD_BLOCK(0x58,cpu->DE.b[LO],cpu->DE.b[LO]) - LD_BLOCK(0x60,*H,cpu->HL.b[HI]) - LD_BLOCK(0x68,*L,cpu->HL.b[LO]) + LD_BLOCK(0x40,cpu->BC.b.hi,cpu->BC.b.hi) + LD_BLOCK(0x48,cpu->BC.b.lo,cpu->BC.b.lo) + LD_BLOCK(0x50,cpu->DE.b.hi,cpu->DE.b.hi) + LD_BLOCK(0x58,cpu->DE.b.lo,cpu->DE.b.lo) + LD_BLOCK(0x60,*H,cpu->HL.b.hi) + LD_BLOCK(0x68,*L,cpu->HL.b.lo) case 0x70: /* LD (HL),B */ TSTATE(7); OFFSET(off); - POKE(*HL+off,cpu->BC.b[HI]); + POKE(*HL+off,cpu->BC.b.hi); break; case 0x71: /* LD (HL),C */ TSTATE(7); OFFSET(off); - POKE(*HL+off,cpu->BC.b[LO]); + POKE(*HL+off,cpu->BC.b.lo); break; case 0x72: /* LD (HL),D */ TSTATE(7); OFFSET(off); - POKE(*HL+off,cpu->DE.b[HI]); + POKE(*HL+off,cpu->DE.b.hi); break; case 0x73: /* LD (HL),E */ TSTATE(7); OFFSET(off); - POKE(*HL+off,cpu->DE.b[LO]); + POKE(*HL+off,cpu->DE.b.lo); break; case 0x74: /* LD (HL),H */ TSTATE(7); OFFSET(off); - POKE(*HL+off,cpu->HL.b[HI]); + POKE(*HL+off,cpu->HL.b.hi); break; case 0x75: /* LD (HL),L */ TSTATE(7); OFFSET(off); - POKE(*HL+off,cpu->HL.b[LO]); + POKE(*HL+off,cpu->HL.b.lo); break; case 0x76: /* HALT */ @@ -2180,10 +2160,10 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) case 0x77: /* LD (HL),A */ TSTATE(7); OFFSET(off); - POKE(*HL+off,cpu->AF.b[HI]); + POKE(*HL+off,cpu->AF.b.hi); break; - LD_BLOCK(0x78,cpu->AF.b[HI],cpu->AF.b[HI]) + LD_BLOCK(0x78,cpu->AF.b.hi,cpu->AF.b.hi) ALU_BLOCK(0x80,ADD8) ALU_BLOCK(0x88,ADC8) @@ -2297,8 +2277,8 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) Z80Word port; port=FETCH_BYTE; - port|=(Z80Word)cpu->AF.b[HI]<<8; - PRIV->pwrite(cpu,port,cpu->AF.b[HI]); + port|=(Z80Word)cpu->AF.b.hi<<8; + PRIV->pwrite(cpu,port,cpu->AF.b.hi); } else cpu->PC++; @@ -2344,8 +2324,8 @@ void Z80_Decode(Z80 *cpu, Z80Byte opcode) Z80Word port; port=FETCH_BYTE; - port|=(Z80Word)cpu->AF.b[HI]<<8; - cpu->AF.b[HI]=PRIV->pread(cpu,port); + port|=(Z80Word)cpu->AF.b.hi<<8; + cpu->AF.b.hi=PRIV->pread(cpu,port); } else cpu->PC++; |