Nardil stack

This commit is contained in:
Timon 2025-11-06 13:02:39 +01:00
parent 522f886eea
commit 68480249b4
3 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,27 @@
prog START 0
JSUB sinit
LDA #5
JSUB sum
halt J halt
stkp WORD 0
stk RESW 1000
sinit . nastavi stkp na zacetek sklada
rsum COMP #2
STL rsumL . Base case
JLT rsumExit
RMO A, B
SUB #1 . recursive case
JSUB rsum . rsum(n-1)
ADDR B, A
rsumExit LDL rsumL
RSUB
rsumL WORD 0
END prog