80 likes | 280 Views
Lab 1. Program structure, comments, define variables. Program Structure. Comments. Anything after a semicolon is a comment. Comment. Defining Variables. Defining variables goes under the .DATA segment. Defining Variables. Name Type Value. Exercise 1.
E N D
Lab 1 Program structure, comments, define variables
Comments • Anything after a semicolon is a comment. Comment
Defining Variables • Defining variables goes under the .DATA segment
Defining Variables • NameType Value
Exercise 1 • Can we use the following names as identifiers in assembly language: • NUM.4 • #LET • _ROUND • QUS%%$ • Def* • No • No • Yes • Yes • No
Exercise 2 • Define a variable in assembly language: • 1. A variable called RED of the type word, uninitialized. • RED DW ? • 2. A byte variable named HexNum of value 73 in Hex. • HexNum DB 73H • 3. An array called Array1 of type byte, contains ‘HELLO’ value, it needs to be in HEX. • ARRAY1 DB 48h,45h,4Ch,4Ch,4Fh • 4. 70 byte elements in an array AA, which they have the same value of 14, it needs to be in binary. • AA DB 70 DUP (00001110b) • 5. A constant RRR has a value of 90. • RRR EQU 90
Exercise 3 • In each of the following definitions, give us the type, name and value, if it is an array give us the number of elements: • 1. NOW DB ‘N’, ‘O’, ‘W’ • Type: Byte name: NOW value: NOW elements: 3 • 2. NUMBER DB 100 DUP(?) • Type: byte name: NUMBER value: uninitialized elements: 100 • 3. LETTERS DQ ‘ABCDEFG’ • Type: Quad word name: LETTERS value: ABCDEFG • 4. ASM DW 10101010B • Type: word name: ASM value: 10101010 • 5. Bin DD12.5 • Type: double word name: Bin value: 12.5 • 6. TIA EQU3 • Type: Constant name:TIA VALUE: 3