Fix Palette Demo

Balloon Demo can't work anymore
remove vga_text_cache
update some documentation on graphics
MemRep vbe additions
This commit is contained in:
xmm15 2020-02-19 19:34:08 -06:00
parent a8c0bc9903
commit 8fe695955a
12 changed files with 19 additions and 22 deletions

Binary file not shown.

Binary file not shown.

View file

@ -4,7 +4,7 @@ U8 a[60]={0,127,0,1,255,192,3,255,224,3,231,224,
7,217,240,7,223,240,7,217,240,3,231,224,
3,255,224,3,255,224,2,255,160,1,127,64,
1,62,64,0,156,128,0,156,128,0,73,0,0,73,0,
 0,62,0,0,62,0,0,28,0};
0,62,0,0,62,0,0,28,0};
U0 Balloon()
{

View file

@ -1,23 +1,23 @@
U0 PaletteDemo()
{
I64 i,j;
CBGR48 bgr;
CBGR24 bgr;
for (i=0;i<COLORS_NUM;i++)
"$$BLACK$$$$BG,%d$$__%-8Z__$$FG$$$$BG$$\n",i,i,"ST_COLORS";
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
//Alternatively, use $LK,"GrPaletteSet",A="MN:GrPaletteSet"$(gr_palette_gray);
for (i=0;i<COLORS_NUM;i++) {
j=0xFFFF*i/(COLORS_NUM-1);
j=0xFF*i/(COLORS_NUM-1);
bgr.b=j;
bgr.g=j;
bgr.r=j;
GrPaletteColorSet(i,bgr);
gr_palette[i] = bgr;
}
PressAKey;
//You can do it this way, too.
GrPaletteColorSet(WHITE,0xFFFFFFFF0000);
gr_palette[WHITE] = 0xFFFF00;
PressAKey;
//$LK,"SettingsPop",A="MN:SettingsPop"$() restores original palette

View file

@ -42,8 +42,8 @@ $ID,-2$$TR,"Why does it leak memory?"$
$ID,2$ZenithOS allocs mem as more items are displayed in the window. Also, ZenithOS allocs mem for code as it is compiled at the cmd line. If you $FG,2$#include$FG$ a file twice, it allocs more mem for it. If you have a 50,000 line program with each line taking twenty bytes on a machine with 1 Gig, you could $FG,2$#include$FG$ it a thousand times if it had no data or graphics and no other use of mem. If it bothers you, hit $FG,2$<CTRL-ALT-x>$FG$ and $FG,2$<CTRL-ALT-t>, $FG$periodically, to kill and recreate the task$FG$. Use the pop-up flag on macros in your $LK,"PersonalMenu",A="FI:::Home/PersonalMenu.DD"$ to spawn new tasks, run applications and free the applications when they are finished. Small mem chunks stick to the task when they are freed until it is killed. The only way to get in trouble is allocating multiple Meg chunks and freeing them. These can only be reused if the same size gets alloced again. Use $LK,"HeapLog",A="MN:HeapLog"$(), $LK,"HeapLogAddrRep",A="MN:HeapLogAddrRep"$() and $LK,"HeapLogSizeRep",A="MN:HeapLogSizeRep"$() to see who alloced mem and didn't free it. See $LK,"MemoryOverview",A="FI:::/Doc/MemoryOverview.DD"$.
$ID,-2$$TR,"Why do I get a memory leak when editing big files?"$
$ID,2$The editor periodically takes a snap-shot of the document for $FG,2$UNDO$FG$ and this looks like a memory leak.
$ID,-2$$TR,"Why is it in text mode?"$
$ID,2$ZenithOS runs in $FG,2$VGA 640x480 16 color$FG$ graphics mode, not text mode. It changes to this mode with a $LK,"BIOS call",A="FF:::/Kernel/KStart16.CC,INT 0x10"$ while in real-mode before it switches to 64-bit mode. The text is $LK,"drawn by hand",A="MN:GrUpdateTextFG"$. See $LK,"::/Kernel/FontStd.CC"$. If graphics mode fails, it falls-back on text mode. You can force text mode with an $LK,"Kernel config",A="FI:::/Kernel/KConfig.CC"$ option.
$ID,-2$$TR-C,"Why is it in text mode?"$
$ID,2$ZenithOS runs in $FG,2$High-res 32-bit color VBE$FG$ graphics modes, not text mode. It changes to this mode with a $LK,"BIOS call",A="FF:::/Kernel/KStart16.CC,INT 0x10"$ while in real-mode before it switches to 64-bit mode. The text is $LK,"drawn by hand",A="MN:GrUpdateTextFG"$. See $LK,"::/Kernel/FontStd.CC"$.
$ID,-2$$TR,"Where is the kernel memory?"$
$ID,2$ZenithOS identity-maps all memory, all the time. It is like paging is not used. There is no special kernel $FG,2$high half$FG$ memory space. ZenithOS is ring-0-only, so everything is kernel, even user programs. There is a special task called $FG,2$Zenith$FG$ and he doesn't die, so his heap never gets freed. That's as close to $FG,2$kernel memory$FG$ as it gets. All code goes in the lowest 2Gig of addresses, known as the $LK,"Code Heap",A="FF:::/Doc/Glossary.DD,Code and Data Heaps"$, so that the $FG,2$REL32$FG$ addressing mode can be used. See $LK,"MemoryOverview",A="FI:::/Doc/MemoryOverview.DD"$.
$ID,-2$$TR,"Why does it run code from stack addresses?"$

View file

@ -34,7 +34,7 @@ A three bttn mouse is like a leg you cannot put weight on. ZenithOS just does h
* $FG,2$640x480$FG$ 16 colors. Updates whole screen at $FG,2$60 fps$FG$, optimized for full screen games where $FG,2$InvalidRectangle$FG$s are counter-productive.
* One font, 8x8. Text and graphic layers done in software with text normally on an 8x8 grid. It can run in Text mode if graphic initialization fails.
* One font, 8x8. Text and graphic layers done in software with text normally on an 8x8 grid.
* Compiler extends all values to 64-bit when fetched and does only 64-bit computations intermediately. Assembler has minimal 16-bit support, good enough for compiling boot loaders.

Binary file not shown.

View file

@ -1570,7 +1570,7 @@ U0 OSTestSuite()
TS("SpriteText"); TSFile("::/Demo/Graphics/SpriteText");
TS("SpriteRaw"); TSFile("::/Demo/Graphics/SpriteRaw");
TS("EdSprite"); TSFile("::/Demo/Graphics/EdSprite");
TS("Balloon"); TSFile("::/Demo/Graphics/Balloon",0);
// TS("Balloon"); TSFile("::/Demo/Graphics/Balloon",0);
TS("Carry"); TSFile("::/Demo/Carry");
TS("Directives"); TSFile("::/Demo/Directives");
TS("RandDemo"); DoRandDemo;
@ -1624,7 +1624,7 @@ U0 OSTestSuite()
TS("TextDemo"); TSFile("::/Demo/DolDoc/TextDemo");
TS("CursorMove"); TSFile("::/Demo/DolDoc/CursorMove");
TS("MiniCompiler"); DoMiniCompiler;
TS("MiniGrLib"); TSFile("::/Demo/Lectures/MiniGrLib",0);
// TS("MiniGrLib"); TSFile("::/Demo/Lectures/MiniGrLib",0);
TS("TimeIns"); TSFileChar("::/Demo/TimeIns");
TS("PhoneNumWords"); DoPhoneNumWords;
TS("UnusedSpaceRep"); TSFile("::/Demo/Disk/UnusedSpaceRep");
@ -1715,8 +1715,9 @@ U0 OSTestSuite()
TS("VideoRep"); XTalkWait(task, "VideoRep;Sleep(750);\n");
DeathWait(&task,TRUE);
 ProgressBarsReset("ZenithOS/OSTestSuite");
ProgressBarsReset("ZenithOS/OSTestSuite");
"Elapsed Time:%5.3f\n",tS-ts_t0;
}
OSTestSuite;


Binary file not shown.

View file

@ -17,7 +17,6 @@ public class CGrGlobals
U16 *win_uncovered_bitmap;
I64 highest_uncovered;
U16 *vga_text_cache;
I64 pan_text_x,pan_text_y; //[-7,7]
U0 (*fp_final_screen_update)(CDC *dc);//Mouse cursor is handled here.
U0 (*fp_wall_paper)(CTask *task);
@ -56,4 +55,4 @@ DefinePrint("GR_HEIGHT", "%d", sys_vbe_mode.height);
DefinePrint("TEXT_ROWS","%d",text.rows);;
HashPublic("TEXT_ROWS",HTT_DEFINE_STR);;
DefinePrint("TEXT_COLS","%d",text.cols);;
HashPublic("TEXT_COLS",HTT_DEFINE_STR);;
HashPublic("TEXT_COLS",HTT_DEFINE_STR);;

View file

@ -168,7 +168,7 @@ U0 GrInit2()
HashDefineListAdd("ST_SPRITE_ELEM_CODES",SPHT_ELEM_CODE,gr.sprite_hash);
gr.screen_zoom=1;
PaletteSetGruvboxLight;
PaletteSetGruvboxLight;
gr.to_8_bits =MAlloc(256*sizeof(I64));
gr.to_8_colors=MAlloc(256*sizeof(I64));
@ -176,7 +176,6 @@ U0 GrInit2()
gr.screen_cache = MAlloc(sys_vbe_mode.width * sys_vbe_mode.height);
gr.text_base=CAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U32));
gr.vga_text_cache=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
gr.win_uncovered_bitmap=CAlloc(65536/8);
gr.highest_uncovered=0;
gr.win_z_buf=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));

