PROGRAM DR2TAP C C VERSION 1.0 C C This program will input data from the DR11-K digital input/output C interface and will output the data to tape. It can read data C clocked in at a continious rate of at least 8kHz and will put C the data out in blocks of 1280 integers to a TE16 drive operating C at 1600 BPI. C C The program flow is shown below : C C C +--------+ * +----------+ +--------+ <--------------. C | | E.D.R. | | | | | C | |------->| DR11-K | | Fill | | C | DEVICE | | Input |----->| the | | C | |------->| Register | | Buffer | | C | | Data | | | | | C +--------+ +----------+ +--------+ | C | | C | | C | | C '---> +--------+ --> +--------+ C | | | | C | Start | | Toggle | C | Output | | Buffer | C | of | | Number | C | the | | | C | Buffer | +--------+ C | | C +--------+ C * NOTE : E.D.R. is External Data Ready signal C C C An external device provides a data sample and an EXTERNAL DATA C READY signal to the DR11-K. This program reads the data sample C and puts it into a buffer. This process is repeated until the C buffer is filled. At this time the process to write the buffer C is initiated, the buffer number is toggled (1 to 2 or 2 to 1), C and the new buffer is set up to receive data from the DR11-K. By C double buffering the data input in this way the program can run C at a continious rate of 8 kHz ( 8kHz was tested and worked fine. C The upper speed limit has not been determined by the author at C the time of this writting). C C RESTRICTIONS : C This program was written for a PDP-11/55 running RSX-11M V.4.0 C that has a TE16 tape drive. If you have a PDP with 22 bit C addressing (i.e. a PDP-11/70) then this program will NOT run C as is on your system. Also, if you do not have a TE16 drive C then modifications will be in order. I leave all modifications C to the prospective user since I do not have access to other C PDP systems. C C If you do have a PDP with 18 bit addressing and a TE16 tape C drive then please check the DEFINE module in LABWORK.MAC C to be sure the CSR's and addresses of the DR11-K and the TE16 C tape drive are the same as the devices actually on your system. C If they are different then modify the variables to the proper C values. C C The tape handling routines are setup for speed so error C checking is non-existant (error checking takes time and time C could not be spared with my appliction). What this means is C that if you have a parity error on a tape write, you will C never know it, the routine will simply clear out the error C register and keep on truck'n! As a result you might end up C with a bad block on tape. However, I have not experienced C any problems yet as I have kept the tape heads clean and C used new tapes. C C The data written to tape is not formatted. Thus to read C it back you can either use QIO's or you can make use of C the subroutine TAPEIO.MAC submitted on an earlier DECUS C symposium tape. TAPEIO.MAC is included on this UIC for C convience. C C TO BUILD : C Use the command file BLDLAB.CMD found in this UIC. C C TO RUN : C Make sure the KLAB series support is included in your system. C If it isn't then you need to gen it in. C C Now issue the following commmand : C C >@GO DR2TAP C (For further information see GO.CMD) C C When you want to stop the program simply set the front panel C switch #0 high. C C VARIABLES : C LEN - Length of the output data blocks. C ARRAY - Two dimensional buffer that accepts data from the C DR11-K. C BASADD - Base address of the first element of each column C of ARRAY (the first 16 bits). C EXTADD - Extended address of the first element of each column C of ARRAY (the upper 2 bits). C Note : The combination of BASADD and EXTADD gives a C full 18 bit address. C TCMASK - Tape control register mask used in TPBLTR. C WCMASK - Word count register mask used in TPBLTR. C FCMASK - Frame count register mask used in TPBLTR. C CSRMSK - Control and status 1 register mask used in TPBLTR. C C SUBROUTINES : C ADRESS - This subroutine finds the physical memory address of C a variable passed to it. It is used to determine the C base and extended addresses of the first element of C each column of ARRAY. C INITAT - Initialize the mag tape registers, clear all errors, C and select the proper controller and formatter. C SETWRT - Initialize various register masks used in TPBLTR. C TPBLTR - TApe BLock TRansfer routine. C INPDR - DR11-K reading routine. C C Author : Richard A. Crawford C E-Systems, Inc. C P.O. Box 1056 CBN-27 C Greenville, Texas 75401 C (214) 457-6018 C C Date : January 4,1984 C PARAMETER LEN = 1280 INTEGER ARRAY(LEN,2), BASADD(2), EXTADD(2) INTEGER TCMASK, WCMASK, FCMASK, CSRMSK(2) C C Suppress End-Of-File message : C CALL ERRSET(24,.TRUE.,.FALSE.,.TRUE.,.FALSE.,15) C C Determine which tape drive to use : C WRITE(5,110) 100 READ(5,*,END=500)IN 110 FORMAT(1X,$'Enter tape drive number (0 or 1) : ') IF(IN.NE.0.AND.IN.NE.1)THEN WRITE(5,120) GOTO 100 120 FORMAT(1X,$'Please enter 0 or 1 : ') END IF C C Determine the physical memory starting address of the arrays : C CALL ADRESS( ARRAY(1,1), EXTADD(1), BASADD(1) ) CALL ADRESS( ARRAY(1,2), EXTADD(2), BASADD(2) ) C C Initialize the tape drive : C CALL INITAT(IN) C C Get the proper tape register masks for writting : C CALL SETWRT(IN,LEN,EXTADD(1),EXTADD(2),TCMASK,WCMASK,FCMASK, 1 CSRMSK(1),CSRMSK(2)) C C Initialize the buffer selector : C NUM = 1 C C Let the user know we're starting : C WRITE(5,*)'Input from DR11-K beginning now' WRITE(5,*)'Set Front Panel Switch #0 high to stop' C C Fill up array with data from the DR11-K : C 130 DO 140 I=1,LEN ARRAY(I,NUM) = INPDR() 140 CONTINUE C C Write the data to tape (1600 BPI) : C CALL TPBLTR(TCMASK,WCMASK,FCMASK,BASADD(NUM),CSRMSK(NUM)) C C Toggle the buffer selector : C IF(NUM.EQ.1)THEN NUM = 2 ELSE NUM = 1 END IF GOTO 130 C C Take care of ^Z input responses : C 500 WRITE(5,*)' ADORDA -- EXITING' CALL EXIT(24) !24 is EOF error message number END SUBROUTINE ADRESS(NUM,HI,LO) C C This subroutine finds the physical memory address of a variable C passes to it. It puts the 18 bit address into two variables. C The first variable LO contains the lower 16 bits of the address C and the other variable HI contains the upper 2 bits. C INTEGER NUM, HI, LO INTEGER*2 IBUF(0:2), TEMP(2) INTEGER*4 UPLOW EQUIVALENCE ( UPLOW, TEMP(1) ) C C Get the start address of the task (In 32 word increments) : C CALL GETREG(, IBUF, IDS) C C Convert the start address into bytes : C TEMP(1) = IBUF(0) UPLOW = JISHFT( UPLOW, 6 ) C C Get the address of NUM (Relative to the program C starting address) : C CALL GETADR( IADR, NUM ) C C Now calculate the absolute address of NUM : C UPLOW = UPLOW + IADR HI = TEMP(2) LO = TEMP(1) C C Make sure the LO is even and ensure that HI contains only the C upper two bits of the address : C LO = IAND( LO , '177776'O ) !Base address of NUM HI = IAND( HI , '3'O) !Extended address of NUM RETURN END