473,405 Members | 2,210 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,405 software developers and data experts.

HELP: C/C++ equivalent of dos,crt Pascal units

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?

Below lists names of variables, functions, types & weird interrupt
procedures found in Pascal. Am wondering what can be done to get around
them for use in C/C++.

dos.pas
crt.pas

---undefined identifiers---
'black'
'blue'
'clrscr'
'lightblue'
'lightcyan'
'lightgray'
'lightgreen'
'lightmagenta'
'lightred'
'mem'
'port'
'wherex'
'wherey'
'white'
'yellow'
---undefined functions---
'addr'
'blockread'
'delay'
'fillchar'
'fsearch'
'getintvec'
'gettime'
'gotoxy'
'hi'
'inline_'
'int_'
'intr'
'lo'
'ofs'
'seg'
'setintvec'
'settime'
'swap'
'textbackground'
'textcolor'
'window'
---unknown types---
Single
registers
---misc---
Port[$3C8] := reg;
l := port[$60];
port[$20] := $20;
Port[$43] := $B6;
ch := mem[seg(tex) + (let div 16): ofs(tex) + (let mod 16)];
procedure NewInt1C; Interrupt;
procedure NewInt08; Interrupt;

Sep 1 '06 #1
5 3618
* dh*****************@hotmail.com:
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. Yes, there are.

2. But no, not in the standard C++ library.

3. You probably don't want what you're asking! Probably you're
porting to Windows console, not DOS.

4. DO NOT CROSSPOST TO C, C++ AND PASCAL GROUPS!

5. This is a FAQ. Check the C++ FAQ.

6. You're OFF-TOPIC in all groups posted to.

7. Post to an appropriate group (some appropriate groups are listed
in the FAQ).

Please do not reply to this posting (see points 4, 6 and 7).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Sep 1 '06 #2
On 1 Sep 2006 08:12:41 -0700 in comp.lang.c++,
"dh*****************@hotmail.com" <dh*****************@hotmail.com>
wrote,
>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?
This issue is covered in Marshall Cline's C++ FAQ. See the topics:
# [15.17] How can I tell {if a key, which key} was pressed before the user presses the ENTER key?
# [15.18] How can make it so keys pressed by users are not echoed on the screen?
# [15.19] How can I move the cursor around on the screen?
# [15.20] How can I clear the screen? Is there something like clrscr()?
# [15.21] How can I change the colors on the screen?

It is always good to check the FAQ before posting. You can get the
FAQ at:
http://www.parashift.com/c++-faq-lite/

See the welcome message posted twice per week in comp.lang.c++ under
the subject "Welcome to comp.lang.c++! Read this first." or
available at http://www.slack.net/~shiva/welcome.txt

Sep 1 '06 #3
dh*****************@hotmail.com wrote:
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?

Below lists names of variables, functions, types & weird interrupt
procedures found in Pascal. Am wondering what can be done to get around
them for use in C/C++.

dos.pas
crt.pas

---undefined identifiers---
'black'
'blue'
'clrscr'
'lightblue'
'lightcyan'
'lightgray'
'lightgreen'
'lightmagenta'
'lightred'
'mem'
'port'
'wherex'
'wherey'
'white'
'yellow'
---undefined functions---
'addr'
'blockread'
'delay'
'fillchar'
'fsearch'
'getintvec'
'gettime'
'gotoxy'
'hi'
'inline_'
'int_'
'intr'
'lo'
'ofs'
'seg'
'setintvec'
'settime'
'swap'
'textbackground'
'textcolor'
'window'
---unknown types---
Single
registers
---misc---
Port[$3C8] := reg;
l := port[$60];
port[$20] := $20;
Port[$43] := $B6;
ch := mem[seg(tex) + (let div 16): ofs(tex) + (let mod 16)];
procedure NewInt1C; Interrupt;
procedure NewInt08; Interrupt;
Single = float
Sep 2 '06 #4
Hi,

Well from the top of my head 1C is I believe the timer interrupt. I just
checked a decennia old assembly program of mine
http://moonlit.xs4all.nl/MUSIC.COM
and it still runs in a dosbox. I.e. apparently you can still set
timerinterrupts. 08 interupt vector was I believe the keyboard interrupt.

Open a dosbox and enter music.com (if you dare :-) ) It is a tsr so to
remove it from memory just run it again.

--
Here is a piece of code (in assembly, the C functions are not compatible
amongst the C compiler (msc or turbo C). This replaces interrupt 1C (the
time interrupt) using msdos function (interrupt 21) 35h and 25h. It saves
the old address because you have to restore it when exiting your program.
Otherwise it will obviously point into nothing (which is pretty bad for the
timer interrupt).

Playtune is the offset of your interrupt routine. In MSVC you can use the
__asm keyword. The interrupt itself is best created with as 'naked' routine
and should end with reti (return from interrupt, instead of the compiler
generated ret)

Install: Mov Ax,351ch ;Get old interuptvector
Int 21h
Mov [Oldintoff],Bx
Mov [Oldintseg],Es
Mov Ax,251ch ;Install new interuptvector.
Mov Dx, Play_tune
Int 21h
Ok, so you really don't want to do this right? Just learn windows
programming and lookup WM_TIMER message, SetTimer, KillTimer and WM_CHAR
messages.
Let msvc generate a basic MFC app and do something with those messages in
the main event loop.
Then on the WM_PAINT event draw in your window using the nice GDI functions.
That should cover all those turbo pascal functions I see in your listing.

Regards, Ron AF Greve

http://moonlit.xs4all.nl

<dh*****************@hotmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>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?

Below lists names of variables, functions, types & weird interrupt
procedures found in Pascal. Am wondering what can be done to get around
them for use in C/C++.

dos.pas
crt.pas

---undefined identifiers---
'black'
'blue'
'clrscr'
'lightblue'
'lightcyan'
'lightgray'
'lightgreen'
'lightmagenta'
'lightred'
'mem'
'port'
'wherex'
'wherey'
'white'
'yellow'
---undefined functions---
'addr'
'blockread'
'delay'
'fillchar'
'fsearch'
'getintvec'
'gettime'
'gotoxy'
'hi'
'inline_'
'int_'
'intr'
'lo'
'ofs'
'seg'
'setintvec'
'settime'
'swap'
'textbackground'
'textcolor'
'window'
---unknown types---
Single
registers
---misc---
Port[$3C8] := reg;
l := port[$60];
port[$20] := $20;
Port[$43] := $B6;
ch := mem[seg(tex) + (let div 16): ofs(tex) + (let mod 16)];
procedure NewInt1C; Interrupt;
procedure NewInt08; Interrupt;

Sep 2 '06 #5
Oops in the unlikely event you really want to execute the dos program (or
look into it with debug).

Here is the correct link

http://moonlit.xs4all.nl/~moonlit/MUSIC.COM
--
Regards, Ron AF Greve

http://moonlit.xs4all.nl

"Moonlit" <news moonlit xs4all nlwrote in message
news:44**********************@news.xs4all.nl...
Hi,

Well from the top of my head 1C is I believe the timer interrupt. I just
checked a decennia old assembly program of mine
http://moonlit.xs4all.nl/MUSIC.COM
and it still runs in a dosbox. I.e. apparently you can still set
timerinterrupts. 08 interupt vector was I believe the keyboard interrupt.

Open a dosbox and enter music.com (if you dare :-) ) It is a tsr so to
remove it from memory just run it again.

--
Here is a piece of code (in assembly, the C functions are not compatible
amongst the C compiler (msc or turbo C). This replaces interrupt 1C (the
time interrupt) using msdos function (interrupt 21) 35h and 25h. It saves
the old address because you have to restore it when exiting your program.
Otherwise it will obviously point into nothing (which is pretty bad for
the timer interrupt).

Playtune is the offset of your interrupt routine. In MSVC you can use the
__asm keyword. The interrupt itself is best created with as 'naked'
routine and should end with reti (return from interrupt, instead of the
compiler generated ret)

Install: Mov Ax,351ch ;Get old interuptvector
Int 21h
Mov [Oldintoff],Bx
Mov [Oldintseg],Es
Mov Ax,251ch ;Install new interuptvector.
Mov Dx, Play_tune
Int 21h
Ok, so you really don't want to do this right? Just learn windows
programming and lookup WM_TIMER message, SetTimer, KillTimer and WM_CHAR
messages.
Let msvc generate a basic MFC app and do something with those messages in
the main event loop.
Then on the WM_PAINT event draw in your window using the nice GDI
functions. That should cover all those turbo pascal functions I see in
your listing.

Regards, Ron AF Greve

http://moonlit.xs4all.nl

<dh*****************@hotmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>>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?

Below lists names of variables, functions, types & weird interrupt
procedures found in Pascal. Am wondering what can be done to get around
them for use in C/C++.

dos.pas
crt.pas

---undefined identifiers---
'black'
'blue'
'clrscr'
'lightblue'
'lightcyan'
'lightgray'
'lightgreen'
'lightmagenta'
'lightred'
'mem'
'port'
'wherex'
'wherey'
'white'
'yellow'
---undefined functions---
'addr'
'blockread'
'delay'
'fillchar'
'fsearch'
'getintvec'
'gettime'
'gotoxy'
'hi'
'inline_'
'int_'
'intr'
'lo'
'ofs'
'seg'
'setintvec'
'settime'
'swap'
'textbackground'
'textcolor'
'window'
---unknown types---
Single
registers
---misc---
Port[$3C8] := reg;
l := port[$60];
port[$20] := $20;
Port[$43] := $B6;
ch := mem[seg(tex) + (let div 16): ofs(tex) + (let mod 16)];
procedure NewInt1C; Interrupt;
procedure NewInt08; Interrupt;


Sep 2 '06 #6

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

Similar topics

4
by: Matt | last post by:
Hello. I have an Informix SQL statement that I need to run in MS SQL Server. When I try to execute it I get the following error message from Query Analyzer: Server: Msg 195, Level 15, State 10,...
28
by: Skybuck Flying | last post by:
Hi, I think I understand now a bit better what the difference is between a c compiler and a pascal compiler. For example: When compiling source code with a pascal compiler. The pascal...
3
by: tanya foster | last post by:
Hello, I am re-writing a visual basic .net application(visual studio 2003) in an asp.net application(visual studio 2005). The vb.net application relied on a treeview and hence, treenodes. The...
6
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? ...
0
by: dhruba.bandopadhyay | last post by:
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...
3
by: abraxas91 | last post by:
Hi, my name is Stephan. I've been working on this program off and on over the past few days. I have yet to perfect it. I would really appreciate any help! For some reason the output begins to...
54
by: Ruud | last post by:
Hallo allemaal, During the conversion of my program from Pascal to C, I was more or less able to find the C equivalent of most Pascal functions so far. Only four gave me some real trouble. I...
3
by: smileyme74 | last post by:
Every time I enter for example 1 mile, I get the error. /** * This program will convert measurements expressed in inches, * feet, yards, or miles into each of the possible units of *...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.