How to set a simple tcl breakpoint-condition in openmsx?

By Bengalack

Champion (414)

Аватар пользователя Bengalack

25-09-2021, 14:18

I have a suspect routine in mem between 0x280 and 0x307. I'd like to get breakpoint in this routine if it reads in the area 0xDC08-0xFFFF.

tcl seems so easy, but I always seem to struggle to do the simplest thing.

What is wrong with this, or what should it look like?

debug set_watchpoint read_mem {0xDC08 0xFFFF} {([reg pc]>0x0280) && ([reg pc]<0x0307)}
Для того, чтобы оставить комментарий, необходимо регистрация или !login

By wouter_

Champion (469)

Аватар пользователя wouter_

25-09-2021, 14:53

Bengalack wrote:

What is wrong with this ...?

I don't think there's anything wrong with it. To verify I modified your line like this:

debug set_watchpoint read_mem {0x8000 0x9000} {([reg pc] > 0x5000) && ([reg pc] < 0x6000)}

Then in BASIC I execute:

PRINT PEEK(&h8123)

And this does trigger a "debug break" on address 0x5420.

Some details:

  • When the watchpoint triggers, the PC is already increased to the next instruction. In my example above it triggers on the JP instruction on address 0x5420 instead of on the 'LD A,(HL)' instruction on address 0x541F.
  • In your example you check PC with less-than and greater-than, perhaps you meant less-than-or-equal and greater-than-or-equal?

By Bengalack

Champion (414)

Аватар пользователя Bengalack

25-09-2021, 15:10

Thanks for replying, but I'm not any wiser, I'm afraid.

in the middle of the routine I have these two lines:

	ld 		( _debug_valuei3 ), hl
	ld 		a, ( 0xE000 )

I'm using ram_watch to monitor some values, like dbgval3 here:

ram_watch add [symbol _debug_valuei3 ] -desc dbgval3 -type u16 -format hex.

I'm seeing this value being updated, but the next line does not trigger the breakpoint.

By Bengalack

Champion (414)

Аватар пользователя Bengalack

25-09-2021, 15:19

Ah, got it to work. Finally! Due to so many attempts and fails I got the end address 0x0307 mistyped, it should have been 0x0370. Sorry about the mess. I suspected the tcl... just because I totally suck at it :O

Works now. Thanks.