Subversion Repositories Kolibri OS

Rev

Rev 593 | Rev 2455 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 593 Rev 2288
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 593 $
8
$Revision: 2288 $
9
 
9
 
10
 
10
 
11
; READ RAMDISK IMAGE FROM HD
11
; READ RAMDISK IMAGE FROM HD
12
 
12
 
13
        cmp   [boot_dev+OS_BASE+0x10000],1
13
        cmp     [boot_dev+OS_BASE+0x10000], 1
14
        jne   no_sys_on_hd
14
        jne     no_sys_on_hd
15
 
15
 
16
        test  [DRIVE_DATA+1],byte 0x40
16
        test    [DRIVE_DATA+1], byte 0x40
17
        jz    position_2
17
        jz      position_2
18
        mov   [hdbase],0x1f0
18
        mov     [hdbase], 0x1f0
19
        mov   [hdid],0x0
19
        mov     [hdid], 0x0
20
        mov   [hdpos],1
20
        mov     [hdpos], 1
21
        mov   [fat32part],0
21
        mov     [fat32part], 0
22
  position_1_1:
22
  position_1_1:
23
        inc   [fat32part]
23
        inc     [fat32part]
24
        call  search_and_read_image
24
        call    search_and_read_image
25
        cmp   [image_retrieved],1
25
        cmp     [image_retrieved], 1
26
        je    yes_sys_on_hd
26
        je      yes_sys_on_hd
27
        movzx eax,byte [DRIVE_DATA+2]
27
        movzx   eax, byte [DRIVE_DATA+2]
28
        cmp   [fat32part],eax
28
        cmp     [fat32part], eax
29
        jle     position_1_1
29
        jle     position_1_1
30
  position_2:
30
  position_2:
31
        test  [DRIVE_DATA+1],byte 0x10
31
        test    [DRIVE_DATA+1], byte 0x10
32
        jz    position_3
32
        jz      position_3
33
        mov   [hdbase],0x1f0
33
        mov     [hdbase], 0x1f0
34
        mov   [hdid],0x10
34
        mov     [hdid], 0x10
35
        mov   [hdpos],2
35
        mov     [hdpos], 2
36
        mov   [fat32part],0
36
        mov     [fat32part], 0
37
  position_2_1:
37
  position_2_1:
38
        inc   [fat32part]
38
        inc     [fat32part]
39
        call  search_and_read_image
39
        call    search_and_read_image
40
        cmp   [image_retrieved],1
40
        cmp     [image_retrieved], 1
41
        je    yes_sys_on_hd
41
        je      yes_sys_on_hd
42
        movzx eax,byte [DRIVE_DATA+3]
42
        movzx   eax, byte [DRIVE_DATA+3]
43
        cmp   eax,[fat32part]
43
        cmp     eax, [fat32part]
44
        jle     position_2_1
44
        jle     position_2_1
45
  position_3:
45
  position_3:
46
        test  [DRIVE_DATA+1],byte 0x4
46
        test    [DRIVE_DATA+1], byte 0x4
47
        jz    position_4
47
        jz      position_4
48
        mov   [hdbase],0x170
48
        mov     [hdbase], 0x170
49
        mov   [hdid],0x0
49
        mov     [hdid], 0x0
50
        mov   [hdpos],3
50
        mov     [hdpos], 3
51
        mov   [fat32part],0
51
        mov     [fat32part], 0
52
  position_3_1:
52
  position_3_1:
53
        inc   [fat32part]
53
        inc     [fat32part]
54
        call  search_and_read_image
54
        call    search_and_read_image
55
        cmp   [image_retrieved],1
55
        cmp     [image_retrieved], 1
56
        je    yes_sys_on_hd
56
        je      yes_sys_on_hd
57
        movzx eax,byte [DRIVE_DATA+4]
57
        movzx   eax, byte [DRIVE_DATA+4]
58
        cmp   eax,[fat32part]
58
        cmp     eax, [fat32part]
59
        jle     position_3_1
59
        jle     position_3_1
60
  position_4:
60
  position_4:
61
        test  [DRIVE_DATA+1],byte 0x1
61
        test    [DRIVE_DATA+1], byte 0x1
62
        jz    no_sys_on_hd
