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;
} 25 4263
not "dev". It was huge :)
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.
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.
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
jacob
Thanks for your reply;
jacob navia wrote:
Get a better compiler
Dev C++ couldn't compile the same code that I used with TC. The errors
were like this;
C:\Tc\BIN\KARAK TER.CPP:4: error: expected init-declarator before '*'
token
C:\Tc\BIN\KARAK TER.CPP:4: error: expected `,' or `;' before '*' token
C:\Tc\BIN\KARAK TER.CPP: In function `void _writec(int, int, int)':
C:\Tc\BIN\KARAK TER.CPP:9: error: expected primary-expression before
"char"
C:\Tc\BIN\KARAK TER.CPP:9: error: expected `;' before "char"
C:\Tc\BIN\KARAK TER.CPP:10: error: `scrp' undeclared (first use this
function)
C:\Tc\BIN\KARAK TER.CPP:10: error: (Each undeclared identifier is
reported only once for each function it appears in.)
I couldn't understand why TC compiled and why dev c++ not...
So, I think I should try more interesting methods for drawing. :p
OziRus wrote:
Thanks for your reply;
jacob navia wrote:
>Get a better compiler
Dev C++ couldn't compile the same code that I used with TC. The errors
were like this;
C:\Tc\BIN\KARAK TER.CPP:4: error: expected init-declarator before '*'
token
C:\Tc\BIN\KARAK TER.CPP:4: error: expected `,' or `;' before '*' token
C:\Tc\BIN\KARAK TER.CPP: In function `void _writec(int, int, int)':
C:\Tc\BIN\KARAK TER.CPP:9: error: expected primary-expression before
"char"
C:\Tc\BIN\KARAK TER.CPP:9: error: expected `;' before "char"
C:\Tc\BIN\KARAK TER.CPP:10: error: `scrp' undeclared (first use this
function)
C:\Tc\BIN\KARAK TER.CPP:10: error: (Each undeclared identifier is
reported only once for each function it appears in.)
I couldn't understand why TC compiled and why dev c++ not...
So, I think I should try more interesting methods for drawing. :p
I repeat:
You can't move characters and show characters in the screen by
assigning the characters to some pointer as you do now.
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.
If you want to stay under windows xp there is a compatibility
library for turbo c console I/O with lcc-win32 called
tcconio.lib
You have there functions like "highvideo" "clrscr" and similar
functions, all of them with the same interface that turbo C
used for text mode.
You can download the lcc-win32 compiler from http://www.cs.virginia.edu/~lcc-win32
Note that lcc-win32 will NOT compile the above code
either. You will have to change your functions to:
gotoxy() and puttextA() or similar functions
jacob
Op Sun, 03 Sep 2006 20:06:15 +0200 schreef jacob navia:
The MSDOS emulation will NOT emulate the writing to screen memory,
as it seems.
But surprisingly it DOES, even under XP. If that gives consoloation ;-)
--
Coos
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>
--
Coos
OziRus wrote:
>
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'd be far better off asking in a group which discusses programming
on MS Windows. comp.lang.c concentrates on the C language itself, and
its aspects and uses which are independent of the system it's running
on. Your program is very dependent on the environment you're using -
for example <conio,his not part of C as such. C itself doesn't have
any concept of a screen, and mechanisms you use to control a screen (on
systems which have one) are different on different Operating Systems.
You'll find far more people who are expert on writing programs specific
to MS operating systems in the newsgroups which are dedicated to the
subject.
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.
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.
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.
For further discussion on this please go to a Windows group where they
will know all about the compatibility modes of XP.
--
Flash Gordon
--
Flash Gordon
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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");
|
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 |
|
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...
|
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
|
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.
| |
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)
|
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...
|
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
|
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.
|
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...
|
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...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |