Introduction to Computer Organization and Assembly Language Sheet 1 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 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. Defining Types of data [name] Dn •Syntax: name Dn initial_value expression Defining Types of data Cont. • Dn (Directive): Pseudoop DB DW DD DQ DT Stands for Define Byte Define Word Define Doubleword Define Quadword Define Tenbytes Question 1 Q1: Tell whether each of the following identifiers is Valid or Invalid. Identifier Valid \ Invalid Valid \ Invalid Identifier Open_File Valid Count Valid First. Invalid: Dot is not the first character. @@myfile Valid 2_main Invalid: Begins with a digit. @my file Invalid: Contains a blank. 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 Question 2 Cont. Q2: Give data definition pseudo-ops to define each of the following: b) A word variable WORD1, uninitialized. WORD1 DW ? 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 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 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 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) 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