API:
// Malta API
void cls()
{
unsigned char *pntr = (unsigned char *)0xB8000; //setup the pointer
const long size = 80*25; //console size
long loop; //counter

for (loop=0; loop *pntr++ = 0;
*pntr++ = 0xF;
}
void MsgBox(msg, title);
{
unsigned char *pntr = (unsigned char *)0xB8000; //setup the pointer
const long size = 80*25; //console size
long loop; //counter

framePrint("msgbox");
scrPrint("-------------------------------------/n");
scrColor(blue);
scrPrint(" "title" /n");
scrDefault();
scrPrint("-------------------------------------/n');
scrPrint(true, msg);
buttonPrint(msgbox, "OK");
scrPrint("-------------------------------------/n");
mouseEn();
if (okpressed = 1;)
{ cls();
}
void Start()
{
loader();
}
void GetProperitesOfFile(file);
{
read = 096:975:865 // translates to first sector on cy 0 and side 0
find = 100:000:000 // translates to second sector on cy 0 and side 0
var result = getIt(hdimg);
}
Loader:
global _loader ; making entry point visible to linker
extern _FSMain ; tells the linker that main is in an other file
; doing some grub magic
MODULEALIGN equ 1<<0
MEMINFO equ 1<<1
FLAGS equ MODULEALIGN | MEMINFO
MAGIC equ 0x1BADB002
CHECKSUM equ -(MAGIC + FLAGS)

section .text
align 4
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM

STACKSIZE equ 0x8000 ; reserve 32k of kernel stack space

_loader:
mov esp, stack+STACKSIZE ; set up the stack
push eax ; do multiboot magic
push ebx ; and info structure
call _FSMain ; call function main
hlt ; halt the machine as soon as main returns
section .bss
align 32
stack:
resb STACKSIZE ; reserve 32k stack
For people without Linux and GRUB:
global _loader ; making entry point visible to linker
extern _FSmain ; tells the linker that main is in an other file
; not doing some grub magic
MODULEALIGN equ 1<<0
MEMINFO equ 1<<1
FLAGS equ MODULEALIGN | MEMINFO
MAGIC equ 0x1BADB002
CHECKSUM equ -(MAGIC + FLAGS)
section .text
STACKSIZE equ 0x8000 ; reserve 32k of kernel stack space
_loader:
mov esp, stack+STACKSIZE ; set up the stack
push eax ; do multiboot magic
push ebx ; and info structure

call _FSMain ; call function FSMain
hlt ; halt the machine as soon as FSMain

returns

section .bss
align 32
stack:
resb STACKSIZE ; reserve 32k stack
C part:
// Malta loader
var hdimg = "fs.dir"
var s1 = 0;
scrPrint("Ok when loading...");
// Now to init!
initFS(hdimg, 1, df );
// Fail (yet again?)
if(s1 = 0);
{
scrPrint("Couldn't load filesystem! Error 2.");
}
else()
{
scrPrint("Loaded fully!");
countdown(5, "Load up!");
ExcuteFile("fileman.prg");
}
Hosted by www.Geocities.ws

1