fix vsync (somewhat)
This commit is contained in:
parent
4cba811f1e
commit
d848729281
|
@ -43,13 +43,14 @@ void display() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __POCKETSTATION__
|
#ifdef __POCKETSTATION__
|
||||||
#define FPS 24
|
#define FPS 64
|
||||||
#define CLOCK_SPEED CLOCK_4M
|
#define CLOCK_SPEED CLOCK_8M
|
||||||
|
#define VSYNC_COUNT (FRAMESKIP * (FPS/24))
|
||||||
#include "pocketlib.h"
|
#include "pocketlib.h"
|
||||||
|
|
||||||
static void display() {
|
static void display() {
|
||||||
// ????
|
// ????
|
||||||
for(int i = 0; i<FRAMESKIP*2; i++) VSync();
|
VSync(VSYNC_COUNT);
|
||||||
uint32_t *src = (uint32_t*)screen;
|
uint32_t *src = (uint32_t*)screen;
|
||||||
volatile unsigned int *dst = LCD_VRAM_ADRS;
|
volatile unsigned int *dst = LCD_VRAM_ADRS;
|
||||||
int i = 32;
|
int i = 32;
|
||||||
|
|
|
@ -62,6 +62,9 @@ int PadOnRelease, PadOnPress;
|
||||||
#define CLOCK_4M 0x7
|
#define CLOCK_4M 0x7
|
||||||
#define CLOCK_8M 0x8
|
#define CLOCK_8M 0x8
|
||||||
|
|
||||||
|
#define TICK_PER_SEC (15625 << CLOCK_SPEED)
|
||||||
|
#define TICK_PER_FRAME (TICK_PER_SEC / FPS)
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
#define TIMER0_START() *((volatile unsigned int *)(0xA800008)) |= 0x4
|
#define TIMER0_START() *((volatile unsigned int *)(0xA800008)) |= 0x4
|
||||||
|
@ -159,7 +162,7 @@ void FIQ_Handler(void)
|
||||||
/****************************************/
|
/****************************************/
|
||||||
// Sync Functions
|
// Sync Functions
|
||||||
|
|
||||||
void VSync()
|
void VSync(int count)
|
||||||
{
|
{
|
||||||
register int cnt = VCount;
|
register int cnt = VCount;
|
||||||
register int PadState = PAD_STATUS;
|
register int PadState = PAD_STATUS;
|
||||||
|
@ -169,7 +172,7 @@ void VSync()
|
||||||
PadOnRelease &= PadOnPress;
|
PadOnRelease &= PadOnPress;
|
||||||
PadOnPress = PadState;
|
PadOnPress = PadState;
|
||||||
|
|
||||||
while (VCount == cnt); // Wait For IRQ Timer0
|
while (VCount < cnt + count); // Wait For IRQ Timer0
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -194,7 +197,7 @@ void PocketInit(void)
|
||||||
IRQ_ENABLE = IRQ_TIMER0 | FIQ_TIMER2;
|
IRQ_ENABLE = IRQ_TIMER0 | FIQ_TIMER2;
|
||||||
|
|
||||||
// Start VSync Timer
|
// Start VSync Timer
|
||||||
TIMER0_SETCOUNT((15625 << CLOCK_SPEED) / FPS);
|
TIMER0_SETCOUNT(TICK_PER_FRAME);
|
||||||
TIMER0_START();
|
TIMER0_START();
|
||||||
|
|
||||||
while (PAD_STATUS & PAD_BUTTON); // Wait for Button Release (Button pressed when comming from Menu)
|
while (PAD_STATUS & PAD_BUTTON); // Wait for Button Release (Button pressed when comming from Menu)
|
||||||
|
|
Loading…
Reference in New Issue