From c244998a2e95f693877b1132b6d4ba68d2d5712e Mon Sep 17 00:00:00 2001 From: Thiago Auler dos Santos Date: Tue, 28 Nov 2017 01:10:57 -0200 Subject: [PATCH] more memory implementation --- src/memory.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/memory.c b/src/memory.c index 75781e3..fc524f0 100644 --- a/src/memory.c +++ b/src/memory.c @@ -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; }