The MCU I used is SM8958A,which has 1K bytes on-chip RAM, 256 bytes of it are the same as general 8052 internal memory structure while the expanded 768 bytes on-chip RAM can be accessed by external memory addressing method (by instruction MOVX).The SCONF and RCON should be setting when the expanded 768 bytes on-chip RAM is used.The meaning of RCON is below:
SM8958A has 768 byte on-chip RAM which can be accessed by external memory addressing method only. (By instruction MOVX). The address space of instruction MOVX @Rn is determined by bit 1 and bit 0 (RAMS1, RAMS0) of RCON. The default setting of RAMS1, RAMS0 bits is 00 (page0).
RAMS1 RAMS0 MOVX @Ri i=0,1 mapping to expended RAM address 0 0 $0000 ~ $00FF 0 1 $0100 ~ $01FF 1 0 $0200 ~ $02FF
Now I write the code below:
unsigned long pdata a; unsigned long xdata b; SCONF |= 0x02; //enable the 768 Ram RCON |= 0x01; //$0100 ~ $01FF
When I press F5, I find the position of 'a' in the memory is X:0x0001A4,and the auto disassemble instruction is mov r0, #0xA4, however,the position of 'b' in the memory is X:0x0002BF,and the auto disassemble instruction is movx DPTR,#02BF.
Finally, the program where used 'a' runs wrong,but the program where used 'b' runs right.
But when I program the HEX file into the MCU, let it run in the hardware , the program runs ok.
So, I'm very puzzled: Keil's Debug is right or wrong?
Note This message was edited to reduce width.
mov R0,#0xA4 just move the value from X:0x0000A4 , not X:0x0001A4, that is what I am puzzled. You know, the address of 'a' in memory is X:0x0001A4 at that time. I'm sorry I did not describe my problem clearly.
mov R0,#0xA4 just move the value from X:0x0000A4 NO, it does not! it moves 0xa4 into r0 I huess the next instructions will be mov a,@R0 THAT will move what is at xxa4 in memory into the accumulator. xx will be either the contents of P2 (traditional approach) or if your derivative - which I never have heard of - has a "high memory address SFR" by whatever name, it will be the contents of that.
Erik
mov R0,#0xA4 just move the value from X:0x0000A4 NO, it does not! it moves 0xa4 into r0 I huess the next instructions will be movX a,@R0 THAT will move what is at xxa4 in memory into the accumulator. xx will be either the contents of P2 (traditional approach) or if your derivative - which I never have heard of - has a "high memory address SFR" by whatever name, it will be the contents of that.