ASMB,L,C,R
      HED RDEXT UTILITY SUBROUTINE FOR RDBAM & RDBAP
      NAM RDEXT,7 92069-1X168 REV.2040 800730 
* 
* 
******************************************************************* 
* (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1979. ALL RIGHTS RESERVED.
* NO PART OF THIS PROGRAM MAY BE PHOTOCOPIED, REPRODUCED, OR
* TRANSLATED TO ANOTHER PROGRAM LANGUAGE WITHOUT THE PRIOR WRITTEN
* CONSENT OF HEWLETT-PACKARD COMPANY. 
******************************************************************* 
* 
* 
*     SOURCE:    92069-18168
*     RELOC:     92069-1X168
* 
*     PRGMR:     CEJ
* 
* 
******************************************************************* 
* 
* 
* 
*  RD EXiT is a utility subroutine for the Remote Data Base Access Program
*  and Monitor.  Its function is to build the DS/1000 header for the reply
*  buffer then call D65SV to send the reply.
* 
*  The calling sequence for RDEXT is: 
* 
*         JSB RDEXT 
*          DEF *+6       return point 
*          DEF RPBUF     reply buffer 
*          DEF RPLEN     reply length 
*          DEF DABUF     data buffer
*          DEF DALEN     data length
*          DEF ERROR     DS error code (2 words) to put in reply
*         <error return>
*         <normal return> 
* 
      SKP 
**********************************************************************
***                                                                ***
*                  Standard DS/1000 equates                          *
***                                                                ***
#STR  DEC 0 
#SEQ  DEC 1 
#SRC  DEC 2 
#DST  DEC 3 
#EC1  DEC 4 
#EC2  DEC 5 
#ENO  DEC 6 
#REP  DEC 7 
***                                                                ***
**********************************************************************
**********************************************************************
*                                                                    *
*  DS/1000 RDBA Communications consist of two descriptive buffers:   *
*          1) Request buffer                                         *
*          2) Reply buffer                                           *
*  The reply buffer we are concerned with is as described below.     *
*                                                                    *
**********************************************************************
***                                                                ***
*                                                                    *
*  Reply buffer - one buffer of either 17 or 18 words per RDBA call  *
*                                                                    *
***                                                                  *
RBSTR EQU #STR      DS 1000 stream word 
RBSEQ EQU #SEQ      DS/1000 sequence number 
RBSRC EQU #SRC      DS/1000 source node number
RBDST EQU #DST      DS/1000 destination node number 
RBEC1 EQU #EC1      DS/1000 1st error code word 
RBEC2 EQU #EC2      DS/1000 2nd error code word 
RBEC3 EQU #ENO      DS/1000 error node number upon an error 
RBSTA EQU #REP      RDBA call status array
RBNUM EQU #REP+10   RDBA data base number for DBOPN 
***                                                                ***
**********************************************************************
      ENT RDEXT 
      EXT #NODE,.ENTR,D65SV 
* 
A     EQU 0 
B     EQU 1 
* 
RPBUF NOP 
RPLEN NOP 
DABUF NOP 
DALEN NOP 
ERROR NOP 
* 
*  Get true parameter and return point addresses. 
* 
RDEXT NOP 
      JSB .ENTR 
       DEF RPBUF
* 
*  Get the address of the reply buffer in the B register and set the re-
*  ply bit in the stream word (bit 14 of 1st word of reply buffer). 
* 
      LDB RPBUF 
      LDA B,I 
      IOR REPLY 
      STA B,I 
* 
*  Bump B register to the error code words (5 through 7) of the reply and 
*  put the 2 words passed to us in ERROR into the first two words of the
*  ECOD space in the reply buffer.
* 
      ADB RBEC1 
      LDA ERROR,I 
      STA B,I 
      INB 
      LDA ERROR 
      INA 
      LDA A,I 
      STA B,I 
* 
*  If there was an error, the A register is now non-zero.  Set the node 
*  number in the 7th word of the reply (3rd error code word) in this case 
*  and if the error code is ASCII, i.e. first word of ERROR is non-zero,
*  we need to set bit 15 of the 7th word also.
* 
      INB 
      SZA,RSS 
      JMP EXT1      No error - set ECOD3 to zero. 
* 
      LDA ERROR 
      SZA 
      LDA BIT15 
      IOR #NODE 
EXT1  STA B,I 
* 
*  Call D65SV to send the reply.
* 
      JSB D65SV 
       DEF *+5
       DEF RPBUF,I
       DEF RPLEN,I
       DEF DABUF,I
       DEF DALEN,I
      RSS           Error return, skip bump of return point.
* 
      ISZ RDEXT 
      JMP RDEXT,I 
* 
*  Constants and variables. 
* 
REPLY OCT 040000
BIT15 OCT 100000
      END RDEXT 
                                                                                                                                                                          