Skip to content

Instantly share code, notes, and snippets.

@kg68k
Created July 18, 2025 17:38
Show Gist options
  • Select an option

  • Save kg68k/1dd246b8aa72c899fd2668b7ff7373a3 to your computer and use it in GitHub Desktop.

Select an option

Save kg68k/1dd246b8aa72c899fd2668b7ff7373a3 to your computer and use it in GitHub Desktop.
IOCS _OPMDRVが有効になっているか調べる
#include <stdio.h>
#define __DOS_INLINE__
#include <sys/dos.h>
#define IOCS_OPMDRV 0xf0
int is_opmdrv_installed(void* vec) {
unsigned int v = (unsigned int)vec;
// ベクタの最上位バイトにベクタ番号が入っていれば未使用
if ((v >> 24) == IOCS_OPMDRV) return 0;
// 060turboではIOCS _OPMDRVにはベクタ番号が入らないので
// IOCS ROMを指していれば未使用と判定する
if ((v & 0xffff0000) == 0x00ff0000) return 0;
// 何らかの処理ルーチンが設定されている
return 1;
}
int main(void) {
void* vec = _dos_intvcg(0x100 + IOCS_OPMDRV);
int installed = is_opmdrv_installed (vec);
const char* mes = installed ? "使用可能" : "使用不可能";
printf("IOCS _OPMDRVは%sです(ベクタ = 0x%08x)。\n", mes, (unsigned int)vec);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment