Commit graph

57 commits

Author SHA1 Message Date
Justine Tunney
7f55a4be0a Revert "shave one byte"
This reverts commit 041d23e99b.
2021-11-24 00:07:22 -08:00
Peter Ferrie
041d23e99b shave one byte 2021-11-23 20:17:18 -08:00
Peter Ferrie
7e8979fa7c avoid use of BP across video calls 2021-11-23 19:52:54 -08:00
Peter Ferrie
0637e25bb5
Shave some bytes (#14) now 443 bytes 2021-11-23 19:31:48 -08:00
Justine Tunney
bab9ebed18 Do nothing on undefined variable (now 446 bytes)
The only exception is NIL which has been added to the main Eval().
This change also inlines the ABC Garbage Collector for more speed.
2021-11-23 05:09:13 -08:00
Peter Ferrie
d66e5d984f shave some bytes
- setting of SS is not interruptible, so no need to guard it;
- direction flag is cleared by BIOS code, even on the XT.
2021-11-22 22:04:42 -08:00
Justine Tunney
6000841378 Inline Evaluate into Eval (it looks nicer) 2021-11-22 17:52:05 -08:00
Justine Tunney
c549796f78 Make C impl match latest asm tactics
The C code now has garbage collection. It now uses negative memory
for storing cons cells. Function arguments have been inlined since
undefined evaluation order shouldn't matter since it is immutable.
Compiler warnings have been turned off so we can use traditional C
2021-11-22 16:43:03 -08:00
Justine Tunney
2f57156c34 Remove broken dot parsing in C code
Fixes #13
2021-11-21 23:25:53 -08:00
Justine Tunney
3d19d8d9f2 Shave two bytes (now 456 bytes) 2021-11-21 21:05:36 -08:00
Justine Tunney
d587ce19d1 Shave twelve bytes (now 458 bytes) 2021-11-21 20:28:45 -08:00
Justine Tunney
5a33a6b97a Add garbage collection (now 470 bytes)
This GC wraps Eval() to create a copy of the result, and then
memcpy's it backwards to the position where the g_mem pointer
resided at the beginning of Eval() thereby discarding all the
cons cells that got created which weren't part of the result.
Overlap (or negative GC) isn't possible because we don't copy
cells beneath the low water mark.

As it turns out 44 bytes is all you need to implement garbage
collection when your language guarantees that data structures
can't have cycles, due to the lack of mutability.
2021-11-21 09:21:53 -08:00
Justine Tunney
1acabfcc6a Restore direction flag clearing 2021-11-21 03:44:20 -08:00
Justine Tunney
814c61aeae Shave another sixteen bytes (now 426 bytes)
The flag bit is now removed from atoms in favor of the sign bit.
That let us remove shifts. It also means NIL can be zero, which
freed up the %cx register. Using %cx to call Eval saved 2 bytes.
Saved six bytes removing bss memset as it's not needed anymore.
2021-11-17 08:41:36 -08:00
Justine Tunney
a8f04bc73f Make objdump -Mi8086 sectorlisp.o output look nicer 2021-11-16 22:05:08 -08:00
Justine Tunney
e90a728894 Unshave four bytes for IBM PC compatibility
Ability to run on original hardware is confirmed.
2021-11-16 10:46:28 -08:00
Justine Tunney
1e9c7fca35 Shave another fifteen bytes (now 438 bytes)
%bx wasn't needed in PutChar since we're assuming the machine boots
in a non-graphical mode, i.e. BIOS teletype. In MDA mode BX will be
2 which is dark green on black. The same probably applies with CGA.

Now that BX is always two, we can now use multi-register addressing
when accessing CDR cells. That's a huge savings, since we no longer
need all those displacement bytes; we only need the modrm.

%cx wasn't needed it could be replaced with %si in GetToken thereby
making it possible to remove our use of the %fs register.

Changing the second argument Cons() from %si not %ax helped to save
even more space, since all the things that called it needed to move
the register from %ax to %si.
2021-11-16 10:17:10 -08:00
Justine Tunney
49c538778a Shave another byte and improve asm readability
This changes fixes an issue where clearing the bss could overlap
the stack memory used in the early initialization code.

This change fixes a regression caused by an earlier commit with
nul terminators. Builtins are now automatically numbered.

Comments have been added and labels have been redefined to add
further clarity to how the assembly works. The most beautiful of
which is the code that merges Cadr, Cdr, and Car into one func.
2021-11-16 07:09:58 -08:00
Justine Tunney
532b92688e Fix regression in C code for PrintList()
Fixes #11
2021-11-16 00:05:30 -08:00
Peter Ferrie
522f0a16fd shave two bytes, fix memory init 2021-11-15 21:05:27 -08:00
Justine Tunney
2c760a29e4 Fix extra arg in LISP evaluator
Fixes #12 reported by @derhexenmeister
2021-11-13 15:16:37 -08:00
Peter Ferrie
df9c01c46c back to 386+ CPU 2021-11-08 10:50:15 -08:00
Peter Ferrie
74b20f759e shave one byte 2021-11-08 09:51:36 -08:00
Peter Ferrie
c2a2561366 trim binary 2021-11-08 08:10:54 -08:00
Peter Ferrie
8afbbdd383 shave some bytes 2021-11-08 08:09:12 -08:00
Peter Ferrie
21383822a7 Revert "shave another six bytes"
This reverts commit 8f5f932098.
2021-11-07 22:28:49 -08:00
Peter Ferrie
8f5f932098 shave another six bytes 2021-11-07 21:24:36 -08:00
Justine Tunney
9bb9c6e04c Shave six more bytes 2021-11-07 12:32:23 -08:00
Justine Tunney
9f108b0d60
Merge pull request #10 from peterferrie/main
shave some bytes
2021-11-06 00:59:27 -07:00
Peter Ferrie
98e028d13b restore load address, no need to change after all 2021-11-05 15:21:25 -07:00
Peter Ferrie
0fb8fa3b2a shave one more byte 2021-11-05 15:17:06 -07:00
Peter Ferrie
a0f739da58 shave some bytes 2021-11-05 14:30:46 -07:00
Peter Ferrie
ec2c93295f shave two more bytes 2021-11-05 13:28:00 -07:00
Peter Ferrie
9cde674c1a shave two more bytes 2021-11-05 12:35:03 -07:00
Peter Ferrie
93d01e6932 shave one more byte 2021-11-05 12:23:43 -07:00
Peter Ferrie
50c85199fe shave one more byte 2021-11-05 11:58:36 -07:00
Peter Ferrie
69085d0674 shave two more bytes 2021-11-05 11:22:45 -07:00
Peter Ferrie
3cb4b9743f shave one more byte 2021-11-05 10:47:36 -07:00
Peter Ferrie
bf27f44569 fix typo and avoid stack-race 2021-11-03 21:23:09 -07:00
Peter Ferrie
adb7310d57 shave some bytes 2021-11-02 12:14:10 -07:00
agreppin
1f066da3a1
Merge pull request #9 from peterferrie/main
shave some bytes (credits @peterferrie)
2021-11-02 14:47:02 +01:00
Peter Ferrie
a469910340 shave some bytes 2021-10-31 09:54:36 -07:00
Justine Tunney
05d2bcbfd9 Improve LISP/C/ASM Rosetta Stone consistency 2021-10-30 00:42:55 -07:00
Justine Tunney
e09cdf6619 Remove more non-essential code 2021-10-26 19:53:17 -07:00
Justine Tunney
4233210a86 Remove old code and update documentation 2021-10-08 21:26:31 -07:00
Alain Greppin
cbb4ecc4d5 test files added 2021-10-03 17:03:58 +02:00
Alain Greppin
b77c74543d latest sectorlisp.bin 2021-10-03 16:24:53 +02:00
Alain Greppin
3b26982d9c Eval based on LISP 1.5 manual, 509 bytes 2021-09-28 05:25:24 -07:00
Ilya Kurdyukov
333c5efba4 smaller Intern function 2021-09-28 02:43:05 -07:00
Justine Tunney
2c1ddc26da Fix LICENSE file name 2021-03-05 12:20:03 -08:00