Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
425 victor 1
$Revision: 465 $
431 serge 2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
 
1 ha 9
; READ RAMDISK IMAGE FROM HD
10
 
465 serge 11
        cmp   [boot_dev+OS_BASE+0x10000],1
1 ha 12
        jne   no_sys_on_hd
13
 
412 serge 14
        test  [DRIVE_DATA+1],byte 0x40
1 ha 15
        jz    position_2
16
        mov   [hdbase],0x1f0
17
        mov   [hdid],0x0
18
        mov   [hdpos],1
19
        mov   [fat32part],0
20
  position_1_1:
21
        inc   [fat32part]
22
        call  search_and_read_image
23
        cmp   [image_retrieved],1
24
        je    yes_sys_on_hd
412 serge 25
        movzx eax,byte [DRIVE_DATA+2]
1 ha 26
        cmp   [fat32part],eax
27
        jle     position_1_1
28
  position_2:
412 serge 29
        test  [DRIVE_DATA+1],byte 0x10
1 ha 30
        jz    position_3
31
        mov   [hdbase],0x1f0
32
        mov   [hdid],0x10
33
        mov   [hdpos],2
34
        mov   [fat32part],0
35
  position_2_1:
36
        inc   [fat32part]
37
        call  search_and_read_image
38
        cmp   [image_retrieved],1
39
        je    yes_sys_on_hd
412 serge 40
        movzx eax,byte [DRIVE_DATA+3]
1 ha 41
        cmp   eax,[fat32part]
42
        jle     position_2_1
43
  position_3:
412 serge 44
        test  [DRIVE_DATA+1],byte 0x4
1 ha 45
        jz    position_4
46
        mov   [hdbase],0x170
47
        mov   [hdid],0x0
48
        mov   [hdpos],3
49
        mov   [fat32part],0
50
  position_3_1:
51
        inc   [fat32part]
52
        call  search_and_read_image
53
        cmp   [image_retrieved],1
54
        je    yes_sys_on_hd
412 serge 55
        movzx eax,byte [DRIVE_DATA+4]
1 ha 56
        cmp   eax,[fat32part]
57
        jle     position_3_1
58
  position_4:
412 serge 59
        test  [DRIVE_DATA+1],byte 0x1
1 ha 60
        jz    no_sys_on_hd
61
        mov   [hdbase],0x170
62
        mov   [hdid],0x10
63
        mov   [hdpos],4
64
        mov   [fat32part],0
65
  position_4_1:
66
        inc   [fat32part]
67
        call  search_and_read_image
68
        cmp   [image_retrieved],1
69
        je    yes_sys_on_hd
412 serge 70
        movzx eax,byte [DRIVE_DATA+5]
1 ha 71
        cmp   eax,[fat32part]
72
        jle     position_4_1
73
        jmp   yes_sys_on_hd
74
 
75
  search_and_read_image:
76
        call  set_FAT32_variables
77
        mov   edx, bootpath
78
        call  read_image
79
        test  eax, eax
80
        jz   image_present
81
        mov   edx, bootpath2
82
        call  read_image
83
        test  eax, eax
84
        jz   image_present
85
        ret
86
    image_present:
87
        mov   [image_retrieved],1
88
        ret
89
 
90
read_image:
465 serge 91
        mov   eax, hdsysimage+OS_BASE+0x10000
1 ha 92
        mov   ebx, 1474560/512
381 serge 93
        mov   ecx, RAMDISK
1 ha 94
        mov   esi, 0
95
        mov   edi, 12
96
        call  file_read
381 serge 97
        ret
1 ha 98
 
381 serge 99
image_retrieved  db 0
1 ha 100
counter_of_partitions db 0
101
no_sys_on_hd:
102
yes_sys_on_hd: