Subversion Repositories Kolibri OS

Rev

Rev 1379 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
431 serge 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
593 mikedld 8
$Revision: 1410 $
9
 
10
 
1410 turbanoff 11
;*************************************************************
12
;* 13.02.2010 Find all partition and check supported FS
578 mario79 13
;* 12.07.2007 Check all 4 entry of MBR and EMBR
14
;* 29.04.2006 Elimination of hangup after the
15
;*             expiration hd_wait_timeout -  Mario79
16
;* 28.01.2006 find all Fat16/32 partition in all input point
17
;*            to MBR - Mario79
65 mario79 18
;*************************************************************
19
 
277 diamond 20
uglobal
65 mario79 21
align 4
256 diamond 22
 
65 mario79 23
;******************************************************
431 serge 24
; Please do not change this place - variables  in text
65 mario79 25
; Mario79
26
; START place
27
;******************************************************
28
PARTITION_START      dd 0x3f
29
PARTITION_END        dd 0
1410 turbanoff 30
fs_type              db 0       ; 1=NTFS, 2=EXT2/3, 16=FAT16, 32=FAT32
277 diamond 31
align 4
256 diamond 32
 
33
fs_dependent_data_start:
34
; FATxx data
35
 
65 mario79 36
SECTORS_PER_FAT      dd 0x1f3a
37
NUMBER_OF_FATS       dd 0x2
38
SECTORS_PER_CLUSTER  dd 0x8
39
BYTES_PER_SECTOR     dd 0x200   ; Note: if BPS <> 512 need lots of changes
40
ROOT_CLUSTER         dd 2       ; first rootdir cluster
41
FAT_START            dd 0       ; start of fat table
42
ROOT_START           dd 0       ; start of rootdir (only fat16)
43
ROOT_SECTORS         dd 0       ; count of rootdir sectors (only fat16)
44
DATA_START           dd 0       ; start of data area (=first cluster 2)
45
LAST_CLUSTER         dd 0       ; last availabe cluster
46
ADR_FSINFO           dd 0       ; used only by fat32
47
 
48
fatRESERVED          dd 0x0FFFFFF6
49
fatBAD               dd 0x0FFFFFF7
50
fatEND               dd 0x0FFFFFF8
51
fatMASK              dd 0x0FFFFFFF
52
 
649 diamond 53
fatStartScan         dd 2
54
 
256 diamond 55
fs_dependent_data_end:
321 diamond 56
file_system_data_size = $ - PARTITION_START
57
if file_system_data_size > 96
58
ERROR: sizeof(file system data) too big!
1379 turbanoff 59
end if
256 diamond 60
 
61
virtual at fs_dependent_data_start
62
; NTFS data
63
ntfs_data:
64
.sectors_per_cluster    dd      ?
65
.mft_cluster            dd      ?
66
.mftmirr_cluster        dd      ?
67
.frs_size               dd      ?       ; FRS size in bytes
68
.iab_size               dd      ?       ; IndexAllocationBuffer size in bytes
69
.frs_buffer             dd      ?
70
.iab_buffer             dd      ?
71
.mft_retrieval          dd      ?
72
.mft_retrieval_size     dd      ?
73
.mft_retrieval_alloc    dd      ?
74
.mft_retrieval_end      dd      ?
75
.cur_index_size         dd      ?
76
.cur_index_buf          dd      ?
77
if $ > fs_dependent_data_end
78
ERROR: increase sizeof(fs_dependent_data)!
79
end if
1379 turbanoff 80
end virtual
81
 
1378 turbanoff 82
virtual at fs_dependent_data_start
83
; EXT2 data
84
ext2_data:
1379 turbanoff 85
    .log_block_size                 dd ?
86
    .block_size                     dd ?
87
    .count_block_in_block           dd ?
88
    .blocks_per_group               dd ?
89
    .inodes_per_group               dd ?
90
    .global_desc_table              dd ?
91
    .root_inode                     dd ?	; pointer to root inode in memory
92
    .inode_size                     dd ?
93
    .count_pointer_in_block         dd ?	;  block_size / 4
94
    .count_pointer_in_block_square  dd ?	; (block_size / 4)**2
95
    .ext2_save_block                dd ?    ; блок на глобальную 1 процедуру
96
    .ext2_temp_block                dd ?    ; блок для мелких процедур
97
    .ext2_save_inode                dd ?    ; inode на глобальную процедуру
1378 turbanoff 98
    .ext2_temp_inode                dd ?    ; inode для мелких процедур
99
if $ > fs_dependent_data_end
100
ERROR: increase sizeof(fs_dependent_data)!
101
end if
256 diamond 102
end virtual
1379 turbanoff 103
 
65 mario79 104
;***************************************************************************
105
; End place
106
; Mario79
107
;***************************************************************************
277 diamond 108
endg
109
iglobal
65 mario79 110
 
111
  partition_types:              ; list of fat16/32 partitions
112
    db    0x04                  ; DOS: fat16 <32M
113
    db    0x06                  ; DOS: fat16 >32M
114
    db    0x0b                  ; WIN95: fat32
115
    db    0x0c                  ; WIN95: fat32, LBA-mapped
116
    db    0x0e                  ; WIN95: fat16, LBA-mapped
117
    db    0x14                  ; Hidden DOS: fat16 <32M
118
    db    0x16                  ; Hidden DOS: fat16 >32M
119
    db    0x1b                  ; Hidden WIN95: fat32
120
    db    0x1c                  ; Hidden WIN95: fat32, LBA-mapped
121
    db    0x1e                  ; Hidden WIN95: fat16, LBA-mapped
122
    db    0xc4                  ; DRDOS/secured: fat16 <32M
123
    db    0xc6                  ; DRDOS/secured: fat16 >32M
124
    db    0xcb                  ; DRDOS/secured: fat32
125
    db    0xcc                  ; DRDOS/secured: fat32, LBA-mapped
126
    db    0xce                  ; DRDOS/secured: fat16, LBA-mapped
127
    db    0xd4                  ; Old Multiuser DOS secured: fat16 <32M
128
    db    0xd6                  ; Old Multiuser DOS secured: fat16 >32M
256 diamond 129
    db    0x07                  ; NTFS
1379 turbanoff 130
    db    0x27                  ; NTFS, hidden
1378 turbanoff 131
    db    0x83                  ; Linux native file system (ext2fs)
65 mario79 132
  partition_types_end:
133
 
134
 
135
  extended_types:               ; list of extended partitions
136
    db    0x05                  ; DOS: extended partition
137
    db    0x0f                  ; WIN95: extended partition, LBA-mapped
138
    db    0xc5                  ; DRDOS/secured: extended partition
139
    db    0xd5                  ; Old Multiuser DOS secured: extended partition
140
  extended_types_end:
141
 
142
endg
143
 
144
; Partition chain used:
1379 turbanoff 145
; MBR <---------------------
146
; |                         |
147
; |-> PARTITION1          |
148
; |-> EXTENDED PARTITION -        ;not need be second partition
149
; |-> PARTITION3
150
; |-> PARTITION4
151
 
1378 turbanoff 152
set_PARTITION_variables:
153
set_FAT32_variables:        ;deprecated
1410 turbanoff 154
    and   [problem_partition], 0
65 mario79 155
    call  reserve_hd1
321 diamond 156
    call  reserve_hd_channel
65 mario79 157
 
709 diamond 158
    pushad
159
 
65 mario79 160
    cmp   dword [hdpos],0
161
    je    problem_hd
162
 
163
    xor   ecx,ecx               ; partition count
1410 turbanoff 164
    ;or    edx,-1                ; flag for partition
1378 turbanoff 165
    xor   eax,eax               ; address MBR
65 mario79 166
    xor   ebp,ebp               ; extended partition start
167
 
1378 turbanoff 168
new_mbr:
169
    test  ebp,ebp               ; is there extended partition? (MBR or EMBR)
65 mario79 170
    jnz   extended_already_set  ; yes
171
    xchg  ebp,eax               ; no. set it now
172
 
173
extended_already_set:
174
    add   eax,ebp               ; mbr=mbr+0, ext_part=ext_start+relat_start
175
    mov   ebx,buffer
176
    call  hd_read
74 mario79 177
    cmp  [hd_error],0
178
    jne  problem_hd
65 mario79 179
 
180
    cmp   word [ebx+0x1fe],0xaa55 ; is it valid boot sector?
1410 turbanoff 181
    jnz   end_partition_chain
182
    push  eax                      ; push only one time
65 mario79 183
    cmp   dword [ebx+0x1be+0xc],0 ; skip over empty partition
1378 turbanoff 184
    jnz    test_primary_partition_0
578 mario79 185
    cmp   dword [ebx+0x1be+0xc+16],0
1378 turbanoff 186
    jnz    test_primary_partition_1
578 mario79 187
    cmp   dword [ebx+0x1be+0xc+16+16],0
1378 turbanoff 188
    jnz    test_primary_partition_2
578 mario79 189
    cmp   dword [ebx+0x1be+0xc+16+16+16],0
1410 turbanoff 190
    jnz    test_primary_partition_3
191
    pop   eax
1378 turbanoff 192
    jmp   end_partition_chain
193
 
194
test_primary_partition_0:
65 mario79 195
    mov   al,[ebx+0x1be+4]      ; get primary partition type
196
    call  scan_partition_types
1378 turbanoff 197
    jnz   test_primary_partition_1      ; no. skip over
65 mario79 198
 
199
    inc   ecx
1378 turbanoff 200
    cmp   ecx,[known_part]       ; is it wanted partition?
201
    jnz   test_primary_partition_1      ; no
1410 turbanoff 202
 
203
        pop     eax
204
        ;mov     edx, eax                ; start sector
205
        add     eax, [ebx+0x1be+8]      ; add relative start
206
        ;mov     [PARTITON_START],edx
207
        ;push    edx
208
        mov     edx, [ebx+0x1be+12]     ; length
209
        ;add     edx, eax                ; add length
210
        ;dec     edx                     ; PARTITION_END is inclusive
211
        ;mov     [PARTITION_END], edx    ; note that this can be changed
256 diamond 212
                                        ; when file system data will be available
1410 turbanoff 213
        mov     cl, [ebx+0x1be+4]       ; fs_type
214
        ;mov     [fs_type], dl           ; save for FS recognizer (separate FAT vs NTFS)
215
        ;pop     edx
216
        jmp     hd_and_partition_ok
256 diamond 217
 
1378 turbanoff 218
test_primary_partition_1:
65 mario79 219
    mov   al,[ebx+0x1be+4+16]      ; get primary partition type
220
    call  scan_partition_types
1378 turbanoff 221
    jnz   test_primary_partition_2        ; no. skip over
65 mario79 222
 
223
    inc   ecx
1378 turbanoff 224
    cmp   ecx,[known_part]       ; is it wanted partition?
225
    jnz   test_primary_partition_2        ; no
1410 turbanoff 226
 
227
        pop     eax
228
        add     eax, [ebx+0x1be+8+16]
229
        mov     edx, [ebx+0x1be+12+16]
230
        mov     cl, [ebx+0x1be+4+16]
231
        jmp     hd_and_partition_ok
65 mario79 232
 
1410 turbanoff 233
        ;mov     edx, eax
234
        ;add     edx, [ebx+0x1be+8+16]
235
        ;push    edx
236
        ;add     edx, [ebx+0x1be+12+16]
237
        ;dec     edx
238
        ;mov     [PARTITION_END], edx
239
        ;mov     al, [ebx+0x1be+4+16]
240
        ;mov     [fs_type], dl
241
        ;pop     edx
65 mario79 242
 
1378 turbanoff 243
test_primary_partition_2:
65 mario79 244
    mov   al,[ebx+0x1be+4+16+16]      ; get primary partition type
245
    call  scan_partition_types
1378 turbanoff 246
    jnz   test_primary_partition_3        ; no. skip over
65 mario79 247
 
248
    inc   ecx
1378 turbanoff 249
    cmp   ecx,[known_part]       ; is it wanted partition?
250
    jnz   test_primary_partition_3        ; no
1410 turbanoff 251
 
252
        pop     eax
253
        add     eax, [ebx+0x1be+8+16+16]
254
        mov     edx, [ebx+0x1be+12+16+16]
255
        mov     cl, [ebx+0x1be+4+16+16]
256
        jmp     hd_and_partition_ok
257
        ;mov     edx, eax
258
        ;add     edx, [ebx+0x1be+8+16+16]
259
        ;push    edx
260
        ;add     edx, [ebx+0x1be+12+16+16]
261
        ;dec     edx
262
        ;mov     [PARTITION_END], edx
263
        ;mov     al, [ebx+0x1be+4+16+16]
264
        ;mov     [fs_type], dl
265
        ;pop     edx
65 mario79 266
 
1378 turbanoff 267
test_primary_partition_3:
65 mario79 268
    mov   al,[ebx+0x1be+4+16+16+16]      ; get primary partition type
269
    call  scan_partition_types
1378 turbanoff 270
    jnz   test_ext_partition_0        ; no. skip over
65 mario79 271
 
272
    inc   ecx
1378 turbanoff 273
    cmp   ecx,[known_part]       ; is it wanted partition?
274
    jnz   test_ext_partition_0  ; no
1410 turbanoff 275
 
276
        pop     eax
277
        add     eax, [ebx+0x1be+8+16+16+16]
278
        mov     edx, [ebx+0x1be+12+16+16+16]
279
        mov     cl, [ebx+0x1be+4+16+16+16]
280
        jmp     hd_and_partition_ok
65 mario79 281
 
1410 turbanoff 282
        ;mov     edx, eax
283
        ;add     edx, [ebx+0x1be+8+16+16+16]
284
        ;push    edx
285
        ;add     edx, [ebx+0x1be+12+16+16+16]
286
        ;dec     edx
287
        ;mov     [PARTITION_END], edx
288
        ;mov     al, [ebx+0x1be+4+16+16+16]
289
        ;mov     [fs_type], dl
290
        ;pop     edx
65 mario79 291
 
1410 turbanoff 292
test_ext_partition_0:
293
    pop   eax               ; просто выкидываем из стека
65 mario79 294
    mov   al,[ebx+0x1be+4]   ; get extended partition type
295
    call  scan_extended_types
1378 turbanoff 296
    jnz   test_ext_partition_1
65 mario79 297
 
298
    mov   eax,[ebx+0x1be+8]     ; add relative start
299
    test  eax,eax               ; is there extended partition?
1378 turbanoff 300
    jnz   new_mbr               ; yes. read it
65 mario79 301
 
1378 turbanoff 302
test_ext_partition_1:
65 mario79 303
    mov   al,[ebx+0x1be+4+16]   ; get extended partition type
304
    call  scan_extended_types
1378 turbanoff 305
    jnz   test_ext_partition_2
65 mario79 306
 
1378 turbanoff 307
    mov   eax,[ebx+0x1be+8+16]  ; add relative start
65 mario79 308
    test  eax,eax               ; is there extended partition?
1378 turbanoff 309
    jnz   new_mbr               ; yes. read it
65 mario79 310
 
1378 turbanoff 311
test_ext_partition_2:
65 mario79 312
    mov   al,[ebx+0x1be+4+16+16]   ; get extended partition type
313
    call  scan_extended_types
1378 turbanoff 314
    jnz   test_ext_partition_3
65 mario79 315
 
316
    mov   eax,[ebx+0x1be+8+16+16]     ; add relative start
317
    test  eax,eax               ; is there extended partition?
1378 turbanoff 318
    jnz   new_mbr               ; yes. read it
319
 
320
test_ext_partition_3:
65 mario79 321
    mov   al,[ebx+0x1be+4+16+16+16]   ; get extended partition type
322
    call  scan_extended_types
323
    jnz   end_partition_chain   ; no. end chain
324
 
325
    mov   eax,[ebx+0x1be+8+16+16+16]  ; get start of extended partition
326
    test  eax,eax               ; is there extended partition?
1378 turbanoff 327
    jnz   new_mbr               ; yes. read it
328
 
65 mario79 329
end_partition_chain:
1410 turbanoff 330
    ;mov   [partition_count],ecx
65 mario79 331
 
1410 turbanoff 332
    ;cmp   edx,-1                ; found wanted partition?
333
    ;jnz   hd_and_partition_ok   ; yes. install it
334
    ;jmp   problem_partition_or_fat
335
problem_hd:
336
    or    [problem_partition], 2
337
    jmp   return_from_part_set
65 mario79 338
 
1410 turbanoff 339
 
65 mario79 340
scan_partition_types:
341
    push  ecx
342
    mov   edi,partition_types
343
    mov   ecx,partition_types_end-partition_types
344
    cld
345
    repne scasb                 ; is partition type ok?
346
    pop   ecx
347
    ret
348
 
349
scan_extended_types:
350
    push  ecx
351
    mov   edi,extended_types
352
    mov   ecx,extended_types_end-extended_types
353
    cld
354
    repne scasb                 ; is it extended partition?
355
    pop   ecx
356
    ret
357
 
358
problem_fat_dec_count:          ; bootsector is missing or another problem
1410 turbanoff 359
;    dec   [partition_count]     ; remove it from partition_count
65 mario79 360
 
361
problem_partition_or_fat:
1410 turbanoff 362
    or    [problem_partition],1
363
 
364
return_from_part_set:
65 mario79 365
    popad
1410 turbanoff 366
    ;mov   [fs_type],0
321 diamond 367
    call  free_hd_channel
65 mario79 368
    mov   [hd1_status],0        ; free
369
    ret
370
 
1410 turbanoff 371
hd_and_partition_ok:
372
 
373
;eax = PARTITION_START edx=PARTITION_LENGTH cl=fs_type
374
    mov   [fs_type], cl
375
    ;mov   eax,edx
376
    mov   [PARTITION_START],eax
377
    add   edx, eax
378
    dec   edx
379
    mov   [PARTITION_END], edx
65 mario79 380
 
1410 turbanoff 381
   ;     mov     edx, [PARTITION_END]
382
   ;     sub     edx, eax
383
   ;     inc     edx     ; edx = length of partition зачем оно нам??
384
 
256 diamond 385
;    mov   [hd_setup],1
65 mario79 386
    mov   ebx,buffer
387
    call  hd_read               ; read boot sector of partition
256 diamond 388
        cmp     [hd_error], 0
389
        jz      boot_read_ok
390
        cmp     [fs_type], 7
391
        jnz     problem_fat_dec_count
392
; NTFS duplicates bootsector:
393
; NT4/2k/XP+ saves bootsector copy in the end of disk
394
; NT 3.51 saves bootsector copy in the middle of disk
395
        and     [hd_error], 0
396
        mov     eax, [PARTITION_END]
397
        call    hd_read
398
        cmp     [hd_error], 0
399
        jnz     @f
400
        call    ntfs_test_bootsec
401
        jnc     boot_read_ok
402
@@:
403
        and     [hd_error], 0
404
        mov     eax, edx
405
        shr     eax, 1
406
        add     eax, [PARTITION_START]
407
        call    hd_read
408
        cmp     [hd_error], 0
1378 turbanoff 409
        jnz     problem_fat_dec_count   ; no chance...
256 diamond 410
boot_read_ok:
1378 turbanoff 411
 
256 diamond 412
; if we are running on NTFS, check bootsector
74 mario79 413
 
1378 turbanoff 414
        call    ntfs_test_bootsec      ; test ntfs
1379 turbanoff 415
        jnc     ntfs_setup
416
 
417
        call    ext2_test_superblock   ; test ext2fs
1410 turbanoff 418
        jnc     ext2_setup
1379 turbanoff 419
 
1410 turbanoff 420
        mov     eax, [PARTITION_START]	;ext2 test changes [buffer]
421
        call    hd_read
1379 turbanoff 422
        cmp     [hd_error], 0
1410 turbanoff 423
        jnz     problem_fat_dec_count
1378 turbanoff 424
 
65 mario79 425
    cmp   word [ebx+0x1fe],0xaa55 ; is it valid boot sector?
426
    jnz   problem_fat_dec_count
427
 
428
    movzx eax,word [ebx+0xe]    ; sectors reserved
429
    add   eax,[PARTITION_START]
430
    mov   [FAT_START],eax       ; fat_start = partition_start + reserved
431
 
432
    movzx eax,byte [ebx+0xd]    ; sectors per cluster
1190 diamond 433
    test  eax,eax
434
    jz    problem_fat_dec_count
65 mario79 435
    mov   [SECTORS_PER_CLUSTER],eax
436
 
437
    movzx ecx,word [ebx+0xb]    ; bytes per sector
