News: 11 March 2016 - Forum Rules

Author Topic: x6502 Ricoh 2A03 Disassembler  (Read 2148 times)

MeganGrass

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • GitHub
x6502 Ricoh 2A03 Disassembler
« on: September 04, 2015, 04:15:34 pm »
x6502 is a simple commandline utility used to disassemble PRG ROM data from a NES video game.

I developed this application in order to help myself understand how 6502 processing works for the NES so that I may move on from PSone hacking. I'm not sure what the point is, but I've already laid the groundwork for 6502->R3000A conversion, as well. Furthermore, I may add a GUI in the future if I get bored enough.

Disassembled output can be used in a variety of assemblers, though it was particularly developed with Disch's "Schasm" assembler in-mind.

I'm fairly new to 6502 hacking, so don't hesitate to point out any errors.

Download

EDIT: (Sept 05, 2015)

Version 1.1 is now available with two new optional commands.

The first optional command, label, will implement labels for each JMP, branch type and sub-routine. With this option, these address pointers are no longer hardcoded.

The second optional command, comment, will automatically add two semi-colons on each line for future commenting.

EDIT: (Sept 06, 2015)

Version 1.2 is now available with three new optional commands and a few minor bug fixes.

DATA will disassemble to #byte.

APPEND will open an existing file and append disassembly to the end of the file. Useful for Text+Data disassembly output.

ADDRESS adds commented file addresses and counters to each line.

Example output from Mega Man 3
Code: [Select]
#org $C4F8, $0003C508 ;;
LDX #$00 ;; C4F8 0003C508 ;;
STX $0019 ;; C4FA 0003C50A ;;
BRANCHC4FC: LDA $0780,X ;; C4FC 0003C50C ;;
BMI BRANCHC51C ;; C4FF 0003C50F ;;
STA $2006 ;; C501 0003C511 ;;
LDA $0781,X ;; C504 0003C514 ;;
STA $2006 ;; C507 0003C517 ;;
LDY $0782,X ;; C50A 0003C51A ;;
BRANCHC50D: LDA $0783,X ;; C50D 0003C51D ;;
STA $2007 ;; C510 0003C520 ;;
INX ;; C513 0003C523 ;;
DEY ;; C514 0003C524 ;;
BPL BRANCHC50D ;; C515 0003C525 ;;
INX ;; C517 0003C527 ;;
INX ;; C518 0003C528 ;;
INX ;; C519 0003C529 ;;
BNE BRANCHC4FC ;; C51A 0003C52A ;;
BRANCHC51C: RTS ;; C51C 0003C52C ;;

