Campus LIsP (32K)

Discussion about ZX80 / ZX81 Software
User avatar
siggi
Posts: 772
Joined: Thu May 08, 2008 8:30 am
Location: Dauernheim, Germany
Contact:

Re: Campus LIsP (32K)

Post by siggi » Wed Dec 06, 2017 3:26 pm

stefano wrote:
Wed Dec 06, 2017 2:26 pm
Editing a function is not possible, you need to re-enter it and crossing fingers you should be able to issue the garbage collector with (gc) to wipe the old one.
Hm, then it would be nice to have the souce code of the function somewhere in RAM (where it could be edited), and then could be imported to Lisp command line interpreter.
Do you know Olli's ZEDIT? It is an ASCII editor, running at 16K. It stores the ASCII text (!) at 32K (terminated by ^Z, up to 16KB) and has its HIRES-screen and stack above 48K (thus runs on 48K Zeddies). Maybe it could be used to enter/edit the lisp source code?
After it has terminated, the range 32-48K still contains the text (other memory then can be used e. g. by Lisp).
When it is RUN later again, it looks for existing text at 32-48K to edit it ...

http://forum.tlienhard.com/phpBB3/viewt ... ilit=zedit

Siggi
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

User avatar
stefano
Posts: 340
Joined: Tue Dec 11, 2012 8:24 am
Contact:

Re: Campus LIsP (32K)

Post by stefano » Wed Dec 06, 2017 8:17 pm

There is a Japanese port of the Campus Lisp on the Sharp PC-G 850 which works exactly in this way.
http://ver0.sakura.ne.jp/g800/clisp2.png

It is surely a possible approach, I was focused on the portability, this same program can become, in example, very similar to Spec Lisp and run on most of the z88dk supported targets (often also with graphics).
A 32k variant in hrg able to emulate the Spec Lisp is surely feasible, or, in classic text mode much more of the 48k ram area is usable compared to a Spectrum (more than enough for an editor).

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

Re: Campus LIsP (32K)

Post by siggi » Thu Dec 07, 2017 7:37 am

Hi Stefano
to keep it portable: could you just add an additional option (or a command) to read input from an ASCII string somewehre in memory (e. g. from 8192 of a 56K Zeddy)?

Then I could write a small program to
- copy a text (created by ZEDIT) from 32K to 8K and replace ^Z by a \0 (to create a well-terminated C string)
or
- read (peek) the source code out of REM lines of a BASIC-program (to use the BASIC editor to create the Lisp program) and convert the text into ASCII and write it as C-string to 8K
which is RUN before your Clisp is started.

That would then be also usable at other systems (if they have free ram, maybe at other locations).

Regards
Siggi
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

User avatar
stefano
Posts: 340
Joined: Tue Dec 11, 2012 8:24 am
Contact:

Re: Campus LIsP (32K)

Post by stefano » Fri Dec 08, 2017 1:48 pm

I understand your idea, I'll try to set up a test environment (e.g. a snapshot with a pre- loaded) lisp sentence at a given position (8192 ?).
z88dk could help in a more efficient way, since it supports file redirection, but a sequential or random file access will be necessary (not considering the memory related concerns due to the extra space for the file driver and its buffers) ... so I will experiment a bit.
My past Lisp submission included a memory snapshot with a pre-loaded set of function definitions (and the initialization code removed) to squeeze as much functionality as possible, I'm telling it to explain that to deal with extra memory is a delicate task .. so please be precise about the memory block you think to be appropriate :)

User avatar
mrtinb
Posts: 523
Joined: Fri Nov 06, 2015 4:44 pm
Location: Denmark
Contact:

Re: Campus LIsP (32K)

Post by mrtinb » Fri Dec 08, 2017 1:57 pm

I think Siggi is thinking of a simpler solution.

The user has to load the file @8k or @32k prior to loading CLIsP (with ZxPand, ZxBlast, SIMDOS2 or similar storage solution).

CLIsP simply needs a function that interpreat a zero terminated LISP from a memory location.

E.g.
(READ-SRC 8192)
(READ-SRC 32768)
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

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

Re: Campus LIsP (32K)

Post by siggi » Fri Dec 08, 2017 2:39 pm

Yes, nowadays there are a lot of solutions, to fast-load a program or data anywhere into ram (Zxpand, USB-drivers, Mefisdos, ZeddyNet).
Thus the workflow I had in mind would be:
- Load and run ZEDIT and create a Lisp source code(results in ASCII text at 32K). If necessary, save the text (Lisp source code) for later use or correction
- Load and start a tool (M/C or Basic program) to convert the text into a valid C-string (terminated by \0) and copy it to a free location in ram (e. g. at 8192)
- Load and start your Lisp (as is: interpreter at 16K, using ram above 32K)
- enter a new command to your Lisp to read input from the C-string in memory (as Martin wrote: READ-SRC 8192)
- run the Lisp program

If the program does not work as expected: load ZEDIT and the saved text again and correct it and restart the workflow as written above.

Thus the changes in your Lisp should be: instead of interpreting the command entered by keyboard, interpret the commands (Lisp source) within the string at given location. Then return to command mode and wait for the next comand from keyboard.

Thus instead of

Code: Select all

gets(command);
interpret(command);

Code: Select all

interpret (c_string_in_memory);
Regards
Siggi
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

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

Re: Campus LIsP (32K)

Post by dh1pba » Sun Dec 10, 2017 3:31 pm

How to save a program and load programs with ZXPand (Eighty One)?
Thank you.
Greeting

User avatar
mrtinb
Posts: 523
Joined: Fri Nov 06, 2015 4:44 pm
Location: Denmark
Contact:

Re: Campus LIsP (32K)

Post by mrtinb » Sun Dec 10, 2017 3:57 pm

Enable ZXpand in the hardware menu.

LOAD"name" and SAVE"name" uses ZXpand. LOAD "" uses tape.
Last edited by mrtinb on Sun Dec 10, 2017 4:40 pm, edited 1 time in total.
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

User avatar
sirmorris
Posts: 2696
Joined: Thu May 08, 2008 4:45 pm
Location: oxon, uk

Re: Campus LIsP (32K)

Post by sirmorris » Sun Dec 10, 2017 4:32 pm

As Martin said. There are further facilities for loading and saving blocks of data in memory. The manual is here.
--=== ZXpand+ ... A more moderner all-in-one upgrade solution for ZX81 ===--
* SD/MMC storage * 32K Hires-capable RAM * AY sound chip * Joystick port * Serial *
* BASIC enhancements - plug & play * Reset button * Auto-boot facility *

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests