Introduction to Computer Systems Chapter 7

Introduction to Computer Systems Chapter 7 - Appendix F...

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

View Full Document Right Arrow Icon
Appendix F Selected Solutions F.7 Chapter 7 Solutions 7.1 0xA7FE 7.3 Using an instruction as a label confuses the assembler because it treats the label as the opcode itself so the label AND will not be entered into the symbol table. Instead the assembler will give an error in the second pass. 7.5 (a) The program calculates the product of values at addresses M0 and M1. The product is stored at address RESULT. mem[RESULT] = mem[M0] * mem[M1] (b) x200C 7.7 The assembly language program is: .ORIG x3000 AND R5, R5, #0 ADD R5, R5, #1 ;R5 will act as a mask to ;mask out the unneeded bit AND R1, R1, #0 ;zero out the result register AND R2, R2, #0 ;R2 will act as a counter LD R3, NegSixt MskLoop AND R4, R0, R5 ;mask off the bit BRz NotOne ;if bit is zero then don’t ;increment the result ADD R1, R1, #1 ;if bit is one increment ;the result NotOne ADD R5, R5, R5 ;shift the mask one bit left ADD R2, R2, #1 ;increment counter (tells us ;where we are in bit pattern) 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 APPENDIXF.SELECTEDSOLUTIONS ADD R6, R2, R3 BRn MskLoop ;not done yet go back and ;check other bits HALT NegSixt .FILL #-16 .END 7.9 The .END pseudo-op tells the assembler where the program ends. Any string that occurs after that will be disregarded and not processed by the assembler. It is different from HALT
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Introduction to Computer Systems Chapter 7 - Appendix F...

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

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