working on sicxe
This commit is contained in:
parent
1b990e190c
commit
d836b3955d
79 changed files with 2011 additions and 917 deletions
134
ass1/fac.asm
134
ass1/fac.asm
|
|
@ -1,68 +1,68 @@
|
|||
prog START 0
|
||||
zacetek CLEAR X
|
||||
loop RD #0xFA
|
||||
COMP #0
|
||||
JEQ halt
|
||||
JSUB fact
|
||||
WD #1
|
||||
J loop
|
||||
|
||||
halt J halt
|
||||
|
||||
.fakulteta
|
||||
fact COMP #1
|
||||
JGT rec
|
||||
LDA #1 .base case
|
||||
RSUB
|
||||
|
||||
rec STL @stkp
|
||||
JSUB spush
|
||||
STA @stkp
|
||||
JSUB spush
|
||||
STB @stkp
|
||||
JSUB spush
|
||||
|
||||
RMO A, B .shrani n v B
|
||||
SUB #1 .n-1
|
||||
JSUB fact .fact(n-1)
|
||||
MULR B, A .n * fact(n-1)
|
||||
|
||||
JSUB spop
|
||||
LDB @stkp
|
||||
JSUB spop
|
||||
.LDA @stkp da ne povozimo odgovora?
|
||||
JSUB spop
|
||||
LDL @stkp
|
||||
|
||||
|
||||
|
||||
RSUB
|
||||
|
||||
|
||||
.rutine za sklad
|
||||
sinit STA stkA
|
||||
LDA #stkRESW .inicializiraj stkp
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
spush STA stkA
|
||||
LDA stkp .poveca stkp za 3
|
||||
ADD #3
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
spop STA stkA
|
||||
LDA stkp .zmanjsa stkp za 3
|
||||
SUB #3
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
.podatki za sklad
|
||||
stkp WORD 0
|
||||
stkA WORD 0
|
||||
stkRESW RESW 1000
|
||||
|
||||
prog START 0
|
||||
zacetek CLEAR X
|
||||
loop RD #0xFA
|
||||
COMP #0
|
||||
JEQ halt
|
||||
JSUB fact
|
||||
WD #1
|
||||
J loop
|
||||
|
||||
halt J halt
|
||||
|
||||
.fakulteta
|
||||
fact COMP #1
|
||||
JGT rec
|
||||
LDA #1 .base case
|
||||
RSUB
|
||||
|
||||
rec STL @stkp
|
||||
JSUB spush
|
||||
STA @stkp
|
||||
JSUB spush
|
||||
STB @stkp
|
||||
JSUB spush
|
||||
|
||||
RMO A, B .shrani n v B
|
||||
SUB #1 .n-1
|
||||
JSUB fact .fact(n-1)
|
||||
MULR B, A .n * fact(n-1)
|
||||
|
||||
JSUB spop
|
||||
LDB @stkp
|
||||
JSUB spop
|
||||
.LDA @stkp da ne povozimo odgovora?
|
||||
JSUB spop
|
||||
LDL @stkp
|
||||
|
||||
|
||||
|
||||
RSUB
|
||||
|
||||
|
||||
.rutine za sklad
|
||||
sinit STA stkA
|
||||
LDA #stkRESW .inicializiraj stkp
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
spush STA stkA
|
||||
LDA stkp .poveca stkp za 3
|
||||
ADD #3
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
spop STA stkA
|
||||
LDA stkp .zmanjsa stkp za 3
|
||||
SUB #3
|
||||
STA stkp
|
||||
LDA stkA
|
||||
RSUB
|
||||
|
||||
.podatki za sklad
|
||||
stkp WORD 0
|
||||
stkA WORD 0
|
||||
stkRESW RESW 1000
|
||||
|
||||
END prog
|
||||
Loading…
Add table
Add a link
Reference in a new issue