more memory implementation

This commit is contained in:
Thiago Auler dos Santos 2017-11-28 01:10:57 -02:00
parent 9d0fb5bb4b
commit c244998a2e
1 changed files with 10 additions and 10 deletions

View File

@ -14,7 +14,7 @@
| RAM |
| |
| |
| 0FFF |
| 7FFF |
+ - - - - +
| |
@ -33,7 +33,7 @@
*/
db ram_memory[4096]; // total memory: 4KB
db ram_memory[32 * 1024]; // total memory: 32KB
db keyboard_buffer; // 0xD010
db keyboard_control; // 0xD011
@ -42,23 +42,23 @@ db display_control; // 0xD013
db read_byte(dw address)
{
if (address >= 0x0000 && address <= 0x0FFF)
if (address >= 0x0000 && address <= 0x7FFF)
{
// 4KB memory RAM
// 32KB memory RAM
return ram_memory[address];
}
else if (address == 0xD010)
else if (address == 0xD010 || address == 0xD0F0)
{
// when reading from keyboard buffer,
// its status control is disabled again
keyboard_control = 0x00;
return keyboard_buffer;
}
else if (address == 0xD011)
else if (address == 0xD011 || address == 0xD0F1)
{
return keyboard_control;
}
else if (address == 0xD012)
else if (address == 0xD012 || address == 0xD0F2)
{
return display_buffer;
}
@ -99,12 +99,12 @@ dw read_word(dw address)
void write_mem(dw address, db data)
{
if (address >= 0x0000 && address <= 0x0FFF)
if (address >= 0x0000 && address <= 0x7FFF)
{
// 4KB memory RAM
// 32KB memory RAM
ram_memory[address] = data;
}
else if (address == 0xD012)
else if (address == 0xD012 || address == 0xD0F2)
{
display_buffer = data;
}