templeos-info/public/Wb/Adam/Opt/Boot/BootMHD2.HC.HTML

155 lines
17 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>MODULE_SIZE</span><span class=cF0> 2*</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>-\
<a name="l3"></a> (</span><span class=cF3>BOOT_STK_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;4)
<a name="l4"></a>
<a name="l5"></a></span><span class=cF5>DefinePrint</span><span class=cF0>(
<a name="l6"></a> </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;4);
<a name="l7"></a>
<a name="l8"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l9"></a></span><span class=cF1>USE16</span><span class=cF0>
<a name="l10"></a></span><span class=cFD>BMHD2_START</span><span class=cF0>::
<a name="l11"></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>:[0],</span><span class=cF6>'B'</span><span class=cF0>+0x2000+(</span><span class=cF6>'2'</span><span class=cF0>+0x2000)&lt;&lt;16
<a name="l12"></a>
<a name="l13"></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="l14"></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="l15"></a></span><span class=cF2>//This copies this bootloader's code to 0x00096A00</span><span class=cF0>
<a name="l16"></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="l17"></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="l18"></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="l19"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> [BMHD2_BIOS_DRV_NUM-</span><span class=cFD>BMHD2_START</span><span class=cF0>],</span><span class=cFC>DL</span><span class=cF0>
<a name="l20"></a>
<a name="l21"></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="l22"></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="l23"></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="l24"></a> </span><span class=cF1>REP_MOVSB</span><span class=cF0>
<a name="l25"></a>
<a name="l26"></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="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>
<a name="l29"></a></span><span class=cF2>//My assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l30"></a> </span><span class=cF1>DU8</span><span class=cF0> 0xEA; </span><span class=cF2>//JMP BOOT_HIGH_LOC_MHD2:BMHD2_HISTART</span><span class=cF0>
<a name="l31"></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="l32"></a>
<a name="l33"></a></span><span class=cFD>BMHD2_BOOT_MSG</span><span class=cF0>::
<a name="l34"></a> </span><span class=cF1>DU8</span><span class=cF0> 256 </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l35"></a>
<a name="l36"></a>BMHD2_BIOS_DRV_NUM: </span><span class=cF1>DU8</span><span class=cF0> 0;
<a name="l37"></a>BMHD2_PAGE: </span><span class=cF1>DU8</span><span class=cF0> 0;
<a name="l38"></a></span><span class=cFD>BMHD2_BLK_ARRAY</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 8 </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l39"></a>
<a name="l40"></a>BMHD2_DAP: </span><span class=cF1>DU8</span><span class=cF0> 16,0,1,0; </span><span class=cF2>//One blk at a time</span><span class=cF0>
<a name="l41"></a>BMHD2_DAP_BUF: </span><span class=cF1>DU16</span><span class=cF0> 0,0;
<a name="l42"></a></span><span class=cFD>BMHD2_DAP_BLK</span><span class=cF0>:: </span><span class=cF2>//64-bit</span><span class=cF0>
<a name="l43"></a>BMHD2_DAP_BLK_LO: </span><span class=cF1>DU32</span><span class=cF0> 0;
<a name="l44"></a>BMHD2_DAP_BLK_HI: </span><span class=cF1>DU32</span><span class=cF0> 0;
<a name="l45"></a>
<a name="l46"></a></span><span class=cFD>BMHD2_PUT_CHAR</span><span class=cF0>::
<a name="l47"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>,0xE
<a name="l48"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BL</span><span class=cF0>,7 </span><span class=cF2>//Might be foreground color on some BIOS's</span><span class=cF0>
<a name="l49"></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="l50"></a> </span><span class=cF1>INT</span><span class=cF0> 0x10
<a name="l51"></a></span><span class=cFD>BMHD2_RET</span><span class=cF0>::
<a name="l52"></a> </span><span class=cF1>RET</span><span class=cF0>
<a name="l53"></a></span><span class=cFD>BMHD2_PUTS</span><span class=cF0>::
<a name="l54"></a>@@1: </span><span class=cF1>LODSB</span><span class=cF0>
<a name="l55"></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="l56"></a> </span><span class=cF1>JZ</span><span class=cF0> </span><span class=cFD>BMHD2_RET</span><span class=cF0>
<a name="l57"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BMHD2_PUT_CHAR</span><span class=cF0>
<a name="l58"></a> </span><span class=cF1>JMP</span><span class=cF0> @@1
<a name="l59"></a>
<a name="l60"></a>BMHD2_GETCHAR:
<a name="l61"></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="l62"></a> </span><span class=cF1>INT</span><span class=cF0> 0x16
<a name="l63"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l64"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>,0x0E
<a name="l65"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>BX</span><span class=cF0>,0x07
<a name="l66"></a> </span><span class=cF1>INT</span><span class=cF0> 0x10
<a name="l67"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>
<a name="l68"></a> </span><span class=cF1>RET</span><span class=cF0>
<a name="l69"></a>
<a name="l70"></a>BMHD2_HISTART:
<a name="l71"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>,0xF
<a name="l72"></a> </span><span class=cF1>INT</span><span class=cF0> 0x10
<a name="l73"></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="l74"></a>
<a name="l75"></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>:[0],0
<a name="l76"></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_MSG</span><span class=cF0>-</span><span class=cFD>BMHD2_START</span><span class=cF0>
<a name="l77"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>BMHD2_PUTS</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>CALL</span><span class=cF0> BMHD2_GETCHAR
<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>'0'</span><span class=cF0>
<a name="l80"></a> </span><span class=cF1>JB</span><span class=cF0> @@5
<a name="l81"></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="l82"></a> </span><span class=cF1>JAE</span><span class=cF0> @@5
<a name="l83"></a> </span><span class=cF1>AND</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>,7
<a name="l84"></a>
<a name="l85"></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>*8]
<a name="l86"></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>+4-</span><span class=cFD>BMHD2_START</span><span class=cF0>[</span><span class=cFC>EAX</span><span class=cF0>*8]
<a name="l87"></a>
<a name="l88"></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="l89"></a> </span><span class=cF1>JNZ</span><span class=cF0> @@10
<a name="l90"></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="l91"></a> </span><span class=cF1>JZ</span><span class=cF0> @@5
<a name="l92"></a>
<a name="l93"></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="l94"></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="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=cF9>U16</span><span class=cF0> [BMHD2_OLD_CS_RIP-</span><span class=cFD>BMHD2_START</span><span class=cF0>]
<a name="l97"></a> </span><span class=cF1>SHR</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>,4
<a name="l98"></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+2-</span><span class=cFD>BMHD2_START</span><span class=cF0>]
<a name="l99"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U16</span><span class=cF0> [BMHD2_DAP_BUF+2-</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="l100"></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="l101"></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_DRV_NUM-</span><span class=cFD>BMHD2_START</span><span class=cF0>]
<a name="l102"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AH</span><span class=cF0>,0x42
<a name="l103"></a> </span><span class=cF1>INT</span><span class=cF0> 0x13
<a name="l104"></a>
<a name="l105"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>EBP</span><span class=cF0>
<a name="l106"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>EDX</span><span class=cF0>
<a name="l107"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>EBX</span><span class=cF0>
<a name="l108"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>
<a name="l109"></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="l110"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>GS</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>FS</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>
<a name="l113"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>
<a name="l114"></a> </span><span class=cF1>POPFW</span><span class=cF0>
<a name="l115"></a>
<a name="l116"></a></span><span class=cF2>//My assembler doesn't support 16-bit very well.</span><span class=cF0>
<a name="l117"></a> </span><span class=cF1>DU8</span><span class=cF0> 0xEA; </span><span class=cF2>//JMP xxxx:yyyy</span><span class=cF0>
<a name="l118"></a>BMHD2_OLD_CS_RIP:
<a name="l119"></a> </span><span class=cF1>DU16</span><span class=cF0> 0,0;
<a name="l120"></a></span><span class=cFD>BMHD2_END</span><span class=cF0>::
<a name="l121"></a></span><span class=cF2>//Continues here </span><a href="/Wb/Adam/Opt/Boot/BootHD.HC.HTML#l12"><span class=cF4>::/Adam/Opt/Boot/BootHD.HC</span></a><span class=cF0>
<a name="l122"></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="l123"></a>}
</span></pre></body>
</html>