Compare commits

...

342 Commits

Author SHA1 Message Date
4am
a8c6676549 update holle patcher [fixes Sherwood Forest] 2024-05-15 11:57:44 -04:00
4am
61b7818929 update changelog 2024-04-29 12:17:24 -04:00
4am
b2686f485e add support for encrypted E7Everywhere [fixes Language Carnival] 2024-04-29 12:10:05 -04:00
4am
7829069ff4 fix logic error in calculating display sector (does not affect existing cracks) 2024-04-29 12:09:25 -04:00
4am
43a719aa56 add support for unencrypted AdvInt [fixes Spiderman,War] 2024-04-28 02:09:21 -04:00
4am
cc3a9c4f7e switch to determinate progress bar during initial decompression, and upgrade to ProDOS 2.4.3 2024-03-27 19:59:52 -04:00
4am
6213b948f8 add support for LSR6A+CMP08 JMP0600 variant [fixes Broadsides rev. 4] 2023-12-07 01:28:27 -05:00
4am
161ff58b8d add support for JMP0600 secondary RWTS with address parsing at BC56 [fixes Alphabet Zoo, Broadsides] 2023-12-06 00:14:41 -05:00
4am
dec3ce3698 disable RWTS swapper in RPS protection [fixes Evelyn Dynamic Reader] 2023-10-08 01:10:39 -04:00
4am
c9af84fa27 add support for JMP600 bootloader [fixes Wizard of Words v1.0] 2023-10-02 23:42:07 -04:00
4am
6bf634274f remove gPossibleD5D5F7 flag as it's causing false negatives [fixes Picture Perfect 1987] 2023-09-04 23:34:49 -04:00
4am
11f2ef57d6 add support for Earthware variant [fixes Black Belt rev. 2] 2023-09-03 23:30:13 -04:00
4am
8bd1523939 prep for release 2023-07-28 11:04:10 -04:00
4am
87582b60a4 update comment to match test suite change 2023-07-28 11:03:22 -04:00
Peter Ferrie
8b11ac7320 fix dangling partial-track placement in 5-5-5 2023-07-27 11:38:16 -07:00
4am
39758aaba9 add unexpected 5&3 track detection [fixes Real Math] 2023-06-26 20:39:38 -04:00
4am
3e8f19deb4 update readme 2023-05-28 20:13:17 -04:00
4am
25634996e2 add support for TAY/BIT any-checksum protection [fixes SVS Rapid Reader, E-Z Learner] 2023-05-28 20:02:43 -04:00
4am
d20981ed0e update README 2023-05-06 18:47:42 -04:00
4am
973c0699e4 modify D5D5F7 patch [fixes Les Sports] 2023-05-04 21:07:39 -04:00
4am
cdb1d28920 fix Didatech output log 2023-04-08 11:44:10 -04:00
4am
84a1713b5b add support for Didatech [fixes Crosscountry USA, Canada, California] 2023-03-26 15:00:07 -04:00
4am
540c9fb161 add support for PROBS5 protection [fixes Allyn and Bacon titles] 2023-03-26 13:22:46 -04:00
4am
98107fcb62 add support for nonstandard epilogues in SIGCHECK [fixes Water Pollution] 2023-01-27 21:30:55 -05:00
Peter Ferrie
dc7b3d8cd3 support The General Manager anti-tamper 2023-01-18 20:23:34 -08:00
eientei95
b675e8f372
Properly fix building on case-sensitive OSes, make makefile more closer to winmake.bat (#113) 2022-12-03 18:41:38 -05:00
4am
b250d98d23 add support for Neosoft self-decrypting nibble count at BB29 [fixes Animal Photo Fun, Comparison Kitchen] 2022-11-29 18:32:21 -05:00
4am
c525e8c708 add support for ATILA variants of LSR 6A and CMP 08 RWTS 2022-11-29 13:59:13 -05:00
4am
8a746d084f some comments 2022-11-29 13:33:10 -05:00
4am
c07ce2713e add support for another Scott, Foresman and Company nibble count 2022-11-29 13:31:03 -05:00
4am
8733220f7c add support for Scott, Foresman and Company nibble count 2022-11-29 13:07:40 -05:00
4am
00b9e98b8b Merge branch 'master' of https://github.com/a2-4am/passport 2022-11-17 01:06:13 -05:00
4am
44a8aceb62 add Gamco variant [fixes Percent] 2022-11-17 01:06:05 -05:00
Peter Ferrie
ebcd3df3dd don't let The Game Show escape 2022-08-04 19:10:53 -07:00
4am
cd37eaba50 Merge branch 'master' of https://github.com/a2-4am/passport 2022-08-04 21:53:16 -04:00
4am
b5cdad368b add support for MicroLearn protection [fixes U.S. Constitution Tutor] 2022-08-04 21:53:10 -04:00
4am
4b6b066225
Update README.md 2022-07-18 00:34:55 -04:00
4am
895b4fde82
Update README.md 2022-07-18 00:34:05 -04:00
David Schmidt
424701bfde
Add retry keys to doc (#110) 2022-07-18 00:26:30 -04:00
4am
26215423bf update copyright year 2022-07-11 15:33:54 -04:00
4am
5c329be886 shave some bytes 2022-07-11 13:32:29 -04:00
4am
b9b7d1f118 slightly less wordy 2022-07-10 11:35:46 -04:00
4am
5f6f15ce78 add support for Enlightenment disks [fixes Paul Whitehead Teaches Chess] 2022-07-10 00:16:59 -04:00
4am
d4793ce09f update changelog 2022-07-07 14:40:51 -04:00
Peter Ferrie
7abb12d5ef fix Aquatron and Dragon's Keep 2022-07-07 10:41:16 -07:00
4am
8540b47b47 update changelog 2022-07-07 13:19:04 -04:00
4am
37620387ac actually support Sherwood Forest instead of just claiming to 2022-07-05 21:20:44 -04:00
4am
e6c4dc14c7 more PFS Pascal write checks 2022-06-27 00:39:40 -04:00
4am
950fdf73fd another JMPBB03 variant [fixes Pacific 231] 2022-06-26 21:19:56 -04:00
4am
4029dfbeac give PFS Pascal its own string since it's not really the Activision protection 2022-06-26 18:37:08 -04:00
4am
defb7f2ec0 update changelog 2022-06-25 22:50:09 -04:00
4am
f5a4613b12 more PFS FBFF check variations [really fixes PFS Write 1984-11-01] 2022-06-25 21:54:06 -04:00
4am
cafecddaa2 more PFS FBFF check variations [fixes PFS Write 1984-11-01] 2022-06-25 21:49:53 -04:00
4am
81a3352ac5 more PFS write check variations [fixes PFS Graph 1983-01-12] 2022-06-25 21:00:11 -04:00
4am
6b90aef548 some comments 2022-06-24 19:16:59 -04:00
4am
b0b6bfafbd limited wildcard of third data prologue in universal RWTS [fixes Key Lingo rev. 2] 2022-06-24 19:11:55 -04:00
4am
984946a2b7 add support for Baudville 2022-06-24 13:44:26 -04:00
4am
e437f8154a disable rarely used RWTS swapper in JMPB4BB [fixes Half Time] 2022-06-12 10:36:27 -04:00
Peter Ferrie
6c64f3b8c2 support Ultima II 2022-06-07 11:02:41 -07:00
4am
11086cd3e6 add support for MAK secondary protection on Hartley disks
[fixes Kittens, Kids, and a Frog]
2022-06-03 17:48:21 -04:00
4am
829b031a4f support alternate jump addresses after B400 check [fixes Rebus Writer] 2022-06-01 21:27:02 -04:00
eientei95
e9a37e2541
Fix building on case-sensitive OSes (#109) 2022-04-11 20:25:31 -04:00
Peter Ferrie
8ece0c8b6f Merge branch 'master' of https://github.com/a2-4am/passport 2022-02-05 11:50:38 -08:00
Peter Ferrie
2e03703343 verify explicitly all six sectors in RW18 mode 2022-02-05 11:50:34 -08:00
Peter Ferrie
01f0070939 verify explicitly all six sectors in RW18 mode 2022-02-05 11:50:07 -08:00
Peter Ferrie
f4aee49c5f support RDOS with modified prologue 2022-02-04 21:58:17 -08:00
Peter Ferrie
75323c5b5d support Funbunch College Prep 2022-02-03 16:44:22 -08:00
Peter Ferrie
d6db17b402 clear leftover DOS error 2022-01-24 12:38:14 -08:00
4am
12bfd649a6 . 2022-01-09 19:43:01 -05:00
4am
c5448d52d6 remove nibble translation table hack in IsUnformatted which was causing false positives on some Optimum Resource disks) 2022-01-09 19:42:27 -05:00
Peter Ferrie
fddb1f6bb0 fix off-by-one in Sierra patcher 2021-11-14 11:25:52 -08:00
Peter Ferrie
5000366bc6
support Fax (#106) 2021-11-12 15:27:58 -05:00
4am
be3787a015 check for multiple PFS write checks per track 2021-10-07 15:42:11 -04:00
4am
d3b96395ef disable write check on PFS Pascal disks 2021-10-05 16:43:02 -04:00
4am
c39072431f fix regression caused by shorter Pascal ID 2021-09-29 21:18:11 -04:00
4am
bff35a1895 shorten Pascal signature to catch early PFS 2021-09-25 19:40:29 -04:00
4am
55856a2dc3 more betterer sigcheck 2021-09-14 11:34:01 -04:00
4am
d6a68f40f5 better sigcheck patch with no disk grinding 2021-09-13 12:20:36 -04:00
4am
5fb1e40e0a add support for extra wide tracks anywhere, expand sigcheck patcher 2021-09-13 02:08:11 -04:00
4am
7975003b15 add support for various PFS protections 2021-09-12 15:46:08 -04:00
Peter Ferrie
63cb05140b remove unneeded patch 2021-09-08 19:40:08 -07:00
4am
78a8718662 analyze tracks during 5-5-5 event loop 2021-09-08 18:26:16 -04:00
Peter Ferrie
04a3179328 shave some bytes 2021-09-08 13:34:37 -07:00
Peter Ferrie
f4eaf797a0 Merge branch 'master' of https://github.com/a2-4am/passport 2021-09-08 13:34:04 -07:00
Peter Ferrie
d9d502d50c support Logic Builders 2021-09-08 13:33:58 -07:00
4am
9ba05c5e74 update changelog 2021-09-08 14:51:49 -04:00
Peter Ferrie
b87b0266e3 support Boulder Dash II 2021-09-06 22:06:04 -07:00
Peter Ferrie
f96c63acfd fix random error when switching from 16 to 13 sectors 2021-09-05 12:52:52 -07:00
4am
f5fc9ae5bb update changelog 2021-09-04 18:29:52 -04:00
Peter Ferrie
ce39e396d3 Merge branch 'master' of https://github.com/a2-4am/passport 2021-09-04 13:00:27 -07:00
Peter Ferrie
aa5781ac15 fix hard-disk image numbering 2021-09-04 13:00:23 -07:00
4am
183f029719 update changelog 2021-09-04 15:24:50 -04:00
4am
83c54392d2 rebase 2021-09-04 15:21:22 -04:00
4am
1428b45731 fix universal E7 patcher 2021-09-04 15:20:43 -04:00
Peter Ferrie
23500497b2 support Mind Mirror secondary protection 2021-09-03 19:36:12 -07:00
4am
c3ee6eb0fd minor readme updates 2021-07-11 20:33:12 -04:00
4am
c09940b377 2021-07-12 release 2021-07-11 20:25:46 -04:00
4am
cf88cbda4e some comments 2021-07-11 20:25:32 -04:00
4am
fe6027b112 shave some bytes 2021-07-11 14:25:18 -04:00
4am
a673379742 remove unused global 2021-07-11 14:18:34 -04:00
4am
43090d530f shave some bytes 2021-07-11 14:15:23 -04:00
4am
16bfd3441f some comments 2021-07-11 14:06:03 -04:00
4am
aa2fe760c8 shave some bytes 2021-07-11 14:00:10 -04:00
4am
2ac9702c71 shave some bytes 2021-07-11 13:41:12 -04:00
4am
48e7c8cc55 update some comments 2021-07-11 13:21:15 -04:00
4am
cba62f83b0 shave some bytes 2021-07-11 11:56:35 -04:00
4am
20d53156ef shave some bytes 2021-07-11 11:12:04 -04:00
4am
722b9124ac shave some bytes 2021-07-11 01:15:12 -04:00
4am
1e750b3d88 shave some bytes 2021-07-11 01:10:32 -04:00
4am
6cd32f53e2 shave some bytes 2021-07-11 01:03:32 -04:00
4am
857b9c243a shave some bytes 2021-07-11 00:51:32 -04:00
4am
e505ed9206 shave some bytes in and around CreateFileOnRAMDisk 2021-07-10 21:05:29 -04:00
4am
696f20ba49 shave some bytes 2021-07-10 20:53:57 -04:00
4am
fe21da1a00 clean up TraceDOS33 2021-07-10 01:32:29 -04:00
4am
9ca2297c1d update entry comments 2021-07-10 01:32:03 -04:00
4am
8ce3403acc shave some bytes 2021-07-09 20:14:08 -04:00
4am
4db0aaf0ad shave some bytes 2021-07-09 20:08:27 -04:00
4am
78a8a7e1e0 fix notProDOS branch 2021-07-09 20:03:51 -04:00
4am
f938ac1a45 some readme updates 2021-07-09 18:21:29 -04:00
Peter Ferrie
eab36f7bfc fix 13-sector infinite loop 2021-07-08 20:57:25 -07:00
Peter Ferrie
101c5ba5d7 don't do 13-sector ID if not track 0 2021-07-08 09:09:18 -07:00
4am
91c0f4e805 some comments (no code changes) 2021-07-07 12:01:15 -04:00
4am
2c32447cd0 progress animation from deater 2021-07-03 19:13:55 -04:00
Peter Ferrie
10de85888b more 5-5-5 work 2021-06-30 19:44:31 -07:00
Peter Ferrie
8368a71eb5 more 5-5-5 work 2021-06-30 17:01:25 -07:00
Peter Ferrie
f0c6053489 fix 5-5-5 with RAM disk 2021-06-30 15:30:24 -07:00
Peter Ferrie
2a9d6202ec more 5-5-5 work 2021-06-30 09:11:14 -07:00
Peter Ferrie
48ee3499dc more 5-5-5 work 2021-06-25 15:45:55 -07:00
Peter Ferrie
36b90a6070 allow verify Toy Shop master 2021-06-22 16:08:56 -07:00
Peter Ferrie
20562ee2bb more 5-5-5 work 2021-06-21 19:16:47 -07:00
4am
8ed8811e06 fix recent regression in Pascal RWTS patcher 2021-06-21 21:11:34 -04:00
4am
ebf2ab35d0 fix off-by-1 errors 2021-06-21 21:06:36 -04:00
Peter Ferrie
21368c8e7d more 5-5-5 work 2021-06-21 17:57:24 -07:00
4am
98c8529f45 shave some bytes 2021-06-21 12:12:33 -04:00
4am
ce2e3b5813 shave some bytes 2021-06-21 11:57:02 -04:00
4am
e2a397815c shave some bytes 2021-06-21 11:24:21 -04:00
4am
2a594af93b shave some bytes 2021-06-21 10:33:16 -04:00
4am
0b4ab1d247 shave some bytes 2021-06-21 10:15:48 -04:00
4am
57c732896c shave some bytes 2021-06-21 09:58:22 -04:00
4am
59f21b31f9 shave some bytes 2021-06-21 08:18:07 -04:00
4am
087012a361 shave some bytes 2021-06-21 08:14:02 -04:00
4am
fb31cd38e0 shave some bytes 2021-06-20 21:00:12 -04:00
4am
6ff8d01da7 shave some bytes 2021-06-20 20:00:13 -04:00
4am
6dc5dfee34 shave some bytes 2021-06-20 19:58:42 -04:00
4am
4b35d87e00 shave some bytes 2021-06-20 19:53:51 -04:00
4am
5707f86588 shave some bytes 2021-06-20 18:25:11 -04:00
4am
2be2556ecb shave some bytes 2021-06-20 18:24:17 -04:00
4am
cee6753852 combine and simplify bademu patchers 2021-06-20 17:36:10 -04:00
4am
f1ad04d2dc comments and style 2021-06-20 17:35:48 -04:00
4am
479100ef9f shave some bytes 2021-06-20 00:18:55 -04:00
4am
aabfb0118a shave some bytes 2021-06-19 19:42:56 -04:00
4am
72f4ffb7d7 shave some bytes 2021-06-19 13:11:55 -04:00
4am
4b477a9dba shave some bytes 2021-06-19 13:07:09 -04:00
4am
daefedbb5d shave some bytes 2021-06-19 11:00:16 -04:00
4am
7a75188e4f shave some bytes 2021-06-19 10:54:56 -04:00
4am
9ecb49331b shave some bytes 2021-06-19 00:59:28 -04:00
4am
d435feef86 shave some bytes 2021-06-19 00:46:17 -04:00
4am
4672dbe928 don't clear memory we're just going to copy over 2021-06-19 00:33:10 -04:00
4am
b5372f438c shave some bytes 2021-06-19 00:30:33 -04:00
4am
79c3aacb75 shave some bytes 2021-06-19 00:28:52 -04:00
4am
5b02464c14 shave some bytes 2021-06-19 00:21:14 -04:00
4am
270f437c6f restore missing label 2021-06-18 23:51:12 -04:00
4am
18c9d51da1 update memory map 2021-06-18 23:38:16 -04:00
4am
4ba29c86c1 revert now-unnecessary change to exodecrunch table address 2021-06-18 23:36:30 -04:00
4am
0150b09f75 shave some bytes 2021-06-18 22:06:12 -04:00
4am
3e261a01e6 shave some bytes 2021-06-18 21:56:15 -04:00
4am
18d7e7f811 shave some bytes 2021-06-18 21:41:37 -04:00
4am
3aac011d2c shave some bytes 2021-06-18 21:33:51 -04:00
4am
8fbbb216fe shave some bytes 2021-06-18 21:32:58 -04:00
4am
e768648d54 fix exit flags in IDDavidson 2021-06-18 21:32:11 -04:00
4am
fa07615ebf shave some bytes 2021-06-18 21:29:02 -04:00
4am
431499d41a simplify build and wrapper code 2021-06-18 21:13:59 -04:00
4am
f7de3777ee shave some bytes 2021-06-18 20:54:26 -04:00
4am
86692918e7 more build simplification 2021-06-18 20:50:19 -04:00
4am
2ce68a439a create prefs file as TXT 2021-06-18 20:26:26 -04:00
4am
db9c045d11 shave some bytes, inline some single use functions, and simplify Makefile 2021-06-18 20:15:15 -04:00
4am
53f92388b0 move T00 modules to 3200 or B200 as necessary
also move globals back to program space for compatibility
2021-06-18 13:53:17 -04:00
4am
b7d4a41909 shave some bytes 2021-06-18 01:53:02 -04:00
4am
6626ec5034 shave some bytes 2021-06-18 01:42:53 -04:00
4am
177591ddf1 shave some bytes and fix Dinkey-DOS regression 2021-06-18 01:10:02 -04:00
4am
7bde1d668f cleaner refresh of main menu after slot cycle, and shave some bytes elsewhere 2021-06-17 22:12:07 -04:00
4am
2a1dd8975d split out application-specific write routines 2021-06-17 21:46:49 -04:00
4am
5e0cac5e0e shave some bytes 2021-06-17 21:42:58 -04:00
4am
ee83034bf1 shave some bytes 2021-06-17 21:31:03 -04:00
4am
74f76609c0 shave some bytes 2021-06-17 21:27:39 -04:00
4am
d1597bfb5f shave some bytes 2021-06-17 21:23:50 -04:00
4am
7bd584ec34 shave some bytes 2021-06-17 20:52:42 -04:00
4am
9a10d3c006 shave some bytes 2021-06-17 18:29:21 -04:00
4am
cefbc184a1 shave some bytes 2021-06-17 18:06:06 -04:00
Peter Ferrie
c490d4febb fix my bugs 2021-06-17 14:09:21 -07:00
Peter Ferrie
dc4490939e more 5-5-5 work 2021-06-16 22:08:09 -07:00
4am
422684ca4d fix build 2021-06-17 01:05:35 -04:00
4am
1a1f32e1e3 Merge branch 'master' of https://github.com/a2-4am/passport 2021-06-17 01:04:27 -04:00
4am
475954b6bb shave some bytes 2021-06-17 01:04:21 -04:00
Peter Ferrie
3ee3ce6689 shave some bytes 2021-06-16 22:03:03 -07:00
4am
b8242457ff some comments 2021-06-16 13:57:30 -04:00
4am
b76b442431 shave some bytes 2021-06-16 13:36:20 -04:00
4am
f4c13c270d don't decompress or run T00 modules in verify mode 2021-06-16 13:02:29 -04:00
4am
077bf65edd fix broken log on Optimum Resource and SVE disks 2021-06-14 11:24:10 -04:00
4am
0aba4adb87 fix broken log in ProtectedDOS tracer 2021-06-14 11:20:59 -04:00
4am
a99ac0d169 fix broken log in RDOS13 tracer 2021-06-14 11:18:12 -04:00
4am
5552f8882b do rwtslog patcher before other patchers that might copy universal RWTS into place (avoids false positives) 2021-06-14 11:13:28 -04:00
4am
0290cd71c7 fix broken log in jmpb412 patcher 2021-06-14 11:03:15 -04:00
4am
649917327e fix broken log on 5-5-5 bootloader 2021-06-14 11:01:36 -04:00
4am
765bde89d7 refactor track 0 patchers 2021-06-14 10:56:40 -04:00
4am
d8c9f21877 shave some bytes 2021-06-13 13:08:28 -04:00
4am
8edd3da266 shave some bytes 2021-06-13 01:43:46 -04:00
4am
9fa5659a73 shave some bytes 2021-06-13 01:06:09 -04:00
4am
c6df2ec549 shave some bytes by refactoring PrintByID 2021-06-12 22:07:26 -04:00
4am
154aea3cd9 shave some bytes 2021-06-12 00:50:09 -04:00
4am
24a67c61fc shave some bytes 2021-06-11 20:55:18 -04:00
4am
003240e505 shave some bytes 2021-06-11 20:45:10 -04:00
4am
acf943baf1 shave some bytes 2021-06-11 15:19:41 -04:00
4am
f75eb39c67 shave some bytes 2021-06-11 15:06:50 -04:00
4am
a2d5b46b06 shave some bytes 2021-06-11 14:46:28 -04:00
4am
7d2c1bb12b fix spinner character on ][+ 2021-06-11 14:36:03 -04:00
4am
d5945a7293 if write from RAM disk fails, preserve A long enough to print proper error 2021-06-11 13:56:47 -04:00
Peter Ferrie
335f58cea1 support some Softsmith 5-5-5s 2021-06-10 16:19:58 -07:00
Peter Ferrie
fc74b8b31a guard against C0EC crossing a page 2021-06-07 14:42:03 -07:00
Peter Ferrie
e4f6ed2a26 avoid extra keypress in scroll 2021-06-07 14:27:54 -07:00
4am
3129a8d4e2 erase serial numbers while cracking Lock-It-Up disks, if present 2021-06-07 17:03:11 -04:00
Peter Ferrie
ff6e074bee verify complete RW18 disks (e.g. Toy Shop data disks) 2021-06-07 08:58:39 -07:00
Peter Ferrie
6d713afd14 support 5-5-5 Rocky's Boots 2021-06-03 20:42:19 -07:00
4am
c0e1635e6b update README 2021-05-29 23:03:59 -04:00
Peter Ferrie
8b3325cd31 add for support 5-5-5 spiral protection 2021-05-28 19:03:09 -07:00
Peter Ferrie
648507f1fd 5-5-5 WIP 2021-05-26 19:22:36 -07:00
4am
c6d2031368 support SIGCHECK.O extra wide track protection [fixes Advanced Electricity, others] 2021-05-22 11:35:57 -04:00
Peter Ferrie
5dc2360d58 fix FPs on SVE 2021-05-15 11:30:02 -07:00
Peter Ferrie
955555aef7 support extended Panglossian protection 2021-05-11 22:26:38 -07:00
Peter Ferrie
0a21d6c020 support SVE DOS 2021-05-01 15:42:36 -07:00
4am
691e6f8777 support Micrograms bad block check [fixes Granny Applebee's Cookie Factory, Uncle Clyde's Consonant Slide, and several others] 2021-04-29 21:55:45 -04:00
Peter Ferrie
c475e8597c fix more EA tamper checks 2021-04-29 13:46:53 -07:00
4am
ef666f7b43 fix SwapProDOS confusion in WriteRAMToDisk (always return and let caller handle rechecking for key 2021-04-29 15:53:27 -04:00
Peter Ferrie
fa16586550 fix Arctic Fox anti-tamper 2021-04-29 09:09:48 -07:00
4am
2cfec80809 fix typo in Datasoft string 2021-04-29 10:24:30 -04:00
Peter Ferrie
ccf7bbe065 support new Earth Orbit Stations version 2021-04-28 22:38:53 -07:00
4am
c586346bbd typo 2021-04-28 17:49:09 -04:00
4am
6e022888eb some README updates 2021-04-28 17:44:51 -04:00
4am
fb2df8a26c support for Earthware reverse RWTS swapper [fixes Black Belt, Zoo Master, Star Search] 2021-04-28 17:37:56 -04:00
Peter Ferrie
d86614f81b fix scroll off-by-one 2021-04-21 18:29:51 -07:00
4am
8f2e01cc23 revert some build syntax changes 2021-04-21 10:33:57 -04:00
Peter Ferrie
b080cbf31c verify RW18 (WIP) 2021-04-20 16:29:51 -07:00
4am
09b58e2c58 fix space/tab issue 2021-04-20 16:22:28 -04:00
Peter Ferrie
481e61cd0b backscroll log 2021-04-20 13:02:07 -07:00
4am
79e30dda0e some formatting changes 2021-04-20 01:10:23 -04:00
4am
4b69dfdc46 move sector map to 0CD0..0EFF 2021-04-20 00:42:03 -04:00
4am
c40a85b140 some formatting changes 2021-04-20 00:27:11 -04:00
4am
b5db14e87a move some more stuff around 2021-04-20 00:02:09 -04:00
4am
8a244c82b9 break up passport.a a bit [WIP] 2021-04-19 23:48:41 -04:00
4am
62a9b63498 shave some bytes 2021-04-19 21:17:23 -04:00
4am
80c2b93165 restore and refactor ResetVector, fix SwapProDOS confusion on exit 2021-04-19 20:53:33 -04:00
4am
3e9dd24ed9 merge ResetVector and MainMenu 2021-04-19 10:58:00 -04:00
4am
6d70d7956d clean up RAM/HD files on Ctrl-Reset 2021-04-19 10:44:51 -04:00
4am
4a97d929eb move SaveProDOS to wrapper to shave some bytes 2021-04-19 10:38:28 -04:00
4am
3beb4c8b3d refactor animation-during-decompression using IFDEFs to shave some bytes 2021-04-19 10:28:08 -04:00
4am
46b2019ba1 add support for B4BB RWTS swapper in BASIC [fixes SocMate Analogies Games] 2021-04-19 10:19:57 -04:00
4am
40c3a97cf0 don't show animation after initial decompression 2021-04-18 12:39:19 -04:00
4am
2cccfd3e57 add animation during initial decompression 2021-04-18 11:19:14 -04:00
4am
d4939063b9 move some code around, shave some bytes 2021-04-18 00:49:26 -04:00
4am
b3a75e8748 refactor RAM disk and hard disk support 2021-04-18 00:12:05 -04:00
4am
4aa11ebfcb fix ReorderBuffer [regression after recent refactor] 2021-04-17 23:58:33 -04:00
4am
f386a55fc9 add access to vars, and some comments 2021-04-16 11:48:53 -04:00
4am
d1de957c6f shave some bytes 2021-04-16 11:03:53 -04:00
4am
8655cd707d support Spinnaker RWTS changer [fixes Kidwriter] 2021-04-15 17:55:11 -04:00
4am
fd96ba7922 remove debugging statements 2021-04-15 12:34:19 -04:00
4am
9aef30b9b1 properly close/delete RAM disk file, refactor Save/SwapProDOS to preserve registers and flags 2021-04-15 12:33:41 -04:00
4am
8bcc24c3f5 add label for CFFA3000-managed targets 2021-04-14 23:35:14 -04:00
4am
8eecd95baf support Mastery Development RWTS changer [fixes Mastery Arithmetic Games and several others] 2021-04-14 20:23:59 -04:00
4am
8d136c6c5d minor refactor 2021-04-14 14:13:58 -04:00
Peter Ferrie
4e1dba94ad fix image counting 2021-04-14 10:26:25 -07:00
4am
de98679962 print full path when writing to file 2021-04-14 12:40:53 -04:00
Peter Ferrie
ed060454fd allow /RAM along with hard disk 2021-04-13 19:45:56 -07:00
Peter Ferrie
664be8577c Merge remote-tracking branch 'origin/master' 2021-04-13 18:10:02 -07:00
Peter Ferrie
91f8de836b write image to hard disk 2021-04-13 18:09:55 -07:00
4am
44a208c5c4 shave some bytes 2021-04-13 16:27:20 -04:00
4am
c45bc8b51b typo 2021-04-13 12:43:58 -04:00
4am
2a8a10bc1e some minor formatting fixes 2021-04-12 22:17:34 -04:00
4am
9bc6c06355 don't print rwtslog pseudo-logs in verify mode (recent regression) 2021-04-12 22:17:23 -04:00
4am
f4a106d102 exit via FatalError (after cleanup) on nibble timeout 2021-04-12 22:16:56 -04:00
Peter Ferrie
dd934210f5
give Choplifter a timeout (#104) 2021-04-12 21:59:04 -04:00
4am
29679e0ed9 shave some bytes 2021-04-12 17:41:08 -04:00
4am
3f99d8f14c further refactoring (Trace33P should actually do what I want now) 2021-04-12 17:38:08 -04:00
4am
0bf69eacb2 refactor PreCheckT00 and call it before tracing DOS 3.3P 2021-04-12 17:32:38 -04:00
4am
cc6f10d749 typo 2021-04-12 11:43:05 -04:00
4am
2ae7d41df1 more string consolidation 2021-04-10 22:14:28 -04:00
4am
73ac1d29d2 more string consolidation 2021-04-10 22:01:21 -04:00
4am
51e1ea8a0c even more string consolidation 2021-04-08 16:22:30 -04:00
4am
7ffaec6982 more string consolidation 2021-04-08 16:11:00 -04:00
4am
74f57dfe6a allow strings to include other strings to save space 2021-04-08 13:18:17 -04:00
4am
a183a67ac4 refactor some redundant checks 2021-04-08 12:22:02 -04:00
4am
00a11f87d4 remove some unused code 2021-04-08 10:55:52 -04:00
4am
fecbcd1e1b rewrite Lock-It-Up patcher to preserve contents of 0x200 [fixes Number Crunchers, The Desecration, others] 2021-04-08 10:51:29 -04:00
4am
ddc2f67b63 remove unused demuffin mode 2021-04-08 10:50:14 -04:00
4am
63b250d00e preserve A out of WriteRAMToDisk 2021-04-08 10:49:18 -04:00
4am
d63ced0fab log D4/D5 prologue on Pascal disks [fixes GATO v1.3] 2021-04-07 21:44:09 -04:00
4am
7dea9214a0 patch out SSI fat track check [fixes Sixgun Shootout] 2021-04-06 18:05:12 -04:00
4am
8dda6c43c9 relax IDD5D5F7 [fixes Trivia Fever] 2021-04-02 11:14:46 -04:00
4am
2a66e59951 add support for Leisure Genius disk volume check
fixes Clue, Risk
2021-03-24 19:06:00 -04:00
4am
a5a7da9b75 update revision history
fixes https://github.com/a2-4am/passport/issues/102
2021-03-23 12:50:00 -04:00
4am
ebf83a430f update to ProDOS 2.4.2
fixes https://github.com/a2-4am/passport/issues/101
2021-03-23 12:37:03 -04:00
4am
22d60cec63 split MECC ProDOS searches and simplify some code [fixes Miner's Cave] 2021-03-05 11:06:08 -05:00
4am
3cb2f61fa6 add support for Woodbury bad block protection [fixes PlayWriter] 2021-03-02 18:23:13 -05:00
Peter Ferrie
bbd5349e5c
erase MECC site-license info (#103) 2021-03-01 13:14:32 -05:00
4am
13a6e3928b add support for another MECC RWTS swapper [fixes Zoyon Patrol] 2021-03-01 12:22:46 -05:00
4am
198b432bc6 gate on matching RWTS code 2021-03-01 00:27:38 -05:00
4am
efcfdd8aa2 fixes for MECC Database Composer's multiple layers of RWTS swappers 2021-02-28 21:01:35 -05:00
4am
9fd7e03572 add support for MECC data diskette RWTS swapper
fixes Word Wizards v1.0
2021-02-23 00:42:48 -05:00
4am
cbc5812a52 add support for JMPB500 patcher [fixes Starship Commander] 2021-02-10 13:17:01 -05:00
4am
64b4126662 add support for 1982-era Datasoft protection check at 9B00
fixes Fathoms 40, Canyon Climber
2020-10-17 11:10:21 -04:00
4am
93eface4c3 BB00 protection is called Lock-It-Up
according to EDD IV manual
2020-09-16 21:32:19 -04:00
4am
23b5538d66 add support for TSR protection 2020-07-22 19:01:07 -04:00
4am
74f8e8b93f add support for CMP/NOP/NOP protection (log-only) 2020-07-22 11:38:25 -04:00
4am
5e59b0f288 2020 release 2020-07-20 18:20:23 -04:00
4am
9b5f0277c7 update some comments 2020-07-20 13:01:24 -04:00
4am
622da85b5a ssprot variant 2 should not fall through to variant 3 [fixes Wortgefecht regression] 2020-07-20 12:54:01 -04:00
4am
9c149d5116 clear B200-BEFF to avoid false positives checking memory locations during analyze after cracking previous disk 2020-07-20 12:49:09 -04:00
4am
0d3bd353a3 update build date 2020-07-19 16:25:23 -04:00
4am
1f01f41988 add support for ssprot variant 3 [fixes Metric System Tutor] 2020-07-19 16:24:14 -04:00
4am
6d3cdc7581 add support for simpler RPS variant 2020-07-17 20:17:38 -04:00
4am
d314e7be03 add support for RPS protection [fixes several Britannica and Thunder Mountain disks] 2020-07-15 11:53:18 -04:00
4am
73270715a8 add Harvey to the test suite 2020-07-14 16:37:30 -04:00
4am
de7f80b18a add support for Harvey protection, consolidate similar log messages [fixes Harvey by Primes] 2020-07-14 16:36:31 -04:00
4am
d7a79419ef add support for BB03/B519 variant [fixes Spanish for Mastery] 2020-07-13 20:03:34 -04:00
Peter Ferrie
bcb432cec5
don't crash on SVE DOS (#99)
* simplify build

* don't crash on SVE DOS
2020-07-12 13:19:29 -04:00
4am
0e861f215a do not accelerate 2020-07-02 16:49:41 -04:00
Peter Ferrie
17a43ef07f
simplify build (#98) 2020-03-11 18:23:51 -04:00
Peter Ferrie
3a2a4c0c4f support new King's Quest protection (#97) 2020-01-04 11:55:43 -05:00
4am
2ec1105c5f update build date 2019-12-06 09:29:42 -05:00
4am
9da4e5b0e8
Merge pull request #96 from peterferrie/master
correct docs
2019-12-06 07:39:19 -05:00
Peter Ferrie
292ed3bbed correct docs 2019-12-05 20:34:45 -08:00
4am
e591760739
Merge pull request #95 from peterferrie/master
accelerate!
2019-12-05 22:22:17 -05:00
Peter Ferrie
7a9f7c850c accelerate! 2019-12-05 17:51:43 -08:00
4am
d61b2aedce rename Basham protection to PDI protection 2019-11-15 23:22:13 -05:00
4am
647616882f
Merge pull request #94 from peterferrie/master
support Basham protection
2019-10-13 12:16:37 -04:00
Peter Ferrie
e56eded52e support Basham protection 2019-10-11 13:50:31 -07:00
4am
8788eee1c3
Merge pull request #93 from peterferrie/master
Master
2019-08-28 19:12:19 -04:00
Peter Ferrie
8113c31805 support One-on-One 2019-08-28 14:34:33 -07:00
Peter Ferrie
5a059dca7f don't run with < 64kb 2019-08-27 10:53:01 -07:00
4am
68acfb8792
Merge pull request #92 from peterferrie/master
support Sierra track-swap protection
2019-08-09 13:36:18 -04:00
Peter Ferrie
f9792eb960 support Sierra track-swap protection 2019-08-08 18:08:23 -07:00
4am
868c297916 . 2019-07-25 12:52:04 -04:00
4am
f0d36517ca add support for JMP2012 protection (variant of JMPB412) 2019-07-25 12:51:24 -04:00
215 changed files with 10675 additions and 7282 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2016-8 4am
Copyright (c) 2016-2020 4am
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -17,44 +17,35 @@ ACME=acme
CADIUS=cadius
# https://bitbucket.org/magli143/exomizer/wiki/Home
# requires Exomizer 3.0 or later
EXOMIZER=exomizer raw -q -P23
EXOMIZER=exomizer
BUILDDISK=build/passport
asm:
mkdir -p build
cd src/mods && $(ACME) universalrwts.a
$(EXOMIZER) build/universalrwts.bin -o build/universalrwts.tmp
printf "\xB8\x00" | cat - build/universalrwts.tmp > build/universalrwts.pak
$(EXOMIZER) mem -lnone -q -P23 -f build/universalrwts.bin@0xb800 -o build/universalrwts.pak
cd src/mods && $(ACME) -r ../../build/t00only.lst t00only.a
$(EXOMIZER) build/t00only.bin -o build/t00only.tmp
printf "\x20\x00" | cat - build/t00only.tmp > build/t00only.pak
$(EXOMIZER) mem -lnone -q -P23 -f build/t00only.bin@0x2000 -o build/t00only.pak
echo > build/vars.a
cd src && $(ACME) -r ../build/passport.lst -DFORWARD_DECRUNCHING=1 passport.a 2> ../build/relbase.log
cd src && $(ACME) -DRELBASE=`cat ../build/relbase.log | grep "RELBASE =" | cut -d"=" -f2 | cut -d"(" -f2 | cut -d")" -f1` -DFORWARD_DECRUNCHING=1 passport.a 2> ../build/vars.log
grep "SaveProDOS=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 > build/vars.a
grep "kForceLower=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "DiskIIArray=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "PrintByID=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "WaitForKey=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "CleanExit=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "GetVolumeName=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "OnlineReturn=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "GetVolumeInfo=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "filetype=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "VolumeName=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "auxtype=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "blocks=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "PREFSVER=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "PREFSFILE=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "PREFSREADLEN=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "PREFSBUFFER=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "ValidatePrefs=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "SavePrefs=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "mliparam=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "OpenFile=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "ReadFile=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep "CloseFile=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
$(EXOMIZER) -b build/passport.tmp -o build/passport.pak
cd src && $(ACME) -r ../build/passport.lst -DRELBASE=`cat ../build/relbase.log | grep "RELBASE =" | cut -d"=" -f2 | cut -d"(" -f2 | cut -d")" -f1` -DFORWARD_DECRUNCHING=1 passport.a 2> ../build/vars.log
grep -m1 "ThisSlot=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "PrintByID=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "WaitForKey=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "CleanExit=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "OpenFile=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "ReadFile=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "CloseFile=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "GetVolumeName=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "GetVolumeInfo=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "PREFSVER=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "PREFSFILE=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "SLOT=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "DRIVE=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "MainMenu=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
grep -m1 "CheckCache=" build/vars.log | cut -d":" -f3 | cut -d"(" -f1 >> build/vars.a
$(EXOMIZER) raw -q -P23 -b build/passport.tmp -o build/passport.pak
cd src && $(ACME) -DFORWARD_DECRUNCHING=0 wrapper.a
cp res/work.po "$(BUILDDISK)".po
cp res/_FileInformation.txt build/

301
README.md
View File

@ -40,8 +40,8 @@ Using Passport is simple. After running
the program, put an original disk in
slot 6, drive 1 and a blank formatted
disk in any other drive. If necessary,
press "S" to cycle through your drives.
Then press "C" to start the cracking.
press `S` to cycle through your drives.
Then press `C` to start the cracking.
If all goes well, Passport will read
your original disk and write a copy in
@ -55,6 +55,23 @@ copy program.
If all does not go well, Passport will
tell you where it all went wrong.
During the process, you can press any
key to cancel immediately.
If you have a two-sided disk where only
one side is bootable, after the first
side completes, you can press `2` to
reuse the captured RWTS on the second
side.
If Passport stops because of read errors
but you suspect the errors are due to
physical damage (as opposed to just copy
protection), you can retry the process
ignoring errors by pressing `Ctrl-R`.
The resulting copy may or may not be
usable.
In any case, Passport will NEVER write
to or alter your original disk in any
way. And neither should you! Don't
@ -70,7 +87,13 @@ companies. These types of protection
were common in educational software.
- Abracadata
e.g. Design Your Own Home
e.g. Design Your Own Home series
- Allyn and Bacon
e.g. CAAT Skill Tester series
- American Guidance Service
e.g. SocMate Analogies Games
- Apple "Special Delivery"
e.g. Ernie's Quiz, Instant Zoo
@ -78,14 +101,18 @@ were common in educational software.
- ArtSci
e.g. AceCalc, Magicalc
- Blue Chip
- Blue Chip Software
e.g. Squire, Baron, Tycoon
- BrainBank
e.g. BackAid
- Davidson & Associates
e.g. Math Blaster Plus, Read N Roll
- DC Heath
e.g. What Makes A Dinosaur Sore
e.g. What Makes A Dinosaur Sore,
Buzz Bang Harvey
- DesignWare
e.g. Spellicopter, Crypto Cube
@ -94,17 +121,33 @@ were common in educational software.
e.g. Curious George in Outer Space,
Alien Addition
- Didatech Software
e.g. Crosscountry USA, Crosscountry
Canada
- Edu-Ware
e.g. Decimals, Algebra 2
- Ellen Nelson Learning Library
e.g. Science (series), House-a-fire!
- EME
e.g. Metric System Tutor,
Water in the Air, Complex Circuits
- Encyclopaedia Britannica
e.g. Problem Solving in Algebra,
Math Skills: Elementary Level
- Enlightenment
e.g. Paul Whitehead Teaches Chess,
Living Chess Library
- Focus Media
e.g. The Time Tunnel (series),
Travels with Za-Zoom
- Gamco
- Gamco Publishing
e.g. Math Leap Frog, Math Football
- Grolier Publishing
@ -114,7 +157,7 @@ were common in educational software.
e.g. Chariots, Cougars, and Kings;
Tim and the Cat and the Big Red Hat
- Hayden
- Hayden Software
e.g. SAT Score Improvement System,
Microscopic Journey
@ -135,7 +178,7 @@ were common in educational software.
e.g. Building Reading Skills,
Explorations in Science
- Krell
- Krell Software
e.g. Time Traveler, College Boards
- Laureate Learning Systems
@ -156,6 +199,9 @@ were common in educational software.
- Marshware
e.g. Squeegee Learns About Drugs
- Mastery Development
e.g. Mastery Arithmetic Games
- MECC
e.g. Word Munchers, Clock Works
@ -165,8 +211,9 @@ were common in educational software.
- Methods & Solutions
e.g. Fantasy Land, Behind The Wheel
- Micrograms
e.g. Wild West Math
- Micrograms Publishing
e.g. Wild West Math, Granny
Applebee's Cookie Factory
- Millennium Group
e.g. The Brain Game, Concentration
@ -186,9 +233,16 @@ were common in educational software.
- National Geographic Society
e.g. The Botanist's Apprentice
- Neosoft
e.g. Comparison Kitchen, Animal Photo
Fun
- Optimum Resource
e.g. Stickybear Math, Car Builder
- PDI
e.g. Leadsheeter, Polywriter
- Pelican Software
e.g. Dino Days, Graphics Converter
@ -220,6 +274,19 @@ were common in educational software.
- Science Research Associates
e.g. Computer Drill and Instruction
- Scott, Foresman and Company
e.g. Addition and Subtraction 4,
Decimals 3, Dinosaurs and Squids
- Silicon Valley Systems
e.g. Rapid Reader, E-Z Learner
- Softsmith
e.g. Astro Attack, Dinner on a Disk
- Software Publishing Corporation
e.g. PFS File, PFS Graph, PFS Write
- Spinnaker Software
e.g. Snooper Troops, KidWriter
@ -240,13 +307,18 @@ were common in educational software.
- Unicorn Software
e.g. Magical Myths, Ten Little Robots
- Woodbury Software
e.g. PlayWriter (series)
The latest version of Passport can also
recognize and defeat the protection
used by some game companies. In general
there was more variation and "one-off"
protection in games than in educational
software, so your mileage may vary.
Passport can also recognize and defeat
the copy protection used by some game
companies. In general there was more
variation and "one-off" protection in
games than in educational software, so
your mileage may vary.
- Accolade
e.g. Hardball, Law of the West
- Activision (patcher by TRex)
e.g. Hacker, Rampage
@ -257,6 +329,9 @@ software, so your mileage may vary.
- Atari
e.g. Defender, Gremlins
- Baudville
e.g. Blazing Paddles, Take 1
- Border
e.g. Arena, Early Bird
@ -270,9 +345,15 @@ software, so your mileage may vary.
- Dakin-5
e.g. MIRV, Rings of Saturn
- Datasoft
e.g. Canyon Climber, Fathoms 40
- Data East
e.g. Ikari Warriors, Batman
- Earthware
e.g. Black Belt, Zoo Master
- Electronic Arts (patcher by qkumba)
e.g. The Bard's Tale, Skyfox
@ -291,6 +372,9 @@ software, so your mileage may vary.
- Interplay
e.g. Borrowed Time, Tracer Sanction
- Leisure Genius
e.g. Clue Master Detective, RISK
- MicroFun
e.g. Crown of Arthain, Miner 2049er
@ -306,6 +390,9 @@ software, so your mileage may vary.
- Polarware
e.g. Oo-topos, The Crimson Crown
- Professional Software
e.g. Trivia Fever
- Softape
e.g. Photar
@ -321,13 +408,19 @@ software, so your mileage may vary.
e.g. Rendezvous with Rama, Fahrenheit
451
- TSR
e.g. Dawn Patrol, Dungeon
- Voyager Software
e.g. Starship Commander
## License
Passport is open source and is
distributed under the MIT license.
Passport
Copyright (c) 2016-8 by 4am
Copyright (c) 2016-2023 by 4am
Permission is hereby granted, free of
charge, to any person obtaining a copy
@ -363,6 +456,180 @@ IN THE SOFTWARE.
## History
Unreleased
- NEW: patchers/t00_jmp600.a
(fixes Wizard of Words, Alphabet Zoo,
Broadsides)
- NEW: patchers/e7everywhere.encrypted.a
(fixes Language Carnival 1 & 2)
- IMPROVED: patchers/t00_earthware.a
(fixes Black Belt rev. 2)
- IMPROVED: patchers/d5d5f7.a
(fixes Picture Perfect 1987)
- IMPROVED: patchers/t00_rps.a
(fixes Evelyn Dynamic Reader)
- IMPROVED: patchers/advint.a
(fixes War, Questprobe/Spider-Man)
2023-07-28
- NEW: patchers/didatech.a (fixes
Crosscountry USA, Crosscountry
Canada, Crosscountry California)
- NEW: patchers/microlearn.a (fixes
US Constitution Tutor, SAT English 1)
- NEW: patchers/probs5.a (fixes
Decimals Analyzer, Whole Numbers
Analyzer)
- NEW: patchers/t00_neosoft.a (fixes
Comparison Kitchen, Animal Photo Fun)
- NEW: patchers/t00_scottforesman.a
(fixes Addition and Subtraction 4,
Decimals 3, Dinosaurs and Squids)
- NEW: patchers/t00_scottforesman_
dos33.a (fixes Addition and
Subtraction 3, Decimals 2)
- NEW: unexpected 5&3 track detection
(fixes Real Math, Mathosaurus)
- IMPROVED: patchers/d5d5f7.a (fixes
Les Sports)
- IMPROVED: patchers/gamco.a (fixes
Percent)
- IMPROVED: patchers/sierra.a (fixes
secondary anti-tamper check in
The General Manager)
- IMPROVED: patchers/sigcheck.a (fixes
Water Pollution)
- IMPROVED: patchers/t00_rwtslog.a
(ATILA variant of LSR $6A detection
fixes The Treasure of Forest Isle,
TAY/BIT detection fixes Rapid
Reader and E-Z Learner)
- Matching updates to the
[Passport test suite](https://github.com/a2-4am/passport-test-suite)
2022-07-12
- NEW: patchers/mak.a (fixes "Kittens,
Kids, and a Frog")
- NEW: patchers/t00_baudville.a (fixes
Blazing Paddles, Take 1)
- NEW: patchers/t00_sigcheck.a (fixes
Hardball, Law of the West)
- NEW: patchers/pfs.pascal.a (fixes
pfs:* Pascal titles)
- NEW: patchers/pfs.prodos.a (fixes
pfs:* ProDOS titles)
- NEW: patchers/enlightenment.a (fixes
Paul Whitehead Teaches Chess)
- IMPROVED: id/555.a (fixes Fax,
Funbunch College Prep)
- IMPROVED: patchers/ea.a (fixes
Boulder Dash II) (by qkumba)
- IMPROVED: patchers/holle.a (fixes
Sherwood Forest)
- IMPROVED: patchers/jmpbb03.a (fixes
Pacific 231)
- IMPROVED: patchers/jmpb400.a (fixes
Rebus Writer, Writer's Helper)
- IMPROVED: patchers/jmpb4bb.a (fixes
Half Time)
- IMPROVED: patchers/sierra.a (fixes
Ultima II)
- IMPROVED: patchers/sigcheck.a (fixes
Inca, Holy Grail)
- IMPROVED: RW18 sector verification
(fixes Toy Shop)
- Detect extra wide tracks anywhere,
not just on track 6
- Matching updates to the
[Passport test suite](https://github.com/a2-4am/passport-test-suite)
2021-09-04
- IMPROVED: patchers/universale7.a
cracks now work on //c and IIgs
(fixes Commando, Animate, &c.)
- IMPROVED: patchers/ea.a (fixes
Mind Mirror) (by qkumba)
- Autonumbered .DSK files now go to 11
- Matching updates to the
[Passport test suite](https://github.com/a2-4am/passport-test-suite)
2021-07-12
- Target can be a hard disk, which will
save an autonumbered .DSK file in
PASSPORT subdirectory (by qkumba)
- If the log scrolls off the screen,
you can scroll back with arrows
(by qkumba)
- NEW: patchers/555.a (Agent USA,
Jumpman, many Softsmith) (by qkumba)
- NEW: patchers/earthware.a (Black
Belt, Zoo Master)
- NEW: patchers/tsr.a (Dawn Patrol,
Dungeon, Theseus and the Minotaur)
- NEW: patchers/datasoft2.a (Canyon
Climber, Fathom's 40)
- NEW: patchers/jmpb500.a (Starship
Commander)
- NEW: patchers/woodbury.a (PlayWriter)
- NEW: patchers/meccdqc.a (MECC
DataQuest Composer)
- NEW: patchers/b4bbbasic.a (SocMate
Analogies Games)
- NEW: patchers/jsrb6cc.a (Kidwriter)
- NEW: patchers/mastery.a (Mastery
Arithmetic Games)
- NEW: patchers/leisure.a (Clue, RISK)
- NEW: patchers/errord51.a (Granny
Applebee's Cookie Factory, Uncle
Clyde's Consonant Slides)
- NEW: patchers/sigcheck.a (Advanced
Electricity, Complex Circuits)
- IMPROVED: patchers/mecc.a to erase
site license information from final
generation of MECC disks (by qkumba)
- IMPROVED: patchers/rwtsswapmecc.a
(fixes Zoyon Patrol, Word Wizards)
- IMPROVED: patchers/prodosmecc.a
(fixes Miner's Cave)
- IMPROVED: patchers/rwtslog.a (fixes
La Guillotine, GATO v1.3)
- IMPROVED: patchers/ssi.a (fixes
Sixgun Shootout)
- IMPROVED: id/d5d5f7.a (fixes Trivia
Fever)
- IMPROVED: patchers/jmpbbfe.a (fixes
The Desecration, Depreciation Log)
- "BB00 protection" renamed to its
marketing name "Lock-It-Up"
- Serial numbers will be erased while
cracking Lock-It-Up disks, if present
- Update Passport disk to ProDOS 2.4.2
- Matching updates to the
[Passport test suite](https://github.com/a2-4am/passport-test-suite)
2020-07-20
- NEW: patchers/harvey.a (Buzz Bang
Harvey, Harvey by Primes)
- NEW: patchers/jmp2012.a (BackAid)
- NEW: patchers/pdi.a (Leadsheeter,
Polywriter)
- NEW: patchers/rps.a (Pac-Man Thunder
Mountain release, Problem Solving
in Algebra)
- IMPROVED: patchers/ssprot.a (fixes
Metric System Tutor)
- IMPROVED: patchers/bb03.a (fixes
Spanish for Mastery)
- IMPROVED: patchers/sierra.a (fixes
Mission Asteroid)
- IMPROVED: patchers/ea.a (fixes
One on One)
- Passport will now quit gracefully if
you manage to launch it with less
than 64K
- Matching updates to the
[Passport test suite](https://github.com/a2-4am/passport-test-suite)
2019-06-16
- NEW: verify pure 13-sector disks
(by qkumba)

Binary file not shown.

290
src/adstyle.a Normal file
View File

@ -0,0 +1,290 @@
; /!\ execution falls through from TraceDOS33c
;-------------------------------
; ADStyle
; Caller has determined that the RWTS in memory
; is normal enough to call, Advanced Demuffin style.
; Now we check for protections in early boot that
; indicate intentional bad sectors elsewhere that we
; should skip, or changes we need to make to the RWTS
; before we start.
;
; in: $0800..$08FF contains boot0
; $B600..$BFFF contains boot1
; out: all registers clobbered
; exits via ReadWithRWTS
;-------------------------------
ADStyle
jsr PrintByID
!byte s_diskrwts
;
; Check for Lock-It-Up protection (variant 1, most common),
; which implies an unreadable T00,S0A
;
lda $08FE
clc
adc #$04
ldx #$1D
ldy #$0B
jsr CompareMemory
!byte $BD,$8C,$C0
!byte $A9,WILDCARD
!byte $8D,$00,$02
!byte $BD,$8C,$C0
bcs + ; passport-test-suite/Quadrilaterals.woz [C=0] matches
lda #kSectorOptional
sta T00S0A
lda #$05
sta gDisplayBytes
jsr PrintByID
!byte s_lockitup
;
; Check for Sunburst RWTS,
; which implies an unreadable T11,S0F
;
+
lda $08FE
clc
adc #$03
ldx #$69
ldy #$0B
jsr CompareMemory
!byte $48
!byte $A5,$2A
!byte $4A
!byte $A8
!byte $B9,$29,$BA
!byte $8D,$6A,$B9
bcs + ; passport-test-suite/Green Globs and Graphing Equations.woz [C=0] matches
lda #kSectorOptional
sta T11S0F
lda #$04
sta gDisplayBytes
jsr PrintByID
!byte s_sunburst
;
; Check for Optimum Resource bootloader,
; which implies an unreadable T01,S0F
;
+
lda #$08
ldx #$5D
ldy #$0C
jsr CompareMemory
!byte $68
!byte $85,WILDCARD
!byte $68
!byte $85,WILDCARD
!byte $A0,$01
!byte $B1,WILDCARD
!byte $85,$54
bcs + ; passport-test-suite/Stickybear Math.woz [C=0] matches
lda #kSectorOptional
sta T01S0F
lda #TRUE
sta gIsOptimum
sta gDisplayBytes
jsr PrintByID
!byte s_optimum
;
; Check for SVE bootloader,
; which has a hook in the RWTS that must be patched
;
+
lda #$BE
ldx #$5A
ldy #$03
jsr CompareMemory
!byte $4C,$71,$A9
bcs + ; passport-test-suite/Decimals and Percent.woz [C=0] matches
lda #$00
sta gDisplayBytes
jsr PrintByID
!byte s_sve
lda #$CA
sta $BE5B
lda #$B6
sta $BE5C
lda $B6CE
cmp #$A9
bne +
lda #$DA
sta $B6CD
lda #$B6
sta $B6CE
;
; Check for RPS protection
; (boot1 jumps to $B3C1 to change RWTS,
; epilogue checker jumps to $B6B3 to
; check timing bits, late DOS routes
; through nibble check at $B74B)
; implies multiple unreadable sectors on T02,
; corrupted nibble translate tables,
; and a forced switch to the built-in RWTS
;
+
lda #$B7
ldx #$47
ldy #$07
jsr CompareMemory
!byte $4C,$C1,$B3
!byte $60
!byte $48
!byte $A9,$02
bcs + ; passport-test-suite/Math Skills Elementary Level.woz [C=0] matches
lda #kSectorOptional
sta T02S05
sta T02S0A
; some variants auto-switch earlier,
; others need to be forced
lda #kSectorSwitchToBuiltinRWTS
sta T02S04
; fix corrupted nibble translate tables
ldy #$FF
sty $BA29
iny
sty $BAFF
ldy #$3F
sty $BA96
lda #$01
sta gDisplayBytes
jsr PrintByID
!byte s_rps
+
;
; Check if RWTS calls an extra routine at $B660
; after matching the first two data prologue
; nibbles. This routine can hang in an infinite
; loop if it's used to read an unprotected sector,
; so we need to force-switch to the built-in RWTS
; after reading all the protected sectors.
; (T00,S00-S09 are unprotected because they are
; read by the drive firmware.)
;
lda #$08
ldx #$60
ldy #$1A
jsr CompareMemory
!byte $BD,$8C,$C0,$10,$FB,$C9,$AD,$D0
!byte $F4,$A9,$F8,$3D,$8C,$C0,$D0,$02
!byte $EA,$EA,$EA,$EA,$BD,$8C,$C0,$2A
!byte $30,$02
bcs + ; passport-test-suite/Analogies Tutorial.woz [C=0] matches
lda #kSectorSwitchToBuiltinRWTS
sta T00S09
;
; Check if disk changes RWTS in late boot
; after a nibble check at $B4BB
; (very messy because it needs to handle
; DOS 3.2 and 3.3 variants in both low and
; high memory)
;
+
b4bbcompare
lda #$FD ; SMC
ldx #$00
ldy #$20
jsr CompareMemory
!byte $D8,$A9,$DF,$48,$A9,$FF,$48,$A9
!byte $08,$85,$3D,$85,$43,$A9,$BF,$85
!byte $3F,$A9,$00,$85,$3C,$85,$42,$E6
!byte $42,$A9,$FE,$85,$3E,$A0,$00,$AD
bcs _b4bbexit ; passport-test-suite/Kamikaze.woz [C=0] matches
ldy gIsDOS32
beq @dos32
lda #$55 ; low byte of address that checks address prologue 1
sta b4bbmodify+1
lda #$91 ; low byte of address that checks address epilogue 1
sta b4bbmodify2+1
;X=0 so we will reuse that as the track number
ldy #$0C ; sector
bne @all ; always branches
@dos32
lda #$76 ; low byte of address that checks address prologue 1
sta b4bbmodify+1
lda #$B2 ; low byte of address that checks address epilogue 1
sta b4bbmodify2+1
ldx #$01 ; track
@all
lda #$00
sta gAddress
lda #$0C
adc #BASEPAGE
sta gAddress+1
jsr ReadSectorXY ; read sector so we can look for 'JMP $B4BB' marker
bcs _b4bbexit
lda #$0C
ldx #$84
jsr compare3
!byte $4C,$BB,$B4
bcs _b4bbexit
ldx #$02 ; track
ldy #$02 ; sector
lda gIsDOS32
bne @allb
@dos32b
ldy #$09 ; sector
@allb
jsr ReadSectorXY ; read sector to get address prologue 1 for rest of disk
bcs _b4bbexit
lda #$0C
adc #BASEPAGE
sta x0+2
x0 lda $FFC2 ; high byte modified at runtime (above)
cmp #$D5 ; some disks lie and manually set the prologue later
bne b4bbmodify ; passport-test-suite/SocMate Analogies Games.woz [Z=1] here
lda #TRUE
sta gPossibleB4BBBasic
lda #$BB
b4bbmodify
sta $FFFF ; SMC
lda #$DE
b4bbmodify2
sta $FFFF ; SMC
lda gIsDOS32
bne _b4bbexit
lda #kSectorCustomDOS32B4BB
sta T02S0C
_b4bbexit
lda #$00
sta gSector
sta gTrack
;
; Check for Harvey protection
; which has a one-time RWTS swap
; after loading DOS
;
lda #$B7
ldx #$47
ldy #$03
jsr CompareMemory
!byte $4C,$82,$A2
bcs + ; passport-test-suite/Harvey by Primes.woz [C=0] here
ldx #$00
stx gAddress
inx
ldy #$02
lda #$09
sta gAddress+1
jsr ReadSectorXY ; read T01,S02 into $0900
bcs +
lda #$09
ldx #$32
ldy #$18
jsr CompareMemory
!byte $A9,WILDCARD
!byte $8D,$55,$B9
!byte $8D,$7A,$BC
!byte $A9,WILDCARD
!byte $8D,$5D,$B8
!byte $8D,$FC,$B8
!byte $A9,WILDCARD
!byte $8D,$60,$BC
!byte $4C,$84,$9D
bcs +
lda #$60
sta $0947 ; RTS instead of JMP
jsr $0932 ; call to apply RWTS patches
lda #kSectorSwitchToBuiltinRWTS
sta T02S0F
+
; /!\ execution falls through here to ReadWithRWTS

View File

@ -1,478 +0,0 @@
;-------------------------------
; SkipTrack
; out: C clear if we should skip this track
; C set if we should not skip this track
;-------------------------------
!zone {
SkipTrack
; don't look for whole-track protections on track 0, that's silly
lda gTrack
sec
beq .linknoskip
;
; Electronic Arts protection track?
;
jsr IsEATrack6
lda #s_eatrk6
bcc .print
;
; Nibble count track?
;
jsr JustTheSameDamnThingOverAndOver
lda #s_sync
bcc .print ; always branches
;
; Unformatted track?
;
jsr IsUnformatted
.linknoskip
bcs .donotskip
;
; $F7F6EFEAAB protection track?
; (initially presents as unformatted, needs separate test because it
; triggers special handling)
;
jsr IsF7F6
lda #s_unformat
bcs .print
lda #s_f7
bit gMode
bpl .print
bvc .print
; if we're in 'crack' mode, restart the scan to find the protection code
jmp SetupF7F6SecondRound
.print
jsr PrintByID
;
; Skipping T22 on a ProDOS disk might indicate the presence of a
; Gamco Industries protection elsewhere on the disk. Different
; Gamco disks present as different types of weirdness on T22 --
; EEEF, sync, or even unformatted. (The actual protection is just
; a bad block check, so putting the code here will catch all
; possible cases.)
;
lda gTrack
cmp #$22
clc
bne .donotskip
lda gIsProDOS
bne .donotskip
sta gPossibleGamco
.donotskip
rts
}
;-------------------------------
; IsF7F6
; check for a specific nibble sequence
; ("F7 F6 EF EE AB") that is used by a
; whole-track protection scheme
;
; in slot 6, drive 1 is on track to test
; out C clear if sequence was found
; C set if sequence was not found
;-------------------------------
!zone {
IsF7F6
lda $C0E9
lda #$00
jsr WAIT
tay
lda #$19
sta nibcount
- jsr ReadNib
cmp #$F7
beq +
.restart iny
bne -
dec nibcount
bne -
sec
beq .driveoff
+
jsr ReadNib
cmp #$F6
bne .restart
jsr ReadNib
cmp #$EF
bne .restart
jsr ReadNib
cmp #$EE
bne .restart
jsr ReadNib
cmp #$AB
bne .restart
clc
.driveoff
lda $C0E8
rts
}
ReadNib
- lda $C0EC
bpl -
rts
Read4x4
- lda $C0EC
bpl -
sec
rol
sta tmp
- lda $C0EC
bpl -
and tmp
rts
;-------------------------------
; SetupF7F6SecondRound
;
; Print that we found the F7F6 protection track,
; then restart the scan so we can search every sector
; for the protection code.
; Never returns.
; Exits via RestartScan.
;-------------------------------
SetupF7F6SecondRound
; Mark in the sector map that we should ignore
; this protection track the second time around.
lda checksector+1
sta .a+1
lda checksector+2
sta .a+2
ldy gSector
lda #kSectorIgnore
.a sta $D1D1 ; modifed at runtime
ldx .a+1
bne +
dec .a+2
+ dec .a+1
dey
bpl .a
; print that we found the protection track
lda #s_f7
jsr PrintByID
; set global to activate expensive patcher
lda #TRUE
sta gIsF7F6
jmp RestartScan
;-------------------------------
; JustTheSameDamnThingOverAndOver
; check if track has 512 repeated nibbles
;
; in slot 6, drive 1 is on track to test
; out C clear if found
; C set otherwise
;-------------------------------
!zone {
JustTheSameDamnThingOverAndOver
lda $C0E9 ; turn on drive motor, but we assume it's already spun up from previous reads so no waiting
lda #$60
sta tmp
lda #$19
sta unform+1
ldx #$00
;
; Timing-sensitive code! Cycle counts in margin for worst case path
;
.reset clv ; 2
ldy #$00 ; 2
sta .cmp+1 ; 4
.loop lda $C0EC ; 4
bpl .loop ; 2 when not taken
dex ; 2
bne .cmp ; 2 when not taken
dec unform+1 ; 5
beq .notfound ; 2 when not taken
.cmp cmp #$d1 ; 2
bne .reset ; 2 when not taken
iny ; 2
bne .loop ; 2 when not taken (3 when taken)
bvs .found ; 2 when not taken
bit tmp ; 3 (sets overflow flag)
bvs .loop ; 3 (always taken)
.found
clc
!byte $24
.notfound
sec
lda $C0E8
rts
}
;-------------------------------
; IsUnformatted
; check if track is unformatted by counting
; the number of valid nibbles in a row
;
; in slot 6, drive 1 is on track to test
; out C clear if track is unformatted
; C set if track is formatted
;-------------------------------
!zone {
IsUnformatted
lda #$FD
sta gNIBTableFF
lda $C0E9 ; turn on drive motor, but we assume it's already spun up from previous reads so no waiting
lda #$00
sta unform
lda #$19
sta unform+1
;
; Timing-sensitive code! Cycle counts in margin for worst case path
;
.reset ldy #$00
.loop ldx $C0EC ; 4
bpl .loop ; 2 when not taken
dec unform ; 5
bne + ; 2 when not taken
dec unform+1 ; 5
beq .unformatted;2 when not taken
+ lda gNIBTable,x; 4
bmi .reset ; 2 when not taken
iny ; 2
bne .loop ; 3 when taken
sec
!byte $24
.unformatted
clc
lda $C0E8
lda #$3F
sta gNIBTableFF
rts
}
;-------------------------------
; xHeredityDog
; check for a protection check at $BB00
; which implies an unreadable T00,S0A
;
; in: $0800..$08FF contains boot0
; $B600..$BFFF contains boot1
; out: C clear if protection code was found
; C set if protection code was not found
;-------------------------------
!zone {
xHeredityDog
lda $08FE
clc
adc #$04
ldx #$16
ldy #$4A
jsr CompareMemory
!byte $F0,$05,$A2,$B2,$4C,$F0,$BB,$BD,$8C,$C0,$A9,WILDCARD
!byte $8D,$00,$02,$BD,$8C,$C0,$10,$FB,$C9,$EB,$D0,$F7,$BD,$8C
!byte $C0,$10,$FB,$C9,$D5,$D0,$EE,$BD,$8C,$C0,$10,$FB,$C9,$AA,$D0,$E5
!byte $A9,$4C,$A0,$00,$99,$00,$95,$88,$D0,$FA,$CE,$46,$BB,$AD,$46,$BB
!byte $C9,$07,$D0,$EC,$A9,$18,$8D,$42,$B9,$A9,$0A,$8D,$ED,$B7,$D0,$05
bcs .exit
lda #kSectorOptional
sta T00S0A
.exit
rts
}
;-------------------------------
; xSunburst
; check for a Sunburst RWTS
; which implies an unreadable T11,S0F
;
; in: $0800..$08FF contains boot0
; $B600..$BFFF contains boot1
; out: C clear if Sunburst RWTS was found
; C set otherwise
;-------------------------------
!zone {
xSunburst
lda $08FE
clc
adc #$03
ldx #$69
ldy #$2C
jsr CompareMemory
!byte $48,$A5,$2A,$4A,$A8,$B9,$29,$BA
!byte $8D,$6A,$B9,$8D,$84,$BC,$B9,$34
!byte $BA,$8D,$FC,$B8,$8D,$5D,$B8,$C0
!byte $11,$D0,$03,$A9,$02,$AC,$A9,$0E
!byte $8D,$C0,$BF,$68,$69,$00,$48,$AD
!byte $78,$04,$90,$2B
bcs .no
.yes
lda #kSectorOptional
sta T11S0F
.no
rts
}
;-------------------------------
; xOptimumRes
; check if disk has Optimum Resource bootloader
; which implies an unreadable T01,S0F
;
; in: $0800..$08FF contains boot0
; $B600..$BFFF contains boot1
; out: C clear if OptimumRes bootloader was found
; C set otherwise
;-------------------------------
!zone {
xOptimumRes
lda #$08
ldx #$5D
ldy #$0C
jsr CompareMemory
!byte $68,$85,WILDCARD,$68,$85,WILDCARD,$A0,$01
!byte $B1,WILDCARD,$85,$54
bcs .no
.yes
lda #kSectorOptional
sta T01S0F
.no
rts
}
;-------------------------------
; xB4BB
; check if disk changes RWTS in late boot after a nibble check
; (very messy because it needs to handle DOS 3.2 and 3.3 variants
; in either low or high memory)
;
; in: $0800..$08FF contains boot0
; either $3600..$3FFF or $B600..$BFFF contains boot1
; out: C clear if RWTS was modified in this routine
; C set otherwise
;-------------------------------
!zone {
xB4BB
lda gTrack
pha
lda gSector
pha
b4bbcompare
lda #$FF ; modified at runtime (in Inspect1)
ldx #$00
ldy #$20
jsr CompareMemory
!byte $D8,$A9,$DF,$48,$A9,$FF,$48,$A9
!byte $08,$85,$3D,$85,$43,$A9,$BF,$85
!byte $3F,$A9,$00,$85,$3C,$85,$42,$E6
!byte $42,$A9,$FE,$85,$3E,$A0,$00,$AD
bcs _b4bbexit
ldy gIsDOS32
beq .dos32
lda #$55 ; low byte of address that checks address prologue 1
sta b4bbmodify+1
lda #$91 ; low byte of address that checks address epilogue 1
sta b4bbmodify2+1
ldx #$00 ; track
ldy #$0C ; sector
bne .all ; always branches
.dos32
lda #$76 ; low byte of address that checks address prologue 1
sta b4bbmodify+1
lda #$B2 ; low byte of address that checks address epilogue 1
sta b4bbmodify2+1
ldx #$01 ; track
;;ldy #$00 ; sector
.all
stx gTrack
sty gSector
lda #$00
sta gAddress
lda #$0C
adc #BASEPAGE
sta gAddress+1
jsr ReadSector ; read sector so we can look for 'JMP $B4BB' marker
bcs _b4bbexit
lda #$0C
ldx #$84
ldy #$03
jsr compare
!byte $4C,$BB,$B4
bcs _b4bbexit
ldx #$02 ; track
ldy #$02 ; sector
lda gIsDOS32
bne .allb
.dos32b
ldy #$09 ; sector
.allb
stx gTrack
sty gSector
jsr ReadSector ; read sector to get address prologue 3 for rest of disk
bcs _b4bbexit
lda #$0C
adc #BASEPAGE
sta x0+2
x0 lda $FFC2 ; high byte modified at runtime (above)
b4bbmodify
sta $FFFF ; modified at runtime (high byte in Inspect1, low byte above)
lda #$DE
b4bbmodify2
sta $FFFF ; modified at runtime (high byte in Inspect1, low byte above)
lda gIsDOS32
bne _b4bbexit
lda #kSectorCustomDOS32B4BB
sta T02S0C
_b4bbexit
pla
sta gSector
pla
sta gTrack
rts
}
;-------------------------------
; xB660
; Check if RWTS calls an extra routine at $B660
; after matching the first two data prologue
; nibbles. This routine can hang in an infinite
; loop if it's used to read an unprotected sector,
; so we need to force-switch to the built-in RWTS
; after reading all the protected sectors.
; (T00,S00-S09 are unprotected because they are
; read by the drive firmware.)
;
; in: $0800..$08FF contains boot0
; out: C clear if $B660 routine was found
; C set otherwise
;-------------------------------
!zone {
xB660
lda #$08
ldx #$60
ldy #$1A
jsr CompareMemory
!byte $BD,$8C,$C0,$10,$FB,$C9,$AD,$D0
!byte $F4,$A9,$F8,$3D,$8C,$C0,$D0,$02
!byte $EA,$EA,$EA,$EA,$BD,$8C,$C0,$2A
!byte $30,$02
bcs .no
.yes
lda #kSectorSwitchToBuiltinRWTS
sta T00S09
.no
rts
}
;-------------------------------
; IsEATrack6
; check if track 6 even exists
; in the case of EA, track 6 reads as track 5
;
; in slot 6, drive 1 is on track to test
; out C clear if read track does not match expected track
; C set otherwise
;-------------------------------
IsEATrack6
lda gTrack
cmp #6
sec
bne +
lda $2E ;DOS read track number
sbc #5
cmp #1
+ rts

View File

@ -31,22 +31,44 @@
jmp PrintByID
;jmodify
jmp modify
;jmodify1
jmp modify1
;jmodify2
jmp modify2
;jmodify3
jmp modify3
;jmultimodify
jmp multimodify
;jcompare
jmp compare
;jcompare1
jmp compare1
;jcompare2
jmp compare2
;jcompare3
jmp compare3
;gDisplayBytes
!fill 10 ; array of ten bytes for use as
; substitution strings
;gRAMDiskRef
!byte 00 ; handle of RAM disk
;gHardDiskRef
!byte 00 ; ProDOS file reference number of target file on hard disk
; non-zero if open
;gUsingRAMDisk
!byte FALSE ; 0=true, 1=false
;gRAMDiskRef
!byte 00 ; ProDOS file reference number of temporary file on RAM disk
; non-zero if open
;gTargetType
!byte FALSE ; target type (disk drive, CFFA virtual drive, file on hard disk)
; see apidefs.a for values
;gOnAClearDayYouCanReadForever
;gIsRW18
!byte FALSE ; 0=true, 1=false
; retry reads with a captured RWTS forever,
; instead of falling back to built-in RWTS
; compile-time flag, no way to change at runtime
; reset before each operation
; set in IDBootFailure() after reading T00
;gMECCFastloadType
!byte 00 ; int
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIs13Sector
!byte FALSE ; 0=true, 1=false
@ -58,12 +80,47 @@
; reset before each operation
; set in IDBootFailure() after reading T00
;gMECCFastloadType
!byte 00 ; int
FIRSTFILTER
;gIsJMP600
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIsDidatech
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in TraceDOS33c() after tracing DOS 3.3-shaped RWTS
;gIsEnlightenment
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIsBaudville
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIsLowDOS
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDVolumeName() after identifying ProDOS bootloader
;gPossibleB4BBBasic
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in xB4BB() after tracing DOS 3.3-shaped RWTS
;gPossibleWoodbury
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in TraceDOS33c() after tracing DOS 3.3-shaped RWTS
;gPossibleMECCSwapper
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in TraceDOS33c() after tracing DOS 3.3-shaped RWTS
;gIsTSR
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIsDiversi
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
FIRSTFILTER
;gIsPhoenix
!byte FALSE ; 0=true, 1=false
; reset before each operation
@ -141,10 +198,6 @@ FIRSTFILTER
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gPossibleD5D5F7
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIsOptimum
!byte FALSE ; 0=true, 1=false
; reset before each operation
@ -181,18 +234,6 @@ FIRSTFILTER
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in patchers/t11diskvol.a after reading T11,S00
;gIsRWTS
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in AnalyzeT00() after reading T00
;gIsMaster
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in AnalyzeT00() after reading T00
;gIsBoot1
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in AnalyzeT00() after reading T00
;gIsBoot0
!byte FALSE ; 0=true, 1=false
; reset before each operation
@ -240,3 +281,25 @@ LASTFILTER
!byte %00000000 ; bit 7 0=verify, 1=see bit 6
; bit 6 0=demuffin, 1=crack
; set based on main menu choice
;HardDiskImagePath
!fill 37
;RAMDiskImagePath
!fill 21
;HardDiskArray
!fill 15
;DiskIIArray
!fill 7
;T00PakPtr
!word $3200
;kForceLower
!byte $FF
;OnlineReturn
!byte 0
;VolumeName
!fill 15
;mliparam
!fill 26
;gSector
!byte 0
;gTrack
!byte 0

View File

@ -1,8 +1,33 @@
TRUE = $00 ; Lots of code assumes this is $00
;-------------------------------
; Global constants, addresses, and other sundries
;
; /!\ Everything after APIEND must be kept in sync
; with apidefs.a!
;
; /!\ NO CODE IN THIS FILE, NO EXCEPTIONS
;-------------------------------
TRUE = $00 ; Lots of code assumes this is zero
; so it can branch with BEQ, so
; don't change it either!
; don't change it!
FALSE = $01
;-------------------------------
;Keys recognized on main menu
;-------------------------------
k_verify = "V"
k_crack = "C"
k_slot = "S"
k_quit = "Q"
k_redo = "2" ;for some side 'B'
k_redo_with_ignore = $92; <Ctrl-R>
k_left = $88
k_right = $95
k_up = $8B
k_down = $8A
; <Esc> will also quit
;-------------------------------
;Standard Delivery table indexes
;-------------------------------
@ -22,7 +47,30 @@ ID_MECC3 = $03
ID_MECC4 = $04
ID_MECC_UNK = $FF
; Zero-page addresses we use for variables
;-------------------------------
;target types (for gTargetType)
;-------------------------------
ID_DISK_II = %00000000 ; BIT + BPL + BVC -> target is Disk II drive
ID_CFFA_VIRTUAL_DISK = %01000000 ; BIT + BPL + BVS -> target is a CFFA3000-managed virtual disk drive
ID_FILE_ON_HARD_DISK = %10000000 ; BIT + BMI -> target is a file on a hard disk
; Standard zero-page addresses
TEXTTOP = $22
HPOS = $24
VPOS = $25
; Standard addresses
PRODOSMLI= $BF00
KEY = $C000
STROBE = $C010
TEXT = $FB2F
HOME = $FC58
WAIT = $FCA8
PRBYTE = $FDDA
COUT = $FDED
; Zero-page addresses we use for temporary variables
nibsrcindex = $EC ; byte
nibdestindex = $ED ; byte
prbuf = $EE ; word
@ -41,7 +89,7 @@ tmpx = $FD ; byte
tmpy = $FE ; byte
flag = $FF ; byte
; Application constants (not zero addresses)
; Other application-specific constants and assembler magic
!ifdef RELBASE {
!set VERBOSE = $00 ; override for make script
} else {
@ -50,8 +98,20 @@ RELBASE = $2000 ; dummy assignment for first build
}
LOWPOINT = $4000 ; lowest available address for code
HIGHPOINT = $B200 ; highest available address+1 for code
BASEPAGE = $10 ; Special Delivery tracer assumes
; this is $10, so don't change it!
PREFSBUFFER = $B600
PREFSREADLEN = $0003
BASEPAGE = $10 ; high byte of $1000-byte buffer that
; holds sector data for current track
; Special Delivery tracer assumes this
; is $10, so don't change it!
; Universal RWTS-specific addresses
UNIV_A1 = $B956 ; must LSR before setting
UNIV_A2 = $B95F
UNIV_A3 = $B968
UNIV_D1 = $B8E7
UNIV_D2 = $B8F1
UNIV_D3 = $B8FC
;-------------------------------
; globally-accessible variables
@ -60,74 +120,115 @@ BASEPAGE = $10 ; Special Delivery tracer assumes
;-------------------------------
APIEND = HIGHPOINT
gMode = APIEND-$01 ; byte
gPatchCount = gMode-$01 ; byte
gTriedUniv = gPatchCount-$01 ; byte
gSaidWriting = gTriedUniv-$01 ; byte
gChangedPrefs = gSaidWriting-$01 ; byte
gLastTrack = gChangedPrefs-$01 ; byte
gDiskVolumeNumber = gLastTrack-$01 ; byte
gTrack = APIEND-$01 ; byte
gSector = gTrack-$01 ; byte
mliparam = gSector-26 ; 26 bytes
access = mliparam + 3 ; access privileges (set by MLI get_file_info)
filetype = access + 1 ; file type (set by MLI get_file_info)
auxtype = filetype + 1 ; auxiliary file type (2 bytes, set by MLI get_file_info)
refnum = auxtype ; file refnum (set by MLI open)
mlilen = refnum + 1 ; file length (set by MLI read)
blocks = mlilen + 2 ; blocks used (set by getvolumeinfo)
; member is also used by createfile
; !fill 8 ; used by get_file_info
VolumeName = mliparam-15 ; 15 bytes
OnlineReturn = VolumeName-1 ; byte
kForceLower = OnlineReturn-1 ; byte
T00PakPtr = kForceLower-2 ; 2 bytes
DiskIIArray = T00PakPtr-7 ; 7 bytes
HardDiskArray = DiskIIArray-15 ; 15 bytes
RAMDiskImagePath = HardDiskArray-21 ; 21 bytes
HardDiskImagePath = RAMDiskImagePath-37 ; 37 bytes
gMode = HardDiskImagePath-$01 ; byte
gPatchCount = gMode-$01 ; byte
gTriedUniv = gPatchCount-$01 ; byte
gSaidWriting = gTriedUniv-$01 ; byte
gChangedPrefs = gSaidWriting-$01 ; byte
gLastTrack = gChangedPrefs-$01 ; byte
gDiskVolumeNumber = gLastTrack-$01 ; byte
;FIRSTFILTER ; add new gIs* below this line
gIsDOS32 = gDiskVolumeNumber-$01 ; byte
gIsBoot0 = gIsDOS32-$01 ; byte
gIsBoot1 = gIsBoot0-$01 ; byte
gIsMaster = gIsBoot1-$01 ; byte
gIsRWTS = gIsMaster-$01 ; byte
gCapturedDiskVolumeNumber = gIsRWTS-$01 ; byte
gIsProDOS = gCapturedDiskVolumeNumber-$01 ; byte
gIsDinkeyDOS = gIsProDOS-$01 ; byte
gIsPascal = gIsDinkeyDOS-$01 ; byte
gIsProtDOS = gIsPascal-$01 ; byte
gIsDavidDOS = gIsProtDOS-$01 ; byte
gIsEA = gIsDavidDOS-$01 ; byte
gPossibleGamco = gIsEA-$01 ; byte
gIsOptimum = gPossibleGamco-$01 ; byte
gPossibleD5D5F7 = gIsOptimum-$01 ; byte
gIs8b3 = gPossibleD5D5F7-$01 ; byte
gIsMilliken1 = gIs8b3-$01 ; byte
gAdventureInternational = gIsMilliken1-$01 ; byte
gIsLaureate = gAdventureInternational-$01 ; byte
gIsDatasoft = gIsLaureate-$01 ; byte
gIsSierra = gIsDatasoft-$01 ; byte
gIsSierra13 = gIsSierra-$01 ; byte
gIsF7F6 = gIsSierra13-$01 ; byte
gIsTrillium = gIsF7F6-$01 ; byte
gPolarwareTamperCheck = gIsTrillium-$01 ; byte
gForceDiskVol = gPolarwareTamperCheck-$01 ; byte
gIsAdvent = gForceDiskVol-$01 ; byte
gIsPanglosDOS = gIsAdvent-$01 ; byte
gIsDavidson = gIsPanglosDOS-$01 ; byte
gIsRDOS13 = gIsDavidson-$01 ; byte
gIsMUSERWTS = gIsRDOS13-$01 ; byte
gIsHolle = gIsMUSERWTS-$01 ; byte
gIsPhoenix = gIsHolle-$01 ; byte
gIsDOS32 = gDiskVolumeNumber-$01 ; byte
gIsBoot0 = gIsDOS32-$01 ; byte
gCapturedDiskVolumeNumber = gIsBoot0-$01 ; byte
gIsProDOS = gCapturedDiskVolumeNumber-$01 ; byte
gIsDinkeyDOS = gIsProDOS-$01 ; byte
gIsPascal = gIsDinkeyDOS-$01 ; byte
gIsProtDOS = gIsPascal-$01 ; byte
gIsDavidDOS = gIsProtDOS-$01 ; byte
gIsEA = gIsDavidDOS-$01 ; byte
gPossibleGamco = gIsEA-$01 ; byte
gIsOptimum = gPossibleGamco-$01 ; byte
gIs8b3 = gIsOptimum-$01 ; byte
gIsMilliken1 = gIs8b3-$01 ; byte
gAdventureInternational = gIsMilliken1-$01 ; byte
gIsLaureate = gAdventureInternational-$01 ; byte
gIsDatasoft = gIsLaureate-$01 ; byte
gIsSierra = gIsDatasoft-$01 ; byte
gIsSierra13 = gIsSierra-$01 ; byte
gIsF7F6 = gIsSierra13-$01 ; byte
gIsTrillium = gIsF7F6-$01 ; byte
gPolarwareTamperCheck = gIsTrillium-$01 ; byte
gForceDiskVol = gPolarwareTamperCheck-$01 ; byte
gIsAdvent = gForceDiskVol-$01 ; byte
gIsPanglosDOS = gIsAdvent-$01 ; byte
gIsDavidson = gIsPanglosDOS-$01 ; byte
gIsRDOS13 = gIsDavidson-$01 ; byte
gIsMUSERWTS = gIsRDOS13-$01 ; byte
gIsHolle = gIsMUSERWTS-$01 ; byte
gIsPhoenix = gIsHolle-$01 ; byte
gIsDiversi = gIsPhoenix-$01 ; byte
gIsTSR = gIsDiversi-$01 ; byte
gPossibleMECCSwapper = gIsTSR-$01 ; byte
gPossibleWoodbury = gPossibleMECCSwapper-$01 ; byte
gPossibleB4BBBasic = gPossibleWoodbury-$01 ; byte
gIsLowDOS = gPossibleB4BBBasic-$01 ; byte
gIsBaudville = gIsLowDOS-$01 ; byte
gIsEnlightenment = gIsBaudville-$01 ; byte
gIsDidatech = gIsEnlightenment-$01 ; byte
gIsJMP600 = gIsDidatech-$01 ; byte
;LASTFILTER ; add new gIs* above this line
;gIsInfocom18 is a special case whose ID is not in the regular inspection path
gIsInfocom18 = gIsPhoenix-$01 ; byte
gIsInfocom18 = gIsJMP600-$01 ; byte
;gIs13Sector is a special case whose ID is not in the regular inspection path
gIs13Sector = gIsInfocom18-$01 ; byte
gIs13Sector = gIsInfocom18-$01 ; byte
;gMECCFastloadType is a special case integer whose default value cannot be #FALSE
gMECCFastloadType = gIs13Sector-$01 ; byte
gMECCFastloadType = gIs13Sector-$01 ; byte
;gIsRW18 is a special case whose ID is not in the regular inspection path
gIsRW18 = gMECCFastloadType-$01 ; byte
gOnAClearDayYouCanReadForever = gMECCFastloadType-$01 ; byte
gUsingRAMDisk = gOnAClearDayYouCanReadForever-$01 ; byte
gRAMDiskRef = gUsingRAMDisk-$01 ; byte
gDisplayBytes = gRAMDiskRef-$0A ; 10 bytes
jcompare = gDisplayBytes-$03 ; 3-byte
jmodify = jcompare-$03 ; 3-byte
jPrintByID = jmodify-$03 ; 3-byte
jSearchTrack = jPrintByID-$03 ; 3-byte
jCallRWTS = jSearchTrack-$03 ; 3-byte
jCopyMemory = jCallRWTS-$03 ; 3-byte
jCopyUniversalAnywhere = jCopyMemory-$03 ; 3-byte
jConstructStandardDelivery = jCopyUniversalAnywhere-$03 ; 3-byte
gNIBTableFF = jConstructStandardDelivery-1 ; 1 byte
gNIBTable = gNIBTableFF-$FF ; accessed by +$80
gNIBTableBase = gNIBTableFF-$7F ; 127 bytes
gTargetType = gIsRW18-$01 ; byte
gRAMDiskRef = gTargetType-$01 ; byte
gHardDiskRef = gRAMDiskRef-$01 ; byte
gDisplayBytes = gHardDiskRef-$0A ; 10 bytes
jcompare3 = gDisplayBytes-$03 ; 3-byte
jcompare2 = jcompare3-$03 ; 3-byte
jcompare1 = jcompare2-$03 ; 3-byte
jcompare = jcompare1-$03 ; 3-byte
jmultimodify = jcompare-$03 ; 3-byte
jmodify3 = jmultimodify-$03 ; 3-byte
jmodify2 = jmodify3-$03 ; 3-byte
jmodify1 = jmodify2-$03 ; 3-byte
jmodify = jmodify1-$03 ; 3-byte
jPrintByID = jmodify-$03 ; 3-byte
jSearchTrack = jPrintByID-$03 ; 3-byte
jCallRWTS = jSearchTrack-$03 ; 3-byte
jCopyMemory = jCallRWTS-$03 ; 3-byte
jCopyUniversalAnywhere = jCopyMemory-$03 ; 3-byte
jConstructStandardDelivery = jCopyUniversalAnywhere-$03 ; 3-byte
gNIBTableFF = jConstructStandardDelivery-1 ; 1 byte
gNIBTable = gNIBTableFF-$FF ; accessed by +$80
gNIBTableBase = gNIBTableFF-$7F ; 127 bytes
!ifdef MODULE {
compare = jcompare
compare1 = jcompare1
compare2 = jcompare2
compare3 = jcompare3
modify = jmodify
modify1 = jmodify1
modify2 = jmodify2
modify3 = jmodify3
multimodify = jmultimodify
PrintByID = jPrintByID
SearchTrack = jSearchTrack
CallRWTS = jCallRWTS
@ -138,6 +239,23 @@ ConstructStandardDelivery = jConstructStandardDelivery
!ifdef VERBOSE {
!if VERBOSE=1 {
!warn "gTrack=",gTrack
!warn "gSector=",gSector
!warn "mliparam=",mliparam
!warn "access=",access
!warn "filetype=",filetype
!warn "auxtype=",auxtype
!warn "refnum=",refnum
!warn "mlilen=",mlilen
!warn "blocks=",blocks
!warn "OnlineReturn=",OnlineReturn
!warn "VolumeName=",VolumeName
!warn "kForceLower=",kForceLower
!warn "T00PakPtr=",T00PakPtr
!warn "DiskIIArray=",DiskIIArray
!warn "HardDiskArray=",HardDiskArray
!warn "RAMDiskImagePath=",RAMDiskImagePath
!warn "HardDiskImagePath=",HardDiskImagePath
!warn "gMode=",gMode
!warn "gPatchCount=",gPatchCount
!warn "gTriedUniv=",gTriedUniv
@ -146,9 +264,6 @@ ConstructStandardDelivery = jConstructStandardDelivery
!warn "gLastTrack=",gLastTrack
!warn "gIsDOS32=",gIsDOS32
!warn "gIsBoot0=",gIsBoot0
!warn "gIsBoot1=",gIsBoot1
!warn "gIsMaster=",gIsMaster
!warn "gIsRWTS=",gIsRWTS
!warn "gCapturedDiskVolumeNumber=",gCapturedDiskVolumeNumber
!warn "gIsProDOS=",gIsProDOS
!warn "gIsDinkeyDOS=",gIsDinkeyDOS
@ -159,7 +274,6 @@ ConstructStandardDelivery = jConstructStandardDelivery
!warn "gPossibleGamco=",gPossibleGamco
!warn "gIsOptimum=",gIsOptimum
!warn "gMECCFastloadType=",gMECCFastloadType
!warn "gPossibleD5D5F7=",gPossibleD5D5F7
!warn "gIs8b3=",gIs8b3
!warn "gIsMilliken1=",gIsMilliken1
!warn "gAdventureInternational=",gAdventureInternational
@ -177,15 +291,21 @@ ConstructStandardDelivery = jConstructStandardDelivery
!warn "gIsMUSERWTS=",gIsMUSERWTS
!warn "gIsHolle=",gIsHolle
!warn "gIsPhoenix=",gIsPhoenix
!warn "gIsDiversi=",gIsDiversi
!warn "gIsTSR=",gIsTSR
!warn "gPossibleMECCSwpper",gPossibleMECCSwapper
!warn "gPossibleWoodbury",gPossibleWoodbury
!warn "gIsRDOS13=",gIsRDOS13
!warn "gIsInfocom18=",gIsInfocom18
!warn "gIs13Sector=",gIs13Sector
!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever
!warn "gUsingRAMDisk=",gUsingRAMDisk
!warn "gIsRW18=",gIsRW18
!warn "gTargetType=",gTargetType
!warn "gRAMDiskRef=",gRAMDiskRef
!warn "gHardDiskRef=",gHardDiskRef
!warn "gDisplayBytes=",gDisplayBytes
!warn "jcompare=",jcompare
!warn "jmodify=",jmodify
!warn "jmultimodify=",jmultimodify
!warn "jPrintByID=",jPrintByID
!warn "jSearchTrack=",jSearchTrack
!warn "jCallRWTS=",jCallRWTS

View File

@ -1,16 +1,25 @@
!zone {
;-------------------------------
; EnterCFFAIfAvailable
; check for, and potentially call, the CFFA 3000
; administration menu
;
; currently only supports CFFA 3000 in slot 7
; (no slot scan)
;
; in: none
; out: C clear if we found CFFA 3000 in slot 7 and called it
; C set if we didn't find CFFA 3000
;-------------------------------
EnterCFFAIfAvailable
ldy #$04
- lda $C7F6, y
cmp CFFASignature, y
cmp @CFFASignature, y
sec
bne +
dey
bpl -
jsr $C730
clc
+
rts
CFFASignature
+ rts
@CFFASignature
!byte $43,$46,$33,$4B,$31
}

View File

@ -12,7 +12,7 @@ WILDCARD = $97
; out: C clear if string found
; or set if not found
; If C is clear, then
; A = sector where string was found
; A = @gDisplayBytes = sector where string was found
; X = starting offset where string was found
; all other registers and flags clobbered
;-------------------------------
@ -28,7 +28,7 @@ SearchTrack
; SearchSector subroutine
; written by qkumba
; same as SearchTrack, but for a single sector
; in: A = sector address
; in: A = high byte of sector address in data buffer (e.g. $10 for sector 0)
; Y = string length
; stack = string to find
; out: C clear if string found
@ -150,6 +150,7 @@ match_size2
lda match_buffer2+2
sec
sbc #BASEPAGE
sta gDisplayBytes
clc
rts
@ -172,6 +173,20 @@ all_done_set
sec
rts
; utility functions for common cases
; (from the caller's perspective, these have the side effect of setting Y,
; since the compare routine will 'save' and 'restore' the value we're setting here)
compare3
ldy #$03
!byte $2C
; /!\ execution falls through here
compare2
ldy #$02
!byte $2C
; /!\ execution falls through here
compare1
ldy #$01
; /!\ execution falls through here
;-------------------------------
; compare subroutine
; in: A = sector
@ -180,22 +195,24 @@ all_done_set
; stack = string to compare
; #WILDCARD in search string matches any 1 byte
; (like "." character in regular expressions)
; out: C clear if string matches
; or set if not matched
; A,X unchanged
; Y clobbered
; out: C = 0 if string matches, and gDisplayBytes set to A
; C = 1 if not matched
; A,X,Y preserved
; $tmp zero page clobbered
; $cmp1 zero page clobbered
; $cmp2 zero page clobbered
; stack set to first instruction after string
;-------------------------------
!zone {
compare
sta tmpa
clc
adc #BASEPAGE
!byte $2C
CompareMemory
sta tmpa
sta cmp1+1
stx cmp1
sty tmpy
pla
sta cmp2
pla
@ -206,27 +223,25 @@ CompareMemory
adc cmp2
bcc +
inx
+ sta tmp
+ sta modtmp
txa
pha
lda tmp
lda modtmp
pha
.cmp
@cmp
lda (cmp2),y
dey
bmi .success
bmi @success
cmp (cmp1),y
beq .cmp
beq @cmp
cmp #WILDCARD
beq .cmp
beq @cmp
sec
!byte $24 ; hide CLC
.success clc
php
lda cmp1+1
sec
sbc #BASEPAGE
@success clc
lda tmpa
ldx cmp1
plp
rts
}
ldy tmpy
bcs +
sta gDisplayBytes
+ rts

278
src/crackme.a Normal file
View File

@ -0,0 +1,278 @@
; /!\ execution falls though from ADStyle
;-------------------------------
; ReadWithRWTS
; This is the main loop. The caller has put an RWTS
; in place -- either by boot tracing or by starting
; with the built-in RWTS and patching -- and now it's
; time to do the thing. This routine reads the source
; disk, applies patches in memory, maybe writes out
; the result (depending on mode), and prints relevant
; log messages along the way.
;
; in: suitable RWTS is in place
; relevant globals from ID phase have been set
; out: all registers clobbered
; exits via TheEnd
;-------------------------------
ReadWithRWTS
ldx #0
ldy #0
dec gCommand
jsr ReadSectorXY ; clear DOS error
inc gCommand
jsr IncProgress
lda #$22
jsr ChangeTrackNW
lda #$0F
ldx gIs13Sector
bne +
lda #$0C
+ jsr ChangeSector
lda #<T22S0F
sta checksector+1
lda #>T22S0F
sta checksector+2
.read
lda KEY
bpl .checkinfocom
bit STROBE
cmp #$e0 ;ignore backtick (MAME debug break)
beq .checkinfocom
jmp Cancel
.checkinfocom
lda gIsInfocom18
and gIsRW18
bne checksector
dec gCommand
jsr ReadSector ; seek
inc gCommand
jsr VerifyInfocom18
bcc .passtrack
jmp FatalError
.passtrack
jmp .prevtrack
checksector
lda $FFFF ; status of current sector in sector map (modified above)
cmp #kSectorCustomFirst ; call a custom routine before deciding what to do with this sector?
bcc +
cmp #kSectorCustomLast
bcs +
jsr PreReadSector
+ pha ; replace status (on stack) with new status returned from PreReadSector
cmp #kSectorIgnore ; skip this sector?
beq nextsector
cmp #kSectorSwitchToBuiltinRWTS ; switch to built-in RWTS before reading this sector?
bne +
lda gTriedUniv
beq +
jsr SwitchToUniv
+ jsr ReadSector
bcc nextsector
;
; Uh oh, we got a read error. But do we care?
; If we just got to this track, check for whole-track protections.
;
ldx #$0F ;16-sector
lda gIs13Sector
beq .expect13
lda gIsDOS32
bne +
.expect13
ldx #$0C ;13-sector
+ cpx gSector
bne .checkoptional
stx .sub+1
jsr SkipTrack
bcs .checkoptional
; Skip this track (we already printed the reason)
lda #$00
jsr ChangeSector
lda checksector+1
sec
.sub sbc #$0F ;self-modified according to sectors per track
sta checksector+1
bcs +
dec checksector+2
+ jmp nextsector
; do this only *after* checking for track-skip
; to avoid fatal errors on unformatted tracks
.checkoptional
pla
pha
;
; Maybe we marked this sector as optional based
; on markers in the bootloader.
;
cmp #kSectorOptional
beq .optional
;
; Otherwise we're in the middle of a track, so try switching to
; the universal RWTS and see if that helps. (Many disks contain
; an RWTS that can't read the early tracks or sectors that
; contain the RWTS code, since those are loaded by the
; disk controller firmware.)
;
.tryuniversal
lda gIsDOS32 ; is this a DOS 3.2 disk?
beq .fatal ; yes, so read error is fatal
lda gTriedUniv ; have we tried the universal RWTS?
beq .maybedavidson ; yes, but check one last thing
jsr SwitchToUniv ; no, switch it in now
jmp .read ; and re-read this sector
.maybedavidson
jsr IDDavidson
bcc .optional
.fatal pla ; if we get to here, we've
jmp FatalError ; decided the read error is fatal
.optional
jsr PrintByID ; say we're skipping this optional sector
!byte s_optbad
; /!\ execution falls through here
nextsector
pla
lda checksector+1
bne .nodec
dec checksector+2
.nodec
dec checksector+1
ldy gSector
dey
tya
jsr ChangeSector
lda gSector
bmi .prevtrack
.linkread
jmp .read
.prevtrack
lda #$0F
ldx gIs13Sector
bne +
lda #$0C
+ jsr ChangeSector
ldy gTrack
dey
tya
jsr ChangeTrack ; in crack mode, this calls WriteTrack
; which calls AnalyzeTrack to apply patches,
; then (if we're not using a RAM disk)
; actually writes the track to the target
; disk or file
jsr IncProgress
lda gTrack
bmi Pass
cmp gLastTrack
bcs .linkread
Pass
bit gMode
bpl @passVerify
lda gRAMDiskRef
beq @printFinalMessage ; not using RAM disk, so we're done
; we've written the entire cracked disk as a file on the RAM disk,
; now a second pass to write that file out to the target disk drive
jsr PrintByID
!byte s_writingto
jsr PrintByID
!byte s_slotanddrive
jsr SwapProDOS ; ProDOS out -> in (preserves registers+flags)
jsr WriteRAMToDisk ; C=1 if error, and A=MLI error code
jsr SwapProDOS ; ProDOS in -> out (preserves registers+flags)
bit KEY ; preserves C
bmi Cancel
bcc @printFinalMessage
jmp FatalWriteError
@printFinalMessage
lda gPatchCount
beq @passWithZeroPatches
lda #s_passcrack ; 'crack complete'
!byte $2C
@passWithZeroPatches
lda #s_passcrack0 ; 'crack complete but no patches'
!byte $2C
@passVerify
lda #s_pass ; 'verification complete'
sta +
jsr PrintByID
+ !byte $FD ; SMC
bvc .TheEnd ; always branches
Cancel
jsr PrintByID
!byte s_canceled
bvc .TheEnd ; always branches
;-------------------------------
; PreCheckT00
;
; Before we trace through the drive firmware (which --
; at least on some machines -- will loop forever looking
; for each sector), we do a pre-check to ensure that all
; the sectors we're about to trace are actually readable.
;
; Before calling this function, you need to set all 16
; bytes of the precheck_sectors array (see above for format).
;
; If all required sectors are readable by Passport's own
; sector read routine, this exits gracefully with all
; flags and registered clobbered.
;
; If any required sector fails to read, this exits via
; FatalError, which does not return.
;-------------------------------
PreCheckT00
ldy #$00
sty gTrack
- lda precheck_sectors, y
bmi +
sta gSector
jsr IgnoreAddressChecksum
tya
pha
jsr ReadSector
pla
tay
bcs FatalError
+ iny
cpy #$10
bne -
rts
FatalError
jsr PrintByID
!byte s_fail
lda gTrack
cmp #$22
bne .TheEnd
lda gSector
cmp #$0F
beq @failont22s0f
ldx gIsDOS32
bne .TheEnd
cmp #$0C
bne .TheEnd
@failont22s0f
jsr PrintByID
!byte s_fatal220f
.TheEnd jmp TheEnd
precheck_sectors
; This list is (re)initialized in IDBootloader,
; then potentially altered in IDDOS33 and elsewhere.
; Values are logical sector numbers.
; There are always 16 (0x10) values in this list.
; Negative values are ignored.
; Positive values are treated as logical
; sector numbers and read from track $00.
; Sectors are read in the order listed here.
!byte $09,$08,$07,$06,$05,$04,$03,$02,$01
!byte $00,$FF,$FE,$FD,$FC,$FB,$FA,$F9,$F8

View File

@ -1,8 +1,10 @@
; This source code is altered and is not the original version found on
; the Exomizer homepage.
; It contains modifications made by qkumba to depack a packed file
; optionally crunched forward.
; optionally crunched forward, and additional modifications by 4am
; for an optional progress UI.
;
; Original copyright statement follows:
;
; Copyright (c) 2002 - 2018 Magnus Lind.
;
@ -62,6 +64,11 @@
; compression at the cost of a larger decrunch table.
EXTRA_TABLE_ENTRY_FOR_LENGTH_THREE = 1
; -------------------------------------------------------------------
; optional progress UI
!IFNDEF SHOW_PROGRESS_DURING_DECRUNCH {
!set SHOW_PROGRESS_DURING_DECRUNCH = 0
}
; -------------------------------------------------------------------
; zero page addresses used
; -------------------------------------------------------------------
zp_len_lo = $a7
@ -151,6 +158,21 @@ gb_get_hi:
; no constraints on register content, however the
; decimal flag has to be #0 (it almost always is, otherwise do a cld)
decrunch:
!IF SHOW_PROGRESS_DURING_DECRUNCH = 1 {
kExoProgressWidth = 23 ; depends on total size, max 38
ldx #(kExoProgressWidth+2)
lda #$DF
- sta $0528+(20-(kExoProgressWidth/2))-1, x
sta $05A8+(20-(kExoProgressWidth/2))-1, x
dex
bpl -
lda #$20
sta $05A8+(20-(kExoProgressWidth/2))-1
sta $05A8+(20-(kExoProgressWidth/2))+kExoProgressWidth+1
lda #$A8+(20-(kExoProgressWidth/2))
sta ExoProgressPtr+1
}
; -------------------------------------------------------------------
; init zeropage, x and y regs. (12 bytes)
;
@ -218,6 +240,9 @@ no_fixup_lohi:
; -------------------------------------------------------------------
; copy one literal byte to destination (11(10) bytes)
;
!ifndef FORWARD_DECRUNCHING {
!set FORWARD_DECRUNCHING = 1
}
!if FORWARD_DECRUNCHING = 0 {
literal_start1:
tya
@ -227,6 +252,17 @@ no_hi_decr:
dey
jsr get_crunched_byte
sta (zp_dest_lo),y
!IF SHOW_PROGRESS_DURING_DECRUNCH = 1 {
dec ExoProgressCounter
bne +
lda #$20
ExoProgressPtr
sta $0500 ; SMC lo byte
inc ExoProgressPtr+1
+
}
} else {
literal_start1:
jsr get_crunched_byte
@ -421,6 +457,10 @@ tabl_bit:
tabl_bit:
!BYTE $8c, $e2
}
!IF SHOW_PROGRESS_DURING_DECRUNCH = 1 {
ExoProgressCounter
!byte $00
}
; -------------------------------------------------------------------
; end of decruncher
; -------------------------------------------------------------------

141
src/harddisk.a Normal file
View File

@ -0,0 +1,141 @@
HardDirName !raw "PASSPORT"
HardDirName_e
HardDiskName !raw "/IMG0000.DSK"
HardDiskName_e
;-------------------------------
; CloseFileOnHardDisk
; close the previously open file on a hard disk, if any
;
; always safe to call (gracefully returns if no file is open)
; does not return any error status because no one cares
;
; in: ProDOS is in memory
; out: all registers and flags clobbered
; ProDOS is in memory
;-------------------------------
!macro CloseFileOnHardDisk {
lda gHardDiskRef
beq +
jsr CloseFile
lda #0
sta gHardDiskRef
+
}
;-------------------------------
; PrintHardDiskImagePath
; print full path of file on hard disk
;
; in: @HardDiskImagePath is populated and has non-zero length
; out: all registers and flags clobbered
;-------------------------------
!macro PrintHardDiskImagePath {
lda HardDiskImagePath
sta @volumelen
ldx #0
- lda HardDiskImagePath+1, x
ora #$80
jsr PrintA
inx
@volumelen=*+1
cpx #$FD ; SMC
bcc -
lda #$8D
jsr PrintA
}
;-------------------------------
; CreateFileOnHardDisk
; create a new autonumbered image file on the user's selected target,
; which should be a hard disk
;
; in: HardDiskArray populated
; user's selected target is a hard disk
; ProDOS is not in memory
; out: if C set, create or open failed (A contains MLI error code)
; if C clear, everything succeeded (A is clobbered)
; all other registers and flags clobbered
; ProDOS is not in memory
;-------------------------------
CreateFileOnHardDisk
jsr SwapProDOS ; ProDOS out -> in (preserves flags)
jsr LookupUnitNumberOfSelectedHardDisk
jsr GetVolumeName
lda OnlineReturn
and #$0F ; A=volume name length
tay
clc
adc #(HardDirName_e-HardDirName)+2
sta HardDiskImagePath
tax
lda #$2F
sta HardDiskImagePath+1
sta HardDiskImagePath+2, y
- lda OnlineReturn, y
sta HardDiskImagePath+1, y
dey
bne -
ldy #(HardDirName_e-HardDirName)
- lda HardDirName-1, y
sta HardDiskImagePath, x
dex
dey
bne -
; @HardDiskImagePath = fully qualified pathname of target volume +
; our hardcoded directory
lda #<HardDiskImagePath
sta mliparam+1
lda #>HardDiskImagePath
sta mliparam+2
jsr CreateDir ; create hardcoded directory
; (don't care if this fails)
lda HardDiskImagePath
clc
adc #(HardDiskName_e-HardDiskName)
sta HardDiskImagePath
tax
ldy #(HardDiskName_e-HardDiskName)
- lda HardDiskName-1, y
sta HardDiskImagePath, x
dex
dey
bne -
; @HardDiskImagePath = fully qualified pathname of target volume +
; our hardcoded directory + our default filename
; This file might already exist, in which case we will repeatedly
; construct sequentially numbered filenames until we find one that
; doesn't exist.
@findSpare
jsr GetFileInfo
bcs @tryCreate ; branch if file does not exist (good)
; construct next filename
; (filename starts as IMG0000.DSK so we ignore the last 4 characters
; and increment the digits as base 10)
ldx HardDiskImagePath
@nextDigit
inc HardDiskImagePath-4, x
lda HardDiskImagePath-4, x
cmp #$39+1 ; '9'+1
bcc @findSpare ; loop back to check if new filename exists
lda #$30 ; '0'
sta HardDiskImagePath-4, x
dex
bne @nextDigit
@tryCreate
; @mliparam+1 still points to @HardDiskImagePath, which now contains
; the full pathname of the file we want to create
jsr Create140KFile
bcs +
sta gHardDiskRef
+
; /!\ execution falls through to SwapProDOS

36
src/hw.diskii.a Normal file
View File

@ -0,0 +1,36 @@
;-------------------------------
; ScanForDiskII
; scan all slots for things that look like Disk II cards
;
; in: X = 0
; Y = 0
; out: DiskIIArray populated
; X = 0
; all other registers and flags clobbered
;-------------------------------
!macro ScanForDiskII {
;X=0,Y=0
stx cmp1
ldx #$07
- txa
ora #$C0
sta cmp1+1
ldy #$01
lda (cmp1), y
cmp #$20
bne +
ldy #$03
lda (cmp1), y
bne +
ldy #$05
lda (cmp1), y
cmp #$03
bne +
ldy #$FF
lda (cmp1), y
bne +
tya
sta DiskIIArray-1, x
+ dex
bne -
}

139
src/hw.harddisk.a Normal file
View File

@ -0,0 +1,139 @@
SlashRAM !raw "/RAM"
SlashRAM_e
RAMFileName !raw "PASSPORTTMP.DSK"
RAMFileName_e
;-------------------------------
; ScanForRAMAndHardDisks
; scan all slots for things that look like RAM disks or hard drives
;
; in: X=0
; out: HardDriveArray populated
; RAMDiskImagePath possibly populated (if a suitable RAM disk was found)
; all registers and flags clobbered
;-------------------------------
ScanForRAMAndHardDisks
stx iunit
@nextunit
lda iunit
clc
adc #$10
sta iunit
bne +
rts
+ cmp #$80
beq @nextunit
pha
and #$70
lsr
lsr
lsr
lsr
tay
pla
ldx DiskIIArray-1, y
bne @nextunit ; ScanForDiskII already detected that this slot is a floppy drive, so skip it
jsr GetVolumeName
bcs @nextunit ; can't get a volume name, so skip it
lda OnlineReturn
and #$0F
beq @nextunit ; volume name length=0 means an error occurred, so skip it
jsr GetVolumeInfo
lda filetype
and #$0F
cmp #$0F
bne @nextunit ; ProDOS volume type says this isn't a directory, so skip it
lda access
and #$02
beq @nextunit ; volume is not writeable, so skip it
; check free space on volume (need at least $118 blocks)
lda auxtype
sec
sbc blocks
tax
lda auxtype+1
sbc blocks+1
cmp #1
bcc @nextunit ; not enough free space, so skip it
bne +
cpx #$18
bcc @nextunit ; not enough free space, so skip it
+
; check if this volume is a RAM disk
; if so, we will use it as temporary storage when writing to a disk in a disk drive
; (writing to a file on the RAM disk, then writing that to the target disk all at once)
jsr .IsRAMDisk
bne @foundHardDrive
lda RAMDiskImagePath
bne @nextunit ; we already found a suitable RAM disk, so skip this one
; now that we've found the first suitable RAM disk, construct
; the full path of the RAM disk image file and store it in
; RAMDiskImagePath
jsr .ConstructRAMDiskImagePath
beq @nextunit ; always branches
@foundHardDrive
lda iunit
pha
lsr
lsr
lsr
lsr
tay
pla
sta HardDiskArray-1, y
bne @nextunit ; always branches
.IsRAMDisk
; in: @OnlineReturn+@VolumeName contains length+name of a ProDOS volume
; out: Z=1 if volume is a suitable RAM disk
; Z=0 otherwise
; all other registers and flags clobbered
lda OnlineReturn
and #$0F
cmp #4
beq +
cmp #5
bne @exit ; volume name isn't the right length for a supported RAM disk
+
; due to limitations of the ProDOS API, we settle for checking if the volume name =
; 'RAM' or 'RAMn' where n is a slot number, which covers the common cases ('RAM3' for
; third-party memory cards, 'RAM5' on a IIgs)
ldy #(SlashRAM_e-SlashRAM)
- lda SlashRAM-1, y
cmp VolumeName-1, y
bne @exit ; volume name does not match 'RAM' or 'RAMn' pattern
dey
bne -
@exit rts
.ConstructRAMDiskImagePath
; in: @OnlineReturn+@VolumeName contains length+name of RAM disk
; out: Z=1
; Y=0
; all other registers and flags clobbered
lda OnlineReturn
and #$0F
tay
clc
adc #(RAMFileName_e-RAMFileName)+1
sta RAMDiskImagePath
tax
lda #$2F
sta RAMDiskImagePath+1, y
- lda OnlineReturn, y
sta RAMDiskImagePath, y
dey
bne -
ldy #(RAMFileName_e-RAMFileName)
- lda RAMFileName-1, y
sta RAMDiskImagePath, x
dex
dey
bne -
rts

49
src/id/555.a Normal file
View File

@ -0,0 +1,49 @@
;-------------------------------
; ID555
; identify 555 bootloader
;
; in: track buffer contains T00,S00
; out: C clear if 555 bootloader found
; C set otherwise
; all registers & flags clobbered
;-------------------------------
!macro ID555 {
lda #8
ldy #22
jsr SearchSector
!byte $85,$27 ; STA $27
!byte $E8 ; INX
!byte $86,WILDCARD ; STX $xx
!byte $84,WILDCARD ; STY $xx
!byte $B9,WILDCARD,$08 ; LDA $08xx,Y
!byte $85,$3D ; STA $3D
!byte $20,WILDCARD,$08 ; JSR $08xx
!byte $A4,WILDCARD ; LDY $xx
!byte $C8 ; INY
!byte $C4,WILDCARD ; CPY $xx
!byte $90,$EF ; BCC *-$0F
bcc .exit ; passport-test-suite/Jumpman.woz [C=0] matches
lda #8
ldx #1
ldy #18
jsr CompareMemory
!byte $4C,$76,$08 ; JMP $0876
!byte $00,$03,$05
!byte $07,$09,$0B
!byte $0D,$0F,$02
!byte $04,$06,$08
!byte $0A,$0C,$0E
bcc .exit
lda #8
ldx #1
ldy #19
jsr CompareMemory
!byte $4C,$7A,$08 ; JMP $087A
!byte $00,$00,$03
!byte $05,$07,$09
!byte $0B,$0D,$0F
!byte $02,$04,$06
!byte $08,$0A,$0C
!byte $0E
.exit
}

View File

@ -15,7 +15,7 @@
; - Mindshadow
; - The Tracer Sanction
;-------------------------------
IDAdvent
!macro IDAdvent {
lda #BASEPAGE
ldy #33
jsr SearchSector
@ -33,7 +33,8 @@ IDAdvent
!byte $D0,$F5 ;BNE $-8
!byte $A6,$2B ;LDX $2B
!byte $4C,$00 ;JMP $xx00
rts ; passport-test-suite/Borrowed Time.woz [C=0] matches
; passport-test-suite/Borrowed Time.woz [C=0] matches
}
foundadvent
;
@ -44,8 +45,8 @@ foundadvent
; original disk.
;
!zone {
lda #s_advent
jsr PrintByID
!byte s_advent
jsr CopyUniversal
;hook read address prologue

39
src/id/baudville.a Normal file
View File

@ -0,0 +1,39 @@
;-------------------------------
; IDBaudville
; identify Baudville bootloader
;
; in: track buffer contains T00,S00
; out: C clear if Baudville bootloader found
; C set otherwise
; all other registers & flags clobbered
;-------------------------------
!macro IDBaudville {
; variation 1
; - Blazing Paddles rev. 0
; - Blazing Paddles v04421
; - Blazing Paddles v04431
; - Pixit v01331
lda #$00
ldx #$15
jsr compare3
!byte $18,$AD,$4A
bcc + ; passport-test-suite/Blazing Paddles rev. 0.woz [C=0] matches
; variation 2
; - Guitar Wizard v11601
; - Prince v15521
; - Prince v15531
; - Rainy Day Games v13501
; - Ski Crazed v28701
; - Take 1 v06431
; - Take 1 v06451
; - Video Vegas v12501
; - Video Vegas v12511
lda #BASEPAGE
ldy #$05
jsr SearchSector
!byte $48
!byte $AD,$01,$E0
!byte $48
; passport-test-suite/Take 1 v06431.woz [C=0] matches
+
}

429
src/id/bootfailure.a Normal file
View File

@ -0,0 +1,429 @@
;-------------------------------
; IDBootFailure
; main entry point to identify the bootloader
; when the initial read failed
; identifies Infocom 18-sector side B disks
; and pure 13-sector disks
; and Broderbund RW18 disks
; doubles as Infocom verification routine after ID
; triples as RW18 verification routine after ID
; written by qkumba
;
; in: nothing
; out: carry set if we can't ID it
;-------------------------------
!zone {
IDBootFailure
VerifyInfocom18
lda $C0E9
lda #2
sta modsrc
.retry13
ldx #$1A ; the length of a track
ldy #0
--- iny
bne +
dex
bne +
.no sec
lda $C0E8
rts
.badsect
dec modsrc
beq .no
lda gIsInfocom18
and gIsRW18
beq .no ; if in Infocom/RW18 mode already then we have a true failure
bne .retry13 ; otherwise, try to identify 13-sector instead
; the issue being that both have a D5 AA AD sequence
+
jsr ReadNib
-- cmp #$D5
bne ---
jsr ReadNib
cmp #$9D
beq .RW18
cmp #$AA
bne --
jsr ReadNib
cmp #$B5 ; 13-sector only
beq .build13
cmp #$AD
bne --
jsr Read4x4
lda #$12 ; all 18 sectors when in verify mode
ldx gIsInfocom18
beq .setcount ; passport-test-suite/Trinity - Side B.woz [Z=1] here
lda #$02 ; passport-test-suite/Time Lord.woz [Z=0] here
; only two sectors when in ID mode
.setcount
sta tmp ; sector counter
lda #$00
-- ldy #$56
.x1
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x1 != >* {
!serious "branch crosses a page"
}
}
eor $BA00,x ; from universal RWTS
dey
bne -
.x2
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x2 != >* {
!serious "branch crosses a page"
}
}
eor $BA00,x ; from universal RWTS
iny
bne -
.x3
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x3 != >* {
!serious "branch crosses a page"
}
}
eor $BA00,x ; from universal RWTS
bne .badsect
dec tmp
bne --
sta gIsInfocom18
.checkmode
bit gMode ; verify-mode already?
bpl + ; yes, continue
lda #%00000000
sta gMode ; no, switch to verify-mode
jsr PrintByID ; and say so
!byte s_toverify
+ clc ; all clear
lda $C0E8
rts
.RW18
jsr .rw18pro
bne .badsect
ldx gIsRW18
beq .verifyrw18
sta gIsRW18
bne .checkmode ; always taken
;build 5-and-3 decoding table
;for 13-sector support
.no13
jmp ---
.build13
lda gTrack
bne .no13 ; skip if not boot phase
ldx #0
ldy #$AB
- tya
sta tmp
lsr
ora tmp
cmp #$FF
bne +
cpy #$D5
beq +
txa
sta $800,y
inx
+ iny
bne -
sty gIs13Sector
beq .checkmode ; always taken
.verifyrw18
ldx #$06 ; six sectors, three times the usual size
stx tmp ; sector counter
stx $40
stx $41
stx $42
stx $43
stx $44
stx $45
.retryrw18
jsr ReadNib
-- cmp #$D5
bne .retryrw18
jsr ReadNib
cmp #$9D
bne --
jsr .rw18pro
bne .badrw18
ldx $2D
cmp $40,x
beq .badrw18
sta $40,x
ldy #4
- dey
beq .badrw18
.x4
-- ldx $C0EC
bpl --
!if RELBASE != $2000 {
!if >.x4 != >* {
!serious "branch crosses a page"
}
}
lda $BA00,x
eor #$A5
bne -
sta $3A
tay
.x5
-- ldx $C0EC
bpl --
!if RELBASE != $2000 {
!if >.x5 != >* {
!serious "branch crosses a page"
}
}
eor $3A
eor $BA00,x
sta $2F
lda $BA00,x
asl
asl
sta $30
.x6
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x6 != >* {
!serious "branch crosses a page"
}
}
and #$C0
ora $BA00,x
sta $3A
lda $30
asl
asl
.x7
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x7 != >* {
!serious "branch crosses a page"
}
}
sta $30
and #$C0
ora $BA00,x
sta $3B
lda $30
asl
.x8
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x8 != >* {
!serious "branch crosses a page"
}
}
asl
ora $BA00,x
eor $3B
eor $2F
iny
bne --
.x9
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x9 != >* {
!serious "branch crosses a page"
}
}
eor $BA00,x
eor $3A
and #$3F
bne .badrw18
jsr ReadNib
cmp #$D4
bne .badrw18
dec tmp
bne .jmpretryrw18
jmp .checkmode
.jmpretryrw18
jmp .retryrw18
.badrw18
jmp .badsect
.rw18pro
.x10
-- ldx $C0EC
bpl --
!if RELBASE != $2000 {
!if >.x10 != >* {
!serious "branch crosses a page"
}
}
lda $BA00,x ; region (half)
sta $2C
.x11
-- ldx $C0EC
bpl --
!if RELBASE != $2000 {
!if >.x11 != >* {
!serious "branch crosses a page"
}
}
lda $BA00,x ; region (half)
sta $2D
.x12
-- ldx $C0EC
bpl --
!if RELBASE != $2000 {
!if >.x12 != >* {
!serious "branch crosses a page"
}
}
lda $BA00,x ; checksum
eor $2C
eor $2D
bne +
.x13
-- ldx $C0EC
bpl --
!if RELBASE != $2000 {
!if >.x13 != >* {
!serious "branch crosses a page"
}
}
lda $BA00,x ; epilogue
eor #$AA
+ rts
seekread13
dec gCommand
jsr $BD00 ; seek
inc gCommand
read13
lda $C0E9
lda #$1C ; retry count
sta tmp
.readaddr
dec tmp
bmi .badread2
clc
ldx #$03 ; 768 nibbles
ldy #0
.readdata
php
--- iny
bne +
dex
beq .badread1
+
jsr ReadNib
-- cmp #$D5
bne ---
jsr ReadNib
cmp #$AA
bne --
jsr ReadNib
cmp #$B5
bne +
ldy #$03
.x14
-- lda $C0EC
bpl --
!if RELBASE != $2000 {
!if >.x14 != >* {
!serious "branch crosses a page"
}
}
rol
sta $3C
.x15
- lda $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x15 != >* {
!serious "branch crosses a page"
}
}
and $3C
dey
bne --
plp
cmp gSector
bne .readaddr
bcs .readdata
+ plp
bcc .readaddr
eor #$AD
bne .readaddr
-- ldy #$9A
.x16
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x16 != >* {
!serious "branch crosses a page"
}
}
eor $800,x
dey
bne -
.x17
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x17 != >* {
!serious "branch crosses a page"
}
}
eor $800,x
iny
bne -
.x18
- ldx $C0EC
bpl -
!if RELBASE != $2000 {
!if >.x18 != >* {
!serious "branch crosses a page"
}
}
eor $800,x
cmp #$01 ; set carry if non-zero
!byte $2c
.badread1
plp
.badread2
sec
lda $C0E8
rts
}
; this prevents branches in this file from crossing a page
; (adjust as necessary)
filler !fill 9

View File

@ -1,34 +0,0 @@
;-------------------------------
; IDD5D5F7
; Identify specific version of DOS 3.3 bootloader
; shared by all disks that use the D5D5F7 check.
; Note: this detection pattern makes no logical
; sense; it just happens to be a useful filter for
; the D5D5F7 patcher to use later. It filters out
; about 2/3 of disks on which I've never seen a
; D5D5F7 protection check, so we can save time by
; not doing full-track searches on those disks.
;
; in: $0800..$08FF contains T00,S00
; IDDOS33 returned success
; out: C clear if specific version of DOS 3.3 bootloader found
; C set otherwise
; X,Y preserved
; all other flags and registers clobbered
;-------------------------------
!zone {
IDD5D5F7
lda $084C
cmp #$08
bne .no
lda $08B0
cmp #$B6
bne .no
lda $08D0
cmp #$20
bne .no
clc
!byte $24
.no sec
rts ; passport-test-suite/RoboMath.woz [C=0] matches
}

View File

@ -2,35 +2,20 @@
; IDDatasoft
; identify Datasoft encrypted bootloader
;
; in: track buffer contains T00,S00
; out: C clear if Datasoft encrypted bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
;
; tested with
; - Tomahawk
; - Video Title Shop
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if Datasoft encrypted bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
IDDatasoft
lda #$00
tax
ldy #$7E
!macro IDDatasoft {
ldy #$08
jsr compare
!byte $01,$4C,$7E,$08,$04,$8A,$0C,$B8
!byte $00,$56,$10,$7A,$00,$00,$1A,$16
!byte $12,$0E,$0A,$06,$53,$18,$9A,$02
!byte $10,$1B,$02,$10,$4D,$56,$15,$0B
!byte $BF,$14,$14,$54,$54,$54,$92,$81
!byte $1B,$10,$10,$41,$06,$73,$0A,$10
!byte $33,$4E,$00,$73,$12,$10,$33,$7C
!byte $00,$11,$20,$E3,$49,$50,$73,$1A
!byte $10,$41,$00,$23,$80,$5B,$0A,$10
!byte $0B,$4E,$9D,$0A,$10,$9D,$0C,$10
!byte $60,$1E,$53,$10,$90,$53,$BC,$90
!byte $53,$00,$90,$D8,$52,$00,$D8,$7C
!byte $00,$53,$80,$0B,$06,$41,$00,$09
!byte $04,$45,$0C,$63,$04,$90,$94,$D0
!byte $D4,$23,$04,$91,$A1,$EB,$CD,$06
!byte $95,$A1,$E1,$98,$97,$86
rts ; passport-test-suite/Tomahawk.woz [C=0] matches
!byte $01
!byte $4C,$7E,$08
!byte $04,$8A,$0C,$B8
; passport-test-suite/Tomahawk.woz [C=0] matches
}

View File

@ -2,31 +2,31 @@
; IDDavid
; identify David-DOS bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if David-DOS bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if David-DOS bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDDavid
lda #$00
ldx #$01
ldy #$06
jsr compare ; if T00,S00,$01 ==
!macro IDDavid {
ldy #$07
jsr compare ; if T00,S00,$00 ==
!byte $01
!byte $A5,$27 ; LDA $27
!byte $C9,$09 ; CMP #$09
!byte $D0,$17 ; BNE +$17
bcs .exit
lda #$00
bcs @notDavid
ldx #$4A
ldy #$0B
dey
jsr compare ; and T00,S00,$4A ==
!byte $A2,WILDCARD ; LDX #$**
!byte $BD,WILDCARD,$08; LDA $08**,X
!byte $9D,WILDCARD,$04; STA $04**,X
!byte $CA ; DEX
!byte $10,$F7 ; BPL -
.exit rts ; passport-test-suite/Horses.woz [C=0] matches
!byte $9D
; passport-test-suite/Horses.woz [C=0] matches
tax
@notDavid
}

View File

@ -11,25 +11,25 @@
!zone {
IDDavidson
lda gIsProDOS ; ProDOS?
bne .exit ; no, give up
bne .fail ; no, give up
lda gTrack ; track $22?
cmp #$22
sec
bne .exit ; no, give up
bne .fail ; no, give up
lda gSector ; sector $00?
bne .exit ; no, give up
bne .fail ; no, give up
;;lda #$00 ; try re-reading the sector but
sta $B92E ; ignore data field checksum failure
jsr ReadSector
lda #$13
sta $B92E
bcs .exit ; passport-test-suite/Word Attack Plus Spanish.woz [C=0] matches
bcs .fail ; passport-test-suite/Word Attack Plus Spanish.woz [C=0] matches
; if the read didn't work, give up
lda #s_davidson
jsr PrintByID
!byte s_davidson
lda #TRUE
sta gIsDavidson
clc
.exit
rts
!byte $24
.fail sec
.exit rts
}

View File

@ -2,18 +2,17 @@
; IDDinkeyDOS
; identify Dinkey-DOS by filename in ProDOS catalog
;
; in: track buffer contains T00,S0B
; out: C clear if Dinkey-DOS found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: track buffer contains T00,S0B
; out: C clear if Dinkey-DOS found
; C set otherwise
; A = #$0B
; all other registers & flags clobbered
;-------------------------------
!zone {
IDDinkeyDOS
!macro IDDinkeyDOS {
lda #$0B
ldx #$2B
ldy #$0B
tay
jsr compare ; if T00,S0B,$2B ==
!byte $29,$44,$49,$4E,$4B,$45,$59,$44,$4F,$53,$00
rts ; passport-test-suite/Ultima V.woz [C=0] matches
; passport-test-suite/Ultima V.woz [C=0] matches
}

View File

@ -2,20 +2,21 @@
; IDDiversi
; identify Diversi-DOS bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; out: C clear if Diversi-DOS bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; A = 0
; out: C clear if Diversi-DOS bootloader found
; C set otherwise
; A = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDDiversi
lda #$00
!macro IDDiversi {
ldx #$F1
ldy #$0B
jsr compare ; if T00,S00,$F1 ==
!byte $B3,$A3,$A0,$D2,$CF,$D2,$D2,$C5,$8D,$87,$8D
rts ; passport-test-suite/Moon Bingo.woz [C=0] matches
bcs + ; passport-test-suite/Moon Bingo.woz [C=0] matches
sta gIsDiversi
+
}

44
src/id/dos32.a Normal file
View File

@ -0,0 +1,44 @@
;-------------------------------
; IDDOS32
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if hybrid DOS 3.2/3.3 bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDDOS32 {
ldy #$0F
jsr compare ; if T00,S00,$00 =
!byte $01
!byte $A0,$0F ; LDY #$0F
!byte $B9,$00,$08; LDA $0800,Y
!byte $99,$00,$02; STA $0200,Y
!byte $C8 ; INY
!byte $D0,$F7 ; BNE -
!byte $4C,$0F,$02; JMP $020F
bcs +
ldx #$33
ldy #$08
jsr compare ; and T00,S00,$33 =
!byte $A6,$2B ; LDX $2B
!byte $20,$5D,$02; JSR $025D
!byte $4C,$D1,$02; JMP $02D1
bcs +
ldx #$F4
ldy #$08
jsr compare ; and T00,S00,$F4 =
!byte $CC,$00,$03; CPY $0300
!byte $D0,$03 ; BNE +
!byte $4C,$3B,$02; JMP $023B
bcs +
ldx #$45
jsr compare3 ; and T00,S00,$45 =
!byte $4C,$01,$03; JMP $0301
tax
+
}

43
src/id/dos32lo.a Normal file
View File

@ -0,0 +1,43 @@
;-------------------------------
; IDDOS32LO
; detect earlier variant of hybrid bootloader that loads into
; low memory ($3600) then relocates to the top of main memory
; after loading DOS
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if low DOS 3.2/3.3 bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDDOS32LO {
ldy #$0F
jsr compare
!byte $01
!byte $A2,$00 ; LDX #$00
!byte $BD,$00,$08; LDA $0800,X
!byte $9D,$00,$02; STA $0200,X
!byte $E8 ; INX
!byte $D0,$F7 ; BNE -
!byte $4C,$0F,$02; JMP $020F
bcs +
ldx #$2F
ldy #$08
jsr compare
!byte $A6,$2B ; LDX $2B
!byte $20,$5D,$02; JSR $025D
!byte $20,$D1,$02; JSR $02D1
bcs +
ldx #$41
jsr compare3
!byte $4C,$01,$03; JMP $0301
bcc +
ldx #$37
jsr compare3
!byte $4C,$01,$03; JMP $0301
+ tax
}

View File

@ -3,14 +3,14 @@
; identify DOS 3.3 bootloader or some variation
; that can be safely boot traced
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if traceable DOS 3.3-style bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; X = 0
; out: C clear if traceable DOS 3.3-style bootloader found
; C set otherwise
; A = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDDOS33
;
; $08FE must be either $B6 (standard) or $20..$36
@ -19,20 +19,20 @@ IDDOS33
; Must weed out some Infocom and TLC disks that would
; load over program space and crash.
;
lda $08FE
cmp #$B6
beq ++ ; passport-test-suite/Binomial Multiplication.woz [Z=1] here, loads at $B600
cmp #$37
txa
ldy $08FE
cpy #$B6
beq @ok08FE ; passport-test-suite/Binomial Multiplication.woz [Z=1] here, loads at $B600
cpy #$37
bcc + ; passport-test-suite/Beach-Head.woz [C=0] here, loads at $3F00
- sec
@fail sec
rts
+ cmp #$20
bcc - ; passport-test-suite/Alf.woz [C=0] here, loads at $1300
+ cpy #$20
bcc @fail ; passport-test-suite/Alf.woz [C=0] here, loads at $1300
@ok08FE
;
; Code at $0801 must be standard (with one exception)
; Code at $0800 must be standard (with one exception)
;
++ lda #$00
tax
ldy #$3F
jsr compare ; if T00,S00,$00 ==
!byte $01
@ -66,13 +66,10 @@ IDDOS33
!byte $6C,$3E,$00
!byte $EE,$FE,$08
!byte $EE,$FE,$08
bcc + ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
jmp .exit
+
bcs @fail ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
;
; DOS 3.3 has JSR $FE89 / JSR $FE93 / JSR $FB2F
; DOS 3.3 and most derivatives have JSR $FE89 / JSR $FE93 / JSR $FB2F at $083F
;
lda #$00
ldx #$3F
ldy #$0B
jsr compare ; if T00,S00,$3F ==
@ -80,76 +77,60 @@ IDDOS33
!byte $20,$93,$FE
!byte $20,$2F,$FB
!byte $A6,$2B
bcc + ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
bcc @ok083F ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
;
; some Sierra have STA $C050 / STA $C057 / STA $C055 instead
; Sierra variants have STA $C050 / STA $C057 / STA $C055 at $083F
;
lda #$00
ldx #$3F
ldy #$0B
jsr compare ; if T00,S00,$3F ==
!byte $8D,$50,$C0
!byte $8D,$57,$C0
!byte $8D,$55,$C0
!byte $A6,$2B
bcs .exit
+
bcs @exit ; passport-test-suite/Leisure Suit Larry.woz [C=0] matches
; other variations -> failure
@ok083F
;
; Check sector order map
; Filter out unsupported sector order map
;
lda #$00 ; passport-test-suite/Leisure Suit Larry.woz [C=0] matches previous compare
ldx #$4D
ldy #$10
jsr compare ; if T00,S00,$4D ==
!byte $00,$0D,$0B,$09,$07,$05,$03,$01
!byte WILDCARD,$0C,$0A,$08,$06,$04,$02,$0F
bcs .exit ; passport-test-suite/Pitfall II.woz [C=1] because of non-standard sector map
bcs @exit ; passport-test-suite/Pitfall II.woz [C=1] here
;
; Check for MUSE sector order map
; Check for MUSE sector order map (nonstandard but supported)
;
lda #$00
ldx #$55
ldy #$01
jsr compare ; if T00,S00,$55 ==
!byte $02
bcs +
lda #TRUE ; passport-test-suite/The Function Game.woz [C=0] matches previous compare
ldy $0855
cpy #$02
bne @notMUSE ; passport-test-suite/The Function Game.woz [Z=0] matches
sta gIsMUSERWTS
lda #$0E
sta precheck_sectors+1
lda #kSectorIgnore
sta T00S08
sta T00S0F
+
ldy #$0E
sty precheck_sectors+1
ldy #kSectorIgnore
sty T00S08
sty T00S0F
@notMUSE
;
; Minor variant jumps to $08F0 and back but is still safe to trace.
; Check for this jump and match the code at $08F0 exactly.
; DOS 3.3 and most derivatives have STA $08FE at $081C
;
lda #$00
ldx #$1C
ldy #$03
jsr compare ; if T00,S00,$1C ==
jsr compare3 ; if T00,S00,$1C ==
!byte $8D,$FE,$08
; standard code at $081C -> success
bcc .exit ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
lda #$00
ldx #$1C
ldy #$03
jsr compare ; if T00,S00,$1C ==
bcc @exit ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
;
; Variant jumps to $08F0 and back but is still safe to trace.
; Check for this jump and also match the code at $08F0 exactly.
;
jsr compare3 ; if T00,S00,$1C ==
!byte $4C,$F0,$08; JMP $08F0
bcs .exit ; unknown code at $081C -> failure
lda #$00
bcs @exit ; unknown code at $081C -> failure
ldx #$F0
ldy #$09
jsr compare ; if T00,S00,$F0 ==
!byte $8D,$FE,$08
!byte $EE,$F3,$03
!byte $4C,$1F,$08
; passport-test-suite/Library Magic.woz [C=0] matches acceptable code at $08F0
; unknown code at $08F0 -> failure
.exit
rts ; passport-test-suite/Library Magic.woz [C=0] matches acceptable code at $08F0
}
@exit rts

View File

@ -2,42 +2,28 @@
; IDEA
; identify Electronic Arts custom bootloader
;
; in: track buffer contains T00,S00
; out: C clear if EA bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if EA bootloader was found
; C set if not found
; A = 0
; X = 0
; all other registers & flags clobbered
;
; module by qkumba
;-------------------------------
IDEA
lda #$00
tax
ldy #36
jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2
!byte $03,$A9,$C6,$8D,$F3,$03,$49,$A5
!byte $8D,$F4,$03,$A9,$00,$8D,$C7,$09
!byte $AD,$E9,$C0,$A9,$B0,$85,$3E,$A9
!byte $02,$20,$00,$0C
bcc +
lda #$00
tax
ldy #39
jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2
!byte $03,$A9,$C6,$8D,$F3,$03,$49,$A5
!byte $8D,$F4,$03,$A9,$00,$8D,$C7,$09
!byte $AD,$E9,$C0,$A9,$B7,$48,$A9,$B0
!byte $85,$3E,$A9,$00,$20,$00,$0C
bcc +
lda #$00
tax
!macro IDEA {
ldy #16
jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2
!byte $03,$A9,$C6,$8D,$F3,$03,$49,$A5
bcc +
jsr compare
!byte $01,$A5,$27,$C9,$09,$D0,$2E,$A2
!byte $10,$8A,$9D,$EF,$03,$CA,$D0,$F9
+ rts
+
}
foundea
;
@ -48,8 +34,8 @@ foundea
; original disk.
;
!zone {
lda #s_eab0
jsr PrintByID
!byte s_eab0
jsr CopyUniversal
; mark track $22 as "optional" in sector map

View File

@ -10,13 +10,12 @@
; all registers clobbered
; all other flags clobbered
;-------------------------------
!zone {
IDEncoded44
!macro IDEncoded44 {
ldy #$07
jsr SearchTrack
!byte $BD,$8C,$C0
!byte $10,$FB
!byte $38
!byte $2A
rts ; passport-test-suite/Sneakers.woz [C=0] matches
; passport-test-suite/Sneakers.woz [C=0] matches
}

View File

@ -11,11 +11,9 @@
; all registers clobbered
; all other flags clobbered
;-------------------------------
!zone {
IDEncoded53
!macro IDEncoded53 {
ldy #$10
jsr SearchTrack
!byte $BD,$8C,$C0,$10,$FB,$C9,$B5,$F0
!byte $09,$28,$90,$DF,$49,$AD,$F0,$1F
rts
}

18
src/id/enlightenment.a Normal file
View File

@ -0,0 +1,18 @@
;-------------------------------
; IDEnlightenment
; identify Enlightenment bootloader
;
; in: $800..$8FF contains T00,S00
; out: C clear if Enlightenment bootloader found
; C set otherwise
; all other registers & flags clobbered
;-------------------------------
!macro IDEnlightenment {
lda #$08
ldx #$01
ldy #$04
jsr CompareMemory
!byte $A9,$B7
!byte $85,$27
; passport-test-suite/Paul Whitehead Teaches Chess.woz [C=0] matches
}

View File

@ -2,28 +2,26 @@
; IDHolle
; identify Dav Holle's encrypted bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if Holle bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if Holle bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDHolle
lda #$00
tax
ldy #(@searchend-@searchstart)
!macro IDHolle {
ldy #$10
jsr compare ; if T00,S00,$00 ==
@searchstart
!byte $01
CLD
BIT $C081
LDA #$60
EOR $FF58
@hang BNE @hang
STA $03F3
SEI
@searchend
rts ; passport-test-suite/Crime Wave.woz [C=0] matches
!byte $D8 ; CLD
!byte $2C,$81,$C0; BIT $C081
!byte $A9,$60 ; LDA #$60
!byte $4D,$58,$FF; EOR $FF58
!byte $D0,$FE ; BNE
!byte $8D,$F3,$03; STA $03F3
!byte $78
; passport-test-suite/Crime Wave.woz [C=0] matches
}

View File

@ -5,23 +5,32 @@
;
; in: T00,S00 in memory at $0800
;-------------------------------
!zone {
IDBootloader
;
; Reset all per-disk globals.
; These are used as filters later so irrelevant patchers can be skipped.
; Some of these are used as filters later so irrelevant patchers can be skipped.
;
ldx #(LASTFILTER-FIRSTFILTER)
lda #FALSE
- sta FIRSTFILTER-1,x
- sta FIRSTFILTER-1, x
dex
bne -
; X = 0
stx gMECCFastloadType
stx gLastTrack
txa
; A = 0
ldx #9
- sta gDisplayBytes, x
dex
bpl -
ldx #$0F
ldy #$F8
- tya
sta precheck_sectors,x
sta precheck_sectors, x
iny
dex
bpl -
@ -30,19 +39,28 @@ IDBootloader
ldx gIsInfocom18
beq .printinfo
lda #s_rw18
ldx gIsRW18
beq .printinfo
.check13
lda gIs13Sector
bne .sanity
lda #s_13sector
.printinfo
sta +
jsr PrintByID
+ !byte $FD ; SMC
jmp UseUniversal
.sanity
;
; Quick sanity check -- only recognized values for $0800
; are 1 or 2 for regular disks, and 5 for possible Electronic Arts.
; Quick sanity check -- only recognized values for $0800 are
; $00 = some Enlightenment disks
; $01 = most disks
; $02 = Special Delivery (DOS 3.3P)
; $05 = some EA disks
;
lda $0800
beq +
@ -50,7 +68,19 @@ IDBootloader
bcc .sane
cmp #$05
beq .sane
+ jmp UseUniversal
- jmp UseUniversal
+
;
; Try to identify Enlightenment bootloader.
; (in none; out none)
;
+IDEnlightenment
bcs -
lda #TRUE
sta gIsEnlightenment
jsr PrintByID
!byte s_enlightenmentb0
bvc - ; always branches
.sane
;
@ -59,54 +89,88 @@ IDBootloader
;
lda #$08
ldx #BASEPAGE
ldy #$01
jsr CopyMemory
jsr CopyMemory1 ; exits with X=0
;
; Try to identify DOS 3.3-shaped bootloader.
; Exit via custom trace function if found.
; (in X=0; out A=0)
;
jsr IDDOS33
bcs .notdos33
lda #TRUE
sta gIsBoot0
jsr IDD5D5F7
bcs +
lda #TRUE
sta gPossibleD5D5F7
+ jsr IDDiversi
lda #s_diversidos
sta gIsBoot0 ; A = 0 (TRUE)
;
; Try to identify Diversi-DOS
; (in A=0; out A=0)
;
+IDDiversi
ldx #s_diversidos
bcc .printdos
jsr IDPronto
lda #s_prontodos
;
; Try to identify Pronto-DOS
; (in A=0; out A=0)
;
+IDPronto
ldx #s_prontodos
bcc .printdos
lda #s_dosb0
ldx #s_dosb0
.printdos
stx +
jsr PrintByID
+ !byte $FD ; SMC
jmp TraceDOS33
.notdos33
;
; Try to identify Laureate Learning Systems bootloader.
; Exit via custom trace function if found.
; (in A=0; out A=0)
;
+IDLaureate
bcs .notLaureate
jsr PrintByID
!byte s_laureate
sta gIsLaureate ; A = 0 (TRUE)
lda #$0B
jsr PrereadT00Partial
bcs .notLaureate
jmp TraceLaureate
.notLaureate
;
; Try to identify a variant bootloader that calls to $08B3
; early to munge the nibble tables used by the drive firmware.
; Exit via custom trace function if found.
; (in A=0; out A=0,X=0)
;
.notdos33
jsr ID8b3
bcs +
lda #s_jsr8b3
+ID8b3
bcs .not8b3
jsr PrintByID
lda #TRUE
sta gIs8b3
!byte s_jsr8b3
sta gIs8b3 ; A = 0 (TRUE)
jmp Trace8B3
.not8b3
;
; Try to identify a bootloader that loads several sectors
; into the text page before loading a non-standard RWTS in
; higher memory.
; Exit via custom trace function if found.
;
+IDJMP600
bcs .notjmp600
jsr PrintByID
!byte s_jmp600
sta gIsJMP600 ; A = 0 (TRUE)
jmp FoundJMP600
.notjmp600
;
; Try to identify all the different MECC fastloader variants.
; Exit via custom trace function if found.
; (in A=0,X=0; out A=0,X=0)
;
+ jsr IDMECC
+IDMECC
bcs .notmecc
lda #ID_MECC_UNK
sta gMECCFastloadType
lda #s_mecc
jsr PrintByID
!byte s_mecc
jsr PrereadT00
bcs .notmecc
jsr IDMECC1
@ -131,67 +195,192 @@ IDBootloader
jmp foundmecc4
.notmecc
;
; Try to identify DOS 3.3P (Special Delivery) bootloader.
; Exit via custom trace function if found.
; Try to identify encrypted Datasoft bootloader
; (in A=0,X=0; out A=0,X=0)
;
jsr IDSpecDel
bcs +
lda #s_specdel
+IDDatasoft
bcs .notDatasoft
jsr PrintByID
jmp TraceSpecDel
!byte s_datasoftb0
sta gIsDatasoft ; A = 0 (TRUE)
; /!\ execution falls through here
.notDatasoft
;
; Try to identify Laureate Learning Systems bootloader.
; Exit via custom trace function if found.
; Try to identify RDOS 16-sector bootloader
; (in A=0,X=0; out A=0,X=0)
;
+ jsr IDLaureate
bcs +
lda #s_laureate
+IDRDOS16
bcs .notRDOS16
jsr PrintByID
lda #TRUE
sta gIsLaureate
lda #$0B
jsr PrereadT00Partial
bcs +
jmp TraceLaureate
!byte s_rdos
; /!\ execution falls through here
.notRDOS16
;
; David-DOS II
; (in A=0,X=0; out A=0,X=0)
;
+IDDavid
bcs .notDavid
jsr PrintByID
!byte s_daviddos
sta gIsDavidDOS ; A = 0 (TRUE)
; /!\ execution falls through here
.notDavid
;
; TSR bootloader
; (in A=0,X=0; out A=0,X=0)
;
+IDTSR
bcs .notTSR
jsr PrintByID
!byte s_tsr
sta gIsTSR ; A = 0 (TRUE)
; /!\ execution falls through here
.notTSR
;
; Micrograms bootloader
; (in A=0,X=0; out A=0,X=0)
;
+IDMicrograms
bcs .notMicrograms
jsr PrintByID
!byte s_micrograms
; /!\ execution falls through here
.notMicrograms
;
; Quick-DOS
; (in A=0,X=0; out A=0,X=0)
;
+IDQuickDOS
bcs .notQuickDOS
jsr PrintByID
!byte s_quickdos
; /!\ execution falls through here
.notQuickDOS
;
; Dav Holle encrypted bootloader
; (in A=0,X=0; out A=0,X=0)
;
+IDHolle
bcs .notHolle
jsr PrintByID
!byte s_holle
sta gIsHolle ; A = 0 (TRUE)
; /!\ execution falls through here
.notHolle
;
; Try to identify Electronic Arts bootloader.
; Exit via custom trace function if found.
; (in A=0,X=0; out A=0,X=0)
;
+ jsr IDEA
bcs +
+IDEA
bcs .notEA
jmp foundea
.notEA
;
; Try to identify hybrid 16-/13-sector bootloader.
; Exit via custom trace function if found.
; (in A=0,X=0; out A=0,X=0)
;
+IDDOS32
bcs .notDOS32
jsr PrintByID
!byte s_dos32b0
jmp TraceDOS32
.notDOS32
;
; Try to identify DOS 3.3P (Special Delivery) bootloader.
; Exit via custom trace function if found.
; (in A=0,X=0; out A=0,X=0)
;
+IDSpecDel
bcs .notSpecialDelivery
jsr PrintByID
!byte s_specdel
jmp TraceSpecDel
.notSpecialDelivery
;
; Try to identify hybrid 16-/13-sector bootloader (variant
; that loads into $3600 then relocates).
; Exit via custom trace function if found.
; (in A=0,X=0; out A=0,X=0)
+IDDOS32LO
bcs .notDOS32LO
jsr PrintByID
!byte s_dos32b0
jmp TraceDOS32LO
.notDOS32LO
;
; ProDOS (all versions)
; (in A=0,X=0; out none [after jsr IDVolumeName])
;
+IDProDOS
bcs .notProDOS
jsr PrintByID
!byte s_prodosb0
sta gIsProDOS ; A = 0 (TRUE)
jsr IDVolumeName
; /!\ execution falls through here because Dinkey-DOS disks are also ProDOS
;
; Dinkey-DOS (ProDOS file structure with DOS 3.3-ish RWTS in language card)
; detectable now because IDVolumeName just read the first sector of the
; volume directory into memory so we can look for a unique filename
; (in none; out none)
;
+IDDinkeyDOS
bcs .notDinkey
sta gDisplayBytes ; A = #$0B
jsr PrintByID
!byte s_dinkeydos
lda #TRUE
sta gIsDinkeyDOS
; /!\ execution falls through here to save bytes (no other IDs will match)
.notProDOS
.notDinkey
;
; Apple Pascal (all versions)
; (in none; out none [after jsr IDVolumeName])
;
+IDPascal
bcs .notPascal
jsr PrintByID
!byte s_pascalb0
sta gIsPascal ; A = 0 (TRUE)
jsr IDVolumeName
; /!\ execution falls through here
.notPascal
;
; Try to identify Interplay bootloader.
; Exit via custom trace function if found.
; (in none; out none)
;
+ jsr IDAdvent
bcs +
+IDAdvent
bcs .notInterplay
jmp foundadvent
.notInterplay
;
; Try to identify hybrid 16-/13-sector bootloader on
; DOS 3.2 disks.
; Exit via custom trace function if found.
; Try to identify Baudville bootloader.
; (in none; out none)
;
+ jsr IDDOS32
bcs +
lda #s_dos32b0
+IDBaudville
bcs .notBaudville
jsr PrintByID
jmp TraceDOS32
+ jsr IDDOS32LO
bcs +
lda #s_dos32b0
jsr PrintByID
jmp TraceDOS32LO
!byte s_baudville
lda #TRUE
sta gIsBaudville
.notBaudville
;
; Try to detect whether there is code in the boot sector
; that loads 4-and-4-encoded data. This is an early escape
; hatch for disks that will fail later anyway.
; (in none; out none)
;
+ jsr IDEncoded44
bcs +
lda #s_encoded44
+IDEncoded44
bcs .not44
jsr PrintByID
!byte s_encoded44
jmp TheEnd
.not44
;
; Try to detect whether there is code in the boot sector
; that loads 5-and-3-encoded data. If the earlier DOS 3.2
@ -199,112 +388,28 @@ IDBootloader
; (the universal RWTS only works on 6-and-2 encoded data), so
; this serves as an early escape hatch for disks that will
; fail later anyway.
; (in none; out none)
;
+ jsr IDEncoded53
bcs +
lda #s_encoded53
+IDEncoded53
bcs .not53
jsr PrintByID
!byte s_encoded53
jmp TheEnd
.not53
;
; ProDOS (all versions)
; 5-5-5 spiral bootloader
; (in none; out none)
;
+ jsr IDProDOS
bcs +
lda #s_prodosb0
+ID555
bcs .not555
lda #0
sta gDisplayBytes
jsr PrintByID
lda #TRUE
sta gIsProDOS
jsr IDVolumeName
bcs .useuniv
;
; Dinkey-DOS (ProDOS file structure with DOS 3.3-ish RWTS in language card)
; detectable now because IDVolumeName just read the first sector of the
; volume directory into memory so we can look for a unique filename
;
jsr IDDinkeyDOS
bcs .useuniv
lda #s_dinkeydos
jsr PrintByID
lda #TRUE
sta gIsDinkeyDOS
beq .useuniv ; always branches
;
; Apple Pascal (all versions)
;
+ jsr IDPascal
bcs +
lda #s_pascalb0
jsr PrintByID
lda #TRUE
sta gIsPascal
jsr IDVolumeName
bvc .useuniv ; always branches
;
; David-DOS II
;
+ jsr IDDavid
bcs +
lda #s_daviddos
jsr PrintByID
lda #TRUE
sta gIsDavidDOS
beq .useuniv ; always branches
;
; Encrypted Datasoft bootloader
;
+ jsr IDDatasoft
bcs +
lda #s_datasoftb0
jsr PrintByID
lda #TRUE
sta gIsDatasoft
beq .useuniv ; always branches
;
; Micrograms bootloader
; (just for display)
;
+ jsr IDMicrograms
bcs +
lda #s_micrograms
jsr PrintByID
bcc .useuniv ; always branches
;
; Quick-DOS
; (just for display)
;
+ jsr IDQuickDOS
bcs +
lda #s_quickdos
jsr PrintByID
bcc .useuniv ; always branches
;
; RDOS
; (just for display)
;
+ jsr IDRDOS
bcs +
lda #s_rdos
jsr PrintByID
bcc .useuniv ; always branches
;
; Dav Holle encrypted bootloader
; (will be decrypted and patched)
;
+ jsr IDHolle
bcs +
lda #s_holle
jsr PrintByID
lda #TRUE
sta gIsHolle
+
.useuniv
!byte s_555
jmp Do555
.not555
jmp UseUniversal
}
!zone {
PrereadT00
lda #$0F
PrereadT00Partial
@ -316,198 +421,8 @@ PrereadT00Partial
sta gTrack
sta gAddress
- jsr ReadSector
bcs .exit
bcs +
dec gAddress+1
dec gSector
bne -
.exit
rts
}
;-------------------------------
; IDBootFailure
; main entry point to identify the bootloader
; when the initial read failed
; identifies Infocom 18-sector side B disks
; and pure 13-sector disks
; doubles as Infocom verification routine after ID
; written by qkumba
;
; in: nothing
; out: carry set if we can't ID it
;-------------------------------
!zone {
IDBootFailure
VerifyInfocom18
lda $C0E9
lda #2
sta modsrc
.retry13
ldx #$1A ; the length of a track
ldy #0
--- iny
bne +
dex
bne +
.no sec
lda $C0E8
rts
.badsect
dec modsrc
beq .no
lda gIsInfocom18
beq .no ; if in Infocom mode already then we have a true failure
bne .retry13 ; otherwise, try to identify 13-sector instead
; the issue being that both have a D5 AA AD sequence
+
jsr ReadNib
-- cmp #$D5
bne ---
jsr ReadNib
cmp #$AA
bne --
jsr ReadNib
cmp #$B5 ; 13-sector only
beq .build13
cmp #$AD
bne --
jsr Read4x4
lda #$12 ; all 18 sectors when in verify mode
ldx gIsInfocom18
beq .setcount ; passport-test-suite/Trinity - Side B.woz [Z=1] here
lda #$02 ; passport-test-suite/Time Lord.woz [Z=0] here
; only two sectors when in ID mode
.setcount
sta tmp ; sector counter
lda #$00
-- ldy #$56
- ldx $C0EC
bpl -
eor $BA00,x ; from universal RWTS
dey
bne -
- ldx $C0EC
bpl -
eor $BA00,x ; from universal RWTS
iny
bne -
- ldx $C0EC
bpl -
eor $BA00,x ; from universal RWTS
bne .badsect
dec tmp
bne --
sta gIsInfocom18
.checkmode
bit gMode ; verify-mode already?
bpl + ; yes, continue
lda #%00000000 ;
sta gMode ; no, switch to verify-mode
lda #s_toverify
jsr PrintByID ; and say so
+ clc ; all clear
lda $C0E8
rts
;build 5-and-3 decoding table
;for 13-sector support
.build13
ldx #$00
ldy #$AB
- tya
sta tmp
lsr
ora tmp
cmp #$FF
bne +
cpy #$D5
beq +
txa
sta $800,y
inx
+ iny
bne -
sty gIs13Sector
beq .checkmode ; always taken
read13
lda $C0E9
lda #$1C ; retry count
sta tmp
.readaddr
dec tmp
bmi .badread2
clc
ldx #$02 ; 512 nibbles
ldy #0
.readdata
php
--- iny
bne +
dex
beq .badread1
+
jsr ReadNib
-- cmp #$D5
bne ---
jsr ReadNib
cmp #$AA
bne --
jsr ReadNib
cmp #$B5
bne +
ldy #$03
-- lda $C0EC
bpl --
rol
sta $3C
- lda $C0EC
bpl -
and $3C
dey
bne --
plp
cmp gSector
bne .readaddr
bcs .readdata
+ plp
bcc .readaddr
eor #$AD
bne .readaddr
-- ldy #$9A
- ldx $C0EC
bpl -
eor $800,x
dey
bne -
- ldx $C0EC
bpl -
eor $800,x
iny
bne -
- ldx $C0EC
bpl -
eor $800,x
cmp #$01 ; set carry if non-zero
!byte $2c
.badread1
plp
.badread2
sec
lda $C0E8
rts
}
+ rts

47
src/id/jmp600.a Normal file
View File

@ -0,0 +1,47 @@
;------------------------------------------------------------------------------
; IDJMP600
; identify JMP600 bootloader
; custom boot sector uses its own RWTS to load one or more sectors into the
; text page and eventually jumps to $600 which uses a second RWTS to load
; and jump to a third RWTS at $B700
;
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if JMP600 bootloader was found
; C set if not found
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDJMP600 {
ldy #$11
jsr compare
!byte $01,$A2,$00,$BD,$00,$08,$9D,$00
!byte $02,$E8,$D0,$F7,$4C,$0F,$02,$A9
!byte $A0
; passport-test-suite/Competition Karate.woz [C=0] matches
}
FoundJMP600
;
; We found a JMP600 bootloader. Now we create
; an RWTS that can read the rest of the disk.
; Starting with our built-in RWTS, we modify address
; and data prologues based on the parameters of the
; original disk.
;
lda $84A
lsr
sta UNIV_A1
lda $853
sta UNIV_A2
lda $85D
sta UNIV_A3
lda $888
sta UNIV_D1
lda $891
sta UNIV_D2
lda $89B
sta UNIV_D3
jmp ADStyle

View File

@ -4,44 +4,27 @@
; to alter the nibble translate table used
; by the drive firmware at $C600
;
; in: track buffer contains T00,S00
; out: C clear if this bootloader was found
; C set otherwise
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; out: C clear if this bootloader was found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
ID8b3
lda #$00
tax
ldy #$5A
jsr compare
!byte $01,$20,$B3,$08,$D0,$19,$EA,$A5
!byte $2B,$4A,$4A,$4A,$4A,$09,$C0,$85
!byte $3F,$A9,$5C,$85,$3E,$18,$AD,$FE
!byte $08,$6D,$FF,$08,$8D,$FE,$08,$AE
!byte $FF,$08,$F0,$15,$8A,$EA,$EA,$85
!byte $3D,$CE,$FF,$08,$AD,$FE,$08,$85
!byte $27,$CE,$FE,$08,$A6,$2B,$6C,$3E
!byte $00,$EE,$FE,$08,$EE,$FE,$08,$20
!byte $89,$FE,$20,$93,$FE,$20,$2F,$FB
!byte $A2,$FF,$BD,$00,$08,$9D,$00,$B6
!byte $CA,$E0,$FF,$D0,$F5,$20,$CC,$08
!byte $A6,$2B
bcs .exit
lda #$00
!macro ID8b3 {
ldx #$B3
ldy #$36
ldy #$14
jsr compare
!byte $A9,$3F,$8D,$6C,$03
!byte $A9,$1C,$8D,$CC,$03,$A9,$00,$8D
!byte $D5,$03,$A9,$37,$8D,$A3,$03,$A5
!byte $27,$C9,$09,$60,$A9,$00,$85,$00
!byte $A9,$B5,$85,$01,$A0,$FF,$C8,$B9
!byte $00,$F0,$91,$00,$C0,$FF,$D0,$F6
!byte $C6,$01,$A9,$08,$C5,$01,$D0,$EC
!byte $60
.exit
rts ; passport-test-suite/Ardy The Aardvark.woz [C=0] matches
!byte $A9,$1C,$8D,$CC,$03
!byte $A9,$00,$8D,$D5,$03
!byte $A9,$37,$8D,$A3,$03
tax
bcs +
ldy #$08
jsr compare
!byte $01,$20,$B3,$08,$D0,$19,$EA,$A5
; passport-test-suite/Ardy The Aardvark.woz [C=0] matches
+
}

View File

@ -4,34 +4,29 @@
; Laureate Learning Systems
; loads RWTS directly into language card
;
; in: track buffer contains T00,S00
; out: C clear if Laureate bootloader was found
; (and track buffer now contains all of track 0)
; C set if not found
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; out: C clear if Laureate bootloader was found
; C set if not found
; A = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDLaureate
lda #$00
!macro IDLaureate {
ldx #$2E
ldy #$0E
ldy #$08
jsr compare ; if T00,S00,$2E ==
!byte $AE,$FF,$08; LDX $08FF
!byte $30,$1E ; BMI +$1E
!byte $E0,$02 ; CPX #$02
!byte $D0,$05 ; BNE +$05
!byte $A9,$BF ; LDA #$BF
!byte $8D,$FE,$08; STA $08FE
bcs .exit
!byte $D0 ; BNE
bcs +
ldx #$F8
ldy #$08
jsr compare ; and T00,S00,$F8 ==
!byte $4C,$00,$B7; JMP $B700
!byte $00,$00,$00
!byte $FF,$0B
.exit
rts ; passport-test-suite/Sound Ideas- Word Attack - Disk 1 - Ending Consonants.woz [C=0] matches
; passport-test-suite/Sound Ideas- Word Attack - Disk 1 - Ending Consonants.woz [C=0] matches
+
}
;-------------------------------

View File

@ -6,23 +6,22 @@
; are required to distinguish between them after
; this function matches
;
; in: track buffer contains T00,S00
; out: C clear if MECC bootloader was found
; (and track buffer now contains all of track 0)
; C set if not found
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if MECC bootloader was found
; C set if not found
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDMECC
lda #$00
tax
!macro IDMECC {
ldy #$17
jsr compare
!byte $01,$4C,$1A,$08,$17,$0F,$00,$00
!byte $0D,$0B,$09,$07,$05,$03,$01,$0E
!byte $0C,$0A,$08,$06,$04,$02,$0F
rts ; passport-test-suite/Clock Works v1.0.woz [C=0] matches
; passport-test-suite/Clock Works v1.0.woz [C=0] matches
}
;-------------------------------
@ -44,34 +43,31 @@ IDMECC1
jsr compare ; IF T00,S0B,$02 ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$89
jsr compare ; AND T00,S0B,$89 ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$09
ldy #$09
jsr compare ; AND T00,S0B,$09 ==
!byte $D0,$EF,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9
bcs .exit
ldx #$13
ldy #$0A
jsr compare ; AND T00,S0B,$13 ==
!byte $D0,$E5,$A0,$03,$BD,$8C,$C0,$10
!byte $FB,$C9
bcs .exit
ldx #$89
ldy #$06
jsr compare ; AND T00,S0B,$89 ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$90
ldy #$09
jsr compare ; AND T00,S0B,$90 ==
!byte $D0,$F4,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9
bcs .exit
ldx #$9A
ldy #$09
jsr compare ; AND T00,S0B,$9A ==
!byte $D0,$F2,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9
ldx #$13
iny
jsr compare ; AND T00,S0B,$13 ==
!byte $D0,$E5,$A0,$03,$BD,$8C,$C0,$10
!byte $FB,$C9
bcs .exit
.exit
rts ; passport-test-suite/Coordinate Math v1.0.woz [C=0] matches
@ -131,28 +127,27 @@ IDMECC4a
jsr compare ; IF T00,S07,$7D ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$84
ldy #$09
jsr compare ; AND T00,S07,$84 ==
!byte $D0,$F0,$EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$8E
ldy #$0A
jsr compare ; and T00,S07,$8E ==
!byte $D0,$F2,$A0,$03,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$0F
ldy #$06
jsr compare ; and T00,S07,$0F ==
!byte $BD,$8C,$C0,$10,$FB,$49
bcs .exit
ldx #$18
ldy #$07
iny
jsr compare ; and T00,S07,$18 ==
!byte $EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$84
iny
iny
jsr compare ; AND T00,S07,$84 ==
!byte $D0,$F0,$EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$8E
iny
jsr compare ; and T00,S07,$8E ==
!byte $D0,$F2,$A0,$03,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$20
ldy #$0A
jsr compare ; and T00,S07,$20 ==
!byte $D0,$F2,$A0,$56,$BD,$8C,$C0,$10,$FB,$C9
.exit
@ -220,7 +215,7 @@ IDMECC3
!byte $D0,$EF,$EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$F3
ldy #$0A
iny
jsr compare ; and T00,S0A,$F3 ==
!byte $D0,$F2,$A0,$03,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
@ -236,7 +231,6 @@ IDMECC3
!byte $D0,$F4,$EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$7A
ldy #$09
jsr compare ; and T00,S0B,$7A ==
!byte $D0,$F2,$EA,$BD,$8C,$C0,$10,$FB,$C9
.exit

View File

@ -2,27 +2,29 @@
; IDMicrograms
; identify Micrograms bootloader
;
; in: track buffer contains T00,S00
; out: C clear if Micrograms bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if Micrograms bootloader was found
; C set if not found
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDMicrograms
lda #$00
ldx #$01
ldy #$0A
!macro IDMicrograms {
ldy #$0B
jsr compare
!byte $01
!byte $A5,$27
!byte $C9,$09
!byte $D0,$12
!byte $A9,$C6
!byte $85,$3F
bcs .exit ; passport-test-suite/Shapes and Patterns.woz [C=0] matches
bcs @notMicrograms ; passport-test-suite/Shapes and Patterns.woz [C=0] matches
ldx #$42
ldy #$02
jsr compare
jsr compare2
!byte $4C,$00
.exit rts
; passport-test-suite/Shapes and Patterns.woz [C=0] matches
tax
@notMicrograms
}

View File

@ -16,14 +16,13 @@ IDMilliken
; already identified a marker on T00,S01 that strongly
; suggests the presence of this routine, so it's worth
; doing an extra disk read here to be sure)
lda #$00
sta gTrack
lda #$0A
sta gSector
ldx #$00
ldy #$0A
tya
clc
adc #BASEPAGE
sta gAddress+1
jsr ReadSector
jsr ReadSectorXY
bcs .exit
IDMilliken1

View File

@ -13,26 +13,20 @@ PanglosDOS
lda jCallRWTS+2
ldx #$00 ; check for "STY $48;STA $49"
ldy #$04 ; at RWTS entry point
pha
jsr CompareMemory
!byte $84,$48,$85,$49
pla
bcs .jmpexit1
sec
sbc #5
ldx #$C3 ; check for "SEC;RTS" at $x8C3
ldy #$02
pha
jsr CompareMemory
!byte $38,$60
pla
bcs .jmpexit1
ldx #$62 ; check for "LDA $C08C,X" at $x862
ldy #$03
pha
jsr CompareMemory
!byte $BD,$8C,$C0
pla
bcs .jmpexit1
lda jCallRWTS+2
ldx #$B9 ; check for "JSR $xxF9" at $xDB9
@ -42,9 +36,9 @@ PanglosDOS
bcc + ; passport-test-suite/Stepwise Multiple Regression.woz [C=0] matches
.jmpexit1
jmp .exit
+ lda #s_gathering
+
jsr PrintByID
!byte s_gathering
;$230 (560) bytes for address keys
;$230 (560) bytes for data keys
@ -54,15 +48,29 @@ PanglosDOS
sta .patch5+2
sta .patch6+2
sta .patch7+2
sta .patch16+2
sta .patch17+2
sta .patch18+2
sta .patch19+2
sec
sbc #5
sbc #4
sta .patch14+2
sta .patch15+2
sta .patch20+2
sta .patch21+2
sbc #1
sta .patch1+2
sta .patch2+2
sta .patch3+2
sta .patch4+2
sta .patch8+2
sta .patch9+2
sta .patch10+2
sta .patch11+2
sta .patch12+2
sta .patch13+2
ldy #0
sty .onetime-1
tya
- sta $2000,y
sta $2100,y
@ -86,6 +94,21 @@ PanglosDOS
sta $3880
.patch4
sta $38EE
ldy #3
.hookpro
lda .hookD5,y
.patch10
sta $3867,y
.patch11
sta $38D5,y
dey
bpl .hookpro
lda #$F3
.patch12
sta $386B
lda #$EF
.patch13
sta $38D9
lda #$0F
sta .sector+1
.readdir lda #$11
@ -95,7 +118,38 @@ PanglosDOS
lda #BASEPAGE
sta gAddress+1
jsr ReadSector
bcs .jmpexit1
bcs .jmpexit3
bcc .onetime
.onetime
lda #.goodnib-.onetime
sta .onetime-1
lda (BASEPAGE * 256) + $2B
cmp #$A0
beq .goodnib
lda #$20
.patch14
sta $39D5
lda #$D5
.patch15
sta $39D6
jsr ReadSector
lda (BASEPAGE * 256) + $2B
cmp #$A0
bne .jmpexit3
lda #$20
.patch16
sta $3D00
lda #<.callback3
.patch17
sta $3D01
lda #>.callback3
.patch18
sta $3D02
lda #$EA
.patch19
sta $3D03
.goodnib
inc gAddress+1
lda #$0B ;entry offset
.parsedir
@ -110,6 +164,7 @@ PanglosDOS
sta gTrack
stx gSector
jsr ReadSector
.jmpexit3
bcs .jmpexit2
ldx #0
ldy #0
@ -148,7 +203,7 @@ PanglosDOS
adc #$23
bne .parsedir
dec .sector+1
bne .readdir
bne .jmpreaddir
.setpanglos
lda #$20
@ -167,6 +222,40 @@ PanglosDOS
.jmpexit2
jmp .exit
.jmpreaddir
jmp .readdir
.callback3
sty $48
sta $49
ldy #4
lda ($48),y
cmp #2
bne .notyet
iny
lda ($48),y
cmp #$0F
bne .notyet
lda #$D5
.patch20
sta $39D5
lda #$20
.patch21
sta $39D6
.notyet
rts
.hookD5
jsr .callback2
!byte $D0
.callback2
cmp #$D5
beq .goodpro
cmp #$D6
.goodpro
rts
.callback
sty $578
lda gTrack

View File

@ -2,38 +2,39 @@
; IDPascal
; identify Apple Pascal bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if Apple Pascal bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if Apple Pascal bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDPascal
!macro IDPascal {
;
; Apple Pascal signature (version < 1.3)
; The wildcard in 7th position catches alternate jump
; 7th position not included, to catch alternate jump
; addresses (e.g. Wizardry I, Sundog Frozen Legacy)
; 8th position not included, to catch PFS
;
lda #$00
tax
ldy #$08
ldy #$06
jsr compare ; if T00,S00,$00 ==
!byte $01
!byte $E0,$60
!byte $F0,$03
!byte $4C,WILDCARD,$08
bcc .exit ; passport-test-suite/Wizplus.woz [C=0] matches
!byte $4C
bcc @notPascal ; passport-test-suite/Wizplus.woz [C=0] matches
; passport-test-suite/PFS A02.woz [C=0] matches
;
; Apple Pascal 1.3 signature [thanks Marco V.]
;
ldy #$08 ; passport-test-suite/Triangles Through Octagons.woz [C=1] reaches here
; passport-test-suite/Triangles Through Octagons.woz [C=1] reaches here
jsr compare ; or if T00,S00,$00 ==
!byte $01
!byte $E0,$70
!byte $B0,$04
!byte $E0,$40
!byte $B0
.exit rts ; passport-test-suite/Triangles Through Octagons.woz [C=0] matches
!byte $E0
@notPascal ; passport-test-suite/Triangles Through Octagons.woz [C=0] matches
}

View File

@ -12,8 +12,7 @@
IDPhoenix
lda #$00
ldx #$B8
ldy #$03
jsr compare
jsr compare3
!byte $AC,$B7,$F6
rts ; passport-test-suite/Zoom Grafix 26-JAN-82.woz [C=0] matches
}

View File

@ -2,27 +2,27 @@
; IDProDOS
; identify ProDOS bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if ProDOS bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if ProDOS bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDProDOS
!macro IDProDOS {
; Some disks jump to $08FF at $0804 (SOS entry point).
; Others have a modified T00,S00 but eventually load
; ProDOS (e.g. 1-2-3 Sequence Me, Alge-Blaster Plus,
; Dazzle Draw, SuperPrint II). All of these variants
; will match.
lda #$00
tax
ldy #$05
jsr compare ; if T00,S00,$00 ==
!byte $01
!byte $38 ; SEC
!byte $B0,$03 ; BCS +3
!byte $4C ; JMP
rts ; passport-test-suite/Investigating Plant Growth.woz [C=0] matches
; passport-test-suite/Investigating Plant Growth.woz [C=0] matches
}

View File

@ -2,22 +2,21 @@
; IDPronto
; identify Pronto-DOS bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; out: C clear if Pronto-DOS bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; A = 0
; out: C clear if Pronto-DOS bootloader found
; C set otherwise
; A = 0
; all other flags clobbered
;-------------------------------
!zone {
IDPronto
lda #$00
!macro IDPronto {
ldx #$5E
ldy #$07
jsr compare ; if T00,S00,$5E ==
!byte $B0,$50 ; BCS +$50
!byte $AD,$CB,$B5; LDA $B5CB
!byte $85,$42 ; STA $42
rts ; passport-test-suite/America Coast to Coast.woz [C=0] matches
; passport-test-suite/America Coast to Coast.woz [C=0] matches
}

View File

@ -18,11 +18,12 @@ ProtectedDOS
!byte $D0,$E8
bcs .exit ; passport-test-suite/Ultima IV.woz [C=0] matches
stx gDisplayBytes
lda $B706 ; decryption key
sta .key+1
sta gDisplayBytes
lda #s_protdos
sta gDisplayBytes+1
jsr PrintByID
!byte s_protdos
;
; decrypt RWTS in memory

View File

@ -2,23 +2,24 @@
; IDQuickDOS
; identify Quick-DOS bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if Quick-DOS bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if Quick-DOS bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDQuickDOS
lda #$00
ldx #$01
ldy #$0A
!macro IDQuickDOS {
ldy #$0B
jsr compare ; if T00,S00,$01 ==
!byte $01
!byte $A5,$27 ; LDA $27
!byte $C9,$09 ; CMP #$09
!byte $D0,$27 ; BNE +$27
!byte $78 ; SEI
!byte $AD,$83,$C0; LDA $C083
rts ; passport-test-suite/Kid Niki.woz [C=0] matches
; passport-test-suite/Kid Niki.woz [C=0] matches
}

View File

@ -1,18 +1,18 @@
;-------------------------------
; IDRDOS
; IDRDOS16
; identify RDOS 16-sector bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if RDOS 16-sector bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if RDOS 16-sector bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDRDOS
lda #$00
tax
!macro IDRDOS16 {
ldy #$0E
jsr compare ; if T00,S00,$00 ==
!byte $01
@ -22,5 +22,5 @@ IDRDOS
!byte $A0,$1F ; LDY #$1F
!byte $B9,$00,$08; LDA $0800,Y
!byte $49 ; EOR
rts ; passport-test-suite/Roadwar 2000.woz [C=0] matches
; passport-test-suite/Roadwar 2000.woz [C=0] matches
}

View File

@ -11,25 +11,24 @@ Trace
txa
pha
lda #$C6
ldx #$B6
ldy #$01
jsr CopyMemory
ldx #$16
jsr CopyMemory1
pla
ldx #0
ldy $B6F8
ldy $16F8
cpy #$4C
beq +
ldx #3
ldy $B6FB
ldy $16FB
cpy #$4C
bne ++
+ sta $B6FA,x ; hi byte of callback
+ sta $16FA,x ; hi byte of callback
pla
sta $B6F9,x ; lo byte of callback
jmp $B600
sta $16F9,x ; lo byte of callback
jmp $1600
++ pla
lda #s_canttrace ; unknown disk controller
jsr PrintByID
jmp UseUniversal
jsr PrintByID ; unknown disk controller
!byte s_canttrace
; /!\ execution falls through here to UseUniversal
}

View File

@ -3,85 +3,6 @@
; that boots automatically on 16-sector drives
; e.g. many early disks from Edu-Ware, Hartley, DLM, Milliken
;-------------------------------
; IDDOS32
; returns C clear if 3.2/3.3 bootloader detected in T00,S00
;-------------------------------
!zone {
IDDOS32
lda #$00
tax
ldy #$0F
jsr compare
!byte $01
!byte $A0,$0F ; LDY #$0F
!byte $B9,$00,$08; LDA $0800,Y
!byte $99,$00,$02; STA $0200,Y
!byte $C8 ; INY
!byte $D0,$F7 ; BNE -
!byte $4C,$0F,$02; JMP $020F
bcs .exit
ldx #$33
ldy #$08
jsr compare
!byte $A6,$2B ; LDX $2B
!byte $20,$5D,$02; JSR $025D
!byte $4C,$D1,$02; JMP $02D1
bcs .exit
ldx #$F4
ldy #$08
jsr compare
!byte $CC,$00,$03; CPY $0300
!byte $D0,$03 ; BNE +
!byte $4C,$3B,$02; JMP $023B
bcs .exit
ldx #$45
ldy #$03
jsr compare
!byte $4C,$01,$03; JMP $0301
.exit rts
}
;-------------------------------
; IDDOS32LO
; detect earlier variant of hybrid bootloader that loads into
; low memory ($3600) then relocates to the top of main memory
; after loading DOS
; returns C clear if 3.2lo/3.3 bootloader detected in T00,S00
;-------------------------------
!zone {
IDDOS32LO
lda #$00
tax
ldy #$0F
jsr compare
!byte $01
!byte $A2,$00 ; LDX #$00
!byte $BD,$00,$08; LDA $0800,X
!byte $9D,$00,$02; STA $0200,X
!byte $E8 ; INX
!byte $D0,$F7 ; BNE -
!byte $4C,$0F,$02; JMP $020F
bcs .exit
ldx #$2F
ldy #$08
jsr compare
!byte $A6,$2B ; LDX $2B
!byte $20,$5D,$02; JSR $025D
!byte $20,$D1,$02; JSR $02D1
bcs .exit
ldx #$41
ldy #$03
jsr compare
!byte $4C,$01,$03; JMP $0301
bcc .exit
ldx #$37
ldy #$03
jsr compare
!byte $4C,$01,$03; JMP $0301
.exit rts
}
;-------------------------------
; TraceDOS32/TraceDOS32LO
; set up boot trace to capture 13-sector RWTS
@ -90,7 +11,7 @@ IDDOS32LO
TraceDOS32
lda #<.TraceDOS32b
ldx #>.TraceDOS32b
bne .linktrace
bne .linktrace ; always branches
TraceDOS32LO
lda #<.TraceDOS32LOb
ldx #>.TraceDOS32LOb
@ -120,7 +41,7 @@ TraceDOS32LO
.TraceDOS32c
lda #$03
ldx #$0D
ldy #$39
ldy #$36
jsr CompareMemory
!byte $A6,$2B
!byte $A9,$09
@ -149,17 +70,20 @@ TraceDOS32LO
!byte $AD,$CC,$03
!byte $85,$3F
!byte $E6,$3F
!byte $6C,$3E,$00
bcs .tryChoplifter
lda $03CC
cmp #$B6
beq +
cmp #$36
beq +
cmp #$B2 ;RDOS
bne .fail ; passport-test-suite/Epidemic.woz [Z=1] matches
cmp #$B2 ; RDOS
clc
+ php
beq ++ ; passport-test-suite/Epidemic.woz [Z=1] matches
cmp #$B6 ; DOS 3.2 loaded high
beq +
cmp #$36 ; DOS 3.2 loaded low
bne .fail
pha
jsr MoveT00PakHigh ; move our packed T00 modules out of the way first
pla
+ sec
++ php ; pulled later to distinguish RDOS from DOS 3.2
;
; set up RWTS entry point and other self-modified vectors
; that depend on where the RWTS is in memory
@ -175,6 +99,18 @@ TraceDOS32LO
lda #$00
sta jCallRWTS+1
;don't let The Game Show print
lda $343
eor #$4C
bne +
sta $345
lda #$6C
sta $343
lda #$3E
sta $344
+
; set up final trace
lda #$4C
@ -200,10 +136,10 @@ TraceDOS32LO
!byte $A9,$EA ;LDA #$EA
!byte $20,$26,$03 ;JSR $0326
bcs .fail ; passport-test-suite/Eggs-It.woz [C=0] matches
lda #s_choplifter
jsr PrintByID
lda #s_diskrwts
!byte s_choplifter
jsr PrintByID
!byte s_diskrwts
jmp Choplifter
; something did not match, not comfortable tracing,
@ -221,8 +157,9 @@ TraceDOS32LO
bcs .fail
lda #TRUE
sta gIsRDOS13
lda #s_rdos13
sta gDisplayBytes
jsr PrintByID
!byte s_rdos13
lda #<.RDOS13Hook
sta jCallRWTS+1
@ -321,8 +258,10 @@ TraceDOS32d
jsr CompareMemory
!byte $20,$DD
bcs + ; passport-test-suite/Robotwar.woz [C=0] matches
lda #s_muse
lda #$08
sta gDisplayBytes
jsr PrintByID
!byte s_muse
; read the rest of the disk with the original RWTS
+
@ -370,10 +309,20 @@ FFer
;standard 13-sector prologue on T00
;because we can't decode the 16-sector version
lda $BC76
pha
lda $BC8B
pha
lda #$D5
sta $BC76
lda #$B5
sta $BC8B
jsr +
pla
sta $BC8B
pla
sta $BC76
rts
+ lda gAddress
sta $BAF7

View File

@ -5,49 +5,26 @@
;-------------------------------
!zone {
TraceDOS33
;
; Before we trace through the drive firmware (which --
; at least on some machines -- will loop forever looking
; for each sector), we do a pre-check to ensure that all
; the sectors we're about to trace are actually readable.
;
lda #$00
sta gTrack
ldy #$00
@precheck_loop
lda precheck_sectors,y
bmi +
sta gSector
jsr IgnoreAddressChecksum
tya
pha
jsr ReadSector
pla
tay
bcc +
jmp FatalError
jsr PreCheckT00 ; does not return on failure
lda $08FE
bmi + ; if we're about to trace a DOS that loads at $3600,
jsr MoveT00PakHigh ; move our packed T00 modules out of the way first
+
iny
cpy #$10
bne @precheck_loop
;
; pre-check passed, do the trace
;
lda #<TraceDOS33b
ldx #>TraceDOS33b
jmp Trace
precheck_sectors
; This list is (re)initialized in IDBootloader,
; then potentially altered in IDDOS33.
; Values are logical sector numbers.
; There are always 16 (0x10) values in this list.
; Negative values are ignored.
; Positive values are treated as logical
; sector numbers and read from track $00.
; Sectors are read in the order listed here.
!byte $09,$08,$07,$06,$05,$04,$03,$02,$01
!byte $00,$FF,$FE,$FD,$FC,$FB,$FA,$F9,$F8
MaybeB6 !byte 0
MaybeB7 !byte 0
MaybeB8 !byte 0
MaybeB9 !byte 0
MaybeBA !byte 0
MaybeBB !byte 0
MaybeBC !byte 0
MaybeBD !byte 0
MaybeBE !byte 0
MaybeBF !byte 0
;-------------------------------
; TraceDOS33b
@ -68,113 +45,194 @@ TraceDOS33b
bne .noppatch ; including "Grafboot"
jmp $0801
TraceDOS33c
lda $08FE ; 2nd-level trace callback is here
sta .x6+1
sta .x6b+1
sta .x6c+2
clc
adc #$02
_Inspect1a
sta .x1+1
sta .x2+1
sta .x7+1
TraceDOS33c ; 2nd-level trace callback is here
ldy $08FE ; Set up array of high bytes of the sectors we read
dey
ldx #0
- tya
sta MaybeB6, x
iny
inx
cpx #$0A
bcc -
lda MaybeB9
sta b4bbmodify+2
sta b4bbmodify2+2
clc
adc #$06
lda MaybeBF
sta b4bbcompare+1
tax
dex
stx .x5+1
dex
stx .x3+1
stx .x4+1
stx .x8+2
stx .x9+2
stx jCallRWTS+2
jsr ProtectedDOS ; check for a specific (encrypted)
; bootloader called "Protected DOS"
lda MaybeBD
sta jCallRWTS+2
;
; Check for a specific encrypted bootloader called 'Protected.DOS'
;
jsr ProtectedDOS
bcs .notprotdos
jmp ADStyle
.useAD jmp ADStyle
.notprotdos
jsr PanglosDOS ; check for a specific bootloader
; that uses per-file sector encoding
bcs .notpanglosdos
jmp ADStyle
.notpanglosdos
lda jCallRWTS+2
ldx #$00 ; check for "STY $48;STA $49"
ldy #$04 ; at RWTS entry point
jsr CompareMemory ; (e.g. $BD00 or $3D00)
!byte $84,$48,$85,$49
bcc .x1
jmp UseUniversal
.x1 lda #$B9 ; check for "SEC;RTS" at $B942
;
; Check for a specific bootloader that uses per-file sector encoding
;
jsr PanglosDOS
bcc .useAD
;
; Check if $BD00 (RWTS entry point) starts with 'STY $48;STA $49'
;
lda MaybeBD
ldx #$00
ldy #$04
jsr CompareMemory
!byte $84,$48
!byte $85,$49
bcc .okaySoFar
;
; If $BD00 check failed, check for Mastery Development variation
; (usable)
;
ldy #$03
jsr CompareMemory
!byte $20,$AF,$BE
bcs .notmastery
adc #$01
ldx #$AF
ldy #$08
jsr CompareMemory
!byte $84,$48
!byte $85,$49
!byte $A0,$04
!byte $B1,$48
bcc .okaySoFar ; passport-test-suite/Mastery Arithmetic Games.woz [C=0] here
.notmastery
;
; If $BD00 check failed, check for Kidwriter variation
; (usable)
;
cmp #$BD
bne .notkidwriter
ldy #$03
jsr CompareMemory
!byte $20,$CC,$B6
bcs .notkidwriter
lda #$B6
ldx #$CC
ldy #$08
jsr CompareMemory
!byte $84,$48
!byte $85,$49
!byte $AD,$EC,$B7
!byte $F0
bcs .notkidwriter ; passport-test-suite/Kidwriter.woz [C=0] here
lda #<gTrack ; this entry point assumes track number is in $B7EC
sta $B6D1 ; which isn't true, so change the code to look at
lda #>gTrack ; Passport's gTrack instead
sta $B6D2
bne .okaySoFar ; always branches
.notkidwriter
;
; If $BD00 check failed and all variation checks failed,
; give up and use the built-in RWTS
;
.useuniv jmp UseUniversal
;
; $BD00 check succeeded (or a supported variation),
; so now check for 'SEC;RTS' at $B942
;
.okaySoFar
lda MaybeB9
ldx #$42
ldy #$02
jsr CompareMemory
!byte $38,$60
bcc .x2
jmp UseUniversal
.x2 lda #$B9 ; check for "LDA $C08C,X" at $B94F
bcs .useuniv
;
; $B942 check succeeded,
; so now check for 'LDA $C08C,X' at $B94F
;
ldx #$4F
ldy #$03
iny ; Y=3
jsr CompareMemory
!byte $BD,$8C,$C0
bcc .x3
jmp UseUniversal
.x3 lda #$BD ; check for "JSR $xx00" at $BDB9
bcs .useuniv
;
; $B94F check succeeded,
; so now check for 'JSR $xx00' at $BDB9
;
lda MaybeBD
ldx #$B9
ldy #$02
dey ; Y=2
jsr CompareMemory
!byte $20,00
bcc .x5
bcc .notVerbViper
;
; Check for RWTS variant that has extra code before
; If $BDB9 check failed, check for RWTS variant that has extra code before
; JSR $B800 e.g. Verb Viper (DLM), Advanced Analogies (Hartley)
; (usable)
;
.x4 lda #$BD ; check for "JSR $xx00" at $BDC5
ldx #$C5
ldy #$02
ldx #$C5 ; check for 'JSR $xx00' at $BDC5
jsr CompareMemory
!byte $20,00
bcc .x5 ; passport-test-suite/Analogies Tutorial.woz [C=0] matches
jmp UseUniversal ; give up tracing; this RWTS is unsupported
bcs .useuniv ; passport-test-suite/Analogies Tutorial.woz [C=0] here
.notVerbViper
;
; Check for RWTS variant that uses non-standard address for slot
; LDX $1FE8 e.g. Pinball Construction Set (1983)
; we don't like that one
; (not usable)
;
.x5 lda #$BE ; check for "LDX $1FE8" at $BE43
lda MaybeBE ; check for 'LDX $1FE8' at $BE43
ldx #$43
ldy #$03
iny ; Y=3
jsr CompareMemory
!byte $AE,$E8,$1F
bcs .x6 ; passport-test-suite/Pinball Construction Set (Budgeco).woz [C=0] matches
jmp UseUniversal ; give up tracing; this RWTS is unsupported
bcc .useuniv ; passport-test-suite/Pinball Construction Set (Budgeco).woz [C=0] matches
;
; Check for Milliken protection routine in late-stage boot
; (affects readable/ignoreable sector map, so must ID now)
;
.x6 lda #$B7 ; check for "JMP $9B03" at $B747
lda MaybeB7 ; check for 'JMP $9B03' at $B747
ldx #$47
ldy #$03
jsr CompareMemory
!byte $4C,$03,$9B
bcs .x6b ; passport-test-suite/Tangram Puzzler.woz [C=0] matches
bcs .notMilliken ; passport-test-suite/Tangram Puzzler.woz [C=0] matches
jsr IDMilliken
bcs .x6b
lda #s_milliken
bcs .notMilliken
lda #$0A
sta gDisplayBytes
jsr PrintByID
!byte s_milliken
lda #kSectorOptional
sta T02S05
.notMilliken
;
; Try to initialize the "current track" variable like the bootloader would --
; Check for Didatech decryption routine
; (affects readable/ignoreable sector map, so must ID now)
;
lda MaybeBC
ldx #$E1
ldy #$0A
jsr CompareMemory
!byte $A2,$04
!byte $A0,$05
!byte $A9,$96
!byte $59,$00,$08
!byte $99
bcs .notDidatech ; passport-test-suite/Crosscountry Canada.woz [C=0] matches
lda #$07
sta gDisplayBytes
jsr PrintByID
!byte s_didatech
lda #kSectorOptional
sta T02S07
lda #TRUE
sta gIsDidatech
.notDidatech
;
; Try to initialize the 'current track' variable like the bootloader would --
; required for some disks that use a strange location for this variable
; e.g. Super Taxman II
;
.x6b lda #$B7 ; check for "LDA #$00 / STA $....,X / STA $....,X / JSR $..93" at $B730
lda MaybeB7 ; check for 'LDA #$00 / STA $....,X / STA $....,X / JSR $..93' at $B730
sta .taxman+2
ldx #$30
ldy #$0A
jsr CompareMemory
@ -182,21 +240,23 @@ _Inspect1a
!byte $9D,WILDCARD,WILDCARD
!byte $9D,WILDCARD,WILDCARD
!byte $20,$93
bcs .x7 ; passport-test-suite/Super Taxman II.woz [C=0] matches
bcs .notTaxman ; passport-test-suite/Super Taxman II.woz [C=0] matches
ldy #$07
.x6c lda $B730,y
.taxman lda $B730,y ; SMC (high byte)
sta .trackpointer,y
dey
bpl .x6c
bpl .taxman
ldx #$06
.trackpointer
LDA #$00
STA $04F8,X
STA $0478,X
.notTaxman
;
; Check for Adventure International RWTS (sets flag for patcher)
; Check for Adventure International RWTS
; (sets flag to activate expensive search later)
;
.x7 lda #$B9 ; check for code at $B936
lda MaybeB9
ldx #$36
ldy #$0A
jsr CompareMemory
@ -204,38 +264,72 @@ _Inspect1a
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $10,$FB ; BPL -$FB
!byte $C9,$00 ; CMP #$00
bcs + ; passport-test-suite/S.A.G.A. 6.woz [C=0] matches
bcs .notAdvInt ; passport-test-suite/S.A.G.A. 6.woz [C=0] matches
lda #TRUE
sta gAdventureInternational
.notAdvInt
;
; Check for Phoenix bootloader/RWTS
; (implies possible secondary protection elsewhere)
; (sets flag to activate expensive search later)
;
+ jsr IDPhoenix
bcs +
jsr IDPhoenix
bcs .notPhoenix
lda #TRUE
sta gIsPhoenix
.notPhoenix
;
; Turn off drive recalibration
; Check for MECC DOS loaded in low memory
; (sets flag to activate expensive search later)
;
+ lda jCallRWTS+2; check for code at $BDD2
lda $08FE
cmp #$36
bne .notMECCSwapper
lda $371A
cmp #$0D
bne .notMECCSwapper ; passport-test-suite/Word Wizards v1.0.woz [Z=1] here
lda #TRUE
sta gPossibleMECCSwapper
.notMECCSwapper
;
; Check for unusual init at $BFC8
; (sets flag to activate expensive search later,
; and marks a certain sector optional)
;
lda $08FE
cmp #$B7
bne .notWoodbury
lda $BFCC
cmp #$10
bne .notWoodbury ; passport-test-suite/Playwriter.woz [Z=1] here
lda #TRUE
sta gPossibleWoodbury
lda #kSectorOptional
sta T14S06
.notWoodbury
;
; Turn off drive recalibration, if possible
;
lda MaybeBD ; check for code at $BDD2
sta .recal1+2
sta .recal2+2
ldx #$D2
ldy #$06
jsr CompareMemory
!byte $A9,$60 ; LDA #$60
!byte $20,$95,$BE; JSR $BE95
!byte $CE ; DEC $xxxx
bcs +
bcs .norecal
lda #$B0
.x8 sta $BDD2
.recal1 sta $BDD2 ; SMC (high byte)
lda #$30
.x9 sta $BDD3
.recal2 sta $BDD3 ; SMC (high byte)
.norecal
;
; Check for Infocom disk (need to massage RWTS a little)
; Check for Infocom RWTS (need to massage RWTS a little)
;
+ lda $08FE
lda $08FE
cmp #$23
bne + ; passport-test-suite/Planetfall r26.woz [Z=1] matches
bne .notInfocom; passport-test-suite/Planetfall r26.woz [Z=1] matches
lda #$AD ; allow $AD..$FF for third data prologue nibble
sta $24FC
lda #$90
@ -245,12 +339,12 @@ _Inspect1a
sta $2BB8,y
dey
bpl -
.notInfocom
;
; Check for Micro Fun RWTS swapper (called from outside RWTS so
; we need to call it ourselves)
+ ldx jCallRWTS+2
dex
txa
; Check for Micro Fun RWTS swapper
; (called from outside RWTS so we need to call it ourselves)
;
lda MaybeBC
ldx #$61
ldy #$0B
jsr CompareMemory
@ -259,14 +353,44 @@ _Inspect1a
!byte $A9,$B5
!byte $8D,$FC,$B8
!byte $60
bcs + ; passport-test-suite/Crown of Arthain.woz [C=0] matches
bcs .notFun ; passport-test-suite/Crown of Arthain.woz [C=0] matches
jsr $BC61
.notFun
;
; Check for Micro Learn RWTS
; (uses per-disk zero page values within RWTS)
;
lda MaybeB7
cmp #$B7
bne .notLearn
ldx #$38
ldy #$08
jsr CompareMemory
!byte $A9,WILDCARD
!byte $85,$31
!byte $A9,WILDCARD
!byte $85,$D6
bcs .notLearn ; passport-test-suite/U.S. Constitution Tutor.woz [C=0] matches
lda #$C9
sta $B8E6
sta $B8F0
sta $B934
sta $B954
sta $B95E
sta $B990
lda $B739
sta $B8F1
sta $B955
sta $B991
lda $B73D
sta $B8E7
sta $B935
sta $B95F
.notLearn
;
; Check for alternate RWTS entry point (e.g. Swordthrust)
;
+ lda jCallRWTS+2
sec
sbc #$06
lda MaybeB7
ldx #$75
ldy #(@end_swordthrust-@begin_swordthrust)
jsr CompareMemory
@ -282,7 +406,7 @@ _Inspect1a
PLA
JSR $BD00
@end_swordthrust
bcs + ; passport-test-suite/Swordthrust 1.woz [C=0] matches
bcs .notSwordthrust ; passport-test-suite/Swordthrust 1.woz [C=0] matches
stx jCallRWTS+1; set new RWTS entry point to $B775
lda #$B7
sta jCallRWTS+2
@ -290,8 +414,45 @@ _Inspect1a
sta $B779 ; which isn't true, so change the code to look at
lda #>gTrack ; Passport's gTrack instead
sta $B77A
.notSwordthrust
;
; Check for Earthware reverse RWTS swapper
; (need to pre-swap RWTS then swap it back at T02,S04)
;
lda MaybeB6
ldx #$89
ldy #$0E
jsr CompareMemory
!byte $BD,$8C,$C0
!byte $10,$FB
!byte $C9,$AD
!byte $D0,$13
!byte WILDCARD,WILDCARD
!byte $9D,$8D,$C0
bcc .yesEarthware ; passport-test-suite/Zoo Master.woz [C=0] matches
ldx #$8C
jsr CompareMemory
!byte $BD,$8C,$C0
!byte $10,$FB
!byte $C9,$AD
!byte $D0,$F4
!byte $A9,$F8
!byte $3D,$8C,$C0
bcs .notEarthware ; passport-test-suite/Zoo Master rev. 2.woz [C=0] matches
.yesEarthware
lda #$BD
sta $B8F6
lda $B8F7
sta EarthwareSwapperLo+1
lda #$8C
sta $B8F7
lda #$C0
sta $B8F8
lda #kSectorCustomEarthware
sta T02S04
.notEarthware
;
; good to go
;
+ jmp ADStyle ; use this RWTS to read the disk
; /!\ execution falls through to ADStyle
}

View File

@ -4,26 +4,26 @@
;-------------------------------
; IDSpecDel
; returns C clear if "Special Delivery" bootloader
; detected in T00,S00
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if Special Delivery bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
IDSpecDel
lda #$00
tax
ldy #$58
!macro IDSpecDel {
ldy #$08
jsr compare
!byte $02,$90,$4A,$C6,$27,$BD,$31,$09
!byte $49,$B0,$48,$C6,$3D,$98,$C8,$48
!byte $CE,$00,$08,$A9,$20,$C6,$27,$48
!byte $51,$26,$91,$26,$AA,$A5,$27,$85
!byte $32,$CE,$00,$08,$A8,$B5,$33,$84
!byte $29,$84,$21,$8A,$A2,$17,$86,$31
!byte $D5,$33,$A6,$2B,$5D,$31,$09,$85
!byte $29,$5D,$32,$09,$C6,$3D,$85,$28
!byte $5D,$33,$09,$85,$48,$A0,$2B,$84
!byte $20,$C6,$40,$30,$3E,$24,$40,$30
!byte $33,$24,$24,$24,$24,$40,$40,$40
rts
!byte $02
!byte $90,$4A
!byte $C6,$27
!byte $BD,$31,$09
; passport-test-suite/Ernie's Quiz.woz [C=0] matches
}
;-------------------------------
; TraceSpecDel
@ -32,13 +32,24 @@ IDSpecDel
; format on tracks 0-2)
;-------------------------------
TraceSpecDel
ldx #$0F
lda #$FF
- sta precheck_sectors, x
dex
bpl -
inc precheck_sectors
lda #$07
inc precheck_sectors+1
jsr PreCheckT00
jsr ClearTSBuffer
lda #$00 ; set a marker to see if entire
sta $3FFF ; RWTS loads successfully later
;; lda #$00 ; save zero page before trace
ldx #$0A
ldy #$01
jsr CopyMemory
jsr CopyMemory1
jsr MoveT00PakHigh
lda #<TraceSpecDel2
ldx #>TraceSpecDel2
@ -86,15 +97,13 @@ TraceSpecDel4
lda #$0B
ldx #$00
ldy #$03
jsr compare ; if $1B00 ==
jsr compare3 ; if $1B00 ==
!byte $4C,$4D,$2A
SDfail
php
lda #$0A ; restore zero page from before trace
ldx #$00
ldy #$01
jsr CopyMemory
jsr CopyMemory1
plp
bcc SDsuccess
@ -128,20 +137,16 @@ SDsuccess
;
lda #$13
ldx #$14
ldy #$01
jsr CopyMemory
jsr CopyMemory1
lda #$12
ldx #$13
ldy #$01
jsr CopyMemory
jsr CopyMemory1
lda #$11
ldx #$12
ldy #$01
jsr CopyMemory
jsr CopyMemory1
lda #$10
ldx #$11
ldy #$01
jsr CopyMemory
jsr CopyMemory1
; $1B00-$1FFF is real code and in the right place
; but we should clear the rest of T00 so we're not
@ -161,8 +166,8 @@ SDsuccess
bit gMode ; don't say we're writing a bootloader in verify-only mode,
bpl + ; that's scary
lda #s_bootwrite
jsr PrintByID
!byte s_bootwrite
+
; now manually write out track 0 with Standard Delivery
; bootloader
@ -198,8 +203,7 @@ SDsuccess
!byte $C9,$AD,$90,$E5
lda #$18
ldx #$38
ldy #$01
jsr CopyMemory
jsr CopyMemory1
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
lda #$C9
sta $38B6

31
src/id/tsr.a Normal file
View File

@ -0,0 +1,31 @@
;-------------------------------
; IDTSR
; identify TSR bootloader
;
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if TSR bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDTSR {
ldy #$05
jsr compare
!byte $01
!byte $A5,$27
!byte $C9,$09
bcs @notTSR
ldx #$FE
jsr compare2
!byte $B0,$0F
bcs @notTSR
ldx #$1C
jsr compare3
!byte $20,$B3,$08
; passport-test-suite/Dawn Patrol.woz [C=0] matches
@notTSR
tax
}

View File

@ -3,30 +3,24 @@
; identify and print volume name if found
; (ProDOS and Pascal supported)
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; gIsProDOS or gIsPascal is true
; out: C clear if disk volume name was found and printed
; C set otherwise
; oVerflow always clear
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; gIsProDOS or gIsPascal is true
; out: all registers & flags clobbered
;-------------------------------
!zone {
IDVolumeName
; read T00,S0B (volume key block)
lda #$00
sta gTrack
sta cmp1
lda #$0B
sta gSector
ldx #$00
stx cmp1
ldy #$0B
tya
sta gDisplayBytes
clc
adc #BASEPAGE
sta gAddress+1
sta cmp1+1
jsr ReadSector
bcs .error
jsr ReadSectorXY
bcs .exit
lda gIsPascal
beq .pascal
@ -35,7 +29,7 @@ IDVolumeName
ldy #$04
lda (cmp1), y
cmp #$F1
bcc .error
bcc .exit
and #$0F
tax
lda #$05
@ -46,12 +40,12 @@ IDVolumeName
ldy #$02
lda (cmp1), y
cmp #$06
bne .error
bne .exit
ldy #$06
lda (cmp1), y
beq .error
beq .exit
cmp #$08
bcs .error ; passport-test-suite/Notecard Maker.woz [C=0] reaches here
bcs .exit ; passport-test-suite/Notecard Maker.woz [C=0] reaches here
tax
lda #$07
sta .offset+1
@ -60,8 +54,8 @@ IDVolumeName
.print
; X (now the volume name length) is preserved by the PrintByID call
lda #s_volumename
jsr PrintByID
!byte s_volumename
; print the volume name
.offset ldy #$d1 ; set at runtime
@ -73,10 +67,18 @@ IDVolumeName
bne -
lda #$8D
jsr PrintA
clc
!byte $24 ; hide next SEC
.error
sec
clv
rts
}
; while we're here, we check for a specific file that is
; always (!) in a specific place in the root directory
; (this will unlock a patcher with an expensive search)
lda #$0B
ldx #$7A
ldy #$06
jsr compare
!byte $4C,$4F,$57,$44,$4F,$53
bcs .exit
lda #TRUE
sta gIsLowDOS
lda #kSectorOptional
sta T00S0C
.exit rts

View File

@ -1,205 +0,0 @@
;-------------------------------
; ScanForDiskII
; scan all slots for things that
; look like Disk II cards
;
; out: all registers clobbered
; all flags clobbered
; DiskIIArray filled with 00 or FF
;-------------------------------
!zone {
ScanForDiskII
lda #$00
sta cmp1
ldx #$07
.fingerprint
txa
ora #$C0
sta cmp1+1
ldy #$01
lda (cmp1),y
cmp #$20
bne .next
ldy #$03
lda (cmp1),y
bne .next
ldy #$05
lda (cmp1),y
cmp #$03
bne .next
ldy #$FF
lda (cmp1),y
bne .next
tya
sta DiskIIArray-1,x
.next
dex
bne .fingerprint
rts
}
!zone {
ScanForRAMDisk
lda #$00
sta iunit
- lda iunit
clc
adc #$10
sta iunit
beq .done
cmp #$80
beq -
pha
and #$70
lsr
lsr
lsr
lsr
tay
pla
ldx DiskIIArray-1,y
bne -
jsr GetVolumeName
bcs -
lda OnlineReturn
beq -
jsr GetVolumeInfo
;watch for RAM disk type
lda filetype
and #$0F
cmp #$0F
bne -
;check for RAM[x] by name
ldy OnlineReturn
cpy #4
beq +
cpy #5
bne -
dey
+
-- lda SlashRAM-1,y
cmp VolumeName-1,y
bne -
dey
bne --
;check free space
;need at least $118 blocks
sec
lda auxtype
sbc blocks
tax
lda auxtype+1
sbc blocks+1
cmp #1
bcc -
bne +
cpx #$18
bcc -
+ lda #TRUE
sta gUsingRAMDisk
.done
rts
SlashRAM !byte $2F, $52, $41, $4D
}
;-------------------------------
; LoadPrefs
; load preferences from file
;
; in: ProDOS must be in memory
;-------------------------------
LoadPrefs
lda #$FF
sta PREFSVER
jsr LoadFile1Shot
!word PREFSFILE
!word PREFSVER
!word PREFSREADLEN
!word PREFSBUFFER
jsr ValidatePrefs
bcc .goodprefs
jmp SavePrefs
.goodprefs
rts
;-------------------------------
; LoadFile1Shot
; load a file into memory all at once,
; using ProDOS MLI calls
;
; in: stack contains 8 bytes of parameters:
; +1 address of pathname
; +3 address of data buffer (to receive file contents)
; +5 [word] maximum length of data to read
; +7 address of ProDOS file buffer
; out: if C set, load failed and A contains error code
; from open or read
; if C clear, load succeeded and ($02) contains
; data loaded from file
; all other flags clobbered
; all registers clobbered
; stack set to next instruction after parameters
;-------------------------------
!zone {
LoadFile1Shot
clc
pla
sta $00
adc #$08
tax
pla
sta $01
adc #$00
pha
txa
pha
ldy #$01
lda ($00),y ; lo byte of pathname
sta mliparam+1
iny
lda ($00),y ; hi byte of pathname
sta mliparam+2
ldy #$07
lda ($00),y ; lo byte of ProDOS file buffer
sta mliparam+3
iny
lda ($00),y ; hi byte of ProDOS file buffer
sta mliparam+4
jsr OpenFile
bcs .loadfile1s ; C set on error
pha ; push file reference number
ldy #$03
lda ($00),y ; lo address of data buffer
sta mliparam+2
iny
lda ($00),y ; hi address of data buffer
sta mliparam+3
iny
lda ($00),y ; lo data length
sta mliparam+4
iny
lda ($00),y ; hi data length
sta mliparam+5
pla ; pull file reference number
jsr ReadFile
php ; save flags from readfile
pha
jsr CloseFile ; always close whether read worked or not
pla
plp ; restore flags from readfile
; (so caller gets codes from read attempt,
; not close)
.loadfile1s
rts
}

View File

@ -1,22 +1,25 @@
KEY = $C000
STROBE = $C010
!zone {
;-------------------------------
; WaitForKey
; wait forever for a key
; if the key pressed is '*', break to the monitor
; with a message on how to get back
;
; in: none
; out: A = uppercase version of key pressed
; other flags and registers clobbered
;-------------------------------
WaitForKey
bit STROBE
.k lda KEY
bpl .k
- lda KEY
bpl -
bit STROBE
cmp #"*"
bne .noast
bne +
jsr TEXT
lda #s_reset
jsr PrintByID
!byte s_reset
jmp $FF59
.noast
cmp #$E1
+ cmp #$E1
bcc +
and #$DF ; force uppercase
+
rts
}
+ rts

View File

@ -1,92 +1,100 @@
;-------------------------------
; YE OLDE GRAND UNIFIED MEMORY MAP
;
; 0200..03FF - clobbered by DOS 3.2 tracer (and other supported 13-sector disks like Choplifter)
; 0200..02CB - clobbered by exodecrunch
; 02D8..038D - clobbered by Optimum reader
; 0300..0395 - clobbered by DOS 3.3 tracer
; 0800..08FF - clobbered by all boot tracers and RAM disk
; 0900..09FF - clobbered by Special Delivery tracer and RAM disk
; 0A00..0AFF - backup of zero page during Special Delivery tracer, used by RAM disk
; 0B00..0BFF - used by RAM disk
; 0C00..0CFF - clobbered by Special Delivery tracer
; 0D00..0EFF - unused
; 0F00..0FFF - backup of page $BF (SaveProDOS, SwapProDOS)
; 0CD0..0EFF - sector map
; 0F00..0FFF - backup of page $BF (SwapProDOS)
; 1000..1FFF - data buffer for current track
; 2000..35FF - clobbered by Special Delivery tracer
; 3600..3FFF - clobbered by lomem DOS 3.3 / Special Delivery tracers
; 2600..26FF - clobbered by all boot tracers (copy of C600)
; 3600..3FFF - clobbered by lomem DOS 3.2/3.3 tracers, Special Delivery tracer
; 4000..B1FF - program code
; B200..BFFF - clobbered by DOS boot tracer (RDOS is B200+, DOS 3.x is B600+)
;-------------------------------
; /!\ execution falls through from CreateFileOnHardDisk
;-------------------------------
; SaveProDOS
; saves memory pages used by ProDOS
; pages $BF
; in: none
; out: all flags and registers clobbered
; SwapProDOS
; saves/restores memory used by ProDOS ($BF00..$BFFF)
; in: none
; out: all flags and registers preserved
;-------------------------------
!zone {
SaveProDOS
SaveGlobal
SwapProDOS
php
pha
lda #$BF
ldx #$0F
ldy #$01
;;jsr CopyMemory ; fall through
}
sec
jsr SwapMemory
pla
plp
- rts
;-------------------------------
; MoveT00PakLow/MoveT00PakHigh
;
; Copy compressed blob of track 0 patchers
; from low memory to high memory or vice versa.
; Each entry point is always safe to call,
; e.g. if the blob is already low and you call
; MoveT00PakLow, it just exits.
;
; in: none
; out: if blob needs to be copied, exits via CopyMemory
; if no action, all registers preserved
;-------------------------------
MoveT00PakLow
bit T00PakPtr+1
bpl - ; already low
lda #$B2
ldx #$32
bne + ; always branches
MoveT00PakHigh
bit T00PakPtr+1
bmi - ; already high
lda #$32
ldx #$B2
+ stx T00PakPtr+1
ldy #$0D
!byte $2C ; hide next LDY
; /!\ execution falls through here
CopyMemory1
ldy #$01
; /!\ execution falls through here
;-------------------------------
; CopyMemory
; in: A = source address (high)
; X = destination address (high)
; Y = number of pages to copy
; out: all flags and registers clobbered
; in: A = source address (high)
; X = destination address (high)
; Y = number of pages to copy
; out: Z = 1
; X = 0
; Y = 0
; all other flags and registers clobbered
;-------------------------------
!zone {
CopyMemory
sta .source+2
stx .dest+2
sta @source+2
stx @dest+2
ldx #$00
.source lda $FF00,x
.dest sta $FF00,x
@source lda $FF00,x
@dest sta $FF00,x
inx
bne .source
inc .source+2
inc .dest+2
bne @source
inc @source+2
inc @dest+2
dey
bne .source
bne @source
rts
}
;-------------------------------
; ClearTSBuffer
; clear the $1000 byte memory buffer
; used to store the current track's data
; in: none
; out: all flags and registers clobbered
;-------------------------------
ClearTSBuffer
lda #BASEPAGE
ldx #$00
ldy #$10
;; jmp ClearMemory ; fall through
;-------------------------------
; ClearMemory
; in: A = source address (high)
; X = value to set
; Y = number of pages
; out: all flags and registers clobbered
;-------------------------------
!zone {
ClearMemory
sta .dest+2
.dest stx $FF00
inc .dest+1
bne .dest
inc .dest+2
dey
bne .dest
rts
}
;-------------------------------
; ReorderBuffer - convert data
@ -98,28 +106,12 @@ ClearMemory
; out: all flags clobbered
; all registers clobbered
;-------------------------------
!zone {
ReorderBuffer
lda #BASEPAGE+1
ldx #BASEPAGE+$0E
ldy #$07
clc
bcc SwapMemory ; branch always
}
;-------------------------------
; SwapProDOS
; saves/restores memory pages used by ProDOS
; pages $BF
; in: none
; out: all flags and registers clobbered
;-------------------------------
SwapProDOS
lda #$BF
ldx #$0F
ldy #$01
sec
;;jsr SwapMemory ; fall through
; /!\ execution falls through here
;-------------------------------
; SwapMemory
@ -129,37 +121,35 @@ SwapProDOS
; C = dest direction (set: +, clear: -)
; out: all flags and registers clobbered
;-------------------------------
!zone {
SwapMemory
sta .source1+2
sta .source2+2
stx .dest1+2
stx .dest2+2
sta @source1+2
sta @source2+2
stx @dest1+2
stx @dest2+2
lda #$FF
adc #0
ora #1
sta .destadjust+1
sta @destadjust+1
ldx #$00
.source1 lda $FF00,x
@source1 lda $FF00,x
pha
.dest1 lda $FF00,x
.source2 sta $FF00,x
@dest1 lda $FF00,x
@source2 sta $FF00,x
pla
.dest2 sta $FF00,x
@dest2 sta $FF00,x
inx
bne .source1
inc .source1+2
inc .source2+2
lda .dest1+2
bne @source1
inc @source1+2
inc @source2+2
lda @dest1+2
clc
.destadjust
@destadjust
adc #$D1
sta .dest1+2
sta .dest2+2
sta @dest1+2
sta @dest2+2
dey
bne .source1
bne @source1
rts
}
;-------------------------------
; ReorderLogicalToPhysical - reorder pages in
@ -186,7 +176,6 @@ SwapMemory
; in: track buffer has data in logical sector order
; out: A,X,Y clobbered
;-------------------------------
!zone {
ReorderLogicalToPhysical
ldy #$00
- ldx $1800,y
@ -219,4 +208,3 @@ ReorderLogicalToPhysical
iny
bne -
rts
}

36
src/memory.clear.a Normal file
View File

@ -0,0 +1,36 @@
; /!\ execution falls through from ChangeTrack
;-------------------------------
; ClearTSBuffer
; clear the $1000 byte memory buffer
; used to store the current track's data
; in: none
; out: Z = 1
; X preserved
; Y = 0
; all other flags and registers clobbered
;-------------------------------
ClearTSBuffer
lda #BASEPAGE
ldx #$00
ldy #$10
; /!\ execution falls through here
;-------------------------------
; ClearMemory
; in: A = source address (high)
; X = value to set
; Y = number of pages
; out: Z = 1
; X preserved
; Y = 0
; all other flags and registers clobbered
;-------------------------------
ClearMemory
sta @dest+2
@dest stx $FF00
inc @dest+1
bne @dest
inc @dest+2
dey
bne @dest
rts

737
src/mli.a
View File

@ -3,9 +3,9 @@ CMD_CREATE = $C0 ; create new file
CMD_DESTROY = $C1 ; delete a file
CMD_GETFILEINFO = $C4 ; get file (or volume) info
CMD_ONLINE = $C5 ; check online volume(s)
CMD_SETPREFIX = $C6 ; change default pathname prefix
;CMD_SETPREFIX = $C6 ; change default pathname prefix
CMD_OPEN = $C8 ; open a file
CMD_NEWLINE = $C9 ; set line-by-line read mode
;CMD_NEWLINE = $C9 ; set line-by-line read mode
CMD_READ = $CA ; read an open file
CMD_WRITE = $CB ; write to an open file
CMD_CLOSE = $CC ; close an open file
@ -17,684 +17,163 @@ PC_CREATE = $07
PC_DESTROY = $01
PC_GETFILEINFO = $0A
PC_ONLINE = $02
PC_SETPREFIX = $01
;PC_SETPREFIX = $01
PC_OPEN = $03
PC_NEWLINE = $03
;PC_NEWLINE = $03
PC_READ = $04
PC_WRITE = $04
PC_CLOSE = $01
PC_SETMARK = $02
PC_SETEOF = $02
PRODOSMLI = $BF00 ; [callable] MLI entry point
!ct "lcase.ct"
RAMFileName !text "PASSPORTTMP.DSK"
RAMFileName_e
; MLI constants
FULL_ACCESS = $C3
; MLI error codes
MLI_IOERR = $27
MLI_NODEV = $28
MLI_WRITEPROT = $2B
ERR_FNF = $46
ERR_EOF = $4C
;-------------------------------
; WriteTrackMLI - write the contents of
; BASEPAGE data buffer to disk
; in: @SLOT contains (slot x 16) + $30
; @DRIVE contains drive + $30
; @gTrack contains track number
; @BASEPAGE contains data to write ($1000 bytes)
; out: if C set, write failed (A contains MLI error code)
; if C clear, write succeeded (A is clobbered)
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
WriteTrackMLI
jsr SwapProDOS
lda gUsingRAMDisk
beq +
jsr ReorderBuffer
+ lda DRIVE ; ProDOS "unit number" is
sec
sbc #$31
lsr ; DSSS0000, where D is the
lda #00 ; drive number (0=drive 1,
ror ; 1=drive 2) and SSS is
; the slot number (1-7).
; "Beneath Apple ProDOS"
; page 6-19
sta mliparam+1
lda SLOT
asl
asl
asl
asl
ora mliparam+1
sta mliparam+1
lda #$00
sta mliparam+2 ; lo byte of data buffer
lda #$08
sta .blockcount
lda gTrack
asl
asl
asl
sta mliparam+4 ; lo byte of block number
rol
and #$01
sta mliparam+5 ; hi byte of block number
lda #BASEPAGE ; hi byte of data buffer
sta mliparam+3
.writeloop
lda gUsingRAMDisk
beq +
lda #$81 ; 'write block' command
ldy #$03 ; parameter count
jsr mli
bcs .writeerr
- inc mliparam+3 ; 2 pages per block
inc mliparam+3
inc mliparam+4
dec .blockcount
bne .writeloop
clc
bcc .writedone
+ jsr WriteToRAMFile
bcc -
.writeerr
.writedone
php
pha
lda gUsingRAMDisk
beq +
jsr ReorderBuffer
+ jsr SwapProDOS
pla
plp
rts
.blockcount !byte $FF
}
;-------------------------------
; SaveFile1Shot
; save a file to disk all at once,
; using ProDOS MLI calls
;
; in: stack contains 11 ($0B) bytes of parameters:
; +1 address of pathname
; +3 [byte] file type
; +4 [word] aux file type
; +6 address of data buffer
; +8 [word] length of data buffer
; +A address of ProDOS file buffer
; out: if C set, save failed and A contains error code
; from open or write
; if C clear, save succeeded
; all other flags clobbered
; all registers clobbered
; stack set to next instruction after parameters
;-------------------------------
!zone {
SaveFile1Shot
clc
pla
sta $00
adc #$0B
tax
pla
sta $01
adc #$00
pha
txa
pha
ldy #$01
lda ($00),y ; lo byte of pathname
sta mliparam+1
iny
lda ($00),y ; hi byte of pathname
sta mliparam+2
jsr DeleteFile ; don't care if this fails
ldy #$03
lda ($00),y ; file type
sta mliparam+4
iny
lda ($00),y ; lo byte of aux file type
sta mliparam+5
iny
lda ($00),y ; hi byte of aux file type
sta mliparam+6
jsr CreateFile
bcs .savefile1s
ldy #$0A
lda ($00),y ; lo byte of ProDOS file buffer
sta mliparam+3
iny
lda ($00),y ; hi byte of ProDOS file buffer
sta mliparam+4
jsr OpenFile
bcs .savefile1s
pha ; push file reference number
ldy #$06
lda ($00),y ; lo address of data buffer
sta mliparam+2
iny
lda ($00),y ; hi address of data buffer
sta mliparam+3
iny
lda ($00),y ; lo data length
sta mliparam+4
iny
lda ($00),y ; hi data length
sta mliparam+5
pla ; pull file reference number
jsr WriteFile
php ; save flags from writefile
pha
jsr CloseFile ; always close whether write worked or not
pla
plp ; restore flags from write
; (so caller gets codes from write attempt,
; not close)
.savefile1s
rts
}
ERR_EXIST = $47
;-------------------------------
; open file via ProDOS MLI
;
; in: caller has filled @mliparam with address of
; in: ProDOS is in memory
; caller has filled @mliparam with address of
; pathname, address of data buffer, and maximum
; data length
; out: if C set, open failed and A contains error code
; if C clear, open succeeded and A contains
; out: if C set, open failed and A contains error code
; if C clear, open succeeded and A contains
; file reference number
; preserves X
; ProDOS is in memory
;-------------------------------
!zone {
OpenFile
lda #CMD_OPEN ; MLI command
ldy #PC_OPEN ; number of parameters for 'open' command
jsr mli
bcs .openfile
bcs +
lda refnum ; caller should save file reference number
; as this memory location may be
; overwritten by later MLI calls
.openfile
rts
}
;-------------------------------
; set line-by-line mode via ProDOS MLI
;
; in: A = file reference number
; out: if C set, set failed and A contains error code
; if S clear, set succeeded and A contains the same
; file reference number that was passed in
;-------------------------------
lbl_mask = $7F
lbl_cr = $0D
!zone {
SetLineByLine
sta mliparam+1 ; store file reference number
lda #lbl_mask ; accept high bit set or clear
sta mliparam+2
lda #lbl_cr ; carriage return character
sta mliparam+3
lda #CMD_NEWLINE ; MLI 'newline' command to set read mode
ldy #PC_NEWLINE ; number of parameters for 'newline' command
jsr mli
bcs .setlinebylin
lda mliparam+1 ; if no error, return file reference number
.setlinebylin
rts
}
+ rts
;-------------------------------
; read an open file via ProDOS MLI
;
; in: A = file reference number
; caller has filled @mliparam with address of
; in: ProDOS is in memory
; A = file reference number
; caller has filled @mliparam with address of
; data buffer and maximum data length
; out: if C set, read failed and A contains error code
; if C clear, read succeeded and A contains the same
; out: if C set, read failed and A contains error code
; if C clear, read succeeded and A contains the same
; file reference number that was passed in
; preserves X
; ProDOS is in memory
;-------------------------------
!zone {
ReadFile
sta mliparam+1 ; store file reference number
lda #CMD_READ ; MLI read command
ldy #PC_READ ; number of parameters for 'read' command
JsrMLIAndReturnPlus1
jsr mli
bcs .readfile
bcs +
lda mliparam+1 ; if no error, return file reference number
.readfile
rts
}
+ rts
;-------------------------------
; change file position in an open file via ProDOS MLI
;
; in: A = file reference number
; caller has filled @mliparam+2/+3/+4 with
; in: A = file reference number
; caller has filled @mliparam+2/+3/+4 with
; new file position
; out: if C set, set_mark call failed and A contains error code
; if C clear, set_mark call succeeded and A contains
; out: if C set, set_mark call failed and A contains error code
; if C clear, set_mark call succeeded and A contains
; the same file reference number that was passed in
; preserves X
;-------------------------------
!zone {
SetMark
sta mliparam+1 ; store file reference number
lda #CMD_SETMARK ; MLI set_mark command
ldy #PC_SETMARK ; number of params for 'set_mark' cmd
jsr mli
bcs .exit
lda mliparam+1 ; if no error, return file refnum
.exit rts
}
bne JsrMLIAndReturnPlus1 ; always branches
;-------------------------------
; write to an open file via ProDOS MLI
;
; in: A = file reference number
; caller has filled @mliparam with address of
; in: A = file reference number
; caller has filled @mliparam with address of
; data buffer and data length
; out: if C set, write failed and A contains error code
; if C clear, write succeeded and A contains the same
; out: if C set, write failed and A contains error code
; if C clear, write succeeded and A contains the same
; file reference number that was passed in
; preserves X
;-------------------------------
!zone {
WriteFile
sta mliparam+1 ; store file reference number
lda #CMD_WRITE ; MLI write command
ldy #PC_WRITE ; number of parameters for 'write' command
jsr mli
bcs .writefile
lda mliparam+1 ; if no error, return file reference number
.writefile
rts
}
bne JsrMLIAndReturnPlus1 ; always branches
;-------------------------------
; set file size in an open file via ProDOS MLI
;
; in: A = file reference number
; caller has filled @mliparam+2/+3/+4 with
; in: A = file reference number
; caller has filled @mliparam+2/+3/+4 with
; new file size
; out: if C set, set_eof call failed and A contains error code
; if C clear, set_eof call succeeded and A contains
; out: if C set, set_eof call failed and A contains error code
; if C clear, set_eof call succeeded and A contains
; the same file reference number that was passed in
; preserves X
;-------------------------------
!zone {
SetEOF
sta mliparam+1 ; store file reference number
lda #CMD_SETEOF ; MLI set_eof command
ldy #PC_SETEOF ; number of params for 'set_eof' cmd
jsr mli
bcs .exit
lda mliparam+1 ; if no error, return file refnum
.exit rts
}
;-------------------------------
; close an open file
; in: A = file reference number
; out: if error, C set and A contains error code
; if success, C clear
;-------------------------------
CloseFile
sta mliparam+1 ; store file reference number
lda #CMD_CLOSE ; MLI close command
ldy #PC_CLOSE ; number of parameters for 'close' command
jsr mli
rts
;-------------------------------
; create a file via ProDOS MLI
; always sets access bits to $C3 (full access)
; always sets creation to 0 (current date/time)
; always sets storage type to 1 (file)
; in: caller has filled @mliparam
; with address of pathname,
; file type, aux file type
; out: if error, C set and A contains error code
; if success, C clear
;-------------------------------
accessbits = $C3 ; full access
CreateFile
lda #accessbits
sta mliparam+3 ; access bits (full access)
ldy #1
sty mliparam+7 ; storage type (file)
dey
sty mliparam+8 ; creation date (current)
sty mliparam+9
sty mliparam+10 ; creation time (current)
sty mliparam+11
lda #CMD_CREATE ; MLI create command
ldy #PC_CREATE ; number of parameters for 'create' command
jsr mli
rts
;-------------------------------
; delete a file using ProDOS MLI
; in: caller has filled @mliparam
; with address of pathname
; out: if error, C set and A contains error code
; if success, C clear
;-------------------------------
DeleteFile
lda #CMD_DESTROY ; MLI destroy command
ldy #PC_DESTROY ; number of parameters for 'destroy' command
jsr mli
rts
;-------------------------------
; CreateRAMFile - create image file on RAM disk
; if RAM disk is in use
; in: nothing (assumes that prefix is set to /RAM)
; out: if C set, write failed (A contains MLI error code)
; if C clear, write succeeded (A is clobbered)
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
CreateRAMFile
lda gUsingRAMDisk
bne .done
;existing file being reused?
lda gRAMDiskRef
bne .done
;no, create a new one
jsr SwapProDOS
lda OnlineReturn
tay
clc
adc #(RAMFileName_e-RAMFileName)+1
sta RAMPath
tax
lda #$2F
sta RAMPath+1,y
- lda OnlineReturn,y
sta RAMPath,y
dey
bne -
ldy #(RAMFileName_e-RAMFileName)
- lda RAMFileName-1,y
sta RAMPath,x
dex
dey
bne -
jsr DeleteRAMFile
jsr CreateFile
bcs .createfail
lda #0
sta mliparam+3
lda #8
sta mliparam+4
jsr OpenFile
bcs .openfail
sta gRAMDiskRef
;140kb
ldx #0
stx mliparam+2
ldx #$30
stx mliparam+3
ldx #2
stx mliparam+4
jsr SetEOF
;update file buffer array
php
jsr SaveGlobal
plp
bcc .restore
lda gRAMDiskRef
jsr CloseFile
.openfail
pha
jsr DeleteRAMFile
pla
sec
.createfail
ldx #FALSE
stx gUsingRAMDisk
.restore
php
pha
jsr SwapProDOS
pla
plp
.done
rts
RAMPath !byte $d1
!fill 17
!fill RAMFileName_e-RAMFileName
}
;-------------------------------
; WriteToRAMFile - write memory to image file on RAM disk
; if RAM disk is in use
; in: called has filled @mliparam
; with block number and write address
; out: if error, C set and A contains error code
; if success, C clear
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
WriteToRAMFile
lda mliparam+2
pha
lda mliparam+3
pha
lda mliparam+4
sta .tmpparm4
asl
sta mliparam+3
lda mliparam+5
sta .tmpparm5
rol
sta mliparam+4
lda #0
sta mliparam+2
lda gRAMDiskRef
jsr SetMark
tax
pla
sta mliparam+3
pla
sta mliparam+2
txa
bcs .done
lda #0
sta mliparam+4
lda #2
sta mliparam+5
lda gRAMDiskRef
jsr WriteFile
.done
pha
lda .tmpparm4
sta mliparam+4
lda .tmpparm5
sta mliparam+5
pla
rts
.tmpparm4 !byte 0
.tmpparm5 !byte 0
}
;-------------------------------
; WriteRAMToDisk - write image file in RAM to physical disk
; if RAM disk is in use
; in: nothing
; out: if error, C set and A contains error code
; if success, C clear
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
WriteRAMToDisk
lda #0
sta mliparam+2
sta mliparam+3
sta mliparam+4
sta gTrack
jsr SwapProDOS
lda gRAMDiskRef
jsr SetMark
jsr SwapProDOS
jsr RestartProgress ; restart progress bar
lda #FALSE
sta gUsingRAMDisk ; prevent track write from calling RAM again
- lda #0
sta mliparam+2
sta mliparam+4
lda #$10
sta mliparam+3
sta mliparam+5
jsr SwapProDOS
lda gRAMDiskRef
jsr ReadFile
jsr SwapProDOS
jsr IncProgress
jsr WriteTrackMLI
bcs .exit
lda KEY
bmi .cancel
inc gTrack
lda gTrack
cmp #$23
bne -
jsr IncProgress
clc
.exit
lda #TRUE
sta gUsingRAMDisk
rts
.cancel
lda #TRUE
sta gUsingRAMDisk
jmp Cancel
}
;-------------------------------
; (Close)DeleteRAMFile - (close and) remove image file on RAM disk
; if RAM disk is in use
; in: nothing
; out: if error, C set and A contains error code
; if success, C clear
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
CloseDeleteRAMFile
lda gRAMDiskRef
jsr CloseFile
lda #0
sta gRAMDiskRef
DeleteRAMFile
lda #<RAMPath
sta mliparam+1
lda #>RAMPath
sta mliparam+2
jsr DeleteFile
.done
rts
}
;-------------------------------
; change current directory (set prefix)
; using ProDOS MLI
; in: caller has filled @mliparam
; with address of pathname
; out: if error, C set and A contains error code
; if success, C clear
;-------------------------------
SetPrefix
lda #CMD_SETPREFIX
ldy #PC_SETPREFIX
jsr mli
rts
bne JsrMLIAndReturnPlus1 ; always branches
;-------------------------------
; get volume name of disk in specific slot+drive
; in: A = unit number (DSSS0000)
; out: if no disk in drive or any MLI error, C set and A contains error code
; if disk found, C clear and @VolumeName contains volume name
; (length byte + up to 14 character name, no leading slash)
;
; in: A = unit number (DSSS0000)
; out: if no disk in drive or any MLI error, C set and A contains error code
; if disk found, C clear and @VolumeName contains volume name
; (up to 15 character name, no leading slash)
; note: lower 4 bits of @OnlineReturn contain length of @VolumeName
; preserves X
;-------------------------------
!zone {
GetVolumeName
sta mliparam+1
lda #<OnlineReturn
sta mliparam+2
lda #>OnlineReturn
sta mliparam+3
jsr Online
rts
OnlineReturn
!byte $FF
VolumeName
!byte $FF,$FF,$FF,$FF,$FF,$FF,$FF
!byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
}
; /!\ execution falls through here
;-------------------------------
; check if volume is online
; using ProDOS MLI
; in: caller has filled @mliparam
; with unit number
; out: if error, C set and A contains error code
; if success, C clear
;
; in: caller has filled @mliparam with unit number
; out: if error, C set and A contains error code
; if success, C clear
; preserves X
;-------------------------------
Online
lda #CMD_ONLINE
ldy #PC_ONLINE
jsr mli
rts
bne mli ; always branches
;-------------------------------
; query volume information
; using ProDOS MLI
; in: nothing (queries last fetched volume)
; out: if error, C set and A contains error code
; if success, C clear and MLI buffer is filled
; (access, file type, block count, dates and times)
;
; in: @OnlineReturn+@VolumeName contain the length+name of the volume to query
; (this will be true if you just called GetVolumeName)
; out: if error, C set and A contains error code
; if success, C clear and MLI buffer is filled
; (access, file type, block count, dates and times)
; clobbers X/Y
;-------------------------------
GetVolumeInfo
lda OnlineReturn
@ -713,10 +192,12 @@ GetVolumeInfo
sta mliparam+1
lda #>OnlineReturn
sta mliparam+2
; /!\ execution falls through here
GetFileInfo
lda #CMD_GETFILEINFO
ldy #PC_GETFILEINFO
jsr mli
rts
; /!\ execution falls through here
;-------------------------------
; low-level MLI wrapper
@ -736,12 +217,70 @@ mli sta mlicmd ; store command code
mlicmd !byte 00 ; command number
!word mliparam ; address of parameter table
rts
mliparam !byte $FE,$FE,$FE,$FE
filetype !byte $FE ; file type (set by MLI get_file_info)
auxtype ; auxiliary file type (2 bytes, set by MLI get_file_info)
refnum !byte $FE ; file refnum (set by MLI open)
mlilen !byte $FE,$FE ; file length (set by MLI read)
blocks !byte $FE,$FE ; blocks used (set by getvolumeinfo)
; member is also used by createfile
!byte $FE,$FE,$FE,$FE,$FE,$FE,$FE,$FE
; used by get_file_info
;-------------------------------
; close an open file
; in: ProDOS is in memory
; A = file reference number
; out: if error, C set and A contains error code
; if success, C clear
; preserves X
; ProDOS is in memory
;-------------------------------
CloseFile
sta mliparam+1 ; store file reference number
lda #CMD_CLOSE ; MLI close command
ldy #PC_CLOSE ; number of parameters for 'close' command
bne mli ; always branches
;-------------------------------
; DeleteFile
; delete a file using ProDOS MLI
;
; in: ProDOS is in memory
; caller has filled @mliparam+1 with address of pathname
; out: if error, C set and A contains error code
; if success, C clear
; preserves X
; ProDOS is in memory
;-------------------------------
DeleteFile
lda #CMD_DESTROY ; MLI destroy command
ldy #PC_DESTROY ; number of parameters for 'destroy' command
bne mli ; always branches
;-------------------------------
; CreateDir/CreateBinFile/CreateTxtFile
;
; create a directory or file via ProDOS MLI
; always sets access bits to $C3 (full access)
; always sets creation to 0 (current date/time)
; in: caller has filled @mliparam+1 with address of pathname
; out: if error, C set and A contains error code
; if success, C clear and A clobbered
; preserves X
;-------------------------------
CreateDir
lda #$0D
ldy #$0F
bne + ; always branches
CreateBinFile
ldy #$06
!byte $2C
CreateTxtFile
ldy #$04
lda #$01
+ pha ; storage type (directory or file)
sty mliparam+4 ; file type (directory or binary)
lda #FULL_ACCESS
sta mliparam+3 ; access bits (full access)
lda #0
ldy #6
- sta mliparam+5,y ; aux type (none) + creation datetime (current)
dey
bpl -
pla
sta mliparam+7 ; storage type (directory or file)
lda #CMD_CREATE ; MLI create command
ldy #PC_CREATE ; number of parameters for 'create' command
bne mli ; always branches

View File

@ -1,3 +1,21 @@
; utility functions for common cases
; (from the caller's perspective, these have the side effect of setting Y,
; since the modify routine will 'save' and 'restore' the value we're setting here)
modify4
ldy #$04
!byte $2C
; /!\ execution falls through here
modify3
ldy #$03
!byte $2C
; /!\ execution falls through here
modify2
ldy #$02
!byte $2C
; /!\ execution falls through here
modify1
ldy #$01
; /!\ execution falls through here
;-------------------------------
; modify subroutine
; in: A = starting address (high byte)
@ -10,13 +28,12 @@
; $moddest zero page clobbered
; stack set to return to
; code after string
; A,X preserved
; Y clobbered
; A,X,Y preserved
; oVerflow bit clear
; all other flags clobbered
;-------------------------------
!zone {
modify
sty mod_tmp_y
sta gDisplayBytes
clc
adc #BASEPAGE
@ -31,49 +48,87 @@ modify
tya
clc
adc modsrc
bcc .noinc
bcc +
inx
.noinc
sta tmp
+ sta tmp
txa
pha
lda tmp
pha
sty modtmp
bit gMode
bpl .exitnomod ; verify mode -> no modify
bvc .exitnomod ; demuffin mode -> no modify
lda #s_modify
bpl @exitnomod ; verify mode -> no modify
jsr PrintByID
!byte s_modify
ldy #0
.dest
lda (moddest),y
- lda (moddest), y
jsr PrintByte
iny
cpy modtmp
bne .dest
lda #s_modifyto
bne -
jsr PrintByID
!byte s_modifyto
ldy #0
.src
iny
lda (modsrc),y
- iny
lda (modsrc), y
jsr PrintByte
cpy modtmp
bne .src
bne -
lda #$8D
jsr PrintA
bvc +
.mod
sta (moddest),y
+ lda (modsrc),y
- sta (moddest), y
+ lda (modsrc), y
dey
bpl .mod
.exit
bpl -
@exit
inc gPatchCount
.exitnomod
@exitnomod
lda gDisplayBytes
ldx moddest
mod_tmp_y=*+1
ldy #$FD ; SMC
clv
rts
}
multimodify
; in: (A/Y) -> sector+offsets+values block
; X = number of values (must also be equal number of sectors and offsets)
; out: all registers/flags clobbered
sta @getsector+1
sty @getsector+2
stx @loop+1
clc
adc @loop+1
bcc +
iny
+ sta @getoffset+1
sty @getoffset+2
clc
adc @loop+1
bcc +
iny
+ sta @getvalue+1
sty @getvalue+2
jmp @next
@loop
ldy #$FD ; SMC
@getvalue
lda $FDFD, y ; SMC
sta @cmpvalue
sta @modvalue
@getsector
lda $FDFD, y ; SMC
@getoffset
ldx $FDFD, y ; SMC
jsr compare1
@cmpvalue
!byte $FD ; SMC
bcc @next
jsr modify1
@modvalue
!byte $FD ; SMC
@next
dec @loop+1
bpl @loop
rts

View File

@ -10,114 +10,100 @@ WILDCARD = $97 ; from compare.a
;-------------------------------
; AnalyzeT00
; set additional flags based on contents of track $00
; apply track $00-specific patchers
;
; in: Track $00 in data buffer
; out: gIsBoot1, gIsMaster, gIsRWTS set to #TRUE or #FALSE
; all flags clobbered
; out: all flags clobbered
; all registers clobbered
;-------------------------------
!zone {
AnalyzeT00
lda #$01
ldx #$00
ldy #$38
jsr compare ; if T00,S01,$00 ==
!byte $8E,$E9,$B7,$8E,$F7,$B7,$A9,$01
!byte $8D,$F8,$B7,$8D,$EA,$B7,$AD,$E0
!byte $B7,$8D,$E1,$B7,$A9,$02,$8D,$EC
!byte $B7,$A9,$04,$8D,$ED,$B7,$AC,$E7
!byte $B7,$88,$8C,$F1,$B7,$A9,$01,$8D
!byte $F4,$B7,$8A,$4A,$4A,$4A,$4A,$AA
!byte $A9,$00,$9D,$F8,$04,$9D,$78,$04
ldx #TRUE
bcc .boot1
ldx #FALSE
.boot1
stx gIsBoot1
lda #$01
ldx #$00
ldy #$38
jsr compare ; if T00,S01,$00 ==
!byte $8E,$E9,$37,$8E,$F7,$37,$A9,$01
!byte $8D,$F8,$37,$8D,$EA,$37,$AD,$E0
!byte $37,$8D,$E1,$37,$A9,$02,$8D,$EC
!byte $37,$A9,$04,$8D,$ED,$37,$AC,$E7
!byte $37,$88,$8C,$F1,$37,$A9,$01,$8D
!byte $F4,$37,$8A,$4A,$4A,$4A,$4A,$AA
!byte $A9,$00,$9D,$F8,$04,$9D,$78,$04
ldx #TRUE
bcc .master
ldx #FALSE
.master
stx gIsMaster
lda #$07
ldx #$00
ldy #$40
jsr compare ; if T00,S07,$00 ==
!byte $84,$48,$85,$49,$A0,$02,$8C,WILDCARD
!byte WILDCARD,$A0,$04,$8C,WILDCARD,WILDCARD,$A0,$01
!byte $B1,$48,$AA,$A0,$0F,$D1,$48,$F0
!byte $1B,$8A,$48,$B1,$48,$AA,$68,$48
!byte $91,$48,$BD,$8E,$C0,$A0,$08,$BD
!byte $8C,$C0,$DD,$8C,$C0,$D0,$F6,$88
!byte $D0,$F8,$68,$AA,$BD,$8E,$C0,$BD
!byte $8C,$C0,$A0,$08,$BD,$8C,$C0,$48
ldx #TRUE
bcc .rwts
ldx #FALSE
.rwts
stx gIsRWTS
}
ldx #$04
ldy #$21
jsr compare ; if T00,S07,$04 ==
!byte $A0,$02
!byte $8C,WILDCARD,WILDCARD
!byte $A0,$04
!byte $8C,WILDCARD,WILDCARD
!byte $A0,$01
!byte $B1,$48
!byte $AA
!byte $A0,$0F
!byte $D1,$48
!byte $F0,$1B
!byte $8A
!byte $48
!byte $B1,$48
!byte $AA
!byte $68
!byte $48
!byte $91,$48
!byte $BD,$8E,$C0
bcc +
jmp T00_IsNotRWTS
+
; DOS 3.3 RWTS patchers
!source "../patchers/t00_artsci.a" ; A=0A,X=FE,Y=02; out none
!source "../patchers/t00_bademu.a" ; Y=05; out none
!source "../patchers/t00_border.a" ; A=08,X=5A,Y=0A; out A=08,X=5A,Y=0A
!source "../patchers/t00_dakin5.a" ; A=00,X=B3,Y=0C; out A=03,X=9A,Y=03
!source "../patchers/t00_datasoft2.a" ; A=0A,X=3A,Y=06; out A=01,X=48,Y=02
!source "../patchers/t00_jmpb500.a"
!source "../patchers/sunburst.a"
!source "../patchers/jmpbcf0.a"
!source "../patchers/jmpbeb1.a"
!source "../patchers/jmpbeca.a"
!source "../patchers/jmpb660.a"
!source "../patchers/jmpb720.a"
!source "../patchers/bademu.a"
!source "../patchers/bademu2.a"
!source "../patchers/rwts.a"
!source "../patchers/rwtslog.a"
!source "../patchers/mecc.a"
!source "../patchers/rol1e.a"
; !source "../patchers/thunder.a"
!source "../patchers/bb03.a"
!source "../patchers/rwtsswap.a"
!source "../patchers/rwtsswap2.a"
!source "../patchers/rwtsswapmicrofun.a"
!source "../patchers/border.a"
!source "../patchers/jmpae8e.a"
!source "../patchers/jmpbbfe.a"
!source "../patchers/datasoft.a"
!source "../patchers/nibtable.a"
!source "../patchers/milliken.a"
!source "../patchers/methods.a"
!source "../patchers/jsr8b3.a"
!source "../patchers/laureate.a"
!source "../patchers/pascalrwts.a"
!source "../patchers/micrograms.a"
!source "../patchers/dos32.a"
!source "../patchers/dos32dlm.a"
!source "../patchers/microfun.a"
!source "../patchers/microfun2.a"
!source "../patchers/panglosdos.a"
!source "../patchers/rdos13.a"
!source "../patchers/swordthrust.a"
!source "../patchers/dakin5.a"
!source "../patchers/muserwts.a"
!source "../patchers/artsci.a"
!source "../patchers/springboard.a"
!source "../patchers/hoffman.a"
!source "../patchers/t00_earthware.a" ; out A=02,X=F6,Y=03
!source "../patchers/t00_jmpb660.a" ; in A=02,X=F6,Y=03
;add only above this line
!source "../patchers/t00_jmpbbfe.a"
!source "../patchers/t00_jmpbcf0.a" ; A=03,X=94,Y=08; out A=03,X=94,Y=08
!source "../patchers/t00_jmpbeb1.a"
!source "../patchers/t00_jmpbeca.a"
!source "../patchers/t00_jsrb6cc.a"
!source "../patchers/t00_mastery.a"
!source "../patchers/t00_methods.a"
!source "../patchers/t00_microfun.a"
!source "../patchers/t00_microfun2.a"
!source "../patchers/t00_microlearn.a"
!source "../patchers/t00_milliken.a"
!source "../patchers/t00_muserwts.a"
!source "../patchers/t00_panglosdos.a"
!source "../patchers/t00_rps.a"
!source "../patchers/t00_rwtsswap.a"
!source "../patchers/t00_rwtsswapmicrofun.a"
!source "../patchers/t00_springboard.a"
!source "../patchers/t00_sunburst.a"
!source "../patchers/t00_sve.a"
!source "../patchers/t00_swordthrust.a"
!source "../patchers/t00_scottforesman_dos33.a"
!source "../patchers/t00_neosoft.a"
; ----- add new DOS 3.3 patchers above this line -----
!source "../patchers/t00_nibtable.a" ; clobbers $2000..$2095 (AnalyzeT00 is decompressed into $2000)
!source "../patchers/t00_rwts.a" ; must run after all other patchers that might modify RWTS code
!source "../patchers/t00_diskvol.a"
; /!\ execution falls through here
!source "../patchers/diskvol.a"
T00_IsNotRWTS
; patchers that run on every disk
!source "../patchers/t00_rwtslog.a"
; ----- add new patchers below this line -----
!source "../patchers/t00_bb03.a"
!source "../patchers/t00_datasoft.a"
!source "../patchers/t00_dos32.a"
!source "../patchers/t00_dos32dlm.a"
!source "../patchers/t00_hoffman.a"
!source "../patchers/t00_jsr8b3.a"
!source "../patchers/t00_laureate.a"
!source "../patchers/t00_mecc.a"
!source "../patchers/t00_micrograms.a"
!source "../patchers/t00_pascalrwts.a"
!source "../patchers/t00_rdos13.a"
!source "../patchers/t00_rol1e.a"
!source "../patchers/t00_sigcheck.a"
!source "../patchers/t00_baudville.a"
!source "../patchers/t00_enlightenment.a"
!source "../patchers/t00_scottforesman.a"
!source "../patchers/t00_jmp600.a"
rts
!if * > $4000 {
!if * > $3200 {
!serious "code is too large to fit in available space!"
}

View File

@ -9,7 +9,7 @@
; - address prologue $D4 $AA $96 or $D5 $AA $96
; - verifies address field checksum
; - any address epilogue
; - data prologue $D5 $AA $AD
; - data prologue $D5 $AA * (anything > $96)
; - verifies data field checksum
; - any data epilogue
; - waits longer than a normal RWTS to find an address prologue (long enough
@ -37,14 +37,14 @@ universalrwts
!byte $C0,$60,$A0,$00,$A2,$56,$CA,$30,$FB,$B9,$00,$BB,$5E,$00,$BC,$2A
!byte $5E,$00,$BC,$2A,$91,$3E,$C8,$C4,$26,$D0,$EB,$60,$A0,$20,$88,$F0
!byte $61,$BD,$8C,$C0,$10,$FB,$49,$D5,$D0,$F4,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9,$AA,$D0,$F2,$A0,$56,$BD,$8C,$C0,$10,$FB,$C9,$AD,$D0,$E7,$A9
!byte $C9,$AA,$D0,$F2,$A0,$56,$BD,$8C,$C0,$10,$FB,$C9,$97,$90,$E7,$A9
!byte $00,$88,$84,$26,$BC,$8C,$C0,$10,$FB,$59,$00,$BA,$A4,$26,$99,$00
!byte $BC,$D0,$EE,$84,$26,$BC,$8C,$C0,$10,$FB,$59,$00,$BA,$A4,$26,$99
!byte $00,$BB,$C8,$D0,$EE,$BC,$8C,$C0,$10,$FB,$D9,$00,$BA,$D0,$13,$BD
!byte $8C,$C0,$10,$FB,$C9,$00,$D0,$00,$EA,$BD,$8C,$C0,$10,$FB,$C9,$00
!byte $D0,$5C,$38,$60,$A0,$F7,$84,$26,$C8,$D0,$04,$E6,$26,$F0,$F3,$BD
!byte $8C,$C0,$10,$FB,$4A,$C9,$6A,$D0,$EF,$BD,$8C,$C0,$10,$FB,$C9,$AA
!byte $D0,$F2,$BD,$8C,$C0,$10,$FB,$C9,$96,$D0,$E7,$A0,$03,$A9,$00,$85
!byte $D0,$F2,$BD,$8C,$C0,$10,$FB,$C9,$96,$D0,$E9,$A0,$03,$A9,$00,$85
!byte $27,$BD,$8C,$C0,$10,$FB,$2A,$85,$26,$BD,$8C,$C0,$10,$FB,$25,$26
!byte $99,$2C,$00,$45,$27,$88,$10,$E7,$A8,$D0,$B7,$BD,$8C,$C0,$10,$FB
!byte $C9,$00,$D0,$00,$EA,$BD,$8C,$C0,$10,$FB,$C9,$00,$D0,$00,$18,$60

File diff suppressed because it is too large Load Diff

861
src/patchers/555.a Normal file
View File

@ -0,0 +1,861 @@
;-------------------------------
; #555
; RWTS reads 5 sectors from
; three consecutive half-tracks
;
; module by qkumba
;
; tested on
; - Addition Magician
; - Adventure Double Feature Vol. II
; - Agent USA
; - Algebra
; - Bugbyter
; - Bumble Games v1.3
; - Bumble Games v1.4
; - Bumble Plot v1.1
; - Con-Putation
; - Cosmic Combat
; - Crosscountry Rallye
; - Crush, Crumble and Chomp v1981-06-22
; - Disk Director
; - Drinks On a Disk
; - Friends or Lovers
; - Funbunch College Prep
; - Game of the U.S.
; - Gertrude's Puzzles v1.0
; - Gertrude's Secrets v1.0
; - Guardian
; - Jumble Jet
; - Jumpman
; - Keyboard Golf
; - L.A. Land Monopoly
; - Lazersilk
; - Logic Builders
; - Microzine 3
; - Microzine 4
; - Microzine 5
; - Microzine 6
; - Moptown Parade v1.0
; - Number Stumper
; - Reader Rabbit v1.0
; - Rocky's Boots v1.0
; - Supermap
; - Tales of Discovery
; - Temple of Apshai
; - The Final Frontier
; - The Game Show
; - Trap-a-Zoid
; - Volcanoes
; - Zenith
;-------------------------------
!zone {
Do555
; find entrypoint for second stage
lda $802
cmp #$76
beq .setfixed
cmp #$7A
beq .setfixed2
lda #8
ldy #3
jsr SearchSector
!byte $A9,WILDCARD ; LDA #$xx
!byte $48 ; PHA
lda $801,x
bcc .setpage
lda #8
ldy #4
jsr SearchSector
!byte $45,WILDCARD ; EOR $xx
!byte $91,$26 ; STA ($26),y
lda #4
bcc .setenc
tay
asl
jsr SearchSector
!byte $45,WILDCARD ; EOR $xx
!byte $99,$00 ; STA $xxxx,y
bcs .jmpexit
lda $804,x
.setenc
sec
.setpage
sta .patch+1
bcs .findkey
txa
tay
iny
iny
iny
jsr search
ldy $801,x
iny
lda #0
bcc .setPC
.jmpexit
jmp FatalError
.setfixed
lda #1
!byte $2C
.setfixed2
lda #3
sta .curtrk+1
lda #$FF
sta .cmpsect+1
jmp .dofixed
.findkey
lda #8
ldy #3
jsr SearchSector
!byte $A0,WILDCARD ; LDY #$xx
!byte $A2 ; LDX #$xx
bcs .jmpexit
lda $803,x
ldy #0
.setPC
sta .xorkey+1
sty .initPC+1
.loopsect
inc gSector
jsr ReadSector
bcs .jmpexit
jsr .decode
.initPC
; skip lightly variable init
ldx #0 ; SMC
lda $800,x
cmp #$46
bne .nolsr
inx
inx
.nolsr
lda $800,x
cmp #$A0 ; LDY #$xx
bne .noldy
inx
inx
lda $800,x
cmp #$98 ; TYA
bne .isldy
inx
.isldy
lda #8
ldy #6
jsr CompareMemory
!byte $20,WILDCARD,WILDCARD ; JSR $xxxx
!byte $88 ; DEY
!byte $D0,$FA ; BNE *-4
bcs +
jmp .nohalf
+ jsr CompareMemory
!byte $99,$02,$08 ; STA $802,y
!byte $88 ; DEY
!byte $D0,$FA ; BNE *-4
bcs .loopsect
inx
inx
inx
.skipjsr
inx
inx
inx
.noldy
lda $800,x
cmp #$A9 ; LDA #$xx
bne .nolda
inx
inx
.nolda
lda $800,x
cmp #$20 ; JSR $xxxx
bne .loopsect
lda $802,x
eor .patch+1
bne .skipjsr
sta .curtrk+1
;search for seek routine
;in highly variable main
;so we can count calls to whole-track seek
; static boot tracer!
.skip2jsr
ldy $801,x
lda $800,y
cmp #$A9 ; LDA
bne .maybehalf
lda $803,y
cmp #$0B ; [JMP] $xx0B
beq .incx3
cmp #$20 ; JSR $xxxx
bne .nohalf
lda $808,x
eor .patch+1
bne .nohalf
lda $806,x
cmp #$20 ; JSR $xxxx
bne .nohalf
lda $808,x
eor .patch+1
bne .nohalf
txa
adc #5 ; try the next JSR instead
tax
bcc +
.incx3
inx
inx
inx ; try the next JSR instead
+ inc .curtrk+1
inc .curtrk+1
bne .skip2jsr ; always taken
.maybehalf
lda $801,y
tay
lda $800,y
cmp #$48 ; PHA
beq .foundseek
lda $801,y
tay
lda $800,y
cmp #$E6 ; INC $xx
beq .nohalf
cmp #$48 ; PHA
beq .foundseek2
inc .curtrk+1
lda $801,y
tay
lda $800,y
cmp #$48 ; PHA
beq .foundseek
.jmpexit2
jmp FatalError
.nohalf
lda #$FF
sta .curtrk+1
lda #0
sta .hookseek+1
ldx #$94
lda $801,x
cmp #$B7
bne .not_e7
ldx #$A2
.not_e7
jmp .foundpart
.foundseek2
stx $3A
lda $801,x
tax
lda $803,x
cmp #$A2 ; LDX #$xx
bne .foundseek
ldx $3A
.foundseek
dey
dey
sty .hookseek+1
dey
sty .patch
inc .curtrk+1
lda #8
sta $3B
inx
inx
inx
.walkcode
stx $3A
ldy #0
lda ($3A),y
cmp #$4C ; JMP $xxxx
beq .nohalf
cmp #$AA ; TAX
beq .isldx
cmp #$A2 ; LDX #$xx
bne .tryseek
iny
.isldx
iny
lda ($3A),y
cmp #$20 ; JSR $xxxx
bne .sizeinst
iny
.skipjsr2
iny
.skipjsr1
tya
bne .skipinst ; always
.tryseek
cmp #$20 ; JSR $xxxx
bne .trylda
iny
iny
lda ($3A),y
cmp .patch+1
bne .skipjsr1
dey
lda ($3A),y
tax
cmp .patch
beq .inctrack
lda $800,x
bcs .checkinc
cmp #$20 ; JSR
bne .skipjsr2
lda $801,x
cmp .patch
bne .skipjsr2
beq .inctrack
.checkinc
cmp #$A9
bne .walkcode
inc .curtrk+1
.inctrack
inc .curtrk+1
bne .skipjsr2 ; always
.trylda
ldx $3A
lda $800,x
cmp #$66 ; ROR $xx
bne .sizeinst
lda #$A9 ; LDA #$xx
inx
inx
cmp $800,x
beq .foundpart
inc .curtrk+1
inx
inx
inx
cmp $800,x
beq .foundpart
.sizeinst
ldy #0
lda ($3A),y
jsr $F88E ; INSDS2
lda $2F
.skipinst
sec
adc $3A
tax
bcc .walkcode
jmp FatalError
; success!
; found where the partial tracks start
; read whole tracks to this point
; then the partial tracks
; and then the rest of the disk
.foundpart
stx $3A
jsr IncProgress
.donohalf
lda gSector
sta .cmpsect+1
.dofixed
lda #BASEPAGE
sta gAddress+1
lda #8
ldx #$AD
ldy #4
jsr CompareMemory
!byte $A9,$0F ; LDA #$0F
!byte $85,$3D ; STA $3D
ldx #0
bcs .forwards
ldx #<.forwards3-<.forwards1
.forwards
lda #1
sta .forwards1+1,x
lda #6
sta .forwards1+3,x
txa
eor #<.forwards3-<.forwards1
tax
lda #11
sta .forwards1+1,x
lda #16
sta .forwards1+3,x
.copytracks
ldx #0
stx gSector
ldy #$10
jsr .readwrite
lda gTrack
cmp #1
bne .curtrk
ldx #$AC
stx $BDEF
ldx #$90
stx $BDF2
.curtrk
cmp #00 ; SMC
beq .ispartial
jmp .notpartial
.ispartial
ldy #$CD
sty $BE2B
.forwards1
ldx #1
ldy #6
jsr .readsectors
sec
rol gTrack
dec dct+1 ; half-track stepping!
ldx #6
ldy #11
jsr .readsectors
jsr IncProgress
inc gTrack
lsr gTrack
inc dct+1 ; back to normal
.forwards3
ldx #11
ldy #16
jsr .readsectors
dec gTrack
lda #1
ldx #$44
jsr compare3
!byte $20,$76,$08 ;JSR $0876
bcs .notfixed
jsr modify1
!byte $2C ;BIT
ldx #$64
jsr modify3
!byte $20,$76,$08 ;JSR $0876
.notfixed
lda #$0F
ldx #$38
jsr compare3
!byte $20,$5F,$08 ;JSR $085F
bcs .notfixed2
jsr modify1
!byte $2C ;BIT
ldx #$4B
jsr modify1
!byte $C1
ldx #$C1
ldy #9
jsr modify
!byte $20,$5F,$08 ;JSR $085F
!byte $20,$5F,$08 ;JSR $085F
!byte $4C,$5F,$08 ;JMP $085F
.notfixed2
jsr ReorderLogicalToPhysical
jsr .writesectors
inc gTrack
ldy #$B9
sty $BE2B
.notpartial
lda gTrack
cmp #$23
bcc .jmpcopy
jsr IncProgress
jsr .cleanup
jmp .exit
.jmpcopy
jmp .copytracks
.cancel
jsr .cleanup
jmp Cancel
.readwrite
jsr .readsectors
lda gTrack
bne .writesectors
ldx #2
jsr compare1
!byte $76
bcs .checkfixed2
ldx #$B2
jsr compare
!byte $00
bcc .patchfixed
ldx #$B6
.patchfixed
jsr modify1
!byte 1
ldx #2
.checkfixed2
jsr compare
!byte $7A
bcs .writesectors
ldx #$16
jsr modify4
!byte $1A,$08
!byte $E6,$41 ; INC $41
lda #$0B
ldx #$0D
jsr modify1
!byte $EA
ldx #$64
jsr modify1
!byte $2C ; BIT
ldx #$86
jsr modify4
!byte $8A,$04
!byte $E6,$41 ; INC $41
ldx #$EA
ldy #6
jsr modify
!byte $20,$85,$04 ; JSR $0485
!byte $4C,$85,$04 ; JMP $0485
.writesectors
jsr WriteTrack
jsr IncProgress
lda KEY
bmi .cancel
ldx gTrack
inx
txa
jmp ChangeTrackNW
.maybefatal
ldx $BDF2
jsr .cleanup
lda $478
sta $47E ; restore track number replaced by DOS
cpx #$F0
bne .retryread
lda gError
cmp #$40 ; sector not found
bne .reallyfatal
lda gTrack
cmp .curtrk+1
bcc .jmpnotpatch2 ; cross fingers
rts
.reallyfatal
jmp FatalError
.readsectors
sty .endsector+1
.readsector
txa
jsr ChangeSector
.retryread
jsr ReadSector
bcs .maybefatal
lda gTrack
bne .jmpnotpatch2
lda gSector
.cmpsect
eor #$00 ; SMC
beq .checkpatch
.jmpnotpatch2
jmp .notpatch2
.checkpatch
jsr .decode
ldy #$37
lda ($3E),y
cmp #$41 ; [INC] $41
beq .jnotpatch1
ldy $3A
iny
lda ($3E),y
cmp #$4C
beq .jnotpatch1
tya
clc
adc #$0D
.hookseek
ldy #00 ; SMC
beq .nohook
sta ($3E),y
.nohook
sbc #3
tax
lda $3F
sbc #BASEPAGE
ldy #8
jsr modify
.patch
!byte $00,$04 ; [JSR] $04xx
!byte $B0,$0B ; BCS *+$0D
!byte $E6,$41 ; INC $41
!byte $EA ; NOP
!byte $4C ; JMP $xxxx
ldy .curtrk+1
bpl .skipnohalf
clc
txa
adc #4
sta $3C
lda $3F
sta $3D
ldy #6
jsr SearchSector
!byte $20,WILDCARD,WILDCARD ; JSR $xxxx
!byte $48 ; PHA
!byte $98 ; TYA
!byte $48 ; PHA
stx $3E
ldy #1
lda ($3E),y
ldy #4
sta ($3C),y
ldy #1
lda $3C
sta ($3E),y
iny
lda ($3E),y
ldy #5
sta ($3C),y
lda #0
sta $3E
.jnotpatch1
beq .notpatch1
.skipnohalf
sec
txa
sbc #5
tay
lda #$0F
sta ($3E),y
tya
sbc #9
tay
lda ($3E),y
cmp #$41
bne .notpatch1
lda #$EA
sta ($3E),y
.notpatch1
jsr .decode
.notpatch2
ldx gSector
inx
.endsector
cpx #00 ; SMC
beq .rescanall
jmp .readsector
.rescanpro
clc
.rescanall
php
ldy #12
jsr SearchTrack
!byte $C9,$FF ; CMP #$FF
!byte $D0,WILDCARD ; BNE *+$xx
!byte $EA ; NOP
!byte $BD,$8C,$C0 ; LDA $C08C,X
!byte $10,$FB ; BPL *-3
!byte $C9,$FF ; CMP #$FF
bcs .notadrpro
inx
pha
jsr modify1
!byte $DE
txa
clc
adc #10
tax
pla
jsr modify1
!byte $AA
plp
bcs .rescanpro
!byte $A9 ; mask PLP
.notadrpro
plp
ldy #9
jsr SearchTrack
!byte $BD,$8C,$C0 ; LDA $C08C,X
!byte $10,$FB ; BPL *-3
!byte $C9,$FF ; CMP #$FF
!byte $F0,$02 ; BEQ *+4
bcs .notadrepi
pha
txa
adc #6
tax
pla
jsr modify1
!byte $DE
.notadrepi
ldy #8
jsr SearchTrack
!byte $A9,$20 ; LDA #$20
!byte $D0,$E1 ; BNE *-$1D
!byte $A0,$05 ; LDY #$05
!byte $B1,$48 ; LDA ($48),Y
bcs .novol
inx
inx
inx
jsr modify1
!byte $00
.novol
ldy #5
jsr SearchTrack
!byte $20,$87,$07 ; JSR $0787
!byte $A6,$2B ; LDX $2B
bcs .notfixed3
ldy #5
jsr modify
!byte $20,$89,$07 ; JSR $0789
!byte $E6,$41 ; INC $41
.notfixed3
ldy #8
jsr SearchTrack
!byte $01,$30,$28
!byte $24,$20,$1E
!byte $1D,$1C
bcs .notseek
pha
sec
txa
sbc #$6D
tax
pla
sbc #0
ldy #10
jsr compare
!byte $0A ; ASL
!byte $85,WILDCARD ; STA $xx
!byte $CD,WILDCARD,WILDCARD ; CMP $xxxx
!byte $F0,$53 ; BEQ *+$55
!byte $A9,$00 ; LDA #$00
bcs .notseek
pha
txa
adc #8
tax
pla
jsr modify2
!byte $D0,$73 ; BNE *+$75
pha
clc
txa
adc #$23
tax
pla
jsr modify1
!byte $08
pha
ldy #$15
sec
lda (moddest),y
sbc #4
sta (moddest),y
iny
lda (moddest),y
sbc #0
sta (moddest),y
clc
txa
adc #$4A
tax
pla
adc #0 ; DOS seek spans a page
jsr modify4
!byte $70,$2C,$26
!byte $22
pha
lda (moddest),y
tay
pla
cpy #$70
beq .nocross ; Pollywog seek spans a page
sec
sbc #1
.nocross
inx
inx
inx
inx
ldy #11
jsr modify
!byte $1F,$1E,$1D
!byte $1C
!byte $4A ; LSR
!byte $85,$41 ; STA $41
!byte $A9,$00 ; LDA #$00
!byte $F0,$86 ; BEQ *-$78
.notseek
rts
.decode
ldy #0
- lda ($3E),y
.xorkey
eor #$D1 ; SMC
sta ($3E),y
iny
bne -
rts
.cleanup
lda #1
sta dct+1
lda #$CC
sta $BDEF
lda #$F0
sta $BDF2
lda #$B9
sta $BE2B
lda #$50
sta $47E ; blow away track number to force full recalibration
rts
.exit
jmp Pass
.exit2
}

View File

@ -5,10 +5,8 @@
; e.g. Game Frame One, Game Frame Two
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsPascal ; only ever seen this protection
bne .exit ; on Pascal disks
; gIsPascal is TRUE here
; (only ever seen this protection on Pascal disks)
ldy #$0A
jsr SearchTrack
@ -18,16 +16,10 @@
!byte $4C,$A5,$00; JMP $00A5
!byte $C9,$A5 ; CMP #$A5
bcs .exit ; passport-test-suite/Game Frame One.woz [C=0] matches
sta gDisplayBytes
pha
txa
adc #$08
tax
lda #s_a5count
jsr inx8
jsr PrintByID
pla
ldy #$02
jsr modify
!byte s_a5count
jsr modify2
!byte $D0,$7B ; BNE +$7B
.exit
}

View File

@ -4,10 +4,8 @@
; e.g. The Secrets of Science Island
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsPascal ; only ever seen this protection
bne .exit ; on Pascal disks
; gIsPascal is TRUE here
; (only ever seen this protection on Pascal disks)
ldy #$09
jsr SearchTrack
@ -33,13 +31,9 @@
!byte $AE,$F8,$01; LDX $01F8
!byte $A9
bcs .exit
sta gDisplayBytes
pha
lda #s_a6bc95
jsr PrintByID
pla
ldy #$01
jsr modify
!byte s_a6bc95
jsr modify1
!byte $60 ; RTS
.exit
}

View File

@ -7,30 +7,25 @@
; Moebius (Origin)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda #$0F
sta gDisplayBytes
.loop lda gDisplayBytes
sta .sector+1
.sector lda #$FD ; SMC
ldx #$04
ldy #$0E
jsr compare
!byte $CE,$07,$02; DEC $0207
!byte $EF,$07,$02; ??? $0207 (becomes INC)
!byte $A0,$27 ; LDY #$27
!byte $D0,$02 ; BNE *+4
!byte $00 ; BRK
!byte $6C,$B9,$00; JMP ($00B9)
bcs + ; passport-test-suite/Moebius.woz [C=0] matches
lda #s_aacount
!byte $CE,$07,$02 ; DEC $0207
!byte $EF,$07,$02 ; ??? $0207 (becomes INC)
!byte $A0,$27 ; LDY #$27
!byte $D0,$02 ; BNE *+4
!byte $00 ; BRK
!byte $6C,$B9,$00 ; JMP ($00B9)
bcs + ; passport-test-suite/Moebius.woz [C=0] matches
jsr PrintByID
lda gDisplayBytes
ldy #$01
jsr modify
!byte $60 ; RTS
!byte s_aacount
jsr modify1
!byte $60 ; RTS
+
dec gDisplayBytes
bpl .loop
dec .sector+1
bpl .sector
.exit
}

View File

@ -9,14 +9,9 @@
; module by qkumba
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .jmpexit
lda gIsAdvent
beq +
.jmpexit
jmp .exit
bne .exit
+
;carry controls how many times to run on one track
;Mindshadow and Tracer Sanction have two copies
;of the protection on track 0, loaded to two
@ -40,10 +35,12 @@
!byte $A9,$96 ;LDA #$96
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
!byte $60 ;RTS
bcs .pop ; passport-test-suite/Borrowed Time.woz [C=0] matches
ldy #1 ; passport-test-suite/Mindshadow.woz [C=0] matches
jsr modify ; passport-test-suite/The Tracer Sanction.woz [C=0] matches
bcs .pop ; passport-test-suite/Borrowed Time.woz [C=0] matches
; passport-test-suite/Mindshadow.woz [C=0] matches
; passport-test-suite/The Tracer Sanction.woz [C=0] matches
jsr modify1
!byte $10 ;BEQ -> BPL
ldy #23
jsr SearchTrack
!byte $A4,WILDCARD ;LDY $xx
@ -72,15 +69,13 @@
adc #0
pha
tya
ldy #3
jsr modify
jsr modify3
!byte $C9,$DE ;CMP #$DE
!byte $EA ;NOP
pla
.patch
ldx #0
ldy #3 ; passport-test-suite/Borrowed Time.woz [Z=1] reaches here
jsr modify
ldx #0 ; passport-test-suite/Borrowed Time.woz [Z=1] reaches here
jsr modify3
!byte $C9,$AA ;CMP #$AA
!byte $EA ;NOP
plp

View File

@ -1,39 +1,69 @@
;-------------------------------
; #ADVINT
; encrypted protection check on
; Adventure International disks
; protection check on Adventure International disks
; usually encrypted but not always
;
; tested on
; - Curse of Crowley Manor
; - Earthquake San Francisco 1906
; - QuestProbe featuring The Hulk
; - QuestProbe featuring Spider-Man vB-258
; - QuestProbe featuring Spider-Man vF-261
; - SAGA1 - Adventureland v2.0-416
; - SAGA1 - Adventureland v2.1-416
; - SAGA2 - Pirate Adventure v2.1-408
; - SAGA3 - Mission Impossible v2.1/306
; - SAGA4 - Voodoo Castle v2.1/119
; - SAGA3 - Mission Impossible v2.1-306
; - SAGA4 - Voodoo Castle v2.1-119
; - SAGA5 - The Count v2.1-115
; - SAGA6 - Strange Odyssey v2.1-119
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gAdventureInternational
bne .exit
; variant 0 - very old, possibly first generation
ldy #$09
jsr SearchTrack
!byte $C9,$9C
!byte $B0,$04
!byte $BD,$88,$C0
!byte $60
!byte $4C
bcs .variant1 ; passport-test-suite/War.woz [C=0] matches
jsr PrintByID
!byte s_advint
jsr inx8
jsr modify3
!byte $18 ;CLC
!byte $90,$F9 ;BCC -$F9
bvc .exit ; always branches
;-----
.variant1
; variant 1 - unencrypted
ldy #$08
jsr SearchTrack
!byte $4C,WILDCARD,WILDCARD ;JMP $****
!byte $BD,$8C,$C0 ;LDA $C08C,X
!byte $10,$FB ;BPL -$FB
bcs .variant2 ; passport-test-suite/Spiderman B.woz [C=0] matches
jsr PrintByID
!byte s_advint
jsr modify3
!byte $18 ;CLC
!byte $90,$6E ;BCC +$6E
bvc .exit ; always branches
;-----
.variant2
; variant 2 - bytes are XOR'd with #$C9 on disk
; comments show decrypted code
ldy #$08
jsr SearchTrack
; bytes are XORd with #$C9 on disk -- comments show decrypted code
!byte $85,WILDCARD,WILDCARD ;JMP $****
!byte $74,$45,$09 ;LDA $C08C,X
!byte $D9,$32 ;BPL -$FB
bcs .exit ; passport-test-suite/S.A.G.A. 6.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_advint
bcs .exit ; passport-test-suite/S.A.G.A. 6.woz [C=0] matches
jsr PrintByID
pla
ldy #$03
jsr modify
!byte s_advint
jsr modify3
!byte $D1 ;CLC
!byte $59,$A7 ;BCC +$6E
.exit

View File

@ -1,41 +0,0 @@
;-------------------------------
; #ARTSCI
; loader on T00,S0A changes epilogue
;
; tested on
; - AceCalc (ArtSci)
; - Magicalc (ArtSci)
; - Magic Words
; - Photar
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsRWTS
bne .exit
lda #$0A
ldx #$FE
ldy #$02
jsr compare
!byte $DE,$D5
bcs .exit
ldy #(@searchend-@searchstart)
jsr SearchTrack
@searchstart
LDY #$35
TXA
STA ($3C),Y
@searchend
bcs .exit ; passport-test-suite/Photar.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_bytrack
jsr PrintByID
pla
ldy #$01
jsr modify
!byte $60
.exit
}

18
src/patchers/b4bbbasic.a Normal file
View File

@ -0,0 +1,18 @@
;-------------------------------
; #B4BBBASIC
; RWTS swapper in BASIC
;
; tested on
; - SocMate Analogies Games
;-------------------------------
lda gPossibleB4BBBasic
bne +
ldy #$07
jsr SearchTrack
!byte $B9,$34,$37,$34 ; 'POKE 47445,' in Applesoft BASIC (POKE opcode is $B9)
!byte $34,$35,$2C
bcs + ; passport-test-suite/SocMate Analogies Games.woz [C=0] matches
jsr modify1
!byte $B2 ; change POKE opcode to REM
+

View File

@ -1,42 +0,0 @@
;-------------------------------
; #BADEMU
; RWTS checks for timing bit by
; checking if data latch is still
; $D5 after waiting "too long"
; but this confuses legacy emulators
; (AppleWin, older versions of MAME)
; so we patch it for compatibility
;
; tested on
; - Dino Dig (Troll Associates)
; - Make A Face (Troll Associates)
; - Let's Go There: Beginning Map and Geography Skills (Troll Associates)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsRWTS ; if DOS 3.3 RWTS
bne .exit
lda #$03
sta gDisplayBytes
ldx #$4F
ldy #$11
jsr compare ; and T00,S03,$4F ==
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $10,$FB ; BPL -$FB
!byte $C9,$D5 ; CMP #$D5
!byte $D0,$F0 ; BNE -$F0
!byte $EA ; NOP
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $C9,$D5 ; CMP #$D5
!byte $F0,$12 ; BEQ +$12
bcs .exit ; passport-test-suite/Beginning Map and Geography Skills.woz [C=0] matches
lda #s_d5timing
jsr PrintByID
lda #$03
ldx #$58
ldy #$02
jsr modify ; then set T00,S03,$58 =
!byte $F0,06 ; BEQ +$06
.exit
}

View File

@ -1,37 +0,0 @@
;-------------------------------
; #BADEMU2
; RWTS checks for timing bit by
; checking if data latch is still
; $D5 after waiting "too long"
; but this confuses legacy emulators
; (AppleWin, older versions of MAME)
; so we patch it for compatibility
;
; tested on
; - Dinosaur Days
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsRWTS ; if DOS 3.3 RWTS
bne .exit
lda #$03
ldx #$4F
ldy #$11
jsr compare ; and T00,S03,$4F ==
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $10,$FB ; BPL -$FB
!byte $4A ; LSR
!byte $C9,$6A ; CMP #$6A
!byte $D0,$EF ; BNE -$EF
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $C9,$D5 ; CMP #$D5
!byte $F0,$12 ; BEQ +$12
bcs .exit ; passport-test-suite/Dinosaur Days.woz [C=0] matches
lda #$03
ldx #$59
ldy #$02
jsr modify ; then set T00,S03,$59 =
!byte $F0,$05 ; BEQ +$05
.exit
}

View File

@ -1,94 +0,0 @@
;-------------------------------
; #BB03
; boot1 calls $BB03 for a self-decrypting nibble check
;
; variant 1 (JSR $BB03)
; - Classifying Animals with Backbones
; - EduCalc
;
; variant 2 (JSR $BB03 but David-DOS)
; - Case of the Great Train Robbery
; - Case of the Missing Chick
; - Mrs. Wigglesworth's Secret
; - Mystery of the Witch's Shoes
;
; variant 3 (JMP $BB03)
; - Alice in Wonderland (some versions)
; - Sum Ducks
; - Trivia Fever
;-------------------------------
!zone {
sec
bit gMode ; nothing to do here in verify-only mode
bpl .noButInYellow
lda #$07 ; sector to check for David-DOS variant
ldx gIsDavidDOS
beq .maybe
lda gIsBoot0 ; if DOS 3.3 boot0 loader
ora gIsBoot1 ; and DOS 3.3 boot1 loader
bne .noButInYellow
lda #$05 ; sector to check for DOS 3.3 variant
.maybe
ldx #$03
ldy #$03
jsr compare ; if T00,S0(5|7),$03 ==
!byte $4E,$06,$BB
bcs .no
sta gDisplayBytes
lda #s_bb03
jsr PrintByID
lda gIsDavidDOS
beq .variant2
lda #$01
ldx #$38
ldy #$03
jsr compare ; if T00,S01,$38 ==
!byte $20,$03,$BB; JSR $BB03
bcc .variant1
ldy #$03
jsr compare ; if T00,S01,$38 ==
!byte $4C,$03,$BB; JMP $BB03
bcs .no
lda #$05
ldx #$6B
ldy #$05
jsr compare ; if T00,S05,$6B ==
!byte $06,$26,$7D,$39,$41; encrypted, decrypts to 'LDA $C08C,X / BPL -'
.noButInYellow
bcs .no
.variant3
ldy #$02
jsr modify ; then set T00,S05,$6B =
!byte $6B,$F6 ; encrypted, decrypts to 'BNE +$5C' which will unconditionally branch to success path at $BBC9
lda #$06
ldx #$0F
ldy #$01
jsr modify ; and set T00,S06,$0F =
!byte $89 ; encrypted, decrypts to $10 which is the expected nibble count value
; unconditional branch (V is always 0 coming out of modify)
bvc .no ; passport-test-suite/Trivia Fever.woz [V=0] reaches here
.variant1
lda #$05
ldx #$03
ldy #$09
jsr modify ; then set T00,S05,$03 =
!byte $A9,$B5
!byte $48
!byte $A9,$18
!byte $48
!byte $4C,$93,$B7
; unconditional branch (V is always 0 coming out of modify)
bvc .no ; passport-test-suite/Classifying Animals with Backbones.woz [V=0] reaches here
.variant2
lda #$07
ldx #$03 ; passport-test-suite/Case of the Great Train Robbery.woz [Z=0] reaches here
ldy #$0B
jsr modify ; then set T00,S07,$03 =
!byte $A9,$B5
!byte $48
!byte $A9,$18
!byte $48
!byte $A0,$04
!byte $4C,$A9,$B7
.no
}

View File

@ -16,10 +16,8 @@
; 1-2-3 Sequence Me (1991)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsProDOS
bne .exit
; gIsProDOS is TRUE here
ldy #$08
jsr SearchTrack
!byte $8E,$C0
@ -33,13 +31,9 @@
!byte $A6,WILDCARD
!byte $BD,$89,$C0
bcs .exit ; passport-test-suite/Odd One Out 1990.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_bbf9
jsr PrintByID
pla
ldy #$02
jsr modify
!byte s_bbf9
jsr modify2
!byte $18,$60
.exit
}

View File

@ -5,8 +5,6 @@
; after a certain number of boots
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
ldx gTrack
dex
bne .exit
@ -19,13 +17,9 @@
!byte WILDCARD,$CE,$17,$18,$D0,$05,$A9,$80
!byte $8D,$18,$18
bcs .exit ; passport-test-suite/Elementary Vol. 2 v3.2 limited backup.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_bootcounter
jsr PrintByID
pla
ldy #$03
jsr modify ; then set T01,S00,$00 =
!byte s_bootcounter
jsr modify3 ; then set T01,S00,$00 =
!byte $4C,$03,$1B
.exit
}

View File

@ -13,8 +13,6 @@
; Swiss Family Robinson
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
ldy #$1A
jsr SearchTrack
!byte $A8 ; TAY
@ -33,25 +31,11 @@
!byte $38 ; SEC
!byte $60 ; RTS
bcs .exit ; passport-test-suite/Mr. Pixel's Programming Paint Set.woz [C=0] matches
sta gDisplayBytes
pha
txa
clc
adc #$09
tax
stx gDisplayBytes+1
pla
pha
ldy #$01
jsr modify
jsr inx9
jsr modify1
!byte $DE
lda gDisplayBytes+1
clc
adc #$0A
tax
pla
ldy #$01
jsr modify
jsr inx0A
jsr modify1
!byte $AA
.exit
}

View File

@ -22,8 +22,6 @@
; - Star Blazer (Broderbund)
;-------------------------------
!zone {
rts ; reachable only via inspect
Choplifter
lda #$00
sta gCommand ; passport-test-suite/Eggs-It.woz [Z=1] reaches here
@ -101,10 +99,11 @@ Choplifter
- lda .stage2,y
sta $1D00,y
iny
cpy #.exit2-.stage2
bne -
lda #s_bootwrite
jsr PrintByID
!byte s_bootwrite
lda #$00
sta gTrack
jsr WriteTrackNA
@ -247,8 +246,12 @@ ReadChoplifter
.prolog3
cmp #$D1 ; SMC
bne - ; this had the same bug
.x1
-- lda $C0EC ; timing issue requires unrolling part of this
bpl --
!if >.x1 != >* {
!serious "branch crosses a page"
}
sec
rol
sta tmp
@ -263,8 +266,12 @@ ReadChoplifter
sec
rol
sta tmp
.x2
- lda $C0EC
bpl -
!if >.x2 != >* {
!serious "branch crosses a page"
}
and tmp
sta (BASEPAGE+8)<<8,y
iny
@ -310,6 +317,10 @@ ReadChoplifter
.readtracki !pseudopc $2000 {
ldx #$60
lda #$E0
sta tmpa
sta tmpy
.retry
lda tmpx
sta nibcount
@ -318,7 +329,9 @@ ReadChoplifter
lda modsrc+1
sta moddest+1
ldy #$00
--- jsr .readnibx
--- inc tmpa
beq .inc_tmpy
jsr .readnibx
-- cmp cmp2+1
bne ---
jsr .readnibx
@ -360,6 +373,13 @@ ReadChoplifter
bne .retry
rts
.inc_tmpy
inc tmpy
bne ---
;;something
jsr .cleanup
jmp FatalError
.readnibx
- lda $C08C,x
bpl -
@ -496,4 +516,6 @@ ReadChoplifter
rts
} ;$5xx
} ;$Bxxx
.exit2
}

View File

@ -10,8 +10,6 @@
; Super Huey
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gTrack
cmp #$13
bne .exit
@ -35,7 +33,6 @@
!byte $D0,$F1 ; BNE -$F1
bcs .exit
ldx #$A4
ldy #$0F
jsr compare
!byte $A9,$23 ; LDA #$23
!byte $85,$02 ; STA $02
@ -45,11 +42,10 @@
!byte $85,$04 ; STA $04
!byte $20,$28,$40; JSR $4028
bcs .exit ; passport-test-suite/Squire.woz [C=0] matches
lda #s_corrupter
sta gDisplayBytes
jsr PrintByID
lda #$0E
ldy #$01
jsr modify
!byte s_corrupter
jsr modify1
!byte $60 ; RTS
.exit
}

View File

@ -3,36 +3,26 @@
; nibble count with weird bitstream
; involving $D5 and $F7 as delimiters
;
; Ace Detective
; Cat 'n Mouse
; Cotton Tales
; Dyno-Quest
; Easy Street
; Fraction-oids
; Math Magic
; RoboMath
; Ace Detective (Mindplay)
; Cat 'n Mouse (Mindplay)
; Cotton Tales (Mindplay)
; Dyno-Quest (Mindplay)
; Easy Street (Mindplay)
; Fraction-oids (Mindplay)
; Math Magic (Mindplay)
; RoboMath (Mindplay)
; NoteCard Maker (Pascal variant)
; Les Sports (DC Heath) - variant wrapped by PHA/PLAs
; Picture Perfect (1987) (Mindplay)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
;
; always run on Pascal disks
; only run on Pascal disks and DOS 3.3 disks
;
lda gIsPascal
beq +
;
; if DOS 3.3-shaped bootloader, only run if we found
; specific markers on T00,S00 earlier that are shared
; by all the samples I have that use this protection.
; (This filter is subject to revision if we find
; additional samples.)
;
lda gIsBoot0
ora gPossibleD5D5F7
and gIsBoot0
bne .exit
+ ldy #$20
ldy #$20
jsr SearchTrack
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $10,$FB ; BPL -$FB
@ -51,14 +41,12 @@
!byte $C8 ; INY
!byte $18 ; CLC
!byte $6D ; ADC
bcs .exit ; passport-test-suite/RoboMath.woz [C=0] matches
sta gDisplayBytes ; passport-test-suite/Notecard Maker.woz [C=0] matches
pha
lda #s_d5d5f7
bcs .exit ; passport-test-suite/Cotton Tales.woz [C=0] matches
; passport-test-suite/Notecard Maker.woz [C=0] matches
jsr PrintByID
pla
ldy #$01
jsr modify
!byte $60 ; RTS
!byte s_d5d5f7
jsr modify3
!byte $18 ; CLC
!byte $90,$62 ; BCC +$62
.exit
}

View File

@ -1,48 +0,0 @@
;-------------------------------
; #DAKIN5
; RWTS XORs sector ID with #$7E
;
; tested on
; - Neutrons
; - MIRV
; - Rings of Saturn
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsRWTS
bne .exit
lda #$00
ldx #$B3
ldy #(@compareend-@comparestart)
jsr compare ; if T00,S00,$B3 ==
@comparestart
CMP #$AA
BNE @b
LDA $2E
BEQ @a
EOR #$7E
STA $2E
@a LDA #$AA
CLC
RTS
@b SEC
RTS
@compareend
bcs .exit
lda #$03
ldx #$9A
ldy #$03
jsr compare ; and T00,S03,$9A ==
JMP $B6B3
bcs .exit ; passport-test-suite/MIRV.woz [C=0] matches
pha
lda #s_dakin5
jsr PrintByID
pla
ldy #$03
jsr modify ; then set T00,S03,$9A =
!byte $C9,$AA
!byte $D0
.exit
}

View File

@ -14,8 +14,6 @@
; - Word Attack Plus Spanish 1.2
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsDavidson
bne .exit
@ -28,9 +26,10 @@
!byte $20,$D2,$25; JSR $25D2
!byte $4C,$74,$08; JMP $0874
bcs + ; passport-test-suite/Word Attack Plus Spanish.woz [C=0] matches
jsr PrintByID
!byte s_badblock
ldx #$04
ldy #$01
jsr modify
jsr modify1
!byte $79 ; JMP to $0879 instead
+ dec .sector+1
bpl .sector

View File

@ -10,8 +10,6 @@
; - Math and Me 1.0
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsDavidson
bne .exit
@ -19,10 +17,10 @@
jsr SearchTrack
!byte $08,$80,$00,$FD,$1C,$D1,$0D,$EC
bcs .exit ; passport-test-suite/Read 'N Roll.woz [C=0] matches
sta gDisplayBytes
jsr PrintByID
!byte s_badblock
inx
ldy #$01
jsr modify
jsr modify1
!byte $CC ; MLI CLOSE command (instead of BLOCKREAD)
.exit
}

25
src/patchers/didatech.a Normal file
View File

@ -0,0 +1,25 @@
;-------------------------------
; #DIDATECH
; nibble check of malformed T02,S07
;
; tested on
; - Crosscountry Canada
; - Crosscountry USA
; - Crosscountry California
;-------------------------------
lda gIsDidatech
bne +
ldy #$09
jsr SearchTrack; code is XOR #$96 but not tamper-checked
!byte $06,$59 ; BCC -$CF
!byte $8E ; CLC
!byte $36,$68 ; LDY #$FE
!byte $06,$97 ; BCC +$01
!byte $5E ; INY
!byte $1A ; STY ....
bcs + ; passport-test-suite/Crosscountry Canada.woz [C=0] matches
jsr inx7
jsr modify1
!byte $7C ; NOP instead of INY
+

View File

@ -6,8 +6,6 @@
; Castle Wolfenstein (1981, MUSE)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsDOS32
bne .exit
ldx gTrack
@ -15,12 +13,10 @@
bne .exit
lda #$08
ldx #$D6
ldy #$02
jsr compare ; if T01,S08,$D6 ==
jsr compare2 ; if T01,S08,$D6 ==
!byte $4C,$D5
bcs .exit ; passport-test-suite/Castle Wolfenstein.woz [C=0] matches
ldy #$03
jsr modify ; then set T01,S08,$D6 =
jsr modify3 ; then set T01,S08,$D6 =
!byte $E8,$D0,$32
.exit
}

View File

@ -3,8 +3,9 @@
; E7 bitstream in the track seam of every track
;
; We can't attack the bitstream itself (like #UNIVERSALE7) because it's not
; within any sector data, so we search for the code instead. AFAIK the code
; is never encrypted.
; within any sector data, so we search for the code instead. Encrypted
; variant is handled elsewhere.
;
; This does a full-track search on every track, which is unfortunate. I've
; only seen this protection on DOS and ProDOS disks, so we filter on that
; to optimize performance a little bit.
@ -18,33 +19,22 @@
; - The Quarter Mile (Barnum)
; - Reading and Writing with The Boars (McGraw-Hill)
;------------------------------------------------------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
E7Everywhere
lda gIsBoot0
beq +
lda gIsProDOS
bne .exit
+
and gIsProDOS
bne +
ldy #$11
jsr SearchTrack
;
LDA #$05
!byte $A9,$05 ; LDA #$05
!byte $8D,WILDCARD,WILDCARD
!byte $AE,WILDCARD,WILDCARD
LDA $C08E,X
LDA $C089,X
LDA #$00
!byte $BD,$8E,$C0; LDA $C08E,X
!byte $BD,$89,$C0; LDA $C089,X
!byte $A9,$00 ; LDA #$00
!byte $8D
;
bcs .exit ; passport-test-suite/Garfield Trivia Game.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_e7everywhere
jsr PrintByID
pla
ldy #$02
jsr modify
bcs + ; passport-test-suite/Garfield Trivia Game.woz [C=0] matches
jsr PrintByID ; passport-test-suite/Curious George Goes Shopping.woz [C=0] matches
!byte s_e7everywhere
jsr modify2
!byte $18,$60 ; CLC/RTS
.exit
}
+

View File

@ -0,0 +1,30 @@
;------------------------------------------------------------------------------
; #E7EVERYWHERE.ENCRYPTED
; E7 bitstream in the track seam of every track
;
; We can't attack the bitstream itself (like #UNIVERSALE7) because it's not
; within any sector data, so we search for the code instead.
;
; tested on
; - Language Carnival 1 & 2 (DLM)
;------------------------------------------------------------------------------
; gIsProDOS is TRUE here
lda #$0F
sta .sector+1
.sector lda #$FF ; modified at runtime
ldx #$0C
ldy #$0A
jsr compare
!byte $F5
!byte $20,$00,$20
!byte $90,$04
!byte $20,$B0,$FE
!byte $60
bcs .nextsector ; passport-test-suite/Language Carnival.woz [C=0] matches
jsr PrintByID
!byte s_e7everywhere
jsr modify1 ; change branch target to success path
!byte $09
.nextsector
dec .sector+1
bpl .sector

View File

@ -30,13 +30,9 @@
; - Skyfox
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .jmpexit
lda gIsEA ; only ever seen this protection
beq + ; on Electronic Arts titles
jmp .dostitles
.jmpexit
jmp .exit
+ ldy #40
jsr SearchTrack
@ -69,14 +65,12 @@
sta .patch2+1
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $AA ;data prologue #2
.patch2
ldx #$D1
pla
ldy #1
jsr modify
jsr modify1
!byte $AD ;data prologue #3
+ ldy #13
@ -87,13 +81,8 @@
!byte $03,$4C ;LDI #$00
!byte $04,$EB,$19 ;LDA $c0e8
bcs +
inx
inx
inx
inx
inx
ldy #1
jsr modify
jsr inx5
jsr modify1
!byte $04
+ ldy #15
jsr SearchTrack
@ -102,8 +91,7 @@
!byte $5A,$16,$DA,$30,$06,$45,$C2
bcs +
inx
ldy #1
jsr modify
jsr modify1
!byte $EE ;enciphered jsra->lda to disable call
+ ldy #8
@ -113,14 +101,8 @@
!byte $D0,$A7 ;BNE -$A7
!byte $4C ;JMP $xxxx
bcs +
inx
inx
inx
inx
inx
inx
ldy #1
jsr modify
jsr inx6
jsr modify1
!byte $00 ;disable branch
+ ldy #15
@ -132,25 +114,23 @@
!byte $07,$01 ;SUB #$4d
!byte $0F,$F5,$70 ;BNE $a9f6
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
!byte s_tamper
txa
clc
adc #7
tax
adc #4
sta .patch3 + 1
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $04 ;new checksum value for sub
pla
.patch3
ldx #$D1
ldy #1
jsr modify
jsr modify1
!byte $00 ;jsra->lda to disable call
;routine loops infinitely on failure
@ -163,16 +143,15 @@
!byte $D0,$7C ;BNE +$7C
!byte $60 ;RTS
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
!byte s_tamper
txa
clc
adc #11
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $00 ;disable branch
+ ldy #15
@ -184,16 +163,15 @@
!byte $07,$1C ;SUB #$50
!byte $0F,$78,$60 ;BNE $B97B
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
!byte s_tamper
txa
clc
adc #11
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $4C ;new checksum value for sub
+ ldy #14
@ -205,18 +183,12 @@
!byte $20,$67,$67 ;JSR $6767
!byte $20,$AA,$BF ;JSR $BFAA
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
!byte s_tamper
pla
inx
inx
inx
inx
inx
ldy #1
jsr modify
jsr inx5
jsr modify1
!byte $00 ;new checksum value for cmp
+ ldy #9
@ -226,19 +198,10 @@
!byte $C9,$52 ;CMP #$52
!byte $F0,$03 ;BEQ +$03
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
pla
inx
inx
inx
inx
inx
inx
ldy #1
jsr modify
!byte s_tamper
jsr inx6
jsr modify1
!byte $50 ;new checksum value for cmp
+ ldy #7
@ -247,17 +210,10 @@
!byte $C9,$52 ;CMP #$52
!byte $D0,$DB ;BNE -$DB
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
pla
inx
inx
inx
inx
ldy #1
jsr modify
!byte s_tamper
jsr inx4
jsr modify1
!byte $50 ;new checksum value for cmp
+ ldy #12
@ -267,14 +223,8 @@
!byte $20,$00,$61 ;JSR $6100
!byte $4C,$94,$69 ;JMP $6994
bcs +
inx
inx
inx
inx
inx
inx
ldy #1
jsr modify
jsr inx6
jsr modify1
!byte $2C ;JSR->BIT
+ ldy #23
@ -294,8 +244,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $C7 ;lda from known-zero instead
+ ldy #23
@ -314,8 +263,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #23
@ -334,8 +282,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #23
@ -354,8 +301,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #31
@ -378,14 +324,13 @@
adc #29
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $D1 ;lda from known-zero instead
+ ldy #16
jsr SearchTrack
!byte $49,$4E ;EOR #$4E
!byte $09,$2B ;ORA #$2B
!byte $09,WILDCARD ;ORA #$xx
!byte $48 ;PHA
!byte $A9,$04 ;LDA #$04
!byte $48 ;PHA
@ -395,14 +340,10 @@
!byte $E9,$00 ;SBC #$00
!byte $48 ;PHA
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
pla
!byte s_tamper
inx
ldy #1
jsr modify
jsr modify1
!byte $E8 ;new checksum value for eor
+ ldy #14
@ -415,16 +356,15 @@
!byte $C9,$A0 ;CMP #$A0
!byte $F0 ;BEQ *+xx
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
!byte s_tamper
txa
clc
adc #12
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $A1 ;new checksum value for eor
+ ldy #24
@ -439,28 +379,38 @@
!byte $04,$F1,$70 ;LDA $a9f2
!byte $07 ;CMP #$xx
bcs +
sta gDisplayBytes
pha
lda #s_tamper
jsr PrintByID
!byte s_tamper
txa
clc
adc #24
tax
pla
ldy #1
jsr compare
!byte $AB
jsr compare1
!byte $AB ;Last Gladiator
bcs ++
ldy #1
jsr modify
jsr modify1
!byte $BB ;new checksum value for eor
bvc +
++ ldy #1
jsr compare
!byte $DB
++
jsr compare1
!byte $D4 ;Arctic Fox, PHM Pegasus
bcs ++
ldy #1
jsr modify
jsr modify1
!byte $D5 ;new checksum value for eor
bvc +
++
jsr compare1
!byte $2C
bcs ++
jsr modify1
!byte $2D ;new checksum value for eor
++
jsr compare1
!byte $DB ;Adventure Construction Set, Archon, Marble Madness, Bard's Tale
bcs ++
jsr modify1
!byte $D4 ;new checksum value for eor
++
@ -480,8 +430,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #23
@ -500,8 +449,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $30 ;lda from known-zero instead
+ ldy #14
@ -513,18 +461,77 @@
!byte $5C,$0D
!byte $5E,$00
!byte $5E,$0D
bcs .exit
sta gDisplayBytes
pha
lda #s_tamper
bcs +
jsr PrintByID
pla
!byte s_tamper
inx
inx
ldy #1
jsr modify
jsr modify1
!byte $F0 ;new checksum value for eor
+ ldy #23
jsr SearchTrack
!byte $03,$4C ;LDI #$00
!byte $07,$E1,$66 ;STA $bfe2
!byte $04,$CC,$64 ;JSRA $bdcf
!byte $04,$CC,$64 ;JSRA $bdcf
!byte $04,$CC,$64 ;JSRA $bdcf
!byte $04,$CC,$64 ;JSRA $bdcf
!byte $05,$EB,$19 ;LDA $c0e8
!byte $05,$E1,$66 ;LDA $bfe2
bcs +
pha
txa
adc #21
tax
pla
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #14
jsr SearchTrack
!byte $A9,$BD ;LDA #$BD
!byte $A0,$00 ;LDY #$00
!byte $51,$97 ;EOR ($97),Y
!byte $18 ;CLC
!byte $71,$97 ;ADC ($97),Y
!byte $C8 ;INY
!byte $D0,$F8 ;BNE $8111
!byte $E6,$98 ;INC $98
bcs +
pha
jsr PrintByID
!byte s_tamper
txa
clc
adc #25
tax
pla
jsr compare1
!byte $4C
bcs +
jsr modify1
!byte $2C ;jmp to bit
+ ldy #23
jsr SearchTrack
!byte $03,$7A ;LDI #$00
!byte $06,$7E,$9F ;STA $32E2
!byte $05,$4C,$9D ;JSRA $30D0
!byte $05,$4C,$9D ;JSRA $30D0
!byte $05,$4C,$9D ;JSRA $30D0
!byte $05,$4C,$9D ;JSRA $30D0
!byte $04,$74,$6D ;LDA $c0e8
!byte $04,$7E,$9F ;LDA $32E2
bcs +
pha
txa
adc #21
tax
pla
jsr modify1
!byte $7F ;lda from known-zero instead
+
.dostitles
@ -547,8 +554,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $7F ;lda from known-zero instead
+ ldy #13
@ -565,8 +571,7 @@
adc #11
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $00 ;disable branch
+

View File

@ -0,0 +1,48 @@
;-------------------------------
; #ENLIGHTENMENT
; anti-tamper checks on the changes
; we're about to make on track 0
; to disable the RWTS swapper and
; protection check
;-------------------------------
!zone {
lda gIsEnlightenment
bne .exit
lda gTrack
cmp #$02
bne .exit
lda #$01
ldx #$AE
jsr compare1
!byte $48
bcs +
jsr PrintByID
!byte s_tamper
jsr modify1
!byte $EA
+
lda #$01
ldx #$D5
jsr compare1
!byte $48
bcs +
jsr modify1
!byte $EA
+
lda #$09
ldx #$8A
jsr compare3
!byte $A9,$00
!byte $48
bcs +
inx
jsr PrintByID
!byte s_tamper
jsr modify1
!byte $52
+
.exit
}

50
src/patchers/errord51.a Normal file
View File

@ -0,0 +1,50 @@
;-------------------------------
; #ERRORD51
; sneaky bad block check sets an error callback
; then expects the RWTS call not to return
; (prints ']ERROR D51' on failure)
;
; tested on
; - Granny Applebee's Cookie Factory
; - Hugo Hound's Vowel Sounds (series)
; - Marty's Family Reader (series)
; - Marty's Reading Workout (series)
; - Uncle Clyde's Consonant Slides (series)
;-------------------------------
ERRORD51
lda gIsLowDOS
bne @exit
ldy #$10
jsr SearchTrack
!byte $A9,WILDCARD
!byte $8D,$07,WILDCARD
!byte $A9,WILDCARD
!byte $8D,$08,WILDCARD
!byte $A9,$01
!byte $8D,WILDCARD,WILDCARD
!byte $20
bcs @exit
pha
clc
adc #BASEPAGE
sta @highBytePtr+2
txa
pha
jsr inx6
stx @highBytePtr+1
jsr PrintByID
!byte s_badblock
pla
tax
pla
jsr modify1
!byte $4C ; JMP opcode
@highBytePtr
ldy $FDFD ; SMC
sty +
inx
inx
jsr modify1
+ !byte $FD ; SMC (high byte of JMP address)
@exit

View File

@ -14,11 +14,9 @@
; Create With Garfield Deluxe Edition (1987, DLM)
; Teddy Bearrels of Fun (1987, DLM)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
F7F6
lda gIsF7F6
bne .exit
bne +
ldy #$08
jsr SearchTrack
@ -26,17 +24,12 @@
!byte $85,$FA ; STA $FA
!byte $A2,$60 ; LDX #$60
!byte $BD,$8E ; LDA $..8E,X
bcs .exit ; passport-test-suite/Might and Magic.woz [C=0] matches
bcs + ; passport-test-suite/Might and Magic.woz [C=0] matches
inx
inx
inx
inx
ldy #$01
jsr modify
jsr inx4
jsr modify1
!byte $18 ; CLC
lda #TRUE ; needed for Might & Magic
sta gForceDiskVol
.exit
}
+

View File

@ -90,8 +90,6 @@
; - Zork Quest II
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
ldy #$14
jsr SearchTrack
!byte $BD,$89,$C0
@ -104,11 +102,8 @@
!byte $F0,WILDCARD
!byte $BC,$8C,$C0
bcs .exit ; passport-test-suite/Maniac Mansion.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_fbff
jsr PrintByID
pla
!byte s_fbff
ldy #$05
jsr modify
!byte $A9,$FF

View File

@ -15,33 +15,28 @@
; Oo-Topos
;
; and several non-Polarware disks:
; Clue Master Detective
; Clue Master Detective (1989, Leisure Genius)
; RISK (1988, Leisure Genius)
; ESL Writer (1989, Scholastic)
; Magic Spells v2.1 (1985, The Learning Company)
;
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsProDOS ; only seen this protection on ProDOS disks
bne .exit
; gIsProDOS is TRUE here
; (only ever seen this protection on ProDOS disks)
ldy #$06
jsr SearchTrack ; (all bytes are XOR #$FF)
!byte $39,$FD ; DEC $02
!byte $2F,$FB ; BNE +4
!byte $39,$FC ; DEC $03
bcs .exit ; passport-test-suite/Oo-Topos.woz [C=0] matches
bcs .exit ; passport-test-suite/Oo-Topos.woz [C=0] matches
inx
inx
inx
sta gDisplayBytes
pha
lda #s_fbff
jsr PrintByID
pla
ldy #$01
jsr modify
!byte s_fbff
jsr modify1
!byte $A2 ; change encrypted BNE +4 to +5D so code exits with Death Counter > 0
.exit
}

View File

@ -1,5 +1,5 @@
;-------------------------------
; #FBFF
; #FBFFPASCAL
; a variant of Activision's Timing Bit Detection
; linked as an Apple Pascal module
; (soft switches are hard-coded to slot 6)
@ -12,10 +12,8 @@
; Power Up! The Typewriter
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsPascal ; only seen this protection on Pascal disks
bne .exit
; gIsPascal is TRUE here
ldy #$14
jsr SearchTrack
!byte $AD,$E9,$C0; LDA $C0E9
@ -29,18 +27,16 @@
!byte $AC,$EC,$C0; LDY $C0EC
bcs .exit ; passport-test-suite/The Typewriter.woz [C=0] matches
stx .a+1
sta gDisplayBytes
adc #BASEPAGE ; carry is guaranteed to be clear here
sta .a+2
ldy #$10 ; get the branch offset from the WILDCARD above
.a lda $FDFD,y ; set at runtime
adc #$0A ; calculate new branch offset (note: carry still guaranteed to be clear here)
sta .branch ; store offset in patch bytes below
lda #s_fbff
jsr PrintByID
!byte s_fbff
lda gDisplayBytes
ldy #$03
jsr modify
jsr modify3
; unconditional jump to success path
!byte $18 ; CLC
!byte $90 ; BCC +

View File

@ -5,8 +5,6 @@
; e.g. Essential Grammar, Math Football
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
; [speed optimization: only ever seen this protection on disks with
; a specific nibble sequence on track $22, or an unformatted T22 --
; if this global variable is set in SkipTrack() after failing to read T22S0F,
@ -18,16 +16,26 @@
!byte $33,$32,$01,$30,$03,$31,$39,$31
!byte $03,$31,$32,$38,$02,$31,$31,$02
!byte $39,$36
bcs .exit ; passport-test-suite/Essential Grammar.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_poke
bcs .var2 ; passport-test-suite/Essential Grammar.woz [C=0] matches
jsr PrintByID
pla
ldy #$12
!byte s_poke
jsr modify
!byte $34,$34,$01,$30,$02,$31,$30,$03
!byte $32,$33,$34,$03,$31,$36,$39,$02
!byte $33,$39
bvc .exit
.var2
ldy #$12
jsr SearchTrack
!byte $32,$01,$30,$03,$31,$39,$31,$03
!byte $31,$32,$38,$03,$32,$35,$30,$02
!byte $33,$31
bcs .exit ; passport-test-suite/Percent (Gamco).woz [C=0] matches
jsr PrintByID
!byte s_poke
jsr modify
!byte $36,$01,$30,$03,$31,$36,$39,$03
!byte $31,$32,$38,$03,$31,$36,$39,$02
!byte $33,$39
.exit
}

View File

@ -7,10 +7,8 @@
; Super Taxman II (HAL Labs)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsBoot0
bne .exit
; gIsBoot0 is TRUE here
ldx gTrack
dex
bne .exit
@ -37,14 +35,9 @@
!byte $20
@search2end
bcs .exit ; passport-test-suite/Super Taxman II.woz [C=0] matches
sta gDisplayBytes
pha
lda #s_hallabs
jsr PrintByID
pla
ldy #$01
jsr modify
RTS
!byte s_hallabs
jsr modify1
!byte $60
.exit
}

31
src/patchers/harvey.a Normal file
View File

@ -0,0 +1,31 @@
;-------------------------------
; #HARVEY
; late-stage RWTS swapper
;
; tested on
; Buzz Bang Harvey (Queue)
; Harvey by Primes (Queue)
;-------------------------------
!zone {
ldx gTrack
dex
bne .exit
lda #$01
ldx #$95
jsr compare3 ; if T01,S01,$95 ==
!byte $4C,$32,$A3
bcs .exit ; passport-test-suite/Harvey by Primes.woz [C=0] here
ldy #$A2
sty gDisplayBytes+1 ; address (hi)
ldy #$82
sty gDisplayBytes+2 ; address (lo)
jsr PrintByID
!byte s_beforedos
inx
jsr modify1 ; then set T01,S01,$96 =
!byte $47
.exit
}

View File

@ -3,22 +3,20 @@
; encrypted bootloader hides an evil RWTS
;
; tested on
; - Sherwood Forest (Phoenix Software)
; - Mad Rat (Phoenix Software)
; - Masquerade (Phoenix Software)
; - Bats in the Belfry (Phoenix Software)
; - Bouncing Kamungas (Penguin Software)
; - Crime Wave (Penguin Software)
; - Mad Rat (Phoenix Software)
; - Masquerade (Phoenix Software)
; - Pensate (Penguin Software)
; - Sherwood Forest (Phoenix Software)
; - Thunder Bombs (Penguin Software)
; - The Spy Strikes Back (Penguin Software)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bmi +
- jmp .exit
+ bvc - ; nothing to do here in demuffin mode
lda gIsHolle
bne -
beq +
jmp .exit
+ lda gTrack
bne +
jmp .DecryptBootloader
@ -34,12 +32,10 @@
!byte $C9
bcs +
ldx #$91
ldy #$01
jsr compare
jsr compare1
!byte $DE
bcc +
ldy #$01
jsr modify
jsr modify1
!byte $DE
+
ldx #$2F
@ -50,12 +46,10 @@
!byte $C9
bcs +
ldx #$35
ldy #$01
jsr compare
jsr compare1
!byte $DE
bcc +
ldy #$01
jsr modify
jsr modify1
!byte $DE
+
ldx #$9D
@ -65,21 +59,53 @@
JSR $B8B8
bcs +
ldx #$9E
ldy #$01
jsr compare ; first data epilogue nibble (write)
jsr compare1 ; first data epilogue nibble (write)
!byte $DE
bcc +
ldx #$9E
ldy #$01
jsr modify
jsr modify1
!byte $DE
+
dec .sector+1
bpl .sector
; look for secondary RWTS that enforces elongated timing after data prologue
; e.g. Sherwood Forest
ldy #$09
jsr SearchTrack
!byte $49,$AD ; EOR #$AD
!byte $D0,$E7 ; BNE -
!byte $08 ; PHP
!byte $20,WILDCARD,WILDCARD ; JSR xxxx
!byte $28 ; PLP
bcs +
jsr inx4
jsr modify2
!byte $F0,$03 ; BEQ +3
; look for secondary disk volume number check
; e.g. Sherwood Forest
+ ldy #$03
jsr SearchTrack
!byte $A4,$1A ; LDY $1A
!byte $8C ; STY
bcs +
jsr modify2
!byte $A0,$00 ; LDY #$00
; look for save game disk volume number check
; e.g. Sherwood Forest
+ ldy #$05
jsr SearchTrack
!byte $AD,$16,$98 ; LDA $9816
!byte $F0,$0F ; BEQ +0F
bcs +
jsr inx4
jsr modify1
!byte $00
; look for secondary disk volume number check
; e.g. Crime Wave
ldy #$04
+ ldy #$04
jsr SearchTrack
LDA $2F
ORA $2E
@ -136,8 +162,8 @@
sta .decrypt1_store+2
sta .decrypt2+2
lda #s_decryptrwts
jsr PrintByID
!byte s_decryptrwts
inc gPatchCount
lda #$4C
.decrypt1
@ -182,8 +208,7 @@
.addressEpilogueEnd
bcs +
inx
ldy #$01
jsr modify ; normalize address epilogue 1st nibble
jsr modify1 ; normalize address epilogue 1st nibble
!byte $DE
+
ldy #(.dataPrologue3End-.dataPrologue3Start)
@ -199,8 +224,7 @@
inx
inx
inx
ldy #$02
jsr modify ; disable CPU-burning JSR after data prologue
jsr modify2 ; disable CPU-burning JSR after data prologue
!byte $F0,$03
+
ldy #(.dataEpilogue1End-.dataEpilogue1Start)
@ -212,8 +236,7 @@
.dataEpilogue1End
bcs +
inx
ldy #$01
jsr modify ; normalize data epilogue 1st nibble
jsr modify1 ; normalize data epilogue 1st nibble
!byte $DE
+
ldy #(.dataEpilogue3End-.dataEpilogue3Start)
@ -225,8 +248,7 @@
bcs +
inx
inx
ldy #$01
jsr modify ; ignore data epilogue 3rd nibble
jsr modify1 ; ignore data epilogue 3rd nibble
!byte $00
+
ldy #(.diskVolumeEnd-.diskVolumeStart)
@ -235,8 +257,7 @@
LDY $2F
.diskVolumeEnd
bcs +
ldy #$02
jsr modify ; don't use disk volume number to initialize data field checksum
jsr modify2 ; don't use disk volume number to initialize data field checksum
LDY #$00
+
ldy #(.alternatingTrackEnd-.alternatingTrackStart)
@ -246,8 +267,7 @@
AND #$01
.alternatingTrackEnd
bcs .exit
ldy #$01
jsr modify
jsr modify1
!byte $A9 ; EOR -> LDA so alternating track check always passes
jmp .exit

38
src/patchers/jmp2012.a Normal file
View File

@ -0,0 +1,38 @@
;-------------------------------
; #JMP2012
; Boot1 jumps to $B3C3 to read
; and decrypt a nibble check at
; $2012, which exits via $9D84
; if successful
; seems to be a variant of JMPB412
; with tighter code
;
; tested on
; - BackAid - The Start Disk (1987, BrainBank's Be Better Series)
;-------------------------------
!zone {
lda gTrack
cmp #$02
bne .exit
lda #$00
ldx #$E5
ldy #$06
jsr compare ; if T02,S00,$E8 ==
!byte $99,$12,$20; STA $2012,Y
!byte $C8 ; INY
!byte $D0,$F5 ; BNE -
bcs .exit ; passport-test-suite/BackAid.woz [C=0] matches
ldy #$20
sty gDisplayBytes+1 ; address (hi)
ldy #$12
sty gDisplayBytes+2 ; address (lo)
jsr PrintByID
!byte s_beforedos
ldx #$EC
jsr modify2 ; then set T02,S00,$EC =
!byte $84,$9D
.exit
}

View File

@ -1,27 +0,0 @@
;-------------------------------
; #JMPAE8E
; Late stage DOS jumps to $AE8E
; for a nibble check
; e.g. Alien Addition
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsBoot0 ; if DOS 3.3 boot0 loader
ora gIsBoot1 ; and DOS 3.3 boot1 loader
bne .exit
lda #$0D
ldx #$4D
ldy #$03
jsr compare ; and T00,S0D,$4D ==
!byte $4C,$8E,$AE
bcs .exit
lda #s_jmpae8e
jsr PrintByID
lda #$0D
ldx #$4E
ldy #$02
jsr modify ; then set T00,S0D,$4E =
!byte $80,$A1
.exit
}

Some files were not shown because too many files have changed in this diff Show More