fb:porticula NoPaste
rtlib_video.bi
Uploader: | ThePuppetMaster |
Datum/Zeit: | 26.08.2008 22:20:51 |
'###############################################################################################################
'###############################################################################################################
'### F B - C O R E
'###############################################################################################################
'###############################################################################################################
'### Version: 1.00.0
'### Revision: 0
'###############################################################################################################
'### (c) 2008 By.: /_\ DeltaLab's Germany [experimental computing]
'### Author: Martin Wiemann
'### Date of Idea: 2008.08.16 - 17:55:38
'###############################################################################################################
'### Copy('s) of this code or a part of this IS allowed!!!
'###############################################################################################################
'###############################################################################################################
Const C_GFX_Black as UByte = &H0
Const C_GFX_Blue as UByte = &H1
Const C_GFX_Green as UByte = &H2
Const C_GFX_Cyan as UByte = &H3
Const C_GFX_Red as UByte = &H4
Const C_GFX_Magenta as UByte = &H5
Const C_GFX_Brown as UByte = &H6
Const C_GFX_LightGray as UByte = &H7
Const C_GFX_DarkGray as UByte = &H8
Const C_GFX_LighBlue as UByte = &H9
Const C_GFX_LightGreen as UByte = &HA
Const C_GFX_LightCyan as UByte = &HB
Const C_GFX_LightRed as UByte = &HC
Const C_GFX_LightMagenta as UByte = &HD
Const C_GFX_Yellow as UByte = &HE
Const C_GFX_White as UByte = &HF
'###############################################################################################################
Dim Shared G_Video_Construct as UByte
'--------------------------------------------------------------------------------------------------------------------
Dim Shared G_Video_GFX_Mode as UByte
Dim Shared G_Video_Text_Row as UByte
Dim Shared G_Video_Text_Col as UByte
Const G_Video_Text_SubLen as UByte = 4
Const G_Video_Text_PTR_Base as UByte Ptr = &Hb8000
Dim Shared G_Video_Text_Pos_Row as UShort
Dim Shared G_Video_Text_Pos_Col as UShort
Dim Shared G_Video_Text_Color as UByte
Static Shared G_Video_Text as UShort Ptr
Dim Shared G_Video_Cursor_Show as UByte
'####################################################################################################################
Private Sub rtlib_video_init() 'constructor
If G_Video_Construct = 1 Then Exit Sub
G_Video_Construct = 1
G_Video_GFX_Mode = 0
G_Video_Text_Row = 25
G_Video_Text_Col = 80
G_Video_Cursor_Show = 1
G_Video_Text_Color = C_GFX_LightGray
G_Video_Text = Cast(UShort Ptr, G_Video_Text_PTR_Base)
End Sub
'####################################################################################################################
Private Sub Int_Text_Cursor_Move(V_Row as UShort, V_Col as UShort)
rtlib_video_init()
If G_Video_GFX_Mode <> 0 Then Exit Sub
If @V_Row <> 0 Then If V_Row > G_Video_Text_Row Then Exit Sub
If @V_Col <> 0 Then If V_Col > G_Video_Text_Col Then Exit Sub
If @V_Row <> 0 Then G_Video_Text_Pos_Row = V_Row
If @V_Col <> 0 Then G_Video_Text_Pos_Col = V_Col
If G_Video_Cursor_Show = 0 Then Exit Sub
Dim TLP as UShort = V_Row * G_Video_Text_Col + V_Col
outb(&H3D4, 14)
outb(&H3D5, (TLP shr 8))
outb(&H3D4, 15)
outb(&H3D5, TLP)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Private Sub Int_Text_Cursor_Hide()
rtlib_video_init()
If G_Video_GFX_Mode <> 0 Then Exit Sub
G_Video_Cursor_Show = 0
Dim TLP as UShort = G_Video_Text_Row * G_Video_Text_Col + 1
outb(&H3D4, 14)
outb(&H3D5, (TLP shr 8))
outb(&H3D4, 15)
outb(&H3D5, TLP)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Private Sub Int_Text_Cursor_Show()
rtlib_video_init()
If G_Video_GFX_Mode <> 0 Then Exit Sub
G_Video_Cursor_Show = 1
Int_Text_Cursor_Move(G_Video_Text_Pos_Row, G_Video_Text_Pos_Col)
End Sub
'####################################################################################################################
Public Sub Int_Text_CLS()
rtlib_video_init()
If G_Video_GFX_Mode <> 0 Then Exit Sub
For Y as UShort = 0 to G_Video_Text_Row - 1
For X as UShort = 0 to G_Video_Text_Col - 1
G_Video_Text[Y * G_Video_Text_Col + X] = &H07 * 256
Next
Next
G_Video_Text_Pos_Row = 0
G_Video_Text_Pos_Col = 0
If G_Video_Cursor_Show = 1 Then Int_Text_Cursor_Move(G_Video_Text_Pos_Row, G_Video_Text_Pos_Col)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Print_EX CDecL Alias "Core_Text_Print_Ex"(ByVal V_Text as String = "", ByVal V_ByteCode as UByte = 0, V_Color as UByte = G_Video_Text_Color)
rtlib_video_init()
If G_Video_GFX_Mode <> 0 Then Exit Sub
Dim XTextPtr as UByte Ptr
Dim TBP as UByte = 0
If V_ByteCode > 0 Then
XTextPtr = @V_ByteCode
TBP = 1
Else: XTextPtr = StrPtr(V_Text)
End If
Do
Select Case *XTextPtr
Case 10 'Linefeed
If G_Video_Text_Pos_Row + 1 = G_Video_Text_Row Then
For Y as UShort = 1 to G_Video_Text_Row - 1
For X as UShort = 0 to G_Video_Text_Col - 1
G_Video_Text[(Y - 1) * G_Video_Text_Col + X] = G_Video_Text[Y * G_Video_Text_Col + X]
Next
Next
For X as UShort = 0 to G_Video_Text_Col - 1
G_Video_Text[(G_Video_Text_Row - 1) * G_Video_Text_Col + X] = 0
Next
Else: G_Video_Text_Pos_Row += 1
End If
Case 13 'Carrier Return
G_Video_Text_Pos_Col = 0
Case Else
If G_Video_Text_Pos_Col = G_Video_Text_Col Then
If G_Video_Text_Pos_Row + 1 = G_Video_Text_Row Then
For Y as UShort = 1 to G_Video_Text_Row - 1
For X as UShort = 0 to G_Video_Text_Col - 1
G_Video_Text[(Y - 1) * G_Video_Text_Col + X] = G_Video_Text[Y * G_Video_Text_Col + X]
Next
Next
For X as UShort = 0 to G_Video_Text_Col - 1
G_Video_Text[(G_Video_Text_Row - 1) * G_Video_Text_Col + X] = 0
Next
Else: G_Video_Text_Pos_Row += 1
End If
G_Video_Text_Pos_Col = 0
End If
G_Video_Text[G_Video_Text_Pos_Row * G_Video_Text_Col + G_Video_Text_Pos_Col] = V_Color * 256 + *XTextPtr
G_Video_Text_Pos_Col += 1
End Select
If G_Video_Cursor_Show = 1 Then Int_Text_Cursor_Move(G_Video_Text_Pos_Row, G_Video_Text_Pos_Col)
If TBP = 1 Then Exit Do
XTextPtr += 1
If *XTextPtr = 0 Then Exit Do
Loop
End Sub
'####################################################################################################################
Public Sub Int_Text_Add CDecL Alias "Core_Text_Add"(ByVal V_Text as String = "", V_Color as UByte = C_GFX_LightGray)
Int_Text_Print_EX(, 13)
Int_Text_Print_EX(, 10)
Int_Text_Print_EX(V_Text, , V_Color)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Add_Done CDecL Alias "Core_Text_Done"()
G_Video_Text_Pos_Col = G_Video_Text_Col - G_Video_Text_SubLen
Int_Text_Print_EX("DONE", , C_GFX_LightGreen)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Add_Fail CDecL Alias "Core_Text_Fail"()
G_Video_Text_Pos_Col = G_Video_Text_Col - G_Video_Text_SubLen
Int_Text_Print_EX("FAIL", , C_GFX_LightRed)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Add_Warn CDecL Alias "Core_Text_Warn"()
G_Video_Text_Pos_Col = G_Video_Text_Col - G_Video_Text_SubLen
Int_Text_Print_EX("WARN", , C_GFX_Yellow)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Add_Proc CDecL Alias "Core_Text_Proc"(ByVal V_Text as String)
Int_Text_Print_EX(, 13)
Int_Text_Print_EX(, 10)
Int_Text_Print_EX(" * ", , C_GFX_LightGray)
Int_Text_Print_EX(V_Text, , C_GFX_LightGray)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Add_Light CDecL Alias "Core_Text_Light"(ByVal V_Text as String)
Int_Text_Print_EX(, 13)
Int_Text_Print_EX(, 10)
Int_Text_Print_EX(V_Text, , C_GFX_White)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Add_Info CDecL Alias "Core_Text_Info"(ByVal V_Text as String)
Int_Text_Print_EX(, 13)
Int_Text_Print_EX(, 10)
Int_Text_Print_EX(" - ", , C_GFX_Yellow)
Int_Text_Print_EX(V_Text, , C_GFX_Yellow)
End Sub
'--------------------------------------------------------------------------------------------------------------------
Public Sub Int_Text_Add_Err CDecL Alias "Core_Text_Err"(ByVal V_Text as String)
Int_Text_Add_Fail
Int_Text_Print_EX(, 13)
Int_Text_Print_EX(, 10)
Int_Text_Print_EX("-!- ", , C_GFX_LightRed)
Int_Text_Print_EX(V_Text, , C_GFX_LightRed)
End Sub