Apple2: Set mousecard IRQ rate when possible

This commit is contained in:
Colin Leroy-Mira
2025-05-11 11:49:53 +02:00
committed by Oliver Schmidt
parent 3b089b715a
commit cd92e4f0af
4 changed files with 55 additions and 4 deletions

View File

@@ -8,7 +8,7 @@
.import _set_iigs_speed, _get_iigs_speed
.import ostype
.constructor calibrate_tv, 2
.constructor calibrate_tv, 8 ; After ostype
.include "accelerator.inc"
.include "apple2.inc"

View File

@@ -2,10 +2,9 @@
; Oliver Schmidt, 2013-05-31
;
.export em_libref, mouse_libref, ser_libref, tgi_libref
.export em_libref, ser_libref, tgi_libref
.import _exit
em_libref := _exit
mouse_libref := _exit
ser_libref := _exit
tgi_libref := _exit

View File

@@ -7,6 +7,7 @@
.include "zeropage.inc"
.include "mouse-kernel.inc"
.include "apple2.inc"
.include "get_tv.inc"
.macpack module
@@ -21,6 +22,7 @@ CLAMPMOUSE = $17 ; Sets mouse bounds in a window
HOMEMOUSE = $18 ; Sets mouse to upper-left corner of clamp win
INITMOUSE = $19 ; Resets mouse clamps to default values and
; sets mouse position to 0,0
TIMEDATA = $1C ; Set mousecard's interrupt rate
pos1_lo := $0478
pos1_hi := $0578
@@ -41,6 +43,7 @@ status := $0778
.byte MOUSE_API_VERSION ; Mouse driver API version number
; Library reference
libref:
.addr $0000
; Jump table
@@ -169,7 +172,31 @@ next: inc ptr1+1
asl
sta yparam+1
; The AppleMouse II Card needs the ROM switched in
; Apple II technical notes "Varying VBL Interrupt Rate",
lda libref
ldx libref+1
sta ptr1
stx ptr1+1
.ifdef __APPLE2ENH__
lda (ptr1)
.else
ldy #$00
lda (ptr1),y
.endif
cmp #TV::OTHER
beq :+
; The TV values are aligned with the values the mousecard
; expect: 0 for 60Hz, 1 for 50Hz.
.assert TV::NTSC = 0, error
.assert TV::PAL = 1, error
ldx #TIMEDATA
jsr firmware
: ; The AppleMouse II Card needs the ROM switched in
; to be able to detect an Apple //e and use RDVBL
bit $C082

25
libsrc/apple2/mouseref.s Normal file
View File

@@ -0,0 +1,25 @@
;
; Colin Leroy-Mira, 2025-05-11
;
.export mouse_libref
.import _get_tv, ostype, return0
.constructor init_mousetv
.include "get_tv.inc"
.segment "ONCE"
.proc init_mousetv
lda ostype
cmp #$40 ; Technical notes say not to change
bcs :+ ; interrupt rate on IIc/IIgs, so...
jsr _get_tv
sta mouse_libref
: rts ; ...don't update "Other" on those machines
.endproc
.data
mouse_libref: .byte TV::OTHER