🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.ibm.pc.programmer
5 messages
5 total messages Started by Chevan Nanayakkara Nyx Wed, 29 Jul 1992 21:34
DOS Kernel/COMMAND.COM
#13
Author: Chevan Nanayakkara Nyx
Date: Wed, 29 Jul 1992 21:34
15 lines
1468 bytes
I was wondering if someone could help me locate some information about writing
a command.com replacement for DOS.  I've read through all my books and they
pretty much say "create a .COM file assign it to the SHELL environment variable
and from there it is a substitute for COMMAND.COM", pretty rotten advice.  I'd
like to know what services I'd have to take care of and how.  Also how do I 
find a list of what internal services command.com performs.  I've got some code
I'm plugging through but if someone can point me in the direction of some text
I would appreciate it very much.  I've never done a lot of systems programming
before so something lucid would be nice (although that is probably asking a
lot).  Thanks very much in advance,
--
---Tear Here Please
Chevan (Sleepy) Nanayakkara  -  csnanaya@cadehp0.eng.utah.edu - best
or chevan.nanayakkara@m.cc.utah.edu or cnanayak@nyx.cs.du.edu
Posting from NYX! - The *BEST* Public Access NEWS site in the Universe :-).
Re: DOS Kernel/COMMAND.COM
#14
Author: Peter Clark
Date: Thu, 30 Jul 1992 01:11
2 lines
653 bytes
In re-doing a COMMAND.COM you will have to take care of any services that
are listed in your DOS manual as 'internal' - like DIR, ERASE et al.
Re: DOS Kernel/COMMAND.COM
#16
Author: Steve Resnick
Date: Thu, 30 Jul 1992 17:05
37 lines
2616 bytes
In article <1992Jul29.213404.22198@mnemosyne.cs.du.edu> cnanayak@nyx.cs.du.edu (Chevan Nanayakkara @ Nyx) writes:
>I was wondering if someone could help me locate some information about writing
>a command.com replacement for DOS.  I've read through all my books and they
>pretty much say "create a .COM file assign it to the SHELL environment variable
>and from there it is a substitute for COMMAND.COM", pretty rotten advice.  I'd
>like to know what services I'd have to take care of and how.  Also how do I 
>find a list of what internal services command.com performs.  I've got some code
>I'm plugging through but if someone can point me in the direction of some text
>I would appreciate it very much.  I've never done a lot of systems programming
>before so something lucid would be nice (although that is probably asking a
>lot).  Thanks very much in advance,
>--
>---Tear Here Please
>Chevan (Sleepy) Nanayakkara  -  csnanaya@cadehp0.eng.utah.edu - best
>or chevan.nanayakkara@m.cc.utah.edu or cnanayak@nyx.cs.du.edu
>Posting from NYX! - The *BEST* Public Access NEWS site in the Universe :-).


After DOS 3.0 the .EXE loader is in the DOS Kernel (MSDOS.SYS) instead of
COMMAND.COM. The things you need to handle: INT 23 - Control C, INT 24 -
Critical Errors (this is fun, believe me.) Depending on how you do your
I/O and what you are going to run under, you may want to execute INT 28
(DOS Idle) when waiting for input. I have written a shell replacement for
DOS, and it works fairly well (at least my interface to DOS does. The 
code has a lot of malloc/calloc errors). If you need some assistance
feel free to ask  :) 


Cheers!
Steve

-- 
------------------------------------------------------------------------------
Steve Resnick - resnicks@netcom.com steve@axebbs.kludge.com FidoNet: 1:143/105
"I just want to be the one you run to, I just want to be the one you come to.
I just want to be there for someone, when the night comes" - J. Cocker
-----------------------------------------------------------------------------
Re: DOS Kernel/COMMAND.COM
#17
Author: Heath Ian Hunnicutt
Date: Thu, 30 Jul 1992 23:46
24 lines
1502 bytes
resnicks@netcom.com (Steve Resnick) writes:
>After DOS 3.0 the .EXE loader is in the DOS Kernel (MSDOS.SYS) instead of
>COMMAND.COM. The things you need to handle: INT 23 - Control C, INT 24 -
>Critical Errors (this is fun, believe me.) Depending on how you do your
>I/O and what you are going to run under, you may want to execute INT 28
>(DOS Idle) when waiting for input. I have written a shell replacement for
>DOS, and it works fairly well (at least my interface to DOS does. The 
>code has a lot of malloc/calloc errors). If you need some assistance
>feel free to ask  :) 


