Commit eeb4bcb0 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Try a 3rd time to ReadData from a drive

The ReadData function already has 2 workarounds for some quirks with Sony and Panasonic drives, using READ_CD to emulate the behaviour of READ_DATA because the latter didn't work on the particular models Acorn shipped. However, with DVD drives some firmware vendors have been a bit literal about what READ_CD does, so you end up in a situation of being able to read a CD but not a DVD in an otherwise identical setup.
Change the retry loop from 2 goes to 3. On the 3rd attempt just try using READ_DATA(12) like the standard intended, so we retain the former workarounds and only use that command last. Note that READ_DATA(2) only has a 2 byte block count which would be a truncation from READ_CD's 3, so using READ_DATA(12) with a 4 byte block count keeps the command block shuffling simpler.
Tested on a HP branded TS-H653 and Pioneer DVR-TD11RS with an ISO9660 DVD-R.

Version 1.39. Tagged as 'ATAPI-1_39'
parent dd1ae3ad
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.38"
Module_Version SETA 138
Module_MajorVersion SETS "1.39"
Module_Version SETA 139
Module_MinorVersion SETS ""
Module_Date SETS "23 Jan 2016"
Module_ApplicationDate SETS "23-Jan-16"
Module_Date SETS "31 Jan 2016"
Module_ApplicationDate SETS "31-Jan-16"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.38"
Module_HelpVersion SETS "1.38 (23 Jan 2016)"
Module_FullVersion SETS "1.39"
Module_HelpVersion SETS "1.39 (31 Jan 2016)"
END
/* (1.38)
/* (1.39)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.38
#define Module_MajorVersion_CMHG 1.39
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 Jan 2016
#define Module_Date_CMHG 31 Jan 2016
#define Module_MajorVersion "1.38"
#define Module_Version 138
#define Module_MajorVersion "1.39"
#define Module_Version 139
#define Module_MinorVersion ""
#define Module_Date "23 Jan 2016"
#define Module_Date "31 Jan 2016"
#define Module_ApplicationDate "23-Jan-16"
#define Module_ApplicationDate "31-Jan-16"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.38"
#define Module_HelpVersion "1.38 (23 Jan 2016)"
#define Module_LibraryVersionInfo "1:38"
#define Module_FullVersion "1.39"
#define Module_HelpVersion "1.39 (31 Jan 2016)"
#define Module_LibraryVersionInfo "1:39"
......@@ -408,6 +408,12 @@ RD_HowManyBlocks
; do with two calls to READ CD. This shouldn't have a performance impact
; because, once CDFS sees that it's a mode 2 form 1 disc, it changes mode to
; internal mode 3 anyway.
; However, other drives are very literal about READ CD and can only read
; data from CDs and not DVDs with this command, so having worked round the
; above problem with Panasonic drives we may end up rejecting perfectly good
; DVDs instead, as a last attempt use READ(12) to read the data. Note that
; READ(10) only has a 2 byte block count, which would be retrograde having
; allowed 3 byte block counts for READ CD.
; First: trap access to mode 0 discs and treat them as 1/3 i.e. the same as
; READ(10) would do. If the disc is not mode 0, the read will succeed.
......@@ -417,13 +423,15 @@ RD_HowManyBlocks
TEQS r0,#0
ADDEQ r0,r0,#1
; set bit 31 to indicate that retry in different mode has not been done
; use bits 31 & 30 to indicate which retry it is
; retry 2: READ CD mode 1, else
; retry 1: READ CD mode 2 form 1, else
; retry 0: READ(12), else error
ORR r0,r0,#1<<31
Push "r0,r8"
10
; r0 = expected mode 1,2,3
; r0 bit 31 => have not yet tried alternative mode
TSTS r0,#1 ; mode 1 or mode 2 form 1?
ORRNE r14,r5,#2_00010000 << 24 ; flags = just user data
......@@ -439,7 +447,12 @@ RD_HowManyBlocks
ORREQ r14,r5,#2_01111000 << 24 ; flags = all headers/user/EDC/ECC
MOVEQ r2,#2_000 << (24 + 2) ; any type of sector
ORR r2,r2,#ATAPI__READ_CD << 16 ; opcode
MOV r1,r0,LSR #30 ; retry
CMP r1,#1
ORRCS r2,r2,#ATAPI__READ_CD << 16 ; opcode
ORRCC r2,r2,#ATAPI__READ_DATA << 16
BICCC r2,r2,#2_1111 << (24 + 1) ; DPO=0 FUA=0
MOVCC r14,r14,LSL #8 ; knock out flags, make transfer length MSB=0
; r2 = opcode + expected sector type
; r3 -> data buffer
......@@ -517,24 +530,17 @@ RD_HowManyBlocks
Pull "r8",NE ; ...restore r8
BNE error_handler ; ...and branch
; illegal request error
; if mode 1 and not tried mode 3, try mode 3
; if mode 3 and not tried mode 1, try mode 1
; if tried both, give up
; illegal request error, try again
LDR r0,[sp] ; get stacked mode
; stacked r0 = mode just tried
; stacked r0 bit 31 => have not yet tried alternative mode
TSTS r0,#1 ; mode 1 or 3?
TSTNES r0,#1<<31 ; yes, tried other yet?
EORNE r0,r0,#(1<<31) + (1<<1) ; if not, try other mode
STRNE r0,[sp] ; overwrite stacked r0
BNE %B10 ; r0 = mode
TST r0,#1 ; internal mode 1 or 3?
BEQ %FT30
SUBS r0,r0,#1<<30 ; yes, tried other yet?
STRPL r0,[sp] ; try again
BPL %B10 ; r0 = mode
; illegal request error and done all modes
30
Pull "r0,r8"
[ cdebug
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment