mirror of
https://github.com/samsonjs/sectorlisp.git
synced 2026-04-27 14:57:41 +00:00
shave two more bytes
This commit is contained in:
parent
9cde674c1a
commit
ec2c93295f
2 changed files with 54 additions and 54 deletions
Binary file not shown.
108
sectorlisp.S
108
sectorlisp.S
|
|
@ -93,35 +93,6 @@ GetToken: # GetToken():al, dl is g_look
|
||||||
xchg %cx,%ax
|
xchg %cx,%ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
GetObject: # called just after GetToken
|
|
||||||
cmpb $'(',%al
|
|
||||||
je GetList
|
|
||||||
.Intern:
|
|
||||||
mov $g_str,%di
|
|
||||||
xor %al,%al
|
|
||||||
0: push %di # save 1
|
|
||||||
1: cmpsb
|
|
||||||
jne 2f
|
|
||||||
dec %di
|
|
||||||
scasb
|
|
||||||
jne 1b
|
|
||||||
jmp 5f
|
|
||||||
2: pop %si # drop 1
|
|
||||||
mov $g_token,%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
|
|
||||||
add $-g_str,%ax # stc
|
|
||||||
adc %ax,%ax # ax = 2 * ax + carry
|
|
||||||
.ret: ret
|
|
||||||
|
|
||||||
.PutObject: # .PutObject(c:al,x:di)
|
.PutObject: # .PutObject(c:al,x:di)
|
||||||
call PutChar # preserves di
|
call PutChar # preserves di
|
||||||
xchg %di,%ax
|
xchg %di,%ax
|
||||||
|
|
@ -157,6 +128,35 @@ PrintObject: # PrintObject(x:ax)
|
||||||
4: mov $')',%al
|
4: mov $')',%al
|
||||||
jmp PutChar
|
jmp PutChar
|
||||||
|
|
||||||
|
GetObject: # called just after GetToken
|
||||||
|
cmpb $'(',%al
|
||||||
|
je GetList
|
||||||
|
.Intern:
|
||||||
|
mov $g_str,%di
|
||||||
|
xor %al,%al
|
||||||
|
0: push %di # save 1
|
||||||
|
1: cmpsb
|
||||||
|
jne 2f
|
||||||
|
dec %di
|
||||||
|
scasb
|
||||||
|
jne 1b
|
||||||
|
jmp 5f
|
||||||
|
2: pop %si # drop 1
|
||||||
|
mov $g_token,%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
|
||||||
|
add $-g_str,%ax # stc
|
||||||
|
adc %ax,%ax # ax = 2 * ax + carry
|
||||||
|
.ret: ret
|
||||||
|
|
||||||
GetChar:
|
GetChar:
|
||||||
xor %ax,%ax # get keystroke
|
xor %ax,%ax # get keystroke
|
||||||
int $0x16 # keyboard service
|
int $0x16 # keyboard service
|
||||||
|
|
@ -175,16 +175,26 @@ PutChar:
|
||||||
mov $'\n',%al
|
mov $'\n',%al
|
||||||
jmp PutChar # bx volatile, bp never used
|
jmp PutChar # bx volatile, bp never used
|
||||||
|
|
||||||
GetList:call GetToken
|
|
||||||
cmpb $')',%al
|
|
||||||
je .retF
|
|
||||||
call GetObject
|
|
||||||
push %ax # save 1
|
|
||||||
call GetList
|
|
||||||
jmp xCons
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Pairlis:cmp $NIL,%di # Pairlis(x:di,y:si,a:dx):ax
|
||||||
|
je 1f
|
||||||
|
push 2(%di) # save 1 Cdr(x)
|
||||||
|
lodsw
|
||||||
|
push (%si) # save 2 Cdr(y)
|
||||||
|
mov (%di),%di
|
||||||
|
xchg %ax,%si
|
||||||
|
call Cons # preserves dx
|
||||||
|
pop %si # restore 2
|
||||||
|
pop %di # restore 1
|
||||||
|
push %ax # save 3
|
||||||
|
call Pairlis
|
||||||
|
xchg %ax,%si
|
||||||
|
pop %di # restore 3
|
||||||
|
jmp Cons # can be inlined here
|
||||||
|
1: xchg %dx,%ax
|
||||||
|
ret
|
||||||
|
|
||||||
Evlis: cmp $NIL,%di # Evlis(m:di,a:dx):ax
|
Evlis: cmp $NIL,%di # Evlis(m:di,a:dx):ax
|
||||||
je 1f
|
je 1f
|
||||||
push 2(%di) # save 1 Cdr(m)
|
push 2(%di) # save 1 Cdr(m)
|
||||||
|
|
@ -210,23 +220,13 @@ Cons: xchg %di,%ax
|
||||||
1: xchg %di,%ax
|
1: xchg %di,%ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Pairlis:cmp $NIL,%di # Pairlis(x:di,y:si,a:dx):ax
|
GetList:call GetToken
|
||||||
je 1f
|
cmpb $')',%al
|
||||||
push 2(%di) # save 1 Cdr(x)
|
je .retF
|
||||||
lodsw
|
call GetObject
|
||||||
push (%si) # save 2 Cdr(y)
|
push %ax # save 1
|
||||||
mov (%di),%di
|
call GetList
|
||||||
xchg %ax,%si
|
jmp xCons
|
||||||
call Cons # preserves dx
|
|
||||||
pop %si # restore 2
|
|
||||||
pop %di # restore 1
|
|
||||||
push %ax # save 3
|
|
||||||
call Pairlis
|
|
||||||
xchg %ax,%si
|
|
||||||
pop %di # restore 3
|
|
||||||
jmp Cons # can be inlined here
|
|
||||||
1: xchg %dx,%ax
|
|
||||||
ret
|
|
||||||
|
|
||||||
1: mov 2(%di),%di # di = Cdr(c)
|
1: mov 2(%di),%di # di = Cdr(c)
|
||||||
Evcon: push %di # save c
|
Evcon: push %di # save c
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue