;Assembler header file for ADFS
;written by DefMod (Dec 31 2005) on Sat Dec 31 14:01:37 2005
;Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995

        [       :LNOT: :DEF: ADFS_Hdr
        GBLS    ADFS_Hdr

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET oslib/Types.Hdr"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET oslib/OS.Hdr"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

        [       :LNOT: :DEF: Get_FileCore
        GBLS    Get_FileCore
        ]
        [       :LNOT: :DEF: FileCore_Hdr
Get_FileCore                    SETS    "GET oslib/FileCore.Hdr"
        |
Get_FileCore                    SETS    ""
        ]
        $Get_FileCore

;Symbols for constants
Error_ADFSDriverInUse           *       &108A0
ADFS_ControllerDiscNotPresent   *       &0
ADFS_Controller1772             *       &1
ADFS_Controller71X              *       &2
ADFS_ControllerST506            *       &3
ADFS_ControllerIDE              *       &4

;Symbols for structure offsets and sizes
                                ^       0
                                #       Int
ADFS_Controller                 *       @


;Symbols for SWI's and SWI reason codes
XADFS_DiscOp                    *       &60240
ADFS_DiscOp                     *       &40240

ADFSDiscOp_Verify               *       &0
   ;Entry
   ;  R1 = &0 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress)
   ;  R4 = unverified (Int)

ADFSDiscOp_ReadSectors          *       &1
   ;Entry
   ;  R1 = &1 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 = data (pointer to data)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress)
   ;  R3 = next_data (pointer to data)
   ;  R4 = unread (Int)

ADFSDiscOp_WriteSectors         *       &2
   ;Entry
   ;  R1 = &2 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 -> data (data)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress)
   ;  R3 -> next_data (data)
   ;  R4 = unwritten (Int)

ADFSDiscOp_ReadTrack            *       &3
   ;Entry
   ;  R1 = &3 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 = data (pointer to data)

ADFSDiscOp_ReadId               *       &3
   ;Entry
   ;  R1 = &3 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 = data (pointer to data)

ADFSDiscOp_WriteTrack           *       &4
   ;Entry
   ;  R1 = &4 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 -> data (data)

ADFSDiscOp_FormatTrack          *       &4
   ;Entry
   ;  R1 = &4 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 = &0
   ;  R4 -> format (FileCore_TrackFormat)

ADFSDiscOp_Seek                 *       &5
   ;Entry
   ;  R1 = &5 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)

ADFSDiscOp_Restore              *       &6
   ;Entry
   ;  R1 = &6 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)

ADFSDiscOp_StepIn               *       &7
   ;Entry
   ;  R1 = &7 :OR: flags (Bits)

ADFSDiscOp_StepOut              *       &8
   ;Entry
   ;  R1 = &8 :OR: flags (Bits)

ADFSDiscOp_ReadSectorsViaCache  *       &9
   ;Entry
   ;  R1 = &9 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 = data (pointer to data)
   ;  R4 = size (Int)
   ;  R6 = cache_handle (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress)
   ;  R3 = next_data (pointer to data)
   ;  R4 = unread (Int)
   ;  R6 = cache_handle_out (Int)

ADFSDiscOp_Specify              *       &F
   ;Entry
   ;  R1 = &F :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress)

XADFS_HDC                       *       &60241
ADFS_HDC                        *       &40241
   ;Entry
   ;  R2 = controller (pointer to data)
   ;  R3 = poll_location (pointer to Int)
   ;  R4 = poll_bits (Bits)
   ;  R5 = enable_location (pointer to data)
   ;  R6 = enable_bits (Bits)

XADFS_Drives                    *       &60242
ADFS_Drives                     *       &40242
   ;Exit
   ;  R0 = default_drive (Int)
   ;  R1 = floppy_count (Int)
   ;  R2 = hard_disc_count (Int)

XADFS_FreeSpace                 *       &60243
ADFS_FreeSpace                  *       &40243
   ;Entry
   ;  R0 -> disc_name (String)
   ;Exit
   ;  R0 = free (Int)
   ;  R1 = max (Int)

XADFS_Retries                   *       &60244
ADFS_Retries                    *       &40244
   ;Entry
   ;  R0 = mask (Bits)
   ;  R1 = value (Bits)
   ;Exit
   ;  R1 corrupted
   ;  R2 = old_value (Bits)
   ;  R3 = new_value (Bits)

XADFS_DescribeDisc              *       &60245
ADFS_DescribeDisc               *       &40245
   ;Entry
   ;  R0 -> disc_name (String)
   ;  R1 = disc (pointer to FileCore_Disc)

XADFS_VetFormat                 *       &60246
ADFS_VetFormat                  *       &40246
   ;Entry
   ;  R0 = format (pointer to FileCore_Format)
   ;  R1 = drive_no (Int)

