Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone take a look at my code

Status
Not open for further replies.

dndc416

Programmer
Nov 5, 2005
3
US
My program is suppose to read in a string of characters and generate 20 random strings consisting of 10 characters from the original string. I can't seem to get my loops quite right.

STR1 BYTE "Enter a String of Characters, Press Enter when done ",0
BUFFER BYTE 50 DUP (0)
BYTECOUNT DWORD ?
RANDVAL BYTE ?

COUNT DWORD ?
RANDOMCHAR DWORD ?

.code

MAIN PROC

CALL CLRSCR

MOV EDX, OFFSET STR1
CALL WRITESTRING
MOV EDX, OFFSET BUFFER
MOV ECX, (SIZEOF BUFFER) - 1
CALL READSTRING
MOV BYTECOUNT, EAX

MOV ECX, 20
L1:
MOV COUNT, ECX
MOV ECX, 10
L2:

CALL RANDOMIZE
MOV EAX, (OFFSET BUFFER) + 1
CALL RANDOMRANGE
CALL WRITECHAR

LOOP L2
CALL CRLF
MOV ECX, COUNT
LOOP L1


EXIT

 
If we don't know what the call'ed procedures do, we can't tell what's wrong!

Tessa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top