Make waitvsync available on apple2

This commit is contained in:
Colin Leroy-Mira
2025-05-27 16:22:37 +02:00
committed by Oliver Schmidt
parent d3ef3e1b62
commit a9ab23ad51
2 changed files with 27 additions and 8 deletions

View File

@@ -104,6 +104,7 @@ function.
<item><ref id="mktime_dt" name="mktime_dt"> <item><ref id="mktime_dt" name="mktime_dt">
<item>rebootafterexit <item>rebootafterexit
<item><ref id="videomode" name="videomode"> <item><ref id="videomode" name="videomode">
<item><ref id="waitvsync" name="waitvsync">
</itemize> </itemize>
@@ -119,6 +120,7 @@ function.
<item><ref id="mktime_dt" name="mktime_dt"> <item><ref id="mktime_dt" name="mktime_dt">
<item>rebootafterexit <item>rebootafterexit
<item><ref id="videomode" name="videomode"> <item><ref id="videomode" name="videomode">
<item><ref id="waitvsync" name="waitvsync">
</itemize> </itemize>
@@ -8516,14 +8518,20 @@ if the mode is not supported due to lack of hardware.
<descrip> <descrip>
<tag/Function/Wait until the start of the next video frame. <tag/Function/Wait until the start of the next video frame.
<tag/Header/<tt/ <tag/Header/<tt/
<ref id="apple2enh.h" name="apple2enh.h">, <ref id="apple2.h" name="apple2.h">,
<ref id="atmos.h" name="atmos.h">, <ref id="atmos.h" name="atmos.h">,
<ref id="cbm.h" name="cbm.h">, <ref id="cbm.h" name="cbm.h">,
<ref id="gamate.h" name="gamate.h">, <ref id="gamate.h" name="gamate.h">,
<ref id="nes.h" name="nes.h">, <ref id="nes.h" name="nes.h">,
<ref id="pce.h" name="pce.h">/ <ref id="pce.h" name="pce.h">/
<tag/Declaration/<tt/void waitvsync (void);/ <tag/Declaration/
<tt>void waitvsync (void);</tt><newline>
<tt>signed char waitvsync (void); /* For Apple II */</tt><newline>
<tag/Description/Wait for vertical sync, to reduce flickering. <tag/Description/Wait for vertical sync, to reduce flickering.
<tag/Notes/<itemize>
<item>The function will return -1 when the feature is not supported,
like on the Apple&nbsp;&rsqb;&lsqb;+.
</itemize>
<tag/Availability/Platforms served by the headers above <tag/Availability/Platforms served by the headers above
(Atmos requires the VSync hack) (Atmos requires the VSync hack)
<tag/Example/None. <tag/Example/None.

View File

@@ -3,11 +3,13 @@
; ;
; void waitvsync (void); ; void waitvsync (void);
; ;
.ifdef __APPLE2ENH__
.export _waitvsync .export _waitvsync
.import ostype .import ostype
.ifndef __APPLE2ENH__
.import machinetype
.endif
.include "apple2.inc" .include "apple2.inc"
_waitvsync: _waitvsync:
@@ -15,18 +17,27 @@ _waitvsync:
bmi iigs ; $8x bmi iigs ; $8x
bvs iic ; $4x bvs iic ; $4x
.ifndef __APPLE2ENH__
bit machinetype ; IIe/enh?
bmi :+
lda #$FF ; ][+ Unsupported
tax
rts
.endif
: bit RDVBLBAR : bit RDVBLBAR
bpl :- ; Blanking bpl :- ; Blanking
: bit RDVBLBAR : bit RDVBLBAR
bmi :- ; Drawing bmi :- ; Drawing
rts bpl out
; Apple IIgs TechNote #40, VBL Signal ; Apple IIgs TechNote #40, VBL Signal
iigs: bit RDVBLBAR iigs: bit RDVBLBAR
bmi iigs ; Blanking bmi iigs ; Blanking
: bit RDVBLBAR : bit RDVBLBAR
bpl :- ; Drawing bpl :- ; Drawing
rts bmi out
; Apple IIc TechNote #9, Detecting VBL ; Apple IIc TechNote #9, Detecting VBL
iic: php iic: php
@@ -42,6 +53,6 @@ iic: php
bit DISVBL bit DISVBL
: sta IOUDISON ; IIc Tech Ref Man: The firmware normally leaves IOUDIS on. : sta IOUDISON ; IIc Tech Ref Man: The firmware normally leaves IOUDIS on.
plp plp
out: lda #$00
tax
rts rts
.endif ; __APPLE2ENH__