125 lines
13 KiB
Plaintext
125 lines
13 KiB
Plaintext
|
<!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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Graphics/Color"</span><span class=cF0>
|
||
|
<a name="l2"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> </span><span class=cFB>gr_rainbow_10</span><span class=cF0>[10]={
|
||
|
<a name="l3"></a> </span><span class=cF3>BLACK</span><span class=cF0>,</span><span class=cF3>BROWN</span><span class=cF0>,</span><span class=cF3>RED</span><span class=cF0>,</span><span class=cF3>LTRED</span><span class=cF0>,</span><span class=cF3>YELLOW</span><span class=cF0>,</span><span class=cF3>GREEN</span><span class=cF0>,</span><span class=cF3>BLUE</span><span class=cF0>,</span><span class=cF3>PURPLE</span><span class=cF0>,</span><span class=cF3>LTGRAY</span><span class=cF0>,</span><span class=cF3>WHITE</span><span class=cF0>};
|
||
|
<a name="l4"></a>
|
||
|
<a name="l5"></a></span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>"ST_RAINBOW_10"</span><span class=cF0>,
|
||
|
<a name="l6"></a> </span><span class=cF6>"BLACK\0BROWN\0RED\0LTRED\0YELLOW\0GREEN\0BLUE\0PURPLE\0LTGRAY\0WHITE\0"</span><span class=cF0>);
|
||
|
<a name="l7"></a>
|
||
|
<a name="l8"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrPaletteIndicesSet</span><span class=cF0>()
|
||
|
<a name="l9"></a>{</span><span class=cF2>//There is a level of indirection that we identity map.</span><span class=cF0>
|
||
|
<a name="l10"></a></span><span class=cF2>// Set 16-colors to use first 16 DAC BGR entries, so we</span><span class=cF0>
|
||
|
<a name="l11"></a></span><span class=cF2>// never need to worry about indexes, just DAC palette settings.</span><span class=cF0>
|
||
|
<a name="l12"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||
|
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</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=cF1>return</span><span class=cF0>;
|
||
|
<a name="l14"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l15"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l16"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_VGA</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l17"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l18"></a> </span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>VGAP_INPUT_STAT</span><span class=cF0>); </span><span class=cF2>//Rsts attr index/data</span><span class=cF0>
|
||
|
<a name="l19"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cF3>COLORS_NUM</span><span class=cF0>;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l20"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_ATTR_INDEX</span><span class=cF0>,i);
|
||
|
<a name="l21"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_ATTR_DATA_WRITE</span><span class=cF0>,i);
|
||
|
<a name="l22"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l23"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_ATTR_INDEX</span><span class=cF0>,0x20);
|
||
|
<a name="l24"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_ATTR_DATA_WRITE</span><span class=cF0>,0); </span><span class=cF2>//Dummy write</span><span class=cF0>
|
||
|
<a name="l25"></a> </span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>VGAP_INPUT_STAT</span><span class=cF0>); </span><span class=cF2>//Rsts attr index/data</span><span class=cF0>
|
||
|
<a name="l26"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_VGA</span><span class=cF0>],0);
|
||
|
<a name="l27"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l28"></a>}
|
||
|
<a name="l29"></a>
|
||
|
<a name="l30"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrPaletteColorSet</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> color_num,</span><span class=cF9>CBGR48</span><span class=cF0> bgr48)
|
||
|
<a name="l31"></a>{</span><span class=cF2>//VGA has 6-bits for blue, for green, and for red.</span><span class=cF0>
|
||
|
<a name="l32"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</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=cF1>return</span><span class=cF0>;
|
||
|
<a name="l33"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l34"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l35"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_VGA</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l36"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l37"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_MASK</span><span class=cF0>,0xFF);
|
||
|
<a name="l38"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_REG_WRITE</span><span class=cF0>,color_num);
|
||
|
<a name="l39"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_DATA</span><span class=cF0>,bgr48.r>>10);
|
||
|
<a name="l40"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_DATA</span><span class=cF0>,bgr48.g>>10);
|
||
|
<a name="l41"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_DATA</span><span class=cF0>,bgr48.b>>10);
|
||
|
<a name="l42"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_VGA</span><span class=cF0>],0);
|
||
|
<a name="l43"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l44"></a>}
|
||
|
<a name="l45"></a>
|
||
|
<a name="l46"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CBGR48</span><span class=cF0> </span><span class=cF5>GrPaletteColorGet</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> color_num)
|
||
|
<a name="l47"></a>{</span><span class=cF2>//VGA has 6-bits for blue, for green, and for red.</span><span class=cF0>
|
||
|
<a name="l48"></a> </span><span class=cF9>CBGR48</span><span class=cF0> res=0;
|
||
|
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</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=cF1>return</span><span class=cF0> 0;
|
||
|
<a name="l50"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l51"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l52"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_VGA</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l53"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l54"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_MASK</span><span class=cF0>,0xFF);
|
||
|
<a name="l55"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>VGAP_REG_READ</span><span class=cF0>,color_num);
|
||
|
<a name="l56"></a> res.r=0xFFFF<<10*</span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_DATA</span><span class=cF0>)/0xFC00;
|
||
|
<a name="l57"></a> res.g=0xFFFF<<10*</span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_DATA</span><span class=cF0>)/0xFC00;
|
||
|
<a name="l58"></a> res.b=0xFFFF<<10*</span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>VGAP_PALETTE_DATA</span><span class=cF0>)/0xFC00;
|
||
|
<a name="l59"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_VGA</span><span class=cF0>],0);
|
||
|
<a name="l60"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l61"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l62"></a>}
|
||
|
<a name="l63"></a>
|
||
|
<a name="l64"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CBGR48</span><span class=cF0> </span><span class=cFB>gr_palette_std</span><span class=cF0>[</span><span class=cF3>COLORS_NUM</span><span class=cF0>]={
|
||
|
<a name="l65"></a>0x000000000000,0x00000000AAAA,0x0000AAAA0000,0x0000AAAAAAAA,
|
||
|
<a name="l66"></a>0xAAAA00000000,0xAAAA0000AAAA,0xAAAA55550000,0xAAAAAAAAAAAA,
|
||
|
<a name="l67"></a>0x555555555555,0x55555555FFFF,0x5555FFFF5555,0x5555FFFFFFFF,
|
||
|
<a name="l68"></a>0xFFFF55555555,0xFFFF5555FFFF,0xFFFFFFFF5555,0xFFFFFFFFFFFF};
|
||
|
<a name="l69"></a>
|
||
|
<a name="l70"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CBGR48</span><span class=cF0> </span><span class=cFB>gr_palette_gray</span><span class=cF0>[</span><span class=cF3>COLORS_NUM</span><span class=cF0>]={
|
||
|
<a name="l71"></a>0x000000000000,0x111111111111,0x222222222222,0x333333333333,
|
||
|
<a name="l72"></a>0x444444444444,0x555555555555,0x666666666666,0x777777777777,
|
||
|
<a name="l73"></a>0x888888888888,0x999999999999,0xAAAAAAAAAAAA,0xBBBBBBBBBBBB,
|
||
|
<a name="l74"></a>0xCCCCCCCCCCCC,0xDDDDDDDDDDDD,0xEEEEEEEEEEEE,0xFFFFFFFFFFFF};
|
||
|
<a name="l75"></a>
|
||
|
<a name="l76"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrPaletteGet</span><span class=cF0>(</span><span class=cF9>CBGR48</span><span class=cF0> *bgr48)
|
||
|
<a name="l77"></a>{</span><span class=cF2>//16 colors</span><span class=cF0>
|
||
|
<a name="l78"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||
|
<a name="l79"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cF3>COLORS_NUM</span><span class=cF0>;i++)
|
||
|
<a name="l80"></a> bgr48[i]=</span><span class=cF5>GrPaletteColorGet</span><span class=cF0>(i);
|
||
|
<a name="l81"></a>}
|
||
|
<a name="l82"></a>
|
||
|
<a name="l83"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrPaletteSet</span><span class=cF0>(</span><span class=cF9>CBGR48</span><span class=cF0> *bgr48)
|
||
|
<a name="l84"></a>{</span><span class=cF2>//16 colors</span><span class=cF0>
|
||
|
<a name="l85"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||
|
<a name="l86"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cF3>COLORS_NUM</span><span class=cF0>;i++)
|
||
|
<a name="l87"></a> </span><span class=cF5>GrPaletteColorSet</span><span class=cF0>(i,bgr48[i]);
|
||
|
<a name="l88"></a>}
|
||
|
<a name="l89"></a>
|
||
|
<a name="l90"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>PaletteSetStd</span><span class=cF0>()
|
||
|
<a name="l91"></a>{</span><span class=cF2>//Activate std palette.</span><span class=cF0>
|
||
|
<a name="l92"></a> </span><span class=cF5>GrPaletteSet</span><span class=cF0>(</span><span class=cFB>gr_palette_std</span><span class=cF0>);
|
||
|
<a name="l93"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|