Nardil stack
This commit is contained in:
parent
522f886eea
commit
68480249b4
3 changed files with 80 additions and 0 deletions
37
ass1/Rekurzija/stack.asm
Normal file
37
ass1/Rekurzija/stack.asm
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
prog START 0
|
||||
JSUB sinit
|
||||
LDX #5
|
||||
STX @stkp
|
||||
JSUB spush
|
||||
JSUB spop
|
||||
CLEAR X
|
||||
LDX @stkp
|
||||
halt J halt
|
||||
|
||||
stkp WORD 0
|
||||
stk RESW 1000
|
||||
stkA WORD 0 . Zacasni prostor za shranjevanje registra A
|
||||
|
||||
sinit STA stkA
|
||||
LDA #stk
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
spush . stkp++
|
||||
STA stkA
|
||||
LDA stkp
|
||||
ADD #3
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
spop . stkp--
|
||||
STA stkA
|
||||
LDA stkp
|
||||
SUB #3
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
END prog
|
||||
Loading…
Add table
Add a link
Reference in a new issue