54 lines
No EOL
948 B
NASM
54 lines
No EOL
948 B
NASM
prog START 0
|
|
JSUB sinit
|
|
LDA #5
|
|
JSUB fa
|
|
WD #1
|
|
|
|
halt J halt
|
|
|
|
fa STL @stkp
|
|
JSUB spush
|
|
STB @stkp
|
|
JSUB spush
|
|
. Base case
|
|
COMP #2
|
|
JLT faExit
|
|
RMO A, B
|
|
SUB #1
|
|
JSUB fa
|
|
MULR B, A
|
|
|
|
|
|
faExit JSUB spop
|
|
LDB @stkp
|
|
JSUB spop
|
|
LDL @stkp
|
|
RSUB
|
|
|
|
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 |