Link to home
Start Free TrialLog in
Avatar of lina2401
lina2401

asked on

DOS Command

I need to write an assembly program simulate to the DEL DOS Command..??
ASKER CERTIFIED SOLUTION
Avatar of StefanZ
StefanZ

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vikiing
vikiing

Somebody asks for a program and you, Stefan, suggest to use a debugger?

What would you suggest if someone asks for a printer? perhaps a sound card?

I have a rough understanding of how debug can help your assembly piece if you are having trouble with a compiler or compiled version of what you think should work.  I have no clue on the intent of the effort or how that would help, as in:

Why not just use DOS, or more clearly, what is meant by

"simulate to"

Is your intent to delete the file the same way that DOS does? Or to 'pretend to' delete.  If I wanted to do 'like DOS' does it, my personal preference would be to skip the code and do DOS.

I'd recommend checking your assembler (documentation or help) for its method to 'shell' out to DOS (CLI).

Or perhaps you are looking for how to tell a program to run any DOS command, for example, the delete command (if the assembler does not have good online help).  That'd be more a programming q:.

If you really want to get into coding, the question may be more appropriate for the programming section here. Perhaps you are trying to beef up on how Microsoft uses s/w 'interrupts' for example. [implying, a q: on how to access s/w interrupts from assembly lang]
Delete file is INT 21H, function 41H

Call with DS:DX pointing to zero terminated ASCII string with file name. Wild cards are not allowed.

Returns AX with error code. 00H = Success, 02H = File Not Found, 05H = Access Denied (file is R/O)

Assuming that you had a string in memory you could code:

PUSH CS         'Save code segment on stack
POP DS           'Load into data segment
MOV DX, 80H   'Point to address where string is saved
MOV AL, 21H   'DOS services code
MOV AH, 41H  'Delete file opcode
INT 21H          'Have DOS do it
MOV AH, 4CH  'Terminate (Status returns in AL)
INT 21H         'Bye!

THis is just about compilable as a COM program...

M