الاثنين، 24 مارس 2014
2:35 م

Define Data in assembly

mov value from location in dt1 to dt2:-
org 100h 

.data
dt1 db 10
dt2 db 0  

.code
mov si,offset dt1
mov di,offset dt2

mov ax,@data
mov ds,ax

mov al,[si]
mov [di],al 

ret

find area of square and put solution in dt2:-
org 100h 

.data
dt1 db 2,4,8
dt2 db 3 dup(0)  // for put zero in 3 location at once

.code
mov si,offset dt1
mov di,offset dt2

mov ax,@data
mov ds,ax

mov cx,0003h
label:
mov ax,0000h
mov al,[si]
mul al 
mov [di],al
inc si
inc di 
loop label
ret


add 20 to offset dt1(si) and put solution in dt2(di):-
org 100h 

.data
dt1 db 1,2,3,4,5,6,7,8,9,10
dt2 db 10 dup(0)  

.code
mov si,offset dt1
mov di,offset dt2

mov ax,@data
mov ds,ax

mov cx,000ah
label:
mov ax,0000h
mov al,[si]
add al,20h 
mov [di],al
inc si
inc di 
loop label
ret



0 التعليقات:

إرسال تعليق