XADFS_FlpProcessDCB             *       &60247
ADFS_FlpProcessDCB              *       &40247

XADFS_ControllerType            *       &60248
ADFS_ControllerType             *       &40248
   ;Entry
   ;  R0 = drive_no (Int)
   ;Exit
   ;  R0 = controller (ADFS_Controller)

XADFS_PowerControl              *       &60249
ADFS_PowerControl               *       &40249

ADFSPowerControl_ReadSpin       *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = drive_no (Int)
   ;Exit
   ;  R2 = spinning (Bool)

ADFSPowerControl_SetAutospindown *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = drive_no (Int)
   ;  R2 = spindown_time (Int)
   ;Exit
   ;  R3 = old_spindown_time (Int)

ADFSPowerControl_SetSpin        *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 = drive_no (Int)
   ;  R2 = spinning (Bool)

XADFS_SetIDEController          *       &6024A
ADFS_SetIDEController           *       &4024A
   ;Entry
   ;  R2 = controller (pointer to data)
   ;  R3 = status_location (pointer to Int)
   ;  R4 = status_bits (Bits)
   ;  R5 = irq_location (pointer to Int)
   ;  R6 = irq_bits (Bits)
   ;  R7 -> read_code (code)
   ;  R8 -> write_code (code)

XADFS_IDEUserOp                 *       &6024B
ADFS_IDEUserOp                  *       &4024B
   ;Entry
   ;  R0 = op (Bits)
   ;  R2 -> commands (data)
   ;  R3 = buffer (pointer to data)
   ;  R4 = size (Int)
   ;  R5 = timeout (Int)
   ;Exit
   ;  R0 = status (Int)
   ;  R4 = untransferred (Int)
   ;  R5 corrupted

XADFS_MiscOp                    *       &6024C
ADFS_MiscOp                     *       &4024C

ADFSMiscOp_Mount                *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = drive_no (Int)
   ;  R2 = disc_addr (FileCore_DiscAddress)
   ;  R3 = buffer (pointer to data)
   ;  R4 = size (Int)
   ;  R5 = disc (pointer to FileCore_Disc)

ADFSMiscOp_PollChanged          *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = drive_no (Int)
   ;  R2 = sequence_no (Int)
   ;Exit
   ;  R2 = sequence_no_out (Int)
   ;  R3 = result (Bits)

ADFSMiscOp_LockDrive            *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 = drive_no (Int)

ADFSMiscOp_UnlockDrive          *       &3
   ;Entry
   ;  R0 = &3
   ;  R1 = drive_no (Int)

ADFSMiscOp_PollPeriod           *       &4
   ;Entry
   ;  R0 = &4
   ;  R1 -> disc_name (String)
   ;Exit
   ;  R5 = poll_period (Int)
   ;  R6 -> media_type (String)

ADFSMiscOp_EjectDisc            *       &5
   ;Entry
   ;  R0 = &5
   ;  R1 = drive_no (Int)

ADFSMiscOp_ReadInfo             *       &6
   ;Entry
   ;  R0 = &6
   ;Exit
   ;  R0 -> info (FileCore_Info)

XADFS_SectorDiscOp              *       &6024D
ADFS_SectorDiscOp               *       &4024D

ADFSSectorDiscOp_Verify         *       &0
   ;Entry
   ;  R1 = &0 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_SectorDiscAddress)
   ;  R4 = unverified (Int)

ADFSSectorDiscOp_ReadSectors    *       &1
   ;Entry
   ;  R1 = &1 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R3 = data (pointer to data)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_SectorDiscAddress)
   ;  R3 = next_data (pointer to data)
   ;  R4 = unread (Int)

ADFSSectorDiscOp_WriteSectors   *       &2
   ;Entry
   ;  R1 = &2 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R3 -> data (data)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_SectorDiscAddress)
   ;  R3 -> next_data (data)
   ;  R4 = unwritten (Int)

ADFSSectorDiscOp_ReadTrack      *       &3
   ;Entry
   ;  R1 = &3 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R3 = data (pointer to data)

ADFSSectorDiscOp_ReadId         *       &3
   ;Entry
   ;  R1 = &3 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R3 = data (pointer to data)

ADFSSectorDiscOp_WriteTrack     *       &4
   ;Entry
   ;  R1 = &4 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R3 -> data (data)

ADFSSectorDiscOp_FormatTrack    *       &4
   ;Entry
   ;  R1 = &4 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R3 = &0
   ;  R4 -> format (FileCore_TrackFormat)

ADFSSectorDiscOp_Seek           *       &5
   ;Entry
   ;  R1 = &5 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)

ADFSSectorDiscOp_Restore        *       &6
   ;Entry
   ;  R1 = &6 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)

