Fix run on linux

This commit is contained in:
Kilian committed 2026-08-31 04:43:52 +02:00
1 parent f5672ee9c3
commit d37d434228
13 files changed
+151 -98

No files matched your search

+21 -12
View File
@@ -1,41 +1,50 @@
#include "memoryMap.h"
uint8_t readMemory(uint16_t address, uint8_t *ram, uint8_t *rom) {
if (address < RAM_SIZE || address >= IO_BASE + IO_SIZE) { // FIXME: Expanded for debug
if ((address < RAM_SIZE && address < IO_BASE) || address >= ROM_BASE) {
if (address >= ROM_BASE && ram[IO_BASE + ROM_BANKED_OUT] == 0) {
return rom[address - ROM_BASE];
}
return ram[address];
} else if (address < RAM_SIZE + IO_SIZE) {
uint16_t _address = address - RAM_SIZE;
} else {
uint16_t _address = address - IO_BASE;
switch (_address) {
case KEYBOARD_ADDRESS: {
return getChar();
}
case ROM_BANKED_OUT: {
return ram[IO_BASE + ROM_BANKED_OUT];
}
default:
break;
}
return 0;
} else {
return rom[address - RAM_SIZE - IO_SIZE];
}
}
void writeMemory(uint16_t address, uint8_t value, uint8_t *ram, uint8_t *rom) {
if (address < RAM_SIZE) {
ram[address] = value;
} else if (address < RAM_SIZE + IO_SIZE || address >= IO_BASE + IO_SIZE) { // FIXME: Expanded for debug
uint16_t _address = address - RAM_SIZE;
void writeMemory(uint16_t address, uint8_t value, uint8_t *ram) {
if ((address < RAM_SIZE && address < IO_BASE) || address >= ROM_BASE) {
if (address < ROM_BASE && ram[IO_BASE + ROM_BANKED_OUT] != 0) {
ram[address] = value;
}
} else {
uint16_t _address = address - IO_BASE;
switch (_address) {
case SCREEN_ADDRESS: {
putChar(value);
break;
}
case ROM_BANKED_OUT: {
ram[IO_BASE + ROM_BANKED_OUT] = value;
break;
}
default:
break;
}
} else {
rom[address - RAM_SIZE - IO_SIZE] = value;
}
}