joycal

calibrate the horizontal joystick input against the vertical sync period

usage: joycal

joycal counts the number of iterations of a timing loop that occur between two successive rising edges of the video vertical sync pulse, and prints the resulting count on the standard output. The timing loop is identical to the one used in joystk, which measures the time taken to charge a capacitor through the resistive load on the game port's horizontal input. Thus the output of these two programs together gives the experimentor a precise relation between the known video refresh period (usually 72s-1) and the unknown game port charging period. A variable resistance that shifts the charging period between an interval less than the refresh period and an interval greater than the refresh period is suitable for use as an input to the fastshft program, since fastshft tests the charging period only in relation to the video refresh period.

An output of zero indicates that the sixteen-bit counter has overflowed before the end of the video sync period was reached. This problem will be encountered with processors operating at clock speeds in excess of 160MHz or with video cards operating at low frame rates. The overflow problem can be resolved by patching joycal so that it uses a 32-bit counter, or by inserting delay code in the body of the timing loop. In either case, joystk must be patched identically in order to maintain consistency of measures.