Initial Project Setup
This commit is contained in:
6
include/bus.h
Normal file
6
include/bus.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
|
||||
u8 bus_read(u16 address);
|
||||
void bus_write(u16 address, u8 value);
|
22
include/cart.h
Normal file
22
include/cart.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
|
||||
typedef struct {
|
||||
u8 entry[4];
|
||||
u8 logo[0x30];
|
||||
|
||||
char title[16];
|
||||
u16 new_lic_code;
|
||||
u8 sgb_flag;
|
||||
u8 type;
|
||||
u8 rom_size;
|
||||
u8 ram_size;
|
||||
u8 dest_code;
|
||||
u8 lic_code;
|
||||
u8 version;
|
||||
u8 checksum;
|
||||
u16 global_checksum;
|
||||
} rom_header;
|
||||
|
||||
bool cart_load(char *cart);
|
17
include/common.h
Normal file
17
include/common.h
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
#define BIT(a, n) ((a & (1 << n)) ? 1 : 0)
|
||||
#define BIT_SET(a, n, on) (on ? (a) |= (1 << n) : (a) &= !(1 << n))
|
||||
#define BETWEEN(a, b, c) ((a >= b) && (a <= c))
|
||||
|
||||
void delay(u32 ms);
|
6
include/cpu.h
Normal file
6
include/cpu.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
|
||||
void cpu_init();
|
||||
bool cpu_step();
|
12
include/emu.h
Normal file
12
include/emu.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
|
||||
typedef struct {
|
||||
bool paused;
|
||||
bool running;
|
||||
u64 ticks;
|
||||
} emu_context;
|
||||
|
||||
int emu_run(int, char**);
|
||||
emu_context *emu_get_context();
|
6
include/ppu.h
Normal file
6
include/ppu.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
|
||||
void ppu_init();
|
||||
void ppu_tick();
|
6
include/timer.h
Normal file
6
include/timer.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <common.h>
|
||||
|
||||
void timer_init();
|
||||
void timer_tick();
|
Reference in New Issue
Block a user