No problem!
It looks like ClearVsyncCounter and GetVsyncCounter were added during the creation of Video Mode 13 in the following commit:
Code: Select all
commit 76790238c0aed587cd39f81bcd77e93ec89fce41
Author: uze@belogic.com <uze@belogic.com@c007265c-c25a-11dd-ae62-6dab0a2b1684>
Date: Sat Feb 7 04:17:29 2015 +0000
-Created video mode 13
diff --git a/kernel/uzeboxVideoEngineCore.s b/kernel/uzeboxVideoEngineCore.s
index b09f833..3af3214 100644
--- a/kernel/uzeboxVideoEngineCore.s
+++ b/kernel/uzeboxVideoEngineCore.s
@@ -75,6 +75,8 @@
.global SetUserPostVsyncCallback
.global UartInitRxBuffer
.global IsRunningInEmulator
+.global GetVsyncCounter
+.global ClearVsyncCounter
;Public variables
.global sync_pulse
@@ -121,6 +123,8 @@
.byte 1
joypad2_status_hi: .byte 1
.byte 1
+
+ vsync_counter: .word 1
#if TRUE_RANDOM_GEN == 1
random_value: .word 1
@@ -420,6 +424,14 @@ no_render:
lds ZH,render_lines_count_tmp
sts render_lines_count,ZH
+ ;increment the vsync counter
+ lds r24,vsync_counter
+ lds r25,vsync_counter+1
+ adiw r24,1
+ sts vsync_counter,r24
+ sts vsync_counter+1,r25
+
+
;process user pre callback
lds ZL,pre_vsync_user_callback+0
lds ZH,pre_vsync_user_callback+1
@@ -502,7 +514,7 @@ hsync_pulse:
; This flag is set on each VSYNC by
; the engine. This func is used to
; synchronize the programs on frame
-; rate (30hz).
+; rate (60hz).
;
; C-callable
;************************************
@@ -524,6 +536,33 @@ ClearVsyncFlag:
sts sync_flags,r18
ret
+
+;************************************
+; Read the current vsync counter.
+; This value is incremented by the kernel
+; on each vertical sync (60hz). Can be used
+; for timeout functions.
+;
+; C-callable
+;************************************
+.section .text.GetVsyncCounter
+GetVsyncCounter:
+ lds r24,vsync_counter
+ lds r25,vsync_counter+1
+ ret
+
+;************************************
+; Clear the vsync counter.
+;
+; C-callable
+;************************************
+.section .text.ClearVsyncCounter
+ClearVsyncCounter:
+ sts vsync_counter,r1
+ sts vsync_counter+1,r1
+ ret
+
+
;*****************************
; Return joypad 1 or 2 buttons status
; C-callable
I just don't know which V# that is a part of, or if that versioning system was abandoned, because the last reference to that type of version number I can find is in a commit made on Jan 17, 2012, removing those version numbers:
Code: Select all
commit 294299433f16af4f0ac119dfaa68396f7d46737a
Author: uze@belogic.com <uze@belogic.com@c007265c-c25a-11dd-ae62-6dab0a2b1684>
Date: Tue Jan 17 03:54:54 2012 +0000
-Added current field to sync flags for all video modes
-Sprite struct now 4 bytes in size
diff --git a/kernel/uzeboxVideoEngineCore.s b/kernel/uzeboxVideoEngineCore.s
index 4b812ca..868559b 100644
--- a/kernel/uzeboxVideoEngineCore.s
+++ b/kernel/uzeboxVideoEngineCore.s
@@ -21,32 +21,7 @@
/*
Changes
---------------------------------------------
- V2.0:
- -Sprite engine
- -Reset console with joypad
- -ReadJoypad() now return int instead of char
- -NTSC timing more accurate
- -Use of conditionals (see defines.h)
- -Many small improvements
-
- V3.0
- -Major Refactoring: All video modes in their own files
- -New video modes: 3,4,6,7,8
- -EEPROM functions
- -Assembly functions in their own sections to save flash
- -Added Vsync User callback
- -UART Receive buffer & functions
- -Color burst offset control
-
- V3.2
- -Rewrote sync code
- -Use interrupt to pull back sync line for serration pulses
- -Added inline mixer selectable with a compile switch
- -Added channel 5 PCM (avail with inline mixer only)
- -Fixed the "click" sound upon game resets
- -Removed color burst offset code
- -Removed RAM patch code in music engine
-
+ See http://code.google.com/p/uzebox/source/browse/trunk/README.txt
*/
but that URL is now broken, and I don't see it in the current README.md, so I'm still not sure, but GetVsyncCounter and ClearVsyncCounter happened at least 3 years after V3.2, so I guess I can just use the dates for now on the wiki.
Edit: I did find a slightly more "updated" version in GitHub. It is the tags, but it only goes to:
Rev 3.3 Notes (Jan 03, 2012)