- Comencem a implementar la memòria
- Afegim la boot rom, i el tetris pa anar probant
This commit is contained in:
BIN
dmg_boot.bin
Normal file
BIN
dmg_boot.bin
Normal file
Binary file not shown.
37
mem.cpp
Normal file
37
mem.cpp
Normal 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
3
mem.h
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user