diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-09-04 23:38:33 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-09-04 23:38:33 +0200 |
| commit | 467e19b262d435f1820539bc0c85ed4fa31b9687 (patch) | |
| tree | c3ee7690b089713614309857ecfc046d6a13d160 /boot0/disk_load_16.asm | |
| parent | 487ecc1615ccc0368f1520c1146b2b43cdab6577 (diff) | |
Finally we have a 2 stage bootloader !
This one can load the ramdis up to 0xfffff :)
Diffstat (limited to 'boot0/disk_load_16.asm')
| -rw-r--r-- | boot0/disk_load_16.asm | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/boot0/disk_load_16.asm b/boot0/disk_load_16.asm new file mode 100644 index 0000000..55ad4aa --- /dev/null +++ b/boot0/disk_load_16.asm @@ -0,0 +1,78 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;; Miguel's FoolOS Helper Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +;disk_load_16 +; + + +[bits 16] + +STR_LBA: + db "\nLBA Support Detected (no support yet)",0 + +STR_CHS + db "CHS Support Detected",0 + +STR_ERROR + db "Disk Read Error",0 + +STR_DONE + db "Stage 2 Loaded",0 + +disk_load_16: + + pusha + + ; check if LBA is supported + mov ah,0x41 + mov bx,0x55aa + int 0x13 + jnc disk_load_lba + jmp disk_load_chs + + +disk_load_lba: + + mov bx, STR_LBA + call print_string + call print_nextline + jmp $ + jmp disk_load_finish + +disk_load_chs: + + mov bx, STR_CHS + call print_string + call print_nextline + + mov bx,0 ;target es:bx + mov es,bx + mov bx,0x7e00 + + mov al,50 ;number of sectors to read + mov ah,0x02 ;BIOS read sector func + + mov cl,2 ; sector + mov ch,0 ; cylinder + + mov dl,[BOOT_DRIVE] + mov dh,0 ;head + + int 0x13 ;bios interrupt + + jnc disk_load_finish + + jmp $ + +disk_load_finish: + + call print_nextline + mov bx, STR_DONE + call print_string + call print_nextline + + + popa + ret + |
