From c1c2a973906812ff31faf534c4bc384e895cadfe Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 20 Mar 2025 17:08:15 +0200 Subject: feat: Demo video and accompanying example assembly --- examples/example3.s | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/example3.s (limited to 'examples/example3.s') diff --git a/examples/example3.s b/examples/example3.s new file mode 100644 index 0000000..fa65c4b --- /dev/null +++ b/examples/example3.s @@ -0,0 +1,18 @@ +; Tonkobali assembler will assemble this program into a series of i64 values +; Every instruction here is composed of SUBLEQ instructions! + +condition = 0 +modifier = 5 +operand = 10 +jmp main ; Start execution from main + +label_add: add modifier, operand ; operand += modifier + rts ; return from subroutine +label_sub: sub modifier, operand ; operand -= modifier + rts ; return from subroutine + +main: beq condition, do_add ; if condition == 0 goto do_add +do_sub: jsr label_sub ; else enter label_sub subroutine + jmp continue +do_add: jsr label_add ; enter label_add subroutine +continue: mov operand, %1000 ; Mem[1000] = operand -- cgit v1.3.1-26-gb76a