X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Fcbm510%2Fmcbdefault.s;h=700dcebb11de6c138669603c7e9b02b858095953;hb=cb7882a2022ed7ec17d935c7f1e7a1db8785547a;hp=028fb4ec19a701ccb594e99bf0fda6852ed293ca;hpb=f091d0b3cdb0f93e6ec6d9bfa7c053f33f8c57b0;p=cc65 diff --git a/libsrc/cbm510/mcbdefault.s b/libsrc/cbm510/mcbdefault.s index 028fb4ec1..700dcebb1 100644 --- a/libsrc/cbm510/mcbdefault.s +++ b/libsrc/cbm510/mcbdefault.s @@ -8,7 +8,10 @@ ; be called from an interrupt handler. ; + .constructor initmcb .export _mouse_def_callbacks + .import _mouse_def_pointershape + .import _mouse_def_pointercolor .import vic:zp .include "mouse-kernel.inc" @@ -19,14 +22,50 @@ ; Sprite definitions. The first value can be changed to adjust the number ; of the sprite used for the mouse. All others depend on that value. MOUSE_SPR = 0 ; Sprite used for the mouse +MOUSE_SPR_MEM = $F400 ; Memory location MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register +; -------------------------------------------------------------------------- +; Initialize the mouse sprite. + +.segment "ONCE" + +initmcb: + +; Copy the mouse sprite data + + ldx #64 - 1 +@L0: lda _mouse_def_pointershape,x + sta MOUSE_SPR_MEM,x + dex + bpl @L0 + +; Set the mouse sprite pointer + + lda #<(MOUSE_SPR_MEM / 64) + sta $F3F8 + MOUSE_SPR + +; Set the mouse sprite color + + ldx IndReg + lda #15 + sta IndReg + + lda _mouse_def_pointercolor + ldy #VIC_SPR0_COLOR + MOUSE_SPR + sta (vic),y + + stx IndReg + rts + ; -------------------------------------------------------------------------- ; Hide the mouse pointer. Always called with interrupts disabled. +.code + hide: ldy #15 sty IndReg