WFDis - 6502/65C02 interactive disassembler

Programming the 6502 microprocessor and its relatives in assembly and other languages.
kgreene
Posts: 7
Joined: 19 Nov 2005
Contact:

Re: WFDis - 6502/65C02 interactive disassembler

Post by kgreene »

I noticed the comments don't appear to show up when copying everything out. Well, the first comment does but none of the others.
White Flame
Posts: 704
Joined: 24 Jul 2012

Re: WFDis - 6502/65C02 interactive disassembler

Post by White Flame »

Unfortunately, I can't replicate that, either in Chromium or Firefox. I tried the multiple comments with blank lines and around the various display types as well, and it all copies.

Is there anything notably funky going on with how/where the comments are, or would you want to PM me the .wfdis file of the workspace you can't copy out?
User avatar
Ben Boldt
Posts: 1
Joined: 25 Jan 2021

Re: WFDis - 6502/65C02 interactive disassembler

Post by Ben Boldt »

Hello, I think I may have found a small bug. I was disassembling this code, which is "65C02 with bit operations":

Address: $E4DD
6F 15 12 20 8A E7 20 F9 E6 20 AB E7 20 61 E7 20 F6 E0 20 06 E5 0F 11 0A F7 12 A5 12 8D 12 41 20 78 E6 6C 06 01

I get a BBS7 opcode where there should be an SMB7.
bbs7 should be smb7.png
bbs7 should be smb7.png (9.96 KiB) Viewed 5793 times

Code: Select all

$E4DD | 6F 15 12 | bbs6 $15,$E4F2
$E4E0 | 20 8A E7 | jsr $E78A
$E4E3 | 20 F9 E6 | jsr $E6F9
$E4E6 | 20 AB E7 | jsr $E7AB
$E4E9 | 20 61 E7 | jsr $E761
$E4EC | 20 F6 E0 | jsr $E0F6
$E4EF | 20 06 E5 | jsr $E506
$E4F2 | 0F 11 0A | bbs0 $11,$E4FF
$E4F5 | F7 12    | smb7 $12     ; <-- this one disassembled wrong
$E4F7 | A5 12    | lda $12
$E4F9 | 8D 12 41 | sta $4112
$E4FC | 20 78 E6 | jsr $E678
$E4FF | 6C 06 01 | jmp ($0106)
Also, when I load a saved file that using "65C02 with bit operations", it seems to always revert to normal 6502. I just wanted to let you know these things I found; I have worked around them no problem. Thanks for the cool disassembler.
User avatar
MichaelM
Posts: 761
Joined: 23 Apr 2012
Location: Huntsville, AL

Re: WFDis - 6502/65C02 interactive disassembler

Post by MichaelM »

Ben:

Also, should the BBS instructions not be BBR instructions?

In my instruction tables, the msb of the Rockwell instructions indicates the polarity of the test or the set operation. I checked my tables against those in the Rockwell R65F1x processor family data sheet.
Michael A.
Chromatix
Posts: 1462
Joined: 21 May 2018

Re: WFDis - 6502/65C02 interactive disassembler

Post by Chromatix »

Referring to Eyes/Lichty:

0F to 7F is BBR0 to BBR7.
8F to FF is BBS0 to BBS7.
07 to 77 is RMB0 to RMB7.
87 to F7 is SMB0 to SMB7.
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: WFDis - 6502/65C02 interactive disassembler

Post by Dr Jefyll »

I have a Rockwell 'C02 datasheet that agrees with Eyes/Lichty as cited by Chromatix.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
White Flame
Posts: 704
Joined: 24 Jul 2012

Re: WFDis - 6502/65C02 interactive disassembler

Post by White Flame »

Ben Boldt wrote:
Hello, I think I may have found a small bug. I was disassembling this code, which is "65C02 with bit operations":
Oof, I had fixed the display of the bit operations above, but hadn't uploaded it because of other work also being done back then. They all ended up with a BBS name before. It's fixed in this new version.

HuC6280 CPU support added now, which is the 6502 derivative from the PC Engine/TurboGrafx-16. Besides a number of new instructions, it also maps zeropage to $20xx and stack to $21xx, necessitating some more flexibility in the CPU definitions.
jumpjack
Posts: 2
Joined: 28 Sep 2024

Re: WFDis - 6502/65C02 interactive disassembler

Post by jumpjack »

I think there is an issue with "T" command for displaying PETSCII text: this code:


