stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
112 stars 57 forks source link

Allow dumping less than a page of memory in the debugger #160

Open ZornsLemma opened 2 years ago

ZornsLemma commented 2 years ago

I don't know if I'm missing something, but the 'm' command seems to be the only way to dump memory on the emulated machine, and it always shows 256 bytes. That makes my debugging session more verbose than necessary a lot of the time, making it harder to keep track of what's going on. It would be nice if there was a command to dump just 16 bytes (one terminal line's worth) of memory as well.

If you think this is sensible I'm happy to have a go at implementing it myself, but obviously if you'd prefer to do it yourself that's fine by me! If you'd like me to try it, I'd appreciate a suggested command name for this - "mb" (b for brief) perhaps? Not terribly happy with that, just a starting point.

SteveFosdick commented 2 years ago

I have implemented this: https://github.com/stardot/b-em/commit/b7544d802833fa8d31554c57d576ed9a6501f512

It does auto-repeat (if you just press return) as the full page version though as, at the moment, the command repeat feature is only for single letter commands.

ZornsLemma commented 2 years ago

Thanks for doing that! I've just built it and it works well. I wouldn't have noticed the auto-repeat behaviour if you hadn't mentioned it; I do find this slightly odd, but I don't think it's a big deal.

ZornsLemma commented 2 years ago

PS Semi-related thought: I do find myself counting across the 16 columns of the memory output with my finger at times. How would you feel about a "ruler" command which just prints something like:

       00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

in order to allow easier identification of a particular column? Maybe - the fancy version - with an optional argument to start counting at something other than 0, so to get a ruler matching the output of 'm 1234' you'd do 'ruler 4'.

Obviously it would be possible to include this automatically in the output of 'm' but it would add to the verbosity, and for 'mb' it would double the length of the output, hence my suggesting this as an extra command so you can get a ruler somewhere on the screen to compare if you want one.

SteveFosdick commented 2 years ago

Ok I have added that. There are two optional args, the start as you described and the number of bytes. Start defaults to zero and number of bytes defaults to 16.

https://github.com/stardot/b-em/commit/d8355f946206682c8fbcabf851d2d6266edd5aab

ZornsLemma commented 2 years ago

Thanks for implementing that! I've given it a quick try and I think it would work better with some extra spaces at the start of the ruler. Here's a brief extract from a debugger session:

>mb 70
0070 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
>ruler
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F >

The ruler doesn't line up with the data bytes; it would be nicer if there was a 7 space indent.

I was a bit surprised the > prompt appears on the same line as the ruler instead of starting a new line, but that might be a good thing - I'm not entirely sure right now.

SteveFosdick commented 2 years ago

Ok, fixed in https://github.com/stardot/b-em/commit/4999ee3425279310034b6a1f6281e5002a41bab2

ZornsLemma commented 2 years ago

That's brilliant, thanks!