Add CALL/RET example

This commit is contained in:
Joscha 2019-11-10 11:22:16 +00:00
parent fde6fc29ec
commit 4a67848627
2 changed files with 18 additions and 0 deletions

18
examples/call_ret.mimasm Normal file
View file

@ -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