[comp.sys.atari.8bit] Track-ball Handler...Anyone?

PARSONS@KSUVM.BITNET (Scott Parish) (04/13/88)

Does anyone have, know of, heard of, seen, or programmed a handler
for an Atari Track Ball?  You know, the ones at Kaybee Toy Store for
$12.  A mouse handler may work also, as it is the same principle.

If you or anyone you know has information leading to the arrest and
conviction of this or other handlers, please let me know.

Thank you,

Scott Parish

Bitnet:  Parsons@KSUVM

cfchiesa@bsu-cs.UUCP (Christopher Chiesa) (04/14/88)

Sorry to "clog up" the newsgroup, but I tried to send E-mail to Scott, who 
asked about a Trakball handler.  Copy of my intended message follows, Scott,
and now anyone else who wants it can have it too..   -- C.Chiesa.

In-Reply-To: your article <8804131218.AA13585@ucbvax.Berkeley.EDU>

> 
> Does anyone have, know of, heard of, seen, or programmed a handler
> for an Atari Track Ball?  You know, the ones at Kaybee Toy Store for
> $12.  A mouse handler may work also, as it is the same principle.
>

Scott, 

   Something of this nature was posted in this very newsgroup not long ago.
In fact, I think I still have it on file.  Let me do a quick shell-escape and 
see, and if you're lucky I'll tack it on the end of this file.

               *     *     *

* You're in luck.  I found it!  I haven't used it, 'cuz I don't have a trakball
(buy me one and I'll be happy to test it for you! :-)  ) but it supposedly 
does the job!

    Chris Chiesa
------

 
>From iuvax!pur-ee!j.cc.purdue.edu!i.cc.purdue.edu!purdue!gatech!bloom-beacon!husc6!linus!alliant!lackey Wed Mar 16 16:53:22 1988
Path: bsu-cs!iuvax!pur-ee!j.cc.purdue.edu!i.cc.purdue.edu!purdue!gatech!bloom-beacon!husc6!linus!alliant!lackey
From: lackey@Alliant.COM (Stan Lackey)
Newsgroups: comp.sys.atari.8bit
Subject: trak
Message-ID: <1442@alliant.Alliant.COM>
Date: 16 Mar 88 21:53:22 GMT
Reply-To: lackey@alliant.COM (Stan Lackey)
Organization: Alliant Computer Systems, Littleton, MA
Lines: 77

Routines for interfacing the trak-ball
    by Stan Lackey

;
; Code to track the trak-ball
;
OLDVAL = $CB
HORIZ  = $CD
VERT   = $CE
JOYST  = 54016

	ORG $0600

	TYA		; Save Y. The Atari saves A.
	PHA
	LDA JOYST	; Get new val
	TAY		; Save it in Y
	EOR OLDVAL	; Test for a change
	AND #2		; Clear all but horiz motion bit
	BEQ TSTVER	; If not, test for vertical motion
	TYA		; get new val
	AND #1		; Horiz change. Test direction.
	BNE RIGHT
	DEC HORIZ	; Left motion - decr coordinate.
	CLC
	BCC TSTVER
RIGHT:  INC HORIZ	; Right motion.

TSTVER:	TYA		; get new val
	EOR OLDVAL	; Test for change
	AND #8		; Clear all but vert motion bit
	BEQ EXIT	; If no change, exit
	TYA		; new val
	AND #4		; Vert change. Test direction.
	BEQ UP		;
	INC VERT	; Down - incr coordinate.
	CLC
	BCC EXIT
UP:	DEC VERT	; Up - decr coord.
EXIT:	STY OLDVAL	; Update old value
	PLA
	TAY		; Restore Y
	PLA		; Restore A
	RTI		;
	END

Now - the interrupt vector and some other stuff needs to be set up.
I just do it in Basic.

5	F=100			; Timer frequency - This value seems to work OK
10	OPEN #4,4,0,"D1:TRAK.OBJ"		; The binary of the above prog
20	GET #4,X:GET #4,X:GET #4,X:GET #4,X	; Strip the header
30	GET #4,X:GET #4,Y	; Length is in X (less than 256)
40	ADDR=6*256		; Start of page 6
50	FOR I=ADDR TO ADDR+X
60	  GET #4,X
70	  POKE I,X		; Load image
80	NEXT I
90	CLOSE #4		; Done
110	POKE 528,0:POKE 529,6	; Set up $600 into timer interr vector
130	POKE 53761,0		; Set volume to off - enables counter
140	POKE 53760,F		; Set up interrupt frequency
150	POKE 53769,255		; Turn on timers
160	POKE 16,193		; Enable timer1 interrupt

Now - a little program to test it

200	TRAP 200		; Restart if coord's go offscreen
210	GRAPHICS 8+16
220	H=205:V=206		; The coord's
230	POKE H,20:POKE V,20	; Initialize coord's
240	PLOT PEEK(H),PEEK(V)
250	DRAWTO PEEK(H),PEEK(V)
260	GOTO 250

Good luck.  Check for typo's (I don't think there are any, but who knows?)
-Stan



-- 
UUCP: <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!cfchiesa 
cfchiesa@bsu-cs.UUCP