Substitute for dos.h in Linux

1,218 views
Skip to first unread message

Rishi

unread,
Oct 16, 2011, 9:24:20 AM10/16/11
to iit...@googlegroups.com
Hi,

I am required to make a assignment in Computer Graphics using C++ in which I have to control the mouse. I tried making it in Turbo C++ in windows 7 but gave up due to its medieval interface. I set up environment to do this in Linux using steps given here :http://itsanimesh.com/2009/01/08/c_graphics_in_linux/ . But the problem is that there is no substitute for dos.h in Linux which allows to access REGS - register which is used to store mouse positions. I googled it and find out that providing this type of access compromises OS's security so Linux doesn't provide it. Is there any work around?

Regards,
Rishi Agarwal

Narendra Sisodiya

unread,
Oct 16, 2011, 10:42:06 AM10/16/11
to Linux User Group @ IIT Delhi


On Oct 16, 6:24 pm, Rishi <rishiag.i...@gmail.com> wrote:
> Hi,
>
> I am required to make a assignment in Computer Graphics using C++ in which I
> have to control the mouse. I tried making it in Turbo C++ in windows 7 but
> gave up due to its medieval interface. I set up environment to do this in
> Linux using steps given here
> :http://itsanimesh.com/2009/01/08/c_graphics_in_linux/. But the problem is
> that there is no substitute for dos.h in Linux which allows to access REGS -
> register which is used to store mouse positions. I googled it and find out
> that providing this type of access compromises OS's security so Linux
> doesn't provide it. Is there any work around?
>
> Regards,
> Rishi Agarwal



Dear Rishi,
why you want to learn graphics in DOS ? Why not learn graphics
which works cross platform ? standard ..

Here are few options.

Use DevCPP and Learn Open GL
OpenGL is heavy, you can learn GTL http://www.nigels.com/glt/


Other 2D graphics APIs

cairo – a cross platform graphical vectorial draw and text
toolkit.
GTK+ – a cross platform graphical widget toolkit.
Java 2D – a cross platform API for drawing two-dimensional
graphics.
Qt – a cross platform graphical widget toolkit.
wxWidgets – a cross platform graphical widget toolkit.
Asymptote Vector Graphics Language – a script driven, LaTex
compatible, language for high quality sketches, graphs, diagrams,
geometry and typesetting with output in PostScript, PDF, SVG, and 3D
PRC.



Must read discussion - http://stackoverflow.com/questions/1924171/simple-c-graphics-library

Tavish Naruka

unread,
Oct 16, 2011, 11:47:40 AM10/16/11
to iit...@googlegroups.com
On Sun, Oct 16, 2011 at 6:54 PM, Rishi <rishia...@gmail.com> wrote:
Hi,

I am required to make a assignment in Computer Graphics using C++ in which I have to control the mouse. I tried making it in Turbo C++ in windows 7 but gave up due to its medieval interface. I set up environment to do this in Linux using steps given here :http://itsanimesh.com/2009/01/08/c_graphics_in_linux/ . But the problem is that there is no substitute for dos.h in Linux which allows to access REGS - register which is used to store mouse positions. I googled it and find out that providing this type of access compromises OS's security so Linux doesn't provide it. Is there any work around?


Use Xlib if you want this program to work on linux. X11/Xlib.h  and X11/Xutil.h should serve the purpose.

--
 Tavish Naruka

Rishi Agarwal

unread,
Oct 16, 2011, 1:17:16 PM10/16/11
to iit...@googlegroups.com
@Narendra
I know OpenGL but actually in my assignment I have to use ROM BIOS
functions. To invoke this functions I have to use interrupt and
registers available in 8086. These functions can be used in windows by
including dos.h. I want to know that is there something similar in
Linux.

@Tavish
I included these files but it doesn't recognize "int86" & "REGS"
function that I use in windows. Any idea, what can be used at their
place?

> --
> Mailing list guidelines and other related articles: http://lug-iitd.org/Footer
>

--
Rishi Agarwal
3rd Year Undergraduate
Department of Mathematics
Indian Institute of Technology, Delhi

Nilesh Govindarajan

