format PE console
include 'win32ax.inc'
;=======================================
section '.text' code readable executable
;=======================================
start:
cinvoke time, 0
cinvoke srand, EAX
cinvoke rand ;random int is returned to EAX
mov EDX, 0
mov EBX, 10
idiv EBX ;divide by 10 and put remainder in EDX
inc EDX
cinvoke printf, "Random number from 1-10: %d%c", EDX, 10
invoke Sleep,-1
;====================================
section '.idata' import data readable
;====================================
library msvcrt,'msvcrt.dll',kernel32,'kernel32.dll'
import msvcrt,printf,'printf',rand,'rand',srand,'srand',time,'time'
import kernel32,Sleep,'Sleep'
|