include vmm.inc Begin_Control_Dispatch DeviceName |
The Begin_Control_Dispatch macro builds a table for dispatching messages passed to the control procedure for the specified virtual device. This macro is used in conjunction with the Control_Dispatch and End_Control_Dispatch macros.
DeviceName
Specifies the name of the virtual device. The macro uses this parameter to construct the label for the control procedure (appends _Control to the end of this name). This control procedure label must also be specified in the Declare_Virtual_Device macro
This macro has no return value.
The Control_Dispatch macro can be used without Begin_Control_Dispatch, but then it the programmer's responsibility to declare a procedure in locked code (VxD_LOCKED_CODE_SEG), and clear the carry flag for any unprocessed messages. The advantage in using Begin_Control_Dispatch macro is when a large number of messages are processed by a device. The macro builds a jump table which usually requires less code than the sequence of compare and jump instructions that are generated when Control_Dispatch is used alone.
The following example builds a complete dispatch table for the virtual device named MyDevice:
Begin_Control_Dispatch MyDevice
Control_Dispatch Device_Init, MyDeviceInitProcedure
Control_Dispatch Sys_VM_Init, MyDeviceSysInitProcedure
Control_Dispatch Create_VM, MyDeviceCreateVMProcedure
End_Control_Dispatch MyDevice
Control_Dispatch, Declare_Virtual_Device, End_Control_Dispatch