EFORMAT
* /--- FILE TYPE = E
* /--- BLOCK IDENT 00 000 79/06/19 18.19
IDENT EFORMAT
TITLE OUTPUT FORMATTING
*
* GET COMMON SYMBOL TABLE
*
CST
*
*
EXT ECSPRTY SYSTEM ECS ERROR ACTION
*
*
QDIV EQU 10 DIVIDING POINT FOR QUEUE CHOICE
FASTMAX EQU 20 UPPER LIMIT FOR FAST QUEUE
*
* /--- BLOCK EFORMAT 00 000 79/10/08 23.15
TITLE -EFORMAT- OUTPUT TO ECS FORMAT BUFFER
*
* 'IT IS ASSUMED THAT A5/B5/B7 ARE NOT USED HERE, SINCE
* EFORMAT CAN BE CALLED FROM THE EXECUTOR (E.G., -SEND-).
*
*
*
* -EFORMAT-
* OUTPUT *MOUT* BUFFER TO ECS FORMAT BUFFER
*
* EACH BUFFER CONSISTS OF A HEADER WORD, GIVING THE
* LENGTH AND STATION NUMBER, FOLLOWED BY THE
* CONTENTS OF THE MOUT BUFFER.
*
* ON THE BASIS OF WHETHER MOUTLOC IS LESS THAN
* *QDIV*, THE OUTPUT IS PLACED EITHER IN THE FAST
* FORMAT QUEUE OR THE MAIN BUFFER. THE RESULT IS
* THAT SHORT AMOUNTS OF OUTPUT WILL RECEIVE PRIORITY
* PROCESSING BY THE FORMATTER.
* MOUTS LONGER THAN *QDIV* BUT LESS THAN *FASTMAX*
* MAY ALSO BE ROUTED TO THE FAST FORMAT QUEUE IF
* *FQHIGH* IS NON-ZERO
*
* 'A SPECIAL CASE IS THAT OF ALL-STATION -SEND- COMMANDS. 'SO
* AS TO PRESERVE CORRECT TIME-ORDERING, THE ALL-STATION
* SEND DRIVES EFORMAT FOR EACH STATION SENT TO. 'THE STATION
* TO BE SENT TO IS SPECIFIED IN FORCSTN (NORMALLY NEGATIVE).
* 'AT THE END OF THE EFORMAT CALL THE MOUT BUFFER IS RE-
* INITIALIZED BY EFORMAT, TO BE READY FOR THE NEXT MESSAGE
* TO BE SENT.
*
*
ENTRY EFORMAT
EFORMAT EQ *
SA1 MOUTLOC CHECK IF ANY OUTPUT
ZR X1,EFEND
NG X1,EFEND
SX0 X1-MOUTEND+1 CHECK IF TOO MUCH OUTPUT
PL X0,EFEND
*
* /--- BLOCK EFORMAT 00 000 79/10/11 23.56
*
* SPECIAL HANDLING FOR -SEND-
*
EF100 SA2 FORCSTN OVERRIDE STATION FOR -SEND-
NG X2,EF101 JUMP IF NO OVERRIDE
CALL DMPSYSB
SA3 STATION
BX6 X3
SA6 LFORCST SAVE SENDING STATION NO.
SA2 FORCSTN
BX6 X2
SA6 A3 OVERRIDE STATION
CALL LODSYSB GET SENT-TO STATION BANK
*
* DECIDE WHICH FORMAT BUFFER TO USE
*
EF101 INTLOK X,I.EFORM,W INTERLOCK FORMAT BUFFER
SA1 MOUTLOC LENGTH OF OUTPUT
SX1 X1+1 LENGTH OF OUTPUT + HEADER
BX6 X1
LX6 24 POSITION LENGTH OF OUTPUT
SA2 STATION
BX6 X2+X6 ATTACH STATION NUMBER
SA6 POBUFF STORE HEADER WORD
SA2 FORCSTN
PL X2,EF114 IF SEND CASE, LONG QUEUE
SA2 SUBMOUT CHECK IF OUTPUT ALREADY PENDING
SA3 OUTMOUT
IX2 X3-X2
PL X2,EF112 JUMP IF FORMAT CAUGHT UP
SA2 STFLAGS
LX2 60-TPFQS POSITION PLATO-FORMAT QUEUE BIT
NG X2,EF114 PREVIOUS OUTPUT IN LONG QUEUE
EQ EF115 PREVIOUS OUTPUT IN FAST QUEUE
*
EF112 SX4 X1-FASTMAX CHECK IF TOO LONG FOR FAST QUE
PL X4,EF114
SX4 X1-QDIV-1 CHECK FOR SHORT OUTPUT LENGTH
NG X4,EF115 ROUTE SHORT OUTPUT TO FAST QUE
SA1 FQHIGH CHECK IF SHOULD FORCE FAST QUE
NZ X1,EF115
*
* OUTPUT TO MAIN (LONG OUTPUT) FORMAT BUFFER
*
EF114 CALL WXCB,POBUFF,LONGQD
SX0 1 X0 = 1 = LONG OUTPUT QUEUE
ZR X6,EFFLOW IF LONG OUTPUT BUFFER IS FULL
EQ EF120
*
* OUTPUT TO HIGH PRIORITY FORMAT BUFFER
*
EF115 CALL WXCB,POBUFF,FASTQD
MX0 0 X0 = 0 = FAST OUTPUT QUEUE
ZR X6,EFFLOW IF HIGH PRIORITY BUFFER IS FULL
*
* /--- BLOCK EFORMAT 00 000 79/10/10 20.46
*
EF120 SA2 FORCSTN
PL X2,EF130 IF SEND CASE NO UPDATES
LX0 TPFQS-1 POSITION FAST/LONG QUEUE BIT
SX2 1
LX2 TPFQS-1 POSITION MASK FOR QUEUE BIT
SA1 STFLAGS
BX1 -X2*X1 CLEAR CURRENT VALUE
BX6 X0+X1 ATTACH NEW VALUE
SA6 A1
SA1 SUBMOUT INCREMENT NUMBER OF MOUTS SENT
SX6 1 INCREMENT *MOUT* SUBMITTED
IX6 X1+X6
SA6 A1
EQ EF140
EF130 SA2 LFORCST (X2) = ORIGINAL STATION
BX6 X2
SA6 STATION RESTORE STATION NUMBER
CALL LODSYSB
* SET TBPAUSE TO -1 SO THAT OK/NO WILL BE PLACED AT END
* OF MOUT BUFFER INSTEAD OF AT BEGINNING';
MX6 -1
SA6 TBPAUSE
EF140 INTCLR X,I.EFORM
EFEND MX6 0
SA6 MOUTLOC REINITIALIZE MOUT BUFFER
MX6 -1
SA6 FORCSTN RE-INITIALIZE FORCSTN
EQ EFORMAT
*
*
* PROCESS BUFFER OVERFLOW
*
EFFLOW BSS 0
SA2 =5AFASTL CONFIG PARM - FAST OUTPUT QUEUE
ZR X0,EFFLOW1 IF FAST OUTPUT QUEUE TOO SHORT
SA2 =5AFORML CONFIG PARM - LONG OUTPUT QUEUE
EFFLOW1 BSS 0
SB1 3 (B1) = (S=LOG) DAYFILE PARAM
CALL S=CONF ISSUE DAYFILE / B-DISPLAY MSGS
SA1 FORFLOW INCREMENT OVERFLOW COUNT
SX6 X1+1
SA6 A1
INTCLR X,I.EFORM CLEAR FORMAT BUFFER INTERLOCK
CALL DMPSYSB RETURN /STATION/ BANK
SA2 FORCSTN CHECK FOR SPECIAL -SEND-
NG X2,EFFLOW2
SA2 LFORCST
BX6 X2
SA6 STATION
EFFLOW2 BSS 0
CALL WFORMAT
CALL ECSREQ PROCESS FRAMAT ECS REQUESTS
CALL S=WAIT,100 IDLE FOR A WHILE
CALL LODSYSB RE-LOAD /STATION/ BANK
EQ EF100
*
*
LFORCST BSS 1 SAVE ORIGINAL STATION NO.
*
*
* /--- BLOCK WFORMAT 00 000 79/07/15 23.38
TITLE -WFORMAT- WAIT FOR FORMAT INITIALIZATION
*
*
*
* -WFORMAT-
* IDLE EXECUTOR WHILE FORMAT INITIALIZE FLAG SET
*
ENTRY WFORMAT
WFORMAT EQ *
SX0 FORINIP FRAMAT INITIALIZATION FLAG
RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*)
PL X1,WFORMAT
CALL ECSREQ PROCESS FRAMAT ECS REQUESTS
CALL S=BMSG,(=18CWAITING FOR FRAMAT)
CALL S=WAIT,100 IDLE FOR A WHILE
EQ WFORMAT
*
*
* /--- BLOCK FORMREQ 00 000 81/06/29 10.39
TITLE -FORMREQ- PROCESS FORMATTER REQUESTS
*
*
*
* -FORMREQ-
* PROCESS ACTION REQUESTS MADE BY FORMATTER
*
* FORMAT OF REQUEST WORD -
* 1ST 24 BITS = REQUEST INFO
* NEXT 12 = LENGTH OF REQUEST (=1)
* NEXT 12 = REQUEST TYPE
* 0 = NO-OP
* 1 = *CATCHUP* REQUEST
* 2 = PARCELS AT MINIMUM THRESHOLD
* NEXT 12 = STATION NUMBER
*
* FORMAT OF *CATCHUP* REQUEST -
* 1ST 06 BITS = UNUSED
* NEXT 18 = MILLISECOND DELAY TIME
* NEXT 12 = 1 = REQUEST LENGTH
* NEXT 12 = 1 = REQUEST TYPE
* NEXT 12 = STATION
*
*
ENTRY FORMREQ
FORMREQ EQ *
FR020 SX0 FORINIP FRAMAT INITIALIZATION FLAG
RX1 X0 (-RXX- 1 WD READ, MAY CHG *A1*)
NG X1,FR980
SX6 20 SET UP MAX NUMBER OF REQUESTS
SA6 FREQCNT TO PROCESS IN ONE POLL
*
FR100 SA1 FREQCNT
SX6 X1-1 COUNT DOWN PERMISSIBLE ACTIONS
NG X6,FORMREQ IF WE HAVE DONE THE MAXIMUM
SA6 A1
CALL RXCB,POBUFF,FREQQD,0
ZR X6,FORMREQ EXIT IF NOTHING TO PROCESS
EQ FPROC GO TO PROCESS REQUEST
*
FR980 CALL ECSREQ PROCESS ECS REQUESTS
CALL S=WAIT,50 WAIT FOR FORMAT READY
EQ FR020
*
*
FREQCNT BSS 1
*
*
* /--- BLOCK FORMREQ 00 000 81/06/24 22.29
*
* PROCESS NEXT FORMAT REQUEST
*
FPROC MX0 -12
SA1 POBUFF 24/INFO, 12/1, 12/TYPE, 12/STN
LX1 60-12
BX2 -X0*X1 PICK OFF FORMAT REQUEST TYPE
SB1 X2
JP B1+*+1
*
+ EQ FR100 0 = NO-OP
+ EQ "CRASH" 1 = CATCHUP (UNUSED)
+ EQ FR2001 2 = MINIMUM PARCELS LEFT
SPACE 5,11
* PRESS KEY INDICATING PARCELS AT MINIMUM THRESHOLD
FR2001 LX1 12 POSITION STATION NUMBER
BX6 -X0*X1
SA6 INFO
CALL PRESKEY,FR200A,INFO
EQ FR100
FR200A CON CATCHUP
*
*
* /--- BLOCK -RXCB- 00 000 81/06/29 10.40
TITLE RXCB/WXCB READ/WRITE ECS CIRCULAR BUFFER
*
*
*
* -RXCB- READ ECS CIRCULAR BUFFER
* ON ENTRY - B1 = CM BUFFER ADDRESS
* B2 = ADDR OF CIRCULAR BUFFER DESCRIPTOR
* B3 = MAXIMUM LENGTH OF DATA ALLOWED
* = 0 = NO BOUNDS TEST
* ON EXIT - X6 = +N = NUMBER CPU WORDS OF DATA READ
* 0 = BUFFER EMPTY
* -1 = BUFFER ENTRY TOO LONG
*
* -WXCB- WRITE ECS CIRCULAR BUFFER
* ON ENTRY - B1 = CM BUFFER ADDRESS
* B2 = ADDR OF CIRCULAR BUFFER DESCRIPTOR
* ON EXIT - X6 = 1 = DATA WRITTEN TO BUFFER
* 0 = BUFFER FULL
* X1 = NUMBER OF WORDS SHORT (IF X6=0)
*
* FORMAT OF CIRCULAR BUFFER DESCRIPTOR WORD -
* 1ST 18 BITS = LENGTH OF BUFFER
* NEXT 21 = ECS ADDRESS OF BUFFER
* NEXT 21 = ECS ADDRESS OF BUFFER IN/OUT PTRS
*
* FORMAT OF 1ST WORD OF CIRCULAR BUFFER ENTRIES -
* 1ST 24 BITS = UNUSED BY BUFFER ROUTINES
* NEXT 12 = CPU WORD COUNT
* NEXT 12 = PPU WORD COUNT (IF APPLICABLE)
* NEXT 12 = UNUSED BY BUFFER ROUTINES
*
* /--- BLOCK -RXCB- 00 000 81/07/26 12.57
*
*
RXCB EQ *
*
* READ CIRCULAR BUFFER IN/OUT POINTERS
*
MX7 -21 X7 = MASK
SA1 B2 X1 = CIRCULAR BUFFER DESCRIPTOR
ZR X1,RXC190
BX4 -X7*X1 X4 = ECS ADDR OF IN/OUT PTRS
BX0 X4
SA0 RXPTRS
+ RE 2 READ IN/OUT POINTERS TO CM
RJ ECSPRTY
SA2 A0 X2 = *IN* POINTER
SA3 A0+1 X3 = *OUT* POINTER
IX6 X2-X3
ZR X6,RXC190 JUMP IF BUFFER EMPTY
*
* READ 1ST WORD OF BUFFER ENTRY
*
AX1 21 POSITION ADDRESS OF BUFFER
BX7 -X7*X1 X7 = ECS ADDRESS OF BUFFER
IX0 X3+X7 COMPUTE ADDRESS OF NEXT ENTRY
SA0 B1 A0 = CM ADDRESS
+ RE 1 READ 1ST WORD OF BUFFER ENTRY
RJ ECSPRTY
*
* DETERMINE REMAINING AMOUNT TO READ
*
AX1 21
SX1 X1 X1 = LENGTH OF CIRCULAR BUFFER
MX0 -12
SA2 A0 LOAD ENTRY HEADER WORD
AX2 24
BX2 -X0*X2 X2 = CPU WORD COUNT
SX0 X2-1
ZR X0,RXC120 JUMP IF SINGLE WORD ENTRY
ZR B3,RXC115 JUMP IF NO BOUNDS TEST
SB1 X2
LT B3,B1,RXC195 JUMP IF ENTRY TOO LONG
*
RXC115 IX0 X2+X3 COMPUTE ENDING ADDRESS OF READ
IX0 X1-X0
NG X0,RXC130 JUMP IF MUST READ TWO SEGMENTS
*
* /--- BLOCK -RXCB- 00 000 79/03/11 21.29
*
* READ REMAINDER OF DATA BLOCK IN ONE TRANSFER
*
SA0 A0+1 ADVANCE CM ADDRESS
SB1 X2-1 GET LENGTH OF REMAINING DATA
SX6 1
IX0 X3+X6 ADVANCE ECS ADDRESS
IX0 X0+X7
+ RE B1 READ REMAINING DATA TO CM
RJ ECSPRTY
*
RXC120 IX3 X2+X3 ADVANCE *OUT* POINTER
EQ RXC140
*
* READ REMAINDER OF DATA BLOCK IN TWO TRANSFERS
*
RXC130 SA0 A0+1 ADVANCE CM ADDRESS
SX3 X3+1 ADVANCE *OUT* POINTER
IX6 X1-X3 COMPUTE LENGTH OF 1ST TRANSFER
SB1 X6
IX0 X3+X7 ADVANCE ECS ADDRESS
+ RE B1 READ TO END OF CIRCULAR BUFFER
RJ ECSPRTY
SA0 A0+B1 ADVANCE CM ADDRESS
IX3 X2-X6 COMPUTE LTH OF REMAINING DATA
SX3 X3-1 ADJUST FOR HEADER WORD
SB1 X3
BX0 X7 RE-SET ECS ADDR TO FWA OF BUFF
+ RE B1 READ FROM BEGIN OF BUFFER
RJ ECSPRTY
*
* /--- BLOCK -RXCB- 00 000 81/06/29 10.39
*
* UPDATE CIRCULAR BUFFER *OUT* POINTER
*
RXC140 IX0 X3-X1 CHECK IF AT END OF BUFFER
NG X0,RXC142
SX3 0 RE-SET *OUT* TO FWA OF BUFFER
*
RXC142 BX6 X3
SA6 RXPTRS+1 CM ADDRESS OF *OUT* PTR
SX0 1
IX0 X0+X4 SET ECS ADDRESS OF *OUT* PTR
WX6 X0 (-WXX- 1 WD WRITE, MAY CHG *A6*)
BX6 X2 X6 = NUMBER CPU WORDS DATA READ
EQ RXCB
*
RXC190 MX6 0 X6 = 0 = NO DATA IN BUFFER
EQ RXCB
*
RXC195 MX6 -1 X6 = -1 = BUFFER ENTRY TOO LONG
EQ RXCB
*
* /--- BLOCK -WXCB- 00 000 79/03/13 13.58
*
*
WXCB EQ *
*
* READ CIRCULAR BUFFER IN/OUT POINTERS
*
MX7 -21 X7 = MASK
SA1 B2 X1 = CIRCULAR BUFFER DESCRIPTOR
BX4 -X7*X1 X4 = ECS ADDR OF IN/OUT PTRS
BX0 X4
SA0 RXPTRS
+ RE 2 READ IN/OUT POINTERS TO CM
RJ ECSPRTY
*
* CHECK IF SUFFICIENT SPACE IN BUFFER FOR DATA
*
BX5 X1
AX5 42 POSITION LENGTH OF BUFFER
SX5 X5 X5 = LENGTH OF CIRCULAR BUFFER
SA2 A0+1 X2 = *OUT* POINTER
SA3 A0 X3 = *IN* POINTER
IX6 X2-X3
ZR X6,WXC120 CHECK IF BUFFER EMPTY
PL X6,WXC122
*
WXC120 IX6 X5+X6 COMPUTE AMOUNT OF FREE SPACE
*
WXC122 SX6 X6-1 X6 = NUM WORDS OF BUFFER FREE
MX0 -12
SA2 B1 LOAD ENTRY HEADER WORD
AX2 24
BX2 -X0*X2 X2 = LENGTH OF DATA
IX0 X6-X2
NG X0,WXC190 CHECK IF SUFFICIENT SPACE
*
* /--- BLOCK -WXCB- 00 000 79/03/11 17.42
*
* CHECK IF DATA WILL WRAP AROUND BUFFER
*
MX0 -21
AX1 21 POSITION ECS ADDR OF BUFFER
BX7 -X0*X1 X7 = ECS ADDRESS OF BUFFER
SA0 B1 A0 = CM ADDRESS OF DATA
IX0 X2+X3 COMPUTE LWA FOR TRANSFER
IX0 X5-X0
NG X0,WXC130 JUMP IF MUST DO TWO TRANSFERS
*
* COPY DATA TO CIRCULAR BUFFER IN SINGLE TRANSFER
*
IX0 X3+X7 SET ECS ADDRESS FOR TRANSFER
SB1 X2 SET LENGTH FOR TRANSFER
+ WE B1 WRITE DATA TO CIRCULAR BUFFER
RJ ECSPRTY
IX3 X2+X3 ADVANCE *IN* POINTER
EQ WXC140
*
* COPY DATA TO CIRCULAR BUFFER IN TWO TRANSFERS
*
WXC130 IX6 X5-X3 COMPUTE LTH OF 1ST TRANSFER
IX0 X3+X7 SET ECS ADDRESS FOR TRANSFER
SB1 X6 SET LENGTH FOR TRANSFER
+ WE B1 WRITE TO END OF CIRCULAR BUFFER
RJ ECSPRTY
SA0 A0+B1 ADVANCE CM ADDRESS
IX3 X2-X6 COMPUTE REMAINING LTH OF DATA
SB1 X3 SET LENGTH FOR TRANSFER
BX0 X7 SET ECS ADDRESS FOR TRANSFER
+ WE B1 WRITE FROM BEGIN OF BUFFER
RJ ECSPRTY
*
* /--- BLOCK -WXCB- 00 000 79/03/20 11.34
*
* UPDATE CIRCULAR BUFFER *IN* POINTER
*
WXC140 IX0 X3-X5 CHECK IF AT END OF BUFFER
NG X0,WXC142
SX3 0 RE-SET *IN* TO FWA OF BUFFER
*
WXC142 BX6 X3
SA6 RXPTRS CM ADDRESS OF *IN* PTR
WX6 X4 (-WXX- 1 WD WRITE, MAY CHG *A6*)
SX6 1 X6 = 1 = DATA WRITTEN
EQ WXCB
*
WXC190 MX6 0 X6 = 0 = BUFFER FULL
BX1 -X0 (X1) = NUMBER OF WORDS SHORT
EQ WXCB
*
*
*
END