Lab8_Solutions_42 - ; ; Understand what the code is doing...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
BME 303 Fall 2009 Lab 8 Assembly Language This lab will count as one homework assignment of a total of 100%. If you do not finish the work in the lab, complete it on your own, and bring it to the next lab session. Problem 1 (30%) Type in the following lines of code in the LC-3 Editor. Assemble it and run it on the simulator. Determine what the program is doing. (Try running the program with different values for Number1 and Number2, stepping through the program while watching the register values, etc., to figure this out.) Explain the program s purpose to the TA. Understand what each op-code (AND, etc.) and pseudo op-code (.FILL, .END, etc.) stands for. Also see how labels and comments are used. (You can use this as a template for writing future assembly language programs.) ; Program: Problem 1 ; Authors: Jignesh Shah, Mickey Moore ; Last modified: 03/21/2005
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; ; Understand what the code is doing and explain it to the TA .ORIG x3000 ; Initialization AND R2, R2, x0 LD R4, Number1 LD R5, Number2 ; Iteration Test (R5 = 0?) Again BRz Done ADD R2, R2, R4 ADD R5, R5, #-1 ; Decrement loop counter BR Again Done HALT ; Data storage Number1 .FILL x0005 Number2 .FILL x0003 Problem 2 .ORIG x3000 LD R0, Number1 LD R1, Number2 LD R2, Number3 AND R5, R1, R2 NOT R4, R1 AND R6, R2, R4 NOT R2, R2 AND R2, R1, R2 NOT R2, R2 NOT R6, R6 AND R3, R2, R6 NOT R3, R3 AND R3, R0, R3 NOT R5, R5 NOT R3, R3 AND R3, R3, R5 NOT R3, R3 Number1 .FILL xFFFF Number2 .FILL x0001 Number3 .FILL x0011 .END Problem 3 .ORIG x3000 LD R0, Number1 LD R1, Number2 LD R2, Number3 NOT R1, R1 NOT R2, R2 NOT R3, R3 AND R2, R1, R2 AND R3, R2, R3 NOT R3, R3 Number1 .FILL x0001 Number2 .FILL x0011 Number3 .FILL x0111 .END...
View Full Document

This note was uploaded on 01/12/2010 for the course BME 14345 taught by Professor Orlyalter during the Fall '09 term at University of Texas at Austin.

Page1 / 2

Lab8_Solutions_42 - ; ; Understand what the code is doing...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online