Home | History | Annotate | Line # | Download | only in dev
siop_script.ss revision 1.4
      1  1.4  mhitch ;	$NetBSD: siop_script.ss,v 1.4 1999/03/26 22:50:26 mhitch Exp $
      2  1.2  chopps 
      3  1.2  chopps ;
      4  1.2  chopps ; Copyright (c) 1995 Michael L. Hitch
      5  1.2  chopps ; All rights reserved.
      6  1.2  chopps ;
      7  1.2  chopps ; Redistribution and use in source and binary forms, with or without
      8  1.2  chopps ; modification, are permitted provided that the following conditions
      9  1.2  chopps ; are met:
     10  1.2  chopps ; 1. Redistributions of source code must retain the above copyright
     11  1.2  chopps ;    notice, this list of conditions and the following disclaimer.
     12  1.2  chopps ; 2. Redistributions in binary form must reproduce the above copyright
     13  1.2  chopps ;    notice, this list of conditions and the following disclaimer in the
     14  1.2  chopps ;    documentation and/or other materials provided with the distribution.
     15  1.2  chopps ; 3. All advertising materials mentioning features or use of this software
     16  1.2  chopps ;    must display the following acknowledgement:
     17  1.2  chopps ;      This product includes software developed by Michael L. Hitch.
     18  1.2  chopps ; 4. The name of the author may not be used to endorse or promote products
     19  1.2  chopps ;    derived from this software without specific prior written permission
     20  1.2  chopps ;
     21  1.2  chopps ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.2  chopps ; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.2  chopps ; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.2  chopps ; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.2  chopps ; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.2  chopps ; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.2  chopps ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.2  chopps ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.2  chopps ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.2  chopps ; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.2  chopps ;
     32  1.2  chopps 
     33  1.1  chopps ; NCR 53c710 script
     34  1.1  chopps ;
     35  1.4  mhitch ARCH 710
     36  1.4  mhitch ;
     37  1.1  chopps ABSOLUTE ds_Device	= 0
     38  1.1  chopps ABSOLUTE ds_MsgOut 	= ds_Device + 4
     39  1.1  chopps ABSOLUTE ds_Cmd		= ds_MsgOut + 8
     40  1.1  chopps ABSOLUTE ds_Status	= ds_Cmd + 8
     41  1.1  chopps ABSOLUTE ds_Msg		= ds_Status + 8
     42  1.1  chopps ABSOLUTE ds_MsgIn	= ds_Msg + 8
     43  1.1  chopps ABSOLUTE ds_ExtMsg	= ds_MsgIn + 8
     44  1.1  chopps ABSOLUTE ds_SyncMsg	= ds_ExtMsg + 8
     45  1.1  chopps ABSOLUTE ds_Data1	= ds_SyncMsg + 8
     46  1.1  chopps ABSOLUTE ds_Data2	= ds_Data1 + 8
     47  1.1  chopps ABSOLUTE ds_Data3	= ds_Data2 + 8
     48  1.1  chopps ABSOLUTE ds_Data4	= ds_Data3 + 8
     49  1.1  chopps ABSOLUTE ds_Data5	= ds_Data4 + 8
     50  1.1  chopps ABSOLUTE ds_Data6	= ds_Data5 + 8
     51  1.1  chopps ABSOLUTE ds_Data7	= ds_Data6 + 8
     52  1.1  chopps ABSOLUTE ds_Data8	= ds_Data7 + 8
     53  1.1  chopps ABSOLUTE ds_Data9	= ds_Data8 + 8
     54  1.1  chopps 
     55  1.1  chopps ABSOLUTE ok		= 0xff00
     56  1.1  chopps ABSOLUTE err1		= 0xff01
     57  1.1  chopps ABSOLUTE err2		= 0xff02
     58  1.1  chopps ABSOLUTE err3		= 0xff03
     59  1.1  chopps ABSOLUTE err4		= 0xff04
     60  1.1  chopps ABSOLUTE err5		= 0xff05
     61  1.1  chopps ABSOLUTE err6		= 0xff06
     62  1.1  chopps ABSOLUTE err7		= 0xff07
     63  1.1  chopps ABSOLUTE err8		= 0xff08
     64  1.1  chopps ABSOLUTE err9		= 0xff09
     65  1.1  chopps ABSOLUTE err10		= 0xff0a
     66  1.4  mhitch ABSOLUTE err11		= 0xff0b
     67  1.1  chopps 
     68  1.1  chopps ENTRY	scripts
     69  1.1  chopps ENTRY	switch
     70  1.1  chopps ENTRY	wait_reselect
     71  1.3  chopps ENTRY	dataout
     72  1.3  chopps ENTRY	datain
     73  1.4  mhitch ENTRY	clear_ack
     74  1.1  chopps 
     75  1.1  chopps PROC	scripts:
     76  1.1  chopps 
     77  1.1  chopps scripts:
     78  1.1  chopps 
     79  1.1  chopps 	SELECT ATN FROM ds_Device, REL(reselect)
     80  1.1  chopps ;
     81  1.1  chopps switch:
     82  1.1  chopps 	JUMP REL(msgin), WHEN MSG_IN
     83  1.1  chopps 	JUMP REL(msgout), IF MSG_OUT
     84  1.1  chopps 	JUMP REL(command_phase), IF CMD
     85  1.1  chopps 	JUMP REL(dataout), IF DATA_OUT
     86  1.1  chopps 	JUMP REL(datain), IF DATA_IN
     87  1.1  chopps 	JUMP REL(end), IF STATUS
     88  1.1  chopps 
     89  1.3  chopps 	INT err5			; Unrecognized phase
     90  1.1  chopps 
     91  1.1  chopps msgin:
     92  1.1  chopps 	MOVE FROM ds_MsgIn, WHEN MSG_IN
     93  1.1  chopps 	JUMP REL(ext_msg), IF 0x01	; extended message
     94  1.1  chopps 	JUMP REL(disc), IF 0x04		; disconnect message
     95  1.3  chopps 	JUMP REL(msg_sdp), IF 0x02	; save data pointers
     96  1.3  chopps 	JUMP REL(msg_rej), IF 0x07	; message reject
     97  1.3  chopps 	JUMP REL(msg_rdp), IF 0x03	; restore data pointers
     98  1.3  chopps 	INT err6			; unrecognized message
     99  1.1  chopps 
    100  1.4  mhitch msg_rej:
    101  1.4  mhitch ; Do we need to interrupt host here to let it handle the reject?
    102  1.3  chopps msg_rdp:
    103  1.4  mhitch clear_ack:
    104  1.3  chopps 	CLEAR ACK
    105  1.1  chopps 	CLEAR ATN
    106  1.1  chopps 	JUMP REL(switch)
    107  1.1  chopps 
    108  1.1  chopps ext_msg:
    109  1.3  chopps 	CLEAR ACK
    110  1.1  chopps 	MOVE FROM ds_ExtMsg, WHEN MSG_IN
    111  1.1  chopps 	JUMP REL(sync_msg), IF 0x03
    112  1.3  chopps 	int err7			; extended message not SDTR
    113  1.1  chopps 
    114  1.1  chopps sync_msg:
    115  1.1  chopps 	CLEAR ACK
    116  1.1  chopps 	MOVE FROM ds_SyncMsg, WHEN MSG_IN
    117  1.4  mhitch 	int err11			; Let host handle the message
    118  1.4  mhitch ; If we continue from the interrupt, the host has set up a response
    119  1.4  mhitch ; message to be sent.  Set ATN, clear ACK, and continue.
    120  1.4  mhitch 	SET ATN
    121  1.1  chopps 	CLEAR ACK
    122  1.1  chopps 	JUMP REL(switch)
    123  1.1  chopps 
    124  1.1  chopps disc:
    125  1.3  chopps 	CLEAR ACK
    126  1.3  chopps 	WAIT DISCONNECT
    127  1.3  chopps 
    128  1.3  chopps 	int err2			; signal disconnect w/o save DP
    129  1.3  chopps 
    130  1.3  chopps msg_sdp:
    131  1.3  chopps 	CLEAR ACK			; acknowledge message
    132  1.3  chopps 	JUMP REL(switch), WHEN NOT MSG_IN
    133  1.3  chopps 	MOVE FROM ds_ExtMsg, WHEN MSG_IN
    134  1.3  chopps 	INT err8, IF NOT 0x04		; interrupt if not disconnect
    135  1.3  chopps 	CLEAR ACK
    136  1.1  chopps 	WAIT DISCONNECT
    137  1.1  chopps 
    138  1.3  chopps 	INT err1			; signal disconnect
    139  1.1  chopps 
    140  1.3  chopps reselect:
    141  1.1  chopps wait_reselect:
    142  1.1  chopps 	WAIT RESELECT REL(select_adr)
    143  1.3  chopps 	MOVE LCRC to SFBR		; Save reselect ID
    144  1.3  chopps 	MOVE SFBR to SCRATCH0
    145  1.1  chopps 
    146  1.3  chopps 	INT err9, WHEN NOT MSG_IN	; didn't get IDENTIFY
    147  1.1  chopps 	MOVE FROM ds_Msg, WHEN MSG_IN
    148  1.3  chopps 	INT err3			; let host know about reconnect
    149  1.3  chopps 	CLEAR ACK			; acknowlege the message
    150  1.1  chopps 	JUMP REL(switch)
    151  1.1  chopps 
    152  1.3  chopps 
    153  1.3  chopps select_adr:
    154  1.3  chopps 	MOVE SCNTL1 & 0x10 to SFBR	; get connected status
    155  1.3  chopps 	INT err4, IF 0x00		; tell host if not connected
    156  1.3  chopps 	MOVE CTEST2 & 0x40 to SFBR	; clear Sig_P
    157  1.3  chopps 	JUMP REL(wait_reselect)		; and try reselect again
    158  1.3  chopps 
    159  1.1  chopps msgout:
    160  1.1  chopps 	MOVE FROM ds_MsgOut, WHEN MSG_OUT
    161  1.1  chopps 	JUMP REL(switch)
    162  1.1  chopps 
    163  1.1  chopps command_phase:
    164  1.1  chopps 	CLEAR ATN
    165  1.1  chopps 	MOVE FROM ds_Cmd, WHEN CMD
    166  1.1  chopps 	JUMP REL(switch)
    167  1.1  chopps 
    168  1.1  chopps dataout:
    169  1.1  chopps 	MOVE FROM ds_Data1, WHEN DATA_OUT
    170  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    171  1.1  chopps 	MOVE FROM ds_Data2, WHEN DATA_OUT
    172  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    173  1.1  chopps 	MOVE FROM ds_Data3, WHEN DATA_OUT
    174  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    175  1.1  chopps 	MOVE FROM ds_Data4, WHEN DATA_OUT
    176  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    177  1.1  chopps 	MOVE FROM ds_Data5, WHEN DATA_OUT
    178  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    179  1.1  chopps 	MOVE FROM ds_Data6, WHEN DATA_OUT
    180  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    181  1.1  chopps 	MOVE FROM ds_Data7, WHEN DATA_OUT
    182  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    183  1.1  chopps 	MOVE FROM ds_Data8, WHEN DATA_OUT
    184  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_OUT
    185  1.1  chopps 	MOVE FROM ds_Data9, WHEN DATA_OUT
    186  1.1  chopps 	CALL REL(switch)
    187  1.1  chopps 
    188  1.1  chopps datain:
    189  1.1  chopps 	MOVE FROM ds_Data1, WHEN DATA_IN
    190  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    191  1.1  chopps 	MOVE FROM ds_Data2, WHEN DATA_IN
    192  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    193  1.1  chopps 	MOVE FROM ds_Data3, WHEN DATA_IN
    194  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    195  1.1  chopps 	MOVE FROM ds_Data4, WHEN DATA_IN
    196  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    197  1.1  chopps 	MOVE FROM ds_Data5, WHEN DATA_IN
    198  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    199  1.1  chopps 	MOVE FROM ds_Data6, WHEN DATA_IN
    200  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    201  1.1  chopps 	MOVE FROM ds_Data7, WHEN DATA_IN
    202  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    203  1.1  chopps 	MOVE FROM ds_Data8, WHEN DATA_IN
    204  1.1  chopps 	CALL REL(switch), WHEN NOT DATA_IN
    205  1.1  chopps 	MOVE FROM ds_Data9, WHEN DATA_IN
    206  1.1  chopps 	CALL REL(switch)
    207  1.1  chopps 
    208  1.1  chopps end:
    209  1.1  chopps 	MOVE FROM ds_Status, WHEN STATUS
    210  1.3  chopps 	int err10, WHEN NOT MSG_IN	; status not followed by msg
    211  1.1  chopps 	MOVE FROM ds_Msg, WHEN MSG_IN
    212  1.1  chopps 	CLEAR ACK
    213  1.1  chopps 	WAIT DISCONNECT
    214  1.3  chopps 	INT ok				; signal completion
    215  1.1  chopps 	JUMP REL(wait_reselect)
    216