- [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
This commit is contained in:
44
mbc_none.cpp
44
mbc_none.cpp
@@ -1,5 +1,6 @@
|
||||
#include "mbc_none.h"
|
||||
#include "mem.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace mbc_none
|
||||
{
|
||||
@@ -10,6 +11,8 @@ namespace mbc_none
|
||||
uint8_t wram[8192];
|
||||
uint8_t hram[512];
|
||||
|
||||
uint8_t tags[65536];
|
||||
|
||||
uint8_t readMem(uint16_t address)
|
||||
{
|
||||
if (address < 0x8000) {
|
||||
@@ -47,10 +50,49 @@ namespace mbc_none
|
||||
}
|
||||
}
|
||||
|
||||
void init(uint8_t *rom)
|
||||
uint8_t getTag(uint16_t address)
|
||||
{
|
||||
return tags[address];
|
||||
}
|
||||
|
||||
void setTag(uint16_t address, uint8_t value)
|
||||
{
|
||||
tags[address] = value;
|
||||
}
|
||||
|
||||
void saveState(FILE* f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void loadState(FILE *f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void init(uint8_t *rom, uint32_t rom_size, uint32_t ram_size)
|
||||
{
|
||||
mem::readMem = mbc_none::readMem;
|
||||
mem::writeMem = mbc_none::writeMem;
|
||||
mem::getTag = mbc_none::getTag;
|
||||
mem::setTag = mbc_none::setTag;
|
||||
mem::saveState = mbc_none::saveState;
|
||||
mem::loadState = mbc_none::loadState;
|
||||
|
||||
mbc_none::rom = rom;
|
||||
|
||||
FILE *f = fopen("dmg_boot.bin", "rb");
|
||||
if (!f) { printf("ABORTING: 'dmg_boot.bin' not found!\n"); exit(1); }
|
||||
fseek(f, 0, SEEK_END);
|
||||
const int size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
fread(bootrom, size, 1, f);
|
||||
fclose(f);
|
||||
|
||||
for (int i=0; i<8192; ++i) { vram[i] = 0; }
|
||||
for (int i=0; i<8192; ++i) { exram[i] = 0; }
|
||||
for (int i=0; i<8192; ++i) { wram[i] = 0; }
|
||||
for (int i=0; i<512; ++i) { hram[i] = 0; }
|
||||
for (int i=0; i<65536; ++i) { tags[i] = MEMTAG_NONE; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user