Import backup from 2004-03-02

This commit is contained in:
Josh Holtrop 2004-03-02 22:00:00 -05:00
parent 48f4046e79
commit 0b9d7fde22
67 changed files with 3199 additions and 3080 deletions

View File

@ -1,340 +0,0 @@
//Functions.c
//05/07/03 Josh Holtrop
//for HOS
//Modified: 10/30/03
//Writes a byte out to a port
inline void outportb(unsigned int port, unsigned char value) // Output a byte to a port
{
asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
};
//Writes a word out to a port
inline void outportw(unsigned int port, unsigned int value) // Output a word to a port
{
asm volatile ("outw %%ax,%%dx"::"d" (port), "a" (value));
};
//Reads a byte from a port
inline byte inportb(unsigned short port)
{
unsigned char ret_val;
asm volatile("inb %w1,%b0"
: "=a"(ret_val)
: "d"(port));
return ret_val;
};
//Enables (SeTs) Interrupt Flag on the processor
inline void enable_ints()
{
asm("sti");
};
//Disables (CLears) Interrupt Flag on the processor
inline void disable_ints()
{
asm("cli");
};
char *strcat(char *dest, char *src)
{
strcpy(dest+strlen(dest), 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)
{
return (10* ((bcd & 0xF0) >> 4)) + (bcd & 0x0F);
}
//converts a binary-coded-decimal byte to its decimal equivalent
inline byte byte2bcd(byte bite)
{
return ((bite / 10) << 4) | (bite % 10);
}
void rtrim(char *str)
{
str += strlen(str); //now points to the null character at the end of the string
str--;
for (;;)
{
if ((*str == ' ') || (*str == '\t') || (*str == '\n'))
*str-- = 0;
else
break;
}
}
char *ucase(char *str)
{
char *ret = str;
for (;;)
{
if (*str == 0)
break;
if ((*str >= 'a') && (*str <= 'z'))
*str = (*str) - 32;
str++;
}
return ret;
}
char *lcase(char *str)
{
char *ret = str;
for (;;)
{
if (*str == 0)
break;
if ((*str >= 'A') && (*str <= 'Z'))
*str = (*str) + 32;
str++;
}
return ret;
}
//Re-maps the Programmable Interrupr Controllers so IRQ0->pic1 base address, IRG8->pic2 base address
void remap_pics(int pic1, int pic2)
{
byte a1, a2;
a1 = inportb(PIC1_DATA); //0x21
a2 = inportb(PIC2_DATA); //0xA1
outportb(PIC1_COMMAND, ICW1_INIT+ICW1_ICW4); //0x20, 0x10+0x01 00010001b
outportb(PIC2_COMMAND, ICW1_INIT+ICW1_ICW4); //0xA0, 0x10+0x01 00010001b
outportb(PIC1_DATA, pic1); //0x21, pic1
outportb(PIC2_DATA, pic2); //0xA1, pic2
outportb(PIC1_DATA, 4); //0x21, 0x04 00000100b
outportb(PIC2_DATA, 2); //0xA1, 0x02 00000010b
outportb(PIC1_DATA, ICW4_8086); //0x21, 0x01 00000001b
outportb(PIC2_DATA, ICW4_8086); //0xA1, 0x01 00000001b
outportb(PIC1_DATA, a1); //0x21
outportb(PIC2_DATA, a2); //0xA1
}
//Masks interrupts on first Programmable Interrupt Controller
inline void pic1_mask(byte mask)
{
outportb(PIC1_DATA, mask); //0x21, maskfield *OCW1*
}
//Masks interrupts on second Programmable Interrupt Controller
inline void pic2_mask(byte mask)
{
outportb(PIC2_DATA, mask); //0xA1, maskfield *OCW1*
}
//Restarts the computer
inline void restart()
{
enable_ints();
byte temp;
do
{
temp = inportb(0x64);
if (temp & 1)
inportb(0x60);
} while(temp & 2);
outportb (0x64, 0xfe);
for (;;)
{
}
}
//Halts (freezes) the computer
inline void halt()
{
asm("cli");
asm("hlt");
while (1)
;
}
//Initializes 8253 Programmable Interrupt Timer
inline void init_timer()
{
//set timer : 2e9c = 100hz
outportb(0x43, 0x34);
outportb(0x40, 0x9c); //lsb
outportb(0x40, 0x2e); //msb
}
//Signals an End Of Interrupt signal to the first PIC
inline void eoi()
{
outportb(0x20, 0x20);
}
//Signals an End Of Interrupt signal to both the second and first PIC unit
inline void eoi2()
{
outportb(0xA0, 0x20);
outportb(0x20, 0x20);
}
//Returns the size of the kernel (code & data)
// - this does not include the bss section
// - this should be 4kb aligned per the linker script
// - this should be the size of kernel.bin
inline dword kernel_size()
{
return (dword)(&_bss)-(dword)(&_code);
}
//These functions are for reading and writing various values stored on the CMOS Real Time Clock
byte rtc_readDay()
{
outportb(0x70, 7);
return bcd2byte(inportb(0x71));
}
byte rtc_readMonth()
{
outportb(0x70, 8);
return bcd2byte(inportb(0x71));
}
byte rtc_readYear()
{
outportb(0x70, 9);
return bcd2byte(inportb(0x71));
}
byte rtc_readSecond()
{
outportb(0x70, 0);
return bcd2byte(inportb(0x71));
}
byte rtc_readMinute()
{
outportb(0x70, 2);
return bcd2byte(inportb(0x71));
}
byte rtc_readHour()
{
outportb(0x70, 4);
return bcd2byte(inportb(0x71));
}
void rtc_setDay(byte day)
{
outportb(0x70, 7);
outportb(0x71, byte2bcd(day));
}
void rtc_setMonth(byte month)
{
outportb(0x70, 8);
outportb(0x71, byte2bcd(month));
}
void rtc_setYear(byte year)
{
outportb(0x70, 9);
outportb(0x71, byte2bcd(year));
}
void rtc_setSecond(byte second)
{
outportb(0x70, 0);
outportb(0x71, byte2bcd(second));
}
void rtc_setMinute(byte minute)
{
outportb(0x70, 2);
outportb(0x71, byte2bcd(minute));
}
void rtc_setHour(byte hour)
{
outportb(0x70, 4);
outportb(0x71, byte2bcd(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);
}

View File

@ -1,12 +0,0 @@
@echo off
echo Backing up to .\Backup\%1
mkdir .\Backup\%1
copy *.h .\Backup\%1
copy *.c .\Backup\%1
copy *.inc .\Backup\%1
copy *.asm .\Backup\%1
copy *.ld .\Backup\%1
copy *.bat .\Backup\%1

2
c1.bat
View File

@ -1,2 +0,0 @@
nasmw -f aout -o ks.o -l .\lst\kernel.lst kernel.asm

1
c2.bat
View File

@ -1 +0,0 @@
gcc -ffreestanding -fno-builtin -nostdlib -nodefaultlibs -c kernel.c -o kernel.o

1
c3.bat
View File

@ -1 +0,0 @@
nasmw -f aout -o asmfuncs.o -l .\lst\asmfuncs.lst asmfuncs.asm

View File

@ -1 +0,0 @@
copy kernel.bin a:

View File

@ -1,2 +0,0 @@
rem rawrite -f stage1.bin -d a -n
partcopy stage1.bin 0 200 -f0

View File

@ -1 +0,0 @@
copy stage2.bin a:

View File

@ -1 +0,0 @@
nasmw -f bin -o stage1.bin -l .\lst\stage1.lst stage1.asm

View File

@ -1 +0,0 @@
nasmw -f bin -o stage2.bin -l .\lst\stage2.lst stage2.asm

345
fat12.c
View File

@ -1,345 +0,0 @@
// fat12.c
// Author: Josh Holtrop
// Created: 01/04/04
// Modified: 01/14/04
byte *fat12_readFile(char *fileName, DiskDevice *dd)
{
char *fileNameUCase = malloc(strlen(fileName) + 1);
strcpy(fileNameUCase, fileName);
ucase(fileNameUCase);
dword iMadeClusterChain = getClusterChain(dd);
Fat12Entry fe;
if (fat12_getFileHandle(fileNameUCase, dd, &fe))
{
free(fileNameUCase);
if (iMadeClusterChain)
{
free(clusterChain);
clusterChain = 0;
}
return 0;
}
byte *fp = (byte *)fat12_readClusterChain(dd, &fe);
free(fileNameUCase);
if (iMadeClusterChain)
{
free(clusterChain);
clusterChain = 0;
}
return fp;
}
dword fat12_getFileHandle(char *fileName, DiskDevice *dd, Fat12Entry *destination)
{
if (strlen(fileName) < 1)
return 1;
if (fileName[strlen(fileName)-1] == '/')
return 2;
dword iMadeClusterChain = getClusterChain(dd);
int fileName_length = strlen(fileName);
int a;
int entries = 1;
for (a = 0; a < fileName_length; a++)
{
if (fileName[a] == '/')
{
fileName[a] = 0;
entries++;
}
}
char *pointer = fileName;
Fat12Entry *workingDirectory = 0;
Fat12Entry workingDir;
for (a = 0; a < (entries - 1); a++)
{
if (fat12_getDirectoryHandle(pointer, dd, workingDirectory, &workingDir)) //an error occurred if this returns nonzero
{
if (iMadeClusterChain)
{
free(clusterChain);
clusterChain = 0;
}
return 3;
}
workingDirectory = &workingDir;
for (;;) //advance to the next dir name
{
pointer++;
if (*pointer == 0)
{
pointer++;
break;
}
}
}
if (fat12_getFileHandleInDirectory(pointer, dd, workingDirectory, destination)) //an error occurred if this returns nonzero
{
if (iMadeClusterChain)
{
free(clusterChain);
clusterChain = 0;
}
return 4;
}
if (iMadeClusterChain)
{
free(clusterChain);
clusterChain = 0;
}
return 0;
}
dword fat12_getFileHandleInDirectory(char *fileName, DiskDevice *dd, Fat12Entry *currDir, Fat12Entry *destination)
{
if (!currDir) // we are working in the root directory
{
Fat12Entry *rootDir = malloc(14*512); //root directory is 14 sectors long
vfs_readSector(dd, 19, (byte *)rootDir, 14);
int a;
for (a = 0; a < 224; a++) //224 max root directory entries in 14 sectors
{
if (rootDir[a].fileName[0] == 0)
break;
if ((byte)rootDir[a].fileName[0] != 0xE5)
{
if ((rootDir[a].attributes & 0x18) == 0) //this entry is a directory
{
char dirName[9];
char dirExt[4];
memcpy(dirName, rootDir[a].fileName, 8);
dirName[8] = 0;
memcpy(dirExt, rootDir[a].ext, 3);
dirExt[3] = 0;
rtrim(dirName);
rtrim(dirExt);
char dirWhole[14];
strcpy(dirWhole, dirName);
if (strlen(dirExt) > 0) //the directory has an extension
{
strcat(dirWhole, ".");
strcat(dirWhole, dirExt);
}
if (strcmp(dirWhole, fileName)) //the entry found is a match
{
free(rootDir);
*destination = rootDir[a];
return 0;
}
}
}
}
free(rootDir);
return 1; //no match found
}
dword retVal = 2;
dword iMadeClusterChain = getClusterChain(dd);
Fat12Entry *subDirectory = fat12_readClusterChain(dd, currDir);
if (!subDirectory)
return 5;
dword numberOfClusters = fat12_readClusterChainCount(dd, currDir);
int a;
for (a = 0; a < (numberOfClusters * 16); a++)
{
if (subDirectory[a].fileName[0] == 0)
break;
if ((byte)subDirectory[a].fileName[0] != 0xE5)
{
if ((subDirectory[a].attributes & 0x18) == 0) //this entry is a directory
{
char dirName[9];
char dirExt[4];
memcpy(dirName, subDirectory[a].fileName, 8);
dirName[8] = 0;
memcpy(dirExt, subDirectory[a].ext, 3);
dirExt[3] = 0;
rtrim(dirName);
rtrim(dirExt);
char dirWhole[14];
strcpy(dirWhole, dirName);
if (strlen(dirExt) > 0) //the directory has an extension
{
strcat(dirWhole, ".");
strcat(dirWhole, dirExt);
}
if (strcmp(dirWhole, fileName)) //the entry found is a match
{
*destination = subDirectory[a];
retVal = 0;
break;
}
}
}
}
free(subDirectory);
if (iMadeClusterChain)
{
free(clusterChain);
clusterChain = 0;
}
return retVal;
}
dword fat12_getDirectoryHandle(char *directory, DiskDevice *dd, Fat12Entry *currDir, Fat12Entry *destination)
{
if (!currDir) // we are working in the root directory
{
Fat12Entry *rootDir = malloc(14*512); //root directory is 14 sectors long
vfs_readSector(dd, 19, (byte *)rootDir, 14);
int a;
for (a = 0; a < 224; a++) //224 max root directory entries in 14 sectors
{
if (rootDir[a].fileName[0] == 0)
break;
if ((byte)rootDir[a].fileName[0] != 0xE5)
{
if ((rootDir[a].attributes & 0x18) == 0x10) //this entry is a directory
{
char dirName[9];
char dirExt[4];
memcpy(dirName, rootDir[a].fileName, 8);
dirName[8] = 0;
memcpy(dirExt, rootDir[a].ext, 3);
dirExt[3] = 0;
rtrim(dirName);
rtrim(dirExt);
char dirWhole[14];
strcpy(dirWhole, dirName);
if (strlen(dirExt) > 0) //the directory has an extension
{
strcat(dirWhole, ".");
strcat(dirWhole, dirExt);
}
if (strcmp(dirWhole, directory)) //the entry found is a match
{
free(rootDir);
*destination = rootDir[a];
return 0;
}
}
}
}
free(rootDir);
return 1; //no match found
}
dword retVal = 2;
dword iMadeClusterChain = getClusterChain(dd);
Fat12Entry *subDirectory = fat12_readClusterChain(dd, currDir);
if (!subDirectory)
return 5;
dword numberOfClusters = fat12_readClusterChainCount(dd, currDir);
int a;
for (a = 0; a < (numberOfClusters * 16); a++)
{
if (subDirectory[a].fileName[0] == 0)
break;
if ((byte)subDirectory[a].fileName[0] != 0xE5)
{
if ((subDirectory[a].attributes & 0x18) == 0x10) //this entry is a directory
{
char dirName[9];
char dirExt[4];
memcpy(dirName, subDirectory[a].fileName, 8);
dirName[8] = 0;
memcpy(dirExt, subDirectory[a].ext, 3);
dirExt[3] = 0;
rtrim(dirName);
rtrim(dirExt);
char dirWhole[14];
strcpy(dirWhole, dirName);
if (strlen(dirExt) > 0) //the directory has an extension
{
strcat(dirWhole, ".");
strcat(dirWhole, dirExt);
}
if (strcmp(dirWhole, directory)) //the entry found is a match
{
*destination = subDirectory[a];
retVal = 0;
break;
}
}
}
}
free(subDirectory);
if (iMadeClusterChain)
{
free(clusterChain);
clusterChain = 0;
}
return retVal;
}
Fat12Entry *fat12_readClusterChain(DiskDevice *dd, Fat12Entry *directory)
{
dword numberOfClusters = fat12_readClusterChainCount(dd, directory);
if (numberOfClusters == 0)
return 0;
byte *bp = malloc(numberOfClusters * 512);
Fat12Entry *retVal = (Fat12Entry *)bp;
dword cluster = directory->firstCluster;
while (cluster < 0xFF0)
{
vfs_readSector(dd, cluster + 31, bp, 1);
cluster = fat12_getNextCluster(cluster);
bp += 512;
}
return retVal;
}
dword fat12_readClusterChainCount(DiskDevice *dd, Fat12Entry *directory)
{
dword numberOfClusters = 0;
dword cluster = directory->firstCluster;
if (cluster == 0)
return 0;
while (cluster < 0xFF0)
{
cluster = fat12_getNextCluster(cluster);
numberOfClusters++;
}
return numberOfClusters;
}
dword fat12_getNextCluster(dword thisCluster)
{
dword nextCluster = *(word *)((dword)clusterChain + ((thisCluster * 3) >> 1));
if (thisCluster & 0x01) //this is an odd cluster
return nextCluster >> 4;
else //this is an even cluster
return nextCluster & 0x0FFF;
}
dword fat12_getFileSize(char *fileName, DiskDevice *dd)
{
Fat12Entry fe;
if (fat12_getFileHandle(fileName, dd, &fe))
return 0xFFFFFFFF;
return fe.fileSize;
}
dword getClusterChain(DiskDevice *dd)
{
if (!clusterChain)
{
clusterChain = malloc(9*512); //9 sectors for File Allocation Table (cluster chain)
vfs_readSector(dd, 1, clusterChain, 9); //sectors 1 through 9 contain the first FAT
return 1; //this call created the cluster chain
}
else
return 0; //this call did not create the cluster chain
}

58
fat12.h
View File

@ -1,58 +0,0 @@
// fat12.h
// Author: Josh Holtrop
// Created: 01/04/04
typedef struct {
char fileName[8];
char ext[3];
byte attributes;
dword createTime;
word createDate;
word accessDate;
word unused0;
word modifiedDate;
word modifiedTime;
word firstCluster;
dword fileSize;
} __attribute__((packed)) Fat12Entry;
typedef struct {
byte jump[3];
byte sysName[8];
word bytesPerSector;
byte sectorsPerCluster;
word reservedSectors;
byte FATcount;
word maxRootEntries;
word totalSectors1;
byte mediaDescriptor;
word sectorsPerFAT;
word sectorsPerTrack;
word headCount;
dword hiddenSectors;
dword totalSectors2;
byte driveNumber;
byte reserved1;
byte extBootSignature;
dword volumeSerial;
char volumeLabel[11];
char fileSystemID[8];
} __attribute__((packed)) Fat12BootSector;
byte *fat12_readFile(char *fileName, DiskDevice *dd);
dword fat12_getFileHandle(char *fileName, DiskDevice *dd, Fat12Entry *destination);
dword fat12_getDirectoryHandle(char *directory, DiskDevice *dd, Fat12Entry *currDir, Fat12Entry *destination);
Fat12Entry *fat12_readClusterChain(DiskDevice *dd, Fat12Entry *directory);
dword fat12_getFileHandleInDirectory(char *fileName, DiskDevice *dd, Fat12Entry *currDir, Fat12Entry *destination);
dword fat12_readClusterChainCount(DiskDevice *dd, Fat12Entry *directory);
dword fat12_getFileSize(char *fileName, DiskDevice *dd);
dword getClusterChain(DiskDevice *dd);
dword fat12_getNextCluster(dword thisCluster);
byte *clusterChain = 0;

9
fdc.c
View File

@ -1,9 +0,0 @@
//fdc.c
//Author: Josh Holtrop
//Date: 10/30/03
inline void fdc_sendDOR(byte dor)
{
outportb(FDC_DOR, dor);
}

12
fdc.h
View File

@ -1,12 +0,0 @@
//fdc.h
//Author: Josh Holtrop
//Date: 10/30/03
#define FDC_DOR 0x3f2
#define FDC_MSR 0x3f4
inline void fdc_sendDOR(byte dor);

View File

@ -1,52 +0,0 @@
//functions.h
//05/07/03 Josh Holtrop
//for HOS
//Modified: 10/30/03
extern dword _code;
extern dword _bss;
extern dword _end;
inline void outportb(unsigned int port, unsigned char value);
inline void outportw(unsigned int port, unsigned int value);
inline byte inportb(unsigned short port);
inline void enable_ints();
inline void disable_ints();
inline void restart();
inline void halt();
void remap_pics(int pic1, int pic2);
inline void pic1_mask(byte mask);
inline void pic2_mask(byte mask);
inline void eoi();
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);
inline byte bcd2byte(byte bcd);
inline byte byte2bcd(byte bite);
byte rtc_readDay();
byte rtc_readMonth();
byte rtc_readYear();
byte rtc_readSecond();
byte rtc_readMinute();
byte rtc_readHour();
void rtc_setDay(byte dat);
void rtc_setMonth(byte month);
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();

View File

@ -1 +0,0 @@
gcc -S kernel.c -masm=intel -fno-builtin

View File

@ -1 +0,0 @@
partcopy -f0 0 168000 flop.img

View File

@ -1,55 +0,0 @@
//k_defines.h
//03/17/03 Josh Holtrop
//Modified: 10/30/03
#define PIC1 0x20
#define PIC2 0xA0
#define PIC1_COMMAND PIC1
#define PIC1_DATA (PIC1+1)
#define PIC2_COMMAND PIC2
#define PIC2_DATA (PIC2+1)
#define PIC_EOI 0x20
#define ICW1_ICW4 0x01 /* ICW4 (not) needed */
#define ICW1_SINGLE 0x02 /* Single (cascade) mode */
#define ICW1_INTERVAL4 0x04 /* Call address interval 4 (8) */
#define ICW1_LEVEL 0x08 /* Level triggered (edge) mode */
#define ICW1_INIT 0x10 /* Initialization - required! */
#define ICW4_8086 0x01 /* 8086/88 (MCS-80/85) mode */
#define ICW4_AUTO 0x02 /* Auto (normal) EOI */
#define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
#define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
#define ICW4_SFNM 0x10 /* Special fully nested (not) */
#define BLUE_TXT 0x01
#define RED_TXT 0x04
#define WHITE_TXT 0x07
#define CYAN_TXT 0x0B
#define YELLOW_TXT 0x0E
#define BRWHITE_TXT 0x0F
#define FREERAM_START 0x368000 // 0x368000 is first available byte (this is right after the initrd @ 2mb, 1440kb.
#define MAX_RAM 0x40000000 //1gb maximum RAM supported
#define PID_KERNEL 0x02 //kernel's PID
#define PID_VMM 0x03
#define PID_USER 0x10000 //user processes' start PID
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;
typedef struct {
dword lowdword;
dword highdword;
} __attribute__((packed)) qword;
//these defines are the memory locations of values saved by the stage 2 bootloader
#define BOOT_MEMMAP_ENTRIES 0xC009040A
#define BOOT_FIRST_MEMMAP 0xC0092000
#define BOOT_VIDEO_MODE 0xC0090002
#define BOOT_VIDEO_MODE_INFO_BLOCK 0xC0090306

View File

@ -1 +0,0 @@
ld -nodefaultlibs -nostdlib -T link.ld -o kernel.bin -Map .\lst\LDout.doc ks.o kernel.o asmfuncs.o

17
mouse.h
View File

@ -1,17 +0,0 @@
// mouse.h
// 10/03/03
// Author: Josh Holtrop
int mouse_x;
int mouse_y;
int mouse_bytesRead = 0;
byte mouse_inbuffer[16];
void mouse_init();
void isr_mouse();

14
rd.c
View File

@ -1,14 +0,0 @@
// rd.c
// Author: Josh Holtrop
// Created: 12/31/03
// Modified: 01/04/04
byte *rd_readSector(DiskDevice *rd, dword sector, byte *dest)
{
memcpy(dest, (void *)(rd->location + (sector * 512)), 512);
return dest;
}

9
rd.h
View File

@ -1,9 +0,0 @@
// rd.h
// Author: Josh Holtrop
// Created: 12/31/03
// Modified: 01/04/04
byte *rd_readSector(DiskDevice *rd, dword sector, byte *dest);

192
src/Makefile Normal file
View File

@ -0,0 +1,192 @@
#####################################################################
# Author: Benjamen R. Meyer #
# Date: 2004-2-15 #
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
# Note: This makefile is for use on Linux & other Unix-like systems #
#####################################################################
##############
# Variables: #
##############
# Format of kernel binary:
# Do not change unless you know what you are doing
# Original:
KERNEL_FORMAT=aout
# CygWin: ??
#KERNEL_FORMAT=
# Assembler information:
NASM_BIN=nasm
NASM_FLAGS_IPL=-f bin
NASM_FLAGS_KERNEL=-f $(KERNEL_FORMAT)
# C Compile Information:
CC=gcc
CC_FLAGS=-ffreestanding -fno-builtin -nostdlib -nodefaultlibs -I.
# Linker Information:
LD=ld
LD_FLAGS=-nodefaultlibs -nostdlib -T link.ld
# Information for creating a floppy image
# Note: FLOPPY_FS and FLOPPY_FAT_SIZE are related fields.
# FLOPPY_FAT_SIZE should be either 12 or 16,
# depending on if FLOPPY_FS is FAT12 or FAT16, respectively.
MKDOSFS_PROG=/sbin/mkdosfs
FLOPPY_IMAGE=floppy.img
FLOPPY_BLOCK_COUNT=1440
FLOPPY_FS=FAT12
FLOPPY_FAT_SIZE=12
FLOPPY_MOUNT=./floppy_image
# Floppy images are good for programs like VMware and Bochs Pentium Emulator. ;-)
# Program for copying
COPY_BIN=cp
##########################################
# Build the IPL (Boot Loader) and Kernel #
##########################################
all: Boot Link_Kernel
# A word of warning to users :-> And a little helpful information ;-)
@echo "Installation must be done as root."
@echo "Type 'make install' to install to a floppy in drive '/dev/fd0'"
@echo "Type 'make install_img' to create a floppy image and install to it."
#################################################
# Clean up the source directory of any binaries #
#################################################
clean:
- rm *.o ./lst/*.lst *.bin $(FLOPPY_IMAGE)
#################
# Build the IPL #
#################
Boot:
boot/make
###############################
# Linking the kernel together #
###############################
Link_Kernel: Asm_Kernel Asm_Functions FAT_12 FDC Functions Keyboard KIO MM Mouse RD STDFONT VFS Video VMM C_Kernel
$(LD) $(LD_FLAGS) -o kernel.bin -Map ./lst/LDout.doc ks.o fat12.o fdc.o functions.o kernel.o keyboard.o kio.o mm.o mouse.o rd.o stdfont.o vfs.o video.o vmm.o asmfuncs.o
##########################
# Assembly Kernel Loader #
##########################
Asm_Kernel: kernel.asm
$(NASM_BIN) $(NASM_FLAGS_KERNEL) -o ks.o -l ./lst/kernel.lst kernel.asm
#################################
# Assembly Functions for Kernel #
#################################
Asm_Functions: asmfuncs.asm
$(NASM_BIN) $(NASM_FLAGS_KERNEL) -o asmfuncs.o -l ./lst/asmfuncs.lst asmfuncs.asm
############
# C Kernel #
############
FAT_12: fat12.c fat12.h k_defines.h vfs.h
$(CC) $(CC_FLAGS) -c fat12.c -o fat12.o
FDC: fdc.c fdc.h k_defines.h
$(CC) $(CC_FLAGS) -c fdc.c -o fdc.o
Functions: functions.c functions.h k_defines.h
$(CC) $(CC_FLAGS) -c functions.c -o functions.o
Keyboard: keyboard.c keyboard.h k_defines.h
$(CC) $(CC_FLAGS) -c keyboard.c -o keyboard.o
KIO: kio.c kio.h k_defines.h video.h
$(CC) $(CC_FLAGS) -c kio.c -o kio.o
MM: mm.c mm.h k_defines.h
$(CC) $(CC_FLAGS) -c mm.c -o mm.o
Mouse: mouse.c mouse.h k_defines.h video.h
$(CC) $(CC_FLAGS) -c mouse.c -o mouse.o
RD: rd.c rd.h k_defines.h vfs.h
$(CC) $(CC_FLAGS) -c rd.c -o rd.o
STDFONT: stdfont.h stdfont.c
$(CC) $(CC_FLAGS) -c stdfont.c -o stdfont.o
VFS: vfs.c vfs.h k_defines.h
$(CC) $(CC_FLAGS) -c vfs.c -o vfs.o
Video: video.c video.h k_defines.h stdfont.h
$(CC) $(CC_FLAGS) -c video.c -o video.o
# Why does this rely on video.h???
VMM: vmm.c vmm.h k_defines.h video.h
$(CC) $(CC_FLAGS) -c vmm.c -o vmm.o
C_Kernel: kernel.c k_defines.h fat12.h fdc.h functions.h keyboard.h kio.h mm.h mouse.h rd.h vfs.h video.h vmm.h
$(CC) $(CC_FLAGS) -c kernel.c -o kernel.o
###########################################
# The following is for the floppy drive #
# Note: This must be done on *nix as root #
###########################################
##########################
# Make install to floppy #
##########################
install: Install_IPL File_Copy
############################################
# Write the Stage 1 IPL to the boot sector #
############################################
Install_IPL:
boot/make install
#################################
# Copy the files onto the drive #
#################################
File_Copy: kernel.bin
@echo -n "Copying kernel to the floppy: "
cp kernel.bin /dev/fd0
############################################
# The following is for the floppy image. #
# Note: This must be done on *nix as root. #
############################################
########################
# Make a floppy image: #
########################
floppy_image: image_IPL image_file_copy
######################################
# Create and Format the floppy image #
######################################
install_img: $(FLOPPY_IMAGE)
$(MKDOSFS_PROG) -C -F $(FLOPPY_FAT_SIZE) -r 112 $(FLOPPY_IMAGE) $(FLOPPY_BLOCK_COUNT)
##########################################
# Mount the floppy on a loop back device #
##########################################
floppy_mount:
@echo "Mounting a file as a drive..."
mount $(FLOPPY_IMAGE) $(FLOPPY_MOUNT) -o loop
############################################
# Write the Stage 1 IPL to the boot sector #
############################################
image_IPL: stage1.bin floppy_format
@echo "Writing boot sector to image..."
dd if=stage1.bin of=$(FLOPPY_MOUNT) seek=0
#################################
# Copy the files onto the image #
#################################
image_file_copy: stage2.bin kernel.bin
@echo -n "Copying files onto it: "
@echo -n "IPL Stage 2 "
$(COPY_BIN) stage2.bin $(FLOPPY_MOUNT)
@echo ", HOS Kernel"
$(COPY_BIN) kernel.bin $(FLOPPY_MOUNT)

30
src/boot/Makefile Normal file
View File

@ -0,0 +1,30 @@
########################
# Author: Josh Holtrop #
# Date: 2004-2-15 #
########################
# Assembler information:
NASM_BIN=nasm
#################
# Build the IPL #
#################
all: stage1 stage2
################
# IPL: Stage 1 #
################
stage1: stage1.asm
$(NASM_BIN) stage1.asm -o stage1.bin
################
# IPL: Stage 2 #
################
stage2: stage2.asm
$(NASM_BIN) stage2.asm -o stage2.bin
#########
# Clean #
#########
clean:
rm *.bin

View File

@ -1,7 +1,7 @@
; asmfuncs.asm
; Josh Holtrop
; Created: 10/23/03
; Modified: 12/25/03
; Modified: 02/26/04
[extern _putc]
[extern _console_memory]
@ -137,27 +137,6 @@ _memcpy:
pop ebp
ret
;copies memory of n dwords (n*4 bytes) from src to destination
;extern void memcpyd(dword dest, dword src, dword n);
[global _memcpyd]
_memcpyd:
push ebp
mov ebp, esp
push esi
push edi
push ecx
mov edi, [ebp+8]
mov esi, [ebp+12]
mov ecx, [ebp+16]
rep movsd
pop ecx
pop edi
pop esi
pop ebp
ret
;returns the number of characters in a string
;extern dword strlen(char *str);
[global _strlen]

26
src/kernel/asmfuncs.h Normal file
View File

@ -0,0 +1,26 @@
// asmfuncs.h
// Author: Josh Holtrop
// Created: 02/26/04
#ifndef __HOS_ASMFUNCS__
#define __HOS_ASMFUNCS__ __HOS_ASMFUNCS__
dword write_cr0(dword cr0);
dword read_cr0();
dword write_cr3(dword cr3);
dword read_cr2();
dword read_cr3();
void writeCursorPosition(dword pos);
dword getCursorPosition();
void console_scroll();
void console_cls();
int puts(char *str);
int putDec(int number);
int putDecu(dword number);
void strcpy(char *dest, char *src);
void memcpy(void *dest, void *src, dword n);
dword strlen(char *str);
#endif

9
src/kernel/block/fdc.c Normal file
View File

@ -0,0 +1,9 @@
//fdc.c
//Author: Josh Holtrop
//Created: 10/30/03
//Modified: 02/26/04
#include "fdc.h"

21
src/kernel/block/fdc.h Normal file
View File

@ -0,0 +1,21 @@
//fdc.h
//Author: Josh Holtrop
//Date: 10/30/03
//Modified: 02/26/04
#ifndef __HOS_FDC__
#define __HOS_FDC__ __HOS_FDC__
#define FDC_DOR 0x3f2
#define FDC_MSR 0x3f4
inline void fdc_sendDOR(byte dor);
inline void fdc_sendDOR(byte dor)
{
outportb(FDC_DOR, dor);
}
#endif

View File

@ -1,7 +1,10 @@
//Keyboard.c
// Created: 04/17/03 Josh Holtrop
// Modified: 10/30/03
//for HOS
// keyboard.c
// Author: Josh Holtrop
// Created: 04/17/03
// Modified: 03/02/04
#include "hos_defines.h"
#include "keyboard.h"
#define KBD_BUFFER_LENGTH 64
@ -200,16 +203,6 @@ void isr_keyboard()
}
//Switches the case of an ASCII character
/*inline byte (byte asciiCode)
{
if ((asciiCode >= 'A') & (asciiCode <= 'Z'))
return (asciiCode + ('a' - 'A'));
if ((asciiCode >= 'a') & (asciiCode <= 'z'))
return (asciiCode - ('a' - 'A'));
return asciiCode;
}*/
//Gets a key from the buffer, returns 0 if no keys available, returns immediately
dword kbdGetKey()
{
@ -240,10 +233,9 @@ dword kbdWaitKey()
}
//Resets the keyboard LEDs to reflect the current state of the num lock, caps lock, and scroll lock bits
inline void kbd_resetLEDs()
void kbd_resetLEDs()
{
outportb(0x60, 0xED);
//outportb(0x60, (kbdFlags & 0x07));
ackReason = 0xED;
}

View File

@ -1,7 +1,12 @@
//Keyboard.h
// Created: 04/17/03 Josh Holtrop
// Modified: 05/07/03
//for HOS
// keyboard.h
// Author: Josh Holtrop
// Created: 04/17/03
// Modified: 03/02/04
#include "hos_defines.h"
#ifndef __HOS_KEYBOARD__
#define __HOS_KEYBOARD__ __HOS_KEYBOARD__
#define KBD_SCROLL 0x01
#define KBD_NUM 0x02
@ -36,12 +41,10 @@
//====PROTOTYPES:
void isr_keyboard();
inline void kbd_resetLEDs();
inline byte kbd_ascii(dword keycode);
inline byte kbd_scancode(dword keycode);
inline byte kbd_flags(dword keycode);
inline byte switchCase(byte asciiCode);
void kbd_resetLEDs();
dword kbdGetKey();
dword kbdWaitKey();
#endif

View File

@ -2,6 +2,15 @@
// 10/03/03
// Author: Josh Holtrop
#include "mouse.h"
#include "hos_defines.h"
#define MOUSE_BUFFER_LENGTH 16
int mouse_x;
int mouse_y;
int mouse_bytesRead = 0;
byte mouse_inbuffer[MOUSE_BUFFER_LENGTH];
//This method initializes the ps/2 mouse
void mouse_init()

15
src/kernel/char/mouse.h Normal file
View File

@ -0,0 +1,15 @@
// mouse.h
// Author: Josh Holtrop
// Date: 10/03/03
// Modified: 03/02/04
#ifndef __HOS_MOUSE__
#define __HOS_MOUSE__ __HOS_MOUSE__
void mouse_init();
void isr_mouse();
#endif

8
src/kernel/functions.c Normal file
View File

@ -0,0 +1,8 @@
//Functions.c
//05/07/03 Josh Holtrop
//for HOS
//Modified: 02/26/04
#include "functions.h"

96
src/kernel/functions.h Normal file
View File

@ -0,0 +1,96 @@
//functions.h
//05/07/03 Josh Holtrop
//for HOS
//Modified: 02/26/04
#include "hos_defines.h"
#ifndef __HOS_FUNCTIONS__
#define __HOS_FUNCTIONS__ __HOS_FUNCTIONS__
extern dword _code;
extern dword _bss;
extern dword _end;
inline void enable_ints();
inline void disable_ints();
inline void restart();
inline void halt();
inline dword kernel_size();
inline void timer_init();
inline byte bcd2byte(byte bcd);
inline byte byte2bcd(byte bite);
//Enables (SeTs) Interrupt Flag on the processor
inline void enable_ints()
{
asm("sti");
}
//Disables (CLears) Interrupt Flag on the processor
inline void disable_ints()
{
asm("cli");
}
//Restarts the computer
inline void restart()
{
enable_ints();
byte temp;
do
{
temp = inportb(0x64);
if (temp & 1)
inportb(0x60);
} while(temp & 2);
outportb (0x64, 0xfe);
for (;;)
{
}
}
//Halts (freezes) the computer
inline void halt()
{
asm("cli");
asm("hlt");
while (1)
;
}
//Initializes 8253 Programmable Interrupt Timer
inline void timer_init()
{
//set timer : 2e9c = 100hz
outportb(0x43, 0x34);
outportb(0x40, 0x9c); //lsb
outportb(0x40, 0x2e); //msb
}
//Returns the size of the kernel (code & data)
// - this does not include the bss section
// - this should be 4kb aligned per the linker script
// - this should be the size of kernel.bin
inline dword kernel_size()
{
return (dword)(&_bss)-(dword)(&_code);
}
//converts a binary-coded-decimal byte to its decimal equivalent
inline byte bcd2byte(byte bcd)
{
return (10* ((bcd & 0xF0) >> 4)) + (bcd & 0x0F);
}
//converts a binary-coded-decimal byte to its decimal equivalent
inline byte byte2bcd(byte bite)
{
return ((bite / 10) << 4) | (bite % 10);
}
#endif

View File

@ -1,11 +1,11 @@
;gdt.inc
;Author: Josh Holtrop
;for HOS
;Modified: 10/30/03
;Date: 10/30/03
;Modified: 03/02/04
gdtr:
dw gdt_end-gdt-1
dd GDT_P
dd GDT_V
gdt:
dd 0
dd 0
@ -23,7 +23,21 @@ KERNEL_DATA equ $-gdt
db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
VESA_CODE equ $-gdt
USER_CODE equ $-gdt
dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0
db 0x00 ;base 23:16
db 0xFA ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
USER_DATA equ $-gdt
dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0
db 0x00 ;base 23:16
db 0xF2 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
gVESA_CODE equ $-gdt
dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0
db 0x00 ;base 23:16
@ -51,21 +65,7 @@ VIDEO_GRAPHICS equ $-gdt
db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
USER_CODE equ $-gdt
dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0
db 0x00 ;base 23:16
db 0xFA ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
USER_DATA equ $-gdt
dw 0xffff ;limit 15:0
dw 0x0000 ;base 15:0
db 0x00 ;base 23:16
db 0xF2 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
db 0x00 ;base 31:24
gdt_end:
dt_end:

34
src/kernel/hos_defines.h Normal file
View File

@ -0,0 +1,34 @@
//hos_defines.h
//03/17/03 Josh Holtrop
//Modified: 03/02/04
#ifndef __HOS_HOS_DEFINES__
#define __HOS_HOS_DEFINES__ __HOS_HOS_DEFINES__
#define FREERAM_START 0x368000 // 0x368000 is first available byte (this is right after the initrd @ 2mb, 1440kb.
#define MAX_RAM 0x40000000 //1gb maximum RAM supported
#define PID_KERNEL 0x02 //kernel's PID
#define PID_VMM 0x03
#define PID_USER 0x10000 //user processes' start PID
//these defines are the memory locations of values saved by the stage 2 bootloader
#define BOOT_MEMMAP_ENTRIES 0xC009040A
#define BOOT_FIRST_MEMMAP 0xC0092000
#define BOOT_VIDEO_MODE 0xC0090002
#define BOOT_VIDEO_MODE_INFO_BLOCK 0xC0090306
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;
typedef struct {
dword lowdword;
dword highdword;
} __attribute__((packed)) qword;
#endif

View File

@ -1,7 +1,7 @@
;idt.inc
;Author: Josh Holtrop
;for HOS
;Modified: 10/30/03
;Date: 10/30/03
;Modified: 03/02/04
idtr:
dw 50*8-1 ;size of idt
@ -78,7 +78,7 @@ isr_main:
call _isr
pop eax
add esp, 4
pop es
pop ds

View File

@ -1,5 +1,6 @@
;kernel.asm
;Author: Josh Holtrop
;Date: 10/30/03
;Modified: 10/30/03
%define GDT_P 0x100000; ;1mb physical - Global Descriptor Table space
@ -87,7 +88,7 @@ newgdtcontinue:
mov gs, ax
mov fs, ax
mov ss, ax
mov esp, 0xc01ffffc ;stack just under 3gb+2mb, moves downward
mov esp, 0xc0200000 ;stack just under 3gb+2mb, moves downward
lidt [idtr] ;load idt
call _k_init

View File

@ -1,57 +1,30 @@
// kernel.c
//08/13/03 Josh Holtrop
//Holtrop's Operating System
//Version: 0.12
//Modified: 12/30/03
#include "k_defines.h" //#DEFINE's for kernel
// Author: Josh Holtrop
// Date: 08/13/03
// Holtrop's Operating System - Version 0.13
// Modified: 03/02/04
#include "hos_defines.h" //#DEFINE's for kernel
#include "functions.h" //general functions
#include "video.h" //video functions
#include "mm.h" //physical memory management functions
#include "vmm.h" //virtual memory management & paging functions
#include "keyboard.h" //generic keyboard driver & functions
#include "mouse.h" //generic ps/2 mouse driver & functions
#include "fdc.h" //Floppy Disk Controller functions
#include "stdfont.h" //Standard font bitmask array
#include "kio.h"
#include "vfs.h"
#include "rd.h"
#include "fat12.h"
#include "asmfuncs.h" //assembly functions
#include "kio.h" //kernel input/output functions
#include "mm/mm.h" //physical memory management functions
#include "mm/vmm.h" //virtual memory management & paging functions
#include "char/keyboard.h" //generic keyboard driver & functions
#include "char/mouse.h" //generic ps/2 mouse driver & functions
#include "block/fdc.h" //Floppy Disk Controller functions
#include "string/string.h" //string functions
#include "sys/cmos.h" //CMOS interface functions
#include "sys/io.h" //port i/o functions
#include "sys/pic.h" //Programmable Interrupt Controller functions
#include "sys/rtc.h" //Real Time Clock functions
#include "video/stdfont.h" //Standard font bitmask array
#include "video/video.h" //video functions
void isr(dword num);
void k_init();
/* These functions are defined in asmfuncs.asm */
extern dword write_cr0(dword cr0);
extern dword read_cr0();
extern dword write_cr3(dword cr3);
extern dword read_cr2();
extern dword read_cr3();
extern void writeCursorPosition(dword pos);
extern dword getCursorPosition();
extern void console_scroll();
extern void console_cls();
extern int puts(char *str);
extern int putDec(int number);
extern int putDecu(dword number);
extern void strcpy(char *dest, char *src);
extern void memcpy(void *dest, void *src, dword n);
extern dword strlen(char *str);
#include "fat12.c"
#include "rd.c"
#include "vfs.c"
#include "kio.c"
#include "fdc.c"
#include "mouse.c"
#include "keyboard.c"
#include "mm.c"
#include "vmm.c"
#include "functions.c"
#include "video.c"
dword timer = 0;
//Main kernel initialization method
@ -85,21 +58,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++)
{
byte *app = mm_palloc();
vmm_map1((dword)addr, (dword)app);
addr += 4096;
}
addr = vfs_readFile("/bin/hash.hos");
memcpy(0, addr, 4192);
asm("call 0");
free(addr);
*/
dword key = 0;
for (;;)
{

View File

@ -1,9 +1,12 @@
// kio.c
// Author: Josh Holtrop
// Created: 12/25/03
// Modified: 12/25/03
// Modified: 03/02/04
#include "hos_defines.h"
#include "kio.h"
dword cursorPosition = 0; //Caches the current cursor position
// This is the main output routine, it uses a format string and a variable
// number of arguments to print formatted text

View File

@ -3,13 +3,15 @@
// Created: 12/25/03
// Modified: 12/25/03
#include "hos_defines.h"
#ifndef __HOS_KIO__
#define __HOS_KIO__ __HOS_KIO__
void printf(char *fmt, ...);
void putc(dword chr);
int putHex(dword number);
dword cursorPosition = 0; //Caches the current cursor position
#endif

View File

@ -1,7 +1,10 @@
// mm.c
// Author: Josh Holtrop
// Created: 09/01/03
// Modified: 12/28/03
// Modified: 03/02/04
#include "hos_defines.h"
#include "mm.h"
//The total amount of physical memory available (bytes, 1 bit per page)
#define BITMAP_SIZE 0x20000

View File

@ -1,3 +1,12 @@
// mm.c
// Author: Josh Holtrop
// Created: 09/01/03
// Modified: 03/02/04
#include "hos_defines.h"
#ifndef __HOS_MM__
#define __HOS_MM__ __HOS_MM__
typedef struct {
@ -7,7 +16,6 @@ typedef struct {
} __attribute__((packed)) memmap_entry;
void mm_init();
void mm_pfreen(dword base, dword pages);
void mm_pfree(dword base);
@ -15,7 +23,5 @@ void *mm_palloc();
dword mm_freemem();
#endif

View File

@ -2,34 +2,38 @@
// Author: Josh Holtrop
// Date: 09/30/03
// Rewritten from scratch: 12/23/03
// Modified: 12/30/03
// Modified: 03/02/04
#include "hos_defines.h"
#include "vmm.h"
HeapEntry *firstHeapEntry = (HeapEntry *)0xD0000000; //this is where heap memory starts
// This is the initialization procedure for the Virtual Memory Manager
// It sets up the final page directory/page table setup and maps video memory, if present
void vmm_init()
{
dword *pageTables = (dword *)0xC0104000; //this is the location of the page directory
unsigned int *pageTables = (unsigned int *)0xC0104000; //this is the location of the page directory
pageTables[0x3FF] = 0x104000|0x03; //the last page directory entry points to the page directory itself
pageTables[0] = 0;
invlpg(0);
if (videoMode) //we are in a graphical mode
{
dword vidPages = video_mode.XResolution * video_mode.YResolution * (video_mode.BitsPerPixel >> 3);
unsigned int vidPages = video_mode.XResolution * video_mode.YResolution * (video_mode.BitsPerPixel >> 3);
if (vidPages % 4096)
vidPages = (vidPages >> 12) + 1;
else
vidPages = (vidPages >> 12);
vmm_mapn(0xF0000000, video_mode.PhysBasePtr, vidPages);
}
dword firstHeapEntryBlock = (dword)mm_palloc();
vmm_map1((dword)firstHeapEntry, firstHeapEntryBlock);
unsigned int firstHeapEntryBlock = (unsigned int)mm_palloc();
vmm_map1((unsigned int)firstHeapEntry, firstHeapEntryBlock);
HeapEntryBlock *heb = (HeapEntryBlock *)firstHeapEntry;
vmm_heb_init(heb);
heb->entry[0].base = (dword)firstHeapEntry; //start of kernel's heap memory
heb->entry[0].base = (unsigned int)firstHeapEntry; //start of kernel's heap memory
heb->entry[0].size = 4096; //the first HeapEntryBlock is 1 page long
heb->entry[0].attributes = VMM_HE_HEB; //this is a HeapEntryBlock
heb->entry[1].base = (dword)firstHeapEntry+4096; //this is the start of the rest of the kernel's heap memory
heb->entry[1].base = (unsigned int)firstHeapEntry+4096; //this is the start of the rest of the kernel's heap memory
heb->entry[1].size = 0x10000000-4096; //the rest of the kernel's heap memory: 256mb - 4kb
heb->entry[1].attributes = VMM_HE_HOLE; //this is a hold - an unmapped section of heap memory
}
@ -44,38 +48,38 @@ void vmm_heb_init(HeapEntryBlock *heb)
heb->entry[a].base = 0;
heb->entry[a].size = 0;
heb->entry[a].attributes = VMM_HE_UNUSED;
heb->entry[a].link = (dword)&(heb->entry[a+1]);
heb->entry[a].link = (unsigned int)&(heb->entry[a+1]);
}
heb->entry[255].link = 0;
}
// This function maps a virtual address to a physical address using the page directory / page table
void vmm_map1(dword virt, dword physical)
void vmm_map1(unsigned int virt, unsigned int physical)
{
dword pde = virt >> 22;
dword pte = (virt & 0x003FF000) >> 12;
dword *pageTables = (dword *)0xC0104000; //this is the location of the page directory
unsigned int pde = virt >> 22;
unsigned int pte = (virt & 0x003FF000) >> 12;
unsigned int *pageTables = (unsigned int *)0xC0104000; //this is the location of the page directory
if (!(pageTables[pde] & 0x01)) //the page directory entry does not exist, we must allocate a page for it
{
dword *newpagetable = mm_palloc();
pageTables[pde] = ((dword)newpagetable) | 0x03;
unsigned int *newpagetable = mm_palloc();
pageTables[pde] = ((unsigned int)newpagetable) | 0x03;
invlpg(virt);
dword *newpteptr = (dword *)(0xFFC00000 | (pde << 12)); //points to first dword of newly allocated page table
unsigned int *newpteptr = (unsigned int *)(0xFFC00000 | (pde << 12)); //points to first unsigned int of newly allocated page table
int a;
for (a = 0; a < 1024; a++)
{
newpteptr[a] = 0;
}
}
dword *pteptr = (dword *)(0xFFC00000 | (pde << 12) | (pte << 2));
unsigned int *pteptr = (unsigned int *)(0xFFC00000 | (pde << 12) | (pte << 2));
*pteptr = physical | 0x03;
invlpg(virt);
}
// This function maps a variable number of pages in a row
void vmm_mapn(dword virt, dword physical, dword n)
void vmm_mapn(unsigned int virt, unsigned int physical, unsigned int n)
{
for (; n > 0; n--)
{
@ -87,16 +91,16 @@ void vmm_mapn(dword virt, dword physical, dword n)
// This function removes the virtual address's entry in the page directory / page table
void vmm_unmap1(dword virt)
void vmm_unmap1(unsigned int virt)
{
dword *pteptr = (dword *)(0xFFC00000 | ((virt & 0xFFC00000) >> 10) | ((virt & 0x003FF000) >> 10));
unsigned int *pteptr = (unsigned int *)(0xFFC00000 | ((virt & 0xFFC00000) >> 10) | ((virt & 0x003FF000) >> 10));
*pteptr = 0;
invlpg(virt);
}
// This function removes multiple pages' entries
void vmm_unmapn(dword virt, dword n)
void vmm_unmapn(unsigned int virt, unsigned int n)
{
for (; n > 0; n--)
{
@ -107,7 +111,7 @@ void vmm_unmapn(dword virt, dword n)
// Virtual Memory allocator function
void *malloc(dword bytes)
void *malloc(unsigned int bytes)
{
if (bytes % VMM_MALLOC_GRANULARITY)
bytes = bytes + VMM_MALLOC_GRANULARITY - (bytes % VMM_MALLOC_GRANULARITY);
@ -121,7 +125,7 @@ void *malloc(dword bytes)
// This function returns a pointer if a free chunk of memory exists
void *vmm_getFreeChunk(dword bytes)
void *vmm_getFreeChunk(unsigned int bytes)
{
HeapEntry *he = firstHeapEntry;
for (;;)
@ -187,15 +191,15 @@ void vmm_coalesceHeapEntry(HeapEntry *he)
// This function retrieves more physical memory for the heap
int vmm_moreCore(dword bytes)
int vmm_moreCore(unsigned int bytes)
{
dword pages = (bytes >> 12) + 1;
unsigned int pages = (bytes >> 12) + 1;
bytes = pages << 12;
HeapEntry *he = vmm_getFirstHoleHeapEntry(bytes);
dword virt = he->base;
unsigned int virt = he->base;
for (; pages > 0; pages--)
{
dword phys = (dword)mm_palloc();
unsigned int phys = (unsigned int)mm_palloc();
if (!phys)
return 1;
vmm_map1(virt, phys);
@ -234,14 +238,14 @@ void vmm_addHeapEntryBlock()
{
HeapEntry *he = vmm_getFirstHoleHeapEntry(4096);
HeapEntry *newBlock = vmm_getFirstUnusedHeapEntry();
dword heb = (dword)mm_palloc();
unsigned int heb = (unsigned int)mm_palloc();
vmm_map1(he->base, heb);
vmm_heb_init((HeapEntryBlock *)he->base);
HeapEntry *lhe = vmm_getLastHeapEntry();
if (he->size == 4096)
{
he->attributes = VMM_HE_HEB;
lhe->link = (dword)he->base;
lhe->link = (unsigned int)he->base;
}
else
{
@ -250,7 +254,7 @@ void vmm_addHeapEntryBlock()
newBlock->attributes = VMM_HE_HEB;
he->base += 4096;
he->size -= 4096;
lhe->link = (dword)newBlock->base;
lhe->link = (unsigned int)newBlock->base;
}
return;
}
@ -271,7 +275,7 @@ HeapEntry *vmm_getLastHeapEntry()
// This function returns the first heap entry corresponding to a memory "hole"
HeapEntry *vmm_getFirstHoleHeapEntry(dword minBytes)
HeapEntry *vmm_getFirstHoleHeapEntry(unsigned int minBytes)
{
HeapEntry *he = firstHeapEntry;
for (;;)
@ -303,10 +307,10 @@ HeapEntry *vmm_getFirstUnusedHeapEntry()
// This function returns the number of heap entries available for use
dword vmm_heapEntriesLeft()
unsigned int vmm_heapEntriesLeft()
{
HeapEntry *he = firstHeapEntry;
dword entries = 0;
unsigned int entries = 0;
for (;;)
{
if (he->attributes == VMM_HE_UNUSED)
@ -322,7 +326,7 @@ dword vmm_heapEntriesLeft()
// This function "frees" an area of memory previously allocated with malloc()
int free(void *ptr)
{
HeapEntry *he = vmm_getHeapEntryByBase((dword)ptr);
HeapEntry *he = vmm_getHeapEntryByBase((unsigned int)ptr);
if (!he)
return 1; //a heap entry starting at the given address was not found
he->attributes = VMM_HE_FREE;
@ -332,7 +336,7 @@ int free(void *ptr)
// This function scans the heap entry linked list for an entry that begins at the given address
HeapEntry *vmm_getHeapEntryByBase(dword base)
HeapEntry *vmm_getHeapEntryByBase(unsigned int base)
{
HeapEntry *he = firstHeapEntry;
for (;;)

View File

@ -2,8 +2,12 @@
// Author: Josh Holtrop
// Date: 09/30/03
// Rewritten from scratch: 12/23/03
// Modified: 12/30/03
// Modified: 03/02/04
#include "hos_defines.h"
#ifndef __HOS_VMM__
#define __HOS_VMM__ __HOS_VMM__
#define VMM_HE_UNUSED 0 //available entry
#define VMM_HE_FREE 1 //free section of memory
@ -14,10 +18,10 @@
#define VMM_MALLOC_GRANULARITY 4 //granularity for all memory requests
typedef struct {
dword base; //virtual base address
dword size; //size in bytes
dword attributes; //free/used/hole
dword link; //link to next HeapEntry
unsigned int base; //virtual base address
unsigned int size; //size in bytes
unsigned int attributes; //free/used/hole
unsigned int link; //link to next HeapEntry
} __attribute__((packed)) HeapEntry;
@ -27,29 +31,24 @@ typedef struct {
void vmm_init();
void *malloc(dword bytes);
void *malloc(unsigned int bytes);
int free(void *ptr);
void vmm_map1(dword virt, dword physical);
void vmm_mapn(dword virt, dword physical, dword n);
void vmm_unmap1(dword virt);
void vmm_unmapn(dword virt, dword n);
void vmm_map1(unsigned int virt, unsigned int physical);
void vmm_mapn(unsigned int virt, unsigned int physical, unsigned int n);
void vmm_unmap1(unsigned int virt);
void vmm_unmapn(unsigned int virt, unsigned int n);
void vmm_heb_init(HeapEntryBlock *heb);
void *vmm_getFreeChunk(dword bytes);
void *vmm_getFreeChunk(unsigned int bytes);
HeapEntry *vmm_nextHeapEntry();
dword vmm_heapEntriesLeft();
unsigned int vmm_heapEntriesLeft();
HeapEntry *vmm_getLastHeapEntry();
HeapEntry *vmm_getFirstUnusedHeapEntry();
HeapEntry *vmm_getFirstHoleHeapEntry(dword minBytes);
HeapEntry *vmm_getFirstHoleHeapEntry(unsigned int minBytes);
void vmm_addHeapEntryBlock();
int vmm_moreCore(dword bytes);
int vmm_moreCore(unsigned int bytes);
void vmm_coalesceHeapEntry(HeapEntry *he);
HeapEntry *vmm_getHeapEntryByBase(dword base);
HeapEntry *firstHeapEntry = (HeapEntry *)0xD0000000; //this is where heap memory starts
HeapEntry *vmm_getHeapEntryByBase(unsigned int base);
#endif

View File

@ -0,0 +1,88 @@
// string.c
// Author: Josh Holtrop
// Created: 02/26/04
// Implements string functions
#include "string.h"
char *strcat(char *dest, char *src)
{
strcpy(dest+strlen(dest), 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;
}
void rtrim(char *str)
{
str += strlen(str); //now points to the null character at the end of the string
str--;
for (;;)
{
if ((*str == ' ') || (*str == '\t') || (*str == '\n'))
*str-- = 0;
else
break;
}
}
char *ucase(char *str)
{
char *ret = str;
for (;;)
{
if (*str == 0)
break;
if ((*str >= 'a') && (*str <= 'z'))
*str = (*str) - 32;
str++;
}
return ret;
}
char *lcase(char *str)
{
char *ret = str;
for (;;)
{
if (*str == 0)
break;
if ((*str >= 'A') && (*str <= 'Z'))
*str = (*str) + 32;
str++;
}
return ret;
}

View File

@ -0,0 +1,18 @@
// strings.h
// Author: Josh Holtrop
// Created: 02/26/04
// Implements string functions
#ifndef __HOS_STRING__
#define __HOS_STRING__ __HOS_STRING__
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);
#endif

41
src/kernel/sys/cmos.c Normal file
View File

@ -0,0 +1,41 @@
// cmos.c
// Author: Josh Holtrop
// Created: 02/26/04
// Implements various CMOS function calls
#include "hos_defines.h"
#include "cmos.h"
//Returns the cmos type of floppy disk drive 0 (0 = not present)
unsigned char cmos_getfd0()
{
outportb(0x70, 0x10);
return (inportb(0x71) >> 4);
}
//Returns the cmos type of floppy disk drive 1 (0 = not present)
unsigned char cmos_getfd1()
{
outportb(0x70, 0x10);
return (inportb(0x71) & 0x0F);
}
//Returns the cmos type of hard disk drive 0 (0 = not present)
unsigned char cmos_gethd0()
{
outportb(0x70, 0x12);
return (inportb(0x71) >> 4);
}
//Returns the cmos type of hard disk drive 1 (0 = not present)
unsigned char cmos_gethd1()
{
outportb(0x70, 0x12);
return (inportb(0x71) & 0x0F);
}

18
src/kernel/sys/cmos.h Normal file
View File

@ -0,0 +1,18 @@
// cmos.h
// Author: Josh Holtrop
// Created: 02/26/04
// Implements various CMOS function calls
#include "hos_defines.h"
#ifndef __HOS_CMOS__
#define __HOS_CMOS__ __HOS_CMOS__
unsigned char cmos_getfd0();
unsigned char cmos_getfd1();
unsigned char cmos_gethd0();
unsigned char cmos_gethd1();
#endif

8
src/kernel/sys/io.c Normal file
View File

@ -0,0 +1,8 @@
// io.c
// Author: Josh Holtrop
// Created: 02/26/04
// Implements basic port input/output functions
#include "io.h"

40
src/kernel/sys/io.h Normal file
View File

@ -0,0 +1,40 @@
// io.h
// Author: Josh Holtrop
// Created: 02/26/04
// Implements basic port input/output functions
#include "hos_defines.h"
#ifndef __HOS_IO__
#define __HOS_IO__ __HOS_IO__
inline void outportb(unsigned int port, unsigned char value);
inline void outportw(unsigned int port, unsigned int value);
inline unsigned char inportb(unsigned short port);
//Writes a byte out to a port
inline void outportb(unsigned int port, unsigned char value) // Output a byte to a port
{
asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
}
//Writes a word out to a port
inline void outportw(unsigned int port, unsigned int value) // Output a word to a port
{
asm volatile ("outw %%ax,%%dx"::"d" (port), "a" (value));
}
//Reads a byte from a port
inline unsigned char inportb(unsigned short port)
{
unsigned char ret_val;
asm volatile("inb %w1,%b0"
: "=a"(ret_val)
: "d"(port));
return ret_val;
}
#endif

29
src/kernel/sys/pic.c Normal file
View File

@ -0,0 +1,29 @@
// pic.c
// Author: Josh Holtrop
// Created: 02/26/04
#include "hos_defines.h"
#include "pic.h"
//Re-maps the Programmable Interrupr Controllers so IRQ0->pic1 base address, IRG8->pic2 base address
void pic_remap(int pic1, int pic2)
{
byte a1, a2;
a1 = inportb(PIC1_DATA); //0x21
a2 = inportb(PIC2_DATA); //0xA1
outportb(PIC1_COMMAND, ICW1_INIT+ICW1_ICW4); //0x20, 0x10+0x01 00010001b
outportb(PIC2_COMMAND, ICW1_INIT+ICW1_ICW4); //0xA0, 0x10+0x01 00010001b
outportb(PIC1_DATA, pic1); //0x21, pic1
outportb(PIC2_DATA, pic2); //0xA1, pic2
outportb(PIC1_DATA, 4); //0x21, 0x04 00000100b
outportb(PIC2_DATA, 2); //0xA1, 0x02 00000010b
outportb(PIC1_DATA, ICW4_8086); //0x21, 0x01 00000001b
outportb(PIC2_DATA, ICW4_8086); //0xA1, 0x01 00000001b
outportb(PIC1_DATA, a1); //0x21
outportb(PIC2_DATA, a2); //0xA1
}

64
src/kernel/sys/pic.h Normal file
View File

@ -0,0 +1,64 @@
// pic.h
// Author: Josh Holtrop
// Created: 02/26/04
#include "hos_defines.h"
#ifndef __HOS_PIC__
#define __HOS_PIC__ __HOS_PIC__
#define PIC1 0x20
#define PIC2 0xA0
#define PIC1_COMMAND PIC1
#define PIC1_DATA (PIC1+1)
#define PIC2_COMMAND PIC2
#define PIC2_DATA (PIC2+1)
#define PIC_EOI 0x20
#define ICW1_ICW4 0x01 /* ICW4 (not) needed */
#define ICW1_SINGLE 0x02 /* Single (cascade) mode */
#define ICW1_INTERVAL4 0x04 /* Call address interval 4 (8) */
#define ICW1_LEVEL 0x08 /* Level triggered (edge) mode */
#define ICW1_INIT 0x10 /* Initialization - required! */
#define ICW4_8086 0x01 /* 8086/88 (MCS-80/85) mode */
#define ICW4_AUTO 0x02 /* Auto (normal) EOI */
#define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
#define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
#define ICW4_SFNM 0x10 /* Special fully nested (not) */
void pic_remap(int pic1, int pic2);
inline void pic_mask1(byte mask);
inline void pic_mask2(byte mask);
inline void pic_eoi();
inline void pic_eoi2();
//Masks interrupts on first Programmable Interrupt Controller
inline void pic_mask1(byte mask)
{
outportb(PIC1_DATA, mask); //0x21, maskfield *OCW1*
}
//Masks interrupts on second Programmable Interrupt Controller
inline void pic_mask2(byte mask)
{
outportb(PIC2_DATA, mask); //0xA1, maskfield *OCW1*
}
//Signals an End Of Interrupt signal to the first PIC
inline void pic_eoi()
{
outportb(0x20, 0x20);
}
//Signals an End Of Interrupt signal to both the second and first PIC unit
inline void pic_eoi2()
{
outportb(0xA0, 0x20);
outportb(0x20, 0x20);
}
#endif

82
src/kernel/sys/rtc.c Normal file
View File

@ -0,0 +1,82 @@
// rtc.c
// Author: Josh Holtrop
// Created: 02/26/04
// Implements Real-Time Clock function calls
// These functions are for reading and writing various values stored on the CMOS Real Time Clock
// Parameters / return values are in BCD format
#include "hos_defines.h"
#include "rtc.h"
unsigned char rtc_readDay()
{
outportb(0x70, 7);
return inportb(0x71);
}
unsigned char rtc_readMonth()
{
outportb(0x70, 8);
return inportb(0x71);
}
unsigned char rtc_readYear()
{
outportb(0x70, 9);
return inportb(0x71);
}
unsigned char rtc_readSecond()
{
outportb(0x70, 0);
return inportb(0x71);
}
unsigned char rtc_readMinute()
{
outportb(0x70, 2);
return inportb(0x71);
}
unsigned char rtc_readHour()
{
outportb(0x70, 4);
return inportb(0x71);
}
void rtc_setDay(unsigned char day)
{
outportb(0x70, 7);
outportb(0x71, day);
}
void rtc_setMonth(unsigned char month)
{
outportb(0x70, 8);
outportb(0x71, month);
}
void rtc_setYear(unsigned char year)
{
outportb(0x70, 9);
outportb(0x71, year);
}
void rtc_setSecond(unsigned char second)
{
outportb(0x70, 0);
outportb(0x71, second);
}
void rtc_setMinute(unsigned char minute)
{
outportb(0x70, 2);
outportb(0x71, minute);
}
void rtc_setHour(unsigned char hour)
{
outportb(0x70, 4);
outportb(0x71, hour);
}

28
src/kernel/sys/rtc.h Normal file
View File

@ -0,0 +1,28 @@
// rtc.h
// Author: Josh Holtrop
// Created: 02/26/04
// Implements Real-Time Clock function calls
// These functions are for reading and writing various values stored on the CMOS Real Time Clock
// Parameters / return values are in BCD format
#include "hos_defines.h"
#ifndef __HOS_RTC__
#define __HOS_RTC__ __HOS_RTC__
unsigned char rtc_readDay();
unsigned char rtc_readMonth();
unsigned char rtc_readYear();
unsigned char rtc_readSecond();
unsigned char rtc_readMinute();
unsigned char rtc_readHour();
void rtc_setDay(unsigned char dat);
void rtc_setMonth(unsigned char month);
void rtc_setYear(unsigned char year);
void rtc_setSecond(unsigned char second);
void rtc_setMinute(unsigned char minute);
void rtc_setHour(unsigned char hour);
#endif

545
src/kernel/video/stdfont.c Normal file
View File

@ -0,0 +1,545 @@
// stdfont.c
// Author: Josh Holtrop
// Created: 02/26/04
#include "stdfont.h"
const unsigned char stdfont8x5[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xE0, 0xC0, 0x80,
0x00, 0x08, 0x18, 0x38, 0x78, 0x38, 0x18, 0x08,
0x00, 0x20, 0x70, 0xA8, 0x20, 0xA8, 0x70, 0x20,
0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0x00, 0xA0, 0xA0,
0x00, 0x78, 0xA8, 0xA8, 0x78, 0x28, 0x28, 0x68,
0x00, 0x78, 0x80, 0x70, 0x88, 0x70, 0x08, 0xF0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8,
0x00, 0x20, 0x70, 0xA8, 0x20, 0xA8, 0x70, 0xF8,
0x00, 0x20, 0x70, 0xA8, 0x20, 0x20, 0x20, 0x20,
0x00, 0x20, 0x20, 0x20, 0x20, 0xA8, 0x70, 0x20,
0x00, 0x00, 0x20, 0x10, 0xF8, 0x10, 0x20, 0x00,
0x00, 0x00, 0x20, 0x40, 0xF8, 0x40, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x60, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x70, 0xF8, 0xF8, 0x00, 0x00,
0x00, 0x00, 0xF8, 0xF8, 0x70, 0x20, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20,
0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x50, 0xF8, 0x50, 0x50, 0x50, 0xF8, 0x50,
0x00, 0x20, 0x78, 0xA0, 0x70, 0x28, 0xF0, 0x20,
0x00, 0x00, 0x08, 0x90, 0x20, 0x48, 0x80, 0x00,
0x00, 0x20, 0x50, 0x50, 0x20, 0x58, 0x90, 0x68,
0x00, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20,
0x00, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40,
0x00, 0x00, 0xA8, 0x70, 0xF8, 0x70, 0xA8, 0x00,
0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40,
0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x20, 0x60, 0xA0, 0x20, 0x20, 0x20, 0x20,
0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x40, 0xF8,
0x00, 0x70, 0x88, 0x08, 0x10, 0x08, 0x88, 0x70,
0x00, 0x30, 0x50, 0x90, 0x90, 0xF8, 0x10, 0x10,
0x00, 0xF8, 0x80, 0x80, 0xF8, 0x08, 0x88, 0x70,
0x00, 0x38, 0x40, 0x80, 0xF0, 0x88, 0x88, 0x70,
0x00, 0xF8, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40,
0x00, 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70,
0x00, 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x40,
0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10,
0x00, 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00,
0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80,
0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x00, 0x20,
0x00, 0x70, 0x88, 0x88, 0xB8, 0xB0, 0x80, 0x78,
0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70,
0x00, 0xF0, 0x88, 0x88, 0x88, 0x88, 0x88, 0xF0,
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8,
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80,
0x00, 0x70, 0x88, 0x80, 0xB8, 0x88, 0x88, 0x70,
0x00, 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60,
0x00, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88,
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF8,
0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88, 0x88,
0x00, 0x88, 0xC8, 0xE8, 0xB8, 0x98, 0x88, 0x88,
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80,
0x00, 0x70, 0x88, 0x88, 0x88, 0xA8, 0x98, 0x70,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0xA0, 0x90, 0x88,
0x00, 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70,
0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0xA8, 0x50,
0x00, 0x88, 0x50, 0x20, 0x20, 0x50, 0x88, 0x88,
0x00, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20,
0x00, 0xF8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xF8,
0x00, 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70,
0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, 0x00,
0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0xE0,
0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
0x00, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0xF0,
0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70,
0x00, 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78,
0x00, 0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x30, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40,
0x00, 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x70,
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0x88,
0x00, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x90, 0x60,
0x00, 0x80, 0x80, 0x90, 0xA0, 0xC0, 0xA0, 0x90,
0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0xE0,
0x00, 0x00, 0x00, 0xD0, 0xA8, 0xA8, 0xA8, 0xA8,
0x00, 0x00, 0x00, 0xF0, 0x88, 0x88, 0x88, 0x88,
0x00, 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70,
0x00, 0x00, 0x00, 0xF0, 0x88, 0xF0, 0x80, 0x80,
0x00, 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x38,
0x00, 0x00, 0x00, 0x70, 0x48, 0x40, 0x40, 0x40,
0x00, 0x00, 0x00, 0x78, 0x80, 0x70, 0x08, 0xF0,
0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x20,
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20,
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xA8, 0x50,
0x00, 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88,
0x00, 0x00, 0x00, 0x88, 0x88, 0x78, 0x08, 0xF0,
0x00, 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8,
0x00, 0x30, 0x40, 0x40, 0x80, 0x40, 0x40, 0x30,
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0xC0, 0x20, 0x20, 0x10, 0x20, 0x20, 0xC0,
0x00, 0x00, 0x68, 0x90, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0xF8, 0x88, 0x80, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0xF8, 0x48, 0x40, 0x40, 0x40, 0x40, 0xE0,
0x00, 0xF0, 0x50, 0x50, 0x50, 0x50, 0x78, 0x88,
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8,
0x00, 0xA8, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0xA8,
0x00, 0x70, 0x88, 0x08, 0x30, 0x08, 0x88, 0x70,
0x00, 0x88, 0x98, 0xA8, 0xA8, 0xA8, 0xC8, 0x88,
0x00, 0xA8, 0xC8, 0x98, 0xA8, 0xA8, 0xC8, 0x88,
0x00, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88,
0x00, 0xF8, 0x50, 0x50, 0x50, 0x50, 0x50, 0x90,
0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88, 0x88,
0x00, 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80,
0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70,
0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x40, 0x80,
0x00, 0x70, 0x20, 0xF8, 0xA8, 0xF8, 0x20, 0x70,
0x00, 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0xF8, 0x08,
0x00, 0x88, 0x88, 0x88, 0xF8, 0x08, 0x08, 0x38,
0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8,
0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8, 0x08,
0x00, 0xC0, 0x40, 0x40, 0x78, 0x48, 0x48, 0x78,
0x00, 0x88, 0x88, 0xC8, 0xA8, 0xA8, 0xA8, 0xE8,
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0xF0,
0x00, 0xF0, 0x88, 0x08, 0x78, 0x08, 0x88, 0xF0,
0x00, 0x90, 0xA8, 0xA8, 0xE8, 0xA8, 0xA8, 0x90,
0x00, 0x78, 0x88, 0x88, 0x78, 0x28, 0x48, 0x88,
0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x88, 0x78,
0x00, 0x00, 0xF8, 0x80, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x00, 0xF0, 0x88, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x00, 0xF8, 0x48, 0x48, 0x40, 0x40, 0xE0,
0x00, 0x00, 0x78, 0x50, 0x50, 0x50, 0x70, 0x88,
0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x88, 0x70,
0x00, 0x00, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0xA8,
0x00, 0x00, 0x00, 0xF0, 0x88, 0x30, 0x88, 0x70,
0x00, 0x00, 0x88, 0x98, 0xA8, 0xC8, 0x88, 0x88,
0x00, 0x50, 0x20, 0x88, 0x98, 0xA8, 0xC8, 0x88,
0x00, 0x00, 0x88, 0x90, 0xA0, 0xE0, 0x90, 0x88,
0x00, 0x00, 0xF8, 0x48, 0x48, 0x48, 0x48, 0xC8,
0x00, 0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88,
0x00, 0x00, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x88,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0x50, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x88, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x88, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x90, 0x00, 0xF0, 0x80, 0xE0, 0x80, 0xF0,
0x00, 0x00, 0x70, 0x48, 0x70, 0x48, 0x48, 0xF0,
0x00, 0x88, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x88, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x70, 0x50, 0x70, 0x88, 0xF8, 0x88, 0x88,
0x00, 0x88, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88,
0x00, 0x88, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x88, 0xF8, 0x80, 0xE0, 0x80, 0x80, 0xF8,
0x00, 0x40, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x10, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x20, 0x50, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x40, 0x20, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x20, 0x50, 0x00, 0x20, 0x20, 0x20, 0x20,
0x00, 0x20, 0x10, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x00, 0x00, 0x70, 0x80, 0x80, 0x70, 0x20,
0x00, 0x70, 0x88, 0x40, 0xF0, 0x40, 0x40, 0xF8,
0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x88, 0x88, 0x88, 0xF0, 0x80, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80,
0x00, 0x00, 0x70, 0x88, 0x80, 0x80, 0x88, 0x70,
0x00, 0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x00, 0x88, 0x88, 0x50, 0x20, 0x40, 0x80,
0x00, 0x00, 0x70, 0x20, 0xF8, 0xF8, 0x20, 0x70,
0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88,
0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0xF8, 0x08,
0x00, 0x00, 0x88, 0x88, 0x88, 0xF8, 0x08, 0x38,
0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8,
0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8, 0x08,
0x00, 0x00, 0xC0, 0x40, 0x70, 0x48, 0x48, 0x70,
0x00, 0x00, 0x88, 0x88, 0xC8, 0xA8, 0xA8, 0xE8,
0x00, 0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x00, 0x70, 0x88, 0x38, 0x08, 0x88, 0x70,
0x00, 0x00, 0x90, 0xA8, 0xA8, 0xE8, 0xA8, 0x90,
0x00, 0x00, 0x38, 0x48, 0x48, 0x38, 0x28, 0x48,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const unsigned char stdfont10x7[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xE0, 0xF0, 0xFC, 0xF0, 0xE0, 0x80, 0x00, 0x00,
0x00, 0x02, 0x0E, 0x1E, 0x7E, 0x1E, 0x0E, 0x02, 0x00, 0x00,
0x00, 0x10, 0x7C, 0x92, 0x10, 0x92, 0x7C, 0x10, 0x00, 0x00,
0x00, 0x90, 0x90, 0x90, 0x90, 0x00, 0x90, 0x90, 0x00, 0x00,
0x00, 0x7E, 0x92, 0x92, 0x7E, 0x12, 0x12, 0x72, 0x00, 0x00,
0x00, 0x7E, 0x80, 0x7C, 0x82, 0x7C, 0x02, 0xFC, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00,
0x00, 0x10, 0x7C, 0x92, 0x10, 0x92, 0x7C, 0xFE, 0x00, 0x00,
0x00, 0x10, 0x7C, 0x92, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x10, 0x10, 0x10, 0x10, 0x92, 0x7C, 0x10, 0x00, 0x00,
0x00, 0x00, 0x08, 0x04, 0xFE, 0x04, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x40, 0xFE, 0x40, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x7C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFE, 0xFE, 0x7C, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,
0x00, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x44, 0xFE, 0x44, 0x44, 0x44, 0xFE, 0x44, 0x00, 0x00,
0x00, 0x10, 0x7E, 0x90, 0x7C, 0x12, 0xFC, 0x10, 0x00, 0x00,
0x00, 0x00, 0x04, 0x88, 0x10, 0x22, 0x40, 0x00, 0x00, 0x00,
0x00, 0x38, 0x44, 0x44, 0x78, 0x86, 0x84, 0x7A, 0x00, 0x00,
0x00, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00, 0x00,
0x00, 0x40, 0x20, 0x10, 0x10, 0x10, 0x20, 0x40, 0x00, 0x00,
0x00, 0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x02, 0x7C, 0x80, 0x80, 0xFE, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x02, 0x0C, 0x02, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x38, 0x48, 0x88, 0x88, 0xFE, 0x08, 0x08, 0x00, 0x00,
0x00, 0xFE, 0x80, 0x80, 0xFE, 0x02, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x3E, 0x40, 0x80, 0xFC, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0xFE, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0x7C, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0x7E, 0x02, 0x02, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x60, 0x00, 0x00,
0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00,
0x00, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x02, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0x9A, 0x9C, 0x80, 0x7E, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7C, 0x00, 0x00,
0x00, 0xFC, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0xFE, 0x80, 0x80, 0xFC, 0x80, 0x80, 0xFE, 0x00, 0x00,
0x00, 0xFE, 0x80, 0x80, 0xFC, 0x80, 0x80, 0x80, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x80, 0x9E, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x84, 0x88, 0x90, 0xE0, 0x90, 0x88, 0x84, 0x00, 0x00,
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFE, 0x00, 0x00,
0x00, 0x82, 0xEE, 0x92, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0x82, 0xC2, 0xA2, 0x92, 0x8A, 0x86, 0x82, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x80, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0x82, 0x92, 0x8A, 0x7C, 0x00, 0x00,
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x88, 0x84, 0x82, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x80, 0x7C, 0x02, 0x82, 0x7C, 0x00, 0x00,
0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0x6C, 0x00, 0x00,
0x00, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00,
0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0xFE, 0x02, 0x0C, 0x10, 0x60, 0x80, 0xFE, 0x00, 0x00,
0x00, 0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0x78, 0x00, 0x00,
0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00,
0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x00, 0x00,
0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00,
0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x80, 0x80, 0xFC, 0x82, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7C, 0x82, 0x80, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x02, 0x02, 0x7E, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
0x00, 0x30, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7E, 0x82, 0x82, 0x82, 0x7E, 0x02, 0x7C,
0x00, 0x80, 0x80, 0xF8, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
0x00, 0x40, 0x00, 0xC0, 0x40, 0x40, 0x40, 0xE0, 0x00, 0x00,
0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60,
0x00, 0x80, 0x80, 0x88, 0xB0, 0xC0, 0xB0, 0x88, 0x00, 0x00,
0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0xE0, 0x00, 0x00,
0x00, 0x00, 0x00, 0xEC, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF8, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7C, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFC, 0x82, 0x82, 0x82, 0xFC, 0x80, 0x80,
0x00, 0x00, 0x00, 0x7C, 0x84, 0x84, 0x84, 0x7C, 0x04, 0x3C,
0x00, 0x00, 0x00, 0xB8, 0x44, 0x40, 0x40, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7C, 0x80, 0x78, 0x04, 0xF8, 0x00, 0x00,
0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00,
0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x92, 0x6C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x00, 0x00,
0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x7C, 0x04, 0xF8,
0x00, 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8, 0x00, 0x00,
0x00, 0x18, 0x20, 0x20, 0x40, 0x20, 0x20, 0x18, 0x00, 0x00,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x60, 0x10, 0x10, 0x08, 0x10, 0x10, 0x60, 0x00, 0x00,
0x00, 0x00, 0x72, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0xFE, 0x82, 0x80, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0xFE, 0x62, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00,
0x00, 0xFC, 0x6C, 0x6C, 0x6C, 0x6C, 0x7E, 0x82, 0x00, 0x00,
0x00, 0xFE, 0x80, 0x80, 0xFC, 0x80, 0x80, 0xFE, 0x00, 0x00,
0x00, 0x92, 0x92, 0x7C, 0x10, 0x7C, 0x92, 0x92, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x02, 0x1C, 0x02, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x82, 0x8E, 0x92, 0x92, 0x92, 0xE2, 0x82, 0x00, 0x00,
0x00, 0x92, 0xE2, 0x8E, 0x92, 0x92, 0xE2, 0x82, 0x00, 0x00,
0x00, 0x82, 0x8C, 0x90, 0xE0, 0x90, 0x8C, 0x82, 0x00, 0x00,
0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x8C, 0x00, 0x00,
0x00, 0x82, 0xEE, 0x92, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0xFC, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x80, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7C, 0x00, 0x00,
0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0x6C, 0x10, 0x60, 0x80, 0x00, 0x00,
0x00, 0x7C, 0x10, 0xFE, 0x92, 0xFE, 0x10, 0x7C, 0x00, 0x00,
0x00, 0x82, 0x82, 0x6C, 0x10, 0x6C, 0x82, 0x82, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x00, 0x00,
0x00, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x02, 0x1E, 0x00, 0x00,
0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x00, 0x00,
0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x02, 0x00, 0x00,
0x00, 0xE0, 0x60, 0x60, 0x7E, 0x62, 0x62, 0x7E, 0x00, 0x00,
0x00, 0x82, 0x82, 0xE2, 0x92, 0x92, 0x92, 0xF2, 0x00, 0x00,
0x00, 0x80, 0x80, 0xFC, 0x82, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0xFC, 0x82, 0x02, 0x7E, 0x02, 0x82, 0xFC, 0x00, 0x00,
0x00, 0x8C, 0x92, 0x92, 0xF2, 0x92, 0x92, 0x8C, 0x00, 0x00,
0x00, 0x7E, 0x82, 0x82, 0x7E, 0x12, 0x62, 0x82, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x02, 0x7E, 0x82, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x00, 0xFE, 0x80, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0x00, 0xFC, 0x82, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0x00, 0xFE, 0x62, 0x62, 0x60, 0x60, 0xF0, 0x00, 0x00,
0x00, 0x00, 0x7E, 0x6C, 0x6C, 0x6C, 0x7C, 0x82, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x82, 0xFE, 0x80, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x92, 0x7C, 0x10, 0x7C, 0x92, 0x92, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFC, 0x82, 0x1C, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x82, 0x8E, 0x92, 0xE2, 0x82, 0x82, 0x00, 0x00,
0x00, 0x6C, 0x10, 0x82, 0x8E, 0x92, 0xE2, 0x82, 0x00, 0x00,
0x00, 0x00, 0x82, 0x8C, 0x90, 0xF0, 0x8C, 0x82, 0x00, 0x00,
0x00, 0x00, 0xFE, 0x62, 0x62, 0x62, 0x62, 0xE2, 0x00, 0x00,
0x00, 0x00, 0x82, 0xEE, 0x92, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0x00, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7C, 0x44, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x44, 0x00, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x44, 0x00, 0x7C, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x82, 0x00, 0x82, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x8C, 0x00, 0xFC, 0x80, 0xF0, 0x80, 0xFC, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x62, 0x7C, 0x62, 0x62, 0xFC, 0x00, 0x00,
0x00, 0x82, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x82, 0x00, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
0x00, 0x7C, 0x44, 0x7C, 0x82, 0xFE, 0x82, 0x82, 0x00, 0x00,
0x00, 0x82, 0x7C, 0x82, 0x82, 0xFE, 0x82, 0x82, 0x00, 0x00,
0x00, 0x82, 0x7C, 0x82, 0x82, 0x82, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x82, 0x00, 0x82, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x82, 0xFE, 0x80, 0xF0, 0x80, 0x80, 0xFE, 0x00, 0x00,
0x00, 0x60, 0x10, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
0x00, 0x0C, 0x10, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
0x00, 0x10, 0x6C, 0x7C, 0x82, 0xFE, 0x80, 0x7E, 0x00, 0x00,
0x00, 0x60, 0x10, 0x7C, 0x02, 0x7E, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x10, 0x6C, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x10, 0x0C, 0x82, 0x82, 0x82, 0x82, 0x7E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7C, 0x80, 0x80, 0x7C, 0x10, 0x00, 0x00,
0x00, 0x7C, 0x82, 0x60, 0xFC, 0x60, 0x60, 0xFE, 0x00, 0x00,
0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x82, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFC, 0x82, 0x82, 0xFC, 0x80, 0x80, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x82, 0x80, 0x80, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
0x00, 0x00, 0x82, 0x82, 0x6C, 0x10, 0x60, 0x80, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x10, 0xFE, 0xFE, 0x10, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x82, 0x6C, 0x10, 0x6C, 0x82, 0x82, 0x00, 0x00,
0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x00, 0x00,
0x00, 0x00, 0x82, 0x82, 0x82, 0xFE, 0x02, 0x1E, 0x00, 0x00,
0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x00, 0x00,
0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0xFE, 0x02, 0x00, 0x00,
0x00, 0x00, 0xE0, 0x60, 0x7C, 0x62, 0x62, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x82, 0x82, 0xE2, 0x92, 0x92, 0xF2, 0x00, 0x00,
0x00, 0x00, 0x80, 0x80, 0xFC, 0x82, 0x82, 0xFC, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x82, 0x1E, 0x02, 0x82, 0x7C, 0x00, 0x00,
0x00, 0x00, 0x8C, 0x92, 0x92, 0xF2, 0x92, 0x8C, 0x00, 0x00,
0x00, 0x00, 0x1E, 0x62, 0x62, 0x1E, 0x12, 0x62, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
StdFont fonts[] = {
{stdfont8x5, 8, 5},
{stdfont10x7, 10, 7}
};
//Returns the standard font size, 0 = invalid font
// bits 0-7 = font width
// bits 8-15 = font height
unsigned int stdfont_getFontSize(unsigned int fontNumber)
{
if (fontNumber >= STDFONTS)
return 0;
return (fonts[fontNumber].charHeight << 8) | fonts[fontNumber].charWidth;
}
//Returns a pointer to the desired font's bitmap representation
unsigned char *stdfont_getBitmap(unsigned int fontNumber)
{
if (fontNumber >= STDFONTS)
return 0;
return (unsigned char *)fonts[fontNumber].fontPtr;
}

View File

@ -0,0 +1,26 @@
// stdfont.c
// Author: Josh Holtrop
// Created: 02/26/04
// Standard font server
#ifndef __HOS_STDFONT__
#define __HOS_STDFONT__ __HOS_STDFONT__
#define STDFONTS 2
typedef struct {
const unsigned char *fontPtr;
unsigned int charHeight;
unsigned int charWidth;
} StdFont;
//Returns the standard font size, 0 = invalid font
// bits 0-7 = font width
// bits 8-15 = font height
unsigned int stdfont_getFontSize(unsigned int fontNumber);
//Returns a pointer to the desired font's bitmap representation
unsigned char *stdfont_getBitmap(unsigned int fontNumber);
#endif

View File

@ -1,7 +1,17 @@
// video.c
// 08/13/03 Josh Holtrop
// Modified: 11/12/03
// Modified: 03/02/04
#include "hos_defines.h"
#include "video.h"
ModeInfoBlock video_mode;
dword videoMode = 0; //what video mode # we are in, 0 for console mode
word *vid_ptr16 = (word *)0xF0000000;
byte *vid_ptr24 = (byte *)0xF0000000;
dword *vid_ptr32 = (dword *)0xF0000000;
word console_memory[2000]; //holds a copy of the console's memory
void (*video_psetp)(int, dword) = video_psetpnull; //function pointer to set a pixel
//Initialized the video mode information block video_mode and allocated double-buffer memory for graphics display
void video_init()
@ -66,6 +76,20 @@ void video_horiz(int y, int x1, int x2, dword color)
}
}
//Draws a single pixel
void video_pset(int x, int y, dword color)
{
if ((x < 0) || (x > video_mode.XResolution) || (y < 0) || (y > video_mode.YResolution))
return;
video_psetp(y*video_mode.XResolution+x, color);
}
//Draws a pixel at the specified pixel position
void video_pseti(int pixel, dword color)
{
video_psetp(pixel, color);
}
//Draws a vertical line
void video_vert(int x, int y1, int y2, dword color)
{
@ -113,14 +137,6 @@ void video_rectf(int x1, int y1, int x2, int y2, dword color)
video_horiz(y1, x1, x2, color);
}
//Draws a single pixel
inline void video_pset(int x, int y, dword color)
{
if ((x < 0) || (x > video_mode.XResolution) || (y < 0) || (y > video_mode.YResolution))
return;
video_psetp(y*video_mode.XResolution+x, color);
}
//Draws a pixel at the specified pixel position
void video_psetp16(int pixel, dword color)
{
@ -170,7 +186,3 @@ void video_drawConsoleChar(dword position)
}

View File

@ -1,13 +1,19 @@
// video.h
// 08/18/03 Josh Holtrop
// Modified: 12/28/03
// Modified: 03/02/04
#include "hos_defines.h"
#ifndef __HOS_VIDEO__
#define __HOS_VIDEO__ __HOS_VIDEO__
void video_init();
void video_horiz(int y, int x1, int x2, dword color);
void video_vert(int x, int y1, int y2, dword color);
void video_rect(int x1, int y1, int x2, int y2, dword color);
void video_rectf(int x1, int y1, int x2, int y2, dword color);
inline void video_pset(int x, int y, dword color);
void video_pset(int x, int y, dword color);
void video_pseti(int pixel, dword color);
void video_psetp16(int pixel, dword color);
void video_psetp24(int pixel, dword color);
void video_psetp32(int pixel, dword color);
@ -57,16 +63,6 @@ typedef struct{
} ModeInfoBlock;
ModeInfoBlock video_mode;
dword videoMode = 0; //what video mode # we are in, 0 for console mode
word *vid_ptr16 = (word *)0xF0000000;
byte *vid_ptr24 = (byte *)0xF0000000;
dword *vid_ptr32 = (dword *)0xF0000000;
word console_memory[2000]; //holds a copy of the console's memory
void (*video_psetp)(int, dword) = video_psetpnull; //function pointer to set a pixel
#endif

52
src/readme.txt Normal file
View File

@ -0,0 +1,52 @@
HOS - Holtrop's Operating System
HOS is a 32-bit, protected mode, graphical, multitasking operating system.
It was written by me, Josh Holtrop, with help from a few others along the way.
History
-------------
0.14
03/01/04 - Thanks to Ben Meyer for helping me get a Makefile working and building on linux to work!
0.13
01/26/04 - functions added to read/write CMOS clock date and time
01/19/04 - fixed bug GDTR/IDTR pointing to physical rather than linear table base address
01/07/04 - fixed bug not reading sectors correctly from floppy
12/28/03 - fixed bug not storing eax on interrupt
12/25/03 - fixed bug in mm_palloc()
12/25/03 - incorporated output functions as regular functions rather than as part of a linked library
12/23/03 - re-written physical memory manager using bitmap instead of stack
12/22/03 - kernel relocated to 3gb linear / 1mb+24kb physical to allow for app. address space
0.12
12/21/03 - sample bmp loader tested, works (tests loading a kernel of size ~ 932kb
12/20/03 - GDT/IDT now located at 1mb physical, before kernel
10/30/03 - turns floppy motor off
10/30/03 - keyboard LEDs working
10/29/03 - paging functions working
10/15/03 - physical memory management page allocators working
0.11
10/09/03 - PS/2 mouse driver
0.10
09/11/03 - Rewritten C and assembly kernel with VESA GUI mode support, keyboard driver
0.05
05/14/03 - HGUI24/HGUI32 commands finished for testing GUI on both 24bpp and 32bpp graphics cards
05/14/03 - first web release!
0.04
03/09/03 - added VM shortcut command
03/09/03 - press up to fill retrieve last inputted command for Nate Scholten
03/08/03 - press clear to clear console input
03/07/03 - added "shortcut" commands PC, IC, ? for Nate Scholten
03/06/03 - added PROMPTC, INPUTC commands
0.03
12/30/02 - Command Line Interface working, accepting basic commands

258
stdfont.h
View File

@ -1,258 +0,0 @@
const byte stdfont[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xE0, 0xC0, 0x80,
0x00, 0x08, 0x18, 0x38, 0x78, 0x38, 0x18, 0x08,
0x00, 0x20, 0x70, 0xA8, 0x20, 0xA8, 0x70, 0x20,
0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0x00, 0xA0, 0xA0,
0x00, 0x78, 0xA8, 0xA8, 0x78, 0x28, 0x28, 0x68,
0x00, 0x78, 0x80, 0x70, 0x88, 0x70, 0x08, 0xF0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8,
0x00, 0x20, 0x70, 0xA8, 0x20, 0xA8, 0x70, 0xF8,
0x00, 0x20, 0x70, 0xA8, 0x20, 0x20, 0x20, 0x20,
0x00, 0x20, 0x20, 0x20, 0x20, 0xA8, 0x70, 0x20,
0x00, 0x00, 0x20, 0x10, 0xF8, 0x10, 0x20, 0x00,
0x00, 0x00, 0x20, 0x40, 0xF8, 0x40, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x60, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x70, 0xF8, 0xF8, 0x00, 0x00,
0x00, 0x00, 0xF8, 0xF8, 0x70, 0x20, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x20, 0x20,
0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x50, 0xF8, 0x50, 0x50, 0x50, 0xF8, 0x50,
0x00, 0x20, 0x78, 0xA0, 0x70, 0x28, 0xF0, 0x20,
0x00, 0x00, 0x08, 0x90, 0x20, 0x48, 0x80, 0x00,
0x00, 0x20, 0x50, 0x50, 0x20, 0x58, 0x90, 0x68,
0x00, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20,
0x00, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40,
0x00, 0x00, 0xA8, 0x70, 0xF8, 0x70, 0xA8, 0x00,
0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40,
0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60,
0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x20, 0x60, 0xA0, 0x20, 0x20, 0x20, 0x20,
0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x40, 0xF8,
0x00, 0x70, 0x88, 0x08, 0x10, 0x08, 0x88, 0x70,
0x00, 0x30, 0x50, 0x90, 0x90, 0xF8, 0x10, 0x10,
0x00, 0xF8, 0x80, 0x80, 0xF8, 0x08, 0x88, 0x70,
0x00, 0x38, 0x40, 0x80, 0xF0, 0x88, 0x88, 0x70,
0x00, 0xF8, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40,
0x00, 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70,
0x00, 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x40,
0x00, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10,
0x00, 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00,
0x00, 0x80, 0x40, 0x20, 0x10, 0x20, 0x40, 0x80,
0x00, 0x70, 0x88, 0x08, 0x10, 0x20, 0x00, 0x20,
0x00, 0x70, 0x88, 0x88, 0xB8, 0xB0, 0x80, 0x78,
0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70,
0x00, 0xF0, 0x88, 0x88, 0x88, 0x88, 0x88, 0xF0,
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8,
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80,
0x00, 0x70, 0x88, 0x80, 0xB8, 0x88, 0x88, 0x70,
0x00, 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60,
0x00, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88,
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF8,
0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88, 0x88,
0x00, 0x88, 0xC8, 0xE8, 0xB8, 0x98, 0x88, 0x88,
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80,
0x00, 0x70, 0x88, 0x88, 0x88, 0xA8, 0x98, 0x70,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0xA0, 0x90, 0x88,
0x00, 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70,
0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0xA8, 0x50,
0x00, 0x88, 0x50, 0x20, 0x20, 0x50, 0x88, 0x88,
0x00, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x20,
0x00, 0xF8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xF8,
0x00, 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70,
0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, 0x00,
0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0xE0,
0x00, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
0x00, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0xF0,
0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70,
0x00, 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78,
0x00, 0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x30, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40,
0x00, 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x70,
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0x88,
0x00, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x90, 0x60,
0x00, 0x80, 0x80, 0x90, 0xA0, 0xC0, 0xA0, 0x90,
0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0xE0,
0x00, 0x00, 0x00, 0xD0, 0xA8, 0xA8, 0xA8, 0xA8,
0x00, 0x00, 0x00, 0xF0, 0x88, 0x88, 0x88, 0x88,
0x00, 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70,
0x00, 0x00, 0x00, 0xF0, 0x88, 0xF0, 0x80, 0x80,
0x00, 0x00, 0x00, 0x78, 0x88, 0x78, 0x08, 0x38,
0x00, 0x00, 0x00, 0x70, 0x48, 0x40, 0x40, 0x40,
0x00, 0x00, 0x00, 0x78, 0x80, 0x70, 0x08, 0xF0,
0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x20,
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20,
0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xA8, 0x50,
0x00, 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88,
0x00, 0x00, 0x00, 0x88, 0x88, 0x78, 0x08, 0xF0,
0x00, 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8,
0x00, 0x30, 0x40, 0x40, 0x80, 0x40, 0x40, 0x30,
0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0xC0, 0x20, 0x20, 0x10, 0x20, 0x20, 0xC0,
0x00, 0x00, 0x68, 0x90, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0xF8, 0x88, 0x80, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0xF8, 0x48, 0x40, 0x40, 0x40, 0x40, 0xE0,
0x00, 0xF0, 0x50, 0x50, 0x50, 0x50, 0x78, 0x88,
0x00, 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8,
0x00, 0xA8, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0xA8,
0x00, 0x70, 0x88, 0x08, 0x30, 0x08, 0x88, 0x70,
0x00, 0x88, 0x98, 0xA8, 0xA8, 0xA8, 0xC8, 0x88,
0x00, 0xA8, 0xC8, 0x98, 0xA8, 0xA8, 0xC8, 0x88,
0x00, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88,
0x00, 0xF8, 0x50, 0x50, 0x50, 0x50, 0x50, 0x90,
0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88, 0x88,
0x00, 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80,
0x00, 0x70, 0x88, 0x80, 0x80, 0x80, 0x88, 0x70,
0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x40, 0x80,
0x00, 0x70, 0x20, 0xF8, 0xA8, 0xF8, 0x20, 0x70,
0x00, 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88,
0x00, 0x88, 0x88, 0x88, 0x88, 0x88, 0xF8, 0x08,
0x00, 0x88, 0x88, 0x88, 0xF8, 0x08, 0x08, 0x38,
0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8,
0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8, 0x08,
0x00, 0xC0, 0x40, 0x40, 0x78, 0x48, 0x48, 0x78,
0x00, 0x88, 0x88, 0xC8, 0xA8, 0xA8, 0xA8, 0xE8,
0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0xF0,
0x00, 0xF0, 0x88, 0x08, 0x78, 0x08, 0x88, 0xF0,
0x00, 0x90, 0xA8, 0xA8, 0xE8, 0xA8, 0xA8, 0x90,
0x00, 0x78, 0x88, 0x88, 0x78, 0x28, 0x48, 0x88,
0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x88, 0x78,
0x00, 0x00, 0xF8, 0x80, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x00, 0xF0, 0x88, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x00, 0xF8, 0x48, 0x48, 0x40, 0x40, 0xE0,
0x00, 0x00, 0x78, 0x50, 0x50, 0x50, 0x70, 0x88,
0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x88, 0x70,
0x00, 0x00, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0xA8,
0x00, 0x00, 0x00, 0xF0, 0x88, 0x30, 0x88, 0x70,
0x00, 0x00, 0x88, 0x98, 0xA8, 0xC8, 0x88, 0x88,
0x00, 0x50, 0x20, 0x88, 0x98, 0xA8, 0xC8, 0x88,
0x00, 0x00, 0x88, 0x90, 0xA0, 0xE0, 0x90, 0x88,
0x00, 0x00, 0xF8, 0x48, 0x48, 0x48, 0x48, 0xC8,
0x00, 0x00, 0x88, 0xD8, 0xA8, 0x88, 0x88, 0x88,
0x00, 0x00, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88,
0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x00, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x88,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0x50, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x88, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x88, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x90, 0x00, 0xF0, 0x80, 0xE0, 0x80, 0xF0,
0x00, 0x00, 0x70, 0x48, 0x70, 0x48, 0x48, 0xF0,
0x00, 0x88, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x88, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x70, 0x50, 0x70, 0x88, 0xF8, 0x88, 0x88,
0x00, 0x88, 0x70, 0x88, 0x88, 0xF8, 0x88, 0x88,
0x00, 0x88, 0x70, 0x88, 0x88, 0x88, 0x88, 0x70,
0x00, 0x88, 0x00, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x88, 0xF8, 0x80, 0xE0, 0x80, 0x80, 0xF8,
0x00, 0x40, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x10, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x20, 0x50, 0x70, 0x88, 0xF8, 0x80, 0x78,
0x00, 0x40, 0x20, 0x70, 0x08, 0x78, 0x88, 0x78,
0x00, 0x20, 0x50, 0x00, 0x20, 0x20, 0x20, 0x20,
0x00, 0x20, 0x10, 0x88, 0x88, 0x88, 0x88, 0x78,
0x00, 0x00, 0x00, 0x70, 0x80, 0x80, 0x70, 0x20,
0x00, 0x70, 0x88, 0x40, 0xF0, 0x40, 0x40, 0xF8,
0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x88, 0x88, 0x88, 0xF0, 0x80, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80,
0x00, 0x00, 0x70, 0x88, 0x80, 0x80, 0x88, 0x70,
0x00, 0x00, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x00, 0x88, 0x88, 0x50, 0x20, 0x40, 0x80,
0x00, 0x00, 0x70, 0x20, 0xF8, 0xF8, 0x20, 0x70,
0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88,
0x00, 0x00, 0x88, 0x88, 0x88, 0x88, 0xF8, 0x08,
0x00, 0x00, 0x88, 0x88, 0x88, 0xF8, 0x08, 0x38,
0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8,
0x00, 0x00, 0xA8, 0xA8, 0xA8, 0xA8, 0xF8, 0x08,
0x00, 0x00, 0xC0, 0x40, 0x70, 0x48, 0x48, 0x70,
0x00, 0x00, 0x88, 0x88, 0xC8, 0xA8, 0xA8, 0xE8,
0x00, 0x00, 0x80, 0x80, 0xF0, 0x88, 0x88, 0xF0,
0x00, 0x00, 0x70, 0x88, 0x38, 0x08, 0x88, 0x70,
0x00, 0x00, 0x90, 0xA8, 0xA8, 0xE8, 0xA8, 0x90,
0x00, 0x00, 0x38, 0x48, 0x48, 0x38, 0x28, 0x48,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

91
vfs.c
View File

@ -1,91 +0,0 @@
// vfs.c
// Author: Josh Holtrop
// Created: 12/31/03
// Modified: 01/04/04
void vfs_init()
{
firstDiskDevice = malloc(sizeof(DiskDevice));
firstDiskDevice->type = VFS_DISK_FD;
firstDiskDevice->fileSystem = VFS_FS_FAT12;
firstDiskDevice->location = VFS_LOC_FD0;
firstDiskDevice->link = 0;
strcpy(firstDiskDevice->id, "fd0");
rootDevice = firstDiskDevice;
if (*(byte *)0xC0090000) // the user chose to load an initial ram disk from the floppy
{
DiskDevice *rd = malloc(sizeof(DiskDevice));
firstDiskDevice->link = (dword)rd;
rd->type = VFS_DISK_RD;
rd->fileSystem = VFS_FS_FAT12;
rd->location = 0xC0200000;
rd->link = 0;
strcpy(rd->id, "rd0");
rootDevice = rd;
}
}
byte *vfs_readFile(char *fileName)
{
DiskDevice *dd;
dword fileStartPosition;
if (fileName[0] == '/')
{
dd = rootDevice;
fileStartPosition = 1;
}
else
{
if (strlen(fileName) < 5) //not a long enough file name
return 0;
if (!((fileName[3] == ':') && (fileName[4] == '/'))) //if we aren't using the root directory, then there must be a 3 character device explicitly specified
return 0; // followed by a colon and then a slash
char device[4];
memcpy(device, fileName, 3); //copy the 3 digit device id to device
device[3] = 0; //null-terminating character for device string
dd = vfs_getDiskDeviceByID(device);
if (!dd) //the specified device was not found
return 0;
fileStartPosition = 5;
}
switch (dd->fileSystem)
{
case VFS_FS_FAT12:
return fat12_readFile(fileName+fileStartPosition, dd);
}
return 0;
}
byte *vfs_readSector(DiskDevice *dd, dword sector, byte *dest, dword sectors)
{
byte *origDest = dest;
switch (dd->type)
{
case VFS_DISK_RD:
for (; sectors > 0; sectors--, dest += 512, sector++)
rd_readSector(dd, sector, dest);
return origDest;
}
return 0;
}
DiskDevice *vfs_getDiskDeviceByID(char *id)
{
DiskDevice *dd = firstDiskDevice;
for (;;)
{
if (strcmp(dd->id, id))
return dd;
dd = (DiskDevice *)dd->link;
if (!dd)
break;
}
return 0;
}

33
vfs.h
View File

@ -1,33 +0,0 @@
// vfs.h
// Author: Josh Holtrop
// Created: 12/31/03
// Modified: 01/04/04
#define VFS_DISK_RD 1
#define VFS_DISK_FD 2
#define VFS_DISK_HD 3
#define VFS_FS_FAT12 1
#define VFS_LOC_FD0 1
typedef struct {
dword type;
dword fileSystem;
dword location;
dword link;
char id[4];
} __attribute__((packed)) DiskDevice;
void vfs_init();
byte *vfs_readFile(char *fileName);
byte *vfs_readSector(DiskDevice *dd, dword sector, byte *dest, dword sectors);
DiskDevice *vfs_getDiskDeviceByID(char *id);
DiskDevice *rootDevice = 0;
DiskDevice *firstDiskDevice = 0;