jmp main sum: mov x, %1000 ; %1000 = x add y, %1000 ; %1000 += y rts sub: mov x, %1000 ; %1000 = x sub y, %1000 ; %1000 -= y rts operation = 0 ; 0 for sum, >0 for sub x = 48 y = 7 main: beq operation, call_sum ; if operation then %1000 = x+y jmp call_sub ; else %1000 = x-y call_sum: jsr sum jmp call_end call_sub: jsr sub call_end: inc %1001 ; Times main has been ran