我现在正在用C++开发一个ms dos游戏(编译器:DJGPP),需要测试VGA卡当前是否处于垂直消隐间隔。有一个我可以读取的内存地址吗?我怎样才能检查这个?
您正在寻找的是端口0x03DA。 (如果使用 MDA,则为 0x03BA)
//0x03DA:
// Read: status bits are same as MDA (port 3baH) or CGA (port 3daH)
// ╓7┬6┬5┬4┬3┬2┬1┬0╖
// ║ │ │ │ │ ║
// ╙─┴─┴─┴─┴╥┴╥┴╥┴╥╜ bit
// ║ ║ ║ ╚═► 0: retrace. 1=display is in vert or horiz retrace.
// ║ ║ ╚═══► 1: 1=light pen is triggered; 0=armed
// ║ ╚═════► 2: 1=light pen switch is open; 0=closed
// ╚═══════► 3: 1=vertical sync pulse is occurring.
// header that includes inp()
#include <conio.h> // for OpenWatcom
#include <pc.h> // for DJGPP
bool isVsync()
{
return (inp(0x03DA) & 0x08);
}