I'm testing the FreeBASIC to develop a OS with a wiki entry. With this code:
Code: Select all
DECLARE SUB PrintString(src AS Byte Ptr, x AS LONG, y AS LONG)
DECLARE SUB main ()
SUB multiboot ()
Asm
'setting up the Multiboot header - see GRUB docs for details
.set ALIGN, 1<<0
.set MEMINFO, 1<<1
.set FLAGS, ALIGN | MEMINFO
.set MAGIC, 0x1BADB002
.set CHECKSUM, -(MAGIC + FLAGS)
.align 4
.LONG MAGIC
.LONG FLAGS
.LONG CHECKSUM
.set STACKSIZE, 0x4000
.comm stack, STACKSIZE, 32
.global loader
loader:
lea esp, stack + STACKSIZE
push eax
push ebx
CALL MAIN
cli
hlt
END Asm
END SUB
SUB main ()
CONST s = "Hello World"
PrintString CPtr(Byte Ptr, @s), 35, 12
END SUB
SUB PrintString(src AS Byte Ptr, x AS LONG, y AS LONG)
DIM dst AS Byte Ptr
DIM counter AS LONG
dst = CPtr(Byte Ptr, &HB8000 + y * 160 + x * 2)
counter = 0
WHILE src[counter] <> 0
dst[2 * counter] = src[counter]
dst[2 * counter + 1] = 15
counter = counter + 1
WEND
END SUB
Code: Select all
C:\Documents and Settings\Nathan Campos\Desktop>fbc -c kernel.bas -o kernel.o
kernel.asm: Assembler messages:
kernel.asm:24: Error: junk at end of line, first unrecognized character is `,'
C:\Documents and Settings\Nathan Campos\Desktop>
Best Regards,
Nathan Paulino Campos