From 46ba9fee4fd5630c5611c4efdd8503a5675ee80e Mon Sep 17 00:00:00 2001 From: Hikaru Ikuta Date: Tue, 4 Jan 2022 06:34:58 +0900 Subject: [PATCH] A more robust Read function --- sectorlisp.S | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/sectorlisp.S b/sectorlisp.S index 8bb5831..9ae8b8e 100644 --- a/sectorlisp.S +++ b/sectorlisp.S @@ -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