










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











Lab 7
Arrays Addressing Modes Operators Assignment
Dup operator Array1 Db 20 dup(0) Array2 Db 20 dup(?) Array3 Db 4 dup(“ABC”) Array4 DW 4 dup(0)
How to access them??
Register Addressing: MOV AX,BX
Immediate Addressing: MOV AX,
Form 2: Displacement Addressing Mov al,[1234H] By default the address is in data segment but we can override that Mov al, cs:[1234h]
Data db 0 Mov Al, data
How to access data db 0,1,2,3,
Mov al, data
Mov al, data+
Mov al, data+
Exercise: data dw 0,1,2,3,
OFFSET operator TYPE operator Returns the size,in bytes, of a single element of a variable Var1 db? Var2 db 10,20,30, Mov ax, type var Mov ax, type var
Length operator Counts the number of individual elements in a variable that has been defined using DUP. If dup is not used then it returns value of 1 Val1 dw 1000h Val2 db 10,20, Val3 db 32 dup(0) Val1, val2 have length 1, val3 has length 32
Register Indirect Offset is held in BX, DI, SI, BP Mov AX,[BX] BX=1000H, DS =0100H which memory locations are accessed? 0100*10H+ 1000H =2000, 2001H
Segment defaults If BX,DI, SI is used DS is the default register If BP is used then stack segment register Overriding Mov al, cs:[si]
Other section lab: To find if a number is even or odd
Input a string Input a multiple digit number Output a multiple digit number
Write a program that takes 10 numbers from user and allocate it to the array Write a program to copy one array to another Write a program to sum all the array elements Write a program to find the average of an array