Compare commits

...

2 commits

Author SHA1 Message Date
Timon
c305a8bdb4 Poskusu dokoncat rekurzijo, neki ne dela, dosti imam 2025-11-10 15:11:43 +01:00
Timon
9f753e66c4 modified gitignore 2025-11-10 13:44:58 +01:00
4 changed files with 33 additions and 14 deletions

3
.gitignore vendored
View file

@ -3,4 +3,5 @@ Primer/
#Ignorej sictools
sictools.jar
#ignorej ukaze za sic/xe
Appendix_A_thru_C.pdf
Appendix_A_thru_C.pdf
rek_sum.asm

View file

@ -1,4 +1,4 @@
1
10
5
7
6
0

View file

@ -1,5 +1,5 @@
prog START 0
+JSUB sinit
JSUB sinit
LDA #5
JSUB fa
WD #1

View file

@ -1,16 +1,34 @@
rek START 0
JSUB sinit
LDT #10
loop RD #0xFA
COMP #1
loop JSUB read . Pretvorimo iz ASCII v stevilko
COMP #1 . Če je (A) <= 1 končamo, ker 0!=1!=1
JLT halt
JSUB fa
WD #1
CLEAR A
J loop
JSUB fa . Sicer izračunamo (A)!
WD #1 . Zapišemo na std izhod
CLEAR B
CLEAR A
J loop . Gremo prebrat naslednji vhod
halt J halt
halt J halt
fa STL @stkp
read RD #0xFA
COMP #0xA
JEQ rExit . Če preberemo newline gremo na izhod
SUB #0x30 . Sicer iz ascii kode dobimo stevko
LDB tmp
MULR T, B . tmp *= 10
ADDR A, B . tmp += A
STB tmp
J read
rExit LDA tmp
LDB #0
STB tmp
RSUB
fa STL @stkp
JSUB spush
STB @stkp
JSUB spush
@ -23,7 +41,7 @@ fa STL @stkp
MULR B, A
faExit JSUB spop
faExit JSUB spop
LDB @stkp
JSUB spop
LDL @stkp
@ -55,5 +73,5 @@ spop . stkp--
stkp WORD 0
stk RESW 1000
stkA WORD 0
tmp WORD 0
END rek