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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
Bits 16
%define secteur 1
%define port_clavier_60 60h
jmp Main
convert_sector:
push bx
push ax
mov bx, ax
mov dx, 0
div WORD [SectorsPerTrack]
add dl, 01h
mov cl, dl
mov ax, bx
mov dx, 0
div WORD [SectorsPerTrack]
mov dx, 0
div WORD [Sides]
mov dh, dl
mov ch, al
pop ax
pop bx
mov dl, BYTE [BootDrive]
ret
SectorsPerTrack dw 18
Sides dw 2
reset_floppy:
mov ax, 0
mov dl, BYTE [BootDrive]
int 13h
ret
Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print
Done:
ret
Main:
mov [BootDrive], dl
mov ah,0x00
mov dl,0x00
int 0x13
cli
mov ax, 0x0100
mov ss, ax
mov sp, 0xFFFF
sti
mov ax, 07C0h
mov ds, ax
mov es, ax
mov si,msg_disk
call Print
mov si, msg_krl
call Print
mov si, msg_kyb
call Print
mov si, msg_vga
call Print
mov si, msg1
call Print
hlt
attend_frappe:
mov ah,0
int 16h
xor ax,ax
in al,port_clavier_60
test al,10000000b
jnz attend_frappe
mov ch, 0
mov cl, 2
mov dh, 1
mov bx, buffer
mov al, secteur
mov ah, 2
pusha
load_root:
int 13h
jnc loaded_root
call reset_floppy
jmp load_root
loaded_root:
popa
mov di, buffer
mov cx, 224
search_root:
push cx
pop dx
mov si, filename
mov cx, 11
rep cmpsb
je found_file
add ax, 32
mov di, buffer
add di, ax
push dx
pop cx
loop search_root
mov si, msg
call Print
cli
hlt
msg db 'Erreur Noyau SxS Non Trouver!',0
msg1 db 'Appuyez sur une touche pour demarrer SxS',10,13,0
msg_disk db 'Chargement Du Disque [OK]',10,13,0
msg_krl db 'Chargement Du Noyau [OK]',10,13,0
msg_kyb db 'Chargement Du Clavier [OK]',10,13,0
msg_vga db '',10,13,0
found_file:
mov ax, WORD [di+15]
mov [FirstSector], ax
mov bx, buffer
mov ax, 1
call convert_sector
mov al, 9
mov ah, 2
pusha
load_fat:
int 13h
jnc loaded_fat
call reset_floppy
jmp load_fat
loaded_fat:
mov ah, 2
mov al, 1
push ax
load_file_sector:
mov ax, WORD [FirstSector]
add ax, 31
call convert_sector
mov ax, 2000h
mov es, ax
mov bx, WORD [Pointer]
pop ax
push ax
int 13h
jnc calculate_next_sector
call reset_floppy
jmp load_file_sector
calculate_next_sector:
mov ax, [FirstSector]
mov dx, 0
mov bx, 6
mul bx
mov bx, 4
div bx
mov si, buffer
add si, ax
mov ax, WORD [si]
or dx, dx
jz even
odd:
shr ax, 4
jmp short next_sector_calculated
even:
and ax, 0FFFh
next_sector_calculated:
mov WORD [FirstSector], ax
cmp ax, 0FF8h
jae end
add WORD [Pointer], 512
jmp load_file_sector
end:
pop ax
mov dl, BYTE [BootDrive]
jmp 2000h:0000h
BootDrive db 0
filename db "KERNEL XNO"
FirstSector dw 0
Pointer dw 0
;times 510 - ($-$$) db 0
buffer:
dw 0xAA55 |
Partager