OPTION EXPLICIT

IMPORT OSExec
IMPORT OSUtility

CONST AS BYTE ADHARD_CHANNELS = 4
CONST AS BYTE ADALLOC_MINPREC = -128
CONST AS BYTE ADALLOC_MAXPREC = 127

CONST AS UINTEGER ADCMD_FREE       = CMD_NONSTD+0
CONST AS UINTEGER ADCMD_SETPREC    = CMD_NONSTD+1
CONST AS UINTEGER ADCMD_FINISH     = CMD_NONSTD+2
CONST AS UINTEGER ADCMD_PERVOL     = CMD_NONSTD+3
CONST AS UINTEGER ADCMD_LOCK       = CMD_NONSTD+4
CONST AS UINTEGER ADCMD_WAITCYCLE  = CMD_NONSTD+5
CONST AS UINTEGER ADCMD_ALLOCATE   = 32

CONST AS UBYTE ADIOB_PERVOL        = 4
CONST AS UBYTE ADIOF_PERVOL        = 1 SHL 4
CONST AS UBYTE ADIOB_SYNCCYCLE     = 5
CONST AS UBYTE ADIOF_SYNCCYCLE     = 1 SHL 5
CONST AS UBYTE ADIOB_NOWAIT        = 6
CONST AS UBYTE ADIOF_NOWAIT        = 1 SHL 6
CONST AS UBYTE ADIOB_WRITEMESSAGE  = 7
CONST AS UBYTE ADIOF_WRITEMESSAGE  = 1 SHL 7

CONST AS BYTE ADIOERR_NOALLOCATION    = -10
CONST AS BYTE ADIOERR_ALLOCFAILED     = -11
CONST AS BYTE ADIOERR_CHANNELSTOLEN   = -12

TYPE IOAudio
    AS IORequest    ioa_Request
    AS INTEGER      ioa_AllocKey
    AS UBYTE PTR    ioa_Data
    AS ULONG        ioa_Length
    AS UINTEGER     ioa_Period
    AS UINTEGER     ioa_Volume
    AS UINTEGER     ioa_Cycles
    AS Message      ioa_WriteMsg
END TYPE

TYPE BootBlock
    AS UBYTE    bb_id(3)
    AS LONG     bb_chksum
    AS LONG     bb_dosblock
END TYPE

CONST AS INTEGER BOOTSECTS = 2

CONST AS ULONG BBNAME_DOS = &H444F5300
CONST AS ULONG BBNAME_KICK = &H4B49434B

CONST AS UINTEGER CD_RESET = 1
CONST AS UINTEGER CD_READ = 2
CONST AS UINTEGER CD_WRITE = 3
CONST AS UINTEGER CD_UPDATE = 4
CONST AS UINTEGER CD_CLEAR = 5
CONST AS UINTEGER CD_STOP = 6
CONST AS UINTEGER CD_START = 7
CONST AS UINTEGER CD_FLUSH = 8
CONST AS UINTEGER CD_MOTOR = 9
CONST AS UINTEGER CD_SEEK = 10
CONST AS UINTEGER CD_FORMAT = 11
CONST AS UINTEGER CD_REMOVE = 12
CONST AS UINTEGER CD_CHANGENUM = 13
CONST AS UINTEGER CD_CHANGESTATE = 14
CONST AS UINTEGER CD_PROTSTATUS = 15
CONST AS UINTEGER CD_GETDRIVETYPE = 18
CONST AS UINTEGER CD_GETNUMTRACKS = 19
CONST AS UINTEGER CD_ADDCHANGEINT = 20
CONST AS UINTEGER CD_REMCHANGEINT = 21
CONST AS UINTEGER CD_GETGEOMETRY = 22
CONST AS UINTEGER CD_EJECT = 23
CONST AS UINTEGER CD_INFO = 32
CONST AS UINTEGER CD_CONFIG = 33
CONST AS UINTEGER CD_TOCMSF = 34
CONST AS UINTEGER CD_TOCLSN = 35
CONST AS UINTEGER CD_READXL = 36
CONST AS UINTEGER CD_PLAYTRACK = 37
CONST AS UINTEGER CD_PLAYMSF = 38
CONST AS UINTEGER CD_PLAYLSN = 39
CONST AS UINTEGER CD_PAUSE = 40
CONST AS UINTEGER CD_SEARCH = 41
CONST AS UINTEGER CD_QCODEMSF = 42
CONST AS UINTEGER CD_QCODELSN = 43
CONST AS UINTEGER CD_ATTENUATE = 44
CONST AS UINTEGER CD_ADDFRAMEINT = 45
CONST AS UINTEGER CD_REMFRAMEINT = 46

CONST AS BYTE CDERR_OPENFAIL        = -1
CONST AS BYTE CDERR_ABORTED         = -2
CONST AS BYTE CDERR_NOCMD           = -3
CONST AS BYTE CDERR_BADLENGTH       = -4
CONST AS BYTE CDERR_BADADDRESS      = -5
CONST AS BYTE CDERR_UNITBUSY        = -6
CONST AS BYTE CDERR_SELFTEST        = -7
CONST AS BYTE CDERR_NotSpecified = 20
CONST AS BYTE CDERR_NoSecHdr = 21
CONST AS BYTE CDERR_BadSecPreamble = 22
CONST AS BYTE CDERR_BadSecID = 23
CONST AS BYTE CDERR_BadHdrSum = 24
CONST AS BYTE CDERR_BadSecSum = 25
CONST AS BYTE CDERR_TooFewSecs = 26
CONST AS BYTE CDERR_BadSecHdr = 27
CONST AS BYTE CDERR_WriteProt = 28
CONST AS BYTE CDERR_NoDisk = 29
CONST AS BYTE CDERR_SeekError = 30
CONST AS BYTE CDERR_NoMem = 31
CONST AS BYTE CDERR_BadUnitNum = 32
CONST AS BYTE CDERR_BadDriveType = 33
CONST AS BYTE CDERR_DriveInUse = 34
CONST AS BYTE CDERR_PostReset = 35
CONST AS BYTE CDERR_BadDataType = 36
CONST AS BYTE CDERR_InvalidState = 37
CONST AS BYTE CDERR_Phase = 42
CONST AS BYTE CDERR_NoBoard = 50

CONST AS UINTEGER TAGCD_PLAYSPEED = &H0001
CONST AS UINTEGER TAGCD_READSPEED = &H0002
CONST AS UINTEGER TAGCD_READXLSPEED = &H0003
CONST AS UINTEGER TAGCD_SECTORSIZE = &H0004
CONST AS UINTEGER TAGCD_XLECC = &H0005
CONST AS UINTEGER TAGCD_EJECTRESET = &H0006

TYPE CDInfo
    AS UINTEGER     PlaySpeed
    AS UINTEGER     ReadSpeed
    AS UINTEGER     ReadXLSpeed
    AS UINTEGER     SectorSize
    AS UINTEGER     XLECC
    AS UINTEGER     EjectReset
    AS UINTEGER     Reserved1(3)
    AS UINTEGER     MaxSpeed
    AS UINTEGER     AudioPrecision
    AS UINTEGER     Status
    AS UINTEGER     Reserved2(3)
END TYPE

CONST AS UINTEGER CDSTSB_CLOSED = 0
CONST AS UINTEGER CDSTSB_DISK = 1
CONST AS UINTEGER CDSTSB_SPIN = 2
CONST AS UINTEGER CDSTSB_TOC = 3
CONST AS UINTEGER CDSTSB_CDROM = 4
CONST AS UINTEGER CDSTSB_PLAYING = 5
CONST AS UINTEGER CDSTSB_PAUSED = 6
CONST AS UINTEGER CDSTSB_SEARCH = 7
CONST AS UINTEGER CDSTSB_DIRECTION = 8
CONST AS UINTEGER CDSTSF_CLOSED = &H0001
CONST AS UINTEGER CDSTSF_DISK = &H0002
CONST AS UINTEGER CDSTSF_SPIN = &H0004
CONST AS UINTEGER CDSTSF_TOC = &H0008
CONST AS UINTEGER CDSTSF_CDROM = &H0010
CONST AS UINTEGER CDSTSF_PLAYING = &H0020
CONST AS UINTEGER CDSTSF_PAUSED = &H0040
CONST AS UINTEGER CDSTSF_SEARCH = &H0080
CONST AS UINTEGER CDSTSF_DIRECTION = &H0100

CONST AS UINTEGER CDMODE_NORMAL = 0
CONST AS UINTEGER CDMODE_FFWD = 1
CONST AS UINTEGER CDMODE_FREV = 2

CONST AS UBYTE CTLADR_CTLMASK = &HF0
CONST AS UBYTE CTL_CTLMASK = &HD0
CONST AS UBYTE CTL_2AUD        = &H00
CONST AS UBYTE CTL_2AUDEMPH    = &H10
CONST AS UBYTE CTL_4AUD        = &H80
CONST AS UBYTE CTL_4AUDEMPH    = &H90
CONST AS UBYTE CTL_DATA = &H40
CONST AS UBYTE CTL_COPYMASK = &H20
CONST AS UBYTE CTL_COPY = &H20
CONST AS UBYTE CTLADR_ADRMASK = &H0F
CONST AS UBYTE ADR_POSITION = &H01
CONST AS UBYTE ADR_UPC = &H02
CONST AS UBYTE ADR_ISRC = &H03
CONST AS UBYTE ADR_HYBRID = &H05

CONST AS UINTEGER CBD_POST         = CMD_NONSTD+0
CONST AS UINTEGER CBD_CURRENTREADID    = CMD_NONSTD+1
CONST AS UINTEGER CBD_CURRENTWRITEID   = CMD_NONSTD+2
CONST AS UINTEGER CBD_CHANGEHOOK       = CMD_NONSTD+3

CONST AS BYTE CBERR_OBSOLETEID = 1

TYPE ClipboardUnitPartial
    AS Node     cu_Node
    AS ULONG    cu_UnitNum
END TYPE

TYPE IOClipReq
    AS Message       io_Message
    AS Device PTR    io_Device
    AS ClipboardUnitPartial PTR    io_Unit
    AS UINTEGER      io_Command
    AS UBYTE         io_Flags
    AS BYTE          io_Error
    AS ULONG         io_Actual
    AS ULONG         io_Length
    AS STRING        io_Data
    AS ULONG         io_Offset
    AS LONG          io_ClipID
END TYPE

CONST AS LONG PRIMARY_CLIP = 0

TYPE SatisfyMsg
    AS Message      sm_Msg
    AS UINTEGER     sm_Unit
    AS LONG         sm_ClipID
END TYPE

TYPE ClipHookMsg
    AS ULONG    chm_Type
    AS LONG     chm_ChangeCmd
    AS LONG     chm_ClipID
END TYPE

TYPE KeyMap
    AS UBYTE PTR    km_LoKeyMapTypes
    AS ULONG PTR    km_LoKeyMap
    AS UBYTE PTR    km_LoCapsable
    AS UBYTE PTR    km_LoRepeatable
    AS UBYTE PTR    km_HiKeyMapTypes
    AS ULONG PTR    km_HiKeyMap
    AS UBYTE PTR    km_HiCapsable
    AS UBYTE PTR    km_HiRepeatable
END TYPE

TYPE KeyMapNode
    AS Node         kn_Node
    AS KeyMap       kn_KeyMap
END TYPE

TYPE KeyMapResource
    AS Node         kr_Node
    AS List         kr_List
END TYPE

CONST AS UBYTE KC_NOQUAL = 0
CONST AS UBYTE KC_VANILLA = 7
CONST AS UBYTE KCB_SHIFT = 0
CONST AS UBYTE KCF_SHIFT = &H01
CONST AS UBYTE KCB_ALT = 1
CONST AS UBYTE KCF_ALT = &H02
CONST AS UBYTE KCB_CONTROL = 2
CONST AS UBYTE KCF_CONTROL = &H04
CONST AS UBYTE KCB_DOWNUP = 3
CONST AS UBYTE KCF_DOWNUP = &H08
CONST AS UBYTE KCB_DEAD = 5
CONST AS UBYTE KCF_DEAD = &H20
CONST AS UBYTE KCB_STRING = 6
CONST AS UBYTE KCF_STRING = &H40
CONST AS UBYTE KCB_NOP = 7
CONST AS UBYTE KCF_NOP = &H80
CONST AS UBYTE DPB_MOD = 0
CONST AS UBYTE DPF_MOD = &H01
CONST AS UBYTE DPB_DEAD = 3
CONST AS UBYTE DPF_DEAD = &H08
CONST AS UBYTE DP_2DINDEXMASK  = &H0f
CONST AS UBYTE DP_2DFACSHIFT   = 4

CONST AS UBYTE IECLASS_NULL = &H00
CONST AS UBYTE IECLASS_RAWKEY = &H01
CONST AS UBYTE IECLASS_RAWMOUSE = &H02
CONST AS UBYTE IECLASS_EVENT = &H03
CONST AS UBYTE IECLASS_POINTERPOS = &H04
CONST AS UBYTE IECLASS_TIMER = &H06
CONST AS UBYTE IECLASS_GADGETDOWN = &H07
CONST AS UBYTE IECLASS_GADGETUP = &H08
CONST AS UBYTE IECLASS_REQUESTER = &H09
CONST AS UBYTE IECLASS_MENULIST = &H0A
CONST AS UBYTE IECLASS_CLOSEWINDOW = &H0B
CONST AS UBYTE IECLASS_SIZEWINDOW = &H0C
CONST AS UBYTE IECLASS_REFRESHWINDOW = &H0D
CONST AS UBYTE IECLASS_NEWPREFS = &H0E
CONST AS UBYTE IECLASS_DISKREMOVED = &H0F
CONST AS UBYTE IECLASS_DISKINSERTED = &H10
CONST AS UBYTE IECLASS_ACTIVEWINDOW = &H11
CONST AS UBYTE IECLASS_INACTIVEWINDOW = &H12
CONST AS UBYTE IECLASS_NEWPOINTERPOS = &H13
CONST AS UBYTE IECLASS_MENUHELP = &H14
CONST AS UBYTE IECLASS_CHANGEWINDOW = &H15
CONST AS UBYTE IECLASS_MAX = &H15
CONST AS UBYTE IESUBCLASS_COMPATIBLE = &H00
CONST AS UBYTE IESUBCLASS_PIXEL = &H01
CONST AS UBYTE IESUBCLASS_TABLET = &H02
CONST AS UBYTE IESUBCLASS_NEWTABLET = &H03

TYPE IEPointerPixel
    AS ANY PTR     iepp_Screen
    AS INTEGER     X
    AS INTEGER     Y
END TYPE

TYPE IEPointerTablet
    AS UINTEGER     X1
    AS UINTEGER     Y1
    AS UINTEGER     X2
    AS UINTEGER     Y2
    AS INTEGER     iept_Pressure
END TYPE

TYPE IENewTablet
    AS Hook PTR    ient_CallBack
    AS UINTEGER     ient_ScaledX, ient_ScaledY
    AS UINTEGER     ient_ScaledXFraction, ient_ScaledYFraction
    AS ULONG     ient_TabletX, ient_TabletY
    AS ULONG     ient_RangeX, ient_RangeY
    AS TagItem PTR    ient_TagList
END TYPE

CONST AS UINTEGER IECODE_UP_PREFIX = &H80
CONST AS UINTEGER IECODE_KEY_CODE_FIRST = &H00
CONST AS UINTEGER IECODE_KEY_CODE_LAST = &H77
CONST AS UINTEGER IECODE_COMM_CODE_FIRST = &H78
CONST AS UINTEGER IECODE_COMM_CODE_LAST = &H7F
CONST AS UINTEGER IECODE_C0_FIRST          = &H00
CONST AS UINTEGER IECODE_C0_LAST           = &H1F
CONST AS UINTEGER IECODE_ASCII_FIRST = &H20
CONST AS UINTEGER IECODE_ASCII_LAST = &H7E
CONST AS UINTEGER IECODE_ASCII_DEL = &H7F
CONST AS UINTEGER IECODE_C1_FIRST          = &H80
CONST AS UINTEGER IECODE_C1_LAST           = &H9F
CONST AS UINTEGER IECODE_LATIN1_FIRST      = &HA0
CONST AS UINTEGER IECODE_LATIN1_LAST       = &HFF
CONST AS UINTEGER IECODE_LBUTTON = &H68
CONST AS UINTEGER IECODE_RBUTTON = &H69
CONST AS UINTEGER IECODE_MBUTTON = &H6A
CONST AS UINTEGER IECODE_NOBUTTON = &HFF
CONST AS UINTEGER IECODE_NEWACTIVE = &H01
CONST AS UINTEGER IECODE_NEWSIZE = &H02
CONST AS UINTEGER IECODE_REFRESH = &H03
CONST AS UINTEGER IECODE_REQSET = &H01
CONST AS UINTEGER IECODE_REQCLEAR = &H00

CONST AS UINTEGER IEQUALIFIER_LSHIFT = &H0001
CONST AS UINTEGER IEQUALIFIER_RSHIFT = &H0002
CONST AS UINTEGER IEQUALIFIER_CAPSLOCK = &H0004
CONST AS UINTEGER IEQUALIFIER_CONTROL = &H0008
CONST AS UINTEGER IEQUALIFIER_LALT = &H0010
CONST AS UINTEGER IEQUALIFIER_RALT = &H0020
CONST AS UINTEGER IEQUALIFIER_LCOMMAND = &H0040
CONST AS UINTEGER IEQUALIFIER_RCOMMAND = &H0080
CONST AS UINTEGER IEQUALIFIER_NUMERICPAD = &H0100
CONST AS UINTEGER IEQUALIFIER_REPEAT = &H0200
CONST AS UINTEGER IEQUALIFIER_INTERRUPT = &H0400
CONST AS UINTEGER IEQUALIFIER_MULTIBROADCAST = &H0800
CONST AS UINTEGER IEQUALIFIER_MIDBUTTON = &H1000
CONST AS UINTEGER IEQUALIFIER_RBUTTON = &H2000
CONST AS UINTEGER IEQUALIFIER_LEFTBUTTON = &H4000
CONST AS UINTEGER IEQUALIFIER_RELATIVEMOUSE = &H8000
CONST AS UINTEGER IEQUALIFIERB_LSHIFT = 0
CONST AS UINTEGER IEQUALIFIERB_RSHIFT = 1
CONST AS UINTEGER IEQUALIFIERB_CAPSLOCK = 2
CONST AS UINTEGER IEQUALIFIERB_CONTROL = 3
CONST AS UINTEGER IEQUALIFIERB_LALT = 4
CONST AS UINTEGER IEQUALIFIERB_RALT = 5
CONST AS UINTEGER IEQUALIFIERB_LCOMMAND = 6
CONST AS UINTEGER IEQUALIFIERB_RCOMMAND = 7
CONST AS UINTEGER IEQUALIFIERB_NUMERICPAD = 8
CONST AS UINTEGER IEQUALIFIERB_REPEAT = 9
CONST AS UINTEGER IEQUALIFIERB_INTERRUPT = 10
CONST AS UINTEGER IEQUALIFIERB_MULTIBROADCAST = 11
CONST AS UINTEGER IEQUALIFIERB_MIDBUTTON = 12
CONST AS UINTEGER IEQUALIFIERB_RBUTTON = 13
CONST AS UINTEGER IEQUALIFIERB_LEFTBUTTON = 14
CONST AS UINTEGER IEQUALIFIERB_RELATIVEMOUSE = 15

