nesemu/include/cpu/cpu.h

52 lines
1.2 KiB
C
Raw Normal View History

2023-10-05 17:05:06 -04:00
/*
* =====================================================================================
*
* Filename: cpu.h
*
* Description: 6502 CPU emulator headers
*
* Version: 1.0
* Created: 2023-09-21 10:12:33 PM
* Revision: none
* Compiler: gcc
*
* Author: William Nolin,
* Organization:
*
* =====================================================================================
*/
#ifndef EMU_CPU_H
#define EMU_CPU_H
// Reference: https://www.nesdev.org/wiki/Status_flags
#define CPU_STATUS_CARRY_MASK = 0x01;
#define CPU_STATUS_ZERO_MASK = 0x02;
#define CPU_STATUS_INTERRUPT_DISABLE_MASK = 0x04;
#define CPU_STATUS_DECIMAL_MASK = 0x08;
#define CPU_STATUS_B_MASK = 0x10;
#define CPU_STATUS_I_MASK = 0x20;
#define CPU_STATUS_OVERFLOW_MASK = 0x40;
#define CPU_STATUS_NEGATIVE_MASK = 0x80;
// Reference: https://www.nesdev.org/obelisk-6502-guide/registers.html
typedef struct {
unsigned short program_counter;
unsigned char stack_pointer;
unsigned char accumulator;
unsigned char x;
unsigned char y;
unsigned char status;
} cpu_registers_t;
/**
* @brief Set clock
*/
void cpu_step_to(int cycle);
void cpu_add_cycles(int count);
cpu_registers_t* cpu_get_registers();
#endif