FreeBasic Bare Bones: Difference between revisions

Jump to navigation Jump to search
m
Reverted edits by Nathan (Talk); changed back to last version by Combuster
[unchecked revision][unchecked revision]
m (Reverted edits by Nathan (Talk); changed back to last version by Combuster)
Line 114:
<!-- GeSHi is *broken*. don't use freebasic as language here !-->
<source lang="qbasic">
Declare Sub PrintString(src ASAs Byte Ptr, x ASAs LONGLong, y ASAs LONGLong)
Declare Sub main ()
 
Sub multiboot ()
Asm
const XALIGN = 1 shl 0
 
const MEMINFO = 1 shl 1
'setting up the Multiboot header - see GRUB docs for details
const FLAGS = XALIGN or MEMINFO
const MAGIC = &h1BADB002
const XALIGN =.set 1ALIGN, shl 1<<0
const CHECKSUM = -(MAGIC + FLAGS)
const MEMINFO =.set 1MEMINFO, shl 1<<1
const STACKSIZE = &h4000
const .set FLAGS, = XALIGN or ALIGN | MEMINFO
Asm
const .set MAGIC, = &h1BADB0020x1BADB002
.align 32
.LONGset CHECKSUM, -(MAGIC + FLAGS)
 
.LONG FLAGS
.LONGalign CHECKSUM4
.long MAGIC
.alignlong 32FLAGS
.comm stack, STACKSIZE
.long CHECKSUM
 
.set STACKSIZE, 0x4000
.comm stack, STACKSIZE, 32
.global loader
 
loader:
lea esp, [stack + STACKSIZE]
push eax
push ebx
 
CALLcall 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 ASAs Byte Ptr, x ASAs Long, y ASAs Long)
 
Dim dst ASas Byte Ptr
Dim counter ASas Long
 
dst = CPtr(Byte Ptr, &HB8000 + y * 160 + x * 2)
 
counter = 0
Whilewhile src[counter] <> 0
dst[2 * counter] = src[counter]
dst[2 * counter + 1] = 15
counter = counter + 1
WEndwend
End Sub
</source>
1,490

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu