batpu-assembler is a Rust program and library for assembling assembly for the BatPU.
To assemble something, you can put in the assembly file, and then the output file, like this:
batpu-assembler program.asm program.mc
There are other arguments you can use:
-d, --disable-default-defines - Disables built-in defines, such as SCR_PIX_X
-p, --no-print-info - Do not print assembler info
-t, --text-output - Assemble to text file with binary representation
SCR_PIX_X (240) - Screen Pixel XSCR_PIX_Y (241) - Screen Pixel YSCR_DRAW_PIX (242) - Draw pixelSCR_CLR_PIX (243) - Clear pixelSCR_GET_PIX (244) - Get pixelSCR_PUSH (245) - Push screen bufferSCR_CLR (246) - Clear screen bufferCHAR_DISP_WRITE (247) - Write characterCHAR_DISP_PUSH (248) - Push character bufferCHAR_DISP_CLR (249) - Clear character bufferNUM_DISP_SHOW (250) - Show numberNUM_DISP_CLR (251) - Clear numberNUM_DISP_SIGNED (252) - Set to signed modeNUM_DISP_UNSIGNED (253) - Set to unsigned modeRNG (254) - Random number generatorCONTROLLER (255) - Controller input
#define MEM_ADDR r1
#define MEM_VAL r2
jmp +3 // Jump 3 instructions ahead, so to "jmp main"
main:
ldi MEM_ADDR 0x00; ldi MEM_VAL 0xFF
str MEM_ADDR MEM_VAL 0
jmp main // "jmp -2" is also possible