oosiop.ss revision 1.2 1 ; $NetBSD: oosiop.ss,v 1.2 2003/04/06 09:48:42 tsutsui Exp $
2
3 ;
4 ; Copyright (c) 2001 Shuichiro URATA. All rights reserved.
5 ;
6 ; Redistribution and use in source and binary forms, with or without
7 ; modification, are permitted provided that the following conditions
8 ; are met:
9 ; 1. Redistributions of source code must retain the above copyright
10 ; notice, this list of conditions and the following disclaimer.
11 ; 2. Redistributions in binary form must reproduce the above copyright
12 ; notice, this list of conditions and the following disclaimer in the
13 ; documentation and/or other materials provided with the distribution.
14 ; 3. The name of the author may not be used to endorse or promote products
15 ; derived from this software without specific prior written permission.
16 ;
17 ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 ; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 ; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 ; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 ; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 ; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 ; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 ;
28
29 ; NCR 53c700 script
30 ;
31
32 ARCH 700
33
34 ; interrupt codes
35 ABSOLUTE int_done = 0xbeef0000
36 ABSOLUTE int_msgin = 0xbeef0001
37 ABSOLUTE int_extmsg = 0xbeef0002
38 ABSOLUTE int_resel = 0xbeef0003
39 ABSOLUTE int_res_id = 0xbeef0004
40 ABSOLUTE int_resfail = 0xbeef0005
41 ABSOLUTE int_disc = 0xbeef0006
42 ABSOLUTE int_err = 0xdeadbeef
43
44 ; patch entries
45 ENTRY p_resel_msgin_move
46 ENTRY p_select
47 ENTRY p_datain_jump
48 ENTRY p_dataout_jump
49 ENTRY p_msgin_move
50 ENTRY p_msgout_move
51 ENTRY p_cmdout_move
52 ENTRY p_status_move
53 ENTRY p_extmsglen_move
54 ENTRY p_extmsgin_move
55
56
57 PROC oosiop_script:
58
59 ENTRY wait_reselect
60 wait_reselect:
61 WAIT RESELECT REL(reselect_fail)
62 INT int_resel
63 reselect_fail:
64 INT int_resfail
65
66 ENTRY wait_resel_identify
67 wait_resel_identify:
68 INT int_err, WHEN NOT MSG_IN
69 p_resel_msgin_move:
70 MOVE 0, 0, WHEN MSG_IN
71 INT int_res_id
72
73 ENTRY start_select
74 start_select:
75 p_select:
76 SELECT ATN 0, REL(wait_reselect)
77
78 ENTRY phasedispatch
79 phasedispatch:
80 JUMP REL(msgin), WHEN MSG_IN
81 JUMP REL(msgout), WHEN MSG_OUT
82 JUMP REL(status), WHEN STATUS
83 JUMP REL(cmdout), WHEN CMD
84 p_datain_jump:
85 JUMP 0, WHEN DATA_IN
86 p_dataout_jump:
87 JUMP 0, WHEN DATA_OUT
88 INT int_err
89
90 msgin:
91 CLEAR ATN
92 p_msgin_move:
93 MOVE 0, 0, WHEN MSG_IN
94 JUMP REL(complete), IF 0x00
95 JUMP REL(extmsgsetup), IF 0x01
96 JUMP REL(disconnect), IF 0x04
97 INT int_msgin
98
99 ENTRY ack_msgin
100 ack_msgin:
101 CLEAR ACK
102 JUMP REL(phasedispatch)
103
104 ENTRY sendmsg
105 sendmsg:
106 SET ATN
107 CLEAR ACK
108 msgout:
109 p_msgout_move:
110 MOVE 0, 0, WHEN MSG_OUT
111 CLEAR ATN
112 JUMP REL(phasedispatch)
113
114 cmdout:
115 CLEAR ATN
116 p_cmdout_move:
117 MOVE 0, 0, WHEN CMD
118 JUMP REL(phasedispatch)
119
120 status:
121 p_status_move:
122 MOVE 0, 0, WHEN STATUS
123 JUMP REL(phasedispatch)
124
125 disconnect:
126 CLEAR ACK
127 WAIT DISCONNECT
128 INT int_disc
129
130 complete:
131 CLEAR ACK
132 WAIT DISCONNECT
133 INT int_done
134
135 ; receive extended message length
136 extmsgsetup:
137 CLEAR ACK
138 INT int_err, IF NOT MSG_IN
139 p_extmsglen_move:
140 MOVE 0, 0, WHEN MSG_IN
141 INT int_extmsg
142
143 ; receive extended message
144 ENTRY rcv_extmsg
145 rcv_extmsg:
146 CLEAR ACK
147 INT int_err, IF NOT MSG_IN
148 p_extmsgin_move:
149 MOVE 0, 0, WHEN MSG_IN
150 INT int_msgin
151