|
@@ -17,11 +17,11 @@
|
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
|
|
|
|
-/ @fileoverview lisp.c built for real mode with manual tuning
|
|
|
|
-/ binary footprint is approximately 960 bytes, about 40 bytes
|
|
|
|
-/ of it is overhead needed to load the second 512-byte sector
|
|
|
|
-/ so if we can find a way to reduce the code size another 400
|
|
|
|
-/ bytes we can bootstrap the metacircular evaluator in an mbr
|
|
|
|
|
|
+// @fileoverview lisp.c built for real mode with manual tuning
|
|
|
|
+// binary footprint is approximately 960 bytes, about 40 bytes
|
|
|
|
+// of it is overhead needed to load the second 512-byte sector
|
|
|
|
+// so if we can find a way to reduce the code size another 400
|
|
|
|
+// bytes we can bootstrap the metacircular evaluator in an mbr
|
|
|
|
|
|
#define NIL 0
|
|
#define NIL 0
|
|
#define UNDEFINED 8
|
|
#define UNDEFINED 8
|
|
@@ -71,9 +71,9 @@ GetChar:xor %ax,%ax # get keystroke
|
|
xor %ah,%ah # ah is bios scancode
|
|
xor %ah,%ah # ah is bios scancode
|
|
push %ax # al is ascii character
|
|
push %ax # al is ascii character
|
|
call PutChar # ax will have result
|
|
call PutChar # ax will have result
|
|
- cmp $'\r,%al # don't clobber stuff
|
|
|
|
|
|
+ cmp $'\r',%al # don't clobber stuff
|
|
jne 1f
|
|
jne 1f
|
|
- mov $'\n,%al
|
|
|
|
|
|
+ mov $'\n',%al
|
|
call PutChar
|
|
call PutChar
|
|
1: pop %ax
|
|
1: pop %ax
|
|
ret
|
|
ret
|
|
@@ -135,7 +135,7 @@ GetObject:
|
|
cmpb $40,q.token
|
|
cmpb $40,q.token
|
|
je GetList
|
|
je GetList
|
|
mov $q.token,%di
|
|
mov $q.token,%di
|
|
-/ 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
+// 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
Intern: mov %di,%bx
|
|
Intern: mov %di,%bx
|
|
mov $STR,%si
|
|
mov $STR,%si
|
|
@@ -173,9 +173,9 @@ Intern: mov %di,%bx
|
|
|
|
|
|
GetList:call GetToken
|
|
GetList:call GetToken
|
|
mov q.token,%al
|
|
mov q.token,%al
|
|
- cmp $'),%al
|
|
|
|
|
|
+ cmp $')',%al
|
|
je 2f
|
|
je 2f
|
|
- cmp $'.,%al
|
|
|
|
|
|
+ cmp $'.',%al
|
|
je 1f
|
|
je 1f
|
|
call GetObject
|
|
call GetObject
|
|
push %ax # save
|
|
push %ax # save
|
|
@@ -203,8 +203,8 @@ EvalCons:
|
|
pop %si # restore
|
|
pop %si # restore
|
|
xchg %ax,%di
|
|
xchg %ax,%di
|
|
pop %bp
|
|
pop %bp
|
|
-/ jmp Cons
|
|
|
|
-/ 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
+// jmp Cons
|
|
|
|
+// 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
Cons: mov $q.index,%bx
|
|
Cons: mov $q.index,%bx
|
|
mov (%bx),%ax
|
|
mov (%bx),%ax
|
|
@@ -280,8 +280,8 @@ PrintObject:
|
|
call PrintObject
|
|
call PrintObject
|
|
4: pop %bx
|
|
4: pop %bx
|
|
mov $41,%al
|
|
mov $41,%al
|
|
-/ jmp PutChar
|
|
|
|
-/ 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
+// jmp PutChar
|
|
|
|
+// 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
PutChar:push %bx # don't clobber bp,bx,di,si,cx
|
|
PutChar:push %bx # don't clobber bp,bx,di,si,cx
|
|
push %bp # original ibm pc scroll up bug
|
|
push %bp # original ibm pc scroll up bug
|
|
@@ -294,8 +294,8 @@ PutChar:push %bx # don't clobber bp,bx,di,si,cx
|
|
|
|
|
|
Arg1: call Cadr
|
|
Arg1: call Cadr
|
|
xchg %ax,%di
|
|
xchg %ax,%di
|
|
-/ jmp Eval
|
|
|
|
-/ 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
+// jmp Eval
|
|
|
|
+// 𝑠𝑙𝑖𝑑𝑒
|
|
|
|
|
|
Eval: push %bp
|
|
Eval: push %bp
|
|
mov %di,%dx
|
|
mov %di,%dx
|
|
@@ -313,7 +313,7 @@ Eval: push %bp
|
|
je 1f
|
|
je 1f
|
|
mov (%bx),%di
|
|
mov (%bx),%di
|
|
and $-2,%di
|
|
and $-2,%di
|
|
- cmp $ATOM_LAMBDA,(%di)
|
|
|
|
|
|
+ cmpw $ATOM_LAMBDA,(%di)
|
|
jne EvalUndefined
|
|
jne EvalUndefined
|
|
mov 2(%bx),%si
|
|
mov 2(%bx),%si
|
|
mov (%bx),%di
|
|
mov (%bx),%di
|