-
-
Save jryebread/1195c44ff9dd24cc749077d94b5f4d4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;// James Riback | |
;// CSIS-118B-4639 | |
;// 4/9/17 | |
;// Practice 11 | |
INCLUDE c:\Irvine\Irvine32.inc | |
.data | |
msg1 BYTE "Please input the array element number that defines the boundary between the first and second part of the array<0 to 16>:", 0dh, 0ah, 0 | |
msg2 BYTE "Here is the array with random numbers up to FFh in the first part and up to FFFFh in the second part:", 0dh, 0ah, 0 | |
myarray WORD 16 DUP(?) | |
boundary DWORD ? | |
.code | |
main PROC | |
call Randomize | |
mov edx, OFFSET msg1 | |
call WriteString | |
call ReadInt | |
mov boundary, eax | |
push OFFSET myarray | |
push LENGTHOF myarray | |
call ArrayFill;//FILL THE ARRAY! :D | |
mov edx, OFFSET msg2 | |
call WriteString | |
mov esi, OFFSET myarray | |
mov ecx, LENGTHOF myarray | |
L1:;// PRINT ARRAY | |
mov eax, [esi] | |
call WriteHex | |
call Crlf | |
add esi, TYPE myarray | |
loop L1 | |
;//---- | |
invoke ExitProcess, 0 | |
main endp | |
;//________PROCEDURES______\\ | |
ArrayFill PROC | |
push ebp | |
mov ebp, esp | |
pushad ;// save registers | |
mov esi, [ebp + 12] ;// offset of array | |
mov ecx, [ebp + 8] ;// array length | |
cmp ecx, 0 | |
je L2 | |
L1 : | |
mov eax, 0FFFFh;// get random 0 FFFFh was 10000h or FFh = 100h? | |
call RandomRange ;// from the link library | |
mov[esi], ax | |
add esi, TYPE WORD;// move to next element | |
loop L1 | |
L2 : | |
popad;// restore registers | |
pop ebp | |
ret 8 | |
ArrayFill ENDP | |
end main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment