Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sheet 1 Introduction to Computer Organization and Assembly Language.

Similar presentations


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

1 Sheet 1 Introduction to Computer Organization and Assembly Language

2 Program Comment A semicolon marks the beginning of this field, and the assembler ignores anything typed after the semicolon. Example: MOV CX, 0; CX counts terms, initially 0

3 Identifiers Can be from 1 to 31 characters long (not case sensitive). May consist of letters, digits, and the special characters. _ $ % (Thus, embedded blanks are not allowed). Names may not begin with a digit. If a dot is used, it must be the first character.

4 Defining Types of data [name]Dnexpression Syntax: name Dn initial_value

5 Defining Types of data Cont. Dn (Directive): Pseudo- op Stands for DB DW DD DQ DT Define Byte Define Word Define Doubleword Define Quadword Define Tenbytes

6 Question 1 Q1: Tell whether each of the following identifiers is Valid or Invalid. Identifier Valid \ Invalid Identifier Valid \ Invalid CountValid Open_File Valid First.Invalid: Dot is not the first character. Valid 2_mainInvalid: Begins with a file Invalid: Contains a blank.

7 Question 2 Q2: Give data definition pseudo-ops to define each of the following: a) A word variable X initialized to 41. X DW 41

8 Question 2 Cont. Q2: Give data definition pseudo-ops to define each of the following: b) A word variable WORD1, uninitialized. WORD1 DW ?

9 Question 2 Cont. Q2: Give data definition pseudo-ops to define each of the following: c) A byte variable Y initialized to 32h. Y DB 32H

10 Question 2 Cont. Q2: Give data definition pseudo-ops to define each of the following: d) A byte variable ITEM containing the hex equivalent to decimal 71. ITEM DB 47H

11 Question 2 Cont. Q2: Give data definition pseudo-ops to define each of the following: e) A word array ARRAY1, initialized to the first 5 positive integers (i.e. 1-5). ARRAY1 DW 1,2,3,4,5

12 Question 2 Cont. Q2: Give data definition pseudo-ops to define each of the following: f) A 30 bytes array ARR, with each entry initialized to 10H. ARR DB 30 DUP (10H)

13 Question 2 Cont. Q2: Give data definition pseudo-ops to define each of the following: g) A constant LENGTH with value 20, another constant WIDTH with value 10, and constant AREA using LENGTH and WIDTH that you just defined (Note: area = length * width). LENGTH EQU 20 WIDTH EQU 10 AREA EQU length * width


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

Similar presentations


Ads by Google