Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


COMP2476 Intro to Assembly Language and OS

winter 2022

Problem.1: What is the sum of each pair of binary integers (Show your work)? (1 mark)

a. 11010111 + 01101011

 

 

 

b. 01110101 + 10101100

 

Problem.2: How many byte are contained in each of the following data types? (1.5 mark)

a. word

 

b. dword

 

c. Qword

 

Problem.3: What is the minimum number of binary bits needed to represent each of the following unsigned decimal integers? (1 mark)

a. 65

 

b. 4095

 

 

Problem.4: What is the 8-bit binary (two’s-complement) representation of each of the following signed decimal integers? (1.5 mark)

a. -6

 

b. - 26

 

c. -32

 

Problem.5: (1 mark)

 

 

 

a. Declare an array of 20 unsigned bytes named bArray and initialize all elements to zero.

 

 

b. Declare a string variable containing the word “Comp2476” repeated 300 times.

Str Dword 300 DUP("This a Comp2476").

 

 

 

Problem.6: Show the Little -Endian Order of individual bytes in memory for the following doubleword variable: (2 mark) if the lowest memory is equal to 1000

 

 

 

 

 

 

 

Problem.7:  If you have the data part of a 64 bit code is as following


 
firstval  QWORD 13

secondval QWORD 16

thirdval  QWORD 2

sum       QWORD 0
And the procedure part is as following:
 
mov rax, firstval

add rax, secondval

imul rax, thirdval

mov sum, rax

sub rax, secondval

What is the rax register and sum variable values at the end of executing this code?

(4 mark)

 

 

 

Problem.8:  Translate the following C++ expression to assembly language using registers

Write the procedure only (you don’t need to write the full code) (4 mark)

If initial value for X is 5 and initial value for Y is 10.

 

 

 

X=5+ (X*2) - Y.