Beebdis symbols

handy tools that can assist in the development of new software
Post Reply
iainfm
Posts: 602
Joined: Thu Jan 02, 2020 8:31 pm
Location: Dumbarton
Contact:

Beebdis symbols

Post by iainfm »

Hi,

I've found a possible bug in beebdis tonight. If I define a symbol in a file it is replaced for the standard .Lxxxx label if the address referred to is a code area. However, if I've defined the address in question as a byte or a string it doesn't get substituted.

For example, if symbols.asm contains

Code: Select all

mystring = $1E00
mybyte = $1F00
and the control file contains

Code: Select all

.
.
string $1E00 8
byte $1F00 1
.
.
symbols symbols.asm
then the disassembly will look like

Code: Select all

.L1E00 EQUS "12345678"
.
.
.L1F00 EQUB $00
instead of

Code: Select all

.mystring EQUS "12345678"
.
.
.mybyte EQUB $00
Not sure if I'm doing something wrong or if this is a bug. I notice the latest exe on github "Fixed several bugs introduced by lables in config file", but I'm not sure what those bugs were.

I can raise an issue on github if necessary :)
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Beebdis symbols

Post by MarkMoxon »

iainfm wrote: Thu Jun 03, 2021 10:36 pm Not sure if I'm doing something wrong or if this is a bug. I notice the latest exe on github "Fixed several bugs introduced by lables in config file", but I'm not sure what those bugs were.

I can raise an issue on github if necessary :)
Not sure I can add much to this, Iain, other than to say I have this exact problem when using BeebDis. I too assumed it was probably something wrong in my control file, but then I saw your post. It would be great to fix - BeebDis has been a really useful tool, but this bug is a bit annoying.

I guess submitting a bug via GitHub would at least record the issue? I might even be tempted to take a look at it myself, if it doesn't get fixed by someone else; it's been a fair while since I did any Pascal, but it'd be worth having a go!

Mark
iainfm
Posts: 602
Joined: Thu Jan 02, 2020 8:31 pm
Location: Dumbarton
Contact:

Re: Beebdis symbols

Post by iainfm »

MarkMoxon wrote: Fri Jun 04, 2021 7:06 pm Not sure I can add much to this, Iain, other than to say I have this exact problem when using BeebDis. I too assumed it was probably something wrong in my control file, but then I saw your post. It would be great to fix - BeebDis has been a really useful tool, but this bug is a bit annoying.

I guess submitting a bug via GitHub would at least record the issue? I might even be tempted to take a look at it myself, if it doesn't get fixed by someone else; it's been a fair while since I did any Pascal, but it'd be worth having a go!

