customasm: Assembler for custom instruction sets

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
customasm: Assembler for custom instruction sets
by on (#180793)
I made a tool to assemble binaries from custom instruction set definitions! So you just write out some mnemonics and their binary representations, and it assembles based on that. There's quite a bit of functionality already, like using arbitrary expressions, but it's missing a lot too. It's something that I've been wanting for some time. It might be an alternative for NES assembly (though there's currently no direct support for banks, you can emulate that), but it may be really useful for lots of other projects. Tell me what you guys think!

https://github.com/hlorenzi/customasm
Re: customasm: Assembler for custom instruction sets
by on (#180801)
I really like the idea of an assembler supporting custom instruction sets! If you code for multiple systems, it really helps to be able to maintain the same workflow you're used to regardless of the platform. I guess you could even reuse the same macros and stuff, since there's a lot in common about how code and data are structured across different systems. The assembler needs to have a nice feature set for people to want to use it like that, though.
Re: customasm: Assembler for custom instruction sets
by on (#180807)
TASM could do stuff like that, you could provide .TAB files for custom instruction sets. For example, you could change the Z80 definition into a Game Boy.
Re: customasm: Assembler for custom instruction sets
by on (#180812)
Another approach is to define ca65 macros that recognize another ISA's assembly language and emit its opcodes. This has been used to make ca65 do SPC700, and someone who cared enough could probably do Z80, LR35902 (aka GBZ80), and MC68000 that way too. Why? To make a game that fully uses the Super Game Boy, you need 65816, SPC700, and LR35902, and having them in one assembler is convenient.
Re: customasm: Assembler for custom instruction sets
by on (#180815)
tepples wrote:
LR35902 (aka GBZ80)

Didn't blargg do this already?