added stack

This commit is contained in:
zanostro 2025-11-15 12:16:56 +01:00
parent 47f3dcfc12
commit 63d5b3448f

56
ass1/stack.asm Normal file
View file

@ -0,0 +1,56 @@
.code
stack START 0
LDA #9
STA @stackptr
JSUB stackpush . PUSHA
JSUB stackpop . POPA
LDA @stackptr
halt J halt
stackinit
STA stacktmp
LDA #STACK
STA stackptr
LDA stacktmp
RSUB
stackpush
STA stacktmp
LDA stackptr
ADD #3
STA stackptr
LDA stacktmp
RSUB
stackpop
STA stacktmp
LDA stackptr
SUB #3
STA stackptr
LDA stacktmp
RSUB
.data
stackptr WORD 0
stacktmp WORD 0
STACKSIZE EQU 50
STACK RESW STACKSIZE
END stack