www.retrosoftware.co.uk
http://www.retrosoftware.co.uk/forum/

BeebEm and hardware breakpoints
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=11&t=787
Page 1 of 1

Author:  DaveF [ Wed Sep 12, 2012 10:41 pm ]
Post subject:  BeebEm and hardware breakpoints

Hello

I've got a particularly nasty bug where some memory is being written, and although I know the location, I don't know what's writing it.

Does BeebEm or similar support hardware or data breakpoints?

Author:  RichTW [ Wed Sep 12, 2012 11:28 pm ]
Post subject:  Re: BeebEm and hardware breakpoints

I find the debugger in BeebEm close to useless (can't even figure out how to dump the current register values, or disassemble from PC), and I don't see anything like a Data breakpoint there. But if you're able to build BeebEm (and it's very straightforward), then you could hack a quick check into the start of BeebWriteMem() in beebmem.cpp, and get it to log the value of ProgramCounter to stdio. That might help you get a little bit closer. Good luck!

Author:  TomW [ Thu Sep 13, 2012 8:14 am ]
Post subject:  Re: BeebEm and hardware breakpoints

B-em supports data breakpoints - breakr/breakw.

Author:  DaveF [ Thu Sep 13, 2012 9:21 am ]
Post subject:  Re: BeebEm and hardware breakpoints

Ah excellent, Tom!

I use B-Em on my work PC and BeebEm on my mac at home.

I'll give it a try at lunchtime, thanks a lot, will be really useful.


Thanks also for the tip Rich. I have a friend who's written a very basic BBC emulator, so what I was going to do prior to the B-Em tip was ask him to watch that address for me.

It's the sort of really handy thing you would want an emulator to do though!

Author:  DaveF [ Thu Sep 13, 2012 12:57 pm ]
Post subject:  Re: BeebEm and hardware breakpoints

:?

The debugger works on normal startup, and I can set data breakpoints up fine.

However, when I load my game and then select debugger from the menu, it pops up the memory window and the DOS-like window, but I don't get any text in there this time and no debugger prompt.

Is there something I'm missing? I'm using v2.2

Edit I got it working by popping up the debugger window before I ran the game. Further investigation needed but it proved very helpful, looks like something in the IRQ routine is hammering it!

Author:  DaveF [ Fri Sep 14, 2012 1:33 pm ]
Post subject:  Re: BeebEm and hardware breakpoints

Fixed it now thanks to the B-Em debugger!

What was happening was something similar to this:

Code:
.mainLoop:
  JSR updatePlayer
  JMP mainLoop

.updatePlayer:
  If (finishedGame)
    JMP congrats


Which, if you complete the game a few times (admittedly not very likely) leaves the 2 byte return address of the JSR on the stack, eventually going back round to 0x1ff (where I have code). Nasty!

Many thanks Tom saved me an awful lot of head scratching :)

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/