8608/memoryMap.md
2024-08-11 02:39:37 -06:00

3.0 KiB

Main RAM

8 KiB of random-access memory.
Located at addresses $8000 to $9FFF.
Programs can write data to these addresses, and retrieve the data at a later time.
Machine code can also be stored here and executed.

Text Display

Write ASCII values to addresses $2000 to $27FF to display characters at certain positions on the screen.
$2000 is the top left, $27FF is the bottom right.
Rows are 64 bytes long.
For example, $2040 would be the first character of the second row from the top.
Values can also be read back out of the display memory, as if it were RAM.

Text Display Color

Write 6-bit color IDs to addresses $0C00 to $0FFF to set the color of characters on the screen.
If the most significant bit is 1, the character and background colors will be inverted, i.e. highlighted.
Values can also be read back out of the display color memory, as if it were RAM.

Main ROM

1 KiB of read-only memory.
Located at addresses $0000 to $03FF.
When the CPU is first turned on, or is reset, it will start executing code from here, starting at address $0000.
Bricks can be physically placed on top of the ROM brick to set bits within the ROM.
A bootloader, operating system, or hex monitor may be loaded here.

GPIO

Contains hardware multiplication, division, popcount, and a timer.
When two 8-bit values are written to the multiplier registers $0400 and $0401, the result will be available as a big-endian 16-bit value at $0400. Read from $0401 to retrieve an 8-bit result.
When two 8-bit values are written to the divider registers $0402 and $0403, the quotient can be read from $0402 and the remainder from $0403
When any 8-bit value is written to the timer register $0404, the popcount of that value (The number of bits that are 1) can be read from the same location. When any value is written to the timer register at $0405, an interrupt will be triggered after 32 milliseconds.

Keyboard

Read address $0500 to get the next keycode from the buffer.
Keycodes are 7-bit Windows VKey codes, plus a press/release bit. If the MSB is 1, the event is a key press; if 0, a release.
Result will be 0 if the buffer is empty.
If 1 is written to $0500, an interrupt will be triggered whenever a key event is available. Write 0 to disable again.

Robot Controller

Write to $0701 to control a 1x1f-sized "robot" that can place and destroy bricks.
Each bit indicates an action; if that bit is set, that action will be taken. From MSB to LSB: Plant brick, destroy brick, move forward, backward, left, right, up, down.
Write a 6-bit color ID to $0700 to set the color of the bricks the robot will plant.
Read $0700 to get the color of the brick the robot is currently overlapping. If the MSB is 1, a brick exists at this location. Result will be 0 if no brick is present.
The robot should only be given new actions once per game tick. The timer at $0405 can be used for this purpose.