Stack frames are commonly used in subroutines to create local variables on the stack. Accessing the variables can be a little tedious. Here is a solution that might make things just a little easier.
Code:
ORG $1000
START: ; first instruction of program
BSR FRAMEIT
MOVE.B #9,D0
TRAP #15 ; halt simulator
*---------- FRAMEIT subroutine ----------
SIZE EQU -3*4 3 long words, negative for stack frame
OFFSET SIZE offset to local variables is determined
num1 DS.L 1
num2 DS.L 1
num3 DS.L 1
ORG *
FRAMEIT LINK A0,#SIZE create stack frame
MOVEM.L A0-A1,-(A7) put some more stuff on the stack just for fun
MOVE.L #$11111111,(num1,A0) access the local variable using a label
MOVE.L #$22222222,(num2,A0)
MOVE.L #$33333333,(num3,A0)
MOVEM.L (A7)+,A0-A1 get stuff off stack
UNLK A0 remove stack frame
RTS
END START ; last line of source