|
|
1.1 root 1: ////////
2: / MSDOS MWC86 runtime.
3: / Read and write from port.
4: ////////
5:
6: #include <larges.h>
7:
8: ////////
9: / int
10: / in(port);
11: / int port;
12: /
13: / Read a word from the specified port.
14: ////////
15:
16: port = RASIZE
17:
18: .globl in_
19:
20: in_:
21: mov bx, sp
22: mov dx, Pss port(bx) / dx = port address
23: in ax, dx / Read the port.
24: Gret
25:
26: ////////
27: / int
28: / inb(port);
29: / int port;
30: /
31: / Read a byte from the specified port.
32: ////////
33:
34: port = RASIZE
35:
36: .globl inb_
37:
38: inb_:
39: mov bx, sp
40: mov dx, Pss port(bx) / dx = port address
41: inb al, dx / Read from the port and
42: subb ah, ah / convert to integer.
43: Gret
44:
45: ////////
46: / int
47: / out(port, data);
48: / int port;
49: / int data;
50: /
51: / Write the word "data" to port "port".
52: / Return "data".
53: ////////
54:
55: port = RASIZE
56: data = port+2
57:
58: .globl out_
59: out_:
60: mov bx, sp
61: mov dx, Pss port(bx) / dx = port address
62: mov ax, Pss data(bx) / ax = data
63: out dx, ax / Send data to the port.
64: Gret
65:
66: ////////
67: / int
68: / outb(port, data);
69: / int port;
70: / int data;
71: /
72: / Write the low byte of "data" to port "port".
73: / Return "data".
74: ////////
75:
76: port = RASIZE
77: data = port+2
78:
79: .globl outb_
80:
81: outb_:
82: mov bx, sp
83: mov dx, Pss port(bx) / dx = port address
84: movb al, Pss data(bx) / al = data
85: subb ah, ah / Convert to integer.
86: outb dx, al / Send data to the port.
87: Gret
88:
89: / end of inout.m
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.