📄 sym895scr.n
字号:
;*/doDataOut:move PHASE_DATA_OUT to SCRATCHA3; scattered data transfers are implemented here.; first check if its scattered data transfer or not move SCRATCHC0 to SFBRjump REL(doScatDataOut) if not 0; its not scattered data transfer.move from OFFSET_DATA_OUT, when DATA_OUTjump REL(nextPhase)doScatDataOut:; save the initial DSA register for restoring afterwards.move DSA0 + 0 to SFBRmove SFBR to SCRATCHD0move DSA1 + 0 to SFBRmove SFBR to SCRATCHD1move DSA2 + 0 to SFBRmove SFBR to SCRATCHD2move DSA3 + 0 to SFBRmove SFBR to SCRATCHD3; we have to do a scatered data transfer. ; scratchc1 contains the total number of scattered elements; scratchc2 contains how many are remaining elements to be transferred.move SCRATCHC1 to SFBRscatDataStart:; now see if any more scattered data is to be transferred.move SFBR to SCRATCHC2jump REL(scatDataEnd) if 0move from OFFSET_SCAT_DATA, when DATA_OUT ; transfer data move DSA0 + 8 to DSA0 ; point to next data location.jump REL(scatNoCarry), if not carrymove DSA1 + 0 to SFBR with carrymove SFBR to DSA1move DSA2 + 0 to SFBR with carrymove SFBR to DSA2move DSA3 + 0 to SFBR with carrymove SFBR to DSA3scatNoCarry:; by now address is successfully incremented.move SCRATCHC2 - 1 to SFBRjump REL(scatDataStart);Target changed the phaseint SYM895_ILLEGAL_PHASEscatDataEnd:move SCRATCHD0 to SFBRmove SFBR to DSA0move SCRATCHD1 to SFBRmove SFBR to DSA1move SCRATCHD2 to SFBRmove SFBR to DSA2move SCRATCHD3 to SFBRmove SFBR to DSA3jump REL(nextPhase);/************************************************************************; *; * doDataIn - handle Data In phase; */doDataIn:move PHASE_DATA_IN to SCRATCHA3 move from OFFSET_DATA_IN, when DATA_INjump REL(nextPhase);/************************************************************************; *; * doCommand - handle Command phase; */doCommand:move PHASE_COMMAND to SCRATCHA3 move from OFFSET_CMD, when CMDjump REL(nextPhase);/************************************************************************; *; * doStatus - handle STATUS phase; */doStatus:move PHASE_STATUS to SCRATCHA3 move from OFFSET_STATUS, when STATUSjump REL(nextPhase);/************************************************************************; *; * doMsgOut - handle MSG OUT phase; */doMsgOut:move PHASE_MSG_OUT to SCRATCHA3 move SCRATCHA1 to SFBRint SYM895_NO_MSG_OUT if M_OUT_NONE ; if msg out state is none ; Inform Host.call REL(assertAtn) if M_OUT_SENT ; assert ATN for retries.move from OFFSET_MSG_OUT, when MSG_OUT ; transfer datamove M_OUT_SENT to SFBRmove SFBR to SCRATCHA1 ; set msg out state to SENTjump REL(nextPhase);/************************************************************************; *; * doMsgIn - handle MSG IN phase; */doMsgIn:; Now we have a message to be recieved. This could be a simple or a multibyte; message. We can check the message type and do a little processing here.; But unless we can take a decision here, we will defer the processing to; the host. Multi Byte messages are handled separately.move PHASE_MSG_IN to SCRATCHA3 move SCRATCHA2 to SFBRjump REL(contExtMsg) if M_IN_EXT_MSG_DATA move from OFFSET_MSG_IN, when MSG_IN ; get the data injump REL(twobyte) if 0x20 and mask 0x0f ; a two byte message.; now check the message typejump REL(disconn) if M_DISCONNECT ; Disconnect messagejump REL(complete) if M_CMD_COMPLETE ; command complete messagejump REL(extended) if M_EXT_MSG ; extended messageint SYM895_MESSAGE_IN_RECVD ; host handles the rest of them.;; received the Disconnect message;disconn:move 0x00 to SCNTL2clear ackcall REL(timeoutEnable)wait disconnectint SYM895_DISCONNECTED;; received a Command Complete message; complete:move 0x00 to SCNTL2clear ackcall REL(timeoutEnable)wait disconnectint SYM895_CMD_COMPLETE;; Received the first byte of a Two Byte message.; read the second byte and interrupt the host.;twobyte:clear ackmove from OFFSET_MSG_IN_SECOND, when MSG_INint SYM895_MESSAGE_IN_RECVD;; Received the first byte of a Multi Byte message.; Read the message size and interrupt host.;extended:clear ackmove from OFFSET_MSG_IN_SECOND, when MSG_INmove M_IN_EXT_MSG_DATA to sfbrmove sfbr to SCRATCHA2int SYM895_EXT_MESSAGE_SIZEcontExtMsg:clear ackmove from OFFSET_MSG_IN_REST, when MSG_INmove M_IN_NONE to sfbrmove sfbr to SCRATCHA2int SYM895_MESSAGE_IN_RECVD ; at last !;/******************************************************************************; *; * sym895TgtDisconnect - disconnect from SCSI bus; *; */PROC sym895TgtDisconnect:call REL(mismatchATNIntrDisable)set targetdisconnectclear targetint SYM895_DISCONNECTED;/******************************************************************************; * sym895Diag - Diagnotic instructions used in Loopback mode testing.; */PROC sym895Diag:select ATN from LOOPBACK_DEVICE_OFFS, REL(checkNewCmd)move from LOOPBACK_IDENT_OUT_OFFS, when MSG_OUTmove from LOOPBACK_DATA_OUT_OFFS, when DATA_OUT;/******************************************************************************;*;* miscellaneous useful subroutines - mainly to improve readability of the;* main script.;*/;; assertAtn - assert the SCSI ATN signal;assertAtn:set atnreturn;; timeoutEnable - enable the SCSI {inter-byte, select, disconnect} timeout;timeoutEnable:move (STIME0_HTH_TIMEOUT | STIME0_SEL_TIMEOUT) to stime0return;; timeoutDisable - disable the SCSI {inter-byte, select, disconnect} timeout;timeoutDisable:;move (~STIME0_HTH_MASK & stime0) to stime0 ; Disable HTH timeout;move (~STIME0_SEL_MASK & stime0) to stime0 ; Disable SEL timeoutmove 0x0 to sfbrmove sfbr to stime0return;; mismatchATNIntrEnable - enable the phase mismatch / ATN interrupt;mismatchATNIntrEnable:move sien0 | SIEN0_MISMATCH_ATN to sfbrmove sfbr to sien0return;; mismatchATNIntrDisable - disable the phase mismatch / ATN interrupt;mismatchATNIntrDisable:;move sien0 & ~SIEN0_MISMATCH_ATN to sfbrmove sien0 & 0x7f to sfbrmove sfbr to sien0return; End of Script
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -