libmsx
C library for MSX
Loading...
Searching...
No Matches
interrupt.h
Go to the documentation of this file.
1// -*- coding: utf-8-unix -*-
2/*
3 * Copyright (c) 2021-2024 Daishi Mori (mori0091)
4 *
5 * This software is released under the MIT License.\n
6 * See https://github.com/mori0091/libmsx/blob/main/LICENSE
7 *
8 * GitHub libmsx project\n
9 * https://github.com/mori0091/libmsx
10 */
21#pragma once
22
23#ifndef INTERRUPT_H
24#define INTERRUPT_H
25
26#include <stdbool.h>
27#include <stdint.h>
28
47extern volatile bool vsync_busy;
48
71#define await_interrupt() \
72 __asm__("ei"); \
73 __asm__("halt")
74
91void await_vsync(void);
92
119void set_interrupt_handler(void (*handler)(void));
120
138void set_vsync_handler(void (*handler)(void));
139
154void sleep_ticks(uint16_t ticks);
155
161void sleep_millis(uint16_t ms);
162
179
182#endif
void await_vsync(void)
MSX Waits for next VSYNC interrupt.
volatile bool vsync_busy
MSX "Busy" flag for VSYNC interrupt routine.
void set_interrupt_handler(void(*handler)(void))
MSX Register user defined interrupt handler.
void set_vsync_handler(void(*handler)(void))
MSX Register user defined VSYNC interrupt handler.
void sleep_millis(uint16_t ms)
MSX Wait for the specified time to elapse in milliseconds.
void sleep_ticks(uint16_t ticks)
MSX Wait for the specified number of VSYNCs to occur.
bool get_interrupt_state(void)
MSX Return the current state of interrupts.