Create fibonacci.asm

This commit is contained in:
Auios 2024-02-13 18:38:02 -05:00
parent 861820aa49
commit e1540ff2b1
7 changed files with 66 additions and 6 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.vscode

View File

@ -1,4 +0,0 @@
{
"editor.tabSize": 4
}

8
examples/fibonacci.asm Normal file
View File

@ -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

16
examples/helloworld.asm Normal file
View File

@ -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

View File

@ -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

36
memoryMap.md Normal file
View File

@ -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.

View File

@ -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)