home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C128CPM / SGTOOL16.ARC / SGCTOOLS.DOC < prev   
Encoding:
Text File  |  1994-02-27  |  8.7 KB  |  211 lines

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