A high-performance Rust-based assembler for the BatPU-2 redstone computer.
BatPU-2-Speedy streamlines the development workflow for BatPU-2 programs by providing fast assembly, machine code generation, and Minecraft schematic creation. Built in Rust for maximum performance and reliability.
- Assembly: Compile
.sassembly files to.mcmachine code files - Schematic Generation: Convert machine code into
.schem(Sponge Schematic) files for direct Minecraft import - Unified Build Process: Use the
buildcommand to assemble and generate schematics in one step - Fast Performance: Rust implementation ensures quick compilation times
- Error Handling: Clear error messages and robust file processing
Downloads available at the release page
# Clone the repository
git clone https://github.com/tpglitch/BatPU-2-Speedy.git
cd BatPU-2-Speedy
# Build the project
cargo build --release# Assemble an assembly file
batpu2-speedy assemble -i input.s -o output.mc
# Generate a schematic from machine code
batpu2-speedy schematic -i input.mc -o output.schem
# Build everything at once
batpu2-speedy build -i input.s -o program.schemConverts assembly files to machine code.
batpu2-speedy assemble -i <input.S> [options]Generates Minecraft schematics from machine code.
batpu2-speedy schematic -i <input.mc> [options]Runs assembly and schematic generation in sequence.
batpu2-speedy build -i <input.S> [options].s- Assembly source files containing BatPU-2 assembly code (or.S,.as,.asm, etc.).mc- Machine code files (intermediate binary format).schem- Sponge Schematic files for Minecraft WorldEdit/Litematica
BatPU-2-Speedy supports both legacy and modern assembly syntax:
- Labels with colons:
main:orloop:(instead of.mainor.loop) - Semicolon comments:
;in addition to//and# - Comma separators:
add r1, r2, r3(optional, for readability) - Data directives:
.db/.byte- Define bytes.dw/.word- Define 16-bit words.ascii- ASCII string (no null terminator).asciz/.string- ASCII string with null terminator
- String literals in data:
.db "Hello"expands to individual bytes - Multiple define styles:
define,.equ, or.define - Hex and binary numbers:
0xFF,0b11111111
; Hello World using modern syntax
main:
ldi r15, clear_chars_buffer
str r15, r0
ldi r1, message ; Pointer to message
ldi r2, 10 ; Message length
ldi r15, write_char
print_loop:
lod r1, r14, 0
str r15, r14
inc r1
dec r2
brh nz, print_loop
ldi r15, buffer_chars
str r15, r0
hlt
message:
.db 7, 4, 11, 11, 14 ; "HELLO"The assembler remains fully backward compatible with the original syntax:
// Hello World using legacy syntax
.main
LDI r15 write_char
LDI r14 "H"
STR r15 r14
LDI r14 "E"
STR r15 r14
// ... etc
HLTAll BatPU-2 instructions are supported:
- Arithmetic:
ADD,SUB,ADI - Logic:
NOR,AND,XOR,RSH - Memory:
LDI,LOD,STR - Control:
JMP,BRH,CAL,RET - Special:
NOP,HLT
Pseudo-instructions:
CMP- Compare (SUB with r0 destination)MOV- Move (ADD with r0)LSH- Left shiftINC/DEC- Increment/decrementNOT- Bitwise NOTNEG- Negate
The BatPU-2 is a redstone computer architecture created for Minecraft. This assembler supports the full BatPU-2 instruction set and generates compatible machine code.
For more information about the BatPU-2 architecture, see the original video.
Please feel free to submit issues, feature requests, and pull requests.
This project is licensed under the MIT license. Read the LICENSE file for more information.