IDENT SMSG
TITLE SMSG - SEND MESSAGE TO M860.
ENTRY SMSG
SST
*COMMENT PACK AND CHECKSUM M860 MESSAGE.
COMMENT COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
SYSCOM B1
SMSG SPACE 4
*** SMSG - SEMD MESSAGE AND ASSOCIATED DATA TO M860.
*
* W. J. STURGIS. 82/09/14.
*
* SMSG CHECKSUMS AND PACKS THE MESSAGE AND MOVES
* IT TO THE MESSAGE BUFFER. ASSOCIATED DATA(IF ANY)
* IS ALSO MOVED TO THE MESSAGE BUFFER. THE IN POINTER
* IS UPDATED IN THE FET ONLY AFTER ALL DATA IS IN THE
* BUFFER.
*
* SYMPL CALL.
* SMSG(FET,MSG,ADATA,ADATAL,STS);
*
* WHERE
* FET = FET ADDRESS.
* MSG = MESSAGE(UPPER 48 BITS OF 11 WORDS).
* ADATA = ASSOCIATED DATA BLOCK(0 IF NO DATA).
* ADATAL = LENGTH OF ASSOCIATED DATA BLOCK(0 IF NONE).
* STS = RETURN STATUS.
* 0 = MESSAGE AND DATA IN BUFFER.
* 1 = NOT ENOUGH ROOM IN BUFFER FOR MESSAGE(AND DATA).
SPACE 4,10
* COMMON DECKS.
*CALL,COMCMAC
TITLE LOCAL MACROS.
** PACK - PACK AND STORE ONE MESSAGE WORD
*
* PACK SC
*
* WHERE SC = MASK AND SHIFT COUNT.
PURGMAC PACK
PACK MACRO S
SA1 A1+B1 LOAD MESSAGE WORD
MX0 -S
BX1 X7*X1 USE ONLY 48 BITS
LX1 S
BX2 -X0*X1
BX6 X6+X2 FINISH PACKED WORD
SA6 B3 STORE PACKED WORD
SB3 B3+B1 UPDATE BUFFER ADDRESS
BX6 X0*X1 UPPER BITS OF NEXT WORD
ENDM
TITLE MAIN ROUTINE.
SMSG SUBR ENTRY/EXIT
SB1 1
SX7 A1
SA7 PARL SAVE PARAMETER LIST ADDRESS
SA0 X1 FET ADDRESS
SA2 A1+3
SA2 X2 ASSOC. DATA LENGTH
SA1 A0+2 IN
BX7 X1
SA7 IN SAVE IN POINTER FOR WTW
SA3 A1+B1 OUT
IX6 X3-X1 OUT-IN
ZR X6,SMS0 IF IN = OUT
PL X6,SMS1 IF OUT GT IN
SMS0 SA1 A0+B1 FIRST
SA3 A3+B1 LIMIT
SX1 X1
SX3 X3
IX6 X6+X3 +LIMIT
IX6 X6-X1 -FIRST = ROOM IN BUFFER
SMS1 SX2 X2+9+1 ASSOC. DATA + PACKED MSG + 1
IX6 X6-X2
PL X6,SMS3 IF ROOM IN BUFFER
SMS1.0 SX6 1 SET RETURN CODE
SMS2 SA1 PARL
SA2 X1+4 RESPONSE ADDRESS
SA6 X2 STORE RETURN STATUS
EQ SMSGX RETURN
* COMPUTE CHECKSUM.
SMS3 SA1 PARL
SA2 X1+B1
SB2 X2 MESSAGE
SB5 B2
MX0 16
SA2 B2+10
BX6 X0*X2 CLEAR CHECKSUM
SA6 A2
SB3 B2+11
LX0 16
BX6 X6-X6 INITIAL SUM
SMS4 SA1 B2
LX1 16
BX2 X0*X1
LX1 16
IX6 X6+X2
BX3 X0*X1
LX1 16
IX6 X6+X3
BX2 X0*X1
IX6 X6+X2
SB2 B2+B1
LT B2,B3,SMS4
BX6 X0*X6 ONLY 16 BIT SUM
SX1 0#10000
IX6 X1-X6 2S COMPL.
BX6 X0*X6 ONLY 16 BITS
SA1 A1 LOAD LAST WORD OF MESSAGE
LX6 16+12
BX6 X6+X1
SA6 A1 STORE CHECKSUM
* PACK MESSAGE.
SA1 B5-B1 MESSAGE - 1
MX7 48
SB2 0
SB3 MBUF
SMS5 SA1 A1+B1
BX6 X7*X1
PACK 12
PACK 24
PACK 36
SA1 A1+B1
BX1 X7*X1
LX1 48
BX6 X6+X1
SA6 B3 STORE LAST WORD
SB3 B3+B1
SB2 B2+B1
LE B2,B1,SMS5 IF NOT 8 WORDS PACKED
SA1 A1+B1
BX6 X1
SA6 B3 STORE NINTH WORD
SA2 PARL (X2) = FET ADDRESS
SB6 MBUF
SB7 9
RJ WTW MOVE DATA TO BUFFER
SA1 PARL
SA2 X1+2 ASSOC DATA BLOCK
SA3 X1+3 LENGTH
SA3 X3
NZ X3,SMS7 IF ASSOC DATA
SMS6 SA1 IN
BX6 X1
SA6 A0+2 STORE IN POINTER IN FET
JP SMSGX RETURN
* MOVE ASSOCIATED DATA TO BUFFER
SMS7 SB6 X2 WORKING BUFFER
SB7 X3 LENGTH
RJ WTW MOVE DATA
EQ SMS6 UPDATE IN AND RETURN
TITLE SUBROUTINES.
WTW SPACE 4
** WTW - WRITE WORDS FROM WORKING BUFFER.
*
* WTW TRANSFERS DATA FROM A WORKING BUFFER TO A
* CIRCULAR BUFFER.
* WTW IS ADAPTED FROM WTW= (COMCWTW).
*
* ENTRY (A0) = ADDRESS OF FET FOR FILE.
* (B6) = FWA WORKING BUFFER.
* (B7) = WORD COUNT OF WORKING BUFFER.
* IF (B7) = 0, NO TRANSFER WILL BE PERFORMED.
* (IN) = IN POINTER TO USE.
*
* EXIT (IN) = UPDATED IN POINTER FOR FET.
*
* USES X - 1, 2, 3, 4, 6, 7.
* B - 1, 2, 3, 4, 5, 6, 7.
* A - 1, 2, 3, 4, 6, 7.
*
* CALLS NONE.
WTW18 SX6 B3+B4 ADVANCE IN
SB3 B3+B4
SB6 B6+B4
SB7 B7-B4
NE B3,B5,WTW19 IF IN " LIMIT
SA1 A0+B1 IN = FIRST
SX6 X1
WTW19 SA6 IN UPDATE IN
NZ B7,WTW1 IF NOT END OF TRANSFER
WTW SUBR ENTRY/EXIT
WTW1 SA1 A0+3 (B4) = OUT
SA3 IN (B3) = IN
SA4 A1+B1 (B5) = LIMIT
ZR B7,WTWX IF WORKING BUFFER EMPTY
SB4 X1
SA1 A0+B1 (B2) = FIRST
SB3 X3
SB5 X4
SB2 X1
SA1 B6 READ FIRST WORD
NE B2,B4,WTW2 IF OUT " FIRST
SB4 B5
WTW2 LT B3,B4,WTW3 IF NO END AROUND
SB4 B5+1
WTW3 SB4 B4-B1
SB4 B4-B3
ZR B4,SMS1.0 IF NO ROOM
BX7 X1
LE B4,B7,WTW4 IF NOT ENOUGH ROOM TO LIMIT
SB4 B7 NO WRAPAOOUND
* INITIALIZE REGISTERS FOR TRANSFER.
WTWA BSS 0
WTW4 SA3 WTWC PRESET CMU CODE AND VOID STACK
RJ WTW16
* SA1 A1+B1 (NO CMU)
* SX4 B4-B1 (NO CMU)
* MX6 -3 (NO CMU)
* SA7 B3 (NO CMU)
*
* GT B4,B1,WTW14 IF MORE THAN 1 WORD (CMU)
* BX4 X4-X4 (CMU)
* SA7 B3 (CMU)
WTW5 BX3 -X6*X4 NUMBER OF ODD WORDS
AX4 3 NUMBER OF BLOCKS
ZR X3,WTW7 IF NO ODD WORDS
* TRANSFER UP TO 7 WORDS.
WTW6 SX3 X3-1
BX7 X1
SA1 A1+B1
SA7 A7+B1
NZ X3,WTW6 LOOP
* PRE-READ REGISTERS.
WTW7 ZR X4,WTW18 IF NO BLOCKS
SA2 A1+B1
SB2 B1+B1 (B2) = 2
SA3 A2+B1
SB3 X4 (B3) = BLOCK COUNT
SA4 A3+B1
* TRANSFER 8 WORD BLOCKS.
WTW8 BX6 X1
LX7 X2
SA1 A3+B2
SA2 A4+B2
SA6 A7+B1
SB3 B3-B1
SA7 A6+B1
BX6 X3
LX7 X4
SA3 A1+B2
SA4 A2+B2
SA6 A6+B2
SA7 A7+B2
BX6 X1
LX7 X2
SA1 A3+B2
SA2 A4+B2
SA6 A6+B2
SA7 A7+B2
BX6 X3
LX7 X4
SA3 A1+B2
SA4 A2+B2
SA6 A6+B2
SA7 A7+B2
NZ B3,WTW8 LOOP
* WRITE EXIT.
SA3 IN READ IN
SA1 A0+4 (B5) = LIMIT
SB5 X1
WTW9 SB6 B6+B4
SB7 B7-B4
SB3 X3+B4 ADVANCE IN
SX6 X3+B4
SA3 A0+B1 READ FIRST
NE B3,B5,WTW19 IF IN " LIMIT
SX6 X3+ IN = FIRST
WTW10 EQ WTW19 CLEAN UP AND RETURN
* MOVE DATA WITH CMU.
WTW14 SX4 B4-819
PL X4,WTW15 IF TOO BIG FOR CMU
SX4 B4 10 * WORDS = CHARACTERS
LX6 X4,B1
BX1 X0 SAVE X0
LX4 3
IX6 X4+X6
SX7 B6 SET SOURCE ADDRESS
SX4 B3 SET DESTINATION ADDRESS
LX7 30
BX4 X4+X7
MX7 -4
BX3 X7*X6 EXTRACT UPPER PORTION
BX6 -X7*X6 EXTRACT LOWER PORTION
LX3 48-4
BX4 X4+X3
LX6 26
BX6 X4+X6
AX3 51
SA6 WTWC STORE DESCRIPTOR WORD
IM WTWC MOVE DATA
BX0 X1 RESTORE X0
ZR X3,WTW18 IF NO WRITE EXIT
SX3 B3 RESET IN
JP WTW9
WTWB BSS 0
WTW15 SA1 A1+B1 MOVE DATA WITHOUT CMU
SX4 B4-B1
MX6 -3
SA7 B3
JP WTW5
* CMU PRESET CODE.
* WWTC IS READ UP AND THEN RETURN JUMPED TO IN ORDER TO VOID
* STACK. WWTC IS ALSO USED AS THE CMU DESCRIPTOR WORD
WTWC GT B4,B1,WTW14 IF MORE THAN 1 WORD TO MOVE (CMU)
BX4 X4-X4
SA7 B3
WTW16 EQU WTWC USED TO VOID STACK
* PRESET FOR CMU CODE.
SA4 CMUR CHECK IF CMU AVAIALABLE
SB4 WTWA
NG X4,WTW17 IF CMU
SA3 WTWB
WTW17 BX6 X3
SA6 B4
JP WTW1
TITLE WORKING STORAGE.
* WORKING STORAGE.
PARL BSS 1 PARAMETER LIST POINTER
IN BSS 1 IN POINTER FOR FET
MBUF BSS 9 PACKED MESSAGE BUFFER
SPACE 4
END