I have a board with a DS80C310. I have been using Keil tools for years. We are considering expanding from 48K of RAM to 128K RAM. I was reading the Keil newsletter which discusses the new LX51 Extended Linker product. This sounds like it will do the trick. What do I have to do to take advantage of this capability (other than buy the upgrade)? Do I need to make any hardware changes? Do I need to define the memory as FAR instead of XDATA? Is accessing memory in the first 64K different than in the upper 64K? Can I transparently access one large array that starts in the lower 64K and runs up into the upper 64K?
The place to start is to take a look at the XBANKING.A51 file in the LIB directory. This is where you configure the far memory. The C51 Compiler uses 3-byte generic pointers to access far memory areas. far variables are placed in the HDATA memory class and far const variables are placed in the HCONST memory class. The LX51 linker/locater allows you to locate HDATA and HCONST in the logical 16 MBYTE CODE or 16 MBYTE XDATA spaces. The memory access itself is performed via eight different subroutines that are configured in XBANKING.A51. These routines are: * ?C?CLDXPTR and ?C?CSTXPTR: Load and store BYTE (char) in extended memory. * ?C?ILDXPTR and ?C?ISTXPTR: Load and store WORD (int) in extended memory. * ?C?PLDXPTR and ?C?PSTXPTR: Load and store 3-BYTE PTR in extended memory. * ?C?LLDXPTR and ?C?LSTXPTR: Load and store DWORD (long) in extended memory. Note that XBANKING.A51 provides examples for these routines. Each function receives a parameter which is the 3-byte memory address. Registers R1, R2, and R3 contain the pointer. R3 contains the memory type as shown in the following table:
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
MOV R1,#LOW (variable) ; gives LSB address byte of variable MOV R2,#HIGH (variable) ; gives MSB address byte of variable MOV R3,#MBYTE (variable) ; gives memory type byte of variable CALL ?C?CLDXPTR ; load BYTE variable into A