1191 diamond 438
    cmp   ecx,0x200
1190 diamond 439
    jnz   problem_fat_dec_count
65 mario79 440
    mov   [BYTES_PER_SECTOR],ecx
441
 
442
    movzx eax,word [ebx+0x11]   ; count of rootdir entries (=0 fat32)
443
    mov   edx,32
444
    mul   edx
445
    dec   ecx
446
    add   eax,ecx               ; round up if not equal count
447
    inc   ecx                   ; bytes per sector
448
    div   ecx
449
    mov   [ROOT_SECTORS],eax    ; count of rootdir sectors
450
 
451
    movzx eax,word [ebx+0x16]   ; sectors per fat <65536
452
    test  eax,eax
453
    jnz   fat16_fatsize
454
    mov   eax,[ebx+0x24]        ; sectors per fat
455
  fat16_fatsize:
456
    mov   [SECTORS_PER_FAT],eax
457
 
458
    movzx eax,byte [ebx+0x10]   ; number of fats
459
    test  eax,eax               ; if 0 it's not fat partition
460
    jz    problem_fat_dec_count
461
    mov   [NUMBER_OF_FATS],eax
462
    imul  eax,[SECTORS_PER_FAT]
463
    add   eax,[FAT_START]
464
    mov   [ROOT_START],eax      ; rootdir = fat_start + fat_size * fat_count
465
    add   eax,[ROOT_SECTORS]    ; rootdir sectors should be 0 on fat32
466
    mov   [DATA_START],eax      ; data area = rootdir + rootdir_size
467
 
468
    movzx eax,word [ebx+0x13]   ; total sector count <65536
469
    test  eax,eax
470
    jnz   fat16_total
471
    mov   eax,[ebx+0x20]        ; total sector count
472
  fat16_total:
473
    add   eax,[PARTITION_START]
474
    dec   eax
475
    mov   [PARTITION_END],eax
476
    inc   eax
477
    sub   eax,[DATA_START]      ; eax = count of data sectors
478
    xor   edx,edx
479
    div   dword [SECTORS_PER_CLUSTER]
480
    inc   eax
481
    mov   [LAST_CLUSTER],eax
482
    dec   eax                   ; cluster count
649 diamond 483
    mov   [fatStartScan],2
65 mario79 484
 
485
    ; limits by Microsoft Hardware White Paper v1.03
486
    cmp   eax,4085              ; 0xff5
487
    jb    problem_fat_dec_count ; fat12 not supported
488
    cmp   eax,65525             ; 0xfff5
489
    jb    fat16_partition
490
 
491
fat32_partition:
492
    mov   eax,[ebx+0x2c]        ; rootdir cluster
493
    mov   [ROOT_CLUSTER],eax
494
    movzx eax,word [ebx+0x30]   ; fs info sector
495
    add   eax,[PARTITION_START]
496
    mov   [ADR_FSINFO],eax
649 diamond 497
    call  hd_read
498
    mov   eax,[ebx+0x1ec]
499
    cmp   eax,-1
500
    jz    @f
501
    mov   [fatStartScan],eax
502
@@:
65 mario79 503
 
504
    popad
505
 
506
    mov   [fatRESERVED],0x0FFFFFF6
507
    mov   [fatBAD],0x0FFFFFF7
508
    mov   [fatEND],0x0FFFFFF8
509
    mov   [fatMASK],0x0FFFFFFF
256 diamond 510
    mov   [fs_type],32         ; Fat32
321 diamond 511
    call  free_hd_channel
65 mario79 512
    mov   [hd1_status],0        ; free
513
    ret
514
 
515
fat16_partition:
516
    xor   eax,eax
517
    mov   [ROOT_CLUSTER],eax
518
 
519
    popad
520
 
521
    mov   [fatRESERVED],0x0000FFF6
522
    mov   [fatBAD],0x0000FFF7
523
    mov   [fatEND],0x0000FFF8
524
    mov   [fatMASK],0x0000FFFF
256 diamond 525
    mov   [fs_type],16         ; Fat16
321 diamond 526
    call  free_hd_channel
65 mario79 527
    mov   [hd1_status],0        ; free
1410 turbanoff 528
    ret
529