FreeBasic Bare Bones: Difference between revisions

Jump to navigation Jump to search
m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
m (Bot: Replace deprecated source tag with syntaxhighlight)
m (Bot: Replace deprecated source tag with syntaxhighlight)
Line 81:
Basic uses an borrowed trick to tell us the end of the string. After the last character, there will always be a 0. So if we read a string in order, we can tell when it has ended.
 
<sourcesyntaxhighlight lang="freebasic">
Sub PrintString(src As Byte Ptr, x As Long, y As Long)
Line 97:
wend
End Sub
</syntaxhighlight>
</source>
 
To conclude, this function prints a string (a converted Byte Ptr string). It creates a pointer that is aimed at the [[Text UI|video card]] (it occupies among others a range starting from address B8000 hex), and we pick a location in there. Next we take a character from the string, check if its 0, and if it isn't, copy it to the video card and go to the next character. Due to the way the video card works, we add a color (15) as well.
Line 114:
=== kernel.bas ===
<!-- GeSHi is *broken*. don't use freebasic as language here !-->
<sourcesyntaxhighlight lang="qbasic">
Declare Sub PrintString(src As Byte Ptr, x As Long, y As Long)
Declare Sub main ()
Line 174:
wend
End Sub
</syntaxhighlight>
</source>
 
=== link.ld ===
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu