|
|
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: / Raw Serial Device Driver - Assembler Support
9: /
10: ////////
11:
12: ////////
13: /
14: / Locally defined global symbols
15: /
16: ////////
17:
18: .globl rsin_
19: .globl rsout_
20:
21: ////////
22: /
23: / Offsets to fields in the IRING and ORING data structures.
24: /
25: ////////
26:
27: Q_MASK = 0
28: Q_IX = 2
29: Q_OX = 4
30: Q_CC = 6
31:
32: ////////
33: /
34: / Offsets to fields in the IO data structure.
35: /
36: ////////
37:
38: IO_IOC = 2
39: IO_BASE = 8
40:
41: ////////
42: /
43: / Rsin ( rawqp, iop ) -- transfer data from input ring to user
44: / IRING *rawqp;
45: / IO *iop;
46: /
47: ////////
48:
49: rsin_:
50: push si / Save SI, DI, BP, ES
51: push di
52: push bp
53: mov bp, sp
54: push es
55:
56: mov bx, 10(bp) / User destination --> ES:DI
57: mov di, IO_BASE(bx)
58: mov es, uds_
59:
60: cld / Auto Increment
61: mov cx, IO_IOC(bx) / Byte count --> CX
62: jcxz 1f
63:
64: mov bx, 8(bp) / rawqp --> BX
65:
66: mov si, Q_OX(bx)
67: cmp si, Q_IX(bx) / Input data available?
68: je 1f
69:
70: 0: movb al, Q_CC(bx,si) / Yes, read one character
71: inc si / update index
72: and si, Q_MASK(bx) / (wrap if necessary)
73: stosb / write to user space
74: cmp si, Q_IX(bx) / More input data?
75: loopne 0b /
76:
77: mov Q_OX(bx), si / Save revised index
78: mov bx, 10(bp) / Update io parameters
79: mov IO_BASE(bx), di
80: mov IO_IOC(bx), cx
81:
82: 1: pop es / Restore ES, BP, DI, SI.
83: pop bp
84: pop di
85: pop si
86: ret
87:
88: ////////
89: /
90: / Rsout( outqp, iop ) -- transfer data from user to output ring
91: / ORING *outqp;
92: / IO *iop;
93: /
94: ////////
95:
96: rsout_:
97: push si / Save SI, DI, BP, ES
98: push di
99: push bp
100: mov bp, sp
101: push es
102:
103: mov bx, 10(bp) / User source --> ES:DI
104: mov di, IO_BASE(bx)
105: mov es, uds_
106:
107: mov cx, IO_IOC(bx) / Byte count --> CX
108: jcxz 2f
109:
110: mov bx, 8(bp) / outqp --> BX
111: mov si, Q_IX(bx)
112:
113: 0: movb al, es:(di)
114: inc di
115: movb Q_CC(bx,si), al
116: inc si
117: and si, Q_MASK(bx)
118: cmp si, Q_OX(bx)
119: loopne 0b
120:
121: jne 1f / If can't save last char
122: dec di / Undo changes.
123: dec si
124: and si, Q_MASK(bx)
125: inc cx
126:
127: 1: mov Q_IX(bx), si / Save revised index
128: mov bx, 10(bp)
129: mov IO_BASE(bx), di / Update io parameters
130: mov IO_IOC(bx), cx
131:
132: 2: pop es / Restore ES, BP, DI, SI.
133: pop bp
134: pop di
135: pop si
136: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.