0% found this document useful (0 votes)
5 views

Micro

Uploaded by

Fedawak Hailu
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Micro

Uploaded by

Fedawak Hailu
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 11

Ex 1

org 100h

.model small
.data
NUM1 DW 23C5H
NUM2 DW 6789H
result DW?
.code
MOV AX. @data
MOV DS, AX
MOV ES, AX
SUB AX, AX
MOV AX, NUM1
MOV BX, NUM2
ADD AX,BX
MOV RESULT, AX

Ret

Ex 1.1
org 100h
.data
msg: db "Hello, World! $"
.code
mov ax, @data
mov ds, ax
mov dx, msg
mov ah, 09h
int 21h
Ret

Ex 1.2
org 100h
Title 8086 ALP to find the sum of the numbers in the array
.model small
data
x db 63h,32h,45h,75h,12h,42h,09h,14h,56h,38h
sum dw 0
.code
xor di,di
mov cl,10
lea bx,x
back: mov al, [bx+di]
mov ah, 00h
add sum,ax
inc di
dec cl
Jnz back
ret

Ex 1.3
org 100h
mov al,34h
mov cl,38h
add al,cl
aaa
mov al,38h
mov cl,32h
sub al,cl
aas

mov al,32h
mov cl,38h
aas

mov al,36h
mov cl,34h
mul cl
aam

mov ax,0403h
mov cl,07h
aad
div cl

ret

Ex 1.4
org 100h

.model small
.data
NUM1 DW 23CSH
NUM2 DW 6789H
result DW?
.code
MOV AX, @data
MOV DS, AX
MOV ES, AX
SUB AX, AX
MOV AX, NUM1
MOV BX, NUM2
ADD AX, BX
MOV RESULT, AX
Ret

Ex 1.5

org 100h
#start-simple.exef#
In al, 110
in ax, 112
out 110,al
out 112, ax
ret

Ex 2
org 100h
.MODEL small
.CODE
MOV AH,00H
MOV AL, 39h ; for subtraction replace with
ADD AL, 31h ;SUB AL,31h
AAA ;AAS
ADD AX, 3030h
Ret

Ex 2.1
org 100h
mov ah,02
mov dl, 65h
int 21h
ret

Ex 2.2
org 100h
title binary to ASCII convertion
.model small
.code
mov al, 33h
call bta
mov ah, 4ch
int 21h
bta proc near
mov ah,0
aam
add ax, 3030h
mov bx, ax
mov dl, bh
mov ah, 02
int 21h
mov dl, bl
int 21h
ret

Ex 2.3?
org 100h
mov al,39h
mov cd,12h
add al,cl
daa

mov al,96h
mov bl,07h
add al,bi.....

Ex 2.4

org 100h
.MODEL small
.CODE
MOV AH,00H
MOV AL, 39h ;for subtraction replace with
SUB AL,318
ADD AL, 31h ;SUB AL,318
AAA ;AAS
ADD AX, 3030h
Ret

Ex 2.5

org 100h
#start=led_display.exell
mov ax,0000h
out 199,ax
back1: mov bl, 0ah
back2: mov al, bl
out 199, al
call delay
dec bl
cmp bl, 255
je back1
jmp back2
delay proc near
mov cx, 00aah
back3: dec cx
jnz back3
ret

Ex 3

org 100h
mov ah,01
int 21h
ret

Ex 3.1
org 100h
.model small
.code
mov ax, 12abh
call d_hex
mov ah, 4ch
int 21h
d_hex proc near
mov cl, 04h
mov ch, 04h
back: rol ax, cl
push ax
and al, Ofh
cmp al, 9
Jbe add30
add al, 37h
jmp disp
add30: add al, 30h
disp: mov ah, 02h
mov di, al
int 21h
pop ax
dec ch
jnz back
ret

Ex 3.2
org 100h
mov bx,1234h
inc bx
inc bx
dec bx
neg bx
mov ax,0102h
mov cx,0101h
cmp ax,cx
cmp ax,0102h
ret

