1 /* boot loader for Marmot */
3 /* 2k stack starting at 0x6000 */
7 #define LOADER_START 0x8000
17 /* BIOS parameter block */
26 sectors_per_allocation_unit:
37 .byte 0xf0 /* 3.5" floppy */
48 sectors_in_volume_long:
59 .global bootPreferredVideoMode
60 bootPreferredVideoMode:
61 .word 0x0144 /* 1280x1024x32bpp */
81 * Initialize the display.
86 movb $0x03, %al /* ah is already zeroed */
101 * Position the cursor to the coordinates in dx.
115 * Print the message pointed to by si.
133 * Load the rest of the boot loader from disk into memory.
140 /* Get driver parameters */
149 1: /* Important values from int 13,8 are:
150 * cx[5:0] - sectors per track
156 movb %cl, sectorsPerTrack
164 cmpw loaderSectors, %ax
184 /* read failed - reset and try again */
189 /* oops - too many tries */
193 1: addw $0x20, esSave
202 * Convert the block number in ax to a CHS value in cx and dh.
204 * Clobbers ax, cx, dx
223 shl $8, %dx /* dh => head */
225 shl $8, %cx /* ch => low 8 bits of cylinder */
230 and $0x3f, %cl /* cl[5:0] => sector */
231 or %al, %cl /* cl[7:6] => high 2 bits of cylinder */
241 * Reset the disk controller for the boot device.
252 1: mov $resetFailed, %si
260 * Print the message pointed to by %si and halt.
263 .global Die /* so it's visible to VProbes */
279 /* %ss/%sp values for lss - saves a byte over two movs */
281 .word BOOT_SP, BOOT_SS
282 /* %es value during load loop */
284 .word LOADER_START >> 4
285 /* start of string for Die */
288 /* end of string for Die */
291 /* various strings for error messages */
300 /* Master boot record */
315 * Scratch area for the boot loader located at 0x7e00.