This commit is contained in:
Auios 2024-02-16 17:00:38 -05:00
parent 971f8a326c
commit 64a98f6add
4 changed files with 84 additions and 3 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
.vscode
.vscode
programs

30
examples/clear_screen.asm Normal file
View File

@ -0,0 +1,30 @@
.include _hwdefs.asm
.include _clrdefs.asm
;; Variables
.org SYSRAM
stack: byte[128]
;; Main
.org SYSROM
lds stack
jss cls
hlt
;; Clear the screen
FUNC cls:
ldp screen.char
ldc $00 ;; Blank
ldq screen.color
ldb CLR_BLACK ;; Black
.cls_loop: {
stc *p++
stb *q++
lda pl
cmp (lo(COLOR))
jnz .cls_loop
lda ph
cmp (hi(COLOR))
jnz }
rts

50
examples/functions.asm Normal file
View File

@ -0,0 +1,50 @@
.include _hwdefs.asm
.include _clrdefs.asm
;; Defines
.define VARS $0100
;; Variables
.org SYSRAM
stack: byte[128]
.org VARS
hello_str: "Hello world!\0"
;; Main
.org SYSROM
lds stack
jss cls
ldp screen.char
ldq hello_str
jss print
hlt
;; Clear the screen
FUNC cls:
ldp screen.char
ldc $00 ;; Blank
ldq screen.color
ldb CLR_BLACK ;; Black
.cls_loop: {
stc *p++
stb *q++
lda pl
cmp (lo(COLOR))
jnz .cls_loop
lda ph
cmp (hi(COLOR))
jnz }
rts
;; Print string (Q) to the current screen cursor (P)
FUNC print:
lda *q++
jpz .print_end
sta *p++
jmp print
.print_end:
rts

View File

@ -10,7 +10,7 @@ print:
lda *q++
jpz print_end
sta *p++
jmp print:
jmp print
print_end:
hlt
hlt