xref: /titanic_41/usr/src/uts/common/sys/scsi/adapters/scr.ss (revision f8919bdadda3ebb97bd55cc14a16e0271ed57615)
1;
2; Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3; Use is subject to license terms.
4;
5; CDDL HEADER START
6;
7; The contents of this file are subject to the terms of the
8; Common Development and Distribution License, Version 1.0 only
9; (the "License").  You may not use this file except in compliance
10; with the License.
11;
12; You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13; or http://www.opensolaris.org/os/licensing.
14; See the License for the specific language governing permissions
15; and limitations under the License.
16;
17; When distributing Covered Code, include this CDDL HEADER in each
18; file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19; If applicable, add the following below this CDDL HEADER, with the
20; fields enclosed by brackets "[]" replaced with your own identifying
21; information: Portions Copyright [yyyy] [name of copyright owner]
22;
23; CDDL HEADER END
24;
25;       Multi-threaded general purpose script for the
26;	Symbios 53C825/875 host bus adapter chips.
27;
28; ident	"%Z%%M%	%I%	%E% SMI"
29
30	ARCH 825A
31
32	ABSOLUTE NBIT_ICON = 0x10	; CON bit in SCNTL1 register
33
34;
35; Scatter/Gather DMA instructions for datain and dataout
36;
37	ENTRY	dt_do_list_end
38	ENTRY	dt_di_list_end
39	ENTRY	do_list_end
40	ENTRY	di_list_end
41
42;       SCSI I/O entry points.  One of these addresses must be loaded into the
43;       DSA register to initiate SCSI I/O.
44
45	ENTRY start_up
46	ENTRY resel_m
47	ENTRY ext_msg_out
48	ENTRY clear_ack
49	ENTRY continue
50	ENTRY errmsg
51	ENTRY abort
52	ENTRY dev_reset
53	ENTRY ext_msg_in
54	ENTRY phase_mis_match
55
56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57
58start_up:
59	SELECT ATN FROM 0, REL(resel_m)
60
61; after selection, next phase should be msg_out or status
62	INT PASS(NINT_ILI_PHASE), WHEN NOT MSG_OUT
63
64msgout:
65	MOVE FROM PASS(NTOFFSET(nt_sendmsg)), WHEN MSG_OUT
66	JUMP REL(command_phase), WHEN CMD
67	JUMP REL(switch), WHEN NOT MSG_OUT
68; target requested repeat, set atn in case it's an extended msg
69	SET ATN
70	JUMP REL(msgout)
71
72
73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
74
75; The sync (SDTR) message interrupt handler restarts here if the
76; initiator and target have both succesfully exchanged SDTR messages.
77
78clear_ack:
79	CLEAR ACK
80	JUMP REL(switch)
81
82
83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
84
85; Restart here after phase mismatch interrupt, clear ATN in case the
86; interrupt occurred during the msg_out phase.
87
88continue:
89	CLEAR ATN
90	JUMP REL(switch)
91
92
93;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
94
95; Send error message to the target. Usually the target will change
96; phase immediately. But if in data in or data out phase, or part
97; way through a command or message in the phase change will happen
98; at the end of the current phase.
99
100errmsg:
101	SET ATN
102	CLEAR ACK
103	JUMP REL(errmsg_out), WHEN MSG_OUT
104; not message out phase, the target will change phase later
105	JUMP REL(switch)
106
107errmsg_out:
108	MOVE FROM PASS(NTOFFSET(nt_errmsg)), WHEN MSG_OUT
109	JUMP REL(switch) , WHEN NOT MSG_OUT
110; target requested repeat
111	JUMP REL(errmsg_out)
112
113
114;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115
116; Send an abort message to a target that's attempting an invalid
117; reconnection.
118
119abort:
120	SET ATN
121	CLEAR ACK
122	INT PASS(NINT_ILI_PHASE), WHEN NOT MSG_OUT
123
124abort_out:
125	MOVE FROM PASS(NTOFFSET(nt_errmsg)), WHEN MSG_OUT
126	JUMP REL(abort_done), WHEN NOT MSG_OUT
127	SET ATN
128	JUMP REL(abort_out)
129
130abort_done:
131	MOVE 0x00 TO SCNTL2
132	CLEAR ACK
133	WAIT DISCONNECT
134	INT PASS(NINT_OK)
135
136
137;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
138
139; send an Abort or Bus Device Reset message and wait for the disconnect
140
141dev_reset:
142	MOVE 0x00 TO SCNTL2
143	SELECT ATN FROM 0, REL(resel_m)
144; after selection, next phase should be msg_out
145	INT PASS(NINT_ILI_PHASE), WHEN NOT MSG_OUT
146
147dev_reset_out:
148	MOVE FROM PASS(NTOFFSET(nt_sendmsg)), WHEN MSG_OUT
149	CLEAR ACK
150	MOVE SCNTL2 & 0x7F TO SCNTL2
151	WAIT DISCONNECT
152	INT PASS(NINT_DEV_RESET)
153
154
155;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
156
157; The sync (SDTR) or wide (WDTR) message interrupt handler restarts here
158; if the initiator needs to send an SDTR/WDTR message in response to the
159; target's SDTR/WDTR.
160;
161; Set the ATN signal to let target know we've got a message to send
162; and ack the last byte of its SDTR/WDTR message.
163
164ext_msg_out:
165	SET ATN
166	CLEAR ACK
167	JUMP REL(msg_out), WHEN MSG_OUT
168; not message out phase, assume target decided not to do sync i/o
169; if this doesn't work, change it to treat this as illegal phase
170	CLEAR ATN
171	INT PASS(NINT_NEG_REJECT)
172
173msg_out:
174	MOVE FROM PASS(NTOFFSET(nt_sendmsg)), WHEN MSG_OUT
175	JUMP REL(ext_msg_out_chk), WHEN NOT MSG_OUT
176	SET ATN				 ; target requested repeat
177	JUMP REL(msg_out)
178
179
180ext_msg_out_chk:
181; test whether the target accepted the SDTR message
182; any phase besides MSG_IN means the sdtr message is okay
183	JUMP REL(switch), WHEN NOT MSG_IN
184
185; any message besides Message Reject means the SDTR message is okay
186	MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN
187	JUMP REL(msgin2), IF NOT 0x07		; anything else is okay
188
189; SDTR got Message Reject response
190	MOVE 0x00 TO SXFER
191	INT PASS(NINT_NEG_REJECT)
192
193;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
194
195resel_m:
196	WAIT RESELECT REL(alt_sig_p)
197	MOVE SSID SHL SFBR
198	MOVE SFBR SHL SFBR
199	MOVE SFBR & 0x3C TO DSA0
200	MOVE SCRATCHB1 TO SFBR
201	MOVE SFBR TO DSA1
202	MOVE SCRATCHB2 TO SFBR
203	MOVE SFBR TO DSA2
204	MOVE SCRATCHB3 TO SFBR
205	MOVE SFBR TO DSA3
206	SELECT FROM 0x00, REL(Next_Inst)
207Next_Inst:
208	MOVE 0x00 TO DSA0
209	INT PASS(NINT_MSGIN), WHEN NOT MSG_IN
210	;
211	; reselection Identify msg.
212	;
213	MOVE FROM PASS(HBAOFFSET(g_rcvmsg)), WHEN MSG_IN
214	CLEAR ACK
215	;
216	; Target will either continue in msg-in phase (tag q'ing) or
217	; transistion to data or status phase.
218	;
219	; non-tq case: target switched to status phase.
220	;
221	INT PASS(NINT_RESEL), WHEN NOT MSG_IN	; Let UNIX driver grab it
222	;
223	; should be the 0x20 (tag msg).
224	;
225	MOVE FROM PASS(HBAOFFSET(g_moremsgin)), WHEN MSG_IN
226	;
227	; if the target resel and disconnects, handle that here.
228	JUMP REL(resel_disc), IF 0x04
229	;
230	; Check msg-in byte for 20, 21, or 22.
231	JUMP REL(Got_tag), IF 0x20 AND MASK 0x01
232	INT PASS(NINT_RESEL), IF NOT 0x22	; Let UNIX driver grab it
233Got_tag:
234	CLEAR ACK
235	MOVE FROM PASS(HBAOFFSET(g_tagmsg)), WHEN MSG_IN
236	CLEAR ACK
237	INT PASS(NINT_RESEL)			; Let UNIX driver grab it
238
239alt_sig_p:
240	; The driver hit sig_p to start a new cmd.
241	; Test the connected bit in SCNTL1.  If its set, retry the
242	; wait reselect.  Otherwise, let the driver start a new cmd.
243	MOVE CTEST2 TO SFBR			; clear sig_p bit, if set
244	MOVE SCNTL1 & NBIT_ICON TO SFBR		; test the connected bit
245
246	; Interrupt if not connected.
247	INT PASS(NINT_SIGPROC), IF NOT NBIT_ICON
248
249	; otherwise, handle reselection.
250	JUMP REL(resel_m)
251
252;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253
254;       Every phase comes back to here.
255switch:
256	JUMP REL(msgin), WHEN MSG_IN
257	JUMP REL(dataout_gotos), IF DATA_OUT
258	JUMP REL(datain_gotos), IF DATA_IN
259	JUMP REL(status_phase), IF STATUS
260	JUMP REL(command_phase), IF CMD
261	JUMP REL(errmsg_out), WHEN MSG_OUT
262	JUMP REL(dt_dataout_gotos), IF RES4
263	JUMP REL(dt_datain_gotos), IF RES5
264	INT PASS(NINT_ILI_PHASE)
265
266
267;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
268
269msgin:
270; read the first byte
271	MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN
272msgin2:
273	JUMP REL(end), IF 0x00			; command complete message
274	INT PASS(NINT_SDP_MSG), IF 0x02		; save data pointers
275	JUMP REL(disc), IF 0x04			; disconnect message
276	INT PASS(NINT_RP_MSG), IF 0x03		; restore data pointers
277	INT PASS(NINT_MSGREJ), IF 0x07		; Message Reject
278	JUMP REL(ext_msg_in), IF 0x01		; extended message
279	JUMP REL(ignore_wide_residue), IF 0x23	; ignore wide residue
280	INT PASS(NINT_UNS_MSG)			; unsupported message type
281
282disc:
283	MOVE 0x00 TO SCNTL2
284	CLEAR ACK
285	WAIT DISCONNECT
286	INT PASS(NINT_DISC)
287
288resel_disc:
289	MOVE 0x00 TO SCNTL2
290	CLEAR ACK
291	WAIT DISCONNECT
292	INT PASS(NINT_RESEL)
293
294ext_msg_in:
295	CLEAR ACK
296	MOVE FROM PASS(NTOFFSET(nt_extmsg)), WHEN MSG_IN
297	JUMP REL(wide_msg_in), IF 0x02
298	JUMP REL(sync_msg_in), IF 0x03
299	JUMP REL(ppr_msg_in), IF 0x06
300	INT PASS(NINT_UNS_EXTMSG)
301
302ignore_wide_residue:
303	CLEAR ACK
304	MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN
305	INT PASS(NINT_IWR)
306
307ppr_msg_in:
308	CLEAR ACK
309	MOVE FROM PASS(NTOFFSET(nt_pprin)), WHEN MSG_IN
310; don't ack the last byte until after the interrupt handler returns
311	INT PASS(NINT_PPR), IF 0x04
312
313sync_msg_in:
314	CLEAR ACK
315	MOVE FROM PASS(NTOFFSET(nt_syncin)), WHEN MSG_IN
316; don't ack the last byte until after the interrupt handler returns
317	INT PASS(NINT_SDTR), IF 0x01
318
319; unsupported extended message
320	INT PASS(NINT_UNS_EXTMSG)
321
322wide_msg_in:
323	CLEAR ACK
324	MOVE FROM PASS(NTOFFSET(nt_widein)), WHEN MSG_IN
325; don't ack the last byte until after the interrupt handler returns
326	INT PASS(NINT_WDTR), IF 0x03
327
328; unsupported extended message
329	INT PASS(NINT_UNS_EXTMSG)
330
331phase_mis_match:
332	INT PASS(NINT_PMM)
333
334;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
335
336command_phase:
337	MOVE FROM PASS(NTOFFSET(nt_cmd)), WHEN CMD
338	JUMP REL(msgin), WHEN MSG_IN
339	JUMP REL(switch)
340
341
342;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
343
344status_phase:
345	MOVE FROM PASS(NTOFFSET(nt_status)), WHEN STATUS
346	JUMP REL(switch), WHEN NOT MSG_IN
347	MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN
348
349
350;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
351
352end:
353	MOVE 0x00 TO SCNTL2
354	CLEAR ACK
355	WAIT DISCONNECT
356	INT PASS(NINT_OK)
357
358
359;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
360
361; The data in and data out scatter/gather dma lists are set up by
362; the driver such that they're right justified in the table indirect
363; array. In other words if the s/g list contains a single segment then
364; only the last entry in the list is used. If the s/g list contains
365; two entries then the last two entries are used, etc.. The jump table
366; below skip over the unused entries. This way when a phase mismatch
367; interrupt occurs I can easily compute how far into the list processing
368; has proceeded and reset the pointers and the scratch register to
369; properly restart the dma.
370
371dataout_gotos:
372	MOVE SCRATCHA0 TO SFBR
373	INT PASS(NINT_TOOMUCHDATA), IF 0
374	JUMP REL(dataout_1), IF 1
375	JUMP REL(dataout_2), IF 2
376	JUMP REL(dataout_3), IF 3
377	JUMP REL(dataout_4), IF 4
378	JUMP REL(dataout_5), IF 5
379	JUMP REL(dataout_6), IF 6
380	JUMP REL(dataout_7), IF 7
381	JUMP REL(dataout_8), IF 8
382	JUMP REL(dataout_9), IF 9
383	JUMP REL(dataout_10), IF 10
384	JUMP REL(dataout_11), IF 11
385	JUMP REL(dataout_12), IF 12
386	JUMP REL(dataout_13), IF 13
387	JUMP REL(dataout_14), IF 14
388	JUMP REL(dataout_15), IF 15
389	JUMP REL(dataout_16), IF 16
390	JUMP REL(dataout_17), IF 17
391	INT PASS(NINT_TOOMUCHDATA)
392
393dataout_17:	MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN DATA_OUT
394dataout_16:	MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN DATA_OUT
395dataout_15:	MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN DATA_OUT
396dataout_14:	MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN DATA_OUT
397dataout_13:	MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN DATA_OUT
398dataout_12:	MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN DATA_OUT
399dataout_11:	MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN DATA_OUT
400dataout_10:	MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN DATA_OUT
401dataout_9:	MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN DATA_OUT
402dataout_8:	MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN DATA_OUT
403dataout_7:	MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN DATA_OUT
404dataout_6:	MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN DATA_OUT
405dataout_5:	MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN DATA_OUT
406dataout_4:	MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN DATA_OUT
407dataout_3:	MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN DATA_OUT
408dataout_2:	MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN DATA_OUT
409dataout_1:	MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN DATA_OUT
410do_list_end:
411	MOVE 0 TO SCRATCHA0
412	JUMP REL(switch)
413
414;
415; data in processing
416;
417
418datain_gotos:
419	MOVE SCRATCHA0 TO SFBR
420	INT PASS(NINT_TOOMUCHDATA), IF 0
421	JUMP REL(datain_1), IF 1
422	JUMP REL(datain_2), IF 2
423	JUMP REL(datain_3), IF 3
424	JUMP REL(datain_4), IF 4
425	JUMP REL(datain_5), IF 5
426	JUMP REL(datain_6), IF 6
427	JUMP REL(datain_7), IF 7
428	JUMP REL(datain_8), IF 8
429	JUMP REL(datain_9), IF 9
430	JUMP REL(datain_10), IF 10
431	JUMP REL(datain_11), IF 11
432	JUMP REL(datain_12), IF 12
433	JUMP REL(datain_13), IF 13
434	JUMP REL(datain_14), IF 14
435	JUMP REL(datain_15), IF 15
436	JUMP REL(datain_16), IF 16
437	JUMP REL(datain_17), IF 17
438	INT PASS(NINT_TOOMUCHDATA)
439
440datain_17:	MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN DATA_IN
441datain_16:	MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN DATA_IN
442datain_15:	MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN DATA_IN
443datain_14:	MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN DATA_IN
444datain_13:	MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN DATA_IN
445datain_12:	MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN DATA_IN
446datain_11:	MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN DATA_IN
447datain_10:	MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN DATA_IN
448datain_9:	MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN DATA_IN
449datain_8:	MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN DATA_IN
450datain_7:	MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN DATA_IN
451datain_6:	MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN DATA_IN
452datain_5:	MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN DATA_IN
453datain_4:	MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN DATA_IN
454datain_3:	MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN DATA_IN
455datain_2:	MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN DATA_IN
456datain_1:	MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN DATA_IN
457di_list_end:
458	MOVE 0 TO SCRATCHA0
459	JUMP REL(switch)
460
461
462dt_dataout_gotos:
463	MOVE SCRATCHA0 TO SFBR
464	INT PASS(NINT_TOOMUCHDATA), IF 0
465	JUMP REL(dt_dataout_1), IF 1
466	JUMP REL(dt_dataout_2), IF 2
467	JUMP REL(dt_dataout_3), IF 3
468	JUMP REL(dt_dataout_4), IF 4
469	JUMP REL(dt_dataout_5), IF 5
470	JUMP REL(dt_dataout_6), IF 6
471	JUMP REL(dt_dataout_7), IF 7
472	JUMP REL(dt_dataout_8), IF 8
473	JUMP REL(dt_dataout_9), IF 9
474	JUMP REL(dt_dataout_10), IF 10
475	JUMP REL(dt_dataout_11), IF 11
476	JUMP REL(dt_dataout_12), IF 12
477	JUMP REL(dt_dataout_13), IF 13
478	JUMP REL(dt_dataout_14), IF 14
479	JUMP REL(dt_dataout_15), IF 15
480	JUMP REL(dt_dataout_16), IF 16
481	JUMP REL(dt_dataout_17), IF 17
482	INT PASS(NINT_TOOMUCHDATA)
483
484dt_dataout_17:	MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN RES4
485dt_dataout_16:	MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN RES4
486dt_dataout_15:	MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN RES4
487dt_dataout_14:	MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN RES4
488dt_dataout_13:	MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN RES4
489dt_dataout_12:	MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN RES4
490dt_dataout_11:	MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN RES4
491dt_dataout_10:	MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN RES4
492dt_dataout_9:	MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN RES4
493dt_dataout_8:	MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN RES4
494dt_dataout_7:	MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN RES4
495dt_dataout_6:	MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN RES4
496dt_dataout_5:	MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN RES4
497dt_dataout_4:	MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN RES4
498dt_dataout_3:	MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN RES4
499dt_dataout_2:	MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN RES4
500dt_dataout_1:	MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN RES4
501dt_do_list_end:
502	MOVE 0 TO SCRATCHA0
503	JUMP REL(switch)
504
505;
506; data in processing
507;
508
509dt_datain_gotos:
510	MOVE SCRATCHA0 TO SFBR
511	INT PASS(NINT_TOOMUCHDATA), IF 0
512	JUMP REL(dt_datain_1), IF 1
513	JUMP REL(dt_datain_2), IF 2
514	JUMP REL(dt_datain_3), IF 3
515	JUMP REL(dt_datain_4), IF 4
516	JUMP REL(dt_datain_5), IF 5
517	JUMP REL(dt_datain_6), IF 6
518	JUMP REL(dt_datain_7), IF 7
519	JUMP REL(dt_datain_8), IF 8
520	JUMP REL(dt_datain_9), IF 9
521	JUMP REL(dt_datain_10), IF 10
522	JUMP REL(dt_datain_11), IF 11
523	JUMP REL(dt_datain_12), IF 12
524	JUMP REL(dt_datain_13), IF 13
525	JUMP REL(dt_datain_14), IF 14
526	JUMP REL(dt_datain_15), IF 15
527	JUMP REL(dt_datain_16), IF 16
528	JUMP REL(dt_datain_17), IF 17
529	INT PASS(NINT_TOOMUCHDATA)
530
531dt_datain_17:	MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN RES5
532dt_datain_16:	MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN RES5
533dt_datain_15:	MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN RES5
534dt_datain_14:	MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN RES5
535dt_datain_13:	MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN RES5
536dt_datain_12:	MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN RES5
537dt_datain_11:	MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN RES5
538dt_datain_10:	MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN RES5
539dt_datain_9:	MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN RES5
540dt_datain_8:	MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN RES5
541dt_datain_7:	MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN RES5
542dt_datain_6:	MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN RES5
543dt_datain_5:	MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN RES5
544dt_datain_4:	MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN RES5
545dt_datain_3:	MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN RES5
546dt_datain_2:	MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN RES5
547dt_datain_1:	MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN RES5
548dt_di_list_end:
549	MOVE 0 TO SCRATCHA0
550	JUMP REL(switch)
551