CSC103 2011 Assembly Language Examples

From dftwiki3
Revision as of 11:37, 15 February 2011 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- =Program 1= A program that computes the sum of all the integers between 1 and 5 and stores it into a variable called sum. <code><pre> start: lod counter add sum ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 11:37, 15 February 2011 (EST)


Program 1

A program that computes the sum of all the integers between 1 and 5 and stores it into a variable called sum.

start:	lod	counter
		add sum
		sto sum
		lod counter
		sub-c 1
		sto counter
		jmz	done
		jmp	start
done:	hlt


counter:	5
sum:		0