Hello i am really just a begginner in assembly (TASM).
anyway, my program is quite simple it is tasked to just ask the user's name and ID number. after which i have to print "hello <name> your ID is <number>"

but I cant seem to print both of them at the same line. the second user input seems to over write the first user input for some odd reason.

the out put should be:
hello, <name> your ID is: <number>

but it keeps getting over written and usually its like
hello, <number> or <number> <part of name>

help please?

 TITLE simple proj
         DOSSEG
         .model SMALL
         .stack 100h
         .data
GREET    db "Hello, $"
PNAME    db "Name: $"
SNAME    db 24 dup("$")
CRLF     db 13,10,"$"
PID      db "ID# : $"
SID      db 12 dup("$")
URID     db "! Your ID number is: $"

         .code

BEGIN:mov ax, @data
          mov ds, ax
          mov es, ax


          mov al, 03h               ; clear screen
          mov ah, 00h
          int 10h



         mov dx, OFFSET PNAME       ; Print NAME: 
          mov ah, 09h               
          int 21h                   


          mov byte ptr SNAME, 21
          mov dx, OFFSET SNAME      ; scanf Name        
          mov ah, 0Ah
        int 21h

        mov dx, OFFSET CRLF     ; print \n
          mov ah, 09h
          int 21h

          mov dx, OFFSET PID        ; Print ID:         
          mov ah, 09h
          int 21h


          mov byte ptr SID, 9
          mov dx, OFFSET SID        ; Scanf ID          
          mov ah, 0Ah
          int 21h


         mov    dx, OFFSET CRLF     ; print \n
          mov ah, 09h
          int 21h


        mov dx, OFFSET GREET    ; print Hello,
          mov ah, 09h
          int 21h


          mov SI, 0002
          lea DX, SNAME[SI]         ; Print Name Entered
          mov ah, 09h
          int 21h


        mov dx, OFFSET GREET        ; print URID
          mov ah, 09h
          int 21h


        mov SI, 0002
          lea DX, SID[SI]       ; Printf ID Entered
          mov ah, 09h
    int 21h


          mov ah, 4ch
          int 21h
          end BEGIN
Name:    
~~~~~~~~~~~~~~~~~~1
Name:    
~~~~~~~~~~~~~~~~~~2
Name: namae (enter)    
~~~~~~~~~~~~~~~~~~3
Name: namae (enter)
ID:    
~~~~~~~~~~~~~~~~~~4
Name: namae (enter)
ID: 111 (enter)    
~~~~~~~~~~~~~~~~~~5
Name: namae (enter)
ID: 111 (enter)
Hello,  
~~~~~~~~~~~~~~~~~~6
Name: namae (enter)
ID: 111 (enter)
Hello, namae
~~~~~~~~~~~~~~~~~~7
Name: namae (enter)
ID: 111 (enter)
! Your ID# is 111
~~~~~~~~~~~~~~~~~~8

your current output is as shows :D
i notice that from part 8 it over writes a line from line 7 ,
you wanted to write it in 1 line right?

i am quite rusty on x86 ASM though, hope this info helps to the people who could answer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.