ASMB,L,C,R HED RBCST UTILITY SUBROUTINE FOR RDBA-IMAGE/1000 NAM RBCST,7 92069-16228 REV.1912 790130 * * ******************************************************************* * (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-18228 * RELOC: 92069-16228 * * PRGMR: CEJ * * ******************************************************************* * * * * Convert SeT is a subroutine which searches the Set Table, in the cur- * rently active local Run Table for RDBA, for a set to determine its * number, entry address and the accessibility of the set. * * The set whose number and entry are to be found is passed to RBCST as * either a set name or set number. If a set name, it must be six char- * acters long padded with trailing blanks if necessary. When the set * is specified by number, a binary search of the Set Table is performed * looking for the set entry containing that number (the sets are in as- * cending numerical order in the Set Table). When the set is specified * by name, a binary search of the Set Table is performed using the set * Sort Table and comparing the set names (the sets are in ascending alpha- * betical order in the Sort Table). * * If an entry matching the specified set is found, total accessibility * to the set is assumed and RBCST returns successful to the caller. If * a matching entry is not found, the set is assumed to be inaccessible * and the error return is taken. * * The calling sequence for RBSCT is: * * JSB RBCST * DEF *+4 return point * DEF SET set name or number * DEF NUMBR returned set number * DEF ADDRS returned Set Table pointer * < error return > * < normal return > * SKP ********************************************************************** * * * Run Table for local machine in Remote Data Base Access * * * * The local copy of the Run Table used by the RDBA master subrou- * * tines consists of the following sections: * * * * 1) Data Base Control Block * * 2) Data Item Table * * 3) Data Set Table * * 4) Sort Table * * * * These sections are in the order stated. Details of each section * * follow. * * * ********************************************************************** *** *** * * * Data Base Control Block - one 17 word entry per data base * * * *** *** RDCBS DEC 17 DBCB size * RDNAM DEC 0 data base name - three words DEC 1 DEC 2 RDRBN DEC 3 remote data base number DEC 4 RDDSN DEC 5 DS node number DEC 6 RDITC DEC 7 data item count RDITP DEC 8 data item table pointer RDDSC DEC 9 data set count RDDSP DEC 10 data set table pointer RDSOP DEC 11 sort table pointer DEC 12 RDLMD DEC 13 lock flag/open mode RDLFG EQU RDLMD 1st byte: lock flag RDMOD EQU RDLMD 2nd byte: open mode DEC 14 RDCBC DEC 15 # of DCBs desired = 0 RDMDL DEC 16 maximum data length * ZERO EQU RDNAM base of zero for future equates *** *** * * * Data Item Table - one 5 word entry per item in a 1000 data base * * * *** *** RI1LN EQU ZERO+5 length of a 1000 entry * RI1NM EQU ZERO item name - 3 words RI1NO EQU ZERO+3 item number RI1IL EQU ZERO+4 item length *** *** * * * Data Set Table - one 6 word entry per set in a 1000 data base * * * *** *** RS1LN EQU ZERO+6 length of a 1000 entry * RS1NM EQU ZERO set name - 3 words RS1NO EQU ZERO+3 set number RS1EL EQU ZERO+4 entry length (in words) RS1KL EQU ZERO+5 key item length for a master *** *** * * * Sort Table - one 1 word entry per item and per set. Each entry * * is a pointer to the respective item or set table * * entry relative to the start of the Run Table * * * *** *** A EQU 0 B EQU 1 * ENT RBCST,RBCIT EXT .CMW,.ENTR,AIRUN * SET NOP NUMBR NOP ADDRS NOP * * Get true parameter and return point addresses. * RBCST NOP JSB .ENTR DEF SET * * Initialize Set Table search parameters: * 1) Get length of Set Table entry. This is the value in RS1LN. * LDB RS1LN STB ENTLN * * 2) Get number of sets in data base (10th word of DBCB), add one * and this is the highest index for the search. * LDA AIRUN ADA RDDSC LDB A,I INB STB HIGH * * 3) Get pointer to Set Table (11th word of DBCB). This is relative * to start of Run Table. * INA LDB A,I STB TABAD * * 4) Determine address of the set Sort Table = pointer to Sort Table * (12th word of DBCB) + number of items (8th word of DBCB) + * address of Run Table. * INA LDB A,I ADA M4 ADB A,I ADB AIRUN STB STADR * * 5) Set lowest index for search to zero. * << RBCIT joins RBCST at this point. >> * JOIN CLA STA LOW * * 6) Get the first index for the search, this is HIGH/2. * LDA HIGH ARS STA INDEX * * Done with initialization. Determine if a name or number was given. * If a number, the high order byte will be zero, if a name, non-zero. * In either case, if the sign bit is set, the parameter is erroneous. * LDA SET,I SSA JMP CST8 Negative parameter - error. * AND HIBYT SZA JMP CST3 A name reference given. SKP * * Here when a number is given. Perform binary search on Set (or Item) * Table without Sort Table. When an entry is chosen by the algorithm * the address of the entry is calculated by: * (INDEX - 1) * ENTLN + TABAD + AIRUN. * The number in the entry (fourth word in the table entry) is then com- * pared with the number given. * CST1 CCA Get entry's address. ADA INDEX CLB MPY ENTLN ADA TABAD STA ADDRS,I (this is returned if entry a match) ADA AIRUN * ADA RS1NO Get entry's number LDA A,I STA NUMBR,I (this is returned if entry a match) * CMA,INA Compare numbers ADA SET,I SSA JMP CST2 Entry's number > given number SZA,RSS JMP CST7 Entry's number = given number * JSB CHIGH Entry's number < given number. JMP CST1 Get next (higher) index & try it. * CST2 JSB CLOW (Entry>given). Get next JMP CST1 (lower) index & try it. SKP * * Here when a name is given. Perform binary search on Set (or Item) * Table using the Sort Table as a sorted binary tree and using the name * given and the name of the Table entry as the objects of comparison. * When an entry of the Sort Table is chosen by the algorithm, the cor- * responding Set (or Item) Table entry address is calculated by: * Contents of Sort Table entry + AIRUN. * The comparison of names is then performed. * CST3 CCA ADA INDEX ADA STADR LDA A,I A = pointer to entry STA ADDRS,I (this is returned if entry a match) * ADA AIRUN A -> entry LDB SET B -> given name JSB .CMW Compare names. DEF D3 DEC 0 JMP CST6 A match JMP CST5 Entry's name < given name. * JSB CLOW Entry's name > given name. JMP CST3 Get next (lower) index & try it. * CST5 JSB CHIGH (Entry number STA NUMBR,I thanks to CMW * CST7 ISZ RBCST Take normal return when CST8 JMP RBCST,I a match is found. SKP * * Following are the subroutines which do the new index calculations. * First is CLOW. CLOW is called when the entry in the Table chosen by * the algorithm has a comparitor value > that given by the user. The * current index becomes the new HIGH index and CLOW calculates the next * index to use by: * INDEX = INDEX - (HIGH - LOW) / 2. * CLOW NOP CCA Make sure that we are not ADA INDEX already on the lowest CMA,INA posible index. ADA LOW SSA,RSS JMP CST8 Lowest - no matching entry. * LDA INDEX Okay - calculate next STA HIGH (lower) index. LDB LOW CMB,INB ADA B ARS CMA,INA ADA INDEX STA INDEX JMP CLOW,I * * Next is CHIGH. CHIGH is called when the entry in the Table chosen by * the algorithm has a comparitor value < that given by the usr. The * current INDEX becomes the new LOW index and CHIGH calculates the next * index to use by: * INDEX = INDEX + (HIGH - LOW) / 2. * CHIGH NOP LDA INDEX Make sure that we are not INA already on highest CMA possible index. ADA HIGH SSA JMP CST8 Highest - no matching entry. * LDA INDEX Okay - calcualte next STA LOW (higher) index. CMA,INA ADA HIGH ARS ADA INDEX STA INDEX JMP CHIGH,I SKP * * Entry point for RBCIT. The function of RBCIT is the same as RBCST, * except RBCIT works on the Item Table, Item Sort Table, and is called * with an item name or number. The calling sequence for RBCIT is: * * JSB RBCIT * DEF *+4 * DEF ITEM item name or number * DEF NUMB2 returned item number * DEF ADDR2 returned Item Table pointer * < error return > * < normal return > * ITEM NOP NUMB2 NOP ADDR2 NOP * * Get true parameter and return point addresses. * RBCIT NOP JSB .ENTR DEF ITEM * * Initialize Item Table search parameters: * 1) Get length of Item Table entry. This is the value in RI1LN. * LDB RI1LN STB ENTLN * * 2) Get number of items in data base (8th word of DBCB), add one * and this is the highest index for the search. * LDA AIRUN ADA RDITC LDB A,I INB STB HIGH * * 3) Get pointer to Item Table (9th word of DBCB). This is relative * to start of Run Table. * INA LDB A,I STB TABAD * * 4) Get address of item Sort Table = pointer to Sort Table (12th * word of DBCB) + address of Run Table. * ADA D3 LDB A,I ADB AIRUN STB STADR * * From this point on, set and item processing is identical. So, make * RBCST look like the point at which we were entered and jump to JOIN * for the joint processing. * LDA ITEM Move parameter addresses. STA SET LDA NUMB2 STA NUMBR LDA ADDR2 STA ADDRS * LDA RBCIT Move return address STA RBCST JMP JOIN and join set processing. * * * Constants and variables. * M4 DEC -4 D3 EQU ZERO+3 * HIBYT OCT 177400 * ENTLN NOP STADR NOP TABAD NOP HIGH NOP LOW NOP INDEX NOP END $END