Apple II WAIT Delays (A built-in Apple II 6502 Monitor Subroutine at $FCA8) WAIT delays for a specific amount of time, then returns to the program that called it. The amount of delay is spaecified by the contents of the accumulator. The delay is 1/2(26+27A+5A^2) microseconds, where A is the contents of the accumulator. WAIT returns with the accumulator zeroed and the X and Y registers undusturbed. | A Delay | A Delay | A Delay | A Delay | | --- ------- | --- ------- | --- ------- | --- ------- | | 0 13 | 64 11117 | 128 42701 | 192 94765 | | 1 29 | 65 11453 | 129 43357 | 193 95741 | | 2 50 | 66 11794 | 130 44018 | 194 96722 | | 3 76 | 67 12140 | 131 44684 | 195 97708 | | 4 107 | 68 12491 | 132 45355 | 196 98699 | | 5 143 | 69 12847 | 133 46031 | 197 99695 | | 6 184 | 70 13208 | 134 46712 | 198 100696 | | 7 230 | 71 13574 | 135 47398 | 199 101702 | | 8 281 | 72 13945 | 136 48089 | 200 102713 | | 9 337 | 73 14321 | 137 48785 | 201 103729 | | 10 398 | 74 14702 | 138 49486 | 202 104750 | | 11 464 | 75 15088 | 139 50192 | 203 105776 | | 12 535 | 76 15479 | 140 50903 | 204 106807 | | 13 611 | 77 15875 | 141 51619 | 205 107843 | | 14 692 | 78 16276 | 142 52340 | 206 108884 | | 15 778 | 79 16682 | 143 53066 | 207 109930 | | 16 869 | 80 17093 | 144 53797 | 208 110981 | | 17 965 | 81 17509 | 145 54533 | 209 112037 | | 18 1066 | 82 17930 | 146 55274 | 210 113098 | | 19 1172 | 83 18356 | 147 56020 | 211 114164 | | 20 1283 | 84 18787 | 148 56771 | 212 115235 | | 21 1399 | 85 19223 | 149 57527 | 213 116311 | | 22 1520 | 86 19664 | 150 58288 | 214 117392 | | 23 1646 | 87 20110 | 151 59054 | 215 118478 | | 24 1777 | 88 20561 | 152 59825 | 216 119569 | | 25 1913 | 89 21017 | 153 60601 | 217 120665 | | 26 2054 | 90 21478 | 154 61382 | 218 121766 | | 27 2200 | 91 21944 | 155 62168 | 219 122872 | | 28 2351 | 92 22415 | 156 62959 | 220 123983 | | 29 2507 | 93 22891 | 157 63755 | 221 125099 | | 30 2668 | 94 23372 | 158 64556 | 222 126220 | | 31 2834 | 95 23858 | 159 65362 | 223 127346 | | 32 3005 | 96 24349 | 160 66173 | 224 128477 | | 33 3181 | 97 24845 | 161 66989 | 225 129613 | | 34 3362 | 98 25346 | 162 67810 | 226 130754 | | 35 3548 | 99 25852 | 163 68636 | 227 131900 | | 36 3739 | 100 26363 | 164 69467 | 228 133051 | | 37 3935 | 101 26879 | 165 70303 | 229 134207 | | 38 4136 | 102 27400 | 166 71144 | 230 135368 | | 39 4342 | 103 27926 | 167 71990 | 231 136534 | | 40 4553 | 104 28457 | 168 72841 | 232 137705 | | 41 4769 | 105 28993 | 169 73697 | 233 138881 | | 42 4990 | 106 29534 | 170 74558 | 234 140062 | | 43 5216 | 107 30080 | 171 75424 | 235 141248 | | 44 5447 | 108 30631 | 172 76295 | 236 142439 | | 45 5683 | 109 31187 | 173 77171 | 237 143635 | | 46 5924 | 110 31748 | 174 78052 | 238 144836 | | 47 6170 | 111 32314 | 175 78938 | 239 146042 | | 48 6421 | 112 32885 | 176 79829 | 240 147253 | | 49 6677 | 113 33461 | 177 80725 | 241 148469 | | 50 6938 | 114 34042 | 178 81626 | 242 149690 | | 51 7204 | 115 34628 | 179 82532 | 243 150916 | | 52 7475 | 116 35219 | 180 83443 | 244 152147 | | 53 7751 | 117 35815 | 181 84359 | 245 153383 | | 54 8032 | 118 36416 | 182 85280 | 246 154624 | | 55 8318 | 119 37022 | 183 86206 | 247 155870 | | 56 8609 | 120 37633 | 184 87137 | 248 157121 | | 57 8905 | 121 38249 | 185 88073 | 249 158377 | | 58 9206 | 122 38870 | 186 89014 | 250 159638 | | 59 9512 | 123 39496 | 187 89960 | 251 160904 | | 60 9823 | 124 40127 | 188 90911 | 252 162175 | | 61 10139 | 125 40763 | 189 91867 | 253 163451 | | 62 10460 | 126 41404 | 190 92828 | 254 164732 | | 63 10786 | 127 42050 | 191 93794 | 255 166018 | _______________ The actual timings seem to work out to a bit shorter that those shown by the contributor. Here is the delay routine I typed into memory to do the checking ... 1000- A2 00 1002- A9 FF 1004- 20 A8 FC 1007- E8 1008- D0 F8 100A- 60 The basic delay routine sets the Accumulator to 255 (A9 FF) and calls the built-in delay (20 A8 FC) at $FCA8. To get a good sample, the basic delay routine is done 256 times by setting the X reg to 00 (A2 00) and incrementing it (E8) after each call to $FCA8. So long as X is not 00, the routine hops back to $1002 and executes another dealy via the test for 00 (D0 F8). When X goes from $FF to $00 the Return (60) at $100A is executed. The routine at $1000 is called from a short BASIC program which BEEPs when the routine finishes and does its Return ... 10 CALL 4096: PRINT CHR$(7) 20 END For the values shown, the delay from entering RUN until the BEEP is 41 seconds. 41/256 gives 0.160156 seconds or 160156 uSec-- a bit shorter delay than the 166018 uSec shown in the chart. For Accum= 127 (A9 7F) the total delay is 10.5 seconds. 10.5/256 gives 0.041015 seconds or 41015 uSec-- again, a little shorter than the 42050 uSec shown in the chart. Probably, the explanation for the differences is that the typical "1MHz Apple II" runs a tad faster than 1MHz-- somewhere between 1.02MHz and 1.03MHz. Even so, the chart is a good, low-error guide to delay values you can expect using the call to $FCA8. Rubywand