[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applesoft BASIC coding



Paul Schlyter wrote:
In article <fYSdnVqTxdcX-ZvYnZ2dnUVZ_uidnZ2d@comcast.com>,
Michael J. Mahon <mjmahon@aol.com> wrote:


BLuRry wrote:

BTW, 49235 = 12*4096 + 0*256 + 5*16 + 3.
             C        0       5      3


If you're lazy like me and have the windows calc program handy, switch
it to scientific mode and you can convert between hex and dec numbers

True, but I find this a convenient and self-documenting convention
for hex numbers in BASIC.  (I wish it had a built in HEX notation,
but since it's Microsoft BASIC, it would probably be 8080-style
XXXXh.  ;-)

-michael


MBASIC on CP/M used &Hxxxx for hex constants and &xxxxx for octal constants.

Ah yes--I knew that once.  ;-)  Always preferred the $xxxx notation
for its economy and, to be honest, familiarity.

However, since the source code of Applesoft is available, anyone can
add whatever features they want to Applesoft.  I played around with it
in the early 1980's and added, among other things, hex constants using
the $xxxx notation.  Other things I added was IF...THEN...ELSE (still
a one-liner though), an ATAN2() function (i.e. an arc tangent which
works in all four quadrants), and DEG and RAD statements which made
the trig functions work in either dgrees or radians (somewhat like on
most calculators with trig functions).

While this was fun, it wasn't really that useful.  Token values had to
be changed, which made older Applesoft programs incompatible.  And
the interpreter itself had to run in RAM, leaving considerably less
space for Basic programs.

Since Applesoft isn't coded particularly tightly, I expect that some
bug fixes and modifications could fit nicely withing the original 8KB.

But there is a lot of "intertwining" of design decisions that would
make it difficult to extend very much without disturbing compatibility.

For example, many programs use entry points in Applesoft, making a
reassembly problematic.

-michael

New, faster SUDOKU v2.0 solver for Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it's seriously underused."