mirror of
https://github.com/thiagoauler/apple1.git
synced 2024-12-27 15:29:29 +00:00
more memory implementation
This commit is contained in:
parent
9d0fb5bb4b
commit
c244998a2e
20
src/memory.c
20
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user