new sub-function HDD_5x.DETECT

This commit is contained in:
Anatoliy Belyanskiy 2023-07-23 23:37:35 +10:00
parent 87a7ecbd70
commit 2f448e715f
4 changed files with 58 additions and 24 deletions

@ -1 +1 @@
Subproject commit 94cb0e39f321bd11519008801187d93eacb280f2
Subproject commit 95d1fbbb4a2b0de5e09534432be8caa51bcd2142

View File

@ -509,7 +509,7 @@ TAB_5xFNS:
DB low HDD_5x.VERIFY
DB low HDD_5x.READ
DB low HDD_5x.WRITE
DB low FN_ABSENT_5x
DB low HDD_5x.DETECT
DB low HDD_5x.GETMED
DB low HDD_5x.SETMED
@ -603,7 +603,7 @@ TAB_5xFNS:
DB high HDD_5x.VERIFY
DB high HDD_5x.READ
DB high HDD_5x.WRITE
DB high FN_ABSENT_5x
DB high HDD_5x.DETECT
DB high HDD_5x.GETMED
DB high HDD_5x.SETMED

View File

@ -76,7 +76,8 @@ IDE3 EQU #C1D8
WRITE_OUTI_DUPs EQU 32 ; bytes
;[]================================================================[#51]
;Function: Reset drive
HDD_5x.RESET: ; !FIXIT ­¥ à¥á¥â¨âáï?
;For non-ATAPI drives, the only method a driver has of resetting a drive
; after a major error is to do a "software reset" on the bus.
@ -86,6 +87,7 @@ HDD_5x.RESET: ; !FIXIT
; automatically selected.
XOR A
RET
;[]================================================================[#51]
SELECTH:
AND #0F
@ -131,7 +133,7 @@ NODRIVE:
SCF
RET
;[]===========================================================[]
;[]================================================================[#58]
;Function: Get Current Media Parameters
; A - Disk
;Return:
@ -140,7 +142,6 @@ NODRIVE:
; DE - Cylinders
; IX - Capacity sector in bytes
; B - Flags: ide chanel
;[]===========================================================[]
HDD_5x.GETMED:
CALL SELECTH
RET C
@ -159,8 +160,9 @@ HDD_5x.GETMED:
EX AF,AF'
AND A
RET
;[]================================================================[#58]
;[]===========================================================[]
;[]================================================================[#59]
;Function: Set Current Media Parameters
; A - Disk
; H - Heads
@ -169,7 +171,6 @@ HDD_5x.GETMED:
; IX - Capacity sector in bytes
; B - Flags
;Return: None
;[]===========================================================[]
HDD_5x.SETMED:
CALL SELECTH
RET C
@ -187,8 +188,9 @@ HDD_5x.SETMED:
EX AF,AF'
AND A
RET
;[]================================================================[#59]
;[]===========================================================[]
;[]================================================================[#55]
;Function: Read Sectors
; A - Disk
; HL:IX - Sector
@ -197,13 +199,12 @@ HDD_5x.SETMED:
;Return:
; HL:IX - Sector + Sector counter
; DE - Address + (Sector counter * Size sector)
;[]===========================================================[]
;READ SECTOR(S)
HDD_5x.READ:
EX AF,AF'
IN A,(SLOT3)
EX AF,AF'
;[]===========================================================[]
;[]================================================================[#52]
;Function: Long Read Sectors
; A - Disk
; HL:IX - Sector
@ -213,7 +214,6 @@ HDD_5x.READ:
;Return:
; HL:IX - Sector + Sector counter
; DE - Address + (Sector counter * Size sector)
;[]===========================================================[]
;LONG READ SECTOR(S)
HDD_5x.LONG_READ:
PUSH IY
@ -275,7 +275,6 @@ RST8RDR:
POP IY
EX AF,AF'
RET
;READ SECTOR(S)
RDS000: CALL SELECTH
RET C
@ -350,8 +349,10 @@ RDS004: DUP 16
JP NZ,RDS002
XOR A
RET
;[]===========================================================[#52, #55]
;[]===========================================================[]
;[]================================================================[#56]
;Function: Write Sectors
; A - Disk
; HL:IX - Sector
@ -360,13 +361,12 @@ RDS004: DUP 16
;Return:
; HL:IX - Sector + Sector counter
; DE - Address + (Sector counter * Size sector)
;[]===========================================================[]
;WRITE SECTOR(S)
HDD_5x.WRITE:
EX AF,AF'
IN A,(SLOT3)
EX AF,AF'
;[]===========================================================[]
;[]================================================================[#53]
;Function: Long Write Sectors
; A - Disk
; HL:IX - Sector
@ -376,7 +376,6 @@ HDD_5x.WRITE:
;Return:
; HL:IX - Sector + Sector counter
; DE - Address + (Sector counter * Size sector)
;[]===========================================================[]
;WRITE SECTOR(S)
HDD_5x.LONG_WRITE:
PUSH IY
@ -532,14 +531,15 @@ WRS003:
JP NZ,WRS002
XOR A
RET
;[]===========================================================[#53, #56]
;[]===========================================================[]
;[]================================================================[#54]
;Function: Verify Sectors
; A - Disk
; HL:IX - Sector
; B - Sector counter
;Return: None
;[]===========================================================[]
;VERIFY SECTOR(S)
HDD_5x.VERIFY:
PUSH IY
@ -557,7 +557,7 @@ HDD_5x.VERIFY:
EXX
POP IY
RET
;[]================================================================[#54]
;VERIFY SECTOR(S)
VRS000: CALL SELECTH
RET C
@ -588,7 +588,6 @@ VRS003: LD DE,#C140 ;WAIT BUSY=0 & ERR=0 & READY=1
; HL:IX - LBA SECTOR
; B - SECTOR COUNTER
PRESET: LD A,B
LD BC,IDE.Write.Counter
OUT (C),A
@ -684,4 +683,39 @@ WAITPRT:
.error: LD A,4 ;!HARDCODE error number
SCF
RET
;=======================================================
;=======================================================================
;[]================================================================[#57]
;Function: Detect Disk
; A - Disk
;Return: CF=0 - A=Drive type
; CF=1 - drive not present, A=#FF
HDD_5x.DETECT:
CP #84 ;!HARDCODE max HDD drives (#80,#81,#82,#83)
CCF
RET C
LD HL,IDE.INIT_TBL_IDE0.DriveType
AND 3
JR Z,.get_param
LD HL,IDE.INIT_TBL_IDE1.DriveType
DEC A
JR Z,.get_param
LD HL,IDE.INIT_TBL_IDE2.DriveType
DEC A
JR Z,.get_param
LD HL,IDE.INIT_TBL_IDE3.DriveType
.get_param:
IN A,(SLOT3)
LD B,A
LD A,SYS_PAGE
OUT (SLOT3),A
LD A,(HL)
LD C,SLOT3
OUT (C),B
CP #FF
CCF
RET
;[]================================================================[#57]

View File

@ -87,7 +87,7 @@ DRV_LIST: ; ?????
.NOT_CD1:
.ABSIDE1:
LD IY,IDE.INIT_TBL_IDE2
LD A,(IY+IDE.HDD_INIT_TABLE.DriveType) ;IDE TYPE 1-HDD, 2-CD-ROM
LD A,(IY+IDE.HDD_INIT_TABLE.DriveType) ;IDE TYPE 1-HDD, 2-CD-ROM
CP #FF
JR Z,.ABSIDE2
CP IDE.Device.HDD
@ -100,7 +100,7 @@ DRV_LIST: ; ?????
.NOT_CD2:
.ABSIDE2:
LD IY,IDE.INIT_TBL_IDE3
LD A,(IY+IDE.HDD_INIT_TABLE.DriveType) ;IDE TYPE 1-HDD, 2-CD-ROM
LD A,(IY+IDE.HDD_INIT_TABLE.DriveType) ;IDE TYPE 1-HDD, 2-CD-ROM
CP #FF
JR Z,.check_exit
CP IDE.Device.HDD