Assembly & Machine Language
In-class Exercises


  1. Write the assembly language instructions to add the contents of memory location 1 to the contents of register 2 and store the results in register 0.
    
    
    
    
    
    
    
    
    
            
  2. Determine what the following assembly language program fragment does. What would the same program fragment look like in JavaScript?
                LOAD R2 5
                ADD R2 R2 R2
                LOAD R1 3
                ADD R3 R1 R2
                STORE R3 5
                HALT
    
    
    
    
            
  3. What would be the assembly instructions to do the following computation?
                R0 = Mem[7] + R2 - R3
    
    
    
    
    
    
    
    
            
  4. (optional) Write the instructions for exercise 1 in machine language.