Coding : switch to ram overlay or bank

If your program must work with Orix

You don’t need to switch to overlay ram. Because Orix use it (a little) mainly for keyboard buffers and rs232 buffers (14KB are free).

If you need more ram, you can use malloc. Be careful because malloc in cc65 manages his own malloc “segment”.

In assembly, malloc use internal Orix malloc. If you need to switch to overlay ram, please contact me (jede[at]oric[dot]org

If your program is a standalone program (in basic11 for example)

In this case, you must use second via to switch to ram overlay.

Switch to overlay ram

#include "src/include/6522_2.h"
sei
lda V2DRA
and #%11111000 ; switch to overlay ram
sta V2DRA
cli

Return to atmos rom

#include "src/include/6522_2.h"
#define BANK_TO_SWITCH 6 ; 6th bank (atmos rom)
sei
lda V2DRA
and #%11111000 ; switch to overlay ram
sta V2DRA
cli

Switch to a bank

#include "src/include/6522_2.h"
#define BANK_TO_SWITCH 5 ; 5th bank
 
sei
lda V2DRA
and #%11111000 ; switch to overlay ram
ora #BANK_TO_SWITCH 
sta V2DRA
cli

 

Leave a Reply

Your email address will not be published. Required fields are marked *