claudio brunelli

ppage register & far pointer

Discussion created by claudio brunelli on Nov 16, 2010
Latest reply on Nov 16, 2010 by CrasyCat


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:



 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
 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)
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