Rebooting Program Troubleshoot In "c"

Status
Not open for further replies.

Rick

Valued Senior Member
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.
 
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).
 
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:
 
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.
 
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.
 
MAYA

does anyone know about MAYA language,i heard it was used for programming classic games like QUAKE-3,is that correct?
 
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. ;)
 
Status
Not open for further replies.
Back
Top