Author Topic: Double input problems  (Read 6146 times)

MAugustyniak

  • Guest
Double input problems
« on: October 09, 2005, 11:22:55 AM »
I'm trying to write this simple program where I get NASM to input two different strings and then I output them separately, I'll be outputting the second one backwards once I get my program to work.

The problem is that after the first input, I get the message requesting the second output but then it goes straight into input. is it actually possible to input more then one value in NASM?

Here's the code:

segment .data
   msg1 db   'Type-in 25 characters of text: ',0xA
   ln1 equ $-msg1

msg2 db 'Type-in another 25 characters of text: ',0xA
   ln2 equ $-msg2

msg3 db 'Your first inupt is: ',0xA
   ln3 equ $-msg3

msg4 db 'Your second input is:'
   ln4 equ $-msg4

spacer db ' ',0xA,0xA
   lns equ $-spacer

segment .bss
   input1 resb 25
   input2 resb 25

segment .text
   global _start

_start:
   mov eax,4
   mov ebx,1
   mov ecx,msg1
   mov edx,ln1
   int 0x80

mov eax,4
   mov ebx,1
   mov ecx,spacer
   mov edx,lns
   int 0x80

mov eax,3   ;first input
   mov ebx,0
   mov ecx,input1
   int 0x80

mov eax,4
   mov ebx,1
   mov ecx,spacer
   mov edx,lns
   int 0x80

mov eax,4   ;output of second message
   mov ebx,1
   mov ecx,msg2
   mov edx,ln2
    int 0x80

mov eax,4
   mov ebx,1
   mov ecx,spacer
   mov edx,lns
   int 0x80   

mov eax,3   ;second input
   mov ebx,0
   mov ecx,input2
   int 0x80

mov eax,4
   mov ebx,1
   mov ecx,spacer
   mov edx,lns
   int 0x80

final_output:

mov eax,4   ;outputting the first input
   mov ebx,1
   mov ecx,input1
   int 0x80

mov eax,4
   mov ebx,1
   mov ecx,spacer
   mov edx,lns
   int 0x80

mov eax,4
   mov ebx,1
   mov ecx,input2

int 0x80

exit:
   mov eax,1
   int 0x80

MAugustyniak

  • Guest
Re: Double input problems
« Reply #1 on: October 09, 2005, 12:18:25 PM »
I got it, I didn't know youactually had to specify max size for input so it workx now.