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