473,804 Members | 3,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Screen control functions

Hi,

This is my first message on this group. I want to ask something about
screen-drawing functions. I wrote and compiled below code succesfully
on TC IDE in Win-xp. Then i tried to work it on dos but it didn't work.
It runs but doesn't draw anything on screen. Could you say my fault? I
know far,dev and near are a bit problematic in xp but i think compiling
with Tc and running in dos might run it? [I didn't try it on linux yet]

Thanks for everything...

#include <stdio.h>
#include <conio.h>

char far *vp=(char far *)0xB0000000;
void _write(int row,int col,int ch)
{
char far *scrp=vp;
scrp+=row*160+c ol*2;
*scrp=ch;
}

int main()
{
_write(10,10,'t ');
_write(10,11,'e ');
_write(10,12,'s ');
_write(10,13,'t ');
return 0;
}

Sep 3 '06
25 4265
jacob navia wrote:
OziRus wrote:
>Hi,

This is my first message on this group. I want to ask something about
screen-drawing functions. I wrote and compiled below code succesfully
on TC IDE in Win-xp. Then i tried to work it on dos but it didn't work.
It runs but doesn't draw anything on screen. Could you say my fault? I
know far,dev and near are a bit problematic in xp but i think compiling
with Tc and running in dos might run it? [I didn't try it on linux yet]

Thanks for everything...

#include <stdio.h>
#include <conio.h>

char far *vp=(char far *)0xB0000000;
void _write(int row,int col,int ch)
{
char far *scrp=vp;
scrp+=row*160+c ol*2;
*scrp=ch;
}

int main()
{
_write(10,10,'t ');
_write(10,11,'e ');
_write(10,12,'s ');
_write(10,13,'t ');
return 0;
}

You have to run under MSDOS, not windows XP.
Why would that be?
Contrary to what *many* people think, MSDOS is dead since more than 10
years, I do not remember exactly when was it, maybe 1995.
May it RIP.
Contrary to what many people think, the "DOS WINDOW" is just
an EMULATION of text mode msdos, with the same commands,
etc.
No it isn't. The "Command Prompt" is the CLI of either or both of
'command.com' or 'cmd.exe' under Windows 2K and/or Windows XP.
The MSDOS emulation will NOT emulate the writing to screen memory,
as it seems.

Maybe a better idea would be to use the console mode with a 32 bit
compiler, and obtain the same result.

So, you have two solutions:

1) Get a better compiler
2) Get MSDOS and run under msdos by booting from a disquette.
You will get many advantages:
Only 640K of memory. No more problems with that huge amount
of RAM that you do not know what to do about
TC IDE will run better and all dos programs will work.

The choice is yours
Of course it is. But I find the NTVDM under 2K and XP to be functional
for my purposes. The idea of a DOS boot diskette is just too brutal.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Sep 3 '06 #11
"OziRus" <ca************ @gmail.comwrote in message
news:11******** *************@h 48g2000cwc.goog legroups.com...

This might better be asked in comp.os.msdos.p rogrammer or a windows group.

But...
I know far,dev and near are a bit problematic in xp but i think
compiling with Tc and running in dos might run it?
It should work under a Command Line session (often called a "DOS session")
under XP.

But...
char far *vp=(char far *)0xB0000000;
B0000000 is the Monochrome Display Adapter (MDA) base address.

Some color adapters will emulate the MDA, but most won't. Of the those I've
used, only one (see below).

If you're runing this under Windows, it's going to think it's got a color
adapter of some kind*, so you need B8000000.

I've just compiled your program, as a real mode DOS .EXE, and run it under
MS-DOS 5.0, Windows ME and Windows XP. With B0000000 it only works on the
MS-DOS machine. This one explicitly emulates MDA (as per comment above). If I
use B8000000 it works as expected under all three.

- Bill
____________
* Your display adapter probably has to emulate the Color Graphics Adapter (CGA)
for this to work. The majority of adapters do or, at least, did last time I
shopped around (about six months back).
Sep 3 '06 #12
Joe Wright wrote:
jacob navia wrote:
>OziRus wrote:
>>Hi,

