Update documentation, fix .gitignore.

This commit is contained in:
TomAwezome 2022-01-02 22:47:49 -05:00
parent ac3e0cee2d
commit 333690ba5f
17 changed files with 3819 additions and 2444 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
*.BIN*
*.MAP
Boot/
src/Boot/
docs/Boot/
ZealOS-*.iso

View file

@ -36,7 +36,7 @@ body {background-color:#1f1f1f;}
<a name="l9"></a> </span><span class=cF5>WinToTop</span><span class=cF0>;
<a name="l10"></a> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>;
<a name="l11"></a> </span><span class=cF5>Dir</span><span class=cF0>;
<a name="l12"></a> </span><span class=cF6>&quot;\n95,270 LOC, &quot;</span><span class=cF0>;
<a name="l12"></a> </span><span class=cF6>&quot;\n95,327 LOC, &quot;</span><span class=cF0>;
<a name="l13"></a> </span><span class=cF6>&quot;%d MB RAM, &quot;</span><span class=cF0>, </span><span class=cF5>MemBIOSTotal</span><span class=cF0> / </span><span class=cFE>1024</span><span class=cF0> / </span><span class=cFE>1024</span><span class=cF0>;
<a name="l14"></a> </span><span class=cF5>CPURep</span><span class=cF0>;
<a name="l15"></a> </span><span class=cF6>&quot;\n&quot;</span><span class=cF0>;

View file

@ -38,7 +38,7 @@ body {background-color:#1f1f1f;}
<a name="l11"></a>* Low line count and code complexity is the highest good, so it is easy to learn the whole thing. Users should see the light
<a name="l12"></a>at the end of the tunnel. One file system, for example, is better than many file systems.
<a name="l13"></a>
<a name="l14"></a>* There is a limit of 100,000 lines of code for all time, not including applications and demos. Currently, there are 95,270
<a name="l14"></a>* There is a limit of 100,000 lines of code for all time, not including applications and demos. Currently, there are 95,327
<a name="l15"></a>lines of code. </span><span class=cF4>3rd party libraries are banned</span><span class=cF0> because they circumvent the intent of this limit. The vision is a Commodore 64
<a name="l16"></a>ROM -- a fixed core API that is the only dependency of applications. Dependency on components and libraries creates a hell
<a name="l17"></a>that is no longer blissful.

View file

@ -54,7 +54,7 @@ body {background-color:#1f1f1f;}
<a name="l27"></a>
<a name="l28"></a></span><span class=cF5> Single System-wide Memory Map
<a name="l29"></a>
<a name="l30"></a></span><span class=cF2> 0x0000007C00- 0x00000371FF</span><span class=cF0>
<a name="l30"></a></span><span class=cF2> 0x0000007C00- 0x000003739F</span><span class=cF0>
<a name="l31"></a> Kernel module, placed here by the boot-loader, </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4477"><span class=cF4>BOOT_RAM_BASE</span></a><span class=cF0>.
<a name="l32"></a>
<a name="l33"></a></span><span class=cF2> 0x0000096600- 0x0000096FFF</span><span class=cF0>

View file

@ -37,7 +37,7 @@ body {background-color:#1f1f1f;}
<a name="l10"></a>
<a name="l11"></a>Simplicity is a goal to </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Strategy.DD.html#l1"><span class=cF4>keep the line count down</span></a><span class=cF0>, so it's easy to tinker with. As it turns-out, simplicity makes it faster in
<a name="l12"></a>some ways, too. It never switches privilege levels, never changes address maps, tends to load whole contiguous files and
<a name="l13"></a>other, similar things which boost speed. It's only 95,270 lines of code including the kernel, the 64-bit compiler, the
<a name="l13"></a>other, similar things which boost speed. It's only 95,327 lines of code including the kernel, the 64-bit compiler, the
<a name="l14"></a>graphics library and all the tools. More importantly, it's designed to keep the user's line count down -- you can do a </span><span class=cF4>
<a name="l15"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/HelloWorld.DD.html#l1"><span class=cF4>Hello World</span></a><span class=cF0> application in one line of code and can put graphics on the screen with a three line program!
<a name="l16"></a>

212
docs/System/Boot/BootDVD.ZC.html Executable file
View file

@ -0,0 +1,212 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF0>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_HIGH_LOC_DVD</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF3>BOOT_RAM_LIMIT</span><span class=cF0> - (</span><span class=cF3>BOOT_STACK_SIZE</span><span class=cF0> + </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>4</span><span class=cF0>)
<a name="l2"></a>
<a name="l3"></a></span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>&quot;DD_BOOT_HIGH_LOC_DVD&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%08X&quot;</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_DVD</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0>);
<a name="l4"></a></span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>&quot;DD_BOOT_HIGH_LOC_DVD_END&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%08X&quot;</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_LIMIT</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
<a name="l5"></a>
<a name="l6"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l7"></a></span><span class=cF1>USE16</span><span class=cF0>
<a name="l8"></a></span><span class=cFD>BDVD_START</span><span class=cF0>::
<a name="l9"></a></span><span class=cF2>//DL is supposed to have the BIOS drive number</span><span class=cF0>
<a name="l10"></a> </span><span class=cF1>CLD</span><span class=cF0>
<a name="l11"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_DVD</span><span class=cF0>
<a name="l12"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l13"></a>
<a name="l14"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l16"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SP</span><span class=cF0>, </span><span class=cF3>BOOT_STACK_SIZE</span><span class=cF0> + </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>
<a name="l17"></a> </span><span class=cF1>STI</span><span class=cF0>
<a name="l18"></a>
<a name="l19"></a> </span><span class=cF1>CALL</span><span class=cF0> BDVD_GET_RIP
<a name="l20"></a>BDVD_GET_RIP:
<a name="l21"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>
<a name="l22"></a> </span><span class=cF1>SUB</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, BDVD_GET_RIP - </span><span class=cFD>BDVD_START</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>SHR</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>
<a name="l24"></a></span><span class=cF2>//This copies this bootloader's code to 0x00096600</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>CS</span><span class=cF0>
<a name="l26"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>BX</span><span class=cF0>
<a name="l27"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l28"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>
<a name="l29"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, </span><span class=cFC>SI</span><span class=cF0>
<a name="l30"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>DI</span><span class=cF0>, </span><span class=cFC>DI</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>REP_MOVSB</span><span class=cF0>
<a name="l32"></a>
<a name="l33"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_DVD</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l35"></a>
<a name="l36"></a></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l37"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP BOOT_HIGH_LOC_DVD:BDVD_MAIN</span><span class=cF0>
<a name="l38"></a> </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFD>BDVD_MAIN</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_DVD</span><span class=cF0>;
<a name="l39"></a>
<a name="l40"></a>BDVD_BIOS_DRIVE_NUM: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l41"></a>BDVD_PAGE: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l42"></a>
<a name="l43"></a>BDVD_DAP: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>//One block at a time</span><span class=cF0>
<a name="l44"></a>BDVD_DAP_BUF: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l45"></a>BDVD_DAP_BLK: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l46"></a>
<a name="l47"></a>BDVD_ZEALOS_MESSAGE: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>&quot;Loading ZealOS&quot;</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l48"></a>
<a name="l49"></a>BDVD_NOT64_MESSAGE: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>&quot;ZealOS requires a 64-bit capable processor.\n\r&quot;</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l50"></a>
<a name="l51"></a></span><span class=cF2>//These get patched.</span><span class=cF0>
<a name="l52"></a></span><span class=cFD>BDVD_BLK_LO</span><span class=cF0>:: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l53"></a></span><span class=cFD>BDVD_BLK_HI</span><span class=cF0>:: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l54"></a></span><span class=cFD>BDVD_BLK_COUNT</span><span class=cF0>:: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l55"></a></span><span class=cFD>BDVD_SHIFT_BLKS</span><span class=cF0>:: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l56"></a></span><span class=cFD>BDVD_PROGRESS_STEP</span><span class=cF0>:: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l57"></a></span><span class=cFD>BDVD_PROGRESS_VAL</span><span class=cF0>:: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l58"></a>
<a name="l59"></a></span><span class=cFD>BDVD_PUT_CHAR</span><span class=cF0>::
<a name="l60"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0xE</span><span class=cF0>
<a name="l61"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cFE>7</span><span class=cF0> </span><span class=cF2>//Might be foreground color on some BIOS's</span><span class=cF0>
<a name="l62"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BH</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [BDVD_PAGE - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l63"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x10</span><span class=cF0>
<a name="l64"></a></span><span class=cFD>BDVD_RET</span><span class=cF0>::
<a name="l65"></a> </span><span class=cF1>RET</span><span class=cF0>
<a name="l66"></a></span><span class=cFD>BDVD_PUTS</span><span class=cF0>::
<a name="l67"></a>@@1: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l68"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l69"></a> </span><span class=cF1>JZ</span><span class=cF0> </span><span class=cFD>BDVD_RET</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BDVD_PUT_CHAR</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>JMP</span><span class=cF0> @@1
<a name="l72"></a>
<a name="l73"></a></span><span class=cFD>BDVD_MAIN</span><span class=cF0>::
<a name="l74"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> [BDVD_BIOS_DRIVE_NUM - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>DL</span><span class=cF0> </span><span class=cF2>//Passed in by BIOS</span><span class=cF0>
<a name="l75"></a>
<a name="l76"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0xF</span><span class=cF0>
<a name="l77"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x10</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> [BDVD_PAGE - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>BH</span><span class=cF0> </span><span class=cF2>//Video page</span><span class=cF0>
<a name="l79"></a>
<a name="l80"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cFE>0x80000000</span><span class=cF0>
<a name="l81"></a> </span><span class=cF1>CPUID</span><span class=cF0>
<a name="l82"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cFE>0x80000001</span><span class=cF0>
<a name="l83"></a> </span><span class=cF1>JB</span><span class=cF0> @@05
<a name="l84"></a>
<a name="l85"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cFE>0x80000001</span><span class=cF0>
<a name="l86"></a> </span><span class=cF1>CPUID</span><span class=cF0>
<a name="l87"></a> </span><span class=cF1>BT</span><span class=cF0> </span><span class=cFC>EDX</span><span class=cF0>, </span><span class=cFE>29</span><span class=cF0>
<a name="l88"></a> </span><span class=cF1>JC</span><span class=cF0> @@15
<a name="l89"></a>@@05: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, BDVD_NOT64_MESSAGE - </span><span class=cFD>BDVD_START</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BDVD_PUTS</span><span class=cF0>
<a name="l91"></a>@@10: </span><span class=cF1>JMP</span><span class=cF0> @@10
<a name="l92"></a>
<a name="l93"></a>@@15: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, BDVD_ZEALOS_MESSAGE - </span><span class=cFD>BDVD_START</span><span class=cF0>
<a name="l94"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BDVD_PUTS</span><span class=cF0>
<a name="l95"></a>
<a name="l96"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_BASE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l97"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l98"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>, </span><span class=cFC>ECX</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_BLK_COUNT</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l100"></a>
<a name="l101"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, (</span><span class=cFE>80</span><span class=cF0> - </span><span class=cFE>7</span><span class=cF0> - </span><span class=cFE>9</span><span class=cF0>) * </span><span class=cFE>65536</span><span class=cF0> </span><span class=cF2>//80 columns</span><span class=cF0>
<a name="l102"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>EDX</span><span class=cF0>, </span><span class=cFC>EDX</span><span class=cF0>
<a name="l103"></a> </span><span class=cF1>DIV</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>
<a name="l104"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>BDVD_PROGRESS_STEP</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>EAX</span><span class=cF0>
<a name="l105"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>BDVD_PROGRESS_VAL</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFE>0</span><span class=cF0>
<a name="l106"></a>
<a name="l107"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_BLK_LO</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l108"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_BLK_HI</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l109"></a>
<a name="l110"></a>@@20: </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0> </span><span class=cF2>//Block count</span><span class=cF0>
<a name="l111"></a>
<a name="l112"></a></span><span class=cF2>//READ BLOCK</span><span class=cF0>
<a name="l113"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//Block lo</span><span class=cF0>
<a name="l114"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>DX</span><span class=cF0> </span><span class=cF2>//Block hi</span><span class=cF0>
<a name="l115"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0> </span><span class=cF2>//Buf seg</span><span class=cF0>
<a name="l116"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BDVD_DAP_BLK - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>AX</span><span class=cF0>
<a name="l117"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BDVD_DAP_BLK + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>DX</span><span class=cF0>
<a name="l118"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>ES</span><span class=cF0>
<a name="l119"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BDVD_DAP_BUF + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//ES:0000</span><span class=cF0>
<a name="l120"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, BDVD_DAP - </span><span class=cFD>BDVD_START</span><span class=cF0> </span><span class=cF2>//DS:SI=DAP</span><span class=cF0>
<a name="l121"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0x42</span><span class=cF0>
<a name="l122"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [BDVD_BIOS_DRIVE_NUM - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l123"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x13</span><span class=cF0>
<a name="l124"></a>
<a name="l125"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//ES</span><span class=cF0>
<a name="l126"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l127"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l128"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>DX</span><span class=cF0>
<a name="l129"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l130"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>JNZ</span><span class=cF0> @@25
<a name="l132"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cFC>DX</span><span class=cF0>
<a name="l133"></a>
<a name="l134"></a>@@25: </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l135"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_PROGRESS_VAL</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l136"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>BDVD_PROGRESS_STEP</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l137"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>BDVD_PROGRESS_VAL</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>EAX</span><span class=cF0>
<a name="l138"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_PROGRESS_VAL</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>], </span><span class=cFC>BX</span><span class=cF0>
<a name="l139"></a> </span><span class=cF1>JE</span><span class=cF0> @@30
<a name="l140"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'.'</span><span class=cF0>
<a name="l141"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BDVD_PUT_CHAR</span><span class=cF0>
<a name="l142"></a>@@30: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l143"></a>
<a name="l144"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>
<a name="l145"></a> </span><span class=cF1>LOOP</span><span class=cF0> @@20
<a name="l146"></a>
<a name="l147"></a></span><span class=cF2>//Shift backward to align</span><span class=cF0>
<a name="l148"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>
<a name="l149"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_SHIFT_BLKS</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l150"></a> </span><span class=cF1>SHL</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF0>
<a name="l151"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_BLK_COUNT</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l152"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_BASE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l153"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l154"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>BX</span><span class=cF0>
<a name="l155"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l156"></a>@@35: </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>
<a name="l157"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, </span><span class=cFC>SI</span><span class=cF0>
<a name="l158"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>DI</span><span class=cF0>, </span><span class=cFC>DI</span><span class=cF0>
<a name="l159"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>
<a name="l160"></a> </span><span class=cF1>REP_MOVSD</span><span class=cF0>
<a name="l161"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>DS</span><span class=cF0>
<a name="l162"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l163"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l164"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>ES</span><span class=cF0>
<a name="l165"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l166"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l167"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>
<a name="l168"></a> </span><span class=cF1>LOOP</span><span class=cF0> @@35
<a name="l169"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>
<a name="l170"></a>
<a name="l171"></a></span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/BlkDev/DiskAHCI.ZC.html#l1131"><span class=cF4>AHCIBootDVDProbeAll</span></a><span class=cF2>().</span><span class=cF0>
<a name="l172"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>, </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>BDVD_BLK_LO</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l173"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BDVD_SHIFT_BLKS</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>]
<a name="l174"></a> </span><span class=cF1>SHL</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cFE>16</span><span class=cF0>
<a name="l175"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_SRC_DVD</span><span class=cF0> </span><span class=cF2>//</span><span class=cF9><u>See sys_boot_src</span><span class=cF0>
<a name="l176"></a>
<a name="l177"></a></u></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l178"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP BOOT_RAM_BASE:0000</span><span class=cF0>
<a name="l179"></a> </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_BASE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>;
<a name="l180"></a></span><span class=cF2>//Continues here </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KStart16.ZC.html#l1"><span class=cF4>::/Kernel/KStart16.ZC</span></a><span class=cF0>
<a name="l181"></a></span><span class=cFD>BDVD_END</span><span class=cF0>::
<a name="l182"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cFD>BDVD_END</span><span class=cF0>-</span><span class=cFD>BDVD_START</span><span class=cF0> &lt; </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>
<a name="l183"></a>}
</span></pre></body>
</html>

View file

@ -0,0 +1,64 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Install.DD.html#l1"><span class=cF4>Install Documentation</span></a><span class=cF2>.</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>//Study the account examples: </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSConfig.ZC.html#l1"><span class=cF4>Config Strs</span></a><span class=cF2>, </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSDistro.ZC.html#l1"><span class=cF4>Update Funs</span></a><span class=cF0>
<a name="l3"></a>
<a name="l4"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootDVD&quot;</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;DiskISORedSea&quot;</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Install&quot;</span><span class=cF0>
<a name="l8"></a>
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>KERNEL_BIN_C</span><span class=cF0> </span><span class=cF6>&quot;Kernel.BIN.C&quot;</span><span class=cF0>
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>&quot;/Boot&quot;</span><span class=cF0>
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR_DVD_KERNEL_BIN_C</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>&quot;/DVD&quot;</span><span class=cF0> </span><span class=cF3>KERNEL_BIN_C</span><span class=cF0>
<a name="l12"></a>
<a name="l13"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MakeAll</span><span class=cF0>()
<a name="l14"></a>{
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Comp</span><span class=cF7>(</span><span class=cF6>&quot;/Compiler/Compiler&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Compiler&quot;</span><span class=cF0>,, </span><span class=cF6>':'</span><span class=cF7>)</span><span class=cF0>)
<a name="l16"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Comp</span><span class=cF7>(</span><span class=cF6>&quot;/Kernel/Kernel&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Kernel&quot;</span><span class=cF0>,, </span><span class=cF6>':'</span><span class=cF7>)</span><span class=cF0>)
<a name="l18"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l19"></a>}
<a name="l20"></a>
<a name="l21"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootDVDIns</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=</span><span class=cFE>0</span><span class=cF0>)
<a name="l22"></a>{</span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Misc/DoDistro.ZC.html#l1"><span class=cF4>::/Misc/DoDistro.ZC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l24"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Drive</span><span class=cF7>(</span><span class=cF0>drv_let</span><span class=cF7>)</span><span class=cF0>)
<a name="l26"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l27"></a> </span><span class=cF5>MakeAll</span><span class=cF0>;
<a name="l28"></a> </span><span class=cF5>Move</span><span class=cF0>(</span><span class=cF6>&quot;/Kernel/Kernel.BIN&quot;</span><span class=cF0>, </span><span class=cF3>BOOT_DIR_DVD_KERNEL_BIN_C</span><span class=cF0>);
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l30"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l31"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l32"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l33"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l34"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l35"></a>}
</span></pre></body>
</html>

120
docs/System/Boot/BootHD.ZC.html Executable file
View file

@ -0,0 +1,120 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF0>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>MODULE_SIZE</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0> * </span><span class=cF3>BLK_SIZE</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_HIGH_LOC_HD</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF3>BOOT_RAM_LIMIT</span><span class=cF0> - (</span><span class=cF3>BOOT_STACK_SIZE</span><span class=cF0> + </span><span class=cF3>MODULE_SIZE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>4</span><span class=cF0>)
<a name="l3"></a>
<a name="l4"></a></span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>&quot;DD_BOOT_HIGH_LOC_HD&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%08X&quot;</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_HD</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0>);
<a name="l5"></a>
<a name="l6"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l7"></a></span><span class=cF1>USE16</span><span class=cF0>
<a name="l8"></a></span><span class=cFD>BHD_CODE</span><span class=cF0>::
<a name="l9"></a>
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BHD_START</span><span class=cF0> (</span><span class=cFD>BHD_CODE</span><span class=cF0> - </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code</span><span class=cF7>)</span><span class=cF0>)
<a name="l11"></a>
<a name="l12"></a> </span><span class=cF1>CLD</span><span class=cF0>
<a name="l13"></a>
<a name="l14"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_HD</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l16"></a>
<a name="l17"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l18"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SP</span><span class=cF0>, </span><span class=cF3>BOOT_STACK_SIZE</span><span class=cF0> + </span><span class=cF3>MODULE_SIZE</span><span class=cF0>
<a name="l20"></a> </span><span class=cF1>STI</span><span class=cF0>
<a name="l21"></a>
<a name="l22"></a> </span><span class=cF1>CALL</span><span class=cF0> BHD_GET_RIP
<a name="l23"></a>BHD_GET_RIP:
<a name="l24"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>SUB</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, BHD_GET_RIP - </span><span class=cF3>BHD_START</span><span class=cF0>
<a name="l26"></a> </span><span class=cF1>SHR</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>
<a name="l27"></a></span><span class=cF2>//This copies this bootloader's code to 0x00096C00</span><span class=cF0>
<a name="l28"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>CS</span><span class=cF0>
<a name="l29"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>BX</span><span class=cF0>
<a name="l30"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF3>MODULE_SIZE</span><span class=cF0>
<a name="l32"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, </span><span class=cFC>SI</span><span class=cF0>
<a name="l33"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>DI</span><span class=cF0>, </span><span class=cFC>DI</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>REP_MOVSB</span><span class=cF0>
<a name="l35"></a>
<a name="l36"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_HD</span><span class=cF0>
<a name="l37"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l38"></a>
<a name="l39"></a></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l40"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP BOOT_HIGH_LOC_HD:BHD_HISTART</span><span class=cF0>
<a name="l41"></a> </span><span class=cF1>DU16</span><span class=cF0> BHD_HISTART - </span><span class=cF3>BHD_START</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_HD</span><span class=cF0>;
<a name="l42"></a>
<a name="l43"></a>BHD_BIOS_DRIVE_NUM: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l44"></a>
<a name="l45"></a></span><span class=cF2>//Gets patched by </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.ZC.html#l25"><span class=cF4>BootHDIns</span></a><span class=cF2>().</span><span class=cF0>
<a name="l46"></a></span><span class=cFD>BHD_BLK_COUNT</span><span class=cF0>:: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l47"></a>
<a name="l48"></a>BHD_DAP: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>//One block at a time</span><span class=cF0>
<a name="l49"></a>BHD_DAP_BUF: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l50"></a></span><span class=cF2>//Gets patched by </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.ZC.html#l25"><span class=cF4>BootHDIns</span></a><span class=cF2>().</span><span class=cF0>
<a name="l51"></a></span><span class=cFD>BHD_DAP_BLK</span><span class=cF0>:: </span><span class=cF2>//64-bit</span><span class=cF0>
<a name="l52"></a>BHD_DAP_BLK_LO: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l53"></a>BHD_DAP_BLK_HI: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l54"></a>
<a name="l55"></a>BHD_HISTART:
<a name="l56"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> [BHD_BIOS_DRIVE_NUM - </span><span class=cF3>BHD_START</span><span class=cF0>], </span><span class=cFC>DL</span><span class=cF0> </span><span class=cF2>//Passed in by BIOS</span><span class=cF0>
<a name="l57"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_BASE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l58"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l59"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>, </span><span class=cFC>ECX</span><span class=cF0>
<a name="l60"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BHD_BLK_COUNT</span><span class=cF0> - </span><span class=cF3>BHD_START</span><span class=cF0>]
<a name="l61"></a>
<a name="l62"></a>@@05: </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0> </span><span class=cF2>//Block count</span><span class=cF0>
<a name="l63"></a>
<a name="l64"></a></span><span class=cF2>//READ BLOCK</span><span class=cF0>
<a name="l65"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0> </span><span class=cF2>//Buf seg</span><span class=cF0>
<a name="l66"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>ES</span><span class=cF0>
<a name="l67"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BHD_DAP_BUF + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cF3>BHD_START</span><span class=cF0>], </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//ES:0000</span><span class=cF0>
<a name="l68"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, BHD_DAP - </span><span class=cF3>BHD_START</span><span class=cF0> </span><span class=cF2>//DS:SI=DAP</span><span class=cF0>
<a name="l69"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0x42</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [BHD_BIOS_DRIVE_NUM - </span><span class=cF3>BHD_START</span><span class=cF0>]
<a name="l71"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x13</span><span class=cF0>
<a name="l72"></a>
<a name="l73"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//ES</span><span class=cF0>
<a name="l74"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BLK_SIZE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [BHD_DAP_BLK_LO - </span><span class=cF3>BHD_START</span><span class=cF0>]
<a name="l77"></a> </span><span class=cF1>JNZ</span><span class=cF0> @@10
<a name="l78"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [BHD_DAP_BLK_HI - </span><span class=cF3>BHD_START</span><span class=cF0>]
<a name="l79"></a>
<a name="l80"></a>@@10: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>
<a name="l81"></a> </span><span class=cF1>LOOP</span><span class=cF0> @@05
<a name="l82"></a>
<a name="l83"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>, </span><span class=cFC>EBX</span><span class=cF0>
<a name="l84"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cF3>BOOT_SRC_HARDDRIVE</span><span class=cF0> </span><span class=cF2>//</span><span class=cF9><u>See sys_boot_src</span><span class=cF0>
<a name="l85"></a></u></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l86"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP BOOT_RAM_BASE:0000</span><span class=cF0>
<a name="l87"></a> </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_BASE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>;
<a name="l88"></a></span><span class=cF2>//Continues here </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KStart16.ZC.html#l1"><span class=cF4>::/Kernel/KStart16.ZC</span></a><span class=cF0>
<a name="l89"></a></span><span class=cFD>BHD_END</span><span class=cF0>::
<a name="l90"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cFD>BHD_END</span><span class=cF0> - </span><span class=cF3>BHD_START</span><span class=cF0> &lt; </span><span class=cF3>MODULE_SIZE</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>
<a name="l91"></a>}
</span></pre></body>
</html>

View file

@ -0,0 +1,113 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Install.DD.html#l1"><span class=cF4>Install Documentation</span></a><span class=cF2>.</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>//Study the account examples: </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSConfig.ZC.html#l1"><span class=cF4>Config Strs</span></a><span class=cF2>, </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSDistro.ZC.html#l1"><span class=cF4>Update Funs</span></a><span class=cF0>
<a name="l3"></a>
<a name="l4"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootHD&quot;</span><span class=cF0>
<a name="l5"></a>
<a name="l6"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Install&quot;</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>KERNEL_BIN_C</span><span class=cF0> </span><span class=cF6>&quot;Kernel.BIN.C&quot;</span><span class=cF0>
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>&quot;/Boot&quot;</span><span class=cF0>
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR_KERNEL_BIN_C</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>&quot;/&quot;</span><span class=cF0> </span><span class=cF3>KERNEL_BIN_C</span><span class=cF0>
<a name="l11"></a>
<a name="l12"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CompComp</span><span class=cF0>()
<a name="l13"></a>{
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Comp</span><span class=cF7>(</span><span class=cF6>&quot;/Compiler/Compiler&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Compiler&quot;</span><span class=cF0>,, </span><span class=cF6>':'</span><span class=cF7>)</span><span class=cF0>)
<a name="l15"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l16"></a>}
<a name="l17"></a>
<a name="l18"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MakeAll</span><span class=cF0>()
<a name="l19"></a>{
<a name="l20"></a> </span><span class=cF5>CompComp</span><span class=cF0>;
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Comp</span><span class=cF7>(</span><span class=cF6>&quot;/Kernel/Kernel&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Kernel&quot;</span><span class=cF0>,, </span><span class=cF6>':'</span><span class=cF7>)</span><span class=cF0>)
<a name="l22"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l23"></a>}
<a name="l24"></a>
<a name="l25"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootHDIns</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=</span><span class=cFE>0</span><span class=cF0>)
<a name="l26"></a>{</span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.ZC.html#l18"><span class=cF4>MakeAll</span></a><span class=cF2> and install new boot-loader.</span><span class=cF0>
<a name="l27"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive;
<a name="l28"></a> </span><span class=cF9>CFAT32Boot</span><span class=cF0> br;
<a name="l29"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> de;
<a name="l30"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l31"></a>
<a name="l32"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l33"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Drive</span><span class=cF7>(</span><span class=cF0>drv_let</span><span class=cF7>)</span><span class=cF0>)
<a name="l35"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l36"></a>
<a name="l37"></a> drive = </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dv;
<a name="l38"></a> </span><span class=cF5>MakeAll</span><span class=cF0>;
<a name="l39"></a>
<a name="l40"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>Letter2BlkDevType</span><span class=cF7>(</span><span class=cF0>drive-&gt;drv_let</span><span class=cF7>)</span><span class=cF0>)
<a name="l41"></a> {
<a name="l42"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_RAM</span><span class=cF0>:
<a name="l43"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATA</span><span class=cF0>:
<a name="l44"></a> </span><span class=cF5>Move</span><span class=cF0>(</span><span class=cF6>&quot;/Kernel/Kernel.BIN&quot;</span><span class=cF0>, </span><span class=cF3>BOOT_DIR_KERNEL_BIN_C</span><span class=cF0>);
<a name="l45"></a>
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF3>BOOT_DIR_KERNEL_BIN_C</span><span class=cF0>, &amp;de, </span><span class=cF3>FUF_JUST_FILES</span><span class=cF7>)</span><span class=cF0>)
<a name="l47"></a> </span><span class=cF6>&quot;No Kernel.BIN.C\n&quot;</span><span class=cF0>;
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l50"></a> </span><span class=cF5>Free</span><span class=cF0>(de.full_name);
<a name="l51"></a> </span><span class=cF6>&quot;Modifying partition boot record.\n&quot;</span><span class=cF0>;
<a name="l52"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(drive, &amp;br, drive-&gt;drv_offset, </span><span class=cFE>1</span><span class=cF0>);
<a name="l53"></a>
<a name="l54"></a> br.jump_and_nop[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cF3>OC_JMP_REL8</span><span class=cF0>;
<a name="l55"></a> br.jump_and_nop[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code) - </span><span class=cFE>2</span><span class=cF0>;
<a name="l56"></a>
<a name="l57"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code) &gt;= </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CRedSeaBoot</span><span class=cF0>.code)
<a name="l58"></a>
<a name="l59"></a> br.jump_and_nop[</span><span class=cFE>2</span><span class=cF0>] = </span><span class=cF3>OC_NOP</span><span class=cF0>;
<a name="l60"></a> *</span><span class=cFD>BHD_BLK_COUNT</span><span class=cF0>(</span><span class=cF9>U16</span><span class=cF0> *) = (de.size + </span><span class=cF3>BLK_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) &gt;&gt; </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
<a name="l61"></a> *</span><span class=cFD>BHD_DAP_BLK</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *) = </span><span class=cF5>Clus2Blk</span><span class=cF0>(drive, de.clus);
<a name="l62"></a>
<a name="l63"></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=cFD>BHD_END</span><span class=cF0> - </span><span class=cFD>BHD_CODE</span><span class=cF0>; i++)
<a name="l64"></a> br.code[i] = </span><span class=cFD>BHD_CODE</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *)[i];
<a name="l65"></a>
<a name="l66"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code) &gt;= </span><span class=cFD>BHD_END</span><span class=cF0> - </span><span class=cFD>BHD_CODE</span><span class=cF0>
<a name="l67"></a>
<a name="l68"></a> </span><span class=cF1>for</span><span class=cF0> (; i &lt; </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code</span><span class=cF7>)</span><span class=cF0>; i++)
<a name="l69"></a> br.code[i] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l70"></a>
<a name="l71"></a> </span><span class=cF5>BlkWrite</span><span class=cF0>(drive, &amp;br, drive-&gt;drv_offset, </span><span class=cFE>1</span><span class=cF0>);
<a name="l72"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l73"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l74"></a>
<a name="l75"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l76"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l77"></a> }
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l79"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l80"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l81"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l82"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l83"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l84"></a>}
</span></pre></body>
</html>

