Error and Good Sector Check

From Software Archive
Revision as of 18:23, 24 November 2026 by Enigma (talk | contribs) (New protection page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Error and Good Sector Check

This analysis is based on the state of the wiki from 24 Nov 2026.

Error and Good Sector Check is the name used on this wiki for a check routine on disk releases of several publishers from 1984 to 1986: Activision (track 18 sector 9), Epyx, Sydney Development, Data East and others with other sectors. The disk is a normal CBM DOS disk on which one sector has a data block with a wrong checksum.

In short: the program reads the faulty sector with the DOS command U1 and needs a read error, then reads a good sector of the same track and needs the answer without error. After the check the routine erases itself.

The check

The routine is the same on all titles listed below, apart from the address and the two sectors. Pitfall! (Source 1):

$488B  20 E7 FF  JSR $FFE7
$488E  A2 1B     LDX #$1B         ; open the command channel with the command I0:
$4890  A0 49     LDY #$49
$4892  A9 03     LDA #$03
$4894  20 BD FF  JSR $FFBD
$4897  A9 0F     LDA #$0F
$4899  A8        TAY
$489A  A2 08     LDX #$08
$489C  20 BA FF  JSR $FFBA
$489F  20 C0 FF  JSR $FFC0
$48A2  A9 02     LDA #$02         ; open channel 2 with the name "#"
$48A4  A8        TAY
$48A5  A2 08     LDX #$08
$48A7  20 BA FF  JSR $FFBA
$48AA  A9 01     LDA #$01
$48AC  A2 1E     LDX #$1E
$48AE  A0 49     LDY #$49
$48B0  20 BD FF  JSR $FFBD
$48B3  20 C0 FF  JSR $FFC0
$48B6  A9 39     LDA #$39         ; sector 9: read track 18 sector 9
$48B8  20 F8 48  JSR $48F8
$48BB  20 EA 48  JSR $48EA        ; first character of the answer
$48BE  C9 0D     CMP #$0D
$48C0  F0 F9     BEQ $48BB
$48C2  C9 32     CMP #$32         ; must be "2": an error 20 to 29
$48C4  D0 1E     BNE $48E4
$48C6  A9 32     LDA #$32         ; sector 2: read track 18 sector 2
$48C8  20 F8 48  JSR $48F8
$48CB  20 EA 48  JSR $48EA
$48CE  C9 0D     CMP #$0D
$48D0  F0 F9     BEQ $48CB
$48D2  C9 30     CMP #$30         ; must be "0": no error
$48D4  D0 0E     BNE $48E4
$48D6  A9 02     LDA #$02         ; passed: close the channels
$48D8  20 C3 FF  JSR $FFC3
$48DB  A9 0F     LDA #$0F
$48DD  20 C3 FF  JSR $FFC3
$48E0  20 30 49  JSR $4930        ; erase this routine
$48E3  60        RTS
$48E4  20 30 49  JSR $4930        ; failed: erase this routine
$48E7  4C 00 40  JMP $4000        ; and jump away
$48EA  A2 0F     LDX #$0F
$48EC  20 C6 FF  JSR $FFC6
$48EF  20 E4 FF  JSR $FFE4
$48F2  48        PHA
$48F3  20 CC FF  JSR $FFCC
$48F6  68        PLA
$48F7  60        RTS
$48F8  8D 29 49  STA $4929        ; put the sector digit into the command
$48FB  A9 08     LDA #$08
$48FD  20 B1 FF  JSR $FFB1
$4900  A9 6F     LDA #$6F
$4902  20 93 FF  JSR $FF93
$4905  A2 00     LDX #$00
$4907  8A        TXA
$4908  48        PHA
$4909  BD 1F 49  LDA $491F,X      ; send U1:2,0,18,9
$490C  F0 08     BEQ $4916
$490E  20 A8 FF  JSR $FFA8
$4911  68        PLA
$4912  AA        TAX
$4913  E8        INX
$4914  D0 F1     BNE $4907
$4916  68        PLA
$4917  20 AE FF  JSR $FFAE
$491A  60        RTS
  • The text of the commands is I0:, # and U1:2,0,18,9.
  • The first read must give an answer that starts with 2 (every error code from 20 to 29 passes). The second read, of a good sector of the same track, must give an answer that starts with 0. A drive that reports an error for every sector does not pass.
  • After the check the routine at $4930 fills the code with NOP. The command is not found as plain text in the sectors of the disks.

Titles on this wiki

Faulty sector Good sector Titles
Track 18 sector 9 Track 18 sector 2 Fast Tracks (Sources 1 to 3), Pitfall! (Source 1), The Activision Decathlon (Source 2), Toy Bizarre (Sources 1 and 3), Zenji (Sources 1 and 2), Zone Ranger (Sources 1 and 2) - all Activision
Track 2 sector 10 Track 2 sector 5 Summer Games II (Sources 6, 7, 8 and 10) - Epyx
Track 35 sector 10 Track 35 sector 5 Fight Night (Sources 1, 2, 4 and 5) - Sydney Development
Track 29 sector 10 Track 29 sector 5 Desert Fox (Source 2) - Sydney Development, U.S. Gold
Track 1 sector 10 Track 1 sector 5 Kung-Fu Master (Sources 2 and 3) - Data East
Track 18 sector 14 Track 18 sector 5 Asylum (Source 4) - All American Adventures

Verification on this wiki

  • The routine was found in the memory of the C64 at the moment the drive reported the read error (the sources whose Protection field names one error sector were run with a breakpoint in the drive). Sources whose check comes later than 200 seconds or needs input are not covered.
  • Kung-Fu Master: the Protection field of these sources notes that the error on track 1 sector 10 alone is not enough for a copy.
  • Each source of the table was run against a copy in which the data block of the faulty sector has the correct checksum: the copy shows a black screen or the BASIC start screen, the original starts.

Not covered

  • Other Activision sources with a faulty sector 9 on track 18 where this routine was not seen: Ghostbusters (Sources 3, 8, 10 and 13; other code after the same command text), Mindshadow, The Music Studio (Source 4), H.E.R.O., Park Patrol, Pastfinder, Pitfall II, River Raid, The Designer's Pencil.
  • Summer Games II (Sources 4 and 11) names the same sector in its Protection field; the routine was not captured there.

Pages that refer to this protection