; Indirect CALLP/JMPP control-flow example. ; ; Build/run from examples/: ; ../utils/mcpu-as -o indirect-control.o indirect-control.s ; ../utils/mcpu-ld --stack-size=512 -o indirect-control indirect-control.o ; ../utils/mcpu-run --int-reg=r64@0x00020 indirect-control ; ; Expected output: 42 ; .data .align 8 dispatch: .cptr indirect_function .cptr done .text _start_life: ; Load a PROGRAM PTR64 from DATA and call through it. LEA r64@0x00000, dispatch LOADP r64@0x00008, r64@0x00000 CALLP r64@0x00008 ; Select the second entry and jump through it. PADDI r64@0x00000, r64@0x00000, 8 LOADP r64@0x00010, r64@0x00000 JMPP r64@0x00010 ; JMPP must skip this path. LDI r64@0x00020, 99 HALT indirect_function: LDI r64@0x00020, 42 RET done: HALT