DECLARE SUB MouseShow () DECLARE SUB MouseStatus (lb AS INTEGER, rb AS INTEGER, x AS INTEGER, y AS INTEGER) DECLARE SUB MouseDriver (ax AS INTEGER, bx AS INTEGER, cx AS INTEGER, dx AS INTEGER) DECLARE FUNCTION MouseInit% () DIM SHARED asm AS STRING DIM tmp AS STRING DIM lb AS INTEGER, rb AS INTEGER, x AS INTEGER, y AS INTEGER ' Load assembly code into string asm = SPACE$(57) FOR i% = 1 TO 57 READ tmp MID$(asm, i%, 1) = CHR$(VAL("&H" + tmp)) NEXT i% ' See if mouse is available IF (NOT MouseInit%) THEN PRINT "Mouse not found" END END IF CLS MouseShow DO MouseStatus lb, rb, x, y LOCATE 1, 1: PRINT "(" + LTRIM$(STR$(x)) + "," + STR$(y) + ") - LB:"; lb, "RB:"; rb tmp = INKEY$ LOOP UNTIL LEN(tmp) END ' Assembly code 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 ' Send ax, bx, cx and dx registers to assembly code SUB MouseDriver (ax AS INTEGER, bx AS INTEGER, cx AS INTEGER, dx AS INTEGER) DEF SEG = VARSEG(asm) CALL ABSOLUTE(ax, bx, cx, dx, SADD(asm)) DEF SEG END SUB ' Hide mouse (set ax register to 2) SUB MouseHide DIM ax AS INTEGER ax = 2 MouseDriver ax, 0, 0, 0 END SUB ' Initialize mouse (set ax register to 0, test return value) FUNCTION MouseInit% DIM ax AS INTEGER ax = 0 MouseDriver ax, 0, 0, 0 MouseInit% = ax END FUNCTION ' Show mouse (set ax register to 1) SUB MouseShow DIM ax AS INTEGER ax = 1 MouseDriver ax, 0, 0, 0 END SUB ' Get mouse (set ax register to 3, test return values) SUB MouseStatus (lb AS INTEGER, rb AS INTEGER, x AS INTEGER, y AS INTEGER) DIM ax AS INTEGER, bx AS INTEGER, cx AS INTEGER, dx AS INTEGER ax = 3 MouseDriver ax, bx, cx, dx lb = ((bx AND 1) <> 0) rb = ((bx AND 2) <> 0) x = cx y = dx END SUB