31
|
1 *******************************************
|
|
2 * PTY
|
|
3 * Device Driver for emulated terminal
|
|
4 * Emulates the 6850 UART seen in usim
|
|
5 * Protocol:
|
|
6 * V.port is the control port.
|
|
7 * V.port+1 is the data port. It is bidirectional.
|
|
8 * bit 1: 1=data ready to read/0=no data
|
|
9 * bit 2: 1=ready for output
|
|
10 *
|
|
11
|
|
12 nam PTY
|
|
13 ttl Pseudo Terminal
|
|
14
|
|
15 ifp1
|
|
16 use os9defs
|
|
17 use scfdefs
|
|
18 endc
|
|
19
|
|
20 ***********************
|
|
21 * Edition History
|
|
22 *
|
|
23 * # date Comments
|
|
24 * - -------- -------------------------------
|
|
25 * 1 16.11.01 Driver first written. SMR
|
|
26
|
|
27 Revision equ 1
|
|
28
|
|
29 org V.SCF
|
|
30 PST equ .
|
|
31
|
|
32 mod PEND,PNAM,Drivr+Objct,Reent+Revision,PENT,PST
|
|
33 fcb READ.+WRITE.
|
|
34 PNAM fcs /PTY/
|
|
35
|
|
36 PENT lbra INIT
|
|
37 lbra READ
|
|
38 lbra WRITE
|
|
39 lbra GETSTA
|
|
40 lbra PUTSTA
|
|
41 lbra TERM
|
|
42
|
|
43 **********************
|
|
44 * INIT
|
|
45 * Entry: U = Static storage
|
|
46 * Setup the PIA
|
|
47 *
|
|
48 INIT clrb
|
|
49 rts
|
|
50
|
|
51 **********************
|
|
52 * READ
|
|
53 * Entry: U = Static Storage
|
|
54 * Y = Path Descriptor
|
|
55 * Exit: A = Character read
|
|
56 *
|
|
57 * Read a byte from Port B
|
|
58 *
|
|
59 READ ldx V.PORT,u load port address
|
|
60 readlp ldb ,x
|
|
61 bitb #$01
|
|
62 bne readbyte
|
|
63 pshs x sleep for a bit if not
|
|
64 ldx #1
|
|
65 os9 f$sleep
|
|
66 puls x
|
|
67 bra readlp
|
|
68 readbyte lda 1,x read byte
|
|
69 clrb
|
|
70 rts
|
|
71 **********************
|
|
72 * WRITE
|
|
73 * Entry: U = Static storage
|
|
74 * Y = Path Descriptor
|
|
75 * A = Char to write
|
|
76 *
|
|
77 * Write a byte to Port B
|
|
78 *
|
|
79 WRITE ldx V.PORT,u load port address
|
|
80 write1 ldb ,x
|
|
81 bitb #$02
|
|
82 bne wrt
|
|
83 pshs x
|
|
84 ldx #1
|
|
85 os9 f$sleep
|
|
86 puls x
|
|
87 bra write1
|
|
88 wrt sta 1,x write byte
|
|
89 ok clrb
|
|
90 rts
|
|
91
|
|
92 **********************
|
|
93 * GETSTA
|
|
94 * U = Static Storage
|
|
95 * Y = Path Descriptor
|
|
96 *
|
|
97 GETSTA ldx PD.Rgs,y X=pointer to registers
|
|
98 lda R$B,x A=contents of B reg.
|
|
99 cmpa #SS.Ready check for ready code
|
|
100 bne gsta1 if not, check next
|
|
101 ldx V.Port,u use the PIA to determine
|
|
102 ldb ,x if data is available
|
|
103 bitb #$01
|
|
104 bne ok
|
|
105 ldb #E$NotRdy
|
|
106 coma sets the carry flag
|
|
107 rts
|
|
108 gsta1 cmpa #SS.EOF check for eof code
|
|
109 beq ok which always returns ok
|
|
110 comb otherwise return
|
|
111 ldb #E$UnkSVC unknown code error
|
|
112 rts
|
|
113
|
|
114 **********************
|
|
115 * PUTSTA
|
|
116 * Always return error
|
|
117 *
|
|
118 PUTSTA ldx PD.Rgs,y X=register stack
|
|
119 ldb R$B,x B=contents of reg B
|
|
120 comb otherwise return error.
|
|
121 ldb #E$UnkSVC
|
|
122 rts
|
|
123
|
|
124 **********************
|
|
125 * TERM
|
|
126 * Terminate Driver
|
|
127 *
|
|
128 TERM clrb
|
|
129 rts
|
|
130
|
|
131 emod
|
|
132 PEND equ *
|
|
133
|