Ex 3.3
org 100h
MODEL SMALL
.DATA
Array1 DW 1111h,2222h, 3333h, 4444h, 5555h
Array2 DW 5 DUP (0)
Count DW 0005H
.CODE
MOV AX, @DATA
MOV DS,AX
LEA SI,Array1
LEA DI,Array2
MOV CX, Count
NEXT: MOV AX, [SI]
MOV [DIJ,AX
INC SI
INC SI
INC DI
INC DI
LOOP NEXT
Ret

Ex 3.4
org 100h

mov bx,1234h
inc bx
inc bx
dec bx
neg bx

mov ax,0102h
mov cx,0101h
cmp ax,cx
cmp ax,0102h

ret

Ex 4?
Ex 4.1?

EX 4.2

org 100h
mov di,0022h
lea ax,[bx][di]
mov [0010h],7895h
mov [0012h],1258h
Ids ax, [0010h]
ret

EX 4.3
org 100h
.MODEL SMALL
.DATA
Array1 DW 1111h, 2222h, 3333h, 4444h,5555h
Array2 DW 1010h, 2020h, 3030h, 4040h,5050h
Count DW 0005h
.CODE
MOV AX,@DATA
MOV DS,AX
LEA SI,Array1
LEA DL,Array2
MOV CX,Count
NEXT: MOV BX,[SI]
MOV DX,[DI]
XCHG BX,DX
MOV [SI],BX
MOV [DI],DX
INC SI
INC SI
INC DI
INC DI
LOOP NEXT
Ret

Ex 4.4

org 100h
mov di,0022h
lea ax,[bx][di]

mov [0010h],7895h
mov [0012h),1258h
Ids ax, [0010h]

ret

Ex 4.5???
#start=thermometer.exe#
start:
in al, 125
cmp al, 60
jl low
cmp al, 80
jle ok
ig high
low:
mov al, 1.............

Ex-5
title addition of 3x3 matrix
org 100h
.model small
.data
m1 db 10h,20h, 30h,40h, 50h,60h, 70h, 80h, 90h
m2 db 10h, 20h,30h, 40h, 50h, 60h, 70h, 80h,90h
result dw 9 dup(0)
.code
mov ax, @data
mov ds, ax
mov cx, 9
mov di, offset m1
mov bx, offset m2
mov si, offset result
back: mov ah, 0
mov al, [di]
add al, [bx]
adc ah, 0
mov [si], ax
Inc di
Inc bx
inc si
inc si
loop back
ret

Ex-5.1
org 100h
.MODEL TINY
.CODE
MOV AX, 1234h
MOV BX, 7698h
ADD AL, 31h ; for Division replace with
MUL BX ;DIV BX
END
Ret

Ex-5.2
org 100h
.data
message1 db 'what is your name? ','$'
buffer db 9,?,9 DUP(0)
mes db cr, If, 'The number of letters in your name is: ','$'
cr equ 0dh
If equ 0ah
.code
mov ax,@data
mov ds,ax
mov ah,09
lea dx,message1
int 21h
mov ah, 0ah
lea dx, buffer
int 21h
lea bx,buffer
mov cl,[bx+1]
or cl,30h
mov mes+40,cl
mov dx, offset mes
mov ah,09h
int 21h
ret

Ex-5.3

org 100h
#start=Traffic_Lights.exef#
mov ax,0000h
out 4,ax
back: mov ax, 030ch ;N-S green and W-E red
out 4, ax
call delay_g
mov ax, 0492h ;all direction yellow
out 4, ax
call delay_y
mov ax, 0861h ;N-S red and W-E green
out 4, ax
call delay_g
mov ax, 0492h ;all direction yellow
out 4, ax
call delay_y
jmp back
delay_g proc near
mov cx, 004fh
back1: nop
loop back1
delay_y proc near
mov cx, 002fh
back2: nop
loop back2
ret

Ex-5.4
org 100h

mov al, 12h


mov bl,34h

and al,bl
or al,bl
xor al,bl

test al, 12h


not bl
ret

Ex 6
org 100h
Title 8085 ALP to find the maximum number in the array
model small
data
adb 63h, 32h,45h, 75h, 12h 42h, 09h, 14h, 56h, 38h
max db 0
.code
mov ax, @data
mov ds,ax
xor di,di
mov cl,10
lea bx,x
mov al,max
back: cmp al, [bx+di]
jnc skip
mov dl, [bx+di]
mov aldi
skip: Inc di
dec cl
Jnz back
mov max,al
art: mo 01
ret

Ex 6.1
org 100h

.MODEL TINY
.CODE
MOV AX,-1234h
MOV CX,-1BCAh
IMUL CX
Ret

Ex 6.2
org 100h
mov ah,07
int 21h
mov bl, al
mov ah, 02
mov dl, '*'
int 21h
ret

Ex 6.3
org 100h

push Offffh
popf
pushf

ret

Ex 7
org 100h
.data
a db 12h,34h,56h
b db 5 dup(0)
.code
cld
lea si,a
lea di, b
mov cox, 03h
rep movsb
ret

Ex 7.1
org 100h
.MODEL SMALL
.DATA
Number DW OFFFFh
Ans DW 2 DUP (?)
.CODE
MOV AX, @DATA
MOV DS, AX
MOV DX, 0000h
MOV AX, Number
MUL Number
MOV Ans, AX
MOV Ans+2, DX
Ret

Ex 7.2
org 100h
mov ah,2ch
int 21h
ret

Ex 7.3?

org 100h
mov bl,34h
sal bl,1
mov cl,05h
shl bi,cl......CONT

Ex 8
org 100h
mov bx,1234h
mov cx,7896h
xchg cx,bx
push Offfth
popf
lahf
sahf
ret

Ex 8.1
org 100h

NAME Average
PAGE 52, 80
TITLE 8086 ALP to find average of two numbers
.model small
.stack 100
.data
no1 DD 8111FFFFH
no2 OD 92224444H
result DD ?
carry DB 0
code
MOV AX, @data ;initialises
MOV DS, AX ;data segment
MOV AX, word ptr nol
ADD AX, word ptr no2
MOV word ptr result, AX
MOV BX, OFFSET[no1]
MOV AX, WORD PTR(BX+2]
MOV BX, OFFSET[no2]
ADC AX, WORD PTR[Bх+2]
MOV BX, OFFSET result
MOV [BX+21], AX
ADC carry, 0
Ret

Ex 9.1
org 100h

NAME Average
PAGE 52,80
TITLE 8086 ALP to find average of two numbers
model small
stack 100
data
no1 DB 63H
no2 DB 2EH
Avg DB?
.code
MOV AX, data ;initialises
MOV DS, AX ;data segment
SUB AX, AX
MOV Al, no1
ADD AL, no2
ADC AH, 00H ;put carry in AH
MOV CL, 02H
DIV CL ;divide sum by 2
MOV Avg. AL ;copy result to memory
MOV Aug+1, AH

ret

You might also like