It is currently Sun Nov 19, 2017 5:33 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Oct 11, 2015 1:18 pm 
Offline

Joined: Thu Jul 23, 2015 7:54 pm
Posts: 147
Location: USA
I'm sure this has been done before, but I wanted to share it anyway.

This a simple little project I've been working on that will eventually allow for any 4 kilobyte file to be interpreted as raw 6502 assembly code and disassembled accordingly.

However, all it can do right now is disassemble 28 bytes (Enough for a whole screen of implied instructions), so it isn't too useful yet. I want to add scrolling so that the entire 4Kb can be read. I'll also try to make the ROM size smaller, as it's gigantic right now. This may even allow for the disassembly of 8 Kb.

There are some limitations. It has no way of knowing what's code and what's data. The best thing I can think to do right now is, whenever it comes across something that isn't an opcode, it'll just display its byte. Of course this still has the potential for nonsense code to be displayed, but it's better than nothing.

To have something be disassembled, open it up in a hex editor, copy the bytes you want to be disassembled, and paste them at location $0010 (PRG location $8000) in the program's ROM file. (Be sure not to have it inserted, but rather be pasted over.) I'll make a program that'll do this automatically soon. Whatever is at $8000 should get disassembled on your TV or computer screen.

Attachment:
NES Disassembler-0.png
NES Disassembler-0.png [ 2.4 KiB | Viewed 1376 times ]

Attachment:
NES Disassembler-1.png
NES Disassembler-1.png [ 2.41 KiB | Viewed 1376 times ]


Attachment:
NES Disassembler v.01.nes [40.02 KiB]
Downloaded 85 times


Maybe this can be used for something


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 6:05 pm 
Online
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3483
Location: Indianapolis
I find this type of program interesting, I'd really like to have something like this with the bootloader utilities for GTROM. I don't think anyone has written a disassembler that run on NES before.

The only similar program I can think of is Microbug by kevtris (at the bottom of this page): http://kevtris.org/Projects/copynes/copyware.html
It actually emulates the 6502 in the 6502 asm, which I thought was really cool. But the actual disassembly view that you see in those screenshots is done on the PC host side of the software. I'm glad I was reminded of this, because I had been meaning to ask kevtris if he can release the source to that, I know he originally intended to but overlooked it. So I did, and maybe we'll see it sometime soon.

It would be really neat to have Microbug combined with a disassembler such as yours. CopyNES had it kind of rough because it only had part of the stack available, so it works for almost any cartridge. A new program though could just reserve parts of RAM for debugger use, and do this natively on the NES.


Top
 Profile  
 
PostPosted: Fri Oct 16, 2015 7:28 pm 
Online
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3483
Location: Indianapolis
kevtris uploaded it, here is the source code to the CopyNES ROM, which includes the 6502 and PPU emulator I mentioned.
http://blog.kevtris.org/blogfiles/NESCOPYN.ASM

I might not start on it for a couple weeks, but I'm wanting to change this to assemble with CA65 and try some stuff with it. I just think it'd be hilarious to run NES code in a virtual machine on the NES.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group