home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / csr20a.arc / CSR102.NWS < prev    next >
Text File  |  1987-01-10  |  26KB  |  793 lines

  1.  
  2.  
  3.  
  4.         Volume 1, Number 2                               January 10, 1987
  5.         +---------------------------------------------------------------+
  6.         |                                                               |
  7.         |   The Official Newsletter            CCCC                     |
  8.         |                                     CC  CC                    |
  9.         |           of the                   CC                         |
  10.         |                                    CC   S P O T   R U N       |
  11.         |         C Spot Run                 CC                         |
  12.         |                                     CC  CC                    |
  13.         |      C Add-On Library                CCCC                     |
  14.         |                                                               |
  15.         +---------------------------------------------------------------+
  16.  
  17.                                                     Editor: Bob Pritchett
  18.                                                   Publisher: Fido 107/414
  19.  
  20.         This  newsletter is published irregularly when enough information 
  21.         warrants  it.   The latest newsletter is always available at  The 
  22.         Pinelands BBS,  (609) 354-9259, FidoNet (107/414), and registered 
  23.         users of the C Spot Run Library will recieve new issues by  modem 
  24.         or US Mail.
  25.  
  26.         This newsletter is protected by United States Copyright law.   It 
  27.         may  be  reproduced  and freely distributed provided  no  fee  is 
  28.         charged and the newsletter is not modified in any manner.
  29.  
  30.  
  31.                               - Table of Contents -
  32.  
  33.  
  34.              1. Introduction....................................2
  35.  
  36.              2. New release.....................................3
  37.  
  38.              3. Support for more compilers......................4
  39.  
  40.              4. Sample programs.................................5
  41.  
  42.              5. Graphics........................................6
  43.  
  44.              6. Books...........................................7
  45.  
  46.              7. Looking at the future...........................8
  47.  
  48.              8. Sample program sources..........................10
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                    C Spot Run Newsletter - January 10, 1986
  68.  
  69.  
  70.                                == Introduction ==
  71.  
  72.                                   Bob Pritchett
  73.  
  74.  
  75.              Hello  again.   This is the second newsletter,  and  if  you 
  76.         don't  yet have the first,  I recommend you get and read  it,  it 
  77.         might prove interesting.
  78.              Finally,   thanks  to  Microsoft's  technical  support,  the 
  79.         problem I was having with the windows has been removed,  allowing 
  80.         development to continue, the end result being this newsletter and 
  81.         the  accompanying  version  of the library.   (For  the  curious: 
  82.         Although I did the needed moves of BP at the start and finish  of 
  83.         a  small ASM routine,  I neglected to include the PUSH BP and and 
  84.         POP BP statements, resulting in a software hangup.) 
  85.              I've  gotten quite a few calls to the BBS,  and a few  voice 
  86.         phone calls,  and I'd like to thank those of you who've responded 
  87.         for  your comments and suggestions.   However,  even if  only  to 
  88.         satisfy  my curiosity,  I'd really like to see at least a copy of 
  89.         the  user response form (at the end of the manual) from  as  many 
  90.         people as possible.  (I haven't received even one.)  Comments and 
  91.         suggestions  are  valuable  to  me,   as  I  am  running  out  of 
  92.         creativity.   Also, although I can't guarantee it, the chances of 
  93.         you receiving an update notification or something are 100% better 
  94.         if I have your name and address.
  95.              The library is currently released only to CompuServe, GEnie, 
  96.         and  a  couple  of  BBS's  local to  me.   I'd  love  to  see  it 
  97.         distributed as far and wide as possible,  but outside of my small 
  98.         calling range, I don't know any good BBSes.  If you have, or know 
  99.         of,  a  BBS  that would like to be a distribution point  for  the 
  100.         library,  please contact me.  (The only request I have is that if 
  101.         I  list you as a distribution point,  meaning I'll make sure  you 
  102.         always have the latest version, you keep it up on the system.)
  103.              The  Pinelands BBS,  as those of you who've connected  know, 
  104.         has  experienced  a  disk  crash and a  pile  of  other  assorted 
  105.         problems.   It went down for almost a month,  and my apologies to 
  106.         those  of you who tried unsuccessfully to call.   From now on  it 
  107.         will either be up,  or the call will be call-forwarded to another 
  108.         BBS  whose SYSOP was kind enough to have us.   Apologies for  the 
  109.         inconvenience, it is now ready to go.
  110.              Once  again  I extend an invitation (or rather I plead)  for 
  111.         you to contribute routines,  programs, utilities, or articles for 
  112.         the newsletter.
  113.              There  is no Bug Notices section in this newsletter,  as the 
  114.         release of the newsletter coincides with that of the new  library 
  115.         version.
  116.              Enjoy the library,  share it with your friends,  and let  me 
  117.         know if you have questions or comments.  Thanks!
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                                        Page 2
  128.  
  129.  
  130.  
  131.  
  132.  
  133.                    C Spot Run Newsletter - January 10, 1986
  134.  
  135.  
  136.                                 == New Release ==
  137.  
  138.              The new release of the library, version 2.0, has several 
  139.         advantages.  Bugs have been fixed, and new routines cover things 
  140.         such as field and normal input and sound.
  141.  
  142.              There  is  a temptation for me to continue  adding  routines 
  143.         until  I have 'the perfect' library.   The only problem with that 
  144.         is that I will never release it,  because I always have something 
  145.         else  I want added.   So if what you are looking for isn't  here, 
  146.         tell me what it is, and you should find it in the next version of 
  147.         the library.   (Also note that some types of routines involve  so 
  148.         many  variables  that  I can never have exactly the  routine  you 
  149.         want.   (The input routines for example.)  That is why the source 
  150.         code is available....)
  151.  
  152.              Future versions are dependant mainly on the contributions of 
  153.         users by means of source and ideas, keep them coming!
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                                        Page 3
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                    C Spot Run Newsletter - January 10, 1986
  200.  
  201.  
  202.                         == Support for More Compilers ==
  203.  
  204.              The  library,  powerful  as it is,  is currently limited  to 
  205.         Microsoft C 3/4.0.  To make it more globally useful, it should be 
  206.         able  to work with all major compilers,  and I hope this  support 
  207.         can come about in the very near future.   Of course this requires 
  208.         a  few things,  such as someone with a knowledge of the  compiler 
  209.         and its library, and, of course, a copy of the compiler.
  210.              The hardest part of the conversion will be the 'grunt' work. 
  211.         I went ahead and used Microsoft's REGS union for interrupt calls, 
  212.         making  use of the ability to access the ?h and ?l registers,  in 
  213.         addition  to the ?x registers supported by the interrupt  calling 
  214.         functions  of many compilers.   This will obviously be a  tedious 
  215.         conversion  task  for  those  who can  not  directly  access  the 
  216.         individual registers.  (?h and ?l.)
  217.              Additionaly  there  is the job of  converting  the  assembly 
  218.         headers in the .ASM files.
  219.              This  is  just  about all there is  to  it.   (Sounds  easy, 
  220.         right?)   However,  I do not have the time or manuals to do  this 
  221.         conversion  job.   If anyone out there would like to take on  the 
  222.         job  of  converting  the source to work  with  another  compiler, 
  223.         testing  it,  etc.  they may do so,  and will get the source  for 
  224.         free,  in  addition to a possible percentage of revenue generated 
  225.         by  that version.   I don't claim that it is an easy  job  (well, 
  226.         maybe easy,  but surely tedious), so please only volunteer if you 
  227.         have the time and desire to do it.   If you do, please contact me 
  228.         so we can discuss it.
  229.              Note:   So  far  the support plan includes support  for  the 
  230.         Microsoft,   Lattice,   Eco-C88,   and   Computer  Innovations  C 
  231.         compilers.   If you wish to work on another brand,  that's great, 
  232.         we need all the support we can get.
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                                                        Page 4
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                    C Spot Run Newsletter - January 10, 1986
  266.  
  267.  
  268.                               == Sample Programs ==
  269.  
  270.              At  the  end  of the newsletter are  a  few  sample  program 
  271.         sources, (.EXE is in the archive).  These are just small programs 
  272.         that  demonstrate  the  use of library functions  in  a  somewhat 
  273.         practical manner.
  274.              In  addition to the sources included here I have a couple of 
  275.         non graphic animated games.   (ASCII characters are used  instead 
  276.         of graphic lines and figures.)  For the most part they use just a 
  277.         few library functions (windowing,  screen manipulation, and a few 
  278.         other  odd routines) but they do show some techniques for  psuedo 
  279.         artificial  intelligence  in moving the computer's  players  etc.  
  280.         (Besides,  I  think  some  of them will keep you  playing  for  a 
  281.         while.)   If  you'd like a copy of the sources and EXE,  you  may 
  282.         find them around on BBSes, or write/call me and I'll send them to 
  283.         you.
  284.              Once  again,  I invite contribution of any programs you  may 
  285.         have written using the library.  Even if you don't have source to 
  286.         publicly  distribute,  I'm curious to see what people  have  done 
  287.         with the functions available.  Thanks....
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                                        Page 5
  326.  
  327.  
  328.  
  329.  
  330.  
  331.                    C Spot Run Newsletter - January 10, 1986
  332.  
  333.  
  334.                                  == Graphics ==
  335.  
  336.              Graphics  are an exciting and useful part of an application, 
  337.         and thus an important part of any function library.  However I am 
  338.         far from an expert at PC graphics,  and I don't have the time  or 
  339.         desire  to become one.   I've seen dozens of graphics routines in 
  340.         all languages.  The problem is that I can't get what are probably 
  341.         the  fastest  routines  (the  assembly  ones)  to  work  properly 
  342.         consistently.  
  343.              I've  even  been sent a set of graphics routines in  C,  but 
  344.         they  are  for high resolution mode only,  and I  don't  want  to 
  345.         modify them to work in all modes and handle palletes etc. 
  346.  
  347.              The  problem:   I don't want to do ANY debugging of graphics 
  348.         routines,  and I don't have any good,  fast,  and universal  ones 
  349.         already done.
  350.  
  351.              My  solution:   Whoever  will  send  me a  complete  set  of 
  352.         graphics  routines,   similar  (or  easily  modifiable  to)   the 
  353.         following format will get registration status and library source. 
  354.         (The  $50 option on the order form.)  As many routines as you can 
  355.         put  together  would be nice,  and as long as the  code  is  semi 
  356.         readable I'll even write the documentation.
  357.  
  358.              What I'd like to see:
  359.  
  360.              gdot(row,col,color);
  361.                   Graphic dot plotting routine.  No checks on parameters, 
  362.         and useable in all graphics modes.
  363.  
  364.              gline(x,y,x2,y2,color);
  365.                   Graphic  line.   My limited knowledge of line  plotting 
  366.         routines  suggests  speed would be improved with the addition  of 
  367.         two  routines,  gvline()  and  ghline(),  to  plot  vertical  and 
  368.         horizontal  lines and save time by not checking for diagonals  on 
  369.         all lines.
  370.  
  371.              gbox(x,y,x2,y2,color);  gfbox(x,y,x2,y2,color);
  372.                   A simple open box drawing routine, and a filled box.
  373.  
  374.              goval(...);
  375.                   I don't know how to do it, you might.
  376.  
  377.              gcircle(x,y,radius,color);  gfcircle(x,y,radius,color);
  378.                   Circle routine, and filled circle routine.
  379.  
  380.              I  believe I have some sample routines that would help  with 
  381.         the circle and oval routines, contact me.
  382.              If  I can get these primitives I'll even look  into  graphic 
  383.         windows, as has been requested.
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.                                                        Page 6
  392.  
  393.  
  394.  
  395.  
  396.  
  397.                    C Spot Run Newsletter - January 10, 1986
  398.  
  399.  
  400.                                    == Books ==
  401.  
  402.              Seeing as I have nothing better to write about,  I'd like to 
  403.         take this space to talk about a few C/PC books.
  404.  
  405.              The   Peter  Norton  Programmer's  Guide  to  the  IBM   PC.  
  406.         (Bellevue:  Microsoft Press.  1985).  $19.95
  407.              This  book is billed as "The ultimate regerence guide to the 
  408.         entire  family  of IBM personal computers."  In  my  opinion,  it 
  409.         fully  lives up to this statement.   Without this book,  I  would 
  410.         never have written C Spot Run.  Although it leaves a few subjects 
  411.         with  only minimal explanation,  it covers just about  everything 
  412.         you would ever want to know about your PC.  Examples are provided 
  413.         in  a  variety  of  languages,  and  the  entire  book  is  cross 
  414.         referenced.   An absolute must for anyone developing applications 
  415.         which  make  low  level  use of the IBM  PC's  bios  or  MS-DOS's 
  416.         functions.
  417.  
  418.              Data  Handling  Utilities in C.   Robert  A.  Radcliffe  and 
  419.         Thomas J. Raab.  (Berkley:  Sybex. 1986).  $19.95
  420.              This  book contains hundreds of well documented routines  to 
  421.         perform data entry,  manipulation, and output.  The source is all 
  422.         Lattice,  but it is easily ported to any other compiler.   If you 
  423.         are  writing a data based application that is intensive  in  data 
  424.         manipulation,  this  book  is  a  great  tool.   The  variety  of 
  425.         specialized  routines  goes far beyond the scope of C Spot  Run's 
  426.         limited set of data tools.  A nice set of apendices are included, 
  427.         with things such as a list of vendors of C products,  a  modified 
  428.         _main() function,  and a chart of the powers of two.   Overall it 
  429.         is a very complete set of tools for applications development.
  430.  
  431.              Advanced C:   Techniques & Applications.  Gerald E. Sobelman 
  432.         and David E. Krekelberg.  (Indianapolis:  Que Corporation. 1985). 
  433.         $19.95
  434.              This  book  is for those with a basic knowledge of  C.   The 
  435.         subjects  covered  range  from  device  independant  graphics  to 
  436.         btrees,  linked lists,  and coding style.  After several chapters 
  437.         on  different  areas  of programming,  the book  jumps  into  the 
  438.         development  of  a  large graphics system with  a  powerful  user 
  439.         interface.   (Something like implementing a Macintosh environment 
  440.         on a PC.   However it is put together in a way to make it  rather 
  441.         independant of your machine.   Developing device independant code 
  442.         is  one of the issues the book stresses.)  If you need to write a 
  443.         graphic (/icon) oriented system that is user friendly,  this book 
  444.         is for you.   It also serves to teach good techniques in  general 
  445.         applications   development,   and  stresses  many  other   issues 
  446.         applicable to non graphic systems.
  447.  
  448.              I  hope  you find some of the above useful,  and I  hope  it 
  449.         stimulates  some of you to contribute some book reviews,  whether 
  450.         it's just a paragraph or a complete analysis.
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                                        Page 7
  458.  
  459.  
  460.  
  461.  
  462.  
  463.                    C Spot Run Newsletter - January 10, 1986
  464.  
  465.  
  466.                            == Looking at the Future == 
  467.  
  468.              Wow, another newsletter done.  (Yes, I know this is only the 
  469.         second one, but you didn't write both of them, not to mention the 
  470.         manual.....)
  471.              I'd  like to discuss some issues related to the library  and 
  472.         support of it.  First of all, my goals for the library:
  473.  
  474.              o  To provide a user-supported library of routines and tools 
  475.         for C programmers.
  476.  
  477.              o  To make sure the library is of use to programmers in many 
  478.         areas, and to keep it up to date and well supported.
  479.  
  480.              o   To  make  enough  money to justify the  long  hours  and 
  481.         financial outlay needed to develop and support the library.
  482.  
  483.              I  enjoy working on the library,  however there is  a  large 
  484.         investment  of  time and expense on my part.   For  that  reason, 
  485.         while  I will do my best to help everyone,  registered users will 
  486.         get  first  priority  in support,  and  their  requests  will  be 
  487.         fufilled first. 
  488.  
  489.              The library is user-supported for several reasons.  First of 
  490.         all,  public  domain  C  source was invaluable to me  while  (and 
  491.         after)  I learned the language.   I am also an extensive user  of 
  492.         public  domain programs,  and I owe all those gracious  people  a 
  493.         large  debt.   I don't have the money to compete with  commercial 
  494.         packages, and I don't want to have extensive legal obligations to 
  495.         customers.  
  496.              Now,  while  the library is user-supported,  I still plan to 
  497.         offer  full support,  the result of which is this newsletter  and 
  498.         the  Pinelands  BBS.   The  bottom line of  this  entire  lengthy 
  499.         discussion is that while I plan to offer all the support I can, I 
  500.         am  just  as  lazy  (or more so) than  the  next  guy,  and  thus 
  501.         seemingly simple routines may be absent.   (A bad habit of  mine, 
  502.         if  it  isn't  something  I know how to do,  and  it  isn't  that 
  503.         important  to me,  I won't go to the trouble of looking  it  up.)  
  504.         However, if you need something done, and can't write it yourself, 
  505.         let  me  know and I'll give it a shot,  or find someone  who  can 
  506.         handle it.  (If you can write it, how about sending me a copy?)
  507.  
  508.              A  nice  addition to the library,  and something that  would 
  509.         complement  the input routines,  would be some sort of data  base 
  510.         engine, btree or something.  Anyone who will send a nice complete 
  511.         set of data management routines of this type will get a free copy 
  512.         of  the library source.   (I don't have time to learn  all  that.  
  513.         Note:   What  I  need  is contribution by the  author(s)  of  the 
  514.         routines,  there are a few sets in the PD, but I have been unable 
  515.         to  contact  the  authors for permission to use  them,  which  is 
  516.         something I need.)
  517.  
  518.              I  understand that there are a lot of poor design choices in 
  519.         the library,  especially the windows.   However,  as I can't very 
  520.         well  design  a set-up that will fit  everyone's  needs,  I  have 
  521.  
  522.  
  523.                                                        Page 8
  524.  
  525.  
  526.  
  527.  
  528.  
  529.                    C Spot Run Newsletter - January 10, 1986
  530.  
  531.  
  532.         chosen to do it as you see it implemented, and I haven't thrown a 
  533.         lot of time into insignificant, yet useful, additions, other then 
  534.         what  is already there.   Hopefully (for me) this will  encourage 
  535.         you  to  purchase the source code,  which you can then modify  to 
  536.         your  heart's  content.    In  any  case,  there  are  two  other 
  537.         solutions.   I  can  set up a totally independant second  set  of 
  538.         windowing routines that are more efficient and flexible then  the 
  539.         ones  currently  implemented.    Things  such  as  multiple  page 
  540.         support,  borderless  windows,  windows with virtual  sizes,  not 
  541.         physical,  etc.   Or  you can contact me about a custom job for a 
  542.         specific application.  Let me know your opinions.
  543.  
  544.              Finally, if I can help in any way, I'll be glad to give it a 
  545.         shot.   Don't  be  afraid  to  contact me with  anything  from  a 
  546.         criticism to a suggestion or question.  I'd love to hear from you 
  547.         (it's inspiring) and I'm running out of new ideas.   (Or  rather, 
  548.         out of new ideas I'll implement without prodding from users.)
  549.              (Remember,  routines  and utilities are appreciated,  and  a 
  550.         good  (or  even poor) article for the newsletter would put me  in 
  551.         shock.  (Joyous shock....))
  552.  
  553.                             Bob Pritchett
  554.                             New Dimension Software
  555.                             23 Pawtucket Dr.
  556.                             Cherry Hill, NJ  08003
  557.                             Voice: (609) 424-2595
  558.                              Data: (609) 354-9259  300-2400B 24hrs.
  559.                           FidoNet: (107/414)
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                                        Page 9
  590.  
  591.  
  592.  
  593.  
  594.  
  595.                    C Spot Run Newsletter - January 10, 1986
  596.  
  597.  
  598.                           == Sample Program Sources ==
  599.  
  600.              DateDiff  is  a  small  program  invoked  with  one  or  two 
  601.         arguments, both dates.  It returns, for two arguments, the number 
  602.         of days between the two dates.   For one argument,  the number of 
  603.         days between the given date and the current date.
  604.  
  605.         DATEDIFF.C
  606.         ----------
  607.  
  608.         /*
  609.         **  D A T E D I F F . C
  610.         **
  611.         **  Calculates the difference of two dates, specified on command
  612.         **  line.  Uses the C Spot Run C Add-On Library.
  613.         **
  614.         **  Copyright 1986 Bob Pritchett
  615.         **
  616.         **  Created: 08/17/86   Last Updated: 08/20/86
  617.         **
  618.         */
  619.  
  620.         main(argc,argv)
  621.          int argc;
  622.          char *argv[];
  623.          {
  624.           int x;
  625.           int m;
  626.           int d;
  627.           int y;
  628.           int mn;
  629.           int dy;
  630.           int yr;
  631.           printf("\n               -- DateDiff  Version 1.0 --\n\n");
  632.           if ( argc < 2 || argc > 3 )
  633.            {
  634.             printf("   DateDiff will return the difference between two dates\n");
  635.             printf("in days.  If only one date is specified the current date\n");
  636.             printf("will be used for the second.\n\n");
  637.             printf("     DATEDIFF <xx>/<xx>/<xxxx> [<xx>/<xx>/<xxxx>]\n\n");
  638.             exit(1);
  639.            }
  640.           if ( argc == 2 )
  641.              get_date(&d,&m,&y);
  642.           else
  643.              sscanf(argv[2],"%d/%d/%d",&m,&d,&y);
  644.           sscanf(argv[1],"%d/%d/%d",&mn,&dy,&yr);
  645.           if ( y < 100 )
  646.              y += 1900;
  647.           if ( yr < 100 )
  648.              yr += 1900;
  649.           x = dt_diff(m,d,y,mn,dy,yr);
  650.           printf("  The difference is %d days.\n",x);
  651.           exit(0);
  652.          }
  653.  
  654.  
  655.                                                        Page 10
  656.  
  657.  
  658.  
  659.  
  660.  
  661.                    C Spot Run Newsletter - January 10, 1986
  662.  
  663.  
  664.              SoundEff  is  a small program to demonstrate the use of  the 
  665.         sound()  function to produce sound effects.   It does just  three 
  666.         simple sounds,  but the structure is applicable to other  sounds.  
  667.         The  data  for  these  sounds was obtained  from  a  file  called 
  668.         SOUNDEFF.BAS.  Note:  The sounds were tested on an AT.  Depending 
  669.         on your processor speed and the type of speaker you have you  may 
  670.         find  the  sound  very slow,  very fast,  or  off  tune.   Simple 
  671.         modifications to the numberic constants should be all it takes to 
  672.         fix  them for your setup,  but trial and error is the  only  sure 
  673.         fire method.
  674.  
  675.         SOUNDEFF.C
  676.         ----------
  677.  
  678.         /*
  679.         **  S O U N D E F F . C
  680.         **
  681.         **  Soundeffects in C.  Some data from SOUNDEFF.BAS.
  682.         **
  683.         **  Copyright 1986 Bob Pritchett
  684.         **
  685.         **  History:
  686.         **
  687.         **  08/27/86  RDP  Work on improving sounds. 
  688.         **
  689.         **  08/25/86  RDP  Coding begun, some effects added.
  690.         **
  691.         */
  692.  
  693.         int x;
  694.  
  695.         siren()
  696.          {
  697.           while ( ! kbhit() )
  698.            {
  699.             for ( x = 200; x < 901; ++x )
  700.                 sound(x,30);
  701.             sound(901,900);
  702.             for ( x = 900; x > 199; --x )
  703.                 sound(x,30);
  704.            }
  705.          }
  706.  
  707.         red_alert()
  708.          {
  709.           while ( ! kbhit() )
  710.            {
  711.             for ( x = 800; x < 901; ++x )
  712.                 sound(x,40);
  713.            }
  714.          }
  715.  
  716.         phone()
  717.          {
  718.           while ( ! kbhit() )
  719.  
  720.  
  721.                                                        Page 11
  722.  
  723.  
  724.  
  725.  
  726.  
  727.                    C Spot Run Newsletter - January 10, 1986
  728.  
  729.  
  730.            {
  731.             for ( x = 0; x < 25; ++x )
  732.              {
  733.               sound(523,70);
  734.               sound(659,70);
  735.              }
  736.             for ( x = 0; x < 25000; ++x )
  737.                 ;
  738.            }
  739.          }
  740.  
  741.         main()
  742.          {
  743.           printf("Testing sounds....\n");
  744.           getch();
  745.           siren();
  746.           getch();
  747.           red_alert();
  748.           getch();
  749.           phone();
  750.           getch();
  751.          }
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.                                                        Page 12
  788.  
  789.  
  790.  
  791.  
  792.  
  793.