Skip to content Skip to footer
0 items - $0.00 0

Show HN: Torque – A lightweight meta-assembler for any processor by benbridle

Show HN: Torque – A lightweight meta-assembler for any processor by benbridle

Show HN: Torque – A lightweight meta-assembler for any processor by benbridle

14 Comments

  • Post Author
    sitkack
    Posted April 16, 2025 at 2:22 am

    Super fun site!

    Did you get inspiration from other assemblers or macro processors?

    You have it running on a TRS-80, how does that work? I had no idea Rust could target a TRS-80.

    I am getting hints of Forth, Lisp and TCL.

    How would you go about laying out structs in memory?

    I am sure you considered an internal DSL, what caused you go with something stand alone?

    Any thoughts on adding a constraint solver, like Z3 and allowing end users to set constraints on things like the size of a jump.

    I could see taking this an growing it into a compiler by making macro(macro(macros txt)))

    Is there an internal IR?

    Projects for inspiration

    https://github.com/mattbierner/Template-Assembly

    Specifying representations of machine instructions
    https://dl.acm.org/doi/pdf/10.1145/256167.256225

    https://www.semanticscholar.org/paper/Specifying-representat…

    Typed Assembly Language (TAL)
    https://www.cs.cornell.edu/talc/

    And you haven't come across it, you are in for a treat https://en.wikipedia.org/wiki/META_II has spawned a whole trove of clones

    https://en.wikipedia.org/wiki/OMeta

    https://github.com/DalekBaldwin/clometa

  • Post Author
    zadkey
    Posted April 16, 2025 at 2:37 am

    Excellent work man!
    I know some low level guys who would really appreciate this.

  • Post Author
    anonzzzies
    Posted April 16, 2025 at 3:00 am

    Well done! I write quite a bit of z80 for msx and this seems a nice addition.

  • Post Author
    curtisszmania
    Posted April 16, 2025 at 3:14 am

    [dead]

  • Post Author
    2ton_jeff
    Posted April 16, 2025 at 5:20 am

    Very cool and I like the idea of a "meta-assembler." The most-recent version of flatassembler (fasm 2) is built with fasmg which is also a "meta-assembler" of sorts, in that it also doesn't directly support a specific instruction set and instead is a very powerful macro assembler. I'm keen to check out functionality overlaps between the two implementations.

    https://board.flatassembler.net/topic.php?t=19389

    https://flatassembler.net/download.php

  • Post Author
    angelmm
    Posted April 16, 2025 at 5:24 am

    Any time I read about Z80, my mind wants to try to run something on a GameBoy emulator.

    Pretty cool project!

  • Post Author
    eterps
    Posted April 16, 2025 at 6:16 am

    Nice!

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

  • Post Author
    userbinator
    Posted April 16, 2025 at 6:51 am

    Reminds me of TDASM from the turn of the century: https://web.archive.org/web/20230906054935/http://www.pengui…

    I remember there were a few other meta-assemblers I came across in the 80s-90s, so this is definitely not "unchartered territory", but it's good to see another one show up.

    Of course, in the other direction there are meta-disassemblers used for analysis in tools like Ghidra.

  • Post Author
    kunley
    Posted April 16, 2025 at 6:52 am

    Need to address this point:

    "Assemblers tend to be poorly documented"

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

  • Post Author
    bjackman
    Posted April 16, 2025 at 8:02 am

    At first I thought it was useless: "but each ISA will still end up having different effective syntax because the underlying macro systems will not be designed the same".

    But then I reread it and realised I was not paying attention to the usecase. It's about making it easy to write assemblers. So this isn't for your Arms and RISC-Vs it's for your random niche microcontrollers where the vendor-provided toolchain kinda sucks.

    Seems cool!

    I've experienced a couple of under-documented assemblers in my time. In neither case did this turn out to be that much of a problem in practice, but I guess I just don't write that much assembly.

  • Post Author
    MathMonkeyMan
    Posted April 16, 2025 at 9:00 am

    I'm reminded of a 2016 [talk][1] where Rob Pike describes the common-denominator assembly language that the Go compiler generates. Then that assembly is translated into machine-specific code via table lookups. See the 11 minute mark.

    [1]: https://www.youtube.com/watch?v=KINIAgRpkDA

  • Post Author
    roetlich
    Posted April 16, 2025 at 11:04 am

    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.

  • Post Author
    zzo38computer
    Posted April 17, 2025 at 12:30 am

    Is there any support for non-Unicode text? Is there any support for octal numbers? These things should be corrected, hopefully.

    Also, some of the links in the table of contents of the documentation does not seems to work.

  • Post Author
    vanderZwan
    Posted April 17, 2025 at 2:59 am

    I shared Torque elsewhere and people asked what license it has

Leave a comment

In the Shadows of Innovation”

© 2025 HackTech.info. All Rights Reserved.

Sign Up to Our Newsletter

Be the first to know the latest updates

Whoops, you're not connected to Mailchimp. You need to enter a valid Mailchimp API key.