12.6 SYS - Device drivers
--------------------------
The compiler makes it much easier to write drivers, because it creates
the driver headers and the STRATEGY and INTERRUPT functions itself. You
only need to write the command processing code.
In order to compile a device driver file, add /sys on the command line.
There are also new compiler directives which act only with this switch:
?sysattribute <value> - this directive passes the driver attribute to
the compiler, the default value being 0x2000.
?sysname <text string> - this directive sends the compiler the name of
the future driver, with the default being "NO_NAME". The name can be up to
8 characters.
?syscommand <command_0>,<command_1>, ... <command_n>; - this directive
is obligatory. It is used to send a list of names of functions for
processing driver commands. The names are separated by commas. The list
ends with a semicolon ';'. No more than 25 commands can be sent. If any
command has no support code you must write the word NONE in the list.
By default the compiler does not create any stack for the driver. The
driver may use the system stack, but sometimes this is very small. If your
functions make active use of the stack and you don't want to use the system
stack, use the directive ?stack <size> to force the driver to use its own
stack.
The address of the header of the request will be passed to your
functions for processing command when transferring control in registers
ES:BX. Register DS is equal to CS. When control is returned, your functions
must retain register DS. Register AX must contain the return code. The
other registers may be used as you wish.
The command initialization processing function should be last (so that
the address space occupied by this function can be returned to the
operating system). If dynamic functions are used in other command
processing functions, this function must be preceeded by the directive
?setdinproc. Global variables must be initialized.