[Coco] Cartridge memory - mapping in and out
Robert Gault
robert.gault at worldnet.att.net
Mon Oct 29 09:22:34 EDT 2007
Mark McDougall wrote:
> Hi all,
>
> I'm a little confused...
>
> If I load a cart with autostart disabled, then PEEKing memory from $C000
> upwards does not return the cartridge contents. I can also read/write
> RAM at those locations.
>
> However, EXEC 49152 ($C000) runs the game.
Not always!
> Is the BASIC interpreter
> doing something shifty here?
No
>
> I have noticed that poking the GIME INIT0 register with a value other
> than $7E briefly sets the register value, but on return to the BASIC
> prompt, it is reset to $7E...
>
> What I'm trying to do is map the cartridge ROM into coco3 memory space
> so I can PEEK (and POKE) it from BASIC. Is this do-able???
>
> Regards,
>
Your problem seems to be you have forgotten a major difference between
the Coco3 and the 1&2 units. The Coco3 runs in all RAM mode.
Now, part of the Coco3 cold start routine ($C123) checks the first two
bytes of the cart ROM. If those bytes are DK, then the routine copies
the ROM into RAM. If the cart does not have DK as the first two bytes,
no copying takes place.
There are many carts that do not auto-start. The owners manual for the
Coco3 states that these carts can't be run with EXEC&HC000. Instead you
must use EXEC&HE010. What's the difference?
If a cart ROM was not copied into RAM, EXEC&HC000 will be completely
unpredictable and almost certainly crash the system. On the other hand,
EXEC&HE010 equals:
E010 JMP $A05E
A05E JSR $8C2E
JMP $C000
8C2E LDA #%11001100 Coco1, MMU, 16K internal/16K external ROM
STA $FF90
CLR $FFDE SAM RAM/ROM switch
RTS
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.
More information about the Coco
mailing list