comparison os9/level1/pty.asm @ 94:f20bf9874697

fix os9 dir
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 25 Dec 2018 15:57:05 +0900
parents src/os9/level1/pty.asm@2088fd998865
children
comparison
equal deleted inserted replaced
93:03a26438ab8d 94:f20bf9874697
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 defsfile
17 endc
18
19 ***********************
20 * Edition History
21 *
22 * # date Comments
23 * - -------- -------------------------------
24 * 1 16.11.01 Driver first written. SMR
25
26 Revision equ 1
27
28 org V.SCF
29 PST equ .
30
31 mod PEND,PNAM,Drivr+Objct,Reent+Revision,PENT,PST
32 fcb READ.+WRITE.
33 PNAM fcs /PTY/
34
35 PENT lbra INIT
36 lbra READ
37 lbra WRITE
38 lbra GETSTA
39 lbra PUTSTA
40 lbra TERM
41
42 **********************
43 * INIT
44 * Entry: U = Static storage
45 * Setup the PIA
46 *
47 INIT clrb
48 rts
49
50 **********************
51 * READ
52 * Entry: U = Static Storage
53 * Y = Path Descriptor
54 * Exit: A = Character read
55 *
56 * Read a byte from Port B
57 *
58 READ ldx V.PORT,u load port address
59 readlp ldb ,x
60 bitb #$01
61 bne readbyte
62 pshs x sleep for a bit if not
63 ldx #1
64 os9 f$sleep
65 puls x
66 bra readlp
67 readbyte lda 1,x read byte
68 clrb
69 rts
70 **********************
71 * WRITE
72 * Entry: U = Static storage
73 * Y = Path Descriptor
74 * A = Char to write
75 *
76 * Write a byte to Port B
77 *
78 WRITE ldx V.PORT,u load port address
79 write1 ldb ,x
80 bitb #$02
81 bne wrt
82 pshs x
83 ldx #1
84 os9 f$sleep
85 puls x
86 bra write1
87 wrt sta 1,x write byte
88 ok clrb
89 rts
90
91 **********************
92 * GETSTA
93 * U = Static Storage
94 * Y = Path Descriptor
95 *
96 GETSTA ldx PD.Rgs,y X=pointer to registers
97 lda R$B,x A=contents of B reg.
98 cmpa #SS.Ready check for ready code
99 bne gsta1 if not, check next
100 ldx V.Port,u use the PIA to determine
101 ldb ,x if data is available
102 bitb #$01
103 bne ok
104 ldb #E$NotRdy
105 coma sets the carry flag
106 rts
107 gsta1 cmpa #SS.EOF check for eof code
108 beq ok which always returns ok
109 comb otherwise return
110 ldb #E$UnkSVC unknown code error
111 rts
112
113 **********************
114 * PUTSTA
115 * Always return error
116 *
117 PUTSTA ldx PD.Rgs,y X=register stack
118 ldb R$B,x B=contents of reg B
119 comb otherwise return error.
120 ldb #E$UnkSVC
121 rts
122
123 **********************
124 * TERM
125 * Terminate Driver
126 *
127 TERM clrb
128 rts
129
130 emod
131 PEND equ *
132