Slide 9.2: This book's link library
Slide 9.4: This book's link library (cont.)
Home

This Book's Link Library (Cont.)


DumpMem
It writes a range of memory to the console window in hexadecimal. Pass it the starting address in ESI, the number of units in ECX, and the unit size in EBX ( 1 = byte, 2 = word, and 4 = doubleword).

DumpRegs
It displays the EAX, EBX, ECX, EDX, ESI, EBP, ESP, EIP, and EFLAGS registers in hexadecimal.

GetMseconds
It returns the number of milliseconds elapsed since midnight in the EAX.

StrLength
It returns the length of a null-terminated string. Pass the string's offset in EDX. The procedure returns the string's length in EAX.

WaitMsg
It displays the message “Press any key to continue...”, and waits for the user to press a key.

 Dumping Memory   Repeating Pressing a Key
after 3 Seconds 5 Times 
 .data
 array1  DWORD  102030h, 405060h
 array2   WORD    7080h,   90A0h
 .code
 mov   esi, OFFSET   array1
 mov   ecx, LENGTHOF array1
 add   ecx, LENGTHOF array1
 add   ecx, LENGTHOF array2
 mov   ebx, TYPE WORD
 call  DumpMem
 NUMBER  = 5
 SECONDS = 3000

 .data
 startTime  DWORD  ?

 .code
      mov   ecx, NUMBER
 L1:  call  getMseconds
      mov   startTime, eax
 L2:  call  getMseconds
      sub   eax, startTime
      cmp   eax, SECONDS    
         
call WaitMsg call Crlf loop L1
 Output