X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=kern%2Fsrc%2Fboot.asm;fp=kern%2Fsrc%2Fboot.asm;h=25486e63f4fbdd8a386d8508cbaf4a4b623aafe0;hb=88e57cf7f2581900eb31cb835a18ad414e37786c;hp=5be618b007a57f605d1095f24bd8b647d8bd45f7;hpb=5145ed1e2adefc9c66e20681532a3a7cd6c2de01;p=eightysix diff --git a/kern/src/boot.asm b/kern/src/boot.asm index 5be618b..25486e6 100644 --- a/kern/src/boot.asm +++ b/kern/src/boot.asm @@ -3,18 +3,19 @@ bits 16 section .bootsect +extern _bootsect_start extern _kern_start_seg extern _kern_size -boot_driveno equ 7b00h -num_read_tries equ 7b06h ; 2 bytes -sect_pending equ 7b08h ; 2 bytes -sect_per_track equ 7b0ah ; 2 bytes -cur_head equ 7b0ch ; 2 bytes - current head -start_sect equ 7b0eh ; 2 bytes - start sector in track -destptr equ 7b10h ; 2 bytes - destination pointer -num_heads equ 7b12h ; 2 bytes - number of heads -cur_cyl equ 7b14h ; 2 bytes - current cylinder +boot_driveno equ 0500h +num_read_tries equ 0506h ; 2 bytes +sect_pending equ 0508h ; 2 bytes +sect_per_track equ 050ah ; 2 bytes +cur_head equ 050ch ; 2 bytes - current head +start_sect equ 050eh ; 2 bytes - start sector in track +destptr equ 0510h ; 2 bytes - destination pointer +num_heads equ 0512h ; 2 bytes - number of heads +cur_cyl equ 0514h ; 2 bytes - current cylinder %macro floppy_motor_off 0 pushf @@ -66,10 +67,17 @@ start: mov ds, ax mov es, ax mov ss, ax + mov [boot_driveno], dl ; save boot drive number + + ; relocate boot sector to 600h + mov si, 0x7c00 + mov di, _bootsect_start + mov cx, 256 + rep movsw + jmp 00:.setcs .setcs: - mov sp, 0x7b00 ; temp stack below our vars - mov [boot_driveno], dl + mov sp, _bootsect_start ; temp stack below our relocated address ; query sectors per track mov ah, 8 ; get drive parameters call, dl already has the drive