ROM image disassembly (not on a Beeb).

discussion of beeb/electron applications, languages, utils and educational s/w
Post Reply
stephen_usher
Posts: 76
Joined: Sun Apr 10, 2016 1:47 pm
Contact:

ROM image disassembly (not on a Beeb).

Post by stephen_usher » Fri May 10, 2019 6:24 pm

I've a BBC ROM containing software I'd like to archive (the University College London terminal emulator). I know it's got a little corruption as the machine just hangs when you type *TERM but I'd like to try to discover the damage, hopefully fix it and then create a new image.

I've now got an EEPROM programmer which should be able to read the contents onto a Windows machine so what I need to do is find some software which will take the ROM image, decode it and try to disassemble the program, preferably generating labels. This may at least show me where the damage might be and maybe, possibly even allow me to detemine what the data should be.

So, basically the question is, does anyone know of any software on Windows, Linux or MacOS which can read a BBC ROM image, interpret it and disassemble the code?

User avatar
0xC0DE
Posts: 384
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by 0xC0DE » Fri May 10, 2019 7:13 pm

I use BeebDis https://github.com/prime6809/BeebDis. An emulator with a debugger built in might help also.

Some people here have used Ghidra https://ghidra-sre.org/. I have no experience with that yet.

Other useful support tools: a Hex editor like HxD https://mh-nexus.de/en/hxd/.
Old but still useful: dis6502 https://www.atarimax.com/dis6502/

Perhaps a little warning in advance: disassembly takes a lot of effort even with excellent tools like this.
Good luck! :D
0xC0DE
:idea: Follow me on Twitter :idea: Visit my YouTube channel featuring my demos for Acorn Electron and BBC Micro

User avatar
BigEd
Posts: 2691
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by BigEd » Fri May 10, 2019 7:16 pm

Might be worth trying WFDis:
https://www.white-flame.com/wfdis/

User avatar
tautology
Posts: 389
Joined: Wed Sep 01, 2010 2:26 pm
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by tautology » Fri May 10, 2019 7:42 pm

Ghidra's good (used it in anger a couple of times) with one main problem: it tries to guess the value of X or Y when used in indexed or indirect mode an places the label there.

This makes some loops get the label in the wrong place.

User avatar
jgharston
Posts: 3755
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by jgharston » Fri May 10, 2019 7:50 pm

stephen_usher wrote:
Fri May 10, 2019 6:24 pm
So, basically the question is, does anyone know of any software on Windows, Linux or MacOS which can read a BBC ROM image, interpret it and disassemble the code?
If you have BBC BASIC for (insert platform here), then my Disassembly suite, which include MkSrc* programs that scan for and generate labels.
http://mdfs.net/Software/Assembler/

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

stephen_usher
Posts: 76
Joined: Sun Apr 10, 2016 1:47 pm
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by stephen_usher » Fri May 10, 2019 8:13 pm

0xC0DE wrote:
Fri May 10, 2019 7:13 pm
I use BeebDis https://github.com/prime6809/BeebDis. An emulator with a debugger built in might help also.
The documentation for BeebDis is awful isn't it? It's seemingly written from the point of view of someone who already has in depth knowledge of how the thing works. It mentions being able to create a file containing definitions of things such as OSBYTE but then fails to tell you how or what it should be called.

Reading the source doesn't help as it's in Pascal with almost zero comments.

If it had that information in the documentation it seems that it would be an excellent utility.
Last edited by stephen_usher on Fri May 10, 2019 8:14 pm, edited 1 time in total.

User avatar
hoglet
Posts: 8685
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by hoglet » Fri May 10, 2019 8:31 pm

stephen_usher wrote:
Fri May 10, 2019 8:13 pm
0xC0DE wrote:
Fri May 10, 2019 7:13 pm
I use BeebDis https://github.com/prime6809/BeebDis. An emulator with a debugger built in might help also.
It mentions being able to create a file containing definitions of things such as OSBYTE but then fails to tell you how or what it should be called.
There's a example here - look at the .sym file.
https://github.com/hoglet67/BBCBasic4r3 ... isassembly

stephen_usher
Posts: 76
Joined: Sun Apr 10, 2016 1:47 pm
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by stephen_usher » Fri May 10, 2019 9:35 pm

hoglet wrote:
Fri May 10, 2019 8:31 pm
stephen_usher wrote:
Fri May 10, 2019 8:13 pm
0xC0DE wrote:
Fri May 10, 2019 7:13 pm
I use BeebDis https://github.com/prime6809/BeebDis. An emulator with a debugger built in might help also.
It mentions being able to create a file containing definitions of things such as OSBYTE but then fails to tell you how or what it should be called.
There's a example here - look at the .sym file.
https://github.com/hoglet67/BBCBasic4r3 ... isassembly
Excellent. Thank-you.

User avatar
Elminster
Posts: 3978
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by Elminster » Fri May 10, 2019 10:22 pm

stephen_usher wrote:
Fri May 10, 2019 8:13 pm
0xC0DE wrote:
Fri May 10, 2019 7:13 pm
I use BeebDis https://github.com/prime6809/BeebDis. An emulator with a debugger built in might help also.
The documentation for BeebDis is awful isn't it? It's seemingly written from the point of view of someone who already has in depth knowledge of how the thing works.
Prime is the author of beebdis and is on this board so you could always ask him so do a beginners guide, or some extra help.
Last edited by Elminster on Fri May 10, 2019 10:22 pm, edited 1 time in total.

Prime
Posts: 2798
Joined: Sun May 31, 2009 11:52 pm
Contact:

Re: ROM image disassembly (not on a Beeb).

Post by Prime » Sat May 11, 2019 4:25 pm

stephen_usher wrote:
Fri May 10, 2019 8:13 pm
0xC0DE wrote:
Fri May 10, 2019 7:13 pm
I use BeebDis https://github.com/prime6809/BeebDis. An emulator with a debugger built in might help also.
The documentation for BeebDis is awful isn't it? It's seemingly written from the point of view of someone who already has in depth knowledge of how the thing works.
That's exactly how it's written, BeebDis started out as a tool for me and I wrote the docs as I went along mostly as a mnemonic for me. This is the reason I had someone else write the documentation for the DragonMMC board, I wanted it to explain things from the point of view of someone not involved with the creation of the code / device. Alas I can't do that for every project.....
It mentions being able to create a file containing definitions of things such as OSBYTE but then fails to tell you how or what it should be called.
Depending on how old the documentation you have is, it is there, use the SYMBOLS keyword followed by the symbols filename in the control file.
Reading the source doesn't help as it's in Pascal with almost zero comments.
Which is miles better than some of the uncommented 'C' I've seen over the years, I try to make the code easy enough to follow e.g. meaningful variable names, good code layout, and spacing (the one everyone always forgets). But I guess that doesn't help much if you are not familliar with Pascal :)
If it had that information in the documentation it seems that it would be an excellent utility.
Glad you think so, thanks :)

Anyway the critisizims of the documentation are in places valid, I have just pushed an updated version that should help clear things up a little, e.g. describing the format of the control file. Perhaps I should include a couple of example disassembilies to illustrate the use. Also if anyone wants to have a crack at updating / making the docs more 'user friendly' feel free, I'm willing to accept updates as writing docs is deffo not my forte :) :) :)

Cheers.

Phill.

Post Reply