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
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