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 32ARCH 700 33 34; interrupt codes 35ABSOLUTE int_done = 0xbeef0000 36ABSOLUTE int_msgin = 0xbeef0001 37ABSOLUTE int_extmsg = 0xbeef0002 38ABSOLUTE int_resel = 0xbeef0003 39ABSOLUTE int_res_id = 0xbeef0004 40ABSOLUTE int_resfail = 0xbeef0005 41ABSOLUTE int_disc = 0xbeef0006 42ABSOLUTE int_err = 0xdeadbeef 43 44; patch entries 45ENTRY p_resel_msgin_move 46ENTRY p_select 47ENTRY p_datain_jump 48ENTRY p_dataout_jump 49ENTRY p_msgin_move 50ENTRY p_msgout_move 51ENTRY p_cmdout_move 52ENTRY p_status_move 53ENTRY p_extmsglen_move 54ENTRY p_extmsgin_move 55 56 57PROC oosiop_script: 58 59ENTRY wait_reselect 60wait_reselect: 61 WAIT RESELECT REL(reselect_fail) 62 INT int_resel 63reselect_fail: 64 INT int_resfail 65 66ENTRY wait_resel_identify 67wait_resel_identify: 68 INT int_err, WHEN NOT MSG_IN 69p_resel_msgin_move: 70 MOVE 0, 0, WHEN MSG_IN 71 INT int_res_id 72 73ENTRY start_select 74start_select: 75p_select: 76 SELECT ATN 0, REL(wait_reselect) 77 78ENTRY phasedispatch 79phasedispatch: 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 84p_datain_jump: 85 JUMP 0, WHEN DATA_IN 86p_dataout_jump: 87 JUMP 0, WHEN DATA_OUT 88 INT int_err 89 90msgin: 91 CLEAR ATN 92p_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 99ENTRY ack_msgin 100ack_msgin: 101 CLEAR ACK 102 JUMP REL(phasedispatch) 103 104ENTRY sendmsg 105sendmsg: 106 SET ATN 107 CLEAR ACK 108msgout: 109p_msgout_move: 110 MOVE 0, 0, WHEN MSG_OUT 111 CLEAR ATN 112 JUMP REL(phasedispatch) 113 114cmdout: 115 CLEAR ATN 116p_cmdout_move: 117 MOVE 0, 0, WHEN CMD 118 JUMP REL(phasedispatch) 119 120status: 121p_status_move: 122 MOVE 0, 0, WHEN STATUS 123 JUMP REL(phasedispatch) 124 125disconnect: 126 CLEAR ACK 127 WAIT DISCONNECT 128 INT int_disc 129 130complete: 131 CLEAR ACK 132 WAIT DISCONNECT 133 INT int_done 134 135; receive extended message length 136extmsgsetup: 137 CLEAR ACK 138 INT int_err, IF NOT MSG_IN 139p_extmsglen_move: 140 MOVE 0, 0, WHEN MSG_IN 141 INT int_extmsg 142 143; receive extended message 144ENTRY rcv_extmsg 145rcv_extmsg: 146 CLEAR ACK 147 INT int_err, IF NOT MSG_IN 148p_extmsgin_move: 149 MOVE 0, 0, WHEN MSG_IN 150 INT int_msgin 151