[Coco] Cartridge memory - mapping in and out

Roger Taylor operator at coco3.com
Mon Oct 29 12:06:36 EDT 2007

At 08:44 AM 10/29/2007, you wrote:
>Robert Gault wrote:
>>  If you want to be sure the cart ROM is readable, you will have 
>> best success with a short ml program that forces the ROM mode and 
>> transfers the data from $C000-$DFFF to lower memory, say 
>> $4000-$5FFF. Return the Coco3 to the normal all RAM conditions and 
>> then check the contents of $4000-$5FFF.
>Thanks for the detailed explanation Robert, much appreciated!
>I need to actually address the *real* cartridge at $C000, because I 
>need to write to the flash chip on the board. Is there any reason 
>why POKE 65502,0 (switch to ROM mode) isn't sufficient to do this? 
>It would appear I can at least read the cartridge contents from 
>$C000 using this POKE...

(On a CoCo 3) I think doing a POKE 65502,x from BASIC is a no-no 
because it switches out the patched ROMs (which are in RAM) and 
switches in the underlying actual ROMs, and performing any commands 
now could crash the system.
That's what the EXEC $E010 does,... very quickly by machine language 
- sets up the GIME and RAM/ROM switch to prepare to run the cartridge 
ROM without letting the user fiddle around at the prompt or perform 
any other functions.

The same goes for writing code that copies a ROM into RAM.  You 
should mask the CPU interrupts (ORCC #80), then for each byte of the 
ROM, POKE 65502,x, read the byte, POKE 65503,x, write the byte into 
RAM, and repeat until all ROM bytes are read, then restore the CPU 
condition code register (ANDCC #175).

More information about the Coco mailing list