Professional Documents
Culture Documents
Data Definition and Data Movement: Meynard Soriano, Cpe, Mit
Data Definition and Data Movement: Meynard Soriano, Cpe, Mit
Data Definition
To define a data, use the following format: name Dnnn expresssion name any valid variable name that will reference the memory Dnnn size of data
expression initial value(s) of the variable
Dnnn:
db -define byte dw -define word dd -define doubleword df-define farword (6 bytes) dq -define quadword (4 words) dt -define ten bytes
Example:
1. 2. 3. 4. 5. 6. 7. var1 var2 var3 var4 var5 var6 Var7 db 12 db 0Ch db 00001100b db 1,2,3,4 db 256 ---> error dw 1234h,5678h dd 12345678h
Defining String
String is an array of characters usually terminated by a $. Example 1. str1 db a,b,c,d,$ 2. str2 db abcd,$ 3. str3 db abcd$ 4. str4 db ab,cd,$ 5. str5 db 61h,62h,63h,64h,$ 6. str6 db 97,98,99,100,$
Creating constants:
EQU -directives that defines a substittute Example: name EQU 10 cntr EQU 5 DAGDAG EQU ADD BAWAS EQU SUB
Moving Data
MOV - an instruction that transfers/copies data referenced by op2 going to op1. op2 is unchanged. format: MOV op1,op2 Note : op1 must agree in size with op2 : op1 and op2 must not be memory variables at the same time : op1 must not be an immediate value
INTRO TO SCREEN PROCESSING 1. Displaying a string: mov ah,9 lea dx,var1 int 21h 2. Accepting a character: mov ah,1 int 21h ***AL automatically gets the accepted character