Fix AHCIBufferAlign causing crashes on bare-metal.

Update 32-bit color graphics demo.
Add global Boolean to toggle window manager framebuffer writes.
This commit is contained in:
TomAwezome 2021-06-22 14:44:19 -04:00
parent 413b73db76
commit 59eba5a7de
6 changed files with 18 additions and 3 deletions

View file

@ -11,7 +11,13 @@ I0 Color32Demo()
I64 i, j, x, y;
CBGR24 color;
while (TRUE)
"\nPress any key to exit demo.\n\n";
Sleep(500);
text.is_fb_busy = TRUE;
while (!CharScan)
{
x = FloorI64(RandU16 % GR_WIDTH, SQUARE_SIZE + SQUARE_GAP);
y = FloorI64(RandU16 % GR_WIDTH, SQUARE_SIZE + SQUARE_GAP);
@ -21,8 +27,12 @@ I0 Color32Demo()
for (j = 0; j < SQUARE_SIZE; j++)
DrawPixel(x + i, y + j, color);
Busy(1000);
Sleep(100);
}
text.is_fb_busy = FALSE;
LFBFlush;
}
Color32Demo;

View file

@ -320,7 +320,7 @@ U8 *AHCIBufferAlign(CBlkDev *bd, U8 *user_buf, I64 buf_size, Bool write)
// "Aligning buffer under 32-bit range\n";
Free(bd->prd_buf);
bd->prd_buf = MAlloc(buf_size, Fs->code_heap);
bd->prd_buf = MAlloc(buf_size, zenith_task->code_heap);
Bts(&bd->flags, BDf_INTERNAL_BUF);

View file

@ -4208,6 +4208,7 @@ public class CTextGlobals
U64 *font, *aux_font, screen_size, buffer_size;
U8 *vga_alias;
U8 border_chars[16];
Bool is_fb_busy;
};
#define FONT_WIDTH 8

View file

@ -190,6 +190,7 @@ U0 CtrlAltT(I64)
U0 CtrlAltV(I64)
{
LFBFlush;
text.is_fb_busy = FALSE;
}
U0 CtrlAltX(I64)

View file

@ -416,6 +416,9 @@ U0 GrUpdateScreen()
{//Called by the Window Manager $LK,"HERE",A="FF:::/Zenith/WinMgr.CC,GrUpdateScreen"$, 30 times a second.
CDC *dc;
if (text.is_fb_busy)
return;
GrUpdateTextBG;
GrUpdateTextFG;
GrUpdateTasks;