🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.comp.lang.learn.c-c++
1 messages
1 total messages Started by dhruba.bandopadhyay Sun, 05 Aug 2007 18:49
HELP: Pascal & C/C++ (with a little assembly)
#313
Author: dhruba.bandopadhyay
Date: Sun, 05 Aug 2007 18:49
61 lines
3188 bytes
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, &regs);
or
intr(0x2f, &regs);

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?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads