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-2025 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 */
22#pragma once
23
24#ifndef INTERRUPT_H
25#define INTERRUPT_H
26
27#include <stdbool.h>
28#include <stdint.h>
29
48extern volatile bool vsync_busy;
49
72#define await_interrupt() \
73 __asm__("ei"); \
74 __asm__("halt")
75
92void await_vsync(void);
93
120void set_interrupt_handler(void (*handler)(void));
121
139void set_vsync_handler(void (*handler)(void));
140
155void sleep_ticks(uint16_t ticks);
156
162void sleep_millis(uint16_t ms);
163
180
183#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.