ZealOS/docs/Kernel/Display.ZC.html
2021-12-11 06:10:58 -05:00

162 lines
17 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> ch)
<a name="l2"></a>{</span><span class=cF2>/*For RAW output during boot and in debugger.</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a></span><span class=cF2>See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrScreen.ZC.html#l277"><span class=cF4>GrUpdateTextFG</span></a><span class=cF2> for</span><span class=cF0>
<a name="l5"></a></span><span class=cF2>the normal screen text output routine.</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a></span><span class=cF2>See also </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrScreen.ZC.html#l404"><span class=cF4>GrUpdateScreen</span></a><span class=cF2>().</span><span class=cF0>
<a name="l8"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l9"></a> </span><span class=cF9>I64</span><span class=cF0> i, row, col, x, y;
<a name="l10"></a> </span><span class=cF9>U32</span><span class=cF0> *framebuffer;
<a name="l11"></a> </span><span class=cF9>U64</span><span class=cF0> ch_bitmap;
<a name="l12"></a>
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFB>text</span><span class=cF0>.raw_flags &amp; </span><span class=cF3>RAWF_SHOW_DOLLAR</span><span class=cF7>)</span><span class=cF0>)
<a name="l14"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'$'</span><span class=cF0>)
<a name="l16"></a> {
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>text</span><span class=cF0>.raw_flags &amp; </span><span class=cF3>RAWF_IN_DOLLAR</span><span class=cF0>)
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l19"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags &amp;= ~</span><span class=cF3>RAWF_IN_DOLLAR</span><span class=cF0>;
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFB>text</span><span class=cF0>.raw_flags &amp; </span><span class=cF3>RAWF_LAST_DOLLAR</span><span class=cF7>)</span><span class=cF0>)
<a name="l21"></a> {
<a name="l22"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags &amp;= ~</span><span class=cF3>RAWF_LAST_DOLLAR</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l24"></a> }
<a name="l25"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l26"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l27"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l28"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags |= </span><span class=cF3>RAWF_IN_DOLLAR</span><span class=cF0> | </span><span class=cF3>RAWF_LAST_DOLLAR</span><span class=cF0>;
<a name="l29"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l31"></a> }
<a name="l32"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags &amp;= ~</span><span class=cF3>RAWF_LAST_DOLLAR</span><span class=cF0>;
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>text</span><span class=cF0>.raw_flags &amp; </span><span class=cF3>RAWF_IN_DOLLAR</span><span class=cF0>)
<a name="l34"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l35"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l36"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l37"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l38"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l39"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>text</span><span class=cF0>.raw_col &amp; </span><span class=cFE>3</span><span class=cF0>)
<a name="l40"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l41"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l42"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>)
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l44"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col--;
<a name="l45"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l46"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col--;
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\n'</span><span class=cF0>)
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l50"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l51"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>text</span><span class=cF0>.raw_col % </span><span class=cFB>text</span><span class=cF0>.cols)
<a name="l52"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_displayable</span><span class=cF0>, ch</span><span class=cF7>)</span><span class=cF0>)
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l56"></a> row = </span><span class=cFB>text</span><span class=cF0>.raw_col / </span><span class=cFB>text</span><span class=cF0>.cols % </span><span class=cFB>text</span><span class=cF0>.rows;
<a name="l57"></a> col = </span><span class=cFB>text</span><span class=cF0>.raw_col % </span><span class=cFB>text</span><span class=cF0>.cols;
<a name="l58"></a>
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>text</span><span class=cF0>.raw_flags &amp; </span><span class=cF3>RAWF_SCROLL</span><span class=cF0> &amp;&amp; </span><span class=cFB>text</span><span class=cF0>.raw_col &amp;&amp; !row &amp;&amp; !col)
<a name="l60"></a> {</span><span class=cF2>//Scroll screen down</span><span class=cF0>
<a name="l61"></a>
<a name="l62"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.fb_alias,
<a name="l63"></a> </span><span class=cFB>text</span><span class=cF0>.fb_alias + </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>,
<a name="l64"></a> </span><span class=cF7>(</span><span class=cFB>text</span><span class=cF0>.screen_size - </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width * </span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>U32</span><span class=cF7>)</span><span class=cF0>);
<a name="l65"></a>
<a name="l66"></a> </span><span class=cF5>MemSetU32</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.fb_alias + </span><span class=cFB>text</span><span class=cF0>.screen_size - </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cF3>BLACK32</span><span class=cF0>, </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>);
<a name="l67"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col -= </span><span class=cFB>text</span><span class=cF0>.cols ;
<a name="l68"></a> row = </span><span class=cFB>text</span><span class=cF0>.rows - </span><span class=cFE>1</span><span class=cF0>;
<a name="l69"></a> }
<a name="l70"></a> x = col * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l71"></a> y = row * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l72"></a> ch_bitmap = </span><span class=cFB>text</span><span class=cF0>.font[ch &amp; </span><span class=cFE>0xFF</span><span class=cF0>];
<a name="l73"></a> framebuffer = </span><span class=cFB>text</span><span class=cF0>.fb_alias + </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width * y + x;
<a name="l74"></a>
<a name="l75"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>; i++)
<a name="l78"></a> {
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (ch_bitmap &amp; </span><span class=cFE>1</span><span class=cF0>)
<a name="l80"></a> *framebuffer++ = </span><span class=cF3>WHITE32</span><span class=cF0>;
<a name="l81"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l82"></a> *framebuffer++ = </span><span class=cF3>BLACK32</span><span class=cF0>;
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (i &amp; </span><span class=cF7>(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>)
<a name="l84"></a> framebuffer += </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width - </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l85"></a> ch_bitmap &gt;&gt;= </span><span class=cFE>1</span><span class=cF0>;
<a name="l86"></a> }
<a name="l87"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l88"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col++;
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l90"></a>}
<a name="l91"></a>
<a name="l92"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>LFBFlush</span><span class=cF0>()
<a name="l93"></a>{</span><span class=cF2>//Flush winmgr screen cache, so updates whole screen.</span><span class=cF0>
<a name="l94"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_FLUSH_VBE_IMAGE</span><span class=cF0>], </span><span class=cFE>0</span><span class=cF0>);
<a name="l95"></a>}
<a name="l96"></a>
<a name="l97"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinDerivedValsUpdate</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
<a name="l98"></a>{</span><span class=cF2>//Those things calculated from other variables.</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l100"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l101"></a> </span><span class=cF2>//Assert: This is called with TASKf_TASK_LOCK set</span><span class=cF0>
<a name="l102"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l103"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l104"></a> task-&gt;win_width = task-&gt;win_right - task-&gt;win_left + </span><span class=cFE>1</span><span class=cF0>;
<a name="l105"></a> task-&gt;win_height = task-&gt;win_bottom - task-&gt;win_top + </span><span class=cFE>1</span><span class=cF0>;
<a name="l106"></a>
<a name="l107"></a> task-&gt;pix_left = </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * task-&gt;win_left;
<a name="l108"></a> task-&gt;pix_right = </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * (task-&gt;win_right + </span><span class=cFE>1</span><span class=cF0>) - </span><span class=cFE>1</span><span class=cF0>;
<a name="l109"></a>
<a name="l110"></a> task-&gt;pix_width = task-&gt;pix_right - task-&gt;pix_left + </span><span class=cFE>1</span><span class=cF0>;
<a name="l111"></a>
<a name="l112"></a> task-&gt;pix_top = </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * task-&gt;win_top;
<a name="l113"></a> task-&gt;pix_bottom = </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * (task-&gt;win_bottom + </span><span class=cFE>1</span><span class=cF0>) - </span><span class=cFE>1</span><span class=cF0>;
<a name="l114"></a>
<a name="l115"></a> task-&gt;pix_height = task-&gt;pix_bottom - task-&gt;pix_top + </span><span class=cFE>1</span><span class=cF0>;
<a name="l116"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l117"></a>}
<a name="l118"></a>
<a name="l119"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>WinInside</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> border=</span><span class=cFE>0</span><span class=cF0>)
<a name="l120"></a>{</span><span class=cF2>//Is pixel (x,y) inside task's win? Border to FONT_WIDTH.</span><span class=cF0>
<a name="l121"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l122"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
<a name="l124"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l126"></a> border = </span><span class=cFE>0</span><span class=cF0>;
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;pix_left - border &lt;= x &lt;= task-&gt;pix_right + border &amp;&amp;
<a name="l128"></a> task-&gt;pix_top - border &lt;= y &lt;= task-&gt;pix_bottom + border)
<a name="l129"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l131"></a>
<a name="l132"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l133"></a>}
</span></pre></body>
</html>