IDK ce dela and i give up at this point

This commit is contained in:
Timon 2025-11-12 18:21:53 +01:00
parent a118970d61
commit a54d6c7f46
2 changed files with 16 additions and 10 deletions

View file

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

View file

@ -2,20 +2,24 @@ rek START 0
JSUB sinit
LDT #10
loop JSUB read . Pretvorimo iz ASCII v stevilko
COMP #1 . Če je (A) <= 1 končamo, ker 0!=1!=1
JLT halt
JSUB fa . Sicer izračunamo (A)!
WD #1 . Zapišemo na std izhod
+STCH @screen
LDA screen
ADD #1
STA screen
CLEAR B
CLEAR A
J loop . Gremo prebrat naslednji vhod
halt J halt
read RD #0xFA
COMP #0xA
JEQ rExit . Če preberemo newline gremo na izhod
read RD #0xFA . V A se shrani naslednji prebrani znak
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
@ -23,10 +27,10 @@ read RD #0xFA
STB tmp
J read
rExit LDA tmp
LDB #0
STB tmp
RSUB
rExit LDA tmp . Shranimo prebrano stevilko v A
LDB #0
STB tmp . Ponastavimo tmp
RSUB
fa STL @stkp
JSUB spush
@ -70,6 +74,7 @@ spop . stkp--
LDA stkA
RSUB
screen WORD 0xb800
stkp WORD 0
stk RESW 1000
stkA WORD 0