You are on page 1of 5

Data Types:

The BYTE (define byte) and SBYTE (define signed byte) directives allocate storage for
one or more unsigned or signed values. Each initializer must fit into 8 bits of storage. A
question mark (?) initializer leaves the variable uninitialized, implying it will be assigned
a value at runtime.

The WORD (define word) and SWORD (define signed word) directives create storage
for one or more 16-bit integers.

The DWORD (define double word) and SDWORD (define signed double word)
directives allocate storage for one or more 32-bit integers. The DWORD can be used to
declare a variable that contains the 32-bit offset of another variable.

The QWORD (define quad word) directive allocates storage for 64-bit (8-byte) value.

String:
The datatype of the string is byte, first write the datatype after that string is written. 0 is a
terminator of string. String must be end with 0, otherwise compiler take random values
and assign to the string. When the compiler reads 0 then it understand that the string
ends.

Call writestring

The above function used to call the string on console.

0ah, 0dh, are used to print the output in the next line.

Offset has the address of string. To print the string on console must have to move the
offset of string into edx register.
INCLUDE Irvine32.inc

.data

str1 byte "Hello world", 0ah, 0dh, 0

.code

main PROC

mov edx, offset str1


call writestring
call readint

exit
main ENDP
END main
Division:
When two numbers is divided then the quotient of the number is stored in eax register
and the remainder of that number is store in the edx register. For storing the value of
remainder the edx register is assign to the 0 value, move 0 to edx register.

Example 1:

16 divided by 5.
Input from user:

Input of the user is store in eax register.

Call readint

The above function is used to take input from user and stay console on screen.

Example 2:

Take two numbers from user and add them.


Lab task 1: Write the code for the following equation.

(10 * 9 + 13) / (8 * 4 - 9)

Lab task 2: Take values of the variables from user and solve the equation. You
can use multiple registers.

a) a + b + (x / y) – 7
b) x / (y * 8) – 10y

You might also like