reorg done
[eightysix] / kern / src / boot.asm
index 96506de..5be618b 100644 (file)
@@ -3,8 +3,8 @@
        bits 16
        section .bootsect
 
-extern _stage2_start_seg
-extern _stage2_size
+extern _kern_start_seg
+extern _kern_size
 
 boot_driveno   equ 7b00h
 num_read_tries equ 7b06h       ; 2 bytes
@@ -57,7 +57,7 @@ bios_param_block:
        db 0            ; 25h: winnt flags
        db 28h          ; 26h: signature(?)
        dd 0            ; 27h: volume serial number
-       db "80 SIX BOOT"; 2bh: volume label, 11 bytes
+       db "86BOOT     "; 2bh: volume label, 11 bytes
        db "FAT12   "   ; 36h: filesystem id, 8 bytes
 
 start:
@@ -65,12 +65,10 @@ start:
        xor ax, ax
        mov ds, ax
        mov es, ax
+       mov ss, ax
        jmp 00:.setcs
 .setcs:
-       ; put the stack high
-       mov ax, 0x7f00
-       mov ss, ax
-       xor sp, sp
+       mov sp, 0x7b00  ; temp stack below our vars
        mov [boot_driveno], dl
 
        ; query sectors per track
@@ -92,13 +90,13 @@ start:
 .querydone:
 
        ; load the rest of the code high
-       mov ax, _stage2_size
+       mov ax, _kern_size
        add ax, 511
        mov cl, 9
        shr ax, cl
        inc ax
        mov [sect_pending], ax
-       mov ax, _stage2_start_seg
+       mov ax, _kern_start_seg
        mov es, ax      ; destination segment
        mov word [destptr], 0
        mov word [start_sect], 1        ; start from sector 1 to skip boot sector
@@ -173,7 +171,7 @@ start:
        jnz .rdloop
 
        ; loaded sucessfully, load segment registers and jump
-.done: mov ax, _stage2_start_seg
+.done: mov ax, _kern_start_seg
        mov ds, ax
        mov es, ax
        push ax
@@ -248,7 +246,7 @@ print_hex_digit:
 
 str_rdtrack2   db " from ",0
 str_rdtrack3   db "/",0
-str_load_fail  db "Failed to load 2nd stage!",0
+str_load_fail  db "Failed to load kernel!",0
 str_newline    db 13,10,0
 
        times 510-($-$$) db 0