Top
Best
New

Posted by benbridle 4/15/2025

Show HN: Torque – A lightweight meta-assembler for any processor(benbridle.com)
Hello everyone, I've been working on this project for the past few months.

Torque is a meta-assembler: instead of having an instruction set built into the assembler, you use macros to build up a small language that decribes an instruction set and then you use that to write your program. It's designed to work for any microcontroller/processor architecture, you build from the bit level upwards so there aren't any assumptions around word widths, instruction formats, or endianness.

I created Torque initially to write programs for a PIC microcontroller, after running into difficulties with the official assembler. I've also used it to write programs for the Z80 processor inside an old TRS-80 computer.

Let me know if you try it out or have any questions!

79 points | 31 commentspage 2
roetlich 4/16/2025|
This looks very cool, maybe I'll try this for risc-v if I have some time. I guess you could also use this to write RAW images, or other binary data.
eterps 4/16/2025||
Nice!

Would be interesting to target the RISC CPU of https://www.projectoberon.net with it.

kunley 4/16/2025||
Need to address this point:

"Assemblers tend to be poorly documented"

I wish everything in programming was as good documented as assemblers and ISAs.

benbridle 4/16/2025|
I should clarify, I was thinking of microcontroller toolchains when I wrote this. The documentation I've seen for Intel processors is solid.
kunley 4/16/2025||
Not to mention ARM64...

And 6502 ;-) (and probably most of the ancient ones)

vanderZwan 4/17/2025||
I shared Torque elsewhere and people asked what license it has
benbridle 4/17/2025|
Thanks for the interest! Torque is public domain, feel free to use it or change it or share it however you want. I'd love to hear how people use it, but no obligation.

If you shared it someplace public I'd love to pop by, if you have a link.

vanderZwan 4/17/2025|||
I shared it on the catlang discord, Devine immediately replied "wow, that looks so much like uxn 0_o" hahaha. It's not the most active server but the response has been very positive! A few people thought it would probably be fun to use it to build a custom IR as part of a compiler pipeline, that was the context of the question.

I personally really love the utf8 and the "z80 for loop" examples, those are beautiful and make me nostalgic for the days I was writing stuff for the TI-83+ in Z80 assembly.

benbridle 4/17/2025|||
I've since been informed that public domain isn't really a proper term, legally speaking, so to clarify things I've released Torque under the MIT license.
curtisszmania 4/16/2025|
[dead]