This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A strange problem regarding pointer

I MUST set a pointer to 0xFF0000 in code space and use
instructions as follows:

     char code *ptr = 0xFF0000;
     value = *ptr;
On debugging, I watch the following code from diassemble window:

11: char code *ptr = 0xFF0000;
C:0x1F04F5 E4 CLR A
C:0x1F04F6 90190004 MOV DPTR,#0x190004
C:0x1F04FA F0 MOVX @DPTR,A
C:0x1F04FB A3 INC DPTR
C:0x1F04FC F0 MOVX @DPTR,A
???Only allocating 2 bytes for ptr???

12: value = *ptr;
C:0x1F04FD 90190004 MOV DPTR,#0x190004
C:0x1F0501 E0 MOVX A,@DPTR
C:0x1F0502 FE MOV R6,A
C:0x1F0503 A3 INC DPTR
C:0x1F0504 E0 MOVX A,@DPTR
C:0x1F0505 F582 MOV DPL(0x82),A
C:0x1F0507 8E83 MOV DPH(0x83),R6
C:0x1F0509 75931F MOV DPX(0x93),#0x1F
???Get data from 1F0000H???
C:0x1F050C E4 CLR A
C:0x1F050D 93 MOVC A,@A+DPTR
C:0x1F050E 90190003 MOV DPTR,#0x190003
C:0x1F0512 F0 MOVX @DPTR,A

In another word, ptr = 0x1F0000!!!
Why? What should I do?

My configuration is as follows:
Language = C;
CPU = DS80C400;
Option for Target:
Memory model: Large
Code ROM size: Contiguous Mode: 16MB Program
Off-chip code memory: 0x1F0000(0x10000 in length),
0xFF0000(0x8000 in length)
Off-chip Xdata memory: 0x190000(0x10000 in length)
Enable "far memory type support"
Enable LX51 & AX51

0