CSC103 Homework 3 2017
--D. Thiebaut (talk) 11:28, 26 September 2017 (EDT)
This assignment is due on 10/8/2017, at 11:55 p.m. Submit your answer on Moodle. You may work in pairs on this assignment, but make sure you
Assembly Language Programming
Write a an assembly language program using the SCS simulator we used in class, to compute the quantity
y = 2 * ( x - 1 )
where and x and y are two variables stored in memory.
When your program starts, x will contain an integer number of your choice, say 5, and y will contain 0. When your program stops, the memory location corresponding to y will contain 8, which is equal to 2 * (5 - 1). If x had contained 10 when the program started, then y would have contained 18 when your program had stopped.
Use comments (after the semicolon) to document what each instruction does. Below is an example of how I would comment a simple program that adds one to Variable x stored in Memory Location 7:
; D. Thiebaut ; This program adds 1 to variable x ; stored at Memory Location 7 0000: LOAD [7] ; AC <-- x 0002: SUB 1 ; AC <-- x - 1 0004: STORE [7] ;x <-- x - 1 0006: HALT ; 0007: 10 ; x. Initial value of 10
When you are satisfied that your program runs well and computes the correct value for y, submit it (copy/paste it) on Moodle, in the Homework 3 section.
Submit your program