(N << 3) | (Z << 2) | (V<<1) | C;
#define BUILDEXR() \
- if( h8300smode ) cpu.exr = ( trace<<7 ) | intMask;
+ if (h8300smode) cpu.exr = (trace<<7) | intMask;
#define GETSR() \
c = (cpu.ccr >> 0) & 1;\
intMaskBit = (cpu.ccr >> 7) & 1;
#define GETEXR() \
- if( h8300smode ) { \
+ if (h8300smode) { \
trace = (cpu.exr >> 7) & 1;\
intMask = cpu.exr & 7; }
}
#define ONOT(name, how) \
-case O(name, SB): \
+case O (name, SB): \
{ \
int t; \
int hm = 0x80; \
how; \
goto shift8; \
} \
-case O(name, SW): \
+case O (name, SW): \
{ \
int t; \
int hm = 0x8000; \
how; \
goto shift16; \
} \
-case O(name, SL): \
+case O (name, SL): \
{ \
int t; \
int hm = 0x80000000; \
}
#define OSHIFTS(name, how1, how2) \
-case O(name, SB): \
+case O (name, SB): \
{ \
int t; \
int hm = 0x80; \
} \
goto shift8; \
} \
-case O(name, SW): \
+case O (name, SW): \
{ \
int t; \
int hm = 0x8000; \
} \
goto shift16; \
} \
-case O(name, SL): \
+case O (name, SL): \
{ \
int t; \
int hm = 0x80000000; \
}
#define OBITOP(name,f, s, op) \
-case O(name, SB): \
+case O (name, SB): \
{ \
int m; \
int b; \
if (f) ea = fetch (&code->dst); \
- m=1<< fetch(&code->src); \
+ m=1<< fetch (&code->src); \
op; \
- if(s) store (&code->dst,ea); goto next; \
+ if (s) store (&code->dst,ea); goto next; \
}
int
#define ALUOP(STORE, NAME, HOW) \
- case O(NAME,SB): HOW; if(STORE)goto alu8;else goto just_flags_alu8; \
- case O(NAME, SW): HOW; if(STORE)goto alu16;else goto just_flags_alu16; \
- case O(NAME,SL): HOW; if(STORE)goto alu32;else goto just_flags_alu32;
+ case O (NAME,SB): HOW; if (STORE)goto alu8;else goto just_flags_alu8; \
+ case O (NAME, SW): HOW; if (STORE)goto alu16;else goto just_flags_alu16; \
+ case O (NAME,SL): HOW; if (STORE)goto alu32;else goto just_flags_alu32;
#define LOGOP(NAME, HOW) \
- case O(NAME,SB): HOW; goto log8;\
- case O(NAME, SW): HOW; goto log16;\
- case O(NAME,SL): HOW; goto log32;
+ case O (NAME,SB): HOW; goto log8;\
+ case O (NAME, SW): HOW; goto log16;\
+ case O (NAME,SL): HOW; goto log32;
res = rd + ea;
goto alu8;
-#define EA ea = fetch(&code->src);
-#define RD_EA ea = fetch(&code->src); rd = fetch(&code->dst);
+#define EA ea = fetch (&code->src);
+#define RD_EA ea = fetch (&code->src); rd = fetch (&code->dst);
ALUOP (1, O_SUB, RD_EA;
ea = -ea;
case O (O_EEPMOV, SB):
case O (O_EEPMOV, SW):
- if(h8300hmode||h8300smode)
+ if (h8300hmode||h8300smode)
{
register unsigned char *_src,*_dst;
- unsigned int count = (code->opcode==O(O_EEPMOV, SW))?cpu.regs[R4_REGNUM]&0xffff:
+ unsigned int count = (code->opcode == O(O_EEPMOV, SW))?cpu.regs[R4_REGNUM]&0xffff:
cpu.regs[R4_REGNUM]&0xff;
_src = cpu.regs[R5_REGNUM] < memory_size ? cpu.memory+cpu.regs[R5_REGNUM] :
cpu.eightbit + (cpu.regs[R5_REGNUM] & 0xff);
- if((_src+count)>=(cpu.memory+memory_size))
+ if ((_src+count)>=(cpu.memory+memory_size))
{
- if((_src+count)>=(cpu.eightbit+0x100))
+ if ((_src+count)>=(cpu.eightbit+0x100))
goto illegal;
}
_dst = cpu.regs[R6_REGNUM] < memory_size ? cpu.memory+cpu.regs[R6_REGNUM] :
cpu.eightbit + (cpu.regs[R6_REGNUM] & 0xff);
- if((_dst+count)>=(cpu.memory+memory_size))
+ if ((_dst+count)>=(cpu.memory+memory_size))
{
- if((_dst+count)>=(cpu.eightbit+0x100))
+ if ((_dst+count)>=(cpu.eightbit+0x100))
goto illegal;
}
memcpy(_dst,_src,count);
cpu.regs[R5_REGNUM]+=count;
cpu.regs[R6_REGNUM]+=count;
- cpu.regs[R4_REGNUM]&=(code->opcode==O(O_EEPMOV, SW))?(~0xffff):(~0xff);
+ cpu.regs[R4_REGNUM]&=(code->opcode == O(O_EEPMOV, SW))?(~0xffff):(~0xff);
cycles += 2*count;
goto next;
}
goto just_flags_inc32;
#define GET_CCR(x) BUILDSR();x = cpu.ccr
-#define GET_EXR(x) BUILDEXR();x = cpu.exr
+#define GET_EXR(x) BUILDEXR ();x = cpu.exr
case O (O_LDC, SB):
case O (O_LDC, SW):
- res = fetch(&code->src);
+ res = fetch (&code->src);
goto setc;
case O (O_STC, SB):
case O (O_STC, SW):
- if(code->src.type==OP_CCR)
+ if (code->src.type == OP_CCR)
{
- GET_CCR(res);
+ GET_CCR (res);
}
- else if(code->src.type==OP_EXR && h8300smode)
+ else if (code->src.type == OP_EXR && h8300smode)
{
- GET_EXR(res);
+ GET_EXR (res);
}
else
goto illegal;
goto next;
case O (O_ANDC, SB):
- if(code->dst.type==OP_CCR)
+ if (code->dst.type == OP_CCR)
{
GET_CCR (rd);
}
- else if(code->dst.type==OP_EXR && h8300smode)
+ else if (code->dst.type == OP_EXR && h8300smode)
{
GET_EXR (rd);
}
goto setc;
case O (O_ORC, SB):
- if(code->dst.type==OP_CCR)
+ if (code->dst.type == OP_CCR)
{
GET_CCR (rd);
}
- else if(code->dst.type==OP_EXR && h8300smode)
+ else if (code->dst.type == OP_EXR && h8300smode)
{
GET_EXR (rd);
}
goto setc;
case O (O_XORC, SB):
- if(code->dst.type==OP_CCR)
+ if (code->dst.type == OP_CCR)
{
GET_CCR (rd);
}
- else if(code->dst.type==OP_EXR && h8300smode)
+ else if (code->dst.type == OP_EXR && h8300smode)
{
GET_EXR (rd);
}
c = rd & (hm >> 1); v = (rd & (hm >> 1)) != ((rd & (hm >> 2)) << 2); rd <<= 2);
OSHIFTS (O_SHAR,
t = rd & hm; c = rd & 1; v = 0; rd >>= 1; rd |= t,
- t = rd & hm; c = rd & 2; v = 0; rd >>= 2; rd |= t | t >> 1 );
+ t = rd & hm; c = rd & 2; v = 0; rd >>= 2; rd |= t | t >> 1);
OSHIFTS (O_ROTL,
c = rd & hm; v = 0; rd <<= 1; rd |= C,
c = rd & hm; v = 0; rd <<= 1; rd |= C; c = rd & hm; rd <<= 1; rd |= C);
break;
case O (O_TAS, SB):
- if( !h8300smode || code->src.type != X (OP_REG, SL) )
+ if (!h8300smode || code->src.type != X (OP_REG, SL))
goto illegal;
- switch(code->src.reg)
+ switch (code->src.reg)
{
case R0_REGNUM:
case R1_REGNUM:
abort ();
setc:
- if(code->dst.type==OP_CCR)
+ if (code->dst.type == OP_CCR)
{
cpu.ccr = res;
GETSR ();
}
- else if(code->dst.type==OP_EXR && h8300smode)
+ else if (code->dst.type == OP_EXR && h8300smode)
{
cpu.exr = res;
GETEXR ();
cpu.pc = pc;
BUILDSR ();
- BUILDEXR();
+ BUILDEXR ();
cpu.mask = oldmask;
signal (SIGINT, prev);
}
init_pointers ();
- if(!h8300smode && rn >=EXR_REGNUM)
+ if (!h8300smode && rn >=EXR_REGNUM)
rn++;
switch (rn)
{