*12345678901234567890123456789012345678901234567890123456789 #INCLUDE 'A:\VAR_DEF.ASM' * Ex_RPM_1.ASM * This example program calculates the rotation speed N_100 * in 100s rpm and converts it to BCD format. * The program assumes that the times T1 and T2 (in cycles), * as well as the number of overflows, NOF, * have been separately captured and can be found in memory. * To preserve sign information during computation, * the program needs to keep the numbers small. Hence it * works in 100s of cycles. The variables T1_100 and T2_100 * are calculated by dividing T1 and T2 by decimal 100. * The program calculates TOVFL, the time, in 100s of cycles, * taken by the overflows. This is done by repeated addition * of ($10000)/100, the duration between 2 overflows, and * decrementation of NOF. * The total time, T_100, in 100s of cycles, is calculated as * T_100=TOVFL+T2_100-T1_100 * Finally, the program calculates the hex rotation speed, * N_100_HEX, by dividing the 'magic' number * 2000000*60/100/100 by the total time, T_100. * The subroutine HEX_BCD is invoked to convert the rotation * speed from hex to BCD format, N_100_BCD. (Note that the * subroutine is used with #INCLUDE 'A:\HEX_BCD.ASM', hence * you have to have it in the root of your floppy directory). * NOTE: This is only an exercise. You have to enter the * values of T1, T2 and NOF yourself. Start with the examples: * Example 1: T2>T1 * Data: NOF=1, T1=$0006, T2=$110c * Results: T1_100=$0000, T2_100=$002b, TOVFL=$028b, * T_100=$02ba, N_100_HEX=$0011, N_100_BCD=17 * Example 2: T2