Campus LIsP (32K)

Discussion about ZX80 / ZX81 Software
User avatar
mrtinb
Posts: 760
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Campus LIsP (32K)

Post by mrtinb » Mon Dec 11, 2017 10:43 am

I think you misunderstand.

LOAD and SAVE are commands for BASIC.

Noone have implemented them in CLIsP.

That is why we suggest someone implements "(READ_SRC mem-loc)", but it's not implemented yet.

And if you know LISP you would know to call a command would be:
(LOAD HANOI.I)
But this won't work as mentioned as noone has implemeted it. This would be a much larger task than implementing READ_SRC. That's why it was suggested that someone implemented READ_SRC instead.
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

dh1pba
Posts: 7
Joined: Thu Nov 30, 2017 8:34 am

Re: Campus LIsP (32K)

Post by dh1pba » Mon Dec 11, 2017 11:26 am

Ja, wäre schön wenn die Befehle für ZXPand auch funktionieren würden.

Gruss

User avatar
stefano
Posts: 378
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Campus LIsP (32K)

Post by stefano » Fri Aug 10, 2018 1:43 pm

Followup on the file topic. I recently worked with ZEDIT and I finally understood your suggestions.
The problem is that my LISP implementation on the ZX81 uses the exact same system used by ZEDIT: the way the LISP works is to "learn" the text sentences loading the logic into its data structures. To keep the text version in memory would halve the available memory for the programs, moreover ZEDIT requires 48K of memory, and couldn't live together with the LISP interpreter.
I rather hoped to find a way to read the text sequentially from a file, char by char.

User avatar
siggi
Posts: 849
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany
Contact:

Re: Campus LIsP (32K)

Post by siggi » Fri Aug 10, 2018 5:04 pm

Hi Stefano
the memory map of ZEDIT (while running) is:
8-16: unused
16K-32K: ZEDIT program
32K up to 48K: ASCII text (created by ZEDIT)
48K-64K: ZEDIT workspace, stack and clipboard

After ZEDIT is stopped, the 16-32K and 48-64K regions may be used by other programs, while the text (CLISP program) is still at 32K.

Thus by running a BASIC or C program, the text (at least the first 8K) could be copied from 32K to unused region 8K-16K.
Then if CLISP is running (now having free ram from 16K-64K), it could fetch the text from 8K and handle it like input from keyboard (building up its internal tables in CLISP ram 16-64K).

So ZEDIT may be used to create the program, but is no more in memory while CLISP is running.

A different question is: can a CLISP "program" be saved from and reloaded back into the internal data tables (as binary file, using ZXPAND or USB-stick)?

Siggi

PS: reading a file seqentially is possible using ZxPand or USB-Stick, but not in a standard C compatible way ;)
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

User avatar
stefano
Posts: 378
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Campus LIsP (32K)

Post by stefano » Mon Aug 13, 2018 1:53 pm

First of all let me answer to your last question: I already provided a CLISP version for the 32K expansion which does not initialize the data structures. Such structures are statically placed in the memory region over 32768, and can be saved/restored at your convenience, e.g. after exiting with "(quit)".

By the way, here's what I could do for ZEDIT: I shifted such hardcoded structures towards the 48K memory bottom thus leaving about 16K of memory space for the text. On start, CLISP will pick the text from memory starting at 32768 and will get back to the normal interactive mode when chr(0) or chr(26) are found.. in this way the text can be fed by ZEDIT.
For the sake of simplicity it initializes the memory structures rather than expecting a pre-loaded block, so there was no space in the 16K area for the full command set: it is provided in "MINIMALISTIC" mode, which means that the following functions won't be available unless they'll be re-written in LISP (see minimalistic.l for some possible workaround):
"<", "and","divide","lambda","while",">=","<=","comment","zerop","atom","random","rem","1+","1-","equal","="

The following turtle graphics functions are available in low resolution mode: cls, penu, pend, left, right, fwd.

This version REQUIRES an initial LISP code portion properly terminated @32768, the interpreter will crash otherwise.
clisp.c
Updated Campus Lisp with the ZEDIT option added
(37.82 KiB) Downloaded 13 times
clisp-zedit.p
Campus LISP
(15.44 KiB) Downloaded 15 times
clisp.jpg
ZEDIT while preparing the LISP code
clisp.jpg (25.21 KiB) Viewed 475 times
clisp-runtime.jpg
CLISP interpreter loading the text file and then running in interactive mode
clisp-runtime.jpg (17.75 KiB) Viewed 475 times

User avatar
stefano
Posts: 378
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Campus LIsP (32K)

Post by stefano » Mon Aug 13, 2018 2:50 pm

I thought to provide also a similar version for those models with 32K only.
The configuration is similar, full sized integer types, minimalistic function set, lo rez graphics..
The differences are on the memory structure position (here it is at 32768) and on the fact that in this case the initialization is provided by a different program block to save memory.
It should be possible to do the same for the ZEDIT version, this could make it more practical, I'd wait for your comments before providing too many variants which can be confusing.
clisp-init.p
(4.33 KiB) Downloaded 21 times
clisp.p
(14.79 KiB) Downloaded 11 times
lorez.jpg
lorez.jpg (15.98 KiB) Viewed 471 times

User avatar
stefano
Posts: 378
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Campus LIsP (32K)

Post by stefano » Mon Aug 13, 2018 3:38 pm

Variant for ZEDIT with parted structure initialization.
Read the two posts before, this CLISP version mixes them all: you can save the memory area between 32768 and 65535 to keep both the text area and the 'live' LISP memory, or only the bottom part (starting at 49151) to keep only the live program memory, which the first time MUST be initialized with clisp-zedit-init.p.
The text area could hold new commands only or resubmit edited versions of the commands already in memory.
Calling the garbage collector "(gc)" should wipe the previous version.

I repeat: this ZEDIT dependent version MUST have also some valid text @32768, so before running clisp-zedit you must initialize both the memory structure AND the text area !



clisp-zedit.zip
(20.32 KiB) Downloaded 10 times
eliza-clisp-zedited.jpg
eliza-clisp-zedited.jpg (29.71 KiB) Viewed 461 times
eliza-clisp-zedit.jpg
eliza-clisp-zedit.jpg (23.54 KiB) Viewed 461 times

User avatar
stefano
Posts: 378
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Campus LIsP (32K)

Post by stefano » Mon Aug 13, 2018 4:50 pm

One more example, with zero termination for ZEDIT:
turtle.jpg
turtle.jpg (22.48 KiB) Viewed 459 times
turtle.txt
(641 Bytes) Downloaded 26 times

User avatar
siggi
Posts: 849
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany
Contact:

Re: Campus LIsP (32K)

Post by siggi » Fri Aug 17, 2018 4:51 pm

I did this (56K Zeddy, ZEDIT version):
load TURTLE.TXT to 32768
run "clisp-init"
run "clisp"

Result is
IMG_1811_640x480.JPG
:D

Siggi

BTW: for WIN systems the termination char 26 is better than char 0: some text editors handle a \0 terminated file as binary data, but accept char 26 as well-known EOF since CP/M times :mrgreen:
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

Post Reply