A simple example illustrates placing data in the extended memory, reading a data from the extended memory and storing the data address to a linear pointer.
... #include <mmu_lda.h> #pragma CONST_SEG __LINEAR_SEG DATA_LINEAR const int x=2; #pragma CONST_SEG DEFAULT int y; void f() { /* y = x; */ __LOAD_LAP_ADDRESS(x); __LOAD_WORD_INC(y); }
In PRM file, place segment DATA_LINEAR at the correct address.
//PRM file
SEGMENTS
...
//PPAGE_5 = READ_ONLY 0x058000 TO 0x05BFFF;
...
ROM_LINEAR = READ_ONLY 0x014000'F TO 0x017FFF'F
...
END
PLACEMENT
...
DEFAULT_ROM, PAGED_ROM
INTO PPAGE_0,PPAGE_2,PPAGE_4,/*PPAGE_5,*/
PPAGE_6,PPAGE_7,ROM1;
...
DATA_LINEAR INTO ROM_LINEAR;
...
END