add msbasic
This commit is contained in:
1 parent
d37d434228
commit
c5a028c8c6
104 files changed
+25598
-13802
No files matched your search
+52
-52
@@ -1,53 +1,53 @@
|
||||
#include "memoryMap.h"
|
||||
|
||||
uint8_t readMemory(uint16_t address, uint8_t *ram, uint8_t *rom) {
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t readStack(uint8_t address, uint8_t *ram) { return ram[0x100 + address]; }
|
||||
|
||||
#include "memoryMap.h"
|
||||
|
||||
uint8_t readMemory(uint16_t address, uint8_t *ram, uint8_t *rom) {
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t readStack(uint8_t address, uint8_t *ram) { return ram[0x100 + address]; }
|
||||
|
||||
void writeStack(uint8_t address, uint8_t value, uint8_t *ram) { ram[0x100 + address] = value; }
|
||||
Reference in new issue
Block a user