The limited RAM size of the RS08 requires careful data allocation. Access global read/write data using tiny, short, direct, or paged addressing. Access global read-only data using paged or far addressing. RS08 non-static local data must be allocated into an OVERLAP section. The compiler does this allocation automatically, using the same address range as is used for direct addressing (0x00 to 0xBF).
See the following listing for examples using the different addressing modes.
/* in a header file */ #pragma DATA_SEG __TINY_SEG MyTinySection char status; #pragma DATA_SEG __ SHORT_SEG MyShortSection unsigned char IOReg; #pragma DATA_SEG DEFAULT char temp; #pragma DATA_SEG __ PAGED_SEG MyShortSection unsigned char IOReg; unsigned char *__paged io_ptr = &IOREG; #pragma DATA_SEG __ PAGED_SEG MyPagedSection const char table[10]; unsigned char *__paged tblptr = table; #pragma DATA_SEG __ FAR_SEG MyFarSection const char table[1000]; unsigned char *__far tblptr = table;
The segment must be placed on the direct page in the PRM file.
LINK test.abs NAMES test.o startup.o ansi.lib END SECTIONS Z_RAM = READ_WRITE 0x0080 TO 0x00FF; MY_RAM = READ_WRITE 0x0100 TO 0x01FF; MY_ROM = READ_ONLY 0xF000 TO 0xFEFF; PLACEMENT DEFAULT_ROM INTO MY_ROM; DEFAULT_RAM INTO MY_RAM; _ZEROPAGE, myShortSegment INTO Z_RAM; END VECTOR 0 _Startup /* set reset vector on _Startup */