Hi,
I would like to create "Installable Commands" for 4DOS using PowerBASIC 3.5 for DOS. This involves creating a TSR using the POPUP MULTIPLEX command. I'm running MS-DOS 6.22.
The 4DOSTECH.TXT file has this to say;
Writing Installable Commands
An "installable command" is created with a memory-resident program (TSR) which can receive signals from 4DOS and process commands. 4DOS makes every command available to such TSRs before it is executed; if any TSR chooses to execute the command, 4DOS will do no further processing. Otherwise, 4DOS processes the command normally.
The 4DOS "Installable Command" interface is compatible with an undocumented interface present in COMMAND.COM for MS-DOS and PC-DOS 3.3 and above. This interface is documented more thoroughly in the excellent reference text Undocumented DOS by Schulman et. al., published by Addison Wesley.
4DOS looks for an installable command after alias and variable expansion and redirection, and after checking to see if the command is a drive change, but before checking for an internal or external command.
4DOS first makes an INT 2Fh call to determine whether any TSR loaded will respond to the command, with:
AX AE00h
BX offset of command line buffer:
first byte = maximum length of command line
second byte = actual length of command line, not including
trailing CR
remainder = command line, with a trailing CR
CH FFh
CL length of command line, not including the command name
DX FFFFh
SI offset of command name buffer:
first byte = length of command name
remainder = command name, shifted to upper case
and padded with blanks to 11 characters
DS segment for command line and command name buffers
If the TSR does not recognize the command as its own, it must pass the INT 2Fh along with registers unchanged. If it does recognize the command, it must return 0FFh in AL. The command should not be executed at this point.
4DOS will then make another call (buffer formats are the same as above):
AX AE01h
BX offset of command line buffer
CH 0
CL length of command name
DX FFFFh
SI offset of command name buffer
DS segment for command line and command name buffers
If the TSR executes the command line, it must set the command name length at DS:[SI] to 0. If the command name length is not set to 0, 4DOS will attempt to execute the command as an internal or external command. This allows the TSR to return a modified command line to 4DOS by modifying the command line buffer at DS:BX, and leaving the command name length byte at DS:[SI] set to a non-zero value. If the command is executed,the TSR should return the result of the command (zero for normal return or non-zero for an error) in AL.
End of 4DOSTECH.TXT
Here's my 4DOSTSR.BAS program so far;
$COMPILE EXE
$OPTION cntlbreak OFF
$ERROR ALL ON
$INCLUDE "REGNAMES.INC"
Dummy& = SETMEM(-700000)
POPUP MULTIPLEX &HAE00, &HFFFF
PRINT "Before Interrupt call"
PRINT
PRINT "AX = ";
PRINT REG(%AX)
PRINT "BX = ";
PRINT REG(%BX)
PRINT "CX = ";
PRINT REG(%CX)
PRINT "DX = ";
PRINT REG(%DX)
REM If the TSR does not recognize the command as its own, it must pass
REM the INT 2Fh along with registers unchanged.
CALL INTERRUPT &H2F
PRINT "After Interrupt call"
PRINT
PRINT "AX = ";
PRINT REG(%AX)
PRINT "BX = ";
PRINT REG(%BX)
PRINT "CX = ";
PRINT REG(%CX)
PRINT "DX = ";
PRINT REG(%DX)
POPUP SLEEP USING ems, "C:\TEMP\4DOSTSR.SWP"
End of 4DOSTSR.BAS
Now, I'm not sure where to loop this code to check for the call from 4DOS, or if I'm on the right track or not so far.
I've looked at the "Popping up on the multiplex interrupt" section in the PB user's guide, but it is using POPUP KEY as the TSR activator.
Any constructive suggestions would be appreciated.
Thanks,
Joe
I would like to create "Installable Commands" for 4DOS using PowerBASIC 3.5 for DOS. This involves creating a TSR using the POPUP MULTIPLEX command. I'm running MS-DOS 6.22.
The 4DOSTECH.TXT file has this to say;
Writing Installable Commands
An "installable command" is created with a memory-resident program (TSR) which can receive signals from 4DOS and process commands. 4DOS makes every command available to such TSRs before it is executed; if any TSR chooses to execute the command, 4DOS will do no further processing. Otherwise, 4DOS processes the command normally.
The 4DOS "Installable Command" interface is compatible with an undocumented interface present in COMMAND.COM for MS-DOS and PC-DOS 3.3 and above. This interface is documented more thoroughly in the excellent reference text Undocumented DOS by Schulman et. al., published by Addison Wesley.
4DOS looks for an installable command after alias and variable expansion and redirection, and after checking to see if the command is a drive change, but before checking for an internal or external command.
4DOS first makes an INT 2Fh call to determine whether any TSR loaded will respond to the command, with:
AX AE00h
BX offset of command line buffer:
first byte = maximum length of command line
second byte = actual length of command line, not including
trailing CR
remainder = command line, with a trailing CR
CH FFh
CL length of command line, not including the command name
DX FFFFh
SI offset of command name buffer:
first byte = length of command name
remainder = command name, shifted to upper case
and padded with blanks to 11 characters
DS segment for command line and command name buffers
If the TSR does not recognize the command as its own, it must pass the INT 2Fh along with registers unchanged. If it does recognize the command, it must return 0FFh in AL. The command should not be executed at this point.
4DOS will then make another call (buffer formats are the same as above):
AX AE01h
BX offset of command line buffer
CH 0
CL length of command name
DX FFFFh
SI offset of command name buffer
DS segment for command line and command name buffers
If the TSR executes the command line, it must set the command name length at DS:[SI] to 0. If the command name length is not set to 0, 4DOS will attempt to execute the command as an internal or external command. This allows the TSR to return a modified command line to 4DOS by modifying the command line buffer at DS:BX, and leaving the command name length byte at DS:[SI] set to a non-zero value. If the command is executed,the TSR should return the result of the command (zero for normal return or non-zero for an error) in AL.
End of 4DOSTECH.TXT
Here's my 4DOSTSR.BAS program so far;
$COMPILE EXE
$OPTION cntlbreak OFF
$ERROR ALL ON
$INCLUDE "REGNAMES.INC"
Dummy& = SETMEM(-700000)
POPUP MULTIPLEX &HAE00, &HFFFF
PRINT "Before Interrupt call"
PRINT "AX = ";
PRINT REG(%AX)
PRINT "BX = ";
PRINT REG(%BX)
PRINT "CX = ";
PRINT REG(%CX)
PRINT "DX = ";
PRINT REG(%DX)
REM If the TSR does not recognize the command as its own, it must pass
REM the INT 2Fh along with registers unchanged.
CALL INTERRUPT &H2F
PRINT "After Interrupt call"
PRINT "AX = ";
PRINT REG(%AX)
PRINT "BX = ";
PRINT REG(%BX)
PRINT "CX = ";
PRINT REG(%CX)
PRINT "DX = ";
PRINT REG(%DX)
POPUP SLEEP USING ems, "C:\TEMP\4DOSTSR.SWP"
End of 4DOSTSR.BAS
Now, I'm not sure where to loop this code to check for the call from 4DOS, or if I'm on the right track or not so far.
I've looked at the "Popping up on the multiplex interrupt" section in the PB user's guide, but it is using POPUP KEY as the TSR activator.
Any constructive suggestions would be appreciated.
Thanks,
Joe
Comment