Question

what register does readstring goto?

Asked by: jschmuff

I can't seem to figure out what register my call readstring is going into. Can someone assist me real fast please. I get a symbol for some reason like I called readchar or something.

Here is a sample of what I got.

_user DWORD ?
 
call readstring
mov _user, ebx
 
later in the code I have this being called to display the string entered in by user:
 
mov ebx, _user
call writestring
call waitmsg

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-07-23 at 08:01:48ID24594784
Tags

MASM

,

NASM

,

ASM

,

FASM

,

Assembly

,

Assembler

,

Language

,

Programming

Topics

Assembly Programming Language

,

Programming Languages

,

Miscellaneous Programming

Participating Experts
2
Points
500
Comments
16

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Form1.Color := readstring('Color');
    Hello, I use the following line in Delhpi 3. Form1.Color := readstring('Color'); The error is INCOMPATIBLE TYPES: 'TColor' and 'String'. 'Color' has the value 'clNavy' Who has an solution for me?? Thanks, Vincent
  2. Registers
    How can I acceed windows rgistries ( read and write ). Thank you
  3. Register
    I've made an application that loads a certain file with the extension *.bok This file is loaded from my application through a procedure. I want to know how can i register this extension so when i click on a file with *.bok extension outside my application to start the applic...
  4. How to use ReadString in TiniFile
    I use Delphi 7 When i put data into Ini file Ini := TIniFile.Create(lcfoldername + 'Result.INI') ; Ini.WriteString('USER', 'AAA', lcfoldername); But i could not get data truuly Ini := TIniFile.Create(lcfoldername + 'Result.INI') ; lc := Ini.ReadString('USER', 'AAA', lc ...
  5. Probelm with CStdioFile ReadString
    I'm reading in a file line by line like this: CString strLine; while(!fUserList.ReadString(strLine)) { arUsers.Add(strLine); } the file itself looks like this: mark,p trennum,t yello,y when it hits the while loop it crashes and gives me the error "An unknown er...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Infinity08Posted on 2009-07-23 at 10:21:36ID: 24927647

How is readstring defined ? Look at its implementation, or in the documentation of your assembler toolkit.

 

by: jschmuffPosted on 2009-07-24 at 04:53:16ID: 24933940

That is exactly how I used it in my program,

call readstring
mov _user, ebx

it works when I do

call readint
mov _number, eax

but I cannot figure out which register is taking the string I type in like "milk" for example.

 

by: Infinity08Posted on 2009-07-24 at 05:41:44ID: 24934274

>> That is exactly how I used it in my program,

That's how you call it.

But how is the readstring function defined ? What's its implementation ?

 

by: t0t0Posted on 2009-07-27 at 14:09:48ID: 24956048

It's edx and ecx. The string will be read into edx offset by the data, of length ecx.

You need to point to your data like this:

   NAME_MAX = 20
   Name BYTE (NAME_MAX+1) DUP(0)

then,

   mov edx,OFFSET Name
   mov ecx,NAME_MAX
   call readString

as you can see, edx offset Name is what you want.

 

by: Infinity08Posted on 2009-07-28 at 02:47:33ID: 24959088

I'm not sure ... The question states MASM, NASM and FASM - which one is it ? The question talks about readstring, not readString. Your assumption might be correct, but it might not ;) I need more information to be certain heh.

 

by: t0t0Posted on 2009-07-28 at 05:38:55ID: 24959999

jschmuff

By the way, on return from ReadString, eax holds the length of the string so you would do something like this:

   mov  edx, offset string
   call   ReadString
   mov  strSize, eax

not forgetting of course that edx, offset string, is where your string is.


infintiy08

It doesn't matter which assembler jschmuff is using as ReadString is just ReadString whichever way you look at it.

 

by: Infinity08Posted on 2009-07-28 at 05:43:20ID: 24960030

Which ReadString function are you talking about ? (capitalization seems to be changing constantly btw)
And is it the same one jschmuff is using ? How do you know ?

 

by: t0t0Posted on 2009-07-28 at 05:50:16ID: 24960087

infinity08

I think you'll find there's only one ReadString function however, if there is a problem with the code samples I gave then it might be helpful to know which header file it belongs to.
 

 

by: Infinity08Posted on 2009-07-28 at 06:00:27ID: 24960174

I'm not sure how/where to find that there's only one readstring/readString/ReadString function. I'm pretty sure there's more than just one. But in case I'm mistaken, I'm sure you can point me to it. I'm trying to learn something here.

 

by: t0t0Posted on 2009-07-28 at 06:08:30ID: 24960233

As far as I know, the most widely used ReadString function is that which is defined by Irvine as part of his console library functions.

 

by: t0t0Posted on 2009-08-22 at 16:26:50ID: 25160675

Of course I object...

I have provided good answers:

    ID: 24956048
    ID: 24959999

as well as exmaple code.

I believe I should be awarded points for providing the correct solution.

This question should remain in EE for reference purposes.

 

by: t0t0Posted on 2009-08-23 at 04:23:31ID: 25162199

Modalot

Just because you cannot personally confirm my solution, does NOT mean it should be swept under the carpet.

I can't believe your reasoning.... If you can provide proof which contradicts my advice then that's one thing however, because you have not provided such proof it beggers belief you can take the action you have taken.

I expect greater consideration from moderators otherwise what's the point in participating contributions if they are going to be ignored?

This matter should be passed onto someone with greater competence.

 

by: t0t0Posted on 2009-08-23 at 05:14:57ID: 25162324

Modalot

Thank you for your speedy reply.

The following supports and verifies my solution.

See section: "5.4 Reading Characters, Strings, and Integers from Standard Input" of:

   http://ocw.kfupm.edu.sa/user062/COE2055253/05-InputOutput.pdf

Which states:

   ReadString
   Reads a string from standard input. Reading stops when the user presses the
   [Enter] key. Before calling ReadString, EDX should contain the address of
   the array of bytes where the input characters should be stored, and ECX
   should contain the maximum number of bytes
to be read plus one extra byte
   for the null character to terminate the string. This procedure returns a count
   of the actual number of bytes read in the EAX register.


This confirms BOTH of my comments:

   ID: 24956048
   ID: 24959999

 

by: t0t0Posted on 2009-08-23 at 05:31:27ID: 25162370

Modalot

To answer your question:

  Is this very simple answer really worth the hassle you start?

It's not abut the points - it's about fairness!

To add to my previous comment, the actual 32-bit code for ReadString is defined here:

  http://www.cs.fit.edu/~mmahoney/cse3101/examples/Lib32/Irvine32.asm

See code below:

;--------------------------------------------------------
ReadString PROC LOCAL bufSize:DWORD, saveFlags:DWORD, junk:DWORD
;
; Reads a string from the console and places the characters in a buffer.
;
; Receives: EDX offset of the input buffer
;           ECX = maximum characters to input (including terminal null)
; Returns:  EAX = size of the input string.
; Comments: Stops when Enter key (0Dh,0Ah) is pressed. If the user types more characters than (ECX-1), the excess characters are ignored.
;
;; Written by Kip Irvine and Gerald Cahill
;
; Last update: 11/19/92, 03/20/2003
;--------------------------------------------------------
.data
_$$temp DWORD ?		         ; added 03/20/03
.code
	pushad
	CheckInit
 
	mov edi,edx		; set EDI to buffer offset
	mov bufSize,ecx		; save buffer size
 
	push edx
	INVOKE ReadConsole,
	  consoleInHandle,		; console input handle
	  edx,		         ; buffer offset
	  ecx,		         ; max count
	  OFFSET bytesRead,
	  0
	pop edx
	cmp bytesRead,0
	jz  L5 		         ; skip move if zero chars input
 
	dec bytesRead	         ; make first adjustment to bytesRead
	cld		         ; search forward
	mov ecx,bufSize		; repetition count for SCASB
	mov al,0Ah		; scan for 0Ah (Line Feed) terminal character
	repne scasb
	jne L1		         ; if not found, jump to L1
 
	;if we reach this line, length of input string <= (bufsize - 2)
 
	dec bytesRead		; second adjustment to bytesRead
	sub edi,2		         ; 0Ah found: back up two positions
	cmp edi,edx 		; don't back up to before the user's buffer
	jae L2
	mov edi,edx 		; 0Ah must be the only byte in the buffer
	jmp L2		         ; and jump to L2
 
L1:	mov edi,edx		; point to last byte in buffer
	add edi,bufSize
	dec edi
	mov BYTE PTR [edi],0    	; insert null byte
 
	; Save the current console mode
	INVOKE GetConsoleMode,consoleInHandle,ADDR saveFlags
 
	; Switch to single character mode
	INVOKE SetConsoleMode,consoleInHandle,0
 
	; Clear excess characters from the buffer, 1 byte at a time
L6:	INVOKE ReadConsole,consoleInHandle,ADDR junk,1,ADDR _$$temp,0
 
	mov al,BYTE PTR junk
	cmp al,0Ah 		; the terminal line feed character
	jne L6     		; keep looking, it must be there somewhere
 
	INVOKE SetConsoleMode,consoleInHandle,saveFlags ; restore console mode.
	jmp L5
 
L2:	mov BYTE PTR [edi],0	; insert null byte
 
L5:	popad
	mov eax,bytesRead
	ret
ReadString ENDP
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:

Select allOpen in new window

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...