[Coco] ML Question: MMU Block Switching

William Astle lost at l-w.ca
Mon Feb 16 21:22:05 EST 2015


If having interrupts active while the memory block is switched doesn't 
cause a crash and if the interrupts themselves don't touch the MMU 
register you're changing, there's no need to disable them while making 
the switch.

If, however, you're switching out something that the interrupts rely on, 
you'll have to disable them for the duration of your operations with the 
switched memory map.

Also, as has been noted elsewhere, you need to match your orcc and andcc 
to use the same bits. Your example code only re-enables IRQ but you're 
disabling both IRQ and FIRQ. #$af is the right one to re-enable both.

On 15-02-16 05:32 PM, William Mikrut wrote:
> I do have a another ML question about memory block switching.
> When processing I will have a controlling program setup at $1200
>
>          orcc     #$50    Interrupts off
> lda $ffa1     Load current page
> anda   #63
> pshs a           Push for later
> lda #$36 Map in Hi-res Text
> sta $ffa1     Tell MMU to switch page
> andcc  #$ef      Interrupts on
>
> Now I can manipulate data in $2000-$3FFF and essentially display text on
> the hi-res text screen.
>
> When I am done and ending the program I cleanup with this:
>          orcc #$50
> puls a
> sta $ffa1
> andcc  #$ef
>
> Is there any reason that would cause a program fault while my lower memory
> program is operating and the MMU is set to map in page 36 to $2000-$3FFF?
>
> My lower memory program is no where near $2000 in ending size.
>



More information about the Coco mailing list