ADFSSectorDiscOp_StepIn         *       &7
   ;Entry
   ;  R1 = &7 :OR: flags (Bits)

ADFSSectorDiscOp_StepOut        *       &8
   ;Entry
   ;  R1 = &8 :OR: flags (Bits)

ADFSSectorDiscOp_ReadSectorsViaCache *       &9
   ;Entry
   ;  R1 = &9 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)
   ;  R3 = data (pointer to data)
   ;  R4 = size (Int)
   ;  R6 = cache_handle (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_SectorDiscAddress)
   ;  R3 = next_data (pointer to data)
   ;  R4 = unread (Int)
   ;  R6 = cache_handle_out (Int)

ADFSSectorDiscOp_Specify        *       &F
   ;Entry
   ;  R1 = &F :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_SectorDiscAddress)

XADFS_ECCSAndRetries            *       &60250
ADFS_ECCSAndRetries             *       &40250

XADFS_LockIDE                   *       &60251
ADFS_LockIDE                    *       &40251
   ;Entry
   ;  R0 = lock (Bool)

XADFS_FreeSpace64               *       &60252
ADFS_FreeSpace64                *       &40252
   ;Entry
   ;  R0 -> disc_name (String)
   ;Exit
   ;  R0 = free_lo (Bits)
   ;  R1 = free_hi (Int)
   ;  R2 = max (Int)

XADFS_IDEDeviceInfo             *       &60253
ADFS_IDEDeviceInfo              *       &40253

XADFS_DiscOp64                  *       &60254
ADFS_DiscOp64                   *       &40254

ADFSDiscOp64_Verify             *       &0
   ;Entry
   ;  R1 = &0 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress64)
   ;  R4 = unverified (Int)

ADFSDiscOp64_ReadSectors        *       &1
   ;Entry
   ;  R1 = &1 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R3 = data (pointer to data)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress64)
   ;  R3 = next_data (pointer to data)
   ;  R4 = unread (Int)

ADFSDiscOp64_WriteSectors       *       &2
   ;Entry
   ;  R1 = &2 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R3 -> data (data)
   ;  R4 = size (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress64)
   ;  R3 -> next_data (data)
   ;  R4 = unwritten (Int)

ADFSDiscOp64_ReadTrack          *       &3
   ;Entry
   ;  R1 = &3 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R3 = data (pointer to data)

ADFSDiscOp64_ReadId             *       &3
   ;Entry
   ;  R1 = &3 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R3 = data (pointer to data)

ADFSDiscOp64_WriteTrack         *       &4
   ;Entry
   ;  R1 = &4 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R3 -> data (data)

ADFSDiscOp64_FormatTrack        *       &4
   ;Entry
   ;  R1 = &4 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R3 = &0
   ;  R4 -> format (FileCore_TrackFormat)

ADFSDiscOp64_Seek               *       &5
   ;Entry
   ;  R1 = &5 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)

ADFSDiscOp64_Restore            *       &6
   ;Entry
   ;  R1 = &6 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)

ADFSDiscOp64_StepIn             *       &7
   ;Entry
   ;  R1 = &7 :OR: flags (Bits)

ADFSDiscOp64_StepOut            *       &8
   ;Entry
   ;  R1 = &8 :OR: flags (Bits)

ADFSDiscOp64_ReadSectorsViaCache *       &9
   ;Entry
   ;  R1 = &9 :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)
   ;  R3 = data (pointer to data)
   ;  R4 = size (Int)
   ;  R6 = cache_handle (Int)
   ;Exit
   ;  R2 = next_disc_addr (FileCore_DiscAddress64)
   ;  R3 = next_data (pointer to data)
   ;  R4 = unread (Int)
   ;  R6 = cache_handle_out (Int)

ADFSDiscOp64_Specify            *       &F
   ;Entry
   ;  R1 = &F :OR: flags (Bits)
   ;  R2 = disc_addr (FileCore_DiscAddress64)

XADFS_ATAPIOp                   *       &60255
ADFS_ATAPIOp                    *       &40255

Service_IdentifyFormat          *       &6B
   ;Entry
   ;  R0 -> format (String)
   ;  R1 = &6B
   ;Exit
   ;  R0 -> command (String)
   ;  R1 = unclaimed (Bool)
   ;  R2 = disc_format_swi (Int)
   ;  R3 = disc_format_handle (Int)
   ;  R4 = layout_structure_swi (Int)
   ;  R5 = layout_structure_handle (Int)

Service_DisplayFormatHelp       *       &6C
   ;Entry
   ;  R0 = &0
   ;  R1 = &6C
   ;Exit
   ;  R0 -> error (OS_Error)
   ;  R1 = unclaimed (Bool)

        ]
        END
