CC1B memory allocation for SX chips Priority when allocating variables: 1. Variables permanently assigned to a location eg. char aChar @0x21; char Alias @aChar; 2. Local variables allocated by the compiler 3. Global variables allocated by the compiler SX18/20/28 memory map (prior to allocating variables) Mapped RAM: 00h : -------- ******** Bank 0 RAM: 10h : ******** ******** Bank 1 RAM: 30h : ******** ******** Bank 2 RAM: 50h : ******** ******** Bank 3 RAM: 70h : ******** ******** Bank 4 RAM: 90h : ******** ******** Bank 5 RAM: B0h : ******** ******** Bank 6 RAM: D0h : ******** ******** Bank 7 RAM: F0h : ******** ******** SX48/52 memory map (prior to allocating variables) Mapped RAM: 00h : -------- --****** Bank 1 RAM: 10h : ******** ******** Bank 2 RAM: 20h : ******** ******** Bank 3 RAM: 30h : ******** ******** Bank 4 RAM: 40h : ******** ******** Bank 5 RAM: 50h : ******** ******** Bank 6 RAM: 60h : ******** ******** Bank 7 RAM: 70h : ******** ******** Bank 8 RAM: 80h : ******** ******** Bank 9 RAM: 90h : ******** ******** Bank10 RAM: A0h : ******** ******** Bank11 RAM: B0h : ******** ******** Bank12 RAM: C0h : ******** ******** Bank13 RAM: D0h : ******** ******** Bank14 RAM: E0h : ******** ******** Bank15 RAM: F0h : ******** ******** Bank 0 RAM:100h : ******** ******** Symbols: * : free location - : predefined or fixed at address (pragma variable) = : local variable(s) . : global variable 7 : 7 free bits in this location To place variables in Mapped RAM #pragma rambank - char aChar; or use shrBank char aChar; To place variables in Banked RAM #pragma rambank 1 char aChar; or use bank1 char aChar; Variables declared prior to any #pragma rambank or not at a fixed address, are located in the Mapped RAM area. The shadowDef type modifier allow local and global variables and function parameters to be assigned to specific addresses without affecting normal variable allocation. The compiler will ignore the presence of these variables when allocating global and local variable space. shadowDef char aChar @0x70; //global or local variable The above definition allows location 0x70 to be inspected and modified through variable 'aChar'.