[comp.sys.apple] Zip Chip screwups

mw22+@andrew.cmu.edu (Michael Alan Wertheim) (03/19/89)

I have an Apple //c with a Zip Chip and a 512K MultiRam CX card.

I run Appleworks and Kermit very often and have never had a problem with either.
 I have an Applesoft program (under ProDos and Basic.System) that has a
subroutine that tries to measure the time between consecutive keystrokes.  It
looks something like this:


10  Z = 0 : W = 1 : H = 128 : REM  Put constants in variables to increase speed.
20  C = -16368 : B = -16384 : REM  Put constants in variables to increase speed.
30  POKE C,Z : N = 0 : REM  Clear keyboard buffer.  Set counter to 0.
40  FOR I = Z TO W : REM  Goes from 0 to 1.
43      REM  If no key is pressed, increment the counter,
46      REM  and set "I" to back 0 to force NEXT to jump back to 40.
50      IF PEEK(B) < H THEN N = N + 1 : I = Z
60  NEXT : REM  When a key is pressed, loop will terminate.
70  GET A$ : REM  We have a keystroke, so get it.
80  PRINT "Number of loop iterations: ";N : PRINT "Key pressed: ";A$


The main idea behind the loop in lines 30 to 50 is that if no key is pressed
then the NEXT will cause a branch back to 30.  The variable "I" has no other
use.  The "time" is stored in the counter "N".

This routine works 99% of the time.  But every once in a while (usually after
being called a few hundred times), it causes the machine to crash into the
monitor.

Any ideas?



Michael Wertheim
Carnegie Mellon University
Pittsburgh, PA

Arpa: mw22@andrew.cmu.edu
Bitnet: mw22%andrew@cmccvb

===========================
"I wish I was in / Tijuana / eating barbe- / cued iguana."
-- Wall of Voodoo