[comp.lang.pascal] Help needed

efa@iesd.auc.dk (Erik F. Andersen) (10/05/90)

   I hope anyone will take the time to help me out with some programming       problems I have.

   a) I want to write a resident routine that can intercept the commands       entered from the DOS prompt, and process the command if it is defined in the   routine, or otherwise return controle to COMMAND.COM. What I think I need to   know, is the following:
  
   1) Where in memory does DOS store the string entered?
   2) What interrupt is issued after I hit return?
   3) Maby it is better if my routine is invoked, after COMMAND.COM detects    that the commands entered are not in it's library, and before the error:       COMMAND NOT FOUND is written on the screen! How can I do this  - if it's       possible?

   b) When I in TP (v. 5.0) write sub-routines to certain hardware interrupts, like INT08 to redifine caracters written on to the screen, strange things      start to happen. So far the only way I have been able to do this, is through   assemble-language, where I never have any problems. I have often written       sub-routines in TP to other BIOS-routines, like INT09 and INT 1C, without any  trouble. If anyone think they know, what I am doing wrong, please let me know.


FROM: Erik F. Andersen
      efa@iesd.auc.dk      

abcscnuk@Twg-S5.uucp (Naoto Kimura (ACM)) (10/08/90)

In article <EFA.90Oct5133312@student.iesd.auc.dk> efa@iesd.auc.dk (Erik F. Andersen) writes:
>
>   I hope anyone will take the time to help me out with some
>   programming problems I have.
>
>   a) I want to write a resident routine that can intercept the
>      commands entered from the DOS prompt, and process the command
>      if it is defined in the routine, or otherwise return controle
>      to COMMAND.COM. What I think I need to know, is the following:
>
>      1) Where in memory does DOS store the string entered?
>      2) What interrupt is issued after I hit return?
>      3) Maybe it is better if my routine is invoked, after COMMAND.COM
>         detects that the commands entered are not in it's library, and
>         before the error: COMMAND NOT FOUND is written on the screen!
>         How can I do this  - if it's possible?

How about writing a program that reads the input, and then performs the
initial processing, then passes to the modified command line
COMMAND.COM if further processing by the command processor is needed ?
Aside from this technique, you can't really do it w/o patching the
command processor in memory -- which is ugly and non-portable, since it
would heavily depend on the version of DOS you've got.

Command lines and other strings for most of the DOS services offered in
versions 2.0 and later are in the form of ASCIIZ strings -- zero-byte
terminated character sequences.

>   b) When I in TP (v. 5.0) write sub-routines to certain hardware
>      interrupts, like INT08 to redifine caracters written on to the
>      screen, strange things start to happen. So far the only way I
>      have been able to do this, is through assembly language, where
>      I never have any problems. I have often written subroutines in
>      TP to other BIOS-routines, like INT09 and INT 1C, without any
>      trouble. If anyone think they know, what I am doing wrong,
>      please let me know.

Do you make sure that you send a EOI to the interrupt processor ?
Make sure that your processing doesn't take more than 1/18.2 seconds,
because that's the frequency of the clock interrupt.  Make sure that
you also don't take too long in your INT 1C processing routine, as this
routine would be called in the system's INT 08 routine, before it sends
a EOI to the interrupt processor.   Another thing to watch out for is
making inadvertent calls to DOS routines -- DOS isn't reentrant, so you
have to make sure that you don't accidentally call upon DOS services
when DOS is trying to process a request (this would be quite probable
if you are writing interrupt service routines for hardware interrupt).

>
>FROM: Erik F. Andersen
>      efa@iesd.auc.dk      


                //-n-\\			 Naoto Kimura
        _____---=======---_____		 (abcscnuk@csuna.csun.edu)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!