View file

@ -168,17 +168,16 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
"BlkDevs\t:%010X\n",BlkDevsSize;
"Drives\t:%010X\n",DrivesSize;
if (blkdev.cache_base)
"DiskCache\t:%010X\n",
MSize2(blkdev.cache_base)+MSize2(blkdev.cache_hash_table)+
MSize2(blkdev.cache_ctrl);
"DiskCache\t:%010X\n",MSize2(blkdev.cache_base)+MSize2(blkdev.cache_hash_table)+ MSize2(blkdev.cache_ctrl);
"Clip\t:%010X\n",DocSize(sys_clip_doc);
"AutoComplete:%010X\n",CallExtStr("AutoCompleteSize");
"text.font\t:%010X\n", MSize2(text.font);
"text.raw_screen\t:%010X\n", MSize2(text.raw_screen);
"gr.to_8_bits\t:%010X\n",MSize2(gr.to_8_bits);
"gr.to_8_colors\t:%010X\n",MSize2(gr.to_8_colors);
"gr.text_base\t:%010X\n",MSize2(gr.text_base);
"gr.vga_text_cache\t:%010X\n",MSize2(gr.vga_text_cache);
"gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+
MSize2(gr.win_uncovered_bitmap);
"gr.screen_cache\t:%010X\n",MSize2(gr.screen_cache);
"gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+ MSize2(gr.win_uncovered_bitmap);
"gr.dc\t\t:%010X\n",DCSize(gr.dc);
"gr.dc1\t\t:%010X\n",DCSize(gr.dc1);
"gr.dc2\t\t:%010X\n",DCSize(gr.dc2);
@ -201,7 +200,6 @@ public U0 MemRep()
"$$BLACK$$Low Memory\t:0000100000$$FG$$\n$$ID,2$$";
"Kernel\t:%010X-%010X\n",mem_boot_base-sizeof(CBinFile),bfh;
"VGA\t\t:00000A0000-00000BFFFF\n";
"$$ID,-2$$$$BLACK$$HighMemory\t:0000100000-%010X$$FG$$\n",
mem_heap_limit;
"$LK,"SYS_FIXED_AREA",A="MN:CSysFixedArea"$\t:%010X-%010X\n",