sys7.1-doc-wip/Internal/Asm/CrsrDevEqu.a
2019-07-27 22:37:48 +08:00

152 lines
5.5 KiB
Plaintext

;__________________________________________________________________________________________________
;
; File: CrsrDevEqu.a
;
; Contains: equates for new mouse/trackball/etc. acceleration code
;
; Written by: Gary Rensberger
;
; Copyright: © 1992 by Apple Computer, Inc. All rights reserved.
;
; This file is used in these builds: ROM
;
; Change History (most recent first):
;
; <SM3> 12/01/92 HY Defined 2 fields in CsrsDevGlobals, CrsrDevFlags and MoreCrsrDevFlags.
; Defined bit 0 of crsrDevFlags to SkipDraw. This flag indicates to skip
; drawing the cursor on the first VBL, and to only perform calculations.
; This fixes a bug which caused the cursor to flicker when it was at
; the top of the screen. (see CrsrDev.a)
; <SM2> 8/26/92 kc Roll in Horror changes.
; <H3> 7/13/92 djw <GED>Added field in CrsrDataRec which indicates how often (in
; VBL ticks) the cursor should be blitted. Added two related
; vectors in CrsrDevGlobals.
; <H2> 7/13/92 djw <GED> Added equates for two new cursor vectors.
; <SM1> 5/2/92 kc Roll in Horror. Comments follow:
; <H2> 2/17/92 SWC Changed CrsrDevRec.resolution to a long since it's a fixed point
; number, and slightly rearranged the record so everything stays
; long word aligned.
; <H1> 2/12/92 GMR first checked in
; --------- button operations ---------
btnNoOp EQU 0 ; No action for this button
btnSingleClick EQU 1 ; Normal mouse button
btnDoubleClick EQU 2 ; Click-release-click when pressed
btnClickLock EQU 3 ; Click on press, release on next press
btnCharStroke EQU 4 ; A keystroke, data=(modifiers, char code)
btnAppleScript EQU 5 ; An AppleScript
btnCustom EQU 6 ; Custom behavior, data=proc pointer
; --------- Device Classes ---------
classAbsolute EQU 0 ; a flat-response device
classMouse EQU 1 ; mechanical or optical mouse
classTrackball EQU 2 ; trackball
classScratchPad EQU 3 ; (midas)
classJoystick EQU 4 ; (homeRow)
classRelTablet EQU 5 ; relative tablet
CrsrDevSegment RECORD 0
devUnits ds.l 1 ; highest device speed for this segment
slope ds.l 1 ; multiplier for device speed (crsr speed/dev speed)
intercept ds.l 1 ; offset to produce cursor speed
CrsrDevSegSize EQU *
ENDR
CrsrDevRec RECORD 0
nextCrsrDev ds.l 1 ; ptr to next record in linked list
whichCursor ds.l 1 ; ptr to data for target cursor
refCon ds.l 1 ; Application defined
unused ds.l 1 ; reserved for future
devID ds.l 1 ; device identifier (from ADB reg 1)
resolution ds.l 1 ; units/inch (orig. from ADB reg 1)
devClass ds.b 1 ; device class (from ADB reg 1)
cntButtons ds.b 1 ; # of buttons (from ADB reg 1)
ds.b 1 ; align
buttons ds.b 1 ; state of all buttons
buttonOp ds.b 8 ; action performed per button
buttonTicks ds.l 8 ; ticks when button last went up (for debounce)
buttonData ds.l 8 ; data for the button operation
doubleClickTime ds.l 1 ; device-specific double click speed
acceleration ds.l 1 ; current acceleration
accelPoints ds.l 1 ; Private: Ptr to array of (dev_delta, slope, intercept)
deltaX ds.l 1 ; Private: accumulated deltas
deltaY ds.l 1 ; Private: "
errorX ds.l 1 ; Private: accumulated errors
errorY ds.l 1 ; Private: "
denom ds.w 1 ; Private: fraction of the errors to use next time
spread ds.w 1 ; Private: Number of samples to spread errors over
newData ds.b 1 ; Private: set when deltas are new
ds.b 1 ; align
CrsrDevSize EQU *
ENDR
CrsrDataRec RECORD 0
nextCrsrData ds.l 1 ; next in global list
displayInfo ds.l 1 ; unused (FUTURE: display info for this cursor)
whereX ds.l 1 ; horizontal position
whereY ds.l 1 ; vertical position
where ds.w 2 ; the pixel position
isAbs ds.b 1 ; has been stuffed with absolute coords
buttonCount ds.b 1 ; number of buttons currently pressed
screenRes ds.l 1 ; Pixels per inch on the current display
screenDelay ds.w 1 ; minimum number of VBLs between subsequent crsr redraws <H3>
reserved ds.w 1 ; future expansion <H3>
scrnDelayPtr ds.l 1 ; ptr to table of screen delay values <H3>
alsoreserved ds.l 1 ; future expansion <H3>
scrnDelayTbl ds.l 8 ; default tbl for <refnum><screen delay> pairs <H3>
CrsrDataSize EQU *
ENDR
CrsrDevGlobals RECORD 0
firstCrsrDev ds.l 1 ; head of the cursor device list
firstCrsrData ds.l 1 ; points to THE ONLY cursor data record
SetCrsrDelayVector ds.l 1 ; points to routine that updates screen crsr delay <H3>
DrawCrsrVBLVector ds.l 1 ; vectors final drawing stage of CrsrDevHandleVBL <H3>
CrsrDevFlags ds.b 1 ; Flags <SM3>
MoreCrsrDevFlags ds.b 1 ; <SM3>
reserved ds.l 1 ; future expansion <H3>
CrsrGlobSize EQU *
ENDR
;
; CrsrDevFlags bit definitions
;
SkipDraw equ 0 ; Skip Draw flag forces the CrsrDevHandleVBL routine <SM3>
; to skip drawing the cursor. <SM3>
DrawCrsrVector EQU $1FB8 ; jump entry for DrawCursor <H2>
EraseCrsrVector EQU $1FBC ; jump entry for EraseCursor <H2>
;---------------------
; Misc. equates
;---------------------
;mouseAddr EQU 3 ; default address of mice
extDevHand EQU 04 ; handler 04 = extended type mouse device
;v EQU 0 ; point offsets
;h EQU 2
frameRate EQU 67 ; 67 frames/sec