This is my first message on this group. I want to ask something about
screen-drawing functions. I wrote and compiled below code succesfully
on TC IDE in Win-xp. Then i tried to work it on dos but it didn't work.
It runs but doesn't draw anything on screen. Could you say my fault? I
know far,dev and near are a bit problematic in xp but i think compiling
with Tc and running in dos might run it? [I didn't try it on linux yet]

Thanks for everything...

#include <stdio.h>
#include <conio.h>

char far *vp=(char far *)0xB0000000;
void _write(int row,int col,int ch)
{
char far *scrp=vp;
scrp+=row*160+c ol*2;
*scrp=ch;
}

int main()
{
_write(10,10,'t ');
_write(10,11,'e ');
_write(10,12,'s ');
_write(10,13,'t ');
return 0;
}

You have to run under MSDOS, not windows XP.
Why would that be?
>Contrary to what *many* people think, MSDOS is dead since more than 10
years, I do not remember exactly when was it, maybe 1995.
May it RIP.
>Contrary to what many people think, the "DOS WINDOW" is just
an EMULATION of text mode msdos, with the same commands,
etc.
No it isn't. The "Command Prompt" is the CLI of either or both of
'command.com' or 'cmd.exe' under Windows 2K and/or Windows XP.
Yes, that is a better description. But you will agree that this "cli"
has commands like

DIR

that remember me an older system. In that sense it is an emulation of a
previous environment.
>
>The MSDOS emulation will NOT emulate the writing to screen memory,
as it seems.

Maybe a better idea would be to use the console mode with a 32 bit
compiler, and obtain the same result.

So, you have two solutions:

1) Get a better compiler
2) Get MSDOS and run under msdos by booting from a disquette.
You will get many advantages:
Only 640K of memory. No more problems with that huge amount
of RAM that you do not know what to do about
TC IDE will run better and all dos programs will work.

The choice is yours


Of course it is. But I find the NTVDM under 2K and XP to be functional
for my purposes. The idea of a DOS boot diskette is just too brutal.
<OT>

Why?

Digital research and MAXTOR offer an MSDOS disquette that when
you boot it will test the hard disk. Cute isn't it?

Besides MSDOS under emulation will never be exactly like
the true MSDOS.
Sep 3 '06 #13
Flash Gordon wrote:
jacob navia wrote:

<snip>
>Contrary to what *many* people think, MSDOS is dead since more than 10
years, I do not remember exactly when was it, maybe 1995.


Incorrect. Windows95, Windows98 and even WindowsME actually had DOS 7.x
underneath and in all of them (although with ME it was difficult) you
could get them to boot to a DOS prompt without loading Windows at all.
True, but not under windows xp, the system the OP said he
was using.
In addition, you still get some stuff distributed as bootable DOS disk
images. Such as BIOS upgrades. Since this has been the case on some new
machines even after the year 2000 there are obviously still some
programs being run under DOS.
True. I used one yesterday from MAXTOR. It boots
MSDOS (Digital Research) and tests your MAXTOR hard drive.

>Contrary to what many people think, the "DOS WINDOW" is just
an EMULATION of text mode msdos, with the same commands,
etc.


True.
>The MSDOS emulation will NOT emulate the writing to screen memory,
as it seems.


<snip>

Definitely not entirely true. I've run old DOS based games that did
graphics and sound using their own built in drivers under XP. It might
not really access the screen, but XP traps the attempt (when used in the
correct way) and renders the expected result inside the applications
window.

Yes, you can change the emulator behavior with the "shortcut properties"
if I remember correctly, and maybe it emulates that hacks too.
For further discussion on this please go to a Windows group where they
will know all about the compatibility modes of XP.
AHHHH

Nostalgia is not what it used to be ...

:-)
Sep 3 '06 #14
William J. Leary Jr. wrote:
"OziRus" <ca************ @gmail.comwrote in message
news:11******** *************@h 48g2000cwc.goog legroups.com...

This might better be asked in comp.os.msdos.p rogrammer or a windows group.

But...

>>I know far,dev and near are a bit problematic in xp but i think
compiling with Tc and running in dos might run it?


It should work under a Command Line session (often called a "DOS session")
under XP.

But...

>>char far *vp=(char far *)0xB0000000;


B0000000 is the Monochrome Display Adapter (MDA) base address.

Some color adapters will emulate the MDA, but most won't. Of the those I've
used, only one (see below).

