rename struct Rom to struct rom

This commit is contained in:
Vineet K 2024-07-21 14:48:29 -04:00
parent 7d148924e2
commit 362341eac3
4 changed files with 8 additions and 10 deletions

3
cpu.c
View File

@ -36,7 +36,7 @@
#define PULL() \
(peek(0x0100 + ++regs.sp))
struct Rom rom = {0};
struct rom rom = {0};
uint32_t cycles = 0;
bool page_crossed = false;
@ -1020,6 +1020,7 @@ main(int argc, char *argv[])
parse_rom(buf, buflen, &rom);
free(buf);
ppu.rom = &rom;
cpu_init();

5
ppu.h
View File

@ -11,10 +11,7 @@ struct ppu {
uint8_t vram[2048];
uint8_t palette[16*2];
uint16_t cycles, scanlines;
/* copied from rom */
uint8_t *chr_rom;
size_t chr_rom_size;
enum screen_mirroring mirror;
struct rom *rom;
};
extern struct ppu ppu;

4
rom.c
View File

@ -6,7 +6,7 @@
#include "rom.h"
void
parse_rom(const uint8_t *data, size_t data_len, struct Rom *rom)
parse_rom(const uint8_t *data, size_t data_len, struct rom *rom)
{
size_t prg_rom_offset = 16;
size_t chr_rom_offset = 0;
@ -48,7 +48,7 @@ parse_rom(const uint8_t *data, size_t data_len, struct Rom *rom)
}
void
free_rom(struct Rom *rom)
free_rom(struct rom *rom)
{
free(rom->prg_rom);
if (rom->chr_rom_size > 0)

6
rom.h
View File

@ -7,7 +7,7 @@ enum screen_mirroring {
M_FOUR,
};
struct Rom {
struct rom {
char *prg_rom;
char *chr_rom;
size_t prg_rom_size;
@ -16,7 +16,7 @@ struct Rom {
enum screen_mirroring mirror;
};
void parse_rom(const uint8_t *data, size_t data_len, struct Rom *rom);
void free_rom(struct Rom *rom);
void parse_rom(const uint8_t *data, size_t data_len, struct rom *rom);
void free_rom(struct rom *rom);
#endif /* ROM_H */