----------Race Car 'Rithmetic---------- A 4am crack 2014-05-21 --------------------------------------- "Race Car 'Rithmetic" is a 1983 educational game. It was designed by June S. Stark and David Flatman at the Computer Learning Center for Children, and it was distributed by Unicorn Software Company. [The copy protection is identical to "Gertrude's Secrets," which is mildly interesting in that it was distributed by a different company. This write-up is therefore quite similar to that one, with a few corrections.] Booting the original disk sounds like a normal DOS 3.3, complete with track seeking to track 2, then 1, then 0, then swinging to the middle of the disk to read the catalog track. It even displays a BASIC prompt during boot, as if it's loading a HELLO program. However, the disk is uncopyable by any automated method. COPYA fails instantly. EDD4 bit copy gives read errors on track $13 and up (which appear to be entirely unformatted). The copy that EDD4 creates can boot, but it only gets as far as loading DOS and displaying the BASIC prompt before clearing the screen and rebooting. My trusty Copy ][+ sector editor can read tracks $00 through $12, though, once I change the RWTS option to "DOS 3.3 PATCHED" (which ignores address field checksums and epilogue bytes). Track $11 does appear to contain a disk catalog. My initial hypothesis: 6-2 nibble encoding scheme; custom RWTS with standard prologue bytes ("D5 AA 96" and "D5 AA AD") but non-standard epilogue bytes; a CALL in the HELLO program that executes a nibble check. I can use COPYA from the DOS 3.3 master disk to copy the data from the original disk to a blank disk with standard epilogue bytes. By booting the DOS 3.3 master disk and changing $B942 from SEC ($38) to CLC ($18), I can create a "no checksum" RWTS that ignores epilogue bytes on read but respects them on write. I will need to make one additional modification. By default, COPYA copies the entire disk, tracks $00 through $22. There is no option in the UI to change this, so I will need to manually BLOAD COPY.OBJ0 and modify it to stop reading and writing after track $12. [S6D1=DOS 3.3 master disk] Load COPYA and its helper program into memory: ]LOAD COPYA ]BLOAD COPY.OBJ0 Stop COPYA from reloading COPY.OBJ0: ]70 Patch COPY.OBJ0 in memory to stop reading (and writing -- two separate patches) after track $12: ]CALL-151 *302:13 *35F:13 Patch DOS to ignore epilogue errors: *B942:18 And go: *3D0G ]RUN [S6D1=original disk] [S6D2=blank disk] This produces a copy that is readable by unmodified DOS 3.3. The copy can even read itself (since the only thing that's changed is the epilogue bytes that it was ignoring in the first place). But it still displays the same behavior as the copy I made with EDD4: it loads DOS, displays the BASIC prompt, then reboots. However, further investigation reveals something very interesting... [S6D1=DOS 3.3 master disk] [S6D2=non-working copy] ]PR#6 ]CATALOG,D2 DISK VOLUME 254 A 002 HELLO B 066 LOGO.PAGE B 034 TITLE.PAGE B 034 RACE GAME.PAGE A 048 PROGRAM B 002 LOMEM: B 026 HIGHER TEXT B 008 SUBROUTINES.OBJ B 005 TITLE.OBJ ]RUN HELLO Lo and behold, the game loads and runs! That means that the last part of my hypothesis was incorrect. Whatever secondary protection causes the copy to reboot is not part of the HELLO program; it's part of the custom DOS. At this point, I can recreate a working copy of the game by initializing another blank disk with DOS 3.3 and copying these files over with a file copier. What about the nibble check? Don't even care. OK, OK, I care a little. Let's do a little boot tracing. [S6D1=non-working copy] [S5D1=my work disk] ]PR#5 ... CAPTURING BOOT0 ...reboots slot 6... ...reboots slot 5... SAVING BOOT0 ]CALL -151 *800<2800.28FFM *801L . . all normal, until... . 084A- 4C C0 08 JMP $08C0 *8C0L 08C0- 8E E9 B7 STX $B7E9 08C3- 6C FD 08 JMP ($08FD) Weird. "STX $B7E9" would usually be the first instruction in the boot1 code, at $B700. But otherwise, nothing unusual here. The boot0 code is close enough to DOS 3.3 that I can continue with the next step of my AUTOTRACE program. (It stopped after saving boot0 because the instruction at $084A was non-standard.) ]BRUN AUTOTRACE1 CAPTURING BOOT1 ...reboots slot 6... ...reboots slot 5... SAVING BOOT1 SAVING RWTS ]BLOAD BOOT1,A$2600 ]CALL -151 *B600<2600.2EFFM The very first line at $B700 is suspicious: B700- 20 00 BB JSR $BB00 I've learned from previous cracks (and from reading "Beneath Apple DOS") that, in a standard DOS-3.3-derived RWTS, the area from $BB00 to $BC55 is overwritten by during every disk read. So why is there executable code there? Let's find out. *BB00L BB00- A0 00 LDY #$00 BB02- B9 00 BB LDA $BB00,Y BB05- 99 00 02 STA $0200,Y BB08- 88 DEY BB09- D0 F7 BNE $2B02 BB0B- 60 RTS Well that's definitely suspicious. Relocating yourself into the input buffer at $200? Seriously, who does that? I'm guessing that the first instruction after this is the entry point, so after relocation that would be $020C. *200