BCOS 80x86 Stage 1 SourceProject Map
80x86 PC BIOS CD-ROM Boot Loader
File: 80x86/sys_src/p1/pc_bios/bootcd/0index.asm
 

Copyright © Brendan Trotter 2008

This material is provided by Brendan Trotter as a service to interested parties on an "as-is" basis, for informational purposes only. Brendan Trotter assumes no responsibility for any errors or omissions. Brendan Trotter does not make, and expressly disclaims any, representations or warranties, express or implied, regarding this web page and the host web site, including, without limitation, any implied warranties of merchantability or fitness for a particular purpose.

Under no circumstances shall Brendan Trotter, or any associated contributors, volunteers or representatives be liable for any damages, whether direct, indirect, special or consequential damages for lost revenues, lost profits, or otherwise, arising from or in connection with this web page, the host web site, or the materials contained herein.

All materials contained in these files are protected by copyright laws, and may not be reproduced, republished, distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express prior written permission of Brendan Trotter. You may make one copy of this web page for your personal and non-commercial use only, without altering or removing this copyright notice or any other notice.




Overview

This index file determines the layout of all other source files in memory. The final binary is used to boot the OS from a CD using "El Torito" with no emulation.

Like all boot loaders designed for the PC BIOS, this boot loader must comply with the Common PC BIOS Module Transition State Specification.


Start Of Code


Included System Files

The following line/s include standard "include" files into the binary.

24: ;Standard include files
25: 
26: 
%include "asm.inc"
27: %include "kernel/log.inc"
28: %include "kernel/a20.inc"
29: %include "kernel/pasm.inc"
30: %include "ff/header.inc"
31: %include "ff/frl.inc"
32: 
33: 
;CD-ROM boot loader include files
34: 
35: 
%include "options.inc"


Assembler Setup

Here we just tell the assembler what address the code starts at, what mode the CPU is expected to be operating in and which instructions to accept.

Note: This code starts as "8086 compatible", then checks if the CPU meets the operating system's minimum requirements. After this check we tell the assembler to allow the full "80486" instruction set.

47:       ORG 0x7C00
48: 
49: 
      BITS 16
50:       CPU 8086
51: 
52: 
BOOTLOADER_START:
53:       section .bss
54: BSS_START:
55:       section .text


Start of Binary and Entry Point

This is the beginning of the binary, which is also the entry point. When the BIOS starts the boot loader everything should be considered undefined, except for the registers shown below.

A far jump is used deliberately to set CS to a known value, as the BIOS may have used 0x0000:0x7C00 or 0x07C0:0x0000 as the entry point.

68:       jmp START


Source Code - Part 1

This is code that must be in the first 512 bytes of the boot loader.

77: %include "part1/init.asm"
78: %include "part1/abort.asm"
79: %include "part1/video/init.asm"
80: %include "part1/video/print.asm"
81: %include "part1/data.asm"
82: 
83: 
      times ($$-$+0x01FE) db 0x00
84:       dw 0xAA55


Source Code - Part 2

This is code that must be in the first 2048 bytes of the boot loader.

 92: %include "part2/data.asm"
 93: %include "part2/init.asm"
 94: %include "part2/cpu.asm"
 95: 
 96: 
      CPU 486
 97: 
 98: 
%include "part2/load1.asm"
 99: %include "part2/diskerr.asm"
100: %include "part2/log/init.asm"
101: %include "part2/log/addchar.asm"
102: %include "part2/log/addstrng.asm"
103: 
104: 
      times ($$-$+2040) db 0x00
105: SECTOR2_SIGNATURE:
106:       db '<{BCOS}>'


Source Code - Part 3

113: %include "part3/data.asm"
114: %include "part3/init.asm"
115: %include "part3/progress.asm"
116: %include "part3/files.asm"
117: %include "part3/load2.asm"
118: %include "part3/log/addchar.asm"
119: %include "part3/log/adddec.asm"
120: %include "part3/log/addhex.asm"
121: %include "part3/log/movelog.asm"
122: %include "part3/gatea20.asm"
123: %include "part3/goflat.asm"
124: %include "part3/pasm/init.asm"
125: %include "part3/pasm/addentry.asm"
126: %include "part3/pasm/probe.asm"
127: %include "part3/pasm/cmos.asm"
128: %include "part3/pasm/88.asm"
129: %include "part3/pasm/da88.asm"
130: %include "part3/pasm/8a.asm"
131: %include "part3/pasm/c7.asm"
132: %include "part3/pasm/e801.asm"
133: ;%include "part3/pasm/e881.asm"           ;Disabled due to buggy BIOSs (see note in "part3/pasm/init.asm")
134: %include "part3/pasm/e820.asm"
135: %include "part3/pasm/e820acpi.asm"
136: %include "part3/pasm/showpasm.asm"
137: %include "part3/pasm/findtop.asm"
138: %include "part3/pasm/movepasm.asm"
139: %include "part3/pasm/foreach.asm"
140: %include "part3/nff/precheck.asm"
141: %include "part3/nff/crc.asm"
142: %include "part3/frl/init.asm"
143: %include "part3/frl/check.asm"
144: %include "part3/frl/movefrl.asm"
145: %include "part3/frl/bitmap.asm"
146: %include "part3/frl/chcktrust.asm"
147: %include "part3/frl/clean.asm"
148: %include "part3/mem/init.asm"
149: %include "part3/mem/alloc.asm"
150: %include "part3/mem/secbuff.asm"
151: %include "part3/mem/free.asm"
152: %include "part3/mem/test.asm"
153: %include "part3/mem/show.asm"
154: %include "part3/file/start.asm"
155: %include "part3/file/end.asm"
156: %include "part3/commonpc/init.asm"
157: %include "part3/commonpc/start.asm"
158: %include "part3/script/init.asm"
159: %include "part3/image/init.asm"
160: %include "part3/bcat/init.asm"
161: %include "part3/bcat/addentry.asm"
162: %include "part3/bcat/finalize.asm"


The End

Here we define a few labels that are used later.

171: END_SIGNATURE:
172:       db '<{BCOS}>'
173:       align 2048
174: BOOTLOADER_END:
175:       section .bss
176:       alignb 4
177: BSS_END:


Generated on Fri Oct 30 10:06:05 2009