Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

User input help 2

user input

  • Please log in to reply
3 replies to this topic

#1 untitled_1

untitled_1

    CC Addict

  • Validating
  • PipPipPipPipPip
  • 129 posts
  • Location:3rd rock from the sun
  • Programming Language:C, C++, Delphi/Object Pascal, Assembly
  • Learning:Python, Perl, Ada, Fortran, Bash

Posted 06 November 2010 - 03:32 AM

Hi all...i can get the input and store it in memory( used debug to check )..i want to print the input on screen but the program is looping( showing prompt and waiting for input ) for some mysterious reason when i call int 20 to show input...following code:

org 100h

jmp main

message: db 'Enter your name please $'

;input_buffer
in_buf: db 20 ;length of input buffer
len_in: db 00 ;length of input string will be strored by dos
user: times 20 db ' ' ;reserve 20 storage positions for input buffer

cr_lf:
	db 13, 10, '$' ;carriage return/line feed
	
disp_prompt:
	mov ah, 09 ;function to print string to string
	mov dx, message ;address of prompt
	int 21h ;show prompt message on screen
	mov ah, 0ah ;function for string input
	mov dx, in_buf ;address of input buffer
	int 21h ;wait for input
	mov ah, 09 
	mov dx, cr_ lf ;address of 0ah and 0dh
	int 21h ;move to new line on screen
	ret
	
display:
	mov dx, user ; address of resulting user input string 
	mov ah, 09 
	int 21h ;display user input
	

main:
	call disp_prompt
	call display
	
        int 20h

Edited by dargueta, 06 November 2010 - 06:50 PM.

  • 0

#2 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Assembly, Bash, Others
  • Learning:Objective-C

Posted 06 November 2010 - 06:55 PM


display:

	mov dx, user ; address of resulting user input string 

	mov ah, 09 

	int 21h ;display user input

	[COLOR="RED"][B]ret[/B][/COLOR]


  • 0

sudo rm -rf / && echo $'Sanitize your inputs!'


#3 untitled_1

untitled_1

    CC Addict

  • Validating
  • PipPipPipPipPip
  • 129 posts
  • Location:3rd rock from the sun
  • Programming Language:C, C++, Delphi/Object Pascal, Assembly
  • Learning:Python, Perl, Ada, Fortran, Bash

Posted 06 November 2010 - 10:24 PM

oh what a fool i was....thank u
  • 0

#4 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Assembly, Bash, Others
  • Learning:Objective-C

Posted 06 November 2010 - 11:46 PM

Yeah, it took me a while to find it.
  • 0

sudo rm -rf / && echo $'Sanitize your inputs!'






Also tagged with one or more of these keywords: user input

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download