*DECK XSTTP
IDENT XSTTP
SST
EXT ABORT
EXT XTRACE
ENTRY XSTTP
*#
*1DC XSTTP
* 1. PROC NAME AUTHOR DATE
* XSTTP Y.J.POLAK 81/03/03
* 2. FUNCTIONAL DESCRIPTION
* THIS ROUTINE IS RESPONSIBLE FOR ACCESSING THE VARIOUS STATE
* TABLES.IT IS CALLED BY EACH OF THE FOUR STATE TABLE
* PROCESSORS (NCSTTP,NBSTTP,HCSTTP,HBSTTP).EACH ONE OF THESE
* SPECIFIES THE STATE TABLE TO BE PROCESSED BY PASSING THE
* PROPER ORDINAL.
* 3. METHOD USED
* THE STATE TABLES ARE DEFINED BY USING THE FOLLOWING MACROES
* (DEFINED IN COMDECK STBLMAC):INITBL,STATE,TRIG,ENDTBL.
* INITIALLY INITBL IS INVOKED WITH THE STATE TABLE NAME OF 2
* CHARACTERS,THE MAXIMUM STATE NUMBER AND THE MAXIMUM TRIGGER
* TRIGGER NUMBER.
* NEXT FOR EACH STATE ALL LEGAL TRIGGERS ARE DEFINED,BY
* INVOKING A STATE MACRO WITH THE STATE NUMBER FOLLOWED BY
* THE TRIG MACRO FOR EACH LEGAL TRIGGER IN THAT STATE.THE TRIG
* MACRO HAS THE FOLLOWING PARAMETERS (IN THIS ORDER):
* TRIGN - TRIGGER NUMBER
* NEWST - NEW STATE AS A RESULT OF THIS TRIGGER
* ACTION- ACTION ORDINAL OF CODE TO BE PERFORMED IN THIS CASE
* TRIGC - TRIGGER NO, TO BE SENT TO CORRESP. CONNECTION STATE
* TABLE
* TRIGB - TRIGGER NO. TO BE SENT TO CORREP. BLOCK PROTOCOL
* STATE TABLE.
* EXCEPT TRIGN ALL PARAMETERS MAY BE LEFT BLANK BY ADJACENT
* COMMAS,IN WHICH A NO CHANGE VALUE (NOCHG) WILL BE FILLED IN.
* ALL STATES MUST BE DEFINED IN ORDER STARTING FROM THE SPECIAL
* NO CONNECTION STATE (STATX),THEN STATE 0,STATE 1 AND SO ON.
* ALL STATES MUST HAVE AT LEAST ONE LEGAL TRIGGER.FINALLY THE
* MACRO ENDTBL MUST BE INVOKED WITH THE 2-CHAR NAME OF THE
* STATE TABLE.
* THE STATE TABLES MACROES ARE DEVISED SUCH THAT ONLY LEGAL
* TRIGGERS NEED TO BE SPECIFIED.ONLY IN THESE CASES ARE ANY
* PARAMETERS STORED IN THE STATE TABLE.AT THE SAME TIME A
* BITMAP IS CONSTRUCTED WITH ONE BIT PER POSSIBLE CASE (BOTH
* LEGAL AND ILLEGAL).IF THE TRIGGER IS DEFINED THAT MEANS THAT
* THE CASE IS LEGAL AND THE APPROPRIATE BIT IS SET.IF TRIGGER
* NUMBERS ARE SKIPPED THIS MEANS THAT THOSE CASES ARE ILLEGAL
* AND THE APPROPRIATE BITS ARE CLEARED.
* WHEN ROUTINE XSTTP IS CALLED IT CALCULATES THE FOLLOWING
* BASED ON THE CALL PARAMETERS:
* (CURRENT STATE NO.*(MAX TRIGGER VALUE+1))+CURRENT TRIGGER NO
* THIS IS THE APPROPRIATE BIT-NUMBER IN THE BITMAP FOR THIS
* CASE.IF IT IS CLEAR THE CASE IS ILLEGAL AND ZEROES ARE
* RETURNED IN THE RESPONSE.IF IT IS SET THEN THE CASE IS
* LEGAL AND THE RESPONSE PARAMETERS ARE TO BE LOCATED IN THE
* STATE TABLE.THIS IS DONE BY COUNTING THE ONE BITS PRECEDING
* THIS CASE IN THE BITMAP,USING THE POPULATION COUNT
* MACHINE INSTRUCTION.BASED ON THE NUMBER OF PRECEDING LEGAL
* CASES THE PARAMETER-LOCATION IN THE ACTUAL STATE TABLE IS
* CALCULATED (EACH LEGAL CASE OCCUPIES 30 BITS,CURRENTLY).
* FINALLY THAT INFO IS PASSED IN THE RESPONSE PARAMETER.
* 4. ENTRY PARAMETERS
* ORD STATE TABLE ORDINAL (0-3)
* CURST CURRENT STATE OF CONNECTION OR 76B IF NO
* CONNECTION EXISTS
* TRIGNO CURRENT TRIGGER NUMBER
* 5. EXIT PARAMETER.
* STATRSP RESPONSE WORD CONTAINING THE FOLLOWING FIELDS
*
* LEGALB BOOLEAN(LEFTMOST BIT)
* IF FALSE THEN THE TRIGGER WAS NOT LEGAL
* THE CURRENT STATE
* IF TRUE THEN THE TRIGGER WAS LEGAL FOR THE
* CURRENT STATE AND THE FOLLOWING FIELDS (6-
* BITS EACH) ARE CONTAINED IN THE RIGHMOST
* 30 BITS OF STATRSP:
*
* NEWST NEW STATE OF CONNECTION
* ACTION ACTION INDICATOR OF CODE TO BE PERFORMED
* TRIGC TRIGGER TO CORRESPONDING CONNECTION
* STATE TABLE
* TRIGB TRIGGER TO CORRESPONDING BLOCK PROTOCOL
* STATE TABLE
* RES RESERVED (77B)
*
*
* A VALUE OF NOCHG(77B) INDICATES THAT NO STATE CHANGE,
* ACTION OR TRIGGER IS NEEDED
* A SPECIAL VALUE OF STATX (76B) FOR THE NEW STATE IMPLIES
* THERE IS NO CONNECTION ANYMORE
*
* 6. COMDECKS CALLED.
* MACDEF CYBERDEFS STBLDEF INPARU STBLMAC
* 7. ROUTINES CALLED.
* ABORT
* 8. DAYFILE MESSAGES
* NONE DIRECTLY
* VIA ABORT: ERR IN STATE TABLE PROCESSOR CALL (XSTTP)
*
*#
*CALL MACDEF
*CALL CYBERDEFS
*CALL INPARU
*CALL STBLDEF
*CALL STBLMAC
*CALL STATTBL
XSTTP SUBR =
IFEQ DEBUG,1,6
SX6 A1
SA6 TEMP
SX1 XNAME
RJ XTRACE
SA1 TEMP
SA1 X1
SB7 WL
SB1 1
SA2 X1 PAR LIST,PICK UP STTBL ORDINAL
SA2 X2+TBLPNTR POINTER TABLE INDEXED BY ORDINAL
SB2 X2 SAVE LEGBM ADDRESS
MX7 48
LX2 12 SHIFT POINTER TABLE ENTRY
BX1 -X7*X2 MAXIMUM TRIGGER VALUE
SX1 X1+B1 ADD ONE
LX2 12 SHIFT AGAIN AND PICK UP
BX3 -X7*X2 LENGTH OF LEGAL CASE BITMAP IN WORDS
SB3 X3 SAVE IN B3
SA3 A1+B1 NEXT PAR:CURRENT STATE
SA5 X3
SX4 X5-STATX
ZR X4,NOCONN IF STATE OF NO CONNECTION SKIP
SX3 X5+B1 ADD ONE FOR NO CONN STATE
IX4 X1*X3 CALCULATE CUR STATE*MAX TRIGVAL+1
NOCONN SA3 A3+B1 NEXT PAR:TRIGNO
SA5 X3
IX3 X5+X4 ADD IT TO X4
SB4 X3 SAVE IN B4 (CURST*(MAXTR+1))+TRIGNO
SB6 B0
LT B4,B7,FNDWD IF VALUE LESS THAN 60 THEN FOUND WORD
LOOP SB4 B4-B7 OTHERWISE SUBTRACT 60 AND
SB6 B6+B1 KEEP WORD COUNT IN B6
GE B4,B7,LOOP MORE TO GO
FNDWD GE B6,B3,ERR ILLEGAL VALUE IN B4
SA1 B2+B6 FETCH PROPER LEGBM WORD
LX5 X1,B4 SHIFT TO PROPER BIT
NG X5,LEGVAL LEGAL TRIGGER,JUMP
MX6 0 ILLEGAL TRIGGER
SA3 A3+B1 SET EXIT PAR TO 0
SA6 X3 STORE AND EXIT
EQ XSTTPX
LEGVAL MX6 1 COUNT NO OF PRECEDING ENTRIES
AX7 B4,X6 BUILD MASK FOR ALL PRECEDING BITS
BX5 X7*X1 X1 CONTAINS LEGBM WORD
CX3 X5 NUMBER OF ONES IN WORD
EQ B6,NOMORE JUMP IF NO PRECEDING WORDS
MORE SB6 B6-B1 CHECK PRECEDING WORDS IN LEGBM
SA1 B2+B6 PREVIOUS WORD
CX5 X1 COUNT ONES
IX3 X3+X5 ADD TO RESULT
GT B6,MORE MORE TO GO
NOMORE SX3 X3-1 SUBTRACT ONE FOR ORIG ENTRY
* X3 NOW HOLDS THE NUMBER OF PRECEDING LEGAL ENTRIES IN STTBL
* BASED ON 30 BIT ENTRY LENGTH WE DIVIDE BY 2 IN ORDER TO
* CALCULATE THE PROPER ADDRESS
AX4 B1,X3
SB3 X4
LX5 B1,X4 MULT BACK BY 2AND CALCULATE LOGICAL
BX4 X5-X3 DIFFERENCE TO KNOW SIDE OF ENTRY
* X2 STILL HOLDS POINTER TABLE WORD FOR PROPER ORDINAL
LX2 18 SHIFT TO POSITION
SA1 X2+B3 FETCH PROPER STTBL WORD
NZ X4,RIGHTSD TAKE PROPER SIDE
LX1 30 LEFT OR
RIGHTSD MX7 30 RIGHT
BX5 -X7*X1 MASK THE 30 BITS AND ADD
BX7 X5+X6 HIGH ORDER BIT TO INDICATE
SA3 A3+B1 LEGAL VALUE
SA7 X3 STORE IN EXIT PARAMETER
EQ XSTTPX
ERR SX1 ERRMSG
RJ ABORT ABORT WITH PROPER ERROR MESSAGE IN DAYFILE
ERRMSG DIS ,* ERROR IN XSTTP CALL*
XNAME DATA L*XSTTP*
TEMP BSS 1
END