Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a problem with the svga256.bgi and the mouse

Status
Not open for further replies.

DjJayKay

Programmer
Jan 26, 2006
11
RO
i want to use for a program in graph mode the svga256.bgi driver for borland pascal 7.0. but in the same porgram i want to use a mouse. the problem is that my program dosen't know how to draw the mouse cursor in this graphic mode. i searched the net for ansewrs and i came up with this : there is a program made by the same people who made the svga256.bgi driver named HGXMOUSE TSR and i heard that if i run this program the mouse should work perfectly. but i found this program and ran it but it still thosen't work. i've been trying to solve this problem for 2 weeks now and i don't know what to do enymore. if someone had this problem and solved it or if anyone has another way that i can use 256 colors in my program ...pleas help me. thank you!
 
BP and TP 7.0 are unreliable at best on the XP platform, especially on graphics. This is because most true DOS support has been eliminated and what is left is emulated.

If this is on the XP platform, you might seriously consider switching to something like FreePascal.

If it's not on the XP platform (95/98/Me or true DOS), then write back and we can go from there.
 
that is the problem.... it's an XP platform. is there no way i can make this work...maybe you cand tell me another method for using 256 colors ...because that is all that i need from the svga256.bgi . ia had allready made a part of the program using 256 colors before i discovered this problem
 
It may not be the fault of either WinXP or your pascal compiler.

Firstly, you didn't actually say you're using WinXP. Before WinXP there was a time when a lot of Windows installations didn't include the DOS mouse driver by default in their DOS-boxes. This was plain silly. If you haven't got a DOS mouse driver, you won't get a mouse in a DOS-type program.

If you are using WinXP I doubt this is the problem; most machines I've seen with WinXP emulate DOS perfectly - better, in fact, than their predecessors.

(silly extra, but remember that the mouse TSR that you talk about will have to be run in the same dos-box as you're using your program, whether that be for development or in final use, and it will have to be run at the begining of each dos-box session; it's not an install-and-stay-there-for-ever program)

Secondly (but this probably isn't your problem if you can do the colour stuff but just the mouse fails): If you're using sVGA, do remember that the actual sVGA modes (screen resolutions and colours) vary enormously between VGA cards, and some combinations that look quite boring and simple are actually not present on all cards. Just because a card can do 1280*1024 in true colour doesn't mean it can do 800*600 in 16 colours!

If the worst comes to the worst, you can always write your own mouse handler and graphics stuff; but I'd only recommend that if this is a hobby project for self-education or fun. It's quite a bit of work.

 
the mouse driver is installed because i used the mouse in an other program also in borland pascal 7.0 but using the egavga.bgi driver.

about the TSR ...you are saying that i should execute it evrey time i execute my program? thoese this mean i have to use the "exec" procedure in the dos unit or is there an other method

the svga256.bgi driver works very well but only in the 2nd mode this means 640 by 480 resolution and 256 colors. i used it so far in my project an besides this problem i haven't encountered enithing else.

i tried to use larger resolutions like the 3 and 4 modes of this driver but they didn't work ...my monitor flikeres(i'm not very good at writing in english and i don't know if that is corectly writen) an it shows me a message that says the frequeci is to high.

about creating my own mouse handler and graphics stuff ... i have to turn in the project by late may... if you can help me and if you think that i will finish in time i am willing to try that too.
 
(1) With the TSR, if you're running a DOS-window inside any version of Windows, when you close the DOS window, the TSR is also lost. This also applies if you've made an icon on a desktop that starts a DOS application (because it starts a DOS window for the application to run in). Therefore theoretically you don't need to run the TSR every time you run the program, on the condition that you keep a DOS-window open and run the program several times from the DOS command line. But since you very often will be opening a new DOS window for the program, I think you're right to make the TSR process automatic. However, rather than writing something into your program to start the TSR, I would write a dos-style batch-file that runs the TSR and also your program or your pascal editor. The batch file only needs to be a simple text file containing two lines, first the name of the tsr program, and then the name of the other thing you want to run, your pascal editor or your program exe file.
(2) I'm not an expert on the various svga versions of .bgi files that have been produced. If your monitor is flickering and can't handle the resolution requested it could be your monitor or it could be that the .bgi isn't optimally programmed for handling your monitor. Either way, I'd give up and limit myself to the bits that work.
(3) Similarly I'm no expert on mouse-use in .bgi files. My copy of turbo pascal, 6.0, doesn't provide any mouse functions in the graph unit, which is responisble for interacting with .bgi files, so I assumed that mouse-handling isn't provided in the .bgi files. But the mouse will still work in standard graphic modes because all mouse graphics are handled by the mouse interrupt. The problem is that the mouse interrupt can't deal with non-standard, sVGA modes, so the mouse will go weird (strange distorted shapes diagonally zipping across the screen instead of a neat pointer). [You might just get away with turning the mouse off but watching its position and drawing your own pointer as necessary]

On the whole, if you need high resolution by the end of May, you'd probably do best to buy a different, more up to date, compiler. It would be difficult to write your own mouse graphics handler for an sVGA mode from scratch, without experience of this, in the time available.
 
my borland pascal 7.0 editor has a dos sehll and i ran the TSR through thet dos shell, and i ran the program after i exited the dos shell. isn't that in the same window as the editor, shouldn't the TSR work this way?
if not then how do i create this batch file ? i haven't seen one yet.. what extension will the text file have?..where do i run this batch file from? when i wil want to run my program will i need to run the batch file?...

sorry if i bother you with all these questines but i can see that you knew what you are talking about and i haven't found anyone else who could help me... an belive me i've been searching for a long time... thanks a lot!

don't worry about the resolution becauze i have begone my program using the 640/480 mode and it's enough for now... in later versions il try a biger resolution. and the mouse is supported by my 7.0 editor the only thing that it needs is a mouse unit...witch i have plenty of from the internet.
 
Hm, I'm not as knowledgeable as all that... strictly a beginner in this direction.
I think, if your TP7.0 is similar to TP6.0, that the DOS-shell is a temporary escape into the DOS environment in which the turbo editor/compiler is operating, in which case you're probably doing the right thing. But to be sure it might be worth compiling your program to disk (i.e. make the exe file), then go to a dos window (or dos shell from the TP editor), and run the tsr, followed by the program as a compiled exe file, because then you are absolutely certain that the tsr is resident at the time the program is run.

Batch files have the file extension .bat, and are simply text files containing instructions that you could type at the dos prompt. You can write then in notepad or your pascal editor. If you want to run a tsr followed by a normal program, you just need a text file with two lines, the first containing the name of the tsr, the second the name of the program, and the whole file called something like name.bat. Then, when you type 'name' at the dos prompt, it's as though you'd typed everything in the batch file.

Yes, with 640*480 you should be fine. If you ever get interested in self-made mice, you'd need to find out about interrupt 033h, which deals with all the communication with the mouse. It also has a call where you can specify a procedure that will be called every time some mouse event occurs (and you specify a filter on what events should trigger it), for instance every time the mouse moves. You can then write your own procedure that draws a mouse pointer and use this mechanism to get it called every time the mouse moves. The process isn't trivial because the mouse might move while, for instance, your program has called DOS to do something with a file, or collect a key press from the keyboard. In this case the data segment will be that of DOS, not your program, so all your variables will be wrong... So writing the mouse drawing procedure is a bit interesting and requires some fiddling around in assembler, a process best avoided if possible.

Good luck

 
i tried the thing with the dos shell and it doesen't work. i still have to tri the batch file. but i don't think that will work eather, because logicaly it should have worked with the dos shell to ...if that is the problem. i don't know..i'll tri that to... if it doese'n work i don't know what i'll do

i know some thing in assembler ...not all ... and i have seen how some mous function look like ... but i haven't tried to create my on... first i would have to understand why that error with the svga.bgi occurs ..and then create my own procedures.... i'm even thinking about learning c++ and makeing my project in that language... but i don't think i could learn al that i need in so little time...
 
i tried the thing with the batch file
my batch file looked like this

E:\teme\temeadi\chess\hgxmouse.exe
E:\teme\temeadi\chess\chess.exe

(don't look at the folder names because they are in my language i'm romanian)
and it si named " pornire.bat "
i tried to run it with this command line
E:\teme\temeadi\chess\pornire.bat
but it doesen't work and i don't know why....
 
ok ...i made it run ....but the tsr doesn't work .... the program runs until the first mouse roteen is used and then it gives the same error as before...

i have no ideea what to do next....
 
sorry, then I'm stuck as well. If you've got a DOS-mouse driver and you've got a TSR that claims to make the mouse svga compatible but doesn't, then presumably the tsr isn't doing its job correctly, which isn't a huge surprise because even vga programming is quite tricky at the hardware level, let alone getting into sVGA stuff.

Looking on the happy side, if you're trying to write a good chess program, then the playing strength (and probably the appeal to a keen chess player) shouldn't be adversely affected by its running in 640*480 VGA graphics!

Sorry not to be able to help.
 
well i'm not that consourned about the resolution....i'm more consourned about the colors....because i have allready done a very big part of the project(mostly the interface) using 256 colors and now i have to cheange a lot of things.i allmost have to do all of the project again....

now ..about the dos-mouse driver.... i'm not quite sure that i have one... i tried installing one ...but it requires the mouse to be set up in the COM port ..but my mouse is PS/2.. so i don't know if i have such a driver installed...i know only that the driver for XP is corectly installed. could this be the problem? do you know some drivers for this?...some names maby?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top