Create fibonacci.asm

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

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