On Thursday, December 5, 2013 11:40:13 AM UTC-5,
ep...@juno.com wrote:
> I know of two main ways to extend interpreted MS-Basic for the 65xx family. One is to CALL (or SYS on CBM) a ML routine at a known address. This routine then uses internal ROM routines. To look at the tokenized text in the code stream following the CALL (or SYS).
>
I already know of this. I'd rather do this from a ROM cartridge, but I want to make available an extension written in assembler, loaded in and called via a SYS command for other users who want to extend C64 BASIC.
> I don't remember if the Vic-20 or C-64 has a LINE INPUT routine. The problem with INPUT X$ is that the read terminates with a comma in the input text. Once the ML routine is installed, you would use it with a SYS address,X$. The routine would look
That's good, but I'd rather *extend* the BASIC language, i.e. add commands, functions and support.
> In order to understand what is going you have to understand that MS-Basic has something called a TXTPTR (text pointer) that points to what BASIC is currently trying to interpret. CHKCOM makes sure that TXTPRT is pointing to a comma, else syntax error. PRTGET fetches a pointer to the memory used by variable X$. INLIN reads data into the input buffer. SAVED converts that off to a string variable. (and lots of other internal stuff...)
>
I understand about TXTPTR and CHRGET/CHRGOT but want a full tutorial on the subject. I have a C64 ROM map, but it doesn't show how to use the routines, nor does it display the information in a useful format.
> A more primitive way is to hook a lower level routine in BASIC called CHRGET. This routine is what BASIC uses to fetch the next (tokenized) character in either the program or in text input from the keyboard. AFAIK on CBM, this routine can be re-vectored to call a user routine, then if nothing of interest is found, to rejoin the normal ROM routine.
>
Could be useful, but I'd rather not.
> There are two spiral bound books that document the KERNAL and ROMs in great detail for the C64. Sorry, I don't remember their titles (maybe by Sheldon Leemon??)
>
Any resources online?