A more robust Read function

This commit is contained in:
Hikaru Ikuta 2022-01-04 06:34:58 +09:00
parent 90903662a9
commit 46ba9fee4f

View file

@ -104,8 +104,25 @@ PrintObject: # PrintObject(x:si)
jnz .PrintString # -> ret
ret
Read: xchg %dx,%ax
Print: mov (%si),%si # si = Cdr(e)
mov (%si),%ax # ax = Car(Cdr(e))
EvalPrint:
call Eval
push %ax
push %dx
xchg %ax,%si
call PrintObject
pop %dx
pop %ax
ret
Read: push %dx
call GetChar
call GetToken
call GetObject
pop %dx
ret
GetObject: # called just after GetToken
cmp $'(',%al
je GetList
@ -144,18 +161,6 @@ PutChar:mov $0x0e,%ah # prints CP-437
.RetDx: xchg %dx,%ax
ret
Print: mov (%si),%si # si = Cdr(e)
mov (%si),%ax # ax = Car(Cdr(e))
EvalPrint:
call Eval
push %ax
push %dx
xchg %ax,%si
call PrintObject
pop %dx
pop %ax
ret
////////////////////////////////////////////////////////////////////////////////
Evlis: test %di,%di # Evlis(m:di,a:dx):ax