;/* ;*MicrosoftConfidential ;*Copyright(C)MicrosoftCorporation1983-1991 ;*AllRightsReserved. ;*/ ;BOOT-IBMharddiskbootrecord6/8/82 ; ; ;Thisisthestandardbootrecordthatwillbeshippedonallharddisks.Itcontains: 逆@风@者 ; ;1.Codetoload(andgivecontrolto)thebootrecordfor1of4possible ;operatingsystems. ; ;2.Apartitiontableattheendofthebootrecord,followedbytherequiredsignature. ; ; _datasegmentpublic assumecs:_data,ds:_data org600h cli;nointerruptsfornow xorax,ax movss,ax movsp,7c00h;newstackat0:7c00 movsi,sp;wherethisbootrecordstarts-0:7c00 pushax popes;segregsthesame pushax popds sti;interruptsoknow cld movdi,0600h;wheretorelocatethisbootrecordto movcx,100h repnzmovsw;relocateto0:0600 ;jmpentry2 db0eah dw$ 4,0 entry2: movsi,offsettab;partitiontable movbl,4;numberoftableentries next: cmpbyteptr[si],80h;isthisabootableentry? jeboot;yes cmpbyteptr[si],0;no,isbootindicatorzero? jnebad;no,itmustbex"00"orx"80"tobevalid addsi,16;yes,gotonextentry decbl jnznext int18h;nobootableentries-gotorombasic boot: movdx,[si];headanddrivetobootfrom movcx,[si 2];cyl,sectortobootfrom movbp,si;savetableentryaddresstopasstopartitionbootrecord next1: addsi,16;nexttableentry decbl;#entriesleft jztabok;allentrieslookok cmpbyteptr[si],0;allremainingentriesshouldbeginwithzero jenext1;thisoneisok bad: movsi,offsetm1;oops-foundanon-zeroentry-thetableisbad msg: lodsb;getamessagecharacter cmpal,0 jehold pushsi movbx,7 movah,14 int10h;anddisplayit popsi jmpmsg;dotheentiremessage ; hold:jmphold;spinhere-nothingmoretodo tabok: movdi,5;retrycount rdboot: movbx,7c00h;wheretoreadsystembootrecord movax,0201h;read1sector pushdi int13h;getthebootrecord popdi jncgoboot;successful-nowgiveitcontrol xorax,ax;hadanerror,so int13h;recalibrate decdi;reduceretrycount jnzrdboot;ifretrycountabovezero,goretry movsi,offsetm2;allretriesdone-permanenterror-pointtomessage, jmpmsg;godisplaymessageandloop goboot: movsi,offsetm3;prepareforinvalidbootrecord movdi,07dfeh cmpwordptr[di],0aa55h;doesthebootrecordhavethe ;requiredsignature? jnemsg;no,displayinvalidsystembootrecordmessage movsi,bp;yes,passpartitiontableentryaddress db0eah dw7c00h,0 includefdisk5.cl1 org7beh tab:;partitiontable dw0,0;partition1begin dw0,0;partition1end dw0,0;partition1relativesector(low,highparts) dw0,0;partition1#ofsectors(low,highparts) dw0,0;partition2begin dw0,0;partition2end dw0,0;partition2relativesector dw0,0;partition2#ofsectors dw0,0;partition3begin dw0,0;partition3end dw0,0;partition3relativesector dw0,0;partition3#ofsectors dw0,0;partition4begin dw0,0;partition4end dw0,0;partition4relativesector dw0,0;partition4#ofsectors signadb55h,0aah;signature _dataends end
|