Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Combined SYS device drivers - more than 1 driver in a file (Announce)

posted by Arjay, 21.06.2010, 17:48
(edited by Arjay on 21.06.2010, 18:10)

> snippety-snip... Just an detail which you may or may not remember
>
> >> The reason is that an FFFFFFFFh value denotes the LAST driver in the
> DOS
> >> driver list.

> Actually, when loading a driver, MS-DOS (others ?) check only the
> segment part (high word) of this double word for the special value
> FFFFh. This behaviour (by design?) will allow us to make a dual device
> driver/ dot com executable, using the first two bytes as a short jump over
> the rest of the driver header. Of course, the init routine for the 'sys'
> specific part of the init code should replace FFFF at offset zero before
> giving back control to the DOS system initialisation routines...
>

With the aid of RJDUMP and a single example of such 2 in 1 SYS file. I have established that there exists a multiple SYS device file format (at least on MS-DOS) which is also supported by LOADSYS. This explains why MS-DOS at the least does NOT expect the "Offset To Next Driver" value and indeed "Segment Address of Next Driver" to always be ZERO as sometimes they shouldn't be.

To explain, lets look the following RJDUMP snippet from such a driver:

Offset Address of Next Driver                         0012h  ( 18d )
Segment Address of Next Driver                        0000h  ( 0d )


Firstly note that neither value are FFFFh as most people would expect them to be. So effectively the logic here would "appear" to be that if "Segment Address of Next Driver" is set to 0000h and "Offset Address of Next Driver" is non-zero then DOS expects "Offset Address of Next Driver" to point to a another header *within* the same file. Indeed in this example case the value 00012h tells us that a second SYS header "follows" the first header at offset 0012h or 18 in decimal, all of which makes perfect sense since the SYS header structure is 18 bytes long. For those of you unfamiliar with it, here it is:


    OfsAddrOfNextDriver : Word;                    {2 bytes+}
    SegAddrOfNextDriver : Word;                    {2 bytes+}
    DeviceAttributes    : Word;                    {2 bytes+}
    OfsAddrOfStrategy   : Word;                    {2 bytes+}
    OfsAddrOfInterrupt  : Word;                    {2 bytes+}
    DeviceName          : Array[1..8] of Char;     {8 bytes=18 bytes!}


From this I thus now strongly suspect that many multiple SYS files can be combined/daisy chained together with the list ending with $FFFF $FFFF (as happens in memory). I haven't had the time or interest to test this yet but am providing the information here to enable others to investigate. It will also be interesting to see if this SYS logic is "correct" on non MS-DOS's.

Note: I also haven't seen *any* documentation on this and have just worked it out based on a 1 such device driver that I have/Ninho's earlier comments.
I am thus providing this technical information here for those of you who may be interested in testing further. Any info you find out would be appreciated.

Below is a complete RJDUMP for the driver that I have here after I updated RJDUMP to deal with the above logic. Again as you can see all of the driver information (which I haven't altered) makes perfect sense when viewed in this way:

DOS SYS Header
Offset Address of Next Driver                         0012h  ( 18d )
Segment Address of Next Driver                        0000h  ( 0d )

DeviceName                                            'COM5    '
Device attributes          1000100000000000b          8800h  ( 34816d )
   Bit 15  =  1    Device driver type                 Character
   Bit 14  =  0    Supports functions 03h and 0Ch?    No
   Bit 13  =  0    Supports function 10h?             No
   Bit 12  =  0    Reserved                           
   Bit 11  =  1    Supports functions ODh and OEh?    Yes
   Bit 10  =  0    Reserved                           
   Bit  9  =  0    Reserved                           
   Bit  8  =  0    Reserved                           
   Bit  7  =  0    Reserved                           
   Bit  6  =  0    Reserved                           
   Bit  5  =  0    Reserved                           
   Bit  4  =  0    Reserved                           
   Bit  3  =  0    Current clock$ device?             No
   Bit  2  =  0    Current NUL driver?                No
   Bit  1  =  0    Current standard output driver?    No
   Bit  0  =  0    Current standard output driver?    No
Offset address of strategy routine                    0056h  ( 86d )
Offset address of Interrupt routine                   0061h  ( 97d )


DOS SYS Header
Offset Address of Next Driver                         FFFFh  ( 65535d )
Segment Address of Next Driver                        FFFFh  ( 65535d )

DeviceName                                            'COM6    '
Device attributes          1000100000000000b          8800h  ( 34816d )
   Bit 15  =  1    Device driver type                 Character
   Bit 14  =  0    Supports functions 03h and 0Ch?    No
   Bit 13  =  0    Supports function 10h?             No
   Bit 12  =  0    Reserved                           
   Bit 11  =  1    Supports functions ODh and OEh?    Yes
   Bit 10  =  0    Reserved                           
   Bit  9  =  0    Reserved                           
   Bit  8  =  0    Reserved                           
   Bit  7  =  0    Reserved                           
   Bit  6  =  0    Reserved                           
   Bit  5  =  0    Reserved                           
   Bit  4  =  0    Reserved                           
   Bit  3  =  0    Current clock$ device?             No
   Bit  2  =  0    Current NUL driver?                No
   Bit  1  =  0    Current standard output driver?    No
   Bit  0  =  0    Current standard output driver?    No
Offset address of strategy routine                    0056h  ( 86d )
Offset address of Interrupt routine                   0078h  ( 120d )



Note: The "shared" common strategy routine but separate Interrupt handlers with the first driver pointing to the second and the second starting $FFFF $FFFF thus ending the chain.

 

Complete thread:

Back to the forum
Board view  Mix view
22779 Postings in 2122 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum