From 353721067470fa1671a0413944dd38b744e9f0bb Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Tue, 27 Oct 2020 22:25:58 +0100 Subject: [PATCH] add waitvsync() for atari and atari5200 --- doc/atari.sgml | 1 + doc/atari5200.sgml | 2 +- include/atari.h | 1 + include/atari5200.h | 3 +++ libsrc/atari/waitvsync.s | 15 +++++++++++++++ libsrc/atari5200/waitvsync.s | 15 +++++++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 libsrc/atari/waitvsync.s create mode 100644 libsrc/atari5200/waitvsync.s diff --git a/doc/atari.sgml b/doc/atari.sgml index eecd1b803..7fc929f42 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -332,6 +332,7 @@ See the for declaration and u _scroll _setcolor _setcolor_low +waitvsync diff --git a/doc/atari5200.sgml b/doc/atari5200.sgml index 00d3dfbd2..032b0ef6c 100644 --- a/doc/atari5200.sgml +++ b/doc/atari5200.sgml @@ -77,7 +77,7 @@ Programs containing Atari 5200 specific code may use the Atari 5200 specific functions

-TBD. +waitvsync diff --git a/include/atari.h b/include/atari.h index 1a00a4c67..b2fca0b0e 100644 --- a/include/atari.h +++ b/include/atari.h @@ -227,6 +227,7 @@ extern unsigned char __fastcall__ _getcolor (unsigned char color_reg); /* Other screen functions */ /*****************************************************************************/ +extern void waitvsync (void); /* Wait for start of next frame */ extern int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */ extern void __fastcall__ _scroll (signed char numlines); /* numlines > 0 scrolls up */ diff --git a/include/atari5200.h b/include/atari5200.h index d6c2561b2..9662fe98e 100644 --- a/include/atari5200.h +++ b/include/atari5200.h @@ -89,5 +89,8 @@ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */ */ #define _bordercolor(color) 0 +extern void waitvsync (void); +/* Wait for start of next frame */ + /* End of atari5200.h */ #endif diff --git a/libsrc/atari/waitvsync.s b/libsrc/atari/waitvsync.s new file mode 100644 index 000000000..a19b2375d --- /dev/null +++ b/libsrc/atari/waitvsync.s @@ -0,0 +1,15 @@ +; +; Written by Christian Groessler +; +; void waitvsync (void); +; + + .include "atari.inc" + .export _waitvsync + +.proc _waitvsync + lda RTCLOK+2 +@lp: cmp RTCLOK+2 + beq @lp + rts +.endproc diff --git a/libsrc/atari5200/waitvsync.s b/libsrc/atari5200/waitvsync.s new file mode 100644 index 000000000..9a67c6429 --- /dev/null +++ b/libsrc/atari5200/waitvsync.s @@ -0,0 +1,15 @@ +; +; Written by Christian Groessler +; +; void waitvsync (void); +; + + .include "atari5200.inc" + .export _waitvsync + +.proc _waitvsync + lda RTCLOK+1 +@lp: cmp RTCLOK+1 + beq @lp + rts +.endproc