ZealOS/docs/Kernel/Display.CC.html
TomAwezome 1b75d91002 Fix Mount AHCI Port selection.
Add arg to SATARep to specify drive types to show.
Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
2021-08-02 16:40:05 -04:00

170 lines
18 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.13">
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</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.CC.html#l296"><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.CC.html#l415"><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, framebuffer_u64_size, framebuffer_u64_offset;
<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, *framebuffer_u64;
<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=cF2>//</span><span class=cF0> </span><span class=cF2>MemCopy(text.fb_alias,</span><span class=cF0>
<a name="l63"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>text.fb_alias</span><span class=cF0> </span><span class=cF2>+ sys_vbe_mode.width * FONT_HEIGHT,</span><span class=cF0>
<a name="l64"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>(text.screen_size</span><span class=cF0> </span><span class=cF2>- sys_vbe_mode.width * FONT_HEIGHT) * sizeof(U32));</span><span class=cF0>
<a name="l65"></a>
<a name="l66"></a> </span><span class=cF2>// MemCopy is slow, computing these and iterating U64's manually is far faster.</span><span class=cF0>
<a name="l67"></a> framebuffer_u64 = </span><span class=cFB>text</span><span class=cF0>.fb_alias;
<a name="l68"></a> framebuffer_u64_size = </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width * </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.height / </span><span class=cFE>2</span><span class=cF0>;
<a name="l69"></a> framebuffer_u64_offset = </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width / </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l70"></a>
<a name="l71"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; framebuffer_u64_size; i++)
<a name="l72"></a> framebuffer_u64[i] = framebuffer_u64[i + framebuffer_u64_offset];
<a name="l73"></a>
<a name="l74"></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="l75"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col -= </span><span class=cFB>text</span><span class=cF0>.cols;
<a name="l76"></a> row = </span><span class=cFB>text</span><span class=cF0>.rows - </span><span class=cFE>1</span><span class=cF0>;
<a name="l77"></a> }
<a name="l78"></a> x = col * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l79"></a> y = row * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l80"></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="l81"></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="l82"></a>
<a name="l83"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l84"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l85"></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="l86"></a> {
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (ch_bitmap &amp; </span><span class=cFE>1</span><span class=cF0>)
<a name="l88"></a> *framebuffer++ = </span><span class=cF3>WHITE32</span><span class=cF0>;
<a name="l89"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l90"></a> *framebuffer++ = </span><span class=cF3>BLACK32</span><span class=cF0>;
<a name="l91"></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="l92"></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="l93"></a> ch_bitmap &gt;&gt;= </span><span class=cFE>1</span><span class=cF0>;
<a name="l94"></a> }
<a name="l95"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l96"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col++;
<a name="l97"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l98"></a>}
<a name="l99"></a>
<a name="l100"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>LFBFlush</span><span class=cF0>()
<a name="l101"></a>{</span><span class=cF2>//Flush winmgr screen cache, so updates whole screen.</span><span class=cF0>
<a name="l102"></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="l103"></a>}
<a name="l104"></a>
<a name="l105"></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="l106"></a>{</span><span class=cF2>//Those things calculated from other variables.</span><span class=cF0>
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l108"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l109"></a> </span><span class=cF2>//Assert: This is called with TASKf_TASK_LOCK set</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l112"></a> task-&gt;win_width = task-&gt;win_right - task-&gt;win_left + </span><span class=cFE>1</span><span class=cF0>;
<a name="l113"></a> task-&gt;win_height = task-&gt;win_bottom - task-&gt;win_top + </span><span class=cFE>1</span><span class=cF0>;
<a name="l114"></a>
<a name="l115"></a> task-&gt;pix_left = </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * task-&gt;win_left;
<a name="l116"></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="l117"></a>
<a name="l118"></a> task-&gt;pix_width = task-&gt;pix_right - task-&gt;pix_left + </span><span class=cFE>1</span><span class=cF0>;
<a name="l119"></a>
<a name="l120"></a> task-&gt;pix_top = </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * task-&gt;win_top;
<a name="l121"></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="l122"></a>
<a name="l123"></a> task-&gt;pix_height = task-&gt;pix_bottom - task-&gt;pix_top + </span><span class=cFE>1</span><span class=cF0>;
<a name="l124"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l125"></a>}
<a name="l126"></a>
<a name="l127"></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="l128"></a>{</span><span class=cF2>//Is pixel (x,y) inside task's win? Border to FONT_WIDTH.</span><span class=cF0>
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l130"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l131"></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="l132"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></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="l134"></a> border = </span><span class=cFE>0</span><span class=cF0>;
<a name="l135"></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="l136"></a> task-&gt;pix_top - border &lt;= y &lt;= task-&gt;pix_bottom + border)
<a name="l137"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l138"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l139"></a>
<a name="l140"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l141"></a>}
</span></pre></body>
</html>