From: segaloco via COFF <coff@tuhs.org>
To: COFF <coff@tuhs.org>
Subject: [COFF] Pipeable MCS6500 Family Disassembler
Date: Mon, 28 Aug 2023 21:29:47 +0000 [thread overview]
Message-ID: <XW_aHORE_aA-gyqWsrW6HY-_ipVwPpFkOkDi2qUb5783m0Wb9bQ7nGlkTyIokh5mYgFM8Fa9kAkzmQwsOMGw3QLPwXhSP9Dq4qyH3TrbE7Q=@protonmail.com> (raw)
Howdy folks, just wanted to share a tool I wrote up today in case it might be useful for someone else: https://gitlab.com/segaloco/dis65
This has probably been done before, but this is a bare-bones one-pass MOS 6500 disassembler that does nothing more than convert bytes to mnemonics and parameters, so no labeling, no origins, etc. My rationale is as I work on my Dragon Quest disassembly, there are times I have to pop a couple bytes through the disassembler again because something got misaligned or some other weird issue. My disassembler through the project has been da65, which does all the labeling and origin stuff but as such, requires a lot of seeking and isn't really amenable to a pipeline, which has required me to do something like:
printf "\xAD\xDE\xEF\xBE" > temp.bin && da65 temp.bin && rm temp.bin
to get the assembly equivalent of 0xDEADBEEF.
Enter my tool, it enables stuff like:
printf "\xAD\xDE\xEF\xBE" | dis65
instead. A longer term plan is to then write a second pass that can then do all the more sophisticated stuff without having to bury the mnemonic generation down in there somewhere, plus that second pass could then be architecture-agnostic to a high degree.
Anywho, feel free to do what you want with it, it's BSD licensed. One "bug" I need to address is that all byte values are presented as unsigned, but in the case of indirects and a few other circumstances, it would make more sense for them to be signed. Probably won't jump on that ASAP, but know that's a coming improvement. While common in disassemblers, I have no intention on adding things like printing the binary bytes next to the opcodes. Also this doesn't support any of the undocumented opcodes, although it should be trivial to add them if needed. I went with lower-case since my assembler supports it, but you should have a fine time piping into tr(1) if you need all caps for an older assembler.
- Matt G.
reply other threads:[~2023-08-28 21:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='XW_aHORE_aA-gyqWsrW6HY-_ipVwPpFkOkDi2qUb5783m0Wb9bQ7nGlkTyIokh5mYgFM8Fa9kAkzmQwsOMGw3QLPwXhSP9Dq4qyH3TrbE7Q=@protonmail.com' \
--to=coff@tuhs.org \
--cc=segaloco@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).