bit reversal and sorting programs [ assembly language ]
1)bit reversal(FOR 16 BIT)
MOV CX,0010 ;count=16 (16 bit)
MOV AX,[1100];16 bit input
MOV BX,0000;result
L1:SHL AX,01;each bit of input inserted into BX in opp direc
RCR BX,01
LOOP L1
MOV [2000],BX
HLT
2)program to sort an array in acending order
clc
mov cx,[3000h]
dec cx
l1: push cx
mov si,2000
l2:mov ax,[si]
mov bx,[si+2]
cmp bx,ax
jbe l3
xchg ax,bx
mov [si],ax
mov [si+2],bx
l3:inc si
inc si
loop l2
pop cx
loop l1
hlt
just replace 'jbe' by 'jae' to get the descending order program code...
You might be also interested in:
:: Interfacing Analog-to-Digital converter to 8086 using 8255
:: Interfacing Digital-To-Analog converter to 8086 using 8255
:: Temperature Control system using 8086
:: Traffic light control system using 8086
Microprocessor and microcontroller excellent programming.Thank you for giving opportunity
ReplyDeleteRegads.
govt jobs in ap
I like your programming language but the traffic light control system using 8086 not work for me by emu8086(setup) what is my mistake can you tell me
ReplyDeleteI like your programming language but the traffic light control system using 8086 not work for me by emu8086(setup) what is my mistake can you tell me
ReplyDelete