org 100h
.data
dt1 dw 500 dup(0)
.code
mov ax,@data
mov ds,ax
mov si, offset dt1
mov bx,1000
mov cx,500
label:
mov [si],bx
add bx,0002
inc si
inc si
loop label
hlt
note: see in memory in two byte CE and 06 equal 1
إظهار الرسائل ذات التسميات Assembly. إظهار كافة الرسائل
إظهار الرسائل ذات التسميات Assembly. إظهار كافة الرسائل
الاثنين، 5 مايو 2014
الخميس، 24 أبريل 2014
َQ6:datasheet to find y=x2-10+x in assembly
org 100h
.data
dt1 db 1,2,3,4,5,6,7,8,9,10
dt2 db 10 dup(0)
.code
mov ax,@data
mov ds,ax
mov si,offset dt1
mov di,offset dt2
mov cx,0ah
lable:
mov ax,[si]
mov bx,2
mul bx
sub ax,10
add ax,[si]
mov [di],ax
inc si
inc di
loop lable
ret
1:59 م
الاثنين، 7 أبريل 2014
Q9:datasheet find sum and average
org 100h
.data
dt1 db 1,2,3,4,5,6,7,8,9,10
dt2 db 2 DUP(0)
.code
mov ax,@data
mov ds,ax
mov si,offset dt1
mov di,offset dt2
MOV CX,0aH
MOV Ax,0000H
MOV BX,0000H
label:
MOV Bl,[si]
ADD Ax,Bx
INC SI
LOOP label
MOV [DI],Ax
MOV BL,0ah
DIV BL
inc di
MOV [DI],Ax
hlt
11:00 م
Q4:datasheet
org 100h
.data
dt1 dB 55,45,10,64,96
dt2 db 1 DUP(0)
.code
mov ax,@data
mov ds,ax
mov si,offset dt1
mov di,offset dt2
MOV CX,5H
MOV Ax,0000H
MOV BX,0000H
label:
MOV Bl,[si]
ADD Ax,Bx
INC SI
LOOP label
MOV BL,5H
DIV BL
MOV [DI],Ax
hlt
ret
10:51 م
Q1:datasheet find area of square
org 100h
.data
dt1 db 1,2,3,4,5,6,7,8,9,10
dt2 db 10 cup(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,000ah
label:
mov ax,0000h
mov al,[si]
mul al
mov [di],al
inc si
inc di
loop label
ret
10:40 م
Q3: Convert capital Character to small Character (lowercase)
org 100h
.data
dt1 dB 'COMPUTER'
dt2 db 8 dup(0)
.code
mov ax,@data
mov ds,ax
mov si,offset dt1
mov di,offset dt2
MOV BL,20H
MOV CX,08
label:
MOV AL,[si]
ADD AL,BL
MOV [DI],Al
INC SI
INC DI
LOOP label
hlt
another way :-
-to convert small Character to capital Chara
10:35 م
Q2:data sheet find area of rectangle
org 100h
.data
dt1 db 1,2,3,4,5,6,7,8,9,10
dt2 db 5 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]
inc si
mov ah,[si]
mul ah
mov [di],al
inc si
inc di
loop label
ret
10:31 م
الاثنين، 24 مارس 2014
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&
2:35 م
الاثنين، 17 مارس 2014
string instruction with repeated(REP)
1- move from block to another by using string instruction with repeated(REP) :
org 100h
mov ax,0h
mov ds,ax
mov es,ax
mov si,2000h
mov di,3000h
mov cx,20h // 32 consecutive bytes in hex=20
cld
rep movsb
hlt
2-scan number
4:27 م
string instruction : STOSB
org 100h
mov ax,0h
mov ds,ax // do not need because use (di with es)
mov es,ax
mov di,0a000h
mov al,05h
mov cx,0fh
cld // do not need because only increment
again:
stosb // di <-- al , inc di
loop again // dec cx
hl
3:39 م
new instruction : Call and push,pop
org 100h
mov al,01h
mov ah,01h
mov dl,02h
mov cx,0000h
mov bl,al
call square
add cx,bx
mov bl,ah
call square
add cx,bx
mov bl,dl
call square
add cx,bx
square:
push ax
mov al,bl
mul bl
mov bx,ax
pop ax
ret
hlt
note : CX must be = 6
3:04 م
الاشتراك في:
الرسائل (Atom)