On Tue, Jan 3, 2012 at 3:39 PM, Tony Duell <ard at p850ug1.demon.co.uk> wrote:
In genral, BASICs were not extendable like that. It is
very difficult to
add new keywords ot a BASIC interpretter, and the way to do it is not
often docuemnted.
MICROS~1 BASIC typically has a somewhat awkward DEFUSR function in the
language to let you create and call machine language code...
Sure. Most BASICs had some way to call machine language routines. But
doing so was totally differnet to using built-in fucntions (or using
BASIC subroutines) and requried you gerneally to remember th rright
addresses. Better tnan nothing, but a kludge.
I wrote at lot of hybrid BASIC/6502-machine-code programs back in the
day. In the Commodore world (PET BASIC all the way through the
C-128), you had the USR() function, which was handy if you wanted to
pass one floating-point arg to your program and/or wanted your routine
to pass you back a value - just POKE the address of your code into the
documented USR() vector location so BASIC could hit it via a
JMP-indirect instruction ($6C), or if you didn't need to pass args
in/out (or you were willing to play parser tricks), just directly call
your routine with SYS. It was all clearly described in the manuals -
I wouldn't call it a kludge, just a method that was probably present
in Microsoft BASICs that might not have been present in versions of
BASIC that was, for lack of a better term, more Dartmouth-like.
I didn't ever have much experience in the past with HP BASIC or DEC
EDUsystem BASIC, so I can't guess what, if any, mechanisms there were
for those commonly-encountered-at-school environments.
I guess if you were writing your own machine code, as I was doing,
you'd know your entry points, vs trying to make use of someone else's
code, where I can see how it might seem arbitrary and kludgey,
especially if they didn't prepend things with a jump table.
-ethan