Create fibonacci.asm
This commit is contained in:
8
examples/fibonacci.asm
Normal file
8
examples/fibonacci.asm
Normal 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
16
examples/helloworld.asm
Normal 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
|
@ -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
|
Reference in New Issue
Block a user