Files
gameboy/mem.cpp
Raimon Zamora ab77116dca - [NEW] Afegit modul debug
- [NEW] Afegit tagging de memòria
- [NEW] modul mbc_none funcional
- [NEW] Afegit modul main base del programa
- [NEW] Afegits Makefile i .gitignore
- Primera execució. No arriba a 0x0100
- [FIX] Corregida la representació del ensamblador cap enrere
2025-01-15 15:42:14 +01:00

41 lines
886 B
C++

#include "mem.h"
#include <stdlib.h>
#include <stdio.h>
#include "mbc_none.h"
namespace mem
{
uint8_t(*readMem)(uint16_t);
void (*writeMem)(uint16_t, uint8_t);
uint8_t(*getTag)(uint16_t);
void (*setTag)(uint16_t, uint8_t);
void (*saveState)(FILE*);
void (*loadState)(FILE*);
char *title = nullptr;
void init(uint8_t* rom, const int size)
{
//if (memory) free(memory);
//memory = (uint8_t*)malloc(size);
title = (char*)&rom[0x134];
uint8_t mapper_type = rom[0x147];
uint32_t rom_size = 32768 * (1 << rom[0x148]);
int sizes[] = { 0, 0, 8, 32, 128, 64};
uint32_t ram_size = sizes[rom[0x149]] * 1024;
switch (mapper_type)
{
case 0x00:
mbc_none::init(rom, rom_size, ram_size);
break;
};
}
void reset()
{
}
}