Trevor Merritt e29ac45c84 scroll down works on CHIP-8 and High-Res modes
scroll left and right work in stdef and hidef
adds octo test roms
adds schip fonts to memory
2024-10-27 11:41:25 -04:00

56 lines
821 B
Plaintext

###########################################
#
# A modular stack data structure using
# a v0-based calling convention.
# This approach reserves a dedicated
# register for a stack pointer and as
# a result is very simple and fast.
# maximum stack size is 256 bytes.
#
###########################################
:alias stack-ptr vd
: stack 0 0 0 0 0 0 0 0
: push
i := stack
i += stack-ptr
save v0
stack-ptr += 1
;
: pop
stack-ptr += -1
i := stack
i += stack-ptr
load v0
;
###########################################
#
# Usage Example:
#
###########################################
: print
# takes an arg in v0
i := hex v0
sprite va vb 5
va += 6
;
: main
va := 3
vb := 3
v0 := 5 push
v0 := 3 push
v0 := 1 push
pop print
v0 := 9 push
pop print
pop print
pop print
# should print '1935'