News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Simple macro to log variables

Started by jj2007, November 04, 2023, 08:38:41 PM

Previous topic - Next topic

jj2007

Purest Masm32 SDK code - full source attached (definitely not a substitute for a full-fledged deb but it's start :biggrin: ):

LV$=0 ; string
LVd=1 ; DWORD
LVw=2 ; WORD
LVb=3 ; BYTE

useLV=1    ; default; set to 0 to suppress any code creation
.data
MyArray    dd 25, 18, 23
HelloW$    db "Hello World", 0
MyByte    db 111, 112, 113, 114

.code
start:
  cls
  mov esi, offset HelloW$
  LogVar esi, LV$
  inc esi
  LogVar esi, LV$
  inc esi
  LogVar esi, LV$
  LogVar offset HelloW$, LV$
  LogVar offset HelloW$[1], LV$
  LogVar offset HelloW$[2], LV$
  LogVar MyArray[0], LVd
  LogVar MyArray[4], LVd
  inc MyArray[4]
  LogVar MyArray[4], LVd
  LogVar MyByte, LVb
  inc MyByte
  LogVar MyByte, LVb
  LogVar MyByte[2], LVb
  exit

Output:
esi    Hello World
esi    ello World
esi    llo World
offset HelloW$          Hello World
offset HelloW$          ello World
offset HelloW$          llo World
MyArray[0]      25
MyArray[4]      18
MyArray[4]      19
MyByte          111
MyByte          112
MyByte[2]      113