diff --git a/cpu.c b/cpu.c index 8c88959..c0e3877 100644 --- a/cpu.c +++ b/cpu.c @@ -206,18 +206,6 @@ asl(uint8_t arg) STATUS_UPDATE_NEGATIVE(regs.a); } -static void -bbr(uint8_t arg) -{ -/* TODO: complete this */ -} - -static void -bbs(uint8_t arg) -{ -/* TODO: complete this */ -} - static void bcc(uint8_t arg) { @@ -268,12 +256,6 @@ bpl(uint8_t arg) regs.pc += arg; } -static void -bra(uint8_t arg) -{ -/* TODO: complete this */ -} - static void brk(void) { @@ -527,12 +509,6 @@ ply(uint8_t arg) /* TODO: complete this */ } -static void -rmb(uint8_t arg) -{ -/* TODO: complete this */ -} - static void rol(uint8_t arg) { @@ -567,25 +543,19 @@ sbc(uint8_t arg) static void sec(uint8_t arg) { -/* TODO: complete this */ + regs.status.carry = 1; } static void sed(uint8_t arg) { -/* TODO: complete this */ + regs.status.decimal_mode = 1; } static void sei(uint8_t arg) { -/* TODO: complete this */ -} - -static void -smb(uint8_t arg) -{ -/* TODO: complete this */ + regs.status.interrupt_disable = 1; } static void @@ -594,12 +564,6 @@ sta(uint8_t arg) /* TODO: complete this */ } -static void -stp(uint8_t arg) -{ -/* TODO: complete this */ -} - static void stx(uint8_t arg) { @@ -612,12 +576,6 @@ sty(uint8_t arg) /* TODO: complete this */ } -static void -stz(uint8_t arg) -{ -/* TODO: complete this */ -} - static void tax(void) { @@ -633,18 +591,6 @@ tay(uint8_t arg) /* TODO: complete this */ } -static void -trb(uint8_t arg) -{ -/* TODO: complete this */ -} - -static void -tsb(uint8_t arg) -{ -/* TODO: complete this */ -} - static void tsx(uint8_t arg) { @@ -669,18 +615,6 @@ tya(uint8_t arg) /* TODO: complete this */ } -static void -wai(uint8_t arg) -{ -/* TODO: complete this */ -} - -static void -unp(uint8_t arg) -{ -/* TODO: complete this */ -} - static void interpret(void) { @@ -784,70 +718,6 @@ interpret(void) asl(opcode_arg(AM_ABS_X)); cycles += 6; break; - case 0x0f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x1f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x2f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x3f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x4f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x5f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x6f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x7f: - bbr(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x8f: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0x9f: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0xaf: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0xbf: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0xcf: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0xdf: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0xef: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; - case 0xff: - bbs(opcode_arg(AM_REL)); - cycles += 4; - break; case 0x90: bcc(opcode_arg(AM_IMM)); cycles += 2; @@ -892,10 +762,6 @@ interpret(void) bpl(opcode_arg(AM_IMM)); cycles += 2; break; - case 0x80: - bra(opcode_arg(AM_IMM)); - cycles += 3; - break; case 0x00: brk(); cycles += 7; @@ -1256,38 +1122,6 @@ interpret(void) ply(opcode_arg(AM_ACC)); cycles += 4; break; - case 0x07: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x17: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x27: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x37: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x47: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x57: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x67: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x77: - rmb(opcode_arg(AM_REL)); - cycles += 5; - break; case 0x2a: rol(opcode_arg(AM_ACC)); cycles += 2; @@ -1384,38 +1218,6 @@ interpret(void) sei(opcode_arg(AM_ACC)); cycles += 2; break; - case 0x87: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0x97: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0xa7: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0xb7: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0xc7: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0xd7: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0xe7: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; - case 0xf7: - smb(opcode_arg(AM_REL)); - cycles += 5; - break; case 0x85: sta(opcode_arg(AM_ZP)); cycles += 4; @@ -1448,10 +1250,6 @@ interpret(void) sta(opcode_arg(AM_IND_Y)); cycles += 7; break; - case 0xdb: - stp(opcode_arg(AM_ACC)); - cycles += 2; - break; case 0x86: stx(opcode_arg(AM_ZP)); cycles += 4; @@ -1476,22 +1274,6 @@ interpret(void) sty(opcode_arg(AM_ABS)); cycles += 5; break; - case 0x64: - stz(opcode_arg(AM_ZP)); - cycles += 4; - break; - case 0x74: - stz(opcode_arg(AM_ZP_X)); - cycles += 5; - break; - case 0x9c: - stz(opcode_arg(AM_ABS)); - cycles += 5; - break; - case 0x9e: - stz(opcode_arg(AM_ABS_X)); - cycles += 6; - break; case 0xaa: tax(); cycles += 2; @@ -1500,22 +1282,6 @@ interpret(void) tay(opcode_arg(AM_ACC)); cycles += 2; break; - case 0x14: - trb(opcode_arg(AM_ZP)); - cycles += 5; - break; - case 0x1c: - trb(opcode_arg(AM_ABS)); - cycles += 6; - break; - case 0x04: - tsb(opcode_arg(AM_ZP)); - cycles += 5; - break; - case 0x0c: - tsb(opcode_arg(AM_ABS)); - cycles += 6; - break; case 0xba: tsx(opcode_arg(AM_ACC)); cycles += 2; @@ -1532,186 +1298,6 @@ interpret(void) tya(opcode_arg(AM_ACC)); cycles += 2; break; - case 0xcb: - wai(opcode_arg(AM_ACC)); - cycles += 5; - break; - case 0x03: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x0b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x13: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x1b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x23: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x2b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x33: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x3b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x43: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x4b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x53: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x5b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x63: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x6b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x73: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x7b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x83: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x8b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x93: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x9b: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xa3: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xab: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xb3: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xbb: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xc3: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xd3: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xe3: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xeb: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xf3: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0xfb: - unp(opcode_arg(AM_ACC)); - cycles += 1; - break; - case 0x02: - unp(opcode_arg(AM_IMM)); - cycles += 2; - break; - case 0x22: - unp(opcode_arg(AM_IMM)); - cycles += 2; - break; - case 0x42: - unp(opcode_arg(AM_IMM)); - cycles += 2; - break; - case 0x62: - unp(opcode_arg(AM_IMM)); - cycles += 2; - break; - case 0x82: - unp(opcode_arg(AM_IMM)); - cycles += 2; - break; - case 0xc2: - unp(opcode_arg(AM_IMM)); - cycles += 2; - break; - case 0xe2: - unp(opcode_arg(AM_IMM)); - cycles += 2; - break; - case 0x44: - unp(opcode_arg(AM_ZP)); - cycles += 3; - break; - case 0x54: - unp(opcode_arg(AM_ZP_X)); - cycles += 4; - break; - case 0xd4: - unp(opcode_arg(AM_ZP_X)); - cycles += 4; - break; - case 0xf4: - unp(opcode_arg(AM_ZP_X)); - cycles += 4; - break; - case 0x5c: - unp(opcode_arg(AM_ABS)); - cycles += 8; - break; - case 0xdc: - unp(opcode_arg(AM_ABS_X)); - cycles += 4; - break; - case 0xfc: - unp(opcode_arg(AM_ABS_X)); - cycles += 4; - break; default: printf("opcode $%02X not implemented\n", opcode); break;