Thank you very much for your reply expert for your reply,but I have alreday know my error,
But can I ask you another question,
Can you give me a short and simple code for bubble sort in assembly programming.
Thankyou.
Main Topics
Browse All TopicsHi experts,
I dont know whats the error in this code,please help me to convert the numbers
data segment
count DW 8
BIN DW 8 dup(0)
HEX DB '0,1,2,3,4,5,6,7,8,9,A,B,C
msg0 DB 'Enter number $'
msg1 DB 'Decima1 is $'
msg2 DB 'Hexadecimal is $'
msg3 DB 'Sorry,Wrong number!$'
data ends
working_storage segment stack
dw 100h dup(?)
working_storage ends
code segment
assume cs:code,ds:data,ss:working
extrn putdec:proc,putcrlf:proc,g
start:
mov ax,data
mov ds,ax
go: mov Dx,offset msg0
mov ah,9h
int 21h
call putcrlf
call getdec
cmp ax,255
jae finish
mov bx,ax
mov cx,2
mov dx,offset msg1
mov ah,9h
int 21h
mov count,8
mov si,0
repeat:
mov ax,bx
mov dx,0
div cx
cmp ax,0
jz done
mov BIN[si],dx
inc si
inc si
dec count
jnz repeat
done: mov si,14
mov BIN[si],dx
do: mov ax,BIN[si]
call putdec
dec si
dec si
jnz do
next: mov ax,bx
mov cx,16
mov si,16
again:div cx
mov HEX[si],dx
cmp ax,0
jnz again
dec si
jnz again
yes:call putcrlf
mov dx,offset msg2
mov ah,9h
INT 21h
mov ax,HEX[si]
call putdec
call putcrlf
jmp go
finish:mov dx,offset msg3
mov ah,9h
INT 21h
mov ax,4c00h
int 21h
code ends
end start
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here's pseudocode for the bubble sort algorithm :
http://en.wikipedia.org/wi
It shouldn't be too difficult to convert it to assembler.
I already did ask for the reason for deleting this question ;) Here : http:#21951813
Business Accounts
Answer for Membership
by: Infinity08Posted on 2008-05-07 at 01:27:32ID: 21514177
>> I dont know whats the error in this code,
What is the problem ? What behavior do you see that is not correct ? Anything you can tell us, can help us find the problem :)