unread,
Oct 16, 2011, 1:20:12 PM10/16/11
to iit...@googlegroups.com
On 10/16/2011 08:12 PM, Narendra Sisodiya wrote:
>
>
> On Oct 16, 6:24 pm, Rishi <rishiag.i...@gmail.com> wrote:
>> Hi,
>>
>> I am required to make a assignment in Computer Graphics using C++ in which I
>> have to control the mouse. I tried making it in Turbo C++ in windows 7 but
>> gave up due to its medieval interface. I set up environment to do this in
>> Linux using steps given here
>> :http://itsanimesh.com/2009/01/08/c_graphics_in_linux/. But the problem is
>> that there is no substitute for dos.h in Linux which allows to access REGS -
>> register which is used to store mouse positions. I googled it and find out
>> that providing this type of access compromises OS's security so Linux
>> doesn't provide it. Is there any work around?
>>
>> Regards,
>> Rishi Agarwal
>
>
>
> Dear Rishi,
> why you want to learn graphics in DOS ? Why not learn graphics
> which works cross platform ? standard ..
>
> Here are few options.
>
> Use DevCPP and Learn Open GL
> OpenGL is heavy, you can learn GTL http://www.nigels.com/glt/
>
>
> Other 2D graphics APIs
>
> cairo � a cross platform graphical vectorial draw and text
> toolkit.
> GTK+ � a cross platform graphical widget toolkit.
> Java 2D � a cross platform API for drawing two-dimensional
> graphics.
> Qt � a cross platform graphical widget toolkit.
> wxWidgets � a cross platform graphical widget toolkit.
> Asymptote Vector Graphics Language � a script driven, LaTex

> compatible, language for high quality sketches, graphs, diagrams,
> geometry and typesetting with output in PostScript, PDF, SVG, and 3D
> PRC.
>
>
>
> Must read discussion - http://stackoverflow.com/questions/1924171/simple-c-graphics-library
>

What about those bloody fucking exams?
I was just about to ask this graphics question here because I have
installed Ubuntu 11.10 on a non-geek friend's old P4. He's doing just C
now, and next semester we have C++ with graphics.h

--
Nilesh Govindarajan
http://nileshgr.com

Nalin Savara

unread,
Oct 16, 2011, 1:24:54 PM10/16/11
to iit...@googlegroups.com
On Sun, Oct 16, 2011 at 10:47 PM, Rishi Agarwal <rishia...@gmail.com> wrote:
> @Narendra
> I know OpenGL but actually in my assignment I have to use ROM BIOS
> functions. To invoke this functions I have to use interrupt and
> registers available in 8086. These functions can be used in windows by
> including dos.h. I want to know that is there something similar in
> Linux.
>
> @Tavish
> I included these files but it doesn't recognize "int86" & "REGS"
> function that I use in windows. Any idea, what can be used at their
> place?
>
@Rishi:

unix-like operating systems are written 95% in c and only 5% in
assembler-- for original unix-- and talking directly to hardware- as
well as lack of portability-- is discouraged as part of unix's design
philosophy.

So, while logically you could use assembler-- compile it to a .o
file-- and link with your c code into a executable-- using assembler
is not the preferred way of doing this under unix.

I suggest that for your assignment-- use turbo-c/c++ ---> in dos-box
if not in dos/windows-- and get the assignment done-- and understand
the concepts.

Personally I believe that apart from talking of turbo-c versus gcc--
you (Rishi) need to dig deeper into understanding the architectural
concepts of systems and also about operating systems-- so that the
answers of this question will be self obvious.

I hope this helps.

Best Regards,

Nalin

Tavish Naruka

unread,
Oct 16, 2011, 2:02:08 PM10/16/11
to iit...@googlegroups.com
@Tavish
I included these files but it doesn't recognize "int86" & "REGS"
function that I use in windows. Any idea, what can be used at their
place?


If you wanted to just control the mouse pointer or take input from it, Xlib should suffice. Maybe you don't need 'int86' and 'REGS'.

--
 Tavish Naruka

Rishi Agarwal

unread,
Oct 16, 2011, 2:13:24 PM10/16/11
to iit...@googlegroups.com
@Nalin
Yeah, I guess I will get done by assignment first then afterwards find
out how to do this in Linux.
Thanks for you insight.
@Tavish
Yup, I will refer to Xlib's documentation to find functions as per my
need. Thanx for you suggestion.

