d2alphame
d2alphame

Reputation: 195

How do I create an msdos .com program that takes a file as parameter

How do I create a .com program that accepts a file as a parameter. The .com program is to be executed from the Command line interpreter. I'm planning to write the program in Assembly language. Here is how its supposed to work. Let's say the program is DecToHex.com At the command line (in MSDOS) the user enters

DecToHex.com afile.dec

The program then converts afile.dec into hexadecimal and creates another file named afile.hex

P.S: This is to be done in MSDOS assembly language

Upvotes: 1

Views: 660

Answers (1)

Aki Suihkonen
Aki Suihkonen

Reputation: 20037

IIRC, MSDOS stores the command line parameters starting from CS:0080h.

You should be able to verify that with debug.exe dectohex.com infile outfile Then disassemble / dump memory from cs:0 and search for the string.

As Frank reminded, asciiz was unknown to MSDOS, which instead used apparently pascal-type string format. One has to parse the string byte per byte -- and I suppose the command line parameters will be there as is. Eg. consecutive spaces will not be truncated.

Upvotes: 1

Related Questions