You are using stack to store the keys pressed, and it works as a LIFO structure (Last-In First-Out), so, the last character entered will be the first to be displayed.

why are you using this?
n2:    
       pop ax  
       mov bx,ax
       push bx
       loop n2

That instructions maintain the stack status intact, since you pop a value out, and push it back immediately onto the stack (doing that operation 6 times).


I suggest you to store the key pressed in a variable, for example, declare:

keys db 6 dup(?)

Jaime

-----Mensaje original-----
De: bena [mailto:[EMAIL PROTECTED]
Enviado el: Martes, 26 de Octubre de 2004 15:37
Para: [EMAIL PROTECTED]
Asunto: [c-prog] plz help for assmebly




i have this assembly programe
that read a name from the user and print it in same order
qustion asked to use stack and int 16
i don't know why not it print it in the same order i do it write
it print in interrupt 21h but in interrupt 16 not working write can
some body tells me why

her is the code


.model small
.stack 100h

.code
       mov cx,6

name1: mov ah,00h
       int 16h
       push ax
       loop name1
      
       mov cx,6

n2:    
       pop ax  
       mov bx,ax
       push bx
       loop n2
       
       mov cx, 6

n3:   pop bx
      mov ah,02h
      mov dx,bx
      int 21h
      loop n3
     
      end
     






To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links










To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=315388.5529720.6602079.3001176/D=groups/S=:HM/A=2372354/rand=677849428


Yahoo! Groups Links

Reply via email to