Initial commit of files related to NED architecture.
[ned1] / software / assembly_fragments / ansi_escape.asm
# ASCII NUL
WORD_0
# ASCII 'G'
WORD_70
IM_1
ADD
# ASCII '1'
WORD_48
IM_1
ADD
# ASCII '['
WORD_90
IM_1
ADD
# ASCII ESC
WORD_26
IM_1
ADD
# ASCII 'K'
WORD_74
IM_1
ADD
# ASCII '2'
WORD_50
# ASCII '['
WORD_90
IM_1
ADD
# ASCII ESC
WORD_26
IM_1
ADD
# ASCII 'H'
WORD_72
# Print characters
printstring
LDSP+0
TEST
BRZ>halt
JSR>putchar
JMP>printstring
halt
TEST # Clean the null terminator off the stack.
HALT
putchar
# Description:
# Writes one character to the terminal.
# Stack Requirements:
# Character to write
# Return PC <-- TOS
WORD_134217728 # XBUF
WORD_134217732 # XCSR
LDSP+3
SWAP
putcharloop
LDSP+0
LOAD
TEST
BRZ>putcharloop
TEST # Drop XCSR from stack
SWAP
STORE
# Wrote the character. Clean up stack and return.
STSP+0
RTS