Dented/cpu.c

22 lines
488 B
C
Raw Permalink Normal View History

2024-11-22 14:11:26 -07:00
#include "cpu.h"
#include <stdint.h>
#include <stdio.h>
void execute_instruction(cpu* cpu, uint8_t opcode, uint16_t operand) {
switch (opcode) {
// SEI: Set Interrupt Disable Flag
case 0x78:
cpu->p |= 0x4;
break;
// CLD: Clear Decimal Flag
case 0xd8:
cpu->p &= 0xfd;
break;
case 0xa2:
cpu->x = (uint8_t)operand;
break;
default:
printf("Unknown Opcode: %#04x, with Operand: %#08x\n", opcode, operand);
break;
}
}