ppage register & far pointer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ppage register & far pointer

813 Views
Claudione
Contributor I

Hi.

In my project  I have several files in C & assembler language .

I'm using a banked memory model and in an assembler file I wrote my assembler font tables.

Initially I din't have any problem because the fonts were in the fixed flash page.

But now (code increased) they are in the 31 page.

I need to get the right font pointer with this assembler funtion:

 

 

 GetFontPtr:
 ldx    #Fnt_00                                          ;ix* = font 0
 ldy    1,sp                                ;iy* = font code to use
 cpy    #0                                               ;is font type N° 0 ?
 beq    GetFontPtr01
 ldx    #Fnt_01                                          ;ix* = font 1
 
GetFontPtr01: 
 subd   #32                                              ;subd space
 lsld                                                   ;16 bit entry
 leax   d,x                                             ;load effective addres from d
 ldx    0, x ;low address
 ldab   PPAGE ;high address (PPAGE)
 rtc
I modified the return convention and everything it's ok especially if and only if the GetFontPtr is in the same page of fonts.
But I want to keep my assembler function in page 30 and the font in page 31.
In this condition the instruction ldx 0,x get the right address, because the Fnt_00 and Fnt_01 tables are seen from linker and the address it's ok...but no PPAGE register !
Infact it is 30.The value where is the function and not the  fonts.Clearly I don'thave the rigt pointer.
Simple example: if the table font has this address 318000 from ldx 0,x I get 8000 but the ppage reg is 30 not 31 !
I need to know  to export the ppage value from my assembler file.
Is it possible in your opinion ? Or I have to write the functions in the same font file ? 
I would not to do this.
Thanks a lot
Claudio
Labels (1)
0 Kudos
1 Reply

301 Views
CrasyCat
Specialist III

Hello

 

Only solution you have here is to go through a function which is allocated in non-banked flash to actually access the paged data (the font pointer in your case).

 

You cannot access a paged pointer from banked code.

 

Check how this is done in et run time libraries in module datapage.c.

 

CrasyCat

0 Kudos