stk START 0 JSUB stackinit LDA #1 STA @stkptr JSUB stackpush LDA #2 STA @stkptr JSUB stackpush LDA #3 STA @stkptr JSUB stackpush JSUB stackpop LDA @stkptr STA val3 JSUB stackpop LDA @stkptr STA val2 JSUB stackpop LDA @stkptr STA val1 halt J halt stackpush STA temp LDA stkptr ADD #3 STA stkptr LDA temp RSUB stackpop STA temp LDA stkptr SUB #3 STA stkptr LDA temp RSUB stackinit STA temp LDA #stack STA stkptr LDA temp RSUB stkptr RESW 1 temp RESW 1 val1 RESW 1 val2 RESW 1 val3 RESW 1 stack RESW 50 END stk