Add CALL/RET example
This commit is contained in:
parent
fde6fc29ec
commit
4a67848627
2 changed files with 18 additions and 0 deletions
BIN
examples/call_ret.mima
Normal file
BIN
examples/call_ret.mima
Normal file
Binary file not shown.
18
examples/call_ret.mimasm
Normal file
18
examples/call_ret.mimasm
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue