home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 225_01 / deff4.txt < prev    next >
Text File  |  1987-06-09  |  11KB  |  328 lines

  1.                         DEFF4.TXT
  2.                         ---------
  3.  
  4.          I have given, below, a description of each of the functions
  5.          which I have written for the file -
  6.  
  7.                    DEFF4.C
  8.  
  9.          and which may be accessed through -
  10.  
  11.                    DEFF4(.CRL)
  12.  
  13.          when you use the CLINK function with BDS C.   It is
  14.          necessary to specify "DEFF4" on the command line when using
  15.          the included functions.   If you put it first, say -
  16.  
  17.                    clink filename deff4 {other options} <RETURN>
  18.  
  19.          then you will always get the DEFF4 functions included in the
  20.          COM file in preference to any other functions of the same name
  21.          which might be elsewhere in your files.
  22.  
  23.          If you intend to use DEFF4 in this way then it should be on
  24.          the same disk as the BDS C DEFF files.   Now, the functions
  25.          I have written and what they do are -
  26.  
  27.          BRIGHT         ENTAB          GO_TO          HAZ_CLEAR
  28.          LINE           LINES          LISTD          LISTS
  29.          LOWER_STR      MAKE_FCB       NORMAL         OUT_CHAR
  30.          PEC_CLEAR      PRINT_U        PRT_HEX        SET_BIT
  31.          UP_STR         VIDEO_CHAR     B_TEST
  32.  
  33.          The special BIOS functions are -
  34.  
  35.          CONIN          CONOUT         CONST          LIST_C
  36.          LISTST         READ_SEC       SELDSK         SET_DMA
  37.          SET_SEC        SET_TRK        W_BOOT         WRITE_SEC
  38.  
  39.  
  40.          void BRIGHT()
  41.          -------------
  42.  
  43.          Makes the display appear in high-intensity, for the Hazeltine
  44.          Esprit terminal.
  45.  
  46.          char B_TEST(byte, bit)
  47.          int bit;
  48.          char byte;
  49.          ---------------------
  50.  
  51.          Tests the byte to see whether the nominated bit is set or not.
  52.          Returns TRUE if bit set else returns FALSE.   Note the bits
  53.          are numbered from ZERO (0) to SEVEN (7).
  54.  
  55.          char CONIN()
  56.          ------------
  57.  
  58.          Returns the next character from the console, with the parity
  59.          bit ( = bit 7) set to zero.
  60.  
  61.          void CONOUT(c)
  62.          char c;
  63.          --------------
  64.  
  65.          Prints the ASCII character to the console.
  66.  
  67.          char CONST()
  68.          ------------
  69.  
  70.          Returns the console status as -
  71.  
  72.                    0         if no character is waiting
  73.                    0xff      if a character is waiting
  74.  
  75.  
  76.          char ENTAB(n)
  77.          int n;
  78.          -------------
  79.  
  80.          This can only be used when the position "n" along the line
  81.          (generally of up to 80 characters and ALWAYS terminated with
  82.          the RETURN character) is known.   So you have to maintain
  83.          (external to this function) a count of where you are along
  84.          the line, and pass this value to TAB.
  85.  
  86.          TAB will then expand any "tab" characters ( = 0x09) into the
  87.          correct number of spaces, so long as you are using a tab
  88.          which is set to 8 spaces.   If you want to change this to any
  89.          other tab spacing, then go into DEFF4 and change the equate.
  90.  
  91.          Note particularly this was written for use with printers
  92.          which don't recognise the tab character.   I believe a lot
  93.          of the older printers are of this type.
  94.  
  95.  
  96.          void GO_TO(column, row)
  97.          int column, row;
  98.          -----------------------
  99.  
  100.          Will send the cursor to the nominated address where#-
  101.  
  102.                    column  =  0 to 79  (for 80 characters)
  103.  
  104.                    row     =  0 to 23  (for 24 lines)
  105.  
  106.          for the Hazeltine terminals.   Note the function could
  107.          easily be altered for other terminals provided the lead-in
  108.          codes are known.
  109.  
  110.  
  111.          void HAZ_CLEAR()
  112.          ----------------
  113.  
  114.          Will clear the screen and home cursor for the Hazeltine Esprit
  115.          terminal.
  116.  
  117.  
  118.          char INKEY()
  119.          ------------
  120.  
  121.          Duplicates the Microsoft Basic "inkey" function in that it will
  122.          return  TRUE/FALSE depending on whether a key has been pressed
  123.          or not.   Note it doesn't display the key which was pressed.
  124.  
  125.          Must be used in a loop to function properly.   For example -
  126.  
  127.               while(inkey() == FALSE)
  128.                   ;            /* Empty loop */
  129.  
  130.  
  131.          void LINE()
  132.          -----------
  133.  
  134.          Will space down one line on the console screen.
  135.  
  136.  
  137.          void LINES(n)
  138.          unsigned n;
  139.          -------------
  140.  
  141.          Will space down the number of lines nominated by the user.
  142.  
  143.          void LISTC(c)
  144.          char c;
  145.          -------------
  146.  
  147.          Sends the ASCII character to the line printer.
  148.  
  149.  
  150.          void LISTD(i)
  151.          int i;
  152.          -------------
  153.  
  154.          Will print an integer as a decimal number on the list device
  155.          which is typically the line printer.
  156.  
  157.  
  158.          void LISTS(str)
  159.          char *str;
  160.          ---------------
  161.  
  162.          Will list a null-terminated string on the list device which is
  163.          typically the line printer.
  164.  
  165.          char LISTST()
  166.          -------------
  167.  
  168.          Checks to see whether the line printer (the list device) is on
  169.          line and returns 0xff if the printer is ready to accept a
  170.          character else returns 0 if the printer is busy or is off line.
  171.  
  172.  
  173.          void LOWER_STR(str)
  174.          char *str;
  175.          -------------------
  176.  
  177.          Will convert a null-terminated string, in place, to lower
  178.          case characters.
  179.  
  180.  
  181.          void MAKE_FCB(name, fcb)
  182.          char name[15], fcb[36];
  183.          ------------------------
  184.  
  185.          Will create a CP/M file control block with the file name
  186.          correctly parsed for use with other functions such as
  187.          OPEN_FILE, CREATE_FILE, etc which are to be found in DEFF3.
  188.  
  189.          Note:     I didn't do anything to set the drive code (which is
  190.          ----      character fcb[0], so this will be zero unless you
  191.                    specifically set it to something after using the
  192.                    "make_fcb" function.   It is easy enough to include
  193.                    the drive specifier in the function, if you wish to
  194.                    do this yourself as an exercise.
  195.  
  196.  
  197.          void NORMAL()
  198.          -------------
  199.  
  200.          Returns the screen display to normal viewing intensity, for
  201.          the Hazeltine Esprit terminal.
  202.  
  203.  
  204.          void OUT_CHAR(c)
  205.          int c;
  206.          ----------------
  207.  
  208.          Sends the nominated character to the terminal after first
  209.          limiting it to no more than 7 bits.  i.e. the parity bit is
  210.          removed prior to transmission.
  211.  
  212.          Uses the "bios" function to send the character.
  213.  
  214.  
  215.          void PEC_CLEAR()
  216.          ----------------
  217.  
  218.          Clears the terminal screen without having to know the special
  219.          terminal functions.   Note does NOT home the cursor.
  220.  
  221.  
  222.          void PRINT_U(n)
  223.          unsigned n;
  224.          ---------------
  225.  
  226.          Will print the unsigned integer, in decimal format, to the
  227.          console screen.
  228.  
  229.          void READ_SEC()
  230.          ---------------
  231.  
  232.          Reads the 128-byte sector into the DMA buffer.   Note the
  233.          sector must have been previously specified with calls to
  234.          SET_TRK and SET_SEC and the DMA buffer must have been
  235.          specified with SET_DMA.   Returns 0 if the read was OK else
  236.          returns 1 for an unspecified read error.
  237.  
  238.          int SELDSK(drive)
  239.          char drive;
  240.          -----------------
  241.  
  242.          Selects the nominated disk (A, B,.....F) as the "logical" disk
  243.          for the next disk operation.   Will return 0 if drive refers
  244.          to a non-existent drive.
  245.  
  246.          void SET_BIT(fcb, mode)
  247.          char fcb[36], mode[3];
  248.          -----------------------
  249.  
  250.          This is the function used in BACKUP to change the attribute
  251.          bits in the name given in the file control block.   Mode has
  252.          to be one of -
  253.  
  254.               R/O       Read Only
  255.               R/W       Read/Write
  256.               DIR       Appears in directory when listed
  257.               SYS       Doesn't appear in directory
  258.               ARC       Has already been archived by BACKUP
  259.               CPY       Not yet archived
  260.  
  261.          void SET_DMA(buffer)
  262.          char *buffer;
  263.          --------------------
  264.  
  265.          Sets the DMA buffer address at the address given by the
  266.          buffer pointer.   This buffer is then used in all later
  267.          disk I/O operations.
  268.  
  269.          void SET_SEC(sector_number)
  270.          int sector_number;
  271.          ---------------------------
  272.  
  273.          This is the sector number used in direct track addressing
  274.          and can hold any value from 0 to 255.   For the address to
  275.          be valid you must have first used the SET_TRK function to
  276.          set the absolute track number.
  277.  
  278.          void SET_TRK(track_number)
  279.          int track_number;
  280.          --------------------------
  281.  
  282.          This is the (absolute) track number used in direct disk track
  283.          addressing operations.   Note the disk must first have been
  284.          pre-selected with the SELDSK function.   Acceptable track
  285.          numbers are from 0 to 65,535 (0x00 to 0xffff).
  286.  
  287.  
  288.          void UP-STR(str)
  289.          char *str;
  290.          ----------------
  291.  
  292.          Will convert a null-terminated string to upper case ASCII
  293.          characters, in place.
  294.  
  295.          void W_BOOT()
  296.          -------------
  297.  
  298.          Performs the normal CP/M "warm boot" function.
  299.  
  300.          char WRT_SEC()
  301.          --------------
  302.  
  303.          Writes out to disk the sector nominated in SELDSK, SET_TRK
  304.          and SET_SEC and as contained in the DMA buffer.   Will
  305.          return zero for a successful write else returns 1 for an
  306.          unspecified write error.
  307.  
  308.          void VIDEO_CHAR(c, attr)
  309.          char c, attr;
  310.          ------------------------
  311.  
  312.          Prints to the console the character nominated in the video
  313.          mode stipulated by the user.   At present the mode is
  314.          restricted to -
  315.  
  316.              'B' -  Bright
  317.              'N' -  Normal
  318.  
  319.          Note the function is specific to Hazeltine terminals because
  320.          it uses (internally) the functions "BRIGHT" and "NORMAL"
  321.          which have been written for the Hazeltine terminals.   If it
  322.          is required to transport the function to another terminal
  323.          then it will be necessary to make BRIGHT and NORMAL specific
  324.          to that terminal.
  325.  in all later
  326.          disk I/O operations.
  327.  
  328.          void SET_SE