home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C128CPM / SGTOOLS17.ARC / SGCTOOLS.DOC < prev    next >
Encoding:
Text File  |  1994-06-01  |  9.0 KB  |  217 lines

  1. ___________________________________________________________________
  2.  
  3.                          SG C Tools 1.7
  4.                     (C) 1994 Steve Goldsmith
  5.                        All Rights Reserved
  6. ___________________________________________________________________
  7.  
  8.  
  9. OVERVIEW
  10.  
  11. SG C Tools ANSI C library unlocks the power of the C128 running
  12. CP/M!  High level and low level functions are included to access
  13. the VDC, SID and CIA.  All source code is compatible with the
  14. Freeware version of Hi Tech C.  A demo is included to show you how
  15. to use most features.
  16.  
  17. I have not had much time to add more features to SG C Tools.  I'm
  18. operating 3 AS/400s for 9 hours.  I also support several PC Pascal
  19. tool kits that make real money, so I've focused on them too.  What
  20. all this means is that you now have the complete source code to SG
  21. C Tools!  Hack it and crack it, but do not try to sell it.  Send me
  22. any cool programs you develop with it via Internet UU encoded E-
  23. mail or Mail to my address at end of doc.
  24.  
  25. The ellipse functions and demo were the only modification between
  26. 1.6 and 1.7.  Ellipses in 640 X 480 interlace mode no longer leave
  27. gaps with larger A,B values.  Just compile VDCELLPI.C and
  28. VDCELLPI.C, use LIBR to replace the .OBJ files in the C128LIB.LIB.
  29.  
  30.  
  31. REQUIREMENTS
  32.  
  33. A C128 or C128D running CP/M 3.0 or a IBM PC running a CP/M
  34. emulator and DOS to CP/M file transfer software.
  35.  
  36. At least one 1581, two 1571s, large RAM disk or hard drive to
  37. compile on a C128.
  38.  
  39. 80 column monitor for VDC specific routines.  640 X 480 interlace
  40. graphics requires a monitor that can handle this format.
  41.  
  42. SG C Tools 1.6 (SGTOOL16.ARC).
  43.  
  44. ANSI C programming experience.
  45.  
  46.  
  47. LICENSE AGREEMENT
  48.  
  49. PLEASE FEEL FREE TO (i) UPLOAD THIS SOFTWARE TO ANY ELECTRONIC
  50. BULLETIN BOARD, (ii) DEMONSTRATE THE SOFTWARE AND ITS CAPABILITIES
  51. OR (iii) GIVE COPIES TO POTENTIAL USERS, SO THAT OTHERS MAY HAVE
  52. THE OPPORTUNITY TO OBTAIN A COPY FOR USE IN ACCORDANCE WITH THE
  53. LICENSE TERMS CONTAINED IN THIS FILE.
  54.  
  55. NOTICE TO USER:  CAREFULLY READ THE FOLLOWING LEGAL AGREEMENT.
  56.  
  57. 1.   LICENSE GRANT.  Steven P. Goldsmith grants to you, as an
  58. individual, a non-exclusive right to use one copy of the SOFTWARE
  59. associated with this license for personal use on your computer. 
  60. This license to use the SOFTWARE is conditioned upon your
  61. compliance with the terms of this Agreement.  You are entitled to
  62. use the software in any way you see fit as long as there is NO
  63. charge.
  64.  
  65. 2.   COPYRIGHT.  The SOFTWARE is protected by United States
  66. copyright law and international treaty provisions.  You acknowledge
  67. that no title to the intellectual property in the SOFTWARE is
  68. transferred to you.  You further acknowledge that title and full
  69. ownership rights to the SOFTWARE will remain the exclusive property
  70. of Steven P. Goldsmith or its suppliers, and you will not acquire
  71. any rights to the SOFTWARE except as expressly set forth in this
  72. license.  You agree that any copies of the SOFTWARE will contain
  73. the same proprietary notices which appear on and in the SOFTWARE.
  74.  
  75. 3.   LIMITED WARRANTY.  Steven P. Goldsmith warrants that the
  76. SOFTWARE will perform substantially in accordance with the
  77. accompanying written materials for a period of ninety (90) days
  78. from the date of purchase.  Any implied warranties relating to the
  79. SOFTWARE are limited to ninety (90) days.
  80.  
  81. 4.   STEVEN P. GOLDSMITH DOES NOT WARRANT THAT THE SOFTWARE IS
  82. ERROR FREE.  STEVEN P. GOLDSMITH DISCLAIMS ALL OTHER WARRANTIES
  83. WITH RESPECT TO THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
  84. BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
  85. FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
  86.  
  87. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES
  88. OR LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY MAY LAST, OR THE
  89. EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
  90. THE ABOVE LIMITATIONS OR EXCLUSIONS MAY NOT APPLY TO YOU.  THIS
  91. WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS AND YOU MAY ALSO HAVE
  92. OTHER RIGHTS WHICH VARY FROM JURISDICTION TO JURISDICTION.
  93.  
  94. 5.   NO LIABILITY FOR CONSEQUENTIAL DAMAGES.  IN NO EVENT SHALL
  95. STEVEN P. GOLDSMITH OR ITS SUPPLIERS BE LIABLE TO YOU FOR ANY
  96. CONSEQUENTIAL, SPECIAL, INCIDENTAL OR INDIRECT DAMAGES OF ANY
  97. KIND ARISING OUT OF THE DELIVERY, PERFORMANCE OR USE OF THE
  98. SOFTWARE, EVEN IF STEVEN P. GOLDSMITH HAS BEEN ADVISED OF THE
  99. POSSIBILITY OF SUCH DAMAGES.  IN NO EVENT WILL STEVEN P.
  100. GOLDSMITH'S LIABILITY FOR ANY CLAIM, WHETHER IN CONTRACT, TORT OR
  101. ANY OTHER THEORY OF LIABILITY, EXCEED THE LICENSE FEE PAID BY YOU,
  102. IF ANY.
  103.  
  104. 6.   ENTIRE AGREEMENT.  This is the entire agreement between you
  105. and Steven P. Goldsmith which supersedes any prior agreement or
  106. understanding, whether written or oral, relating to the subject
  107. matter of this license.
  108.  
  109. Commodore 128 is a trademark of Commodore Business Machines.  CP/M
  110. and CP/M 3.0 are trademarks of Digital Research.  MS-DOS and
  111. Windows are trademarks of Microsoft.  IBM PC,  PC-XT and PC-AT are
  112. trademarks of International Business Machines.
  113.  
  114.  
  115. COMPILING DEMO WITH HI-TECH C 3.09
  116.  
  117. First you will need to have a copy of HI-TECH C 3.09 (CP/M-80). 
  118. You can download the following Freeware files from GEnie's CP/M RT
  119. (M685;3) or other source:
  120.  
  121.  8149 LIBSRC.LZH               X BRIAN-CPM    930616   80384     39 
  122.  3
  123.       Desc: Source Code to Hitech C library
  124.  8148 Z80V309.LZH              X BRIAN-CPM    930616  194304     51 
  125.  3
  126.       Desc: Hitech C Compiler for CP/M
  127.  8147 Z80DOC.LZH               X BRIAN-CPM    930616   89088     55 
  128.  3
  129.       Desc: Documentation for Hitech C compiler
  130.  
  131. You should look over HI-TECH C's manual and compile a simple "hello
  132. world" program before proceeding.  I installed all the compiler
  133. related files on my 1581.  My source and header files are on a
  134. 1571.  You could get away with two 1571s, but a RAM disk or hard
  135. drive would be better.  You could also use a faster CP/M system or
  136. a Z80 emulator to edit and compile code on other platforms.
  137.  
  138. To build LIBC128.LIB make sure all files in LIBC128.ARC reside in
  139. the same drive and user as HTC.
  140.  
  141. SUBMIT LIB 
  142.  
  143. Assembles, compiles and creates LIBC128.LIB.
  144.  
  145. To compile demo program use:
  146.  
  147. C -O -X DEMO.C -LC128
  148.  
  149.  
  150. PROGRAMMING CONSIDERATIONS
  151.  
  152. The VDC should be configured to its default CP/M 3.0 settings at
  153. the start and end of each program.
  154.  
  155. Display memory        0000h
  156. Attribute memory      0800h
  157. Character definitions 2000h
  158.  
  159. This includes restoring character definitions if you use memory at
  160. 2000h for bit maps, etc.  Setting the VDC to 64K mode wipes out
  161. memory used in 16K mode, so be sure to save the character
  162. definitions to a memory buffer or file before using 64K mode.  The
  163. VDC remains in 64K mode until you do a cold boot or warm boot with
  164. the C128's reset button.
  165.  
  166. Most of the VDC functions do not check parameters for range
  167. violations.  Range checking should be preformed at the application
  168. level.  There are times when you may want to write to a off screen
  169. memory location.  For this reason there is no need to waste time
  170. and code doing range checks.  Just be aware of the implications. 
  171. A renegade program may accidentally wipe out character definitions
  172. or other important memory regions forcing you to reboot.
  173.  
  174. Basically, just return to CP/M the way it was before your program
  175. ran.  See DEMO.C for a complete example of setting various VDC
  176. modes and exiting back to CP/M correctly.
  177.  
  178. CP/M relies on the CIAs for communication to the outside world just
  179. like in native 64/128 modes.  With this in mind it is best not to
  180. change certain registers.  I have found it safe to use CIA #2's TOD
  181. clock, timers A and B and disable all interrupt sources.  You can
  182. also safely read the keyboard and joy sticks via CIA #1 if you
  183. disable interrupts.  My low level key scan function reads all key
  184. positions into an array of 11 bytes.  See page 642 of the Commodore
  185. 128 Programmer's Reference for the key positions in the matrix. 
  186. You can tell joy stick signals from a key short because the joy
  187. stick shorts a whole row in the matrix instead of one bit like a
  188. key press.  See page 32 of the 1351 Mouse User's manual for more
  189. info.
  190.  
  191. CP/M uses voice 1 of the SID to produce a key click.  You can use
  192. the SID just as you would in native 128 mode with one exception. 
  193. Since CP/M writes to the SID during key presses it may affect a
  194. sound in progress.  You can disable interrupts to eliminate this
  195. problem.
  196.  
  197. The four bit Z Blaster engine requires the sound data's high
  198. nibbles to come first.  You can easily swap the nibbles once the
  199. sample is in memory if needed.  The maximum sample rate is about 15
  200. KHz.
  201.  
  202. The PCX engines for 640 X 200 and 640 X 480 require you to toggle
  203. off the disk status line.  The status line updates during disk I/O
  204. and changes the VDC update address which throws off the engines.
  205.  
  206.  
  207. HOW TO CONTACT ME
  208.  
  209. Please report any support questions, problems, suggestions, etc. to
  210. me via GEnie S.GOLDSMITH2, Internet S.GOLDSMITH2@GENIE.GEIS.COM,
  211. voice phone (813) 925-1064 or US Mail to:
  212.  
  213. Steve Goldsmith
  214. 2805 Jamaica Street
  215. Sarasota, FL 34231
  216. USA
  217.