home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / Information / CHACKING11A.ARC / ISSUE11-A
Encoding:
Text File  |  2019-04-13  |  71.6 KB  |  1,803 lines

  1.                    ########
  2.              ##################
  3.          ######            ######
  4.       #####
  5.     #####  ####  ####      ##      #####   ####  ####  ####  ####  ####   #####
  6.   #####    ##    ##      ####    ##   ##   ##  ###     ##    ####  ##   ##   ##
  7.  #####    ########     ##  ##   ##        #####       ##    ## ## ##   ##
  8. #####    ##    ##    ########  ##   ##   ##  ###     ##    ##  ####   ##   ##
  9. #####  ####  ####  ####  ####  #####   ####  ####  ####  ####  ####   ######
  10. #####                                                                     ##
  11.  ######            ######            Issue #11
  12.    ##################               Version 1.0
  13.        ########                    December 1995
  14.  
  15. -------------------------------------------------------------------------------
  16.  
  17. #(@)contents: Table of Contents
  18.  
  19.  
  20. Features
  21.    6. Speed up RAMLink transfers with the Double-DMA Technique
  22.       (Reference: dbldma)                   by Doug Cotton and Mark Fellows 
  23.         RAMLink Designer Mark Fellows and Technical Editor Doug Cotton of 
  24.         CMD describe a way of using a Commodore REU to increase transfer 
  25.         rates of the CMD RAMLink to one-half the speed of the REU transfer 
  26.         rate.
  27.    8. The Graphics Toolbox by Stephen Judd
  28.       (Reference: toolbox)
  29.         To add another tool to our toolbox, Stephen details a new algorithm
  30.         for drawing ellipses.  Some improvements to the circle routine in
  31.         a previous column that will enable it to draw perfect circles of any
  32.         radius is discussed, as well as details on using logarithms to 
  33.         perform division.
  34.   10. Design and Implementation of an Advanced Text Editor by Craig Bruce
  35.       (Reference: zedace)
  36.         Peer into the internal organization and implementation of an 
  37.         advanced text editor/word processor for the ACE environment. 
  38.         Relevant data structure, global variables, display maintenance, 
  39.         text "sloshing", and algorithms for many editing commands are 
  40.         detailed.
  41.  
  42. Columns
  43.    4. Hi Tech Trickery by George Taylor
  44.       (Reference: trick)
  45.         Don't let anyone ever tell you the SID chip is only capable of 4 bit 
  46.         sample playback.  George Taylor explains using the digi dithering 
  47.         technique to increase the SID's resolution.
  48.   12. Hacking Graphics by Rick Mosdell
  49.       (Reference: gfx)
  50.         Dig into this overview on how to set up the VIC-II to display Doodle
  51.         and KOALA format pictures.  The two formats are detailed, and similar
  52.         formats are referenced.
  53.    
  54. Departments
  55.    1. The (cough,cough) Hacking Editor
  56.       (Reference: editor)
  57.    2. Input/Output
  58.       (Reference: io)
  59.    3. Newsfront
  60.       (Reference: news)
  61.    5. Hacking the Mags
  62.       (Reference: mags)
  63.    7. UseNuggets
  64.       (Reference: usenet)
  65.    9. Hack Surfing
  66.       (Reference: surf)
  67.   11. Commodore Trivia
  68.       (Reference: trivia)
  69.   13. ? DS, DS$: rem The Error Channel
  70.       (Reference: error)
  71.   14. The Next Hack
  72.       (Reference: next)
  73.  
  74. -------------------------------------------------------------------------------
  75.  
  76. #(@)legal: Commodore Hacking Legal Notice
  77.  
  78. Commodore and the respective Commodore product names are trademarks or 
  79. registered trademarks of ESCOM GmbH.  Commodore hacking is in no way 
  80. affiliated with ESCOM GmbH, owners of said trademarks.  Commodore Hacking is 
  81. published 4 times yearly by:
  82.  
  83. Brain Innovations Inc. 
  84. 602 N. Lemen 
  85. Fenton MI  48430
  86.  
  87. The magazine is published on on-line networks free of charge, and a nominal 
  88. fee is charged for alternate mediums of transmission.  
  89.  
  90. Permission is granted to re-distribute this "net-magazine" or "e-zine" in its 
  91. entirety for non-profit use.  A charge of no more than US$5.00 may be 
  92. charged by redistribution parties to cover printed duplication and no more
  93. than US$10.00 for other types of duplication to cover duplication and media
  94. costs for this publication.  If this publication is included in a for-profit 
  95. compilation, this publication must be alternately available separately or as
  96. part of a non-profit compilation.
  97.  
  98. This publication, in regards to its specific ordering and compilations of
  99. various elements, is copyright(c) 1995 by Brain Innovations, Incorporated,
  100. unless otherwise noted.  Each work in this publication retains any and all 
  101. copyrights pertaining to the individual work's contents.  For  
  102. redistribution rights to individual works, please contact the author of said 
  103. work or Brain Innovations, Inc.
  104.  
  105. Brain Innovations, Inc. assumes no responsibility for errors or omissions in 
  106. editorial, article, or program listing content.  
  107.  
  108. -------------------------------------------------------------------------------
  109.  
  110. #(@)info: Commodore Hacking Information
  111.  
  112. Commodore Hacking is published via the Internet 4 times yearly, and is 
  113. presented in both ISO-8859-1 and HTML versions.  This and previous issues can 
  114. be found at the Commodore Hacking Home Page 
  115. (http://www.msen.com/~brain/chacking/), as well as via FTP 
  116. (ftp://ccnga.uwaterloo.ca/pub/cbm/hacking.mag/)
  117.  
  118. In addition, the Commodore Hacking mail server can be used to retrieve each 
  119. issue.  To request a copy of an issue, please send the following electronic 
  120. mail message:
  121.  
  122. To: brain@mail.msen.com
  123. Subject: MAILSERV
  124. Body of Message:
  125.  
  126. help
  127. catalog
  128. send c=hacking11.txt 
  129. quit
  130.  
  131. To subscribe to the Commodore Hacking and receive new issues as 
  132. they are published, add the following command to you MAILSERV message 
  133. prior to the quit command:
  134.  
  135. subscribe c=hacking Firstname Lastname msglen
  136.  
  137. (msglen is largest size of file in kilobytes you can receive in an email 
  138. message.  When in doubt, choose 64)
  139.  
  140. example:
  141.  
  142. subscribe c=hacking Jim Brain 100
  143.  
  144. Although no fee is charged for this magazine, donations are gladly accepted 
  145. from corporate and individual concerns.  All monies will be used to defray 
  146. any administrative costs, subscribe to publications for review, and 
  147. compensate the individual authors contributing to this issue.
  148.  
  149. Any persons wishing to author articles for inclusion in Commodore Hacking are 
  150. encouraged to view the submission guidelines on the WWW
  151. (http://www.msen.com/~brain/pub/c-hacking-submit.txt) or via the MAILSERV 
  152. server (send c-hacking-submit.txt).  
  153.  
  154. ============================================================================
  155.  
  156. #(@)rch: Reading C=Hacking
  157.  
  158. Starting with Issue 11 of Commodore Hacking, the new QuickFind indexing 
  159. system is utilized to aid readers of the text version in navigating the
  160. magazine.  At the top  of each article or other important place in the
  161. magazine, a word prefixed with a special string is present.  (See the
  162. title of this article for an example.  Throughout the magazine, if an
  163. article is mentioned, it will be followed by a reference string.  For
  164. example, if we mentioned this article, we would add (Reference: rch) after
  165. the name.  By using your favorite editor's search function and searching
  166. for the string after the word "Reference:", prefixed by the magic prefix
  167. string, will move you directly to the article of choice.  To merely skip to
  168. the next article in the magazine, search only for the magic prefix string.
  169.  
  170. Some handy indexing strings possibly not referenced anywhere are:
  171.  
  172. top      top of issue
  173. bottom   bottom of issue
  174. contents table of contents
  175. legal    legal notice
  176.  
  177. For those with access to a UNIX system, the command "what" can be
  178. run on the issue, which will result in all the article titles being
  179. printed.
  180.  
  181. A slightly different magic prefix string "#(A)" is used to delimit
  182. sub-topics or main heading in articles.  The text after the magic string
  183. differs depending on article content.  For the Input/Output column
  184. (Reference: io), the text after the magic prefix will either be "c" for 
  185. comment, or "r" for response.  In features and columns, a number after
  186. the prefix indicates the ordinal of that heading or sub-topic in the
  187. article.  If a specific sub-topic is referenced elsewhere in the article,
  188. a sub-topic reference will be indicated.  A reference to "#(A)r" would
  189. be written as "(SubRef: r)".
  190.  
  191. As time goes on, the role of this indexing system will be expanded and
  192. changed to ease navigation of the text version, but minimize the clutter
  193. added by these extra items.
  194.  
  195. ============================================================================
  196.  
  197. #(@)editor: The Hacking Editor
  198.             by Jim Brain (brain@mail.msen.com)
  199.  
  200. Two new faces appear in this month's Commodore Hacking.  One is its new editor,
  201. while the other is its new look.  I hope neither causes anyone to worry about 
  202. the content of the magazine.  It's all still here.  C=Hacking will continue
  203. to provide leading edge technical information about the Commodore computers
  204. we all know and love.  The magazine will continue to cater to the Commodore
  205. computer programmer, whether it be in the areas of sound, graphics, algorithms,
  206. disk media access, or communications.  
  207.  
  208. However, the role of the magazine continues to expand.  It has been shown that
  209. many people other than CBM programmers read the magazine, and programmers have
  210. requested other information besides technical content be included in the
  211. magazine.  To this end, Issue 11 contains many new features, including:
  212.  
  213. o  "Hacking the Mags" (Reference: mags), which will summarize the other 
  214.    Commodore magazines in the market place.  Not everyone can read or
  215.    subscribe to all the quality CBM publications out there, so this column
  216.    will alert readers to specific issues that may be of interest.
  217.    
  218. o  "Newsfront" (Reference: news), which will bring the Commodore programmer 
  219.    and user up to date on developments in the Commodore community.  The
  220.    Commodore world doesn't stand still, and every programmer should be aware
  221.    of the newest technologies affecting the CBM line.
  222.  
  223. o  "The Error Channel" (Reference: error), which will formalize the process 
  224.    of fixing errors in earlier issues.  Hopefully, this will be unnecessary
  225.    in most issues, but it will be here just in case.
  226.    
  227. o  "Input/Output" (Reference: io), which will allow C=Hacking readers space 
  228.    for comments and concerns.  Many readers have sent me suggestions and
  229.    comments, some C=Hacking can implement, and some C=Hacking cannot.  
  230.    This spot will detail which is which and why.
  231.  
  232. o  Article separators.  As you can see above, each article or column in the
  233.    magazine is delimited by the special key, followed by a short name
  234.    of the article.  See "Reading C=Hacking" (Reference: rch) in this issue.
  235.    
  236. o  Smaller size.  The last issue was over 400kB in size, which generated
  237.    many complaints.  There is no need to create such a long issue, when 
  238.    more issues can be published.  This issue should comfortably fit on
  239.    two sides of a 1541 disk, a 1571 disk, or a 1581 disk.
  240.  
  241. o  Stable publication dates.  Circumstances (college, job hunt), made it 
  242.    hard for the previous editor to maintain a schedule, so no blame is laid,
  243.    but the magazine does need some stability.  Although possibly unrealistic,
  244.    I am striving to publish C=Hacking quarterly, with the following schedule:
  245.       
  246.       Publication Date        Submission Deadline
  247.       March, 1996             February 10, 1996
  248.       June, 1996              May 10, 1996
  249.       September, 1996         Auguest 10, 1996
  250.       December 1996           November 10, 1996
  251.  
  252.    If article submissions keep up, a switch to bi-monthly publication might
  253.    be warranted, but I won't get too far ahead.
  254.    
  255. o  Fully HTML-ized version of the magazine.  Issue 11 contains many
  256.    improvements designed to make the publication of an World Wide Web
  257.    readable version of the magazine easier.  Look for the HTML version of
  258.    this and older issues at URL: http://www.msen.com/~brain/chacking/.   
  259.    
  260. Many people have compared Commodore Hacking to the defunct _Transactor_ 
  261. magazine, which is encouraging.  The new format will hopefully add to the
  262. appeal of Commodore Hacking.
  263.  
  264. Although many of you know me or of me through previous Commodore work, this
  265. is my first editorship, so please comment on the changes I have made and what
  266. your opinions on each are.  As the magazine is for you, the reader, it is
  267. always important to keep the reader happy.
  268.  
  269. Sadly, some things, like the WWW browser for C=Hacking, did not get done,
  270. but there is always next time.
  271.  
  272. Enjoy YOUR magazine,
  273.  
  274. Jim Brain (brain@mail.msen.com)
  275. editor
  276.  
  277. ============================================================================
  278.  
  279. #(@)io: Input/Ouput
  280.  
  281. Obviously, Commodore Hacking depends on the comments and article submissions
  282. from the Commodore community to flourish.  Everyone sees the articles, but
  283. let's not forget those comments.  They are very helpful, and every attempt
  284. is made to address concerns in them.  Address any comments, concerns, or
  285. suggestions to:
  286.  
  287. Commodore Hacking
  288. 602 N. Lemen
  289. Fenton, MI  48430
  290. brain@mail.msen.com (Internet)
  291.  
  292. #(A)c: Need Samples of Samples  
  293.  
  294. From: "Clifford \"Paska\" Anderson" <andersoc@saturn.uaamath.alaska.edu>
  295.  
  296. Dear C=Hacking,
  297. Hey.  Just writing to mention something I'd like to see in C=Hacking, if 
  298. you can find someone to write about it.  I am interested in knowing more 
  299. about how samples work on the 64, how to play, etc.
  300. -----
  301.  _    _       _
  302. Si vales, valeo
  303.  
  304. #(A)r:
  305. Your wish is granted.  Check out this issue's Hi Tech Trickery 
  306. (Reference: trick) by George Taylor for some insight into playing 
  307. samples.
  308.  
  309. #(A)c: You Index, I Index, We all Index
  310.  
  311. From: coyote@wakko.gil.net
  312.  
  313. Dear C=Hacking,
  314. I would like to offer an idea for the Chacking mag. Every now and then 
  315. I'll come across a reference to an article in this or that Chacking Issue.
  316. I run Zed and load that issue in (Thanks Mr Bruce) and start hunting for 
  317. the start of the article. 
  318.  
  319. This process would be made a lot easier if Chacking used a method of 
  320. indexing I have seen used in several publications.
  321.  
  322. It involves the search function of most text editors. A 2/3/4 ? letter 
  323. code (with a delimiter char to prevent unintentional matches) that the 
  324. reader uses to find the beginning of the article.
  325.  
  326. (Outline of suggestion deleted)
  327.  
  328. I would like to add a personal thanks for all your efforts on behalf of 
  329. the C= community.
  330.  
  331. Al Anger
  332. 13841 SW 139 Ct.
  333. Miami Fl. 33186
  334. (305) 233-4689
  335.  
  336. #(A)r:
  337. Fire up that search function in your favorite editor.  Issue 11 now
  338. contains the QuickFind indexing system that should fit your needs.  See 
  339. "Reading C=Hacking" (Reference: rch) for information on how to utilize the 
  340. indexing system.  We would like to add that C=Hacking appreciates your 
  341. personal thanks.
  342.  
  343. #(A)c: Are We Talking the Same Language?
  344. From: Jack Vander White <ceejack@crl.com>
  345.  
  346. Dear C=Hacking,
  347. Noticed something that may be a potential problem and thought I would 
  348. let you know.
  349.   
  350. Way back when hacking mag started I didn't have Internet access. the first
  351. couple of issues were sent to me by fellows who had downloaded them and in
  352. downloading had set their terms to translate them to PETSCII. This of 
  353. course changed the coding in the uuencoding parts of the magazine and made
  354. them decode improperly. 
  355.  
  356. Since then I have my own access and have re-downloaded them and posted 
  357. them on my BBS in the original straight ASCII so that those who download
  358. them can uudecode the relevant parts and then translate the text for 
  359. reading.
  360.   
  361. Since different Terminal Programs are using different Translation tables
  362. I can see all kinds of problems in this for the average user.
  363.   
  364. Any comment????
  365.   
  366. Jack VW
  367.  
  368. #(A)r:
  369. The HTML version of Commodore Hacking utilizes the ISO-8859-1 text
  370. encoding standard, while the text version utilizes its 7-bit subset, 
  371. commonly called ASCII.  Normally, the encoding standard poses little
  372. problem, as text uses but a nominal set of characters which can be
  373. translated between PETSCII and ASCII.  However, as you point out, the
  374. uucode format uses more characters, which may or may not be
  375. translated correctly.  To circumvent this problem, which only occurs
  376. in the text version, the files embedded in a Commodore Hacking issue 
  377. should be uudecoded prior to converting the file to anoy alternate
  378. format.
  379.  
  380. ============================================================================
  381.  
  382. #(@)news: Newsfront
  383.  
  384. *  Although not new news, Some still may not know that Creative Micro Designs,
  385.    Inc., is currently designing the Super64CPU accelerator.  This external
  386.    3" tall by 6" wide by 2" deep cartridge will allow Commodore computers
  387.    to execute programs at either 10MHz or 20MHz  (actually, 9 and 18 MHz, 
  388.    realistically).  The unit uses the Western Design Center's 65C816S CPU,
  389.    which is object code compatible with the 6502/6510/8502.  The CPU, used
  390.    in the Super Nintendo Entertainment System as well as other products, can
  391.    be switched between 6502 emulation mode and "native" mode, which allows
  392.    the following:
  393.    
  394.    o  access to 16 MB of RAM without bank switching.
  395.    o  64kB stack.
  396.    o  64kB zero page (now called "direct access").
  397.    o  16 bit registers.
  398.    o  Support for virtual memory systems.
  399.  
  400.    The unit is scheduled for production in February, 1996, and will cost 
  401.    ~US$149.00 for the 10MHz unit and US$199.00 for the 20MHz unit.  
  402.  
  403. *  The following information was relayed to the USENET newsgroup comp.sys.cbm
  404.    by Jack Vanderhite, editor and publisher of COMMODORE CEE disk magazine:
  405.    
  406.       Rather than reply to all the messages asking about DIEHARD I will tell
  407.       all what has been happening over the last few days. 
  408.  
  409.       Brian Crosthwaite, Publisher of Diehard, contacted CMD, Loadstar, and
  410.       Commodore CEE this week with the following form letter faxed to each of
  411.       us:
  412.       -----------
  413.       
  414.       Diehard, the Flyer for commodore 8bitters is planning to cease 
  415.       publication and we are looking to transfer our subscription fulfillment.
  416.       Our number of outstanding subscribers is approximately 8,400 and I 
  417.       would be willing to throw in the balance of the list, totaling 
  418.       approximately 12,000.
  419.          
  420.       Please call me at (xxx)xxx-xxxx if you are interested in acquiring these
  421.       readers and names.
  422.       
  423.       Sincerely, 
  424.       
  425.       Brian L. Crosthwaite
  426.       Publisher
  427.       
  428.       ----------
  429.       
  430.       Each of us did contact Brian for further details. They are bleak. The
  431.       total number of paper issues due to subscribers is approximately 64,000.
  432.       This does not count the approximately 1,200 spinner subscribers which
  433.       would make approximately 10,000 disks due. 
  434.       
  435.       The cost of publishing alone would amount to approximately $100,000 for
  436.       printing, layout, disks, ,mail cost, etc. Not taking into account the
  437.       cost of articles, etc.
  438.       
  439.       when asked about money Brian's only comment was "There is none. It's 
  440.       gone."
  441.  
  442.       a further complication is that Tom Netsel told me last week that General
  443.       Media says that Brian has assumed the obligation to deliver the balance
  444.       of the Gazette subscriptions. I questioned Brian about this. Brian says 
  445.       that general media faxed him the terms of transference of the 
  446.       obligation and that he faxed back an acceptance of the terms.  While I 
  447.       have not seen the actual faxes involved it does sound like offer and 
  448.       acceptance of a binding contract from here.
  449.       
  450.       Obviously, all of us have rejected this offer. I have been told that 
  451.       there is an issue of Diehard at the printers, probably printed. 
  452.       However, the printing bill alone is over $8,000 plus the cost 
  453.       of mailing. Since there is no money it sits there.   
  454.       
  455.       If anyone were willing to assume the total obligations they would have 
  456.       to assume a liability of well over $100,000 over the next year before 
  457.       any returns from renewals would even make a dent in this huge 
  458.       obligation.
  459.       
  460.       Please Note: I am putting this out as a public message. This is ALL I 
  461.       know.
  462.  
  463.       Please do not come back at me asking questions. I have nothing more I can
  464.       add to this.   
  465.       
  466.       Jack VW
  467.     
  468.    So, if you have outstanding issues of dieHard due you, as the editor 
  469.    does,  the fears have been confirmed.  However, for those who purchased 
  470.    the dieHard "Spinner" disk, read on for the encouraging news.
  471.  
  472. *  The LOADSTAR disk magazine has been recently purchased from Softdisk 
  473.    Publishing by LOADSTAR principles Fender Tucker and Julie Mangham.  Now 
  474.    owned by J and F Publishing, a corporation founded by Mr. Tucker and Mrs.
  475.    Mangham, provide the magazine with even more flexibility   Tucker 
  476.    states that now LOADSTAR is "more solvent then ever before".  Existing 
  477.    subscribers will see no difference with this change, as Softdisk and 
  478.    LOADSTAR will continue to maintain a close relationship, with Softdisk 
  479.    continuing to handle subscriptions, in addition to other tasks.  
  480.    
  481.    In related news, J and F Publishing has agreed to fulfill the remainder 
  482.    of the outstading dieHard "Spinner" subscriptions.  Although 
  483.    unfortunate that dieHard left its subscribers out in the cold, it 
  484.    is commendable that these subscriptions will be fulfilled with 
  485.    LOADSTAR issues.  The agreement will provide one issue of LOADSTAR 
  486.    for every two issues of the Spinner, as the Spinner was a single 
  487.    disk, whereas LOADSTAR is double that.  No word has been heard yet on 
  488.    the fate of dieHard paper subscriptions.  All 1200 Spinner 
  489.    subscribers should be receiving information about the 
  490.    subscription fulfillment soon.
  491.  
  492. *  For those people wishing to use the Internet with their Commodore 64, 
  493.    only to find out that the local Internet Service Provider (ISP) only 
  494.    provides Serial Line Internet Protocol (SLIP) service with no shell 
  495.    account service, help is coming.  A prototype Transmissions Control 
  496.    Protocol/Internet Protocol (TCP/IP) protocol stack with SLIP support has 
  497.    been developed by Daniel Dallmann 
  498.    (Daniel.Dallmann@studbox.rus.uni-stuttgart.de) of Germany.  Available now 
  499.    via the Internet (ftp://131.188.190.131:/pub/c64), the package is by no 
  500.    means complete, but does include the basic TCP/IP stack, the SLIP driver, 
  501.    and a rudimentary Telnet application.  
  502.    
  503. *  Another Commodore hardware/software supplier has announced its online
  504.    presence: Performance Peripherals Incorporated.  Maker of the RAMDrive
  505.    and BB units (BBGRAM, BBRTC, and BBGRam), PPI published an online catalog 
  506.    that users can retrieve via the C=Hacking WWW Site 
  507.    (http://www.msen.com/~brain/pub/PPI_catalog.11.95.txt) and the 
  508.    C=Hacking MAILSERV server. (send PPI_catalog.11.95.txt).  In addition to
  509.    importing FLASH8 (the 8MHz accelerator cartridge from Germany), PPI 
  510.    manufactures CommPort, which is a 6551 UART cartridge (ala Swiftlink) 
  511.    which has the basic 6551 functionality with the addition of switch 
  512.    selectable NMI or IRQ interrupt triggering and switch-selectable 
  513.    $de00/$df00 addressing.  
  514.  
  515. *  PPI has one more trick up its sleeve.  PPI will be carrying Novaterm 9.6,
  516.    the newest version of Nick Rossi's oft-used terminal program for the 
  517.    C64.  The blurb follows:
  518.  
  519.       Novaterm 9.6 is a complete terminal emulation program on cartridge for 
  520.       the C64. Novaterm has several features such as 80 column ANSI on a stock 
  521.       C64, and compatibility with CommPort, RAMDrive, BBGRam, and many other 
  522.       hardware devices. Just connect a BBGRam, and Novaterm can use it as a
  523.       "buffer" for storing text or as a "virtual disk" for quickly and easily
  524.       downloading files. Definately the perfect setup for Internet usage. And 
  525.       since Novaterm is in cartridge form, the program loads in seconds, not 
  526.       minutes. Novaterm 9.6 is the latest version programmed by NICK ROSSI. 
  527.       Includes autoboot switch.
  528.  
  529. ============================================================================
  530.  
  531. #(@)trick: Hi Tech Trickery: Sample Dither 
  532.            by George Taylor (yurik@io.org)
  533.  
  534. #(A): Introduction
  535.  
  536. You may know of dithering in graphics.  It is when a limited number of
  537. colors are used to simulate more.  This is done by randomly arranging the
  538. pixels so they blend at a distance, creating an average of the shades.
  539. Here, screen space is being averaged, and more shades are being produced.
  540. In playing samples, time is being averaged, and more bits are being produced.
  541.  
  542. #(A): Dithering Sound
  543.  
  544. Let's say we do the following:
  545.  
  546.                 lda #8
  547.                 sta $d418       This code toggles the low bit of the output.
  548.                 lda #9
  549.                 sta $d418
  550.  
  551. Over an average of time, this is the same as:
  552.  
  553.                 lda #8.5        But we can't really do this.
  554.                 sta $d418
  555.  
  556. This idea can be used to easily do 5 bit sound.  Basically, we take a
  557. 5 bit sample, shift right, then add 0.  If bit 0 was high,
  558. it will increment the 4 bit number.  Then as this adding takes place,
  559. toggling bit 0, it will average out to give half a bit.
  560.  
  561. #(A): Is There a Catch?
  562.  
  563. There is one drawback though.  This toggling can be heard as the high
  564. frequency square wave it resembles.  You must use a high enough sample
  565. rate so this can't be heard.  Also it takes two bit toggles to create the
  566. 5th bit, so you must double the sample rate.  In order to play 8.5, for
  567. example, you must play 8 and then 9, so the 8 and 9 must take half the normal
  568. time, or your sample will play too slow.
  569. One other problem is that there is the possibility of overflow.  In this
  570. case you can use hard clipping on the signal.  In other words, the 5 bit
  571. sample 31 will be played at 16, so instead play 15.
  572.  
  573. This is actually called pulse width modulation.  It is a good example for
  574. illustrating sample dithering.  For example, you can play TRUE 16 bit sound,
  575. even with one bit. To do this, take the 16 bit sample, add a 12 bit random
  576. number, then play the high 4 bits of this result.  Also remember the clipping
  577. problem as mentioned above.
  578.  
  579. @(A): How Is This Like Pulse Width Modulation?
  580.  
  581. The random number range is proportional to the 16 bit sample.  If the 16 bit
  582. number is high, then it is very likely the 0 bit (toggle bit) is high.  It is
  583. the random number which allows the toggle bit to change.  So now we have 16
  584. bit sound with 16db signal to noise ratio.
  585.  
  586. There are some more advanced technical issues to this.  The kind of random
  587. number you choose affects the results.  You need a triangle density function
  588. for perfect linearity (ie., for no distortion).  This is the relationship
  589. of random numbers in the sequence, and does not affect the probability
  590. distribution, which should be equal.  The choice of density function is a
  591. tradeoff between added noise and linearity.  I used pulse density function
  592. in my demo, which is non-filtered random numbers, and it's ok but I can
  593. still hear some noise pumping.
  594.  
  595. #(A): Conclusion
  596.  
  597. Enjoy the ditherdigi!
  598.  
  599. #(A)5bit: Listing One:  5 bit play routine
  600.  
  601. Memory map:
  602. 3:     start page of sample
  603. 4:     end page of sample
  604. 5:     sample period (remmber to play twice normal speed)
  605. fb,fc: pointer to sample
  606.  
  607. start lda 3
  608.       sta $fc
  609.       lda #0
  610.       sta $fb           ; initialize sample pointer
  611.       lda #$b
  612.       sta $d011         ; blank screen for better timing
  613.       sei               ; disable interrupts for better timing
  614. play  lda ($fb),y
  615.       lsr
  616.       sta $d418         ; push sample
  617.       ldx 5
  618. d     dex
  619.       bne d
  620.       pha
  621.       nop
  622.       adc #0
  623.       cmp #$10
  624.       beq s1
  625.       sta $d418
  626.       bpl s
  627. s1    nop
  628.       nop
  629.       nop
  630. s     pla
  631.       ldx 5
  632. d1    dex
  633.       bne d1
  634.       iny
  635.       bne play
  636.       inc fc
  637.       lda fc
  638.       cmp 4
  639.       bne play
  640.       lda #$1b
  641.       sta $d011
  642.       cli
  643. end   rts
  644.  
  645. #(A): References
  646.  
  647. Consult the proceedings of the ACM for further info on digi dithering.
  648.  
  649. ============================================================================
  650.  
  651. #(@)mags: Hacking the Mags
  652.  
  653. Not everything good and/or technical comes from Commodore Hacking, which is
  654. as it should be.  (I still think we have the most, though...)  Thus, let's
  655. spotlight some good and/or technical reading from the other Commodore 
  656. publications.
  657.  
  658. If you know of a magazine that you would like to see summarized here, let 
  659. C=Hacking know about it.  These summaries are only limited by Commodore 
  660. Hacking's inability to purchase subscriptions to all the Commodore 
  661. publications available.  We are very grateful to those publications that send
  662. complimentary copies of their publications for review.
  663.  
  664. #(A): COMMODORE CEE
  665.    Volume 1, Issues 1 and 2 came all packaged as one "mega-issue". This
  666.    particular double issue should be renamed the memory map issue, with 
  667.    I/O and/or memory maps for the VIC, 64, 128, and PET computers.  
  668.    Information on 6522 bugs and on the 6526 CIA chips that was cut from the 
  669.    final compilation of the Commodore 64 Prorammer's Reference Guide is
  670.    of interest to Commodore Haking readers.  Some of the information is
  671.    culled from the Internet: the 64 memory maps, the info on the 6522, and a 
  672.    list of all the CSG produced IC numbers with descriptions.  Of course, these
  673.    files are also available on the Internet, if you have access.  Howver, for 
  674.    those who don't know where to look or for those without access, the 
  675.    information is welcome. Issue 3 has a PCX to GEOPaint converter, much like
  676.    _LOADSTAR_, and Issue 4 will begin a column on PAL to NTSC program 
  677.    conversions.  One thing we'd like to see at Commodore Hacking is a better
  678.    menu program, as the current one is somewhat hard to navigate.
  679.  
  680. #(A): Commodore World
  681.    Issue 10 just arrived at the computer room, with a snazzy front cover.  
  682.    Slick paper aside, the picture of Al Anger's Tower 128 was a masterpiece. 
  683.    Editor Doug Cotton spews about the hype of Windows 95, and the first ads 
  684.    for the Super 64 CPU accelerator are present.  If you're into hardware 
  685.    mods, you can't miss page 4, which shows some other Al Anger hacked 
  686.    Commodore creations.  Jim Butterfield's 4 page 65XX ML reference is 
  687.    useful for the newer programmers, and Doug Cotton's Assembly Line topic of 
  688.    serial routines will help those disk I/O challenged in the crowd.  This 
  689.    issue details the high level routines, while #11 will tackle the low level 
  690.    disk I/O.  Maurice Randall goes over event handling in GEOS, while Al Anger
  691.    details how to disable the internal 1571D in the C128D.  Gaelyne Moranec
  692.    touches on the Internet nitty-gritty of learning UNIX commands and 
  693.    includes a table of UNIX-like commands found in ACE and LUnix.  At the end,
  694.    though, C=Hacking's burning question is:  What hangup does Doug have with 
  695.    those abstract graphics sprinkled throughout the mag?  There's nothing 
  696.    wrong with them, but some look like those psycho-analyst inkblot test 
  697.    cards.   
  698.  
  699. #(A): Driven
  700.    Driven 9 contains a rundown on USENET (written by Jim Brain), which will
  701.    help those Internet "newbies".  For those doing cross development, the
  702.    review of the PC<->C64/C128 networking system called 64NET by Paul Gardner-
  703.    Stephen might help some get object code from the PC to the 64/128.  Eddie
  704.    Bourdon has some info on GEnie, including what Commodore support is
  705.    available.  
  706.  
  707.    Driven 10 presents some useful WWW addresses, while XMikeX and Pegasus
  708.    tackle the issues of apathy and pessimism in the Commodore community.  Both
  709.    make for good reading, but the best (in our opinion) was the pessimism
  710.    piece.  How many times have YOU been laughed out of CompUSA for mentioning
  711.    that modem or SCSI drive was for a Commodore?
  712.  
  713. #(A): LOADSTAR
  714.    Issue 138 just finished loading on the 1581 disk drive, and the disk is
  715.    packed with information.  Fender Tucker goes into much detail on the
  716.    recent changes at LOADSTAR and its new Publishing company, J and F
  717.    Publishing.  Of interest to programmers is the PCX to GEOPaint converter
  718.    program, written by Fender Tucker and Doreen Horne.  Some details on Al
  719.    Angers machines that are shown in Commodore World are related.  Jeff Jones
  720.    presents a simple program pause routine, which fiddles with the NMI 
  721.    interrupt, and gives out source code as well.  The Internet 101 series takes
  722.    a month off from the LOADSTAR letter in #28, but is expected back next
  723.    month.  Lastly, Dave Moorman presents his fractal generator called FRACTAL
  724.    MOUNTAINS.  C=Hacking couldn't get it to work, but we think it's user error.
  725.  
  726. #(A): LOADSTAR 128
  727.    In Issue 29, Fender apologizes for not paying enough attention to the 800
  728.    LOADSTAR 128 subscribers.  Of interest to programmers is the program listing
  729.    pause program on the issue, but the rest is pretty light stuff, not to knock
  730.    LOADSTAR.  Different audiences need different material.
  731.  
  732. #(A): Vision
  733.    
  734.    In Issue 7, Rick Mosdell has an article on graphics formats, updated and
  735.    reproduced in this issue (Reference: gfx).  There is some information from
  736.    USENET reproduced, and a list of FTP sites as posted to USENET is
  737.    also presented.  Not much technical content in here, but C=Hacking was
  738.    impressed with the graphics, music, and stories in the mag.  Besides, 
  739.    everyone needs some time to enjoy the machine. 
  740.  
  741. Other magazines not covered in this rundown include _The Underground_, 
  742. _Gatekeeper_, _Commodore Network_, _64'er_, _Atta Bitar_ (_8 bitter_), as well
  743. as those C=Hacking is simply not aware of.  As soon as we can snag a copy of 
  744. any of these, or get the foreign language ones in English :-), we will give 
  745. you the scoop on them.  
  746.  
  747. ============================================================================
  748.  
  749. #(@)dbldma: Speed up RAMLink transfers with the Double-DMA Technique 
  750.             by Doug Cotton (cmd-doug@genie.com) and Mark Fellows 
  751.  
  752. #(A): Introduction
  753.  
  754. When CMD designed the RAMLink, we tried to make the system as fast as possible,
  755. but costs and complexity prohibited us from duplicating the operation of the 
  756. DMA operation found in the Commodore RAM Expansion Unit (REU),  The 8726 DMA
  757. controller found in the REU is a very complex item that allows the REU to
  758. transfer one byte per 1 MHz CPU clock cycle (1 microsecond).  On the other 
  759. hand, the RAMLink uses the 6510/8502 CPU load and store operations to transfer
  760. memory from the RAMLink memory to main memory.  For the user who uses RL-DOS
  761. and RAMDOS, the difference is not noticeable, because although the RAMLink
  762. transfer is slower, RAMDOS continually pages its code in and out of main 
  763. memory, effectively slowing its effective transfer speed down significantly.  
  764.  
  765. But, what if the programmer isn't using RAMDOS?  Then, the speed of the RAMLink
  766. becomes an issue.  The RAMLink takes about 8 cycles to perform a transfer
  767. of a byte, while the REU does it in 1.  This is significant.  However, if a
  768. user owns both a RAMLink and an REU, there is a way to boost the transfer rate
  769. of the RAMLink via software.  The method is called Double-DMA.  
  770.  
  771. #(A): Double-DMA Description
  772.  
  773. Basically, the process is quite simple.  Since the REU has the ability to
  774. transfe memory at 1 byte/microsecond, you can use the REU DMA to transfer
  775. memory from the RAMLink to main memory.  To understand how we can do this,
  776. remember that the normal RL-DOS transfer routines use the CPU to perform the
  777. memory transfer.  Well, to do that, at least some of the RAMLink RAM must be
  778. mapped into main memory.  To be exact, 256 bytes is mapped in.  So, to 
  779. utilize the Double-DMA technique, the programmer simply makes the 
  780. appropriate 256 bytes of RAMLink memory to be transferred visible in the 
  781. main memory map, uses the REU to transfer that 256 bytes to the REU, and then
  782. uses the REU to transfer the 256 bytes in the REU to its destination in the
  783. main memory map. Thus, the Double-DMA technique will allow the RAMLink to
  784. transfer data at rouyghly 1/2 the speed of the REU, or 3-4 times faster than
  785. using the CPU to perform transfers.
  786.  
  787. #(A): The RAMLink memory map
  788.  
  789. To achieve this transfer speed gain, the programmer must forego RL-DOS
  790. usage and write specialized transfer routines.  To do that, we need to
  791. discuss how the RAMLink maps itself into main memory and detail the various
  792. RAMLink registers needed to make this feat possible:
  793.  
  794. Address Description
  795. ------- -----------
  796. $de00   256 bytes of data (See $dfc0-$dfc3 for more information)
  797. $df7e   write to this location to activate the RAMLink hardware
  798. $df7f   write to this location to deactivate the RAMLink hardware.
  799. $dfa0   lo byte of requested RAMCard memory page
  800. $dfa1   hi byte of requested RAMCard memory page
  801. $dfc0   write to this location to show RL variable RAM at $de00 (default)
  802. $dfc1   write to this location to show RAMCard memory at $de00
  803. $dfc2   write to this location to show the RAM Port device $de00 page at $de00
  804. $dfc0   write to this location to show Pass-Thru Port dev. $de00 page at $de00
  805.  
  806.  
  807. For all locations that have the description "write to this address...", the
  808. program can safely write any byte to those locations, as the RAMLink hardware
  809. simply waits for an access, not any particular byte to be written.
  810.  
  811. #(A): Order of Operations
  812.  
  813. Although the Double-DMA technique relies on use of the REU, it is beyond the
  814. scope of this article to detail how to access the REU RAM under programmatic
  815. control.  For more information on transferring data from the Commodore 128/64
  816. and the 17XX REU, refer to the back of a REU owner's manual.  
  817.  
  818. The following steps will realize the Double-DMA method:
  819.  
  820. Notes:  P = PAGE in RAMCard RAM to be transferred to/from
  821.         A = PAGE of RAM in main memory to be transferred to/from
  822.         X = single page of memory in REU used as temp RAM
  823.  
  824.  
  825.  1)  if computer = 128, set up correct RAM bank
  826.  2)  make I/O visible in main memory
  827.  3)  sei
  828.  4)  sta $df7e - activate RAMLink
  829.  5)  lda #<P
  830.  6)  sta $dfa0
  831.  7)  lda #>P
  832.  8)  sta $dfa1
  833.  9)  sta $dfc1 - make $de00 show PAGE of RAM on RAMCard
  834.  
  835. Now, with the RAMLink hardware enabled in this way, the REU registers are
  836. also visible, so one can do a double DMA transfer at this point.  There
  837. are two choices:
  838.  
  839. Transfer A->P:
  840.  
  841. 10)  set up REU for A->X transfer
  842. 11)  initiate REU DMA transfer
  843. 12)  set up REU for X->$de00 transfer
  844. 13)  initiate REU DMA transfer
  845.  
  846. Transfer P->A
  847.  
  848. 10)  set up REU for X->$de00 transfer
  849. 11)  initiate REU DMA transfer
  850. 12)  set up REU for A->X transfer
  851. 13)  initiate REU DMA transfer
  852.  
  853. Now, to go on:
  854.  
  855. 14)  If more byte need transferrring, A=A+1, P=P+1, goto 5
  856. 15)  sta $dfc1 - restore contents of $de00
  857. 15)  sta $df7f - deactivate RAMLink hardware
  858. 16)  if computer = 128, restore bank
  859. 17)  restore I/O visibility if needed
  860. 18)  cli
  861.  
  862. #(A): Address Translation
  863.  
  864. To effectively use the Double-DMA technique, a programmer will want to
  865. set up a DACC partition in the RAMLink for use as external RAM.  The
  866. programmer will need to determine the start address of the partition with the
  867. RL-DOS G-P command (or its sister command, G-[shift]P)  This command will
  868. return the address of the DACC partition, or will it?
  869.  
  870. The answer is: Maybe.  If a user has inserted an REU into the RAMLink RAM
  871. port and has the Normal/Direct swittch set to Normal, RL-DOS uses REU memory 
  872. as the lowest RAM in the RAMLink memory map. However, when directly accessing 
  873. the RAMLink and bypassing RL-DOS, the REU is not mapped into the RAMLink 
  874. memory map. So, for such a condition, the code that determines the start of 
  875. the DACC partition must SUBTRACT the size of the REU from the address returned
  876. by the G-P command.  It's non-utopian, but the program need only do this once.
  877. However, for such an REU configuration, one must take care to ensure that at 
  878. least 256 bytes of REU RAM is available and not already in use before 
  879. utilizing the Double-DMA technique.
  880.  
  881. #(A): Performance
  882.  
  883. Craig Bruce, who has implemented this technique in his ACE operating system,
  884. provides the following performance figures for different access techniques:
  885.  
  886. Type            Bandwidth   Latency Notes
  887.                 (bytes/sec) (~usec)
  888. -------------   ---------   ------- -----
  889. REU             1,007,641      65.8 REU in Direct mode
  890. REU thru RL     1,007,641      77.8 REU in RAM Port in Normal mode
  891. RAMLink           105,792     199.2 Regular RAMLink access
  892. RL with REU       372,827     319.8 Double-DMA
  893. Internal RAM0     120,181      44.2 Zero-page
  894. Internal RAM1      80,283      56.3 All main memory except zero-page
  895.  
  896. So, using this technique in ACE results in a 3.7x increase in transfer speed.
  897. For some applications, that is well worth the trouble.
  898.  
  899. #(A): Conclusion
  900.  
  901. Obviously, CMD recommends that the RL-DOS be used for most operations, but
  902. we realize that some programmers simply need faster transfer rates.  The
  903. Double-DMA technique should provide the speed needed from the RAMLink. 
  904. Obviously, since this technique bypasses RL-DOS, code using it can
  905. potentially corrupt RAMLink memory if errors occur or if the technique is
  906. improperly used. When using the technique, we recommend extensive testing
  907. using various DACC partitions and different REU configurations to ensure
  908. proper operation.  
  909.  
  910. #(A)ddcode: Double-DMA Code
  911.  
  912. Following is a set of functions that will perform transfers using Double-DMA.
  913. They are copied from the routines used in Craig Bruce's ACE operating system,
  914. Release 14, which incorporates the Double-DMA method.  We thank Craig for
  915. the code below:
  916.  
  917. ; Name:        Double-DMA memory transfer
  918. ; Author:      Craig Bruce
  919. ; Date:        1995-12-4
  920. ; Description: The following routines use the Double-DMA technique to transfer
  921. ;              memory to/from main RAM and the RAMLink.  If no RL is present,
  922. ;              normal CPU transfer methods are utilized.
  923. ;
  924. ; Variables:   [mp] holds the address of RAMCard memory to transfer
  925. ;              ramlinkNearPtr hold the address of main memory to transfer
  926. ;              ramlinkLength is length of data to transfer
  927. ;              ramlinkOpcode = $90: main memory -> RL
  928. ;                            = $91: RL -> main memory 
  929.  
  930. reu = $df00
  931. rlActivate   = $df7e
  932. rlDeactivate = $df7f
  933. rlSram       = $dfc0
  934. rlPageSelect = $dfa0
  935. rlPageActivate = $dfc1
  936. rlPageData   = $de00
  937.  
  938. ramlinkOpcode .buf 1
  939. ramlinkLength .buf 2
  940. ramlinkNearPtr .buf 2
  941. ramlinkMpSave .buf 3
  942. ramlinkZpSave .buf 2
  943.  
  944. ramlinkOp = *  ;( [mp]=farPtr, ramlinkNearPtr, ramlinkLength, ramlinkOpcode )
  945.    lda mp+0
  946.    ldy mp+1
  947.    ldx mp+2
  948.    sta ramlinkMpSave+0
  949.    sty ramlinkMpSave+1
  950.    stx ramlinkMpSave+2
  951.    lda zp+0
  952.    ldy zp+1
  953.    sta ramlinkZpSave+0
  954.    sty ramlinkZpSave+1
  955.    lda ramlinkNearPtr+0
  956.    ldy ramlinkNearPtr+1
  957.    sta zp+0
  958.    sty zp+1
  959.    clc
  960.    lda mp+1
  961.    adc aceRamlinkStart+0
  962.    sta mp+1
  963.    lda mp+2
  964.    adc aceRamlinkStart+1
  965.    sta mp+2
  966. -  lda ramlinkLength+0
  967.    ora ramlinkLength+1
  968.    beq +
  969.    jsr rlTransferChunk
  970.    jmp -
  971. +  lda ramlinkMpSave+0
  972.    ldy ramlinkMpSave+1
  973.    ldx ramlinkMpSave+2
  974.    sta mp+0
  975.    sty mp+1
  976.    stx mp+2
  977.    lda ramlinkZpSave+0
  978.    ldy ramlinkZpSave+1
  979.    sta zp+0
  980.    sty zp+1
  981.    clc
  982.    rts
  983.  
  984.    rlTrSize .buf 1
  985.  
  986.    rlTransferChunk = *  ;( [mp]=rlmem, (zp)=nearmem, rlLength, rlOpcode )
  987.    ;** figure maximum page operation
  988.    lda ramlinkLength+1
  989.    beq +
  990.    lda #0
  991.    ldx mp+0
  992.    beq rlTrDo
  993.    sec
  994.    sbc mp+0
  995.    jmp rlTrDo
  996. +  lda mp+0
  997.    beq +
  998.    lda #0
  999.    sec
  1000.    sbc mp+0
  1001.    cmp ramlinkLength+0
  1002.    bcc rlTrDo
  1003. +  lda ramlinkLength+0
  1004.  
  1005.    ;** do the transfer
  1006.    rlTrDo = *
  1007.    tay
  1008.    sty rlTrSize
  1009.    jsr rlPageOp
  1010.  
  1011.    ;** update the pointers and remaining length
  1012.    clc
  1013.    lda rlTrSize
  1014.    bne +
  1015.    inc mp+1
  1016.    inc zp+1
  1017.    dec ramlinkLength+1
  1018.    rts
  1019. +  adc mp+0
  1020.    sta mp+0
  1021.    bcc +
  1022.    inc mp+1
  1023. +  clc
  1024.    lda zp+0
  1025.    adc rlTrSize
  1026.    sta zp+0
  1027.    bcc +
  1028.    inc zp+1
  1029. +  sec
  1030.    lda ramlinkLength+0
  1031.    sbc rlTrSize
  1032.    sta ramlinkLength+0
  1033.    bcs +
  1034.    dec ramlinkLength+1
  1035. +  rts
  1036.  
  1037.    rlPageOp = *  ;( [mp]=rlmem, (zp)=nearmem, .Y=bytes, ramlinkOpcode )
  1038.    php
  1039.    sei
  1040.    sta rlActivate
  1041.    lda mp+1
  1042.    sta rlPageSelect+0
  1043.    lda mp+2
  1044.    sta rlPageSelect+1
  1045.    sta rlPageActivate
  1046.    lda aceReuRlSpeedPage+3
  1047.    bne rlPageOpReu  ;xxx dependency on aceMemNull==0
  1048.    rlPageOpNonReu = *
  1049.    tya
  1050.    clc
  1051.    adc mp+0
  1052.    tax
  1053.  
  1054.    lda ramlinkOpcode
  1055.    cmp #$91
  1056.    bne rlPageOpWrite
  1057.    dex
  1058.    dey
  1059.    beq +
  1060. -  lda rlPageData,x
  1061.    sta (zp),y
  1062.    dex
  1063.    dey
  1064.    bne -
  1065. +  lda rlPageData,x
  1066.    sta (zp),y
  1067.    jmp rlPageOpContinue
  1068.  
  1069.    rlPageOpWrite = *
  1070.    dex
  1071.    dey
  1072.    beq +
  1073. -  lda (zp),y
  1074.    sta rlPageData,x
  1075.    dex
  1076.    dey
  1077.    bne -
  1078. +  lda (zp),y
  1079.    sta rlPageData,x
  1080.  
  1081.    rlPageOpContinue = *
  1082.    sta rlSram
  1083.    sta rlDeactivate
  1084.    plp
  1085.    rts
  1086.  
  1087.    rlPageOpReu = * ;( [mp]=rlmem, (zp)=nearmem, .Y=bytes, ramlinkOpcode )
  1088.    ;** ramlink hardware already switched in
  1089.    ldx #1
  1090.    tya
  1091.    beq +
  1092.    ldx #0
  1093.    cmp #0  ;xx cut-off value
  1094.    bcc rlPageOpNonReu
  1095. +  ldy ramlinkOpcode
  1096.    cpy #$90
  1097.    beq +
  1098.    ldy #$90            ;rl->reu->intern
  1099.    jsr rlPageOpReuRl
  1100.    ldy #$91
  1101.    jsr rlPageOpReuIntern
  1102.    jmp ++
  1103. +  ldy #$90            ;intern->reu->rl
  1104.    jsr rlPageOpReuIntern
  1105.    ldy #$91
  1106.    jsr rlPageOpReuRl
  1107. +  sta rlSram
  1108.    sta rlDeactivate
  1109.    plp
  1110.    rts
  1111.  
  1112.    rlPageOpReuIntern = *  ;( .AX=bytes, .Y=op )
  1113.    sta reu+7  ;len
  1114.    stx reu+8
  1115.    sty temp1
  1116.    pha
  1117.    lda zp+0
  1118.    ldy zp+1
  1119.    sta reu+2
  1120.    sty reu+3
  1121.    lda aceReuRlSpeedPage+0
  1122.    ldy aceReuRlSpeedPage+1
  1123.    sta reu+4
  1124.    sty reu+5
  1125.    lda aceReuRlSpeedPage+2
  1126.    sta reu+6
  1127. .if computer-64
  1128.    ldy vic+$30
  1129.    lda #0
  1130.    sta vic+$30
  1131. .ife
  1132.    lda temp1
  1133.    sta reu+1
  1134. .if computer-64
  1135.    sty vic+$30
  1136. .ife
  1137.    pla
  1138.    rts
  1139.  
  1140.    rlPageOpReuRl = *  ;( .AX=bytes, .Y=op )
  1141.    sta reu+7  ;len
  1142.    stx reu+8
  1143.    sty temp1
  1144.    pha
  1145.    lda mp+0
  1146.    ldy #>rlPageData
  1147.    sta reu+2
  1148.    sty reu+3
  1149.    lda aceReuRlSpeedPage+0
  1150.    ldy aceReuRlSpeedPage+1
  1151.    sta reu+4
  1152.    sty reu+5
  1153.    lda aceReuRlSpeedPage+2
  1154.    sta reu+6
  1155. .if computer-64
  1156.    ldy vic+$30
  1157.    lda #0
  1158.    sta vic+$30
  1159. .ife
  1160.    lda temp1
  1161.    sta reu+1
  1162. .if computer-64
  1163.    sty vic+$30
  1164. .ife
  1165.    pla
  1166.    rts
  1167.  
  1168. ============================================================================
  1169.  
  1170. #(@)usenet: UseNuggets
  1171.  
  1172. COMP.SYS.CBM:  The breeding ground of programmers and users alike.  Let's
  1173. see what topics are showing up this month:
  1174.  
  1175. #(A): We Want More Power!
  1176.    CMD's announcement of the Super64 CPU accelerator got things stirred up
  1177.    in the newsgroup.  When it was announced that the initial product would run
  1178.    on a C64 or on a C128 in 64 mode only, some angry C128 128 mode users
  1179.    vented all over the place.  Everything from people wondering aloud what
  1180.    extra work the 128 version would require to threats of non-purchase of
  1181.    the unit ensued.  Then, just as the first wave of fighting subsided, the
  1182.    next wave started, programmers worried about RAM transfer speed bottlenecks
  1183.    questioned CMD's decision not to include a DMA device on the unit to
  1184.    speed data transfers.  CMD's response:
  1185.  
  1186.       From: Doug Cotton <cmd-doug@genie.geis.com>
  1187.       Newsgroups: comp.sys.cbm
  1188.       Subject: Re: Power Users!
  1189.       Date: 28 Nov 1995 00:59:26 GMT
  1190.       Organization: Creative Micro Designs, Inc.
  1191.       
  1192.       There were some earlier questions about how fast memory transfers 
  1193.       could be accomplished with the accelerator, and at least one 
  1194.       individual emailed me over the lack of a DMA controller. I obtained 
  1195.       some figures from Mark concerning this. Presently, the DMA transfers
  1196.       using an REU transfers a byte in 1 microsecond. The accelerator can 
  1197.       achieve this same speed when transferring data from either 
  1198.       on-board static RAM, or from expansion memory (slower DRAM) to the 
  1199.       host computer RAM. Transfers internally (from static RAM to static 
  1200.       RAM) will take .35 microseconds per byte (350 nanoseconds). 
  1201.       Transfers from RAMLink RAMCard RAM (direct style) to the host 
  1202.       computer RAM will take about 2 microseconds per byte. The only figures 
  1203.       I don't have yet are for transfers between on-board static RAM 
  1204.       and expansion DRAM, but this will be governed by the speed of the 
  1205.       DRAM itself, and the number of wait-states required. It definately 
  1206.       will be faster than 1 byte per microsecond though. So the only 
  1207.       thing slower than a current DMA operation is transferring to and 
  1208.       from RAMLink RAMCard memory, which is still pretty impressive at 
  1209.       half the speed of present DMA transfers.   
  1210.       
  1211.       Given these speeds, the cost of high-speed DMA controllers ($$$$), and 
  1212.       a real lack of anywhere to put one on the main board, I think 
  1213.       going without a DMA controller is reasonable. If you really want 
  1214.       one, though, there's always the high-speed expansion port, and 
  1215.       a do-it-yourself project.
  1216.       
  1217.       Doug Cotton
  1218.       
  1219.    Notice the tiny "high speed expansion port" mention at the end.  Reports
  1220.    indicate that such a port or ports will definitely appear on the unit,
  1221.    but it is still undetermined whether a single connector or a small 
  1222.    expansion bus will be utilized.  Commodore Hacking recommends the latter,
  1223.    as more options for hardware mods are available.
  1224.  
  1225. #(A): Let's all design the Commodore 64 Laptop!
  1226.  
  1227.    Yes, the dreamers are at it once again.  Starting in late October, the
  1228.    net was abuzz with thoughts on what should be included on a Commodore
  1229.    Laptop. The designs were flying fast and furious, with many different
  1230.    features discussed.  It was agreed that the laptop would need to be
  1231.    a power sipper and have an LCD screen and a keyboard.  However, that
  1232.    was where agreement ended.  Some of following items were bantered about:
  1233.  
  1234.    CPU:
  1235.  
  1236.    o  "really fast" 6510
  1237.    o  65C816S
  1238.  
  1239.    Disk:
  1240.  
  1241.    o  FLASH RAM cards.
  1242.    o  built in hard drive
  1243.    o  low power 1581 or CMD FD2000/4000
  1244.    
  1245.    RAM
  1246.  
  1247.    o  definitely more than 64kB, but disagreement as to how much more.
  1248.    
  1249.    Video
  1250.  
  1251.    o  VIC-II compatibility with more modes.
  1252.    o  VIC-III as found in Commodore 65
  1253.  
  1254.    Sound
  1255.  
  1256.    o  Built in stereo SIDs
  1257.    o  Quad SIDs
  1258.  
  1259.    So, on and on it went.  Some got down to the nitty gritty of planning
  1260.    designs for chips.  Some wanted to put the SIDs into one chip, while 
  1261.    others wanted a SID/VIC/CPU single chip solution.  
  1262.  
  1263.    It's December, and the thread is still going strong, but a few great
  1264.    things have surfaced, which is why you can't just discount this type of
  1265.    dreaming:
  1266.  
  1267.    o  Someone posted the procedure for modifying the C64 to run on
  1268.       battery power.
  1269.  
  1270.    o  A few people started looking into how much money such designing would
  1271.       require.
  1272.  
  1273.    o  Most people who thought disk media should be included agreed that the 
  1274.       CMD FD drive could/should be used.  
  1275.  
  1276.    o  Everyone woke up and noticed that the NMOS CPU process used for the
  1277.       fabbibng of the CBM chips was power hungry and ill-suited to battery
  1278.       operation.
  1279.  
  1280.    C=Hacking encourages users to answer the quetion: My dream Commodore
  1281.    laptop computer would include....  Send you entries to Commodore
  1282.    Hacking (brain@mail.msen.com) with the subject "LAPTOP".  We'll print
  1283.    the best entries next issue.
  1284.  
  1285.    Everyone seems to think that CMD is going to have one in development 
  1286.    before long.  Dunno.  Commodore Hacking has heard rumors of what is going
  1287.    on at CMD, but we haven't heard about the laptop project.  Of course, 
  1288.    we're not SPECIAL or anything.... :-)
  1289.  
  1290. #(A): The Tower of Power
  1291.  
  1292.    It seems Al Anger's (coyote@gil.net) Tower 128 picture on Commodore World's
  1293.    Issue 10 cover got everyone excited.  A couple of people were sending Al
  1294.    email about it, Commodore Hacking asked some questions, and some USENETters
  1295.    were deciding how to do it themselves.  Al states that $2000 would just
  1296.    about cover it, which turned a few enquiring minds away, we're sure.
  1297.    Still, the reasons given for wanting a tower were solid.  Commodore users
  1298.    are getting tired of all the clutter and mess cables, power cords,
  1299.    expansion extenders, Swiftlink cartridges, etc. make in the computer room.
  1300.    C=Hacking notes that at least one manufacturer produces tower 64 systems,
  1301.    but the cost is evidently more than what most folks are willing to fork
  1302.    over (~US$300 - US$550).  So, everyone is waiting for the cost to come 
  1303.    down.... 
  1304.  
  1305. #(A): Dave Letterman, Eat Your Heart Out!
  1306.  
  1307.    The latest thread is the top ten list of games.  Everyone is submitting
  1308.    their 10 most favorite games for the CBM machines.  (Is anyone compiling
  1309.    these?)  Anyway, it turns out this thread has a nice side effect.  People
  1310.    are reminiscing about the old games, and the Commodore users are noting
  1311.    that the new games "just aren't as good".  Here, here!
  1312.  
  1313. So, that wraps up the USENET this time.  We try to keep an eye out for 
  1314. stuff of interest, but drop us a line if you think we might miss an IMPORTANT
  1315. topic...
  1316.  
  1317. ============================================================================
  1318.  
  1319. #(@)toolbox: The Graphics Toolbox: Ellipses
  1320.              by Stephen L. Judd (sjudd@nwu.edu)
  1321.  
  1322.  
  1323. #(A): Introduction
  1324.  
  1325. After a much needed break from Commodore 64 programming, I thought it
  1326. would be nice to construct another algorithm for the 2D graphics toolbox.
  1327. Since we did circles last time, a natural successor would be an algorithm
  1328. to draw eclipses.  We will first review the circle algorithm, and then build
  1329. upon it to draw eclipses.  You may recall that the algorithm had problems
  1330. with small-radius circles.  There is a very easy way to fix this, so we will
  1331. cover that issue as well.
  1332.  
  1333. #(A): Circles
  1334.  
  1335.    Recall that the equation for a circle is
  1336.  
  1337.          x^2 + y^2 = r^2
  1338.  
  1339. After taking differentials of both sides, we find that
  1340.  
  1341.          dy = -x/y dx
  1342.  
  1343. That is, if we take a step of size dx in the x-direction, we in principle
  1344. want to take a step of size dy in the y-direction.  
  1345.  
  1346. Next we start at the top of the circle, so that y=r and x=0.  We
  1347. start increasing x in step sizes of one.  We only care about step sizes
  1348. of one, since our basic unit is now a pixel.  The y-coordinate is going to
  1349. start piling up these dy's, and at some point the integer part of y will 
  1350. increase, and we get a new y-coordinate for the pixel.  The idea, then, is to
  1351. keep adding the dy's together, and once their sum is greater than one, we
  1352. decrease y (remember that y starts at the top of the circle).
  1353.  
  1354. The sneaky way to do this is to treat y as an integer "constant".  Then
  1355. it is very easy to add the dy's together, since they have a common denominator
  1356. equal to y. So really all we need to do is start adding x-coordinates together,
  1357. and once their sum is larger than y, we decrease y and hang on to the
  1358. remaining fractional part of dy.  The algorithm then looks like:
  1359.  
  1360.       y=r
  1361.       x=0
  1362.       a=r
  1363. loop: x=x+1
  1364.       a=a-r
  1365.       if a<=0 then a=a+y:y=y-1
  1366.       plot (x,y)
  1367.       if x<y then loop:
  1368.  
  1369. Now, Chris McBride pointed something out to me.  As you may recall,
  1370. the algorithm breaks down for small r.  Chris said that if a is initially
  1371. set to r/2 instead of r, the algorithm works perfectly.  Why is that?
  1372. Recall that we add dy to itself until it is greater than one.  Wouldn't
  1373. it make more sense to add dy to itself until it is greater than 0.5?
  1374. That would have the effect of rounding things up.  Thus, starting at r/2
  1375. is like adding 0.5 to the fractional part of y -- it is the difference
  1376. between INT(y) and INT(y+0.5).
  1377.  
  1378. Thus, the above line
  1379.    
  1380.    a=r
  1381.  
  1382. should be changed to
  1383.  
  1384.    a=r/2
  1385.  
  1386. for a perfect circle every time.  Thus, this corresponds to adding an LSR
  1387. to the machine code.  Incidentally, this fix appeared in an earlier C=Hacking,
  1388. but it was placed in such a crazy place that you probably never saw it.
  1389.  
  1390. #(A): Ellipses, HO!
  1391.  
  1392. Now we can move on to eclipses.  Since ellipses are simply a
  1393. squashed circle, it seems reasonable that we could modify the above circle
  1394. algorithm.  So, let's get to it!
  1395.  
  1396. Everyone knows the equation of an eclipse:
  1397.  
  1398.    x^2/a^2 + y^2/b^2 = 1
  1399.  
  1400. Upon taking differentials of both sides we have,
  1401.  
  1402.    2*x*dx/a^2 + 2*y*dy/b^2 = 0
  1403.  
  1404. or, equivalently,
  1405.  
  1406.    dy = -b^2/a^2 * x/y * dx
  1407.  
  1408. As you can see, life becomes suddenly becomes more complicated by a factor of
  1409. b^2/a^2.  Furthermore, with an eclipse we only have reflection symmetries
  1410. through the x- and y-axis.  In the circle algorithm we could get away with
  1411. just drawing an eighth of the circle, but now we have to draw a full quarter
  1412. of the eclipse.
  1413.  
  1414. We will start drawing the eclipse at x=0, y=b, so that initially x
  1415. will increase by one at each step, and y will wait a few steps to increase.
  1416. At some point, though, we will want y to increase by one at each step, and
  1417. x to wait a few steps before increasing; in the circle algorithm we just quit
  1418. once we reached this point, but now we are going to need an equation for dx:
  1419.  
  1420.    dx = -a^2/b^2 * y/x * dy
  1421.  
  1422. In the circle algorithm, we used a single variable to count up and
  1423. tell us when it was time to increase y.  Perhaps your intuition suggests
  1424. that we can do an eclipse with _two_ variables; mine said the same thing,
  1425. so that is exactly what we will do.
  1426.  
  1427. First, let us assume we have a way of calculating b^2/a^2:
  1428.  
  1429.    E = b^2/a^2
  1430.  
  1431. I will suggest a way to perform this calculation later.  Let's write out
  1432. the first few terms in the dy summation, starting at x=0, y=b:
  1433.  
  1434.    dy1 + dy2 + ... = -E * (x0 + x1 + x2 + x3 + ...)/y
  1435.                    = -E * (0 + 1 + 2 + 3 + ...)/b
  1436.                    = - (0 + E + 2E + 3E + ...)/b
  1437.  
  1438. So, the basic structure of the algorithm is: add up 0, E, 2E, etc. until
  1439. the sum is larger than y.  At that point, reset the counter, keeping the
  1440. remainder, and decrease y.  This is where the two variables come in:
  1441.  
  1442.    X=X+1
  1443.    T2=T2+E
  1444.    T1=T1+T2
  1445.    IF T1>=Y THEN T1=T1-Y:Y=Y-1
  1446.  
  1447. Do you see how it works?  T2 simply takes on the values 0, E, 2E, 3E, etc.,
  1448. and T1 is the counter.  Furthermore, you can see that once T2 is larger
  1449. than Y, dy will be larger than one at each step.  We need a new algorithm
  1450. to continue the calculation, and it turns out to be quite simple.
  1451.  
  1452. Look at the expression for dx above.  We could calculate a^2/b^2,
  1453. but somehow that goes against the spirit of the calculation so far.  Let's
  1454. instead rewrite dx slightly:
  1455.  
  1456.    dx = - y/(E*x) * dy
  1457.  
  1458. Here we have simply written a^2/b^2 as 1/(b^2/a^2) = 1/E.  But E*x is
  1459. exactly the variable T2 above, so we can continue the calcuation without
  1460. even stopping for breath:
  1461.  
  1462.    Y=Y-1
  1463.    T1=T1+Y
  1464.    IF T1>=T2 THEN T1=T1-T2:X=X+1:T2=T2+E
  1465.  
  1466. (remember that T1 keeps track of the fractional part of y).  So, we now
  1467. have a complete algorithm for drawing an eclipse:
  1468.  
  1469.    0 REM ELLIPSE ATTEMPT #N SLJ 11/3/95
  1470.    10 A=150:B=16:E=B*B/(A*A)
  1471.    20 X=0:Y=B:T1=0:T2=0.5
  1472.    30 GRAPHIC1,1:SLOW:X0=160:Y0=100:DRAW1,X0+A,Y0:DRAW1,X0,Y0-B
  1473.    40 X=X+1:T2=T2+E
  1474.    50 T1=T1+T2
  1475.    60 IF T1>=Y THEN T1=T1-Y:Y=Y-1
  1476.    70 DRAW1,X0+X,Y0-Y
  1477.    80 IF T2<Y THEN 40
  1478.    90 Y=Y-1
  1479.    100 T1=T1+Y
  1480.    110 IF T1>=T2 THEN T1=T1-T2:X=X+1:T2=T2+E
  1481.    120 DRAW1,X0+X,Y0-Y
  1482.    130 IF Y>0 THEN 90
  1483.  
  1484. Lines 40-80 are the top part of the eclipse, and lines 90-130 handle the
  1485. bottom part.  Note that T2 starts at 0.5, to round off the calculation in the
  1486. same spirit as we did in the circle algorithm.
  1487.  
  1488. Naturally, this algorithm has a few limitations.  In line 30 the start
  1489. and end points are plotted, so you can see how close the algorithm really is.
  1490. In my experiments it occasionally missed the endpoint by a pixel or two.  As 
  1491. usual, I was a little too lazy to investigate possible ways to get around this.
  1492. If you require a perfect eclipse, you need to start the calculation at x=0, y=b
  1493. and run it forwards (e.g. lines 40-80 above), and then do another, similar
  1494. calcuation, starting at x=a, y=0, and running backwards.  That is, for the
  1495. second calculation, calculate E2=a^2/b^2, and then run the algorithm just like
  1496. lines 40-80, interchanging X and Y.
  1497.  
  1498. Now we need to translate this algorithm into assembly.  I am going
  1499. to make a few assumptions: first, that everything fits in a byte.  In
  1500. particular, I require that b^2/a < 256.  This insures that b^2/a^2 < 256,
  1501. and also insures that T2 will not overflow (note that when x=a, T2=E*a,
  1502. e.g. T2=b^2/a).  What this means is that eclipses can't be too squashed.
  1503.  
  1504. Next, we need to deal with the fraction E=b^2/a^2.  Any number
  1505. like this consists of two parts, an integer part plus a fractional part
  1506. (e.g. a number and a decimal).  So, let's split E into two parts, EL and EH,
  1507. where EL represents the decimal part and EH the integer.  Now our addition
  1508. consists of adding together the fractional parts, and if there is an overflow,
  1509. increasing the integer part.  For example, if E=1.62, then EH=1 and EL=0.62.
  1510. We add EL to our number, and if it is greater than one, we carry the one to
  1511. when we add EH to our number.
  1512.  
  1513. The best thing to do is to represent EL as a fractional part of 256.
  1514. That is, our EL above should really be 0.62*256.  This way, carries and
  1515. overflows will be handled automatically (this will become clear in a moment).
  1516.  
  1517. Let me give some pseudo-assembly code and we'll push off the
  1518. explanation until later:
  1519.  
  1520.    35 GOTO 200
  1521.    190 REM ***********************
  1522.    200 XM=0:YM=B:X=128:Y=0:EH%=INT(E):EL%=INT((E-EH%)*256+0.5)
  1523.    210 XM=XM+1
  1524.    220 C=0:A=X:A=A+EL%:IF A>255 THEN A=A-256:C=1
  1525.    230 X=A:A=Y:A=A+EH%+C:Y=A
  1526.    235 A=A+T1
  1527.    240 IF A>=YM THEN A=A-YM:YM=YM-1
  1528.    250 T1=A:DRAW1, X0+XM, Y0-YM
  1529.    260 IF Y<=YM THEN 210
  1530.    265 T2=Y:A=T1
  1531.    270 YM=YM-1
  1532.    280 A=A+YM:IF A<T2 THEN 300
  1533.    290 A=A-T2:T1=A:XM=XM+1:A=X:C=0:A=A+EL%:IF A>255 THEN A=A-256:C=1
  1534.    295 X=A:A=T2:A=A+EH%+C:T2=A:A=T1
  1535.    300 DRAW1, X0+XM, Y0-YM
  1536.    310 YM=YM-1:IF YM>=0 THEN 280
  1537.  
  1538. XM and YM are the x and y coordinates of the point to be plotted.  Note
  1539. that in line 200 X starts at 128, and this again is to round up all our
  1540. calculations; compare to line 20, where we started T2 at 0.5.  In the
  1541. above code I store T2 in the X and Y registers for the first part of the
  1542. code.  Note that in lines 220 and 290 there is some extraneous code to
  1543. simulate things that in assembly are taken care of by the 6502.  Note
  1544. also that the comparison in line 260 has been changed from < to <=.  This
  1545. makes the branch easier, and I'm not sure how it affects the calculation
  1546. (I didn't notice any difference in the few runs I tried it on).
  1547.  
  1548. Moving through the code, we increase x, and then add the decimal
  1549. part of E to the counter.  Then we add the integer part of E to the counter,
  1550. along with any carries.  If the integer part of the counter is greater than
  1551. y, it is time to decrease y and reset the counter.
  1552.  
  1553. Moving to the second part of the code, we do a little rearranging
  1554. in line 265.  Really a better thing to do would be to let A=T1-T2, so that
  1555. the compare in line 280 becomes simpler.  Anyways, note that the Y register
  1556. becomes freed up at this point.  From here on, it is pretty much the same
  1557. thing as before.
  1558.  
  1559. The full assembly code is then:
  1560.  
  1561.    ;Ellipse SLJ 11/3/95 Assumptions:
  1562.    ;0->XM B->YM, x- and y-coordinates
  1563.    ;0->T1
  1564.    ;EL and EH contain remainder and integer parts of E, resp.
  1565.  
  1566.    LDX #128
  1567.    LDY #00
  1568.    CLC
  1569. L1 INC XM
  1570.    TXA
  1571.    ADC EL
  1572.    TAX
  1573.    TYA
  1574.    ADC EH
  1575.    TAY
  1576.    ADC T1
  1577.    CMP YM
  1578.    BCC :CONT1
  1579.    SBC YM
  1580.    DEC YM
  1581. :CONT1   STA T1
  1582.    JSR PLOT
  1583.    CPY YM
  1584.    BCC L1
  1585.  
  1586.    STY T2
  1587.    LDA T1
  1588.    SBC T2
  1589.    DEC YM
  1590. L2 ADC YM
  1591.    BCC :CONT2
  1592.    SBC T2
  1593.    STA T1
  1594.    INC XM
  1595.    TXA
  1596.    ADC EL
  1597.    TAX
  1598.    LDA T2
  1599.    ADC EH
  1600.    STA T2
  1601.    LDA T1
  1602. :CONT2  JSR PLOT
  1603.    DEC YM
  1604.    BPL L2      ;Assuming y<128
  1605.  
  1606.  
  1607. #(A): Logarithms
  1608.  
  1609. Finally, we need a way of calculating b^2/a^2.  I suggest using
  1610. logarithms for this.  I do believe I discussed this concept in an earlier
  1611. issue of C=Hacking.  Nevertheless, the idea is that if
  1612.  
  1613.    x = b^2/a^2
  1614.  
  1615. then
  1616.  
  1617.    log(x) = 2*log(b) - 2*log(a)
  1618.  
  1619. so that
  1620.  
  1621.    x = exp(2*(log(b) - log(a))
  1622.  
  1623. Thus, three tables need to be created: one for log(x), and one each for
  1624. the integer and remainder parts of e^(2*x).  Now, to improve accuracy,
  1625. the first table might be a table of f(x)=222/log(128) * log(x/2).  This
  1626. constant is chosen so that f(255) is roughly 255.  222 was chosen because
  1627. the inversion (i.e. the e^x part) works best at that value.  This pretty
  1628. much assumes that x is not zero or one, either.  You can of course use
  1629. more tables for somewhat better accuracy.
  1630.  
  1631. One really nice thing about this is that you don't have to worry
  1632. about squaring things, since that part can be taken care of automatically
  1633. in logarithm space.  On the downside, we are restricted even further by
  1634. the types of numbers we can divide (e.g. log(a)-log(b) can't be larger
  1635. than 127 or so).
  1636.  
  1637. Division then consists of a table lookup, subtraction of another
  1638. table lookup, and two more table lookups.  Here is a short program to
  1639. demonstrate the use of logs in this sort of division, and a very rough
  1640. feel for the type of accuracy to expect -- note that it doesn't compare
  1641. decimal parts, or convert the decimal parts into fractions of 256, etc.:
  1642.  
  1643.    1 FAST:PRINT"[CLR]"
  1644.    10 DIM L(256),EI(256),ER(256):FC=222/LOG(128)
  1645.    20 FOR I=1 TO 256
  1646.    25 PRINT "[HOME]"I
  1647.    30 L(I)= INT(FC*LOG(I/2)+0.5):IF I=1 THEN L(I)=0
  1648.    40 S=I:IF I>127 THEN S=I-256
  1649.    50 EX=EXP(2*S/FC):IF EX>256 THEN PRINT"WHOOPS! EX="EX"I="I
  1650.    60 EI(I)=INT(EX+0.5)
  1651.    70 ER(I)=EX-EI(I)
  1652.    80 NEXT I
  1653.    90 EI(0)=1:ER(0)=0
  1654.    100 FOR A=2 TO 250
  1655.    110 FOR B=2 TO 250
  1656.    120 X=L(B)-L(A)
  1657.    123 IF X>127 THEN PRINT"OOPS:A="A"B="B"X="X
  1658.    126 IF X<0 THEN X=X+256
  1659.    130 A1=EI(X)+ER(X):A2=B*B/(A*A):IF A2>255 THEN B=600
  1660.    135 BL=INT(A2+0.5)-INT(A1+0.5)
  1661.    140 PRINT A;B,A1;A2,"ERR="INT(A2+0.5)-INT(A1+0.5)
  1662.    150 NEXT:NEXT
  1663.  
  1664. #(A): Conclusion
  1665.  
  1666. Sorry, no 3D graphics this time around.  Watch for a full-screen, hires
  1667. bitmapped solid 3D virtual world sometime in the not too distant future.
  1668. Otherwise, may your ellipses never be square :).
  1669.  
  1670.  
  1671. ============================================================================
  1672.  
  1673. #(@)surf: Hack Surfing
  1674.  
  1675. For those who can access that great expanse of area called the World Wide
  1676. Web, here is some new places to visit that are of interest to the Commodore
  1677. community.  In early 1994, when the US Commodore WWW Site started, the number
  1678. of sites online that catered to Commodore numbered in the 10's.  Now, the
  1679. number is in the 100's.  What a change.
  1680.  
  1681. If you know of a site that is not listed here, please feel free to send it
  1682. to the magazine.  The following links have been gleaned from those recently
  1683. changed or added to the US Commodore WWW Site Links page 
  1684. (http://www.msen.com/~brain/cbmlinks.html).  
  1685.  
  1686. To encourage these sites to strive to continually enhance their creations,
  1687. and because we like to gripe :-), we'll point out an improvements that 
  1688. could be made at each site. 
  1689.  
  1690. #(A): Companies
  1691.  
  1692. o  http://www.escom.nl
  1693.    ESCOM Interactive, Inc. The new home of Commodore has links to many of
  1694.    its offices and some general information.  The pages are still under 
  1695.    construction, but you should probably save this address.  C=Hacking gripe:
  1696.    No Commodore 8-bit inforation yet.
  1697.  
  1698. o  http://www.msen.com/~brain/guest/cmd/
  1699.    Creative Micro Designs.  Stay tuned to this site for information on
  1700.    the accelerator, and keep up to date on the latests prices on CMD
  1701.    peripherals and software.  C=Hacking gripe: For a comapny wanting having
  1702.    just announced the Super64CPU, no mention of it is to found anywhere on
  1703.    the WWW site.  Bummer.
  1704.  
  1705. #(A): Publications
  1706.    
  1707. o  http://www.softdisk.com/about/c64.html
  1708.    LOADSTAR and LOADSTAR 128.  If you are interested in LOADSTAR, check 'em
  1709.    out here.  Some Commodore links are included, and the and a few magazine 
  1710.    teasers are present.  In addition, details on how to ordr LOADSTAR or any
  1711.    of its related software titles is provided.  C=Hacking gripe:  the 
  1712.    background color.  Yellow is hard on our eyes...  Oh well.
  1713.    
  1714. o  http://www.mds.mdh.se/~dat95pkn/8bitar/
  1715.    Atta Bitar (8 Bitter) magazine.  Full indexes for the past 3 years, as well
  1716.    as information on how to subscribe.  We'd tell you more, but none of us
  1717.    read German (At least we THINK it's German), and the English transmation 
  1718.    page isn't done yet.  Anyway, if you would like to subscribe or need to 
  1719.    search the index of the magazine, here's the place to go.  
  1720.    C=H gripe: Yes, we know this is English-centric, but we just wish we could
  1721.    actually read all the great info on this site.
  1722.    
  1723. #(A): User's Groups
  1724.  
  1725. o  http://www.cucug.org/
  1726.    Champaign-Urbana Commodore User's Group.  Home of the Universtity of
  1727.    Illinois (the editor's alma mater!)  Meeting dates and time, along with 
  1728.    newsletters and a user group listing are presented.  C=H gripe: No 
  1729.    mention of what local CBM 8-bit users are doing.  This site recently 
  1730.    changed addresses, so change all your links...
  1731.    
  1732. o  http://www.psc.edu/~eberger/pcg/
  1733.    Pittsburgh Commodore Group.  Local news, meeting dates and time, and 
  1734.    some newsletters are present.  This site has also recently relocated
  1735.    to this new address.  C=H gripe: Same as for CUCUG.  We want to know
  1736.    what the CBM 8-bitters are doing in Pittsburgh.
  1737.    
  1738. o  http://www.slonet.org/~rtrissel/
  1739.    The Central Coast Commodore User's Group.  Those in the Santa Maria
  1740.    CA area will be glad to know that CCCUG is there for them.  Past
  1741.    newsletter are available, and some links to other information of 
  1742.    interest is present.  C=H gripe: Meeting dates and times need to be
  1743.    present in some easy place.  C=H plug:  It sounds like this club might
  1744.    need a little help, as it is down on members.  If you are in the Santa
  1745.    Maria area, consider joining...
  1746.  
  1747. #(A): Miscellaneous
  1748.  
  1749. o  http://www.byte.com/art/9408/sec14/art1.htm
  1750.    Byte Magazine's Commodore obituary, by Tom Halfhill.  Tom spells out many
  1751.    of the things that Commodore DID do right in its lifetime, and reflects
  1752.    on the blunders CBM made.  The article makes for very good reading, but 
  1753.    will depress some.  C=H gripe: The pictures in the real article aren't
  1754.    reproduced in the WWW page.
  1755.  
  1756. o  http://stud1.tuwien.ac.at/~e9426444/geoswarp/index.html
  1757.    GEOS Warp 1.0.  For the Mac user who needs or wants to run GEOS, this
  1758.    program, run on a Macintosh, will allow GEOS programs to operate on
  1759.    the Mac.  The system looks very impressive, to the point of us not asking,
  1760.    Why?  C=H gripe:  Not really with the page, but the writer laments that
  1761.    progress is slow owing to no agreement with GEOWorks.  Such things may
  1762.    doom the project to failure.
  1763.  
  1764. o  http://vanbc.wimsey.com/~danf/cbm/
  1765.    Dan Fandrich's WWW Site.  For those who develop on alternate platforms or
  1766.    use multiple programming languages with the C64/128, bookmark this page.  
  1767.    Very current info, and lots of it is presented.  Some defunct Commodore 
  1768.    mags are indexed, and pointers are provided to many of the current crop of 
  1769.    magazines, including this one.  C=H gripe:  the page needs a little bit 
  1770.    more organization to make it easier to get at juicy info.
  1771.  
  1772. o  http://www.aloha.net/~scatt/commodore.htm
  1773.    Scatt's WWW Site. For those just moving into assembly language programming
  1774.    from BASIC or something else, this page has a beginner's tutorial you
  1775.    might find useful.  C=H gripe: A little low on content, but we are glad 
  1776.    what there is is available.
  1777.  
  1778. o  http://www.cs.wm.edu/~pbgonz/progc64.html
  1779.    Pete Gonzalez's WWW Site.  Small page, but worth viewing.  Pete shows some
  1780.    screen shots of a new game he is developing, and offers copies of his 
  1781.    in progress cross assembler for the PC.  C=H gripe: When's the game coming
  1782.    out again? :-)
  1783.  
  1784. o  http://www.ts.umu.se/~yak/cccc/
  1785.    The Commodore Computer Cult Corner.  Some people play games, and then some
  1786.    people PLAY games.  Jonas Hulten has pictures of his game design, 
  1787.    implementation, and programming heoes.  You can read about each one, and
  1788.    even light a "candle" for them.  This site has a CBM links page, which 
  1789.    anyone can add their link to automatically.  C=H gripe: We can add our home
  1790.    page automatically, but not our hero.  
  1791.  
  1792. o  http://www.slonet.org/~jwilbur/
  1793.    John Wilbur's WWW Site.  Basically, just a links page right now, but we'll
  1794.    check back.  C=H gripe: We'd like to see a little more about John as it
  1795.    relates to Commodore.
  1796.  
  1797. o  http://www.student.informatik.th-darmstadt.de/~supermjk/
  1798.    Marc-Jano Knopp's WWW Site.  Mainly a large links page for Commodore
  1799.    information, this site does give a glimpse of the never produced Commodore
  1800.    LCD laptop computer.  C=H gripe:  As above, we love to see a little more
  1801.    about Marc-Jano as it relates to Commodore.
  1802.  
  1803.