cs221pnu.files.wordpress.com  · web viewtranslate the following high-level language assignment...

2
Princess Nora Bint Abdulrahman University CS 206 – CS 321 College of Computer and Information Sciences Computer Organization and Assembly Language Department of Computer Sciences Homework (2) Name: ID: Section: 1. Tell whether each of the following instructions is legal or illegal.W1 and W2 are word variables, and B1 and B2 are byte variables. a) ADD W1,W2 b) ADD 01,AH c) MOV CS,BX d) MOV DS,SS e) MOV AH,W2 f) MOV B1,B2 g) MOV DS,200h h) MOV W2,CS i) MOV AL,0211h j) ADD 02,01 k) MOV W1,B1 2. Use only MOV, ADD, SUB, INC and DEC to translate the following high- level language assignment statements into assembly language. A, B, and C are word variables. a) A = 3 + 2 * B b) B = C + 1 c) B = A + C d) A = A - B e) A = C - A – 1 3. Write assembly program that displays the following “This Program is to add content of two memory locations”, and then define three uninitialized variables BYTE1 , BYTE2 and Result (all of type byte) , then write a transfer instruction that assign value (01H) in BYTE1 and value (11H) in BYTE2, then add the two values and transfer the result to Result variable.

Upload: others

Post on 20-Aug-2020

5 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: cs221pnu.files.wordpress.com  · Web viewtranslate the following high-level language assignment statements into assembly language. A, B, and C are word variables. A = 3 + 2 * B

Princess Nora Bint Abdulrahman University CS 206 – CS 321College of Computer and Information Sciences Computer Organization and Assembly LanguageDepartment of Computer Sciences Homework (2)

Name: ID: Section:

1. Tell whether each of the following instructions is legal or illegal.W1 and W2 are word variables, and B1 and B2 are byte variables.

a) ADD W1,W2b) ADD 01,AHc) MOV CS,BXd) MOV DS,SSe) MOV AH,W2f) MOV B1,B2g) MOV DS,200hh) MOV W2,CSi) MOV AL,0211hj) ADD 02,01k) MOV W1,B1

2. Use only MOV, ADD, SUB, INC and DEC to translate the following high-level language assignment statements into assembly language. A, B, and C are word variables.

a) A = 3 + 2 * Bb) B = C + 1c) B = A + Cd) A = A - Be) A = C - A – 1

3. Write assembly program that displays the following “This Program is to add content of two memory locations”, and then define three uninitialized variables BYTE1 , BYTE2 and Result (all of type byte) , then write a transfer instruction that assign value (01H) in BYTE1 and value (11H) in BYTE2, then add the two values and transfer the result to Result variable.