Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sheet 2 Introduction to Computer Organization and Assembly Language.

Similar presentations


Presentation on theme: "Sheet 2 Introduction to Computer Organization and Assembly Language."— Presentation transcript:

1 Sheet 2 Introduction to Computer Organization and Assembly Language

2 Question 1 Q1: Tell whether each of the following instructions is legal or illegal.WD1 and WD2 are word variables, and BT1 and BT2 are byte variables.

3 Question 1 A. ADD WD1,WD2 B. MOV AL,0AC3h C. MOV DS,BX D. ADD 03,AL E. MOV AH,WD2 F. MOV BT1,BT2 G. MOV CS,SS H. MOV DS,100h I. MOV WD2,CS J. MOV BT1,WD1 Illegal memory location & memory location Illegal out of range Legal Illegal the destination is a constant Illegal operands are not of the same type Illegal memory location & memory location Illegal segment register to segment register Illegal constant to segment register Legal segment register to memory location Illegal memory location & memory location

4 Question 2 Q2: Using only MOV, ADD, SUB, INC, DEC, and NEG, translate the following high-level language assignment statements into assembly language. A, B, and C are word variables.

5 Question 2 a. B = 3 * B + 2 MOV AX,B ADD AX,B ADD AX,2 MOV B,AX b. B = A + C MOV AX,A ADD AX,C MOV B,AX

6 Question 2 c. C = -(C + 1) INC C NEG C d. A = C – B MOV AX,C SUB AX,B MOV A,AX

7 Question 2 e. A = C - A – 1 MOV AX,C SUB AX,A DEC AX MOV A,AX

8 Question 3 Q3: Write assembly program that displays the following “This Program is to swap content of two memory locations”, and then define two variables (BYTE1 and BYTE2) of type byte and uninitialized, then write a transfer instruction that assign value ('A') in BYTE1 and value (45H) in BYTE2, then try to swap the values.

9 Question 3

10

11


Download ppt "Sheet 2 Introduction to Computer Organization and Assembly Language."

Similar presentations


Ads by Google