// Absolute addressing: ADDSP 3 // allocate x,y,rv; you may also PUSHIMM 0 three times PUSHIMM 0 // location in which to store rv PUSHIMM 0 // value to store in rv's location STOREIND // store value 0 in address 0 PUSHIMM 1 // location to store x PUSHIMM 10 // value to give x STOREIND // store value of x PUSHIMM 2 // location to store y PUSHIMM 20 // value to give y STOREIND // store value of y PUSHIMM 0 // location to store result of x+y PUSHIMM 1 // push address of x PUSHIND // retrieve value of x PUSHIMM 2 // push address of y PUSHIND // retrieve value of y ADD // add values of x and y STOREIND // store value of x+y in address rv ADDSP -2 // remove x and y from memory STOP // halt --> SaM should return 30