-
Notifications
You must be signed in to change notification settings - Fork 3
/
boot.asm
69 lines (56 loc) · 1.03 KB
/
boot.asm
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
[BITS 16]
[ORG 0x7c00]
start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7c00
TestDiskExtension:
mov [DriveId],dl
mov ah,0x41
mov bx,0x55aa
int 0x13
jc NotSupport
cmp bx,0xaa55
jne NotSupport
LoadLoader:
mov si,ReadPacket
mov word[si],0x10
mov word[si+2],5
mov word[si+4],0x7e00
mov word[si+6],0
mov dword[si+8],1
mov dword[si+0xc],0
mov dl,[DriveId]
mov ah,0x42
int 0x13
jc ReadError
mov dl,[DriveId]
jmp 0x7e00
ReadError:
NotSupport:
mov ah,0x13
mov al,1
mov bx,0xa
xor dx,dx
mov bp,Message
mov cx,MessageLen
int 0x10
End:
hlt
jmp End
DriveId: db 0
Message: db "We have an error in boot process"
MessageLen: equ $-Message
ReadPacket: times 16 db 0
times (0x1be-($-$$)) db 0
db 80h
db 0,2,0
db 0f0h
db 0ffh,0ffh,0ffh
dd 1
dd (20*16*63-1)
times (16*3) db 0
db 0x55
db 0xaa