summaryrefslogtreecommitdiff
path: root/boot/mbr.asm
diff options
context:
space:
mode:
Diffstat (limited to 'boot/mbr.asm')
-rw-r--r--boot/mbr.asm140
1 files changed, 67 insertions, 73 deletions
diff --git a/boot/mbr.asm b/boot/mbr.asm
index 96fc788..bb74d23 100644
--- a/boot/mbr.asm
+++ b/boot/mbr.asm
@@ -39,121 +39,115 @@
;The Boot record is identified by the last 2 magic bytes: 0xaa55 (?)
[org 0x7c00]
-;define some constants
-;where we will load our kernel into memory and some
-;other memory locations
-
+;;define some constants
+;;where we will load our kernel into memory and some
+;;other memory locations
+;
KERNEL_OFFSET equ 0x1000
MEMMAP_SIZE_OFFSET equ 0x7c00+0x600
MEMMAP_OFFSET equ 0x7c00+0x400
VESA_MODES equ 0x8300
VESA_MODE_INFO equ 0x8400
VESA_MODE_SELECT equ 0x4114
-;VESA_MODE_SELECT equ 0x0
-
+;
jmp boot_16 ;start boot process
-
-;SOME Global Data, mainly info/error strings
+;
+;;SOME Global Data, mainly info/error strings
BOOT_DRIVE:
db 0xff
STR_VERSION:
- db "v0.3.1~",0
+ db "v0.4",0
VESA_CHECK1:
- db " V1.",0
+ db "1",0
VESA_CHECK2:
- db " V2",0
+ db "2",0
VESA_CHECK3:
- db " V3",0
+ db "3",0
CHECK_A20:
- db " A20",0
-
-;lets put our temporary GDT (Global Descriptor Table) here
-;kernel should move this away
+ db "A",0
+;
+;;lets put our temporary GDT (Global Descriptor Table) here
+;;kernel should move this away
%include "boot/GDT.asm"
-
-;include 16-bit real mode routines (print_string, disk_load, vesa_setup,check_a20)
+;
+;;include 16-bit real mode routines (print_string, disk_load, vesa_setup,check_a20)
%include "boot/disk_load_16.asm"
-%include "boot/check_a20_16.asm"
+;%include "boot/check_a20_16.asm"
%include "boot/print_string_16.asm"
%include "boot/vesa_setup_16.asm"
-
-;include our routines for switching to 32-bit protected mode
+;
+;;include our routines for switching to 32-bit protected mode
%include "boot/pm.asm"
-
-;pic_setup mapping routing
-%include "boot/pic.asm"
-
-;get memory map routine
+;
+;
+;;get memory map routine
%include "boot/memmap.asm"
-
-;;;;;;;; BOOT 16-bit real ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;lets start
+;
+;;;;;;;;; BOOT 16-bit real ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
+;;lets start
[bits 16]
-
+;
boot_16:
-
+;
+;
mov bx, STR_VERSION
call print_string
-
- ;setup the stack
+;
+;
+; ;setup the stack
mov bp,0x8000
mov sp,bp
-
- ;remember BOOT_DRIVE (as was set by BIOS)
+;
+; ;remember BOOT_DRIVE (as was set by BIOS)
mov [BOOT_DRIVE],dl
-
- ;Load the KERNEL (52 sectors starting at sector 2)
+; mov bx, BOOT_DRIVE
+; call print_string
+;
+; ;Load the KERNEL (52 sectors starting at sector 2)
mov bx,KERNEL_OFFSET
mov dh, 52
mov dl, [BOOT_DRIVE]
call disk_load
- ;get memory map from bios before we enter 32 bit protected mode
+ mov bx, KERNEL_OFFSET
+ call print_string
+
+;
+; ;get memory map from bios before we enter 32 bit protected mode
mov ax,0 ; set target address in es:di (0:offset)
mov es,ax
mov di,MEMMAP_OFFSET
call BiosGetMemoryMap ; this will also put the number of entries
- ; of the memory map at MEMMAP_SIZE_OFFSET
-
-a20check:
-
- mov bx, CHECK_A20
- call print_string
-
- call check_a20
- cmp ax,0
- je a20check ;hang if a20 is disabled!
-
- ;VESA: also setup vesa stuff before entering 32 bit protected mode
+; ; of the memory map at MEMMAP_SIZE_OFFSET
+;
+;a20check:
+;
+; mov bx, CHECK_A20
+; call print_string
+;
+; call check_a20
+; cmp ax,0
+; je a20check ;hang if a20 is disabled!
+;
+; ;VESA: also setup vesa stuff before entering 32 bit protected mode
call VesaSetup
-
- ;finally lets enter Protected mode!!!
+;
+; ;finally lets enter Protected mode!!!
call switch_to_pm
-
-;;;;;;;; BOOT 32-bit protected mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
+;;;;;;;;; BOOT 32-bit protected mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[bits 32]
boot_32_pm:
+;
-; we could do ALL This inside the kernel!!!!!! TODO
-
- ;enable A20
- ;http://www.brokenthorn.com/Resources/OSDev9.html
- ;Method 3.1: Enables A20 through keyboard controller
- ;Not all keyboard controllers support this
- ;todo: check if this has any effect at all !?!?
- ;mov al, 0xdd ; command 0xdd: enable a20
- ;mov al, 0xdf ; command 0xdf: disable a20
- ;out 0x64, al ; send command to controller
-
- ;pic setup
- call pic_setup
-
+;
call KERNEL_OFFSET ;jump into our Kernel!
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
;so we get identified as MBR
-times 510-($-$$) db 0
+times 510-($-$$) db 0x0
+;dw 0x0
dw 0xaa55