nesemu/cpu/mem.c

26 lines
721 B
C

//
// Created by william on 30/09/23.
//
#include "../include/cpu/mem.h"
#include "../include/cpu/op.h"
#include "../include/cpu/cpu.h"
unsigned short get_memory_address(addr_mode_t addr_mode, unsigned short operand) {
if (addr_mode == ADDR_MODE_ABSOLUTE) {
cpu_add_cycles(4);
return operand;
} else if (addr_mode == ADDR_MODE_ABSOLUTE_INDEXED_X) {
unsigned char x = cpu_get_registers()->x;
cpu_add_cycles(4);
return operand + x;
} else if (addr_mode == ADDR_MODE_ABSOLUTE_INDEXED_Y) {
unsigned char y = cpu_get_registers()->y;
cpu_add_cycles(4);
return operand + y;
} else if (addr_mode == ADDR_MODE_INDEXED_INDIRECT) {
}
}