134
docs/System/Boot/BootMHD.ZC.html Executable file
View file

@ -0,0 +1,134 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF0>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>MODULE_SIZE</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0> * </span><span class=cF3>BLK_SIZE</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_HIGH_LOC_MHD</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF3>BOOT_RAM_LIMIT</span><span class=cF0> - (</span><span class=cF3>BOOT_STACK_SIZE</span><span class=cF0> + </span><span class=cF3>MODULE_SIZE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>4</span><span class=cF0>)
<a name="l3"></a>
<a name="l4"></a></span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>&quot;DD_BOOT_HIGH_LOC_MHD&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%08X&quot;</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0>);
<a name="l5"></a>
<a name="l6"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l7"></a></span><span class=cF1>USE16</span><span class=cF0>
<a name="l8"></a></span><span class=cFD>BMHD_START</span><span class=cF0>::
<a name="l9"></a></span><span class=cFD>BMHD_CODE</span><span class=cF0>::
<a name="l10"></a> </span><span class=cF1>CLD</span><span class=cF0>
<a name="l11"></a>
<a name="l12"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD</span><span class=cF0>
<a name="l13"></a>
<a name="l14"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l16"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SP</span><span class=cF0>, </span><span class=cF3>BOOT_STACK_SIZE</span><span class=cF0> + </span><span class=cF3>MODULE_SIZE</span><span class=cF0>
<a name="l17"></a> </span><span class=cF1>STI</span><span class=cF0>
<a name="l18"></a>
<a name="l19"></a> </span><span class=cF1>PUSHF</span><span class=cF0>
<a name="l20"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>
<a name="l21"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>
<a name="l22"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>FS</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>GS</span><span class=cF0>
<a name="l24"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>
<a name="l26"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>EDX</span><span class=cF0>
<a name="l27"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>EBP</span><span class=cF0>
<a name="l28"></a>
<a name="l29"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l30"></a>
<a name="l31"></a> </span><span class=cF1>CALL</span><span class=cF0> BMHD_GET_RIP
<a name="l32"></a>BMHD_GET_RIP:
<a name="l33"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>SUB</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, BMHD_GET_RIP-</span><span class=cFD>BMHD_START</span><span class=cF0>
<a name="l35"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cFC>BX</span><span class=cF0>
<a name="l36"></a> </span><span class=cF1>SHR</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>
<a name="l37"></a></span><span class=cF2>//This copies this bootloader's code to 0x00096C00</span><span class=cF0>
<a name="l38"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>CS</span><span class=cF0>
<a name="l39"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l40"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>BX</span><span class=cF0>
<a name="l41"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l42"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BMHD_OLD_CS_RIP - </span><span class=cFD>BMHD_START</span><span class=cF0>], </span><span class=cFC>CX</span><span class=cF0>
<a name="l43"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BMHD_OLD_CS_RIP + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BMHD_START</span><span class=cF0>]
<a name="l44"></a>
<a name="l45"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF3>MODULE_SIZE</span><span class=cF0>
<a name="l46"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, </span><span class=cFC>SI</span><span class=cF0>
<a name="l47"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>DI</span><span class=cF0>, </span><span class=cFC>DI</span><span class=cF0>
<a name="l48"></a> </span><span class=cF1>REP_MOVSB</span><span class=cF0>
<a name="l49"></a>
<a name="l50"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD</span><span class=cF0>
<a name="l51"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l52"></a>
<a name="l53"></a></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l54"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP BOOT_HIGH_LOC_MHD:BMHD_HISTART</span><span class=cF0>
<a name="l55"></a> </span><span class=cF1>DU16</span><span class=cF0> BMHD_HISTART - </span><span class=cFD>BMHD_START</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD</span><span class=cF0>;
<a name="l56"></a>
<a name="l57"></a>BMHD_BIOS_DRIVE_NUM: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l58"></a>BMHD_OLD_CS_RIP: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l59"></a></span><span class=cF2>//Gets patched by </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.ZC.html#l25"><span class=cF4>BootHDIns</span></a><span class=cF2>().</span><span class=cF0>
<a name="l60"></a></span><span class=cFD>BMHD_BLK_COUNT</span><span class=cF0>:: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l61"></a>
<a name="l62"></a>BMHD_DAP: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>//One block at a time</span><span class=cF0>
<a name="l63"></a>BMHD_DAP_BUF: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l64"></a></span><span class=cF2>//Gets patched by </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.ZC.html#l25"><span class=cF4>BootHDIns</span></a><span class=cF2>().</span><span class=cF0>
<a name="l65"></a></span><span class=cFD>BMHD_DAP_BLK</span><span class=cF0>:: </span><span class=cF2>//64-bit</span><span class=cF0>
<a name="l66"></a>BMHD_DAP_BLK_LO: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l67"></a>BMHD_DAP_BLK_HI: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l68"></a>
<a name="l69"></a>BMHD_HISTART:
<a name="l70"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> [BMHD_BIOS_DRIVE_NUM - </span><span class=cFD>BMHD_START</span><span class=cF0>], </span><span class=cFC>DL</span><span class=cF0> </span><span class=cF2>//Passed in by BIOS</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_BASE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l72"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l73"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>, </span><span class=cFC>ECX</span><span class=cF0>
<a name="l74"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [</span><span class=cFD>BMHD_BLK_COUNT</span><span class=cF0> - </span><span class=cFD>BMHD_START</span><span class=cF0>]
<a name="l75"></a>
<a name="l76"></a>@@05: </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0> </span><span class=cF2>//Block count</span><span class=cF0>
<a name="l77"></a>
<a name="l78"></a></span><span class=cF2>//READ BLOCK</span><span class=cF0>
<a name="l79"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0> </span><span class=cF2>//Buf seg</span><span class=cF0>
<a name="l80"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>ES</span><span class=cF0>
<a name="l81"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BMHD_DAP_BUF + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BMHD_START</span><span class=cF0>], </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//ES:0000</span><span class=cF0>
<a name="l82"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, BMHD_DAP - </span><span class=cFD>BMHD_START</span><span class=cF0> </span><span class=cF2>//DS:SI=DAP</span><span class=cF0>
<a name="l83"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0x42</span><span class=cF0>
<a name="l84"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [BMHD_BIOS_DRIVE_NUM - </span><span class=cFD>BMHD_START</span><span class=cF0>]
<a name="l85"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x13</span><span class=cF0>
<a name="l86"></a>
<a name="l87"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//ES</span><span class=cF0>
<a name="l88"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BLK_SIZE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [BMHD_DAP_BLK_LO - </span><span class=cFD>BMHD_START</span><span class=cF0>]
<a name="l91"></a> </span><span class=cF1>JNZ</span><span class=cF0> @@10
<a name="l92"></a> </span><span class=cF1>INC</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [BMHD_DAP_BLK_HI - </span><span class=cFD>BMHD_START</span><span class=cF0>]
<a name="l93"></a>
<a name="l94"></a>@@10: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>
<a name="l95"></a> </span><span class=cF1>LOOP</span><span class=cF0> @@05
<a name="l96"></a>
<a name="l97"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [BMHD_BIOS_DRIVE_NUM - </span><span class=cFD>BMHD_START</span><span class=cF0>]
<a name="l98"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>, </span><span class=cF9>U32</span><span class=cF0> [BMHD_OLD_CS_RIP - </span><span class=cFD>BMHD_START</span><span class=cF0>]
<a name="l99"></a></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l100"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP BOOT_RAM_BASE:0000</span><span class=cF0>
<a name="l101"></a> </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>BOOT_RAM_BASE</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>;
<a name="l102"></a></span><span class=cF2>//Continues here </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootMHD2.ZC.html#l8"><span class=cF4>BMHD2_START</span></a><span class=cF0>
<a name="l103"></a></span><span class=cFD>BMHD_END</span><span class=cF0>::
<a name="l104"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cFD>BMHD_END</span><span class=cF0>-</span><span class=cFD>BMHD_START</span><span class=cF0> &lt;= </span><span class=cFE>440</span><span class=cF0>
<a name="l105"></a>}
</span></pre></body>
</html>

