[Coco] [CoCo] Re: Basic Lisp

J Arcane jarcane at gmail.com
Sat Nov 15 15:34:11 EST 2014


Wow! Nice work. Debugging old-school BASIC is rarely the most painless
experience, so kudos to your efforts.

I've been working on a little language project myself, writing a
BASIC-inspired Lisp dialect as a Racket library. It's presented me with any
number of odd conundrums and important revelations about how certain things
work and the differences between languages.

The most weird one though, and one I am still a bit stuck on is the
PRINT/INPUT commands vs. their Lisp eqvs. and how to define them. BASIC's
PRINT more or less roughly aligns to displayln, with some extra syntax like
the ; and , shortcuts, and INPUT really doesn't have an equivalent at all
exactly (owing largely to major differences in how the two languages do
things). Lisp uses read and read-line, and lacks strict typing (though
there are variants for reading a string or chars specifically), nor is it
even explicitly required to be assigning to a variable; they're simply
functions that take some input from a given port, and return that input.

It's a case of two very, very different approaches and needing to decide
which one to prioritize. Not getting far yet.

On Sat, Nov 15, 2014 at 9:52 PM, Stephen Pereira <spereira1952 at comcast.net>
wrote:

> Here is an update of my investigation of Basic Lisp:
>
> I have scoured the code and continued to clean up OCR issues.  I added all
> the spaces back into the code, so I can better understand what the code is
> doing.  I believe that I found one typo from the original listing in 80
> Microcomputing magazine:
>
> 26013 IF ERR/2+1=9 THEN IF A>350 OR J1>15 OR J2>15 OR J>15 PRINT"; STACK
> OVERFLOW" : GOTO 27000
>
> There is no variable called ERR in the program.  The is a variable ER,
> however, so I am assuming that the IF statement should be something like IF
> ER*R/2+1=9, or some other operation like that.  But, this is how the
> magazine printed it, so more analysis of the code will be needed to
> determine what the IF statement should be.
>
> My system is a stock CoCo 3 with an HDB DOS cartridge and using Drivewire
> as the mass storage.  When I power up, PRINT MEM provides 22824. After I
> load the program, PRINT MEM provides 12571.  With this little memory left
> available, the CLEAR and DIM statements in line 15 look problematic:
>
> 15 CLS : CLEAR 325 : DEF INT A-E,G-V,X-Z : DEF STR O : DIM
> LM(1100),PL(1100),OB(90),PT(90),ST(350),FP(50),T1(15),X1(15) : N=3000
>
> Indeed, when I type RUN, I am greeted by OM ERROR IN 15 (well, actually,
> that came after the SN ERRORs, because of the DEFINT and DEFSTR statements
> that I had to eliminate).
>
> I reduced both LM and PL to 100 elements each, in order to see if I could
> get the code to go at all.  Following that, I found that I had to make
> array OB(90) to be OB$(90) because it’s a string array.  I also found that
> the CoCo does not like a variable to be named AS for some reason, and I
> needed to change the ON ERROR command to be ONERR.
>
> With these changes, I am able to get the program to go through
> initialization and show the $ prompt as it should.  Then, it will take an
> initial (, but it hangs on the next character I type.
>
> So, that’s my progress so far.  I am thinking that I will have to
> explicitly indicate that all the numeric variables and arrays (except F and
> W) are integer by using the % marker on them.  Then, perhaps I will be able
> to lengthen the LM and PL arrays.  But first, I’ll have to figure out where
> the code is hanging up, so I can actually enter an entire line for
> evaluation by the interpreter.
>
> That’s all so far...
>
> smp
> --
> Stephen M. Pereira
> Bedford, NH  03110
> KB1SXE
>
>
> > On Nov 11, 2014, at 5:42 PM, Stephen Pereira <spereira1952 at comcast.net>
> wrote:
> >
> > I remember that someone posted that he had come across an article and
> listing for Basic Lisp, a small version of Lisp coded in TRS-80 Basic.  The
> article and listing is found in 80 Microcomputing magazine from March 1983.
> >
> > Interestingly enough, I recently stumbled across this, as well.  I was
> intrigued, so I captured the Basic code from the text of the magazine that
> is available at archive.org <http://archive.org/>:
> https://archive.org/stream/80-microcomputing-magazine-1983-03/80Microcomputing_0383_djvu.txt
> <
> https://archive.org/stream/80-microcomputing-magazine-1983-03/80Microcomputing_0383_djvu.txt
> >
> >
> > I believe that I have cleaned up all the OCR errors in the code by
> comparing it with the listing in the PDF scan of the magazine.  I have
> attached the file, so anyone else who is interested can have it, too.
> >
> > The Basic code is originally for other TRS-80 computers besides the
> CoCo, so it will take a bit more cleanup to get it to go on the CoCo.  I
> gave it a brief try, and after clearing out the DEFINT and DEFSTR commands
> in line 15, I got an OM error in that same line.  I guess that the CLEAR
> and DIM statements use up a bunch of memory, leaving nothing left.
> >
> > Oh, well, I’ll keep playing around with it, and I’ll let you know what
> progress (of lack thereof) I make.
> >
> > smp
> > --
> > Stephen M. Pereira
> > Bedford, NH  03110
> > KB1SXE
> >
> > <BasicLisp.txt>
> >
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list