[Coco] Color BASIC and "CURLIN" (direct versus in a program)

Allen Huffman alsplace at pobox.com
Fri Oct 24 15:30:31 EDT 2025


> On Oct 24, 2025, at 2:14 PM, William Astle via Coco <coco at maltedmedia.com> wrote:
> 
>> Thanks — I’ll look at those for examples.
>> I was trying to find out how it knows what token was just parsed, but the code is fancier than my brain can currently understand.
> 
> I believe you'll want to look at the "Command interpretation loop" (RVEC20) and the "Crunch" (RVEC23) handlers. Yes, really. The tokenization routine. It's a hack to work around some unfortunate weirdness in the structure of Basic's main loop. Incidentally, Disk Basic 1.1 completely replaces the entire command interpretation main loop in its handler, apparently needlessly (it has a reason but it's not really important). I mention that so you can avoid being confused about what it's doing.

Your suggestion of the RVEC12 seems to do the trick.

newcode2
    ldx 2,s             get what called us
    cmpx #$ac7f
    bne continue2
    ldx #$ffff
    stx CURLIN

continue2
savedrvec12 rmb 3       call regular RAM hook
    rts                 just in case…

I found the return address at 2,s probably matching this in the ROM:

LAC7C JSR LA390 GO GET AN INPUT LINE
	LDU #FFFF THE LINE NUMBER FOR DIRECT MODE IS $FFFF

LA390 is the JSR to the vector:

LA390 JSR RVEC12 

This may be good enough for what I am doing. I’ll have another blog post soon that shows how I hijacked the UNCRUNCH so I could LIST and see embedded CHR$(128-255) characters, but I had to replicate much of the un-crunch code in my program since I was parsing for quotes and end of lines and such. Yuck.

		— ALlen



More information about the Coco mailing list