far types

I've tried to mod the xbanking link file to generate paging for my device.

I was trying to use segment B which is defined between 8000-BFFF. Then page into this to give 128k.

I have set the HData to 0000-1FFFF in the options for far data.

Here are the mods i made.

LOAD_BANK MACRO
LOCAL lab
MOV DPL,R1
MOV DPH,R2
ORL DPH,#80H
;Now generate the page
MOV A,R2
RL A
RL A
ANL A,#03H
MOV ?C?XPAGE1SFR,A

Then used one of the examples from banking and tried this.

FVAR (char, 0x15678) = 0x5A;
i = FVAR (char, 0x15678);

i comes out to be 1. Stepping through the assembly code looks fine.

Is this correct usage?

David

Parents
  • I have set the HData to 0000-1FFFF in the options for far data.

    Oops. I missed this in the original post.

    Take a look at this table from XBANKING.A51:

    ; Each function gets as a parameter the memory address with 3 BYTE POINTER    *
    ; representation in the CPU registers R1/R2/R3.  The register R3 holds the    *
    ; memory type.  The C51 compiler uses the following memory types:             *
    ;                                                                             *
    ; R3 Value | Memory Type | Memory Class | Address Range                       *
    ; -----------------------+--------------+--------------------------           *
    ;    00    | data/idata  | DATA/IDATA   | I:0x00     .. I:0xFF                *
    ;    01    | xdata       | XDATA        | X:0x0000   .. X:0xFFFF              *
    ;  02..7F  | far         | HDATA        | X:0x010000 .. X:0x7E0000            *
    ;  80..FD  | far const   | HCONST       | C:0x800000 .. C:0xFD0000 (see note) *
    ;    FE    | pdata       | XDATA        | one 256-byte page in XDATA memory   *
    ;    FF    | code        | CODE         | C:0x0000   .. C:0xFFFF              *

    From this, I think you need to set your HDATA range from 0x020000-0x03FFFF.

    If you access anything from 0x000000-0x00FFFF, the compiler assumes this is in IDATA and never calls the XBANKING routines.

    Anything in the range 0x010000-0x01FFFF is in XDATA. Accesses to this range also do not call the XBANKING routines.

    Jon

Reply
  • I have set the HData to 0000-1FFFF in the options for far data.

    Oops. I missed this in the original post.

    Take a look at this table from XBANKING.A51:

    ; Each function gets as a parameter the memory address with 3 BYTE POINTER    *
    ; representation in the CPU registers R1/R2/R3.  The register R3 holds the    *
    ; memory type.  The C51 compiler uses the following memory types:             *
    ;                                                                             *
    ; R3 Value | Memory Type | Memory Class | Address Range                       *
    ; -----------------------+--------------+--------------------------           *
    ;    00    | data/idata  | DATA/IDATA   | I:0x00     .. I:0xFF                *
    ;    01    | xdata       | XDATA        | X:0x0000   .. X:0xFFFF              *
    ;  02..7F  | far         | HDATA        | X:0x010000 .. X:0x7E0000            *
    ;  80..FD  | far const   | HCONST       | C:0x800000 .. C:0xFD0000 (see note) *
    ;    FE    | pdata       | XDATA        | one 256-byte page in XDATA memory   *
    ;    FF    | code        | CODE         | C:0x0000   .. C:0xFFFF              *

    From this, I think you need to set your HDATA range from 0x020000-0x03FFFF.

    If you access anything from 0x000000-0x00FFFF, the compiler assumes this is in IDATA and never calls the XBANKING routines.

    Anything in the range 0x010000-0x01FFFF is in XDATA. Accesses to this range also do not call the XBANKING routines.

    Jon

Children
More questions in this forum