diff --git a/examples/call_ret.mima b/examples/call_ret.mima new file mode 100644 index 0000000..b18cb35 Binary files /dev/null and b/examples/call_ret.mima differ diff --git a/examples/call_ret.mimasm b/examples/call_ret.mimasm new file mode 100644 index 0000000..1e68770 --- /dev/null +++ b/examples/call_ret.mimasm @@ -0,0 +1,18 @@ +IAR = main +ACC = 0 +RA = 0 + +; This CALL/RET example does not use any sort of stack, and thus can +; only go 1 call deep. Nevertheless, it demonstrates how the CALL and +; RET instructions behave. + +main: + LDC 0 + ADC 1 + CALL sub ; Sets the RA to the next address (in this case, ADC 4) + ADC 4 + HALT + +sub: + ADC 50 + RET ; Jumps to the ADC 4