Author Topic: Debugging Macros  (Read 663 times)


  • Member
  • **
  • Posts: 132
Debugging Macros
« on: August 02, 2020, 05:41:28 AM »
My favorite debugging tools in PowerBASIC are two macros: ods and odx. Ods is short for OutputDebugString. I use a special OutputDebugString viewer (debugtext.exe) to collect these debug strings. Ods is for showing literal strings and other string data. Odx shows a variable´s name and it´s content regardless of the variable type.

Now i wanted to have something similar for assembler:

odxm: show name + content of a register or variable as integer and hex. (e.g bl = 9 -> odxm(bl) : BL = 9  -  09h)
In case of a floating point or text variable an additional specifier suffix is needed: $, $$ (wide string), #   e.g:

hello db "Hello World", 0 -> odxm(hello$) : hello = "Hello World"
float real4 2.22          -> odxm(float#) : float = 2.22

In case of a register as pointer an additional specifier suffix is needed to form a short version
*b (byte ptr), *w (word ptr), *d (dword ptr), *q (qword ptr), *o (oword ptr)
*4 (real4), *8 (real8) *t (real10)

In general these two forms are possible: e.g. eax points to a real8 in memory
1.) odxm(eax*8)                 (short version)
2.) odxm(real8 ptr [eax])    (regular version)
where only the second form allows for displacements: (real8 ptr [eax + 8])

odsm: show literals (enclosed in double quotes) combined with variables and registers (just like with odxm, but without name). Items to show must be concatenated by "+", a single ASCII character may be given as number (13 = carriage return, 10 = line feed, etc.). Please study the code for more syntax examples and more information about how to assemble and link.

The code is written for UASM, because i wanted to have it work in 32 and 64 bit. There are substantial differences between ml and ml64, so UASM seemed to be easier for a start. I think, it is possible to port it MASM too.

It is still WIP and there is potential for optimization, but basically it seems to work. Please have mercy, this is the first time i´m posting a reasonable amount of code here in this forum. Comments, critics, code or ideas for improvement or bug reports are welcome.

« Last Edit: August 04, 2020, 02:00:12 AM by JK »