Virtual Devices (3.1) (vdag31qh.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Install_IO_Handler
                                                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
include vmm.inc
 
mov     esi, IOCallback     ; points to callback procedure
mov     edx, Port           ; I/O port number
VMMcall Install_IO_Handler
 
jc      not_installed       ; carry set if procedure not installed
 
The Install_IO_Handler service installs a callback procedure for I/O port
trapping and enables trapping for the specified port. Only one procedure may
be installed for a given port.
 
This service is only available during initialization.
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
IOCallback  Points to the callback procedure. See the Comments for more
            information about the callback procedure.
 
Port        Specifies the I/O port to be trapped.
 
Return Value
 
The carry flag is clear if the service successfully installs the callback
procedure. If the carry flag is set, a callback procedure is already
installed for the specified port or the system limit for I/O callback
procedures has been reached.
 
Comments
 
The system calls the callback procedure whenever a program in a virtual
machine attempts to access the specified I/O port, and I/O trapping is
enabled. The system calls the procedure as follows:
 
mov     ebx, VM             ; current VM handle
mov     ecx, IOType         ; type of I/O
mov     edx, Port           ; port number
mov     ebp, OFFSET32 crs   ; points to a Client_Reg_Struc
mov     eax, Data           ; output data (if I/O type is output)
call    [IOCallback]
 
mov     [Data], eax         ; input data (if I/O type is input)
 
The VM parameter specifies the current virtual machine, Port specifies the
I/O port, and crs points to a Client_Reg_Struc structure containing the
register contents for the current virtual machine.
 
The IOType parameter specifies the type of input or output operation
requested and determines whether the callback procedure receives data in the
EAX register or must return data in the EAX register. The IOType parameter
can be a combination of the following values:
 
Value         Meaning
────────────────────────────────────────────────────────────────────────────
Byte_Input    Input a single byte; place in AL if String_IO not given.
 
Byte_Output   Output a single byte from AL if String_IO not given.
 
Word_Input    Input a word; place in AX if String_IO not given.
 
Word_Output   Output a word from AX if String_IO not given.
 
Dword_Input   Input a double word; place in EAX if String_IO not given.
 
Dword_Output  Output a double word from EAX if String_IO not given.
 
String_IO     Input or output a string. The high 16-bits specifies segment
              address of buffer containing the string to output or to
              receive the string input.
 
Rep_IO        Repeat the input or output string operation the number of
              times specified by the Client_CX field in the
              Client_Reg_Struc structure.
 
Addr_32_IO    Use 32-bit address offsets for input or output string
              operations. If this value is not given, the 16-bit offsets are
              used.
 
Reverse_IO    Decrement string address on each input or output operation. If
              this value is not given, the string address is incremented on
              each operation.
 
A virtual machine can disable trapping of a port for every or for specific
virtual machines by using the Disable_Global_Trapping and
Disable_Local_Trapping services.
 
Uses
 
Flags
 
See Also
 
Disable_Global_Trapping, Disable_Local_Trapping, Install_Mult_IO_Handlers