IDK ce dela and i give up at this point
This commit is contained in:
parent
a118970d61
commit
a54d6c7f46
2 changed files with 16 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
|||
10
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
0
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue