Re: Debug.exe for win32
From: Frank Kotler (fbkotler_at_comcast.net)
Date: 09/07/04
- Next message: Al Leitch: "Re: Debug.exe for win32"
- Previous message: C: "Re: Debug.exe for win32"
- In reply to: Robert: "Debug.exe for win32"
- Next in thread: Al Leitch: "Re: Debug.exe for win32"
- Reply: Al Leitch: "Re: Debug.exe for win32"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 07 Sep 2004 09:04:40 GMT
Robert wrote:
>
> Greetings everyone,
Hi Robert,
> Is it possible to work with debug.exe (which comes with every MS os
> that I know of) to create win32 programs?
1) I'm no Windows expert, but I thought that debug was "optional" these
days. You *don't* necessarily have it. I could be wrong on that...
2) Yes, you can write (simple) win32 programs with debug - visiting
hours are Thursdays and Saturdays. (if you don't get the joke, that
means you'll end up confined to a mental institution). You *can* do it,
but you don't wanna!
> I know that debug.exe is
> limited to creating 64k com files, and that windows programs probably
> need this much for their headers and such.
There's a lot of "fluff" in a win32 program, but it isn't quite *that*
bad. You can get a *little* win32 code into 64k.
Debug's insistance on making a .com file brings up an interesting
"problem" I ran into... I fed debug a script (you really don't want to
do this by hand) to produce a "hello world messagebox". This was *not* a
.com file, but a true PE - just *named* .com. I dragged it onto my
desktop and clicked on it - worked fine. I clicked again, and again...
after working a couple of times, it started getting an "out of
memory"(!) error. Renamed the file to .exe - same file, just renamed -
dragged it to the desktop, and the problem disappeared.
It's a well-known fact (used to be, anyway) that dos pays no attention
if the filename is .com or .exe. The way in which it's loaded depends
entirely on the presence or absence of the "MZ" signature. These days,
the "PE" signature is considered, too, but if the "MZ" signature is
missing, it's still loaded as a .com... or so I thought. But Windows
does *something* different if the name is .com. So if you're foolish
enough to try this, you might want to rename debug's output to .exe.
> Still, I was wondering if
> there was a way to use debug.exe to cut apart the important headers
> off of existing win32 files, and use them as the headers for your
> programs that you build with debug.exe
Might work. I haven't tried it, but I think you could use debug that
way. Any header clipped from an existing file would need to be modified,
but debug ought to handle that. You'd have to do the calculations
yourself.
Where debug really falls flat is that it'll only do 16-bit code. It
isn't an insurmounable obstacle, but you'll be writing a lot of "db"
lines - a tedious and error-prone process.
> I'd like to be able to sit down at any MS-OS and start writing
> programs.
Would you settle for dos programs? That's painful enough with debug, but
a little more within the tool's capabilities.
Would you consider carrying a floppy in your pocket at all times? You
could put an assembler on a floppy that would be up to win32 programs.
Fasm might be best, but Nasm would do... At that point, your biggest
problem might be lack of documentation. If you forget your floppy,
running home to get it might be a better bet than using debug :)
To prove it can be done... "debug<hwmb2.scr" (might be better to use
some other name - I use ".scr" for debug scripts, but Windows insists
it's a screensaver). See ya Thursdays and Saturdays :)
Best,
Frank
f 100 354 0
e 100 'MZ'
e 104 2
e 108 2
e 10a 1e
e 10c 1e
e 111 2
a 120
push cs
pop ds
mov dx,e
mov ah,9
int 21
mov ax,4c01
int 21
e 12e 'Win32 EXE!'
e 138 7 d a 24 40
e 140 'PE'
e 144 4c 1 1
e 154 e0 0 2 1 b 1
e 169 10
e 176 40
e 179 10
e 17d 2
e 180 4
e 188 4
e 190 54
e 195 2
e 19c 2
e 1a2 10
e 1a5 10
e 1aa 10
e 1ad 10
e 1b4 10
e 1c0 11 10
e 1c4 43
e 238 '.text'
e 245 10
e 248 54
e 24d 2
e 25c 60
e 25f e0
e 300 b8 25 10 40 00 99 52 50 50 52 ff 15 40 10 40
e 310 c3 40 10
e 319 ff ff ff ff 35 10
e 321 40 10
e 325 'Hello world!'
e 335 'user32.dll'
e 340 46 10
e 348 'MessageBoxA'
n hwmb2.com
r cx
254
w
q
- Next message: Al Leitch: "Re: Debug.exe for win32"
- Previous message: C: "Re: Debug.exe for win32"
- In reply to: Robert: "Debug.exe for win32"
- Next in thread: Al Leitch: "Re: Debug.exe for win32"
- Reply: Al Leitch: "Re: Debug.exe for win32"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|