A Jiffy Clock for the Apple Iic, II+, and Iie with a Mouse
Total Page:16
File Type:pdf, Size:1020Kb
BehaviorResearch Methods, Instruments, & Computers 1988, 20 (3). 362 NOTES A jiffy clock for the Apple lIe, pa~r of numbe~s, but a space separates each subsequent 11+, and lIe with a mouse pan. The remainder of the program can be entered in the same manner. To return to BASIC when finished, type CHARLES MERBITZ, JEFFREY GRIP <Control-C> <RETURN> . and HANS PETER MARQUI ' To savetheclockto diskwithOOS3.3, BSAVEJIFFY, Rehabilitation Institute ofChicago, Chicago, Illinois A$2BD, L223 shouldbe entered. With ProOOS, BSAVE JIFFY, A$2B5, L245 will save the clock to disk. The A "jiffy clock" is presented for the Apple IIc or other clock may be installed either before a BASIC program ~p~le II having Apple's mouse card. The clock allows runs or withina BASIC program. The commandBLOAD timing of events to tenths of a second,and is read from JIFFY retrieves the clock from the disk. BASIC. A convenient elapsed timer function is provided as well. The memorylocationsused to control the clock are the same in both versions. POKE is used to set the time base to seconds (POKE786,60) or tenths of seconds (POKE Unlike with some microcomputers(e.g., Radio Shack 786,6): Because the time is stored in 2 bytes, at 65,536 TRS-80; Balsam, Deich, O'Connor, & Scopatz, 1986) (64K) increments (either seconds or tenths of seconds), that provide a current time function, timing events with the clock reaches its maximum value and "rolls over" the earlier Apple II, 11+, lIe, and IIc usually requires the to zero before continuing to increment. The possibility addition of a hardware clock (Flowers, 1982). A clock that a session will last long enough to include a rollover has been built into the new Apple IIgs; with the Apple mustbe consideredwhenprogramming. Following a roll lie, a 6O-Hz interrupt is readily availableand can be used over, a negativenumberwillresult whenthe elapsedtime to run a simple "jiffy clock." Since the jiffy clock is calculated. (Expansionto 4 bytesto increase the dura originates in Apple's mouse firmware, an Apple 11+ or tion before a rollover is possible, but does not seem use lie with a mouse card has access to the jiffy clock. fulin viewofthe interruption-during-diskaccess problem.) The routines described here create a jiffy clock that Execution of a CALL 768 locates the slot of the mouse keeps time to tenths of a sec and is suitable for general card, and a CALL 771 begins the clock. The clock can use. They require Applesoft floating-point BASIC. Be be disabled with a CALL 777. cause the clock pauses during disk access, its accuracy From within a BASICprogram, executionof the com i~ c~mpromised when disk operations take place during mand& A in any line readsthe clock intothe variable A. tumng. Any legal floating-point variable can be used, but not a ProDOS was designed to handle interrupts; DOS 3.3 string, integer, or array variable. A CALL 774 clears the was not. Therefore, different versions of the jiffy clock clock to zero but does not stop it. The next & A will then program are provided. For the DOS 3.3 version, it is give the time since the most recent CALL 774. This fea strongly suggested that the clock be turned off with a ture is convenient when the clock is used repeatedly as CALL 777before issuing any OOScommands, sinceboth an elapsed timer. Otherwise, the programmer must store DOS and the clock use location $45 (decimal 69). This the firsttimevaluewhentimingbegins and subtractit from precaution is not needed in the ProDOS environment, or ~e secondtimevaluewhentimingendsto findthe elapsed with an enhanced lie or lie. time. To type in the program listing, one must boot the pre Availability. Thejiffy clock is availableon disk to per ferred DOS and enter the monitor with a CALL-151 sons who send $4 or a labeled, initialized 5.25-in. disk < RETURN> . Each line of the program may be entered ette with a self-addressed, stamped mailer to the senior as follows. The four-digit hexadecimal address (e.g., author. Please specify which DOS is preferred, or send 02BD in DOS 3.3, or 02B5 in ProDOS), a colon, and a double-sided, double-notched diskette for bothversions. the address contents are entered, and <RETURN> is pressed. No space occurs between the colon and the first REFERENCES BALSAM, P., DEICH, J., O'CONNOR, K., '" ScOPATZ, R. (1986). Micro computers and conditioning research. BehaviorResearch Methods, Instruments, & Computers, 17, 537-545. This work was supported by National Institute of Handicapped FLOWERS, J. H. (1982). Some simple Apple II software for the collec Research Grant 0008300079. The authors also wish to recognize the tion and analysis of observational data. Behavior Research Methods constructive suggestions of the reviewers. Address correspondence to & Instrumentation, 14, 241-249. Charles Merbitz, Rehabilitation Institute of Chicago. 448 E. Ontario, 6th Roor, Chicago, IL 60611. (Revision accepted for publication November 24, 1987.) Copyright 1988 Psychonomic Society, Inc. 362.