blob: fa65c4b9c6ca7cadb9db0e300546b7f62fe82cdb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
|