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.VERIFY
DB low HDD_5x.READ DB low HDD_5x.READ
DB low HDD_5x.WRITE DB low HDD_5x.WRITE
DB low FN_ABSENT_5x DB low HDD_5x.DETECT
DB low HDD_5x.GETMED DB low HDD_5x.GETMED
DB low HDD_5x.SETMED DB low HDD_5x.SETMED
@ -603,7 +603,7 @@ TAB_5xFNS:
DB high HDD_5x.VERIFY DB high HDD_5x.VERIFY
DB high HDD_5x.READ DB high HDD_5x.READ
DB high HDD_5x.WRITE DB high HDD_5x.WRITE
DB high FN_ABSENT_5x DB high HDD_5x.DETECT
DB high HDD_5x.GETMED DB high HDD_5x.GETMED
DB high HDD_5x.SETMED DB high HDD_5x.SETMED

View File

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