Browse Source

A more robust Read function

Hikaru Ikuta 3 years ago
parent
commit
46ba9fee4f
1 changed files with 18 additions and 13 deletions
  1. 18 13
      sectorlisp.S

+ 18 - 13
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