🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #898

TSR Programming Dilema

#898
From: Dominique Willems
Date: Sun, 01 Jul 1990 22:10
56 lines
3037 bytes
Hello Peter,

 >                      1)  Stuff 16 characters or less into the
 >                          keyboard buffer.
 >                      2)  Transfer control to calling program until
 >                          keyboard buffer is read (cleared).
 >                      3)  Repeat 1 and 2 until no more characters
 >                          from the text file can be processed.

I don't know if this is of any use to you, but I once had a similar 
problem when I wanted to make one-key or key-combination macroes that 
allowed me to start up a program and simulate all the key-entries to put 
the programme in the wanted state from the DOS command line. The programme 
works perfectly and has saved me from a lot of useless (repetitive) 
keystrokes since.

It is implemented in Assembly Language, although I think you shouldn't 
have many problems implementing it in Modula-2, although I don't really 
recommend it, since it's very unlikely that even JPI's M2 can produce more 
compact code for this very simple TSR.

What I did was :

1) Intercept interrupt 16H
2) Check for the Macro keystroke (in your case this is already done)
3) Set a counter equal to the number of simulated ("emulated" is more
   correct) keystrokes, although this is unnecessary if the string has a
   termination character (in your case probably the End-Of-File marker)
4) Signal via the return registers that there is a character available from
   the keyboard and put the character in AL
5) IRET

- programme execution -

6) Interception of INT 16H (the programme wants to read the next character)
7) Check the counter or any other flag you choose to use to check whether
   the transfer is complete
8) If the counter#0, or flag is still set, then fetch the next character and
   go to step 4 else jump to the usual INT 16H routine (of which you have
   saved the address at TSR installation, of course)

As you see this is a very simple solution and doesn't use the buffer at 
all, so theoretically unlimited size character streams can be transferred. 
(the only really important thing is step 4)

As I said, I don't know if this helps you any further, but it did the 
trick wonderfully for me. If you want more details about the code, please 
let me know.

Greetings from Brussels, where the weather has gone bizarre again,
Dominique


--  
uucp: uunet!m2xenix!puddle!2!295!46.4610!Dominique.Willems
Internet: Dominique.Willems@p4610.f46.n295.z2.fidonet.org
Technical Details
Message-ID: <1173.269437B7@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p4610.f46.n295.z2.fidonet.org!Dominique.Willems

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p4610.f46.n295.z2.fidonet.org!Dominique.Willems
From: Dominique.Willems@p4610.f46.n295.z2.fidonet.org (Dominique Willems)
Newsgroups: comp.lang.modula2
Subject: TSR Programming Dilema
Message-ID: <1173.269437B7@puddle.fidonet.org>
Date: 1 Jul 90 22:10:00 GMT
Sender: ufgate@puddle.fidonet.org (newsout1.26)
Organization: FidoNet node 2:295/46.4610 - Starline System, Brussels Belgium
Lines: 56