10 0c 01 19 05 12 13 3a 20 31 20 20 20 13 14 01
12 14 20 01 14 20 13 05 03 14 0f 12 3a 20 30 31
20 20 01 14 14 01 03 0b 20 0f 06 20 14 08 05 20
0d 15 14 01 0e 14 20 03 01 0d 05 0c 13 20 20 20
20 03 0f 0c 0c 09 13 09 0f 0e 13 20 17 09 14 08
20 03 01 0d 05 0c 13 3a 20 20 20 0e 0f 20 20 20
20 06 12 0f 0d 20 14 08 05 20 03 12 05 01 14 0f
12 20 0f 06 20 07 12 09 04 12 15 0e 0e 05 12 20
20 20 10 12 05 13 13 20 06 09 12 05 20 14 0f 20
13 14 01 12 14 20 14 08 05 20 07 01 0d 05 20 20
20 20 20 20 20 20 20 20

...results as text if copied directly to screen memory:

PLAYER: 1 START AT SECTOR [...]


but WFDIs shows instead:

▕▕{10}{0c}{01}{19}{05}{Rvs On}{Home}: 1 {Home}{Del}{01}{ [....]

Additionally, mouse selection works improperly on Chrome: it's ok if I click on start and end point of selection, but if I drag mouse from start to end, only first byte is interpreted as "selected".
White Flame
Posts: 704
Joined: 24 Jul 2012

Re: WFDis - 6502/65C02 interactive disassembler

Post by White Flame »

Unfortunately those are currently known things.

There are tons of text encodings and decorations (eg, 0x80 | char = end of string), which a big ol' mess of options to try to figure out how to express to the system. Having picked one implementation with PETSCII (eg, "A" = 65), that's different from screen memory/font codes ("A" = 1) which your example uses. I have a new input system that isn't just all one big set of shortcuts that I'm working on, which will allow more flexible variety of configuring things.

Drag selection was intentionally disabled some years ago because of weird browser issues, but it's probably worth revisiting it.

Progress has obviously been impeded by a lot of IRL, as well as bigger backend goals for this, but this does return attention to it. Thanks for bringing them up!
jumpjack
Posts: 2
Joined: 28 Sep 2024

Re: WFDis - 6502/65C02 interactive disassembler

Post by jumpjack »

Thanks for having a look at it.

I have another question: how does "run selected code" work? If I apply it to this code:

Code: Select all

Sys2087             ldx #$00
L0829               lda L0838,x
                    sta $0100,x
                    inx
                    bne L0829
                    ldx #$ff
                    txs
                    jmp $0100
The result panel appears, but it is titled "Emulated effects from $0838-$0838" and it does not contain anything,as it starts from $0801, while this routine relocates code to $0100. Can I specify where disassembly should start from? (I am trying to disassemble this)

I tried a dozen different disassemblers, I can't find a single one allowing copying/pasting chunks of data to other locations. :-(


A side note: the help panel is so large (and unscrollable) that it does not fit in my screen, I add to zoom out to 50% to see whole text!
White Flame
Posts: 704
Joined: 24 Jul 2012

Re: WFDis - 6502/65C02 interactive disassembler

Post by White Flame »

Hmm, I'm not getting email notifications for this thread anymore. I'll have to check into that. Sorry for the delay.
jumpjack wrote:
I have another question: how does "run selected code" work? If I apply it to this code:

The result panel appears, but it is titled "Emulated effects from $0838-$0838" and it does not contain anything,as it starts from $0801, while this routine relocates code to $0100. Can I specify where disassembly should start from? (I am trying to disassemble this)
It's trying to execute the effects from 0838-0838, which is only 1 byte you've selected, which is the non-disassembled byte after your initial code. (That probably should trigger an error.) Selections are made by shift-cursor keys, as mouse drag to select wasn't consistent and is disabled for now.

If you select from `ldx #$00` to `bne L0829` (using shift-cursor keys), then it works. You basically just want the copy loop itself emulated, not any other execution, such as the `jmp $0100`.

Example: https://i.imgur.com/GHAC3Bo.mp4
Shift-R to run the selected code, Shift-A after selecting the byte at $0100 after emulation.
Quote:
A side note: the help panel is so large (and unscrollable) that it does not fit in my screen, I add to zoom out to 50% to see whole text!
You can just click anywhere within that panel to toggle its visibility. Same with the 'Saves' panel.
Post Reply