#org $C6D8, $0003C6E8, $74 ;;
#byte $58 ;; C6D8 0003C6E8 ;;
#byte $F1 ;; C6D9 0003C6E9 ;;
#byte $02 ;; C6DA 0003C6EA ;;
#byte $28 ;; C6DB 0003C6EB ;;
#byte $E0 ;; C6DC 0003C6EC ;;
#byte $F1 ;; C6DD 0003C6ED ;;
#byte $02 ;; C6DE 0003C6EE ;;
#byte $28 ;; C6DF 0003C6EF ;;
#byte $B8 ;; C6E0 0003C6F0 ;;
#byte $F1 ;; C6E1 0003C6F1 ;;
#byte $02 ;; C6E2 0003C6F2 ;;
#byte $70 ;; C6E3 0003C6F3 ;;
#byte $20 ;; C6E4 0003C6F4 ;;
#byte $F1 ;; C6E5 0003C6F5 ;;
#byte $02 ;; C6E6 0003C6F6 ;;
#byte $A0 ;; C6E7 0003C6F7 ;;
#byte $68 ;; C6E8 0003C6F8 ;;
#byte $F1 ;; C6E9 0003C6F9 ;;
#byte $02 ;; C6EA 0003C6FA ;;
#byte $D0 ;; C6EB 0003C6FB ;;
#byte $D8 ;; C6EC 0003C6FC ;;
#byte $F1 ;; C6ED 0003C6FD ;;
#byte $02 ;; C6EE 0003C6FE ;;
#byte $D0 ;; C6EF 0003C6FF ;;
#byte $90 ;; C6F0 0003C700 ;;
#byte $F2 ;; C6F1 0003C701 ;;
#byte $02 ;; C6F2 0003C702 ;;
#byte $10 ;; C6F3 0003C703 ;;
#byte $40 ;; C6F4 0003C704 ;;
#byte $F2 ;; C6F5 0003C705 ;;
#byte $02 ;; C6F6 0003C706 ;;
#byte $58 ;; C6F7 0003C707 ;;
#byte $D0 ;; C6F8 0003C708 ;;
#byte $F2 ;; C6F9 0003C709 ;;
#byte $02 ;; C6FA 0003C70A ;;
#byte $58 ;; C6FB 0003C70B ;;
#byte $78 ;; C6FC 0003C70C ;;
#byte $F2 ;; C6FD 0003C70D ;;
#byte $02 ;; C6FE 0003C70E ;;
#byte $80 ;; C6FF 0003C70F ;;
#byte $28 ;; C700 0003C710 ;;
#byte $F2 ;; C701 0003C711 ;;
#byte $02 ;; C702 0003C712 ;;
#byte $D8 ;; C703 0003C713 ;;
#byte $A8 ;; C704 0003C714 ;;
#byte $F2 ;; C705 0003C715 ;;
#byte $02 ;; C706 0003C716 ;;
#byte $D8 ;; C707 0003C717 ;;
#byte $90 ;; C708 0003C718 ;;
#byte $E4 ;; C709 0003C719 ;;
#byte $03 ;; C70A 0003C71A ;;
#byte $18 ;; C70B 0003C71B ;;
#byte $28 ;; C70C 0003C71C ;;
#byte $E4 ;; C70D 0003C71D ;;
#byte $03 ;; C70E 0003C71E ;;
#byte $20 ;; C70F 0003C71F ;;
#byte $68 ;; C710 0003C720 ;;
#byte $E4 ;; C711 0003C721 ;;
#byte $03 ;; C712 0003C722 ;;
#byte $30 ;; C713 0003C723 ;;
#byte $58 ;; C714 0003C724 ;;
#byte $E4 ;; C715 0003C725 ;;
#byte $03 ;; C716 0003C726 ;;
#byte $60 ;; C717 0003C727 ;;
#byte $80 ;; C718 0003C728 ;;
#byte $E4 ;; C719 0003C729 ;;
#byte $03 ;; C71A 0003C72A ;;
#byte $70 ;; C71B 0003C72B ;;
#byte $10 ;; C71C 0003C72C ;;
#byte $E4 ;; C71D 0003C72D ;;
#byte $03 ;; C71E 0003C72E ;;
#byte $98 ;; C71F 0003C72F ;;
#byte $58 ;; C720 0003C730 ;;
#byte $E4 ;; C721 0003C731 ;;
#byte $03 ;; C722 0003C732 ;;
#byte $C0 ;; C723 0003C733 ;;
#byte $80 ;; C724 0003C734 ;;
#byte $E4 ;; C725 0003C735 ;;
#byte $03 ;; C726 0003C736 ;;
#byte $D0 ;; C727 0003C737 ;;
#byte $18 ;; C728 0003C738 ;;
#byte $E4 ;; C729 0003C739 ;;
#byte $03 ;; C72A 0003C73A ;;
#byte $10 ;; C72B 0003C73B ;;
#byte $A0 ;; C72C 0003C73C ;;
#byte $E4 ;; C72D 0003C73D ;;
#byte $03 ;; C72E 0003C73E ;;
#byte $48 ;; C72F 0003C73F ;;
#byte $28 ;; C730 0003C740 ;;
#byte $E4 ;; C731 0003C741 ;;
#byte $03 ;; C732 0003C742 ;;
#byte $58 ;; C733 0003C743 ;;
#byte $40 ;; C734 0003C744 ;;
#byte $E4 ;; C735 0003C745 ;;
#byte $03 ;; C736 0003C746 ;;
#byte $90 ;; C737 0003C747 ;;
#byte $98 ;; C738 0003C748 ;;
#byte $E4 ;; C739 0003C749 ;;
#byte $03 ;; C73A 0003C74A ;;
#byte $A0 ;; C73B 0003C74B ;;
#byte $78 ;; C73C 0003C74C ;;
#byte $E4 ;; C73D 0003C74D ;;
#byte $03 ;; C73E 0003C74E ;;
#byte $D8 ;; C73F 0003C74F ;;
#byte $30 ;; C740 0003C750 ;;
#byte $E4 ;; C741 0003C751 ;;
#byte $03 ;; C742 0003C752 ;;
#byte $E0 ;; C743 0003C753 ;;
#byte $A0 ;; C744 0003C754 ;;
#byte $E4 ;; C745 0003C755 ;;
#byte $03 ;; C746 0003C756 ;;
#byte $E8 ;; C747 0003C757 ;;
#byte $00 ;; C748 0003C758 ;;
#byte $00 ;; C749 0003C759 ;;
#byte $00 ;; C74A 0003C75A ;;
#byte $00 ;; C74B 0003C75B ;; 
« Last Edit: September 06, 2015, 03:26:48 pm by MarkGrass »