Previous Thread
Next Thread
Print Thread
Writing registers from Debugger Watchpoints #115255 05/10/19 11:49 AM
Joined: Feb 2014
Posts: 280
G
Golden Child Offline OP
Senior Member
OP Offline
Senior Member
G
Joined: Feb 2014
Posts: 280

I was trying to get the debugger to respond to a watchpoint and change the value returned in a register, but it didn't work as expected.

The Apple II code would LDA $C0F0 (an i/o address) and I wanted it to return a specific value in the 6502 accumulator, say 0xFF.

So my debugger watchpoint would look like this:

wp c0f0,1,r,1,{a=ff; g}

but what's interesting is that the a=ff gets executed immediately when you enter the wp command from the debugger console, which is definitely unexpected.

When it hits the actual watchpoint, doesn't actually change the accumulator's value.



If you add a printf to the watchpoint to see the value of the accumulator, you get:

wp c0f0,1,r,1,{printf "%x",a;a=ff;printf "%x",a; }

It will print what you expect, but it doesn't seem to actually change the accumulator as execution continues.

Re: Writing registers from Debugger Watchpoints [Re: Golden Child] #115289 05/13/19 04:51 PM
Joined: Jun 2014
Posts: 83
P
peter ferrie Offline
Member
Offline
Member
P
Joined: Jun 2014
Posts: 83
If you "wp c0f0,1,r,{a=0xff}" (i.e. drop the trailing '1') then it will do the expected thing.
The trailing '1' is causing the watchpoint to be evaluated immediately because it's always true, but that it activates immediately looks like a bug since the watchpoint itself isn't hit yet.

Re: Writing registers from Debugger Watchpoints [Re: Golden Child] #115290 05/13/19 07:01 PM
Joined: May 2012
Posts: 513
S
shattered Offline
Senior Member
Offline
Senior Member
S
Joined: May 2012
Posts: 513
Originally Posted by Golden Child

but what's interesting is that the a=ff gets executed immediately when you enter the wp command from the debugger console, which is definitely unexpected.


And feels like a bug. Interesting unexpected stuff may happen if you change pc in the expression smile


Who's Online Now
4 registered members (R. Belmont, zino, AJR, 1 invisible), 90 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,673
Posts113,788
Members4,852
Most Online418
Aug 14th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3