A Bug with SCDPQ/SCDPQL (US Model 1/2 BIOS, Possibly More)
So, these 2 BIOS functions are supposed to retrieve the P and Q subcode data for the current sector being processed. But, there is a bug that causes slight corruption, at least in the US model 1/2 BIOS revisions. I have no idea if this was fixed in any other revisions, but this bug exists here.
According to the manual, this is the expected result:
Note the "P" flag entry. That's the P subcode flag. Everything else is from the Q subcode data.
As it is stated, there are 3 Q subcode data modes that dictate what the data contains and how it's arranged. Mode 1 basically describes the current track/sector, mode 2 describes the catalogue number, and mode 3 describes the ISRC code. The "P" flag's location depends on this mode, due to the varying data lengths, and the BIOS tries to take that into account, but fails. Let's see what it does...
Code:
move.b 0(a1),d1 ; Get Q subcode data mode
andi.b #$F,d1
cmpi.b #1,d1 ; Is it mode 1?
beq.s .Mode1 ; If so, branch
cmpi.b #2,d1 ; Is it mode 2?
beq.s .Mode1 ; If so, branch (BUG: WRONG LABEL!)
cmpi.b #3,d1 ; Is it mode 3?
beq.s .Mode1 ; If so, branch (BUG: WRONG LABEL!)
bra.s .StoredPFlag ; If it's none of the above, skip
; ---------------------------------------------------------------------------
.Mode1:
move.b d0,6(a1) ; Store P subcode flag for mode 1
bra.s .StoredPFlag
; ---------------------------------------------------------------------------
.Mode2:
; UNREFERENCED!
move.b d0,8(a1) ; Store P subcode flag for mode 2
bra.s .StoredPFlag
; ---------------------------------------------------------------------------
.Mode3:
; UNREFERENCED!
move.b 8(a1),d1 ; Store P subcode flag for mode 3
andi.b #$F0,d1
andi.b #$F,d0
or.b d1,d0
move.b d0,8(a1)
; ---------------------------------------------------------------------------
.StoredPFlag:
Oh dear.
Yeah, looks like they just copied and pasted the checks for modes 2 and 3... but forgot to change the label to go to the correct code. As a result, if you wanted to get the catalogue number or ISRC code for whatever reason, I hope you enjoy it being slightly corrupted!