Hello World Tutorial
This is the smallest useful Cat Assembly program: load a pointer to a null-terminated string into r1, then call interrupt 0x80 to print it.
#const INT_PRINT, 0x80
start: mov r1, hello_msg ; r1 = pointer to C-style string int INT_PRINT ; VM prints string at address in r1
halt: jmp halt ; keep CPU alive (simple infinite loop)
hello_msg: dstr "Hello, World!\n\0"How it works
Section titled “How it works”#const INT_PRINT, 0x80gives the print interrupt a readable name.mov r1, hello_msgplaces the assembled address ofhello_msgintor1.int INT_PRINTinvokes the VM stdout handler, which reads bytes fromr1until\0.dstr "Hello, World!\n\0"emits the message bytes, including newline (\n) and terminator (\0).jmp haltprevents execution from falling through into string data.
Build and run (CatLauncher)
Section titled “Build and run (CatLauncher)”catasm hello.cat -o hello.bincatlaunch run --rom hello.binExpected output:
Hello, World!