199 lines
17 KiB
HTML
Executable File
199 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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Install;File/Cmd Line (Typically);Cmd Line (Typically)"</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>ROUND_DRV_TO</span><span class=cF0> (63*255)
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>DRV_HEADER</span><span class=cF0> 63
|
|
<a name="l5"></a>
|
|
<a name="l6"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CPlannedDrv</span><span class=cF0>
|
|
<a name="l7"></a>{
|
|
<a name="l8"></a> </span><span class=cF9>CPlannedDrv</span><span class=cF0> *next,*last;
|
|
<a name="l9"></a> </span><span class=cF9>I64</span><span class=cF0> size;
|
|
<a name="l10"></a> </span><span class=cF1>Bool</span><span class=cF0> pri;
|
|
<a name="l11"></a>};
|
|
<a name="l12"></a>
|
|
<a name="l13"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DskPrt</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=0,...)
|
|
<a name="l14"></a>{</span><span class=cF2>/*Partition the disk containing partition drv_let.</span><span class=cF0>
|
|
<a name="l15"></a>
|
|
<a name="l16"></a></span><span class=cF2>drv_let=0 means add new drive that is not already mounted.</span><span class=cF0>
|
|
<a name="l17"></a>
|
|
<a name="l18"></a></span><span class=cF2>>DskPrt('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk.</span><span class=cF0>
|
|
<a name="l19"></a>
|
|
<a name="l20"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l21"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd;
|
|
<a name="l22"></a> </span><span class=cF9>CPlannedDrv</span><span class=cF0> head,*tmppp;
|
|
<a name="l23"></a> </span><span class=cF9>CMasterBoot</span><span class=cF0> mbr;
|
|
<a name="l24"></a> </span><span class=cF1>Bool</span><span class=cF0> pri=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l25"></a> </span><span class=cF9>I64</span><span class=cF0> ext_base,drv_let2,pri_cnt=0,i,start_offset,</span><span class=cF1>offset</span><span class=cF0>,
|
|
<a name="l26"></a> total,remaining,cur_arg=0;
|
|
<a name="l27"></a> </span><span class=cF6>"This command does not play well\n"</span><span class=cF0>
|
|
<a name="l28"></a> </span><span class=cF6>"with other operating systems.\n"</span><span class=cF0>
|
|
<a name="l29"></a> </span><span class=cF6>"You really should use another\n"</span><span class=cF0>
|
|
<a name="l30"></a> </span><span class=cF6>"operating system's partitioner.\n"</span><span class=cF0>
|
|
<a name="l31"></a> </span><span class=cF6>"If you use this, it may, in fact,\n"</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF6>"make your hard drive impossible\n"</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF6>"to repartition with other operating\n"</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF6>"until you set block zero to zero\n"</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cF6>"with $LK,\"BootMHDZero\",\"MN:BootMHDZero\"$()\n\n\n"</span><span class=cF0>
|
|
<a name="l36"></a> </span><span class=cF6>"Continue"</span><span class=cF0>;
|
|
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (argc<=cur_arg && !</span><span class=cF5>YorN</span><span class=cF0>)
|
|
<a name="l38"></a> </span><span class=cF1>return</span><span class=cF0> 0;
|
|
<a name="l39"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l40"></a>
|
|
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (drv_let && !</span><span class=cF5>Let2BlkDev</span><span class=cF7>(</span><span class=cF0>drv_let,</span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l42"></a> drv_let=0;
|
|
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (!drv_let && !</span><span class=cF7>(</span><span class=cF0>drv_let=</span><span class=cF5>Mount</span><span class=cF0>(</span><span class=cF3>TRUE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l44"></a> !</span><span class=cF7>(</span><span class=cF0>bd=</span><span class=cF5>Let2BlkDev</span><span class=cF0>(drv_let,</span><span class=cF3>FALSE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> || bd->type!=</span><span class=cF3>BDT_ATA</span><span class=cF0>)
|
|
<a name="l45"></a> </span><span class=cF1>return</span><span class=cF0> 0;
|
|
<a name="l46"></a>
|
|
<a name="l47"></a> total=bd->max_blk+1;
|
|
<a name="l48"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&head);
|
|
<a name="l49"></a> drv_let2=bd->first_drv_let;
|
|
<a name="l50"></a> remaining=</span><span class=cF5>FloorU64</span><span class=cF0>(bd->max_blk+1,</span><span class=cF3>ROUND_DRV_TO</span><span class=cF0>);
|
|
<a name="l51"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>FloorU64</span><span class=cF7>(</span><span class=cF0>remaining,</span><span class=cF3>ROUND_DRV_TO</span><span class=cF7>)</span><span class=cF0>>=</span><span class=cF3>ROUND_DRV_TO</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l52"></a> tmppp=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CPlannedDrv</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l53"></a> </span><span class=cF1>do</span><span class=cF0> {
|
|
<a name="l54"></a> </span><span class=cF6>"$RED$Partition %C$FG$\n"</span><span class=cF0>,drv_let2;
|
|
<a name="l55"></a> tmppp->pri=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (pri) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l57"></a> </span><span class=cF6>"Primary Partition"</span><span class=cF0>;
|
|
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (argc>cur_arg || </span><span class=cF5>YorN</span><span class=cF0>) {
|
|
<a name="l59"></a> pri_cnt++;
|
|
<a name="l60"></a> tmppp->pri=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (pri_cnt==3)
|
|
<a name="l62"></a> pri=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l63"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l64"></a> pri=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l66"></a> </span><span class=cF6>"\nBlocks Remaining:%d (0x%X)\n"</span><span class=cF0>,
|
|
<a name="l67"></a> remaining-</span><span class=cF3>DRV_HEADER</span><span class=cF0>,remaining-</span><span class=cF3>DRV_HEADER</span><span class=cF0>;
|
|
<a name="l68"></a> </span><span class=cF1>if</span><span class=cF0> (argc>cur_arg)
|
|
<a name="l69"></a> tmppp->size=</span><span class=cF5>MinI64</span><span class=cF0>(</span><span class=cF5>CeilU64</span><span class=cF7>(</span><span class=cF5>MaxI64</span><span class=cF0>(remaining,</span><span class=cF3>DRV_HEADER</span><span class=cF0>),</span><span class=cF3>ROUND_DRV_TO</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l70"></a> </span><span class=cF5>CeilU64</span><span class=cF7>(</span><span class=cF0>argv[cur_arg++](</span><span class=cF1>F64</span><span class=cF0>)*total,</span><span class=cF3>ROUND_DRV_TO</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l71"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l72"></a> tmppp->size=</span><span class=cF5>CeilU64</span><span class=cF0>(</span><span class=cF5>GetI64</span><span class=cF7>(</span><span class=cF6>"Size in Blocks :"</span><span class=cF0>,
|
|
<a name="l73"></a> remaining-</span><span class=cF3>DRV_HEADER</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF3>DRV_HEADER</span><span class=cF0>,</span><span class=cF3>ROUND_DRV_TO</span><span class=cF0>);
|
|
<a name="l74"></a> } </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF3>ROUND_DRV_TO</span><span class=cF0><=tmppp->size<=</span><span class=cF5>FloorU64</span><span class=cF0>(remaining,</span><span class=cF3>ROUND_DRV_TO</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l75"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmppp,head.last);
|
|
<a name="l76"></a> remaining-=tmppp->size;
|
|
<a name="l77"></a> drv_let2++;
|
|
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l79"></a>
|
|
<a name="l80"></a> </span><span class=cF6>"\n\n!!! Repartition Drive !!!\n\n"</span><span class=cF0>;
|
|
<a name="l81"></a> tmppp=head.next;
|
|
<a name="l82"></a> drv_let2=bd->first_drv_let;
|
|
<a name="l83"></a> </span><span class=cF1>while</span><span class=cF0> (tmppp!=&head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l84"></a> </span><span class=cF6>"Drive %C:%08X "</span><span class=cF0>,drv_let2,tmppp->size;
|
|
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (tmppp->pri)
|
|
<a name="l86"></a> </span><span class=cF6>"Primary\n"</span><span class=cF0>;
|
|
<a name="l87"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l88"></a> </span><span class=cF6>"Logical\n"</span><span class=cF0>;
|
|
<a name="l89"></a> tmppp=tmppp->next;
|
|
<a name="l90"></a> drv_let2++;
|
|
<a name="l91"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (!argc && !</span><span class=cF5>AreYouSure</span><span class=cF0>)
|
|
<a name="l93"></a> </span><span class=cF1>goto</span><span class=cF0> pd_done;
|
|
<a name="l94"></a>
|
|
<a name="l95"></a> remaining=</span><span class=cF5>FloorU64</span><span class=cF0>(bd->max_blk+1,</span><span class=cF3>ROUND_DRV_TO</span><span class=cF0>)-</span><span class=cF3>ROUND_DRV_TO</span><span class=cF0>;
|
|
<a name="l96"></a> tmppp=head.next;
|
|
<a name="l97"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&mbr,0,</span><span class=cF3>BLK_SIZE</span><span class=cF0>);
|
|
<a name="l98"></a> mbr.signature=0xAA55;
|
|
<a name="l99"></a> </span><span class=cF1>offset</span><span class=cF0>=0;
|
|
<a name="l100"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<pri_cnt;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l101"></a> mbr.p[i].active=0x80;
|
|
<a name="l102"></a> mbr.p[i].start_head=0;
|
|
<a name="l103"></a> mbr.p[i].start_cyl=0x101;
|
|
<a name="l104"></a> mbr.p[i].type=1; </span><span class=cF2>//Will get set different.</span><span class=cF0>
|
|
<a name="l105"></a> mbr.p[i].end_head=0xFE;
|
|
<a name="l106"></a> mbr.p[i].end_cyl=0xFFFF;
|
|
<a name="l107"></a> mbr.p[i].</span><span class=cF1>offset</span><span class=cF0>=</span><span class=cF3>DRV_HEADER</span><span class=cF0>+</span><span class=cF1>offset</span><span class=cF0>;
|
|
<a name="l108"></a> mbr.p[i].size=tmppp->size-</span><span class=cF3>DRV_HEADER</span><span class=cF0>;
|
|
<a name="l109"></a> </span><span class=cF1>offset</span><span class=cF0>+=tmppp->size;
|
|
<a name="l110"></a> remaining-=tmppp->size;
|
|
<a name="l111"></a> tmppp=tmppp->next;
|
|
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l113"></a> </span><span class=cF1>if</span><span class=cF0> (!i) i++;
|
|
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (tmppp!=&head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l115"></a> mbr.p[i].active=0x80;
|
|
<a name="l116"></a> mbr.p[i].start_head=0;
|
|
<a name="l117"></a> mbr.p[i].start_cyl=0x101;
|
|
<a name="l118"></a> mbr.p[i].type=0xF;
|
|
<a name="l119"></a> mbr.p[i].end_head=0xFE;
|
|
<a name="l120"></a> mbr.p[i].end_cyl=0xFFFF;
|
|
<a name="l121"></a> mbr.p[i].</span><span class=cF1>offset</span><span class=cF0>=</span><span class=cF1>offset</span><span class=cF0>;
|
|
<a name="l122"></a> mbr.p[i].size=remaining;
|
|
<a name="l123"></a> ext_base=</span><span class=cF1>offset</span><span class=cF0>;
|
|
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l125"></a> </span><span class=cF5>ATAWriteBlks</span><span class=cF0>(bd,&mbr,0,1);
|
|
<a name="l126"></a>
|
|
<a name="l127"></a> </span><span class=cF1>while</span><span class=cF0> (tmppp!=&head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l128"></a> start_offset=</span><span class=cF1>offset</span><span class=cF0>;
|
|
<a name="l129"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&mbr,0,</span><span class=cF3>BLK_SIZE</span><span class=cF0>);
|
|
<a name="l130"></a> mbr.signature=0xAA55;
|
|
<a name="l131"></a>
|
|
<a name="l132"></a> mbr.p[0].active=0x80;
|
|
<a name="l133"></a> mbr.p[0].start_head=1;
|
|
<a name="l134"></a> mbr.p[0].start_cyl=0x101;
|
|
<a name="l135"></a> mbr.p[0].type=1; </span><span class=cF2>//Will get set different.</span><span class=cF0>
|
|
<a name="l136"></a> mbr.p[0].end_head=0xFE;
|
|
<a name="l137"></a> mbr.p[0].end_cyl=0xFFFF;
|
|
<a name="l138"></a> mbr.p[0].</span><span class=cF1>offset</span><span class=cF0>=</span><span class=cF3>DRV_HEADER</span><span class=cF0>;
|
|
<a name="l139"></a> mbr.p[0].size=tmppp->size-</span><span class=cF3>DRV_HEADER</span><span class=cF0>;
|
|
<a name="l140"></a> </span><span class=cF1>offset</span><span class=cF0>+=tmppp->size;
|
|
<a name="l141"></a> tmppp=tmppp->next;
|
|
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (tmppp!=&head) {
|
|
<a name="l143"></a> mbr.p[1].active=0x80;
|
|
<a name="l144"></a> mbr.p[1].start_head=0;
|
|
<a name="l145"></a> mbr.p[1].start_cyl=0x101;
|
|
<a name="l146"></a> mbr.p[1].type=5;
|
|
<a name="l147"></a> mbr.p[1].end_head=0xFE;
|
|
<a name="l148"></a> mbr.p[1].end_cyl=0xFFFF;
|
|
<a name="l149"></a> mbr.p[1].</span><span class=cF1>offset</span><span class=cF0>=</span><span class=cF1>offset</span><span class=cF0>-ext_base;
|
|
<a name="l150"></a> mbr.p[1].size=tmppp->size;
|
|
<a name="l151"></a> }
|
|
<a name="l152"></a> </span><span class=cF5>ATAWriteBlks</span><span class=cF0>(bd,&mbr,start_offset,1);
|
|
<a name="l153"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l154"></a>
|
|
<a name="l155"></a> bd->flags&=~(</span><span class=cF3>BDF_INITIALIZED</span><span class=cF0> | </span><span class=cF3>BDF_INIT_IN_PROGRESS</span><span class=cF0>);
|
|
<a name="l156"></a> </span><span class=cF5>BlkDevAdd</span><span class=cF0>(bd,,</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l157"></a> </span><span class=cF1>for</span><span class=cF0> (i=bd->first_drv_let;i<drv_let2;i++)
|
|
<a name="l158"></a> </span><span class=cF5>Fmt</span><span class=cF0>(i,,</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l159"></a>
|
|
<a name="l160"></a> pd_done:
|
|
<a name="l161"></a> </span><span class=cF1>while</span><span class=cF0> (head.next!=&head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l162"></a> tmppp=head.next;
|
|
<a name="l163"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmppp);
|
|
<a name="l164"></a> </span><span class=cF5>Free</span><span class=cF0>(tmppp);
|
|
<a name="l165"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l166"></a> </span><span class=cF1>return</span><span class=cF0> total;
|
|
<a name="l167"></a>}
|
|
</span></pre></body>
|
|
</html>
|