You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include"Types.h"voidkPrintString(intiX, intiY, constchar*pcString);
// This function must be the first function defined. Otherwise, other function// will be located at 0x10200voidMain(void) {
kPrintString(0, 3, "C Language Kernel Started~!!!");
while (1);
}
// Looks familiar, right? :D// you can find assembly version in Bootloader.asm and EntryPoint.svoidkPrintString(intiX, intiY, constchar*pcString) {
CHARACTER*pstScreen= (CHARACTER*) 0xB8000;
inti;
pstScreen+=iY*80+iX;
for (i=0; pcString[i] !=0; i++) {
pstScreen[i].bCharacter=pcString[i];
}
}
// Types.h header file// Because we still access to video memory address, a structure// for printing text is defined#ifndef__Types_H__#define__Types_H__#defineBYTE unsigned char
#defineWORD unsigned short
#defineDWORD unsigned int
#defineQWORD unsigned long
#defineBOOL unsigned char
#defineTRUE 1
#defineFALSE 0
#defineNULL 0
#pragma pack(push, 1)
typedefstructkChractorStruct {
BYTEbCharacter;
BYTEbAttribute;
} CHARACTER;
#pragma pack(pop)
#endif
;; Part of EntryPoint.C ;; Let EntryPoint execute code written in Cpush (SWITCHSUCCESSMESSAGE - $$ +0x10000)push2push0call PRINTMESSAGEaddesp,12 ; 4 bytes (Protected Mode) * 3 ; In EntryPoint.s, replace jmp $ ; jump to code which is written in C languagejmp dword 0x08:0x10200