clean up documentation, clean up dead code, add some instrs
This commit is contained in:
75
memoryMap.md
75
memoryMap.md
@@ -1,45 +1,48 @@
|
||||
## Boot ROM
|
||||
Execution starts here, at address `$0000`.<br>
|
||||
The main program is located here, or the OS bootloader if an OS is present.
|
||||
|
||||
## Main RAM
|
||||
8 KiB of random-access memory.<br>
|
||||
Located at addresses `$8000` to `$9FFF`.<br>
|
||||
Programs can write data to these addresses, and retrieve the data at a later time.<br>
|
||||
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.<br>
|
||||
`$2000` is the top left, `$27FF` is the bottom right.<br>
|
||||
Rows are 64 bytes long.<br>
|
||||
For example, `$2040` would be the first character of the second row from the top.<br>
|
||||
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.<br>
|
||||
If the most significant bit is 1, the character and background colors will be inverted, i.e. highlighted.<br>
|
||||
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.<br>
|
||||
Located at addresses `$0000` to `$03FF`.<br>
|
||||
When the CPU is first turned on, or is reset, it will start executing code from here, starting at address `$0000`.<br>
|
||||
Bricks can be physically placed on top of the ROM brick to set bits within the ROM.<br>
|
||||
A bootloader, operating system, or hex monitor may be loaded here.
|
||||
|
||||
## GPIO
|
||||
Contains hardware multiplication (`$0400 * $0401 -> $0400`) and division (`$0402 / $0403 -> $0402 r $0403`), popcount (`$0404 -> $0404`), and a timer (`$0405`).<br>
|
||||
Value written to timer register = number of game ticks (32 ms) between interrupt triggers.<br>
|
||||
Write 0 to disable.
|
||||
Contains hardware multiplication, division, popcount, and a timer.<br>
|
||||
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.<br>
|
||||
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`<br>
|
||||
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 key event<br>
|
||||
7-bit Windows VKey code, MSB 1 = press, 0 = release<br>
|
||||
Returns 0 if buffer is empty.
|
||||
Write 1 to `$0500` to enable keyboard interrupts, 0 to disable.
|
||||
Read address `$0500` to get the next keycode from the buffer.<br>
|
||||
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.<br>
|
||||
Result will be 0 if the buffer is empty.<br>
|
||||
If 1 is written to `$0500`, an interrupt will be triggered whenever a key event is available. Write 0 to disable again.
|
||||
|
||||
## Serial Peripheral Interface
|
||||
Not yet implemented.
|
||||
|
||||
## Robot Controller
|
||||
Write to `$0701` to control the robot. Each bit is an action - MSB to LSB: Plant brick, destroy brick, move forward, backward, left, right, up, down.<br>
|
||||
Write a 6-bit color ID to `$0700` to set the color of the bricks the robot plants.<br>
|
||||
Read `$0700` to get the color of the brick the robot is on. MSB = brick exists. Returns 0 if no brick.
|
||||
|
||||
|
||||
## Text Display
|
||||
Write ASCII values to `$0800` to `$0BFF` to display characters at certain positions on screen.<br>
|
||||
`$0800` is top left, `$0BFF` is bottom right, rows are 64 bytes.
|
||||
|
||||
## Text Display Color
|
||||
Write 6-bit color IDs to `$0C00` to `$0FFF` to set the color of characters on screen.<br>
|
||||
MSB = whether to invert character mask (i.e. for highlighting).
|
||||
|
||||
## System RAM
|
||||
The OS may use this memory for the stack, system variables, etc.<br>
|
||||
If no OS is present, this memory can be used for any purpose, etc.<br>
|
||||
Located at `$1000` to `$1FFF`.
|
||||
|
||||
## User ROM
|
||||
User program and data can go here.<br>
|
||||
If no OS is present, the boot ROM will need to jump into this code.<br>
|
||||
Located at `$2000` to `$2FFF`.
|
||||
|
||||
## User RAM
|
||||
Your code can use this memory for variables, arrays, a heap, etc.<br>
|
||||
Located at `$3000` to `$3FFF`.
|
||||
Write to `$0701` to control a 1x1f-sized "robot" that can place and destroy bricks.<br>
|
||||
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.<br>
|
||||
Write a 6-bit color ID to `$0700` to set the color of the bricks the robot will plant.<br>
|
||||
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.<br>
|
||||
The robot should only be given new actions once per game tick. The timer at `$0405` can be used for this purpose.
|
||||
|
||||
Reference in New Issue
Block a user