Naredil read.asm da testiram ce pravilno berem znake iz datoteke
This commit is contained in:
parent
b35ff88e19
commit
a118970d61
1 changed files with 30 additions and 0 deletions
30
ass1/Rekurzija/read.asm
Normal file
30
ass1/Rekurzija/read.asm
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
rd START 0
|
||||
|
||||
LDT #10 . Za mnozenje z 10
|
||||
|
||||
rloop JSUB read
|
||||
COMP #0
|
||||
JEQ halt
|
||||
WD #1
|
||||
J rloop
|
||||
|
||||
halt J halt
|
||||
|
||||
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
|
||||
ADDR A, B . tmp += A
|
||||
STB tmp
|
||||
J read
|
||||
|
||||
rExit LDA tmp . Shranimo prebrano stevilko v A
|
||||
LDB #0
|
||||
STB tmp . Ponastavimo tmp
|
||||
RSUB
|
||||
|
||||
END rd
|
||||
|
||||
tmp WORD 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue