Re: BASIC for the CBM-II/8088

From: Spiro Trikaliotis <ml-cbmhackers_at_trikaliotis.net>
Date: Thu, 5 Jul 2018 22:15:56 +0200
Message-ID: <20180705201556.4f3cb2zg6gfoexep@hermes.local.trikaliotis.net>
Hello Mia,

* On Thu, Jul 05, 2018 at 04:34:55PM +0200 Mia Magnusson wrote:
> Den Thu, 05 Jul 2018 14:59:49 +0200 skrev MichaƂ Pleban
> <lists@michau.name>:
> > Baltissen, GJPAA (Ruud) wrote:

> > > Storing the variables. Again I don't know exactly how BASIC saves it
> > > variables.
> 
> There are some stuff online about this. In short it has a table
> (dynamically resized as needed) that contains a list of all variable
> names, types and for floats and integers the actual values. For arrays
> it instead points to where in the array area the variable is, and for
> strings it points to where the string is stored.

For arrays, you are wrong. Array have their own area, and they start
after the variable area.

"Normal" variables all occupy 7 byte (even if they do not need all of
them), that's why you can proceed to the next one just by adding 7 to
the current address.

For arrays, this is not true anymore, they occupy exactly as many byte
as they need to.

>                                              If B$ is shrunk the
> existing length will be retained,

I think you are wrong: BASIC will allocate new space for a new variable,
even if it is smaller than the previous one. It will let the GC take
care of this later.

At least, that should be correct until BASIC2. I do not know about newer
ones (namely, 3.5, 7.0)

> while if B$ grows then a new space
> will be allocated (maybe it deletes the old if it were the last stored
> in the string space).

Your "maybe" part is wrong, again. It will not do this. It just lets the
GC handle it.

 
> On VIC-20/C64 the pointers for these areas are somewhere around 43
> (decimal) in zero page.

43/44: start of BASIC program
45/46: start of variable area (and, thus, end of program + 1)
47/48: start of array area (and, thus, end of variable area + 1)
...

 
> It seems like Microsoft Basic = CBM Basic were written to be able to
> process mathematical problems and other thins like speed had a lower
> priority.

Most probably, they had a space limitation. They wanted to make BASIC as
small as possible. That's why even the advanced FP routines were
optional in the original MS BASIC.

As the routines already existed, it was easier (program size wise) to
reuse the routines instead of generating their own integer routines.

Regards,
Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/
Received on 2018-07-05 23:00:19

Archive generated by hypermail 2.2.0.