From a0f739da5815c86a121b51673110939431aa0a28 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Fri, 5 Nov 2021 14:30:46 -0700 Subject: [PATCH] shave some bytes --- bin/sectorlisp.bin | Bin 512 -> 512 bytes sectorlisp.S | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/sectorlisp.bin b/bin/sectorlisp.bin index 533f0fed9f8fd2da5417d74e8bd993d588479c60..60f04d1b22f372c9f0b9b68ca3477759acb8feea 100755 GIT binary patch delta 198 zcmV;%06G7F1b_sPDMxgG01gfg9|yhybcyj7iOl@C05*=`G5_*&7#c8UIo&^#b^0;-YdaglHoU0?v0r~#LB4$<$4{;Y(+ zbWG?@0PFU!DF1Z=i#_Py|5$_g0dx$g0hh2KbnCGB=*|DIDeEjeD0Fr)|1iK;rga8S zu66nA5njFkcCK~(It6v>SENs_b^BNWz(A4aR0t~nJSlW~=zNnx0lbs&0R;k8s)pQM Ay#N3J delta 199 zcmV;&0671E1b_sPDMxl-01gfg9|yhyc8T#9iOl>lz>eTC|MRN9fIzV&^Q5v0=o0|w zYXG_d0O$$<=q&)S4d{#j>*&7#K#Bf{&^#b^0;-Ydc9C!tVr2lAr~#LB5Yg|AwSYjZ zgurx9=urUc_OK}bbpne$=-vNVgZKe-45$H@upo5nu=(iA|F9|RFFYu8dB1=_Fu+%) zbp}tab@}TNUcLZ8u66x71$FCJq))DO`&b2lzY)NZ;Zz7E|2!#ldgytRJpsG|RjRu7 BUGD$@ diff --git a/sectorlisp.S b/sectorlisp.S index d74ee14..daf962b 100644 --- a/sectorlisp.S +++ b/sectorlisp.S @@ -30,8 +30,9 @@ .set ATOM_CONS, 61 .set ATOM_EQ, 71 -.set g_token, 0x4000 -.set g_str, 0x4080 +.set g_token, 0x7600 +.set g_str, 0x0 +.set g_mem, 0x3600 .set boot, 0x7c00 //////////////////////////////////////////////////////////////////////////////// @@ -45,8 +46,8 @@ kSymbols: .ascii "NIL\0T\0QUOTE\0COND\0ATOM\0CAR\0CDR\0CONS\0EQ" .type .init,@function -.init: ljmp $0x600>>4,$_begin # end of bios data roundup page -_begin: push %cs # memory model cs=ds=es = 0x600 +.init: ljmp $0x800>>4,$_begin # end of bios data roundup page +_begin: push %cs # memory model cs=ds=es = 0x800 push %cs push %cs pop %ds @@ -56,11 +57,11 @@ _begin: push %cs # memory model cs=ds=es = 0x600 pop %ss mov %cx,%sp cld - xor %ax,%ax + mov $g_mem,%ax mov %ax,%fs # fs = &g_mem xor %di,%di rep stosb # clears our bss memory -main: mov $g_str,%di +main: xor %di,%di # mov g_str, %di mov $37,%cl rep movsb 0: mov $'\n',%dl @@ -104,7 +105,7 @@ PrintObject: # PrintObject(x:ax) jz .PrintList .PrintAtom: shr %di - lea g_str(%di),%si + mov %di,%si # lea g_str(%di),%si .PrintString: # nul-terminated in si lodsb test %al,%al @@ -132,7 +133,7 @@ GetObject: # called just after GetToken cmpb $'(',%al je GetList .Intern: - mov $g_str,%di + xor %di,%di # mov $g_str,%di xor %al,%al 0: push %di # save 1 1: cmpsb @@ -153,8 +154,9 @@ GetObject: # called just after GetToken scasb jnz 4b 5: pop %ax # restore 1 - add $-g_str,%ax # stc - adc %ax,%ax # ax = 2 * ax + carry +# add $-g_str,%ax + add %ax,%ax # ax = 2 * ax + inc %ax # + 1 .ret: ret GetChar: