1; $OpenBSD: oosiop.ss,v 1.2 2004/10/01 04:08:45 jsg Exp $ 2; $NetBSD: oosiop.ss,v 1.2 2003/04/06 09:48:42 tsutsui Exp $ 3 4; 5; Copyright (c) 2001 Shuichiro URATA. All rights reserved. 6; 7; Redistribution and use in source and binary forms, with or without 8; modification, are permitted provided that the following conditions 9; are met: 10; 1. Redistributions of source code must retain the above copyright 11; notice, this list of conditions and the following disclaimer. 12; 2. Redistributions in binary form must reproduce the above copyright 13; notice, this list of conditions and the following disclaimer in the 14; documentation and/or other materials provided with the distribution. 15; 3. The name of the author may not be used to endorse or promote products 16; derived from this software without specific prior written permission. 17; 18; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28; 29 30; NCR 53c700 script 31; 32 33ARCH 700 34 35; interrupt codes 36ABSOLUTE int_done = 0xbeef0000 37ABSOLUTE int_msgin = 0xbeef0001 38ABSOLUTE int_extmsg = 0xbeef0002 39ABSOLUTE int_resel = 0xbeef0003 40ABSOLUTE int_res_id = 0xbeef0004 41ABSOLUTE int_resfail = 0xbeef0005 42ABSOLUTE int_disc = 0xbeef0006 43ABSOLUTE int_err = 0xdeadbeef 44 45; patch entries 46ENTRY p_resel_msgin_move 47ENTRY p_select 48ENTRY p_datain_jump 49ENTRY p_dataout_jump 50ENTRY p_msgin_move 51ENTRY p_msgout_move 52ENTRY p_cmdout_move 53ENTRY p_status_move 54ENTRY p_extmsglen_move 55ENTRY p_extmsgin_move 56 57 58PROC oosiop_script: 59 60ENTRY wait_reselect 61wait_reselect: 62 WAIT RESELECT REL(reselect_fail) 63 INT int_resel 64reselect_fail: 65 INT int_resfail 66 67ENTRY wait_resel_identify 68wait_resel_identify: 69 INT int_err, WHEN NOT MSG_IN 70p_resel_msgin_move: 71 MOVE 0, 0, WHEN MSG_IN 72 INT int_res_id 73 74ENTRY start_select 75start_select: 76p_select: 77 SELECT ATN 0, REL(wait_reselect) 78 79ENTRY phasedispatch 80phasedispatch: 81 JUMP REL(msgin), WHEN MSG_IN 82 JUMP REL(msgout), WHEN MSG_OUT 83 JUMP REL(status), WHEN STATUS 84 JUMP REL(cmdout), WHEN CMD 85p_datain_jump: 86 JUMP 0, WHEN DATA_IN 87p_dataout_jump: 88 JUMP 0, WHEN DATA_OUT 89 INT int_err 90 91msgin: 92 CLEAR ATN 93p_msgin_move: 94 MOVE 0, 0, WHEN MSG_IN 95 JUMP REL(complete), IF 0x00 96 JUMP REL(extmsgsetup), IF 0x01 97 JUMP REL(disconnect), IF 0x04 98 INT int_msgin 99 100ENTRY ack_msgin 101ack_msgin: 102 CLEAR ACK 103 JUMP REL(phasedispatch) 104 105ENTRY sendmsg 106sendmsg: 107 SET ATN 108 CLEAR ACK 109msgout: 110p_msgout_move: 111 MOVE 0, 0, WHEN MSG_OUT 112 CLEAR ATN 113 JUMP REL(phasedispatch) 114 115cmdout: 116 CLEAR ATN 117p_cmdout_move: 118 MOVE 0, 0, WHEN CMD 119 JUMP REL(phasedispatch) 120 121status: 122p_status_move: 123 MOVE 0, 0, WHEN STATUS 124 JUMP REL(phasedispatch) 125 126disconnect: 127 CLEAR ACK 128 WAIT DISCONNECT 129 INT int_disc 130 131complete: 132 CLEAR ACK 133 WAIT DISCONNECT 134 INT int_done 135 136; receive extended message length 137extmsgsetup: 138 CLEAR ACK 139 INT int_err, IF NOT MSG_IN 140p_extmsglen_move: 141 MOVE 0, 0, WHEN MSG_IN 142 INT int_extmsg 143 144; receive extended message 145ENTRY rcv_extmsg 146rcv_extmsg: 147 CLEAR ACK 148 INT int_err, IF NOT MSG_IN 149p_extmsgin_move: 150 MOVE 0, 0, WHEN MSG_IN 151 INT int_msgin 152