Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II » 6502bench SourceGen disassembler updated
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: 6502bench SourceGen disassembler updated [message #387702 is a reply to message #387701] Tue, 08 October 2019 17:01 Go to previous messageGo to previous message
Anonymous
Karma:
Originally posted by: fadden

6502bench SourceGen v1.4-dev1 is now available. Key features:

- Platform and project symbols now have explicit widths.
- Extension script formatting capabilities have been expanded.
- ProDOS 8 symbol file and script have been enhanced.

Platform and project symbols are used to define labels for addresses outside the project file, like zero-page locations, jump vectors, and ROM entry points. Being able to identify pointers, vectors, and multi-byte tables makes the auto-disassembly more accurate when something references PTR+1 or BUFFER+23.

After adding widths to the symbol definitions, I was able to remove the formatting from about 110 locations in the Applesoft disassembly, mostly for access to floating-point storage locations like FAC (6 bytes). This also allowed me to fully describe the ProDOS 8 MLI globals page, so those definitions have been added to the symbol file that ships with SourceGen.

This may require updates to existing projects with project symbols, as the external symbols were effectively being treated as 3 bytes wide in v1.3. So some things that used to pick up "PTR+1" won't anymore until you define PTR as 2 bytes.


The set of inline data format options available to extension scripts has been expanded to include strings. Also, scripts can now get at project and user symbols (i.e. labels on things inside the file), and can query the data structure that defines the mapping of offsets to addresses. The benefits of these changes can be demonstrated with an example.

Consider Glen Bredon's "Cat Doctor" utility. Given this P8 Open call:

2154: 20 00 bf jsr P8_MLI
2157: c8 .dd1 P8_OPEN
2158: bf 21 .dd2 L21BF

You could double-click on the .dd2 to jump to the data area, which looks like this:

21bf: 03 L21BF .dd1 $03
21c0: cf .dd1 $cf
21c1: 21 .dd1 $21
21c2: 00 .dd1 $00
21c3: b0 .dd1 $b0
21c4: 00 L21C4 .dd1 $00

The updated ProDOS 8 script converts $21bf to a file offset, and formats the data at that location automatically. It now looks like this:

21bf: 03 L21BF .dd1 3
21c0: cf 21 .dd2 L21CF
21c2: 00 b0 .dd2 $b000
21c4: 00 L21C4 .dd1 0

Of particular note is the second line, which is now correctly recognized as a pointer to a pathname buffer, and has a label generated automatically.

This is handy, but the real trick when poking around in Cat Doctor is the inline string function. Calls to a certain address are followed by string data, using the same sort of mechanism the ProDOS MLI does to skip past the function code and param block pointer.

With the new formatting capabilities, if you see a JSR to the string-print code, you can format the block of data that follows the JSR as an inline null-terminated string, and the disassembler will step over it. Hard-coding locations into the extension script is annoying, so we use the label lookup feature to avoid doing so.

Given this:

0872: 20 8c 22 jsr $228c
0875: 21 c3 and ($c3,x)
0877: c1 d4 cmp ($d4,x)
0879: a0 c4 ldy #$c4
087b: cf c3 d4 cf+ .str “OCTOR 6.8”,$8d
0885: 19 .dd1 $19
0886: c3 ef f0 f9+ .str “Copyright 1990 by Glen Bredon”,$8d,$8d
08a6: 00 .dd1 $00
08a7: 84 .dd1 $84
08a8: da .dd1 $da

If you add an appropriate script (such as SourceGen/Examples/Scripts/InlineNullTerm.cs), and set the label at $228c to "PrintInlineZString", SourceGen will disassemble this to:

0872: 20 8c 22 jsr PrintInlineZString
0875: 21 c3 c1 d4+ .zstr $21,“CAT DOCTOR 6.8”,$8d,$19,“Copyright 1990 by Glen Bredon”
+ $8d,$8d
08a7: 84 da sty $da

(You may have to hit F5 to refresh after editing the label. This is due to SourceGen trying to be efficient and only do a partial re-analysis after a label change. I'm still trying to figure out a good way to handle this.)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Asimov FTP anonymous login
Next Topic: new apple2 demos/game
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Mar 28 19:23:45 EDT 2024

Total time taken to generate the page: 0.02165 seconds