150
docs/System/Boot/BootMHD2.ZC.html Executable file
View file

@ -0,0 +1,150 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF0>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>MODULE_SIZE</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>BLK_SIZE</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_HIGH_LOC_MHD2</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF3>BOOT_RAM_LIMIT</span><span class=cF0> - (</span><span class=cF3>BOOT_STACK_SIZE</span><span class=cF0> + </span><span class=cF3>MODULE_SIZE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>4</span><span class=cF0>)
<a name="l3"></a>
<a name="l4"></a></span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>&quot;DD_BOOT_HIGH_LOC_MHD2&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%08X&quot;</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD2</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0>);
<a name="l5"></a>
<a name="l6"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l7"></a></span><span class=cF1>USE16</span><span class=cF0>
<a name="l8"></a></span><span class=cFD>BMHD2_START</span><span class=cF0>::
<a name="l9"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> </span><span class=cFC>FS</span><span class=cF0>:[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cF6>'B'</span><span class=cF0> + </span><span class=cFE>0x2000</span><span class=cF0> + (</span><span class=cF6>'2'</span><span class=cF0> + </span><span class=cFE>0x2000</span><span class=cF0>) &lt;&lt; </span><span class=cFE>16</span><span class=cF0>
<a name="l10"></a>
<a name="l11"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD2</span><span class=cF0>
<a name="l12"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l13"></a></span><span class=cF2>//This copies this bootloader's code to 0x00096A00</span><span class=cF0>
<a name="l14"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFC>CS</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l16"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [BMHD2_OLD_CS_RIP - </span><span class=cFD>BMHD2_START</span><span class=cF0>], </span><span class=cFC>EBX</span><span class=cF0>
<a name="l17"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> [BMHD2_BIOS_DRIVE_NUM - </span><span class=cFD>BMHD2_START</span><span class=cF0>], </span><span class=cFC>DL</span><span class=cF0>
<a name="l18"></a>
<a name="l19"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>CX</span><span class=cF0>, </span><span class=cF3>MODULE_SIZE</span><span class=cF0>
<a name="l20"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, </span><span class=cFC>SI</span><span class=cF0>
<a name="l21"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>DI</span><span class=cF0>, </span><span class=cFC>DI</span><span class=cF0>
<a name="l22"></a> </span><span class=cF1>REP_MOVSB</span><span class=cF0>
<a name="l23"></a>
<a name="l24"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD2</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>, </span><span class=cFC>AX</span><span class=cF0>
<a name="l26"></a>
<a name="l27"></a></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l28"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP BOOT_HIGH_LOC_MHD2:BMHD2_HISTART</span><span class=cF0>
<a name="l29"></a> </span><span class=cF1>DU16</span><span class=cF0> BMHD2_HISTART - </span><span class=cFD>BMHD2_START</span><span class=cF0>, </span><span class=cF3>BOOT_HIGH_LOC_MHD2</span><span class=cF0>;
<a name="l30"></a>
<a name="l31"></a></span><span class=cFD>BMHD2_BOOT_MESSAGE</span><span class=cF0>::
<a name="l32"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>256</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l33"></a>
<a name="l34"></a>BMHD2_BIOS_DRIVE_NUM: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l35"></a>BMHD2_PAGE: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l36"></a></span><span class=cFD>BMHD2_BLK_ARRAY</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l37"></a>
<a name="l38"></a>BMHD2_DAP: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>//One block at a time</span><span class=cF0>
<a name="l39"></a>BMHD2_DAP_BUF: </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l40"></a></span><span class=cFD>BMHD2_DAP_BLK</span><span class=cF0>:: </span><span class=cF2>//64-bit</span><span class=cF0>
<a name="l41"></a>BMHD2_DAP_BLK_LO: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l42"></a>BMHD2_DAP_BLK_HI: </span><span class=cF1>DU32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l43"></a>
<a name="l44"></a></span><span class=cFD>BMHD2_PUT_CHAR</span><span class=cF0>::
<a name="l45"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0xE</span><span class=cF0>
<a name="l46"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>, </span><span class=cFE>7</span><span class=cF0> </span><span class=cF2>//Might be foreground color on some BIOS's</span><span class=cF0>
<a name="l47"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BH</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [BMHD2_PAGE - </span><span class=cFD>BMHD2_START</span><span class=cF0>]
<a name="l48"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x10</span><span class=cF0>
<a name="l49"></a></span><span class=cFD>BMHD2_RET</span><span class=cF0>::
<a name="l50"></a> </span><span class=cF1>RET</span><span class=cF0>
<a name="l51"></a></span><span class=cFD>BMHD2_PUTS</span><span class=cF0>::
<a name="l52"></a>@@1: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l53"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cFC>AL</span><span class=cF0>
<a name="l54"></a> </span><span class=cF1>JZ</span><span class=cF0> </span><span class=cFD>BMHD2_RET</span><span class=cF0>
<a name="l55"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BMHD2_PUT_CHAR</span><span class=cF0>
<a name="l56"></a> </span><span class=cF1>JMP</span><span class=cF0> @@1
<a name="l57"></a>
<a name="l58"></a>BMHD2_GETCHAR:
<a name="l59"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFC>AH</span><span class=cF0>
<a name="l60"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x16</span><span class=cF0>
<a name="l61"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l62"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0x0E</span><span class=cF0>
<a name="l63"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>, </span><span class=cFE>0x07</span><span class=cF0>
<a name="l64"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x10</span><span class=cF0>
<a name="l65"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l66"></a> </span><span class=cF1>RET</span><span class=cF0>
<a name="l67"></a>
<a name="l68"></a>BMHD2_HISTART:
<a name="l69"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0xF</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x10</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> [BMHD2_PAGE - </span><span class=cFD>BMHD2_START</span><span class=cF0>], </span><span class=cFC>BH</span><span class=cF0> </span><span class=cF2>//Video page</span><span class=cF0>
<a name="l72"></a>
<a name="l73"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> </span><span class=cFC>FS</span><span class=cF0>:[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cFE>0</span><span class=cF0>
<a name="l74"></a>@@5: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, </span><span class=cFD>BMHD2_BOOT_MESSAGE</span><span class=cF0> - </span><span class=cFD>BMHD2_START</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BMHD2_PUTS</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>CALL</span><span class=cF0> BMHD2_GETCHAR
<a name="l77"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'0'</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>JB</span><span class=cF0> @@5
<a name="l79"></a> </span><span class=cF1>CMP</span><span class=cF0> </span><span class=cFC>AL</span><span class=cF0>, </span><span class=cF6>'8'</span><span class=cF0>
<a name="l80"></a> </span><span class=cF1>JAE</span><span class=cF0> @@5
<a name="l81"></a> </span><span class=cF1>AND</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cFE>7</span><span class=cF0>
<a name="l82"></a>
<a name="l83"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>, </span><span class=cF9>U32</span><span class=cF0> </span><span class=cFD>BMHD2_BLK_ARRAY</span><span class=cF0> - </span><span class=cFD>BMHD2_START</span><span class=cF0>[</span><span class=cFC>EAX</span><span class=cF0> * </span><span class=cFE>8</span><span class=cF0>]
<a name="l84"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cF9>U32</span><span class=cF0> </span><span class=cFD>BMHD2_BLK_ARRAY</span><span class=cF0> + </span><span class=cFE>4</span><span class=cF0> - </span><span class=cFD>BMHD2_START</span><span class=cF0>[</span><span class=cFC>EAX</span><span class=cF0> * </span><span class=cFE>8</span><span class=cF0>]
<a name="l85"></a>
<a name="l86"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>, </span><span class=cFC>EBX</span><span class=cF0>
<a name="l87"></a> </span><span class=cF1>JNZ</span><span class=cF0> @@10
<a name="l88"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cFC>EAX</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>JZ</span><span class=cF0> @@5
<a name="l90"></a>
<a name="l91"></a>@@10: </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [BMHD2_DAP_BLK_LO - </span><span class=cFD>BMHD2_START</span><span class=cF0>], </span><span class=cFC>EBX</span><span class=cF0>
<a name="l92"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [BMHD2_DAP_BLK_HI - </span><span class=cFD>BMHD2_START</span><span class=cF0>], </span><span class=cFC>EAX</span><span class=cF0>
<a name="l93"></a>
<a name="l94"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [BMHD2_OLD_CS_RIP - </span><span class=cFD>BMHD2_START</span><span class=cF0>]
<a name="l95"></a> </span><span class=cF1>SHR</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>
<a name="l96"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>, </span><span class=cF9>U16</span><span class=cF0> [BMHD2_OLD_CS_RIP + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BMHD2_START</span><span class=cF0>]
<a name="l97"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BMHD2_DAP_BUF + </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFD>BMHD2_START</span><span class=cF0>], </span><span class=cFC>AX</span><span class=cF0> </span><span class=cF2>//ES:0000</span><span class=cF0>
<a name="l98"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SI</span><span class=cF0>, BMHD2_DAP - </span><span class=cFD>BMHD2_START</span><span class=cF0> </span><span class=cF2>//DS:SI=DAP</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> [BMHD2_BIOS_DRIVE_NUM - </span><span class=cFD>BMHD2_START</span><span class=cF0>]
<a name="l100"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>, </span><span class=cFE>0x42</span><span class=cF0>
<a name="l101"></a> </span><span class=cF1>INT</span><span class=cF0> </span><span class=cFE>0x13</span><span class=cF0>
<a name="l102"></a>
<a name="l103"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>EBP</span><span class=cF0>
<a name="l104"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>EDX</span><span class=cF0>
<a name="l105"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>
<a name="l106"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>
<a name="l107"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>, </span><span class=cFC>EAX</span><span class=cF0>
<a name="l108"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>GS</span><span class=cF0>
<a name="l109"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>FS</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>POPF</span><span class=cF0>
<a name="l113"></a>
<a name="l114"></a></span><span class=cF2>//The assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l115"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP xxxx:yyyy</span><span class=cF0>
<a name="l116"></a>BMHD2_OLD_CS_RIP:
<a name="l117"></a> </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
<a name="l118"></a></span><span class=cFD>BMHD2_END</span><span class=cF0>::
<a name="l119"></a></span><span class=cF2>//Continues here </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHD.ZC.html#l10"><span class=cF4>::/System/Boot/BootHD.ZC</span></a><span class=cF0>
<a name="l120"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cFD>BMHD2_END</span><span class=cF0> - </span><span class=cFD>BMHD2_START</span><span class=cF0> &lt; </span><span class=cF3>MODULE_SIZE</span><span class=cF0>
<a name="l121"></a>}
</span></pre></body>
</html>

