68kMLA Classic Interface

This is a version of the 68kMLA forums for viewing on your favorite old mac. Visitors on modern platforms may prefer the main site.

Click here to select a new forum.
Mouse in Applesoft BASIC
Posted by: MultiFinder on 2007-08-07 09:30:11
Does anybody know how to access mouse movements (and maybe even the button! That would be wondrous!) in Applesoft BASIC? I know how to do the joystick, but I'm unsure about how to get the mouse. This would really make some little apps more fun and interesting.

Posted by: david__schmidt on 2007-08-07 11:26:10
Here's details on the machine language interfaces:

http://home.swbell.net/rubywand/R034MOUSEPRG.TXT

Convert the hex to decimals; peek, poke, and call - and you're good to go in BASIC. ;-)

Posted by: MultiFinder on 2007-08-07 18:55:36
Hear that sound? That was my brain asploding 😛

Is there an easier way? I know that to do things with the joystick in BASIC you use "pdl", but isn't there something like that for the mouse?

Posted by: Kallikak on 2007-08-07 19:11:29
Depends what slot you have it in. Say you have it in slot 4, then try using IN #4 and then loop over INPUT X,Y,B and PRINT X, Y, B or something like that and see if you get the desired values.

Edit: I just had a try with an emulator, but couldn't get it to work. Might have more luck remembering the details on my real machine at home (with a couple of books to refer to!)

Posted by: luddite on 2007-08-07 22:21:29
Try searching comp.sys.apple2 and comp.sys.apple2.programmer on Google Groups... there's a bit of useful info on there.

Posted by: david__schmidt on 2007-08-08 08:12:46
Hear that sound? That was my brain asploding 😛
http://your.head.asplode.net/

Is there an easier way? I know that to do things with the joystick in BASIC you use "pdl", but isn't there something like that for the mouse?
No, not built in. The paddle interface was there since day 1 of the Apple II, but the mouse card came much, much later. Long after BASIC updates had ceased. It wouldn't surprise me if there are extensions out there, but I'm not aware of any.

Posted by: MultiFinder on 2007-08-08 10:11:48
Luddite: Thanks, I'll have to poke around in there a bit 🙂

Dave: Alrightey, thanks for confirming what I had thought but not hoped for 🙁 I'll keep looking around though.

1