git-svn-id: https://spexeah.com:8443/svn/Asuro@610 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
132978aea1
commit
f1d3dabe14
1512
src/backup/consoleWNDBK.pas
Normal file
1512
src/backup/consoleWNDBK.pas
Normal file
File diff suppressed because it is too large
Load Diff
532
src/console.pas
532
src/console.pas
@ -36,6 +36,15 @@ type
|
||||
lYellow = $E,
|
||||
lWhite = $F );
|
||||
|
||||
TEventType = ( EVENT_DRAW,
|
||||
EVENT_MOUSE_CLICK,
|
||||
EVENT_MOUSE_MOVE,
|
||||
EVENT_MOUSE_DOWN,
|
||||
EVENT_MOUSE_UP,
|
||||
EVENT_KEY_PRESSED,
|
||||
EVENT_CLOSE,
|
||||
EVENT_MINIMIZE );
|
||||
|
||||
procedure init();
|
||||
procedure clear();
|
||||
procedure setdefaultattribute(attribute : uint32);
|
||||
@ -172,14 +181,18 @@ procedure redrawWindows;
|
||||
procedure toggleWNDVisible(WND : uint32);
|
||||
procedure setWNDVisible(WND : uint32; visible : boolean);
|
||||
procedure closeAllWindows;
|
||||
function newWindow(x : uint32; y : uint32; Width : uint32; Height : uint32; Title : PChar) : HWND;
|
||||
function registerEventHandler(WND : HWND; Event : TEventType; Handler : void) : boolean;
|
||||
procedure forceQuitAll;
|
||||
procedure closeWindow(WND : HWND);
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
lmemorymanager, strings;
|
||||
lmemorymanager, strings, keyboard, serial;
|
||||
|
||||
const
|
||||
MAX_WINDOWS = 10;
|
||||
MAX_WINDOWS = 255;
|
||||
DefaultWND = 0;
|
||||
|
||||
type
|
||||
@ -210,6 +223,26 @@ type
|
||||
Y : Byte;
|
||||
end;
|
||||
|
||||
TDrawHook = procedure();
|
||||
TMouseClickHook = procedure(x : uint32; y : uint32; left : boolean);
|
||||
TMouseMoveHook = procedure(x : uint32; y : uint32);
|
||||
TMouseDownHook = procedure(x : uint32; y : uint32);
|
||||
TMouseUpHook = procedure(x : uint32; y : uint32);
|
||||
TKeyPressedHook = procedure(info : TKeyInfo);
|
||||
TCloseHook = procedure();
|
||||
TMinimizeHook = procedure();
|
||||
|
||||
THooks = record
|
||||
OnDraw : TDrawHook;
|
||||
OnMouseClick : TMouseClickHook;
|
||||
OnMouseMove : TMouseMoveHook;
|
||||
OnMouseDown : TMouseDownHook;
|
||||
OnMouseUp : TMouseUpHook;
|
||||
OnKeyPressed : TKeyPressedHook;
|
||||
OnClose : TCloseHook;
|
||||
OnMinimize : TMinimizeHook;
|
||||
end;
|
||||
|
||||
TWindow = record
|
||||
visible : boolean;
|
||||
buffer : T2DVideoMemory;
|
||||
@ -220,9 +253,12 @@ type
|
||||
WND_H : uint32;
|
||||
Cursor : TCoord;
|
||||
WND_NAME : PChar;
|
||||
Hooks : THooks;
|
||||
Closed : boolean;
|
||||
end;
|
||||
PWindow = ^TWindow;
|
||||
|
||||
TWindows = Array[0..MAX_WINDOWS-1] of TWindow;
|
||||
TWindows = Array[0..MAX_WINDOWS-1] of PWindow;
|
||||
|
||||
TWindowManager = record
|
||||
Windows : TWindows;
|
||||
@ -244,9 +280,103 @@ var
|
||||
Ready : Boolean = false; //Is the unit ready for use?
|
||||
MouseDrawActive : Boolean = false; //Is the Mouse currently being updated?
|
||||
mouse_dirt : TMouseDirt; //Character Cell(s) the mouse occupies, these need to be rewritten on mouse move.
|
||||
Window_Border : TCharacter;
|
||||
Window_Border : TCharacter;
|
||||
Default_Char : TCharacter;
|
||||
|
||||
function registerEventHandler(WND : HWND; Event : TEventType; Handler : void) : boolean;
|
||||
begin
|
||||
registerEventHandler:= true;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
case Event of
|
||||
EVENT_DRAW : WindowManager.Windows[WND]^.Hooks.OnDraw:= TDrawHook(Handler);
|
||||
EVENT_MOUSE_CLICK : WindowManager.Windows[WND]^.Hooks.OnMouseClick:= TMouseClickHook(Handler);
|
||||
EVENT_MOUSE_MOVE : WindowManager.Windows[WND]^.Hooks.OnMouseMove:= TMouseMoveHook(Handler);
|
||||
EVENT_MOUSE_DOWN : WindowManager.Windows[WND]^.Hooks.OnMouseDown:= TMouseDownHook(Handler);
|
||||
EVENT_MOUSE_UP : WindowManager.Windows[WND]^.Hooks.OnMouseUp:= TMouseUpHook(Handler);
|
||||
EVENT_KEY_PRESSED : WindowManager.Windows[WND]^.Hooks.OnKeyPressed:= TKeyPressedHook(Handler);
|
||||
EVENT_CLOSE : WindowManager.Windows[WND]^.Hooks.OnClose:= TCloseHook(Handler);
|
||||
EVENT_MINIMIZE : WindowManager.Windows[WND]^.Hooks.OnMinimize:= TMinimizeHook(Handler);
|
||||
else registerEventHandler:= false;
|
||||
end;
|
||||
end else begin
|
||||
registerEventHandler:= false;
|
||||
end;
|
||||
end;
|
||||
|
||||
function newWindow(x : uint32; y : uint32; Width : uint32; Height : uint32; Title : PChar) : HWND;
|
||||
var
|
||||
idx : uint32;
|
||||
WND : PWindow;
|
||||
|
||||
begin
|
||||
newWindow:= 0;
|
||||
for idx:=1 to MAX_WINDOWS-1 do begin
|
||||
if WindowManager.Windows[idx] = nil then begin
|
||||
newWindow:= idx;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
if newWindow <> 0 then begin
|
||||
WND:= PWindow(kalloc(sizeof(TWindow)));
|
||||
WND^.WND_NAME:= StringCopy(Title);
|
||||
WND^.WND_X:= x;
|
||||
WND^.WND_Y:= y;
|
||||
WND^.WND_W:= Width;
|
||||
WND^.WND_H:= Height;
|
||||
WND^.Cursor.x:= 0;
|
||||
WND^.Cursor.y:= 0;
|
||||
WND^.visible:= true;
|
||||
WND^.Closed:= false;
|
||||
WND^.Hooks.OnDraw := nil;
|
||||
WND^.Hooks.OnMouseClick := nil;
|
||||
WND^.Hooks.OnMouseMove := nil;
|
||||
WND^.Hooks.OnMouseDown := nil;
|
||||
WND^.Hooks.OnMouseUp := nil;
|
||||
WND^.Hooks.OnKeyPressed := nil;
|
||||
WND^.Hooks.OnClose := nil;
|
||||
WND^.Hooks.OnMinimize := nil;
|
||||
WindowManager.Windows[newWindow]:= WND;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure forceQuitAll;
|
||||
var
|
||||
i : uint32;
|
||||
WND : PWindow;
|
||||
|
||||
begin
|
||||
for i:=1 to MAX_WINDOWS-1 do begin
|
||||
if WindowManager.Windows[i] <> nil then begin
|
||||
WND:= WindowManager.Windows[i];
|
||||
WindowManager.Windows[i]:= nil;
|
||||
kfree(void(WND^.WND_NAME));
|
||||
kfree(void(WND));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure _closeWindow(WND : HWND);
|
||||
var
|
||||
WNDCopy : PWindow;
|
||||
|
||||
begin
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WNDCopy:= WindowManager.Windows[WND];
|
||||
WindowManager.Windows[WND]:= nil;
|
||||
if WNDCopy^.Hooks.OnClose <> nil then WNDCopy^.Hooks.OnClose();
|
||||
kfree(void(WNDCopy^.WND_NAME));
|
||||
kfree(void(WNDCopy));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure closeWindow(WND : HWND);
|
||||
begin
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Closed:= True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure closeAllWindows;
|
||||
var
|
||||
i : uint32;
|
||||
@ -259,12 +389,16 @@ end;
|
||||
|
||||
procedure setWNDVisible(WND : uint32; visible : boolean);
|
||||
begin
|
||||
WindowManager.Windows[WND].visible:= visible;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.visible:= visible;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure toggleWNDVisible(WND : uint32);
|
||||
begin
|
||||
WindowManager.Windows[WND].visible:= not WindowManager.Windows[WND].visible;
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.visible:= not WindowManager.Windows[WND]^.visible;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure drawMouse;
|
||||
@ -335,46 +469,52 @@ begin
|
||||
end;
|
||||
end;
|
||||
for w:=0 to MAX_WINDOWS-1 do begin
|
||||
If WindowManager.Windows[w].visible then begin
|
||||
if WindowManager.Windows[w] <> nil then begin
|
||||
if w <> 0 then begin
|
||||
WXL:= WindowManager.Windows[w].WND_X - 1;
|
||||
WYL:= WindowManager.Windows[w].WND_Y - 1;
|
||||
WXR:= WindowManager.Windows[w].WND_X + WindowManager.Windows[w].WND_W + 1;
|
||||
WYR:= WindowManager.Windows[w].WND_Y + WindowManager.Windows[w].WND_H + 1;
|
||||
for y:=WYL to WYR do begin
|
||||
Console_Matrix[y][WXL]:= Window_Border;
|
||||
Console_Matrix[y][WXL-1]:= Window_Border;
|
||||
Console_Matrix[y][WXR]:= Window_Border;
|
||||
Console_Matrix[y][WXR+1]:= Window_Border;
|
||||
Console_Real[y][WXL].Character:= char(3);
|
||||
Console_Real[y][WXL-1].Character:= char(3);
|
||||
Console_Real[y][WXR].Character:= char(3);
|
||||
Console_Real[y][WXR+1].Character:= char(3);
|
||||
if WindowManager.Windows[w]^.Hooks.OnDraw <> nil then WindowManager.Windows[w]^.Hooks.OnDraw();
|
||||
end;
|
||||
If WindowManager.Windows[w]^.visible then begin
|
||||
if w <> 0 then begin
|
||||
WXL:= WindowManager.Windows[w]^.WND_X - 1;
|
||||
WYL:= WindowManager.Windows[w]^.WND_Y - 1;
|
||||
WXR:= WindowManager.Windows[w]^.WND_X + WindowManager.Windows[w]^.WND_W + 1;
|
||||
WYR:= WindowManager.Windows[w]^.WND_Y + WindowManager.Windows[w]^.WND_H + 1;
|
||||
for y:=WYL to WYR do begin
|
||||
Console_Matrix[y][WXL]:= Window_Border;
|
||||
Console_Matrix[y][WXL-1]:= Window_Border;
|
||||
Console_Matrix[y][WXR]:= Window_Border;
|
||||
Console_Matrix[y][WXR+1]:= Window_Border;
|
||||
Console_Real[y][WXL].Character:= char(3);
|
||||
Console_Real[y][WXL-1].Character:= char(3);
|
||||
Console_Real[y][WXR].Character:= char(3);
|
||||
Console_Real[y][WXR+1].Character:= char(3);
|
||||
end;
|
||||
STRC:= 0;
|
||||
MIDP:= (WXR + WXL) div 2;
|
||||
STARTP:= MIDP - (StringSize(WindowManager.Windows[w]^.WND_NAME) div 2) - 1;
|
||||
for x:=WXL to WXR do begin
|
||||
Console_Matrix[WYL][x]:= Window_Border;
|
||||
if (x >= STARTP) and (STRC < StringSize(WindowManager.Windows[w]^.WND_NAME)) then begin
|
||||
Console_Matrix[WYL][x].character:= WindowManager.Windows[w]^.WND_NAME[STRC];
|
||||
inc(STRC);
|
||||
end;
|
||||
if x = WXR then begin
|
||||
Console_Matrix[WYL][x].character:= 'x';
|
||||
end;
|
||||
Console_Matrix[WYR][x]:= Window_Border;
|
||||
Console_Real[WYL][x].Character:= char(3);
|
||||
Console_Real[WYR][x].Character:= char(3);
|
||||
end;
|
||||
end;
|
||||
STRC:= 0;
|
||||
MIDP:= (WXR + WXL) div 2;
|
||||
STARTP:= MIDP - (StringSize(WindowManager.Windows[w].WND_NAME) div 2) - 1;
|
||||
for x:=WXL to WXR do begin
|
||||
Console_Matrix[WYL][x]:= Window_Border;
|
||||
if (x >= STARTP) and (STRC < StringSize(WindowManager.Windows[w].WND_NAME)) then begin
|
||||
Console_Matrix[WYL][x].character:= WindowManager.Windows[w].WND_NAME[STRC];
|
||||
inc(STRC);
|
||||
for y:=WindowManager.Windows[w]^.WND_Y to WindowManager.Windows[w]^.WND_Y + WindowManager.Windows[w]^.WND_H do begin
|
||||
if y > 63 then break;
|
||||
for x:=WindowManager.Windows[w]^.WND_X to WindowManager.Windows[w]^.WND_X + WindowManager.Windows[w]^.WND_W do begin
|
||||
if x > 159 then break;
|
||||
Console_Matrix[y][x]:= WindowManager.Windows[w]^.buffer[y - WindowManager.Windows[w]^.WND_Y][x - WindowManager.Windows[w]^.WND_X];
|
||||
end;
|
||||
if x = WXR then begin
|
||||
Console_Matrix[WYL][x].character:= 'x';
|
||||
end;
|
||||
Console_Matrix[WYR][x]:= Window_Border;
|
||||
Console_Real[WYL][x].Character:= char(3);
|
||||
Console_Real[WYR][x].Character:= char(3);
|
||||
end;
|
||||
end;
|
||||
for y:=WindowManager.Windows[w].WND_Y to WindowManager.Windows[w].WND_Y + WindowManager.Windows[w].WND_H do begin
|
||||
if y > 63 then break;
|
||||
for x:=WindowManager.Windows[w].WND_X to WindowManager.Windows[w].WND_X + WindowManager.Windows[w].WND_W do begin
|
||||
if x > 159 then break;
|
||||
Console_Matrix[y][x]:= WindowManager.Windows[w].buffer[y - WindowManager.Windows[w].WND_Y][x - WindowManager.Windows[w].WND_X];
|
||||
end;
|
||||
end;
|
||||
if WindowManager.Windows[w]^.Closed then _closeWindow(w);
|
||||
end;
|
||||
end;
|
||||
redrawMatrix;
|
||||
@ -383,6 +523,7 @@ end;
|
||||
procedure initWindows;
|
||||
var
|
||||
x, y, w : uint32;
|
||||
WND : PWindow;
|
||||
|
||||
begin
|
||||
Default_Char.Character:= ' ';
|
||||
@ -393,28 +534,21 @@ begin
|
||||
Window_Border.Attributes:= $0000FFFF;
|
||||
Window_Border.visible:= true;
|
||||
|
||||
for w:=0 to MAX_WINDOWS-1 do begin
|
||||
WindowManager.Windows[w].visible:= false;
|
||||
for y:=0 to 63 do begin
|
||||
for x:=0 to 159 do begin
|
||||
WindowManager.Windows[w].Buffer[y][x]:= Default_Char;
|
||||
Console_Real[y][x].character:= char(1);
|
||||
end;
|
||||
end;
|
||||
For w:=0 to MAX_WINDOWS-1 do begin
|
||||
WindowManager.Windows[w]:= nil;
|
||||
end;
|
||||
|
||||
WindowManager.Windows[0].visible:= true;
|
||||
WindowManager.Windows[0].WND_X:= 0;
|
||||
WindowManager.Windows[0].WND_Y:= 0;
|
||||
WindowManager.Windows[0].WND_H:= 63;
|
||||
WindowManager.Windows[0].WND_W:= 159;
|
||||
|
||||
WindowManager.Windows[1].visible:= false;
|
||||
WindowManager.Windows[1].WND_X:= 20;
|
||||
WindowManager.Windows[1].WND_W:= 90;
|
||||
WindowManager.Windows[1].WND_Y:= 10;
|
||||
WindowManager.Windows[1].WND_H:= 20;
|
||||
WindowManager.Windows[1].WND_NAME:= 'ASURO TERMINAL';
|
||||
WND:= PWindow(kalloc(sizeof(TWindow)));
|
||||
WND^.WND_NAME:= 'Asuro';
|
||||
WND^.WND_X:= 0;
|
||||
WND^.WND_Y:= 0;
|
||||
WND^.WND_W:= 159;
|
||||
WND^.WND_H:= 63;
|
||||
WND^.Cursor.x:= 0;
|
||||
WND^.Cursor.y:= 0;
|
||||
WND^.visible:= true;
|
||||
WND^.Closed:= false;
|
||||
WindowManager.Windows[0]:= WND;
|
||||
end;
|
||||
|
||||
function getPixel(x : uint32; y : uint32) : uint16;
|
||||
@ -593,19 +727,21 @@ var
|
||||
x,y: Byte;
|
||||
|
||||
begin
|
||||
for y:=0 to 63 do begin
|
||||
for x:=0 to 159 do begin
|
||||
WindowManager.Windows[DefaultWND].Buffer[y][x].Character:= ' ';
|
||||
WindowManager.Windows[DefaultWND].Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
WindowManager.Windows[DefaultWND].row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x].Character:= ' ';
|
||||
//Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
//OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
end;
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
for y:=0 to 63 do begin
|
||||
for x:=0 to 159 do begin
|
||||
WindowManager.Windows[DefaultWND]^.Buffer[y][x].Character:= ' ';
|
||||
WindowManager.Windows[DefaultWND]^.Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
WindowManager.Windows[DefaultWND]^.row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x].Character:= ' ';
|
||||
//Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
//OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
end;
|
||||
end;
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.X:= 0;
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.Y:= 0;
|
||||
//redrawWindows;
|
||||
end;
|
||||
WindowManager.Windows[DefaultWND].Cursor.X:= 0;
|
||||
WindowManager.Windows[DefaultWND].Cursor.Y:= 0;
|
||||
redrawWindows;
|
||||
//Console_Cursor.X:= 0;
|
||||
//Console_Cursor.Y:= 0;
|
||||
end;
|
||||
@ -745,13 +881,15 @@ end;
|
||||
|
||||
procedure writecharex(character: char; attributes: uint32); [public, alias: 'console_writecharex'];
|
||||
begin
|
||||
WindowManager.Windows[DefaultWND].Buffer[WindowManager.Windows[DefaultWND].Cursor.Y][WindowManager.Windows[DefaultWND].Cursor.X].Character:= character;
|
||||
WindowManager.Windows[DefaultWND].Buffer[WindowManager.Windows[DefaultWND].Cursor.Y][WindowManager.Windows[DefaultWND].Cursor.X].Attributes:= attributes;
|
||||
//outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
||||
WindowManager.Windows[DefaultWND].row_dirty[WindowManager.Windows[DefaultWND].Cursor.Y]:= true;
|
||||
console._safeincrement_x();
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
WindowManager.Windows[DefaultWND]^.Buffer[WindowManager.Windows[DefaultWND]^.Cursor.Y][WindowManager.Windows[DefaultWND]^.Cursor.X].Character:= character;
|
||||
WindowManager.Windows[DefaultWND]^.Buffer[WindowManager.Windows[DefaultWND]^.Cursor.Y][WindowManager.Windows[DefaultWND]^.Cursor.X].Attributes:= attributes;
|
||||
//outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
||||
WindowManager.Windows[DefaultWND]^.row_dirty[WindowManager.Windows[DefaultWND]^.Cursor.Y]:= true;
|
||||
console._safeincrement_x();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure writehexpair(b : uint8);
|
||||
@ -966,17 +1104,21 @@ end;
|
||||
|
||||
procedure backspace;
|
||||
begin
|
||||
Dec(WindowManager.Windows[DefaultWND].Cursor.X);
|
||||
writechar(' ');
|
||||
Dec(WindowManager.Windows[DefaultWND].Cursor.X);
|
||||
_update_cursor();
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
Dec(WindowManager.Windows[DefaultWND]^.Cursor.X);
|
||||
writechar(' ');
|
||||
Dec(WindowManager.Windows[DefaultWND]^.Cursor.X);
|
||||
_update_cursor();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure _increment_x(); [public, alias: '_console_increment_x'];
|
||||
begin
|
||||
WindowManager.Windows[DefaultWND].Cursor.X:= WindowManager.Windows[DefaultWND].Cursor.X+1;
|
||||
If WindowManager.Windows[DefaultWND].Cursor.X > WindowManager.Windows[DefaultWND].WND_W-1 then WindowManager.Windows[DefaultWND].Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.X:= WindowManager.Windows[DefaultWND]^.Cursor.X+1;
|
||||
If WindowManager.Windows[DefaultWND]^.Cursor.X > WindowManager.Windows[DefaultWND]^.WND_W-1 then WindowManager.Windows[DefaultWND]^.Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
end;
|
||||
//Console_Cursor.X:= Console_Cursor.X+1;
|
||||
//If Console_Cursor.X > 159 then Console_Cursor.X:= 0;
|
||||
//console._update_cursor;
|
||||
@ -984,12 +1126,14 @@ end;
|
||||
|
||||
procedure _increment_y(); [public, alias: '_console_increment_y'];
|
||||
begin
|
||||
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].Cursor.Y+1;
|
||||
If WindowManager.Windows[DefaultWND].Cursor.Y > WindowManager.Windows[DefaultWND].WND_H-1 then begin
|
||||
console._newline();
|
||||
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].WND_H-1;
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.Y:= WindowManager.Windows[DefaultWND]^.Cursor.Y+1;
|
||||
If WindowManager.Windows[DefaultWND]^.Cursor.Y > WindowManager.Windows[DefaultWND]^.WND_H-1 then begin
|
||||
console._newline();
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.Y:= WindowManager.Windows[DefaultWND]^.WND_H-1;
|
||||
end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
console._update_cursor;
|
||||
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||
//If Console_Cursor.Y > 63 then begin
|
||||
// console._newline();
|
||||
@ -1000,11 +1144,13 @@ end;
|
||||
|
||||
procedure _safeincrement_x(); [public, alias: '_console_safeincrement_x'];
|
||||
begin
|
||||
WindowManager.Windows[DefaultWND].Cursor.X:= WindowManager.Windows[DefaultWND].Cursor.X+1;
|
||||
if WindowManager.Windows[DefaultWND].Cursor.X > WindowManager.Windows[DefaultWND].WND_W-1 then begin
|
||||
console._safeincrement_y();
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.X:= WindowManager.Windows[DefaultWND]^.Cursor.X+1;
|
||||
if WindowManager.Windows[DefaultWND]^.Cursor.X > WindowManager.Windows[DefaultWND]^.WND_W-1 then begin
|
||||
console._safeincrement_y();
|
||||
end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
console._update_cursor;
|
||||
//Console_Cursor.X:= Console_Cursor.X+1;
|
||||
//If Console_Cursor.X > 159 then begin
|
||||
// console._safeincrement_y();
|
||||
@ -1014,13 +1160,15 @@ end;
|
||||
|
||||
procedure _safeincrement_y(); [public, alias: '_console_safeincrement_y'];
|
||||
begin
|
||||
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].Cursor.Y+1;
|
||||
if WindowManager.Windows[DefaultWND].Cursor.Y > WindowManager.Windows[DefaultWND].WND_H-1 then begin
|
||||
console._newline();
|
||||
WindowManager.Windows[DefaultWND].Cursor.Y:= WindowManager.Windows[DefaultWND].WND_H-1;
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.Y:= WindowManager.Windows[DefaultWND]^.Cursor.Y+1;
|
||||
if WindowManager.Windows[DefaultWND]^.Cursor.Y > WindowManager.Windows[DefaultWND]^.WND_H-1 then begin
|
||||
console._newline();
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.Y:= WindowManager.Windows[DefaultWND]^.WND_H-1;
|
||||
end;
|
||||
WindowManager.Windows[DefaultWND]^.Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
end;
|
||||
WindowManager.Windows[DefaultWND].Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||
//If Console_Cursor.Y > 63 then begin
|
||||
// console._newline();
|
||||
@ -1035,27 +1183,29 @@ var
|
||||
x, y : byte;
|
||||
|
||||
begin
|
||||
if WindowManager.Windows[DefaultWND].WND_W = 0 then exit;
|
||||
if WindowManager.Windows[DefaultWND].WND_H = 0 then exit;
|
||||
for x:=0 to WindowManager.Windows[DefaultWND].WND_W do begin
|
||||
for y:=0 to WindowManager.Windows[DefaultWND].WND_H-1 do begin
|
||||
WindowManager.Windows[DefaultWND].buffer[y][x]:= WindowManager.Windows[DefaultWND].buffer[y+1][x];
|
||||
WindowManager.Windows[DefaultWND].row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
||||
end;
|
||||
if WindowManager.Windows[DefaultWND] <> nil then begin
|
||||
if WindowManager.Windows[DefaultWND]^.WND_W = 0 then exit;
|
||||
if WindowManager.Windows[DefaultWND]^.WND_H = 0 then exit;
|
||||
for x:=0 to WindowManager.Windows[DefaultWND]^.WND_W do begin
|
||||
for y:=0 to WindowManager.Windows[DefaultWND]^.WND_H-1 do begin
|
||||
WindowManager.Windows[DefaultWND]^.buffer[y][x]:= WindowManager.Windows[DefaultWND]^.buffer[y+1][x];
|
||||
WindowManager.Windows[DefaultWND]^.row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
||||
end;
|
||||
end;
|
||||
for x:=0 to WindowManager.Windows[DefaultWND]^.WND_W do begin
|
||||
WindowManager.Windows[DefaultWND]^.buffer[WindowManager.Windows[DefaultWND]^.WND_H-1][x].Character:= ' ';
|
||||
WindowManager.Windows[DefaultWND]^.buffer[WindowManager.Windows[DefaultWND]^.WND_H-1][x].Attributes:= $FFFF0000;
|
||||
//Console_Matrix[63][x].Character:= ' ';
|
||||
//Console_Matrix[63][x].Attributes:= $FFFF0000;
|
||||
end;
|
||||
//for y:=0 to 63 do begin
|
||||
// for x:=0 to 159 do begin
|
||||
// OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
// end;
|
||||
//end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
for x:=0 to WindowManager.Windows[DefaultWND].WND_W do begin
|
||||
WindowManager.Windows[DefaultWND].buffer[WindowManager.Windows[DefaultWND].WND_H-1][x].Character:= ' ';
|
||||
WindowManager.Windows[DefaultWND].buffer[WindowManager.Windows[DefaultWND].WND_H-1][x].Attributes:= $FFFF0000;
|
||||
//Console_Matrix[63][x].Character:= ' ';
|
||||
//Console_Matrix[63][x].Attributes:= $FFFF0000;
|
||||
end;
|
||||
//for y:=0 to 63 do begin
|
||||
// for x:=0 to 159 do begin
|
||||
// OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
// end;
|
||||
//end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
|
||||
{ WND Specific Console Draw Functions }
|
||||
@ -1065,19 +1215,21 @@ var
|
||||
x,y: Byte;
|
||||
|
||||
begin
|
||||
for y:=0 to 63 do begin
|
||||
for x:=0 to 159 do begin
|
||||
WindowManager.Windows[WND].Buffer[y][x].Character:= ' ';
|
||||
WindowManager.Windows[WND].Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
WindowManager.Windows[WND].row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x].Character:= ' ';
|
||||
//Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
//OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
end;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
for y:=0 to 63 do begin
|
||||
for x:=0 to 159 do begin
|
||||
WindowManager.Windows[WND]^.Buffer[y][x].Character:= ' ';
|
||||
WindowManager.Windows[WND]^.Buffer[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
WindowManager.Windows[WND]^.row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x].Character:= ' ';
|
||||
//Console_Matrix[y][x].Attributes:= Console_Properties.Default_Attribute;
|
||||
//OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
end;
|
||||
end;
|
||||
WindowManager.Windows[WND]^.Cursor.X:= 0;
|
||||
WindowManager.Windows[WND]^.Cursor.Y:= 0;
|
||||
//redrawWindows;
|
||||
end;
|
||||
WindowManager.Windows[WND].Cursor.X:= 0;
|
||||
WindowManager.Windows[WND].Cursor.Y:= 0;
|
||||
redrawWindows;
|
||||
//Console_Cursor.X:= 0;
|
||||
//Console_Cursor.Y:= 0;
|
||||
end;
|
||||
@ -1217,13 +1369,15 @@ end;
|
||||
|
||||
procedure writecharexWND(character: char; attributes: uint32; WND : uint32);
|
||||
begin
|
||||
WindowManager.Windows[WND].Buffer[WindowManager.Windows[WND].Cursor.Y][WindowManager.Windows[WND].Cursor.X].Character:= character;
|
||||
WindowManager.Windows[WND].Buffer[WindowManager.Windows[WND].Cursor.Y][WindowManager.Windows[WND].Cursor.X].Attributes:= attributes;
|
||||
//outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
||||
WindowManager.Windows[WND].row_dirty[WindowManager.Windows[WND].Cursor.Y]:= true;
|
||||
console._safeincrement_x_WND(WND);
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Buffer[WindowManager.Windows[WND]^.Cursor.Y][WindowManager.Windows[WND]^.Cursor.X].Character:= character;
|
||||
WindowManager.Windows[WND]^.Buffer[WindowManager.Windows[WND]^.Cursor.Y][WindowManager.Windows[WND]^.Cursor.X].Attributes:= attributes;
|
||||
//outputChar(character, Console_Cursor.X, Console_Cursor.Y, attributes SHR 16, attributes AND $FFFF);
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Character:= character;
|
||||
//Console_Matrix[Console_Cursor.Y][Console_Cursor.X].Attributes:= attributes;
|
||||
WindowManager.Windows[WND]^.row_dirty[WindowManager.Windows[WND]^.Cursor.Y]:= true;
|
||||
console._safeincrement_x_WND(WND);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure writehexpairWND(b : uint8; WND : uint32);
|
||||
@ -1416,17 +1570,21 @@ end;
|
||||
|
||||
procedure backspaceWND(WND : uint32);
|
||||
begin
|
||||
Dec(WindowManager.Windows[WND].Cursor.X);
|
||||
writecharWND(' ', WND);
|
||||
Dec(WindowManager.Windows[WND].Cursor.X);
|
||||
_update_cursor();
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
Dec(WindowManager.Windows[WND]^.Cursor.X);
|
||||
writecharWND(' ', WND);
|
||||
Dec(WindowManager.Windows[WND]^.Cursor.X);
|
||||
_update_cursor();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure _increment_x_WND(WND : uint32);
|
||||
begin
|
||||
WindowManager.Windows[WND].Cursor.X:= WindowManager.Windows[WND].Cursor.X+1;
|
||||
If WindowManager.Windows[WND].Cursor.X > WindowManager.Windows[WND].WND_W-1 then WindowManager.Windows[WND].Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Cursor.X:= WindowManager.Windows[WND]^.Cursor.X+1;
|
||||
If WindowManager.Windows[WND]^.Cursor.X > WindowManager.Windows[WND]^.WND_W-1 then WindowManager.Windows[WND]^.Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
end;
|
||||
//Console_Cursor.X:= Console_Cursor.X+1;
|
||||
//If Console_Cursor.X > 159 then Console_Cursor.X:= 0;
|
||||
//console._update_cursor;
|
||||
@ -1434,12 +1592,14 @@ end;
|
||||
|
||||
procedure _increment_y_WND(WND : uint32);
|
||||
begin
|
||||
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].Cursor.Y+1;
|
||||
If WindowManager.Windows[WND].Cursor.Y > WindowManager.Windows[WND].WND_H-1 then begin
|
||||
console._newlineWND(WND);
|
||||
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].WND_H-1;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Cursor.Y:= WindowManager.Windows[WND]^.Cursor.Y+1;
|
||||
If WindowManager.Windows[WND]^.Cursor.Y > WindowManager.Windows[WND]^.WND_H-1 then begin
|
||||
console._newlineWND(WND);
|
||||
WindowManager.Windows[WND]^.Cursor.Y:= WindowManager.Windows[WND]^.WND_H-1;
|
||||
end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
console._update_cursor;
|
||||
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||
//If Console_Cursor.Y > 63 then begin
|
||||
// console._newline();
|
||||
@ -1450,11 +1610,13 @@ end;
|
||||
|
||||
procedure _safeincrement_x_WND(WND : uint32);
|
||||
begin
|
||||
WindowManager.Windows[WND].Cursor.X:= WindowManager.Windows[WND].Cursor.X+1;
|
||||
if WindowManager.Windows[WND].Cursor.X > WindowManager.Windows[WND].WND_W-1 then begin
|
||||
console._safeincrement_y_WND(WND);
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Cursor.X:= WindowManager.Windows[WND]^.Cursor.X+1;
|
||||
if WindowManager.Windows[WND]^.Cursor.X > WindowManager.Windows[WND]^.WND_W-1 then begin
|
||||
console._safeincrement_y_WND(WND);
|
||||
end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
console._update_cursor;
|
||||
//Console_Cursor.X:= Console_Cursor.X+1;
|
||||
//If Console_Cursor.X > 159 then begin
|
||||
// console._safeincrement_y();
|
||||
@ -1464,13 +1626,15 @@ end;
|
||||
|
||||
procedure _safeincrement_y_WND(WND : uint32);
|
||||
begin
|
||||
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].Cursor.Y+1;
|
||||
if WindowManager.Windows[WND].Cursor.Y > WindowManager.Windows[WND].WND_H-1 then begin
|
||||
console._newlineWND(WND);
|
||||
WindowManager.Windows[WND].Cursor.Y:= WindowManager.Windows[WND].WND_H-1;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
WindowManager.Windows[WND]^.Cursor.Y:= WindowManager.Windows[WND]^.Cursor.Y+1;
|
||||
if WindowManager.Windows[WND]^.Cursor.Y > WindowManager.Windows[WND]^.WND_H-1 then begin
|
||||
console._newlineWND(WND);
|
||||
WindowManager.Windows[WND]^.Cursor.Y:= WindowManager.Windows[WND]^.WND_H-1;
|
||||
end;
|
||||
WindowManager.Windows[WND]^.Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
end;
|
||||
WindowManager.Windows[WND].Cursor.X:= 0;
|
||||
console._update_cursor;
|
||||
//Console_Cursor.Y:= Console_Cursor.Y+1;
|
||||
//If Console_Cursor.Y > 63 then begin
|
||||
// console._newline();
|
||||
@ -1485,27 +1649,29 @@ var
|
||||
x, y : byte;
|
||||
|
||||
begin
|
||||
if WindowManager.Windows[WND].WND_W = 0 then exit;
|
||||
if WindowManager.Windows[WND].WND_H = 0 then exit;
|
||||
for x:=0 to WindowManager.Windows[WND].WND_W do begin
|
||||
for y:=0 to WindowManager.Windows[WND].WND_H-1 do begin
|
||||
WindowManager.Windows[WND].buffer[y][x]:= WindowManager.Windows[WND].buffer[y+1][x];
|
||||
WindowManager.Windows[WND].row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
||||
end;
|
||||
if WindowManager.Windows[WND] <> nil then begin
|
||||
if WindowManager.Windows[WND]^.WND_W = 0 then exit;
|
||||
if WindowManager.Windows[WND]^.WND_H = 0 then exit;
|
||||
for x:=0 to WindowManager.Windows[WND]^.WND_W do begin
|
||||
for y:=0 to WindowManager.Windows[WND]^.WND_H-1 do begin
|
||||
WindowManager.Windows[WND]^.buffer[y][x]:= WindowManager.Windows[WND]^.buffer[y+1][x];
|
||||
WindowManager.Windows[WND]^.row_dirty[y]:= true;
|
||||
//Console_Matrix[y][x]:= Console_Matrix[y+1][x];
|
||||
end;
|
||||
end;
|
||||
for x:=0 to WindowManager.Windows[WND]^.WND_W do begin
|
||||
WindowManager.Windows[WND]^.buffer[WindowManager.Windows[WND]^.WND_H-1][x].Character:= ' ';
|
||||
WindowManager.Windows[WND]^.buffer[WindowManager.Windows[WND]^.WND_H-1][x].Attributes:= $FFFF0000;
|
||||
//Console_Matrix[63][x].Character:= ' ';
|
||||
//Console_Matrix[63][x].Attributes:= $FFFF0000;
|
||||
end;
|
||||
//for y:=0 to 63 do begin
|
||||
// for x:=0 to 159 do begin
|
||||
// OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
// end;
|
||||
//end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
for x:=0 to WindowManager.Windows[WND].WND_W do begin
|
||||
WindowManager.Windows[WND].buffer[WindowManager.Windows[WND].WND_H-1][x].Character:= ' ';
|
||||
WindowManager.Windows[WND].buffer[WindowManager.Windows[WND].WND_H-1][x].Attributes:= $FFFF0000;
|
||||
//Console_Matrix[63][x].Character:= ' ';
|
||||
//Console_Matrix[63][x].Attributes:= $FFFF0000;
|
||||
end;
|
||||
//for y:=0 to 63 do begin
|
||||
// for x:=0 to 159 do begin
|
||||
// OutputChar(Console_Matrix[y][x].Character, x, y, Console_Matrix[y][x].Attributes SHR 16, Console_Matrix[y][x].Attributes AND $FFFF);
|
||||
// end;
|
||||
//end;
|
||||
console._update_cursor;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -56,6 +56,7 @@ type
|
||||
PDouble = ^Double;
|
||||
|
||||
Void = ^uInt32;
|
||||
HWND = uint32;
|
||||
|
||||
//Alternate Types
|
||||
UBit1 = 0..(1 shl 01) - 1;
|
||||
|
@ -333,7 +333,7 @@ var
|
||||
|
||||
begin
|
||||
disable_cursor;
|
||||
closeAllWindows;
|
||||
console.forceQuitAll;
|
||||
if not BSOD_ENABLE then exit;
|
||||
console.setdefaultattribute(console.combinecolors($FFFF, $F800));
|
||||
console.clear;
|
||||
|
@ -45,7 +45,8 @@ uses
|
||||
faults,
|
||||
fonts,
|
||||
RTC,
|
||||
serial;
|
||||
serial,
|
||||
memview;
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||
|
||||
@ -210,6 +211,9 @@ begin
|
||||
console.writestringln('Press any key to boot in to Asuro Terminal...');
|
||||
tracer.pop_trace;
|
||||
|
||||
{ Init Progs }
|
||||
memview.init();
|
||||
|
||||
tracer.push_trace('kmain.KEYHOOK');
|
||||
keyboard.hook(@temphook);
|
||||
tracer.pop_trace;
|
||||
|
102
src/prog/memview.pas
Normal file
102
src/prog/memview.pas
Normal file
@ -0,0 +1,102 @@
|
||||
unit memview;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
console, terminal;
|
||||
|
||||
procedure init();
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
strings, tracer;
|
||||
|
||||
var
|
||||
Handle : HWND = 0;
|
||||
MEM_LOC : uint32;
|
||||
|
||||
procedure mvprintmemory(source : uint32; length : uint32; col : uint32; delim : PChar; offset_row : boolean);
|
||||
var
|
||||
buf : puint8;
|
||||
i : uint32;
|
||||
|
||||
begin
|
||||
tracer.push_trace('memview.printmemory');
|
||||
buf:= puint8(source);
|
||||
console.writestringlnWND(' ', Handle);
|
||||
console.writestringlnWND(' ', Handle);
|
||||
for i:=0 to length-1 do begin
|
||||
if offset_row and (i = 0) then begin
|
||||
console.writestringWND(' ', Handle);
|
||||
console.writehexWND(source + (i), Handle);
|
||||
console.writestringWND(': ', Handle);
|
||||
end;
|
||||
console.writehexpairWND(buf[i], Handle);
|
||||
if i<>length-1 then begin
|
||||
if ((i+1) MOD col) = 0 then begin
|
||||
console.writestringlnWND(' ', Handle);
|
||||
if offset_row then begin
|
||||
console.writestringWND(' ', Handle);
|
||||
console.writehexWND(source + (i + 1), Handle);
|
||||
console.writestringWND(': ', Handle);
|
||||
end;
|
||||
end else begin
|
||||
console.writestringWND(delim, Handle);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
console.writestringlnWND(' ', Handle);
|
||||
end;
|
||||
|
||||
procedure OnClose();
|
||||
begin
|
||||
Handle:= 0;
|
||||
end;
|
||||
|
||||
procedure Draw();
|
||||
begin
|
||||
tracer.push_trace('memview.draw');
|
||||
if Handle <> 0 then begin
|
||||
clearWND(Handle);
|
||||
mvprintmemory(MEM_LOC, 176, 16, ' ', true);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure run(Params : PParamList);
|
||||
var
|
||||
loc : PChar;
|
||||
|
||||
begin
|
||||
tracer.push_trace('memview.run');
|
||||
if ParamCount(Params) < 1 then begin
|
||||
writestringlnWND('No memory location specified!', getTerminalHWND);
|
||||
end else begin
|
||||
loc:= GetParam(0, Params);
|
||||
if StringEquals(loc, 'close') then begin
|
||||
tracer.push_trace('memview.close');
|
||||
if Handle <> 0 then begin
|
||||
closeWindow(Handle);
|
||||
end;
|
||||
end else begin
|
||||
MEM_LOC:= stringToInt(loc);
|
||||
if Handle = 0 then begin
|
||||
Handle:= newWindow(20, 40, 63, 14, 'MEMVIEW');
|
||||
registerEventHandler(Handle, EVENT_DRAW, void(@Draw));
|
||||
registerEventHandler(Handle, EVENT_CLOSE, void(@OnClose));
|
||||
writestringWND('Memview started at location: ', getTerminalHWND);
|
||||
end else begin
|
||||
writestringWND('Memview location changed to: ', getTerminalHWND);
|
||||
end;
|
||||
writehexlnWND(MEM_LOC, getTerminalHWND);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
tracer.push_trace('memview.init');
|
||||
terminal.registerCommand('MEMVIEW', @Run, 'View a location in memory [MEMVIEW <Location>]');
|
||||
end;
|
||||
|
||||
end.
|
@ -22,9 +22,6 @@ uses
|
||||
asuro,
|
||||
serial;
|
||||
|
||||
const
|
||||
TERMINAL_HWND = 1;
|
||||
|
||||
type
|
||||
PParamList = ^TParamList;
|
||||
TParamList = record
|
||||
@ -67,6 +64,9 @@ implementation
|
||||
uses
|
||||
RTC;
|
||||
|
||||
var
|
||||
TERMINAL_HWND : HWND = 1;
|
||||
|
||||
function getTerminalHWND : uint32;
|
||||
begin
|
||||
getTerminalHWND:= TERMINAL_HWND;
|
||||
@ -387,6 +387,7 @@ begin
|
||||
success:= success AND Serial.Send(COM1, uint8('R'), 1000);
|
||||
success:= success AND Serial.Send(COM1, uint8('L'), 1000);
|
||||
success:= success AND Serial.Send(COM1, uint8('D'), 1000);
|
||||
success:= success AND Serial.Send(COM1, 10, 1000);
|
||||
success:= success AND Serial.Send(COM1, 13, 1000);
|
||||
if success then begin
|
||||
console.writestringlnWND('Send Success!', TERMINAL_HWND);
|
||||
@ -416,6 +417,8 @@ end;
|
||||
|
||||
procedure run;
|
||||
begin
|
||||
TERMINAL_HWND:= newWindow(20, 10, 90, 20, 'ASURO TERMINAL');
|
||||
//newWindow(10, 10, 32, 32, 'MEMVIEW');
|
||||
keyboard.hook(@key_event);
|
||||
console.clearWND(TERMINAL_HWND);
|
||||
console.writestringWND('Asuro#', TERMINAL_HWND);
|
||||
|
Loading…
x
Reference in New Issue
Block a user