Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mouse support #15

Open
inexorabletash opened this issue Jan 13, 2017 · 0 comments
Open

Add mouse support #15

inexorabletash opened this issue Jan 13, 2017 · 0 comments

Comments

@inexorabletash
Copy link
Owner

ftp://ftp.apple.asimov.net/pub/apple_II/documentation/hardware/io/AppleMouse%20II%20User's%20Manual.pdf

tl;dr:

5 S = 4 : REM Slot - should scan for it 
10 PRINT CHR$(4)"PR#"S :  PRINT CHR$(1) : PRINT CHR$(4)"PR#0" : REM Initialize mouse 
20 PRINT CHR$(4)"IN#"S : INPUT "";X,Y,B : PRINT CHR$(4)"IN#0" : REM Read mouse 
30 PRINT X,Y,B : REM x,y coords, button state (4=up, 2=pressed, 1=down, 3=released) 
40 GOTO 20 

... where B will be negative if a key is pressed, until strobe is cleared (POKE 49168,0)

And to scan for the mouse - using Pascal 1.1 protocol:

10 FOR S = 1 TO 7 : SO = S * 256 
20 IF PEEK(49157 + SO) = 56 AND PEEK(49159 + SO) = 24 AND PEEK(49163 + SO) = 1 AND PEEK(49164 + SO) = 32 THEN PRINT "Mouse is in slot ";S : END 
30 NEXT 

Or alternately just $Cn0C == $20 && $CnFB == $D6:

10 FOR S = 1 TO 7 : SO = S * 256 
20 IF PEEK(49164+ SO) = 32 AND PEEK(49403 + SO) = 214 THEN PRINT "Mouse is in slot ";S : END 
30 NEXT : PRINT "No mouse :("
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant