DECLARE SUB Lightup (sm!, X%, y%)
DECLARE SUB Pause ()
DECLARE SUB MouseStatus (lb%, rb%, xMouse%, yMouse%)
DECLARE SUB MouseRange (x1%, y1%, x2%, y2%)
DECLARE SUB MousePut (X%, y%)
DECLARE SUB MouseHide ()
DECLARE SUB MouseDriver (ax%, bx%, cx%, dx%)
DECLARE SUB MouseShow ()
DECLARE FUNCTION MouseInit% ()
DECLARE FUNCTION SetOnExit%(byval ProcedurePointer???)
SHARED Mouse$
x=SetOnExit%(Bye1)
Mouse$ = SPACE$(57)
FOR I% = 1 TO 57
READ A$
H$ = CHR$(VAL("&H" + A$))
MID$(Mouse$, I%, 1) = H$
NEXT I%
DATA 55,89,E5,8B,5E,0C,8B,07,50,8B,5E,0A,8B,07,50,8B
DATA 5E,08,8B,0F,8B,5E,06,8B,17,5B,58,1E,07,CD,33,53
DATA 8B,5E,0C,89,07,58,8B,5E,0A,89,07,8B,5E,08,89,0F
DATA 8B,5E,06,89,17,5D,CA,08,00
CLS
ms% = MouseInit%
IF NOT ms% THEN
PRINT "Mouse not found"
END
END IF
SCREEN 0
MouseShow
1 MouseStatus lb%, rb%, y%, X%
GOTO 1

SUB Lightup (sm, X%, y%)
AAA = 176
IF sm = 0 GOTO ZERO
IF sm = 12 GOTO TW
TW:
LOCATE X% / 15, y% / 8: PRINT CHR$(AAA)
AAA = AAA + 1
IF AAA > 179 THEN A = 219
IF AAA = 220 GOTO 2222
GOTO TW
ZERO:
LOCATE X% / 7.5, y% / 7.8: PRINT CHR$(AAA)
AAA = AAA + 1
IF AAA > 179 THEN A = 219
IF AAA = 220 GOTO 2222
GOTO ZERO
2222 END SUB

SUB MouseDriver (ax%, bx%, cx%, dx%)
DEF SEG = VARSEG(Mouse$)
Mouse% = -32546
'CALL ABSOLUTE m (ax%, bx%, cx%, dx%, Mouse%
END SUB

SUB MouseHide
ax% = 2
MouseDriver ax%, 0, 0, 0
END SUB

FUNCTION MouseInit%
ax% = 0
MouseDriver ax%, 0, 0, 0
MouseInit% = ax%
END FUNCTION

SUB MousePut (X%, y%)
ax% = 4
cx% = X%
dx% = y%
MouseDriver ax%, 0, cx%, dx%
END SUB

SUB MouseRange (x1%, y1%, x2%, y2%)
ax% = 7
cx% = x1%
dx% = x2%
MouseDriver ax%, 0, cx%, dx%
ax% = 8
cx% = y1%
dx% = y2%
MouseDriver ax%, 0, cx%, dx%
END SUB

SUB MouseShow
ax% = 1
MouseDriver ax%, 0, 0, 0
END SUB

SUB MouseStatus (lb%, rb%, xMouse%, yMouse%)
ax% = 3
MouseDriver ax%, bx%, cx%, dx%
lb% = ((bx% AND 1) <> 0)
rb% = ((bx% AND 2) <> 0)
xMouse% = cx%
yMouse% = dx%
END SUB

SUB Pause
'This sub used for demo, not needed for mouse calls
PRINT "Press any key to continue..."
G$ = INPUT$(1)
PRINT
END SUB

Sub Bye
Print "Bye!"
End Sub