From 36678457f38d57e43d2c99be50fcd99cbea292a8 Mon Sep 17 00:00:00 2001 From: Hikaru Ikuta Date: Thu, 6 Jan 2022 12:44:40 +0900 Subject: [PATCH] Put Print in Apply --- sectorlisp.S | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sectorlisp.S b/sectorlisp.S index f7a97bf..6dbcab3 100644 --- a/sectorlisp.S +++ b/sectorlisp.S @@ -56,7 +56,9 @@ main: mov %sp,%cx call NewLine mov %dx,%fs # Clear input lookahead cache call Read - call EvalPrint + call Eval + xchg %si,%ax + call PrintObject jmp main GetToken: # GetToken():al, dl is g_look @@ -104,21 +106,18 @@ PrintObject: # PrintObject(x:si) jnz .PrintString # -> ret ret -Print: mov (%si),%si # si = Cdr(e) - test %si,%si - jnz 1f -NewLine:mov $'\r',%al - jmp PutChar -1: mov (%si),%ax # ax = Car(Cdr(e)) -EvalPrint: - call Eval +Print: test %si,%si + jz NewLine + mov (%si),%si # ax = Car(Cdr(e)) push %dx - xchg %ax,%si call PrintObject xchg %dx,%ax pop %dx ret +NewLine:mov $'\r',%al + jmp PutChar + Read: push %dx mov %fs,%dx # Get cached character call GetToken @@ -233,6 +232,8 @@ Pairlis:test %di,%di # Pairlis(x:di,y:si,a:dx):dx ja .resolv # ah is zero if not above mov (%si),%di # di = Car(x) je .ifAtom + cmp $kPrint,%al + je Print cmp $kCons,%al jae .ifCons .ifCar: cmp $kCar,%al @@ -282,8 +283,6 @@ Eval: test %ax,%ax # Eval(e:ax,a:dx):ax lodsw # ax = Car(e) cmp $kRead,%ax je Read - cmp $kPrint,%ax - je Print cmp $kQuote,%ax # maybe CONS mov (%si),%di # di = Cdr(e) je Car