<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://www.cse.unl.edu/~jgompert/OS/lesson1.htm -->
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD><TITLE>Write Your Own Operating System - Lesson 1</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content=Word.Document name=ProgId>
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<META content="Microsoft Word 9" name=Originator><LINK
href="./lesson1_files/filelist.xml" rel=File-List><!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>Joel Matthias Gompert</o:Author>
<o:LastAuthor>Joel Matthias Gompert</o:LastAuthor>
<o:Revision>12</o:Revision>
<o:TotalTime>17</o:TotalTime>
<o:Created>2001-12-28T02:59:00Z</o:Created>
<o:LastSaved>2001-12-28T04:42:00Z</o:LastSaved>
<o:Pages>3</o:Pages>
<o:Words>1070</o:Words>
<o:Characters>6103</o:Characters>
<o:Company>The Flaming Gymsocks</o:Company>
<o:Lines>50</o:Lines>
<o:Paragraphs>12</o:Paragraphs>
<o:CharactersWithSpaces>7494</o:CharactersWithSpaces>
<o:Version>9.2720</o:Version>
</o:DocumentProperties>
</xml><![endif]-->
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; mso-header-margin: .5in; mso-footer-margin: .5in; mso-paper-source: 0; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 12pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-weight: bold
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 12pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-weight: bold
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 12pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-weight: bold
}
H1 {
FONT-SIZE: 16pt; MARGIN: 0in 0in 12pt; FONT-FAMILY: Arial; mso-pagination: widow-orphan; mso-bidi-font-weight: normal; mso-style-next: Normal; mso-outline-level: 1; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: "Courier New"; mso-font-kerning: 0pt
}
P.MsoTitle {
FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0in 3pt; FONT-FAMILY: Arial; TEXT-ALIGN: center; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"; mso-outline-level: 1; mso-font-kerning: 14.0pt
}
LI.MsoTitle {
FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0in 3pt; FONT-FAMILY: Arial; TEXT-ALIGN: center; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"; mso-outline-level: 1; mso-font-kerning: 14.0pt
}
DIV.MsoTitle {
FONT-WEIGHT: bold; FONT-SIZE: 16pt; MARGIN: 12pt 0in 3pt; FONT-FAMILY: Arial; TEXT-ALIGN: center; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"; mso-outline-level: 1; mso-font-kerning: 14.0pt
}
P.MsoBodyText {
FONT-SIZE: 12pt; MARGIN: 0in 0in 12pt; FONT-FAMILY: "Times New Roman"; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
LI.MsoBodyText {
FONT-SIZE: 12pt; MARGIN: 0in 0in 12pt; FONT-FAMILY: "Times New Roman"; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
DIV.MsoBodyText {
FONT-SIZE: 12pt; MARGIN: 0in 0in 12pt; FONT-FAMILY: "Times New Roman"; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
DIV.Section1 {
page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US style="tab-interval: .5in" vLink=purple link=blue>
<DIV class=Section1>
<P class=MsoTitle><A name=_Toc534120514>Write Your Own Operating System
Tutorial</A></P>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 1pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 0.75pt solid">
<P class=MsoNormal
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-border-bottom-alt: solid windowtext .75pt; mso-padding-alt: 0in 0in 1.0pt 0in"><SPAN
style="mso-bookmark: _Toc534120514"></SPAN><A
href="http://www.cse.unl.edu/~jgompert/OS/introduction.htm"><SPAN
style="mso-bookmark: _Toc534120514">Previous</SPAN><SPAN
style="mso-bookmark: _Toc534120514"></SPAN></A><SPAN
style="mso-bookmark: _Toc534120514"><SPAN
style="mso-tab-count: 1">
</SPAN></SPAN><A
href="http://www.cse.unl.edu/~jgompert/OS/TableOfContents.htm"><SPAN
style="mso-bookmark: _Toc534120514">Table of Contents</SPAN><SPAN
style="mso-bookmark: _Toc534120514"></SPAN></A><SPAN
style="mso-bookmark: _Toc534120514"><SPAN
style="mso-tab-count: 1">
</SPAN></SPAN><A href="http://www.cse.unl.edu/~jgompert/OS/lesson2.htm"><SPAN
style="mso-bookmark: _Toc534120514">Next Lesson</SPAN><SPAN
style="mso-bookmark: _Toc534120514"></SPAN></A><SPAN
style="mso-bookmark: _Toc534120514"></SPAN></P></DIV><SPAN
style="mso-bookmark: _Toc534120514"></SPAN>
<H1>Lesson 1: The Boot Sector</H1>
<P class=MsoNormal>In this lesson well learn about the contents of the boot
sector so that we can learn to write our own boot program.</P>
<P class=MsoNormal>When the computer boots from a floppy, BIOS (Basic
Input/Output System) reads the disk and loads the first sector into memory at
address 0000:7C00.<SPAN style="mso-spacerun: yes"> </SPAN>This first
sector is called the DOS Boot Record (DBR).<SPAN
style="mso-spacerun: yes"> </SPAN>BIOS jumps to the address 0x7C00 and
begins executing instructions there.<SPAN style="mso-spacerun: yes">
</SPAN>It is these instructions (the boot loader) that will load the operating
system (OS) into memory and begin the OSs boot process.</P>
<P class=MsoNormal>The first thing to do is to take a look inside the Boot
Record.<SPAN style="mso-spacerun: yes"> </SPAN>The DOS utility DEBUG is a
widely available tool that can be used to view the contents of memory and
disks.<SPAN style="mso-spacerun: yes"> </SPAN>Well use DEBUG to look at a
floppy disks Boot Record.</P>
<P class=MsoNormal>At a DOS (or Windows) command prompt type <SPAN
style="FONT-FAMILY: 'Courier New'">debug</SPAN>.<SPAN
style="mso-spacerun: yes"> </SPAN>This will leave you with just a hyphen
as a prompt.<SPAN style="mso-spacerun: yes"> </SPAN>If you enter letter
d as a command and press Enter, it will show you a portion of the contents of
RAM.<SPAN style="mso-spacerun: yes"> </SPAN>Typing the question mark as a
command will give you a list of all the available commands in DEBUG.<SPAN
style="mso-spacerun: yes"> </SPAN>(<I>Be very careful when using the DEBUG
utility.<SPAN style="mso-spacerun: yes"> </SPAN>This utility can be used
to overwrite data on any disk drive, possibly causing loss of data.)</I></P>
<P class=MsoNormal>Place a freshly formatted disk in the A: drive.<SPAN
style="mso-spacerun: yes"> </SPAN>To load the Boot Record off your floppy
disk, type the following command.</P>
<P class=MsoNormal><SPAN