Lines Matching +full:0 +full:x7c00

26 #define B0_BASE	0x1ae	/* move the internal data area */
29 #define B0_BASE 0x1b2
49 * bootloader) at 0:0x7c00. This code depends on %cs:%ip being 0:0x7c00
54 * The area at offset 0x1b2 contains a magic string ('Drive '), also
62 * As in every Master Boot Record, the partition table is at 0x1be,
66 * 0 1 status (0x80: bootable, 0: non bootable)
68 * 8:head, 6:sector, 2:cyl bit 9..8, 8:cyl bit 7..0
74 * and followed by the two bytes 0x55, 0xAA (MBR signature).
83 * %cs:%ip 0:0x7c00
84 * %dl drive number (0x80, 0x81, ... )
90 * This boot block first relocates itself at a different address (0:0x600),
91 * to free the space at 0:0x7c00 for the next stage boot block.
93 * It then initializes some memory at 0:0x800 and above (pointed by %bp)
98 * The variables at 0x1b2 are accessed as negative offsets from %bp.
106 * control is transferred to the newly loaded code at 0:0x7c00.
112 * NHRDRV is the address in segment 0 where the BIOS writes the
119 * it cannot be changed. Computed as a negative offset from 0x200
123 .set NHRDRV,0x475 # Number of hard drives
124 .set ORIGIN,0x600 # Execution address
125 .set LOAD,0x7c00 # Load address
127 .set PRT_OFF,0x1be # Partition table
128 .set B0_OFF,(B0_BASE-0x200) # Offset of boot0 data
130 .set MAGIC,0xaa55 # Magic: bootable
132 .set KEY_ENTER,0x1c # Enter key scan code
133 .set KEY_F1,0x3b # F1 key scan code
134 .set KEY_1,0x02 # #1 key scan code
137 .set ASCII_CR,0x0D # ASCII code for <CR>
149 .set SETDRV, 0x20 # the 'setdrv' flag
150 .set NOUPDATE, 0x40 # the 'noupdate' flag
151 .set USEPACKET, 0x80 # the 'packet' flag
154 .set _TICKS, (PRT_OFF - 0x200 - 2) # Timeout ticks
155 .set _MNUOPT, 0x10 # Saved menu entries
164 * segments start at 0.
168 * the 0x55, 0xaa at the end, as an identifier for version 1.0
170 * In version 1.0 the parameter table (_NEXTDRV etc) is at 0x1b9
180 * Copy this code to the address it was linked for, 0x600 by default.
184 movw $0x100,%cx # Word count
188 * After the code, (i.e. at %di+0, 0x800) create a partition entry,
189 * initialized to LBA 0 / CHS 0:0:1.
194 movb $0x8,%cl # Words to clear
197 incb -0xe(%di) # Set the S field to 1
202 #if defined(SIO) && COMSPEED != 0
224 js save_curdrive # Possibly (0x80 set)
234 * is normally used for the state of the partition (0x80 or 0x00),
235 * but we abuse it as it is very convenient to access at offset 0.
252 movw $(partbl+0x4),%bx # Partition table (+4)
259 read_entry: movb %ch,-0x4(%bx) # Zero active flag (ch == 0)
287 addb $0x10,%bl # Next entry
292 * Note that if we started from a floppy, %dl was 0 so we still
296 subb $0x80-0x1,%al # Does next
302 decw %ax # Already drive 0?
305 * If it was illegal or we cycled through them, go back to drive 0.
307 xorb %al,%al # Drive 0
311 * This digit is also part of the printed drive string, so add 0x80
314 print_drive: addb $'0'|0x80,%al # Save next
341 int $0x1a # system time
349 movb $0x1,%ah # BIOS: Check
350 int $0x16 # for keypress
352 movb $0x03,%ah # BIOS: Read COM
354 testb $0x01,%ah # Check line status
358 xorb %ah,%ah # BIOS: int 0x1a, 00
359 int $0x1a # get system time
373 * Otherwise convert F1..F6 (or '1'..'6') to 0..5 and check if the
379 xorb %ah,%ah # BIOS: int 0x16, 00
380 int $0x16 # get keypress
384 movb $0x02,%ah # BIOS: Receive
401 cmpb $0x5,%al # F1..F6
408 cmpb $0x5,%al # F1..F6 or 1..6 ?
411 int $0x18 # found F6, try INT18
421 cbtw # Extend (%ah=0 used later)
431 * Make %si and %bx point to the fake partition at LBA 0 (CHS 0:0:1).
433 * Set %dl with the drive number saved in byte 0.
440 cmpb $0x4,%al # F5/#5 pressed?
448 shlb $0x4,%al # Point to
451 movb $0x80,(%bx) # Flag active
453 * If not asked to do a write-back (flags 0x40) don't do one.
461 movb $0x3,%ah # Write sector
467 * Remember to un-ascii it. Hey 0x80 is already set, cool!
472 subb $'0',%dl # number
475 * fails or there is no 0x55aa marker, treat it as a bad selection.
478 movb $0x2,%ah # Read sector
481 cmpw $MAGIC,0x1fe(%bx) # Bootable?
523 testb $0x80,%al # End of string?
525 andb $~0x80,%al # Clear MSB then print last
530 movw $0x7,%bx # Page:attribute
531 movb $0xe,%ah # BIOS: Display
532 int $0x10 # character
535 movb $0x01,%ah # BIOS: Send character
539 int $0x14 # BIOS: Serial I/O
553 movb 0x1(%si),%dh # Load head
554 movw 0x2(%si),%cx # Load cylinder:sector
555 movb $0x1,%al # Sector count
564 pushl $0x0 # Set the
565 pushl 0x8(%si) # LBA address
568 push $0x1 # Block count
569 push $0x10 # Packet size
572 orb $0x40,%ah # Use disk packet
573 1: int $0x13 # BIOS: Disk I/O
587 item: .ascii " "; .byte ' '|0x80
588 crlf: .ascii "\r"; .byte '\n'|0x80
598 .byte 0x83, 0xa5, 0xa6, 0xa9, 0x06, 0x07, 0x0b
600 .byte 0x05 # extended partition
603 .byte 0x01 # FAT12
604 .byte 0x04 # FAT16 < 32M
634 os_misc: .byte '?'|0x80
637 .ascii "DO"; .byte 'S'|0x80
639 os_win: .ascii "Wi"; .byte 'n'|0x80
640 os_linux: .ascii "Linu"; .byte 'x'|0x80
642 os_bsd: .ascii "BS"; .byte 'D'|0x80
644 os_ext: .ascii "EX"; .byte 'T'|0x80
647 .org (0x200 + B0_OFF),0x90
657 nxtdrv: .byte 0x0 # Next drive number
658 opt: .byte 0x0 # Option
659 setdrv_num: .byte 0x80 # Drive to force
662 .byte 0xa8,0xa8,0xa8,0xa8 # Volume Serial Number
670 partbl: .fill 0x40,0x1,0x0 # Partition table
672 .org 0x200 # again, safety check