View file

@ -0,0 +1,209 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Install.DD.html#l1"><span class=cF4>Install Documentation</span></a><span class=cF2>.</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>//Study the account examples: </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSConfig.ZC.html#l1"><span class=cF4>Config Strs</span></a><span class=cF2>, </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSDistro.ZC.html#l1"><span class=cF4>Update Funs</span></a><span class=cF0>
<a name="l3"></a>
<a name="l4"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootMHD&quot;</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootMHD2&quot;</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Install&quot;</span><span class=cF0>
<a name="l8"></a>
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>&quot;/Boot&quot;</span><span class=cF0>
<a name="l10"></a></span><span class=cF2>//Stage 2 of master boot loader</span><span class=cF0>
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR_BOOTMHD2_BIN_C</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>&quot;/BootMHD2.BIN.C&quot;</span><span class=cF0>
<a name="l12"></a></span><span class=cF2>//Old master boot record</span><span class=cF0>
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR_OLDMBR_BIN_C</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>&quot;/OldMBR.BIN.C&quot;</span><span class=cF0>
<a name="l14"></a>
<a name="l15"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootMHDOldRead</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> src_drive, </span><span class=cF1>U8</span><span class=cF0> dst_drive)
<a name="l16"></a>{</span><span class=cF2>//Reads MBR from disk drive containing src partition.</span><span class=cF0>
<a name="l17"></a></span><span class=cF2>//Writes a single block file to dst BOOT_DIR.</span><span class=cF0>
<a name="l18"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd = </span><span class=cF5>Letter2BlkDev</span><span class=cF0>(src_drive);
<a name="l19"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive;
<a name="l20"></a> </span><span class=cF9>CMasterBoot</span><span class=cF0> mbr;
<a name="l21"></a>
<a name="l22"></a> </span><span class=cF5>Drive</span><span class=cF0>(dst_drive);
<a name="l23"></a> drive = </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dv;
<a name="l24"></a>
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (drive-&gt;fs_type != </span><span class=cF3>FSt_REDSEA</span><span class=cF0> &amp;&amp; drive-&gt;fs_type != </span><span class=cF3>FSt_FAT32</span><span class=cF0>)
<a name="l26"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;File System Not Supported\n&quot;</span><span class=cF0>);
<a name="l27"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l28"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l29"></a></span><span class=cF2>//Bypass partition bounds-checking</span><span class=cF0>
<a name="l30"></a> </span><span class=cF5>BlkDevLock</span><span class=cF0>(bd);
<a name="l31"></a> </span><span class=cF5>AHCIAtaBlksRead</span><span class=cF0>(bd, &amp;mbr, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
<a name="l32"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(bd);
<a name="l33"></a>
<a name="l34"></a> </span><span class=cF5>Drive</span><span class=cF0>(dst_drive);
<a name="l35"></a> </span><span class=cF5>DirMake</span><span class=cF0>(</span><span class=cF3>BOOT_DIR</span><span class=cF0>);
<a name="l36"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(</span><span class=cF3>BOOT_DIR_OLDMBR_BIN_C</span><span class=cF0>, &amp;mbr, </span><span class=cF3>BLK_SIZE</span><span class=cF0>);
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l38"></a>}
<a name="l39"></a>
<a name="l40"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootMHDOldWrite</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> src_drive, </span><span class=cF1>U8</span><span class=cF0> dst_drive)
<a name="l41"></a>{</span><span class=cF2>//Reads OldMBR from src drive BOOT_DIR.</span><span class=cF0>
<a name="l42"></a></span><span class=cF2>//writes it to the MBR of the drive with dst partition.</span><span class=cF0>
<a name="l43"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd = </span><span class=cF5>Letter2BlkDev</span><span class=cF0>(dst_drive);
<a name="l44"></a> </span><span class=cF9>CMasterBoot</span><span class=cF0> *mbr;
<a name="l45"></a>
<a name="l46"></a> </span><span class=cF5>Drive</span><span class=cF0>(src_drive);
<a name="l47"></a>
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (mbr = </span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF3>BOOT_DIR_OLDMBR_BIN_C</span><span class=cF7>)</span><span class=cF0>)
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l50"></a></span><span class=cF2>//Bypass partition bounds-checking</span><span class=cF0>
<a name="l51"></a> </span><span class=cF5>BlkDevLock</span><span class=cF0>(bd);
<a name="l52"></a> </span><span class=cF5>AHCIAtaBlksWrite</span><span class=cF0>(bd, mbr, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
<a name="l53"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(bd);
<a name="l54"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l55"></a> </span><span class=cF5>Free</span><span class=cF0>(mbr);
<a name="l56"></a>}
<a name="l57"></a>
<a name="l58"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootMHDZero</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> dst_drive)
<a name="l59"></a>{</span><span class=cF2>//Set MBR of disk with dst partition to zero.</span><span class=cF0>
<a name="l60"></a>
<a name="l61"></a> </span><span class=cF2>//This is dangerous!!</span><span class=cF0>
<a name="l62"></a> </span><span class=cF2>//The ZealOS partitioner doesn't play well</span><span class=cF0>
<a name="l63"></a> </span><span class=cF2>//with other operating systems at this time and you need</span><span class=cF0>
<a name="l64"></a> </span><span class=cF2>//to do this on a drive partitioned by ZealOS</span><span class=cF0>
<a name="l65"></a> </span><span class=cF2>//if you wish to partition with another operating system.</span><span class=cF0>
<a name="l66"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd = </span><span class=cF5>Letter2BlkDev</span><span class=cF0>(dst_drive);
<a name="l67"></a> </span><span class=cF9>CMasterBoot</span><span class=cF0> mbr;
<a name="l68"></a>
<a name="l69"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;mbr, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>BLK_SIZE</span><span class=cF0>);
<a name="l70"></a></span><span class=cF2>//Bypass partition bounds-checking</span><span class=cF0>
<a name="l71"></a> </span><span class=cF5>BlkDevLock</span><span class=cF0>(bd);
<a name="l72"></a> </span><span class=cF5>AHCIAtaBlksWrite</span><span class=cF0>(bd, &amp;mbr, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
<a name="l73"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(bd);
<a name="l74"></a>}
<a name="l75"></a>
<a name="l76"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>BootMHDIns</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let, </span><span class=cF1>U8</span><span class=cF0> *drv_list=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l77"></a>{</span><span class=cF2>//Create new MBR on the disk that has drv_let as a partition.</span><span class=cF0>
<a name="l78"></a></span><span class=cF2>//Puts stage 2 in BOOT_DIR of drv_let.</span><span class=cF0>
<a name="l79"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd, *bd1;
<a name="l80"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive, *p1;
<a name="l81"></a> </span><span class=cF9>CMasterBoot</span><span class=cF0> mbr;
<a name="l82"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> de;
<a name="l83"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, size, *_q;
<a name="l84"></a> </span><span class=cF1>U8</span><span class=cF0> *menu_ptr, *ptr, ch, buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l85"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l86"></a>
<a name="l87"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l88"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (drv_list)
<a name="l90"></a> {
<a name="l91"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, drv_list);
<a name="l92"></a> </span><span class=cF5>StrUtil</span><span class=cF0>(buf, </span><span class=cF3>SUF_TO_UPPER</span><span class=cF0>);
<a name="l93"></a> }
<a name="l94"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l95"></a> {
<a name="l96"></a> j = </span><span class=cFE>0</span><span class=cF0>;
<a name="l97"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cF6>'A'</span><span class=cF0>; i &lt;= </span><span class=cF6>'Z'</span><span class=cF0>; i++)
<a name="l98"></a> buf[j++] = i;
<a name="l99"></a> buf[j++] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l100"></a> }
<a name="l101"></a>
<a name="l102"></a> </span><span class=cF5>Drive</span><span class=cF0>(drv_let);
<a name="l103"></a> drive = </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dv;
<a name="l104"></a>
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (drive-&gt;fs_type != </span><span class=cF3>FSt_REDSEA</span><span class=cF0> &amp;&amp; drive-&gt;fs_type != </span><span class=cF3>FSt_FAT32</span><span class=cF0>)
<a name="l106"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;File System Not Supported\n&quot;</span><span class=cF0>);
<a name="l107"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l108"></a> {
<a name="l109"></a> bd = drive-&gt;bd;
<a name="l110"></a>
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF3>BOOT_DIR_OLDMBR_BIN_C</span><span class=cF0>,, </span><span class=cF3>FUF_JUST_FILES</span><span class=cF7>)</span><span class=cF0>)
<a name="l112"></a> </span><span class=cF5>BootMHDOldRead</span><span class=cF0>(drv_let, drv_let);
<a name="l113"></a>
<a name="l114"></a> _q = </span><span class=cFD>BMHD2_BLK_ARRAY</span><span class=cF0>;
<a name="l115"></a> </span><span class=cF5>MemSet</span><span class=cF0>(_q, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0> * </span><span class=cFE>8</span><span class=cF0>);
<a name="l116"></a> menu_ptr = </span><span class=cFD>BMHD2_BOOT_MESSAGE</span><span class=cF0>;
<a name="l117"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(menu_ptr, </span><span class=cF6>&quot;\n\r\n\rZealOS Boot Loader\n\r\n\r&quot;</span><span class=cF0>);
<a name="l118"></a> j = </span><span class=cFE>0</span><span class=cF0>;
<a name="l119"></a>
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF3>BOOT_DIR_OLDMBR_BIN_C</span><span class=cF0>, &amp;de, </span><span class=cF3>FUF_JUST_FILES</span><span class=cF7>)</span><span class=cF0>)
<a name="l121"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l122"></a> </span><span class=cF5>Free</span><span class=cF0>(de.full_name);
<a name="l123"></a> *_q++ = </span><span class=cF5>Clus2Blk</span><span class=cF0>(drive, de.clus);
<a name="l124"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(menu_ptr, </span><span class=cF6>&quot;0. Old Boot Record\n\r&quot;</span><span class=cF0>);
<a name="l125"></a> j++;
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l127"></a>
<a name="l128"></a> ptr = buf;
<a name="l129"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr++)
<a name="l130"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>p1 = </span><span class=cF5>Letter2Drive</span><span class=cF0>(ch, </span><span class=cF3>FALSE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>bd1 = p1-&gt;bd</span><span class=cF7>)</span><span class=cF0> &amp;&amp; bd1 == bd)
<a name="l132"></a> {
<a name="l133"></a> *_q = p1-&gt;drv_offset;
<a name="l134"></a> </span><span class=cF6>&quot;Drive %C:%16X\n&quot;</span><span class=cF0>, </span><span class=cF5>Drive2Letter</span><span class=cF0>(p1), *_q;
<a name="l135"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(menu_ptr, </span><span class=cF6>&quot;%d. Drive %C\n\r&quot;</span><span class=cF0>, j++, </span><span class=cF5>Drive2Letter</span><span class=cF7>(</span><span class=cF0>p1</span><span class=cF7>)</span><span class=cF0>);
<a name="l136"></a> _q++;
<a name="l137"></a> }
<a name="l138"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l139"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(menu_ptr, </span><span class=cF6>&quot;\n\rSelection:&quot;</span><span class=cF0>);
<a name="l140"></a>
<a name="l141"></a> size = </span><span class=cFD>BMHD2_END</span><span class=cF0> - </span><span class=cFD>BMHD2_START</span><span class=cF0>;
<a name="l142"></a> </span><span class=cF5>FileWrite</span><span class=cF0>(</span><span class=cF3>BOOT_DIR_BOOTMHD2_BIN_C</span><span class=cF0>, </span><span class=cFD>BMHD2_START</span><span class=cF0>, size);
<a name="l143"></a>
<a name="l144"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF3>BOOT_DIR_BOOTMHD2_BIN_C</span><span class=cF0>, &amp;de, </span><span class=cF3>FUF_JUST_FILES</span><span class=cF7>)</span><span class=cF0>)
<a name="l145"></a> </span><span class=cF6>&quot;No Boot Loader Image\n&quot;</span><span class=cF0>;
<a name="l146"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l147"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l148"></a> </span><span class=cF5>Free</span><span class=cF0>(de.full_name);
<a name="l149"></a>
<a name="l150"></a> *</span><span class=cFD>BMHD_BLK_COUNT</span><span class=cF0>(</span><span class=cF9>U16</span><span class=cF0> *) = (size + </span><span class=cF3>BLK_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) &gt;&gt; </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
<a name="l151"></a> *</span><span class=cFD>BMHD_DAP_BLK</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *) = </span><span class=cF5>Clus2Blk</span><span class=cF0>(drive, de.clus);
<a name="l152"></a></span><span class=cF2>//Bypass partition bounds-checking</span><span class=cF0>
<a name="l153"></a> </span><span class=cF5>BlkDevLock</span><span class=cF0>(bd);
<a name="l154"></a> </span><span class=cF5>AHCIAtaBlksRead</span><span class=cF0>(bd, &amp;mbr, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
<a name="l155"></a>
<a name="l156"></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=cFD>BMHD_END</span><span class=cF0> - </span><span class=cFD>BMHD_CODE</span><span class=cF0>; i++)
<a name="l157"></a> mbr.code[i] = </span><span class=cFD>BMHD_CODE</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *)[i];
<a name="l158"></a>
<a name="l159"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CMasterBoot</span><span class=cF0>.code) &gt;= </span><span class=cFD>BMHD_END</span><span class=cF0> - </span><span class=cFD>BMHD_CODE</span><span class=cF0>
<a name="l160"></a>
<a name="l161"></a> </span><span class=cF1>for</span><span class=cF0> (; i &lt; </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMasterBoot</span><span class=cF0>.code</span><span class=cF7>)</span><span class=cF0>; i++)
<a name="l162"></a> mbr.code[i] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l163"></a>
<a name="l164"></a> </span><span class=cF1>if</span><span class=cF0> (!mbr.media_id)
<a name="l165"></a> mbr.media_id = </span><span class=cF5>RandU32</span><span class=cF0>;
<a name="l166"></a>
<a name="l167"></a> mbr.zero = </span><span class=cFE>0</span><span class=cF0>;
<a name="l168"></a> mbr.signature = </span><span class=cFE>0xAA55</span><span class=cF0>;
<a name="l169"></a>
<a name="l170"></a> </span><span class=cF5>AHCIAtaBlksWrite</span><span class=cF0>(bd, &amp;mbr, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
<a name="l171"></a>
<a name="l172"></a> </span><span class=cF5>BlkDevUnlock</span><span class=cF0>(bd);
<a name="l173"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l175"></a> }
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l177"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l178"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l179"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l180"></a>}
</span></pre></body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Call&quot;</span><span class=cF0>
<a name="l2"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l3"></a></span><span class=cFD>_HI_CALL</span><span class=cF0>::
<a name="l4"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l5"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l6"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l7"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l8"></a> </span><span class=cF1>JZ</span><span class=cF0> @@05
<a name="l9"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
<a name="l10"></a>@@05: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l11"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>
<a name="l12"></a></span><span class=cF2>//************************************</span><span class=cF0>
<a name="l13"></a></span><span class=cFD>_HI_MEMCOPY</span><span class=cF0>::
<a name="l14"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>, </span><span class=cFC>RSP</span><span class=cF0>
<a name="l16"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l17"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l18"></a> </span><span class=cF1>CLD</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l20"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l21"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG3</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l22"></a> </span><span class=cF1>REP_MOVSB</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RDI</span><span class=cF0>
<a name="l24"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l26"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l27"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>24</span><span class=cF0>
<a name="l28"></a>}
<a name="l29"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_HI_CALL</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HiCall</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *machine_code);
<a name="l30"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_HI_MEMCOPY</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>HiMemCopy</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dst, </span><span class=cF1>U8</span><span class=cF0> *src, </span><span class=cF9>I64</span><span class=cF0> count);
<a name="l31"></a>
<a name="l32"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Boot&quot;</span><span class=cF0>
<a name="l33"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootRAM</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF6>&quot;::&quot;</span><span class=cF0> </span><span class=cF3>BOOT_DIR_KERNEL_BIN_C</span><span class=cF0>)
<a name="l34"></a>{</span><span class=cF2>//Softboot Kernel.BIN file. No hardware reset.</span><span class=cF0>
<a name="l35"></a> </span><span class=cF9>I64</span><span class=cF0> size;
<a name="l36"></a> </span><span class=cF9>CKernel</span><span class=cF0> *hi_image, *lo_image = </span><span class=cFB>mem_boot_base</span><span class=cF0> - </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CBinFile</span><span class=cF0>), </span><span class=cF1>reg</span><span class=cF0> *sys_ram_reboot;
<a name="l37"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>hi_image = </span><span class=cF5>FileRead</span><span class=cF0>(filename, &amp;size)</span><span class=cF7>)</span><span class=cF0>)
<a name="l39"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF1>while</span><span class=cF0> (hi_image &lt; </span><span class=cFE>0x100000</span><span class=cF0>); </span><span class=cF2>//If alloc from low 640K, just get another copy.</span><span class=cF0>
<a name="l41"></a>
<a name="l42"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l43"></a> sys_ram_reboot = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFD>SYS_RAM_REBOOT_END</span><span class=cF0> - </span><span class=cFD>SYS_RAM_REBOOT</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>-&gt;code_heap);
<a name="l44"></a> </span><span class=cF1>while</span><span class=cF0> (sys_ram_reboot &lt; </span><span class=cFE>0x100000</span><span class=cF0>);
<a name="l45"></a>
<a name="l46"></a> hi_image-&gt;boot_src = </span><span class=cF3>BOOT_SRC_RAM</span><span class=cF0>;
<a name="l47"></a> hi_image-&gt;boot_blk = </span><span class=cFE>0</span><span class=cF0>;
<a name="l48"></a> hi_image-&gt;boot_patch_table_base = lo_image(</span><span class=cF1>U8</span><span class=cF0> *) + hi_image-&gt;h.patch_table_offset;
<a name="l49"></a> hi_image-&gt;</span><span class=cFB>sys_run_level</span><span class=cF0> = lo_image-&gt;</span><span class=cFB>sys_run_level</span><span class=cF0> &amp; (</span><span class=cF3>RLF_VESA</span><span class=cF0> | </span><span class=cF3>RLF_16BIT</span><span class=cF0>);
<a name="l50"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;hi_image-&gt;</span><span class=cF1>start</span><span class=cF0>, &amp;lo_image-&gt;</span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CKernel</span><span class=cF7>)</span><span class=cF0> - </span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CKernel</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>);
<a name="l51"></a>
<a name="l52"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mp_count</span><span class=cF0> &gt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l54"></a> </span><span class=cF5>MPHalt</span><span class=cF0>;
<a name="l55"></a>
<a name="l56"></a> </span><span class=cF5>HiMemCopy</span><span class=cF0>(sys_ram_reboot, </span><span class=cFD>SYS_RAM_REBOOT</span><span class=cF0>, </span><span class=cFD>SYS_RAM_REBOOT_END</span><span class=cF0> - </span><span class=cFD>SYS_RAM_REBOOT</span><span class=cF0>);
<a name="l57"></a> </span><span class=cF5>HiMemCopy</span><span class=cF0>(lo_image, hi_image, size);
<a name="l58"></a> </span><span class=cF5>HiCall</span><span class=cF0>(sys_ram_reboot);
<a name="l59"></a>}
</span></pre></body>
</html>

