1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
#if !__FIRST_ARG_IN_AX__
#ifdef __AS386_16__
#include <bios.h>
#include <errno.h>
#ifdef L_bios_disk_read
_bios_disk_read(drive, cyl, head, sect, length, buffer)
{
#asm
push bp
mov bp,sp
push es
push ds
pop es
mov dl,[bp+2+__bios_disk_read.drive]
mov ch,[bp+2+__bios_disk_read.cyl]
mov dh,[bp+2+__bios_disk_read.head]
mov bx,[bp+2+__bios_disk_read.buffer]
#if 0
mov ax,[bp+2+__bios_disk_read.cyl] ! Bits 10-11 of cylinder, AMI BIOS.
mov cl,#4
sar ax,cl
and al,#$C0
xor dh,al
#endif
mov cl,[bp+2+__bios_disk_read.sect]
and cl,#$3F
mov ax,[bp+2+__bios_disk_read.cyl] ! Bits 8-9 of cylinder.
sar ax,#1
sar ax,#1
and al,#$C0
or cl,al
mov al,[bp+2+__bios_disk_read.length]
mov ah,#$02
int $13
jc read_err1
mov ax,#0
read_err1:
xchg ah,al
xor ah,ah
pop es
pop bp
#endasm
}
#endif
#ifdef L_bios_disk_write
_bios_disk_write(drive, cyl, head, sect, length, buffer)
{
#asm
push bp
mov bp,sp
push es
push ds
pop es
mov dl,[bp+2+__bios_disk_write.drive]
mov ch,[bp+2+__bios_disk_write.cyl]
mov dh,[bp+2+__bios_disk_write.head]
mov bx,[bp+2+__bios_disk_write.buffer]
#if 0
mov ax,[bp+2+__bios_disk_write.cyl] ! Bits 10-11 of cylinder, AMI BIOS.
mov cl,#4
sar ax,cl
and al,#$C0
xor dh,al
#endif
mov cl,[bp+2+__bios_disk_write.sect]
and cl,#$3F
mov ax,[bp+2+__bios_disk_write.cyl] ! Bits 8-9 of cylinder.
sar ax,#1
sar ax,#1
and al,#$C0
or cl,al
mov al,[bp+2+__bios_disk_write.length]
mov ah,#$03
int $13
jc read_err2
mov ax,#0
read_err2:
xchg ah,al
xor ah,ah
pop es
pop bp
#endasm
}
#endif
#ifdef L_bios_get_dpt
long
_bios_get_dpt(drive)
{
#asm
push bp
mov bp,sp
push di
push es
mov dl,[bp+2+__bios_get_dpt.drive]
mov ah,#$08
int $13
jnc func_ok
mov cx,ax
mov dx,#-1
func_ok:
mov ax,cx
pop es
pop di
pop bp
#endasm
}
#endif
#ifdef L_bios_disk_reset
_bios_disk_reset(drive)
{
#asm
push bp
mov bp,sp
push di
push es
mov dl,[bp+2+__bios_disk_reset.drive]
mov ah,#$08
int $13
jnc reset_ok
mov cx,ax
mov dx,#-1
reset_ok:
mov ax,cx
pop es
pop di
pop bp
#endasm
}
#endif
#endif
#endif
|