1*91d0eb55Smhitch; $NetBSD: siop_script.ss,v 1.4 1999/03/26 22:50:26 mhitch Exp $ 2f1e1796cSchopps 3f1e1796cSchopps; 4f1e1796cSchopps; Copyright (c) 1995 Michael L. Hitch 5f1e1796cSchopps; All rights reserved. 6f1e1796cSchopps; 7f1e1796cSchopps; Redistribution and use in source and binary forms, with or without 8f1e1796cSchopps; modification, are permitted provided that the following conditions 9f1e1796cSchopps; are met: 10f1e1796cSchopps; 1. Redistributions of source code must retain the above copyright 11f1e1796cSchopps; notice, this list of conditions and the following disclaimer. 12f1e1796cSchopps; 2. Redistributions in binary form must reproduce the above copyright 13f1e1796cSchopps; notice, this list of conditions and the following disclaimer in the 14f1e1796cSchopps; documentation and/or other materials provided with the distribution. 15f1e1796cSchopps; 3. All advertising materials mentioning features or use of this software 16f1e1796cSchopps; must display the following acknowledgement: 17f1e1796cSchopps; This product includes software developed by Michael L. Hitch. 18f1e1796cSchopps; 4. The name of the author may not be used to endorse or promote products 19f1e1796cSchopps; derived from this software without specific prior written permission 20f1e1796cSchopps; 21f1e1796cSchopps; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22f1e1796cSchopps; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23f1e1796cSchopps; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24f1e1796cSchopps; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25f1e1796cSchopps; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26f1e1796cSchopps; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27f1e1796cSchopps; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28f1e1796cSchopps; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29f1e1796cSchopps; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30f1e1796cSchopps; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31f1e1796cSchopps; 32f1e1796cSchopps 334726ce28Schopps; NCR 53c710 script 344726ce28Schopps; 35*91d0eb55SmhitchARCH 710 36*91d0eb55Smhitch; 374726ce28SchoppsABSOLUTE ds_Device = 0 384726ce28SchoppsABSOLUTE ds_MsgOut = ds_Device + 4 394726ce28SchoppsABSOLUTE ds_Cmd = ds_MsgOut + 8 404726ce28SchoppsABSOLUTE ds_Status = ds_Cmd + 8 414726ce28SchoppsABSOLUTE ds_Msg = ds_Status + 8 424726ce28SchoppsABSOLUTE ds_MsgIn = ds_Msg + 8 434726ce28SchoppsABSOLUTE ds_ExtMsg = ds_MsgIn + 8 444726ce28SchoppsABSOLUTE ds_SyncMsg = ds_ExtMsg + 8 454726ce28SchoppsABSOLUTE ds_Data1 = ds_SyncMsg + 8 464726ce28SchoppsABSOLUTE ds_Data2 = ds_Data1 + 8 474726ce28SchoppsABSOLUTE ds_Data3 = ds_Data2 + 8 484726ce28SchoppsABSOLUTE ds_Data4 = ds_Data3 + 8 494726ce28SchoppsABSOLUTE ds_Data5 = ds_Data4 + 8 504726ce28SchoppsABSOLUTE ds_Data6 = ds_Data5 + 8 514726ce28SchoppsABSOLUTE ds_Data7 = ds_Data6 + 8 524726ce28SchoppsABSOLUTE ds_Data8 = ds_Data7 + 8 534726ce28SchoppsABSOLUTE ds_Data9 = ds_Data8 + 8 544726ce28Schopps 554726ce28SchoppsABSOLUTE ok = 0xff00 564726ce28SchoppsABSOLUTE err1 = 0xff01 574726ce28SchoppsABSOLUTE err2 = 0xff02 584726ce28SchoppsABSOLUTE err3 = 0xff03 594726ce28SchoppsABSOLUTE err4 = 0xff04 604726ce28SchoppsABSOLUTE err5 = 0xff05 614726ce28SchoppsABSOLUTE err6 = 0xff06 624726ce28SchoppsABSOLUTE err7 = 0xff07 634726ce28SchoppsABSOLUTE err8 = 0xff08 644726ce28SchoppsABSOLUTE err9 = 0xff09 654726ce28SchoppsABSOLUTE err10 = 0xff0a 66*91d0eb55SmhitchABSOLUTE err11 = 0xff0b 674726ce28Schopps 684726ce28SchoppsENTRY scripts 694726ce28SchoppsENTRY switch 704726ce28SchoppsENTRY wait_reselect 7122087826SchoppsENTRY dataout 7222087826SchoppsENTRY datain 73*91d0eb55SmhitchENTRY clear_ack 744726ce28Schopps 754726ce28SchoppsPROC scripts: 764726ce28Schopps 774726ce28Schoppsscripts: 784726ce28Schopps 794726ce28Schopps SELECT ATN FROM ds_Device, REL(reselect) 804726ce28Schopps; 814726ce28Schoppsswitch: 824726ce28Schopps JUMP REL(msgin), WHEN MSG_IN 834726ce28Schopps JUMP REL(msgout), IF MSG_OUT 844726ce28Schopps JUMP REL(command_phase), IF CMD 854726ce28Schopps JUMP REL(dataout), IF DATA_OUT 864726ce28Schopps JUMP REL(datain), IF DATA_IN 874726ce28Schopps JUMP REL(end), IF STATUS 884726ce28Schopps 8922087826Schopps INT err5 ; Unrecognized phase 904726ce28Schopps 914726ce28Schoppsmsgin: 924726ce28Schopps MOVE FROM ds_MsgIn, WHEN MSG_IN 934726ce28Schopps JUMP REL(ext_msg), IF 0x01 ; extended message 944726ce28Schopps JUMP REL(disc), IF 0x04 ; disconnect message 9522087826Schopps JUMP REL(msg_sdp), IF 0x02 ; save data pointers 9622087826Schopps JUMP REL(msg_rej), IF 0x07 ; message reject 9722087826Schopps JUMP REL(msg_rdp), IF 0x03 ; restore data pointers 9822087826Schopps INT err6 ; unrecognized message 994726ce28Schopps 1004726ce28Schoppsmsg_rej: 101*91d0eb55Smhitch; Do we need to interrupt host here to let it handle the reject? 102*91d0eb55Smhitchmsg_rdp: 103*91d0eb55Smhitchclear_ack: 10422087826Schopps CLEAR ACK 1054726ce28Schopps CLEAR ATN 1064726ce28Schopps JUMP REL(switch) 1074726ce28Schopps 1084726ce28Schoppsext_msg: 10922087826Schopps CLEAR ACK 1104726ce28Schopps MOVE FROM ds_ExtMsg, WHEN MSG_IN 1114726ce28Schopps JUMP REL(sync_msg), IF 0x03 11222087826Schopps int err7 ; extended message not SDTR 1134726ce28Schopps 1144726ce28Schoppssync_msg: 1154726ce28Schopps CLEAR ACK 1164726ce28Schopps MOVE FROM ds_SyncMsg, WHEN MSG_IN 117*91d0eb55Smhitch int err11 ; Let host handle the message 118*91d0eb55Smhitch; If we continue from the interrupt, the host has set up a response 119*91d0eb55Smhitch; message to be sent. Set ATN, clear ACK, and continue. 120*91d0eb55Smhitch SET ATN 1214726ce28Schopps CLEAR ACK 1224726ce28Schopps JUMP REL(switch) 1234726ce28Schopps 1244726ce28Schoppsdisc: 12522087826Schopps CLEAR ACK 1264726ce28Schopps WAIT DISCONNECT 1274726ce28Schopps 12822087826Schopps int err2 ; signal disconnect w/o save DP 1294726ce28Schopps 13022087826Schoppsmsg_sdp: 13122087826Schopps CLEAR ACK ; acknowledge message 13222087826Schopps JUMP REL(switch), WHEN NOT MSG_IN 13322087826Schopps MOVE FROM ds_ExtMsg, WHEN MSG_IN 13422087826Schopps INT err8, IF NOT 0x04 ; interrupt if not disconnect 13522087826Schopps CLEAR ACK 13622087826Schopps WAIT DISCONNECT 13722087826Schopps 13822087826Schopps INT err1 ; signal disconnect 13922087826Schopps 14022087826Schoppsreselect: 1414726ce28Schoppswait_reselect: 1424726ce28Schopps WAIT RESELECT REL(select_adr) 14322087826Schopps MOVE LCRC to SFBR ; Save reselect ID 14422087826Schopps MOVE SFBR to SCRATCH0 1454726ce28Schopps 14622087826Schopps INT err9, WHEN NOT MSG_IN ; didn't get IDENTIFY 1474726ce28Schopps MOVE FROM ds_Msg, WHEN MSG_IN 14822087826Schopps INT err3 ; let host know about reconnect 14922087826Schopps CLEAR ACK ; acknowlege the message 1504726ce28Schopps JUMP REL(switch) 1514726ce28Schopps 15222087826Schopps 15322087826Schoppsselect_adr: 15422087826Schopps MOVE SCNTL1 & 0x10 to SFBR ; get connected status 15522087826Schopps INT err4, IF 0x00 ; tell host if not connected 15622087826Schopps MOVE CTEST2 & 0x40 to SFBR ; clear Sig_P 15722087826Schopps JUMP REL(wait_reselect) ; and try reselect again 15822087826Schopps 1594726ce28Schoppsmsgout: 1604726ce28Schopps MOVE FROM ds_MsgOut, WHEN MSG_OUT 1614726ce28Schopps JUMP REL(switch) 1624726ce28Schopps 1634726ce28Schoppscommand_phase: 1644726ce28Schopps CLEAR ATN 1654726ce28Schopps MOVE FROM ds_Cmd, WHEN CMD 1664726ce28Schopps JUMP REL(switch) 1674726ce28Schopps 1684726ce28Schoppsdataout: 1694726ce28Schopps MOVE FROM ds_Data1, WHEN DATA_OUT 1704726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1714726ce28Schopps MOVE FROM ds_Data2, WHEN DATA_OUT 1724726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1734726ce28Schopps MOVE FROM ds_Data3, WHEN DATA_OUT 1744726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1754726ce28Schopps MOVE FROM ds_Data4, WHEN DATA_OUT 1764726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1774726ce28Schopps MOVE FROM ds_Data5, WHEN DATA_OUT 1784726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1794726ce28Schopps MOVE FROM ds_Data6, WHEN DATA_OUT 1804726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1814726ce28Schopps MOVE FROM ds_Data7, WHEN DATA_OUT 1824726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1834726ce28Schopps MOVE FROM ds_Data8, WHEN DATA_OUT 1844726ce28Schopps CALL REL(switch), WHEN NOT DATA_OUT 1854726ce28Schopps MOVE FROM ds_Data9, WHEN DATA_OUT 1864726ce28Schopps CALL REL(switch) 1874726ce28Schopps 1884726ce28Schoppsdatain: 1894726ce28Schopps MOVE FROM ds_Data1, WHEN DATA_IN 1904726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 1914726ce28Schopps MOVE FROM ds_Data2, WHEN DATA_IN 1924726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 1934726ce28Schopps MOVE FROM ds_Data3, WHEN DATA_IN 1944726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 1954726ce28Schopps MOVE FROM ds_Data4, WHEN DATA_IN 1964726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 1974726ce28Schopps MOVE FROM ds_Data5, WHEN DATA_IN 1984726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 1994726ce28Schopps MOVE FROM ds_Data6, WHEN DATA_IN 2004726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 2014726ce28Schopps MOVE FROM ds_Data7, WHEN DATA_IN 2024726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 2034726ce28Schopps MOVE FROM ds_Data8, WHEN DATA_IN 2044726ce28Schopps CALL REL(switch), WHEN NOT DATA_IN 2054726ce28Schopps MOVE FROM ds_Data9, WHEN DATA_IN 2064726ce28Schopps CALL REL(switch) 2074726ce28Schopps 2084726ce28Schoppsend: 2094726ce28Schopps MOVE FROM ds_Status, WHEN STATUS 21022087826Schopps int err10, WHEN NOT MSG_IN ; status not followed by msg 2114726ce28Schopps MOVE FROM ds_Msg, WHEN MSG_IN 2124726ce28Schopps CLEAR ACK 2134726ce28Schopps WAIT DISCONNECT 21422087826Schopps INT ok ; signal completion 2154726ce28Schopps JUMP REL(wait_reselect) 216