Hi,
i am working on a serial bootloader for which i dont have the original source code but i can debug it in Codewarrior with USBBDM.
The problem is when it reaches a certain point in the code. In sort it loads 0xF at GPAGE and then it stores a word or byte at the specified location.
On the GSTD or GSTAB instruction the cpu resets. So i have to start from the beginning. Here is the code in assemble language.
ORCC #0X10 LDAB 0x10 PSHB MOVB #0xF, 0x0010 LDX 0x300E LDD 0x3010 GSTD 0x0, X PULB STAB 0x10 ANDCC #0xEF RTS
The cpu resets at the GSTD instruction.
A sort explanation on what the above code does is this,
Store 0xF to GPAGE
Load target address in X and word in D
Save word D at 0xF_xxxx.
Can someone suggest something or have an idea on what is going wrong here?
I would expect that the 0xF_3000 is the "global" ram location which is the same as the "logical" ram location which is at 0x3000.
Solved! Go to Solution.
What is stored in memory at 0x300E? LDX 0x300E loads X reg from memory @0x300E.
You expectations are wrong. See XS128 memory map depicted in Figure 1-2 in XS datasheet. Depending on available RAM size, 4k, 8k or 12k on XS64/XS128/XS256, RAM is available at global addresses 0xF_F000..0xF_FFFF / 0xF_E000.. / 0xF_D000..0xF_FFFF. Table 1-2 in datasheet specifies bottom global address for each derivative, see RAM_LOW column in Table 1-2.
What is stored in memory at 0x300E? LDX 0x300E loads X reg from memory @0x300E.
You expectations are wrong. See XS128 memory map depicted in Figure 1-2 in XS datasheet. Depending on available RAM size, 4k, 8k or 12k on XS64/XS128/XS256, RAM is available at global addresses 0xF_F000..0xF_FFFF / 0xF_E000.. / 0xF_D000..0xF_FFFF. Table 1-2 in datasheet specifies bottom global address for each derivative, see RAM_LOW column in Table 1-2.
0x300E is where the 16bits of the target address are stored.
Your tip really helped me as i moved the target address to the ones that you pointed and it worked. Thank you for your help.
Regards