The mouse is managed and drawn by GEM. (On a modern PC with SVGA or better, the video card itself can draw the mouse to save the OS from doing it, but old machines like an ST or Amiga draw it themselves.. so its not up to the emulated environment).
The mouse operates in several modes; the OS asks the IKBD (keyboard chip essentially) to report relative mose motion, or absolute mouse motion. Absolute is easy.. just report where it is. Sadly, this mode is almost never used by the OS or games. 99.9999% of the time, the games use the OS mouse stuff, and the OS always uses relative coords.
which is to say the emulation reports via the IKBD emulation "-1 x" or "+5 y" or the like. If we reported "(150,25)" it would be hella easy
So this means we need to keep in mind a virtual cursor.. where we thibk the mouse is. Then when you move the mouse (move the joystick) we report back a diff.. if you wre at x 10 and now are at x 12, we report x +2. ITs much more complex too.. you cannot report more than 127 or 128 each direction (its a signed 8bit quantity). Well and good and easy, right?
The trick is that the games and loaders and such may change resolution, or move the mous around on their own, etc. So TOS and GEM know where the mouse is.. but we do not. So you move it to 0,0 say (can't go left and up any more), and the game goes and moves it to 160,100 .. so its in the middle of s low res screen, but we don't think you can go left anymore. A pain.
So you hit calibrate.. it woudl ber easy if we could just ask the OS "where the hell do *you* think the mouse is?" but you can't.. it doesnt' expect to be emulated.
The mouse is also much more complex than the above; you can tell the ikbd to scale the response coords, or put a bounding box around it so it cannot travel anymore, etc etc. SDo games set all sorts of weird effects on the mouse, and things get all weird.
Theres also a number of bugs in the Castaway core for this.
You also cannot broadcast "move here move here move here move here" until it gets where you think "Here" is, for you overrun various bufferds or confuse the OS, since it already thinks its in the rght place. Painful
10.1 helps a lot.. it tries a few things to shove the mouse into the true bottom right.
But I'm plannign on trying some ugly fixes and reworking how Castaway's core deals with the mouse. ie: Not keep a virtual mouse at all.. just report back -1 when pushign left, without caring where the mouse is. Thats how a real ST does it. Castaway doesn't like that sort of thing, and it messes with the component emulation, but it might work a lot better.
So anyway, its more complicated than what you think
But fea not, I'm working on it
Castaway/GP is only a couple motnhs old after all, and come a long way; when presented with tough problems like the above ,and easy prolems like gammka correciton.. you know which one I'll take when limited time is available
jeff