diff --git a/lisp.c b/lisp.c index 7c22783..0f9ab1e 100644 --- a/lisp.c +++ b/lisp.c @@ -111,12 +111,8 @@ GetObject(c) { return Intern(); } -ReadObject() { - return GetObject(GetToken()); -} - Read() { - return ReadObject(); + return GetObject(GetToken()); } PrintAtom(x) { diff --git a/sectorlisp.S b/sectorlisp.S index d4cbee8..9fe50a2 100644 --- a/sectorlisp.S +++ b/sectorlisp.S @@ -68,7 +68,7 @@ GetToken: # GetToken():al, dl is g_look jbe 3f cmp $')',%dl # dl = g_look ja 1b -3: movb %bh,(%di) # bh is zero +3: mov %bh,(%di) # bh is zero xchg %si,%ax ret @@ -86,6 +86,7 @@ GetToken: # GetToken():al, dl is g_look call .PutObject 4: mov $')',%al jmp PutChar + .PutObject: # .PutObject(c:al,x:si) .PrintString: # nul-terminated in si call PutChar # preserves si @@ -99,32 +100,30 @@ PrintObject: # PrintObject(x:si) ret GetObject: # called just after GetToken - cmpb $'(',%al + cmp $'(',%al je GetList -.Intern: - mov %cx,%si +# jmp Intern + +Intern: push %cx # Intern(cx,di): ax + mov %di,%bp + sub %cx,%bp + inc %bp xor %di,%di - xor %al,%al -0: push %di # save 1 -1: cmpsb - jne 2f - dec %di - scasb - jne 1b - jmp 5f -2: pop %bp # drop 1 - mov %cx,%si -3: scasb - jne 3b - cmp (%di),%al - jne 0b - push %di # StpCpy -4: movsb - dec %di - scasb - jnz 4b -5: pop %ax # restore 1 -.ret: ret +1: pop %si + push %si + mov %bp,%cx + mov %di,%ax + cmp %bh,(%di) + je 2f + rep cmpsb # memcmp(di,si,cx) + je 9f + not %cx + xor %ax,%ax + repne scasb # memchr(di,al,cx) + jmp 1b +2: rep movsb # memcpy(di,si,cx) +9: pop %cx + ret GetChar:xor %ax,%ax # GetChar→al:dl int $0x16 # get keystroke @@ -185,7 +184,7 @@ Gc: cmp %dx,%di # Gc(x:di,A:dx,B:si):ax ret GetList:call GetToken - cmpb $')',%al + cmp $')',%al je .retF call GetObject push %ax # popped by xCons