954,490 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

String user input display. HELP!!!

0
By Jreynolds3 on Mar 26th, 2010 8:10 am

Hey people. What I'm trying to do is get a String input from the user. And then displaying that string. I have no idea how to do it. I have most of the code figured out except that one part. Any help will be greatly appreciated! Thanks!! (By the way I'm just learning Assembly Language. I'm more used to Java)

TITLE Echo			(echo.asm)

INCLUDE Irvine32.inc
.data
	str1 BYTE "Please enter a name: ",0
	buffer BYTE 80 DUP(0)
	
.code
main PROC

	mov	edx, OFFSET str1
	call WriteString
	
	mov eax, OFFSET buffer
	mov ebx, SIZEOF buffer
	call ReadString

	exit		; exit to operating system
main ENDP


END main

I changed the name because ECHO is a dos command.

; anEcho : Compiled with A86 (http://eji.com/a86/)
; This program shows how to get user input with echo.
; 
	mov ah, 09h
	mov dx, askName;
	int 21h			; Ask for user name
	
	mov cx, 0ah
	mov si, userName		; Place to store the user name
getName:
	mov ah, 01h
	int 21h			; Get input with echo
	
	cmp al, 0dh		; 
	je printQuit		; Quit if Carriage-return
	
	mov [si], al		; Put entered char in user name
	inc si			; move the position
	loop getName;		; Keep going (looping)
printQuit:
	mov ah, 09h
	mov dx, b4userName;
	int 21h			; Print the finished user name
quit:
	int 20h			; *** DROP TO DOS ***
	
askName:	db 'Enter your name (up to 10 chars) and press enter: $'
b4UserName:	db 0dh, 0ah
userName:	db '$$$$$$$$$$$$$$$$'
thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

Which assembler are you using?

Goalatio
Junior Poster in Training
72 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

How to make the display of the username all CAPITAL LETTERs?
How to count and display how many letters are present?

cray
Newbie Poster
1 post since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

hi, in reference to the query of Jreynolds3 on Mar 25th, 2010, what about if the assembler is tasm? please respond. thank you! vanessa.

vhan
Newbie Poster
1 post since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You