NESEmulator/NES Emulator/mapper.h

33 lines
987 B
C
Raw Normal View History

2021-10-28 14:57:37 +00:00
#ifndef _MAPPER_H_
#define _MAPPER_H_
#include <stdio.h>
2021-10-29 20:33:34 +00:00
#include "SDL.h"
2021-10-28 14:57:37 +00:00
#include "types.h"
struct PPU;
struct Mapper
{
Byte id;
void* mapperStruct;
Byte(*read_cpu)(void*, Word);
Byte(*read_ppu)(void*, Word);
void(*write_cpu)(void*, Word, Byte);
void(*write_ppu)(void*, Word, Byte);
2021-10-29 20:33:34 +00:00
void(*get_pattern_table_texture)(void*, SDL_Texture*, int);
2021-10-28 14:57:37 +00:00
};
#define MapperReadCPU(mapper, addr) mapper->read_cpu(mapper->mapperStruct, addr)
#define MapperReadPPU(mapper, addr) mapper->read_ppu(mapper->mapperStruct, addr)
#define MapperWriteCPU(mapper, addr, val) mapper->write_cpu(mapper->mapperStruct, addr, val)
#define MapperWritePPU(mapper, addr, val) mapper->write_ppu(mapper->mapperStruct, addr, val)
#define GetPatternTableTexture(mapper, texture, index) mapper->get_pattern_table_texture(mapper->mapperStruct, texture, index)
struct Mapper* createMapper(Byte id, Byte prg_rom_size, Byte chr_rom_size, FILE* fp);
void destroyMapper(struct Mapper* mapper);
2021-10-29 20:33:34 +00:00
#endif // _MAPPER_H_