diff --git a/libsrc/apple2/get_tv.s b/libsrc/apple2/get_tv.s index 830cc4ac1..b2eb4d857 100644 --- a/libsrc/apple2/get_tv.s +++ b/libsrc/apple2/get_tv.s @@ -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" diff --git a/libsrc/apple2/libref.s b/libsrc/apple2/libref.s index 8aa54abab..e3d713a5d 100644 --- a/libsrc/apple2/libref.s +++ b/libsrc/apple2/libref.s @@ -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 diff --git a/libsrc/apple2/mou/a2.stdmou.s b/libsrc/apple2/mou/a2.stdmou.s index e48abbb41..9c2f96200 100644 --- a/libsrc/apple2/mou/a2.stdmou.s +++ b/libsrc/apple2/mou/a2.stdmou.s @@ -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 diff --git a/libsrc/apple2/mouseref.s b/libsrc/apple2/mouseref.s new file mode 100644 index 000000000..b0e75c367 --- /dev/null +++ b/libsrc/apple2/mouseref.s @@ -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