程序的目的:将13个随机数[0-100)存储在数组里面,翻转,输出。
TITLE Write a program
INCLUDE Irvine32.inc
.data
ARRAY_SIZE = 13
RAND_MAX = 100
HALF_ARRAY_SIZE = ARRAY_SIZE/2
rands DWORD ARRAY_SIZE dup(0)
.code
main PROC
mov esi,offset rands ;address to the rands
mov ecx,lengthof rands ;calculate the size of array
L1:
mov eax,RAND_MAX ;for random the maxinum number
call RandomRange ;call this function
mov [esi],eax ;set the element that is save in EAX to [esi]
add esi,TYPE rands ;point to next element
loop L1
mov esi,offset rands ;address to the rands
mov ecx,lengthof rands ;calculate the size of array
L2:
mov eax,[esi] ;put the [esi] to eax for outputing
call writeint
mov eax,' ' ;output the space
call writech