rename struct Rom to struct rom
This commit is contained in:
parent
7d148924e2
commit
362341eac3
3
cpu.c
3
cpu.c
@ -36,7 +36,7 @@
|
|||||||
#define PULL() \
|
#define PULL() \
|
||||||
(peek(0x0100 + ++regs.sp))
|
(peek(0x0100 + ++regs.sp))
|
||||||
|
|
||||||
struct Rom rom = {0};
|
struct rom rom = {0};
|
||||||
uint32_t cycles = 0;
|
uint32_t cycles = 0;
|
||||||
|
|
||||||
bool page_crossed = false;
|
bool page_crossed = false;
|
||||||
@ -1020,6 +1020,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
parse_rom(buf, buflen, &rom);
|
parse_rom(buf, buflen, &rom);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
ppu.rom = &rom;
|
||||||
|
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
|
5
ppu.h
5
ppu.h
@ -11,10 +11,7 @@ struct ppu {
|
|||||||
uint8_t vram[2048];
|
uint8_t vram[2048];
|
||||||
uint8_t palette[16*2];
|
uint8_t palette[16*2];
|
||||||
uint16_t cycles, scanlines;
|
uint16_t cycles, scanlines;
|
||||||
/* copied from rom */
|
struct rom *rom;
|
||||||
uint8_t *chr_rom;
|
|
||||||
size_t chr_rom_size;
|
|
||||||
enum screen_mirroring mirror;
|
|
||||||
};
|
};
|
||||||
extern struct ppu ppu;
|
extern struct ppu ppu;
|
||||||
|
|
||||||
|
4
rom.c
4
rom.c
@ -6,7 +6,7 @@
|
|||||||
#include "rom.h"
|
#include "rom.h"
|
||||||
|
|
||||||
void
|
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 prg_rom_offset = 16;
|
||||||
size_t chr_rom_offset = 0;
|
size_t chr_rom_offset = 0;
|
||||||
@ -48,7 +48,7 @@ parse_rom(const uint8_t *data, size_t data_len, struct Rom *rom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
free_rom(struct Rom *rom)
|
free_rom(struct rom *rom)
|
||||||
{
|
{
|
||||||
free(rom->prg_rom);
|
free(rom->prg_rom);
|
||||||
if (rom->chr_rom_size > 0)
|
if (rom->chr_rom_size > 0)
|
||||||
|
6
rom.h
6
rom.h
@ -7,7 +7,7 @@ enum screen_mirroring {
|
|||||||
M_FOUR,
|
M_FOUR,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Rom {
|
struct rom {
|
||||||
char *prg_rom;
|
char *prg_rom;
|
||||||
char *chr_rom;
|
char *chr_rom;
|
||||||
size_t prg_rom_size;
|
size_t prg_rom_size;
|
||||||
@ -16,7 +16,7 @@ struct Rom {
|
|||||||
enum screen_mirroring mirror;
|
enum screen_mirroring mirror;
|
||||||
};
|
};
|
||||||
|
|
||||||
void parse_rom(const uint8_t *data, size_t data_len, struct Rom *rom);
|
void parse_rom(const uint8_t *data, size_t data_len, struct rom *rom);
|
||||||
void free_rom(struct Rom *rom);
|
void free_rom(struct rom *rom);
|
||||||
|
|
||||||
#endif /* ROM_H */
|
#endif /* ROM_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user