65816-llvm-mos/runtime/include/iigs/misc.h
2026-10-13 13:58:56 -05:00

44 lines
1.5 KiB
C

// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// iigs/misc.h - Misc Tool Set wrappers that genToolbox.py can't generate.
//
// genToolbox.py auto-generates inline-asm wrappers for every ORCA
// `extern pascal Foo() inline(0xNNTT, dispatcher)` declaration. A
// handful of Misc Tool calls return STRUCT values (ReadTimeHex,
// GetMouseClamp, ...) and ORCA's misctool.h declares those WITHOUT
// the inline() macro, so the generator skips them.
//
// This header (and the iigsToolbox.s entries it forward-declares)
// fills that gap with hand-written, C-friendly wrappers.
//
// Currently exposed:
// - iigsReadTimeHex(unsigned char buf[8])
// Calls Misc Tool $0D03 (ReadTimeHex). Writes the 8-byte TimeRec
// into the caller-provided buffer in this order:
// buf[0] = second (0..59)
// buf[1] = minute (0..59)
// buf[2] = hour (0..23)
// buf[3] = (pad / unused)
// buf[4] = year - 1900
// buf[5] = day-of-month (1..31)
// buf[6] = month (0..11)
// buf[7] = day-of-week (1..7, Sunday=1)
// The Tool Locator must be up before calling (true under
// crt0Gsos and crt0Gno -- the host inits TL before __start).
#ifndef IIGS_MISC_H
#define IIGS_MISC_H
#ifdef __cplusplus
extern "C" {
#endif
extern void iigsReadTimeHex(unsigned char *buf8);
#ifdef __cplusplus
}
#endif
#endif