Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Print out and Exlpain (http://www.go4expert.com/forums/print-exlpain-t22054/)

ahmed-mii 10May2010 00:02

Print out and Exlpain
 
Hi,the program is Binary Search ,but how do I print out two digits this is the code.
Code:

org 0x0100 
            ;mov  [swap],0
            mov cx,1
            jmp start
           
   
    data:  dw 60,80,0,50,70,90,20,30,10,40
   
    swap:  db 0
             
   
   
    start:  mov bx,0
            mov byte [swap],0   
           
    loopl:  mov ax, [data+bx]
            cmp ax, [data+bx+2]
            jbe noswap
           
           
           
            mov dx,[data+bx+2]
            mov [data+bx+2],ax
            mov [data+bx],dx
            mov byte[swap],1
           
           
       
    noswap: add bx,2
            cmp bx,18
            jne loopl
           
            ;xopr [swap],[swap]
         
            add cx,1
            cmp cx,10       
            jbe  start
           
           
            mov cx,10
            mov bx,data 
           
    printsorted:
           
           
            mov al, [bx]
            add bx,2 
            or  al, 30h
            mov ah,0eh 
            int 10h
            sub cx,1
            jnz printsorted

            mov ax,0x4c00           
            int 0x21

I'm waiting.. :D:D

xpi0t0s 10May2010 14:47

Re: Print out and Exlpain
 
How you print one digit is going to be very hardware and software dependent. You need to tell us what processor you're using and what hardware that processor is mounted in.

Are you on a course? If so, there will probably be something in the course notes about how to output data for the user's benefit. Seems odd that you're working on sorting algorithms without having already encountered that.

ahmed-mii 10May2010 20:26

Re: Print out and Exlpain
 
thanks for your reply this program you saw it print out one digit Ok ,but I want to print out two digits the assembler I'm using is NASM and my processor is 32 bit.
So this code you saw for one digit .Is there a way print out to digits if we change the data to 60,80,50. who can I print out them ?Do I need a stack or what??

Code:

org 0x0100
;mov [swap],0
mov cx,1
jmp start


data: dw  6,8,0,5,7,9,2,3,1,4

swap: db 0



start:  mov bx,0
mov byte [swap],0

loopl: mov ax, [data+bx]
cmp ax,  [data+bx+2]
jbe noswap



mov dx,[data+bx+2]
mov  [data+bx+2],ax
mov [data+bx],dx
mov byte[swap],1



noswap:  add bx,2
cmp bx,18
jne loopl

;xopr [swap],[swap]

add  cx,1
cmp cx,10
jbe start


mov cx,10
mov bx,data

printsorted:


mov  al, [bx]
add bx,2
or al, 30h
mov ah,0eh
int 10h
sub cx,1
jnz  printsorted

mov ax,0x4c00
int 0x21


ahmed-mii 10May2010 23:19

Re: Print out and Exlpain
 
come on guys plz help me

xpi0t0s 11May2010 12:02

Re: Print out and Exlpain
 
I just tried to help you but you ignored my questions. Is it the int 10h that displays the number? Where is the number displayed - on a PC screen? What do you want to change to 60,80,50 (i.e. what is it now, cos I can't see anything in the program that looks like it might change easily to that)? Why do you think you might need a stack?

Don't assume that the development system you're working on is the only one in the world, or that we all know exactly what you're talking about.

ahmed-mii 11May2010 18:59

Re: Print out and Exlpain
 
Ok,thanks I tried to be clear as much as I can you see the program print out one digit .So how can I print out two digits.
Look man I don't know much about the assembly language if you can help out I'll be thankful for you

xpi0t0s 11May2010 21:42

Re: Print out and Exlpain
 
No idea then. If the program prints one digit and you can identify the line that prints that digit, then I would have thought the obvious solution was to duplicate that line.

But I suggest your best bet would be to get hold of a programmer, or ask your tutor. I simply don't have the context available to be able to help you.


All times are GMT +5.5. The time now is 05:17.