You are not logged in.
i dont know how to assemble a batch file using debug.exe :pc:
Offline
You don't - debug is a utility for writing Assemby language
http://en.wikipedia.org/wiki/Assembly_language
http://drpaulcarter.com/pcasm/
Offline
Yes, you can.
with debug you can assembly com files with instructions in assembly for 16 bits.
or put binary data, each byte in hexadecimal notation. And all write to disc, or if is a 16 bit program you can run it without write.
debug is not available in windows of 64 bits because debug is a program of 16 bits running with emulation for 16 bits. This emulation is not present in windows operating system of 64 bits.
Example, building a batch file with debug. with binary notation
run this code:
echo.@calc.exe>mybat.cmd
Now, you have mybat.cmd.
If you view the size of mybat.cmd, the size is 11 bytes.
Run debug with this:
debug mybat.cmd
Now you view a "-".
Put this:
d
You view this:
C:\>debug mybat.cmd
-d
15D0:0100 40 63 61 6C 63 2E 65 78-65 0D 0A 00 00 00 00 00 @calc.exe.......
15D0:0110 00 00 00 00 00 00 00 00-00 00 00 00 34 00 BF 15 ............4...
Put q for quit.
Now, we need copy the first 11 hexadecimal bytes.
From 40 to 0A.
Now, with notepad write this file and save how mybat.src
e 0100 40 63 61 6C 63 2E 65 78-65 0D 0A
r cx
B
n mybat.cmd
w
q
:end
the :end is only a etiquet that be called different, is for sure that there are a new line after q, for really quit.
Now delete mybat.cmd
del mybat.cmd
Now run your debug script:
debug < mybat.src
Now you have a mybat.cmd rebuilded.
When you run debug < mybat.src you view how debug works, for not view this redirect to nul like this:
debug < mybat.src >nul
Explication of debug commands:
e is ENTER
is for put data in memory. default you begin putting data in 0100 address, with 16 bytes maximum value for line. if you put more of 16 bytes of data you put like this:
e 100 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
e 110 32
You write in hexadecimal notation.
16 decimal is 10 in hexadecimal. and 100 + 10 in hexadecimal is 110.
r is REGISTER
cx is for specify the CX register.
B is 11 in hexadecimal is the size.
n is NAME. the name of file with 8.3 notation. .exe and .hex extension is not valid
w is WRITE with this you write to disk.
Example, building a batch file with debug. with assembly notation
Now you can do the same putting nemotecnics of assembly.
Run this:
debug mybat.cmd
now put:
u
u is UNASSEMBLY
You view this:
-u
15D0:0100 40 INC AX
15D0:0101 63 DB 63
15D0:0102 61 DB 61
15D0:0103 6C DB 6C
15D0:0104 63 DB 63
15D0:0105 2E CS:
15D0:0106 65 DB 65
15D0:0107 7865 JS 016E
15D0:0109 0D0A00 OR AX,000A
15D0:010C 0000 ADD [BX+SI],AL
Every byte character is nemotecnic in assembly language. Because programming directly in binary is very hard, the assembler programmer programming with nemotecnic with sense.
Now, copy from 0100 to 0109 lines. These are the lines with your binary data.
Now build the next debug script:
a 100
INC AX
DB 63
DB 61
DB 6C
DB 63
CS:
DB 65
JS 016E
OR AX,000A
r cx
B
n mybat.cmd
w
q
:end
This is the same script for build mybat.cmd but with assembly notation.
A is ASSEMBLY
the enter between OR... and r cx is a enter for quit of assembly mode and return to debug mode.
Exist a programs for generate the debug script:
-esc.com
http://lf.8k.com/TOOLS/ESC.ZIP
The limitation of debug is that the files have a limit of 65280 bytes.
You can build file with this limit with esc.com like this:
esc.com file>out.src
Here more information of debug: http://mirror.href.com/thestarman/asm/debug/debug.htm
Last edited by carlos (06 Aug 2010 01:18)
Offline