E
eastroad
Unregistered / Unconfirmed
GUEST, unregistred user!
有以下代码,如何在Delphi及Win2000中实现。
unsigned x_pt[4]={0,0,0,0};
unsigned cd_chk(short unsigned i,short unsigned p)
{
union REGS regs;
regs.x.bx = i;
regs.x.ax = 0xb109;
regs.x.di = p;
int86(0x1a, ®s, ®s);
return(regs.x.cx);
}
char sw_light(char number, char on_off, char card)
{
char n;
unsigned i,a,k=0,*xpt;
union REGS regs;
if (number==0) {
if (on_off==1)
n=0xff;
else
n=0;
}
else {
if (on_off==1)
n=0x7f&number;
else
n=0x80|number;
}
xpt=&x_pt[card];
if ((*xpt)==0) {
(*xpt)=0xffff;
for (i=0; i<0x800; i+=0x8) {
if (cd_chk(i,0x06)!=0x400) continue;
a=cd_chk(i,0x40);
if (cd_chk(i,0x44)!=a) continue;
a/=0x100;
if (k==card) {
(*xpt)=(cd_chk(i,0x10)&0xfff0)+0x84;
break;
}
k++;
}
}
if ((*xpt)&&((*xpt)!=0xffff)) outportb((*xpt),n);
return;
}
unsigned x_pt[4]={0,0,0,0};
unsigned cd_chk(short unsigned i,short unsigned p)
{
union REGS regs;
regs.x.bx = i;
regs.x.ax = 0xb109;
regs.x.di = p;
int86(0x1a, ®s, ®s);
return(regs.x.cx);
}
char sw_light(char number, char on_off, char card)
{
char n;
unsigned i,a,k=0,*xpt;
union REGS regs;
if (number==0) {
if (on_off==1)
n=0xff;
else
n=0;
}
else {
if (on_off==1)
n=0x7f&number;
else
n=0x80|number;
}
xpt=&x_pt[card];
if ((*xpt)==0) {
(*xpt)=0xffff;
for (i=0; i<0x800; i+=0x8) {
if (cd_chk(i,0x06)!=0x400) continue;
a=cd_chk(i,0x40);
if (cd_chk(i,0x44)!=a) continue;
a/=0x100;
if (k==card) {
(*xpt)=(cd_chk(i,0x10)&0xfff0)+0x84;
break;
}
k++;
}
}
if ((*xpt)&&((*xpt)!=0xffff)) outportb((*xpt),n);
return;
}