Fixed bullshit.

git-svn-id: https://spexeah.com:8443/svn/Asuro@34 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2017-05-16 22:52:41 +00:00
parent 4add561061
commit 387365fa5d

View File

@ -26,33 +26,33 @@ type
procedure init(); procedure init();
procedure clear(); procedure clear();
procedure setdefaultattribute(attribute : sint8); procedure setdefaultattribute(attribute : char);
procedure writechar(character : sint8); procedure writechar(character : char);
procedure writestring(str: psint8); procedure writestring(str: PChar);
procedure writeint(i: sint32); procedure writeint(i: Integer);
procedure writeword(i: uint32); procedure writeword(i: DWORD);
procedure writehex(i: uint32); procedure writehex(i: DWORD);
procedure writecharln(character : sint8); procedure writecharln(character : char);
procedure writestringln(str: psint8); procedure writestringln(str: PChar);
procedure writeintln(i: sint32); procedure writeintln(i: Integer);
procedure writewordln(i: uint32); procedure writewordln(i: DWORD);
procedure writehexln(i: uint32); procedure writehexln(i: DWORD);
procedure writecharex(character : sint8; attributes : sint8); procedure writecharex(character : char; attributes : char);
procedure writestringex(str: psint8; attributes : sint8); procedure writestringex(str: PChar; attributes : char);
procedure writeintex(i: sint32; attributes : sint8); procedure writeintex(i: Integer; attributes : char);
procedure writewordex(i: uint32; attributes : sint8); procedure writewordex(i: DWORD; attributes : char);
procedure writehexex(i : uint32; attributes : sint8); procedure writehexex(i : DWORD; attributes : char);
procedure writecharlnex(character : sint8; attributes : sint8); procedure writecharlnex(character : char; attributes : char);
procedure writestringlnex(str: psint8; attributes : sint8); procedure writestringlnex(str: PChar; attributes : char);
procedure writeintlnex(i: sint32; attributes : sint8); procedure writeintlnex(i: Integer; attributes : char);
procedure writewordlnex(i: uint32; attributes : sint8); procedure writewordlnex(i: DWORD; attributes : char);
procedure writehexlnex(i: uint32; attributes : sint8); procedure writehexlnex(i: DWORD; attributes : char);
function combinecolors(Foreground, Background : TColor) : sint8; function combinecolors(Foreground, Background : TColor) : char;
procedure _increment_x(); procedure _increment_x();
procedure _increment_y(); procedure _increment_y();
@ -64,12 +64,12 @@ implementation
type type
TConsoleProperties = record TConsoleProperties = record
Default_Attribute : sint8; Default_Attribute : Char;
end; end;
TCharacter = bitpacked record TCharacter = bitpacked record
Character : sint8; Character : Char;
Attributes : sint8; Attributes : Char;
end; end;
PCharacter = ^TCharacter; PCharacter = ^TCharacter;
@ -80,8 +80,8 @@ type
P2DVideoMemory = ^T2DVideoMemory; P2DVideoMemory = ^T2DVideoMemory;
TCoord = record TCoord = record
X : uint8; X : Byte;
Y : uint8; Y : Byte;
end; end;
var var
@ -98,7 +98,7 @@ end;
procedure clear(); [public, alias: 'console_clear']; procedure clear(); [public, alias: 'console_clear'];
var var
x,y: uint8; x,y: Byte;
begin begin
for x:=0 to 79 do begin for x:=0 to 79 do begin
@ -111,64 +111,64 @@ begin
Console_Cursor.Y:= 0; Console_Cursor.Y:= 0;
end; end;
procedure setdefaultattribute(attribute: sint8); [public, alias: 'console_setdefaultattribute']; procedure setdefaultattribute(attribute: char); [public, alias: 'console_setdefaultattribute'];
begin begin
Console_Properties.Default_Attribute:= attribute; Console_Properties.Default_Attribute:= attribute;
end; end;
procedure writechar(character: sint8); [public, alias: 'console_writechar']; procedure writechar(character: char); [public, alias: 'console_writechar'];
begin begin
console.writecharex(character, Console_Properties.Default_Attribute); console.writecharex(character, Console_Properties.Default_Attribute);
end; end;
procedure writestring(str: psint8); [public, alias: 'console_writestring']; procedure writestring(str: PChar); [public, alias: 'console_writestring'];
begin begin
console.writestringex(str, Console_Properties.Default_Attribute); console.writestringex(str, Console_Properties.Default_Attribute);
end; end;
procedure writeint(i: sint32); [public, alias: 'console_writeint']; procedure writeint(i: Integer); [public, alias: 'console_writeint'];
begin begin
console.writeintex(i, Console_Properties.Default_Attribute); console.writeintex(i, Console_Properties.Default_Attribute);
end; end;
procedure writeword(i: uint32); [public, alias: 'console_writeword']; procedure writeword(i: DWORD); [public, alias: 'console_writeword'];
begin begin
console.writewordex(i, Console_Properties.Default_Attribute); console.writewordex(i, Console_Properties.Default_Attribute);
end; end;
procedure writecharln(character: sint8); [public, alias: 'console_writecharln']; procedure writecharln(character: char); [public, alias: 'console_writecharln'];
begin begin
console.writecharlnex(character, Console_Properties.Default_Attribute); console.writecharlnex(character, Console_Properties.Default_Attribute);
end; end;
procedure writestringln(str: psint8); [public, alias: 'console_writestringln']; procedure writestringln(str: PChar); [public, alias: 'console_writestringln'];
begin begin
console.writestringlnex(str, Console_Properties.Default_Attribute); console.writestringlnex(str, Console_Properties.Default_Attribute);
end; end;
procedure writeintln(i: sint32); [public, alias: 'console_writeintln']; procedure writeintln(i: Integer); [public, alias: 'console_writeintln'];
begin begin
console.writeintlnex(i, Console_Properties.Default_Attribute); console.writeintlnex(i, Console_Properties.Default_Attribute);
end; end;
procedure writewordln(i: uint32); [public, alias: 'console_writewordln']; procedure writewordln(i: DWORD); [public, alias: 'console_writewordln'];
begin begin
console.writewordlnex(i, Console_Properties.Default_Attribute); console.writewordlnex(i, Console_Properties.Default_Attribute);
end; end;
procedure writecharex(character: sint8; attributes: sint8); [public, alias: 'console_writecharex']; procedure writecharex(character: char; attributes: char); [public, alias: 'console_writecharex'];
begin begin
Console_Matrix^[Console_Cursor.Y][Console_Cursor.X].Character:= character; Console_Matrix^[Console_Cursor.Y][Console_Cursor.X].Character:= character;
Console_Matrix^[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes; Console_Matrix^[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
console._safeincrement_x(); console._safeincrement_x();
end; end;
procedure writehexex(i : uint32; attributes: sint8); [public, alias: 'console_writehexex']; procedure writehexex(i : dword; attributes: char); [public, alias: 'console_writehexex'];
var var
Hex : Array[0..7] of uint8; Hex : Array[0..7] of Byte;
Res : uint32; Res : DWORD;
Rem : uint32; Rem : DWORD;
c : sint32; c : Integer;
begin begin
for c:=0 to 7 do begin for c:=0 to 7 do begin
@ -209,25 +209,25 @@ begin
end; end;
end; end;
procedure writehex(i : uint32); [public, alias: 'console_writehex']; procedure writehex(i : dword); [public, alias: 'console_writehex'];
begin begin
console.writehexex(i, Console_Properties.Default_Attribute); console.writehexex(i, Console_Properties.Default_Attribute);
end; end;
procedure writehexlnex(i : uint32; attributes : sint8); procedure writehexlnex(i : dword; attributes : char);
begin begin
console.writehexex(i, attributes); console.writehexex(i, attributes);
console._safeincrement_y(); console._safeincrement_y();
end; end;
procedure writehexln(i : uint32); procedure writehexln(i : dword);
begin begin
writehexlnex(i, Console_Properties.Default_Attribute); writehexlnex(i, Console_Properties.Default_Attribute);
end; end;
procedure writestringex(str: psint8; attributes: sint8); [public, alias: 'console_writestringex']; procedure writestringex(str: PChar; attributes: char); [public, alias: 'console_writestringex'];
var var
i : sint32; i : integer;
begin begin
i:= 0; i:= 0;
@ -237,11 +237,11 @@ begin
end; end;
end; end;
procedure writeintex(i: sint32; attributes : sint8); [public, alias: 'console_writeintex']; procedure writeintex(i: Integer; attributes : char); [public, alias: 'console_writeintex'];
var var
buffer: array [0..11] of sint8; buffer: array [0..11] of Char;
str: psint8; str: PChar;
digit: uint32; digit: DWORD;
minus: Boolean; minus: Boolean;
begin begin
str := @buffer[11]; str := @buffer[11];
@ -255,7 +255,7 @@ begin
end; end;
repeat repeat
Dec(str); Dec(str);
str^ := sint8((digit mod 10) + uint8('0')); str^ := Char((digit mod 10) + Byte('0'));
digit := digit div 10; digit := digit div 10;
until (digit = 0); until (digit = 0);
if (minus) then begin if (minus) then begin
@ -265,11 +265,11 @@ begin
console.writestringex(str, attributes); console.writestringex(str, attributes);
end; end;
procedure writewordex(i: uint32; attributes : sint8); [public, alias: 'console_writedwordex']; procedure writewordex(i: DWORD; attributes : char); [public, alias: 'console_writedwordex'];
var var
buffer: array [0..11] of sint8; buffer: array [0..11] of Char;
str: psint8; str: PChar;
digit: uint32; digit: DWORD;
begin begin
for digit := 0 to 10 do buffer[digit] := '0'; for digit := 0 to 10 do buffer[digit] := '0';
str := @buffer[11]; str := @buffer[11];
@ -277,45 +277,45 @@ begin
digit := i; digit := i;
repeat repeat
Dec(str); Dec(str);
str^ := sint8((digit mod 10) + uint8('0')); str^ := Char((digit mod 10) + Byte('0'));
digit := digit div 10; digit := digit div 10;
until (digit = 0); until (digit = 0);
console.writestringex(@Buffer[0], attributes); console.writestringex(@Buffer[0], attributes);
end; end;
procedure writecharlnex(character: sint8; attributes: sint8); [public, alias: 'console_writecharlnex']; procedure writecharlnex(character: char; attributes: char); [public, alias: 'console_writecharlnex'];
begin begin
console.writecharex(character, attributes); console.writecharex(character, attributes);
console._safeincrement_y(); console._safeincrement_y();
end; end;
procedure writestringlnex(str: sint8; attributes: sint8); [public, alias: 'console_writestringlnex']; procedure writestringlnex(str: PChar; attributes: char); [public, alias: 'console_writestringlnex'];
begin begin
console.writestringex(str, attributes); console.writestringex(str, attributes);
console._safeincrement_y(); console._safeincrement_y();
end; end;
procedure writeintlnex(i: sint32; attributes: sint8); [public, alias: 'console_writeintlnex']; procedure writeintlnex(i: Integer; attributes: char); [public, alias: 'console_writeintlnex'];
begin begin
console.writeintex(i, attributes); console.writeintex(i, attributes);
console._safeincrement_y(); console._safeincrement_y();
end; end;
procedure writewordlnex(i: uint32; attributes: sint8); [public, alias: 'console_writewordlnex']; procedure writewordlnex(i: DWORD; attributes: char); [public, alias: 'console_writewordlnex'];
begin begin
console.writewordex(i, attributes); console.writewordex(i, attributes);
console._safeincrement_y(); console._safeincrement_y();
end; end;
function combinecolors(Foreground, Background: TColor): sint8; [public, alias: 'console_combinecolors']; function combinecolors(Foreground, Background: TColor): char; [public, alias: 'console_combinecolors'];
begin begin
combinecolors:= sint8(((ord(Background) shl 4) or ord(Foreground))); combinecolors:= char(((ord(Background) shl 4) or ord(Foreground)));
end; end;
procedure _update_cursor(); [public, alias: '_console_update_cursor']; procedure _update_cursor(); [public, alias: '_console_update_cursor'];
var var
pos : uint16; pos : word;
b : uint8; b : byte;
begin begin
pos:= (Console_Cursor.Y * 80) + Console_Cursor.X; pos:= (Console_Cursor.Y * 80) + Console_Cursor.X;
@ -366,7 +366,7 @@ end;
procedure _newline(); [public, alias: '_console_newline']; procedure _newline(); [public, alias: '_console_newline'];
var var
x, y : uint8; x, y : byte;
begin begin
for x:=0 to 79 do begin for x:=0 to 79 do begin