sx48 rambank0 addressing
Peter Verkaik
Posts: 3,956
Hi,
Having used only sx18 and sx28 I now try to use rambank0 in the sx48.
If I understand the addressing correctly, I must define
;bank0
org $0
bank0 = $· ;so I can use bank bank0
org $10
temp1 ds 1
temp2 ds 1
etc.
;bank1
org $10
bank1 = $
temp3 ds 1
temp4 ds 1
etc.
So bank0 variables have identical addresses as bank1 variables
then use
bank bank0
mov temp1,w· ;semi direct addressing
What registers are addressed when using IND as in
mov w,indf
if fsr holds $00 to $0F
Are the global registers addressed or rambank0?
I assume the global registers are accessed, so rambank0 is not accessible using indirect addressing.
Please correct me if any of the above is not correct.
regards peter
Having used only sx18 and sx28 I now try to use rambank0 in the sx48.
If I understand the addressing correctly, I must define
;bank0
org $0
bank0 = $· ;so I can use bank bank0
org $10
temp1 ds 1
temp2 ds 1
etc.
;bank1
org $10
bank1 = $
temp3 ds 1
temp4 ds 1
etc.
So bank0 variables have identical addresses as bank1 variables
then use
bank bank0
mov temp1,w· ;semi direct addressing
What registers are addressed when using IND as in
mov w,indf
if fsr holds $00 to $0F
Are the global registers addressed or rambank0?
I assume the global registers are accessed, so rambank0 is not accessible using indirect addressing.
Please correct me if any of the above is not correct.
regards peter
Comments
I think you are correct in your assumptions.
Your right, rambank 0 cannot be accessed using FSR/IND. It can ONLY be accessed by setting FSR to $00 and using semi direct addressing. As in "MOV xx,W" where xx is between $10 and $1F inclusive.
This is why SX/B uses rambank 1 (FSR=$10) as the default on the SX48.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
I made a source for SX48, containing byte read/write and bit read/write routines
for both the general purpose ram and the special configuration registers.
I treat rambank0 registers as special configuration registers.
See the attached pdf for assigned config addresses.
The dynamic access to rambank0 requires a lot of code space (compared to the others)
so I think it is best to reserve rambank0 for a VP that runs in the isr. Then the
readRambank0 and writeRambank0 routines can be left out.
Edit: I added a source without the rambank0 access.
This has much smaller code size and only requires 1 global temporary register.
regards peter
Post Edited (Peter Verkaik) : 9/28/2006 9:43:30 AM GMT