Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!ihwpt!knudsen From: knudsen@ihwpt.ATT.COM (mike knudsen) Newsgroups: comp.sys.m6809 Subject: Re: Hires Joystk I/F Message-ID: <1982@ihwpt.ATT.COM> Date: Thu, 3-Sep-87 13:19:21 EDT Article-I.D.: ihwpt.1982 Posted: Thu Sep 3 13:19:21 1987 Date-Received: Sat, 5-Sep-87 11:17:13 EDT References: <595@potpourri.UUCP> Distribution: na Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 49 Keywords: COCO3 JOYSTICK Summary: how it works; jitter; eats CPU; Steve Bjork > Can someone explain how the RadioShack hires joystick I/f works? > A friend of mine told me that it plugs into the cassette and right > joystick port, but he does not know it can allow a resolution of > 640 for the joystick. Does the joystick scan routine in rom sense > that the hires I/F is pluged in? The interface plugs in as your friend says and can indeed provide 640 (or even better) resolution, with a caveat mentioned later. It contains an analog integrator (op amp with capacitor feedback) and a couple of analog comparators whose outputs feed the Coco's joystick ports. The Coco ROM knows nothing of this gadget; it's still the 1980 vintage code. Your program must explicitly call new code to read the interface (supplied with Level 2 OS9, Colormax, etc. See August '86 Rainbow for the code.) To read, the code first sends a pulse out the Cassette port that resets the analog integrator. Then the code starts counting in a timing loop while monitoring the original joystick X and Y ports. Inside the little black box, the integrator generates a rising voltage as a linear function of time. When it equals your joystick's X or Y voltage, the corresponding comparator in the box switches from 0 to 5 volts. The internal (original) comparator senses that, the code detects that and stores its present count value in a memory slot for X or Y. Once both X and Y are detected, the code breaks out of the loop and returns the raw values, which more software converts to whatever numeric ranges (eg, 0-649, 0-191) are desired. Resolution is limited only by how fast the timing loop can count. You can run separate loops for X and Y. However, the whole process is a little jittery; if you write a BASIC09 program to read the hi-res and push a graphics cursor around, you'll see it constantly wiggling in both X and Y. I've written some very simple hysteresis (backlash) code to clean that up; will post on request. The little black box and its software were designed by Steve Bjork, whose Delphi handle of "6809er" would seem a little pompous, except that he probably deserves it as much as anyone else. Unlike the CocoMax A/D converter, the HiRes box perpetuates the Coco tradition of burning up CPU cycles (software) to handle I/O interfaces in general. I don't notice any slowdown in my OS9 music score editor, but it could cut game performance a lot. Of course games can use the orignal interface (which BTW you can't use on that side with the HiRes box plugged in). -- Mike J Knudsen ...ihnp4!ihwpt!knudsen Bell Labs(AT&T) Delphi: RAGTIMER CIS: "Just say NO to MS-DOS!"