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

https://news.ycombinator.com/rss Hits: 11
Summary

Torque is a lightweight meta-assembler that provides the tools necessary to write programs for any processor architecture. For a quick overview of the language, either read the language overview section of the manual, see this example of a completed program, or skim one of the following hands-on tutorials: For a demonstration of how to write high-level optimising macros in Torque, see: Background Existing assemblers for embedded processors suffer from a number of issues. Assemblers tend to be poorly documented, provide languages that are clunky and verbose, be bloated and difficult to operate, and work only on one operating system. Development of C compilers is often a higher priority than the development of good assemblers. Instead of learning a new assembler for every embedded processor, it would be preferrable to instead use a single general-purpose assembler for every project. Torque was created to fill this niche. Design Torque is designed around the idea that any assembly language can be emulated with just integers, bit sequences, labels, and sufficiently powerful macros. With Torque, the instruction encoding for a target processor can be defined as a set of macros in the program itself, using templates to specify how values are packed into ranges of bits. A program can be written for any processor using only Torque and the datasheet for that processor. Installation Source code for the torque assembler can be downloaded from code.benbridle.com/torque-asm. The latest release is available at tq-2.1.0 as a pre-compiled Linux executable. Build from source To build the Torque assembler from source, first install the Rust compiler from www.rust-lang.org/tools/install, then install the nightly toolchain with rustup toolchain install nightly, and then run cargo +nightly build --release inside the torque-asm source code directory. The compiled binary will be created at ./target/release/tq. Usage The following command will assemble the Torque source file source and save...

First seen: 2025-04-16 01:15

Last seen: 2025-04-16 11:17