@database "gameport"
@master "ADCD_v1.2:IncludesD/Inc&AD1.3/doc/gameport.doc"

@Node Main "gameport.doc"
@TOC 1.3Includes_Autodocs/Autodocs

@{" CMD_CLEAR " Link "CMD_CLEAR"}       @{" GPD_ASKTRIGGER " Link "GPD_ASKTRIGGER"}    @{" GPD_SETCTYPE " Link "GPD_SETCTYPE"}
@{" GPD_ASKCTYPE " Link "GPD_ASKCTYPE"}    @{" GPD_READEVENT " Link "GPD_READEVENT"}     @{" GPD_SETTRIGGER " Link "GPD_SETTRIGGER"}

@EndNode

@Node "CMD_CLEAR" "gameport.device/CMD_CLEAR"

NAME
    CMD_CLEAR - clear gameport input buffer

FUNCTION
    Remove from the input buffer any gameport reports waiting to
    satisfy read requests.

IO REQUEST
    io_Message      mn_ReplyPort set if quick I/O is not possible
    io_Device       preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Unit         preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Command      CMD_CLEAR
    io_Flags        IOB_QUICK set if quick I/O is possible

@EndNode

@Node "GPD_ASKCTYPE" "gameport.device/GPD_ASKCTYPE"

NAME
    GPD_ASKCTYPE - inquire the current game port controller type

FUNCTION
    This command identifies the type of controller at the game
    port, so that the signals at the port may be properly
    interpreted.  The controller type has been set by a previous
    @{"GPD_SETCTYPE" Link "GPD_SETCTYPE"}.

    This command always executes immediately.

IO REQUEST
    io_Message      mn_ReplyPort set if quick I/O is not possible
    io_Device       preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Unit         preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Command      GPD_ASKCTYPE
    io_Flags        IOB_QUICK set if quick I/O is possible
    io_Length       at least 1
    io_Data         the address of the byte variable for the
                    result

@EndNode

@Node "GPD_ASKTRIGGER" "gameport.device/GPD_ASKTRIGGER"

NAME
    GPD_ASKTRIGGER - inquire the conditions for a game port report

FUNCTION
    This command inquires what conditions must be met by a game
    port unit before a pending Read request will be satisfied.
    These conditions, called triggers, are independent -- that
    any one occurs is sufficient to queue a game port report to
    the Read queue.  These conditions are set by @{"GPD_SETTRIGGER" Link "GPD_SETTRIGGER"}.

    This command always executes immediately.

IO REQUEST
    io_Message      mn_ReplyPort set if quick I/O is not possible
    io_Device       preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Unit         preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Command      GPD_ASKTRIGGER
    io_Flags        IOB_QUICK set if quick I/O is possible
    io_Length       sizeof(gameportTrigger)
    io_Data         a structure of type GameportTrigger, which
                    has the following elements
        gpt_Keys -
                GPTB_DOWNKEYS set if button down transitions
                trigger a report, and GPTB_UPKEYS set if button up
                transitions trigger a report
        gpt_Timeout -
                a time which, if exceeded, triggers a report;
                measured in vertical blank units (60/sec)
        gpt_XDelta  -
                a distance in x which, if exceeded, triggers a
                report
        gpt_YDelta  -
                a distance in x which, if exceeded, triggers a
                report

@EndNode

@Node "GPD_READEVENT" "gameport.device/GPD_READEVENT"

NAME
    GPD_READEVENT - return the next game port event.

FUNCTION
    Read game port events from the game port and put them in the
    data area of the iORequest.  If there are no pending game port
    events, this command will not be satisfied, but if there are
    some events, but not as many as can fill IO_LENGTH, the
    request will be satisfied with those currently available.

IO REQUEST
    io_Message      mn_ReplyPort set if quick I/O is not possible
    io_Device       preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Unit         preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Command      GPD_READEVENT
    io_Flags        IOB_QUICK set if quick I/O is possible
    io_Length       the size of the io_Data area in bytes: there
                    are sizeof(inputEvent) bytes per input event.
    io_Data         a buffer area to fill with input events.  The
                    fields of the input event are:
        ie_NextEvent
                    links the events returned
        ie_Class
                    is IECLASS_RAWMOUSE
        ie_SubClass
                    is 0 for the left, 1 for the right game port
        ie_Code
                    contains any gameport button reports.  No
                    report is indicated by the value 0xff.
        ie_Qualifier
                    only the relative and button bits are set
        ie_X, ie_Y
                    the x and y values for this report, in either
                    relative or absolute device dependent units.
        ie_TimeStamp
                    the delta time since the last report, given
                    not as a standard timestamp, but as the frame
                    count in the TV_SECS field.

RESULTS
    This function sets the error field in the iORequest, and fills
    the iORequest with the next game port events (but not partial
    events).

SEE ALSO
    @{"gameport.device/GPD_SETCTYPE" Link "GPD_SETCTYPE"}, @{"gameport.device/GPD_SETTRIGGER" Link "GPD_SETTRIGGER"}

@EndNode

@Node "GPD_SETCTYPE" "gameport.device/GPD_SETCTYPE"

NAME
    GPD_SETCTYPE - set the current game port controller type

FUNCTION
    This command sets the type of device at the game port, so that
    the signals at the port may be properly interpreted.  The port
    can also be turned off, so that no reports are generated.

    This command always executes immediately.

IO REQUEST
    io_Message      mn_ReplyPort set if quick I/O is not possible
    io_Device       preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Unit         preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Command      GPD_SETCTYPE
    io_Flags        IOB_QUICK set if quick I/O is possible
    io_Length       1
    io_Data         the address of the byte variable describing
                    the controller type, as per the equates in
                    the gameport include file

@EndNode

@Node "GPD_SETTRIGGER" "gameport.device/GPD_SETTRIGGER"

NAME
    GPD_SETTRIGGER - set the conditions for a game port report

FUNCTION
    This command sets what conditions must be met by a game
    port unit before a pending Read request will be satisfied.
    These conditions, called triggers, are independent -- that
    any one occurs is sufficient to queue a game port report to
    the Read queue.  These conditions are inquired with
    @{"GPD_ASKTRIGGER" Link "GPD_ASKTRIGGER"}.

    This command always executes immediately.

IO REQUEST
    io_Message      mn_ReplyPort set if quick I/O is not possible
    io_Device       preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Unit         preset by the call to @{"OpenDevice" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/exec/OpenDevice()"}
    io_Command      GPD_SETTRIGGER
    io_Flags        IOB_QUICK set if quick I/O is possible
    io_Length       sizeof(gameportTrigger)
    io_Data         a structure of type GameportTrigger, which
                    has the following elements
        gpt_Keys -
                GPTB_DOWNKEYS set if button down transitions
                trigger a report, and GPTB_UPKEYS set if button up
                transitions trigger a report
        gpt_Timeout -
                a time which, if exceeded, triggers a report;
                measured in vertical blank units (60/sec)
        gpt_XDelta  -
                a distance in x which, if exceeded, triggers a
                report
        gpt_YDelta  -
                a distance in x which, if exceeded, triggers a
                report

@EndNode

