This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Question 1 [23 marks] a) [5 marks] Express the range of 16 bit signed numbers (min max) first in hexadecimal and then in decimal. MIN (hex) = MIN (decimal) = MAX (hex) = MAX (decimal) = b) [2 marks] Provide one reasonable explanation why a programmer may replace the single instruction MOV AX, 2 by two instructions ? INC AX INC AX c) [6 marks] Consider the following sequence of instructions MOV CX, 09F21h MOV DX, 07188h ADD CX, DX After execution : CX = DX = OF = CF = SF = ZF = d) [2 marks]When we use .small in our programs, how are our programs assembled ? e) [ 2 marks] Assembling conditional jump instructions require two passes by the assembly, instead of a single pass. Explain. 1 Sample Final Exam f) [2 marks] Show an efficient way of declaring an array of 200 words, all initialized to zero, when the program is loaded, but prior to program execution. g) [2 marks] Give one example that shows that knowing a bit about the hardware enables you to write more efficient programs. Question 2 [30 marks] (a) [12 marks] The following code fragment shows the body of a subroutine called average. It calls another subroutine whose C-language prototype is as follows : unsigned word roundDIV ( unsigned word dividend, unsigned byte divisor) // Return the result of an integer division, // rounding up the result by 1 iff // ( ( Remainder * 2 ) > Divisor )....
View Full Document
- Summer '09