jc@atcmp.nl (jc van Winkel) (03/03/90)
Below you can find the source to two programs (and it's initialization program) to convert cassette deck counters, tape counters, vcr counters to a real time and back. initialization: You supply it 4 numbers in the variables T1 T2 C1 and C2. These are the 'coordinates' of two measurement points on the tape. T1 is the time of the tape counted from the start somewhere in the middle of the tape, C1 is the accompanying counter value of the deck. T2 and C2 are similar, but further in time, preferably near the end of the tape. times are in minutes.seconds format. Dont forget to reset the tape counter at the beginning of the tape. Usage: T2C: push the time on the stack, run T2C and the display will show you the place on the tape that would appear on the deck's counter after T minutes C2T: push the counter value on the stack, run C2T and the HP28 will calculate the time elapsed since counter value 000. Examples: My cassette deck displays number 500 after 25 minutes of playing a C90 cassette and 730 after 45 minutes. store 500 in C1, 25 in T1, 730 in C2 and 45 in T2 and run TINI. (two new variables appear: D and DLT) Now suppose my counter says 450. How much time is left on the tape? push 450, run C2T, result is 21.21, meaning 450 on the counter is reached after 21 minutes, 21 seconds. So (on the same C90 tape) 23 minutes and 39 seconds are left. The other way around: Suppose I need at least 5 more minutes on the tape. What can the maximum counter value be? push 40 (45 minutes - 5), run T2C, and the HP says: 677.89 so at count 677 there are some 5 minutes left on the tape. The code: (sorry, I'm new in this newsgroup, so I don't have a checksum program. Could someone send me it, along with some other info and tricks?) TINI: (PI means the pi symbol on the keyboard, shift period) << << HMS-> 60 * >> -> RT << PI ->NUM INV DUP T1 RT EVAL * SWAP T2 RT EVAL * { 2 1 } ->ARRY C1 C1 SQ C1 - 2 / C2 C2 SQ C2 - 2 / { 2 2 } ->ARRY / ARRY-> DROP 'DLT' STO 'D' STO >> >> T2C: (SQRT means the square root symbol on the keyboard, shift -) << HMS-> 60 * -> T '(DLT/2-D+SQRT(SQ(D-DLT/2)+2/PI*DLT*T))/DLT' ->NUM >> C2T: << DUP 1 - DLT * 2 / D + * PI * ->NUM 60 / ->HMS >>