*DECK,NP$UPRU
*IF,DEF,XFR
USETEXT NX$ACBF
USETEXT AIPDEF
USETEXT HEADER
USETEXT NP$STAT
USETEXT NP$DB
USETEXT NP$NWL
USETEXT NP$MODE
USETEXT NP$GETS
USETEXT NX$ACBX
PROC NP$UPRU(OLDPTR,NEWPTR);
BEGIN
#
**
* 1. PROC NAME AUTHOR DATE
*
* NP$UPRU Y. C. YIP 02/16/1984
*
* 2. FUNCTIONAL DESCRIPTION.
*
* NP$UPRU UPDATES THE CURRENT INFORMATION POSITION IN
* THE DISK FET FOR BOTH SENDER AND RECEIVER.
*
* 3. METHOD USED.
*
* THE CURRENT INFORMATION IN THE DISK FET IS DETERMINED
* BY THE PRU NUMBER, WORD OFFSET WITHIN THE PRU NUMBER
* AND THE DBIT THAT IS THE NEXT USABLE BIT POSITION IN THE
* WORD OFFSET OF THE CURRENT PRU. DBIT IS ONLY USED BY THE
* TRANSLATION SERVICE.
*
* FTT PRU IS COMPUTED BY THE CALCULATING THE DIFFERENCE
* OF THE NEWPTR AND THE OLDPTR WHICH ARE INPUT PARAMETERS
* USING THE FOLLOWING METHOD:
* FTTCURPRU = FTTCURPRU + (NEWPTR - OLDPTR)/64
* WORD-OFFSET = REMAINDER OF (NEWPTR - OLDPTR)/64
* FTTDBIT = DBIT FROM CHARACTER MODE BUFFER
*
* 4. ENTRY CONDITIONS:
*
* NEWPTR = VALUE OF POINTER IN THE DISKFET.
* OLDPTR = VALUE OF OLDPOINTER IN THE DISKFET.
*
*
* 5. EXIT CONDITIONS:
*
* NEWPTR AND OLDPTR ARE NOT CHANGED.
* FTTCURPRU, FTTWORD, AND FTTDBIT GET UPDATED.
*
*
#
ITEM WORDSKIP; # DIFFERENCE BETWEEN NEWPTR AND
OLDPTR
#
ITEM OLDPTR; # VALUE OF THE PREVIOUS PTR #
ITEM NEWPTR; # VALUE OF THE NEWPTR #
ITEM PRUEXCESS; # INCREMENT IN PRU NUMBER #
CONTROL EJECT;
#
************************************************************************
* *
* CODE OF NP$UPRU BEGINS HERE *
* *
************************************************************************
#
P<FET$CIO> = FTTFETADR[FTTINDEX]; # PULL DISKFET TEMPLATE TO
FET ADDRESS IN FTT #
P<CMB> = FTTCMV$BLK[FTTINDEX]; # PULL CMB TEMPLATE TO #
# CMB ADDRESS IN FTT #
WORDSKIP = NEWPTR - OLDPTR; # CALCULATE DIFFERENCE IN WORD#
IF WORDSKIP LS 0 # FET PPINTERS ALREADY WRAPPED#
THEN # AROUND #
BEGIN
WORDSKIP = WORDSKIP + FETLIM[0] - FETFIR[0];
END # ADD THE FULL BUFFER SIZE #
FTTWORD[FTTINDEX] = FTTWORD[FTTINDEX] + WORDSKIP;
# CALCULATE NEW WORD #
PRUEXCESS = FTTWORD[FTTINDEX]/64; # GET NEW PRU NUMBER #
IF PRUEXCESS GR 0 # PRU INCREMENTED #
THEN
BEGIN
FTTCURPRU[FTTINDEX] =
FTTCURPRU[FTTINDEX] + PRUEXCESS; # UPDATE FTTCURPRU #
FTTWORD[FTTINDEX] = FTTWORD[FTTINDEX] - PRUEXCESS*64;
# UPDATE FTTWORD #
END
FTTDBIT[FTTINDEX] = CMB$DBIT[0]; # UPDATE DBIT FROM CMB #
FTTMSTATE[FTTINDEX] = CMB$STATE[0]; # STORE LAST STATE OF #
# TRANSLATION #
IF FTTOPCODE[FTTINDEX] EQ SEND # FOR SENDER #
THEN
BEGIN
IF CMB$DBUF[0] EQ 1 AND FTTEOR[FTTINDEX] # IF DISK BUFFER #
# EMPTY AND EOR #
THEN
BEGIN
IF (NOT FTTEOI[FTTINDEX]) OR # NOT EOI #
(FTTEOI[FTTINDEX] AND
((NEWPTR NQ OLDPTR) OR (CMB$DBIT[0] NQ CMB$STEP[0])))
THEN # OR EOI AND THERE IS NOTHING #
BEGIN # IN THE DISK BUFFER #
FTTCURPRU[FTTINDEX] = FTTCURPRU[FTTINDEX] + 1; # 1 PRU FOR#
# EOR OR EOF #
FTTWORD[FTTINDEX] = 0; # INITIALIZE WORD COUNT TO 0 #
FTTDBIT[FTTINDEX] = CMB$STEP[0];
FTTMSTATE[0] = 0; # CLEAR STATE OF TRANSLATION #
END
END
END
ELSE
BEGIN # RECEIVER #
IF CMB$NBUF[0] NQ 0 AND TBH$EOR[0]
THEN # NETBUF EMPTY AND EORI #
BEGIN
IF (NOT TBH$EOI[0]) OR # NOT EOI #
(TBH$EOI[0] AND
((NEWPTR NQ OLDPTR) OR
(CMB$DBIT[0] NQ WORDLENGTH - CMB$STEP[0])))
THEN # OR EOI AND NOTHING IN THE #
BEGIN # THE DISK NUFFER #
FTTCURPRU[FTTINDEX] = FTTCURPRU[FTTINDEX] + 1;
FTTWORD[FTTINDEX] = 0; # INITIALIZE WORD COUNT TO 0 #
FTTDBIT[FTTINDEX] = WORDLENGTH - CMB$STEP[0];
FTTMSTATE[0] = 0; # CLEAR STATE OF CONVERSION #
END
END
END
RETURN; # RETURN TO CALLER #
END # END OF PROC NP$UPRU #
TERM
*ENDIF