PDA

View Full Version : Rebooting Program Troubleshoot In "c"


Rick
11-05-01, 08:00 AM
CONSIDER THIS PROGRAM:
#include<stdio.h>
#include<conio.h>
#include"dos.h"
#include<bios.h>
void main()
{
void far (*p)();
p=0xFFFF0000;
(*p)();
}
in the above program when i try to compile this with turbo c ver 3.0 it gives error message initially,after closing the turbo compiler and opening it again,the program runs,but never does anything!!!hangs down,DOS error come where it says that this program has performed an illegal operation.NOTE:THIS IS A PROGRAM which calls ROM-BIOS routine no 1,which it performs during booting process,so the address simply tries to access the bios routine itself.

daktaklakpak
11-13-01, 05:30 PM
If you run it inside a windows box, it will be an illegal operation. If you run it inside the turbo C editor, it will be an illegal operation.

Try compile it and run it from a clean dos prompt(no windows box please).

Rick
11-14-01, 12:36 AM
Hi everyone,

thanks Bowser for those great links:),it did help me.however Dak you have solved my problem as it works fine on clean dos prompt,but i dont know whats wrong?why doesnt it work on windows?:confused:

wet1
11-14-01, 02:06 AM
A link to dos through Windows uses a lot of memory and resources in the background. Most dos based programs are memory hungry and want a lot of it and a clear running field so to say. Windows allocates memory and this is not compatable with most dos programs. Some will work but not usually ones that demand the resources and are a hog about it.

Porfiry
11-14-01, 12:42 PM
C++ is a kludge of a language. So is Java. The only language/environment I've ever found pleasurable to use is Objective-C alongside the Cocoa/OpenStep/GNUstep APIs.

Rick
11-15-01, 08:01 AM
does anyone know about MAYA language,i heard it was used for programming classic games like QUAKE-3,is that correct?

daktaklakpak
11-16-01, 02:31 PM
Originally posted by zion
Hi everyone,

thanks Bowser for those great links:),it did help me.however Dak you have solved my problem as it works fine on clean dos prompt,but i dont know whats wrong?why doesnt it work on windows?:confused:

Any advanced OS needs some way to protect itself from bad codes. In this case, windows created a memory access protection on the address around the boot code in BIOS. So any direct access will cause an illegal operation. Windows doesn't like to be rebooted just by any body making a BIOS call. ;)