مشاهدة النسخة كاملة : micr lab
أميرة قوس النصر
10-25-2009, 08:31 PM
ان شاء الله رح ازودكم ببرامج اكيده ل (micr lab)
وهاد الموضوع يارب يفيدكم
أميرة قوس النصر
10-25-2009, 08:33 PM
.model small
.stack 100h
.data
msg1 db 'enter 1st nub',0ah,0dh,'$'
msg2 db 0ah,0dh,'enter 2nd nub',0ah,0dh,'$'
msg3 db 0ah,0dh,'display sum',0ah,0dh,'$'
msg4 db 0ah,0dh,'display difference',0ah,0dh,'$'
x db ?
y db ?
.code
main proc
mov ax,@data
mov ds,ax
;display 1st msg
lea dx ,msg1
mov ah,9
int 21h
mov ah,1 ;insert 1st num from key
int 21h
sub al,30h
mov [x],al
;display msg2
lea dx ,msg2
mov ah,9
int 21h
mov ah,1 ;insert 1st num from key
int 21h
sub al,30h
add al,[x]
mov [y],al
lea dx,msg3 ;display the op
mov ah,9
int 21h
mov dl,[y]
add dl,30h
mov ah,2
int 21h
lea dx,msg4
mov ah,9
int 21h
sub [x],al
mov dl,[x]
add dl,30h
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:35 PM
; this program to insert and display variables with two digits
; by using variable declaration
.model small
.stack 100h
.data
endl db 0dh,0ah,'$'
msg1 db "insert a number of 2-digits",'$'
var db 2 dup(?)
.code
main proc
mov ax,@data
mov ds,ax
; to insert the 2-digit number
lea dx,msg1
mov ah,9
int 21h
;insert higher digit
mov ah,1
int 21h
sub al,30h
mov [var],al
;insert second digit
mov ah,1
int 21h
sub al,30h
mov [var+1],al
;display the inserted number
mov dl,[var]
add dl,30h
mov ah,2
int 21h
mov dl,[var+1]
add dl,30h
mov ah,2
int 21h
;terminate
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:37 PM
this program for variables with two digits
; by ex:96=9*10 +6
; insert two numbers and find sum of inserted two numbers
.model small
.stack 100h
.data
endl db 0dh,0ah,'$'
msg1 db "insert a number of 2-digits",'$'
var1 db ?
var2 db ?
.code
main proc
mov ax,@data
mov ds,ax
; to insert the first 2-digit number
lea dx,msg1
mov ah,9
int 21h
;insert higher digit of first number
mov ah,1
int 21h
sub al,30h
mov bl,al
mov bh,0
mov ax,0
mov ax,bx
mov bl,0ah
mul bl
mov bx,ax
mov ah,1
int 21h
sub al,30h
add bl,al
mov [var1],bl
mov ax,0
mov bx,0
; to insert the second 2-digit number
lea dx,msg1
mov ah,9
int 21h
;insert higher digit of second number
mov ah,1
int 21h
sub al,30h
mov bl,al
mov bh,0
mov ax,0
mov ax,bx
mov bl,0ah
mul bl
mov bx,ax
mov ah,1
int 21h
sub al,30h
add bl,al
mov [var2],bl
mov bx,0
mov ax,0
; store sum in bx
mov al,[var1]
add al,[var2]
;diplay
mov bl,0ah
div bl
mov cl,al
mov ch,ah
add cl,30h
add ch,30h
mov dl,cl
mov ah,2
int 21h
mov dl,ch
mov ah,2
int 21h
;terminate
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:39 PM
; this program to find sum and differance for two 1-digit variables.
; and store the results in the data segment.
.model small
.stack 100h
.data
x db ?
y db ?
sum db ?
dif db ?
msg1 db 0ah,0dh,"enter a number",'$'
msg2 db 0ah,0dh,"the sum = ",0ah,0dh,'$'
msg3 db 0ah,0dh,"the dif = ",0ah,0dh,'$'
.code
main proc
mov ax,@data
mov ds,ax
; insert first number
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
; svae the number in x
sub al,30h
mov [x],al
; enter second number
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
; svae the number in y
sub al,30h
mov [y],al
; to find the sum
mov al,[x]
mov bl,[y]
add al,bl
mov [sum],al
;find dif
mov al,[x]
mov bl,[y]
sub al,bl
mov [dif],al
; display the sum
lea dx,msg2
mov ah,9
int 21h
mov dl,[sum]
add dl,30h
mov ah,2
int 21h
;display the dif
lea dx,msg3
mov ah,9
int 21h
mov dl,[dif]
add dl,30h
mov ah,2
int 21h
;terminate
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:41 PM
; this code is to print three text on the screen
.model small
.stack 100h
.data
msg1 db "jordan is my country",0ah,0dh,'$'
msg2 db 'irbid is my city',0ah,0dh,'$'
msg3 db 'BAU is my university',0ah,'$'
.code
main proc
mov ax,@data
mov ds,ax
; first string printing
lea dx,msg1
mov ah,9
int 21h
; second string printing
lea dx,msg2
mov ah,9
int 21h
;third string printing
lea dx,msg3
mov ah,9
int 21h
; program termination
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:44 PM
.model small
.stack 100h
.data
msg1 db "please enter a number first number",0ah,0dh,'$'
msg2 db "please enter the second number",0ah,0dh,'$'
msg3 db "the sum is",0ah,08h,'$'
msg4 db "the dif is",0ah,08h,'$'
sum db ?
dif db ?
.code
main proc
mov ax,@data
mov ds,ax
; display first msg
lea dx,msg1
mov ah,9h
int 21h
; read first number
mov ah,1
int 21h
; store first number in bl
mov bl,al
sub bl,30h
; display second msg
lea dx,msg2
mov ah,9h
int 21h
; read second number
mov ah,1
int 21h
; store second number in cl
mov cl,al
sub cl,30h
; find the sum and differance
mov al,0
add al,bl
add al,cl
mov sum,al
mov al,bl
sub al,cl
mov dif,al
;to display the sum
lea dx,msg3
mov ah,9
int 21h
mov dl,sum
add dl,30h
mov ah,2
int 21h
;to display the dif
lea dx,msg4
mov ah,9
int 21h
mov dl,dif
add dl,30h
mov ah,2
int 21h
; program termination
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:47 PM
; program to determin the max value between three numbers
.model small
.stack 100h
.data
msg1 db " eneter 3 numbers",0ah,0dh,'$'
msg2 db "the max is ",0ah,0dh,'$'
num1 db ?
num2 db ?
num3 db ?
.code
main proc
mov ax,@data
mov ds,ax
; read 3 number
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h
mov [num1],al
mov ah,1
int 21h
sub al,30h
mov [num2],al
mov ah,1
int 21h
sub al,30h
mov [num3],al
; the comparsion section
;start with the max msg
lea dx,msg2
mov ah,9
int 21h
mov bl,[num1]
mov cl,[num2]
cmp bl,cl
jl else1
cmp bl,[num3]
jl else1
max1:
mov dl,[num1]
jmp print
else1:
cmp cl,[num1]
jl else2
cmp cl,[num3]
jl else2
max2:
mov dl,[num2]
jmp print
else2:
mov dl,[num3]
print:
add dl,30h
mov ah,2
int 21h
exit:
;terminator
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:48 PM
; program to determin the max value between two numbers
.model small
.stack 100h
.data
msg1 db " eneter two numbers",'$'
msg2 db "the max is ",'$'
num1 db ?
num2 db ?
.code
main proc
mov ax,@data
mov ds,ax
; read two number
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h
mov [num1],al
mov bl,al
mov ah,1
int 21h
sub al,30h
mov [num2],al
cmp bl,[num2]
jg max1
lea dx,msg2
mov ah,9
int 21h
mov dl,[num2]
add dl,30h
mov ah,2
int 21h
jmp exit
max1:
lea dx,msg2
mov ah,9
int 21h
mov dl,[num1]
add dl,30h
mov ah,2
int 21h
exit:
;terminator
mov ah,4ch
int 21h
main endp
end main
أميرة قوس النصر
10-25-2009, 08:49 PM
; program to determin if the input character is lower or upper
.model small
.stack 100h
.data
msg1 db "char is upper case",'$'
msg2 db "char is lower case",'$'
.code
main proc
mov ax,@data
mov ds,ax
; read a char
mov ah,1
int 21h
cmp al,97
jge lower
lea dx,msg1
mov ah,9
int 21h
jmp exit
lower:
lea dx,msg2
mov ah,9
int 21h
exit:
;terminator
mov ah,4ch
int 21h
main endp
end main
Powered by vBulletin™ Version 4.2.0 Copyright © 2024 vBulletin Solutions, TranZ by Almuhajir