Mouse #7: Mouse Clamping

Apple II Technical Notes Developer Technical Support

Revised by: Matt Deatherage November 1988
Written by: Rilla Reynolds October 1986

This Technical Note describes the different methods available for obtaining mouse clamping values on different Apple II family machines.


AppleMouse Card

The AppleMouse card delivers clamping values on request. There is no specific mouse routine to obtain the clamping values, but an internal routine may be used by the mouse card to return them. The values are returned as minimum and maximum values of X and Y clamps, both low and high bytes.

Note: The following code is the only supported use of the $Cn1A offset into the mouse card firmware, and this entry point is not available in any other mouse firmware implementation.

GetClamp   LDA    #$4E
           STA    $478            ;Needed by Mouse Card firmware
           LDA    #$00
           STA    $4F8            ;Needed by Mouse Card firmware
           STA    Tmp             ;Zero-page word for indirect addressing
           LDA    #CN             ;$C<slot>, obtained prior to this rtn
           STA    Tmp+1           ;$C<slot>00, Mouse Card firmware main entry
           STA    ToCard+2
           LDY    #$1A
           LDA    (Tmp),Y
           STA    ToCard+1        ;Mouse Card firmware GetClamp entry
           LDA    #7
           STA    BytePtr
           LDY    #N0             ;$<slot>0, for Mouse Card firmware
GetByte    LDX    #CN             ;$C<slot>, for Mouse Card firmware       
           LDA    #0              ;Needed by Mouse Card firmware
           JSR    ToCard
           LDA    $578            ;Clamp byte returned by Mouse Card firmware
           LDX    BytePtr
           STA    Byte,X
           DEC    $478
           DEX
           STX    BytePtr 
           BPL    GetByte
           RTS
ToCard     JMP    $0000           ;Operand modified by rtn
Byte       DS    8,0              ;MinXH,MinYH,MinXL,MinYL,MaxXH,MaxYH,MaxXL,MaxYL
BytePtr    DS    1,0

Apple IIc

For the Apple IIc, you can get clamping values by reading the following auxiliary memory screen holes:

    $47D MinXL        $67D MaxXL
    $4FD MinYL        $6FD MaxYL
    $57D MinXH        $67D MaxXH
    $5FD MinYH        $6FD MaxYH
    

Apple IIGS

On the Apple IIGS, the Miscellaneous Tool Set call GetMouseClamp returns the mouse clamp values as four words on the stack. This call is documented in the Apple IIGS Toolbox Reference, Volume 1.

Further Reference