FreeBasic Bare Bones: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
Line 114: | Line 114: | ||
<!-- GeSHi is *broken*. don't use freebasic as language here !--> |
<!-- GeSHi is *broken*. don't use freebasic as language here !--> |
||
<source lang="qbasic"> |
<source lang="qbasic"> |
||
Declare Sub PrintString(src |
Declare Sub PrintString(src As Byte Ptr, x As Long, y As Long) |
||
Declare Sub main () |
Declare Sub main () |
||
Sub multiboot () |
Sub multiboot () |
||
⚫ | |||
⚫ | |||
⚫ | |||
'setting up the Multiboot header - see GRUB docs for details |
|||
⚫ | |||
⚫ | |||
⚫ | |||
const CHECKSUM = -(MAGIC + FLAGS) |
|||
⚫ | |||
const STACKSIZE = &h4000 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
. |
.set CHECKSUM, -(MAGIC + FLAGS) |
||
.LONG FLAGS |
|||
. |
.align 4 |
||
.long MAGIC |
|||
⚫ | |||
⚫ | |||
.long CHECKSUM |
|||
.set STACKSIZE, 0x4000 |
|||
⚫ | |||
.global loader |
.global loader |
||
loader: |
loader: |
||
lea esp, |
lea esp, stack + STACKSIZE |
||
push eax |
push eax |
||
push ebx |
push ebx |
||
call MAIN |
|||
cli |
cli |
||
hlt |
hlt |
||
End Asm |
End Asm |
||
End Sub |
End Sub |
||
Sub main () |
Sub main () |
||
Const s = "Hello World" |
Const s = "Hello World" |
||
PrintString CPtr(Byte Ptr, @s), 35, 12 |
PrintString CPtr(Byte Ptr, @s), 35, 12 |
||
End Sub |
End Sub |
||
Sub PrintString(src |
Sub PrintString(src As Byte Ptr, x As Long, y As Long) |
||
Dim dst |
Dim dst as Byte Ptr |
||
Dim counter |
Dim counter as Long |
||
dst = CPtr(Byte Ptr, &HB8000 + y * 160 + x * 2) |
dst = CPtr(Byte Ptr, &HB8000 + y * 160 + x * 2) |
||
counter = 0 |
counter = 0 |
||
while src[counter] <> 0 |
|||
dst[2 * counter] = src[counter] |
dst[2 * counter] = src[counter] |
||
dst[2 * counter + 1] = 15 |
dst[2 * counter + 1] = 15 |
||
counter = counter + 1 |
counter = counter + 1 |
||
wend |
|||
End Sub |
End Sub |
||
</source> |
</source> |