Mark
Thanks Mark, I opened an issue on github earlier today. It has crossed my mind to have a look at it as well (it's been a long (25 years) time since I looked at Pascal as well). I wonder how easy it'd be to port to python, for example... One for a rainy day!

I've only used it a handful of times, but there are a few other improvements I could think of. 1) For some reason, with some control files, the BeebDisStartAddr label is absent and 2) an auto-string finder would be useful, or failing that being able to specify a string within a byte-block would be good. (At the moment doing this duplicates the string as EQUBs and an EQUS. Again, this could be down to me not knowing what I'm doing entirely :lol:
melchett
Posts: 478
Joined: Tue Jan 28, 2003 9:52 am
Contact:

Re: Beebdis symbols

Post by melchett »

It's definitely a bug - I have the same issue and just work around it, it is a pain but the rest of the benefits the tool gives are wonderful. I thought it might just be how I was using it but I tried every before/after permutation I could think of in the control file and it won't replace the label after it has found it and processed it as a data area. My Pascal is a similar age and, actually, I cut and paste into a master file once I figure out what something is doing so it doesn't get in the way too much.
Prime
Posts: 3053
Joined: Mon Jun 01, 2009 12:52 am
Contact:

Re: Beebdis symbols

Post by Prime »

Hi all,

I'm a little busy at the mo, but will try and find some time to look into this.

@iainfm: There is a stringscan function, it's documented in the doc file on the Github repo.....

Cheers.

Phill.
Prime
Posts: 3053
Joined: Mon Jun 01, 2009 12:52 am
Contact:

Re: Beebdis symbols

Post by Prime »

Hi both,

Would it be possible to provide me with a zip file containing an example of where the bug hits?
Ideally this would contain symbol file, control file and binary (to disassemble).

Cheers.

Phill.
iainfm
Posts: 602
Joined: Thu Jan 02, 2020 8:31 pm
Location: Dumbarton
Contact:

Re: Beebdis symbols

Post by iainfm »

Hi,

Thanks very much for this, and for the stringscan tip - I'll try that next time. A quick example is attached. Assembling this source:

Code: Select all

org &3000

.start
LDA #65
STA &7C00
JMP over

.string
EQUS "This is a string"

.data
EQUB $01,$02,$03,$04

.over
LDA #66
STA &7C01
RTS
.end

SAVE "orig.bin",start,end
and disassembling it with this control file:

Code: Select all

load $3000 orig.bin
entry $3000
symbols orig.symbols
string $3008 16
byte $3018 4
# hexdump
# stringscan
save disassembled.asm
cpu 6502
and this symbols file:

Code: Select all

start  = $3000
over   = $301C
string = $3008
data   = $3018
m7_ss0 = $7C00
m7_ss1 = &7C01
Yields:

Code: Select all

m7_ss0  = $7C00
m7_ss1  = $7C01

        org     $3000
.start
        LDA     #$41
        STA     m7_ss0
        JMP     over

.L3008
        EQUS    "This is a string"

.L3018
        EQUB    $01,$02,$03,$04

.over
        LDA     #$42
        STA     m7_ss1
        RTS

.BeebDisEndAddr
SAVE ".\disassembled.bin",BeebDisStartAddr,BeebDisEndAddr
Note the labels for the string and the data have not been translated from the symbols file. Also, there's no entry for BeebDisStartAddr which is a problem I have with some disassemblies but not others. Not sure what the common factor is in the ones that worked - I may have been using an older version of beebdis though.

Thanks again for your help (and the disassembler)!
Attachments
BeebDisExample.zip
(1.18 KiB) Downloaded 52 times
neilh
Posts: 19
Joined: Fri Jan 20, 2023 11:56 am
Contact:

Re: Beebdis symbols

Post by neilh »

Resurrecting an old thread I know, but I'm new here and went down a rabbit hole from the Level9 discussion into BeebDis...

Not sure whether it's still a popular disassembler but thought I'd just put a note on here that I think I've tweaked the code to fix these and a couple of other issues. The documentation mentioned the abilty to add a name to an entry point, but that didn't seem to work. It does now.
I also tweaked the symbol loading code to allow overwriting of generated labels and (hopefully) the right labels for any SAVE command.

Control File (note the label for the entry point):

Code: Select all

load $3000 orig.bin

entry $3000 start

symbols orig.symbols
string $3008 16
byte $3018 4

# hexdump
# stringscan

save disassembled.asm

cpu 6502
Symbol File (without a label for the entry address now):

Code: Select all

over   = $301C
string = $3008
data   = $3018
m7_ss0 = $7C00
m7_ss1 = &7C01
Output:

Code: Select all

m7_ss0          = $7C00
m7_ss1          = $7C01

                org     $3000
.start          LDA     #$41
                STA     m7_ss0
                JMP     over

.string         EQUS    "This is a string"

.data           EQUB    $01,$02,$03,$04

.over           LDA     #$42
                STA     m7_ss1
                RTS

.BeebDisEndAddr
SAVE "disassembled.bin",start,BeebDisEndAddr
...it seems to compile to a matching binary, so that's a plus...
stevei2791
Posts: 92
Joined: Sat Aug 29, 2015 1:21 pm
Location: Irchester
Contact:

Re: Beebdis symbols

Post by stevei2791 »

neilh wrote: Tue Jan 24, 2023 11:06 pm
Not sure whether it's still a popular disassembler but thought I'd just put a note on here that I think I've tweaked the code to fix these and a couple of other issues. The documentation mentioned the abilty to add a name to an entry point, but that didn't seem to work. It does now.
I also tweaked the symbol loading code to allow overwriting of generated labels and (hopefully) the right labels for any SAVE command.
Would it be possible to share the changes for these, I am now hitting the same bugs but my pascal is too rusty to really follow what I need to do to get this to work.
Post Reply

Return to “development tools”