On Wed, Jan 4, 2012 at 3:30 PM, Randy Dawson <rdawson16 at hotmail.com> wrote:
An easy way to add commands is replace the vector to
SYNTAX ERROR with your own parser.
I did this for a commercial product, USDATA industrial BASIC, adding PLC communication
commands (Allen Bradley, Modicon) to a disassembled MS basic.
Here's what you get to play with under Microsoft ROM BASIC on the C-64...
IERROR 0300-0301 768-769 Vector: Print BASIC Error Message
IMAIN 0302-0303 770-771 Vector: BASIC Warm Start
ICRNCH 0304-0305 772-773 Vector: Tokenize BASIC Text
IQPLOP 0306-0307 774-775 Vector: BASIC Text LIST
IGONE 0308-0309 776-777 Vector: BASIC Char. Dispatch
IEVAL 030A-030B 778-779 Vector: BASIC Token Evaluation
The drawback with grabbing the error vector is that part of what you
may want to see has already gone past the parser pointer, so you
either have to back that up, or accept some character overhead every
time you want to "extend" the language. Since PET BASIC did not have
these vectors and since many C-64 tool writers started with PETs, the
typical mechanism was to jump in front of the regular parser (by
patching the CHRGONE routine in low RAM), look for your own token,
then either handle the rest yourself, or let the BASIC detokenizer
handle it. A few cycles of overhead, sure, but the technique worked
across multiple platforms.
-ethan