Mouse #7
Mouse Clamping

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, obtained prior to this rtn
           STA    Tmp+1           ;$C00, 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             ;$0, for Mouse Card firmware
GetByte    LDX    #CN             ;$C, 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
$4FD
MinYL
$57D
MinXH
$5FD
MinYH
$67D
MaxXL
$6FD
MaxYL
$67D
MaxXH
$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


This and all of the other Apple II Technical Notes have been converted to HTML by Aaron Heiss as a public service to the Apple II community, with permission by Apple Computer, Inc. Any and all trademarks, registered and otherwise, are properties of their owners.