>Cheers!
>Steve

	Here's something I've wondered about:  When you write a shell
replacement, how do you set up the master environment?  Did you just
malloc some memory and then adjust the correct pointer in your PSP to
point to it?

Thanks,
Heath

-- 
On Saturday, April 18, 1992, this .sig became self-aware.
Re: DOS Kernel/COMMAND.COM
#19
Author: Jen Kilmer
Date: Sat, 01 Aug 1992 00:54
79 lines
4172 bytes
In article <1992Jul29.213404.22198@mnemosyne.cs.du.edu> cnanayak@nyx.cs.du.edu (Chevan Nanayakkara @ Nyx) writes:
>I was wondering if someone could help me locate some information about writing
>a command.com replacement for DOS.  
>like to know what services I'd have to take care of and how.  Also how do I 
>find a list of what internal services command.com performs.  I've got some code
>I'm plugging through but if someone can point me in the direction of some text
>I would appreciate it very much.  
>Chevan (Sleepy) Nanayakkara  -  csnanaya@cadehp0.eng.utah.edu - best

hi Chevan. I'm going from memory, so it may not be totally complete,
but...

command.com provides the basic user environment for DOS. It prompts for
and accepts user input, carries out some basic file/system management
functions (anything your DOS manual calls "internal commands" - dir,
copy, cls, cd, md, rd, del, time, date, etc) and acts as a program 
loader.

The initial copy of COMMAND.COM creates the base environment space [often
called the "real environment", as in, how do I modify the real environment
from my program?]. COMMAND.COM normally passes a copy of the current 
environment to programs that it loads, and also passes on the "command tail"
- any parameters the user included with the program name. IE if you type

format a:<enter>

at the c> prompt, command reads in "format a:". The space after the t 
indicates that's the end of the actual command you want to run. So command
checks that format isn't one of it's interal things (dir, copy, et al).
Then it starts looking for a program called format. Command looks in the
current drive/directory for format.com, then format.exe, then format.bat
- if it's not found, it keeps searching in each directory specified on the
path variable.

when command finds format.com/.exe, it allocates memory for format, memory
for the environment, etc etc [see chapter 5 of the MS-DOS programmer's
reference, or another programming book about running child programs].

That's most of what command does. But it also...

responds to the prompt variable (changes its looks :-)

only has part of itself _always_ in memory...optional stuff [not needed
when other programs are active] gets overwritten. reloads itself using
comspec variable

provides default int 24 handler [you know that one, it says "abort, retry,
fail?" :> ]

provides default int 23 handler [you know that one too, it handles ctrl-c]

processes batch files

can get spawned from other programs easily [helps if you set comspec=
to yourself]

way back when and once upon a time, command actually implemented the
program execution call (int 21 func 4b). that's 2.0 though.

I would suggest picking up the...lemme check the title..._Microsoft
MS-DOS Programmer's Reference_, mainly cause it includes the 5.0-specific
stuff like how to use upper memory :-). I've heard there's a new version
of _DOS Programmer's Reference_ by Terry Dettmann, published by QUE, that
covers through 5.0 (the 2nd edition covers through 4.0).
 
While I haven't seen the new Dettmann book, I have the 1st and 2nd editions
and I prefer them to Duncan's _Advanced MS-DOS Programming_, from Microsoft
Press, which covers through 4.0 and is well regarded. [Dettmann is my
preference, more for writing style and organization than any factual 
differences.] The MS-DOS Encyclopedia is worth a look *BUT* ONLY covers
through 3.2 and IS HUGE and co$t$ more than the rest. 

My suggestions are Microsoft Press heavy because my boss can get them
for us cheaper then other publishers :-)

anyway, have fun and enjoy!

-jen
Ms Dos Enduser Support        no, I'm not speaking for microsoft, geez....
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads