]> wirehaze git hosting - BOS.git/blob - kernel/fat12/fat12.asm

wirehaze git hosting

partial fat12 structs recovered from forum
[BOS.git] / kernel / fat12 / fat12.asm
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2012-2015. ;
3 ;----------------------------------------------------------;
4 ; ;
5 ; FAT12 driver. ;
6 ; ;
7 ;----------------------------------------------------------;
8 struc disk
9 {
10 .disk_number db 0 ; which disk?
11 .root_dir dw 0 ; position of rootdir
12 .fat_1 dd 0 ; position of fat1
13 .fat_2 dd 0 ; position of fat2
14 .data_area dw 0 ; position of dataarea
15 .disk_size dd 0
16 .free_space dd 0
17 .boot bootsector
18 ; ..... some other values
19 }
20 struc bootsector ; 512 bytes
21 {
22 .jumper db 0,0,0
23 .oem db 0,0,0,0,0,0,0,0
24 .sectorsize dw 0
25 .sect_per_clust db 0
26 ;.... more values here
27 }
28
29 virtual at 0
30 bootsector bootsector
31 sizeof.bootsector = $
32 end virtual
33
34 virtual at 0
35 disk disk
36 sizeof.disk = $
37 end virtual
38
39
40 fd0 disk ; define fd0 data..
41
42 ;drv dd 0
43 ;mov edi, drv+disk.boot
44
45 ;-----------------------------;
46 ; calculate root location ;
47 ;-----------------------------;
48 xor eax, eax
49 mov al, byte [fd0.boot.fats_per_drive]
50 mul word [fd0.boot.sectors_per_fat]
51 add ax, word [fd0.boot.reserved_sect]
52 mov [fd0.root_dir], ax
53
54 ;mov si, [dsk]
55 ;mov ax, [si+disk.boot.sectorssize]
56
57
58 init_fat12:
59 push eax
60 ; a bit more code here
61 pop eax
62 ret