templeos-info/public/Wb/Home/Src/Kernel/Display.HC.HTML

153 lines
17 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<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="/Wb/Adam/Gr/GrScrn.HC.HTML#l255"><span class=cF4>GrUpdateTextFG</span></a><span class=cF2> for</span><span class=cF0>
<a name="l5"></a></span><span class=cF2>the normal scrn text output routine.</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a></span><span class=cF2>See also </span><a href="/Wb/Adam/Gr/GrScrn.HC.HTML#l398"><span class=cF4>GrUpdateScrn</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;
<a name="l10"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr,*ptr1,*ptr2;
<a name="l11"></a>
<a name="l12"></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>RWF_SHOW_DOLLAR</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'$'</span><span class=cF0>) {
<a name="l14"></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>RWF_IN_DOLLAR</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l15"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags&amp;=~</span><span class=cF3>RWF_IN_DOLLAR</span><span class=cF0>;
<a name="l16"></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>RWF_LAST_DOLLAR</span><span class=cF7>)</span><span class=cF0>) {
<a name="l17"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags&amp;=~</span><span class=cF3>RWF_LAST_DOLLAR</span><span class=cF0>;
<a name="l18"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l19"></a> }
<a name="l20"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l21"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags|=</span><span class=cF3>RWF_IN_DOLLAR</span><span class=cF0>|</span><span class=cF3>RWF_LAST_DOLLAR</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l24"></a> }
<a name="l25"></a> </span><span class=cFB>text</span><span class=cF0>.raw_flags&amp;=~</span><span class=cF3>RWF_LAST_DOLLAR</span><span class=cF0>;
<a name="l26"></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>RWF_IN_DOLLAR</span><span class=cF0>)
<a name="l27"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l28"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'\t'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l30"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l31"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>text</span><span class=cF0>.raw_col &amp; 7)
<a name="l32"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l33"></a> </span><span class=cF7>}</span><span class=cF0> </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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l34"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col--;
<a name="l35"></a> </span><span class=cF5>RawPutChar</span><span class=cF0>(</span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l36"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col--;
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0> </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>) </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 % </span><span class=cFB>text</span><span class=cF0>.cols)
<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>
<a name="l42"></a> </span><span class=cF7>}</span><span class=cF0> </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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l43"></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="l44"></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="l45"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>,</span><span class=cF3>RLf_VGA</span><span class=cF7>)</span><span class=cF0>) { </span><span class=cF2>//if text mode</span><span class=cF0>
<a name="l46"></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>RWF_SCROLL</span><span class=cF0> &amp;&amp; </span><span class=cFB>text</span><span class=cF0>.raw_col &amp;&amp; !row &amp;&amp; !col) </span><span class=cF7>{</span><span class=cF0>
<a name="l47"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.vga_text_alias,</span><span class=cFB>text</span><span class=cF0>.vga_text_alias+</span><span class=cFB>text</span><span class=cF0>.cols*2,
<a name="l48"></a> </span><span class=cFB>text</span><span class=cF0>.cols*</span><span class=cF7>(</span><span class=cFB>text</span><span class=cF0>.rows-1</span><span class=cF7>)</span><span class=cF0>*2);
<a name="l49"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.vga_text_alias+</span><span class=cFB>text</span><span class=cF0>.cols*</span><span class=cF7>(</span><span class=cFB>text</span><span class=cF0>.rows-1</span><span class=cF7>)</span><span class=cF0>*2,0,</span><span class=cFB>text</span><span class=cF0>.cols*2);
<a name="l50"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col-=</span><span class=cFB>text</span><span class=cF0>.cols;
<a name="l51"></a> row=</span><span class=cFB>text</span><span class=cF0>.rows-1;
<a name="l52"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l53"></a> ptr=</span><span class=cFB>text</span><span class=cF0>.vga_text_alias+(row*</span><span class=cFB>text</span><span class=cF0>.cols+col)*2;
<a name="l54"></a> ptr[0]=ch;
<a name="l55"></a> ptr[1]=</span><span class=cF3>BLACK</span><span class=cF0>&lt;&lt;4+</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l56"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l57"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_IDX</span><span class=cF0>,</span><span class=cF3>VGAR_MAP_MASK</span><span class=cF0>);
<a name="l58"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_DATA</span><span class=cF0>,0x0F); </span><span class=cF2>//All planes -- WHITE</span><span class=cF0>
<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>RWF_SCROLL</span><span class=cF0> &amp;&amp; </span><span class=cFB>text</span><span class=cF0>.raw_col &amp;&amp; !row &amp;&amp; !col) </span><span class=cF7>{</span><span class=cF0>
<a name="l60"></a></span><span class=cF2>//Scroll cached image</span><span class=cF0>
<a name="l61"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.raw_scrn_image,
<a name="l62"></a> </span><span class=cFB>text</span><span class=cF0>.raw_scrn_image+</span><span class=cF3>GR_WIDTH</span><span class=cF0>*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>&gt;&gt;3,
<a name="l63"></a> </span><span class=cF3>GR_WIDTH</span><span class=cF0>*</span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3);
<a name="l64"></a> </span><span class=cF5>MemSet</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.raw_scrn_image+</span><span class=cF3>GR_WIDTH</span><span class=cF0>*</span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>&gt;&gt;3,0,
<a name="l65"></a> </span><span class=cF3>GR_WIDTH</span><span class=cF0>*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>&gt;&gt;3);
<a name="l66"></a>
<a name="l67"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.vga_alias,</span><span class=cFB>text</span><span class=cF0>.raw_scrn_image,</span><span class=cF3>GR_WIDTH</span><span class=cF0>*</span><span class=cF3>GR_HEIGHT</span><span class=cF0>&gt;&gt;3);
<a name="l68"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col-=</span><span class=cFB>text</span><span class=cF0>.cols;
<a name="l69"></a> row=</span><span class=cFB>text</span><span class=cF0>.rows-1;
<a name="l70"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l72"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l73"></a> ptr=ptr1=col+row*</span><span class=cF3>GR_WIDTH</span><span class=cF0>*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>&gt;&gt;3;
<a name="l74"></a> ptr+=</span><span class=cFB>text</span><span class=cF0>.vga_alias;
<a name="l75"></a> ptr1+=</span><span class=cFB>text</span><span class=cF0>.raw_scrn_image; </span><span class=cF2>//Write to cached image as well</span><span class=cF0>
<a name="l76"></a> ptr2=&amp;</span><span class=cFB>text</span><span class=cF0>.font[ch&amp;255];
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l78"></a> *ptr=*ptr1=</span><span class=cFB>rev_bits_table</span><span class=cF0>[*ptr2++];
<a name="l79"></a> ptr+=</span><span class=cF3>GR_WIDTH</span><span class=cF0>&gt;&gt;3;
<a name="l80"></a> ptr1+=</span><span class=cF3>GR_WIDTH</span><span class=cF0>&gt;&gt;3;
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l82"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l83"></a> }
<a name="l84"></a> </span><span class=cFB>text</span><span class=cF0>.raw_col++;
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l86"></a>}
<a name="l87"></a>
<a name="l88"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>VGAFlush</span><span class=cF0>()
<a name="l89"></a>{</span><span class=cF2>//Flush winmgr vga cache, so updates whole scrn.</span><span class=cF0>
<a name="l90"></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_VGA_IMAGE</span><span class=cF0>],0);
<a name="l91"></a>}
<a name="l92"></a>
<a name="l93"></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="l94"></a>{</span><span class=cF2>//Those things calculated from other variables.</span><span class=cF0>
<a name="l95"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l96"></a> </span><span class=cF2>//Assert: This is called with TASKf_TASK_LOCK set</span><span class=cF0>
<a name="l97"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l98"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l99"></a> task-&gt;win_width =task-&gt;win_right-task-&gt;win_left+1;
<a name="l100"></a> task-&gt;win_height=task-&gt;win_bottom-task-&gt;win_top+1;
<a name="l101"></a> task-&gt;pix_left =</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*task-&gt;win_left;
<a name="l102"></a> task-&gt;pix_right =</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*(task-&gt;win_right+1)-1;
<a name="l103"></a> task-&gt;pix_width =task-&gt;pix_right-task-&gt;pix_left+1;
<a name="l104"></a> task-&gt;pix_top =</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>*task-&gt;win_top;
<a name="l105"></a> task-&gt;pix_bottom =</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>*(task-&gt;win_bottom+1)-1;
<a name="l106"></a> task-&gt;pix_height =task-&gt;pix_bottom-task-&gt;pix_top+1;
<a name="l107"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l108"></a>}
<a name="l109"></a>
<a name="l110"></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=0)
<a name="l111"></a>{</span><span class=cF2>//Is pixel (x,y) inside task's win? Border to FONT_WIDTH.</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
<a name="l113"></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>) </span><span class=cF7>{</span><span class=cF0>
<a name="l114"></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="l115"></a> border=0;
<a name="l116"></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="l117"></a> task-&gt;pix_top-border&lt;=y&lt;=task-&gt;pix_bottom+border)
<a name="l118"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l119"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l120"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l121"></a>}
</span></pre></body>
</html>