1) I am just getting started with the Keil 8051 IDE. For now, I am running the Hello World ASM example and would like to configure a breakpoint to break on read/write to DPTR, or any other SFR as a matter of fact. I go under Debug menu, Breakpoints and enter DPTR under expression and check off READ & WRITE check boxes yet when I go to define the breakpoint I get the message "breakpoint definition error". What's the proper way to define a breakpoint on an SFR read/write in the KEIL IDE? 2) The SP => 69H in the Hello world asm example. When the example steps into a function, the SP increments by two storing the return address. Yet when I go to View, Memory window, memory address 69h & 70h contain 0. Why can't I see the return address in memory?
The access breakpoints do not work on the core SFR's like ACC, B, DPTR, PSW, and the registers R0-R7. Basically almost every instruction is working with these registers and access breakpoints are therefore not useful. For the memory read you need to apply correct memory prefixes like I: for the IDATA space. See the Assembler User's Guide, Chapter 2 for an overview of the architectures.
Thank you for your reply. However to make a statement that almost every instruction is working with the special function registers and making it sound like all the SFRs are being accessed all the time is stretching it quite a bit. I can see accessing ACC or PSW all the time but for example B or DPTR is used less frequently. Hence for example in source code that I just inherited the DPTR register is accessed 6 times in 10000 lines of code - definitely not being accessed all the time. Irrespective of frequency, it would be very useful to be able to trap a write to a specific SFR such as the DPTR when for example troubleshooting what piece of code inadvertantly changes it. I looked through chapter 2 of the assembler user's guide again and understand IDATA space. How do you display IDATA space in a window using uVision IDE? Going under View, Memory Window seems to display XDATA space. How do you change the Memory Window to IDATA space? I can't seem to find where to do this.
The 8051 toolchain provides memory prefix characters. They are described on several places in the manuals. The best starting point might be the Assembler/Utilities User's Guide, Chapter 2, Architecture Overview. The memory prefix for IDATA is I:, so I:0x80 will be the IDATA space at address 0x80.