// Toro Write Pascal Example.
// Example using a minimal kernel to print "Pascal" in 3D
// Changes :
// 19/06/2017 First Version by Joe Care.
// Copyright (c) 2017 Joe Care
// All Rights Reserved
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
program WritePacal;
{$IFDEF FPC}
{$mode delphi}
{$ENDIF}
{$IMAGEBASE 4194304}
// Configuring the RUN for Lazarus
{$IFDEF WIN64}
{%RunCommand qemu-system-x86_64.exe -m 512 -smp 2 -drive format=raw,file=ToroHello.img}
{$ELSE}
{%RunCommand qemu-system-x86_64 -m 512 -smp 2 -drive format=raw,file=ToroHello.img}
{$ENDIF}
{%RunFlags BUILD-}
// They are declared just the necessary units
// The needed units depend on the hardware where you are running the application
uses
Kernel in '..\rtl\Kernel.pas',
Process in '..\rtl\Process.pas',
Memory in '..\rtl\Memory.pas',
Debug in '..\rtl\Debug.pas',
Arch in '..\rtl\Arch.pas',
Filesystem in '..\rtl\Filesystem.pas',
Pci in '..\rtl\Drivers\Pci.pas',
Console in '..\rtl\Drivers\Console.pas';
const
i64: int64 = 1055120232691680095; (* This defines "Pascal" *)
cc: array[-3..3] of ShortString = (* Here are all string-constants *)
('\ '#8' \ ',
#8'__ ',
#8'__/\ ',
' '#8' ',
#8'__/\ ',
' '#8' ',
#8'__/\ ');
var
x, y, c: integer;
begin
PrintStringLn(StringOfChar(cc[1][1], 78));
for y := 0 to 11 do
begin
PrintString(StringOfChar(cc[0][1], 13 - y));
for x := 0 to 16 do
for c := 1 to 5 + (x mod 3) and 2 do
if c <= length(cc[(x - 5) mod 4]) then
PutC(cc[(((i64 shr ((x and 15) * 4 + y div 3)) and (3 -
(y div 9) shl 1)) - 4 + (2 - y mod 3) shl 2) mod 4][c]);
PrintStringln();
end;
while True do
SysThreadSwitch;
end.