XDEF Entry        ; export 'Entry' symbol
            ABSENTRY Entry    ; for absolute assembly: mark this as application entry point

; include derivative specific macros
            ORG $3800
result_sum: ds.w 1
            ORG $4000
Entry:      ;Example of a subroutine that adds 3 words
            ;Whose addresses are pushed on the stack,
            ;returning result in register X
            lds #$3f00
            ldx #$1234
            pshx
            ldx #$4321
            pshx
            ldx #$1212
            pshx
            jsr add3wordsub
            leas 6,sp     ;clean the 3 input words 
                          ;(6 bytes) off of the stack!
            stx result_sum
done:       bra done
;*****Subroutine "add3wordsub" starts here. 
add3wordsub:pshd          ;save D register, as it is altered
            ldd #0        ;Stack Map:  3f00 --
            addd 8,SP     ;(after pshd)3eff 34
            addd 6,SP     ;   SP+8->   3efe 12 
            addd 4,SP     ;            3efd 21
                          ;   SP+6->   3efc 43
                          ;            3efb 12
                          ;   SP+4->   3efa 12
                          ;            3ef9 PClow
            tfr d,x       ;            3ef8 PChigh
            puld          ;            3ef7 Dlow (b)
            rts           ;     SP->   3ef6 Dhigh (a)
            
                                      

;**************************************************************
;*                 Interrupt Vectors                          *
;**************************************************************
  ORG $FFFE

  fdb     Entry      ; Reset