There is a resident program in pascal. When you press the Enter key on the command line when the program is running, some event occurs (for example, displaying on the screen) by handling the keyboard interrupt. When any command (dir, cls, mem) is executed and the Enter event is pressed from the keyboard of the resident program, it is not executed.

I apologize! My first question :) Here is a minimal example:

{$M, $1000, 0,0} program lab5; uses crt, dos; type video = array [1..25,1..80] of record symbol : char; attr : byte; end; var memory : video absolute $B800:$0000; OldKey : procedure; {$F+} procedure Key; Interrupt; begin if (Port[$60] = 156) then {Скан-код клавиши Enter} begin memory[WhereY,WhereX].Symbol := '1'; end; Inline($9C); OldKey; end; {$F-} begin GetIntVec($9, @OldKey); SetIntVec($9, Addr(Key)); Keep(0); end. 



similar to:

 asm PUSHF end; 

The problem is that cascading interrupt processing is not performed when invoking an external command from the shell. I tried to use the line parallel IRQ 2.

 GetIntVec($71, @OldKey); SetIntVec($71, Addr(Key)); 

The most interesting thing is that it started working, but it stopped processing the Enter key without a command and did not work stably. And in the end, after a short time, it stopped working. I did not understand what the problem is.

  • one
    Glory to Russian IT archaeologists. The novelty of the problem can only compete with the excrement of mammoths. (Resident programs are an attempt to combat the single-task dos, and without dos they have no sense) - alexlz
  • 2
    @alexlz, so what? Written as an educational task. @rozzzario, enough words, show the code. - karmadro4
  • There is a program. And the question is where? - drdaeman pm
  • The program is somewhere there, but here it is not there either, but it would be hard to remember the processing of IRQ1 ... Plus, it would be cool to recall low-level things, and also on trubopaskakale. - karmadro4
  • one
    As far as I remember, 156 is a key release code and not a keystroke. Maybe because of this problem? Set the response to an interrupt only and not only if the keypad has a key release code in the port - Chad

1 answer 1

I apologize, my comment quota is over, so in the form of an answer, what is essentially a comment in the form of an answer.

  1. About PUSHF, I raised a false alarm, the instruction is needed, otherwise the stack deteriorates.
  2. If I remember correctly, with the "younger" vectors (in my opinion, the keyboard redirect is not INT 71) the idea is a dead end, because ISR will not be able to call INT 10 ( WhereX , WhereY )
  3. About SwapVectors @ Chad quite rightly noted, as well as before Exec its call is obligatory . By the way, this will make TSR reentrant.
  4. I was never able to reproduce the resident's incorrect behavior in the limited conditions of MS-DOS 6.22 under VMWare. I successfully write '1' to the screen buffer both when I press and when I release <kbd> Enter </ kbd>, although programs often overwrite it (MS-DOS Editor example).
  5. Regarding the links, look at the second post (The date of the post is 1902 about the nature of all this :)