View file

@ -0,0 +1,246 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;File/CD DVD&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(</span><span class=cF9>CPalindromeU16</span><span class=cF0> *dst, </span><span class=cF9>U16</span><span class=cF0> w)
<a name="l4"></a>{
<a name="l5"></a> dst-&gt;big = </span><span class=cF5>EndianU16</span><span class=cF0>(w);
<a name="l6"></a> dst-&gt;little = w;
<a name="l7"></a>}
<a name="l8"></a>
<a name="l9"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(</span><span class=cF9>CPalindromeU32</span><span class=cF0> *dst, </span><span class=cF9>I64</span><span class=cF0> d)
<a name="l10"></a>{
<a name="l11"></a> dst-&gt;big = </span><span class=cF5>EndianU32</span><span class=cF0>(d);
<a name="l12"></a> dst-&gt;little = d;
<a name="l13"></a>}
<a name="l14"></a>
<a name="l15"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CElTorito</span><span class=cF0>
<a name="l16"></a>{
<a name="l17"></a> </span><span class=cF9>U16</span><span class=cF0> w[</span><span class=cFE>16</span><span class=cF0>];
<a name="l18"></a> </span><span class=cF1>U8</span><span class=cF0> bootable; </span><span class=cF2>// 88=bootable 00=not bootable</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>U8</span><span class=cF0> media_type; </span><span class=cF2>// 0=no emulation 4=hard disk</span><span class=cF0>
<a name="l20"></a> </span><span class=cF9>U16</span><span class=cF0> load_seg; </span><span class=cF2>// 0000-&gt;07C0</span><span class=cF0>
<a name="l21"></a> </span><span class=cF1>U8</span><span class=cF0> sys_type;
<a name="l22"></a> </span><span class=cF1>U8</span><span class=cF0> zero;
<a name="l23"></a> </span><span class=cF9>U16</span><span class=cF0> sect_count;
<a name="l24"></a> </span><span class=cF9>U32</span><span class=cF0> load_rba; </span><span class=cF2>// start address of virtual disk</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>U8</span><span class=cF0> zero2[</span><span class=cFE>20</span><span class=cF0>];
<a name="l26"></a>};
<a name="l27"></a>
<a name="l28"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RedSeaISO9660Stage1</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *iso_filename, </span><span class=cF1>U8</span><span class=cF0> *stage2_filename)
<a name="l29"></a>{
<a name="l30"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> de;
<a name="l31"></a> </span><span class=cF9>CFile</span><span class=cF0> *out_file = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l32"></a> </span><span class=cF1>U8</span><span class=cF0> *stage1_buf = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>);
<a name="l33"></a>
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF0>stage2_filename, &amp;de</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>out_file = </span><span class=cF5>FOpen</span><span class=cF0>(iso_filename, </span><span class=cF6>&quot;wc+&quot;</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
<a name="l35"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l36"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(stage1_buf, </span><span class=cFD>BDVD_START</span><span class=cF0>, </span><span class=cFD>BDVD_END</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0>);
<a name="l37"></a> *(</span><span class=cFD>BDVD_BLK_LO</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U32</span><span class=cF0> *) = de.clus &gt;&gt; </span><span class=cFE>2</span><span class=cF0>;
<a name="l38"></a> *(</span><span class=cFD>BDVD_BLK_COUNT</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *) = (de.size + </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) &gt;&gt; (</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>);
<a name="l39"></a> *(</span><span class=cFD>BDVD_SHIFT_BLKS</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *) = de.clus &amp; </span><span class=cFE>3</span><span class=cF0>;
<a name="l40"></a>
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (de.clus &amp; </span><span class=cFE>3</span><span class=cF0>)
<a name="l42"></a> *(</span><span class=cFD>BDVD_BLK_COUNT</span><span class=cF0> - </span><span class=cFD>BDVD_START</span><span class=cF0> + stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *) += </span><span class=cFE>1</span><span class=cF0>;
<a name="l43"></a>
<a name="l44"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, stage1_buf, </span><span class=cFE>20</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0> / </span><span class=cF3>BLK_SIZE</span><span class=cF0>);
<a name="l45"></a> </span><span class=cF5>FClose</span><span class=cF0>(out_file);
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l47"></a> </span><span class=cF5>Free</span><span class=cF0>(stage1_buf);
<a name="l48"></a>}
<a name="l49"></a>
<a name="l50"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RedSeaISO9660</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *iso_filename, </span><span class=cF1>U8</span><span class=cF0> drv_let)
<a name="l51"></a>{
<a name="l52"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive = </span><span class=cF5>Letter2Drive</span><span class=cF0>(drv_let);
<a name="l53"></a> </span><span class=cF9>CISOPriDesc</span><span class=cF0> *iso_pri = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
<a name="l54"></a> *iso_boot = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
<a name="l55"></a> *iso_sup = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
<a name="l56"></a> *iso_term = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l57"></a> </span><span class=cF9>I64</span><span class=cF0> iso_size = </span><span class=cFE>0</span><span class=cF0>, i, j;
<a name="l58"></a> </span><span class=cF9>U32</span><span class=cF0> *d;
<a name="l59"></a> </span><span class=cF9>CElTorito</span><span class=cF0> *et = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l60"></a> </span><span class=cF1>U8</span><span class=cF0> *zero_buf = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>), *st;
<a name="l61"></a> </span><span class=cF9>CFile</span><span class=cF0> *out_file = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l62"></a>
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (out_file = </span><span class=cF5>FOpen</span><span class=cF7>(</span><span class=cF0>iso_filename, </span><span class=cF6>&quot;wc+&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l64"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l65"></a> iso_size = </span><span class=cF5>FSize</span><span class=cF0>(out_file) / </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>;
<a name="l66"></a>
<a name="l67"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; drive-&gt;bd-&gt;drv_offset; i += </span><span class=cFE>4</span><span class=cF0>)
<a name="l68"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, zero_buf, i, </span><span class=cFE>4</span><span class=cF0>);
<a name="l69"></a>
<a name="l70"></a> iso_pri-&gt;type = </span><span class=cF3>ISOT_PRI_VOL_DESC</span><span class=cF0>;
<a name="l71"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_pri-&gt;id, </span><span class=cF6>&quot;CD001&quot;</span><span class=cF0>);
<a name="l72"></a> iso_pri-&gt;version = </span><span class=cFE>1</span><span class=cF0>;
<a name="l73"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;vol_set_size, </span><span class=cFE>1</span><span class=cF0>);
<a name="l74"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;vol_seq_num, </span><span class=cFE>1</span><span class=cF0>);
<a name="l75"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;log_block_size, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l76"></a> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;vol_space_size, iso_size);
<a name="l77"></a> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;root_dir_record, drive-&gt;root_clus);
<a name="l78"></a> iso_pri-&gt;file_structure_version = </span><span class=cFE>1</span><span class=cF0>;
<a name="l79"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_pri-&gt;publisher_id, </span><span class=cF6>&quot;ZealOS RedSea&quot;</span><span class=cF0>);
<a name="l80"></a>
<a name="l81"></a> st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;ZealOS V%0.2f %D %T&quot;</span><span class=cF0>, </span><span class=cFB>sys_os_version</span><span class=cF0>, </span><span class=cF5>Now</span><span class=cF0>, </span><span class=cF5>Now</span><span class=cF0>);
<a name="l82"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_pri-&gt;preparer_id, st);
<a name="l83"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l84"></a>
<a name="l85"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(iso_sup, iso_pri, </span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l86"></a> iso_sup-&gt;type = </span><span class=cF3>ISOT_SUPPLEMENTARY_DESC</span><span class=cF0>;
<a name="l87"></a>
<a name="l88"></a> iso_boot-&gt;type = </span><span class=cF3>ISOT_BOOT_RECORD</span><span class=cF0>;
<a name="l89"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_boot-&gt;id, </span><span class=cF6>&quot;CD001&quot;</span><span class=cF0>);
<a name="l90"></a> iso_boot-&gt;version = </span><span class=cFE>1</span><span class=cF0>;
<a name="l91"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_boot</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>7</span><span class=cF0>, </span><span class=cF6>&quot;EL TORITO SPECIFICATION&quot;</span><span class=cF0>);
<a name="l92"></a>
<a name="l93"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_pri, </span><span class=cFE>16</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
<a name="l94"></a> iso_term-&gt;type = </span><span class=cF3>ISOT_TERMINATOR</span><span class=cF0>;
<a name="l95"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(iso_term-&gt;id, </span><span class=cF6>&quot;CD001&quot;</span><span class=cF0>);
<a name="l96"></a> iso_term-&gt;version = </span><span class=cFE>1</span><span class=cF0>;
<a name="l97"></a>
<a name="l98"></a> d = iso_boot(</span><span class=cF1>U8</span><span class=cF0> *) + </span><span class=cFE>0x47</span><span class=cF0>;
<a name="l99"></a> *d = </span><span class=cFE>20</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0> &gt;&gt; </span><span class=cFE>2</span><span class=cF0>;
<a name="l100"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_boot, </span><span class=cFE>17</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
<a name="l101"></a>
<a name="l102"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_sup, </span><span class=cFE>18</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
<a name="l103"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, iso_term, </span><span class=cFE>19</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
<a name="l104"></a>
<a name="l105"></a> et-&gt;w[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cFE>1</span><span class=cF0>;
<a name="l106"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(&amp;et-&gt;w[</span><span class=cFE>2</span><span class=cF0>], </span><span class=cF6>&quot;ZealOS&quot;</span><span class=cF0>);
<a name="l107"></a> et-&gt;w[</span><span class=cFE>15</span><span class=cF0>] = </span><span class=cFE>0xAA55</span><span class=cF0>;
<a name="l108"></a>
<a name="l109"></a> j = </span><span class=cFE>0</span><span class=cF0>;
<a name="l110"></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=cFE>16</span><span class=cF0>; i++) </span><span class=cF2>//Checksum</span><span class=cF0>
<a name="l111"></a> j += et-&gt;w[i];
<a name="l112"></a>
<a name="l113"></a> et-&gt;w[</span><span class=cFE>14</span><span class=cF0>] = -j;
<a name="l114"></a> et-&gt;bootable = </span><span class=cFE>0x88</span><span class=cF0>;
<a name="l115"></a> et-&gt;media_type = </span><span class=cFE>0</span><span class=cF0>;</span><span class=cF2>//0=no emu 2=1.44meg 4=hard drive</span><span class=cF0>
<a name="l116"></a> et-&gt;sect_count = </span><span class=cFE>4</span><span class=cF0>; </span><span class=cF2>//5 seems like the limit, 4 is safer</span><span class=cF0>
<a name="l117"></a> et-&gt;load_rba = </span><span class=cFE>20</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0> &gt;&gt; </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>;
<a name="l118"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file, et, </span><span class=cFE>20</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>);
<a name="l119"></a> </span><span class=cF5>FClose</span><span class=cF0>(out_file);
<a name="l120"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l121"></a> </span><span class=cF5>Free</span><span class=cF0>(zero_buf);
<a name="l122"></a> </span><span class=cF5>Free</span><span class=cF0>(et);
<a name="l123"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_pri);
<a name="l124"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_boot);
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_sup);
<a name="l126"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_term);
<a name="l127"></a>}
<a name="l128"></a>
<a name="l129"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaISOPass1</span><span class=cF0>(</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde)
<a name="l130"></a>{
<a name="l131"></a> </span><span class=cF9>I64</span><span class=cF0> dir_entry_count = </span><span class=cFE>3</span><span class=cF0> + </span><span class=cF5>LinkedListCount</span><span class=cF0>(tmpde), res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l132"></a>
<a name="l133"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde)
<a name="l134"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
<a name="l136"></a> {
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;sub)
<a name="l138"></a> res += </span><span class=cF5>RedSeaISOPass1</span><span class=cF0>(tmpde-&gt;sub);
<a name="l139"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l140"></a> res += </span><span class=cF3>BLK_SIZE</span><span class=cF0>; </span><span class=cF2>//Empty dir</span><span class=cF0>
<a name="l141"></a> }
<a name="l142"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l143"></a> res += </span><span class=cF5>CeilU64</span><span class=cF0>(tmpde-&gt;size, </span><span class=cF3>BLK_SIZE</span><span class=cF0>);
<a name="l144"></a>
<a name="l145"></a> tmpde = tmpde-&gt;next;
<a name="l146"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l147"></a> res += </span><span class=cF5>CeilU64</span><span class=cF0>(dir_entry_count &lt;&lt; </span><span class=cFE>6</span><span class=cF0>, </span><span class=cF3>BLK_SIZE</span><span class=cF0>); </span><span class=cF2>//Size in bytes</span><span class=cF0>
<a name="l148"></a>
<a name="l149"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF3>CDIR_SIZE</span><span class=cF0> == </span><span class=cFE>64</span><span class=cF0>
<a name="l150"></a>
<a name="l151"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l152"></a>}
<a name="l153"></a>
<a name="l154"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaISO</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_iso_filename=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *_src_dir, </span><span class=cF1>U8</span><span class=cF0> *_stage2_filename=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l155"></a>{</span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Misc/DoDistro.ZC.html#l1"><span class=cF4>::/Misc/DoDistro.ZC</span></a><span class=cF2>. Must be ISO.C</span><span class=cF0>
<a name="l156"></a> </span><span class=cF9>I64</span><span class=cF0> i, res, root_count, root_dir_blks, bitmap_blks, bitmap_blks1;
<a name="l157"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde;
<a name="l158"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>], *iso_filename, *src_dir, *stage2_filename;
<a name="l159"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive = </span><span class=cF5>DriveMakeFreeSlot</span><span class=cF0>(</span><span class=cF5>DriveNextFreeLet</span><span class=cF7>(</span><span class=cF6>'Q'</span><span class=cF7>)</span><span class=cF0>); </span><span class=cF2>//First </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3281"><span class=cF4>BDT_ISO_FILE_WRITE</span></a><span class=cF0>
<a name="l160"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd = </span><span class=cF5>BlkDevNextFreeSlot</span><span class=cF0>(drive-&gt;drv_let, </span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>);
<a name="l161"></a>
<a name="l162"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsDir</span><span class=cF7>(</span><span class=cF0>_src_dir</span><span class=cF7>)</span><span class=cF0>)
<a name="l163"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;'%s' is not a dir.\n&quot;</span><span class=cF0>, _src_dir);
<a name="l164"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l165"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (!_iso_filename)
<a name="l167"></a> _iso_filename = </span><span class=cFB>blkdev</span><span class=cF0>.default_iso_c_filename;
<a name="l168"></a>
<a name="l169"></a> iso_filename = </span><span class=cF5>ExtChange</span><span class=cF0>(_iso_filename, </span><span class=cF6>&quot;ISO.C&quot;</span><span class=cF0>);
<a name="l170"></a> src_dir = </span><span class=cF5>DirNameAbs</span><span class=cF0>(_src_dir);
<a name="l171"></a>
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (_stage2_filename)
<a name="l173"></a> {
<a name="l174"></a> stage2_filename = </span><span class=cF5>FileNameAbs</span><span class=cF0>(_stage2_filename);
<a name="l175"></a> *stage2_filename = drive-&gt;drv_let;
<a name="l176"></a>
<a name="l177"></a> i = </span><span class=cF5>StrLen</span><span class=cF0>(src_dir);
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (i != </span><span class=cFE>3</span><span class=cF0>) </span><span class=cF2>//If not root</span><span class=cF0>
<a name="l179"></a> i++; </span><span class=cF2>//Skip slash</span><span class=cF0>
<a name="l180"></a>
<a name="l181"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(stage2_filename + </span><span class=cFE>3</span><span class=cF0>, stage2_filename + i);
<a name="l182"></a> }
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l184"></a> stage2_filename = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l185"></a>
<a name="l186"></a> tmpde = </span><span class=cF5>FilesFind</span><span class=cF0>(src_dir, </span><span class=cF3>FUF_RECURSE</span><span class=cF0>);
<a name="l187"></a> root_count = </span><span class=cF5>LinkedListCount</span><span class=cF0>(tmpde) + </span><span class=cFE>3</span><span class=cF0>;
<a name="l188"></a> root_dir_blks = </span><span class=cF5>CeilU64</span><span class=cF0>(root_count &lt;&lt; </span><span class=cFE>6</span><span class=cF0>, </span><span class=cF3>BLK_SIZE</span><span class=cF0>) &gt;&gt; </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
<a name="l189"></a>
<a name="l190"></a> </span><span class=cF1>if</span><span class=cF0> (res = </span><span class=cF5>RedSeaISOPass1</span><span class=cF7>(</span><span class=cF0>tmpde</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>)
<a name="l191"></a> {
<a name="l192"></a> bd-&gt;drv_offset = </span><span class=cFE>19</span><span class=cF0> &lt;&lt; </span><span class=cFE>2</span><span class=cF0> + (</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> + </span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>) / </span><span class=cF3>BLK_SIZE</span><span class=cF0>;
<a name="l193"></a> bitmap_blks = </span><span class=cFE>1</span><span class=cF0>;
<a name="l194"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l195"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l196"></a> bitmap_blks1 = bitmap_blks;
<a name="l197"></a> bitmap_blks = (res + bitmap_blks + </span><span class=cF3>BLK_SIZE</span><span class=cF0> &lt;&lt; </span><span class=cFE>3</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) / </span><span class=cF3>BLK_SIZE</span><span class=cF0> &lt;&lt; </span><span class=cFE>3</span><span class=cF0>;
<a name="l198"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l199"></a> </span><span class=cF1>while</span><span class=cF0> (bitmap_blks != bitmap_blks1);
<a name="l200"></a>
<a name="l201"></a> bd-&gt;max_blk = </span><span class=cF5>CeilI64</span><span class=cF0>(bd-&gt;drv_offset + </span><span class=cFE>1</span><span class=cF0> + bitmap_blks + res, </span><span class=cFE>4</span><span class=cF0>);
<a name="l202"></a> bd-&gt;max_blk--; </span><span class=cF2>//Inclusive.</span><span class=cF0>
<a name="l203"></a> bd-&gt;file_disk_name = </span><span class=cF5>SysStrNew</span><span class=cF0>(iso_filename);
<a name="l204"></a> bd-&gt;init_root_dir_blks = root_dir_blks;
<a name="l205"></a> </span><span class=cF5>BlkDevAdd</span><span class=cF0>(bd,, </span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l206"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;%C:/&quot;</span><span class=cF0>, drive-&gt;drv_let);
<a name="l207"></a> </span><span class=cF5>CopyTree</span><span class=cF0>(src_dir, buf, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l208"></a> </span><span class=cF5>RedSeaISO9660Stage1</span><span class=cF0>(iso_filename, stage2_filename);
<a name="l209"></a> </span><span class=cF5>DriveDel</span><span class=cF0>(drive);
<a name="l210"></a> </span><span class=cF5>BlkDevDel</span><span class=cF0>(bd);
<a name="l211"></a> }
<a name="l212"></a> </span><span class=cF5>Free</span><span class=cF0>(stage2_filename);
<a name="l213"></a> </span><span class=cF5>Free</span><span class=cF0>(src_dir);
<a name="l214"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_filename);
<a name="l215"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l216"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l217"></a>}
</span></pre></body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<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=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);;
<a name="l2"></a>
<a name="l3"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootDVDIns&quot;</span><span class=cF0>
<a name="l4"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootHDIns&quot;</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootMHDIns&quot;</span><span class=cF0>
<a name="l6"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;BootRAM&quot;</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a></span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF6>&quot;..&quot;</span><span class=cF0>);;
</span></pre></body>
</html>