Vijeenrosh PW Vijeen

unread,
Oct 16, 2011, 2:39:33 PM10/16/11
to iit...@googlegroups.com

Hi,

  You cant expect linux to simply give you permissions to access pheriperals and other stuffs.
   windows being 32-bit real mode OS allows all such stuffs and allows you to controll mouse , and play around with
   Interrupt Vector Table etc .. with an header file dos.h( with union REGS etc,  I was an mad  TSR writter long back )

   linux being protected mode OS , kernel controlls all those things and direct access to IVTs and other peripherals are not allowed.
  hence no such  header file named   "dos.h",

  and if your aim is to do some GUI programming there is gtk libraries , python libraries like wxpython and pyqt etc , and controlling mouse and al such options are in it
 
--
Vijeenrosh P.W
CSE S3
blog :  www.BlackJackVijeen.blogspot.com



Debasish Ray Chawdhuri

unread,
Oct 17, 2011, 12:24:27 AM10/17/11
to iit...@googlegroups.com

After all, is called dos.h

Nilesh Govindarajan

unread,
Oct 17, 2011, 7:22:56 AM10/17/11
to iit...@googlegroups.com
On Mon 17 Oct 2011 09:54:27 AM IST, Debasish Ray Chawdhuri wrote:
> After all, is called dos.h
>
> --
> Mailing list guidelines and other related articles:
> http://lug-iitd.org/Footer

Apparently you people have got some solution. Which Linux-library has
an API similar to that offerred by TurboC's graphics.h?
I can do with alternatvies, but my friend is not much geeky and also
doesn't have internet, so no research work is possible.
Something close to substitution will be appreciated. This should not
become a reason to reformat the disk on that poor old P4 and install
bullshit Windows Xp.

Mohit Singh

unread,
Oct 17, 2011, 9:49:32 AM10/17/11
to iit...@googlegroups.com
'Mee Turbo C++ Na Ahe'
-----------------------------------

The Board of studies must be given a wakeup call.

If they are using 'Hearn and Baker' for graphics, kindly tell them that the same book has OpenGL version too.

Somebody someday has to stand and speak aloud that the dark ages of DOS have gone and Indian academicians should come out of this 1991 TURBO Shell NOW.

Turbo C++ Compiler! Pirated Version of 1991 everywhere! Even Windows 7 users ask for DOSBOX as they have to run C. Next time when Anna Hazare starts fasting, we must go there with caps of 'Mee Turbo C++ Na Ahe'


Mohit Singh

Debasish Ray Chawdhuri

unread,
Oct 17, 2011, 10:30:37 AM10/17/11
to iit...@googlegroups.com

--
Mailing list guidelines and other related articles: http://lug-iitd.org/Footer

+1
Besides, if you are not "not much geeky", there is no point of learning C. IMHO

--
Debasish Ray Chawdhuri
http://www.geekyarticles.com/
[A collection of advanced articles on java]

Narendra Sisodiya

unread,
Oct 17, 2011, 11:54:29 AM10/17/11
to iit...@googlegroups.com
On Mon, Oct 17, 2011 at 4:52 PM, Nilesh Govindarajan <con...@nileshgr.com> wrote:
On Mon 17 Oct 2011 09:54:27 AM IST, Debasish Ray Chawdhuri wrote:
> After all, is called dos.h
>
> --
> Mailing list guidelines and other related articles:
> http://lug-iitd.org/Footer

Apparently you people have got some solution. Which Linux-library has
an API similar to that offerred by TurboC's graphics.h?
I can do with alternatvies, but my friend is not much geeky and also
doesn't have internet, so no research work is possible.
Something close to substitution will be appreciated.

OpenGL Wrapper can be Written to emulate partially graphics.h. You start, I will support !!
 
This should not
become a reason to reformat the disk on that poor old P4 and install
bullshit Windows Xp.

--
Nilesh Govindarajan
http://nileshgr.com

--
Mailing list guidelines and other related articles: http://lug-iitd.org/Footer



--
┌─────────────────────────┐
│    Narendra Sisodiya
│    http://narendrasisodiya.com
└─────────────────────────┘
Reply all
Reply to author
Forward
0 new messages