Professional Documents
Culture Documents
3. function of call
org 100h
call m1
mov ax, 2 output: the value of AX(Al=02)
ret ; return to operating system. the value of BX(Bl=05)
m1 proc
mov bx, 5
ret ; return to caller.
m1 endp
end
4. to display a single character use int 21h/ah/2h
org 100h
mov dl, 'b' ; move 'b' into dl register The output is b will be displayed on
mov ah, 2h ; function to print a character the screen
int 21h ; dos interrupt
endp
org 100h
mov ax, 05h
mov cx, ax The output is on AX(Al=78)
dec cx
back: mul cx
dec cx
jnz back
; results stored in ax
ret
7. org 100h
mov al, 1
mov bl, 2
call m2
call m2
call m2
call m2 The output is on AX(Al=10)
ret ; return to operating system.
m2 proc
mul bl ; ax = al * bl.
ret ; return to caller.
m2 endp
end
8. program to demonstrate rotate instruction
org 100h
stc ; set carry (cf=1).
mov al, 1ch Output: the value of AX(Al=1E)
; al = 00011100b
rcr al, 1
; al = 10001110b,
cf=0.
ret
9. org 100h
mov cx, 5
mov ax, cx Output: the value of AX(Al=0F)
dec cx
calc:add ax,cx
dec cx
jnz calc
ret