Add method to wait for some frames in CRT.

This commit is contained in:
giomba 2023-10-22 11:40:28 +02:00
parent a49102fbac
commit 9d8bede050
2 changed files with 10 additions and 3 deletions

View File

@ -1,10 +1,13 @@
#include "crt.h"
#include <stdint.h>
void crt_waitNextFrame(void) {
void (*frame_sync_detection_routine)(void) = (void *)0xc75b;
__asm__("push af");
frame_sync_detection_routine();
__asm__("pop af");
}
}
void crt_waitFrames(uint16_t n) {
for (uint16_t i = 0; i < n; ++i)
crt_waitNextFrame();
}

View File

@ -1,6 +1,10 @@
#ifndef CEDA_CRT_H
#define CEDA_CRT_H
#include <stdbool.h>
#include <stdint.h>
void crt_waitNextFrame(void);
void crt_waitFrames(uint16_t n);
#endif // CEDA_CRT_H