blob: 9f5a51d80ede145493f17c58bf7219e60f130d6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; stage 1
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[bits 16]
[org 0x7c00]
jmp stage1
STR_1:
db "Fool Loader Stage 1. v0.1",0
STR_2:
db "Starting Stage 2",0
STR_BOOT:
db "boot drive: ",0
BOOT_DRIVE:
db 0xff ; remember the bootdrive here
%include "boot/print_string_16.asm"
%include "boot0/disk_load_16.asm"
stage1:
;remember BOOT_DRIVE (as was set by BIOS)
mov [BOOT_DRIVE],dl
;first of allsetup the stack (Right under mbr)
;guaranteed ~30KB space
mov bp,0x07bff
mov sp,bp
call print_clear
call print_nextline
;pr message
mov bx, STR_1
call print_string
call print_nextline
;show bootdrive
mov bx, STR_BOOT
call print_string
mov al,[BOOT_DRIVE]
call print_hex_byte
call print_nextline
call disk_load_16 ; loads stage 2
;entering stage2 message
mov bx, STR_2
call print_string
call print_nextline
call print_nextline
mov dl,[BOOT_DRIVE]
jmp 0x7e00 ; jump to next sector where we put stage 2
;fill partition table (4x16byte) with zeroes.
;(otherwise my Acer Aspire will not boot)
times 64 db 0x0
;so we get identified as MBR
times 510-($-$$) db 0x0
;dw 0x0
dw 0xaa55
|