CSC103 Homework 3 Solution 2017

From dftwiki3
Revision as of 16:05, 12 October 2017 by Thiebaut (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut (talk) 17:05, 12 October 2017 (EDT)


Programming Part


; Heloise Cheruvalath
; This program subtracts 1 from a variable x and then multiplies the result by 2
; The final result is stored at Memory Location 10 as the variable y


0000:    LOAD [9]        ; AC <------ x
0002:    SUB 1          ; AC <------- x-1
0004:    MUL 2          ; AC <----- (x-1) * 2
0006:    STORE [10]       ; y <------ (x-1) * 2
0008:    HALT            ;
0009:    20            ; x. Initial value of 20
0010:    0            ; y. Initial value of 0