X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libsrc%2Fapple2%2Fmcbdefault.s;h=2ade00aefdc90066f7b7dbcf3a8dd1d699e2dba9;hb=85885001b133e2dc320b6f6459259afa69784ca8;hp=c7c51a5761e7603392d3934ea293336424323718;hpb=44fd1082ae807a0b6b4046c65914e20a7e27101c;p=cc65 diff --git a/libsrc/apple2/mcbdefault.s b/libsrc/apple2/mcbdefault.s index c7c51a576..2ade00aef 100644 --- a/libsrc/apple2/mcbdefault.s +++ b/libsrc/apple2/mcbdefault.s @@ -1,38 +1,38 @@ ; -; Default mouse callbacks for the Apple II +; Default mouse callbacks for the Apple II ; ; Oliver Schmidt, 22.09.2005 ; -; All functions in this module should be interrupt safe, because they may +; All functions in this module should be interrupt safe, because they may ; be called from an interrupt handler ; - .export _mouse_def_callbacks - - .include "apple2.inc" + .export _mouse_def_callbacks + + .include "apple2.inc" ; ------------------------------------------------------------------------ - .bss - -backup: .res 1 + .bss + +backup: .res 1 ; ------------------------------------------------------------------------ - .rodata + .rodata - ; Callback structure + ; Callback structure _mouse_def_callbacks: - .addr hide - .addr show - .addr movex - .addr movey + .addr hide + .addr show + .addr movex + .addr movey ; ------------------------------------------------------------------------ - .data + .data - .ifdef __APPLE2ENH__ + .ifdef __APPLE2ENH__ cursor = 'B' ; MouseText character .else cursor = '+' | $40 ; Flashing crosshair @@ -41,85 +41,85 @@ cursor = '+' | $40 ; Flashing crosshair getcursor: .ifdef __APPLE2ENH__ bit RD80VID ; In 80 column mode? - bpl column ; No, skip bank switching -switch: bit LOWSCR ; Patched at runtime + bpl column ; No, skip bank switching +switch: bit LOWSCR ; Patched at runtime .endif -column: ldx #$00 ; Patched at runtime -getscr: lda $0400,x ; Patched at runtime - cmp #cursor - rts +column: ldx #$00 ; Patched at runtime +getscr: lda $0400,x ; Patched at runtime + cmp #cursor + rts setcursor: - lda #cursor -setscr: sta $0400,x ; Patched at runtime - .ifdef __APPLE2ENH__ - bit LOWSCR ; Doesn't hurt in 40 column mode + lda #cursor +setscr: sta $0400,x ; Patched at runtime + .ifdef __APPLE2ENH__ + bit LOWSCR ; Doesn't hurt in 40 column mode .endif - rts + rts ; ------------------------------------------------------------------------ - .code + .code done: - .ifdef __APPLE2ENH__ - bit LOWSCR ; Doesn't hurt in 40 column mode + .ifdef __APPLE2ENH__ + bit LOWSCR ; Doesn't hurt in 40 column mode .endif - rts + rts ; Hide the mouse cursor. hide: - jsr getcursor ; Cursor visible at current position? - bne done ; No, we're done - lda backup ; Get character at cursor position - jmp setscr ; Draw character + jsr getcursor ; Cursor visible at current position? + bne done ; No, we're done + lda backup ; Get character at cursor position + jmp setscr ; Draw character ; Show the mouse cursor. show: - jsr getcursor ; Cursor visible at current position? - beq done ; Yes, we're done - sta backup ; Save character at cursor position - jmp setcursor ; Draw cursor + jsr getcursor ; Cursor visible at current position? + beq done ; Yes, we're done + sta backup ; Save character at cursor position + jmp setcursor ; Draw cursor ; Move the mouse cursor x position to the value in A/X. movex: - dex ; Is position [256..279]? - bmi :+ ; No, start with column 0 - clc - adc #$0100 .MOD 7 ; Bias position - ldx #$0100 / 7 - 1 ; Bias column -: sec -: sbc #7 ; 280 positions / 40 columns - inx - bcs :- - stx column+1 + dex ; Is position [256..279]? + bmi :+ ; No, start with column 0 + clc + adc #$0100 .MOD 7 ; Bias position + ldx #$0100 / 7 - 1 ; Bias column +: sec +: sbc #7 ; 280 positions / 40 columns + inx + bcs :- + stx column+1 .ifdef __APPLE2ENH__ - adc #7 / 2 ; Left or right half of 40-col column? - ldx #$0400 ; 000001CD - sta getscr+2 - sta setscr+2 - txa ; ABCDExxx - ror ; EABCDExx - and #%11100000 ; EAB00000 - ora getscr+1 ; EABABCDE - and #%11111000 ; EABAB000 - sta getscr+1 - sta setscr+1 - rts + tax ; ABCDExxx + lsr ; 0ABCDExx + lsr ; 00ABCDEx + lsr ; 000ABCDE + sta getscr+1 + lsr ; 0000ABCD + and #%00000011 ; 000000CD + ora #>$0400 ; 000001CD + sta getscr+2 + sta setscr+2 + txa ; ABCDExxx + ror ; EABCDExx + and #%11100000 ; EAB00000 + ora getscr+1 ; EABABCDE + and #%11111000 ; EABAB000 + sta getscr+1 + sta setscr+1 + rts