;-------------------------------------------------------------------------------
; FATware - firmware and file system driver for ZX Spectrum divIDE interface
; Copyright (c) 2005-2009 Milos Bazelides (baze)
;-------------------------------------------------------------------------------
; This software is provided "as is" without warranties or conditions of any
; kind, either express or implied. In no event shall the author(s) be held
; liable for any damages arising from the use of this software.
; See accompanying "licence.txt" file for copyright and terms of use.
;-------------------------------------------------------------------------------
; This file contains constants and macros related to ATA and divIDE hardware.
; Please DO NOT include any file system or platform specific stuff here.
;-------------------------------------------------------------------------------

; divIDE control register

DIV_CTRL	equ	227

; ATA Command Block registers (with aliases for read/write and CHS/LBA)

ATA_DATA	equ	163	; Data
ATA_ERR		equ	167	; Error
ATA_FEAT	equ	167	; Features
ATA_SC		equ	171	; Sector Count
ATA_SN		equ	175	; Sector Number
ATA_LBA0	equ	175	; LBA bits 0..7
ATA_CL		equ	179	; Cylinder Low
ATA_LBA1	equ	179	; LBA bits 8..15
ATA_CH		equ	183	; Cylinder High
ATA_LBA2	equ	183	; LBA bits 16..23
ATA_DH		equ	187	; Device/Head
ATA_LBA3	equ	187	; LBA bits 24..27
ATA_STAT	equ	191	; Status
ATA_CMD		equ	191	; Command

; device numbers (bits 5 and 7 are only valid for ATA-1 and ATA-2)

DEV_0		equ	0A0h	; device 0 (master)
DEV_1		equ	0B0h	; device 1 (slave)
DEV_LBA		equ	040h	; LBA capability bit

; Status Register bit masks

STA_BSY		equ	80h	; Busy
STA_DRDY	equ	40h	; Device Ready
STA_DF		equ	20h	; Device Fault
STA_DSC		equ	10h	; Device Seek Complete
STA_DRQ		equ	08h	; Data Request
STA_CORR	equ	04h	; Corrected Data
STA_IDX		equ	02h	; Index
STA_ERR		equ	01h	; Error

; ...the same values rotated left (used in optimised I/O routines)

STL_BSY		equ	01h	; Busy
STL_DRDY	equ	80h	; Device Ready
STL_DF		equ	40h	; Device Fault
STL_DSC		equ	20h	; Device Seek Complete
STL_DRQ		equ	10h	; Data Request
STL_CORR	equ	08h	; Corrected Data
STL_IDX		equ	04h	; Index
STL_ERR		equ	02h	; Error

; Identify Device Sector entries we care about

idGeneral	equ	0
idNumCyls	equ	2
idNumHeads	equ	6
idNumSecs	equ	12
idSerial	equ	20
idFirmware	equ	46
idModel		equ	54
idCaps		equ	98
