mirror of
https://github.com/a2-4am/passport.git
synced 2024-06-01 00:41:29 +00:00
Compare commits
663 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a8c6676549 | ||
|
61b7818929 | ||
|
b2686f485e | ||
|
7829069ff4 | ||
|
43a719aa56 | ||
|
cc3a9c4f7e | ||
|
6213b948f8 | ||
|
161ff58b8d | ||
|
dec3ce3698 | ||
|
c9af84fa27 | ||
|
6bf634274f | ||
|
11f2ef57d6 | ||
|
8bd1523939 | ||
|
87582b60a4 | ||
|
8b11ac7320 | ||
|
39758aaba9 | ||
|
3e8f19deb4 | ||
|
25634996e2 | ||
|
d20981ed0e | ||
|
973c0699e4 | ||
|
cdb1d28920 | ||
|
84a1713b5b | ||
|
540c9fb161 | ||
|
98107fcb62 | ||
|
dc7b3d8cd3 | ||
|
b675e8f372 | ||
|
b250d98d23 | ||
|
c525e8c708 | ||
|
8a746d084f | ||
|
c07ce2713e | ||
|
8733220f7c | ||
|
00b9e98b8b | ||
|
44a8aceb62 | ||
|
ebcd3df3dd | ||
|
cd37eaba50 | ||
|
b5cdad368b | ||
|
4b6b066225 | ||
|
895b4fde82 | ||
|
424701bfde | ||
|
26215423bf | ||
|
5c329be886 | ||
|
b9b7d1f118 | ||
|
5f6f15ce78 | ||
|
d4793ce09f | ||
|
7abb12d5ef | ||
|
8540b47b47 | ||
|
37620387ac | ||
|
e6c4dc14c7 | ||
|
950fdf73fd | ||
|
4029dfbeac | ||
|
defb7f2ec0 | ||
|
f5a4613b12 | ||
|
cafecddaa2 | ||
|
81a3352ac5 | ||
|
6b90aef548 | ||
|
b0b6bfafbd | ||
|
984946a2b7 | ||
|
e437f8154a | ||
|
6c64f3b8c2 | ||
|
11086cd3e6 | ||
|
829b031a4f | ||
|
e9a37e2541 | ||
|
8ece0c8b6f | ||
|
2e03703343 | ||
|
01f0070939 | ||
|
f4aee49c5f | ||
|
75323c5b5d | ||
|
d6db17b402 | ||
|
12bfd649a6 | ||
|
c5448d52d6 | ||
|
fddb1f6bb0 | ||
|
5000366bc6 | ||
|
be3787a015 | ||
|
d3b96395ef | ||
|
c39072431f | ||
|
bff35a1895 | ||
|
55856a2dc3 | ||
|
d6a68f40f5 | ||
|
5fb1e40e0a | ||
|
7975003b15 | ||
|
63cb05140b | ||
|
78a8718662 | ||
|
04a3179328 | ||
|
f4eaf797a0 | ||
|
d9d502d50c | ||
|
9ba05c5e74 | ||
|
b87b0266e3 | ||
|
f96c63acfd | ||
|
f5fc9ae5bb | ||
|
ce39e396d3 | ||
|
aa5781ac15 | ||
|
183f029719 | ||
|
83c54392d2 | ||
|
1428b45731 | ||
|
23500497b2 | ||
|
c3ee6eb0fd | ||
|
c09940b377 | ||
|
cf88cbda4e | ||
|
fe6027b112 | ||
|
a673379742 | ||
|
43090d530f | ||
|
16bfd3441f | ||
|
aa2fe760c8 | ||
|
2ac9702c71 | ||
|
48e7c8cc55 | ||
|
cba62f83b0 | ||
|
20d53156ef | ||
|
722b9124ac | ||
|
1e750b3d88 | ||
|
6cd32f53e2 | ||
|
857b9c243a | ||
|
e505ed9206 | ||
|
696f20ba49 | ||
|
fe21da1a00 | ||
|
9ca2297c1d | ||
|
8ce3403acc | ||
|
4db0aaf0ad | ||
|
78a8a7e1e0 | ||
|
f938ac1a45 | ||
|
eab36f7bfc | ||
|
101c5ba5d7 | ||
|
91c0f4e805 | ||
|
2c32447cd0 | ||
|
10de85888b | ||
|
8368a71eb5 | ||
|
f0c6053489 | ||
|
2a9d6202ec | ||
|
48ee3499dc | ||
|
36b90a6070 | ||
|
20562ee2bb | ||
|
8ed8811e06 | ||
|
ebf2ab35d0 | ||
|
21368c8e7d | ||
|
98c8529f45 | ||
|
ce2e3b5813 | ||
|
e2a397815c | ||
|
2a594af93b | ||
|
0b4ab1d247 | ||
|
57c732896c | ||
|
59f21b31f9 | ||
|
087012a361 | ||
|
fb31cd38e0 | ||
|
6ff8d01da7 | ||
|
6dc5dfee34 | ||
|
4b35d87e00 | ||
|
5707f86588 | ||
|
2be2556ecb | ||
|
cee6753852 | ||
|
f1ad04d2dc | ||
|
479100ef9f | ||
|
aabfb0118a | ||
|
72f4ffb7d7 | ||
|
4b477a9dba | ||
|
daefedbb5d | ||
|
7a75188e4f | ||
|
9ecb49331b | ||
|
d435feef86 | ||
|
4672dbe928 | ||
|
b5372f438c | ||
|
79c3aacb75 | ||
|
5b02464c14 | ||
|
270f437c6f | ||
|
18c9d51da1 | ||
|
4ba29c86c1 | ||
|
0150b09f75 | ||
|
3e261a01e6 | ||
|
18d7e7f811 | ||
|
3aac011d2c | ||
|
8fbbb216fe | ||
|
e768648d54 | ||
|
fa07615ebf | ||
|
431499d41a | ||
|
f7de3777ee | ||
|
86692918e7 | ||
|
2ce68a439a | ||
|
db9c045d11 | ||
|
53f92388b0 | ||
|
b7d4a41909 | ||
|
6626ec5034 | ||
|
177591ddf1 | ||
|
7bde1d668f | ||
|
2a1dd8975d | ||
|
5e0cac5e0e | ||
|
ee83034bf1 | ||
|
74f76609c0 | ||
|
d1597bfb5f | ||
|
7bd584ec34 | ||
|
9a10d3c006 | ||
|
cefbc184a1 | ||
|
c490d4febb | ||
|
dc4490939e | ||
|
422684ca4d | ||
|
1a1f32e1e3 | ||
|
475954b6bb | ||
|
3ee3ce6689 | ||
|
b8242457ff | ||
|
b76b442431 | ||
|
f4c13c270d | ||
|
077bf65edd | ||
|
0aba4adb87 | ||
|
a99ac0d169 | ||
|
5552f8882b | ||
|
0290cd71c7 | ||
|
649917327e | ||
|
765bde89d7 | ||
|
d8c9f21877 | ||
|
8edd3da266 | ||
|
9fa5659a73 | ||
|
c6df2ec549 | ||
|
154aea3cd9 | ||
|
24a67c61fc | ||
|
003240e505 | ||
|
acf943baf1 | ||
|
f75eb39c67 | ||
|
a2d5b46b06 | ||
|
7d2c1bb12b | ||
|
d5945a7293 | ||
|
335f58cea1 | ||
|
fc74b8b31a | ||
|
e4f6ed2a26 | ||
|
3129a8d4e2 | ||
|
ff6e074bee | ||
|
6d713afd14 | ||
|
c0e1635e6b | ||
|
8b3325cd31 | ||
|
648507f1fd | ||
|
c6d2031368 | ||
|
5dc2360d58 | ||
|
955555aef7 | ||
|
0a21d6c020 | ||
|
691e6f8777 | ||
|
c475e8597c | ||
|
ef666f7b43 | ||
|
fa16586550 | ||
|
2cfec80809 | ||
|
ccf7bbe065 | ||
|
c586346bbd | ||
|
6e022888eb | ||
|
fb2df8a26c | ||
|
d86614f81b | ||
|
8f2e01cc23 | ||
|
b080cbf31c | ||
|
09b58e2c58 | ||
|
481e61cd0b | ||
|
79e30dda0e | ||
|
4b69dfdc46 | ||
|
c40a85b140 | ||
|
b5db14e87a | ||
|
8a244c82b9 | ||
|
62a9b63498 | ||
|
80c2b93165 | ||
|
3e9dd24ed9 | ||
|
6d70d7956d | ||
|
4a97d929eb | ||
|
3beb4c8b3d | ||
|
46b2019ba1 | ||
|
40c3a97cf0 | ||
|
2cccfd3e57 | ||
|
d4939063b9 | ||
|
b3a75e8748 | ||
|
4aa11ebfcb | ||
|
f386a55fc9 | ||
|
d1de957c6f | ||
|
8655cd707d | ||
|
fd96ba7922 | ||
|
9aef30b9b1 | ||
|
8bcc24c3f5 | ||
|
8eecd95baf | ||
|
8d136c6c5d | ||
|
4e1dba94ad | ||
|
de98679962 | ||
|
ed060454fd | ||
|
664be8577c | ||
|
91f8de836b | ||
|
44a208c5c4 | ||
|
c45bc8b51b | ||
|
2a8a10bc1e | ||
|
9bc6c06355 | ||
|
f4a106d102 | ||
|
dd934210f5 | ||
|
29679e0ed9 | ||
|
3f99d8f14c | ||
|
0bf69eacb2 | ||
|
cc6f10d749 | ||
|
2ae7d41df1 | ||
|
73ac1d29d2 | ||
|
51e1ea8a0c | ||
|
7ffaec6982 | ||
|
74f57dfe6a | ||
|
a183a67ac4 | ||
|
00a11f87d4 | ||
|
fecbcd1e1b | ||
|
ddc2f67b63 | ||
|
63b250d00e | ||
|
d63ced0fab | ||
|
7dea9214a0 | ||
|
8dda6c43c9 | ||
|
2a66e59951 | ||
|
a5a7da9b75 | ||
|
ebf83a430f | ||
|
22d60cec63 | ||
|
3cb2f61fa6 | ||
|
bbd5349e5c | ||
|
13a6e3928b | ||
|
198b432bc6 | ||
|
efcfdd8aa2 | ||
|
9fd7e03572 | ||
|
cbc5812a52 | ||
|
64b4126662 | ||
|
93eface4c3 | ||
|
23b5538d66 | ||
|
74f8e8b93f | ||
|
5e59b0f288 | ||
|
9b5f0277c7 | ||
|
622da85b5a | ||
|
9c149d5116 | ||
|
0d3bd353a3 | ||
|
1f01f41988 | ||
|
6d3cdc7581 | ||
|
d314e7be03 | ||
|
73270715a8 | ||
|
de7f80b18a | ||
|
d7a79419ef | ||
|
bcb432cec5 | ||
|
0e861f215a | ||
|
17a43ef07f | ||
|
3a2a4c0c4f | ||
|
2ec1105c5f | ||
|
9da4e5b0e8 | ||
|
292ed3bbed | ||
|
e591760739 | ||
|
7a9f7c850c | ||
|
d61b2aedce | ||
|
647616882f | ||
|
e56eded52e | ||
|
8788eee1c3 | ||
|
8113c31805 | ||
|
5a059dca7f | ||
|
68acfb8792 | ||
|
f9792eb960 | ||
|
868c297916 | ||
|
f0d36517ca | ||
|
f1ccddc268 | ||
|
b0c980d184 | ||
|
a6a7227cc5 | ||
|
048823c6f8 | ||
|
be6e35f29c | ||
|
904100c21e | ||
|
3cd5107a0c | ||
|
fb841ac259 | ||
|
f26ea5d47e | ||
|
43155dbcb1 | ||
|
65447689a1 | ||
|
48bcc53f25 | ||
|
f2e6b21cd4 | ||
|
0d5c345b63 | ||
|
55a64729ca | ||
|
7d6cd36e74 | ||
|
bb5d7c6319 | ||
|
e432afd3e0 | ||
|
6ecee0b318 | ||
|
448c20472e | ||
|
ae5016cf49 | ||
|
cdef0b322c | ||
|
6ebce5d99c | ||
|
12eaff0dc0 | ||
|
94637816bb | ||
|
384a510b4d | ||
|
e8eb90f592 | ||
|
5fc2c6fc96 | ||
|
b246580f98 | ||
|
8e694a09b9 | ||
|
d750cd2ef9 | ||
|
374e5b0d95 | ||
|
d7324f72d6 | ||
|
4a078e516b | ||
|
f689a0d100 | ||
|
6790ff81a0 | ||
|
cbf2804262 | ||
|
50c2d47a4e | ||
|
646e07ec0c | ||
|
9daae4417a | ||
|
8ff4133522 | ||
|
8b8dd413ae | ||
|
3e42659f1e | ||
|
7d79ba1638 | ||
|
c8912f67c1 | ||
|
935779e6e8 | ||
|
33ff9199d0 | ||
|
c8c61911ae | ||
|
fc79688749 | ||
|
23c3bb623c | ||
|
c2b0866f70 | ||
|
707fce4474 | ||
|
a6fced1381 | ||
|
cf0f245283 | ||
|
f9f3a67b1a | ||
|
562145bfbd | ||
|
f95c77f858 | ||
|
845b1693ca | ||
|
870666d15f | ||
|
6ceb65808d | ||
|
6c8ecc6498 | ||
|
af64599488 | ||
|
7941fcb327 | ||
|
05f8b2e2e0 | ||
|
ffde50cb9e | ||
|
1ec677bed0 | ||
|
fce2a8b1ae | ||
|
063f4e16be | ||
|
7517be5eaa | ||
|
578365f80e | ||
|
7c6ee6e9cb | ||
|
c309ea313e | ||
|
22b2c8a867 | ||
|
8740b3447c | ||
|
4e2ddef1d7 | ||
|
3601c5be62 | ||
|
74a6d52420 | ||
|
2ea34407e6 | ||
|
f909ff30fd | ||
|
335048eaf4 | ||
|
1d2ab40c16 | ||
|
26b5467497 | ||
|
15bec30684 | ||
|
edb2ebd60c | ||
|
852dfc43f5 | ||
|
646157a1f5 | ||
|
48e3a33d38 | ||
|
4ad309bad2 | ||
|
4c3b45e1e9 | ||
|
8ce6297ad1 | ||
|
0dab9cf097 | ||
|
9b1721af99 | ||
|
108ccbb2d2 | ||
|
4e1dc2929d | ||
|
02780b53ab | ||
|
831441425d | ||
|
0618041e91 | ||
|
314f4e9794 | ||
|
1f9d89e250 | ||
|
f1160b90e0 | ||
|
617a2020b6 | ||
|
8b58e3b94f | ||
|
7ac054c7b4 | ||
|
c64b3eed16 | ||
|
052894065a | ||
|
639c442cb5 | ||
|
31bde9b039 | ||
|
64a06d71ba | ||
|
e9644e498f | ||
|
4caa2c5e36 | ||
|
9c015c9f1f | ||
|
fb2e4c3a7a | ||
|
ce28514a54 | ||
|
8c96618beb | ||
|
26ae141203 | ||
|
132a8eb138 | ||
|
dad9aeae8d | ||
|
9a845de251 | ||
|
a447409bdc | ||
|
62c6978cf8 | ||
|
92626d897d | ||
|
6d21441277 | ||
|
07c1635512 | ||
|
81bb88e0b2 | ||
|
cef1aeb329 | ||
|
a56a2a3537 | ||
|
794c7eb13b | ||
|
4ab8e0c4d9 | ||
|
2d9e23c65d | ||
|
ec07283d7f | ||
|
3cba1de488 | ||
|
a8317f488c | ||
|
d1b194dc6d | ||
|
7b7a810bb0 | ||
|
a20d00e90c | ||
|
2fb3c16c83 | ||
|
51f62dcc99 | ||
|
8af8e3c4a2 | ||
|
5facba69f3 | ||
|
fd4eb96d71 | ||
|
0175335383 | ||
|
616d71b452 | ||
|
95c9051019 | ||
|
7a8bfe943f | ||
|
1c1ed5d95b | ||
|
288f87cd4b | ||
|
fe8d073c99 | ||
|
e3d4194e47 | ||
|
fd62b7fbaf | ||
|
202ee089ca | ||
|
dd1327f4be | ||
|
ac89a16dec | ||
|
75080ec675 | ||
|
89f0420516 | ||
|
a436bf7aba | ||
|
f6a75a8aa6 | ||
|
d6e3e0033e | ||
|
5ed95fa109 | ||
|
af663aab6e | ||
|
c1a591b6ed | ||
|
d5aef5c77c | ||
|
e1db615ad0 | ||
|
50b114b7fe | ||
|
4df6692eeb | ||
|
3d94228f0d | ||
|
52934e4566 | ||
|
df4343cdea | ||
|
2faeebc38f | ||
|
b012d335e5 | ||
|
8ec251bd87 | ||
|
522b16c352 | ||
|
bfa675b13b | ||
|
e7d8d55d94 | ||
|
17dfda1eba | ||
|
df6070b0b0 | ||
|
01e7bc86cc | ||
|
85d776157f | ||
|
62f33b3428 | ||
|
13b6061bc1 | ||
|
31666546f6 | ||
|
0cba115097 | ||
|
c40ab9eb4f | ||
|
5d048bdd0d | ||
|
593c3bebab | ||
|
f46863bf4c | ||
|
e9b12036d1 | ||
|
9123b40282 | ||
|
78d4c3eb06 | ||
|
59bde34b30 | ||
|
79e2b1f64e | ||
|
b5c4c782fd | ||
|
8f56e6621f | ||
|
4302cea943 | ||
|
6df5814826 | ||
|
4db5c1fc21 | ||
|
338e65caa5 | ||
|
1c5fdcfed3 | ||
|
d8a60b1ba4 | ||
|
a28ab279df | ||
|
9d9146382b | ||
|
1b9a1c847e | ||
|
5d9bc2243f | ||
|
f62c654690 | ||
|
bba448c1e7 | ||
|
48706b4067 | ||
|
f7693d117d | ||
|
d7e83af2bf | ||
|
2baf15faff | ||
|
5bbce307a8 | ||
|
04161ee164 | ||
|
1d33c0d9b9 | ||
|
c23d378bc4 | ||
|
3eb00c6654 | ||
|
283fa4ce8a | ||
|
b0384941bd | ||
|
7d13281f8a | ||
|
3760fc0169 | ||
|
a243c97f68 | ||
|
d07c4e3ebb | ||
|
a501879fdf | ||
|
3ee6fa37bc | ||
|
9eb4b5044d | ||
|
62917dfec9 | ||
|
586cfb9473 | ||
|
f7b50af0e0 | ||
|
eaf787cbe1 | ||
|
4da8e041b4 | ||
|
bd2be836a8 | ||
|
f7ede6ef84 | ||
|
015103f468 | ||
|
cffd09852b | ||
|
c9b3ecefc1 | ||
|
12530f8f6f | ||
|
b311927145 | ||
|
06ebbba4ae | ||
|
eac3ec982d | ||
|
9d0bfab74a | ||
|
1ce44ea234 | ||
|
086a6b1b20 | ||
|
92535abbcc | ||
|
04469d1cf9 | ||
|
efb87d2e64 | ||
|
74185f274f | ||
|
fe5252f2fe | ||
|
8213426c0f | ||
|
9b1f451930 | ||
|
34a2ae967f | ||
|
05ede0cf19 | ||
|
94d81d8c2c | ||
|
b55676292a | ||
|
546494dc88 | ||
|
846becbeed | ||
|
51d16db26b | ||
|
d68ac00436 | ||
|
125a344fb7 | ||
|
4c32ad028c | ||
|
10b42d2475 | ||
|
87dfe23379 | ||
|
b23817a769 | ||
|
4278a70f23 | ||
|
bdda0f89ea | ||
|
8062a6cc2b | ||
|
bf5501f26a | ||
|
ca40730662 | ||
|
7f929bf227 | ||
|
67be9b688f | ||
|
4ddb44d6e9 | ||
|
d78b359dd1 | ||
|
738bb22bdf | ||
|
a5326914ea | ||
|
808a77ee19 | ||
|
373bf8bd33 | ||
|
98ee070bbd | ||
|
4682ae095d | ||
|
c24598a4d3 | ||
|
760650802f | ||
|
9e3664f630 | ||
|
2f7d6119e1 | ||
|
4c2c8ec6ff | ||
|
bcff14c086 | ||
|
2dcd475e08 | ||
|
642db7e409 | ||
|
799a2d45ce | ||
|
980e66bd64 | ||
|
5304fbdaf0 | ||
|
6742c4161c | ||
|
469cb2c380 | ||
|
0c7384b9fc | ||
|
0b6afb0fad | ||
|
a74cc9b78a | ||
|
e216ba12e9 | ||
|
309a09c385 | ||
|
34b26667d7 | ||
|
b1ba5bf32a | ||
|
5e060a2dc4 | ||
|
b7c168ecaa | ||
|
3cbb4984fa | ||
|
5dd679230e | ||
|
42e07830e3 | ||
|
aa82787654 | ||
|
01691a5f9c | ||
|
bbc8fec036 | ||
|
bcb7a1d1eb | ||
|
677244978a | ||
|
cca5364823 | ||
|
0b19b9a14a | ||
|
fd0dd20afe | ||
|
835598349d | ||
|
bdbfcde5d2 | ||
|
28ff54ed44 | ||
|
eb50cbf8f8 | ||
|
9bbaddf1be | ||
|
e3445b08bf | ||
|
24c0a9fa9d | ||
|
ad0d6bdff3 | ||
|
1eb86bf597 | ||
|
0b2e96cacb | ||
|
81caf5b722 | ||
|
6f496a747d | ||
|
b90f60349b | ||
|
47acabad9a |
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 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
|
||||
|
|
46
Makefile
46
Makefile
|
@ -11,22 +11,52 @@
|
|||
|
||||
# third-party tools required to build
|
||||
# https://sourceforge.net/projects/acme-crossass/
|
||||
ACME=`which acme`
|
||||
# https://sourceforge.net/projects/applecommander/
|
||||
AC=bin/AppleCommander.jar
|
||||
ACME=acme
|
||||
# https://www.brutaldeluxe.fr/products/crossdevtools/cadius/
|
||||
# https://github.com/mach-kernel/cadius
|
||||
CADIUS=cadius
|
||||
# https://bitbucket.org/magli143/exomizer/wiki/Home
|
||||
# requires Exomizer 3.0 or later
|
||||
EXOMIZER=exomizer
|
||||
|
||||
BUILDDISK=build/passport.po
|
||||
BUILDDISK=build/passport
|
||||
|
||||
asm:
|
||||
mkdir -p build
|
||||
cd src && $(ACME) passport.a && cd -
|
||||
cp res/work.po $(BUILDDISK)
|
||||
java -jar $(AC) -p $(BUILDDISK) "PASSPORT.SYSTEM" sys 0x2000 < build/PASSPORT.SYSTEM
|
||||
cd src/mods && $(ACME) universalrwts.a
|
||||
$(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) 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) -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/
|
||||
$(CADIUS) ADDFILE "${BUILDDISK}".po "/PASSPORT/" "build/PASSPORT.SYSTEM"
|
||||
bin/po2do.py build/ build/
|
||||
rm "$(BUILDDISK)".po
|
||||
|
||||
clean:
|
||||
rm -rf build/
|
||||
|
||||
mount:
|
||||
osascript bin/V2Make.scpt "`pwd`" $(BUILDDISK)
|
||||
open "$(BUILDDISK)".dsk
|
||||
|
||||
all: clean asm mount
|
||||
|
|
800
README.md
Normal file
800
README.md
Normal file
|
@ -0,0 +1,800 @@
|
|||
# Passport
|
||||
a verification and copy program for
|
||||
5.25-inch Apple II floppy disks
|
||||
|
||||
Minimum system requirements:
|
||||
- Apple //e, //c, IIgs, or ][+ with 64K
|
||||
- Two 5.25-inch disk drives(*)
|
||||
|
||||
(*) fully compatible with floppy drive
|
||||
emulators like CFFA3000 and FloppyEMU.
|
||||
|
||||
## Some fun facts about copy protection
|
||||
|
||||
1. Many companies, especially smaller
|
||||
ones, outsourced their protection.
|
||||
I have seen byte-for-byte identical
|
||||
copy protection on disks from seven
|
||||
different companies!
|
||||
|
||||
2. Even companies that wrote their own
|
||||
copy protection would try to re-use
|
||||
it on multiple disks to get the most
|
||||
"bang for the buck."
|
||||
|
||||
3. Not everything has been cracked!
|
||||
Because there was so much piracy in
|
||||
the 1980s, some people assume that
|
||||
everything ever published has been
|
||||
cracked, digitized, and preserved in
|
||||
an emulator-friendly format. In
|
||||
reality, there are hundreds of disks
|
||||
that have never been cracked. Thirty
|
||||
years later, these programs are
|
||||
still trapped on physical media,
|
||||
literally rotting away.
|
||||
|
||||
## Usage
|
||||
|
||||
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.
|
||||
|
||||
If all goes well, Passport will read
|
||||
your original disk and write a copy in
|
||||
a standard format, then remove any
|
||||
protection checks from the copy. The
|
||||
copy will boot and run just as well as
|
||||
the original disk, but it will be
|
||||
copyable with COPYA or any full-disk
|
||||
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
|
||||
reduce the number of original disks in
|
||||
the world; they aren't making any more
|
||||
of them.
|
||||
|
||||
## Supported protections
|
||||
|
||||
Passport targets common protection
|
||||
schemes that were reused by multiple
|
||||
companies. These types of protection
|
||||
were common in educational software.
|
||||
|
||||
- Abracadata
|
||||
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
|
||||
|
||||
- ArtSci
|
||||
e.g. AceCalc, Magicalc
|
||||
|
||||
- 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,
|
||||
Buzz Bang Harvey
|
||||
|
||||
- DesignWare
|
||||
e.g. Spellicopter, Crypto Cube
|
||||
|
||||
- Developmental Learning Materials
|
||||
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 Publishing
|
||||
e.g. Math Leap Frog, Math Football
|
||||
|
||||
- Grolier Publishing
|
||||
e.g. NoteCard Maker, EduCalc
|
||||
|
||||
- Hartley Courseware
|
||||
e.g. Chariots, Cougars, and Kings;
|
||||
Tim and the Cat and the Big Red Hat
|
||||
|
||||
- Hayden Software
|
||||
e.g. SAT Score Improvement System,
|
||||
Microscopic Journey
|
||||
|
||||
- Heartsoft
|
||||
e.g. Electric Chalkboard, Tommy the
|
||||
Time-Telling Turtle
|
||||
|
||||
- Hoffman
|
||||
e.g. Good Thinking! series
|
||||
|
||||
- Houghton-Mifflin
|
||||
e.g. Game Frame One, Math Masters
|
||||
|
||||
- HRM Software
|
||||
e.g. Gene Machine, Heredity Dog
|
||||
|
||||
- Josten Learning Systems
|
||||
e.g. Building Reading Skills,
|
||||
Explorations in Science
|
||||
|
||||
- Krell Software
|
||||
e.g. Time Traveler, College Boards
|
||||
|
||||
- Laureate Learning Systems
|
||||
e.g. Concentrate on Words & Concepts
|
||||
|
||||
- The Learning Company
|
||||
e.g. Bumble Games, Gertrude's Secrets
|
||||
|
||||
- Learning Multi-Systems
|
||||
e.g. Solar Reading
|
||||
|
||||
- Learning Technologies
|
||||
e.g. Animal Hotel, Bike Hike
|
||||
|
||||
- McCarthy-McCormack
|
||||
e.g. Vowel Corral, Library Magic
|
||||
|
||||
- Marshware
|
||||
e.g. Squeegee Learns About Drugs
|
||||
|
||||
- Mastery Development
|
||||
e.g. Mastery Arithmetic Games
|
||||
|
||||
- MECC
|
||||
e.g. Word Munchers, Clock Works
|
||||
|
||||
- Media Basics
|
||||
e.g. Return to Reading (series)
|
||||
|
||||
- Methods & Solutions
|
||||
e.g. Fantasy Land, Behind The Wheel
|
||||
|
||||
- Micrograms Publishing
|
||||
e.g. Wild West Math, Granny
|
||||
Applebee's Cookie Factory
|
||||
|
||||
- Millennium Group
|
||||
e.g. The Brain Game, Concentration
|
||||
|
||||
- Milliken Publishing
|
||||
e.g. Math Sequences
|
||||
|
||||
- MindPlay
|
||||
e.g. Fraction-oids, Dyno-Quest
|
||||
|
||||
- Mindscape
|
||||
e.g. The Halley Project, Paperboy
|
||||
|
||||
- MUSE
|
||||
e.g. RobotWar, Caverns of Freitag
|
||||
|
||||
- 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
|
||||
|
||||
- Phoenix Software
|
||||
e.g. Zoom Grafix
|
||||
|
||||
- Polarware
|
||||
e.g. The Electric Crayon (series),
|
||||
The Spy's Adventures (series)
|
||||
|
||||
- Quest Learning Systems
|
||||
e.g. Bingo Bugglebee Presents Home
|
||||
Alone, Outdoor Safety
|
||||
|
||||
- Queue
|
||||
e.g. Force and Motion, Practical
|
||||
Grammar
|
||||
|
||||
- Random House
|
||||
e.g. Snoopy to the Rescue, Charlie
|
||||
Brown's ABCs
|
||||
|
||||
- Reader's Digest
|
||||
e.g. Key Lingo, Cogito
|
||||
|
||||
- Scholastic
|
||||
e.g. Math Shop, Microzine
|
||||
|
||||
- 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
|
||||
|
||||
- Springboard Software
|
||||
e.g. Early Games for Young Children,
|
||||
Puzzle Master, Mask Parade
|
||||
|
||||
- Sunburst Communications
|
||||
e.g. M-ss-ng L-nks, The Incredible
|
||||
Laboratory
|
||||
|
||||
- Thunder Mountain
|
||||
e.g. Pathwords, Quink
|
||||
|
||||
- Troll Associates
|
||||
e.g. Dino Dig, Make A Face
|
||||
|
||||
- Unicorn Software
|
||||
e.g. Magical Myths, Ten Little Robots
|
||||
|
||||
- Woodbury Software
|
||||
e.g. PlayWriter (series)
|
||||
|
||||
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
|
||||
|
||||
- Adventure International
|
||||
e.g. Adventureland, Strange Odyssey
|
||||
|
||||
- Atari
|
||||
e.g. Defender, Gremlins
|
||||
|
||||
- Baudville
|
||||
e.g. Blazing Paddles, Take 1
|
||||
|
||||
- Border
|
||||
e.g. Arena, Early Bird
|
||||
|
||||
- Broderbund
|
||||
e.g. Where in Time Is Carmen Sandiego,
|
||||
Choplifter
|
||||
|
||||
- Coastal
|
||||
e.g. The Chalice of Mostania
|
||||
|
||||
- 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
|
||||
|
||||
- Epyx
|
||||
e.g. Summer Games, Deathsword
|
||||
|
||||
- Gebelli
|
||||
e.g. Horizon V, Russki Duck
|
||||
|
||||
- HAL Labs
|
||||
e.g. Sheila, Super Taxman II
|
||||
|
||||
- Infocom
|
||||
e.g. Planetfall, Zork I/II/III
|
||||
|
||||
- Interplay
|
||||
e.g. Borrowed Time, Tracer Sanction
|
||||
|
||||
- Leisure Genius
|
||||
e.g. Clue Master Detective, RISK
|
||||
|
||||
- MicroFun
|
||||
e.g. Crown of Arthain, Miner 2049er
|
||||
|
||||
- Origin Systems
|
||||
e.g. Ultima V, Times of Lore
|
||||
|
||||
- Penguin Software
|
||||
e.g. Xyphus, Thunder Bombs
|
||||
|
||||
- Phoenix Software
|
||||
e.g. Sherwood Forest, Masquerade
|
||||
|
||||
- Polarware
|
||||
e.g. Oo-topos, The Crimson Crown
|
||||
|
||||
- Professional Software
|
||||
e.g. Trivia Fever
|
||||
|
||||
- Softape
|
||||
e.g. Photar
|
||||
|
||||
- Sierra On-Line (patcher by qkumba)
|
||||
e.g. BC's Quest for Tires, Sammy
|
||||
Lightfoot
|
||||
|
||||
- Strategic Simulations
|
||||
e.g. The Eternal Dagger, The Shard of
|
||||
Spring, Roadwar Europa, Warship
|
||||
|
||||
- Trillium
|
||||
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-2023 by 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 in the Software without
|
||||
restriction, including without
|
||||
limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the
|
||||
Software, and to permit persons to whom
|
||||
the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this
|
||||
permission notice shall be included in
|
||||
all copies or substantial portions of
|
||||
the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS",
|
||||
WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
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)
|
||||
- NEW: verify Infocom 18-sector disks
|
||||
(by qkumba)
|
||||
- NEW: patchers/artsci.a (AceCalc,
|
||||
Magicalc, Photar)
|
||||
- NEW: patchers/choplifter.a (Russki
|
||||
Duck, Choplifter) (by qkumba)
|
||||
- NEW: patchers/dakin5.a (Neutrons,
|
||||
MIRV, Rings of Saturn)
|
||||
- NEW: patchers/e7everywhere.a (Curious
|
||||
George series, Garfield Trivia Game)
|
||||
- NEW: patchers/hallabs.a (Sheila,
|
||||
Super Taxman II)
|
||||
- NEW: patchers/hoffman.a (Good
|
||||
Thinking! series)
|
||||
- NEW: patchers/holle.a (Crime Wave,
|
||||
Sherwood Forest)
|
||||
- NEW: patchers/muserwts.a (Caverns of
|
||||
Freitag, The Function Game)
|
||||
- NEW: patchers/springboard.a (The
|
||||
Newsroom, The Chalice of Mostania)
|
||||
- NEW: patchers/zoomgrafix.a (Zoom
|
||||
Grafix - all versions)
|
||||
- IMPROVED: id/trace33p.a (fixes Kaves
|
||||
of Karkhan)
|
||||
- IMPROVED: patchers/diskvol.a (fixes
|
||||
Diet Analysis Program)
|
||||
- [test suite](https://github.com/a2-4am/passport-test-suite)
|
||||
|
||||
2018-10-14
|
||||
- NEW: 13-sector MUSE support
|
||||
- NEW: 13-sector Sierra support (by
|
||||
qkumba)
|
||||
- NEW: 13-sector RDOS support (SSI) (by
|
||||
qkumba)
|
||||
- NEW: PanglosDOS (per-file encryption)
|
||||
(by qkumba)
|
||||
- NEW: Dinkey-DOS support (Ultima V)
|
||||
- NEW: Interplay support (The Tracer
|
||||
Sanction, Borrowed Time)
|
||||
- NEW: Davidson & Associates support
|
||||
(Math Blaster Plus)
|
||||
- NEW: Penguin RWTS (Xyphus)
|
||||
- NEW: MicroFun RWTS (Crown of Arthain)
|
||||
- NEW: Swordthrust RWTS
|
||||
- NEW: patchers/f7f6.a (Might & Magic)
|
||||
- NEW: patchers/trillium (Rendezvous
|
||||
with Rama, Fahrenheit 451)
|
||||
- NEW: patchers/fbffencrypted.a
|
||||
(Clue, RISK, ESL Writer)
|
||||
- NEW: patchers/fbffpascal.a
|
||||
(Widespread, The Typewriter)
|
||||
- NEW: patchers/polarware.a
|
||||
(Oo-topos, The Crimson Crown)
|
||||
- NEW: patchers/microfun.a (The Heist,
|
||||
Station 5, Miner 2049er)
|
||||
- NEW: print volume name on ProDOS,
|
||||
Pascal, and DOS 3.3 + variants
|
||||
- IMPROVED: patchers/jmpb4bb.a
|
||||
(fixes Rubik's Cube Unlocked)
|
||||
- IMPROVED: id/advint.a
|
||||
(fixes The Curse of Crowley Manor)
|
||||
- IMPROVED: detection of unformatted
|
||||
tracks (fixes Thunder Bombs)
|
||||
- IMPROVED: Micrograms detection
|
||||
(fixes Shapes and Patterns)
|
||||
- IMPROVED: patchers/bbf9.a
|
||||
(fixes Magic Slate II 20-column)
|
||||
- IMPROVED: patchers/memory.config.a
|
||||
(fixes Where Did My Toothbrush Go)
|
||||
- IMPROVED: patchers/c9ff.a
|
||||
(fixes Swiss Family Robinson)
|
||||
- IMPROVED: patchers/bb03.a
|
||||
(fixes Alice in Wonderland)
|
||||
- IMPROVED: patchers/optimum.a
|
||||
(fixes Fat City)
|
||||
- IMPROVED: logging track and sector
|
||||
when switching to built-in RWTS
|
||||
|
||||
2017-11-14
|
||||
- Supports ProDOS RAM disks to read an
|
||||
entire disk at once (IIgs RAM disk,
|
||||
RAMFactor, RAMWorks, modern clones)
|
||||
- NEW: DOS 3.2 support (MUSE, Edu-Ware,
|
||||
Hartley, Krell, Hayden, DLM)
|
||||
- NEW: patchers/advint.a, an encrypted
|
||||
nibble check (Scott Adams adventures)
|
||||
- NEW: patchers/bbf9.a, a desync
|
||||
bitstream (late Sunburst disks)
|
||||
- NEW: patchers/jmpb400.a, a self-
|
||||
decrypting nibble check in late boot
|
||||
(Mindscape, DLM, Thunder Mountain)
|
||||
- NEW: patchers/memory.config.a, ProDOS
|
||||
startup program with nibble check
|
||||
(DC Heath, Marshware)
|
||||
- NEW: patchers/pascalrwts.a
|
||||
(Learning Multi-Systems)
|
||||
- NEW: patchers/sra.a (SRA)
|
||||
- NEW: patchers/rwtslog.a, refactored
|
||||
and expanded log of RWTS variants
|
||||
- NEW: id/micrograms.a (Micrograms)
|
||||
- NEW: id/rdos.a (SSI)
|
||||
- NEW: support for early Infocom disks
|
||||
- IMPROVED: patchers/a6bc95.a
|
||||
(fixes Friendly Filer)
|
||||
- IMPROVED: patchers/jmpbeb1.a
|
||||
(fixes Spelling Rules)
|
||||
- IMPROVED: patchers/sierra.a
|
||||
(fixes Winnie The Pooh)
|
||||
- IMPROVED: id/laureate.a
|
||||
(fixes Sound Ideas)
|
||||
|
||||
2017-05-14
|
||||
- NEW: patcher for Activision (by TRex)
|
||||
- NEW: patcher for Electronic Arts (by
|
||||
qkumba)
|
||||
- NEW: patcher for Sierra On-Line (by
|
||||
qkumba, replaces old patcher)
|
||||
- NEW: patcher for Optimum Resource (by
|
||||
qkumba, replaces old patcher)
|
||||
- NEW: patcher for Gamco Software
|
||||
- NEW: patcher for Border Software
|
||||
- NEW: patcher for Blue Chip Software
|
||||
- NEW: patcher for Houghton-Mifflin
|
||||
- NEW: patcher for Milliken Publishing
|
||||
- NEW: patcher for Methods & Solutions
|
||||
- NEW: patcher for Laureate Learning
|
||||
- NEW: detection of LSR $6A ProDOS RWTS
|
||||
- NEW: identification of Pronto-DOS,
|
||||
Diversi-DOS, David DOS, and Quick-DOS
|
||||
- IMPROVED: patcher for MECC
|
||||
(fixes Word Munchers v1.1)
|
||||
- IMPROVED: patcher for Scholastic
|
||||
(fixes Bank Street Writer II)
|
||||
- IMPROVED: patcher for Grolier
|
||||
(fixes Countries of the World)
|
||||
- migrated build to ACME assembler and
|
||||
source code to GitHub (by qkumba)
|
||||
|
||||
2016-12-30
|
||||
- add support for DOS 3.3P
|
||||
e.g. Ernie's Quiz, Instant Zoo
|
||||
- improve support for disks created
|
||||
with MECC Database
|
||||
- faster detection of 4-and-4 encoding
|
||||
and 5-and-3 encoding (neither is
|
||||
supported)
|
||||
- various speed improvements
|
||||
|
||||
2016-09-02
|
||||
- add support for Protected.DOS
|
||||
e.g. Moebius, Math Blaster
|
||||
- add support for "JMP $B660" RWTS
|
||||
e.g. Verb Viper, Master Match
|
||||
- add support for Datasoft encrypted
|
||||
bootloader
|
||||
e.g. Tomahawk, Video Title Shop
|
||||
- fix bug in boot sector detection that
|
||||
erroneously claimed some disks were
|
||||
unreadable
|
||||
- add informational messages about some
|
||||
RWTS variants (LSR $6A, BCS $08)
|
||||
- refactor code in /id/ directory
|
||||
|
||||
2016-07-12
|
||||
- initial release
|
Binary file not shown.
BIN
bin/V2Make.scpt
BIN
bin/V2Make.scpt
Binary file not shown.
39
bin/po2do.js
Normal file
39
bin/po2do.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
kMap = [0x00,
|
||||
0x0E,
|
||||
0x0D,
|
||||
0x0C,
|
||||
0x0B,
|
||||
0x0A,
|
||||
0x09,
|
||||
0x08,
|
||||
0x07,
|
||||
0x06,
|
||||
0x05,
|
||||
0x04,
|
||||
0x03,
|
||||
0x02,
|
||||
0x01,
|
||||
0x0F
|
||||
]
|
||||
|
||||
a = new ActiveXObject("scripting.filesystemobject")
|
||||
for (b = new Enumerator(a.GetFolder(WScript.Arguments(0)).files); !b.atEnd(); b.moveNext())
|
||||
{
|
||||
if (a.GetExtensionName(b.item()).toLowerCase() == "po")
|
||||
{
|
||||
fi = a.opentextfile(b.item())
|
||||
fo = a.createtextfile(WScript.Arguments(1)+"\\"+a.GetBaseName(b.item())+".dsk", 1)
|
||||
for (track = 0; track < 0x23; ++track)
|
||||
{
|
||||
sectors = new Array(0x10)
|
||||
for (dos_sector = 0; dos_sector < 0x10; ++dos_sector)
|
||||
{
|
||||
sectors[kMap[dos_sector]] = fi.read(256)
|
||||
}
|
||||
for (dos_sector = 0; dos_sector < 0x10; ++dos_sector)
|
||||
{
|
||||
fo.write(sectors[dos_sector])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
bin/po2do.py
Executable file
33
bin/po2do.py
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import glob
|
||||
import os.path
|
||||
|
||||
kMap = {0x00: 0x00,
|
||||
0x07: 0x08,
|
||||
0x0E: 0x01,
|
||||
0x06: 0x09,
|
||||
0x0D: 0x02,
|
||||
0x05: 0x0A,
|
||||
0x0C: 0x03,
|
||||
0x04: 0x0B,
|
||||
0x0B: 0x04,
|
||||
0x03: 0x0C,
|
||||
0x0A: 0x05,
|
||||
0x02: 0x0D,
|
||||
0x09: 0x06,
|
||||
0x01: 0x0E,
|
||||
0x08: 0x07,
|
||||
0x0F: 0x0F}
|
||||
|
||||
indir, outdir = sys.argv[1:3]
|
||||
|
||||
for infile in glob.glob(os.path.join(indir, "*.po")):
|
||||
outfile = os.path.join(outdir, os.path.splitext(os.path.basename(infile))[0] + ".dsk")
|
||||
with open(infile, 'rb') as f, open(outfile, 'wb') as g:
|
||||
for track in range(0, 0x23):
|
||||
sectors = [bytes(256)] * 0x10
|
||||
for dos_sector in range(0, 0x10):
|
||||
sectors[kMap[dos_sector]] = f.read(256)
|
||||
g.write(b"".join(sectors))
|
BIN
res/Universal RWTS.dsk
Executable file
BIN
res/Universal RWTS.dsk
Executable file
Binary file not shown.
1
res/_FileInformation.txt
Normal file
1
res/_FileInformation.txt
Normal file
|
@ -0,0 +1 @@
|
|||
PASSPORT.SYSTEM=Type(FF),AuxType(2000),Access(C3)
|
File diff suppressed because one or more lines are too long
BIN
res/work.po
BIN
res/work.po
Binary file not shown.
290
src/adstyle.a
Normal file
290
src/adstyle.a
Normal 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
|
426
src/analyze.a
426
src/analyze.a
|
@ -1,426 +0,0 @@
|
|||
;-------------------------------
|
||||
; SkipTrack
|
||||
; out: C clear if we should skip this track
|
||||
; C set if we should not skip this track
|
||||
;-------------------------------
|
||||
!zone {
|
||||
SkipTrack
|
||||
;
|
||||
; 1) $EEEF protection track (EEEFBBBAFAAE nibble sequence)
|
||||
; [must come first because track would otherwise pass the IsUnformatted test below]
|
||||
; [speed optimization: only check on track $22]
|
||||
;
|
||||
.checkeeef
|
||||
lda gTrack
|
||||
cmp #$22
|
||||
bne .checkunformat
|
||||
jsr IsEEEF
|
||||
bcs .checkunformat
|
||||
lda #s_eeef
|
||||
bcc .skiptrack ; always taken
|
||||
;
|
||||
; 2) unformatted track
|
||||
;
|
||||
.checkunformat
|
||||
jsr IsUnformatted
|
||||
bcs .checkf7
|
||||
lda #s_unformat
|
||||
bcc .skiptrack ; always taken
|
||||
;
|
||||
; 3) $F7 protection track (F7F6EFEAAB nibble sequence)
|
||||
;
|
||||
.checkf7
|
||||
jsr IsF7
|
||||
bcs .checksync
|
||||
lda #s_f7
|
||||
bcc .skiptrack ; always taken
|
||||
;
|
||||
; 4) nibble count track (mostly $FF sync bytes)
|
||||
;
|
||||
.checksync
|
||||
jsr IsSyncBytes
|
||||
bcs .checktrack6
|
||||
lda #s_sync
|
||||
bcc .skiptrack ; always taken
|
||||
|
||||
;
|
||||
; 5) track simply does not exist (Electronic Arts in particular)
|
||||
;
|
||||
.checktrack6
|
||||
jsr IsEATrack6
|
||||
bcs .fail
|
||||
lda #s_eatrk6
|
||||
; note: execution falls through here
|
||||
.skiptrack
|
||||
jsr PrintByID
|
||||
clc
|
||||
!byte $24 ; hides next SEC
|
||||
.fail
|
||||
sec
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; IsF7
|
||||
; 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 {
|
||||
IsF7
|
||||
lda $C0E9
|
||||
lda #$00
|
||||
jsr WAIT
|
||||
lda #$20
|
||||
sta nibcount
|
||||
ldy #$00
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$F7
|
||||
beq +
|
||||
.restart iny
|
||||
bne -
|
||||
dec nibcount
|
||||
bne -
|
||||
beq .fail
|
||||
+
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$F6
|
||||
bne .restart
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$EF
|
||||
bne .restart
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$EE
|
||||
bne .restart
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$AB
|
||||
bne .restart
|
||||
clc
|
||||
!byte $24 ; hides SEC
|
||||
.fail sec
|
||||
lda $C0E8
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; IsEEEF
|
||||
; check for a specific nibble sequence
|
||||
; ("EE EF BB BA FA AE") 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 {
|
||||
IsEEEF
|
||||
lda $C0E9
|
||||
lda #$00
|
||||
jsr WAIT
|
||||
lda #$20
|
||||
sta nibcount
|
||||
ldy #$00
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$EE
|
||||
beq +
|
||||
.restart iny
|
||||
bne -
|
||||
dec nibcount
|
||||
bne -
|
||||
beq .fail
|
||||
+
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$EF
|
||||
bne .restart
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$BB
|
||||
bne .restart
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$BA
|
||||
bne .restart
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$FA
|
||||
bne .restart
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
cmp #$AE
|
||||
bne .restart
|
||||
lda #TRUE
|
||||
sta gIsEEEF
|
||||
clc
|
||||
!byte $24 ; hides SEC
|
||||
.fail sec
|
||||
lda $C0E8
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; IsSyncBytes
|
||||
; check if track is mostly $FF bytes
|
||||
;
|
||||
; in slot 6, drive 1 is on track to test
|
||||
; out C clear if track is mostly just $FF bytes
|
||||
; C set otherwise
|
||||
;-------------------------------
|
||||
IsSyncBytes
|
||||
lda #$FD
|
||||
sta nibtableff
|
||||
jsr IsUnformatted
|
||||
lda #$3F
|
||||
sta nibtableff
|
||||
rts
|
||||
|
||||
;-------------------------------
|
||||
; IsUnformatted
|
||||
; check if track is unformatted
|
||||
;
|
||||
; in slot 6, drive 1 is on track to test
|
||||
; out C clear if track is unformatted
|
||||
; C set if track is formatted
|
||||
;-------------------------------
|
||||
IsUnformatted
|
||||
lda $C0E9
|
||||
lda #$00
|
||||
sta unform
|
||||
sta unform+1
|
||||
jsr WAIT
|
||||
lda #$20
|
||||
sta nibcount
|
||||
ldy #$00
|
||||
nibloop ldx $C0EC
|
||||
bpl nibloop
|
||||
lda nibtable,x
|
||||
bpl +
|
||||
inc unform
|
||||
bne +
|
||||
inc unform+1
|
||||
+ iny
|
||||
bne nibloop
|
||||
dec nibcount
|
||||
bne nibloop
|
||||
lda $C0E8
|
||||
lda #$18
|
||||
cmp unform+1
|
||||
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
|
||||
pha
|
||||
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
|
||||
pla
|
||||
bcs .exit
|
||||
lda #$80
|
||||
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 #$80
|
||||
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 #$80
|
||||
sta T01S0F
|
||||
.no
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; xB4BB
|
||||
; check if disk changes RWTS in
|
||||
; late boot after a nibble check
|
||||
;
|
||||
; in: $0800..$08FF contains boot0
|
||||
; $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
|
||||
lda #$00
|
||||
sta gTrack
|
||||
sta gAddress
|
||||
lda #$0C
|
||||
sta gSector
|
||||
lda #$0C
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
sta gAddress+1
|
||||
jsr ReadSector
|
||||
bcs _b4bbexit
|
||||
lda #$0C
|
||||
ldx #$84
|
||||
ldy #$03
|
||||
jsr compare
|
||||
!byte $4C,$BB,$B4
|
||||
bcs _b4bbexit
|
||||
lda #$02
|
||||
sta gTrack
|
||||
sta gSector
|
||||
jsr ReadSector
|
||||
bcs _b4bbexit
|
||||
lda #$0C
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
sta x0+2
|
||||
x0 lda $FFC2 ; modified at runtime (above)
|
||||
b4bbmodify
|
||||
sta $FF55 ; modified at runtime (in Inspect1)
|
||||
lda #$DE
|
||||
b4bbmodify2
|
||||
sta $FF91 ; modified at runtime (in Inspect1)
|
||||
_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 #$FE
|
||||
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
|
305
src/apicode.a
Normal file
305
src/apicode.a
Normal file
|
@ -0,0 +1,305 @@
|
|||
;-------------------------------
|
||||
; globally-accessible variables
|
||||
; in fixed position to allow
|
||||
; compressed code to work
|
||||
; offsets must match apidefs.a
|
||||
;-------------------------------
|
||||
|
||||
;gNIBTable
|
||||
!byte $80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$8A,$8B,$8C,$8D,$8E,$8F
|
||||
!byte $90,$91,$92,$93,$94,$95,$00,$01,$98,$99,$02,$03,$9C,$04,$05,$06
|
||||
!byte $A0,$A1,$A2,$A3,$A4,$A5,$07,$08,$A8,$A9,$AA,$09,$0A,$0B,$0C,$0D
|
||||
!byte $B0,$B1,$0E,$0F,$10,$11,$12,$13,$B8,$14,$15,$16,$17,$18,$19,$1A
|
||||
!byte $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7,$C8,$C9,$CA,$1B,$CC,$1C,$1D,$1E
|
||||
!byte $D0,$D1,$D2,$1F,$D4,$D5,$20,$21,$D8,$22,$23,$24,$25,$26,$27,$28
|
||||
!byte $E0,$E1,$E2,$E3,$E4,$29,$2A,$2B,$E8,$2C,$2D,$2E,$2F,$30,$31,$32
|
||||
!byte $F0,$F1,$33,$34,$35,$36,$37,$38,$F8,$39,$3A,$3B,$3C,$3D,$3E
|
||||
;gNIBTableFF
|
||||
!byte $3F
|
||||
|
||||
;jConstructStandardDelivery
|
||||
jmp ConstructStandardDelivery
|
||||
;jCopyUniversalAnywhere
|
||||
jmp CopyUniversalAnywhere
|
||||
;jCopyMemory
|
||||
jmp CopyMemory
|
||||
;jCallRWTS
|
||||
jmp $FF59 ; modified at runtime
|
||||
;jSearchTrack
|
||||
jmp SearchTrack
|
||||
;jPrintByID
|
||||
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
|
||||
;gHardDiskRef
|
||||
!byte 00 ; ProDOS file reference number of target file on hard disk
|
||||
; non-zero if open
|
||||
;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
|
||||
|
||||
;gIsRW18
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; 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
|
||||
; reset before each operation
|
||||
; set in IDBootFailure() after reading T00
|
||||
|
||||
;gIsInfocom18
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootFailure() after reading T00
|
||||
|
||||
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
|
||||
;gIsPhoenix
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsHolle
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsMUSERWTS
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsRDOS13
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsDavidson
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set after reading T22,S00
|
||||
;gIsPanglosDOS
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsAdvent
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gForceDiskVol
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in patchers/f7f6
|
||||
;gPolarwareTamperCheck
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in patchers/polarware
|
||||
; used to avoid an expensive search
|
||||
;gIsTrillium
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in patchers/trillium
|
||||
; used to avoid an expensive search
|
||||
;gIsF7F6
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in analyze (SetupF7F6SecondRound)
|
||||
; used to avoid an expensive search
|
||||
;gIsSierra13
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in sierra13 patcher
|
||||
; used to avoid an expensive search
|
||||
;gIsSierra
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in sierra patcher
|
||||
; used to avoid an expensive search
|
||||
;gIsDatasoft
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsLaureate
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gAdventureInternational
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in TraceDOS33c() after tracing DOS 3.3-shaped RWTS
|
||||
;gIsMilliken1
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in TraceDOS33c() after tracing DOS 3.3-shaped RWTS
|
||||
;gIs8b3
|
||||
!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
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gPossibleGamco
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in SkipTrack() after reading T22
|
||||
;gIsEA
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsDavidDOS
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsProtDOS
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsPascal
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsDinkeyDOS
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsProDOS
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gCapturedDiskVolumeNumber
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in patchers/t11diskvol.a after reading T11,S00
|
||||
;gIsBoot0
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsDOS32
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
LASTFILTER
|
||||
|
||||
;gDiskVolumeNumber
|
||||
!byte 00 ; int
|
||||
; disk volume number from address field of T11,S00
|
||||
; only valid if gCapturedDiskVolumeNumber is TRUE
|
||||
; never explicitly reset to any default value
|
||||
;gLastTrack
|
||||
!byte 00 ; int
|
||||
; the last track that we should try to read
|
||||
; (assuming reading from T22 down to T00)
|
||||
; reset to 0 before each operation, but some
|
||||
; disks (like DOS3.3P) will change it because
|
||||
; they write out the first few DOS tracks
|
||||
; manually before seeking up to T22 to convert
|
||||
; the rest of the disk
|
||||
;gChangedPrefs
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; whether we should try to write the configuration file
|
||||
; when the program exits
|
||||
; set to #TRUE when changing slots
|
||||
;gSaidWriting
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set to #TRUE after we print WRITING TO S%s,D%d
|
||||
;gTriedUniv
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; whether or not we've already tried the built-in RWTS
|
||||
; (and therefore a read error is fatal)
|
||||
; reset before each operation
|
||||
;gPatchCount
|
||||
!byte 00 ; int
|
||||
; number of patches we've applied to this disk
|
||||
; reset before each operation
|
||||
; incremented in modify()
|
||||
;gMode
|
||||
!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
|
319
src/apidefs.a
Normal file
319
src/apidefs.a
Normal file
|
@ -0,0 +1,319 @@
|
|||
;-------------------------------
|
||||
; 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!
|
||||
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
|
||||
;-------------------------------
|
||||
|
||||
ID_DOS33p = $00
|
||||
ID_DOS32 = $01
|
||||
ID_DOS32LO = $02
|
||||
ID_RDOS13 = $03
|
||||
|
||||
;-------------------------------
|
||||
;MECC fast-load variants
|
||||
;-------------------------------
|
||||
|
||||
ID_MECC1 = $01
|
||||
ID_MECC2 = $02
|
||||
ID_MECC3 = $03
|
||||
ID_MECC4 = $04
|
||||
ID_MECC_UNK = $FF
|
||||
|
||||
;-------------------------------
|
||||
;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
|
||||
unform = $F0 ; word
|
||||
nibcount = $F2 ; byte
|
||||
modtmp = $F3 ; byte
|
||||
modsrc = $F4 ; word
|
||||
moddest = $F6 ; word
|
||||
cmp1 = $F8 ; word
|
||||
cmp2 = $FA ; word
|
||||
counter = $FC ; byte
|
||||
tmp = $FC ; byte
|
||||
iunit = $FC ; byte
|
||||
tmpa = $FC ; byte
|
||||
tmpx = $FD ; byte
|
||||
tmpy = $FE ; byte
|
||||
flag = $FF ; byte
|
||||
|
||||
; Other application-specific constants and assembler magic
|
||||
!ifdef RELBASE {
|
||||
!set VERBOSE = $00 ; override for make script
|
||||
} else {
|
||||
RELBASE = $2000 ; dummy assignment for first build
|
||||
; to allow calculation of proper value
|
||||
}
|
||||
LOWPOINT = $4000 ; lowest available address for code
|
||||
HIGHPOINT = $B200 ; highest available address+1 for code
|
||||
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
|
||||
; in fixed position to allow
|
||||
; compressed code to work
|
||||
;-------------------------------
|
||||
|
||||
APIEND = HIGHPOINT
|
||||
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
|
||||
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 = gIsJMP600-$01 ; byte
|
||||
;gIs13Sector is a special case whose ID is not in the regular inspection path
|
||||
gIs13Sector = gIsInfocom18-$01 ; byte
|
||||
;gMECCFastloadType is a special case integer whose default value cannot be #FALSE
|
||||
gMECCFastloadType = gIs13Sector-$01 ; byte
|
||||
;gIsRW18 is a special case whose ID is not in the regular inspection path
|
||||
gIsRW18 = gMECCFastloadType-$01 ; byte
|
||||
|
||||
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
|
||||
CopyMemory = jCopyMemory
|
||||
CopyUniversalAnywhere = jCopyUniversalAnywhere
|
||||
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
|
||||
!warn "gSaidWriting=",gSaidWriting
|
||||
!warn "gChangedPrefs=",gChangedPrefs
|
||||
!warn "gLastTrack=",gLastTrack
|
||||
!warn "gIsDOS32=",gIsDOS32
|
||||
!warn "gIsBoot0=",gIsBoot0
|
||||
!warn "gCapturedDiskVolumeNumber=",gCapturedDiskVolumeNumber
|
||||
!warn "gIsProDOS=",gIsProDOS
|
||||
!warn "gIsDinkeyDOS=",gIsDinkeyDOS
|
||||
!warn "gIsPascal=",gIsPascal
|
||||
!warn "gIsProtDOS=",gIsProtDOS
|
||||
!warn "gIsDavidDOS=",gIsDavidDOS
|
||||
!warn "gIsEA=",gIsEA
|
||||
!warn "gPossibleGamco=",gPossibleGamco
|
||||
!warn "gIsOptimum=",gIsOptimum
|
||||
!warn "gMECCFastloadType=",gMECCFastloadType
|
||||
!warn "gIs8b3=",gIs8b3
|
||||
!warn "gIsMilliken1=",gIsMilliken1
|
||||
!warn "gAdventureInternational=",gAdventureInternational
|
||||
!warn "gIsLaureate=",gIsLaureate
|
||||
!warn "gIsDatasoft=",gIsDatasoft
|
||||
!warn "gIsSierra=",gIsSierra
|
||||
!warn "gissierra13=",gissierra13
|
||||
!warn "gIsF7F6=",gIsF7F6
|
||||
!warn "gIsTrillium=",gIsTrillium
|
||||
!warn "gPolarwareTamperCheck=",gPolarwareTamperCheck
|
||||
!warn "gForceDiskVol=",gIsForceDiskVol
|
||||
!warn "gIsAdvent=",gIsAdvent
|
||||
!warn "gIsPanglosDOS=",gIsPanglosDOS
|
||||
!warn "gIsDavidson=",gIsDavidson
|
||||
!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 "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
|
||||
!warn "jCopyMemory=",jCopyMemory
|
||||
!warn "jCopyUniversalAnywhere=",jCopyUniversalAnywhere
|
||||
!warn "jConstructStandardDelivery=",jConstructStandardDelivery
|
||||
!warn "gNIBTableFF=",gNIBTableFF
|
||||
!warn "gNIBTable=",gNIBTable
|
||||
!warn "gNIBTableBase=",gNIBTableBase
|
||||
}
|
||||
}
|
24
src/cffa.a
24
src/cffa.a
|
@ -1,17 +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
|
||||
!byte $24 ; hide next SEC
|
||||
+
|
||||
sec
|
||||
rts
|
||||
CFFASignature
|
||||
+ rts
|
||||
@CFFASignature
|
||||
!byte $43,$46,$33,$4B,$31
|
||||
}
|
||||
|
|
|
@ -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
278
src/crackme.a
Normal 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
|
490
src/exodecrunch.s
Normal file
490
src/exodecrunch.s
Normal file
|
@ -0,0 +1,490 @@
|
|||
; 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, and additional modifications by 4am
|
||||
; for an optional progress UI.
|
||||
;
|
||||
; Original copyright statement follows:
|
||||
;
|
||||
; Copyright (c) 2002 - 2018 Magnus Lind.
|
||||
;
|
||||
; This software is provided 'as-is', without any express or implied warranty.
|
||||
; In no event will the authors be held liable for any damages arising from
|
||||
; the use of this software.
|
||||
;
|
||||
; Permission is granted to anyone to use this software for any purpose,
|
||||
; including commercial applications, and to alter it and redistribute it
|
||||
; freely, subject to the following restrictions:
|
||||
;
|
||||
; 1. The origin of this software must not be misrepresented; you must not
|
||||
; claim that you wrote the original software. If you use this software in a
|
||||
; product, an acknowledgment in the product documentation would be
|
||||
; appreciated but is not required.
|
||||
;
|
||||
; 2. Altered source versions must be plainly marked as such, and must not
|
||||
; be misrepresented as being the original software.
|
||||
;
|
||||
; 3. This notice may not be removed or altered from any distribution.
|
||||
;
|
||||
; 4. The names of this software and/or it's copyright holders may not be
|
||||
; used to endorse or promote products derived from this software without
|
||||
; specific prior written permission.
|
||||
;
|
||||
; -------------------------------------------------------------------
|
||||
; The decruncher jsr:s to the get_crunched_byte address when it wants to
|
||||
; read a crunched byte into A. This subroutine has to preserve X and Y
|
||||
; register and must not modify the state of the carry nor the overflow flag.
|
||||
; -------------------------------------------------------------------
|
||||
;.import get_crunched_byte
|
||||
; -------------------------------------------------------------------
|
||||
; this function is the heart of the decruncher.
|
||||
; It initializes the decruncher zeropage locations and precalculates the
|
||||
; decrunch tables and decrunches the data
|
||||
; This function will not change the interrupt status bit and it will not
|
||||
; modify the memory configuration.
|
||||
; -------------------------------------------------------------------
|
||||
;.export decrunch
|
||||
|
||||
; -------------------------------------------------------------------
|
||||
; Controls if the shared get_bits routines should be inlined or not.
|
||||
;INLINE_GET_BITS=1
|
||||
; -------------------------------------------------------------------
|
||||
; if literal sequences is not used (the data was crunched with the -c
|
||||
; flag) then the following line can be uncommented for shorter and.
|
||||
; slightly faster code.
|
||||
;LITERAL_SEQUENCES_NOT_USED = 1
|
||||
; -------------------------------------------------------------------
|
||||
; if the sequence length is limited to 256 (the data was crunched with
|
||||
; the -M256 flag) then the following line can be uncommented for
|
||||
; shorter and slightly faster code.
|
||||
;MAX_SEQUENCE_LENGTH_256 = 1
|
||||
; -------------------------------------------------------------------
|
||||
; if the sequence length 3 has its own offset table then the following
|
||||
; line can be uncommented for in some situations slightly better
|
||||
; 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
|
||||
zp_len_hi = $a8
|
||||
|
||||
zp_src_lo = $ae
|
||||
zp_src_hi = zp_src_lo + 1
|
||||
|
||||
zp_bits_hi = $fc
|
||||
|
||||
zp_bitbuf = $fd
|
||||
zp_dest_lo = zp_bitbuf + 1 ; dest addr lo
|
||||
zp_dest_hi = zp_bitbuf + 2 ; dest addr hi
|
||||
|
||||
!IFDEF EXTRA_TABLE_ENTRY_FOR_LENGTH_THREE {
|
||||
encoded_entries = 68
|
||||
} ELSE {
|
||||
encoded_entries = 52
|
||||
}
|
||||
|
||||
tabl_bi = decrunch_table
|
||||
tabl_lo = decrunch_table + encoded_entries
|
||||
tabl_hi = decrunch_table + encoded_entries * 2
|
||||
|
||||
;; refill bits is always inlined
|
||||
!MACRO mac_refill_bits {
|
||||
pha
|
||||
jsr get_crunched_byte
|
||||
rol
|
||||
sta zp_bitbuf
|
||||
pla
|
||||
}
|
||||
|
||||
!IFDEF INLINE_GET_BITS {
|
||||
!MACRO mac_get_bits {
|
||||
adc #$80 ; needs c=0, affects v
|
||||
asl
|
||||
bpl gb_skip
|
||||
gb_next:
|
||||
asl zp_bitbuf
|
||||
bne gb_ok
|
||||
mac_refill_bits
|
||||
gb_ok:
|
||||
rol
|
||||
bmi gb_next
|
||||
gb_skip:
|
||||
bvc skip
|
||||
gb_get_hi:
|
||||
sec
|
||||
sta zp_bits_hi
|
||||
jsr get_crunched_byte
|
||||
skip:
|
||||
}
|
||||
} ELSE {
|
||||
!MACRO mac_get_bits {
|
||||
jsr get_bits
|
||||
}
|
||||
get_bits:
|
||||
adc #$80 ; needs c=0, affects v
|
||||
asl
|
||||
bpl gb_skip
|
||||
gb_next:
|
||||
asl zp_bitbuf
|
||||
bne gb_ok
|
||||
+mac_refill_bits
|
||||
gb_ok:
|
||||
rol
|
||||
bmi gb_next
|
||||
gb_skip:
|
||||
bvs gb_get_hi
|
||||
rts
|
||||
gb_get_hi:
|
||||
sec
|
||||
sta zp_bits_hi
|
||||
jmp get_crunched_byte
|
||||
}
|
||||
; -------------------------------------------------------------------
|
||||
; no code below this comment has to be modified in order to generate
|
||||
; a working decruncher of this source file.
|
||||
; However, you may want to relocate the tables last in the file to a
|
||||
; more suitable address.
|
||||
; -------------------------------------------------------------------
|
||||
|
||||
; -------------------------------------------------------------------
|
||||
; jsr this label to decrunch, it will in turn init the tables and
|
||||
; call the decruncher
|
||||
; 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)
|
||||
;
|
||||
ldy #0
|
||||
ldx #3
|
||||
init_zp:
|
||||
jsr get_crunched_byte
|
||||
sta zp_bitbuf - 1,x
|
||||
dex
|
||||
bne init_zp
|
||||
; -------------------------------------------------------------------
|
||||
; calculate tables (62 bytes) + get_bits macro
|
||||
; x and y must be #0 when entering
|
||||
;
|
||||
clc
|
||||
table_gen:
|
||||
tax
|
||||
tya
|
||||
and #$0f
|
||||
sta tabl_lo,y
|
||||
beq shortcut ; start a new sequence
|
||||
; -------------------------------------------------------------------
|
||||
txa
|
||||
adc tabl_lo - 1,y
|
||||
sta tabl_lo,y
|
||||
lda zp_len_hi
|
||||
adc tabl_hi - 1,y
|
||||
shortcut:
|
||||
sta tabl_hi,y
|
||||
; -------------------------------------------------------------------
|
||||
lda #$01
|
||||
sta <zp_len_hi
|
||||
lda #$78 ; %01111000
|
||||
+mac_get_bits
|
||||
; -------------------------------------------------------------------
|
||||
lsr
|
||||
tax
|
||||
beq rolled
|
||||
php
|
||||
rolle:
|
||||
asl zp_len_hi
|
||||
sec
|
||||
ror
|
||||
dex
|
||||
bne rolle
|
||||
plp
|
||||
rolled:
|
||||
ror
|
||||
sta tabl_bi,y
|
||||
bmi no_fixup_lohi
|
||||
lda zp_len_hi
|
||||
stx zp_len_hi
|
||||
!BYTE $24
|
||||
no_fixup_lohi:
|
||||
txa
|
||||
; -------------------------------------------------------------------
|
||||
iny
|
||||
cpy #encoded_entries
|
||||
bne table_gen
|
||||
; -------------------------------------------------------------------
|
||||
; prepare for main decruncher
|
||||
ldy zp_dest_lo
|
||||
stx zp_dest_lo
|
||||
stx zp_bits_hi
|
||||
; -------------------------------------------------------------------
|
||||
; copy one literal byte to destination (11(10) bytes)
|
||||
;
|
||||
!ifndef FORWARD_DECRUNCHING {
|
||||
!set FORWARD_DECRUNCHING = 1
|
||||
}
|
||||
!if FORWARD_DECRUNCHING = 0 {
|
||||
literal_start1:
|
||||
tya
|
||||
bne no_hi_decr
|
||||
dec zp_dest_hi
|
||||
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
|
||||
sta (zp_dest_lo),y
|
||||
iny
|
||||
bne no_hi_incr
|
||||
inc zp_dest_hi
|
||||
no_hi_incr:
|
||||
}
|
||||
; -------------------------------------------------------------------
|
||||
; fetch sequence length index (15 bytes)
|
||||
; x must be #0 when entering and contains the length index + 1
|
||||
; when exiting or 0 for literal byte
|
||||
next_round:
|
||||
dex
|
||||
lda zp_bitbuf
|
||||
no_literal1:
|
||||
asl
|
||||
bne nofetch8
|
||||
jsr get_crunched_byte
|
||||
rol
|
||||
nofetch8:
|
||||
inx
|
||||
bcc no_literal1
|
||||
sta zp_bitbuf
|
||||
; -------------------------------------------------------------------
|
||||
; check for literal byte (2 bytes)
|
||||
;
|
||||
beq literal_start1
|
||||
; -------------------------------------------------------------------
|
||||
; check for decrunch done and literal sequences (4 bytes)
|
||||
;
|
||||
cpx #$11
|
||||
!IFDEF INLINE_GET_BITS {
|
||||
bcc skip_jmp
|
||||
jmp exit_or_lit_seq
|
||||
skip_jmp:
|
||||
} ELSE {
|
||||
bcs exit_or_lit_seq
|
||||
}
|
||||
; -------------------------------------------------------------------
|
||||
; calulate length of sequence (zp_len) (18(11) bytes) + get_bits macro
|
||||
;
|
||||
lda tabl_bi - 1,x
|
||||
+mac_get_bits
|
||||
adc tabl_lo - 1,x ; we have now calculated zp_len_lo
|
||||
sta zp_len_lo
|
||||
!IFNDEF MAX_SEQUENCE_LENGTH_256 {
|
||||
lda zp_bits_hi
|
||||
adc tabl_hi - 1,x ; c = 0 after this.
|
||||
sta zp_len_hi
|
||||
; -------------------------------------------------------------------
|
||||
; here we decide what offset table to use (27(26) bytes) + get_bits_nc macro
|
||||
; z-flag reflects zp_len_hi here
|
||||
;
|
||||
ldx zp_len_lo
|
||||
} ELSE {
|
||||
tax
|
||||
}
|
||||
lda #$e1
|
||||
!IFDEF EXTRA_TABLE_ENTRY_FOR_LENGTH_THREE {
|
||||
cpx #$04
|
||||
} ELSE {
|
||||
cpx #$03
|
||||
}
|
||||
bcs gbnc2_next
|
||||
lda tabl_bit - 1,x
|
||||
gbnc2_next:
|
||||
asl zp_bitbuf
|
||||
bne gbnc2_ok
|
||||
tax
|
||||
jsr get_crunched_byte
|
||||
rol
|
||||
sta zp_bitbuf
|
||||
txa
|
||||
gbnc2_ok:
|
||||
rol
|
||||
bcs gbnc2_next
|
||||
tax
|
||||
; -------------------------------------------------------------------
|
||||
; calulate absolute offset (zp_src) (21(23) bytes) + get_bits macro
|
||||
;
|
||||
!IFNDEF MAX_SEQUENCE_LENGTH_256 {
|
||||
lda #0
|
||||
sta zp_bits_hi
|
||||
}
|
||||
lda tabl_bi,x
|
||||
+mac_get_bits
|
||||
!if FORWARD_DECRUNCHING = 0 {
|
||||
adc tabl_lo,x
|
||||
sta zp_src_lo
|
||||
lda zp_bits_hi
|
||||
adc tabl_hi,x
|
||||
adc zp_dest_hi
|
||||
} else {
|
||||
clc
|
||||
adc tabl_lo,x
|
||||
eor #$ff
|
||||
sta zp_src_lo
|
||||
lda zp_dest_hi
|
||||
bcc skip_dest_hi
|
||||
sbc #1
|
||||
clc
|
||||
skip_dest_hi:
|
||||
sbc zp_bits_hi
|
||||
sbc tabl_hi,x
|
||||
clc
|
||||
}
|
||||
sta zp_src_hi
|
||||
; -------------------------------------------------------------------
|
||||
; prepare for copy loop (2 bytes)
|
||||
;
|
||||
pre_copy:
|
||||
ldx zp_len_lo
|
||||
; -------------------------------------------------------------------
|
||||
; main copy loop (30 bytes)
|
||||
;
|
||||
copy_next:
|
||||
!if FORWARD_DECRUNCHING = 0 {
|
||||
tya
|
||||
bne copy_skip_hi
|
||||
dec zp_dest_hi
|
||||
dec zp_src_hi
|
||||
copy_skip_hi:
|
||||
dey
|
||||
}
|
||||
!IFNDEF LITERAL_SEQUENCES_NOT_USED {
|
||||
bcs get_literal_byte
|
||||
}
|
||||
lda (zp_src_lo),y
|
||||
literal_byte_gotten:
|
||||
sta (zp_dest_lo),y
|
||||
!if FORWARD_DECRUNCHING = 1 {
|
||||
iny
|
||||
bne copy_skip_hi
|
||||
inc zp_dest_hi
|
||||
inc zp_src_hi
|
||||
copy_skip_hi:
|
||||
}
|
||||
dex
|
||||
bne copy_next
|
||||
!IFNDEF MAX_SEQUENCE_LENGTH_256 {
|
||||
lda zp_len_hi
|
||||
!IFDEF INLINE_GET_BITS {
|
||||
bne copy_next_hi
|
||||
}
|
||||
}
|
||||
begin_stx:
|
||||
stx zp_bits_hi
|
||||
!IFNDEF INLINE_GET_BITS {
|
||||
beq next_round
|
||||
} ELSE {
|
||||
jmp next_round
|
||||
}
|
||||
!IFNDEF MAX_SEQUENCE_LENGTH_256 {
|
||||
copy_next_hi:
|
||||
dec zp_len_hi
|
||||
jmp copy_next
|
||||
}
|
||||
!IFNDEF LITERAL_SEQUENCES_NOT_USED {
|
||||
get_literal_byte:
|
||||
jsr get_crunched_byte
|
||||
bcs literal_byte_gotten
|
||||
}
|
||||
; -------------------------------------------------------------------
|
||||
; exit or literal sequence handling (16(12) bytes)
|
||||
;
|
||||
exit_or_lit_seq:
|
||||
!IFNDEF LITERAL_SEQUENCES_NOT_USED {
|
||||
beq decr_exit
|
||||
jsr get_crunched_byte
|
||||
!IFNDEF MAX_SEQUENCE_LENGTH_256 {
|
||||
sta zp_len_hi
|
||||
}
|
||||
jsr get_crunched_byte
|
||||
tax
|
||||
bcs copy_next
|
||||
decr_exit:
|
||||
}
|
||||
rts
|
||||
!IFDEF EXTRA_TABLE_ENTRY_FOR_LENGTH_THREE {
|
||||
; -------------------------------------------------------------------
|
||||
; the static stable used for bits+offset for lengths 1, 2 and 3 (3 bytes)
|
||||
; bits 2, 4, 4 and offsets 64, 48, 32 corresponding to
|
||||
; %10010000, %11100011, %11100010
|
||||
tabl_bit:
|
||||
!BYTE $90, $e3, $e2
|
||||
} ELSE {
|
||||
; -------------------------------------------------------------------
|
||||
; the static stable used for bits+offset for lengths 1 and 2 (2 bytes)
|
||||
; bits 2, 4 and offsets 48, 32 corresponding to %10001100, %11100010
|
||||
tabl_bit:
|
||||
!BYTE $8c, $e2
|
||||
}
|
||||
!IF SHOW_PROGRESS_DURING_DECRUNCH = 1 {
|
||||
ExoProgressCounter
|
||||
!byte $00
|
||||
}
|
||||
; -------------------------------------------------------------------
|
||||
; end of decruncher
|
||||
; -------------------------------------------------------------------
|
||||
|
||||
; -------------------------------------------------------------------
|
||||
; this 156 (204) byte table area may be relocated. It may also be
|
||||
; clobbered by other data between decrunches.
|
||||
; -------------------------------------------------------------------
|
||||
decrunch_table=$200;;:
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;;.IFDEF EXTRA_TABLE_ENTRY_FOR_LENGTH_THREE
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;;.ENDIF
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0
|
||||
; -------------------------------------------------------------------
|
||||
; end of decruncher
|
||||
; -------------------------------------------------------------------
|
141
src/harddisk.a
Normal file
141
src/harddisk.a
Normal 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
36
src/hw.diskii.a
Normal 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
139
src/hw.harddisk.a
Normal 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
49
src/id/555.a
Normal 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
|
||||
}
|
88
src/id/advent.a
Normal file
88
src/id/advent.a
Normal file
|
@ -0,0 +1,88 @@
|
|||
;-------------------------------
|
||||
; IDAdvent
|
||||
; identify Interplay custom bootloader
|
||||
;
|
||||
; in: track buffer contains T00,S00
|
||||
; out: C clear if Interplay bootloader was found
|
||||
; C set if not found
|
||||
; all other flags clobbered
|
||||
; all registers clobbered
|
||||
;
|
||||
; module by qkumba
|
||||
;
|
||||
; tested on
|
||||
; - Borrowed Time
|
||||
; - Mindshadow
|
||||
; - The Tracer Sanction
|
||||
;-------------------------------
|
||||
!macro IDAdvent {
|
||||
lda #BASEPAGE
|
||||
ldy #33
|
||||
jsr SearchSector
|
||||
!byte $2C,$83,$C0 ;BIT $C083
|
||||
!byte $2C,$83,$C0 ;BIT $C083
|
||||
!byte $A9,$FF ;LDA #$FF
|
||||
!byte $8D,$00,$E0 ;STA $E000
|
||||
!byte $EE,$00,$E0 ;INC $E000
|
||||
!byte $D0,WILDCARD ;BNE $+xx
|
||||
!byte $A2,$00 ;LDX #$00
|
||||
!byte $BD,WILDCARD,$08 ;LDA $08xx,X
|
||||
!byte $F0,$06 ;BEQ $+8
|
||||
!byte $9D,$D8,$07 ;STA $07D8,X
|
||||
!byte $E8 ;INX
|
||||
!byte $D0,$F5 ;BNE $-8
|
||||
!byte $A6,$2B ;LDX $2B
|
||||
!byte $4C,$00 ;JMP $xx00
|
||||
; passport-test-suite/Borrowed Time.woz [C=0] matches
|
||||
}
|
||||
|
||||
foundadvent
|
||||
;
|
||||
; We found an Interplay 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.
|
||||
;
|
||||
!zone {
|
||||
jsr PrintByID
|
||||
!byte s_advent
|
||||
jsr CopyUniversal
|
||||
|
||||
;hook read address prologue
|
||||
lda #<.checktrk
|
||||
sta $BDC5
|
||||
lda #>.checktrk
|
||||
sta $BDC6
|
||||
|
||||
;
|
||||
; this RWTS alters the data prologue in a routine
|
||||
; on a non-zero track, so we need to set a flag so
|
||||
; we know to search for it later
|
||||
;
|
||||
lda #TRUE
|
||||
sta gIsAdvent
|
||||
jmp ADStyle
|
||||
|
||||
.prologtbl1
|
||||
!byte $96, $97, $9A, $9B, $9D, $9E, $9F, $A6
|
||||
!byte $ED, $EE, $EF, $F2, $F3, $F4, $F5, $F6
|
||||
!byte $AA ;extra entry for unprotected sectors
|
||||
|
||||
.prologtbl2
|
||||
!byte $ED, $EE, $EF, $F2, $F3, $F4, $FF, $F7
|
||||
!byte $96, $A6, $AA, $D5, $DF, $EA, $AE, $FE
|
||||
!byte $96 ;extra entry for unprotected sectors
|
||||
|
||||
.checktrk
|
||||
ldy #$10
|
||||
lda gTrack
|
||||
beq +
|
||||
and #$0f
|
||||
tay
|
||||
+ lda .prologtbl1, y
|
||||
sta UNIV_A2
|
||||
lda .prologtbl2, y
|
||||
sta UNIV_A3
|
||||
jmp $B944
|
||||
}
|
39
src/id/baudville.a
Normal file
39
src/id/baudville.a
Normal 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
429
src/id/bootfailure.a
Normal 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
|
|
@ -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
|
||||
}
|
|
@ -2,31 +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
|
||||
; 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
|
||||
ldx #$00
|
||||
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
|
||||
!byte $01
|
||||
!byte $4C,$7E,$08
|
||||
!byte $04,$8A,$0C,$B8
|
||||
; passport-test-suite/Tomahawk.woz [C=0] matches
|
||||
}
|
||||
|
|
|
@ -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
|
||||
!byte $9D
|
||||
; passport-test-suite/Horses.woz [C=0] matches
|
||||
tax
|
||||
@notDavid
|
||||
}
|
||||
|
|
35
src/id/davidson.a
Normal file
35
src/id/davidson.a
Normal file
|
@ -0,0 +1,35 @@
|
|||
;-------------------------------
|
||||
; IDDavidson
|
||||
; identify Davidson disk after failing to read T22,S00
|
||||
;
|
||||
; in: track buffer contains track $22
|
||||
; out: C clear if Davidson disk found
|
||||
; C set otherwise
|
||||
; all registers clobbered
|
||||
; all other flags clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
IDDavidson
|
||||
lda gIsProDOS ; ProDOS?
|
||||
bne .fail ; no, give up
|
||||
lda gTrack ; track $22?
|
||||
cmp #$22
|
||||
bne .fail ; no, give up
|
||||
lda gSector ; sector $00?
|
||||
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 .fail ; passport-test-suite/Word Attack Plus Spanish.woz [C=0] matches
|
||||
; if the read didn't work, give up
|
||||
jsr PrintByID
|
||||
!byte s_davidson
|
||||
lda #TRUE
|
||||
sta gIsDavidson
|
||||
clc
|
||||
!byte $24
|
||||
.fail sec
|
||||
.exit rts
|
||||
}
|
18
src/id/dinkeydos.a
Normal file
18
src/id/dinkeydos.a
Normal file
|
@ -0,0 +1,18 @@
|
|||
;-------------------------------
|
||||
; 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
|
||||
; A = #$0B
|
||||
; all other registers & flags clobbered
|
||||
;-------------------------------
|
||||
!macro IDDinkeyDOS {
|
||||
lda #$0B
|
||||
ldx #$2B
|
||||
tay
|
||||
jsr compare ; if T00,S0B,$2B ==
|
||||
!byte $29,$44,$49,$4E,$4B,$45,$59,$44,$4F,$53,$00
|
||||
; passport-test-suite/Ultima V.woz [C=0] matches
|
||||
}
|
|
@ -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
|
||||
bcs + ; passport-test-suite/Moon Bingo.woz [C=0] matches
|
||||
sta gIsDiversi
|
||||
+
|
||||
}
|
||||
|
|
44
src/id/dos32.a
Normal file
44
src/id/dos32.a
Normal 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
43
src/id/dos32lo.a
Normal 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
|
||||
}
|
116
src/id/dos33.a
116
src/id/dos33.a
|
@ -3,33 +3,37 @@
|
|||
; 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 $36 or $B6 (prevents matching on some
|
||||
; Infocom disks that would otherwise match but then load
|
||||
; boot1 over program space and crash)
|
||||
; $08FE must be either $B6 (standard) or $20..$36
|
||||
; ($36 is a master DOS that relocates itself later.
|
||||
; Others like $22 are used by early Infocom games.)
|
||||
; Must weed out some Infocom and TLC disks that would
|
||||
; load over program space and crash.
|
||||
;
|
||||
lda $08FE
|
||||
cmp #$36
|
||||
beq +
|
||||
cmp #$B6
|
||||
beq +
|
||||
sec
|
||||
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
|
||||
@fail sec
|
||||
rts
|
||||
+ 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
|
||||
ldx #$00
|
||||
ldy #$4A
|
||||
ldy #$3F
|
||||
jsr compare ; if T00,S00,$00 ==
|
||||
!byte $01
|
||||
!byte $A5,$27
|
||||
|
@ -62,49 +66,71 @@ IDDOS33
|
|||
!byte $6C,$3E,$00
|
||||
!byte $EE,$FE,$08
|
||||
!byte $EE,$FE,$08
|
||||
bcs @fail ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
|
||||
;
|
||||
; DOS 3.3 and most derivatives have JSR $FE89 / JSR $FE93 / JSR $FB2F at $083F
|
||||
;
|
||||
ldx #$3F
|
||||
ldy #$0B
|
||||
jsr compare ; if T00,S00,$3F ==
|
||||
!byte $20,$89,$FE
|
||||
!byte $20,$93,$FE
|
||||
!byte $20,$2F,$FB
|
||||
!byte $A6,$2B
|
||||
bcs .exit
|
||||
bcc @ok083F ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
|
||||
;
|
||||
; Sector order map must be standard (no exceptions)
|
||||
; Sierra variants have STA $C050 / STA $C057 / STA $C055 at $083F
|
||||
;
|
||||
jsr compare ; if T00,S00,$3F ==
|
||||
!byte $8D,$50,$C0
|
||||
!byte $8D,$57,$C0
|
||||
!byte $8D,$55,$C0
|
||||
!byte $A6,$2B
|
||||
bcs @exit ; passport-test-suite/Leisure Suit Larry.woz [C=0] matches
|
||||
; other variations -> failure
|
||||
@ok083F
|
||||
;
|
||||
; Filter out unsupported sector order map
|
||||
;
|
||||
lda #$00
|
||||
ldx #$4D
|
||||
ldy #$10
|
||||
jsr compare ; if T00,S00,$4D ==
|
||||
!byte $00,$0D,$0B,$09,$07,$05,$03,$01
|
||||
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F
|
||||
bcs .exit
|
||||
!byte WILDCARD,$0C,$0A,$08,$06,$04,$02,$0F
|
||||
bcs @exit ; passport-test-suite/Pitfall II.woz [C=1] here
|
||||
;
|
||||
; Minor variant (e.g. Terrapin Logo 3.0) jumps to $08F0 and back
|
||||
; but is still safe to trace. Check for this jump and match
|
||||
; the code at $08F0 exactly.
|
||||
; Check for MUSE sector order map (nonstandard but supported)
|
||||
;
|
||||
ldy $0855
|
||||
cpy #$02
|
||||
bne @notMUSE ; passport-test-suite/The Function Game.woz [Z=0] matches
|
||||
sta gIsMUSERWTS
|
||||
ldy #$0E
|
||||
sty precheck_sectors+1
|
||||
ldy #kSectorIgnore
|
||||
sty T00S08
|
||||
sty T00S0F
|
||||
@notMUSE
|
||||
;
|
||||
; 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
|
||||
bcc .exit ; standard code at $081C -> success
|
||||
|
||||
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
|
||||
; bcs .exit ; unknown code at $08F0 -> failure
|
||||
|
||||
.exit
|
||||
rts
|
||||
}
|
||||
; passport-test-suite/Library Magic.woz [C=0] matches acceptable code at $08F0
|
||||
; unknown code at $08F0 -> failure
|
||||
@exit rts
|
||||
|
|
43
src/id/ea.a
43
src/id/ea.a
|
@ -2,35 +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
|
||||
!macro IDEA {
|
||||
ldy #16
|
||||
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
|
||||
+ rts
|
||||
!byte $01,$A5,$27,$C9,$09,$D0,$2E,$A2
|
||||
!byte $10,$8A,$9D,$EF,$03,$CA,$D0,$F9
|
||||
+
|
||||
}
|
||||
|
||||
foundea
|
||||
;
|
||||
|
@ -41,14 +34,14 @@ foundea
|
|||
; original disk.
|
||||
;
|
||||
!zone {
|
||||
lda #s_eab0
|
||||
jsr PrintByID
|
||||
!byte s_eab0
|
||||
jsr CopyUniversal
|
||||
|
||||
; mark track $22 as "optional" in sector map
|
||||
|
||||
ldy #$0F
|
||||
lda #$80
|
||||
lda #kSectorOptional
|
||||
.ignoresectors
|
||||
sta T22,y
|
||||
dey
|
||||
|
@ -77,9 +70,9 @@ foundea
|
|||
.checktrk
|
||||
ldy #0
|
||||
lda .prologtbl, y
|
||||
sta $B8F1
|
||||
sta UNIV_D2
|
||||
lda .prologtbl+2, y
|
||||
sta $B8FC
|
||||
sta UNIV_D3
|
||||
jsr $B8DC
|
||||
bcc +
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
; all registers clobbered
|
||||
; all other flags clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
IDEncoded44
|
||||
!macro IDEncoded44 {
|
||||
ldy #$07
|
||||
jsr SearchTrack
|
||||
!byte $BD,$8C,$C0,$10,$FB,$38,$2A
|
||||
bcs .exit
|
||||
.exit
|
||||
rts
|
||||
!byte $BD,$8C,$C0
|
||||
!byte $10,$FB
|
||||
!byte $38
|
||||
!byte $2A
|
||||
; passport-test-suite/Sneakers.woz [C=0] matches
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
; IDEncoded53
|
||||
; identify bootloader that loads
|
||||
; 5-3-encoded data from track 0
|
||||
; but our DOS 3.2 tracer didn't work
|
||||
; (these disks are unsupported)
|
||||
;
|
||||
; in: track buffer contains T00,S00
|
||||
|
@ -10,13 +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
|
||||
bcs .exit
|
||||
.exit
|
||||
rts
|
||||
}
|
||||
|
|
18
src/id/enlightenment.a
Normal file
18
src/id/enlightenment.a
Normal 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
|
||||
}
|
27
src/id/holle.a
Normal file
27
src/id/holle.a
Normal file
|
@ -0,0 +1,27 @@
|
|||
;-------------------------------
|
||||
; IDHolle
|
||||
; identify Dav Holle's encrypted bootloader
|
||||
;
|
||||
; 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
|
||||
;-------------------------------
|
||||
!macro IDHolle {
|
||||
ldy #$10
|
||||
jsr compare ; if T00,S00,$00 ==
|
||||
!byte $01
|
||||
!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
|
||||
}
|
|
@ -5,29 +5,62 @@
|
|||
;
|
||||
; 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 gIsBoot0
|
||||
sta gIsBoot1
|
||||
sta gIsMaster
|
||||
sta gIsRWTS
|
||||
sta gIsProDOS
|
||||
sta gIsPascal
|
||||
sta gIsProtDOS
|
||||
sta gIsEA
|
||||
sta gIsEEEF
|
||||
sta gIsMECCFastloader
|
||||
sta gPossibleD5D5F7
|
||||
lda #$00
|
||||
sta gLastTrack
|
||||
- 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
|
||||
iny
|
||||
dex
|
||||
bpl -
|
||||
|
||||
lda #s_infocom18
|
||||
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 +
|
||||
|
@ -35,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
|
||||
;
|
||||
|
@ -44,230 +89,340 @@ 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
|
||||
bcc .diversi
|
||||
jsr IDPronto
|
||||
bcc .pronto
|
||||
lda #s_dosb0
|
||||
!byte $2c
|
||||
.diversi
|
||||
lda #s_diversidos
|
||||
!byte $2c
|
||||
.pronto
|
||||
lda #s_prontodos
|
||||
sta gIsBoot0 ; A = 0 (TRUE)
|
||||
;
|
||||
; Try to identify Diversi-DOS
|
||||
; (in A=0; out A=0)
|
||||
;
|
||||
+IDDiversi
|
||||
ldx #s_diversidos
|
||||
bcc .printdos
|
||||
;
|
||||
; Try to identify Pronto-DOS
|
||||
; (in A=0; out A=0)
|
||||
;
|
||||
+IDPronto
|
||||
ldx #s_prontodos
|
||||
bcc .printdos
|
||||
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
|
||||
!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 #TRUE
|
||||
sta gIsMECCFastloader
|
||||
lda #s_mecc
|
||||
lda #ID_MECC_UNK
|
||||
sta gMECCFastloadType
|
||||
jsr PrintByID
|
||||
jsr CopyUniversal
|
||||
!byte s_mecc
|
||||
jsr PrereadT00
|
||||
bcs .notmecc
|
||||
jsr IDMECC1
|
||||
bcs +
|
||||
lda #ID_MECC1
|
||||
sta gMECCFastloadType
|
||||
jmp foundmecc1
|
||||
+ jsr IDMECC2
|
||||
bcs +
|
||||
lda #ID_MECC2
|
||||
sta gMECCFastloadType
|
||||
jmp foundmecc2
|
||||
+ jsr IDMECC3
|
||||
bcs +
|
||||
lda #ID_MECC3
|
||||
sta gMECCFastloadType
|
||||
jmp foundmecc3
|
||||
+ jsr IDMECC4
|
||||
bcs .notmecc
|
||||
lda #ID_MECC4
|
||||
sta gMECCFastloadType
|
||||
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
|
||||
jsr CopyUniversal
|
||||
jsr PrereadT00
|
||||
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)
|
||||
;
|
||||
+IDAdvent
|
||||
bcs .notInterplay
|
||||
jmp foundadvent
|
||||
.notInterplay
|
||||
;
|
||||
; Try to identify Baudville bootloader.
|
||||
; (in none; out none)
|
||||
;
|
||||
+IDBaudville
|
||||
bcs .notBaudville
|
||||
jsr PrintByID
|
||||
!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 are guaranteed to fail later anyway.
|
||||
; 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 (like DOS 3.2 disks with
|
||||
; a hybrid boot sector that loads on 16-sector drives).
|
||||
; Passport has no support for converting DOS 3.2 disks, so
|
||||
; this serves as an early escape hatch for disks that are
|
||||
; guaranteed to fail later anyway.
|
||||
; that loads 5-and-3-encoded data. If the earlier DOS 3.2
|
||||
; identification failed, we will have no way to read the disk
|
||||
; (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
|
||||
beq .useuniv ; always branches
|
||||
;
|
||||
;Apple Pascal (all versions)
|
||||
;
|
||||
+ jsr IDPascal
|
||||
bcs +
|
||||
lda #s_pascalb0
|
||||
jsr PrintByID
|
||||
lda #TRUE
|
||||
sta gIsPascal
|
||||
beq .useuniv ; always branches
|
||||
;
|
||||
; Encrypted Datasoft bootloader
|
||||
;
|
||||
+ jsr IDDatasoft
|
||||
bcs +
|
||||
lda #s_datasoftb0
|
||||
jsr PrintByID
|
||||
bcc .useuniv ; always branches
|
||||
;
|
||||
; David-DOS II
|
||||
;
|
||||
+ jsr IDDavid
|
||||
bcs +
|
||||
lda #s_daviddos
|
||||
jsr PrintByID
|
||||
;
|
||||
; Quick-DOS
|
||||
;
|
||||
+ jsr IDQuickDOS
|
||||
bcs +
|
||||
lda #s_quickdos
|
||||
jsr PrintByID
|
||||
|
||||
+
|
||||
.useuniv
|
||||
!byte s_555
|
||||
jmp Do555
|
||||
.not555
|
||||
jmp UseUniversal
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; AnalyzeT00
|
||||
; set additional flags based on contents of track $00
|
||||
;
|
||||
; in: Track $00 in data buffer
|
||||
; out: gIsBoot1, gIsMaster, gIsRWTS set to #TRUE or #FALSE
|
||||
; 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,$F8
|
||||
!byte $06,$A0,$04,$8C,$F8,$04,$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
|
||||
rts
|
||||
}
|
||||
PrereadT00
|
||||
lda #$0F
|
||||
PrereadT00Partial
|
||||
sta gSector
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
sta gAddress+1
|
||||
lda #$00
|
||||
sta gTrack
|
||||
sta gAddress
|
||||
- jsr ReadSector
|
||||
bcs +
|
||||
dec gAddress+1
|
||||
dec gSector
|
||||
bne -
|
||||
+ rts
|
||||
|
|
47
src/id/jmp600.a
Normal file
47
src/id/jmp600.a
Normal 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
|
|
@ -4,45 +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
|
||||
ldx #$00
|
||||
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
|
||||
bcc .maybe
|
||||
rts
|
||||
|
||||
.maybe
|
||||
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
|
||||
rts
|
||||
!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
|
||||
+
|
||||
}
|
||||
|
|
|
@ -4,35 +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
|
||||
lda #$00
|
||||
!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
|
||||
+
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
|
@ -56,13 +50,13 @@ TraceLaureate
|
|||
sta modsrc+1
|
||||
ldy #$E7
|
||||
lda (modsrc),y
|
||||
sta $B8E7
|
||||
sta UNIV_D1
|
||||
ldy #$F1
|
||||
lda (modsrc),y
|
||||
sta $B8F1
|
||||
sta UNIV_D2
|
||||
ldy #$FC
|
||||
lda (modsrc),y
|
||||
sta $B8FC
|
||||
sta UNIV_D3
|
||||
inc modsrc+1
|
||||
ldy #$44
|
||||
- lda (modsrc),y
|
||||
|
@ -76,5 +70,23 @@ TraceLaureate
|
|||
sta $BA00,y
|
||||
iny
|
||||
bne -
|
||||
;
|
||||
; use built-in RWTS for track 0
|
||||
;
|
||||
lda #$FE
|
||||
sta T00S0B
|
||||
;
|
||||
; don't read track 0 sectors $0C-$0F
|
||||
; (never read, some disks have intentionally bad sectors there)
|
||||
; (seen on Sound Ideas)
|
||||
;
|
||||
lda #kSectorIgnore
|
||||
sta T00S0C
|
||||
sta T00S0D
|
||||
sta T00S0E
|
||||
sta T00S0F
|
||||
;
|
||||
; read the rest of the disk with this constructed RWTS
|
||||
;
|
||||
jmp ADStyle
|
||||
}
|
||||
|
|
136
src/id/mecc.a
136
src/id/mecc.a
|
@ -6,43 +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
|
||||
ldx #$00
|
||||
!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
|
||||
.exit
|
||||
rts
|
||||
}
|
||||
|
||||
!zone {
|
||||
PrereadT00
|
||||
lda #$00
|
||||
sta gTrack
|
||||
sta gAddress
|
||||
lda #$0F
|
||||
sta gSector
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
sta gAddress+1
|
||||
- jsr ReadSector
|
||||
bcs .exit
|
||||
dec gAddress+1
|
||||
dec gSector
|
||||
bne -
|
||||
.exit
|
||||
rts
|
||||
; passport-test-suite/Clock Works v1.0.woz [C=0] matches
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
|
@ -64,36 +43,33 @@ 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
|
||||
rts ; passport-test-suite/Coordinate Math v1.0.woz [C=0] matches
|
||||
|
||||
foundmecc1
|
||||
;
|
||||
|
@ -112,22 +88,22 @@ foundmecc1
|
|||
ldy #$08
|
||||
lda (modsrc),y
|
||||
lsr
|
||||
sta $B956
|
||||
sta UNIV_A1
|
||||
ldy #$12
|
||||
lda (modsrc),y
|
||||
sta $B966
|
||||
sta UNIV_A2
|
||||
ldy #$1D
|
||||
lda (modsrc),y
|
||||
sta $B96F
|
||||
sta UNIV_A3
|
||||
ldy #$8F
|
||||
lda (modsrc),y
|
||||
sta $B8E7
|
||||
sta UNIV_D1
|
||||
ldy #$99
|
||||
lda (modsrc),y
|
||||
sta $B8F1
|
||||
sta UNIV_D2
|
||||
ldy #$A3
|
||||
lda (modsrc),y
|
||||
sta $B8FC
|
||||
sta UNIV_D3
|
||||
jmp ADStyle
|
||||
}
|
||||
|
||||
|
@ -151,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
|
||||
|
@ -189,29 +164,29 @@ foundmecc2
|
|||
lda #$07
|
||||
foundmecc4a
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
adc #BASEPAGE ; passport-test-suite/Clock Works v1.0.woz [C=0] reaches here
|
||||
sta modsrc+1
|
||||
lda #$00
|
||||
sta modsrc
|
||||
ldy #$83
|
||||
lda (modsrc),y
|
||||
lsr
|
||||
sta $B956
|
||||
sta UNIV_A1
|
||||
ldy #$8D
|
||||
lda (modsrc),y
|
||||
sta $B966
|
||||
sta UNIV_A2
|
||||
ldy #$98
|
||||
lda (modsrc),y
|
||||
sta $B96F
|
||||
sta UNIV_A3
|
||||
ldy #$15
|
||||
lda (modsrc),y
|
||||
sta $B8E7
|
||||
sta UNIV_D1
|
||||
ldy #$1F
|
||||
lda (modsrc),y
|
||||
sta $B8F1
|
||||
sta UNIV_D2
|
||||
ldy #$2A
|
||||
lda (modsrc),y
|
||||
sta $B8FC
|
||||
sta UNIV_D3
|
||||
jmp ADStyle
|
||||
}
|
||||
|
||||
|
@ -240,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
|
||||
|
@ -256,11 +231,10 @@ 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
|
||||
rts
|
||||
rts ; passport-test-suite/Number Munchers v1.0.woz [C=0] matches
|
||||
|
||||
foundmecc3
|
||||
;
|
||||
|
@ -279,23 +253,23 @@ foundmecc3
|
|||
ldy #$E8
|
||||
lda (modsrc),y
|
||||
lsr
|
||||
sta $B956
|
||||
sta UNIV_A1
|
||||
ldy #$F2
|
||||
lda (modsrc),y
|
||||
sta $B966
|
||||
sta UNIV_A2
|
||||
ldy #$FD
|
||||
lda (modsrc),y
|
||||
sta $B96F
|
||||
sta UNIV_A3
|
||||
inc modsrc+1
|
||||
ldy #$6F
|
||||
lda (modsrc),y
|
||||
sta $B8E7
|
||||
sta UNIV_D1
|
||||
ldy #$79
|
||||
lda (modsrc),y
|
||||
sta $B8F1
|
||||
sta UNIV_D2
|
||||
ldy #$83
|
||||
lda (modsrc),y
|
||||
sta $B8FC
|
||||
sta UNIV_D3
|
||||
jmp ADStyle
|
||||
}
|
||||
|
||||
|
@ -326,5 +300,5 @@ foundmecc4
|
|||
; original disk.
|
||||
;
|
||||
lda #$08
|
||||
jmp foundmecc4a
|
||||
jmp foundmecc4a ; passport-test-suite/Conquering Whole Numbers v1.1.woz [Z=0] reaches here
|
||||
}
|
||||
|
|
30
src/id/micrograms.a
Normal file
30
src/id/micrograms.a
Normal file
|
@ -0,0 +1,30 @@
|
|||
;-------------------------------
|
||||
; IDMicrograms
|
||||
; identify Micrograms bootloader
|
||||
;
|
||||
; 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
|
||||
;-------------------------------
|
||||
!macro IDMicrograms {
|
||||
ldy #$0B
|
||||
jsr compare
|
||||
!byte $01
|
||||
!byte $A5,$27
|
||||
!byte $C9,$09
|
||||
!byte $D0,$12
|
||||
!byte $A9,$C6
|
||||
!byte $85,$3F
|
||||
bcs @notMicrograms ; passport-test-suite/Shapes and Patterns.woz [C=0] matches
|
||||
ldx #$42
|
||||
jsr compare2
|
||||
!byte $4C,$00
|
||||
; passport-test-suite/Shapes and Patterns.woz [C=0] matches
|
||||
tax
|
||||
@notMicrograms
|
||||
}
|
|
@ -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
|
||||
|
@ -34,8 +33,12 @@ IDMilliken1
|
|||
jsr compare
|
||||
!byte $A9,$AE,$8D,$00,$04,$4C,$99,$AD
|
||||
!byte $AE,$F8,$05,$BD,$89,$C0
|
||||
bcs + ; passport-test-suite/Tangram Puzzler.woz [C=0] matches
|
||||
lda #TRUE
|
||||
sta gIsMilliken1
|
||||
bcc .exit
|
||||
|
||||
+
|
||||
; variant 2 (seen in The Writing Workshop)
|
||||
ldy #$0B
|
||||
jsr compare
|
||||
|
|
287
src/id/panglosdos.a
Normal file
287
src/id/panglosdos.a
Normal file
|
@ -0,0 +1,287 @@
|
|||
;-------------------------------
|
||||
; PanglosDOS
|
||||
; in: $0800..$08FF contains boot0
|
||||
; $3600..$3FFF contains boot1
|
||||
; out: C clear if "Panglossian DOS" was found
|
||||
; C set if "Panglossian DOS" was not found
|
||||
; gIsPanglosDOS is set to TRUE or FALSE
|
||||
;
|
||||
; module by qkumba
|
||||
;-------------------------------
|
||||
!zone {
|
||||
PanglosDOS
|
||||
lda jCallRWTS+2
|
||||
ldx #$00 ; check for "STY $48;STA $49"
|
||||
ldy #$04 ; at RWTS entry point
|
||||
jsr CompareMemory
|
||||
!byte $84,$48,$85,$49
|
||||
bcs .jmpexit1
|
||||
sec
|
||||
sbc #5
|
||||
ldx #$C3 ; check for "SEC;RTS" at $x8C3
|
||||
ldy #$02
|
||||
jsr CompareMemory
|
||||
!byte $38,$60
|
||||
bcs .jmpexit1
|
||||
ldx #$62 ; check for "LDA $C08C,X" at $x862
|
||||
ldy #$03
|
||||
jsr CompareMemory
|
||||
!byte $BD,$8C,$C0
|
||||
bcs .jmpexit1
|
||||
lda jCallRWTS+2
|
||||
ldx #$B9 ; check for "JSR $xxF9" at $xDB9
|
||||
ldy #$02
|
||||
jsr CompareMemory
|
||||
!byte $20,$F9
|
||||
bcc + ; passport-test-suite/Stepwise Multiple Regression.woz [C=0] matches
|
||||
.jmpexit1
|
||||
jmp .exit
|
||||
+
|
||||
jsr PrintByID
|
||||
!byte s_gathering
|
||||
|
||||
;$230 (560) bytes for address keys
|
||||
;$230 (560) bytes for data keys
|
||||
;=$460 bytes total
|
||||
|
||||
lda jCallRWTS+2
|
||||
sta .patch5+2
|
||||
sta .patch6+2
|
||||
sta .patch7+2
|
||||
sta .patch16+2
|
||||
sta .patch17+2
|
||||
sta .patch18+2
|
||||
sta .patch19+2
|
||||
sec
|
||||
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
|
||||
;$2200-222F is partial
|
||||
sta $2300,y
|
||||
sta $2400,y
|
||||
;$2500-252F is partial
|
||||
iny
|
||||
bne -
|
||||
ldy #$2F
|
||||
- sta $2200,y
|
||||
sta $2500,y
|
||||
dey
|
||||
bpl -
|
||||
.patch1
|
||||
sta $3881
|
||||
.patch2
|
||||
sta $38EF
|
||||
lda #$A9
|
||||
.patch3
|
||||
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
|
||||
sta gTrack
|
||||
.sector lda #$D1
|
||||
sta gSector
|
||||
lda #BASEPAGE
|
||||
sta gAddress+1
|
||||
jsr ReadSector
|
||||
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
|
||||
sta .diroff+1
|
||||
.diroff ldy #$D1
|
||||
lda BASEPAGE<<8,Y
|
||||
beq .setpanglos
|
||||
cmp #$FF ;skip deleted files
|
||||
beq .nextent
|
||||
ldx (BASEPAGE<<8)+1,Y
|
||||
.reparse
|
||||
sta gTrack
|
||||
stx gSector
|
||||
jsr ReadSector
|
||||
.jmpexit3
|
||||
bcs .jmpexit2
|
||||
ldx #0
|
||||
ldy #0
|
||||
.parsets
|
||||
lda ((BASEPAGE+1)<<8)+$0C,X
|
||||
beq .chkextend
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sty modsrc+1
|
||||
rol modsrc+1
|
||||
asl
|
||||
rol modsrc+1
|
||||
ora ((BASEPAGE+1)<<8)+$0D,X
|
||||
sta modsrc
|
||||
lda modsrc+1
|
||||
adc #$20 ;$2000+
|
||||
sta modsrc+1
|
||||
lda ((BASEPAGE+1)<<8)+$0A
|
||||
sta (modsrc),Y
|
||||
lda modsrc+1
|
||||
adc #3
|
||||
sta modsrc+1
|
||||
lda ((BASEPAGE+1)<<8)+$0B
|
||||
sta (modsrc),Y
|
||||
inx
|
||||
inx
|
||||
bne .parsets
|
||||
.chkextend
|
||||
ldx ((BASEPAGE+1)<<8)+2
|
||||
lda ((BASEPAGE+1)<<8)+1
|
||||
bne .reparse
|
||||
.nextent
|
||||
lda .diroff+1
|
||||
clc
|
||||
adc #$23
|
||||
bne .parsedir
|
||||
dec .sector+1
|
||||
bne .jmpreaddir
|
||||
|
||||
.setpanglos
|
||||
lda #$20
|
||||
.patch5
|
||||
sta $3DBE
|
||||
lda #<.callback
|
||||
.patch6
|
||||
sta $3DBF
|
||||
lda #>.callback
|
||||
.patch7
|
||||
sta $3DC0
|
||||
lda #TRUE
|
||||
sta gIsPanglosDOS
|
||||
|
||||
clc
|
||||
.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
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
ldy #0
|
||||
sty modsrc+1
|
||||
rol modsrc+1
|
||||
asl
|
||||
rol modsrc+1
|
||||
ora gSector
|
||||
sta modsrc
|
||||
lda modsrc+1
|
||||
adc #$20
|
||||
sta modsrc+1
|
||||
lda (modsrc),Y
|
||||
.patch8
|
||||
sta $38EF ;address sum
|
||||
lda modsrc+1
|
||||
adc #3
|
||||
sta modsrc+1
|
||||
lda (modsrc),Y
|
||||
.patch9
|
||||
sta $3881 ;data sum
|
||||
|
||||
.exit
|
||||
rts
|
||||
}
|
|
@ -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
|
||||
ldx #$00
|
||||
ldy #$08
|
||||
tax
|
||||
ldy #$06
|
||||
jsr compare ; if T00,S00,$00 ==
|
||||
!byte $01
|
||||
!byte $E0,$60
|
||||
!byte $F0,$03
|
||||
!byte $4C,WILDCARD,$08
|
||||
bcc .exit
|
||||
!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
|
||||
jsr compare ; or if T00,S00,$00 ==
|
||||
!byte $01
|
||||
!byte $E0,$70
|
||||
!byte $B0,$04
|
||||
!byte $E0,$40
|
||||
!byte $B0
|
||||
.exit rts
|
||||
!byte $E0
|
||||
@notPascal ; passport-test-suite/Triangles Through Octagons.woz [C=0] matches
|
||||
}
|
||||
|
|
18
src/id/phoenix.a
Normal file
18
src/id/phoenix.a
Normal file
|
@ -0,0 +1,18 @@
|
|||
;-------------------------------
|
||||
; IDPhoenix
|
||||
; identify Phoenix bootloader
|
||||
;
|
||||
; in: track buffer contains T00,S00
|
||||
; out: C clear if Phoenix bootloader was found
|
||||
; C set if not found
|
||||
; all other flags clobbered
|
||||
; all registers clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
IDPhoenix
|
||||
lda #$00
|
||||
ldx #$B8
|
||||
jsr compare3
|
||||
!byte $AC,$B7,$F6
|
||||
rts ; passport-test-suite/Zoom Grafix 26-JAN-82.woz [C=0] matches
|
||||
}
|
|
@ -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 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
|
||||
; 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
|
||||
ldx #$00
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
; $B600..$BFFF contains boot1
|
||||
; out: C clear if "Protected DOS" was found
|
||||
; C set if "Protected DOS" was not found
|
||||
; gProtectedDOS is set to TRUE or FALSE
|
||||
; gIsProtDOS is set to TRUE or FALSE
|
||||
;-------------------------------
|
||||
!zone {
|
||||
ProtectedDOS
|
||||
|
@ -16,13 +16,14 @@ ProtectedDOS
|
|||
!byte $00,$B7,$C8,$D0,$F5,$EE,$04,$B7
|
||||
!byte $EE,$09,$B7,$AD,$09,$B7,$C9,$C0
|
||||
!byte $D0,$E8
|
||||
bcs .exit
|
||||
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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
26
src/id/rdos16.a
Normal file
26
src/id/rdos16.a
Normal file
|
@ -0,0 +1,26 @@
|
|||
;-------------------------------
|
||||
; IDRDOS16
|
||||
; identify RDOS 16-sector bootloader
|
||||
;
|
||||
; 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
|
||||
;-------------------------------
|
||||
!macro IDRDOS16 {
|
||||
ldy #$0E
|
||||
jsr compare ; if T00,S00,$00 ==
|
||||
!byte $01
|
||||
!byte $A9,$60 ; LDA #$60
|
||||
!byte $8D,$01,$08; STA $0801
|
||||
!byte $A2,$00 ; LDX #$00
|
||||
!byte $A0,$1F ; LDY #$1F
|
||||
!byte $B9,$00,$08; LDA $0800,Y
|
||||
!byte $49 ; EOR
|
||||
; passport-test-suite/Roadwar 2000.woz [C=0] matches
|
||||
}
|
228
src/id/trace.a
Executable file → Normal file
228
src/id/trace.a
Executable file → Normal file
|
@ -1,194 +1,34 @@
|
|||
;-------------------------------
|
||||
; TraceDOS33
|
||||
; set up 1st-level boot trace on
|
||||
; a DOS 3.3-shaped bootloader
|
||||
;-------------------------------
|
||||
!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
|
||||
lda #$09
|
||||
sta gSector
|
||||
;
|
||||
; This pre-check is made more difficult by the fact that
|
||||
; some disks have a timing bit after the $D5 nibble in
|
||||
; the address prologue, which triggers the wrong code path
|
||||
; in our built-in RWTS. So just for this pre-check, we
|
||||
; disable that code path. This hack will get overwritten
|
||||
; either by the disk's own RWTS when we capture it, or by
|
||||
; re-copying the built-in RWTS later.
|
||||
;
|
||||
lda #$F0
|
||||
sta $B959
|
||||
lda #$05
|
||||
sta $B95A
|
||||
precheck
|
||||
ldy #<gRWTSParams
|
||||
lda #>gRWTSParams
|
||||
jsr $BD00
|
||||
bcc +
|
||||
jmp FatalError
|
||||
+
|
||||
dec gSector
|
||||
bne precheck
|
||||
;
|
||||
; pre-check passed, do the trace
|
||||
;
|
||||
lda #<TraceDOS33b
|
||||
ldx #>TraceDOS33b
|
||||
jmp Trace
|
||||
|
||||
;-------------------------------
|
||||
; TraceDOS33b
|
||||
; set up 2nd boot trace at $084A
|
||||
;-------------------------------
|
||||
TraceDOS33b
|
||||
lda #$4C
|
||||
sta $084A
|
||||
lda #<TraceDOS33c
|
||||
sta $084B
|
||||
lda #>TraceDOS33c
|
||||
sta $084C
|
||||
lda #$2C ; disable calls to
|
||||
sta $083F ; TEXt/PR0/IN0
|
||||
sta $0842
|
||||
sta $0845
|
||||
jmp $0801
|
||||
|
||||
TraceDOS33c
|
||||
lda $08FE ; 2nd-level trace callback is here
|
||||
sta .x6+1
|
||||
clc
|
||||
adc #$02
|
||||
_Inspect1a
|
||||
sta .x1+1
|
||||
sta .x2+1
|
||||
sta b4bbmodify+2
|
||||
sta b4bbmodify2+2
|
||||
clc
|
||||
adc #$06
|
||||
sta b4bbcompare+1
|
||||
tax
|
||||
dex
|
||||
stx .x5+1
|
||||
dex
|
||||
stx .x3+1
|
||||
stx .x4+1
|
||||
stx callrwts+2
|
||||
jsr ProtectedDOS ; check for a specific (encrypted)
|
||||
; bootloader called "Protected DOS"
|
||||
bcs .notprotdos
|
||||
jmp ADStyle
|
||||
.notprotdos
|
||||
lda callrwts+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 #$FF ; check for "SEC;RTS" at $B942
|
||||
ldx #$42
|
||||
ldy #$02
|
||||
jsr CompareMemory
|
||||
!byte $38,$60
|
||||
bcc .x2
|
||||
jmp UseUniversal
|
||||
.x2 lda #$FF ; check for "LDA $C08C,X" at $B94F
|
||||
ldx #$4F
|
||||
ldy #$03
|
||||
jsr CompareMemory
|
||||
!byte $BD,$8C,$C0
|
||||
bcc .x3
|
||||
jmp UseUniversal
|
||||
.x3 lda #$FF ; check for "JSR $xx00" at $BDB9
|
||||
ldx #$B9
|
||||
ldy #$02
|
||||
jsr CompareMemory
|
||||
!byte $20,00
|
||||
bcc .x5
|
||||
;
|
||||
; Check for RWTS variant that has extra code before
|
||||
; JSR $B800 e.g. Verb Viper (DLM), Advanced Analogies (Hartley)
|
||||
;
|
||||
.x4 lda #$FF ; check for "JSR $xx00" at $BDC5
|
||||
ldx #$C5
|
||||
ldy #$02
|
||||
jsr CompareMemory
|
||||
!byte $20,00
|
||||
bcc .x5
|
||||
jmp UseUniversal ; give up tracing; this RWTS is unsupported
|
||||
;
|
||||
; 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
|
||||
;
|
||||
.x5 lda #$FF ; check for "LDX $1FE8" at $BE43
|
||||
ldx #$43
|
||||
ldy #$03
|
||||
jsr CompareMemory
|
||||
!byte $AE,$E8,$1F
|
||||
bcs .x6
|
||||
jmp UseUniversal ; give up tracing; this RWTS is unsupported
|
||||
;
|
||||
; Check for Milliken protection routine in late-stage boot
|
||||
; (affects readable/ignoreable sector map, so must ID now)
|
||||
;
|
||||
.x6 lda #$FF ; check for "JMP $9B03" at $B747
|
||||
ldx #$47
|
||||
ldy #$03
|
||||
jsr CompareMemory
|
||||
!byte $4C,$03,$9B
|
||||
bcs +
|
||||
jsr IDMilliken
|
||||
bcs +
|
||||
lda #s_milliken
|
||||
jsr PrintByID
|
||||
lda #$80
|
||||
sta T02S05
|
||||
+ jmp ADStyle ; use this RWTS to read the disk
|
||||
|
||||
;-------------------------------
|
||||
; Trace
|
||||
; common code for all boot tracers
|
||||
; in: A = lo byte of callback
|
||||
; X = hi byte of callback
|
||||
; never returns
|
||||
;-------------------------------
|
||||
Trace
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
lda #$C6
|
||||
ldx #$B6
|
||||
ldy #$01
|
||||
jsr CopyMemory
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
ldy $B6F8
|
||||
cpy #$4C
|
||||
bne .maybe_gs
|
||||
sty $B6F8 ; JMP
|
||||
sta $B6F9 ; lo byte of callback
|
||||
stx $B6FA ; hi byte of callback
|
||||
jmp $B600
|
||||
.maybe_gs
|
||||
ldy $B6FB
|
||||
cpy #$4C
|
||||
bne .unknowndrive
|
||||
sty $B6FB ; JMP
|
||||
sta $B6FC ; lo byte of callback
|
||||
stx $B6FD ; hi byte of callback
|
||||
jmp $B600
|
||||
.unknowndrive
|
||||
lda #s_canttrace
|
||||
jsr PrintByID
|
||||
jmp UseUniversal
|
||||
}
|
||||
;-------------------------------
|
||||
; Trace
|
||||
; common code for all boot tracers
|
||||
; in: A = lo byte of callback
|
||||
; X = hi byte of callback
|
||||
; never returns (exits via callback or UseUniversal)
|
||||
;-------------------------------
|
||||
!zone {
|
||||
Trace
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
lda #$C6
|
||||
ldx #$16
|
||||
jsr CopyMemory1
|
||||
pla
|
||||
ldx #0
|
||||
ldy $16F8
|
||||
cpy #$4C
|
||||
beq +
|
||||
ldx #3
|
||||
ldy $16FB
|
||||
cpy #$4C
|
||||
bne ++
|
||||
+ sta $16FA,x ; hi byte of callback
|
||||
pla
|
||||
sta $16F9,x ; lo byte of callback
|
||||
jmp $1600
|
||||
|
||||
++ pla
|
||||
jsr PrintByID ; unknown disk controller
|
||||
!byte s_canttrace
|
||||
; /!\ execution falls through here to UseUniversal
|
||||
}
|
||||
|
|
346
src/id/trace32.a
Normal file
346
src/id/trace32.a
Normal file
|
@ -0,0 +1,346 @@
|
|||
; DOS 3.2 boot tracer
|
||||
; for DOS 3.2 disks with a 3.2/3.3 hybrid bootloader
|
||||
; that boots automatically on 16-sector drives
|
||||
; e.g. many early disks from Edu-Ware, Hartley, DLM, Milliken
|
||||
|
||||
;-------------------------------
|
||||
; TraceDOS32/TraceDOS32LO
|
||||
; set up boot trace to capture 13-sector RWTS
|
||||
;-------------------------------
|
||||
!zone {
|
||||
TraceDOS32
|
||||
lda #<.TraceDOS32b
|
||||
ldx #>.TraceDOS32b
|
||||
bne .linktrace ; always branches
|
||||
TraceDOS32LO
|
||||
lda #<.TraceDOS32LOb
|
||||
ldx #>.TraceDOS32LOb
|
||||
.linktrace
|
||||
jmp Trace
|
||||
|
||||
.TraceDOS32b
|
||||
lda #<.TraceDOS32c
|
||||
sta $0846
|
||||
lda #>.TraceDOS32c
|
||||
sta $0847
|
||||
bne .linkjmp
|
||||
|
||||
.TraceDOS32LOb
|
||||
ldy #$00
|
||||
lda $0837
|
||||
cmp #$4C
|
||||
beq +
|
||||
ldy #$0A
|
||||
+ lda #<.TraceDOS32c
|
||||
sta $0838,y
|
||||
lda #>.TraceDOS32c
|
||||
sta $0839,y
|
||||
.linkjmp
|
||||
jmp $0801
|
||||
|
||||
.TraceDOS32c
|
||||
lda #$03
|
||||
ldx #$0D
|
||||
ldy #$36
|
||||
jsr CompareMemory
|
||||
!byte $A6,$2B
|
||||
!byte $A9,$09
|
||||
!byte $85,$27
|
||||
!byte $AD,$CC,$03
|
||||
!byte $85,$41
|
||||
!byte $84,$40
|
||||
!byte $8A
|
||||
!byte $4A
|
||||
!byte $4A
|
||||
!byte $4A
|
||||
!byte $4A
|
||||
!byte $A9,$02
|
||||
!byte $85,$3F
|
||||
!byte $A9,$5D
|
||||
!byte $85,$3E
|
||||
!byte $20,$43,$03
|
||||
!byte $20,$46,$03
|
||||
!byte $A5,$3D
|
||||
!byte $4D,$FF,$03
|
||||
!byte $F0,$06
|
||||
!byte $E6,$41
|
||||
!byte $E6,$3D
|
||||
!byte $D0,$ED
|
||||
!byte $85,$3E
|
||||
!byte $AD,$CC,$03
|
||||
!byte $85,$3F
|
||||
!byte $E6,$3F
|
||||
bcs .tryChoplifter
|
||||
lda $03CC
|
||||
cmp #$B2 ; RDOS
|
||||
clc
|
||||
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
|
||||
;
|
||||
clc
|
||||
adc #$03 ; $B9 or $39
|
||||
sta b4bbmodify+2
|
||||
sta b4bbmodify2+2
|
||||
adc #$04 ; $BD or $3D
|
||||
sta jCallRWTS+2
|
||||
adc #$02 ; $BF or $3F
|
||||
sta b4bbcompare+1
|
||||
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
|
||||
sta $033A
|
||||
lda #<TraceDOS32d
|
||||
sta $033B
|
||||
lda #>TraceDOS32d
|
||||
sta $033C
|
||||
ldy $0300
|
||||
jmp $0301
|
||||
|
||||
.tryChoplifter
|
||||
lda #$03
|
||||
ldx #$01
|
||||
ldy #$10
|
||||
jsr CompareMemory
|
||||
!byte $A2,$2E ;LDX #$2E
|
||||
!byte $9A ;TXS
|
||||
!byte $84,$48 ;STY $48
|
||||
!byte $A2,$00 ;LDX #$00
|
||||
!byte $BC,$00,$03 ;LDY $0300,X
|
||||
!byte $88 ;DEY
|
||||
!byte $A9,$EA ;LDA #$EA
|
||||
!byte $20,$26,$03 ;JSR $0326
|
||||
bcs .fail ; passport-test-suite/Eggs-It.woz [C=0] matches
|
||||
jsr PrintByID
|
||||
!byte s_choplifter
|
||||
jsr PrintByID
|
||||
!byte s_diskrwts
|
||||
jmp Choplifter
|
||||
|
||||
; something did not match, not comfortable tracing,
|
||||
; but we know enough to know that the universal RWTS won't work,
|
||||
; so we're done
|
||||
|
||||
.fail jmp FatalError
|
||||
|
||||
.RDOSPatch
|
||||
lda #$B3
|
||||
ldx #$00 ; check for "JMP $B9xx;LDY #$00"
|
||||
ldy #$05 ; at RWTS entry point
|
||||
jsr CompareMemory ; (i.e. $B300)
|
||||
!byte $4C,WILDCARD,$B9,$A0,$00
|
||||
bcs .fail
|
||||
lda #TRUE
|
||||
sta gIsRDOS13
|
||||
sta gDisplayBytes
|
||||
jsr PrintByID
|
||||
!byte s_rdos13
|
||||
|
||||
lda #<.RDOS13Hook
|
||||
sta jCallRWTS+1
|
||||
lda #>.RDOS13Hook
|
||||
sta jCallRWTS+2
|
||||
|
||||
lda #<.RDOS13Seek
|
||||
sta $BAC7
|
||||
lda #>.RDOS13Seek
|
||||
sta $BAC8
|
||||
|
||||
lda $BC76
|
||||
cmp #$D5
|
||||
beq .patchmap
|
||||
lda #$C9 ; override address prologue to avoid reliance on $48
|
||||
sta $BC75
|
||||
lda #$D4
|
||||
sta $BC76
|
||||
bne .patchmap
|
||||
|
||||
TraceDOS32d
|
||||
plp
|
||||
bcc .RDOSPatch
|
||||
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
|
||||
bcs .fail
|
||||
|
||||
lda #$FA
|
||||
sta modsrc
|
||||
lda jCallRWTS+2
|
||||
sec
|
||||
sbc #$05
|
||||
sta modsrc+1
|
||||
ldy #$00
|
||||
lda #$4C ; set up JMP at $B8FA to our routine that will
|
||||
sta (modsrc),y ; check whether the data field is missing
|
||||
iny
|
||||
lda #<FFer
|
||||
sta (modsrc),y
|
||||
iny
|
||||
lda #>FFer
|
||||
sta (modsrc),y
|
||||
ldy #$07
|
||||
lda #$F8 ; change BEQ at $B900 to branch to that JMP at $B8FA
|
||||
; if data prologue is not found
|
||||
sta (modsrc),y
|
||||
|
||||
.patchmap
|
||||
|
||||
; skip sectors $0D, $0E, and $0F on all tracks
|
||||
; since this is a 13-sector disk
|
||||
|
||||
lda #<sectormap
|
||||
sta .C+1
|
||||
lda #>sectormap
|
||||
sta .C+2
|
||||
lda #kSectorIgnore
|
||||
ldx #$22
|
||||
.A ldy #$0F
|
||||
.B cpy #$03
|
||||
bcs .D
|
||||
.C sta $FFFF
|
||||
.D inc .C+1
|
||||
bne +
|
||||
inc .C+2
|
||||
+ dey
|
||||
bpl .B
|
||||
dex
|
||||
bpl .A
|
||||
|
||||
; set flag for patcher
|
||||
|
||||
lda #TRUE
|
||||
sta gIsDOS32
|
||||
|
||||
;retain track 00 for RDOS because we can
|
||||
|
||||
ldy gIsRDOS13
|
||||
beq +
|
||||
|
||||
; skip T00,S00-S0A
|
||||
; since we're going to construct our own bootloader later
|
||||
|
||||
ldy #$0A
|
||||
- sta T00,y
|
||||
dey
|
||||
bpl -
|
||||
|
||||
; check for MUSE sector doubling RWTS
|
||||
lda jCallRWTS+2
|
||||
ldx #$09
|
||||
ldy #$02
|
||||
jsr CompareMemory
|
||||
!byte $20,$DD
|
||||
bcs + ; passport-test-suite/Robotwar.woz [C=0] matches
|
||||
lda #$08
|
||||
sta gDisplayBytes
|
||||
jsr PrintByID
|
||||
!byte s_muse
|
||||
|
||||
; read the rest of the disk with the original RWTS
|
||||
+
|
||||
jmp ADStyle
|
||||
|
||||
; callback to check if the data field is missing
|
||||
; and if so, fill the RWTS data buffer with zeros
|
||||
; and tell the caller that nibblizing was successful
|
||||
|
||||
FFer
|
||||
ldy #$00
|
||||
- lda $C08C,x
|
||||
bpl -
|
||||
cmp #$FF
|
||||
bne +
|
||||
iny
|
||||
bne -
|
||||
tya
|
||||
ldy jCallRWTS+2
|
||||
dey
|
||||
sty .G+2
|
||||
dey
|
||||
sty .F+2
|
||||
tay
|
||||
.F sta $FF00,y
|
||||
iny
|
||||
bne .F
|
||||
.G sta $FF00,y
|
||||
iny
|
||||
cpy #$9A
|
||||
bne .G
|
||||
- clc
|
||||
rts
|
||||
+ sec
|
||||
rts
|
||||
|
||||
.RDOS13Hook
|
||||
ldx _sector
|
||||
stx $BAF6
|
||||
lda _track
|
||||
sta $BAF5
|
||||
bne +
|
||||
cpx #$0C
|
||||
beq - ;lie that T00S0C exists
|
||||
|
||||
;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
|
||||
lda gAddress+1
|
||||
sta $BAF8
|
||||
ldx #1
|
||||
stx $B718 ;count of sectors (low part)
|
||||
dex
|
||||
stx $B719 ;count of sectors (high part)
|
||||
jmp $BA00
|
||||
|
||||
.RDOS13Seek
|
||||
jsr $BC65 ;read address
|
||||
lda $2E
|
||||
cmp $BAF5
|
||||
bne +
|
||||
jmp $BAC9
|
||||
+ sec ;fail on the tracks that don't exist
|
||||
rts
|
||||
|
||||
}
|
458
src/id/trace33.a
Executable file
458
src/id/trace33.a
Executable file
|
@ -0,0 +1,458 @@
|
|||
;-------------------------------
|
||||
; TraceDOS33
|
||||
; set up 1st-level boot trace on
|
||||
; a DOS 3.3-shaped bootloader
|
||||
;-------------------------------
|
||||
!zone {
|
||||
TraceDOS33
|
||||
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
|
||||
+
|
||||
lda #<TraceDOS33b
|
||||
ldx #>TraceDOS33b
|
||||
jmp Trace
|
||||
|
||||
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
|
||||
; set up 2nd boot trace at $084A
|
||||
;-------------------------------
|
||||
TraceDOS33b
|
||||
lda #$4C
|
||||
sta $084A
|
||||
lda #<TraceDOS33c
|
||||
sta $084B
|
||||
lda #>TraceDOS33c
|
||||
sta $084C
|
||||
lda #$EA
|
||||
ldy #9
|
||||
.noppatch
|
||||
sta $83E,Y ; disable calls to
|
||||
dey ; TEXt/PR0/IN0
|
||||
bne .noppatch ; including "Grafboot"
|
||||
jmp $0801
|
||||
|
||||
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
|
||||
lda MaybeBF
|
||||
sta b4bbcompare+1
|
||||
lda MaybeBD
|
||||
sta jCallRWTS+2
|
||||
;
|
||||
; Check for a specific encrypted bootloader called 'Protected.DOS'
|
||||
;
|
||||
jsr ProtectedDOS
|
||||
bcs .notprotdos
|
||||
.useAD jmp ADStyle
|
||||
.notprotdos
|
||||
;
|
||||
; 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
|
||||
bcs .useuniv
|
||||
;
|
||||
; $B942 check succeeded,
|
||||
; so now check for 'LDA $C08C,X' at $B94F
|
||||
;
|
||||
ldx #$4F
|
||||
iny ; Y=3
|
||||
jsr CompareMemory
|
||||
!byte $BD,$8C,$C0
|
||||
bcs .useuniv
|
||||
;
|
||||
; $B94F check succeeded,
|
||||
; so now check for 'JSR $xx00' at $BDB9
|
||||
;
|
||||
lda MaybeBD
|
||||
ldx #$B9
|
||||
dey ; Y=2
|
||||
jsr CompareMemory
|
||||
!byte $20,00
|
||||
bcc .notVerbViper
|
||||
;
|
||||
; If $BDB9 check failed, check for RWTS variant that has extra code before
|
||||
; JSR $B800 e.g. Verb Viper (DLM), Advanced Analogies (Hartley)
|
||||
; (usable)
|
||||
;
|
||||
ldx #$C5 ; check for 'JSR $xx00' at $BDC5
|
||||
jsr CompareMemory
|
||||
!byte $20,00
|
||||
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)
|
||||
; (not usable)
|
||||
;
|
||||
lda MaybeBE ; check for 'LDX $1FE8' at $BE43
|
||||
ldx #$43
|
||||
iny ; Y=3
|
||||
jsr CompareMemory
|
||||
!byte $AE,$E8,$1F
|
||||
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)
|
||||
;
|
||||
lda MaybeB7 ; check for 'JMP $9B03' at $B747
|
||||
ldx #$47
|
||||
ldy #$03
|
||||
jsr CompareMemory
|
||||
!byte $4C,$03,$9B
|
||||
bcs .notMilliken ; passport-test-suite/Tangram Puzzler.woz [C=0] matches
|
||||
jsr IDMilliken
|
||||
bcs .notMilliken
|
||||
lda #$0A
|
||||
sta gDisplayBytes
|
||||
jsr PrintByID
|
||||
!byte s_milliken
|
||||
lda #kSectorOptional
|
||||
sta T02S05
|
||||
.notMilliken
|
||||
;
|
||||
; 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
|
||||
;
|
||||
lda MaybeB7 ; check for 'LDA #$00 / STA $....,X / STA $....,X / JSR $..93' at $B730
|
||||
sta .taxman+2
|
||||
ldx #$30
|
||||
ldy #$0A
|
||||
jsr CompareMemory
|
||||
!byte $A9,$00
|
||||
!byte $9D,WILDCARD,WILDCARD
|
||||
!byte $9D,WILDCARD,WILDCARD
|
||||
!byte $20,$93
|
||||
bcs .notTaxman ; passport-test-suite/Super Taxman II.woz [C=0] matches
|
||||
ldy #$07
|
||||
.taxman lda $B730,y ; SMC (high byte)
|
||||
sta .trackpointer,y
|
||||
dey
|
||||
bpl .taxman
|
||||
ldx #$06
|
||||
.trackpointer
|
||||
LDA #$00
|
||||
STA $04F8,X
|
||||
STA $0478,X
|
||||
.notTaxman
|
||||
;
|
||||
; Check for Adventure International RWTS
|
||||
; (sets flag to activate expensive search later)
|
||||
;
|
||||
lda MaybeB9
|
||||
ldx #$36
|
||||
ldy #$0A
|
||||
jsr CompareMemory
|
||||
!byte $EA,$EA,$EA; NOP/NOP/NOP
|
||||
!byte $BD,$8C,$C0; LDA $C08C,X
|
||||
!byte $10,$FB ; BPL -$FB
|
||||
!byte $C9,$00 ; CMP #$00
|
||||
bcs .notAdvInt ; passport-test-suite/S.A.G.A. 6.woz [C=0] matches
|
||||
lda #TRUE
|
||||
sta gAdventureInternational
|
||||
.notAdvInt
|
||||
;
|
||||
; Check for Phoenix bootloader/RWTS
|
||||
; (sets flag to activate expensive search later)
|
||||
;
|
||||
jsr IDPhoenix
|
||||
bcs .notPhoenix
|
||||
lda #TRUE
|
||||
sta gIsPhoenix
|
||||
.notPhoenix
|
||||
;
|
||||
; Check for MECC DOS loaded in low memory
|
||||
; (sets flag to activate expensive search later)
|
||||
;
|
||||
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 .norecal
|
||||
lda #$B0
|
||||
.recal1 sta $BDD2 ; SMC (high byte)
|
||||
lda #$30
|
||||
.recal2 sta $BDD3 ; SMC (high byte)
|
||||
.norecal
|
||||
;
|
||||
; Check for Infocom RWTS (need to massage RWTS a little)
|
||||
;
|
||||
lda $08FE
|
||||
cmp #$23
|
||||
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
|
||||
sta $24FD
|
||||
ldy #$0F ; copy sector order map from boot0 into RWTS
|
||||
- lda $084D,y
|
||||
sta $2BB8,y
|
||||
dey
|
||||
bpl -
|
||||
.notInfocom
|
||||
;
|
||||
; 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
|
||||
!byte $A9,$01
|
||||
!byte $8D,$00,$B9
|
||||
!byte $A9,$B5
|
||||
!byte $8D,$FC,$B8
|
||||
!byte $60
|
||||
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 MaybeB7
|
||||
ldx #$75
|
||||
ldy #(@end_swordthrust-@begin_swordthrust)
|
||||
jsr CompareMemory
|
||||
@begin_swordthrust
|
||||
PHP
|
||||
SEI
|
||||
PHA
|
||||
LDX $B7EC
|
||||
LDA $BED0,X
|
||||
EOR $B942
|
||||
STA $B8FC
|
||||
STA $B85D
|
||||
PLA
|
||||
JSR $BD00
|
||||
@end_swordthrust
|
||||
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
|
||||
lda #<gTrack ; this entry point assumes track number is in $B7EC
|
||||
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
|
||||
;
|
||||
; /!\ execution falls through to ADStyle
|
||||
}
|
|
@ -1,29 +1,29 @@
|
|||
; "Special Delivery" boot tracer
|
||||
; for DOS 3.3P disks
|
||||
; e.g. Ernie's Quiz, Elite
|
||||
;
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
ldx #$00
|
||||
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
|
||||
;; lda #$00 ; save zero page before trace
|
||||
ldx #$0A
|
||||
ldy #$01
|
||||
jsr CopyMemory
|
||||
jsr CopyMemory1
|
||||
|
||||
jsr MoveT00PakHigh
|
||||
|
||||
lda #<TraceSpecDel2
|
||||
ldx #>TraceSpecDel2
|
||||
|
@ -58,57 +69,67 @@ TraceSpecDel2
|
|||
TraceSpecDel3
|
||||
lda $1212
|
||||
cmp #$D8
|
||||
sec
|
||||
bne SDfail
|
||||
lda #$4C
|
||||
sta $10D5
|
||||
ldy #$00
|
||||
lda $10D1
|
||||
cmp #$A2
|
||||
beq + ; passport-test-suite/Ernie's Quiz.woz [Z=1] matches
|
||||
ldy #$04 ; passport-test-suite/Kaves of Karkhan.woz [Z=0] matches
|
||||
+ lda #$4C
|
||||
sta $10D1,Y
|
||||
sta $10EC,Y
|
||||
lda #<TraceSpecDel4
|
||||
sta $10D6
|
||||
sta $10D2,Y
|
||||
sta $10ED,Y
|
||||
lda #>TraceSpecDel4
|
||||
sta $10D7
|
||||
lda #$4C
|
||||
sta $10F0
|
||||
lda #<TraceSpecDel4
|
||||
sta $10F1
|
||||
lda #>TraceSpecDel4
|
||||
sta $10F2
|
||||
sta $10D3,Y
|
||||
sta $10EE,Y
|
||||
jmp $1212
|
||||
|
||||
TraceSpecDel4
|
||||
lda $C0E8 ; turn off source drive
|
||||
lda #$0A ; restore zero page from before trace
|
||||
ldx #$00
|
||||
ldy #$01
|
||||
jsr CopyMemory
|
||||
|
||||
lda $3FFF
|
||||
cmp #$EA
|
||||
sec
|
||||
bne SDfail
|
||||
|
||||
lda #$0B
|
||||
ldx #$00
|
||||
ldy #$03
|
||||
jsr compare ; if $1B00 ==
|
||||
jsr compare3 ; if $1B00 ==
|
||||
!byte $4C,$4D,$2A
|
||||
bcc SDsuccess
|
||||
SDfail
|
||||
php
|
||||
lda #$0A ; restore zero page from before trace
|
||||
ldx #$00
|
||||
jsr CopyMemory1
|
||||
plp
|
||||
bcc SDsuccess
|
||||
|
||||
jmp UseUniversal
|
||||
|
||||
SDsuccess
|
||||
;
|
||||
; Restore the original code in memory before writing.
|
||||
;
|
||||
lda #$A2
|
||||
sta $10D5
|
||||
ldy #$00
|
||||
lda $10D1
|
||||
cmp #$4C
|
||||
beq +
|
||||
ldy #$04
|
||||
+ lda #$A2
|
||||
sta $10D1,Y
|
||||
lda #$FF
|
||||
sta $10D6
|
||||
sta $10D2,Y
|
||||
lda #$9A
|
||||
sta $10D7
|
||||
sta $10D3,Y
|
||||
lda #$A5
|
||||
sta $10F0
|
||||
sta $10EC,Y
|
||||
lda #$2B
|
||||
sta $10F1
|
||||
sta $10ED,Y
|
||||
lda #$4A
|
||||
sta $10F2
|
||||
sta $10EE,Y
|
||||
;
|
||||
; move $1000-$13FF to $1100-$14FF to align it as we need it
|
||||
; for writing to disk with the Standard Delivery bootloader
|
||||
|
@ -116,29 +137,21 @@ 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
|
||||
; writing garbage to disk on unused sectors
|
||||
|
||||
lda #$10
|
||||
ldx #$00
|
||||
ldy #$01
|
||||
jsr ClearMemory
|
||||
lda #$15
|
||||
ldx #$00
|
||||
ldy #$06
|
||||
|
@ -146,30 +159,34 @@ SDsuccess
|
|||
|
||||
; copy Standard Delivery bootloader into place for T00,S00
|
||||
|
||||
ldy #$7E ; _SDboot0-SDboot0, but set here
|
||||
; manually to work around Merlin bug
|
||||
sdcopy lda SDboot0,y
|
||||
sta $1000,y
|
||||
dey
|
||||
bpl sdcopy
|
||||
ldx #ID_DOS33p
|
||||
jsr ConstructStandardDelivery
|
||||
|
||||
; maybe say we're writing a bootloader
|
||||
|
||||
bit gMode ; don't say we're writing a bootloader in verify-only mode,
|
||||
bpl + ; that's scary
|
||||
jsr PrintByID
|
||||
!byte s_bootwrite
|
||||
+
|
||||
; now manually write out track 0 with Standard Delivery
|
||||
; bootloader
|
||||
|
||||
jsr IncProgress
|
||||
lda #$00
|
||||
sta gTrack
|
||||
jsr WriteTrackNA
|
||||
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
|
||||
|
||||
; manually write out track 1
|
||||
|
||||
jsr IncProgress
|
||||
inc gTrack
|
||||
lda #$20
|
||||
ldx #$10
|
||||
ldy #$10
|
||||
lda #$10
|
||||
tax
|
||||
tay
|
||||
asl
|
||||
jsr CopyMemory
|
||||
jsr WriteTrackNA
|
||||
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
|
||||
|
||||
; manually write out track 2 with a patched RWTS
|
||||
|
||||
|
@ -186,9 +203,8 @@ sdcopy lda SDboot0,y
|
|||
!byte $C9,$AD,$90,$E5
|
||||
lda #$18
|
||||
ldx #$38
|
||||
ldy #$01
|
||||
jsr CopyMemory
|
||||
jsr WriteTrackNA
|
||||
jsr CopyMemory1
|
||||
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
|
||||
lda #$C9
|
||||
sta $38B6
|
||||
lda #$AD
|
||||
|
@ -201,7 +217,7 @@ sdcopy lda SDboot0,y
|
|||
; mark tracks 0-2 as "skip" in sector map
|
||||
|
||||
ldy #$2F
|
||||
lda #$00
|
||||
lda #kSectorIgnore
|
||||
skipsectors
|
||||
sta T00,y
|
||||
dey
|
||||
|
@ -210,35 +226,12 @@ skipsectors
|
|||
; set up RWTS entry point
|
||||
|
||||
lda #$D5
|
||||
sta callrwts+1
|
||||
sta jCallRWTS+1
|
||||
lda #$36
|
||||
sta callrwts+2
|
||||
sta jCallRWTS+2
|
||||
|
||||
; read the rest of the disk with the original RWTS
|
||||
|
||||
lda #$03
|
||||
sta gLastTrack
|
||||
jmp ADStyle
|
||||
|
||||
; Standard Delivery bootloader with DOS 3.3P support
|
||||
; https://github.com/peterferrie/standard-delivery/
|
||||
; rev. a5b839d7d0fa21b0ff3a7776d9f6c9750b09ae10 of 2016-11-29
|
||||
;
|
||||
SDboot0
|
||||
!byte $01,$a8,$ee,$06,$08,$ad,$4e,$08
|
||||
!byte $c9,$c0,$f0,$40,$85,$27,$c8,$c0
|
||||
!byte $10,$90,$09,$f0,$05,$20,$2f,$08
|
||||
!byte $a8,$2c,$a0,$01,$84,$3d,$c8,$a5
|
||||
!byte $27,$f0,$df,$8a,$4a,$4a,$4a,$4a
|
||||
!byte $09,$c0,$48,$a9,$5b,$48,$60,$e6
|
||||
!byte $41,$06,$40,$20,$37,$08,$18,$20
|
||||
!byte $3c,$08,$e6,$40,$a5,$40,$29,$03
|
||||
!byte $2a,$05,$2b,$a8,$b9,$80,$c0,$a9
|
||||
!byte $30,$4c,$a8,$fc,$4c,$b3,$10
|
||||
!byte $1E,$1D,$1C,$1B,$00,$00,$00,$00
|
||||
!byte $00,$00,$13,$12,$11,$10,$1F,$20
|
||||
!byte $2E,$2D,$2C,$2B,$2A,$29,$28,$27
|
||||
!byte $26,$25,$24,$23,$22,$21,$2F,$30
|
||||
!byte $3E,$3D,$3C,$3B,$3A,$39,$38,$37
|
||||
!byte $36,$35,$34,$33,$32,$31,$3F,$C0
|
||||
_SDboot0
|
|
@ -85,7 +85,7 @@ _restore3
|
|||
; Mark track 0 and part of track 2 as "skip" in sector map
|
||||
;
|
||||
ldy #$0F
|
||||
lda #$00
|
||||
lda #kSectorIgnore
|
||||
- sta T00,y
|
||||
dey
|
||||
bpl -
|
||||
|
@ -98,13 +98,13 @@ _restore3
|
|||
; Set up RWTS entry point
|
||||
;
|
||||
lda #$00
|
||||
sta callrwts+1
|
||||
sta jCallRWTS+1
|
||||
lda #$BD
|
||||
sta callrwts+2
|
||||
sta jCallRWTS+2
|
||||
;
|
||||
; Read the rest of the disk with the original RWTS
|
||||
;
|
||||
lda #$01
|
||||
sta gLastTrack
|
||||
jmp ADStyle
|
||||
jmp ADStyle ; passport-test-suite/Ardy the Aardvark.woz [Z=0] reaches here
|
||||
}
|
||||
|
|
31
src/id/tsr.a
Normal file
31
src/id/tsr.a
Normal 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
|
||||
}
|
84
src/id/volumename.a
Normal file
84
src/id/volumename.a
Normal file
|
@ -0,0 +1,84 @@
|
|||
;-------------------------------
|
||||
; IDVolumeName
|
||||
; 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: all registers & flags clobbered
|
||||
;-------------------------------
|
||||
IDVolumeName
|
||||
; read T00,S0B (volume key block)
|
||||
ldx #$00
|
||||
stx cmp1
|
||||
ldy #$0B
|
||||
tya
|
||||
sta gDisplayBytes
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
sta gAddress+1
|
||||
sta cmp1+1
|
||||
jsr ReadSectorXY
|
||||
bcs .exit
|
||||
|
||||
lda gIsPascal
|
||||
beq .pascal
|
||||
|
||||
; sanity check the volume name length byte
|
||||
ldy #$04
|
||||
lda (cmp1), y
|
||||
cmp #$F1
|
||||
bcc .exit
|
||||
and #$0F
|
||||
tax
|
||||
lda #$05
|
||||
sta .offset+1 ; passport-test-suite/Investigating Plant Growth.woz [Z=0] reaches here
|
||||
bne .print ; always branches
|
||||
|
||||
.pascal
|
||||
ldy #$02
|
||||
lda (cmp1), y
|
||||
cmp #$06
|
||||
bne .exit
|
||||
ldy #$06
|
||||
lda (cmp1), y
|
||||
beq .exit
|
||||
cmp #$08
|
||||
bcs .exit ; passport-test-suite/Notecard Maker.woz [C=0] reaches here
|
||||
tax
|
||||
lda #$07
|
||||
sta .offset+1
|
||||
|
||||
; note: execution falls through here
|
||||
|
||||
.print
|
||||
; X (now the volume name length) is preserved by the PrintByID call
|
||||
jsr PrintByID
|
||||
!byte s_volumename
|
||||
|
||||
; print the volume name
|
||||
.offset ldy #$d1 ; set at runtime
|
||||
- lda (cmp1), y
|
||||
ora #$80
|
||||
jsr PrintA
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
lda #$8D
|
||||
jsr PrintA
|
||||
|
||||
; 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
|
29
src/keys.a
29
src/keys.a
|
@ -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
|
||||
|
|
301
src/memory.a
301
src/memory.a
|
@ -1,155 +1,154 @@
|
|||
;-------------------------------
|
||||
; 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
|
||||
; 0800..08FF - clobbered by all boot tracers
|
||||
; 0900..09FF - clobbered by Special Delivery tracer
|
||||
; 0A00..0AFF - backup of zero page during Special Delivery tracer
|
||||
; 0B00..0BFF - unused
|
||||
; 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..0FFF - unused
|
||||
; 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
|
||||
; 4000..42FF - backup of zero page, page 3, page $BF (SaveProDOS, SwapProDOS)
|
||||
; 4300..B5FF - program code
|
||||
; B600..BFFF - clobbered by DOS 3.3 boot tracer
|
||||
; 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
|
||||
;-------------------------------
|
||||
; SwapProDOS
|
||||
; saves/restores memory used by ProDOS ($BF00..$BFFF)
|
||||
; in: none
|
||||
; out: all flags and registers preserved
|
||||
;-------------------------------
|
||||
SwapProDOS
|
||||
php
|
||||
pha
|
||||
lda #$BF
|
||||
ldx #$0F
|
||||
ldy #$01
|
||||
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
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
txa
|
||||
ldx #$00
|
||||
.dest sta $FF00,x
|
||||
inx
|
||||
bne .dest
|
||||
inc .dest+2
|
||||
dey
|
||||
bne .dest
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; ClearTSBuffer
|
||||
; clear the $1000 byte memory buffer
|
||||
; used to store the current track's data
|
||||
; ReorderBuffer - convert data
|
||||
; buffer between ProDOS and
|
||||
; DOS 3.3 ordering (use after
|
||||
; read or before write under
|
||||
; ProDOS)
|
||||
; in: none
|
||||
; out: all flags and registers clobbered
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
;-------------------------------
|
||||
ClearTSBuffer
|
||||
lda #BASEPAGE
|
||||
ldx #$00
|
||||
ldy #$10
|
||||
jmp ClearMemory
|
||||
ReorderBuffer
|
||||
lda #BASEPAGE+1
|
||||
ldx #BASEPAGE+$0E
|
||||
ldy #$07
|
||||
clc
|
||||
; /!\ execution falls through here
|
||||
|
||||
;-------------------------------
|
||||
; SwapMemory
|
||||
; in: A = source address (high)
|
||||
; X = destination address (high)
|
||||
; Y = number of pages to copy
|
||||
; 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
|
||||
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
|
||||
inc .dest1+2
|
||||
inc .dest2+2
|
||||
bne @source1
|
||||
inc @source1+2
|
||||
inc @source2+2
|
||||
lda @dest1+2
|
||||
clc
|
||||
@destadjust
|
||||
adc #$D1
|
||||
sta @dest1+2
|
||||
sta @dest2+2
|
||||
dey
|
||||
bne .source1
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; SaveProDOS
|
||||
; saves memory pages used by ProDOS
|
||||
; pages $00, $03, $BF
|
||||
; in: none
|
||||
; out: all flags and registers clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
SaveProDOS
|
||||
lda #$00
|
||||
ldx #$40
|
||||
ldy #$01
|
||||
jsr CopyMemory
|
||||
lda #$03
|
||||
ldx #$41
|
||||
ldy #$01
|
||||
jsr CopyMemory
|
||||
lda #$BF
|
||||
ldx #$42
|
||||
ldy #$01
|
||||
jsr CopyMemory
|
||||
.exit
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; SwapProDOS
|
||||
; saves/restores memory pages used by ProDOS
|
||||
; pages $00, $03, $BF
|
||||
; in: none
|
||||
; out: all flags and registers clobbered
|
||||
;-------------------------------
|
||||
SwapProDOS
|
||||
lda #$00
|
||||
ldx #$40
|
||||
ldy #$01
|
||||
jsr SwapMemory
|
||||
lda #$03
|
||||
ldx #$41
|
||||
ldy #$01
|
||||
jsr SwapMemory
|
||||
lda #$BF
|
||||
ldx #$42
|
||||
ldy #$01
|
||||
jsr SwapMemory
|
||||
bne @source1
|
||||
rts
|
||||
|
||||
;-------------------------------
|
||||
|
@ -175,59 +174,37 @@ SwapProDOS
|
|||
; 0123456789ABCDEF
|
||||
; 07E6D5C4B3A2918F
|
||||
; in: track buffer has data in logical sector order
|
||||
; out: A,Y clobbered
|
||||
; X preserved
|
||||
; out: A,X,Y clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
ReorderLogicalToPhysical
|
||||
ldy #$00
|
||||
- lda $1100,y
|
||||
pha
|
||||
lda $1200,y
|
||||
pha
|
||||
lda $1300,y
|
||||
pha
|
||||
lda $1400,y
|
||||
pha
|
||||
lda $1600,y
|
||||
pha
|
||||
lda $1700,y
|
||||
pha
|
||||
lda $1800,y
|
||||
pha
|
||||
lda $1900,y
|
||||
pha
|
||||
lda $1b00,y
|
||||
pha
|
||||
lda $1c00,y
|
||||
pha
|
||||
lda $1d00,y
|
||||
pha
|
||||
- ldx $1800,y
|
||||
lda $1e00,y
|
||||
sta $1800,y
|
||||
pla
|
||||
sta $1100,y
|
||||
pla
|
||||
sta $1900,y
|
||||
pla
|
||||
sta $1200,y
|
||||
pla
|
||||
sta $1300,y
|
||||
pla
|
||||
sta $1b00,y
|
||||
pla
|
||||
sta $1400,y
|
||||
pla
|
||||
sta $1c00,y
|
||||
pla
|
||||
sta $1d00,y
|
||||
pla
|
||||
sta $1600,y
|
||||
pla
|
||||
lda $1200,y
|
||||
sta $1e00,y
|
||||
pla
|
||||
lda $1b00,y
|
||||
sta $1200,y
|
||||
txa
|
||||
sta $1b00,y
|
||||
ldx $1100,y
|
||||
lda $1d00,y
|
||||
sta $1100,y
|
||||
lda $1400,y
|
||||
sta $1d00,y
|
||||
lda $1700,y
|
||||
sta $1400,y
|
||||
txa
|
||||
sta $1700,y
|
||||
ldx $1900,y
|
||||
lda $1c00,y
|
||||
sta $1900,y
|
||||
lda $1600,y
|
||||
sta $1c00,y
|
||||
lda $1300,y
|
||||
sta $1600,y
|
||||
txa
|
||||
sta $1300,y
|
||||
iny
|
||||
bne -
|
||||
rts
|
||||
}
|
||||
|
|
36
src/memory.clear.a
Normal file
36
src/memory.clear.a
Normal 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
|
604
src/mli.a
604
src/mli.a
|
@ -1,505 +1,203 @@
|
|||
; MLI command codes
|
||||
CMD_CREATE = $C0 ; create new file
|
||||
CMD_DESTROY = $C1 ; delete a file
|
||||
CMD_SETPREFIX = $C6 ; change default pathname prefix
|
||||
CMD_GETFILEINFO = $C4 ; get file (or volume) info
|
||||
CMD_ONLINE = $C5 ; check online volume(s)
|
||||
;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
|
||||
CMD_SETMARK = $CE ; change position in an open file
|
||||
CMD_SETEOF = $D0 ; set file size
|
||||
|
||||
; MLI parameter counts
|
||||
PC_CREATE = $07
|
||||
PC_DESTROY = $01
|
||||
PC_SETPREFIX = $01
|
||||
PC_GETFILEINFO = $0A
|
||||
PC_ONLINE = $02
|
||||
;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
|
||||
; 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
|
||||
jsr ReorderBuffer
|
||||
lda #$81 ; 'write block' command
|
||||
sta mlicmd
|
||||
lda DRIVE ; ProDOS "unit number" is
|
||||
sec
|
||||
sbc #$30
|
||||
lsr ; DSSS0000, where D is the
|
||||
asl ; drive number (0=drive 1,
|
||||
asl ; 1=drive 2) and SSS is
|
||||
asl ; the slot number (1-7).
|
||||
asl ; "Beneath Apple ProDOS"
|
||||
asl ; page 6-19
|
||||
asl
|
||||
asl
|
||||
sta mliparam+1
|
||||
lda SLOT
|
||||
sec
|
||||
sbc #$30
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
adc 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 mlicmd
|
||||
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
|
||||
.writeerr
|
||||
.writedone
|
||||
php
|
||||
pha
|
||||
jsr ReorderBuffer
|
||||
jsr SwapProDOS
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
|
||||
.blockcount !byte $FF
|
||||
}
|
||||
;-------------------------------
|
||||
; ReorderBuffer - convert data
|
||||
; buffer between ProDOS and
|
||||
; DOS 3.3 ordering (use after
|
||||
; read or before write under
|
||||
; ProDOS)
|
||||
; in: none
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
; @cmp1, @cmp2 clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
ReorderBuffer
|
||||
lda #$00
|
||||
sta cmp1
|
||||
sta cmp2
|
||||
tay
|
||||
lda #$01
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
sta cmp1+1
|
||||
lda #$0E
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
sta cmp2+1
|
||||
ldx #$07
|
||||
.L lda (cmp1),y
|
||||
pha
|
||||
lda (cmp2),y
|
||||
sta (cmp1),y
|
||||
pla
|
||||
sta (cmp2),y
|
||||
iny
|
||||
bne .L
|
||||
inc cmp1+1
|
||||
dec cmp2+1
|
||||
dex
|
||||
bne .L
|
||||
rts
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
pla
|
||||
sta $00
|
||||
pla
|
||||
sta $01
|
||||
tax
|
||||
lda #$0B
|
||||
clc
|
||||
adc $00
|
||||
bcc .noinc
|
||||
inx
|
||||
.noinc
|
||||
tay
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
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
|
||||
}
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
pla
|
||||
sta $00
|
||||
pla
|
||||
sta $01
|
||||
tax
|
||||
lda #$08
|
||||
clc
|
||||
adc $00
|
||||
bcc .noinc
|
||||
inx
|
||||
.noinc
|
||||
tay
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
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
|
||||
}
|
||||
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
|
||||
; A = file reference number
|
||||
; 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
|
||||
|
||||
;-------------------------------
|
||||
; close an open file
|
||||
; in: A = file reference number
|
||||
; out: if error, C set and A contains error code
|
||||
; if success, C clear
|
||||
; set file size in an open file via ProDOS MLI
|
||||
;
|
||||
; 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
|
||||
; the same file reference number that was passed in
|
||||
; preserves X
|
||||
;-------------------------------
|
||||
CloseFile
|
||||
SetEOF
|
||||
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
|
||||
lda #CMD_SETEOF ; MLI set_eof command
|
||||
ldy #PC_SETEOF ; number of params for 'set_eof' cmd
|
||||
bne JsrMLIAndReturnPlus1 ; always branches
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
; 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
|
||||
; (up to 15 character name, no leading slash)
|
||||
; note: lower 4 bits of @OnlineReturn contain length of @VolumeName
|
||||
; preserves X
|
||||
;-------------------------------
|
||||
accessbits = $C3 ; full access
|
||||
|
||||
CreateFile
|
||||
lda #accessbits
|
||||
sta mliparam+3 ; access bits (full access)
|
||||
lda #1
|
||||
sta mliparam+7 ; storage type (file)
|
||||
lda #0
|
||||
sta mliparam+8 ; creation date (current)
|
||||
sta mliparam+9
|
||||
sta mliparam+10 ; creation time (current)
|
||||
sta mliparam+11
|
||||
lda #CMD_CREATE ; MLI create command
|
||||
ldy #PC_CREATE ; number of parameters for 'create' command
|
||||
jsr mli
|
||||
rts
|
||||
GetVolumeName
|
||||
sta mliparam+1
|
||||
lda #<OnlineReturn
|
||||
sta mliparam+2
|
||||
lda #>OnlineReturn
|
||||
sta mliparam+3
|
||||
; /!\ execution falls through here
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
; check if volume is online
|
||||
;
|
||||
; in: caller has filled @mliparam with unit number
|
||||
; out: if error, C set and A contains error code
|
||||
; if success, C clear
|
||||
; preserves X
|
||||
;-------------------------------
|
||||
DeleteFile
|
||||
lda #CMD_DESTROY ; MLI destroy command
|
||||
ldy #PC_DESTROY ; number of parameters for 'destroy' command
|
||||
jsr mli
|
||||
rts
|
||||
Online
|
||||
lda #CMD_ONLINE
|
||||
ldy #PC_ONLINE
|
||||
bne mli ; always branches
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
; query volume information
|
||||
;
|
||||
; 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
|
||||
;-------------------------------
|
||||
SetPrefix
|
||||
lda #CMD_SETPREFIX
|
||||
ldy #PC_SETPREFIX
|
||||
jsr mli
|
||||
rts
|
||||
GetVolumeInfo
|
||||
lda OnlineReturn
|
||||
and #$0F
|
||||
tax
|
||||
inx
|
||||
stx OnlineReturn
|
||||
tay
|
||||
- lda OnlineReturn,y
|
||||
sta VolumeName,y
|
||||
dey
|
||||
bne -
|
||||
lda #$2F ;'/'
|
||||
sta VolumeName
|
||||
lda #<OnlineReturn
|
||||
sta mliparam+1
|
||||
lda #>OnlineReturn
|
||||
sta mliparam+2
|
||||
; /!\ execution falls through here
|
||||
|
||||
GetFileInfo
|
||||
lda #CMD_GETFILEINFO
|
||||
ldy #PC_GETFILEINFO
|
||||
; /!\ execution falls through here
|
||||
|
||||
;-------------------------------
|
||||
; low-level MLI wrapper
|
||||
|
@ -519,8 +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,$FE
|
||||
refnum !byte $FE ; file refnum (set by MLI open)
|
||||
mlilen !byte $FE,$FE ; file length (set by MLI read)
|
||||
!byte $FE,$FE,$FE,$FE
|
||||
; used by createfile
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
|
|
111
src/modify.a
111
src/modify.a
|
@ -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,11 +28,12 @@
|
|||
; $moddest zero page clobbered
|
||||
; stack set to return to
|
||||
; code after string
|
||||
; all registers clobbered
|
||||
; all flags clobbered
|
||||
; A,X,Y preserved
|
||||
; oVerflow bit clear
|
||||
; all other flags clobbered
|
||||
;-------------------------------
|
||||
!zone {
|
||||
modify
|
||||
sty mod_tmp_y
|
||||
sta gDisplayBytes
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
|
@ -29,47 +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
|
||||
.mod
|
||||
lda (modsrc),y
|
||||
bvc +
|
||||
- sta (moddest), y
|
||||
+ lda (modsrc), y
|
||||
dey
|
||||
bmi .exit
|
||||
sta (moddest),y
|
||||
clv
|
||||
bvc .mod ; unconditional branch
|
||||
.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
|
||||
}
|
||||
|
|
109
src/mods/t00only.a
Normal file
109
src/mods/t00only.a
Normal file
|
@ -0,0 +1,109 @@
|
|||
!cpu 6502
|
||||
*=$2000
|
||||
|
||||
!to "../../build/t00only.bin",plain
|
||||
|
||||
MODULE=1
|
||||
!source "../apidefs.a"
|
||||
!source "../strings/enid.a"
|
||||
WILDCARD = $97 ; from compare.a
|
||||
|
||||
;-------------------------------
|
||||
; AnalyzeT00
|
||||
; apply track $00-specific patchers
|
||||
;
|
||||
; in: Track $00 in data buffer
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
;-------------------------------
|
||||
AnalyzeT00
|
||||
lda #$07
|
||||
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/t00_earthware.a" ; out A=02,X=F6,Y=03
|
||||
!source "../patchers/t00_jmpb660.a" ; in A=02,X=F6,Y=03
|
||||
|
||||
!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
|
||||
|
||||
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 * > $3200 {
|
||||
!serious "code is too large to fit in available space!"
|
||||
}
|
158
src/mods/universalrwts.a
Normal file
158
src/mods/universalrwts.a
Normal file
|
@ -0,0 +1,158 @@
|
|||
!cpu 6502
|
||||
*=$B800
|
||||
|
||||
!to "../../build/universalrwts.bin",plain
|
||||
|
||||
;-------------------------------
|
||||
; Universal RWTS
|
||||
; a modified DOS 3.3-style RWTS that reads 16-sector (6-and-2 encoded) disks
|
||||
; - address prologue $D4 $AA $96 or $D5 $AA $96
|
||||
; - verifies address field checksum
|
||||
; - any address epilogue
|
||||
; - 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
|
||||
; that it will find the prologue even if there is only one sector on a track)
|
||||
;
|
||||
; It must be loaded at $B800. It uses the standard RWTS entry point at $BD00.
|
||||
;
|
||||
; Write support has been disabled. Any attempt to pass $02 or $04 RWTS commands
|
||||
; will crash. See note below on how to re-enable.
|
||||
;-------------------------------
|
||||
|
||||
universalrwts
|
||||
!byte $A2,$00,$A0,$02,$88,$B1,$3E,$4A,$3E,$00,$BC,$4A,$3E,$00,$BC,$99
|
||||
!byte $00,$BB,$E8,$E0,$56,$90,$ED,$A2,$00,$98,$D0,$E8,$A2,$55,$BD,$00
|
||||
!byte $BC,$29,$3F,$9D,$00,$BC,$CA,$10,$F5,$60,$38,$86,$27,$8E,$78,$06
|
||||
!byte $BD,$8D,$C0,$BD,$8E,$C0,$30,$7C,$AD,$00,$BC,$85,$26,$A9,$FF,$9D
|
||||
!byte $8F,$C0,$1D,$8C,$C0,$48,$68,$EA,$A0,$04,$48,$68,$20,$B9,$B8,$88
|
||||
!byte $D0,$F8,$A9,$D5,$20,$B8,$B8,$A9,$AA,$20,$B8,$B8,$A9,$AD,$20,$B8
|
||||
!byte $B8,$98,$A0,$56,$D0,$03,$B9,$00,$BC,$59,$FF,$BB,$AA,$BD,$29,$BA
|
||||
!byte $A6,$27,$9D,$8D,$C0,$BD,$8C,$C0,$88,$D0,$EB,$A5,$26,$EA,$59,$00
|
||||
!byte $BB,$AA,$BD,$29,$BA,$AE,$78,$06,$9D,$8D,$C0,$BD,$8C,$C0,$B9,$00
|
||||
!byte $BB,$C8,$D0,$EA,$AA,$BD,$29,$BA,$A6,$27,$20,$BB,$B8,$A9,$DE,$20
|
||||
!byte $B8,$B8,$A9,$AA,$20,$B8,$B8,$A9,$EB,$20,$B8,$B8,$A9,$FF,$20,$B8
|
||||
!byte $B8,$BD,$8E,$C0,$BD,$8C,$C0,$60,$18,$48,$68,$9D,$8D,$C0,$1D,$8C
|
||||
!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,$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,$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
|
||||
!byte $86,$2B,$85,$2A,$CD,$78,$04,$F0,$53,$A9,$00,$85,$26,$AD,$78,$04
|
||||
!byte $85,$27,$38,$E5,$2A,$F0,$33,$B0,$07,$49,$FF,$EE,$78,$04,$90,$05
|
||||
!byte $69,$FE,$CE,$78,$04,$C5,$26,$90,$02,$A5,$26,$C9,$0C,$B0,$01,$A8
|
||||
!byte $38,$20,$EE,$B9,$B9,$11,$BA,$20,$00,$BA,$A5,$27,$18,$20,$F1,$B9
|
||||
!byte $B9,$1D,$BA,$20,$00,$BA,$E6,$26,$D0,$C3,$20,$00,$BA,$18,$AD,$78
|
||||
!byte $04,$29,$03,$2A,$05,$2B,$AA,$BD,$80,$C0,$A6,$2B,$60,$AA,$A0,$A0
|
||||
!byte $A2,$11,$CA,$D0,$FD,$E6,$46,$D0,$02,$E6,$47,$38,$E9,$01,$D0,$F0
|
||||
!byte $60,$01,$30,$28,$24,$20,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$70,$2C,$26
|
||||
!byte $22,$1F,$1E,$1D,$1C,$1C,$1C,$1C,$1C,$96,$97,$9A,$9B,$9D,$9E,$9F
|
||||
!byte $A6,$A7,$AB,$AC,$AD,$AE,$AF,$B2,$B3,$B4,$B5,$B6,$B7,$B9,$BA,$BB
|
||||
!byte $BC,$BD,$BE,$BF,$CB,$CD,$CE,$CF,$D3,$D6,$D7,$D9,$DA,$DB,$DC,$DD
|
||||
!byte $DE,$DF,$E5,$E6,$E7,$E9,$EA,$EB,$EC,$ED,$EE,$EF,$F2,$F3,$F4,$F5
|
||||
!byte $F6,$F7,$F9,$FA,$FB,$FC,$FD,$FE,$FF,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
; these $FF bytes (at $BA80..$BA95) are used by the
|
||||
; routine that checks whether a track is formatted
|
||||
!byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
|
||||
; the nibble table that lives at $BA96 is copied into here from another location
|
||||
; after being potentially modified because of protection
|
||||
!byte $FF,$FF,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
; write support is disabled here ($BC56 is a BRK instruction)
|
||||
; set $BC56 to #$38 to re-enable
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$BD,$8D,$C0,$BD,$8E,$C0,$30,$5E,$A9
|
||||
!byte $FF,$9D,$8F,$C0,$DD,$8C,$C0,$48,$68,$20,$C3,$BC,$20,$C3,$BC,$9D
|
||||
!byte $8D,$C0,$DD,$8C,$C0,$EA,$88,$D0,$F0,$A9,$D5,$20,$D5,$BC,$A9,$AA
|
||||
!byte $20,$D5,$BC,$A9,$96,$20,$D5,$BC,$A5,$41,$20,$C4,$BC,$A5,$44,$20
|
||||
!byte $C4,$BC,$A5,$3F,$20,$C4,$BC,$A5,$41,$45,$44,$45,$3F,$48,$4A,$05
|
||||
!byte $3E,$9D,$8D,$C0,$BD,$8C,$C0,$68,$09,$AA,$20,$D4,$BC,$A9,$DE,$20
|
||||
!byte $D5,$BC,$A9,$AA,$20,$D5,$BC,$A9,$EB,$20,$D5,$BC,$18,$BD,$8E,$C0
|
||||
!byte $BD,$8C,$C0,$60,$48,$4A,$05,$3E,$9D,$8D,$C0,$DD,$8C,$C0,$68,$EA
|
||||
!byte $EA,$EA,$09,$AA,$EA,$EA,$48,$68,$9D,$8D,$C0,$DD,$8C,$C0,$60,$88
|
||||
!byte $A5,$E8,$91,$A0,$94,$88,$96,$E8,$91,$A0,$94,$88,$96,$91,$91,$C8
|
||||
!byte $94,$D0,$96,$91,$91,$C8,$94,$D0,$96,$91,$A3,$C8,$A0,$A5,$85,$A4
|
||||
!byte $84,$48,$85,$49,$A0,$02,$8C,$F8,$06,$A0,$04,$8C,$F8,$04,$A0,$01
|
||||
!byte $B1,$48,$AA,$A0,$0F,$D1,$48,$F0,$1B,$8A,$48,$B1,$48,$AA,$68,$48
|
||||
!byte $91,$48,$BD,$8E,$C0,$A0,$08,$BD,$8C,$C0,$DD,$8C,$C0,$D0,$F6,$88
|
||||
!byte $D0,$F8,$68,$AA,$BD,$8E,$C0,$BD,$8C,$C0,$A0,$08,$BD,$8C,$C0,$48
|
||||
!byte $68,$48,$68,$8E,$F8,$05,$DD,$8C,$C0,$D0,$03,$88,$D0,$EE,$08,$BD
|
||||
!byte $89,$C0,$A0,$06,$B1,$48,$99,$36,$00,$C8,$C0,$0A,$D0,$F6,$A0,$03
|
||||
!byte $B1,$3C,$85,$47,$A0,$02,$B1,$48,$A0,$10,$D1,$48,$F0,$06,$91,$48
|
||||
!byte $28,$A0,$00,$08,$6A,$90,$05,$BD,$8A,$C0,$B0,$03,$BD,$8B,$C0,$66
|
||||
!byte $35,$28,$08,$D0,$0B,$A0,$07,$20,$00,$BA,$88,$D0,$FA,$AE,$F8,$05
|
||||
!byte $A0,$04,$B1,$48,$20,$5A,$BE,$28,$D0,$11,$A4,$47,$10,$0D,$A0,$12
|
||||
!byte $88,$D0,$FD,$E6,$46,$D0,$F7,$E6,$47,$D0,$F3,$A0,$0C,$B1,$48,$F0
|
||||
!byte $5A,$C9,$04,$F0,$58,$6A,$08,$B0,$03,$20,$00,$B8,$A0,$30,$8C,$78
|
||||
!byte $05,$AE,$F8,$05,$20,$44,$B9,$90,$24,$CE,$78,$05,$10,$F3,$AD,$78
|
||||
!byte $04,$48,$A9,$60,$20,$95,$BE,$CE,$F8,$06,$F0,$28,$A9,$04,$8D,$F8
|
||||
!byte $04,$A9,$00,$20,$5A,$BE,$68,$20,$5A,$BE,$4C,$BC,$BD,$A4,$2E,$CC
|
||||
!byte $78,$04,$F0,$1C,$AD,$78,$04,$48,$98,$20,$95,$BE,$68,$CE,$F8,$04
|
||||
!byte $D0,$E5,$F0,$CA,$68,$A9,$40,$28,$4C,$48,$BE,$F0,$39,$4C,$AF,$BE
|
||||
!byte $A0,$03,$A9,$00,$48,$A5,$2F,$A0,$0E,$91,$48,$68,$F0,$08,$C5,$2F
|
||||
!byte $F0,$04,$A9,$20,$D0,$E1,$A0,$05,$B1,$48,$A8,$B9,$B8,$BF,$C5,$2D
|
||||
!byte $D0,$97,$28,$90,$1C,$20,$DC,$B8,$08,$B0,$8E,$28,$A2,$00,$86,$26
|
||||
!byte $20,$C2,$B8,$AE,$F8,$05,$18,$24,$38,$A0,$0D,$91,$48,$BD,$88,$C0
|
||||
!byte $60,$20,$2A,$B8,$90,$F0,$A9,$10,$B0,$EE,$48,$A0,$01,$B1,$3C,$6A
|
||||
!byte $68,$90,$08,$0A,$20,$6B,$BE,$4E,$78,$04,$60,$85,$2A,$20,$8E,$BE
|
||||
!byte $B9,$78,$04,$24,$35,$30,$03,$B9,$F8,$04,$8D,$78,$04,$A5,$2A,$24
|
||||
!byte $35,$30,$05,$99,$F8,$04,$10,$03,$99,$78,$04,$4C,$A0,$B9,$8A,$4A
|
||||
!byte $4A,$4A,$4A,$A8,$60,$48,$A0,$02,$B1,$48,$6A,$66,$35,$20,$8E,$BE
|
||||
!byte $68,$0A,$24,$35,$30,$05,$99,$F8,$04,$10,$03,$99,$78,$04,$60,$A0
|
||||
!byte $03,$B1,$48,$85,$41,$A9,$AA,$85,$3E,$A0,$56,$A9,$00,$85,$44,$99
|
||||
!byte $FF,$BB,$88,$D0,$FA,$99,$00,$BB,$88,$D0,$FA,$A9,$50,$20,$95,$BE
|
||||
!byte $A9,$28,$85,$45,$A5,$44,$20,$5A,$BE,$20,$0D,$BF,$A9,$08,$B0,$24
|
||||
!byte $A9,$30,$8D,$78,$05,$38,$CE,$78,$05,$F0,$19,$20,$44,$B9,$B0,$F5
|
||||
!byte $A5,$2D,$D0,$F1,$20,$DC,$B8,$B0,$EC,$E6,$44,$A5,$44,$C9,$23,$90
|
||||
!byte $D3,$18,$90,$05,$A0,$0D,$91,$48,$38,$BD,$88,$C0,$60,$A9,$00,$85
|
||||
!byte $3F,$A0,$80,$D0,$02,$A4,$45,$20,$56,$BC,$B0,$6B,$20,$2A,$B8,$B0
|
||||
!byte $66,$E6,$3F,$A5,$3F,$C9,$10,$90,$EC,$A0,$0F,$84,$3F,$A9,$30,$8D
|
||||
!byte $78,$05,$99,$A8,$BF,$88,$10,$FA,$A4,$45,$20,$87,$BF,$20,$87,$BF
|
||||
!byte $20,$87,$BF,$48,$68,$EA,$88,$D0,$F1,$20,$44,$B9,$B0,$23,$A5,$2D
|
||||
!byte $F0,$15,$A9,$10,$C5,$45,$A5,$45,$E9,$01,$85,$45,$C9,$05,$B0,$11
|
||||
!byte $38,$60,$20,$44,$B9,$B0,$05,$20,$DC,$B8,$90,$1C,$CE,$78,$05,$D0
|
||||
!byte $F1,$20,$44,$B9,$B0,$0B,$A5,$2D,$C9,$0F,$D0,$05,$20,$DC,$B8,$90
|
||||
!byte $8C,$CE,$78,$05,$D0,$EB,$38,$60,$A4,$2D,$B9,$A8,$BF,$30,$DD,$A9
|
||||
!byte $FF,$99,$A8,$BF,$C6,$3F,$10,$CA,$A5,$44,$D0,$0A,$A5,$45,$C9,$10
|
||||
!byte $90,$E5,$C6,$45,$C6,$45,$18,$60,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
|
||||
!byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$00,$0D,$0B,$09,$07,$05,$03,$01
|
||||
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F,$20,$93,$FE,$AD,$81,$C0,$AD,$81
|
||||
!byte $C0,$A9,$00,$8D,$00,$E0,$4C,$44,$B7,$00,$00,$00,$8D,$63,$AA,$8D
|
||||
!byte $70,$AA,$8D,$71,$AA,$60,$20,$5B,$A7,$8C,$B7,$AA,$60,$20,$7E,$AE
|
||||
!byte $AE,$9B,$B3,$9A,$20,$16,$A3,$BA,$8E,$9B,$B3,$A9,$09,$4C,$85,$B3
|
1081
src/passport.a
1081
src/passport.a
File diff suppressed because it is too large
Load Diff
861
src/patchers/555.a
Normal file
861
src/patchers/555.a
Normal 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
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
; e.g. Game Frame One, Game Frame Two
|
||||
;-------------------------------
|
||||
!zone {
|
||||
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
|
||||
|
@ -15,18 +15,11 @@
|
|||
!byte $D0,$03 ; BNE +3
|
||||
!byte $4C,$A5,$00; JMP $00A5
|
||||
!byte $C9,$A5 ; CMP #$A5
|
||||
bcs .exit
|
||||
sta gDisplayBytes
|
||||
pha
|
||||
lda #s_a5count
|
||||
bcs .exit ; passport-test-suite/Game Frame One.woz [C=0] matches
|
||||
jsr inx8
|
||||
jsr PrintByID
|
||||
txa
|
||||
clc
|
||||
adc #$08
|
||||
tax
|
||||
pla
|
||||
ldy #$02
|
||||
jsr modify
|
||||
!byte s_a5count
|
||||
jsr modify2
|
||||
!byte $D0,$7B ; BNE +$7B
|
||||
.exit
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
; e.g. The Secrets of Science Island
|
||||
;-------------------------------
|
||||
!zone {
|
||||
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
|
||||
|
@ -25,22 +25,15 @@
|
|||
!byte $BD,$8C,$C0; LDA $C08C,X
|
||||
!byte $10,$FB ; BPL -$FB
|
||||
!byte $C9,$95 ; CMP #$95
|
||||
bcs .exit
|
||||
ldy #$0E
|
||||
bcs .exit ; passport-test-suite/Writing Skills Volume 2.woz [C=0] matches
|
||||
ldy #$04
|
||||
jsr SearchTrack
|
||||
!byte $AE,$F8,$01; LDX $01F8
|
||||
!byte $A9,$0A ; LDA #$0A
|
||||
!byte $8D,$FE,$01; STA $01FE
|
||||
!byte $BD,$8E,$C0; LDA $C08E,X
|
||||
!byte $BD,$89,$C0; LDA $C089,X
|
||||
!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
|
||||
}
|
||||
|
|
31
src/patchers/aacount.a
Normal file
31
src/patchers/aacount.a
Normal file
|
@ -0,0 +1,31 @@
|
|||
;-------------------------------
|
||||
; #AACount
|
||||
; self-decrypting and re-encrypting nibble count
|
||||
;
|
||||
; tested on
|
||||
; Battle Group (SSI)
|
||||
; Moebius (Origin)
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda #$0F
|
||||
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
|
||||
jsr PrintByID
|
||||
!byte s_aacount
|
||||
jsr modify1
|
||||
!byte $60 ; RTS
|
||||
+
|
||||
dec .sector+1
|
||||
bpl .sector
|
||||
.exit
|
||||
}
|
89
src/patchers/advent.a
Normal file
89
src/patchers/advent.a
Normal file
|
@ -0,0 +1,89 @@
|
|||
;-------------------------------
|
||||
; #Advent
|
||||
; patched RWTS
|
||||
;
|
||||
; Borrowed Time
|
||||
; Mindshadow
|
||||
; Tracer Sanction
|
||||
;
|
||||
; module by qkumba
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda gIsAdvent
|
||||
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
|
||||
;different addresses at different stages of play
|
||||
|
||||
lda gTrack
|
||||
cmp #1
|
||||
.again php
|
||||
ldy #29
|
||||
jsr SearchTrack
|
||||
!byte $F0,$10 ;BEQ $+12
|
||||
!byte $29,$0F ;AND #$0F
|
||||
!byte $A8 ;TAY
|
||||
!byte $B9,WILDCARD,WILDCARD ;LDA $xxxx,Y
|
||||
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
|
||||
!byte $B9,WILDCARD,WILDCARD ;LDA $xxxx,Y
|
||||
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
|
||||
!byte $60 ;RTS
|
||||
!byte $A9,$AA ;LDA #$AA
|
||||
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
|
||||
!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
|
||||
; 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
|
||||
!byte $BD,$8C,$C0 ;LDA $C08C,X
|
||||
!byte $10,$FB ;BPL $-3
|
||||
!byte $D9,WILDCARD,WILDCARD ;CMP $xxxx,Y
|
||||
!byte $D0,$AB ;BNE $-53
|
||||
!byte $EA ;NOP
|
||||
!byte $BD,$8C,$C0 ;LDA $C08C,X
|
||||
!byte $10,$FB ;BPL $-3
|
||||
!byte $D9,WILDCARD,WILDCARD ;CMP $xxxx,Y
|
||||
!byte $D0,$A0 ;BNE $-5E
|
||||
bcs .pop
|
||||
pha
|
||||
txa
|
||||
adc #7
|
||||
tax
|
||||
pla
|
||||
adc #0
|
||||
pha
|
||||
txa
|
||||
adc #11
|
||||
sta .patch+1
|
||||
pla
|
||||
tay
|
||||
adc #0
|
||||
pha
|
||||
tya
|
||||
jsr modify3
|
||||
!byte $C9,$DE ;CMP #$DE
|
||||
!byte $EA ;NOP
|
||||
pla
|
||||
.patch
|
||||
ldx #0 ; passport-test-suite/Borrowed Time.woz [Z=1] reaches here
|
||||
jsr modify3
|
||||
!byte $C9,$AA ;CMP #$AA
|
||||
!byte $EA ;NOP
|
||||
plp
|
||||
bcs .exit
|
||||
sec ; passport-test-suite/Mindshadow.woz [C=0] reaches here
|
||||
bcs .again ; passport-test-suite/The Tracer Sanction.woz [C=1] reaches here
|
||||
|
||||
.pop
|
||||
plp
|
||||
.exit
|
||||
}
|
70
src/patchers/advint.a
Normal file
70
src/patchers/advint.a
Normal file
|
@ -0,0 +1,70 @@
|
|||
;-------------------------------
|
||||
; #ADVINT
|
||||
; 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
|
||||
; - SAGA5 - The Count v2.1-115
|
||||
; - SAGA6 - Strange Odyssey v2.1-119
|
||||
;-------------------------------
|
||||
!zone {
|
||||
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
|
||||
!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
|
||||
jsr PrintByID
|
||||
!byte s_advint
|
||||
jsr modify3
|
||||
!byte $D1 ;CLC
|
||||
!byte $59,$A7 ;BCC +$6E
|
||||
.exit
|
||||
}
|
18
src/patchers/b4bbbasic.a
Normal file
18
src/patchers/b4bbbasic.a
Normal 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
|
||||
+
|
|
@ -1,33 +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
|
||||
; e.g. Dino Dig, Make A Face
|
||||
;-------------------------------
|
||||
!zone {
|
||||
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 $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
|
||||
lda #$03
|
||||
ldx #$58
|
||||
ldy #$02
|
||||
jsr modify ; then set T00,S03,$58 =
|
||||
!byte $F0,06 ; BEQ +$06
|
||||
.exit
|
||||
}
|
|
@ -1,33 +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
|
||||
; e.g. Dinosaur Days
|
||||
;-------------------------------
|
||||
!zone {
|
||||
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
|
||||
lda #$03
|
||||
ldx #$59
|
||||
ldy #$02
|
||||
jsr modify ; then set T00,S03,$59 =
|
||||
!byte $F0,$05 ; BEQ +$05
|
||||
.exit
|
||||
}
|
39
src/patchers/bbf9.a
Normal file
39
src/patchers/bbf9.a
Normal file
|
@ -0,0 +1,39 @@
|
|||
;-------------------------------
|
||||
; #BBF9
|
||||
; patch nibble check seen in
|
||||
; Sunburst disks 1988 and later
|
||||
;
|
||||
; see write-up of 4am crack
|
||||
; no. 1165 Muppet Slate
|
||||
;
|
||||
; tested on
|
||||
; Muppet Slate (1988)
|
||||
; Memory Building Blocks (1989)
|
||||
; Odd One Out (1989)
|
||||
; Regrouping (1989)
|
||||
; Simon Says (1989)
|
||||
; Teddy and Iggy (1990)
|
||||
; 1-2-3 Sequence Me (1991)
|
||||
;-------------------------------
|
||||
!zone {
|
||||
; gIsProDOS is TRUE here
|
||||
|
||||
ldy #$08
|
||||
jsr SearchTrack
|
||||
!byte $8E,$C0
|
||||
!byte $18
|
||||
!byte $A5,WILDCARD
|
||||
!byte $69,$8C
|
||||
!byte $8D
|
||||
bcs .exit
|
||||
ldy #$05
|
||||
jsr SearchTrack
|
||||
!byte $A6,WILDCARD
|
||||
!byte $BD,$89,$C0
|
||||
bcs .exit ; passport-test-suite/Odd One Out 1990.woz [C=0] matches
|
||||
jsr PrintByID
|
||||
!byte s_bbf9
|
||||
jsr modify2
|
||||
!byte $18,$60
|
||||
.exit
|
||||
}
|
|
@ -5,11 +5,10 @@
|
|||
; after a certain number of boots
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda gTrack
|
||||
cmp #$01
|
||||
ldx gTrack
|
||||
dex
|
||||
bne .exit
|
||||
lda #$00
|
||||
ldx #$00
|
||||
txa
|
||||
ldy #$23
|
||||
jsr compare ; if T01,S00,$00 !=
|
||||
!byte $AD,$F3,$03,$8D,$F4,$03,$20,$2F
|
||||
|
@ -17,14 +16,10 @@
|
|||
!byte $58,$FC,$A9,$0A,$85,$25,$2C,WILDCARD
|
||||
!byte WILDCARD,$CE,$17,$18,$D0,$05,$A9,$80
|
||||
!byte $8D,$18,$18
|
||||
bcs .exit
|
||||
sta gDisplayBytes
|
||||
pha
|
||||
lda #s_bootcounter
|
||||
bcs .exit ; passport-test-suite/Elementary Vol. 2 v3.2 limited backup.woz [C=0] matches
|
||||
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
|
||||
}
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
; a custom RWTS-like routine to
|
||||
; position the disk for an E7
|
||||
; protection check
|
||||
; e.g. Bank Street Writer II,
|
||||
;
|
||||
; tested on
|
||||
; Bank Street Writer II
|
||||
; Fact and Fiction Toolkit
|
||||
; Mr. Pixel's Cartoon Kit
|
||||
; Mr. Pixel's Programming Paint Set
|
||||
; Story Maker
|
||||
; NOTE: I've only ever seen this on
|
||||
; track 0, so as a speed optimization
|
||||
; that's the only track where this
|
||||
; runs. It needs to search the entire
|
||||
; track because there is no fixed
|
||||
; position for it to start.
|
||||
; Swiss Family Robinson
|
||||
;-------------------------------
|
||||
!zone {
|
||||
ldy #$1A
|
||||
|
@ -30,26 +30,12 @@
|
|||
!byte $60 ; RTS
|
||||
!byte $38 ; SEC
|
||||
!byte $60 ; RTS
|
||||
bcs .exit
|
||||
sta gDisplayBytes
|
||||
pha
|
||||
txa
|
||||
clc
|
||||
adc #$09
|
||||
tax
|
||||
stx gDisplayBytes+1
|
||||
pla
|
||||
pha
|
||||
ldy #$01
|
||||
jsr modify
|
||||
bcs .exit ; passport-test-suite/Mr. Pixel's Programming Paint Set.woz [C=0] matches
|
||||
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
|
||||
}
|
||||
|
|
521
src/patchers/choplifter.a
Normal file
521
src/patchers/choplifter.a
Normal file
|
@ -0,0 +1,521 @@
|
|||
;-------------------------------
|
||||
; #Choplifter
|
||||
; insane protection by Roland Gustafsson
|
||||
; licensed by Broderbund, Gebelli, and others
|
||||
;
|
||||
; module by qkumba
|
||||
;
|
||||
; tested on
|
||||
; - Choplifter (Broderbund)
|
||||
; - Dueling Digits (Broderbund)
|
||||
; - Eggs-It (Gebelli)
|
||||
; - High Orbit (Gebelli)
|
||||
; - Horizon V (Gebelli)
|
||||
; - Labyrinth (Broderbund)
|
||||
; - Lazer Silk (Broderbund)
|
||||
; - Neptune (Gebelli)
|
||||
; - Phaser Fire (Gebelli)
|
||||
; - Russki Duck (Gebelli)
|
||||
; - Seafox (Broderbund)
|
||||
; - Serpentine (Broderbund)
|
||||
; - Sky Blazer (Broderbund)
|
||||
; - Star Blazer (Broderbund)
|
||||
;-------------------------------
|
||||
!zone {
|
||||
Choplifter
|
||||
lda #$00
|
||||
sta gCommand ; passport-test-suite/Eggs-It.woz [Z=1] reaches here
|
||||
sta dct+1
|
||||
jsr ChangeTrackNW
|
||||
jsr IncProgress
|
||||
ldx #$00
|
||||
- lda .readtracki,x
|
||||
sta $2000,x
|
||||
inx
|
||||
bne -
|
||||
|
||||
.read
|
||||
asl gTrack
|
||||
jsr ReadChoplifter
|
||||
lsr gTrack
|
||||
jsr WriteTrackNA
|
||||
ldx gTrack
|
||||
inx
|
||||
txa
|
||||
pha
|
||||
jsr ChangeTrackNW
|
||||
jsr IncProgress
|
||||
pla
|
||||
cmp #$23
|
||||
bne .read
|
||||
|
||||
bit gMode ; done if in verify-only mode
|
||||
bpl .exit
|
||||
|
||||
; start with RDOS as a minimal SD base
|
||||
; and copy SD code for free
|
||||
|
||||
ldx #ID_RDOS13
|
||||
jsr ConstructStandardDelivery
|
||||
ldx #$B0
|
||||
stx $104E ; exit address
|
||||
stx $1050 ; next-stage addressing
|
||||
inx
|
||||
stx $104F ; next-stage addressing
|
||||
inx
|
||||
stx $105D ; next-stage addressing
|
||||
|
||||
lda #$10
|
||||
sta modsrc+1
|
||||
lda #$5E
|
||||
sta modsrc
|
||||
ldx #$27
|
||||
lda #$67
|
||||
jsr .inittable
|
||||
|
||||
lda #$1F
|
||||
sta modsrc+1
|
||||
lda #$00
|
||||
sta modsrc
|
||||
ldx #$87
|
||||
lda #$C7
|
||||
jsr .inittable
|
||||
|
||||
dec modsrc+1
|
||||
ldx #$0F
|
||||
lda #$27
|
||||
jsr .inittable
|
||||
ldx #$47
|
||||
lda #$87
|
||||
jsr .inittable2
|
||||
|
||||
dec $1E00
|
||||
lda #$C0
|
||||
sta $10DD
|
||||
sta $1EAF
|
||||
sta $1F7F
|
||||
|
||||
ldy #0
|
||||
- lda .stage2,y
|
||||
sta $1D00,y
|
||||
iny
|
||||
cpy #.exit2-.stage2
|
||||
bne -
|
||||
|
||||
jsr PrintByID
|
||||
!byte s_bootwrite
|
||||
lda #$00
|
||||
sta gTrack
|
||||
jsr WriteTrackNA
|
||||
inc gPatchCount
|
||||
|
||||
.exit
|
||||
jsr .cleanup
|
||||
jmp Pass
|
||||
|
||||
.cleanup
|
||||
lda $C0E8
|
||||
lda #$01
|
||||
sta gCommand
|
||||
sta dct+1
|
||||
rts
|
||||
|
||||
ReadChoplifter
|
||||
lda #BASEPAGE
|
||||
sta modsrc+1
|
||||
lda #$00
|
||||
sta modsrc
|
||||
- jsr ReadSector ; really just seek
|
||||
lda $C0E9 ; turn the drive back on
|
||||
; no need for spin-up because we are fast enough
|
||||
ldx #$04
|
||||
lda gTrack
|
||||
beq .settrack00
|
||||
cmp #$12
|
||||
bcc .settrack01
|
||||
cmp #$16
|
||||
bcc .ignore
|
||||
beq .readtrack0B
|
||||
cmp #$3E
|
||||
bcs .checktrack1E
|
||||
jsr .readtrack
|
||||
inc gTrack
|
||||
lda gTrack
|
||||
lsr
|
||||
bcs -
|
||||
dec gTrack
|
||||
.ignore
|
||||
rts
|
||||
|
||||
.cancel
|
||||
jsr .cleanup
|
||||
jmp Cancel
|
||||
|
||||
.settrack00
|
||||
lda #$D5
|
||||
sta cmp1+1
|
||||
sta cmp2+1
|
||||
lda #$DD
|
||||
sta cmp1+0
|
||||
sta cmp2+0
|
||||
!byte $2C
|
||||
.settrack01
|
||||
ldx #$08
|
||||
|
||||
.readtrack
|
||||
stx tmpx
|
||||
jsr $2000 ; must run from page-aligned address for precise timing
|
||||
|
||||
;back-up in case of read failure
|
||||
|
||||
lda unform+0 ; prologue 2
|
||||
sta cmp2+0
|
||||
lda unform+1 ; prologue 1
|
||||
sta cmp2+1
|
||||
lda prbuf+0 ; epilog
|
||||
sta cmp1+0
|
||||
lda prbuf+1 ; prologue 3
|
||||
sta cmp1+1
|
||||
lda moddest+1
|
||||
sta modsrc+1
|
||||
rts
|
||||
|
||||
.readtrack0B
|
||||
|
||||
.checkkey1
|
||||
lda KEY
|
||||
bmi .cancel
|
||||
jsr ReadNib
|
||||
- cmp #$DD
|
||||
bne .checkkey1
|
||||
jsr ReadNib
|
||||
cmp #$F5
|
||||
bne -
|
||||
jsr ReadNib
|
||||
cmp #$D5
|
||||
bne - ; this had the same bug (see below)
|
||||
ldx #$03
|
||||
- jsr Read4x4
|
||||
jsr Read4x4
|
||||
jsr Read4x4
|
||||
sta cmp1+0,x
|
||||
dex
|
||||
bpl -
|
||||
rts
|
||||
|
||||
.checktrack1E
|
||||
cmp #$40
|
||||
bcs .checktrack20
|
||||
rts
|
||||
|
||||
.checktrack20
|
||||
beq .readtrack20
|
||||
cmp #$44
|
||||
beq .readtrack22
|
||||
rts
|
||||
|
||||
.readtrack20
|
||||
ldx #1
|
||||
jsr .readtrack
|
||||
lda (BASEPAGE<<8)+$C5
|
||||
sta .readtrack20i+.prolog1+1-.reloc
|
||||
lda (BASEPAGE<<8)+$CC
|
||||
sta .readtrack20i+.prolog2+1-.reloc
|
||||
lda (BASEPAGE<<8)+$D3
|
||||
sta .readtrack20i+.prolog3+1-.reloc
|
||||
ldy #$00
|
||||
- lda .readtrack20i,y
|
||||
sta $2100,y
|
||||
iny
|
||||
bne -
|
||||
ldx #$60
|
||||
jmp $2100 ; must run from page-aligned address for precise timing
|
||||
|
||||
.readtrack20i !pseudopc $2100 {
|
||||
.reloc
|
||||
-- jsr .readnibx
|
||||
|
||||
.prolog1
|
||||
- cmp #$D1 ; SMC
|
||||
bne --
|
||||
jsr .readnibx
|
||||
.prolog2
|
||||
cmp #$D1 ; SMC
|
||||
bne -
|
||||
jsr .readnibx
|
||||
.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
|
||||
jsr .readnibx
|
||||
and tmp
|
||||
sta (BASEPAGE+8)<<8,y
|
||||
iny
|
||||
jsr .read4x4x
|
||||
sta (BASEPAGE+8)<<8,y
|
||||
iny
|
||||
jsr .readnibx
|
||||
sec
|
||||
rol
|
||||
sta tmp
|
||||
.x2
|
||||
- lda $C0EC
|
||||
bpl -
|
||||
!if >.x2 != >* {
|
||||
!serious "branch crosses a page"
|
||||
}
|
||||
and tmp
|
||||
sta (BASEPAGE+8)<<8,y
|
||||
iny
|
||||
cmp #$EA
|
||||
bne --
|
||||
rts
|
||||
|
||||
.read4x4x
|
||||
- lda $C08C,x
|
||||
bpl -
|
||||
sec
|
||||
rol
|
||||
sta tmp
|
||||
- lda $C08C,x
|
||||
bpl -
|
||||
and tmp
|
||||
rts
|
||||
}
|
||||
|
||||
.readtrack22
|
||||
ldx #$40
|
||||
ldy #$00
|
||||
-- dey
|
||||
bne +
|
||||
dex
|
||||
beq ++
|
||||
+ ldx #$60
|
||||
jsr .readnibx
|
||||
- cmp #$D5
|
||||
bne --
|
||||
jsr .readnibx
|
||||
cmp #$FF
|
||||
bne -
|
||||
jsr .readnibx
|
||||
cmp #$DD
|
||||
bne - ; this had the same bug
|
||||
ldy #$00
|
||||
- jsr .read4x4x
|
||||
sta BASEPAGE<<8,y
|
||||
iny
|
||||
bne -
|
||||
++ rts
|
||||
|
||||
.readtracki !pseudopc $2000 {
|
||||
ldx #$60
|
||||
lda #$E0
|
||||
sta tmpa
|
||||
sta tmpy
|
||||
|
||||
.retry
|
||||
lda tmpx
|
||||
sta nibcount
|
||||
lda modsrc
|
||||
sta moddest
|
||||
lda modsrc+1
|
||||
sta moddest+1
|
||||
ldy #$00
|
||||
--- inc tmpa
|
||||
beq .inc_tmpy
|
||||
jsr .readnibx
|
||||
-- cmp cmp2+1
|
||||
bne ---
|
||||
jsr .readnibx
|
||||
- cmp cmp2+0
|
||||
bne --
|
||||
jsr .readnibx
|
||||
cmp cmp1+1
|
||||
bne - ; this has a bug which is also present in the original code
|
||||
; it branches to the middle nibble instead of the first one
|
||||
; it allows PR0 PR1 [any] PR1 PR2 instead of requiring PR0 PR1 PR2
|
||||
-- lda $C08C,x
|
||||
bpl --
|
||||
rol
|
||||
sta tmp
|
||||
- lda $C08C,x
|
||||
bpl -
|
||||
and tmp
|
||||
sta (moddest), y
|
||||
iny
|
||||
bne --
|
||||
asl $C000
|
||||
- lda $C08C,x
|
||||
bpl -
|
||||
cmp cmp1+0
|
||||
bne .retry
|
||||
inc moddest+1
|
||||
dec nibcount
|
||||
bne --
|
||||
jsr .readnibx
|
||||
sta prbuf+1 ; prologue 3
|
||||
jsr .readnibx
|
||||
sta unform+0 ; prologue 2
|
||||
jsr .readnibx
|
||||
sta unform+1 ; prologue 1
|
||||
jsr .readnibx
|
||||
sta prbuf+0 ; epilog
|
||||
jsr .readnibx
|
||||
cmp unform+1 ; trailer epilog
|
||||
bne .retry
|
||||
rts
|
||||
|
||||
.inc_tmpy
|
||||
inc tmpy
|
||||
bne ---
|
||||
;;something
|
||||
jsr .cleanup
|
||||
jmp FatalError
|
||||
|
||||
.readnibx
|
||||
- lda $C08C,x
|
||||
bpl -
|
||||
rts
|
||||
}
|
||||
|
||||
.inittable
|
||||
ldy #$08
|
||||
|
||||
.inittable2
|
||||
sta tmp
|
||||
|
||||
.buildtable
|
||||
txa
|
||||
sta (modsrc),y
|
||||
dex
|
||||
iny
|
||||
tya
|
||||
and #$0F
|
||||
cmp #$0F
|
||||
bne .buildtable
|
||||
tya
|
||||
sbc #$0F
|
||||
tay
|
||||
txa
|
||||
sta (modsrc),y
|
||||
tya
|
||||
adc #$18-1 ; carry set by sbc
|
||||
tay
|
||||
txa
|
||||
adc #$0F
|
||||
tax
|
||||
cmp tmp
|
||||
bne .buildtable
|
||||
rts
|
||||
|
||||
.stage2 !pseudopc $B000 { ; high address that won't be hit on the first round of SD
|
||||
lda $c057
|
||||
lda $c054
|
||||
lda $c052
|
||||
lda $c050
|
||||
ldx #0
|
||||
- lda $800,x
|
||||
sta $B300,x
|
||||
inx
|
||||
bne -
|
||||
ldx #$42
|
||||
txs
|
||||
lda #>(.resume-1)
|
||||
pha
|
||||
lda #<(.resume-1)
|
||||
pha
|
||||
jmp $4000
|
||||
|
||||
.resume
|
||||
ldx #0
|
||||
- lda .stager,x
|
||||
sta $500,x
|
||||
lda (*+$ff) and $ff00,x
|
||||
sta $200,x
|
||||
lda (*+$1ff) and $ff00,x
|
||||
sta $400,x
|
||||
lda $B300,x
|
||||
sta $800,x
|
||||
txs
|
||||
inx
|
||||
bne -
|
||||
jsr .dostep4
|
||||
ldy #2 ; pagehi, first table
|
||||
sty $807
|
||||
ldy #$60 ; rts
|
||||
sty $84c
|
||||
ldx $2b ; SD requires X=boot slot x16
|
||||
jsr .callSD ; including original $8xx to $7xx
|
||||
asl $807 ; 4xx, second table
|
||||
jmp $500
|
||||
|
||||
.stager !pseudopc $500 {
|
||||
jsr .callSD
|
||||
jsr .step
|
||||
lda #$60 ; rts
|
||||
sta $801
|
||||
|
||||
; to enable writing requires finding three spare pages
|
||||
; that is common to all games. I did not succeed.
|
||||
; for that reason, auto-crack is read-only.
|
||||
|
||||
sta $207
|
||||
|
||||
lda #6
|
||||
sta $27
|
||||
jsr $823 ; read patch table to $600
|
||||
jsr .dostep2 ; reach track $22
|
||||
sta $3d
|
||||
lda #4
|
||||
sta $27
|
||||
jsr $823 ; read high scores to $400
|
||||
lda $C088,x
|
||||
ldy #0 ; avoid CFFA bug (Y is not zero on return)
|
||||
- lda $700,y
|
||||
sta $800,y
|
||||
iny
|
||||
bne -
|
||||
- lda $600,y
|
||||
sta .patcher+1
|
||||
lda $601,y
|
||||
sta .patcher+2
|
||||
lda $602,y
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
|
||||
.patcher
|
||||
sta $d1d1
|
||||
cmp #$ea
|
||||
bne -
|
||||
jmp ($20)
|
||||
|
||||
.callSD
|
||||
sta $806 ; pagelo
|
||||
ldy #$ff
|
||||
jsr $805
|
||||
beq .step
|
||||
|
||||
.dostep4
|
||||
jsr .dostep2
|
||||
|
||||
.dostep2
|
||||
jsr .step
|
||||
|
||||
.step
|
||||
jsr $82F
|
||||
lsr $40
|
||||
rts
|
||||
} ;$5xx
|
||||
} ;$Bxxx
|
||||
|
||||
.exit2
|
||||
}
|
|
@ -33,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
|
||||
|
@ -42,12 +41,11 @@
|
|||
!byte $A9,$01 ; LDA #$01
|
||||
!byte $85,$04 ; STA $04
|
||||
!byte $20,$28,$40; JSR $4028
|
||||
bcs .exit
|
||||
lda #s_corrupter
|
||||
bcs .exit ; passport-test-suite/Squire.woz [C=0] matches
|
||||
sta gDisplayBytes
|
||||
jsr PrintByID
|
||||
lda #$0E
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte s_corrupter
|
||||
jsr modify1
|
||||
!byte $60 ; RTS
|
||||
.exit
|
||||
}
|
||||
|
|
|
@ -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
|
||||
; Sum Ducks
|
||||
; NoteCard Maker
|
||||
; 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 {
|
||||
;
|
||||
; 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
|
||||
and gIsBoot0
|
||||
bne .exit
|
||||
lda gPossibleD5D5F7
|
||||
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
|
||||
sta gDisplayBytes
|
||||
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
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
;-------------------------------
|
||||
; #DAVIDBB03
|
||||
; David-DOS boot0 calls $BB03
|
||||
; for a self-decrypting nibble
|
||||
; check which continues to $B7A9
|
||||
; on success
|
||||
; e.g. Case of the Great Train
|
||||
; Robbery, Case of the Missing
|
||||
; Chick, Mrs. Wigglesworth's Secret
|
||||
; Mystery of the Witch's Shoes
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda #$00
|
||||
ldx #$00
|
||||
ldy #$38
|
||||
jsr compare ; and T00,S00,$00 ==
|
||||
!byte $01,$A5,$27,$C9,$09,$D0,$17,$A5
|
||||
!byte $2B,$4A,$4A,$4A,$4A,$AA,$09,$C0
|
||||
!byte $85,$3F,$A9,$00,$9D,$78,$04,$9D
|
||||
!byte $F8,$04,$A9,$5C,$85,$3E,$AE,$FF
|
||||
!byte $08,$30,$15,$BD,$ED,$08,$85,$3D
|
||||
!byte $CE,$FF,$08,$AD,$FE,$08,$85,$27
|
||||
!byte $CE,$FE,$08,$A6,$2B,$6C,$3E,$00
|
||||
bcs .exit
|
||||
lda #$00
|
||||
ldx #$8B
|
||||
ldy #$03
|
||||
jsr compare ; and T00,S00,$8B ==
|
||||
!byte $20,03,$BB
|
||||
bcs .exit
|
||||
lda #$07
|
||||
ldx #$03
|
||||
ldy #$25
|
||||
jsr compare ; and T00,S07,$03 ==
|
||||
!byte $4E,$06,$BB,$71,$6E
|
||||
!byte $0A,$BB,$40,$27,$6E,$0F,$BB,$DD
|
||||
!byte $1B,$BB,$6E,$15,$BB,$DC,$1E,$BB
|
||||
!byte $6E,$25,$BB,$72,$00,$BB,$B3,$00
|
||||
!byte $B8,$99,$00,$BB,$C8,$A0,$F4,$B0
|
||||
bcs .exit
|
||||
lda #s_jsrbb03
|
||||
jsr PrintByID
|
||||
lda #$07
|
||||
ldx #$03
|
||||
ldy #$0B
|
||||
jsr modify ; then set T00,S07,$03 =
|
||||
!byte $A9,$B5,$48,$A9,$18,$48,$A0,$04
|
||||
!byte $4C,$A9,$B7
|
||||
.exit
|
||||
}
|
37
src/patchers/davidsonasm.a
Normal file
37
src/patchers/davidsonasm.a
Normal file
|
@ -0,0 +1,37 @@
|
|||
;-------------------------------
|
||||
; #DAVIDSONASM
|
||||
; bad block check of T22,S00
|
||||
; implemented in assembly
|
||||
;
|
||||
; tested on
|
||||
; - Alge-Blaster Plus 1.0
|
||||
; - Math Blaster Mystery 1.0
|
||||
; - Math Blaster Mystery 1.3
|
||||
; - Reading and Me
|
||||
; - Spell It Plus
|
||||
; - Word Attack Plus 1.2
|
||||
; - Word Attack Plus French 1.2
|
||||
; - Word Attack Plus Spanish 1.2
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda gIsDavidson
|
||||
bne .exit
|
||||
|
||||
lda #$0F
|
||||
sta .sector+1
|
||||
.sector lda #$FF ; modified at runtime
|
||||
ldx #$00
|
||||
ldy #$06
|
||||
jsr compare
|
||||
!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
|
||||
jsr modify1
|
||||
!byte $79 ; JMP to $0879 instead
|
||||
+ dec .sector+1
|
||||
bpl .sector
|
||||
.exit
|
||||
}
|
26
src/patchers/davidsonforth.a
Normal file
26
src/patchers/davidsonforth.a
Normal file
|
@ -0,0 +1,26 @@
|
|||
;-------------------------------
|
||||
; #DAVIDSONFORTH
|
||||
; bad block check of T22,S00
|
||||
; implemented in FORTH
|
||||
;
|
||||
; tested on
|
||||
; - Math Blaster Plus 1.6
|
||||
; - Read N Roll 1.0
|
||||
; - Read N Roll 1.1
|
||||
; - Math and Me 1.0
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda gIsDavidson
|
||||
bne .exit
|
||||
|
||||
ldy #$08
|
||||
jsr SearchTrack
|
||||
!byte $08,$80,$00,$FD,$1C,$D1,$0D,$EC
|
||||
bcs .exit ; passport-test-suite/Read 'N Roll.woz [C=0] matches
|
||||
jsr PrintByID
|
||||
!byte s_badblock
|
||||
inx
|
||||
jsr modify1
|
||||
!byte $CC ; MLI CLOSE command (instead of BLOCKREAD)
|
||||
.exit
|
||||
}
|
25
src/patchers/didatech.a
Normal file
25
src/patchers/didatech.a
Normal 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
|
||||
+
|
|
@ -1,45 +0,0 @@
|
|||
;-------------------------------
|
||||
; #DISKVOL
|
||||
; non-standard disk volume prevents
|
||||
; DOS from loading
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda gIsRWTS ; if DOS 3.3 RWTS
|
||||
bne .exit
|
||||
lda #$01
|
||||
ldx #$EE
|
||||
ldy #$01
|
||||
jsr compare ; and T00,S01,$EE ==
|
||||
!byte $FB
|
||||
bcs .exit
|
||||
ldx #$FB
|
||||
ldy #$04
|
||||
jsr compare ; and T00,S01,$FB ==
|
||||
!byte $00,$01,$EF,$D8
|
||||
bcs .exit
|
||||
ldx #$EB
|
||||
ldy #$01
|
||||
jsr compare ; and T00,S01,$EB !=
|
||||
!byte $FE
|
||||
bcc .exit
|
||||
ldy #$01
|
||||
jsr compare ; and T00,S01,$EB !=
|
||||
!byte $00
|
||||
bcc .exit
|
||||
lda #$08
|
||||
ldx #$10
|
||||
ldy #$05
|
||||
jsr compare ; and T00,S08,$10 ==
|
||||
!byte $A0,$03 ; LDY #$03
|
||||
!byte $B1,$48 ; LDA ($48),Y
|
||||
!byte $48 ; PHA
|
||||
bcs .exit
|
||||
lda #s_diskvol
|
||||
jsr PrintByID
|
||||
lda #$08
|
||||
ldx #$12
|
||||
ldy #$02
|
||||
jsr modify ; then set T00,S08,$12 =
|
||||
!byte $A9,$00 ; LDA #$00
|
||||
.exit
|
||||
}
|
22
src/patchers/dos32muse.a
Normal file
22
src/patchers/dos32muse.a
Normal file
|
@ -0,0 +1,22 @@
|
|||
;-------------------------------
|
||||
; #DOS32MUSE
|
||||
; $A5D6 jumps to $BFD5 for no good reason
|
||||
;
|
||||
; tested on
|
||||
; Castle Wolfenstein (1981, MUSE)
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda gIsDOS32
|
||||
bne .exit
|
||||
ldx gTrack
|
||||
dex
|
||||
bne .exit
|
||||
lda #$08
|
||||
ldx #$D6
|
||||
jsr compare2 ; if T01,S08,$D6 ==
|
||||
!byte $4C,$D5
|
||||
bcs .exit ; passport-test-suite/Castle Wolfenstein.woz [C=0] matches
|
||||
jsr modify3 ; then set T01,S08,$D6 =
|
||||
!byte $E8,$D0,$32
|
||||
.exit
|
||||
}
|
40
src/patchers/e7everywhere.a
Normal file
40
src/patchers/e7everywhere.a
Normal file
|
@ -0,0 +1,40 @@
|
|||
;------------------------------------------------------------------------------
|
||||
; #E7EVERYWHERE
|
||||
; 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. 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.
|
||||
;
|
||||
; tested on
|
||||
; - Curious George Goes Shopping (DLM)
|
||||
; - Curious George Visits The Library (DLM)
|
||||
; - Curious George Goes To Outer Space (DLM)
|
||||
; - Spelling Mastery (DLM)
|
||||
; - Garfield Trivia Game (DLM)
|
||||
; - The Quarter Mile (Barnum)
|
||||
; - Reading and Writing with The Boars (McGraw-Hill)
|
||||
;------------------------------------------------------------------------------
|
||||
E7Everywhere
|
||||
lda gIsBoot0
|
||||
and gIsProDOS
|
||||
bne +
|
||||
ldy #$11
|
||||
jsr SearchTrack
|
||||
!byte $A9,$05 ; LDA #$05
|
||||
!byte $8D,WILDCARD,WILDCARD
|
||||
!byte $AE,WILDCARD,WILDCARD
|
||||
!byte $BD,$8E,$C0; LDA $C08E,X
|
||||
!byte $BD,$89,$C0; LDA $C089,X
|
||||
!byte $A9,$00 ; LDA #$00
|
||||
!byte $8D
|
||||
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
|
||||
+
|
30
src/patchers/e7everywhere.encrypted.a
Executable file
30
src/patchers/e7everywhere.encrypted.a
Executable 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
|
|
@ -3,6 +3,31 @@
|
|||
; patched RWTS and p-code madness
|
||||
;
|
||||
; module by qkumba
|
||||
;
|
||||
; tested on
|
||||
; - Adventure Construction Set
|
||||
; - Archon
|
||||
; - Archon II
|
||||
; - Arcticfox
|
||||
; - Ali Baba and the Forty Thieves
|
||||
; - Axis Assassin (later releases only)
|
||||
; - The Bard's Tale
|
||||
; - The Bard's Tale II
|
||||
; - Boulder Dash
|
||||
; - Cut & Paste
|
||||
; - Earth Orbit Stations
|
||||
; - The Last Gladiator (all known release)
|
||||
; - Lords of Conquest
|
||||
; - Marble Madness
|
||||
; - Mind Mirror
|
||||
; - Movie Maker
|
||||
; - Music Construction Set (all known releases)
|
||||
; - PHM Pegasus
|
||||
; - Realm of Impossibility
|
||||
; - Return of Heracles
|
||||
; - Robot Rascals
|
||||
; - The Seven Cities of Gold
|
||||
; - Skyfox
|
||||
;-------------------------------
|
||||
!zone {
|
||||
lda gIsEA ; only ever seen this protection
|
||||
|
@ -40,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
|
||||
|
@ -58,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
|
||||
|
@ -73,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
|
||||
|
@ -84,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
|
||||
|
@ -104,21 +115,22 @@
|
|||
!byte $0F,$F5,$70 ;BNE $a9f6
|
||||
bcs +
|
||||
pha
|
||||
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
|
||||
|
||||
|
@ -132,12 +144,14 @@
|
|||
!byte $60 ;RTS
|
||||
bcs +
|
||||
pha
|
||||
jsr PrintByID
|
||||
!byte s_tamper
|
||||
txa
|
||||
clc
|
||||
adc #11
|
||||
tax
|
||||
pla
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr modify1
|
||||
!byte $00 ;disable branch
|
||||
|
||||
+ ldy #15
|
||||
|
@ -150,12 +164,14 @@
|
|||
!byte $0F,$78,$60 ;BNE $B97B
|
||||
bcs +
|
||||
pha
|
||||
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
|
||||
|
@ -167,13 +183,12 @@
|
|||
!byte $20,$67,$67 ;JSR $6767
|
||||
!byte $20,$AA,$BF ;JSR $BFAA
|
||||
bcs +
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
ldy #1
|
||||
jsr modify
|
||||
pha
|
||||
jsr PrintByID
|
||||
!byte s_tamper
|
||||
pla
|
||||
jsr inx5
|
||||
jsr modify1
|
||||
!byte $00 ;new checksum value for cmp
|
||||
|
||||
+ ldy #9
|
||||
|
@ -183,14 +198,10 @@
|
|||
!byte $C9,$52 ;CMP #$52
|
||||
!byte $F0,$03 ;BEQ +$03
|
||||
bcs +
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr PrintByID
|
||||
!byte s_tamper
|
||||
jsr inx6
|
||||
jsr modify1
|
||||
!byte $50 ;new checksum value for cmp
|
||||
|
||||
+ ldy #7
|
||||
|
@ -199,12 +210,10 @@
|
|||
!byte $C9,$52 ;CMP #$52
|
||||
!byte $D0,$DB ;BNE -$DB
|
||||
bcs +
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr PrintByID
|
||||
!byte s_tamper
|
||||
jsr inx4
|
||||
jsr modify1
|
||||
!byte $50 ;new checksum value for cmp
|
||||
|
||||
+ ldy #12
|
||||
|
@ -214,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
|
||||
|
@ -241,8 +244,7 @@
|
|||
adc #21
|
||||
tax
|
||||
pla
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr modify1
|
||||
!byte $C7 ;lda from known-zero instead
|
||||
|
||||
+ ldy #23
|
||||
|
@ -261,8 +263,7 @@
|
|||
adc #21
|
||||
tax
|
||||
pla
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr modify1
|
||||
!byte $E0 ;lda from known-zero instead
|
||||
|
||||
+ ldy #23
|
||||
|
@ -281,14 +282,55 @@
|
|||
adc #21
|
||||
tax
|
||||
pla
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr modify1
|
||||
!byte $E0 ;lda from known-zero instead
|
||||
|
||||
+ ldy #23
|
||||
jsr SearchTrack
|
||||
!byte $03,$4C ;LDI #$00
|
||||
!byte $06,$E1,$E0 ;STA $39e2
|
||||
!byte $05,$D3,$EE ;JSRA $37d0
|
||||
!byte $05,$D3,$EE ;JSRA $37d0
|
||||
!byte $05,$D3,$EE ;JSRA $37d0
|
||||
!byte $05,$D3,$EE ;JSRA $37d0
|
||||
!byte $04,$EB,$19 ;LDA $c0e8
|
||||
!byte $04,$E1,$E0 ;LDA $39e2
|
||||
bcs +
|
||||
pha
|
||||
txa
|
||||
adc #21
|
||||
tax
|
||||
pla
|
||||
jsr modify1
|
||||
!byte $E0 ;lda from known-zero instead
|
||||
|
||||
+ ldy #31
|
||||
jsr SearchTrack
|
||||
!byte $03,$4C ;LDI #$00
|
||||
!byte $06,$E1,$7B ;STA $a2e2
|
||||
!byte $03,$AB ;LDI #$e7
|
||||
!byte $05,$02,$78 ;JSRA $a101
|
||||
!byte $03,$AD ;LDI #$e1
|
||||
!byte $05,$02,$78 ;JSRA $a101
|
||||
!byte $03,$AB ;LDI #$e7
|
||||
!byte $05,$02,$78 ;JSRA $a101
|
||||
!byte $03,$A9 ;LDI #$e5
|
||||
!byte $05,$02,$78 ;JSRA $a101
|
||||
!byte $04,$EB,$19 ;LDA $c0e8
|
||||
!byte $04,$E1,$7B ;LDA $a2e2
|
||||
bcs +
|
||||
pha
|
||||
txa
|
||||
adc #29
|
||||
tax
|
||||
pla
|
||||
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
|
||||
|
@ -298,30 +340,200 @@
|
|||
!byte $E9,$00 ;SBC #$00
|
||||
!byte $48 ;PHA
|
||||
bcs +
|
||||
jsr PrintByID
|
||||
!byte s_tamper
|
||||
inx
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr modify1
|
||||
!byte $E8 ;new checksum value for eor
|
||||
|
||||
+ ldy #14
|
||||
jsr SearchTrack
|
||||
!byte $AD,$00,$05
|
||||
!byte $A2,$FF
|
||||
!byte $5D,$00,$05
|
||||
!byte $CA
|
||||
!byte $D0,$FA
|
||||
!byte $C9,$A0
|
||||
!byte $F0
|
||||
bcs .exit
|
||||
!byte $AD,$00,$05 ;LDA $0500
|
||||
!byte $A2,$FF ;LDX #$FF
|
||||
!byte $5D,$00,$05 ;EOR $0500,X
|
||||
!byte $CA ;DEX
|
||||
!byte $D0,$FA ;BNE *-4
|
||||
!byte $C9,$A0 ;CMP #$A0
|
||||
!byte $F0 ;BEQ *+xx
|
||||
bcs +
|
||||
pha
|
||||
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
|
||||
jsr SearchTrack
|
||||
!byte $04,$4F,$D9 ;LDA $004c
|
||||
!byte $0A,$03,$7B ;LDX ($a200,A)
|
||||
!byte $10,$F1,$70 ;SUB $a9f2
|
||||
!byte $06,$F1,$70 ;STA $a9f2
|
||||
!byte $0C,$4F,$D9 ;INC $004c
|
||||
!byte $07,$AC ;CMP #$e0
|
||||
!byte $0F,$E5,$71 ;BNE $a8e6
|
||||
!byte $04,$F1,$70 ;LDA $a9f2
|
||||
!byte $07 ;CMP #$xx
|
||||
bcs +
|
||||
pha
|
||||
jsr PrintByID
|
||||
!byte s_tamper
|
||||
txa
|
||||
clc
|
||||
adc #24
|
||||
tax
|
||||
pla
|
||||
jsr compare1
|
||||
!byte $AB ;Last Gladiator
|
||||
bcs ++
|
||||
jsr modify1
|
||||
!byte $BB ;new checksum value for eor
|
||||
bvc +
|
||||
++
|
||||
jsr compare1
|
||||
!byte $D4 ;Arctic Fox, PHM Pegasus
|
||||
bcs ++
|
||||
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
|
||||
++
|
||||
|
||||
+ ldy #23
|
||||
jsr SearchTrack
|
||||
!byte $03,$4C ;LDI #$00
|
||||
!byte $06,$E1,$7b ;STA $a2e2
|
||||
!byte $05,$CC,$79 ;JSRA $a0cf
|
||||
!byte $05,$CC,$79 ;JSRA $a0cf
|
||||
!byte $05,$CC,$79 ;JSRA $a0cf
|
||||
!byte $05,$CC,$79 ;JSRA $a0cf
|
||||
!byte $04,$EB,$19 ;LDA $c0e8
|
||||
!byte $04,$E1,$7b ;LDA $a2e2
|
||||
bcs +
|
||||
pha
|
||||
txa
|
||||
adc #21
|
||||
tax
|
||||
pla
|
||||
jsr modify1
|
||||
!byte $E0 ;lda from known-zero instead
|
||||
|
||||
+ ldy #23
|
||||
jsr SearchTrack
|
||||
!byte $03,$9C ;LDI #$00
|
||||
!byte $06,$31,$66 ;STA $bfe2
|
||||
!byte $D5,$CC,$B4 ;JSRA $bdcf
|
||||
!byte $05,$1C,$64 ;JSRA $bdcf
|
||||
!byte $D5,$CC,$B4 ;JSRA $bdcf
|
||||
!byte $05,$1C,$64 ;JSRA $bdcf
|
||||
!byte $D4,$EB,$C9 ;LDA $c0e8
|
||||
!byte $04,$31,$66 ;LDA $bfe2
|
||||
bcs +
|
||||
pha
|
||||
txa
|
||||
adc #21
|
||||
tax
|
||||
pla
|
||||
jsr modify1
|
||||
!byte $30 ;lda from known-zero instead
|
||||
|
||||
+ ldy #14
|
||||
jsr SearchTrack
|
||||
!byte $58,$0D
|
||||
!byte $F1,$5D
|
||||
!byte $5A,$0D
|
||||
!byte $74,$00
|
||||
!byte $5C,$0D
|
||||
!byte $5E,$00
|
||||
!byte $5E,$0D
|
||||
bcs +
|
||||
jsr PrintByID
|
||||
!byte s_tamper
|
||||
inx
|
||||
inx
|
||||
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
|
||||
lda gIsBoot0
|
||||
bne .exit
|
||||
|
@ -342,8 +554,7 @@
|
|||
adc #21
|
||||
tax
|
||||
pla
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr modify1
|
||||
!byte $7F ;lda from known-zero instead
|
||||
|
||||
+ ldy #13
|
||||
|
@ -360,8 +571,7 @@
|
|||
adc #11
|
||||
tax
|
||||
pla
|
||||
ldy #1
|
||||
jsr modify
|
||||
jsr modify1
|
||||
!byte $00 ;disable branch
|
||||
|
||||
+
|
||||
|
|
48
src/patchers/enlightenment.a
Normal file
48
src/patchers/enlightenment.a
Normal 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
50
src/patchers/errord51.a
Normal 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
|
35
src/patchers/f7f6.a
Normal file
35
src/patchers/f7f6.a
Normal file
|
@ -0,0 +1,35 @@
|
|||
;-------------------------------
|
||||
; #F7F6
|
||||
; protection check that counts groups of F7F6EFEEAB nibbles
|
||||
;
|
||||
; hidden behind a global flag (gIsF7F6)
|
||||
; because it relies on an expensive search
|
||||
;
|
||||
; tested on
|
||||
; I, Damiano (1985, Bantam)
|
||||
; Might and Magic (1986, New World Computing)
|
||||
; Sherlock Holmes in Another Bow (1985, Bantam)
|
||||
; Chipwits (1984, Brain Power)
|
||||
; The Complete Scarsdale Medical Diet (1985, Bantam)
|
||||
; Create With Garfield Deluxe Edition (1987, DLM)
|
||||
; Teddy Bearrels of Fun (1987, DLM)
|
||||
;-------------------------------
|
||||
F7F6
|
||||
lda gIsF7F6
|
||||
bne +
|
||||
|
||||
ldy #$08
|
||||
jsr SearchTrack
|
||||
!byte $A9,$40 ; LDA #$40
|
||||
!byte $85,$FA ; STA $FA
|
||||
!byte $A2,$60 ; LDX #$60
|
||||
!byte $BD,$8E ; LDA $..8E,X
|
||||
bcs + ; passport-test-suite/Might and Magic.woz [C=0] matches
|
||||
|
||||
jsr inx4
|
||||
jsr modify1
|
||||
!byte $18 ; CLC
|
||||
|
||||
lda #TRUE ; needed for Might & Magic
|
||||
sta gForceDiskVol
|
||||
+
|
|
@ -3,54 +3,107 @@
|
|||
; Activision's Timing Bit Detection:
|
||||
; FB+FF FF+FF FF+FD FF+FF+FF+FF+FF+FF+FF+FF+FF+ and
|
||||
; DE AA EB+FF+FF+FF+FF+FF+FF D5 AA
|
||||
; Magic key is #$FF, usually EOR'ed with #$AA but not always
|
||||
; As found on Aliens, Maniac Mansion + 22 other titles
|
||||
;
|
||||
; Module by Brian Troha
|
||||
; module by Brian Troha
|
||||
;
|
||||
; tested on
|
||||
; - Aliens
|
||||
; - Alpine Tram Ride
|
||||
; - Alter Ego (male and female releases)
|
||||
; - Bad Dudes
|
||||
; - Basic Fraction Concepts
|
||||
; - Championship Baseball
|
||||
; - Computer Assisted Problem Solving for Pre-Algebra
|
||||
; - Computer Laboratory for Calculus
|
||||
; - Countdown to Shutdown
|
||||
; - Fractions II
|
||||
; - GBA Championship Basketball
|
||||
; - GFL Championship Football
|
||||
; - Gamma Force
|
||||
; - Garry Kitchen's GameMaker
|
||||
; - Geometry - Simple Closed Curves
|
||||
; - Greeting Card Maker
|
||||
; - Hacker
|
||||
; - Hacker II
|
||||
; - Heavy Barrel
|
||||
; - How To Weigh An Elephant
|
||||
; - Lane Mastodon
|
||||
; - Let's Go Fishing
|
||||
; - Little Computer People
|
||||
; - Magic Spells 2.1
|
||||
; - Maniac Mansion
|
||||
; - Master of the Lamps
|
||||
; - Math Man
|
||||
; - Math Rabbit 1.0
|
||||
; - Math Rabbit 1.1
|
||||
; - Math Shop
|
||||
; - Math Tutor - Addition
|
||||
; - Math Tutor - Division
|
||||
; - Math Tutor - Fractions Part I
|
||||
; - Math Tutor - Multiplication
|
||||
; - Math Tutor - Subtraction
|
||||
; - MicroType - The Wonderful World of Paws
|
||||
; - Microzine 15
|
||||
; - Microzine 19
|
||||
; - Microzine 20
|
||||
; - Microzine 21
|
||||
; - Microzine 22
|
||||
; - Microzine 23
|
||||
; - Microzine 24
|
||||
; - Microzine 25
|
||||
; - Microzine 8
|
||||
; - Monkey Business
|
||||
; - Multiplication Advanced Level
|
||||
; - Multiplication and Division
|
||||
; - Number Farm
|
||||
; - Number Please
|
||||
; - Paper Models - The Christmas Kit
|
||||
; - Platoon
|
||||
; - Portal
|
||||
; - Rampage
|
||||
; - Reader Rabbit 1.3
|
||||
; - Scrambled Eggs
|
||||
; - Shanghai
|
||||
; - Sliding Block
|
||||
; - Speedy Delivery
|
||||
; - Spindizzy
|
||||
; - Star Trek - The Kobayashi Alternative
|
||||
; - Success with Reading
|
||||
; - Tales From History
|
||||
; - Tales of Fantasy
|
||||
; - Talking Text Writer
|
||||
; - The Crimson Crown 1985
|
||||
; - The Electric Crayon - ABCs
|
||||
; - The Electric Crayon - Fun on the Farm
|
||||
; - The Flying Carpet
|
||||
; - The Rocky Horror Show
|
||||
; - The Shot Heard Round The World
|
||||
; - Think Quick 1.2
|
||||
; - Top Fuel Eliminator
|
||||
; - Transylvania 1985
|
||||
; - Victory Road
|
||||
; - Wagons West
|
||||
; - Writer Rabbit 1.0
|
||||
; - Writer Rabbit 1.2
|
||||
; - Writer Rabbit 1.3
|
||||
; - Zork Quest
|
||||
; - Zork Quest II
|
||||
;-------------------------------
|
||||
!zone {
|
||||
ldy #$45
|
||||
ldy #$14
|
||||
jsr SearchTrack
|
||||
!byte $BD,$89,$C0
|
||||
!byte $A9,$56
|
||||
!byte $85,$FD
|
||||
!byte $85,WILDCARD
|
||||
!byte $A9,$08
|
||||
!byte $C6,$FC
|
||||
!byte $C6,WILDCARD
|
||||
!byte $D0,$04
|
||||
!byte $C6,$FD
|
||||
!byte $C6,WILDCARD
|
||||
!byte $F0,WILDCARD
|
||||
!byte $BC,$8C,$C0
|
||||
!byte $10,$FB
|
||||
!byte $C0,$FB
|
||||
!byte $D0,$ED
|
||||
!byte $F0,$00
|
||||
!byte $EA
|
||||
!byte $EA
|
||||
!byte $BC,$8C,$C0
|
||||
!byte $C0,$08
|
||||
!byte $2A
|
||||
!byte $B0,$0B
|
||||
!byte $BC,$8C,$C0
|
||||
!byte $10,$FB
|
||||
!byte $C0,$FF
|
||||
!byte $D0,$D8
|
||||
!byte $F0,$EB
|
||||
!byte $BC,$8C,$C0
|
||||
!byte $10,$FB
|
||||
!byte $84,$FC
|
||||
!byte $C9,$0A
|
||||
!byte $D0,$CB
|
||||
!byte $BD,$8C,$C0
|
||||
!byte $10,$FB
|
||||
!byte $38
|
||||
!byte $2A
|
||||
!byte $25,$FC
|
||||
bcs .exit
|
||||
sta gDisplayBytes
|
||||
pha
|
||||
lda #s_fbff
|
||||
bcs .exit ; passport-test-suite/Maniac Mansion.woz [C=0] matches
|
||||
jsr PrintByID
|
||||
pla
|
||||
!byte s_fbff
|
||||
ldy #$05
|
||||
jsr modify
|
||||
!byte $A9,$FF
|
||||
|
|
42
src/patchers/fbffencrypted.a
Normal file
42
src/patchers/fbffencrypted.a
Normal file
|
@ -0,0 +1,42 @@
|
|||
;-------------------------------
|
||||
; #FBFFENCRYPTED
|
||||
; an encrypted variant of Activision's Timing Bit Detection
|
||||
;
|
||||
; see 4am crack no. 622 The Electric Crayon: ABCs
|
||||
; for full explanation
|
||||
;
|
||||
; tested on many Polarware disks:
|
||||
; The Electric Crayon: ABCs (1986)
|
||||
; The Electric Crayon: Fun on the Farm (1986)
|
||||
; The Electric Crayon: This Land is Your Land (1986)
|
||||
; The Spy's Adventures in North America
|
||||
; The Spy's Adventures in Europe
|
||||
; The Crimson Crown
|
||||
; Oo-Topos
|
||||
;
|
||||
; and several non-Polarware disks:
|
||||
; Clue Master Detective (1989, Leisure Genius)
|
||||
; RISK (1988, Leisure Genius)
|
||||
; ESL Writer (1989, Scholastic)
|
||||
; Magic Spells v2.1 (1985, The Learning Company)
|
||||
;
|
||||
;-------------------------------
|
||||
!zone {
|
||||
; 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
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
jsr PrintByID
|
||||
!byte s_fbff
|
||||
jsr modify1
|
||||
!byte $A2 ; change encrypted BNE +4 to +5D so code exits with Death Counter > 0
|
||||
.exit
|
||||
}
|
45
src/patchers/fbffpascal.a
Normal file
45
src/patchers/fbffpascal.a
Normal file
|
@ -0,0 +1,45 @@
|
|||
;-------------------------------
|
||||
; #FBFFPASCAL
|
||||
; a variant of Activision's Timing Bit Detection
|
||||
; linked as an Apple Pascal module
|
||||
; (soft switches are hard-coded to slot 6)
|
||||
;
|
||||
; tested on
|
||||
; Geometry: Simple Closed Curves (1985)
|
||||
; Multiplication: Advanced Level (1985)
|
||||
; Basic Fraction Concepts (1985)
|
||||
; Widespread
|
||||
; Power Up! The Typewriter
|
||||
;-------------------------------
|
||||
!zone {
|
||||
; gIsPascal is TRUE here
|
||||
|
||||
ldy #$14
|
||||
jsr SearchTrack
|
||||
!byte $AD,$E9,$C0; LDA $C0E9
|
||||
!byte $A9,WILDCARD; LDA ...
|
||||
!byte $85,$03 ; STA $03
|
||||
!byte $A9,$08 ; LDA #$08
|
||||
!byte $C6,$02 ; DEC $02
|
||||
!byte $D0,$04 ; BNE +
|
||||
!byte $C6,$03 ; DEC $03
|
||||
!byte $F0,WILDCARD; BEQ ... (this branch offset will be used later to build the patch)
|
||||
!byte $AC,$EC,$C0; LDY $C0EC
|
||||
bcs .exit ; passport-test-suite/The Typewriter.woz [C=0] matches
|
||||
stx .a+1
|
||||
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
|
||||
jsr PrintByID
|
||||
!byte s_fbff
|
||||
lda gDisplayBytes
|
||||
jsr modify3
|
||||
; unconditional jump to success path
|
||||
!byte $18 ; CLC
|
||||
!byte $90 ; BCC +
|
||||
.branch !byte $FD ; set at runtime
|
||||
.exit
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user