fx9860-emulator-playground/scripts/header.c

50 lines
1.2 KiB
C

struct SR0 {
unsigned long dummy0:22;
unsigned long M0:1;
unsigned long Q0:1;
unsigned long I0:4;
unsigned long dummy1:2;
unsigned long S0:1;
unsigned long T0:1;
};
#define M ((*(struct SR0 *)(&SR)).M0)
#define Q ((*(struct SR0 *)(&SR)).Q0)
#define S ((*(struct SR0 *)(&SR)).S0)
#define T ((*(struct SR0 *)(&SR)).T0)
#define SR cpu->sr
#define GBR cpu->gbr
#define SGR cpu->sgr
#define VBR cpu->vbr
#define SSR cpu->ssr
#define SPC cpu->spc
#define DBR cpu->dbr
#define PC cpu->pc
#define PR cpu->pr
#define R cpu->r
#define R0 cpu->r[0]
#define MACH cpu->mach
#define MACL cpu->macl
#define Read_Byte(addr) mem_read(cpu, addr, 1)
#define Read_Word(addr) mem_read(cpu, addr, 2)
#define Read_Long(addr) mem_read(cpu, addr, 4)
#define Write_Byte(addr, data) mem_write(cpu, addr, data, 1)
#define Write_Word(addr, data) mem_write(cpu, addr, data, 2)
#define Write_Long(addr, data) mem_write(cpu, addr, data, 4)
#define Delay_Slot(pc_next) \
uint32_t pc_save = cpu->pc; \
cpu->pc = pc_next; \
run_next_instruction(cpu); \
cpu->pc = pc_save;
#define is_32bit_instruction(addr) is_32bit_instruction_impl(cpu, addr)
int is_32bit_instruction_impl(cpu_t* cpu, int addr) {
// TODO
return 0;
}