Sector Pair Check

From Software Archive
Revision as of 19:16, 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

Sector Pair Check

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

Sector Pair Check is the name used on this wiki for a check routine on disk releases of several publishers from 1983 and 1984: Epyx, Human Engineered Software, Progressive Peripherals & Software, DesignWare, The Learning Company and Softsmith. The disk is a normal CBM DOS disk on which sector 1 of track 1 has a data block with a wrong checksum. The duplicator text of two Epyx titles names a protection: CMDR 4040/1541 HLS-PROT DUP 5"-48/35 1S DD SS (Dragonriders of Pern), V019/S2.0 COMMODORE 4040/1541 HLSPROT DUP (Starfire / Fire One).

In short: the routine reads a good sector with the DOS command U1 and needs the answer without error, then reads the faulty sector before it and needs an error. It runs at any address: it finds its own page first.

The Error and Good Sector Check tests the two sectors in the other order and has other code.

The disk

  • Sector 1 of track 1 has a good header and a data block with a wrong checksum (CBM DOS: error 23, also shown as error 5). Sector 2 of track 1 is good.
  • Math Maze has the pair on track 31: sector 11 is good, sector 10 is faulty.

The check

The routine fills one page of memory. Starfire / Fire One (Source 1), where it was loaded to $1B00:

$1B00  A9 60     LDA #$60         ; put an RTS to $7FFF and call it:
$1B02  8D FF 7F  STA $7FFF
$1B05  20 FF 7F  JSR $7FFF
$1B08  BA        TSX              ; the stack now holds the page of this routine
$1B09  BD 00 01  LDA $0100,X
$1B0C  85 FC     STA $FC
$1B0E  A2 00     LDX #$00
$1B10  86 FB     STX $FB
$1B12  A0 56     LDY #$56         ; write the page into the seven absolute addresses of the routine
$1B14  91 FB     STA ($FB),Y
$1B16  A0 6B     LDY #$6B
$1B18  91 FB     STA ($FB),Y
$1B1A  A0 7D     LDY #$7D
$1B1C  91 FB     STA ($FB),Y
$1B1E  A0 82     LDY #$82
$1B20  91 FB     STA ($FB),Y
$1B22  A0 85     LDY #$85
$1B24  91 FB     STA ($FB),Y
$1B26  A0 9C     LDY #$9C
$1B28  91 FB     STA ($FB),Y
$1B2A  A0 B9     LDY #$B9
$1B2C  91 FB     STA ($FB),Y
$1B2E  AC 00 90  LDY $9000        ; is $9000 RAM?
$1B31  C8        INY
$1B32  8C 00 90  STY $9000
$1B35  CC 00 90  CPY $9000
$1B38  F0 0F     BEQ $1B49
$1B3A  A0 3B     LDY #$3B         ; failed: fill the memory
$1B3C  91 FB     STA ($FB),Y
$1B3E  88        DEY
$1B3F  D0 FB     BNE $1B3C
$1B41  C6 FC     DEC $FC
$1B43  D0 F7     BNE $1B3C
$1B45  C6 FC     DEC $FC
$1B47  D0 F3     BNE $1B3C
$1B49  20 90 FF  JSR $FF90        ; open the command channel
$1B4C  A9 00     LDA #$00
$1B4E  20 CC FF  JSR $FFCC
$1B51  A9 03     LDA #$03
$1B53  A6 DD     LDX $DD
$1B55  A0 1B     LDY #$1B
$1B57  20 BD FF  JSR $FFBD
$1B5A  A9 0F     LDA #$0F
$1B5C  A2 08     LDX #$08
$1B5E  A0 0F     LDY #$0F
$1B60  20 BA FF  JSR $FFBA
$1B63  20 C0 FF  JSR $FFC0
$1B66  A9 01     LDA #$01         ; open channel 3 with the name "#"
$1B68  A2 DC     LDX #$DC
$1B6A  A0 1B     LDY #$1B
$1B6C  20 BD FF  JSR $FFBD
$1B6F  A9 03     LDA #$03
$1B71  A2 08     LDX #$08
$1B73  A0 03     LDY #$03
$1B75  20 BA FF  JSR $FFBA
$1B78  20 C0 FF  JSR $FFC0
$1B7B  20 B0 1B  JSR $1BB0        ; read track 1 sector 2
$1B7E  D0 BA     BNE $1B3A        ; must give no error
$1B80  CE EB 1B  DEC $1BEB        ; sector 2 -> sector 1
$1B83  20 B0 1B  JSR $1BB0        ; read track 1 sector 1
$1B86  F0 B2     BEQ $1B3A        ; must give an error
$1B88  20 CC FF  JSR $FFCC        ; passed: send I and close the channels
$1B8B  A2 0F     LDX #$0F
$1B8D  20 C9 FF  JSR $FFC9
$1B90  A9 49     LDA #$49
$1B92  20 D2 FF  JSR $FFD2
$1B95  A9 0D     LDA #$0D
$1B97  20 D2 FF  JSR $FFD2
$1B9A  20 C2 1B  JSR $1BC2
$1B9D  A9 0F     LDA #$0F
$1B9F  20 C3 FF  JSR $FFC3
$1BA2  A9 03     LDA #$03
$1BA4  20 C3 FF  JSR $FFC3
$1BA7  20 8A FF  JSR $FF8A
$1BAA  A9 EE     LDA #$EE
$1BAC  A4 FC     LDY $FC
$1BAE  D0 43     BNE $1BF3        ; start the program
$1BB0  A2 0F     LDX #$0F         ; send the command at $1BE0: U1:3 0 01 02
$1BB2  20 C9 FF  JSR $FFC9
$1BB5  A0 00     LDY #$00
$1BB7  B9 E0 1B  LDA $1BE0,Y
$1BBA  F0 06     BEQ $1BC2
$1BBC  20 D2 FF  JSR $FFD2
$1BBF  C8        INY
$1BC0  D0 F5     BNE $1BB7
$1BC2  20 CC FF  JSR $FFCC
$1BC5  A2 0F     LDX #$0F
$1BC7  20 C6 FF  JSR $FFC6
$1BCA  20 CF FF  JSR $FFCF        ; first digit of the answer
$1BCD  29 0F     AND #$0F         ; 0 = no error
$1BCF  48        PHA
$1BD0  20 CF FF  JSR $FFCF        ; read the rest of the answer
$1BD3  C9 0D     CMP #$0D
$1BD5  D0 F9     BNE $1BD0
$1BD7  20 CC FF  JSR $FFCC
$1BDA  68        PLA
$1BDB  60        RTS
  • The text at the end of the page is #I/OU1:3 0 01 02. The last digit is counted down after the first read, so the second command is U1:3 0 01 01.
  • The first read must give an answer whose first digit is 0. The second read must give an answer whose first digit is not 0: every error passes. A drive that reports an error for every sector, and a disk without the error, both fail.
  • After a failed check the routine fills the memory and does not come back. After a passed check it jumps to the program.
  • The routine is the same on all titles listed below; only the test of $9000, the jump to the program and a few bytes at the end of the page differ.

Copying

  • A sector copy stops at the faulty sector; a copy that skips it or writes it without error fails the check.
  • A copy needs a read error on the faulty sector and a good sector after it.

Titles on this wiki

Publisher Titles
Epyx Dragonriders of Pern, FAX, Lunar Outpost (Sources 1 and 3), Starfire / Fire One
Human Engineered Software Tri-Math, Turtle Graphics II, Turtle Toyland Jr.
Progressive Peripherals & Software Cyberworld, Perplexian Challenger
DesignWare Math Maze (track 31 sectors 11 and 10), Spellagraph
The Learning Company Word Spinner
Softsmith Ticker

Verification on this wiki

  • The sector images of all G64 on the wiki were searched for the bytes of the routine and for its text. It is on the titles above and on no other.
  • Each source was run against a copy in which the data block of the faulty sector has the correct checksum. The copy shows a screen filled with one character, a blank screen or stays at the loading picture (Word Spinner); the original starts.
  • Cyberworld: the test stops at the request for the data disk on both images; this title is listed because of the routine on its disk and is not confirmed with a copy.
  • The Telarium titles Fahrenheit 451 (Source 3), Nine Princes in Amber and Perry Mason: The Case of the Mandarin Murder have the same faulty sector, but read it with the disk routine of their own program system; they are not counted here.

Pages that refer to this protection