TYPE InputEvent
    AS InputEvent PTR    ie_NextEvent
    AS UBYTE             ie_Class
    AS UBYTE             ie_SubClass
    AS UINTEGER          ie_Code
    AS UINTEGER          ie_Qualifier
    REM FIXME AS union     {

    REM FIXME AS struct     {

    REM FIXME AS INTEGER     ie_x
    REM FIXME AS INTEGER     ie_y
    REM FIXME AS APTR     ie_addr
    REM FIXME AS struct     {

    REM FIXME AS UBYTE     ie_prev1DownCode
    REM FIXME AS UBYTE     ie_prev1DownQual
    REM FIXME AS UBYTE     ie_prev2DownCode
    REM FIXME AS UBYTE     ie_prev2DownQual
    REM FIXME AS timeval     ie_TimeStamp
END TYPE

CONST AS UINTEGER CD_ASKKEYMAP         = CMD_NONSTD+0
CONST AS UINTEGER CD_SETKEYMAP         = CMD_NONSTD+1
CONST AS UINTEGER CD_ASKDEFAULTKEYMAP  = CMD_NONSTD+2
CONST AS UINTEGER CD_SETDEFAULTKEYMAP  = CMD_NONSTD+3

CONST AS UBYTE SGR_PRIMARY = 0
CONST AS UBYTE SGR_BOLD = 1
CONST AS UBYTE SGR_ITALIC = 3
CONST AS UBYTE SGR_UNDERSCORE = 4
CONST AS UBYTE SGR_NEGATIVE = 7
CONST AS UBYTE SGR_NORMAL = 22
CONST AS UBYTE SGR_NOTITALIC = 23
CONST AS UBYTE SGR_NOTUNDERSCORE = 24
CONST AS UBYTE SGR_POSITIVE = 27
CONST AS UBYTE SGR_BLACK = 30
CONST AS UBYTE SGR_RED = 31
CONST AS UBYTE SGR_GREEN = 32
CONST AS UBYTE SGR_YELLOW = 33
CONST AS UBYTE SGR_BLUE = 34
CONST AS UBYTE SGR_MAGENTA = 35
CONST AS UBYTE SGR_CYAN = 36
CONST AS UBYTE SGR_WHITE = 37
CONST AS UBYTE SGR_DEFAULT = 39
CONST AS UBYTE SGR_BLACKBG = 40
CONST AS UBYTE SGR_REDBG = 41
CONST AS UBYTE SGR_GREENBG = 42
CONST AS UBYTE SGR_YELLOWBG = 43
CONST AS UBYTE SGR_BLUEBG = 44
CONST AS UBYTE SGR_MAGENTABG = 45
CONST AS UBYTE SGR_CYANBG = 46
CONST AS UBYTE SGR_WHITEBG = 47
CONST AS UBYTE SGR_DEFAULTBG = 49
CONST AS UBYTE SGR_CLR0    = 30
CONST AS UBYTE SGR_CLR1    = 31
CONST AS UBYTE SGR_CLR2    = 32
CONST AS UBYTE SGR_CLR3    = 33
CONST AS UBYTE SGR_CLR4    = 34
CONST AS UBYTE SGR_CLR5    = 35
CONST AS UBYTE SGR_CLR6    = 36
CONST AS UBYTE SGR_CLR7    = 37
CONST AS UBYTE SGR_CLR0BG  = 40
CONST AS UBYTE SGR_CLR1BG  = 41
CONST AS UBYTE SGR_CLR2BG  = 42
CONST AS UBYTE SGR_CLR3BG  = 43
CONST AS UBYTE SGR_CLR4BG  = 44
CONST AS UBYTE SGR_CLR5BG  = 45
CONST AS UBYTE SGR_CLR6BG  = 46
CONST AS UBYTE SGR_CLR7BG  = 47
CONST AS UBYTE DSR_CPR = 6
CONST AS UBYTE CTC_HSETTAB = 0
CONST AS UBYTE CTC_HCLRTAB = 2
CONST AS UBYTE CTC_HCLRTABSALL = 5
CONST AS UBYTE TBC_HCLRTAB = 0
CONST AS UBYTE TBC_HCLRTABSALL = 3
CONST AS UBYTE M_LNM = 20

CONST AS LONG CONU_LIBRARY  = -1
CONST AS LONG CONU_STANDARD = 0
CONST AS LONG CONU_CHARMAP = 1
CONST AS LONG CONU_SNIPMAP = 3
CONST AS LONG CONFLAG_DEFAULT = 0
CONST AS LONG CONFLAG_NODRAW_ON_NEWSIZE = 1

CONST AS UBYTE PMB_ASM   = M_LNM+1
CONST AS UBYTE PMB_AWM   = PMB_ASM+1
CONST AS INTEGER MAXTABS = 80

TYPE ConUnit
    AS MsgPort      cu_MP
    AS ANY PTR      cu_Window
    AS INTEGER      cu_XCP
    AS INTEGER      cu_YCP
    AS INTEGER      cu_XMax
    AS INTEGER      cu_YMax
    AS INTEGER      cu_XRSize
    AS INTEGER      cu_YRSize
    AS INTEGER      cu_XROrigin
    AS INTEGER      cu_YROrigin
    AS INTEGER      cu_XRExtant
    AS INTEGER      cu_YRExtant
    AS INTEGER      cu_XMinShrink
    AS INTEGER      cu_YMinShrink
    AS INTEGER      cu_XCCP
    AS INTEGER      cu_YCCP
    AS KeyMap       cu_KeyMapStruct
    AS UINTEGER     cu_TabStops(MAXTABS-1)
    AS BYTE         cu_Mask
    AS BYTE         cu_FgPen
    AS BYTE         cu_BgPen
    AS BYTE         cu_AOLPen
    AS BYTE         cu_DrawMode
    AS BYTE         cu_Obsolete1
    AS ANY PTR      cu_Obsolete2
    AS UBYTE        cu_Minterms(7)
    REM FIXME AS TextFont PTR    cu_Font
    AS ANY PTR      cu_Font
    AS UBYTE        cu_AlgoStyle
    AS UBYTE        cu_TxFlags
    AS UINTEGER     cu_TxHeight
    AS UINTEGER     cu_TxWidth
    AS UINTEGER     cu_TxBaseline
    AS INTEGER      cu_TxSpacing
    AS UBYTE        cu_Modes((PMB_AWM+7)/8 - 1)
    AS UBYTE        cu_RawEvents((IECLASS_MAX+8)/8-1)
END TYPE

CONST AS UINTEGER GPD_READEVENT      = CMD_NONSTD+0
CONST AS UINTEGER GPD_ASKCTYPE       = CMD_NONSTD+1
CONST AS UINTEGER GPD_SETCTYPE       = CMD_NONSTD+2
CONST AS UINTEGER GPD_ASKTRIGGER     = CMD_NONSTD+3
CONST AS UINTEGER GPD_SETTRIGGER     = CMD_NONSTD+4

CONST AS UINTEGER GPTB_DOWNKEYS = 0
CONST AS UINTEGER GPTF_DOWNKEYS = 1 SHL 0
CONST AS UINTEGER GPTB_UPKEYS   = 1
CONST AS UINTEGER GPTF_UPKEYS   = 1 SHL 1

TYPE GamePortTrigger
    AS UINTEGER     gpt_Keys
    AS UINTEGER     gpt_Timeout
    AS UINTEGER     gpt_XDelta
    AS UINTEGER     gpt_YDelta
END TYPE

CONST AS BYTE GPCT_ALLOCATED    = -1
CONST AS BYTE GPCT_NOCONTROLLER = 0
CONST AS BYTE GPCT_MOUSE        = 1
CONST AS BYTE GPCT_RELJOYSTICK  = 2
CONST AS BYTE GPCT_ABSJOYSTICK  = 3

CONST AS BYTE GPDERR_SETCTYPE   = 1

TYPE RigidDiskBlock
    AS ULONG     rdb_ID
    AS ULONG     rdb_SummedLongs
    AS LONG      rdb_ChkSum
    AS ULONG     rdb_HostID
    AS ULONG     rdb_BlockBytes
    AS ULONG     rdb_Flags
    AS ULONG     rdb_BadBlockList
    AS ULONG     rdb_PartitionList
    AS ULONG     rdb_FileSysHeaderList
    AS ULONG     rdb_DriveInit
    AS ULONG     rdb_Reserved1(5)
    AS ULONG     rdb_Cylinders
    AS ULONG     rdb_Sectors
    AS ULONG     rdb_Heads
    AS ULONG     rdb_Interleave
    AS ULONG     rdb_Park
    AS ULONG     rdb_Reserved2(2)
    AS ULONG     rdb_WritePreComp
    AS ULONG     rdb_ReducedWrite
    AS ULONG     rdb_StepRate
    AS ULONG     rdb_Reserved3(4)
    AS ULONG     rdb_RDBBlocksLo
    AS ULONG     rdb_RDBBlocksHi
    AS ULONG     rdb_LoCylinder
    AS ULONG     rdb_HiCylinder
    AS ULONG     rdb_CylBlocks
    AS ULONG     rdb_AutoParkSeconds
    AS ULONG     rdb_HighRDSKBlock
    AS ULONG     rdb_Reserved4
    AS BYTE      rdb_DiskVendor(7)
    AS BYTE      rdb_DiskProduct(15)
    AS BYTE      rdb_DiskRevision(3)
    AS BYTE      rdb_ControllerVendor(7)
    AS BYTE      rdb_ControllerProduct(15)
    AS BYTE      rdb_ControllerRevision(3)
    AS BYTE      rdb_DriveInitName(39)
END TYPE

CONST AS ULONG IDNAME_RIGIDDISK = &H5244534B

CONST AS UBYTE RDB_LOCATION_LIMIT = 16
CONST AS UBYTE RDBFB_LAST = 0
CONST AS UBYTE RDBFF_LAST = &H01
CONST AS UBYTE RDBFB_LASTLUN = 1
CONST AS UBYTE RDBFF_LASTLUN = &H02
CONST AS UBYTE RDBFB_LASTTID = 2
CONST AS UBYTE RDBFF_LASTTID = &H04
CONST AS UBYTE RDBFB_NORESELECT = 3
CONST AS UBYTE RDBFF_NORESELECT = &H08
CONST AS UBYTE RDBFB_DISKID = 4
CONST AS UBYTE RDBFF_DISKID = &H10
CONST AS UBYTE RDBFB_CTRLRID = 5
CONST AS UBYTE RDBFF_CTRLRID = &H20
CONST AS UBYTE RDBFB_SYNCH = 6
CONST AS UBYTE RDBFF_SYNCH = &H40

TYPE BadBlockEntry
    AS ULONG     bbe_BadBlock
    AS ULONG     bbe_GoodBlock
END TYPE

TYPE BadBlockBlock
    AS ULONG     bbb_ID
    AS ULONG     bbb_SummedLongs
    AS LONG      bbb_ChkSum
    AS ULONG     bbb_HostID
    AS ULONG     bbb_Next
    AS ULONG     bbb_Reserved
    AS BadBlockEntry     bbb_BlockPairs(60)
END TYPE

CONST AS ULONG IDNAME_BADBLOCK = &H42414442

TYPE PartitionBlock
    AS ULONG     pb_ID
    AS ULONG     pb_SummedLongs
    AS LONG      pb_ChkSum
    AS ULONG     pb_HostID
    AS ULONG     pb_Next
    AS ULONG     pb_Flags
    AS ULONG     pb_Reserved1(1)
    AS ULONG     pb_DevFlags
    AS UBYTE     pb_DriveName(31)
    AS ULONG     pb_Reserved2(14)
    AS ULONG     pb_Environment(19)
    AS ULONG     pb_EReserved(11)
END TYPE

CONST AS ULONG IDNAME_PARTITION = &H50415254

CONST AS ULONG PBFB_BOOTABLE = 0
CONST AS ULONG PBFF_BOOTABLE = 1
CONST AS ULONG PBFB_NOMOUNT = 1
CONST AS ULONG PBFF_NOMOUNT = 2

TYPE FileSysHeaderBlock
    AS ULONG     fhb_ID
    AS ULONG     fhb_SummedLongs
    AS LONG      fhb_ChkSum
    AS ULONG     fhb_HostID
    AS ULONG     fhb_Next
    AS ULONG     fhb_Flags
    AS ULONG     fhb_Reserved1(1)
    AS ULONG     fhb_DosType
    AS ULONG     fhb_Version
    AS ULONG     fhb_PatchFlags
    AS ULONG     fhb_Type
    AS ULONG     fhb_Task
    AS ULONG     fhb_Lock
    AS ULONG     fhb_Handler
    AS ULONG     fhb_StackSize
    AS LONG      fhb_Priority
    AS LONG      fhb_Startup
    AS LONG      fhb_SegListBlocks
    AS LONG      fhb_GlobalVec
    AS ULONG     fhb_Reserved2(22)
    AS BYTE      fhb_FileSysName(83)
END TYPE

CONST AS ULONG IDNAME_FILESYSHEADER = &H46534844

TYPE LoadSegBlock
    AS ULONG     lsb_ID
    AS ULONG     lsb_SummedLongs
    AS LONG     lsb_ChkSum
    AS ULONG     lsb_HostID
    AS ULONG     lsb_Next
    AS ULONG     lsb_LoadData(122)
END TYPE

CONST AS ULONG IDNAME_LOADSEG = &H4C534547

CONST AS UINTEGER  IND_ADDHANDLER     = CMD_NONSTD+0
CONST AS UINTEGER  IND_REMHANDLER     = CMD_NONSTD+1
CONST AS UINTEGER  IND_WRITEEVENT     = CMD_NONSTD+2
CONST AS UINTEGER  IND_SETTHRESH      = CMD_NONSTD+3
CONST AS UINTEGER  IND_SETPERIOD      = CMD_NONSTD+4
CONST AS UINTEGER  IND_SETMPORT       = CMD_NONSTD+5
CONST AS UINTEGER  IND_SETMTYPE       = CMD_NONSTD+6
CONST AS UINTEGER  IND_SETMTRIG       = CMD_NONSTD+7

CONST AS UINTEGER KBD_READEVENT         = CMD_NONSTD+0
CONST AS UINTEGER KBD_READMATRIX        = CMD_NONSTD+1
CONST AS UINTEGER KBD_ADDRESETHANDLER   = CMD_NONSTD+2
CONST AS UINTEGER KBD_REMRESETHANDLER   = CMD_NONSTD+3
CONST AS UINTEGER KBD_RESETHANDLERDONE  = CMD_NONSTD+4

CONST AS UINTEGER NDB_NEWIORB  = 0
CONST AS UINTEGER NDB_WORDSYNC = 1
CONST AS UINTEGER NDB_SYLSYNC  = 2
CONST AS UINTEGER NDF_NEWIORB  = 1  SHL  NDB_NEWIORB
CONST AS UINTEGER NDF_WORDSYNC = 1  SHL  NDB_WORDSYNC
CONST AS UINTEGER NDF_SYLSYNC  = 1  SHL  NDB_SYLSYNC

CONST AS BYTE ND_NoMem       =  -2
CONST AS BYTE ND_NoAudLib    =  -3
CONST AS BYTE ND_MakeBad     =  -4
CONST AS BYTE ND_UnitErr     =  -5
CONST AS BYTE ND_CantAlloc   =  -6
CONST AS BYTE ND_Unimpl      =  -7
CONST AS BYTE ND_NoWrite     =  -8
CONST AS BYTE ND_Expunged    =  -9
CONST AS BYTE ND_PhonErr     = -20
CONST AS BYTE ND_RateErr     = -21
CONST AS BYTE ND_PitchErr    = -22
CONST AS BYTE ND_SexErr      = -23
CONST AS BYTE ND_ModeErr     = -24
CONST AS BYTE ND_FreqErr     = -25
CONST AS BYTE ND_VolErr      = -26
CONST AS BYTE ND_DCentErr    = -27
CONST AS BYTE ND_CentPhonErr = -28

CONST AS UINTEGER DEFPITCH = 110
CONST AS UINTEGER DEFRATE = 150
CONST AS UINTEGER DEFVOL = 64
CONST AS UINTEGER DEFFREQ = 22200
CONST AS UINTEGER MALE = 0
CONST AS UINTEGER FEMALE = 1
CONST AS UINTEGER NATURALF0   = 0
CONST AS UINTEGER ROBOTICF0   = 1
CONST AS UINTEGER MANUALF0    = 2
CONST AS UINTEGER DEFSEX      = MALE
CONST AS UINTEGER DEFMODE     = NATURALF0
CONST AS UINTEGER DEFARTIC = 100
CONST AS UINTEGER DEFCENTRAL = 0
CONST AS UINTEGER DEFF0PERT   = 0
CONST AS UINTEGER DEFF0ENTHUS = 32
CONST AS UINTEGER DEFPRIORITY = 100
CONST AS UINTEGER MINRATE = 40
CONST AS UINTEGER MAXRATE = 400
CONST AS UINTEGER MINPITCH = 65
CONST AS UINTEGER MAXPITCH = 320
CONST AS UINTEGER MINFREQ = 5000
CONST AS UINTEGER MAXFREQ = 28000
CONST AS UINTEGER MINVOL = 0
CONST AS UINTEGER MAXVOL = 64
CONST AS UINTEGER MINCENT = 0
CONST AS UINTEGER MAXCENT = 100

TYPE narrator_rb
    AS IOStdReq     message
    AS UINTEGER     rate
    AS UINTEGER     pitch
    AS UINTEGER     mode
    AS UINTEGER     sex
    AS UBYTE PTR    ch_masks
    AS UINTEGER     nm_masks
    AS UINTEGER     volume
    AS UINTEGER     sampfreq
    AS UBYTE        mouths
    AS UBYTE        chanmask
    AS UBYTE        numchan
    AS UBYTE        flags
    AS UBYTE        F0enthusiasm
    AS UBYTE        F0perturb
    AS BYTE         F1adj
    AS BYTE         F2adj
    AS BYTE         F3adj
    AS BYTE         A1adj
    AS BYTE         A2adj
    AS BYTE         A3adj
    AS UBYTE        articulate
    AS UBYTE        centralize
    AS STRING       centphon
    AS BYTE         AVbias
    AS BYTE         AFbias
    AS BYTE         priority
    AS BYTE         pad1
END TYPE

TYPE mouth_rb
    AS narrator_rb voice
    AS UBYTE       width
    AS UBYTE       height
    AS UBYTE       shape
    AS UBYTE       sync
END TYPE

TYPE IOPArray
    AS ULONG     PTermArray0
    AS ULONG     PTermArray1
END TYPE

TYPE IOExtPar
    AS IOStdReq     IOPar
    AS ULONG     io_PExtFlags
    AS UBYTE     io_Status
    AS UBYTE     io_ParFlags
    AS IOPArray     io_PTermArray
END TYPE

CONST AS UBYTE PARB_SHARED = 5
CONST AS UBYTE PARF_SHARED  = 1 SHL 5
CONST AS UBYTE PARB_SLOWMODE = 4
CONST AS UBYTE PARF_SLOWMODE    = 1 SHL 4
CONST AS UBYTE PARB_FASTMODE = 3
CONST AS UBYTE PARF_FASTMODE    = 1 SHL 3
CONST AS UBYTE PARB_RAD_BOOGIE = 3
CONST AS UBYTE PARF_RAD_BOOGIE  = 1 SHL 3
CONST AS UBYTE PARB_ACKMODE = 2
CONST AS UBYTE PARF_ACKMODE     = 1 SHL 2
CONST AS UBYTE PARB_EOFMODE = 1
CONST AS UBYTE PARF_EOFMODE     = 1 SHL 1
CONST AS UBYTE IOPARB_QUEUED = 6
CONST AS UBYTE IOPARF_QUEUED    = 1 SHL 6
CONST AS UBYTE IOPARB_ABORT = 5
CONST AS UBYTE IOPARF_ABORT     = 1 SHL 5
CONST AS UBYTE IOPARB_ACTIVE = 4
CONST AS UBYTE IOPARF_ACTIVE    = 1 SHL 4
CONST AS UBYTE IOPTB_RWDIR = 3
CONST AS UBYTE IOPTF_RWDIR  = 1 SHL 3
CONST AS UBYTE IOPTB_PARSEL = 2
CONST AS UBYTE IOPTF_PARSEL     = 1 SHL 2
CONST AS UBYTE IOPTB_PAPEROUT = 1
CONST AS UBYTE IOPTF_PAPEROUT  = 1 SHL 1
CONST AS UBYTE IOPTB_PARBUSY = 0
CONST AS UBYTE IOPTF_PARBUSY   = 1 SHL 0

REM FIXME CONST AS STRING PARALLELNAME   =   "parallel.device"

CONST AS UINTEGER PDCMD_QUERY      = CMD_NONSTD
CONST AS UINTEGER PDCMD_SETPARAMS  = CMD_NONSTD+1

CONST AS BYTE ParErr_DevBusy   = 1
CONST AS BYTE ParErr_BufTooBig = 2
CONST AS BYTE ParErr_InvParam  = 3
CONST AS BYTE ParErr_LineErr   = 4
CONST AS BYTE ParErr_NotOpen   = 5
CONST AS BYTE ParErr_PortReset = 6
CONST AS BYTE ParErr_InitErr   = 7

CONST AS UINTEGER PRD_RAWWRITE         = CMD_NONSTD+0
CONST AS UINTEGER PRD_PRTCOMMAND       = CMD_NONSTD+1
CONST AS UINTEGER PRD_DUMPRPORT        = CMD_NONSTD+2
CONST AS UINTEGER PRD_QUERY            = CMD_NONSTD+3
CONST AS UINTEGER PRD_RESETPREFS       = CMD_NONSTD+4
CONST AS UINTEGER PRD_LOADPREFS        = CMD_NONSTD+5
CONST AS UINTEGER PRD_USEPREFS         = CMD_NONSTD+6
CONST AS UINTEGER PRD_SAVEPREFS        = CMD_NONSTD+7
CONST AS UINTEGER PRD_READPREFS        = CMD_NONSTD+8
CONST AS UINTEGER PRD_WRITEPREFS       = CMD_NONSTD+9
CONST AS UINTEGER PRD_EDITPREFS        = CMD_NONSTD+10
CONST AS UINTEGER PRD_SETERRHOOK       = CMD_NONSTD+11
CONST AS UINTEGER PRD_DUMPRPORTTAGS    = CMD_NONSTD+12

CONST AS UBYTE aRIS = 0
CONST AS UBYTE aRIN = 1
CONST AS UBYTE aIND = 2
CONST AS UBYTE aNEL = 3
CONST AS UBYTE aRI = 4
CONST AS UBYTE aSGR0  = 5
CONST AS UBYTE aSGR3  = 6
CONST AS UBYTE aSGR23 = 7
CONST AS UBYTE aSGR4  = 8
CONST AS UBYTE aSGR24 = 9
CONST AS UBYTE aSGR1  = 10
CONST AS UBYTE aSGR22 = 11
CONST AS UBYTE aSFC = 12
CONST AS UBYTE aSBC = 13
CONST AS UBYTE aSHORP0 = 14
CONST AS UBYTE aSHORP2 = 15
CONST AS UBYTE aSHORP1 = 16
CONST AS UBYTE aSHORP4 = 17
CONST AS UBYTE aSHORP3 = 18
CONST AS UBYTE aSHORP6 = 19
CONST AS UBYTE aSHORP5 = 20
CONST AS UBYTE aDEN6   = 21
CONST AS UBYTE aDEN5   = 22
CONST AS UBYTE aDEN4   = 23
CONST AS UBYTE aDEN3   = 24
CONST AS UBYTE aDEN2   = 25
CONST AS UBYTE aDEN1   = 26
CONST AS UBYTE aSUS2   = 27
CONST AS UBYTE aSUS1   = 28
CONST AS UBYTE aSUS4   = 29
CONST AS UBYTE aSUS3   = 30
CONST AS UBYTE aSUS0   = 31
CONST AS UBYTE aPLU = 32
CONST AS UBYTE aPLD = 33
CONST AS UBYTE aFNT0   = 34
CONST AS UBYTE aFNT1   = 35
CONST AS UBYTE aFNT2   = 36
CONST AS UBYTE aFNT3   = 37
CONST AS UBYTE aFNT4   = 38
CONST AS UBYTE aFNT5   = 39
CONST AS UBYTE aFNT6   = 40
CONST AS UBYTE aFNT7   = 41
CONST AS UBYTE aFNT8   = 42
CONST AS UBYTE aFNT9   = 43
CONST AS UBYTE aFNT10  = 44
CONST AS UBYTE aPROP2  = 45
CONST AS UBYTE aPROP1  = 46
CONST AS UBYTE aPROP0  = 47
CONST AS UBYTE aTSS = 48
CONST AS UBYTE aJFY5   = 49
CONST AS UBYTE aJFY7   = 50
CONST AS UBYTE aJFY6   = 51
CONST AS UBYTE aJFY0   = 52
CONST AS UBYTE aJFY3   = 53
CONST AS UBYTE aJFY1   = 54
CONST AS UBYTE aVERP0  = 55
CONST AS UBYTE aVERP1  = 56
CONST AS UBYTE aSLPP = 57
CONST AS UBYTE aPERF = 58
CONST AS UBYTE aPERF0  = 59
CONST AS UBYTE aLMS = 60
CONST AS UBYTE aRMS = 61
CONST AS UBYTE aTMS = 62
CONST AS UBYTE aBMS = 63
CONST AS UBYTE aSTBM = 64
CONST AS UBYTE aSLRM = 65
CONST AS UBYTE aCAM = 66
CONST AS UBYTE aHTS = 67
CONST AS UBYTE aVTS = 68
CONST AS UBYTE aTBC0   = 69
CONST AS UBYTE aTBC3   = 70
CONST AS UBYTE aTBC1   = 71
CONST AS UBYTE aTBC4   = 72
CONST AS UBYTE aTBCALL = 73
CONST AS UBYTE aTBSALL = 74
CONST AS UBYTE aEXTEND = 75
CONST AS UBYTE aRAW = 76

TYPE IOPrtCmdReq
    AS Message     io_Message
    AS Device PTR  io_Device
    AS Unit PTR    io_Unit
    AS UINTEGER    io_Command
    AS UBYTE       io_Flags
    AS BYTE        io_Error
    AS UINTEGER    io_PrtCommand
    AS UBYTE       io_Parm0
    AS UBYTE       io_Parm1
    AS UBYTE       io_Parm2
    AS UBYTE       io_Parm3
END TYPE

TYPE IODRPReq
    AS Message         io_Message
    AS Device PTR      io_Device
    AS Unit PTR        io_Unit
    AS UINTEGER        io_Command
    AS UBYTE           io_Flags
    AS BYTE            io_Error
    AS ANY PTR         io_RastPort
    AS ANY PTR         io_ColorMap
    AS ULONG           io_Modes
    AS UINTEGER        io_SrcX
    AS UINTEGER        io_SrcY
    AS UINTEGER        io_SrcWidth
    AS UINTEGER        io_SrcHeight
    AS LONG            io_DestCols
    AS LONG            io_DestRows
    AS UINTEGER        io_Special
END TYPE

TYPE IODRPTagsReq
    AS Message     io_Message
    AS Device PTR    io_Device
    AS Unit PTR    io_Unit
    AS UINTEGER     io_Command
    AS UBYTE     io_Flags
    AS BYTE     io_Error
    AS ANY PTR     io_RastPort
    AS ANY PTR     io_ColorMap
    AS ULONG     io_Modes
    AS UINTEGER     io_SrcX
    AS UINTEGER     io_SrcY
    AS UINTEGER     io_SrcWidth
    AS UINTEGER     io_SrcHeight
    AS LONG     io_DestCols
    AS LONG     io_DestRows
    AS UINTEGER     io_Special
    AS TagItem PTR    io_TagList
END TYPE

CONST AS UINTEGER SPECIAL_MILCOLS = &H0001
CONST AS UINTEGER SPECIAL_MILROWS = &H0002
CONST AS UINTEGER SPECIAL_FULLCOLS = &H0004
CONST AS UINTEGER SPECIAL_FULLROWS = &H0008
CONST AS UINTEGER SPECIAL_FRACCOLS = &H0010
CONST AS UINTEGER SPECIAL_FRACROWS = &H0020
CONST AS UINTEGER SPECIAL_CENTER = &H0040
CONST AS UINTEGER SPECIAL_ASPECT = &H0080
CONST AS UINTEGER SPECIAL_DENSITY1     = &H0100
CONST AS UINTEGER SPECIAL_DENSITY2     = &H0200
CONST AS UINTEGER SPECIAL_DENSITY3     = &H0300
CONST AS UINTEGER SPECIAL_DENSITY4     = &H0400
CONST AS UINTEGER SPECIAL_DENSITY5     = &H0500
CONST AS UINTEGER SPECIAL_DENSITY6     = &H0600
CONST AS UINTEGER SPECIAL_DENSITY7     = &H0700
CONST AS UINTEGER SPECIAL_NOFORMFEED = &H0800
CONST AS UINTEGER SPECIAL_TRUSTME = &H1000
CONST AS UINTEGER SPECIAL_NOPRINT = &H2000

CONST AS BYTE PDERR_NOERR = 0
CONST AS BYTE PDERR_CANCEL = 1
CONST AS BYTE PDERR_NOTGRAPHICS = 2
CONST AS BYTE PDERR_INVERTHAM = 3
CONST AS BYTE PDERR_BADDIMENSION = 4
CONST AS BYTE PDERR_DIMENSIONOVFLOW = 5
CONST AS BYTE PDERR_INTERNALMEMORY = 6
CONST AS BYTE PDERR_BUFFERMEMORY = 7
CONST AS BYTE PDERR_TOOKCONTROL = 8
CONST AS BYTE PDERR_BADPREFERENCES = 9
CONST AS BYTE PDERR_LASTSTANDARD = 31
CONST AS BYTE PDERR_FIRSTCUSTOM = 32
CONST AS BYTE PDERR_LASTCUSTOM = 126

CONST AS UINTEGER SPECIAL_DENSITYMASK = &H0700
CONST AS UINTEGER SPECIAL_DIMENSIONSMASK = SPECIAL_MILCOLS OR SPECIAL_MILROWS OR SPECIAL_FULLCOLS OR SPECIAL_FULLROWS OR SPECIAL_FRACCOLS OR SPECIAL_FRACROWS OR SPECIAL_ASPECT

CONST AS ULONG DRPA_Dummy           = TAG_USER + &H60000
CONST AS ULONG DRPA_ICCProfile      = DRPA_Dummy+1
CONST AS ULONG DRPA_ICCName         = DRPA_Dummy+2
CONST AS ULONG DRPA_NoColCorrect    = DRPA_Dummy+3
CONST AS ULONG DRPA_SourceHook      = DRPA_Dummy+4

TYPE DRPSourceMsg
    REM FIXME AS DRPSourceMsg     {
    AS LONG     x
    AS LONG     y
    AS LONG     width
    AS LONG     height
    AS ULONG PTR    buf
END TYPE

CONST AS UBYTE UNIT_MICROHZ = 0
CONST AS UBYTE UNIT_VBLANK = 1
CONST AS UBYTE UNIT_ECLOCK = 2
CONST AS UBYTE UNIT_WAITUNTIL = 3
CONST AS UBYTE UNIT_WAITECLOCK = 4

TYPE timeval
    AS ULONG     tv_sec
    AS ULONG     tv_usec
END TYPE

TYPE EClockVal
    AS ULONG     ev_hi
    AS ULONG     ev_lo
END TYPE

TYPE timerequest
    AS IORequest     tr_node
    AS timeval     tr_time
END TYPE

CONST AS UINTEGER TR_ADDREQUEST    = CMD_NONSTD
CONST AS UINTEGER TR_GETSYSTIME    = CMD_NONSTD+1
CONST AS UINTEGER TR_SETSYSTIME    = CMD_NONSTD+2

TYPE IOPrtPrefsReq
    AS Message     io_Message
    AS Device PTR    io_Device
    AS Unit PTR    io_Unit
    AS UINTEGER     io_Command
    AS UBYTE     io_Flags
    AS BYTE     io_Error
    AS TagItem PTR    io_TagList
END TYPE

CONST AS ULONG DRPA_AspectX   = DRPA_Dummy+5
CONST AS ULONG DRPA_AspectY   = DRPA_Dummy+6
CONST AS ULONG PPRA_Dummy     = TAG_USER + &H70000
CONST AS ULONG PPRA_Window    = PPRA_Dummy+1
CONST AS ULONG PPRA_Screen    = PPRA_Dummy+2
CONST AS ULONG PPRA_PubScreen = PPRA_Dummy+3

TYPE IOPrtErrReq
    AS Message     io_Message
    AS Device PTR  io_Device
    AS Unit PTR    io_Unit
    AS UINTEGER    io_Command
    AS UBYTE       io_Flags
    AS BYTE        io_Error
    AS Hook PTR    io_Hook
END TYPE

TYPE PrtErrMsg
    AS ULONG     pe_Version
    AS ULONG     pe_ErrorLevel
    AS ANY PTR   pe_Window
    AS ANY PTR   pe_ES
    AS ULONG PTR pe_IDCMP
    AS ANY PTR   pe_ArgList
END TYPE

CONST AS INTEGER PDHOOK_VERSION = 1

TYPE IOPrefsReq
    AS Message     io_Message
    AS Device PTR    io_Device
    AS Unit PTR    io_Unit
    AS UINTEGER     io_Command
    AS UBYTE     io_Flags
    AS BYTE     io_Error
    REM FIXME AS PrinterTxtPrefs PTR    io_TxtPrefs
    AS ANY PTR     io_TxtPrefs
    REM FIXME AS PrinterUnitPrefs PTR    io_UnitPrefs
    AS ANY PTR     io_UnitPrefs
    REM FIXME AS PrinterDeviceUnitPrefs PTR    io_DevUnitPrefs
    AS ANY PTR     io_DevUnitPrefs
    REM AS PrinterGfxPrefs PTR    io_GfxPrefs
    AS ANY PTR     io_GfxPrefs
END TYPE

TYPE DeviceData
    AS Library    dd_Device
    AS ANY PTR    dd_Segment
    AS ANY PTR    dd_ExecBase
    AS ANY PTR    dd_CmdVectors
    AS ANY PTR    dd_CmdBytes
    AS UINTEGER   dd_NumCommands
END TYPE

CONST AS UBYTE IOB_QUEUED = 4
CONST AS UBYTE IOB_CURRENT = 5
CONST AS UBYTE IOB_SERVICING = 6
CONST AS UBYTE IOB_DONE = 7
CONST AS UBYTE IOF_QUEUED   = 1 SHL IOB_QUEUED
CONST AS UBYTE IOF_CURRENT  = 1 SHL IOB_CURRENT
CONST AS UBYTE IOF_SERVICING    = 1 SHL IOB_SERVICING
CONST AS UBYTE IOF_DONE     = 1 SHL IOB_DONE
CONST AS UBYTE PB_IOR0     = 0
CONST AS UBYTE PB_IOR1     = 1
CONST AS UBYTE PB_IOOPENED = 2
CONST AS UBYTE PB_EXPUNGED = 7
CONST AS UBYTE PBF_IOR0     = 1 SHL PB_IOR0
CONST AS UBYTE PBF_IOR1     = 1 SHL PB_IOR1
CONST AS UBYTE PBF_IOOPENDED    = 1 SHL PB_IOOPENED
CONST AS UBYTE PBF_EXPUNGED     = 1 SHL PB_EXPUNGED
CONST AS UBYTE DUB_STOPPED = 0
CONST AS UBYTE DUF_STOPPED  = 1 SHL DUB_STOPPED

CONST AS UINTEGER P_OLDSTKSIZE = &H0800
CONST AS UINTEGER P_STKSIZE = &H1000
CONST AS UINTEGER P_BUFSIZE = 256
CONST AS UINTEGER P_SAFESIZE = 128

TYPE PrinterData
    AS DeviceData          pd_Device
    AS MsgPort             pd_Unit
    AS ULONG               pd_PrinterSegment
    AS UINTEGER            pd_PrinterType
    AS PrinterSegment PTR  pd_SegmentData
    AS UBYTE PTR           pd_PrintBuf
    REM FIXME AS LONG     (*pd_PWrite)()
    AS ANY PTR             pd_PWrite
    REM AS LONG     (*pd_PBothReady)()
    AS ANY PTR             pd_PBothRead
    AS IOExtPar            pd_p0
    AS IOExtPar            pd_p1
    AS timerequest         pd_TIOR
    AS MsgPort             pd_IORPort
    AS Task                pd_TC
    AS UBYTE               pd_OldStk(P_OLDSTKSIZE-1)
    AS UBYTE               pd_Flags
    AS UBYTE               pd_pad
    REM FIXME AS Preferences         pd_Preferences
    REM FIXME AS UBYTE               pd_PWaitEnabled
    REM FIXME AS UBYTE               pd_Flags1
    REM FIXME AS UBYTE               pd_Stk(P_STKSIZE-1)
    REM FIXME AS PrinterUnit PTR     pd_PUnit
    REM FIXME REM FIXME AS LONG     (*pd_PRead)()
    REM FIXME AS ANY PTR             pd_PRead
    REM FIXME REM FIXME AS LONG     (*pd_CallErrHook)()
    REM FIXME AS ANY PTR             pd_CallErrHook
    REM FIXME AS ULONG               pd_UnitNumber
    REM FIXME AS STRING              pd_DriverName
    REM FIXME REM FIXME AS LONG     (*pd_PQuery)()
    REM FIXME AS ANY PTR             pd_PQuery
END TYPE

CONST AS UBYTE PPCB_GFX = 0
CONST AS UBYTE PPCF_GFX = &H1
CONST AS UBYTE PPCB_COLOR = 1
CONST AS UBYTE PPCF_COLOR = &H2
CONST AS UBYTE PPC_BWALPHA = &H00
CONST AS UBYTE PPC_BWGFX = &H01
CONST AS UBYTE PPC_COLORALPHA = &H02
CONST AS UBYTE PPC_COLORGFX = &H03
CONST AS UBYTE PPCB_EXTENDED = 2
CONST AS UBYTE PPCF_EXTENDED = &H4
CONST AS UBYTE PPCB_NOSTRIP = 3
CONST AS UBYTE PPCF_NOSTRIP = &H8
CONST AS UBYTE PCC_BW = &H01
CONST AS UBYTE PCC_YMC = &H02
CONST AS UBYTE PCC_YMC_BW = &H03
CONST AS UBYTE PCC_YMCB = &H04
CONST AS UBYTE PCC_4COLOR = &H04
CONST AS UBYTE PCC_ADDITIVE = &H08
CONST AS UBYTE PCC_WB = &H09
CONST AS UBYTE PCC_BGR = &H0A
CONST AS UBYTE PCC_BGR_WB = &H0B
CONST AS UBYTE PCC_BGRW = &H0C
CONST AS UBYTE PCC_MULTI_PASS = &H10

TYPE PrinterExtendedData
    AS STRING       ped_PrinterName
    AS SUB          ped_Init
    AS SUB          ped_Expunge
    REM FIXME AS LONG     (*ped_Open)()
    AS ANY PTR      ped_Open
    AS SUB          ped_Close
    AS UBYTE        ped_PrinterClass
    AS UBYTE        ped_ColorClass
    AS UBYTE        ped_MaxColumns
    AS UBYTE        ped_NumCharSets
    AS UINTEGER     ped_NumRows
    AS ULONG        ped_MaxXDots
    AS ULONG        ped_MaxYDots
    AS UINTEGER     ped_XDotsInch
    AS UINTEGER     ped_YDotsInch
    AS STRING PTR   ped_Commands
    REM FIXME AS LONG     (*ped_DoSpecial)()
    AS ANY PTR      ped_DoSpecial
    REM FIXME AS LONG     (*ped_Render)()
    AS ANY PTR      ped_Render
    AS LONG         ped_TimeoutSecs
    AS STRING PTR   ped_8BitChars
    AS LONG         ped_PrintMode
    REM FIXME AS LONG     (*ped_ConvFunc)()
    AS ANY PTR      ped_ConvFunc
    AS TagItem PTR  ped_TagList
    REM FIXME AS LONG     (*ped_DoPreferences)()
    AS ANY PTR      ped_DoPreferences
    AS SUB          ped_CallErrHook
END TYPE

CONST AS ULONG PRTA_Dummy            = TAG_USER + &H50000
CONST AS ULONG PRTA_8BitGuns         = PRTA_Dummy + 1
CONST AS ULONG PRTA_ConvertSource    = PRTA_Dummy + 2
CONST AS ULONG PRTA_FloydDithering   = PRTA_Dummy + 3
CONST AS ULONG PRTA_AntiAlias        = PRTA_Dummy + 4
CONST AS ULONG PRTA_ColorCorrection  = PRTA_Dummy + 5
CONST AS ULONG PRTA_NoIO             = PRTA_Dummy + 6
CONST AS ULONG PRTA_NewColor         = PRTA_Dummy + 7
CONST AS ULONG PRTA_ColorSize        = PRTA_Dummy + 8
CONST AS ULONG PRTA_NoScaling        = PRTA_Dummy + 9
CONST AS ULONG PRTA_DitherNames      = PRTA_Dummy + 20
CONST AS ULONG PRTA_ShadingNames     = PRTA_Dummy + 21
CONST AS ULONG PRTA_ColorCorrect     = PRTA_Dummy + 22
CONST AS ULONG PRTA_DensityInfo      = PRTA_Dummy + 23
CONST AS ULONG PRTA_LeftBorder       = PRTA_Dummy + 30
CONST AS ULONG PRTA_TopBorder        = PRTA_Dummy + 31
CONST AS ULONG PRTA_MixBWColor       = PRTA_Dummy + 32
CONST AS ULONG PRTA_Preferences      = PRTA_Dummy + 40

TYPE PrinterSegment
    AS ULONG        ps_NextSegment
    AS ULONG        ps_runAlert
    AS UINTEGER     ps_Version
    AS UINTEGER     ps_Revision
    AS PrinterExtendedData     ps_PED
END TYPE

TYPE PrtDriverPreferences
    AS UINTEGER  pdp_Version
    AS UBYTE     pdp_PrinterID(31)
    AS UBYTE     pdp_PrefName(15)
    AS ULONG     pdp_Length
END TYPE

CONST AS UBYTE PCMYELLOW   = 0
CONST AS UBYTE PCMMAGENTA  = 1
CONST AS UBYTE PCMCYAN     = 2
CONST AS UBYTE PCMBLACK    = 3
CONST AS UBYTE PCMBLUE     = PCMYELLOW
CONST AS UBYTE PCMGREEN    = PCMMAGENTA
CONST AS UBYTE PCMRED      = PCMCYAN
CONST AS UBYTE PCMWHITE    = PCMBLACK

TYPE PrtInfo
    REM FIXME AS LONG     (*pi_render)()
    AS ANY PTR      pi_render
    AS ANY PTR      pi_rp
    AS ANY PTR      pi_temprp
    AS UINTEGER PTR pi_RowBuf
    AS UINTEGER PTR pi_HamBuf
    AS ULONG PTR    pi_ColorMap
    AS ULONG PTR    pi_ColorInt
    AS ULONG PTR    pi_HamInt
    AS ULONG PTR    pi_Dest1Int
    AS ULONG PTR    pi_Dest2Int
    AS UINTEGER PTR pi_ScaleX
    AS UINTEGER PTR pi_ScaleXAlt
    AS UBYTE PTR    pi_dmatrix
    AS UINTEGER PTR pi_TopBuf
    AS UINTEGER PTR pi_BotBuf
    AS UINTEGER     pi_RowBufSize
    AS UINTEGER     pi_HamBufSize
    AS UINTEGER     pi_ColorMapSize
    AS UINTEGER     pi_ColorIntSize
    AS UINTEGER     pi_HamIntSize
    AS UINTEGER     pi_Dest1IntSize
    AS UINTEGER     pi_Dest2IntSize
    AS UINTEGER     pi_ScaleXSize
    AS UINTEGER     pi_ScaleXAltSize
    AS UINTEGER     pi_PrefsFlags
    AS ULONG        pi_special
    AS UINTEGER     pi_xstart
    AS UINTEGER     pi_ystart
    AS UINTEGER     pi_width
    AS UINTEGER     pi_height
    AS ULONG        pi_pc
    AS ULONG        pi_pr
    AS UINTEGER     pi_ymult
    AS UINTEGER     pi_ymod
    AS INTEGER      pi_ety
    AS UINTEGER     pi_xpos
    AS UINTEGER     pi_threshold
    AS UINTEGER     pi_tempwidth
    AS UINTEGER     pi_flags
    AS UINTEGER PTR pi_ReduceBuf
    AS UINTEGER     pi_ReduceBufSize
    AS Hook PTR     pi_SourceHook
    AS ULONG PTR    pi_InvertHookBuf
END TYPE

CONST AS ULONG HD_WIDESCSI = 8
CONST AS ULONG HD_SCSICMD = 28

TYPE SCSICmd
    AS UINTEGER PTR scsi_Data
    AS ULONG        scsi_Length
    AS ULONG        scsi_Actual
    AS UBYTE PTR    scsi_Command
    AS UINTEGER     scsi_CmdLength
    AS UINTEGER     scsi_CmdActual
    AS UBYTE        scsi_Flags
    AS UBYTE        scsi_Status
    AS UBYTE PTR    scsi_SenseData
    AS UINTEGER     scsi_SenseLength
    AS UINTEGER     scsi_SenseActual
END TYPE

CONST AS UBYTE SCSIF_WRITE = 0
CONST AS UBYTE SCSIF_READ = 1
CONST AS UBYTE SCSIB_READ_WRITE = 0
CONST AS UBYTE SCSIF_NOSENSE = 0
CONST AS UBYTE SCSIF_AUTOSENSE = 2
CONST AS UBYTE SCSIF_OLDAUTOSENSE = 6
CONST AS UBYTE SCSIB_AUTOSENSE = 1
CONST AS UBYTE SCSIB_OLDAUTOSENSE = 2

CONST AS BYTE HFERR_SelfUnit = 40
CONST AS BYTE HFERR_DMA = 41
CONST AS BYTE HFERR_Phase = 42
CONST AS BYTE HFERR_Parity = 43
CONST AS BYTE HFERR_SelTimeout = 44
CONST AS BYTE HFERR_BadStatus = 45
CONST AS BYTE HFERR_NoBoard = 50

TYPE IOTArray
    AS ULONG     TermArray0
    AS ULONG     TermArray1
END TYPE

CONST AS ULONG SER_DEFAULT_CTLCHAR = &H11130000

TYPE IOExtSer
    AS IOStdReq     IOSer
    AS ULONG     io_CtlChar
    AS ULONG     io_RBufLen
    AS ULONG     io_ExtFlags
    AS ULONG     io_Baud
    AS ULONG     io_BrkTime
    AS IOTArray     io_TermArray
    AS UBYTE     io_ReadLen
    AS UBYTE     io_WriteLen
    AS UBYTE     io_StopBits
    AS UBYTE     io_SerFlags
    AS UINTEGER     io_Status
END TYPE

CONST AS UINTEGER SDCMD_QUERY       = CMD_NONSTD
CONST AS UINTEGER SDCMD_BREAK       = CMD_NONSTD+1
CONST AS UINTEGER SDCMD_SETPARAMS   = CMD_NONSTD+2

CONST AS UINTEGER SERB_XDISABLED      = 7
CONST AS UINTEGER SERF_XDISABLED      = 1 SHL 7
CONST AS UINTEGER SERB_EOFMODE        = 6
CONST AS UINTEGER SERF_EOFMODE        = 1 SHL 6
CONST AS UINTEGER SERB_SHARED         = 5
CONST AS UINTEGER SERF_SHARED         = 1 SHL 5
CONST AS UINTEGER SERB_RAD_BOOGIE     = 4
CONST AS UINTEGER SERF_RAD_BOOGIE     = 1 SHL 4
CONST AS UINTEGER SERB_QUEUEDBRK      = 3
CONST AS UINTEGER SERF_QUEUEDBRK      = 1 SHL 3
CONST AS UINTEGER SERB_7WIRE          = 2
CONST AS UINTEGER SERF_7WIRE          = 1 SHL 2
CONST AS UINTEGER SERB_PARTY_ODD      = 1
CONST AS UINTEGER SERF_PARTY_ODD      = 1 SHL 1
CONST AS UINTEGER SERB_PARTY_ON       = 0
CONST AS UINTEGER SERF_PARTY_ON       = 1 SHL 0
CONST AS UINTEGER IO_STATB_XOFFREAD   = 12
CONST AS UINTEGER IO_STATF_XOFFREAD   = 1 SHL 12
CONST AS UINTEGER IO_STATB_XOFFWRITE  = 11
CONST AS UINTEGER IO_STATF_XOFFWRITE  = 1 SHL 11
CONST AS UINTEGER IO_STATB_READBREAK  = 10
CONST AS UINTEGER IO_STATF_READBREAK  = 1 SHL 10
CONST AS UINTEGER IO_STATB_WROTEBREAK = 9
CONST AS UINTEGER IO_STATF_WROTEBREAK = 1 SHL 9
CONST AS UINTEGER IO_STATB_OVERRUN    = 8
CONST AS UINTEGER IO_STATF_OVERRUN    = 1 SHL 8

CONST AS UINTEGER SEXTB_MSPON  = 1
CONST AS UINTEGER SEXTF_MSPON  = 1 SHL 1
CONST AS UINTEGER SEXTB_MARK   = 0
CONST AS UINTEGER SEXTF_MARK   = 1 SHL 0

CONST AS BYTE SerErr_DevBusy       = 1
CONST AS BYTE SerErr_BaudMismatch  = 2
CONST AS BYTE SerErr_BufErr        = 4
CONST AS BYTE SerErr_InvParam      = 5
CONST AS BYTE SerErr_LineErr       = 6
CONST AS BYTE SerErr_ParityErr     = 9
CONST AS BYTE SerErr_TimerErr      = 11
CONST AS BYTE SerErr_BufOverflow   = 12
CONST AS BYTE SerErr_NoDSR         = 13
CONST AS BYTE SerErr_DetectedBreak = 15
CONST AS BYTE SerErr_InvBaud       = 3
CONST AS BYTE SerErr_NotOpen       = 7
CONST AS BYTE SerErr_PortReset     = 8
CONST AS BYTE SerErr_InitErr       = 10
CONST AS BYTE SerErr_NoCTS         = 14

CONST AS UBYTE IOSTB_XOFFREAD    = 4
CONST AS UBYTE IOSTF_XOFFREAD    = 1 SHL 4
CONST AS UBYTE IOSTB_XOFFWRITE   = 3
CONST AS UBYTE IOSTF_XOFFWRITE   = 1 SHL 3
CONST AS UBYTE IOSTB_READBREAK   = 2
CONST AS UBYTE IOSTF_READBREAK   = 1 SHL 2
CONST AS UBYTE IOSTB_WROTEBREAK  = 1
CONST AS UBYTE IOSTF_WROTEBREAK  = 1 SHL 1
CONST AS UBYTE IOSTB_OVERRUN     = 0
CONST AS UBYTE IOSTF_OVERRUN     = 1 SHL 0
CONST AS UBYTE IOSERB_BUFRREAD   = 7
CONST AS UBYTE IOSERF_BUFRREAD   = 1 SHL 7
CONST AS UBYTE IOSERB_QUEUED     = 6
CONST AS UBYTE IOSERF_QUEUED     = 1 SHL 6
CONST AS UBYTE IOSERB_ABORT      = 5
CONST AS UBYTE IOSERF_ABORT      = 1 SHL 5
CONST AS UBYTE IOSERB_ACTIVE     = 4
CONST AS UBYTE IOSERF_ACTIVE     = 1 SHL 4

REM FIXME #define SERIALNAME     "serial.device"

CONST AS UBYTE NUMSECS = 11
CONST AS UBYTE NUMUNITS = 4

CONST AS UINTEGER TD_SECTOR = 512
CONST AS UINTEGER TD_SECSHIFT = 9

REM FIXME #define TD_NAME "trackdisk.device"

CONST AS UINTEGER TD_MOTOR     = CMD_NONSTD+0
CONST AS UINTEGER TD_SEEK      = CMD_NONSTD+1
CONST AS UINTEGER TD_FORMAT    = CMD_NONSTD+2
CONST AS UINTEGER TD_REMOVE    = CMD_NONSTD+3
CONST AS UINTEGER TD_CHANGENUM     = CMD_NONSTD+4
CONST AS UINTEGER TD_CHANGESTATE   = CMD_NONSTD+5
CONST AS UINTEGER TD_PROTSTATUS    = CMD_NONSTD+6
CONST AS UINTEGER TD_RAWREAD   = CMD_NONSTD+7
CONST AS UINTEGER TD_RAWWRITE  = CMD_NONSTD+8
CONST AS UINTEGER TD_GETDRIVETYPE  = CMD_NONSTD+9
CONST AS UINTEGER TD_GETNUMTRACKS  = CMD_NONSTD+10
CONST AS UINTEGER TD_ADDCHANGEINT  = CMD_NONSTD+11
CONST AS UINTEGER TD_REMCHANGEINT  = CMD_NONSTD+12
CONST AS UINTEGER TD_GETGEOMETRY   = CMD_NONSTD+13
CONST AS UINTEGER TD_EJECT     = CMD_NONSTD+14
CONST AS UINTEGER TD_LASTCOMM  = CMD_NONSTD+15

CONST AS UINTEGER TDF_EXTCOM = 1 SHL 15

CONST AS UINTEGER ETD_WRITE    = CMD_WRITE OR TDF_EXTCOM
CONST AS UINTEGER ETD_READ     = CMD_READ OR TDF_EXTCOM
CONST AS UINTEGER ETD_MOTOR    = TD_MOTOR OR TDF_EXTCOM
CONST AS UINTEGER ETD_SEEK     = TD_SEEK OR TDF_EXTCOM
CONST AS UINTEGER ETD_FORMAT   = TD_FORMAT OR TDF_EXTCOM
CONST AS UINTEGER ETD_UPDATE   = CMD_UPDATE OR TDF_EXTCOM
CONST AS UINTEGER ETD_CLEAR    = CMD_CLEAR OR TDF_EXTCOM
CONST AS UINTEGER ETD_RAWREAD  = TD_RAWREAD OR TDF_EXTCOM
CONST AS UINTEGER ETD_RAWWRITE = TD_RAWWRITE OR TDF_EXTCOM

TYPE IOExtTD
    AS IOStdReq     iotd_Req
    AS ULONG     iotd_Count
    AS ULONG     iotd_SecLabel
END TYPE

TYPE DriveGeometry
    AS ULONG     dg_SectorSize
    AS ULONG     dg_TotalSectors
    AS ULONG     dg_Cylinders
    AS ULONG     dg_CylSectors
    AS ULONG     dg_Heads
    AS ULONG     dg_TrackSectors
    AS ULONG     dg_BufMemType
    AS UBYTE     dg_DeviceType
    AS UBYTE     dg_Flags
    AS UINTEGER     dg_Reserved
END TYPE

CONST AS UBYTE DG_DIRECT_ACCESS     = 0
CONST AS UBYTE DG_SEQUENTIAL_ACCESS = 1
CONST AS UBYTE DG_PRINTER           = 2
CONST AS UBYTE DG_PROCESSOR         = 3
CONST AS UBYTE DG_WORM              = 4
CONST AS UBYTE DG_CDROM             = 5
CONST AS UBYTE DG_SCANNER           = 6
CONST AS UBYTE DG_OPTICAL_DISK      = 7
CONST AS UBYTE DG_MEDIUM_CHANGER    = 8
CONST AS UBYTE DG_COMMUNICATION     = 9
CONST AS UBYTE DG_UNKNOWN           = 31

CONST AS UBYTE DGB_REMOVABLE        = 0
CONST AS UBYTE DGF_REMOVABLE        = 1

CONST AS UBYTE IOTDB_INDEXSYNC      = 4
CONST AS UBYTE IOTDF_INDEXSYNC      = 1 SHL 4
CONST AS UBYTE IOTDB_WORDSYNC       = 5
CONST AS UBYTE IOTDF_WORDSYNC       = 1 SHL 5
CONST AS UBYTE TD_LABELSIZE         = 16
CONST AS UBYTE TDB_ALLOW_NON_3_5    = 0
CONST AS UBYTE TDF_ALLOW_NON_3_5    = 1 SHL 0
CONST AS UBYTE DRIVE3_5             = 1
CONST AS UBYTE DRIVE5_25            = 2
CONST AS UBYTE DRIVE3_5_150RPM      = 3

CONST AS BYTE TDERR_NotSpecified    = 20
CONST AS BYTE TDERR_NoSecHdr        = 21
CONST AS BYTE TDERR_BadSecPreamble  = 22
CONST AS BYTE TDERR_BadSecID        = 23
CONST AS BYTE TDERR_BadHdrSum       = 24
CONST AS BYTE TDERR_BadSecSum       = 25
CONST AS BYTE TDERR_TooFewSecs      = 26
CONST AS BYTE TDERR_BadSecHdr       = 27
CONST AS BYTE TDERR_WriteProt       = 28
CONST AS BYTE TDERR_DiskChanged     = 29
CONST AS BYTE TDERR_SeekError       = 30
CONST AS BYTE TDERR_NoMem           = 31
CONST AS BYTE TDERR_BadUnitNum      = 32
CONST AS BYTE TDERR_BadDriveType    = 33
CONST AS BYTE TDERR_DriveInUse      = 34
CONST AS BYTE TDERR_PostReset       = 35

TYPE TDU_PublicUnit
    AS Unit         tdu_Unit
    AS UINTEGER     tdu_Comp01Track
    AS UINTEGER     tdu_Comp10Track
    AS UINTEGER     tdu_Comp11Track
    AS ULONG        tdu_StepDelay
    AS ULONG        tdu_SettleDelay
    AS UBYTE        tdu_RetryCnt
    AS UBYTE        tdu_PubFlags
    AS UINTEGER     tdu_CurrTrk
    AS ULONG        tdu_CalibrateDelay
    AS ULONG        tdu_Counter
END TYPE

CONST AS UBYTE TDPB_NOCLICK = 0
CONST AS UBYTE TDPF_NOCLICK = 1 SHL 0

