Hi All, 

At present, the interface program for Logger just performs a slightly optimized 
brute force search for the Logger device driver. Although reliable, it is very 
slow compared to providing a simple interrupt call to test for installation. 
Looking at the different interrupts, I think I have come up with a solution 
that will work well for Logger and any other driver or program that needs such 
a check. So, I’d like to propose a “standard” we could use. I’d like to get 
your feedback on what I’m thinking…

Looking at RBIL, interrupt 0x2b is barely used by anything. Under MS-DOS and 
FreeDOS, this simply points to an IRET. Under IBM ROM-DOS, AH functions 
0x00-0x03 do some things. But, all other calls do nothing. 

 https://fd.lod.bz/rbil/interrup/dos_kernel/2b.html 
<https://fd.lod.bz/rbil/interrup/dos_kernel/2b.html>

An install check issuing this interrupt would be simple to perform. A program 
could set the Carry Flag, load AH/AX with “check for install” function and set 
DS:BX to point to an identifier string (minimum 8 characters, no maximum). Then 
call the interrupt. On return, if the Carry Flag is still set, then the install 
check failed. If the Carry Flag is clear, it succeeded and other register would 
be modified to according to the needs of the programs. 

Implementation for Logger (as an example) could be:

        
CHECK:
        push cs
        pop  ds                         ; set DS to our code segment
        stc                             ; set the carry flag            
        mov  ax, 0xfd00                 ; set AX to install check function
        mov  bx, LOGGER_ID              ; offset to LOGGER device driver ID
        int  0x2b                       ; call install check interrupt
        jc   NOT_INSTALLED              ; nothing changed, driver is not loaded
        mov  [DRIVER_PTR + 2], es       ; save segment of far call to driver 
function dispatcher
        mov  [DRIVER_PTR], di           ; save offset of far call to driver 
function dispatcher
        jmp  MAIN

DRIVER_PTR:
        dw 0, 0                         ; pointer to driver function dispatcher

LOGGER_ID:
        db 'LOGGERxx'                   ; Logger device driver identifier. 8+ 
Characters.

MAIN:                                   ; do program stuff

NOT_INSTALLED:                          ; driver not loaded, die now with error 
message
        

As for the installed Driver, TSR or other extension, you just hook int 0x2b. If 
AX=0xFD00 and DS:BX points to an identifier you recognize, then it would clear 
the carry flag and return values in whatever registers required. Otherwise, it 
completely ignore it and just jump to the previous interrupt handler. 

It requires no additions to the kernel, is backwards compatible and should have 
a low probability of any collisions. 

Any thoughts on using it as a very minimal “standard” extension installation 
check? 

:-)

Jerome
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to