Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
;============kernel_start.asm file
[BITS 32]
[global start]
[extern _k_main] ; this is in the c file
start:
call _k_main
cli ; stop interrupts
hlt ; halt the CPU
;============kernel.c file
#define WHITE_TXT 0x07 // white on black text
void k_clear_screen();
unsigned int k_printf(char *message, unsigned int line);
void update_cursor(int row, int col);
k_main() // like main in a normal C program
{
k_clear_screen();
k_printf("Hi!\nWelcome to Andaman", 0);
};
void k_clear_screen() // clear the entire text screen
{
char *vidmem = (char *) 0xb8000;
unsigned int i=0;
while(i < (80*25*2))
{
vidmem[i]=' ';
i++;
vidmem[i]=WHITE_TXT;
i++;
};
};
unsigned int k_printf(char *message, unsigned int line) // the message and then the line #
{
char *vidmem = (char *) 0xb8000;
unsigned int i=0;
i=(line*80*2);
while(*message!=0)
{
if(*message=='\n') // check for a new line
{
line++;
i=(line*80*2);
*message++;
} else {
vidmem[i]=*message;
*message++;
i++;
vidmem[i]=WHITE_TXT;
i++;
};
};
return(1);
};
This is in the DJGPP installation instructions. You need to set the environment variable DJGPP to [YourDJGPPInstallPath]\djgpp.env. The DJGPP install path also needs to be added to your PATH environment variable.
And before someone else gets there - you may find that you hit some stubmling blocks later and would like to create a GCC Cross-Compiler
* For Windows 2000 or Windows XP systems:
- Right-click "My Computer", then select "Properties";
- Select the "Advanced" tab, then click "Environment Variables" button;
- Edit the PATH system variable to add the DJGPP bin subdirectory;
(if you are not an administrator, add the DJGPP bin directory to
the user PATH variable - or create one with only this directory
since it is added to the system path);
- Add a new variable DJGPP and set its value to the full path
name of the DJGPP.ENV file as explained below.
DJGPP Installation Page wrote:When properly installed, you should have a c:\djgpp\bin directory, and in it should be at least gcc.exe, as.exe, and stubify.exe. If all the files are in c:\djgpp with no subdirectories, or you see directories like c:\djgpp\djdev203\, you need to delete everything and try a different unzip program.
Make sure you use the djgpp's unzip32, or some other unzip that doesn't support long file names. If you install with WinNT long file names, C++ programs won't compile. Another option is to use pkunzip instead (see the MS-DOS install instructions) or read the FAQ about the NameNumericTail registry key.
Right-click My Computer, select Properties. Select the Advanced tab, then the Environment Variables button. Edit the Path (or PATH, whichever exists) system variable to include C:\DJGPP\BIN at the front. (If you are not an administrator, add it to the PATH variable in the User Variables section, or add a new PATH user environment variable which contains only C:\DJGPP\BIN) Add a new variable DJGPP set to C:\DJGPP\DJGPP.ENV (system variable if possible, user variable if not an administrator) .
You'll need to close and reopen your MS-DOS windows for these changes to take effect.
Rather than edit your autoexec files and/or global environment, you may wish to create a djgpp shortcut instead. To do this, create a c:\djgpp\djgpp.bat that has lines like this:
@echo off
set PATH=c:\djgpp\bin;%PATH%
set DJGPP=c:\djgpp\djgpp.env
chdir c:\djgpp\mystuff (or any other directory)
command
(you can replace that last line with any other shell you'd like)
It complains about your code, rather than the installation procedure
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
// no newline at the end here
#endif#ifndef header2
#define header2
...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]