Use VICE 3.6.1 monitor to check a memory location

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Use VICE 3.6.1 monitor to check a memory location

Post by nbla000 »

Sometime it's useful to use the VICE monitor to set checkpoint and debug the code on the fly, normally by using his manual, it's easy to understand how to use it but this time, I'm not able to find the right command for the VICE monitor.

What I wish is that when a specific location has a specific value, stop and go to the debugger window.

Supposing the location is $1000 and the value to check is $80 how to do?

I've tried these commands with no success:

Code: Select all

w store $1000 if $80
w store $1000 if $1000==$80
By typing this command from the Vic+8K prompt, nothing happens except the char on the top\left corner :wink: :

Code: Select all

POKE4096,128 
Some other similar working examples that I may use but is not exactly what I need:

Stop if any value is written to $1000:

Code: Select all

w store $1000
Stop if any value is written to $1000 and Accumulator is $80:

Code: Select all

w store $1000 if A==$80
Stop if any value is written to $1000 and Register X is $80:

Code: Select all

w store $1000 if X==$80
Stop if any value is written to $1000 and Register Y is $80:

Code: Select all

w store $1000 if Y==$80
Any idea?
Mega-Cart: the cartridge you plug in once and for all.
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Use VICE 3.6.1 monitor to check a memory location

Post by beamrider »

Shouldn't a combination of the A, X & Y commands work?

How else would $80 get into that memory location (other than inc/dec) which perhaps you also want to catch?

+suppose you would also get false hits with x&y being set to $80 by chance e.g. for indexing
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Use VICE 3.6.1 monitor to check a memory location

Post by nbla000 »

By using these 3 commands:

Code: Select all

w store $1000 if A==$80
w store $1000 if X==$80
w store $1000 if Y==$80
I have some "false" stops that I may tolerate but I will not catch INC DEC without a specific command that check a specific value in a memory location...
Mega-Cart: the cartridge you plug in once and for all.
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Use VICE 3.6.1 monitor to check a memory location

Post by beamrider »

I would raise it as a bug for VICE as from my reading of the documentation I agree "w store $1000 if $1000==$80" should work.

btw, it also doesn't seem to work for the x64.exe

edit: For anyone else reading this that can't get the monitor to work also, figured out you have to uncheck Settings|Host|Monitor|Use native monitor interface (this is checked by default)!
Last edited by beamrider on Thu Jun 16, 2022 10:10 am, edited 1 time in total.
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: Use VICE 3.6.1 monitor to check a memory location

Post by thegg »

I believe the Vice help for 'condition' specifies a memory location in a specified bank is required. Try:
watch store $1000 if @:default:$1000 == (value)

Works for me on winvice 3.6.1
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Use VICE 3.6.1 monitor to check a memory location

Post by beamrider »

Didn't seem to work on older versions.

On 3.6 I can't even seem to open the monitor, just does nothing in response to "Activate Monitor".
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: Use VICE 3.6.1 monitor to check a memory location

Post by thegg »

Using Bank in xvic monitor gives 2 possible banknames default and cpu. So following the syntax described in 'help conditions':
Watch store $1000 if @default:$1000 == value
Watch store $1000 if @cpu:$1000 == value

Sorry my previous post had an erroneous : after the @. Note that the vice monitor displays @:bankname:location in its readout.

This works for me in WinVice 3.6.1.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Use VICE 3.6.1 monitor to check a memory location

Post by nbla000 »

thegg wrote: Thu Jun 16, 2022 6:02 am

Code: Select all

Watch store $1000 if @default:$1000 == value 
Watch store $1000 if @cpu:$1000 == value
Both methods work fine with Vice 3.6.1, thanks.

Anyway I'm curious to know what this command does:

Code: Select all

Watch store $1000 if $1000 == value

The monitor accepts this command but it never stops on $1000 with any value...
Mega-Cart: the cartridge you plug in once and for all.
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Use VICE 3.6.1 monitor to check a memory location

Post by beamrider »

nbla000 wrote: Thu Jun 16, 2022 9:01 am Anyway I'm curious to know what this command does:

Code: Select all

Watch store $1000 if $1000 == value

The monitor accepts this command but it never stops on $1000 with any value...
I believe it's just evaluating it as a Boolean expression as:

w store $1000 if $1 == $0 : never stops
w store $1000 if $1 == $1 : always stops
Last edited by beamrider on Thu Jun 16, 2022 10:21 am, edited 1 time in total.
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Use VICE 3.6.1 monitor to check a memory location

Post by beamrider »

also further to my previous post, the monitor doesn't work out of the box unless you uncheck Preferences|Settings|Host|UseNativeMonitorInterfce
Post Reply