* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / linux86-0.16.17 / libc / bios / bios_disk.c
blob49b4ec6f7e09d439f59b15ee6091690b63db8ebf
2 #if !__FIRST_ARG_IN_AX__
3 #ifdef __AS386_16__
5 #include <bios.h>
6 #include <errno.h>
8 #ifdef L_bios_disk_rd
9 _bios_disk_read(drive, cyl, head, sect, length, buffer)
11 #asm
12 push bp
13 mov bp,sp
15 push es
16 push ds
17 pop es
19 mov dl,[bp+2+__bios_disk_read.drive]
20 mov ch,[bp+2+__bios_disk_read.cyl]
21 mov dh,[bp+2+__bios_disk_read.head]
22 mov bx,[bp+2+__bios_disk_read.buffer]
24 #if 0
25 mov ax,[bp+2+__bios_disk_read.cyl] ! Bits 10-11 of cylinder, AMI BIOS.
26 mov cl,#4
27 sar ax,cl
28 and al,#$C0
29 xor dh,al
30 #endif
32 mov cl,[bp+2+__bios_disk_read.sect]
33 and cl,#$3F
34 mov ax,[bp+2+__bios_disk_read.cyl] ! Bits 8-9 of cylinder.
35 sar ax,#1
36 sar ax,#1
37 and al,#$C0
38 or cl,al
40 mov al,[bp+2+__bios_disk_read.length]
41 mov ah,#$02
42 int $13
43 jc read_err1
44 mov ax,#0
45 read_err1:
46 xchg ah,al
47 xor ah,ah
49 pop es
50 pop bp
51 #endasm
53 #endif
55 #ifdef L_bios_disk_wr
56 _bios_disk_write(drive, cyl, head, sect, length, buffer)
58 #asm
59 push bp
60 mov bp,sp
62 push es
63 push ds
64 pop es
66 mov dl,[bp+2+__bios_disk_write.drive]
67 mov ch,[bp+2+__bios_disk_write.cyl]
68 mov dh,[bp+2+__bios_disk_write.head]
69 mov bx,[bp+2+__bios_disk_write.buffer]
71 #if 0
72 mov ax,[bp+2+__bios_disk_write.cyl] ! Bits 10-11 of cylinder, AMI BIOS.
73 mov cl,#4
74 sar ax,cl
75 and al,#$C0
76 xor dh,al
77 #endif
79 mov cl,[bp+2+__bios_disk_write.sect]
80 and cl,#$3F
81 mov ax,[bp+2+__bios_disk_write.cyl] ! Bits 8-9 of cylinder.
82 sar ax,#1
83 sar ax,#1
84 and al,#$C0
85 or cl,al
87 mov al,[bp+2+__bios_disk_write.length]
88 mov ah,#$03
89 int $13
90 jc read_err2
91 mov ax,#0
92 read_err2:
93 xchg ah,al
94 xor ah,ah
96 pop es
97 pop bp
98 #endasm
100 #endif
102 #ifdef L_bios_get_dpt
103 long
104 _bios_get_dpt(drive)
106 #asm
107 push bp
108 mov bp,sp
110 push di
111 push es
113 mov dl,[bp+2+__bios_get_dpt.drive]
115 mov ah,#$08
116 int $13
117 jnc func_ok
118 mov cx,ax
119 mov dx,#-1
120 func_ok:
121 mov ax,cx
123 pop es
124 pop di
125 pop bp
126 #endasm
128 #endif
130 #ifdef L_bios_disk_rs
131 _bios_disk_reset(drive)
133 #asm
134 push bp
135 mov bp,sp
137 push di
138 push es
140 mov dl,[bp+2+__bios_disk_reset.drive]
142 mov ah,#$08
143 int $13
144 jnc reset_ok
145 mov cx,ax
146 mov dx,#-1
147 reset_ok:
148 mov ax,cx
150 pop es
151 pop di
152 pop bp
153 #endasm
155 #endif
157 #endif
158 #endif