; STACK instruction example. ; ; Build/run from examples/: ; ../utils/mcpu-as -o stack.o stack.s ; ../utils/mcpu-ld --stack-size=128 -o stack stack.o ; ../utils/mcpu-run --int-reg=r64@0x00028 stack ; ; Expected output: 22 ; .text _start_life: LDI r64@0x00000, 11 LDI r64@0x00008, 22 ; STACK grows downward. cpu-run initializes SP to stack_size. PUSH r64@0x00000 PUSH r64@0x00008 ; Current stack top contains 22, SP+8 contains 11. LDSP r64@0x00010, 8 STSP 0, r64@0x00000 POP r64@0x00018 POP r64@0x00020 ; Reserve a 16-byte local frame without automatic padding. ADJSP -16 STSP 0, r64@0x00008 LDSP r64@0x00028, 0 ADJSP 16 HALT