Import backup from 2004-02-11
This commit is contained in:
parent
311b8afc83
commit
2cd08dee70
64
Functions.c
64
Functions.c
@ -45,6 +45,37 @@ char *strcat(char *dest, char *src)
|
||||
}
|
||||
|
||||
|
||||
//Splits a string into multiple strings by turning all characters
|
||||
// equal to delim into null values (string termination character)
|
||||
//Returns the number of strings after the split, 1 if no delim chars
|
||||
int string_split(char *str, char delim)
|
||||
{
|
||||
if (strlen(str) < 1)
|
||||
return 0; //empty string
|
||||
int count = 1;
|
||||
for (; *str; str++)
|
||||
{
|
||||
if (*str == delim)
|
||||
{
|
||||
count++;
|
||||
*str = 0;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
//Advances a char pointer to the byte after the current string's
|
||||
// null-terminating character
|
||||
//Useful after calling string_split()
|
||||
//Returns a pointer to the following string
|
||||
char *string_advance(char *str)
|
||||
{
|
||||
for (; *str; str++);
|
||||
return str+1;
|
||||
}
|
||||
|
||||
|
||||
//converts a binary-coded-decimal byte to its decimal equivalent
|
||||
inline byte bcd2byte(byte bcd)
|
||||
{
|
||||
@ -268,6 +299,39 @@ void rtc_setHour(byte hour)
|
||||
}
|
||||
|
||||
|
||||
//Returns the cmos type of floppy disk drive 0 (0 = not present)
|
||||
byte cmos_getfd0()
|
||||
{
|
||||
outportb(0x70, 0x10);
|
||||
return (inportb(0x71) >> 4);
|
||||
}
|
||||
|
||||
|
||||
//Returns the cmos type of floppy disk drive 1 (0 = not present)
|
||||
byte cmos_getfd1()
|
||||
{
|
||||
outportb(0x70, 0x10);
|
||||
return (inportb(0x71) & 0x0F);
|
||||
}
|
||||
|
||||
|
||||
//Returns the cmos type of hard disk drive 0 (0 = not present)
|
||||
byte cmos_gethd0()
|
||||
{
|
||||
outportb(0x70, 0x12);
|
||||
return (inportb(0x71) >> 4);
|
||||
}
|
||||
|
||||
|
||||
//Returns the cmos type of hard disk drive 1 (0 = not present)
|
||||
byte cmos_gethd1()
|
||||
{
|
||||
outportb(0x70, 0x12);
|
||||
return (inportb(0x71) & 0x0F);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -22,6 +22,8 @@ inline void eoi2();
|
||||
inline dword kernel_size();
|
||||
inline void init_timer();
|
||||
char *strcat(char *dest, char *src);
|
||||
int string_split(char *str, char delim);
|
||||
char *string_advance(char *str);
|
||||
void rtrim(char *str);
|
||||
char *ucase(char *str);
|
||||
char *lcase(char *str);
|
||||
@ -39,6 +41,10 @@ void rtc_setYear(byte year);
|
||||
void rtc_setSecond(byte second);
|
||||
void rtc_setMinute(byte minute);
|
||||
void rtc_setHour(byte hour);
|
||||
byte cmos_getfd0();
|
||||
byte cmos_getfd1();
|
||||
byte cmos_gethd0();
|
||||
byte cmos_gethd1();
|
||||
|
||||
|
||||
|
||||
|
6
idt.inc
6
idt.inc
@ -94,10 +94,16 @@ isr_syscall:
|
||||
push ds
|
||||
push es
|
||||
|
||||
sc1:
|
||||
cmp eax, 1 ;syscall 1 - putc
|
||||
jnz sc2
|
||||
push ebx
|
||||
call _putc
|
||||
add esp, 4
|
||||
jmp scdone
|
||||
sc2:
|
||||
|
||||
scdone:
|
||||
pop es
|
||||
pop ds
|
||||
popa
|
||||
|
3
kernel.c
3
kernel.c
@ -75,7 +75,7 @@ void k_init()
|
||||
{
|
||||
int p = video_mode.XResolution*video_mode.YResolution-1;
|
||||
for (; p >= 0; p--)
|
||||
video_psetp(p, 0x00000044);
|
||||
video_psetp(p, 0x00000077);
|
||||
video_drawConsole();
|
||||
}
|
||||
|
||||
@ -85,7 +85,6 @@ void k_init()
|
||||
printf("%d/%d/%d\t%d:%d:%d\n", rtc_readMonth(), rtc_readDay(), rtc_readYear(), rtc_readHour(), rtc_readMinute(), rtc_readSecond());
|
||||
printf("Root Directory: %s/\n", rootDevice->id);
|
||||
|
||||
|
||||
/* int a;
|
||||
byte *addr = 0;
|
||||
for (a = 0; a < 5; a++)
|
||||
|
@ -853,7 +853,7 @@ puthex2_goon2:
|
||||
;------------------------------------------------------
|
||||
txt_welcome: db " Welcome to HOS v", VERSION, "! ", 0
|
||||
txt_rd1: db "1. Do not load an initial ram disk", 0
|
||||
txt_rd2: db "2. Load initial ram disk from floppy", 0
|
||||
txt_rd2: db "2. Load initial ram disk from boot media", 0
|
||||
txt_input: db "Enter your selection: ", 0
|
||||
txt_vesa: db "VESA version: ", 0
|
||||
txt_vesaerror: db "VESA function call error! Halting system!", 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user