This is the source code:
Code: Select all
; boot.asm
.386 ; Compile for i386 processors
.model TINY ; memory of model?
extrn _KMain:near ; C prototype function
.code
org 07c00h ; BootSector
;----------------------- CODE SEGMENT -----------------------
main:
jmp short start
nop
start:
call _KMain
ret
END mainCode: Select all
//kernel.c
#include "stddef.h"
WORD *vmem = (WORD*)0xB8000;
void kclear()
{
for(int i=80*25; i; i--)
vmem[i] = 0;
}
void kprint(char *text)
{
WORD *t_vmem = vmem;
while(*text)
{
*t_vmem++ = H_WHITE | (*text++<<8);
}
}
extern "C" void KMain()
{
kclear();
kprint("Hello");
while(true);
}Code: Select all
@del *.obj
@bintools\ml /AT /c boot.asm
@bintools\cl /Gs /c /Zl *.cpp
@bintools\link /NOD boot.obj kmain.obj
@pause
createimg.exeCode: Select all
Microsoft (R) Macro Assembler Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: boot.asm
boot.asm(17) : warning A4023:with /coff switch, leading underscore required for
start address : main
Microsoft (R) 32-bit C/C++ Optimizing Compiler versione 15.00.30729.01 per 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
kmain.cpp
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.Any idea or tips?