View file

@ -5,6 +5,7 @@
<meta name="generator" content="ZealOS V1.08">
<style type="text/css">
body {background-color:#1f1f1f;}
.c0F{color:#1f1f1f;background-color:#e3e3e3;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
@ -41,8 +42,8 @@ body {background-color:#1f1f1f;}
<a name="l14"></a>
<a name="l15"></a> </span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootDVD.ZC.html#l3"><span class=cF4>DD_BOOT_HIGH_LOC_DVD</span></a><span class=cF0>
<a name="l16"></a></span><span class=cF5>
<a name="l17"></a>+] LineRep</span><span class=cF0>
<a name="l18"></a>
<a name="l17"></a>+] LineRep</span><span class=c0F>
<a name="l18"></a></span><span class=cF0>
<a name="l19"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>&quot;DD_MP_VECT&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%08X&quot;</span><span class=cF0>, </span><span class=cF3>MP_VECT_ADDR</span><span class=cF0>);
<a name="l20"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>&quot;DD_MP_VECT_END&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%08X&quot;</span><span class=cF0>, </span><span class=cF3>MP_VECT_ADDR</span><span class=cF0> + </span><span class=cFD>COREAP_16BIT_INIT_END</span><span class=cF0> - </span><span class=cFD>COREAP_16BIT_INIT</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
<a name="l21"></a>

File diff suppressed because it is too large Load diff