|
|
1.1 root 1: / (lgl-
2: / COHERENT Driver Kit Version 1.1.0
3: / Copyright (c) 1982, 1990 by Mark Williams Company.
4: / All rights reserved. May not be copied without permission.
5: / -lgl)
6: ////////
7: /
8: / AT Hard Disk Assembler Support
9: /
10: / $Log: atas.s,v $
11: / Revision 1.1 92/07/17 15:24:03 bin
12: / Initial revision
13: /
14: / Revision 1.4 92/02/05 15:55:06 hal
15: / Patchable ATSREG_.
16: /
17: / Revision 1.3 91/10/24 12:37:44 hal
18: / COH 3.2.03k.
19: / Poll HF_REG (3F6) rather than CSR_REG (1F7).
20: /
21: /
22: / atsend( off, seg ) - send 512 bytes from seg:off into hard disk buffer
23: / atrecv( off, seg ) - receive 512 bytes from hard disk buffer into seg:off.
24: / DRQ is not checked. DRQ must be true before atsend/atrecv are called.
25: /
26: / atbsyw() - wait while controller is busy
27: / atdrqw() - wait for controller to request data transfer
28: /
29: ////////
30:
31: .globl atsend_
32: .globl atrecv_
33: .globl atbsyw_
34: .globl atdrqw_
35: .globl ATSREG_
36:
37: BSY_ST = 0x80
38: DRQ_ST = 0x08
39:
40: ////////
41: /
42: / void
43: / atsend( fp ) -- send 512 bytes to AT disk controller.
44: / faddr_t fp;
45: /
46: / Input: fp = far pointer [sel:off] to data buffer.
47: /
48: / Action: Transfer 512 bytes to AT disk controller from buffer.
49: /
50: ////////
51:
52: atsend_:
53: push si
54: push ds
55: push bp
56: mov bp, sp
57: lds si, 8(bp)
58: mov cx, $256
59: mov dx, $0x1F0
60: cld
61: rep
62: outs
63: pop bp
64: pop ds
65: pop si
66: ret
67:
68: ////////
69: /
70: / void
71: / atrecv( fp ) -- receive 512 bytes from AT disk controller.
72: / faddr_t fp;
73: /
74: / Input: fp = far pointer [sel:off] to data buffer.
75: /
76: / Action: Transfer 512 bytes from AT disk controller to buffer.
77: /
78: ////////
79:
80: atrecv_:
81: push di
82: push es
83: push bp
84: mov bp, sp
85: les di, 8(bp)
86: mov cx, $256
87: mov dx, $0x1F0
88: cld
89: rep
90: ins
91: pop bp
92: pop es
93: pop di
94: ret
95:
96: ////////
97: /
98: / atbsyw() -- wait for AT disk controller to become not busy
99: /
100: / Return: 0 = timeout
101: / * = not busy
102: /
103: ////////
104:
105: atbsyw_:
106: mov dx, ATSREG_
107: mov bx, $4 / add another layer of iteration for 486's
108: 0: mov cx, $-1
109: 1: inb al, dx
110: testb al, $BSY_ST
111: loopne 1b
112: je 2f / not busy - return nonzero value
113: dec bx
114: jne 0b
115: 2: mov ax, cx
116: ret
117:
118: ////////
119: /
120: / atdrqw() -- wait for AT disk controller to initiate data request
121: /
122: / Return: 0 = timeout
123: / * = data requested
124: /
125: ////////
126:
127: atdrqw_:
128: mov dx, ATSREG_
129: mov bx, $4
130: 0: mov cx, $-1
131: 1: inb al, dx
132: testb al, $DRQ_ST
133: loope 1b
134: jne 2f / not busy - return nonzero value
135: dec bx
136: jne 0b
137: 2: mov ax, cx
138: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.