[Coco] CoCo3 and 16K cart roms.....

William Astle lost at l-w.ca
Mon Apr 11 11:32:41 EDT 2016


You can actually test for ROM mode without burning a register. Also, 
"STA" would be faster than "CLR" for the FFDx addresses.

The test for ROM mode involves some cleverness related to the fact that 
the opcodes for BRA and BRN differ by 1.

	DEC ROMTEST
ROMTEST	BRN RAMMODE
	JMP ROUTINE
RAMMODE	INC ROMTEST
	; set up ROM mode with book keeping as needed
	JSR ROUTINE
	; restore RAM mode with book keeping as needed
	RTS

The above has the advantage that it doesn't burn any registers unless 
the "book keeping" bits do. It depends what ROUTINE does whether you 
need to do any book keeping or not, of course.

The above has the advantage that if someone has previously set the 
system to ROM mode for some reason (which can happen), you won't return 
it to RAM mode unexpectedly.

It has the disadvantage that the stack will be arranged differently 
depending on whether you were vectoring in via ROM or RAM mode but if 
you aren't relying on stack contents for parameters, that won't be a 
problem.

It will also run ROUTINE in ROM mode on a Coco1/2 that's been switched 
to all RAM mode and then return it to RAM mode when done.

On 2016-04-11 08:14, Barry Nelson wrote:
>   To access the contents of $E000-$FE00 in rom on a CoCo 3 you must first set ROM mode.
>
>          		LDA	$FFFE		Get first byte of the reset vector
>          		CMPA	#$8C		Is this a CoCo 3?
>          		BNE	COCO12
> 			CLR	$FFDE		Enable ROM in memory map
> COCO12	JSR		ADDRESS	Your routine in upper rom
>          		LDA	$FFFE		Get first byte of the reset vector
>          		CMPA	#$8C		Is this a CoCo 3?
>          		BNE	SKIPRAM
> 			CLR	$FFDF		Enable all RAM mode
> SKIPRAM	NOP				Code continues
>
>> Bill Pierce ooogalapasooo at aol.com
>> Mon Apr 11 09:02:46 EDT 2016
>>
>> Phil, isn't that where Super Extended Basic is at?
>> The Coco 3 transfers it's Roms to ram to patch in SECB after boot, so your rom is being over written by SECB. That's the same problem with extending HDBDOS to 16k, it won't work on Coco 3 without doing some bank switching to keep SECB working.
>
>



More information about the Coco mailing list