News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

masm - alternate usage query

Started by RedXVII, April 27, 2006, 08:27:31 PM

Previous topic - Next topic

MichaelW

I'm not sure why the original code renamed the object module to remove the extension, because doing so will have no effect on Debug. Debug will load the file starting at offset 100h in its buffer and set BX:CX to the size of the file. For your code, if BX and CX are set to zero when the Write command executes then it's because the DWORD at offset 24h in the object module is set to zero. This would be correct for the object module for the last ASM code I posted, because the DWORD at offset 24h would be the size of the raw data for the nonexistent .text section.


@echo off
echo r > dbg
echo q >> dbg
echo. >> dbg
debug test.obj < dbg
if exist test del test
ren test.obj test
debug test < dbg
pause
del dbg


-r
AX=0000  BX=0000  CX=0014  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=0B07  ES=0B07  SS=0B07  CS=0B07  IP=0100   NV UP EI PL NZ NA PO NC
0B07:0100 64            DB      64
-q
-r
AX=0000  BX=0000  CX=0014  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=0B07  ES=0B07  SS=0B07  CS=0B07  IP=0100   NV UP EI PL NZ NA PO NC
0B07:0100 64            DB      64
-q


I realize now that in my last post I neglected files with a HEX extension. For these files Debug assumes an Intel HEX file, loads the number of bytes specified in the file, starting at the address specified in the file, and sets BX and CX to zero.

eschew obfuscation