#
# SUBROUTINE TEST PROGRAM
# (self modifying code)

start:
    move    0x01
    store   0xF0    # init var

code0:
    move    code0   # save base addr
    jump    multx2

code1:
    move    code1   # save base addr
    jump    multx2

trap:
    jump trap

#
# MULT 2 subroutine
#

multx2:
    add     2       # generate return address
    store   8 exit
    load    0xF0    # read tmp variable
    addm    0xF0    # add tmp variable to ACC i.e. x2
    store   0xF0    # store to tmp variable 
    store   0xFF    # store ACC to output port
exit:
    jump    0x00  