If you're runing this under Windows, it's going to think it's got a color
adapter of some kind*, so you need B8000000.

I've just compiled your program, as a real mode DOS .EXE, and run it under
MS-DOS 5.0, Windows ME and Windows XP. With B0000000 it only works on the
MS-DOS machine. This one explicitly emulates MDA (as per comment above). If I
use B8000000 it works as expected under all three.

- Bill
____________
* Your display adapter probably has to emulate the Color Graphics Adapter (CGA)
for this to work. The majority of adapters do or, at least, did last time I
shopped around (about six months back).

Bill (Your second names isn't Gates I presume ? :-)

You are a TRUE MSDOS HACKER (tm)

This is actually the reason!!!!

Congratulations Bill.

jacob
Sep 3 '06 #15
OziRus wrote:
Hi,

This is my first message on this group. I want to ask something about
screen-drawing functions.
To do screen drawing you need things beyond standard C. So you would be
best off asking in a group dedicated to your platform.
I wrote and compiled below code succesfully
on TC IDE in Win-xp. Then i tried to work it on dos but it didn't work.
When you go to a Windows group you should be more explicit. Tell them
which version of TC etc. They will probably tell you to upgrade to a
more recent version that actually has proper support for XP.
It runs but doesn't draw anything on screen. Could you say my fault? I
know far,dev and near are a bit problematic in xp but i think compiling
far and near are nothing to do with C. They are extensions that some
compilers used to provide.
with Tc and running in dos might run it? [I didn't try it on linux yet]
No chance of it working in Linux unless you run it under a DOS emulator.
Thanks for everything...

#include <stdio.h>
#include <conio.h>
Non-standard header. However, it (and the library that go with it) might
provide some of the facility you want.
char far *vp=(char far *)0xB0000000;
far, as I say, is not part of the C language. In any case, there is no
guarantee your screen (or emulated screen in DOS compatibility mode on
XP is at that location. IIRC the location depended to an extent on the
type of graphics card, CGA, EGA and VGA being at different locations. I
could be wrong. Ask on a DOS group.
void _write(int row,int col,int ch)
Don't use names starting with an underscore. There are some you can use
in some conditions but it is not worth the effort of remembering what
you are allowed to do, far simpler to just avoid them.

<snip>
--
Flash Gordon
Sep 3 '06 #16
Op Sun, 03 Sep 2006 23:14:09 +0200 schreef jacob navia:
Coos Haak wrote:
>Op Sun, 03 Sep 2006 20:38:15 +0200 schreef jacob navia:

>>>In MSDOS, the machine looked at that address to show the 80x24
video display (if I remember correctly).

This is NO LONGER THE CASE unless you still run MSDOS.

Then, you can't compile and RUN that.


<OT>
I've used TC 2.01 some time ago and it works with W98 and XP. Don't tell us
nonsense.
</OT>

You mean you write into 0xB0000000 and you see the characters
in the screen ???

That would be highly surprising, specially under windows xp
<OT>
I would not do that, but writing to 0xB800:0000 still has effect.
Mind you, TC is a 16 bit application. It can't write to a 32 bit long
address.
</OT>
--
Coos
Sep 3 '06 #17
"jacob navia" <ja***@jacob.re mcomp.frwrote in message
news:44******** *************** @news.orange.fr ...
William J. Leary Jr. wrote:
I've just compiled your program, as a real mode DOS .EXE, and run it under
MS-DOS 5.0, Windows ME and Windows XP. With B0000000 it only works on the
MS-DOS machine. This one explicitly emulates MDA (as per comment above).
If I
use B8000000 it works as expected under all three.

Bill (Your second names isn't Gates I presume ? :-)
No. "Junior" was born two days after me.
You are a TRUE MSDOS HACKER (tm)
I did a great deal of CP/M and MS-DOS programming. A lot of it direct to
hardware, mostly in K&R C and assembler. Still do some MS-DOS stuff, but in
(almost)ANSI-C and Oberon these days.
This is actually the reason!!!!

Congratulations Bill.
Thanks.

- Bill
Sep 3 '06 #18
"OziRus" <ca************ @gmail.comwrite s:
This is my first message on this group. I want to ask something about
screen-drawing functions. I wrote and compiled below code succesfully
on TC IDE in Win-xp. Then i tried to work it on dos but it didn't work.
It runs but doesn't draw anything on screen. Could you say my fault? I
know far,dev and near are a bit problematic in xp but i think compiling
with Tc and running in dos might run it? [I didn't try it on linux yet]

Thanks for everything...

#include <stdio.h>
#include <conio.h>

char far *vp=(char far *)0xB0000000;
void _write(int row,int col,int ch)
{
char far *scrp=vp;
scrp+=row*160+c ol*2;
*scrp=ch;
}

int main()
{
_write(10,10,'t ');
_write(10,11,'e ');
_write(10,12,'s ');
_write(10,13,'t ');
return 0;
}
Apart from the system-specificity of your code, it's a bad idea to use
identifiers starting with an underscore:

All identifiers that begin with an underscore and either an
uppercase letter or another underscore are always reserved for any
use.

All identifiers that begin with an underscore are always reserved
for use as identifiers with file scope in both the ordinary and
tag name spaces.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 3 '06 #19
jacob navia <ja***@jacob.re mcomp.frwrites:
[snip]
You have to run under MSDOS, not windows XP.

Contrary to what *many* people think, MSDOS is dead since more than 10
years, I do not remember exactly when was it, maybe 1995.

Contrary to what many people think, the "DOS WINDOW" is just
an EMULATION of text mode msdos, with the same commands,
etc.
[snip]

Contrary to what jacob navia seems to think, this newsgroup discusses
the C programming language, not MSDOS or Windows.

There are plenty of newsgroups that do discuss those operating
systems. The OP's question, and jacob's answer, would be appropriate
in one of them.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 3 '06 #20

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

Similar topics

19
105845
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method: System.out.print((char)27 + "[2J");
8
1633
by: Kris Dugan | last post by:
I am using a Unix/Solaris 8/9 environment. I want to make a tool that will constantly read a structure of information and display that information (or "paint it") to the screen. Rather than having the information scroll by, I want a way in which the screen would be "repainted". Sample Screen: ------------------------------------------------- | foo: 6 bar: 12 | | this: 18 that: 20 |
4
4536
by: Curious Student | last post by:
I was looking at methods of clearing the screen. I remember using clrscr() in C on a Unix machine when I was at the institute learning software development. I tried using it on MS VC++ 6.0. It didn't work. I looked up the documentation. The documentation said this is a non-standard function and is included in conio.h. I had included conio.h already, and yet it couldn't link. I guess clrscr is a unix thing then? I also found this code in...
2
4579
by: Dan Sikorsky | last post by:
How do you get the x,y pixel location of a textbox so that you can position the Web Date Control popup nearby the associated textbox that will contain the date selected by the Web Date Control? -- Thank you kindly, Dan Sikorsky BAB, BScE, MSC
3
5418
by: steve | last post by:
Hi All I have textboxes within a TableLayoutpanel and I want to be able to position an independant control adjacent to a selected textbox This independent control allows selection of text to insert into the textbox I am having trouble achieving this, see code below, the x position is too far to the right and the y position is close to the bottom of the textbox and I want it to be side by side.
2
6626
by: dumbledad | last post by:
Hi All, I'm using ASP.Net web services to provide the logic required for a Flash based prototype. The Flash and the ASP .Net run together on the client machine. One of the functions I'd like to offer is public void StoreLogEntry(string tag, string description, bool screenshotRequired)
3
1433
by: peter | last post by:
I've been wrestling on and off with this problem for over a year now, without success. Basically, I am looking for a simple set of screen and keyboard manipulation commands that will run identically under Linux and Windows. Nothing fancy - just clear the screen, print a string at an arbitrary xy position and detect a keystroke. I've googled around this newsgroup and elsewhere, and come across various suggestions (and even posted my own...
5
1243
by: pilsdumps | last post by:
I have a parent and child class: parent: #!/usr/local/bin/perl -w #class clFormMaker package clFormMaker; sub new { #constructor
4
6979
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I just gotta fix it. I need to make some calculations on the measurements and VB6 is my language. Yes, the system mouse will corrupt the measurement, but it's an auditing function and that's acceptable.
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10577
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10077
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9150
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.