473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HELP: Pascal & C/C++ (with a little assembly)

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?

Aug 5 '07 #1
0 1553

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: R BUckshaw | last post by:
Hello, I have been attempting to write a VB class that would expose its stuff to an older (ok, legacy application) program which can load and call exported functions from the old style dlls. ...
4
by: Chris Gordon-Smith | last post by:
I am tying to call a Pascal function from C++, and vice versa. Does anyone know how to do this, or where detailed information on this topic can be found? For the C++ to Pascal call I have...
0
by: Ben | last post by:
I'm having some issues understanding the GAC. I have little doubt I've over complicated my problem, but here it is. I want to have a project reference an assembly in the GAC. Then I want to add...
24
by: Faith Dorell | last post by:
I really don´t like C.You can write better programs in BASIC than in C, if you don´t like this language. I don´t understand how C became so popular, although much better programming languages...
1
by: John Stemper | last post by:
Getting resource files to work with VS2002 and ASP.Net seems to be a little flaky. I've added a resource file "strings.resx" to the project. The properties of the files say Build action = ...
3
by: Piripiccio | last post by:
Hello , please give me a little minute for this problem the first thing ..... my english is very bad I wrote a little program that using a socket pair with 2 process Padre (Father) and Figlio...
1
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems...
5
by: dhruba.bandopadhyay | last post by:
I am trying to port an old Pascal DOS game to DOS C/C++. I am wondering if anyone is familar with the dos & crt Pascal units and whether there are C/C++ equivalent libraries. Maybe dos.c & crt.c? ...
1
by: Andrew Wan | last post by:
I am having problems linking an assembly object with my C object files. Am getting: Linker Warning: DOSSEG directive ignored in module asm.asm Linker Error: Undefined symbol _ASMClsV in module...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.