- Comencem a implementar la memòria

- Afegim la boot rom, i el tetris pa anar probant
This commit is contained in:
2025-01-13 21:57:50 +01:00
parent bf8ecb19bb
commit f766c40cc7
4 changed files with 41 additions and 1 deletions

BIN
dmg_boot.bin Normal file

Binary file not shown.

37
mem.cpp Normal file
View File

@@ -0,0 +1,37 @@
#include "mem.h"
#include <stdlib.h>
namespace mem
{
char *title = nullptr;
uint8_t *memory = nullptr;
uint8_t *mapper_type = nullptr;
uint8_t *rom_size = nullptr;
uint8_t *ram_size = nullptr;
void init(const uint8_t* rom, const int size)
{
if (memory) free(memory);
memory = (uint8_t*)malloc(size);
title = (char*)&memory[0x134];
mapper_type = &memory[0x147];
rom_size = &memory[0x148];
ram_size = &memory[0x149];
}
void reset()
{
}
uint8_t readMem(uint16_t address)
{
}
void writeMem(uint16_t address, uint8_t value)
{
}
}

3
mem.h
View File

@@ -3,6 +3,9 @@
namespace mem namespace mem
{ {
#define MAPPER_NONE 0
void init(const uint8_t* rom, const int size);
void reset(); void reset();
uint8_t readMem(uint16_t address); uint8_t readMem(uint16_t address);
void writeMem(uint16_t address, uint8_t value); void writeMem(uint16_t address, uint8_t value);

BIN
tetris.gb Normal file

Binary file not shown.