I'm currently maintaining a 16 bit application developed with
Borland Turbo C++ Version 3.00 and running on DOS 6.22.
If possible, I'd prefer to use a compiler that is actively
supported, for instance Open Watcom. While trying to compile this
application with Open Watcom I noted that there are issues with
gotoxy, outputportb, clrscr, etc.
Is there any advice available for this task?
Your feedback is appreciated!
With much regards,
Bart
Hi,
> supported, for instance Open Watcom. While trying to compile this
> application with Open Watcom I noted that there are issues with
> gotoxy, outputportb, clrscr, etc.
You will need to be a bit more specific and describe exactly what your
problem is.
Reading between the linkes, I guess you are encountering unresolved
externals. If so, I recommend you review the drawing functions in the
Library Reference. They may serve your needs.
I dimly recall that someone did a port of the Borland graphics library
to OpenWatcom, but I can not find a link.
Steven
--
---------------------------------------------------------------------
Steven Levine <ste...@earthlink.bogus.net>
eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com
---------------------------------------------------------------------
Thanks for replying!
Indeed, gotoxy, outputportb, clrscr, etc are not supported by Open
Watcom, at least I could not find the calls in the Open Watcom
headers.
Any libraries available to ease porting Borland to Open Watcom?
Thanks!
Bart
On 26 jul, 01:52, "Steven Levine" <stev...@nomail.earthlink.net>
wrote:
> On Mon, 25 Jul 2011 22:06:59 UTC, Bart <bart.debo...@gmail.com> wrote:
>
> Hi,
>
> > supported, for instance Open Watcom. While trying to compile this
> > application with Open Watcom I noted that there are issues with
> > gotoxy, outputportb, clrscr, etc.
>
> You will need to be a bit more specific and describe exactly what your
> problem is.
>
> Reading between the linkes, I guess you are encountering unresolved
> externals. If so, I recommend you review the drawing functions in the
> Library Reference. They may serve your needs.
>
> I dimly recall that someone did a port of the Borland graphics library
> to OpenWatcom, but I can not find a link.
>
> Steven
>
> --
> ---------------------------------------------------------------------
> Steven Levine <stev...@earthlink.bogus.net>
> eCS/Warp/DIY etc.www.scoug.comwww.ecomstation.com
> ---------------------------------------------------------------------
Hi, please visit
http://mobile.experts-exchange.com/Q_10126289.html
for an answer to this question.
Lynn
Here is the contents of
http://mobile.experts-exchange.com/Q_10126289.html
Accepted Solution
dianna_d : 02/09/1999 - 02:22AM PST
Below are some cursor routines that I wrote many years ago and have used over and over again. They are reliable. They are written in
STD C and can be compiled with either Borland C++ or MSVC++ 1.52. They should work with Watcom. Make sure to #include <dos.h> for the
prototypes and REGS data type.
These routines make use of DOS BIOS INT10 services. For more info get a reference book that covers BIOS and DOS calls. These may be
in ancient libraries somewhere. Thom Hogan wrote an exhaustive ref. that is very handy if you have to write a lot of DOS code.
If you plan to write more than a few DOS programs, put these functions and other reusable common code into your own library. By
writing your own library you can build a common "look and feel" to all of your programs. Just add your library to the project make
file of new programs and you are set.
Dianna
P.S. I noticed that this message window wrapped my longer lines with comments and might confuse things. Since this is my first
posting, I will leave it as is. If the read back is messy, I will clean up entries next posting.
dd
/*========================================================================
C U R S O R C O N T R O L R O U T I N E S
========================================================================*/
/*------------------------------------------------------------------
FUNC: ShowCursor
PARM: 1 to display cursor, 0 to hide cursor
RETN: Nothing
DISC:
------------------------------------------------------------------*/
void ShowCursor (short bCursorOn)
{
static short start, end;
union REGS reg;
if (!bCursorOn)
{
reg.h.ah = 0x0f; /* get video page in bh */
int86 (0x10, ®, ®);
reg.h.ah = 3; /* read cursor config */
int86 (0x10, ®, ®); /* call bios video func */
start = reg.h.ch; /* save start scan line */
end = reg.h.cl; /* save end scan line */
}
reg.h.ah = 1; /* int10, service 1 */
reg.h.ch = (int)(bCursorOn? start : end); /* start row */
reg.h.cl = (int)(bCursorOn? end : start); /* end row */
int86 (0x10, ®, ®); /* call bios video func */
}
/*------------------------------------------------------------------
FUNC: GetCursorPos
PARM: Nothing
RETN: Cursor position: hibyte = x-pos, lobyte = y-pos
DISC: When in doubt, ask DOS
------------------------------------------------------------------*/
POINT GetCursorPos (void)
{
union REGS iregs, oregs;
POINT pos;
iregs.h.ah = 0x0f; /* get video page */
int86 (0x10, &iregs, &oregs);
iregs.h.ah = 0x03; /* get cursor pos */
iregs.h.bh = oregs.h.bh;
int86 (0x10, &iregs, &oregs);
pos.row = oregs.h.dh+1;
pos.col = oregs.h.dl+1;
return pos;
}
/*------------------------------------------------------------------
FUNC: SetCursorPos
PARM: Cursor position: hibyte = x-pos, lobyte = y-pos
RETN: Nothing
DISC: Screen upper left coords 1,1 - DOS coords 0,0
------------------------------------------------------------------*/
void SetCursorPos (short row, short col)
{
union REGS iregs, oregs;
iregs.h.ah = 0x0f; /* get video page */
int86 (0x10, &iregs, &oregs);
iregs.h.ah = 0x02; /* set cursor pos */
iregs.h.bh = oregs.h.bh;
iregs.h.dh = (char)row-1; /* row y-pos */
iregs.h.dl = (char)col-1; /* col x-pos */
int86 (0x10, &iregs, &oregs);
}
/*------------------------------------------------------------------
FUNC: SetLineCursor
PARM: Nothing
RETN: Nothing
DISC:
------------------------------------------------------------------*/
void SetLineCursor (void)
{
union REGS reg;
reg.h.ah = 1; /* set cursor shape */
reg.h.ch = 6; /* y-row - top */
reg.h.cl = 7; /* x-col - left */
int86 (0x10, ®, ®); /* call bios video func */
}
/*------------------------------------------------------------------
FUNC: SetBlockCursor
PARM: Nothing
RETN: Nothing
DISC:
------------------------------------------------------------------*/
void SetBlockCursor (void)
{
union REGS reg;
reg.h.ah = 1; /* int10, service 1 */
reg.h.ch = 1; /* start row */
reg.h.cl = 7; /* end row */
int86 (0x10, ®, ®); /* call bios video func */
}
Expert Comment
MadYugoslav : 02/09/1999 - 06:13AM PST
Put this into some header file
#define gotoxy(x,y) _settextposition(y,x)
>Hi Steven,
>
> Thanks for replying!
>
> Indeed, gotoxy, outputportb, clrscr, etc are not supported by Open
>Watcom, at least I could not find the calls in the Open Watcom
>headers.
But did you look at the help files?
Would, for example, _moveto() do something like gotoxy()?
A _GCLEARSCREEN macro is defined in graph.h; did you investigate how
it is used? It might allow a replacement for clrscr().
You wouldn't necessarily have to replace gotoxy() with _moveto() in
the code; you could write a gotoxy() function that manipulates its
parameters as needed and uses _moveto() -- particularly if you want to
be sure they are doing the same thing. If they are, then you could
consider converting the code.
And there are, IIRC, output functions for ports, not in graph.h but
in conio.h which might do whatever outputportb() does.
> Any libraries available to ease porting Borland to Open Watcom?
Judging from the other responces, you may be in luck. Surely this is
not a new problem!
--
"'If God foreknew that this would happen,
it will happen.'"
Thanks for all the constructive feedback! Will try your suggestions
today.
I know I'm late, but you could also take a look at this:
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/devel/libs/tcc2wat/