51 lines
622 B
NASM
51 lines
622 B
NASM
.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
|