1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Merge pull request #453 from mrdudz/waitvsync

waitvblank for cbm targets
This commit is contained in:
Oliver Schmidt 2017-07-18 15:38:27 +02:00 committed by GitHub
commit 6002e59c28
19 changed files with 142 additions and 26 deletions

View File

@ -437,7 +437,7 @@ function.
<!-- <itemize> -->
<!-- <item><ref id="get_tv" name="get_tv"> -->
<!-- <item><ref id="waitvblank" name="waitvblank"> -->
<!-- <item><ref id="waitvsync" name="waitvsync"> -->
<!-- </itemize> -->
(incomplete)

View File

@ -69,8 +69,8 @@ Programs containing NES specific code may use the <tt/nes.h/ header file.
<sect1>NES specific functions<p>
<itemize>
<item>waitvblank - wait until the start of vblank
<item>get_tv
<item>waitvsync - wait until the start of the next frame</item>
<item>get_tv</item>
</itemize>

View File

@ -77,7 +77,7 @@ Programs containing PCE specific code may use the <tt/pce.h/ header file.
<sect1>PCE specific functions<p>
<itemize>
<item>waitvblank</item>
<item>waitvsync</item>
<item>get_tv (since all PCE systems are NTSC, this always returns TV_NTSC)</item>
</itemize>

View File

@ -66,7 +66,7 @@ Programs containing Supervision specific code may use the <tt/supervision.h/ hea
<sect1>Supervision specific functions<p>
<itemize>
<item>waitvblank
<item>waitvsync</item>
</itemize>

View File

@ -153,7 +153,10 @@ struct cbm_dirent {
unsigned char get_tv (void);
/* Return the video mode the machine is using. */
#if !defined(__CBM610__) && !defined(__PET__)
void waitvsync (void);
/* wait for the start of the next frame */
#endif
/*****************************************************************************/
/* CBM kernal functions */

View File

@ -188,8 +188,8 @@ extern void gamate_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
#define JOY_START 6
#define JOY_SELECT 7
void waitvblank (void);
/* Wait for the vertical blanking */
void waitvsync (void);
/* Wait for start of next frame */
/* NOTE: all Gamate are "NTSC" */
#define get_tv() TV_NTSC

View File

@ -163,8 +163,8 @@ extern void nes_64_56_2_tgi[]; /* Referred to by tgi_static_stddrv[] */
void waitvblank (void);
/* Wait for the vertical blanking */
void waitvsync (void);
/* Wait for start of the next frame */
unsigned char get_tv (void);
/* Return the video mode the machine is using. */

View File

@ -83,8 +83,8 @@ extern void pce_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
#define JOY_SELECT 6
#define JOY_RUN 7
void waitvblank (void);
/* Wait for the vertical blanking */
void waitvsync (void);
/* Wait for start of the next frame */
/* NOTE: all PCE are NTSC */
#define get_tv() TV_NTSC

30
libsrc/c128/waitvsync.s Normal file
View File

@ -0,0 +1,30 @@
;
; Written by Groepaz <groepaz@gmx.net>
;
; void waitvsync (void);
;
.export _waitvsync
.include "c128.inc"
_waitvsync:
bit MODE
bmi @c80
@l1:
bit VIC_CTRL1
bpl @l1
@l2:
bit VIC_CTRL1
bmi @l2
rts
@c80:
;FIXME: do we have to switch banks?
@l3:
lda VDC_INDEX
and #$20
beq @l3
rts

18
libsrc/c64/waitvsync.s Normal file
View File

@ -0,0 +1,18 @@
;
; Written by Groepaz <groepaz@gmx.net>
;
; void waitvsync (void);
;
.export _waitvsync
.include "c64.inc"
_waitvsync:
@l1:
bit VIC_CTRL1
bpl @l1
@l2:
bit VIC_CTRL1
bmi @l2
rts

28
libsrc/cbm510/waitvsync.s Normal file
View File

@ -0,0 +1,28 @@
;
; Written by Groepaz <groepaz@gmx.net>
;
; void waitvsync (void);
;
.export _waitvsync
.import PALFLAG
.import sys_bank, restore_bank
.importzp vic
.include "cbm510.inc"
_waitvsync:
jsr sys_bank ; Switch to the system bank
sei
ldy #VIC_CTRL1
@l1:
lda (vic),y
bpl @l1
@l2:
lda (vic),y
bmi @l2
cli
jmp restore_bank

View File

@ -1,16 +1,18 @@
;
; void waitvblank (void);
; Written by Groepaz <groepaz@gmx.net>
;
; void waitvsync (void);
;
.include "gamate.inc"
.include "extzp.inc"
.forceimport ticktock
.export _waitvblank
.export _waitvsync
; FIXME: is this actually correct?
.proc _waitvblank
.proc _waitvsync
lda tickcount
@lp: cmp tickcount

View File

@ -1,15 +1,15 @@
;
; Written by Groepaz/Hitmen <groepaz@gmx.net>
; Written by Groepaz <groepaz@gmx.net>
; Cleanup by Ullrich von Bassewitz <uz@cc65.org>
;
; void waitvblank(void);
; void waitvsync(void);
;
.export _waitvblank
.export _waitvsync
.include "nes.inc"
.proc _waitvblank
.proc _waitvsync
wait: lda PPU_STATUS
bpl wait

View File

@ -1,14 +1,16 @@
;
; void waitvblank (void);
; Written by Groepaz <groepaz@gmx.net>
;
; void waitvsync (void);
;
.include "pce.inc"
.include "extzp.inc"
.forceimport ticktock
.export _waitvblank
.export _waitvsync
.proc _waitvblank
.proc _waitvsync
lda tickcount
@lp: cmp tickcount

17
libsrc/plus4/waitvsync.s Normal file
View File

@ -0,0 +1,17 @@
;
; Written by Groepaz <groepaz@gmx.net>
;
; void waitvsync (void);
;
.export _waitvsync
.include "plus4.inc"
_waitvsync:
@l1:
lda TED_VLINEHI
and #$01
ora TED_VLINELO
bne @l1
rts

16
libsrc/vic20/waitvsync.s Normal file
View File

@ -0,0 +1,16 @@
;
; Written by Groepaz <groepaz@gmx.net>
;
; void waitvsync (void);
;
.export _waitvsync
.include "vic20.inc"
_waitvsync:
@l2:
lda VIC_HLINE
bne @l2
rts

View File

@ -117,8 +117,8 @@ void main(void)
gotoxy(7 + inpos,1);
#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
/* not all targets have waitvblank */
waitvblank();
/* not all targets have waitvsync */
waitvsync();
/* for targets that do not have a keyboard, read the first
joystick */
joy = joy_read(JOY_1);

View File

@ -41,7 +41,7 @@ int main(int argc, char *argv[])
break;
}
waitvblank();
waitvsync();
(*((unsigned char*)LCD_XPOS)) = x;
(*((unsigned char*)LCD_YPOS)) = y;

View File

@ -123,7 +123,7 @@ void main(void)
p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
}
waitvblank();
waitvsync();
++n;
}
}