D
dhruba.bandopadhyay
Am using Borland C++ 4.5 for the old dos.h APIs. It appears that newer
versions of compilers stop support for the oldskool DOS routines. Am
trying to convert/port an oldskool Pascal program that uses registers/
interrupts into C/C++.
1. What are the inline($FA); & inline($FB); Pascal functions? What is
the C/C++ equivalent?
inline($CD / $1C);
inline($9C);
2. Just checking if this is correct Pascal-to-C conversion:
fillchar(playscores, sizeof(playscores), 0);//Pascal
memset(&playscores, 0, sizeof(playscores));//C
scrofsptr = addr(scr_ofs);//Pascal
scrofsptr = &(scr_ofs);//C
getintvec(0x9, oldkeyvec);//Pascal
getvect(0x9, oldkeyvec);//C
setintvec(0x9, addr(newkbdint()));//Pascal
setvect(0x9, &(newkbdint));//C
s = seg(dat);//Pascal
s = (unsigned int)dat & 0xFFFF0000;//C
o = ofs(dat);//Pascal
o = (unsigned int)dat & 0x0000FFFF;//C
port[0x40] = lo(count);//Pascal
outp( 0x40, lo(count) );//C
port[0x40] = hi(count);//Pascal
outp( 0x40, hi(count) );//C
3. dos.h contains a bunch of register structures.
My Pascal functions makes use of bx, es, si registers and this fits
nicely in struct REGPACK.
However some Pascal functions uses the 'al' register and struct
REGPACK doesn't have this member.
The union REGS gives me the 'al' register but doesn't provide a 'es'
register. See the dilemma?
It appears each function fills in a register struct and then calls
either:
intr(0x7a, ®s);
or
intr(0x2f, ®s);
Should I use the int386x() function since it takes 2 register
structures, one for input, one for output/result?
and then checks the 'al' member for the results.
4. How can I reverse the bits of a byte or word?
versions of compilers stop support for the oldskool DOS routines. Am
trying to convert/port an oldskool Pascal program that uses registers/
interrupts into C/C++.
1. What are the inline($FA); & inline($FB); Pascal functions? What is
the C/C++ equivalent?
inline($CD / $1C);
inline($9C);
2. Just checking if this is correct Pascal-to-C conversion:
fillchar(playscores, sizeof(playscores), 0);//Pascal
memset(&playscores, 0, sizeof(playscores));//C
scrofsptr = addr(scr_ofs);//Pascal
scrofsptr = &(scr_ofs);//C
getintvec(0x9, oldkeyvec);//Pascal
getvect(0x9, oldkeyvec);//C
setintvec(0x9, addr(newkbdint()));//Pascal
setvect(0x9, &(newkbdint));//C
s = seg(dat);//Pascal
s = (unsigned int)dat & 0xFFFF0000;//C
o = ofs(dat);//Pascal
o = (unsigned int)dat & 0x0000FFFF;//C
port[0x40] = lo(count);//Pascal
outp( 0x40, lo(count) );//C
port[0x40] = hi(count);//Pascal
outp( 0x40, hi(count) );//C
3. dos.h contains a bunch of register structures.
My Pascal functions makes use of bx, es, si registers and this fits
nicely in struct REGPACK.
However some Pascal functions uses the 'al' register and struct
REGPACK doesn't have this member.
The union REGS gives me the 'al' register but doesn't provide a 'es'
register. See the dilemma?
It appears each function fills in a register struct and then calls
either:
intr(0x7a, ®s);
or
intr(0x2f, ®s);
Should I use the int386x() function since it takes 2 register
structures, one for input, one for output/result?
and then checks the 'al' member for the results.
4. How can I reverse the bits of a byte or word?