62
        jz      no_sys_on_hd
63
        mov   [hdbase],0x170
63
        mov     [hdbase], 0x170
64
        mov   [hdid],0x10
64
        mov     [hdid], 0x10
65
        mov   [hdpos],4
65
        mov     [hdpos], 4
66
        mov   [fat32part],0
66
        mov     [fat32part], 0
67
  position_4_1:
67
  position_4_1:
68
        inc   [fat32part]
68
        inc     [fat32part]
69
        call  search_and_read_image
69
        call    search_and_read_image
70
        cmp   [image_retrieved],1
70
        cmp     [image_retrieved], 1
71
        je    yes_sys_on_hd
71
        je      yes_sys_on_hd
72
        movzx eax,byte [DRIVE_DATA+5]
72
        movzx   eax, byte [DRIVE_DATA+5]
73
        cmp   eax,[fat32part]
73
        cmp     eax, [fat32part]
74
        jle     position_4_1
74
        jle     position_4_1
75
        jmp   yes_sys_on_hd
75
        jmp     yes_sys_on_hd
76
 
76
 
77
  search_and_read_image:
77
  search_and_read_image:
78
        call  set_FAT32_variables
78
        call    set_FAT32_variables
79
        mov   edx, bootpath
79
        mov     edx, bootpath
80
        call  read_image
80
        call    read_image
81
        test  eax, eax
81
        test    eax, eax
82
        jz   image_present
82
        jz      image_present
83
        mov   edx, bootpath2
83
        mov     edx, bootpath2
84
        call  read_image
84
        call    read_image
85
        test  eax, eax
85
        test    eax, eax
86
        jz   image_present
86
        jz      image_present
87
        ret
87
        ret
88
    image_present:
88
    image_present:
89
        mov   [image_retrieved],1
89
        mov     [image_retrieved], 1
90
        ret
90
        ret
91
 
91
 
92
read_image:
92
read_image:
93
        mov   eax, hdsysimage+OS_BASE+0x10000
93
        mov     eax, hdsysimage+OS_BASE+0x10000
94
        mov   ebx, 1474560/512
94
        mov     ebx, 1474560/512
95
        mov   ecx, RAMDISK
95
        mov     ecx, RAMDISK
96
        mov   esi, 0
96
        mov     esi, 0
97
        mov   edi, 12
97
        mov     edi, 12
98
        call  file_read
98
        call    file_read
99
        ret
99
        ret
100
 
100
 
101
image_retrieved  db 0
101
image_retrieved  db 0
102
counter_of_partitions db 0
102
counter_of_partitions db 0
103
no_sys_on_hd:
103
no_sys_on_hd:
104
        ; test_to_format_ram_disk (need if not using ram disk)
104
        ; test_to_format_ram_disk (need if not using ram disk)
105
        cmp   [boot_dev+OS_BASE+0x10000],3
105
        cmp     [boot_dev+OS_BASE+0x10000], 3
106
        jne not_format_ram_disk
106
        jne     not_format_ram_disk
107
        ; format_ram_disk
107
        ; format_ram_disk
108
        mov edi, RAMDISK
108
        mov     edi, RAMDISK
109
        mov ecx, 0x1080
109
        mov     ecx, 0x1080
110
        xor eax,eax
110
        xor     eax, eax
111
@@:		
111
@@:             
112
		stosd
112
        stosd
113
        loop @b
113
        loop    @b
114
 
114
 
115
        mov ecx, 0x58F7F
115
        mov     ecx, 0x58F7F
116
        mov eax,0xF6F6F6F6
116
        mov     eax, 0xF6F6F6F6
117
@@:		
117
@@:             
118
		stosd
118
        stosd
119
        loop @b
119
        loop    @b
120
        
120
        
121
        mov [RAMDISK+0x200],dword 0xFFFFF0		; fat table
121
        mov     [RAMDISK+0x200], dword 0xFFFFF0         ; fat table
122
        mov [RAMDISK+0x4200],dword 0xFFFFF0
122
        mov     [RAMDISK+0x4200], dword 0xFFFFF0
123
        
123
        
124
not_format_ram_disk:
124
not_format_ram_disk:
125
yes_sys_on_hd:
125
yes_sys_on_hd: