[Coco] Color BASIC BREAK CHECK RAM hook ($17c)

rcrislip rcrislip at neo.rr.com
Mon Jun 20 14:28:40 EDT 2022


On Sun, 19 Jun 2022 23:42:14 -0500
Allen Huffman via Coco <coco at maltedmedia.com> wrote:

> > On Jun 19, 2022, at 7:32 PM, Walter ZAMBOTTI
> > <zambotti at iinet.net.au> wrote:
> > 
> > sounds technical.
> > 
> > You could have provided a short explanation of what the console out
> > hook is or what it does.
> > 
> > I assume console means display so this is where the the bits
> > finally hit the video ram memory and are displayed on screen?!?!?  
> 
> It is, quite so, to me, but probably not for many on this list who
> learned all of this 40 years ago.
> 
> The ROM has a routine calls CONSOUT that takes whatever character is
> in register A and outputs it to a device.
> 
> Devices are numbered, like:
> 
> -2 - printer
> -1 - cassette
> 0 - screen and keyboard
> 1-15 - disk
> 
> Printing to the screen we all know, but you can also use its device
> number:
> 
> PRINT “HELLO”
> 
> PRINT #0,”HELLO"
> 
> When you print to the printer, you don’t have to open it first. You
> just use the device:
> 
> PRINT #-2,”THIS GOES TO THE PRINTER”
> 
> And then tape and disk files get opened first:
> 
> OPEN “O”,#-1,”TAPEFILE”
> PRINT #-1,”THIS GOES TO TAPE”
> CLOSE #-1
> 
> OPEN “O”,#1,”DISKFILE”
> PRINT #1,”THIS GOES TO DISK”
> CLOSE #1
> 
> CONSOUT is called for all of those, and the ROM code checks the
> device number and decides where to go.
> 
> Color BASIC had support for printer #-2, tape #-1, and screen #0. 
> 
> The RAM hook was used to add more devices.  In Color BASIC, when a
> character is being output, the ROM routine first calls the RAM hook.
> For Color BASIC alone, it’s nothing — just a return.
> 
> But when Extended BASIC ROM is there, it changes the RAM hook to a
> jump instruction pointing to new code in the Extended ROM.  That code
> looks at the device and handles a special case for the DLOAD command,
> which I just learned was device #-3. I had no idea about this one.
> But it would do that, and then return.
> 
> Disk BASIC, if present, overrides the RAM hook and makes it jump to
> Disk BASIC somewhere. In that code, it checks for disk devices and
> handles it, and then jumps directly to the handler in Extended BASIC.
> This means Disk BASIC was hard coded to a specific address in Exended
> BASIC which Microsoft would have had to ensure did not change.  I
> don’t know how many versions of Extended BASIC got released, but they
> would have all had to keep this routine in the same ROM location for
> compatibility.
> 
> And down the rabbit hole I go… I’ll have an article about this up on
> subethasoftware.com <http://subethasoftware.com/> soon with example
> code and what I have learned so far.
> 
> --
> Allen Huffman - PO Box 7634 - Urbandale IA 50323 - 515-999-0227
> (vmail/TXT only) http://www.subethasoftware.com -
> https://www.facebook.com/subethasoftware
> 
> 
> 

Thank you documenting all this.

Cheers


More information about the Coco mailing list