Supportnet / Forum / Anwendungen(Java,C++...)
VGA- Konsole
Frage
Hallo!
Ich bin gerade dabei ein OS zu schreiben. Momentan bin ich bei der VGA Konsole.
Ich habe sie in Pascal geschrieben.
Der Code:
Unit VGAConsole;
Interface
Procedure WriteString(Const s : String);
Implementation
Var
VideoBuf : PChar;
ScreenWidth, ScreenHeight : LongInt;
CursorPos : Word;
CursorPosX, CursorPosY : Integer;
Procedure GetCursorPos;
Begin
outportb($3D4, $F);
CursorPos := inportb($3D5);
outportb($3D4, $E);
CursorPos := CursorPos Or (inportb($3D5) Shl 8);
CursorPosX := CursorPos Mod ScreenWidth;
CursorPosY := CursorPos Div ScreenWidth;
End;
Procedure SetCursorPos(X, Y : LongInt);
Begin
CursorPosX := X;
CursorPosY := Y;
CursorPos := Y*ScreenWidth + X;
outportb($3D4, $F);
outportb($3D5, CursorPos And $FF);
outportb($3D4, $E);
outportb($3D5, (CursorPos Shr 8) And $FF);
End;
Procedure WriteTTY(c : Char);
Begin
Case c Of
#13 :
Begin
CursorPosX := 0;
Inc(CursorPosY);
If (CursorPosY >= ScreenHeight) Then
CursorPosY := ScreenHeight - 1;
SetCursorPos(CursorPosX, CursorPosY);
End;
Else
Begin
VideoBuf[CursorPos*2] := c;
Inc(CursorPosX);
If CursorPosX >= ScreenWidth Then
Begin
CursorPosX := 0;
Inc(CursorPosY);
If CursorPosY >= ScreenHeight Then
CursorPosY := ScreenHeight - 1;
End;
SetCursorPos(CursorPosX, CursorPosY);
End;
End;
End;
Procedure WriteString(Const s : String);
Var
I : Integer;
Begin
For I := 1 To Length(s) Do
WriteTTY(s[I]);
End;
Begin
Pointer(VideoBuf) := Pointer($B8000);
ScreenWidth := 80;
ScreenHeight := 25;
GetCursorPos;
End.
Wenn ich Sie mit DEV Pascal (Compiler: Free Pascal) kompilieren will erhalte ich folgende Meldung:
Fatal Error: I could not excute the compiler!
Jeduch schreibt der Compiler:
Errors: 0
Size of outputfile: 0 KB
Klicke ich dann auf "show al compiler results" erhalte ich Folgendes:
The command:
"C:\Dev-Pas\bin\gpc --automake "c:\dokumente und einstellungen\daniel\desktop\dialoger\paskernel\vgaconsole.pp" -o"c:\dokumente und einstellungen\daniel\desktop\dialoger\paskernel\vgaconsole.exe" -fstandard-pascal -fno-inline -fno-io-checking -fno-stack-checking -O1 -march=i386 -mcpu=i386 -funit-path=C:\Dev-Pas\units\;C:\Dev-Pas\units\rtl\ -BC:\Dev-Pas\units\ -BC:\Dev -Pas\units\rtl\ -BC:\Dev-Pas\bin\ "
was not successfully executed.
Please check that your "bin" directory is correct!