Accessing Data Objects Examples

The tables below show appropriate ways to access a global integer and a global pointer variable. The first two columns of each table list states of two checkboxes, Large Data Model and Globals live in lower memory. Both checkboxes are in the M56800E Processor settings panel; the first enables the second.

The following table lists ways to access a global integer stored at address X:0x1234.

int g1;
Table 1. Accessing Global Integer
Large Data Model checkbox Globals Live in Lower Memory Checkbox Instruction Comments
Clear Clear move.w

X:0x1234,y0

Default values
Checked Clear move.w

X:0x001234,y0

 
Clear Checked Combination not allowed  
Checked Checked move.w

X:0x1234,y0

Global accesses use 16-bit addressing

The following table lists ways to load a global pointer variable, at X:0x4567, into an address register.

 int * gp1;
Table 2. Loading Global Pointer Variable
Large Data Model checkbox Globals Live in Lower Memory Checkbox Instruction Comments
Clear Clear move.w

X:0x4567,r0

Default 16-bit addressing, 16-bit pointer value
Checked Clear move.l

X:0x004567,r0

24-bit addressing, pointer value is 24-bit
Clear Checked Combination not allowed  
Checked Checked move.l

X:0x4567,r0

16-bit addressing, pointer value is 24-bit