i want to program a Kernel in Pascal. There are two functions: WriteChar (print a char) and WriteLn (print strings):
Code: Select all
type
TScreen = Array[1..25, 1..80] of record
c : Char;
attr : Byte;
end;
Code: Select all
procedure WriteChar(c : Char);
begin
Screen^[X, Y].c := c;
inc(Y);
end;
procedure WriteLn(s : String);
var i : Integer;
begin
for i := 1 to Length(s) do
WriteChar(s[i]);
end;
If I would write WriteLn('a'); there would be nothing.
I found out, that there ist maybe a Problem with the string (s : String) or Length(s)/s.
If I would print s[1] on the screen, there would be also nothing. Length(s) is also wrong, because this code prints nothing:
Code: Select all
procedure WriteLn(s : String);
var i : Integer;
begin
for i := 1 to Length(s) do
WriteChar('a');
end;
Have someone any idea, why WriteLn is not working ?
Maybe there is a mistake in following lines, but I found nothing:
Code: Select all
unit system;
interface
type
ValSInt = LongInt;
SizeInt = LongInt;
procedure FPC_INITIALIZEUNITS; compilerproc;
procedure FPC_DO_EXIT; compilerproc;
procedure fpc_shortstr_assign(len: longint; src, dst: pointer);
function fpc_shortstr_concat(const s1, s2 : ShortString) : ShortString; compilerproc;
function fpc_shortstr_to_shortstr(len : LongInt; const sstr : ShortString) : ShortString; compilerproc;
implementation
procedure FPC_INITIALIZEUNITS; alias: 'FPC_INITIALIZEUNITS'; compilerproc;
begin
end;
...