1. Simple Program

ORG 100 LOAD x ADD Y Store Z HALT X, Dec 35 Y, Dec -23 Z, Hex 0

2. Program to get two values from user / add them together, and print result / read first value into ACC / then copy into variable X

input store X input store Y add X / ACC = ACC + X output / print result halt / end program / local variables, initialized to 0 (using base 10) X, dec 0 Y, dec 0

Program 3 / program to get x,y from user and print largest of two numbers

org 100 load X subt Y / acc = X - Y skipcond 800 / if positive then X bigger, skip further tests jump Test load X output halt Test,load Y output halt X, dec 20 y, dec 10

Example 4: simple loop A program to get the user to enter an integer less than 10 (repeats until a valid response is given). / program to get int < 10 from user / keep reading til valid value obtained

org 100 NewVal, input / get value for x store X subt TooBig / compute x - toobig skipcond 000 / if negative then x ok (less than toobig) jump NewVal / otherwise go back and try again Show, load X / got valid value, print x, then done output halt X, dec 0 / default value for x TooBig, dec 10 / X must be less than this