diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..600d2d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4594df2..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "editor.tabSize": 4 -} - diff --git a/examples/fibonacci.asm b/examples/fibonacci.asm new file mode 100644 index 0000000..63a632e --- /dev/null +++ b/examples/fibonacci.asm @@ -0,0 +1,8 @@ +lda 1 +ldb 0 + +fib_loop: +ldc b +ldb a +add c +jlt fib_loop ; Stop when carry flag is set \ No newline at end of file diff --git a/examples/helloworld.asm b/examples/helloworld.asm new file mode 100644 index 0000000..baf2b0b --- /dev/null +++ b/examples/helloworld.asm @@ -0,0 +1,16 @@ +.org $0100 ; Static data +hello_str: +"Hello world\0" + +.org $0000 ; Program must start at $0000 +ldp $0800 ; Char display +ldq hello_str + +print: +lda *q++ +jpz print_end +sta *p++ +jmp print: + +print_end: +hlt \ No newline at end of file diff --git a/examples/add1.asm b/examples/increment_reg.asm similarity index 88% rename from examples/add1.asm rename to examples/increment_reg.asm index 512dd70..38112ac 100644 --- a/examples/add1.asm +++ b/examples/increment_reg.asm @@ -1,7 +1,8 @@ ; This program adds 1 to register A until it equals 64, then halts. -ldb 1 + loop: -add b +inc a cmp 64 jnz loop + hlt \ No newline at end of file diff --git a/memoryMap.md b/memoryMap.md new file mode 100644 index 0000000..cc1ea6d --- /dev/null +++ b/memoryMap.md @@ -0,0 +1,36 @@ +## Boot ROM +Execution starts here, at address `$0000`. +The OS bootloader is located here. + +## GPIO +Contains hardware multiplication (`$0400`-`$0401`) and division (`$0402`-`$0403`), popcount (`$0404`), and a timer (`$0405`). + +## Keyboard +Read address `$0500` to get the next key event (7-bit Windows VKey code, MSB on indicates press/release). Returns 0 if empty. +Write 1 to `$0500` to enable interrupts. + +## Serial Peripheral Interface +Not yet implemented. + +## Robot Controller +Not directly mentioned in the provided code snippets, but if it follows a similar addressing scheme, it would have a specific range not covered here. + +## Text Display +Write ASCII values to addresses `$0800` to `$0FFF` to display characters at certain positions on the screen. +`$0800` is the top left, `$0FFF` would be the bottom right, considering the character display dimensions and memory layout. + +## Text Display Color +Write 6-bit color IDs to addresses `$0800` to `$0FFF` to set the color of characters on screen. +MSB = whether to invert character mask (i.e., for highlighting). This might need clarification or correction based on the actual implementation, as it seems to overlap with the Text Display's address range. + +## System RAM +The OS may use this memory for the stack, system variables, etc., located at `$1000` to `$1FFF`. + +## User ROM +Your program and data go here, located at `$2000` to `$2FFF`. + +## User RAM +Your code can use this memory for variables, arrays, a heap, etc., located at `$3000` to `$3FFF`. + +## Video Display +Not directly mentioned in the provided snippets for addressing, but based on the peripheral configuration, it would be addressed from `$8000` to `$FFFF` for direct pixel manipulation or other video-related functions. diff --git a/readme.md b/readme.md index f7a0ded..e204f56 100644 --- a/readme.md +++ b/readme.md @@ -27,3 +27,5 @@ For a list of instructions, see [instructionList.txt](instructionList.txt). love . C:/path/filename.asm ``` +## Memory Map +[memory map](memoryMap.md)