1 / 11

Introduction to Computer Organization and Assembly Language

Introduction to Computer Organization and Assembly Language . Sheet 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. Question 1. ADD WD1,WD2 MOV AL,0AC3h MOV DS,BX ADD 03,AL

jaafar
Download Presentation

Introduction to Computer Organization and Assembly Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Computer Organization and Assembly Language Sheet 2

  2. Question1 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. Question1 • ADD WD1,WD2 • MOV AL,0AC3h • MOV DS,BX • ADD 03,AL • MOV AH,WD2 • MOV BT1,BT2 • MOV CS,SS • MOV DS,100h • MOV WD2,CS • 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. Question2 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. Question2 a. B = 3 * B + 2 MOV AX,B ADD 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. Question2 c. C = -(C + 1) INC C NEG C • d. A = C – B MOV AX,C SUB AX,B MOV A,AX

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

  8. Question3 • 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. Question3

  10. Question3

  11. Question3

More Related