Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1 ha 1
hd_phys_read:
2
;eax - sector number
3
;ebx - destination
4
  pushad
5
  call  wait_for_hd_idle
6
  popad
7
  push  edx
8
  push  eax
9
  cli
10
  xor   eax,eax
11
  mov   edx,[hdbase]
12
  inc   edx
13
  out   dx,al
14
  inc   edx
15
  inc   eax
16
  out   dx,al
17
  inc   edx
18
;write sector number.
19
  mov   eax,[esp]
20
  out   dx,al
21
  shr   eax,8
22
  inc   edx
23
  out   dx,al
24
  shr   eax,8
25
  inc   edx
26
  out   dx,al
27
  shr   eax,8
28
  inc   edx
29
  and   al,1+2+4+8
30
  add   al,byte [hdid] ;+0 or +16
31
  or    al,32+64+128
32
  out   dx,al
33
  inc   edx
34
  mov   al,0x20
35
  out   dx,al
36
  sti
37
 
38
  call  wait_for_sector_buffer
39
  cmp   [hd_error],0
40
  jnz   hd_read_error
41
  cli
42
  push  edi
43
  mov   edi,ebx
44
  mov   ecx,256
45
  mov   edx,[hdbase]
46
  cld
47
  rep   insw
48
  pop   edi
49
  sti
50
  pop   edx
51
  pop   eax
52
  ret
53
 
54
hd_phys_write:
55
;eax - sector number
56
;ebx - destination
57
  cmp   eax,[partition_start]
58
  jb    .ret
59
  cmp   eax,[partition_end]
60
  ja    .ret
61
  pushad
62
  call  wait_for_hd_idle
63
  popad
64
  push  edx
65
  push  eax
66
  cli
67
  xor   eax,eax
68
  mov   edx,[hdbase]
69
  inc   edx
70
  out   dx,al
71
  inc   edx
72
  inc   eax
73
  out   dx,al
74
;write sector number
75
  inc   edx
76
  mov   eax,[esp]
77
  out   dx,al
78
  shr   eax,8
79
  inc   edx
80
  out   dx,al
81
  shr   eax,8
82
  inc   edx
83
  out   dx,al
84
  shr   eax,8
85
  inc   edx
86
  and   al,1+2+4+8
87
  add   al,byte [hdid] ;+0 or +16
88
  or    al,32+64+128
89
  out   dx,al
90
 
91
  inc   edx
92
  mov   al,0x30
93
  out   dx,al
94
  sti
95
 
96
  call  wait_for_sector_buffer
97
  cmp   [hd_error],0
98
  jnz   hd_write_error
99
  cli
100
  push  esi
101
  mov   esi,ebx
102
  mov   ecx,256
103
  mov   edx,[hdbase]
104
  cld
105
  rep   outsw
106
  pop   esi
107
  sti
108
  pop   edx
109
  pop   eax
110
.ret:
111
  ret