static int op_srliyd(int data) /* SRL (IY+d) */ { register BYTE *p; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif p = ram + IY + data; (*p & 1) ? (F |= C_FLAG) : (F &= ~C_FLAG); //*p >>= 1; memwrt(p, *p >> 1); F &= ~(H_FLAG | N_FLAG); (*p) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); (*p & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (parity[*p]) ? (F &= ~P_FLAG) : (F |= P_FLAG); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_incyd(void) /* INC (IY+d) */ { register BYTE *p; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif p = ram + IY + (signed char) *PC++; ((*p & 0xf) + 1 > 0xf) ? (F |= H_FLAG) : (F &= ~H_FLAG); //(*p)++; memwrt(p, ++(*p)); (*p == 128) ? (F |= P_FLAG) : (F &= ~P_FLAG); (*p & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (*p) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); F &= ~N_FLAG; #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_rlciyd(int data) /* RLC (IY+d) */ { register int i; register BYTE *p; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif p = ram + IY + data; i = *p & 128; (i) ? (F |= C_FLAG) : (F &= ~C_FLAG); F &= ~(H_FLAG | N_FLAG); //*p <<= 1; memwrt(p, *p << 1); //if (i) *p |= 1; if (i) memwrt(p, *p | 1); (*p) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); (*p & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (parity[*p]) ? (F &= ~P_FLAG) : (F |= P_FLAG); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_decyd(void) /* DEC (IY+d) */ { register BYTE *p; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif p = ram + IY + (signed char) *PC++; (((*p - 1) & 0xf) == 0xf) ? (F |= H_FLAG) : (F &= ~H_FLAG); (*p)--; (*p == 127) ? (F |= P_FLAG) : (F &= ~P_FLAG); (*p & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (*p) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); F |= N_FLAG; #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_rriyd(int data) /* RR (IY+d) */ { register int old_c_flag; register BYTE *p; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif old_c_flag = F & C_FLAG; p = ram + IY + data; (*p & 1) ? (F |= C_FLAG) : (F &= ~C_FLAG); //*p >>= 1; memwrt(p, *p >> 1); //if (old_c_flag) *p |= 128; if (old_c_flag) memwrt(p, *p | 128); F &= ~(H_FLAG | N_FLAG); (*p) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); (*p & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (parity[*p]) ? (F &= ~P_FLAG) : (F |= P_FLAG); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
/* * This is the main handler for all OUT op-codes, * called by the simulator. It calls the output * function for port adr. */ void io_out(BYTE adr, BYTE data) { //printf("Output to port %d\r\n", adr); cpu_bus = CPU_OUT; fp_sampleLightGroup(0, 0); (*port[adr][1]) (data); }
/* * This is the main handler for all IN op-codes, * called by the simulator. It calls the input * function for port adr. */ BYTE io_in(BYTE adr) { //printf("Input from port %d\r\n", adr); cpu_bus = CPU_WO | CPU_INP; fp_sampleLightGroup(0, 0); return((*port[adr][0]) ()); }
static int op_ldydl(void) /* LD (IY+d),L */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif *(IY + (signed char) *PC++ + ram) = L; #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(19); }
static int op_sb6ixd(int data) /* SET 6,(IX+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif //*(ram + IX + data) |= 64; memwrt(ram + IX + data, *(ram + IX + data) | 64); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_ldydh(void) /* LD (IY+d),H */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif //*(IY + (signed char) *PC++ + ram) = H; memwrt(ram + IY + (signed char) *PC++, H); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(19); }
static int op_rb6iyd(int data) /* RES 6,(IY+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif //*(ram + IY + data) &= ~64; memwrt(ram + IY + data, *(ram + IY + data) & ~64); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_sb7iyd(int data) /* SET 7,(IY+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif //*(ram + IY + data) |= 128; memwrt(ram + IY + data, *(ram + IY + data) | 128); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_rb7ixd(int data) /* RES 7,(IX+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif //*(ram + IX + data) &= ~128; memwrt(ram + IX + data, *(ram + IX + data) & ~128); #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_ldlyd(void) /* LD L,(IY+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif L = *(IY + (signed char) *PC++ + ram); return(19); }
static int op_ldydn(void) /* LD (IY+d),n */ { register int d; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif d = (signed char) *PC++; *(IY + d + ram) = *PC++; #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(19); }
static int op_ldiynn(void) /* LD IY,nn */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif IY = *PC++; IY += *PC++ << 8; return(14); }
static int op_exspy(void) /* EX (SP),IY */ { register int i; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_STACK | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif i = *STACK + (*(STACK + 1) << 8); *STACK = IY; *(STACK + 1) = IY >> 8; IY = i; #ifdef BUS_8080 cpu_bus = CPU_STACK; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif return(23); }
static int op_tb6iyd(int data) /* BIT 6,(IY+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif F &= ~(N_FLAG | S_FLAG); F |= H_FLAG; (*(ram + IY + data) & 64) ? (F &= ~(Z_FLAG | P_FLAG)) : (F |= (Z_FLAG | P_FLAG)); return(20); }
static int op_oryd(void) /* OR (IY+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif A |= *(ram + IY + (signed char) *PC++); (A & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (A) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); (parity[A]) ? (F &= ~P_FLAG) : (F |= P_FLAG); F &= ~(H_FLAG | N_FLAG | C_FLAG); return(19); }
static int op_ldiyinn(void) /* LD IY,(nn) */ { register BYTE *p; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif p = ram + *PC++; p += *PC++ << 8; IY = *p++; IY += *p << 8; return(20); }
static int op_ldiny(void) /* LD (nn),IY */ { register BYTE *p; #ifdef BUS_8080 cpu_bus = 0; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif p = ram + *PC++; p += *PC++ << 8; *p++ = IY; *p = IY >> 8; return(20); }
static int op_tb7iyd(int data) /* BIT 7,(IY+d) */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif F &= ~N_FLAG; F |= H_FLAG; if (*(ram + IY + data) & 128) { F &= ~(Z_FLAG | P_FLAG); F |= S_FLAG; } else { F |= (Z_FLAG | P_FLAG); F &= ~S_FLAG; } return(20); }
static int op_popiy(void) /* POP IY */ { #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_STACK | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif #ifdef WANT_SPC if (STACK <= ram) STACK = ram + 65536L; #endif IY = *STACK++; #ifdef WANT_SPC if (STACK <= ram) STACK = ram + 65536L; #endif IY += *STACK++ << 8; return(14); }
static int op_pusiy(void) /* PUSH IY */ { #ifdef BUS_8080 cpu_bus = CPU_STACK; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif #ifdef WANT_SPC if (STACK <= ram) STACK = ram + 65536L; #endif *--STACK = IY >> 8; #ifdef WANT_SPC if (STACK <= ram) STACK = ram + 65536L; #endif *--STACK = IY; return(15); }
static int op_adayd(void) /* ADD A,(IY+d) */ { register int i; register BYTE P; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif P = *(ram + IY + (signed char) *PC++); ((A & 0xf) + (P & 0xf) > 0xf) ? (F |= H_FLAG) : (F &= ~H_FLAG); (A + P > 255) ? (F |= C_FLAG) : (F &= ~C_FLAG); A = i = (signed char) A + (signed char) P; (i < -128 || i > 127) ? (F |= P_FLAG) : (F &= ~P_FLAG); (i & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (A) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); F &= ~N_FLAG; return(19); }
static int op_cpyd(void) /* CP (IY+d) */ { register int i; register BYTE P; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif P = *(ram + IY + (signed char) *PC++); ((P & 0xf) > (A & 0xf)) ? (F |= H_FLAG) : (F &= ~H_FLAG); (P > A) ? (F |= C_FLAG) : (F &= ~C_FLAG); i = (signed char) A - (signed char) P; (i < -128 || i > 127) ? (F |= P_FLAG) : (F &= ~P_FLAG); (i & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (i) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); F |= N_FLAG; return(19); }
static int op_scayd(void) /* SBC A,(IY+d) */ { register int i, carry; register BYTE P; #ifdef BUS_8080 cpu_bus = CPU_WO | CPU_MEMR; #endif #ifdef FRONTPANEL fp_sampleLightGroup(0, 0); #endif carry = (F & C_FLAG) ? 1 : 0; P = *(ram + IY + (signed char) *PC++); ((P & 0xf) + carry > (A & 0xf)) ? (F |= H_FLAG) : (F &= ~H_FLAG); (P + carry > A) ? (F |= C_FLAG) : (F &= ~C_FLAG); A = i = (signed char) A - (signed char) P - carry; (i < -128 || i > 127) ? (F |= P_FLAG) : (F &= ~P_FLAG); (i & 128) ? (F |= S_FLAG) : (F &= ~S_FLAG); (A) ? (F &= ~Z_FLAG) : (F |= Z_FLAG); F |= N_FLAG; return(19); }