THIS FILE CONTAINS SUPPORT FOR MOUSES - MS AND PC \ Beginning of mouse support VISA MOUSE.BLK NEED 4DROP 2 3 THRU : MOUSE ; \ Primitive mouse words 7 /28/88VARIABLE 'CURSOR? CREATE 'RTI $0CF C, CODE (MOUSE) (S DX CX BX AX -- DX CX BX AX ) BX AX MOV BX POP CX POP DX POP 51 INT DX PUSH CX PUSH BX PUSH AX BX MOV NEXT END-CODE CODE 3DROP BX POP BX POP BX POP NEXT END-CODE : M.RESET 51 @INT D0= IF 'RTI CSEG 51 !INT THEN 0 0 0 0 (MOUSE) 4DROP ; : SHOW.CURSOR 'CURSOR? @ NOT IF 0 0 0 1 (MOUSE) 4DROP 'CURSOR? ON THEN ; : HIDE.CURSOR 'CURSOR? @ IF 0 0 0 2 (MOUSE) 4DROP 'CURSOR? OFF THEN ; : M.STAT (S -- row col stat ) 0 0 0 3 (MOUSE) DROP ; : M.POSITION (S -- col row ) M.STAT DROP SWAP ; \ MORE MOUSE WORDS : LEFT? (S -- f ) M.STAT NIP NIP 1 AND ; : RIGHT? (S -- f ) M.STAT NIP NIP 2 AND ; : MIDDLE? (S -- f ) M.STAT NIP NIP 4 AND ; : ANY? ( -- f ) M.STAT NIP NIP 7 AND ; : H.LIMIT (S right left -- ) \ set limits of travel hor 0 7 (MOUSE) 4DROP ; : V.LIMIT (S bottom top -- ) \ set vertical limits 0 8 (MOUSE) 4DROP ; : M.SETUP M.RESET 639 0 H.LIMIT 199 0 V.LIMIT SHOW.CURSOR ; : M.AT (S col row -- ) 0 4 (MOUSE) 4DROP ; : M.MOTION (S -- col row ) 0 0 0 11 (MOUSE) 2DROP ; : TEXT/CURSOR ( -- ) HIDE.CURSOR M.RESET $7F00 $0FFFF 0 10 (MOUSE) 4DROP SHOW.CURSOR ; : ?CURSOR ( f -- ) IF SHOW.CURSOR THEN ; \ Beginning of mouse support Name this file required words: 4DROP load the needed blocks MOUSE -- a dummy word for view \ Primitive mouse words 'CURSOR? variable to store the current state cursor display (MOUSE) (S DX CX BX AX -- DX CX BX AX ) the primitive mouse interface 3DROP ( a b c -- ) the obvious M.RESET ( -- ) reset the mouse driver SHOW.CURSOR show the mouse cursor HIDE.CURSOR hide the mouse cursor M.STAT (S -- row col stat ) return mouse status M.POSITION (S -- col row ) return just position LEFT? (S -- f ) non-zero flag if left button pressed RIGHT? (S -- f ) non-zero flag if right button pressed MIDDLE? (S -- f ) non-zero flag if middle button pressed ANY? ( -- f ) non-zero flag if any button pressed \ MORE MOUSE WORDS H.LIMIT (S right left -- ) set limits of horizontal travel V.LIMIT (S bottom top -- ) set vertical limits M.SETUP reset mouse, set default travel limits, and show cursor M.AT (S col row -- ) force mouse location M.MOTION (S -- col row ) return relative mouse motion TEXT/CURSOR ( -- ) define a text mode cursor and show it ?CURSOR ( f -- ) show cursor if true