mirror of
https://github.com/samsonjs/sectorlisp.git
synced 2026-04-27 14:57:41 +00:00
Shave four bytes
This commit is contained in:
parent
a6836ede0f
commit
b2d4ef9960
1 changed files with 22 additions and 21 deletions
43
sectorlisp.S
43
sectorlisp.S
|
|
@ -174,6 +174,27 @@ Cons: xchg %di,%cx # Cons(m:di,a:ax):ax
|
||||||
.RetDi: xchg %di,%ax
|
.RetDi: xchg %di,%ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
Builtin:cmp $kAtom,%ax # atom: last builtin atom
|
||||||
|
ja .resolv # ah is zero if not above
|
||||||
|
mov (%si),%di # di = Car(x)
|
||||||
|
je .ifAtom
|
||||||
|
cmp $kPrint,%al
|
||||||
|
je .ifPrint
|
||||||
|
cmp $kRead,%al
|
||||||
|
je .ifRead
|
||||||
|
cmp $kCons,%al
|
||||||
|
jae .ifCons
|
||||||
|
.ifCar: cmp $kCar,%al
|
||||||
|
je Car
|
||||||
|
.ifCdr: jmp Cdr
|
||||||
|
.ifCons:mov (%bx,%si),%si # si = Cdr(x)
|
||||||
|
lodsw # si = Cadr(x)
|
||||||
|
je Cons
|
||||||
|
.isEq: xor %di,%ax
|
||||||
|
jne .retF
|
||||||
|
.retT: mov $kT,%al
|
||||||
|
ret
|
||||||
|
|
||||||
GetList:call GetToken
|
GetList:call GetToken
|
||||||
cmp $')',%al
|
cmp $')',%al
|
||||||
je .retF
|
je .retF
|
||||||
|
|
@ -200,7 +221,7 @@ Gc: cmp %dx,%di # Gc(x:di,A:dx,B:si):ax
|
||||||
call Assoc # do (fn si) → ((λ ...) si)
|
call Assoc # do (fn si) → ((λ ...) si)
|
||||||
pop %si
|
pop %si
|
||||||
Apply: test %ax,%ax # Apply(fn:ax,x:si:a:dx):ax
|
Apply: test %ax,%ax # Apply(fn:ax,x:si:a:dx):ax
|
||||||
jns .switch # jump if atom
|
jns Builtin # jump if atom
|
||||||
xchg %ax,%di # di = fn
|
xchg %ax,%di # di = fn
|
||||||
.lambda:mov (%bx,%di),%di # di = Cdr(fn)
|
.lambda:mov (%bx,%di),%di # di = Cdr(fn)
|
||||||
push %di # for .EvCadr
|
push %di # for .EvCadr
|
||||||
|
|
@ -218,26 +239,6 @@ Pairlis:test %di,%di # Pairlis(x:di,y:si,a:dx):dx
|
||||||
xchg %ax,%dx # a = new list
|
xchg %ax,%dx # a = new list
|
||||||
pop %di # grab Cdr(x)
|
pop %di # grab Cdr(x)
|
||||||
jmp Pairlis
|
jmp Pairlis
|
||||||
.switch:cmp $kAtom,%ax # atom: last builtin atom
|
|
||||||
ja .resolv # ah is zero if not above
|
|
||||||
mov (%si),%di # di = Car(x)
|
|
||||||
je .ifAtom
|
|
||||||
cmp $kPrint,%al
|
|
||||||
je .ifPrint
|
|
||||||
cmp $kRead,%al
|
|
||||||
je .ifRead
|
|
||||||
cmp $kCons,%al
|
|
||||||
jae .ifCons
|
|
||||||
.ifCar: cmp $kCar,%al
|
|
||||||
je Car
|
|
||||||
.ifCdr: jmp Cdr
|
|
||||||
.ifCons:mov (%bx,%si),%si # si = Cdr(x)
|
|
||||||
lodsw # si = Cadr(x)
|
|
||||||
je Cons
|
|
||||||
.isEq: xor %di,%ax
|
|
||||||
jne .retF
|
|
||||||
.retT: mov $kT,%al
|
|
||||||
ret
|
|
||||||
.ifAtom:test %di,%di # test if atom
|
.ifAtom:test %di,%di # test if atom
|
||||||
jns .retT
|
jns .retT
|
||||||
.retF: xor %ax,%ax # ax = nil
|
.retF: xor %ax,%ax # ax = nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue