[Coco] coco sub 64k memory modes
Darren A
mechacoco at gmail.com
Tue Aug 4 11:53:30 EDT 2009
On 8/4/09, Stephen Adolph wrote:
> Just to confirm,
> If I read what I've seen correctly,
>
> 32K bank switching is controlled by 4 registers
>
> FFDE/FFDF (TY) defines the use of the upper 32k for either the ROMs or RAM
>
> FFD4/FFD5 (P1) defines the use of the lower 32k for RAM, when in ROM
> ACTIVE (not all RAM mode)
>
> ex.
>
> To set all ram mode, one would write to FFDF
>
> To set first page of RAM active, and ROMS active, write to FFDE, FFD4
>
>
> And, to jump into all ram mode, you would (in machine language)
> (assuming default 32k operation)
>
> * write to FFD4 (ensure normal P1 setting)
> * start loop
> * write to FFDE (to go into RAM/ROM mode)
> * get a byte D from address A
> * write to FFDF(switch to all RAM mode)
> * write byte D to address A
> * end loop
>
>
> sound reasonable?
>
First off, if you are using a CoCo 3 then it runs in All RAM mode by
default, so there usually isn't any need to do this.
Your example is mostly correct for a 64K CoCo 1 or 2. You don't need
to touch P1 (FFD4, FFD5) because your code will be executing in
whatever page happens to be current (normally 0). If you changed the
page your code would disappear and the machine would likely crash.
Furthermore when in All RAM mode, P1 has no significance.
You also need to remember to mask interrupts during the loop, as in
the following example:
ORCC #$50
LDX #$8000
LP STA $FFDE
LDD ,X
STA $FFDF
STD ,X++
CMPX #$FE00
BNE LP
ANDCC #$AF
RTS
Darren
More information about the Coco
mailing list