Merge pull request #1 from moon-chilled/main

Minor tweaks so the assembly builds with clang
This commit is contained in:
Justine Tunney 2020-10-27 14:40:00 -07:00 committed by GitHub
commit b64b27feb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 19 deletions

View file

@ -17,11 +17,11 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
/ @fileoverview lisp.c built for real mode with manual tuning // @fileoverview lisp.c built for real mode with manual tuning
/ binary footprint is approximately 960 bytes, about 40 bytes // binary footprint is approximately 960 bytes, about 40 bytes
/ of it is overhead needed to load the second 512-byte sector // 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 // so if we can find a way to reduce the code size another 400
/ bytes we can bootstrap the metacircular evaluator in an mbr // 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

View file

@ -42,7 +42,7 @@ _begin: push %cs # memory model cs=ds=es = 0x600
xor %dh,%dh # drive dl head zero xor %dh,%dh # drive dl head zero
mov $0x0200+v_sectors,%ax # read sectors mov $0x0200+v_sectors,%ax # read sectors
int $0x13 # disk service int $0x13 # disk service
/ 𝑠𝑙𝑖𝑑𝑒 // 𝑠𝑙𝑖𝑑𝑒
.section .yoink .section .yoink
nop main nopw main