Finished CPU instructions and created ui window.
This commit is contained in:
@ -30,7 +30,9 @@ typedef struct {
|
||||
bool stepping;
|
||||
|
||||
bool int_master_enabled;
|
||||
bool enabling_ime;
|
||||
u8 ie_register;
|
||||
u8 int_flags;
|
||||
} cpu_context;
|
||||
|
||||
void cpu_init();
|
||||
@ -41,6 +43,8 @@ typedef void (*IN_PROC)(cpu_context *);
|
||||
IN_PROC inst_get_processor(in_type type);
|
||||
|
||||
#define CPU_FLAG_Z BIT(ctx->regs.f, 7)
|
||||
#define CPU_FLAG_N BIT(ctx->regs.f, 6)
|
||||
#define CPU_FLAG_H BIT(ctx->regs.f, 5)
|
||||
#define CPU_FLAG_C BIT(ctx->regs.f, 4)
|
||||
|
||||
u16 cpu_read_reg(reg_type rt);
|
||||
@ -56,4 +60,7 @@ void fetch_data();
|
||||
u8 cpu_get_ie_register();
|
||||
void cpu_set_ie_register(u8 ie);
|
||||
|
||||
cpu_registers *cpu_get_regs();
|
||||
cpu_registers *cpu_get_regs();
|
||||
|
||||
u8 cpu_get_int_flags();
|
||||
void cpu_set_int_flags(u8 value);
|
@ -5,6 +5,7 @@
|
||||
typedef struct {
|
||||
bool paused;
|
||||
bool running;
|
||||
bool die;
|
||||
u64 ticks;
|
||||
} emu_context;
|
||||
|
||||
|
16
include/interrupts.h
Normal file
16
include/interrupts.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
#include <cpu.h>
|
||||
|
||||
typedef enum {
|
||||
IT_VBLANK = 1,
|
||||
IT_LCD_STAT = 2,
|
||||
IT_TIMER = 4,
|
||||
IT_SERIAL = 8,
|
||||
IT_JOYPAD = 16
|
||||
} interrupt_type;
|
||||
|
||||
void cpu_request_interrupt(interrupt_type t);
|
||||
|
||||
void cpu_handle_interrupts(cpu_context *ctx);
|
9
include/ui.h
Normal file
9
include/ui.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
|
||||
static const int SCREEN_WIDTH = 1024;
|
||||
static const int SCREEN_HEIGHT = 768;
|
||||
|
||||
void ui_init();
|
||||
void ui_handle_events();
|
Reference in New Issue
Block a user