[comp.sys.mac.programmer] How can I move the cursor with THINKC??

nugteren@pttrnl.nl (10/22/90)

I am writing a trackball driver that would allow connection of an MSDOS Mouse
(actually optical trackball) to a Mac II. One of the problems I have to solve
is how to change to cursor position on the screen from a software level.
I have found the addresses in RAM that contain the current cursor position
(0x830). But now I would like to know which routine to call to refresh the
screen. Does anyone know where this ROM routine starts??


I would appreciate any tips you might have!!

Thanks in advance,

Nils

mxmora@unix.SRI.COM (Matt Mora) (10/25/90)

In article <55432.2723256d@pttrnl.nl> nugteren@pttrnl.nl writes:
>I am writing a trackball driver that would allow connection of an MSDOS Mouse
>(actually optical trackball) to a Mac II. One of the problems I have to solve
>is how to change to cursor position on the screen from a software level.
>I have found the addresses in RAM that contain the current cursor position
>(0x830). But now I would like to know which routine to call to refresh the
>screen. Does anyone know where this ROM routine starts??
>
>
>I would appreciate any tips you might have!!
>
>Thanks in advance,
>
>Nils


From UMPG page 10:


This seems to come up every few months. I've posted bad Pascal code for this SetMouse routine in the past. Here's a Think C version:


/* ------------------------- SetMouse ------------------------- */
/* some dangerous low-memory-global equates */
extern	Point	MTemp		:	0x828;
extern	Point	RawMouse	:	0x82c;
extern	Point	Mouse		:	0x830;
extern	Byte	MBState		:	0x172;
extern	int	CrsrNewCouple	:	0x8ce;  /* both New & Couple */
extern	Byte	CrsrNew		:	0x8ce;
extern	Byte	CrsrCouple	:	0x8cf;

#define 	Couple		0xff;	/* value for CrsrCouple */
#define 	Uncouple	0x00;	/* value for CrsrCouple */

void	SetMouse(where)
Point	where;
{
long	finalTicks;
	LocalToGlobal(&where);   /* Get ready to store mouse position */
	RawMouse = where;        /* into RawMouse */
	MTemp = where;           /* and MTemp */
	CrsrNewCouple = 0xffff;  /* Hit CrsrNew & CrsrCouple */
	Delay(5, &finalTicks);   /* let the cursor catch up */
}	/* SetMouse */


From: cbm@well.UUCP (Chris Muir)


-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

gurgle@well.sf.ca.us (Pete Gontier) (10/27/90)

In article <55432.2723256d@pttrnl.nl> nugteren@pttrnl.nl writes:
>I am writing a trackball driver that would allow connection of an MSDOS Mouse
>(actually optical trackball) to a Mac II. One of the problems I have to solve
>is how to change to cursor position on the screen from a software level.
>


This is what I have used in the past (yesterday, in fact).

Matt's code is probably just as functional, but I guessed that if you're
doing a hardware interface, you don't want an explicit call to Delay
for 5 ticks (and might not have access to it). I believe that the line
which puts a value into the variable LongMouse does basically what the
delay for 5 ticks does.

 --- cut here ---

typedef enum { eCoupled = -1, eUncoupled = 0 } tMouseCouple;

extern Point MTemp                : 0x0828;
extern Point Mouse                : 0x0830;
extern long LongMouse             : 0x0830;
extern tMouseCouple CrsrCouple    : 0x08CF;
extern Point RawMouse             : 0x082C;
extern Boolean CrsrNew            : 0x08CE;
extern Boolean CrsrBusy           : 0x08CD;

/*******************************************/

void SetMouse ( Point p ) {
  long pinnedPt = PinRect ( & CrsrPin, p );
  CrsrBusy = true;            /* I'm fucking the mouse; hands off */
  CrsrCouple = eUncoupled;    /* switch off coupling */
  MTemp = p;                  /* hack interrupt-level mouse coords */
  RawMouse = p;               /* hack "unjerked" mouse coords */
  LongMouse = pinnedPt;       /* hack "high-level" mouse coords */
  CrsrNew = true;             /* hey, mouse VBL, DO IT */
  CrsrCouple = eCoupled;      /* switch on coupling */
  CrsrBusy = false;           /* OK, all done */
}
-- 
 Pete Gontier, gurgle@well.sf.ca.us
 Software Imagineer, Kiwi Software, Inc.