https://benbridle.com/projects/torque.html
benbridle.com Projects
Torque
* Torque
* Background
* Design
* Installation
* Build from source
* Usage
* Documentation
* Development
Torque is a lightweight meta-assembler that provides the tools
necessary to write programs for any processor architecture.
[torque-scr]
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:
* Torque: Programming the PIC10F200
* Torque: Programming the TRS-80
For a demonstration of how to write high-level optimising macros in
Torque, see:
* Torque: Advanced loops on the Z80
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 the assembled output to the file destination in the chosen
format.
tq [source] [destination] --format=
Documentation
* Manual v2.1.0
The full user manual for version 2.1.0 of the language and
assembler.
Development
* Changelog
* Roadmap