IDENT GMSG
TITLE GET M860 MESSAGE AND ASSOCIATED DATA.
ENTRY GMSG
ENTRY GDATA
SST
*COMMENT GET M860 MESSAGE AND ASSOC. DATA.
COMMENT COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
SYSCOM B1
GMSG SPACE 4
*** GMSG - GET M860 MESSAGE AND ASSOCIATED DATA.
*
* W. J. STURGIS. 82/09/14.
*
* GMSG GETS A M860 MESSAGE AND VERIFIES THE CHECKSUM.
* THE MESSAGE UNPACKED AND RETURNED TO THE CALLER ALONG
* WITH A STATUS. ENTRY GDATA RETURNS AN ASSOCIATED DATA
* BLOCK TO THE CALLER ALONG WITH A STATUS.
*
* SYMPL CALLS
* GMSG(FET,MSG,STS);
* GDATA(FET,DATA,LEN,STS);
*
* WHERE
* FET = FET ASSRESS.
* MSG = MESSAGE BUFFER(UPPER 48 BITS OF 11 WORDS)
* DATA = ASSOCIATED DATA BUFFER.
* LEN = LENGTH OF ASSOCIATED DATA.
* STS = RETURN STATUS.
* 0 = NORMAL COMPLETE.
* 1 = CHECKSUM ERROR(GMSG ONLY).
* 2 = NOT ENOUGH DATA IN BUFFER(BUFFER IS EMPTY).
SPACE 4,10
* COMMON DECKS.
*CALL,COMCMAC
TITLE LOCAL MACROS.
** UPACK - UNPACK ONE MESSAGE WORD.
*
* UNPACK SC
*
* WHERE SC = MASK AND SHIDT COUNT.
PURGMAC UNPACK
UPACK MACRO SC
SA1 A1+B1 GET NEXT PACKED WORD
MX0 SC
BX2 X0*X1
LX2 SC-48 POSITION TO LOWER OF PREVOIUS
BX6 X6+X2
SA6 B2 STORE UNPACKED WORD
SB2 B2+B1
BX6 -X0*X1 LOWER TO NEXT WORD
LX6 SC LEFT JUSTIFY
ENDM
TITLE MAIN ROUTINES.
GMSG SPACE 0
GMSG SUBR ENTRY/EXIT
SB1 1
SX7 A1
SA7 PARL SAVE PARAMETER LIST
SA0 X1 FET ADDRESS
SB6 MBUF
SB7 9
RJ RDW READ MESSAGE TO WORKING BUFFER
ZR B7,GMS2 IF FULL MESSAGE
SX6 2 FLAG PARTIAL OR NO MESSAGE
GMS1 SA1 PARL
SA1 X1+2
SA6 X1 STORE RESPONSE
EQ GMSGX RETURN
GMS2 SA1 PARL
SA1 X1+B1 CALLER MESSAGE BUFFER
SB2 X1
SA1 MBUF-1 INITIALIZE A1
SB3 0 LOOP COUNTER
GMS3 SA1 A1+B1
MX0 48
BX6 X0*X1
SA6 B2
SB2 B2+B1
BX6 -X0*X1
LX6 48 LEFT JUSTIFY
UPACK 36
UPACK 24
UPACK 12
SA6 B2 STORE LAST WORD
SB2 B2+B1
SB3 B3+B1
LE B3,B1,GMS3
SA1 A1+B1
MX0 32 ONLY 32 BITS IN LAST WORD
BX6 X0*X1
SA6 B2
* CHECKSUM MESSAGE
SB3 B2-10 START OF MESSAGE
MX0 -16
BX6 X6-X6 INITIAL CHECKSUM
GMS4 SA1 B3 MESSAGE WORD
LX1 16
BX2 -X0*X1
IX6 X6+X2
LX1 16
BX2 -X0*X1
IX6 X6+X2
LX1 16
BX1 -X0*X1
IX6 X6+X1
SB3 B3+B1
LE B3,B2,GMS4 IF NOT ENTIRE MESSAGE
BX6 -X0*X6 IGNORE OVERFLOW
ZR X6,GMS1 IF CHECKSUM CORRECT
SX6 1 RETURN CHECKSUM ERROR STATUS
JP GMS1 STORE STATUS AND RETURN
EJECT
GDATA SPACE 0
** GDATA - GET ASSOCIATED DATA FROM BUFFER.
GDATA SUBR ENTRY/EXIT
SB1 1
SX7 A1
SA7 PARL SAVE PARAMETER LIST POINTER
SA0 X1 FET ADDRESS
SA1 A1+B1
SB6 X1 DATA BUFFER
SA1 A1+B1
SA1 X1
SB7 X1 LENGTH
RJ RDW MOVE DATA TO BUFFER
SX6 B7 REMAINDER WORD COUNT
ZR X6,GDA1 IF ALL DATA
SX6 2 SET NOT FULL BLOCK STATUS
GDA1 SA1 PARL
SA1 X1+3
SA6 X1 STORE RESPONSE
EQ GDATAX RETURN
TITLE SUBROUTINES.
RDW SPACE 4
** RDW - READ WORDS TO WORKING BUFFER.
*
** RDW READS A GIVEN NUMBER OF WORDS FROM A CIRCULAR
* BUFFER TO A WORKING BUFFER. RDW IS ADAPTED FROM RDW=(COMCRDW)
*
* 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.
*
* EXIT (B7) = 0 FOR TRANSFER COMPLETE.
* (B7) = REMAINING WORDS ON INCOMPLETE TRANSFER.
*
* 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.
* PROCESS 1 WORD OR BUFFER EMPTY.
RDW18 ZR B3,RDWX IF NO DATA
BX7 X1 STORE 1 WORD
SA7 B6
RDW19 SX6 B4+B3 ADVANCE OUT
SB4 B4+B3
SB6 B6+B3
SB7 B7-B3
NE B4,B5,RDW20 IF OUT " LIMIT
SA1 A0+B1 READ FIRST
SX6 X1 OUT = FIRST
RDW20 SA6 A3 UPDATE OUT
NZ B7,RDW1 IF NOT DONE
RDW SUBR ENTRY/EXIT
RDW0 SX1 B0+
LE B7,RDWX IF NO WORDS TO TRANSFER
RDW1 SA3 A0+3 (B4) = OUT
SA1 A0+2 (B3) = IN
SB1 1
SA4 A3+B1 (B5) = LIMIT
SB4 X3
SB3 X1
SA1 X3 READ FIRST WORD
SB5 X4
GE B3,B4,RDW2 IF NO END AROUND
SB3 B5
RDW2 SB3 B3-B4 FREE DATA LENGTH
LE B3,B7,RDW3 IF NOT ENOUGH ROOM
SB3 B7
RDWA BSS 0
RDW3 SA3 RDWB PRESET CMU CODE
RJ RDW16 PRESET CMU CODE
* LE B3,B1,RDW18 IF 1 WORD OR LESS OF DATA (NO CMU)
* BX7 X1 (NO CMU)
* SA1 A1+B1 (NO CMU)
*
* LE B3,B1,RDW18 IF 1 WORD OR LESS OF DATA (CMU)
* JP RDW14 (CMU)
* INITIALIZE REGISTERS FOR TRANSFER.
RDW4 SX4 B3-B1
MX6 -3
SA7 B6
BX3 -X6*X4 NUMBER OF ODD WORDS
AX4 3 NUMBER OF BLOCKS
* TRANSFER UP TO 7 WORDS.
ZR X3,RDW6 IF NO ODD WORDS
SB2 X3
RDW5 SB2 B2-B1
BX7 X1
SA1 A1+B1
SA7 A7+B1
NZ B2,RDW5 IF MORE WORDS
* PRE-READ REGISTERS.
RDW6 ZR X4,RDW19 IF NO BLOCKS
SA2 A1+B1
SB2 B1+B1 (B2) = 2
SA3 A2+B1
SB4 X4 (B4) = LOOP COUNT
SA4 A3+B1
* TRANSFER 8 WORD BLOCKS.
RDW7 BX6 X1
LX7 X2
SA1 A3+B2
SA2 A4+B2
SA6 A7+B1
SB4 B4-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 B4,RDW7 LOOP
* READ EXIT.
SA3 A0+3 OUT
SA1 A3+B1 (B5) = LIMIT
SB5 X1
RDW8 SB6 B6+B3
SB7 B7-B3
SB4 X3+B3 ADVANCE OUT
SX6 X3+B3
SA1 A0+1 READ FIRST
NE B4,B5,RDW20 IF OUT " LIMIT
SX6 X1+ OUT = FIRST
RDW9 EQ RDW20 CLEAN UP AND RETURN
* MOVE DATA WITH CMU.
RDW14 SX4 B3-819
PL X4,RDW15 IF MOVE TOO BIG FOR CMU
SX4 B3 10 * WORDS = CHARACTERS
LX6 X4,B1
BX1 X0 SAVE X0
LX4 3
IX6 X4+X6
SX7 B6 SET DESTINATION ADDRESS
LX3 30
MX4 -4
BX7 X7+X3
BX3 X4*X6 EXTRACT UPPER PORTION OF CHARACTER COUNT
LX3 48-4
BX4 -X4*X6
BX7 X3+X7
LX4 26
BX7 X4+X7
AX3 51
SA7 RDWB STORE DESCRIPTOR WORD
IM RDWB MOVE DATA
BX0 X1 RESTORE X0
ZR X3,RDW19 IF NO READ EXIT CHECK
SX3 B4 SET OUT
JP RDW8
RDW15 BX7 X1
SA1 A1+B1
JP RDW4
* PRESET FOR CMU.
* RDWB IS READ UP AND THEN RETURN JUMPED TO IN ORDER TO VOID
* THE INSTRUCTION STACK.
RDWB LE B3,B1,RDW18 IF 1 WORD OR LESS (CMU)
JP RDW14
RDW16 EQU RDWB USED TO VOID STACK AT PRESET
* PRESET FOR CMU.
SA4 CMUR CHECK IF CMU AVAIALABLE
SB3 RDWA
NG X4,RDW17 IF CMU
SA3 RDWC
RDW17 BX6 X3
SA6 B3
JP RDW1
RDWC LE B3,B1,RDW18 IF 1 WORD OR LESS (NO CMU)
BX7 X1
SA1 A1+B1
TITLE WORKING STORAGE.
* WORKING STORAGE.
PARL BSS 1 PARAMETER LIST POINTER
MBUF BSS 9 MESSAGE BUFFER
SPACE 4
END