home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / Information / CHACKING-12 < prev    next >
Encoding:
Text File  |  2019-04-13  |  191.1 KB  |  4,259 lines

  1. @(#)top:
  2.                    ########
  3.              ##################
  4.          ######            ######
  5.       #####
  6.     #####  ####  ####      ##      #####   ####  ####  ####  ####  ####   #####
  7.   #####    ##    ##      ####    ##   ##   ##  ###     ##    ####  ##   ##   ##
  8.  #####    ########     ##  ##   ##        #####       ##    ## ## ##   ##
  9. #####    ##    ##    ########  ##   ##   ##  ###     ##    ##  ####   ##   ##
  10. #####  ####  ####  ####  ####  #####   ####  ####  ####  ####  ####   ######
  11. #####                                                                     ##
  12.  ######            ######            Issue #12
  13.    ##################               Version 1.1b
  14.        ########                      March 1996
  15.                           
  16. -------------------------------------------------------------------------
  17.  
  18. @(#)contents: Table of Contents
  19.   
  20.  
  21. Features
  22.    6. "Polygonamy": A Study in 3 Dimensions by Stephen Judd
  23.       (Reference: polygon)
  24.         Did you ever feel real time 3 Dimensional graphics was just asking
  25.         too much from a Commodore 64?  Well, ask no more, as Stephen shows
  26.         us just hoiw it can be done.  The 64 steps up to the challenge of
  27.         displaying correctly rendered shaded 3D polygons right before your
  28.         very eyes.
  29.    9. Underneath the Hood of the SuperCPU by Jim Brain
  30.       (Reference: cmdcpu)
  31.         Delve into the technical details of this new accelerator
  32.         under development by CMD.  Jim will explain its advantages 
  33.         over existing offering, epxlain the features it provides, and
  34.         dispel some myths about the unit.
  35.  
  36. Columns
  37.    4. Hi Tech Trickery by Doug Cotton
  38.       (Reference: trick)  
  39.         Trying to switch from 128 mode to 64 mode on a C128 without
  40.         human intervwention is triccky.  Doing it on modified KERNAL ROMs
  41.         is doubly so.  Doug details a routine that will work regardless of
  42.         the ROM in use.  
  43.   12. Hacking Graphics by Harsfalvi Levente
  44.       (Reference: gfx)
  45.         All you Commodore Plus/4 lovers, listen up.  Harsfalve delves into
  46.         the Commodore Plus/4 TED chip, explains its many functions and
  47.         details its various registers.  Do you know all the things the TED
  48.         chip does in addition to handle video.  Now you'll know.
  49.    
  50. Departments
  51.    1. The (cough,cough) Hacking Editor
  52.       (Reference: editor)
  53.    2. Input/Output
  54.       (Reference: io)
  55.    3. Newsfront
  56.       (Reference: news)
  57.    5. Hacking the Mags
  58.       (Reference: mags)
  59.    7. UseNuggets
  60.       (Reference: usenet)
  61.    8. FIDO's Nuggets
  62.       (Reference: fido)
  63.   10. Hack Surfing
  64.       (Reference: surf)
  65.   11. Commodore Trivia
  66.       (Reference: trivia)
  67.   13. ? DS, DS$: rem The Error Channel
  68.       (Reference: error)
  69.   14. The Next Hack
  70.       (Reference: next)
  71.   15. Hacking the Code
  72.       (Reference: code)
  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 publications 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=hacking12.txt 
  129. quit
  130.  
  131. To retrieve a PKZIP 1.01 archive of the individual articles in Commodore
  132. Hacking, request the file c=hacking12.zip
  133.  
  134. To subscribe to the Commodore Hacking and receive new issues as 
  135. they are published, add the following command to you MAILSERV message 
  136. prior to the quit command:
  137.  
  138. subscribe c=hacking Firstname Lastname msglen
  139.  
  140. (msglen is largest size of email message in line you can receive.  Each
  141. line is roughly 50 characters, so 600 lines is about 30000 bytes.  When
  142. in doubt, choose 600)
  143.  
  144. example:
  145.  
  146. subscribe c=hacking Jim Brain 600
  147.  
  148. Although no fee is charged for this magazine, donations are gladly accepted 
  149. from corporate and individual concerns.  All monies will be used to defray 
  150. any administrative costs, subscribe to publications for review, and 
  151. compensate the individual authors contributing to this issue.
  152.  
  153. Any persons wishing to author articles for inclusion in Commodore Hacking are 
  154. encouraged to view the submission guidelines on the WWW
  155. (http://www.msen.com/~brain/pub/c-hacking-submit.txt) or via the MAILSERV 
  156. server (send c-hacking-submit.txt).  
  157.  
  158. =========================================================================
  159.  
  160. @(#)rch: Reading C=Hacking
  161.   
  162. Starting with Issue 11 of Commodore Hacking, the new QuickFind indexing 
  163. system is utilized to aid readers of the text version in navigating the
  164. magazine.  At the top  of each article or other important place in the
  165. magazine, a word prefixed with a special string is present.  (See the
  166. title of this article for an example.  Throughout the magazine, if an
  167. article is mentioned, it will be followed by a reference string.  For
  168. example, if we mentioned this article, we would add (Reference: rch) after
  169. the name.  By using your favorite editor's search function and searching
  170. for the string after the word "Reference:", prefixed by the magic prefix
  171. string, will move you directly to the article of choice.  To merely skip to
  172. the next article in the magazine, search only for the magic prefix string.
  173.  
  174. Some handy indexing strings possibly not referenced anywhere are:
  175.  
  176. top      top of issue
  177. bottom   bottom of issue
  178. contents table of contents
  179. legal    legal notice
  180.  
  181. For those with access to a UNIX system, the command "what" can be
  182. run on the issue, which will result in all the article titles being
  183. printed.
  184.  
  185. A slightly different magic prefix string "@(A)" is used to delimit
  186. sub-topics or main heading in articles.  The text after the magic string
  187. differs depending on article content.  For the Input/Output column
  188. (Reference: io), the text after the magic prefix will either be "c" for 
  189. comment, or "r" for response.  In features and columns, a number after
  190. the prefix indicates the ordinal of that heading or sub-topic in the
  191. article.  If a specific sub-topic is referenced elsewhere in the article,
  192. a sub-topic reference will be indicated.  A reference to "@(A)r" would
  193. be written as "(SubRef: r)".
  194.  
  195. As time goes on, the role of this indexing system will be expanded and
  196. changed to ease navigation of the text version, but minimize the clutter
  197. added by these extra items.
  198.  
  199. =========================================================================
  200.  
  201. @(#)editor: The Hacking Editor
  202.             by Jim Brain (brain@mail.msen.com)
  203.  
  204. Speed and the Web.  The owners are asking about it.  The developers are
  205. looking into it.  The market is readying itself for it.  No, not the PC
  206. market, I'm referring to the Commodore 8-bit market.  The same market 
  207. usually referred to as "mature".  The same market usually referred to with
  208. a condescending tone.  Well, mature we might be, but isn't that considered
  209. a good thing? People are supposed to mature as they grow older.  As such,
  210. they are revered and looked up to.  What parallels can we draw here?
  211.  
  212. If you haven't anything about the planned introduction of the CMD SuperCPU
  213. 20 MHz accelerator cartridges for the C64 and C128, shame on you!  You
  214. need to stay in touch more.  For those who have, let's not overdo the
  215. hype.  CMD isn't the first to produce such a cartridge, but they will be
  216. the first to introduce 20 MHz as a speed option.  C128 users will rejoice
  217. as the first 128 mode accelerator ships from CMD.  When this happens, 
  218. performance approaching that of the venerable Intel 80386 will be as 
  219. close as the on/off switch.  
  220.  
  221. The explosion of interest in the Internet and the World Wide Web is
  222. changing the way people view computers.  Until recently, it seemed that
  223. people thought only computer systems including a 32 or 64 bit CPU,
  224. multiple megabytes of RAM, gigabyte hard drives, infinite resolution 
  225. monitors and million bit sound cards were worth owning.  Commodore
  226. owners have felt the sting of ridicule as they continually take blow
  227. after blow for remaining loyal to a machine with much to offer.  Well,
  228. be patient, because 1996 might be the year of the "network computer", a
  229. smaller comuter system that trades all the fancy features of bloated PCs
  230. for a smaller size, cost, and a connection to the Internet.  Big names
  231. like IBM, Oracle and Apple are pushing this idea, which would bring to
  232. market systems with modest RAM, small drives, television displays, and
  233. small operating systems.  Does this idea sound familiar?  It should, as
  234. it describes many features of Commodore 8-bit systems.  No, the CBM
  235. 8-bit still lacks a few items present in the IBM/Apple/Oracle designs,
  236. but the bulk of features are already available on your so called 
  237. "obsolete" CBM machine.  Don't gloat yet, as there's much to do, but
  238. if your friends tout the benefits of such a machine, gently remind them
  239. that you own of of the first and best, a Commodore 8-bit.
  240.  
  241. Enjoy YOUR magazine,
  242.  
  243. Jim Brain (brain@mail.msen.com)
  244. editor
  245.  
  246. ============================================================================
  247.  
  248. @(#)io: Input/Ouput
  249.  
  250. Obviously, Commodore Hacking depends on the comments and article submissions
  251. from the Commodore community to flourish.  Everyone sees the articles, but
  252. let's not forget those comments.  They are very helpful, and every attempt
  253. is made to address concerns in them.  Address any comments, concerns, or
  254. suggestions to:
  255.  
  256. Commodore Hacking
  257. 602 N. Lemen
  258. Fenton, MI  48430
  259. brain@mail.msen.com (Internet)
  260.  
  261. @(A)c: Time Travellin'
  262.  
  263. From: Robin Harbron <rfharbro@flash.lakeheadu.ca>
  264.  
  265. Dear C=Hacking,
  266. I was looking at the Commodore Hacking page (fantastic magazine) and 
  267. noticed that the "Publishing Schedule for 95-96" has 1995 for all the 
  268. dates, while I assume that the last 4,5,or 6 probably should be 1996.  
  269. Thanks for everything!
  270.  
  271. Robin
  272.  
  273. @(A)r:
  274. Yep, we must have just returned from our time travel experiments when we
  275. wrote that in the WWW pages.  Note that the magazine was correct, but the
  276. home was in error.  Oh well.  
  277.   
  278. @(A)c: Run (Down) the Software
  279.  
  280. From: sis319@educ.di.unito.it 
  281.  
  282. Dear C=Hacking,
  283. I really appreciate the work you are doing with the Commodore Hacking 
  284. on-line magazine. I like the new look and the new features you added, such 
  285. as newsfront and hacking the mags.
  286.  
  287. I would like to see on the magazine some reviews about the latest and more
  288. interesting PD and Shareware software (with a list of FTP sites where these 
  289. are available) and hardware products.
  290.  
  291. Please note that Commodore Hacking is the only Commodore magazine I can 
  292. easily find here in Italy, because all the Italian magazine there were are
  293. dead and all the foreign magazines that were distributed, such as "RUN", 
  294. "Compute!'s Gazette", "64'er" are either dead or no longer distributed.
  295.  
  296. @(A)r:
  297. We appreciate your comments about the new look of C=Hacking.  As for the
  298. inclusion of reviews, we're looking into it.  it's not that we don't want
  299. to do it, just that we need to schedule the reviews (Commodore Hacking
  300. shouldn't do all of them, as that creates bias), and determining what
  301. software is worthy of review.  Look for some reviews in upcoming issues.
  302.  
  303. @(A)c: Separate But Equal
  304.        
  305. From: alan.jones@qcs.org (Alan Jones)
  306.  
  307. Dear C=Hacking,
  308. I like your new version of C=Hacking.  I like the idea of including 
  309. relevant news and summaries of other magazines and disks.  Size should not 
  310. be a constraint, although you should publish early when it exceeds some 
  311. critical size.  Don't scrimp on source code listings and uuencoded files!  
  312. There is no other publication for this sort of bulky technical stuff.  
  313. It would also be wonderfull if we could get an apropriate means for 
  314. including diagrams or pictures, viewable by C64/128 users.  I would REALLY 
  315. like to have the C64/128 html viewer/printer that you mentioned.  You may 
  316. not know it but we came very close to having Al Angers Tower article 
  317. submitted to C=Hacking in place of _Commodore World_, but C=Hacking could 
  318. not really handle drawings and photos.           
  319.  
  320. I have been separating C=Hacking into separate articles and files, archiving 
  321. them and placing the archive(s) on a local BBS.  This compacts the length 
  322. and makes it easier to read and use.  I try to make C=Hacking easy to 
  323. download and use locally, but I still want to keep it as whole and original 
  324. as possible.  
  325.  
  326. @(A)r:
  327. Alan, we're glad you approve of the new format.  We're going to try to keep
  328. the size so that it will always fit onto 2 1541 disk sides.  C=Hacking
  329. is still working on the HTML viewer, but it's taking a back seat to other
  330. more pressing issues.  We'll have it finished at some point, and start 
  331. distributing the magazine that way as well.   As for your separation, we
  332. appreciate the work you've done to make C=Hacking easier to distribute.  
  333. With issue #12, we are offering an archive of all the article in separate
  334. files.  The archival method has not been chosen just yet, but look on the
  335. C=Hacking MAILSERV server for the file.  
  336.  
  337. Late news: check Commodore Hacking Information (Reference: info) for 
  338. more information of retrieving an archive of the individual articles.
  339.  
  340. @(A)c: Enquiring Minds Wanna Know!
  341.        
  342. From: Peter Hofman <HOFMAN%NLEV00@btmv56.se.bel.alcatel.be>
  343.  
  344. Dear C=Hacking
  345. I would like to make a suggestion for your "Commodore Hacking E-Zine" page. 
  346. Maybe you could add a link to a page with some info about the next issue of 
  347. Commodore Hacking, so people know what will be in the next issue. The reason
  348. why I make this suggestion is that I read the other issues, and I am very
  349. curious, what will be published.
  350.  
  351. @(A)r:
  352. Good suggestion.  So good, in fact, that we implemented it.  Mind you, we
  353. can't completely predict the future, so the information in the link may
  354. not exactly reflect the contents of the issue when it is published, but
  355. we'll try to keep the two in sync.
  356.  
  357. @(A)c: Pulling It Out of the Closet
  358.        
  359. From: bloodbane@rlion.com (Jeffrey S Cotterman)
  360.  
  361. Dear C=Hacking,
  362. Well, I was just writing to say I think you did a great job on C=
  363. Hacking... I am throughly amazed by the support and the interest in
  364. the Commodores.  I have a Vic-20, C-64, C-128, and an Amiga 1000.
  365. I have not used any of them in a long time, I have two Beamers that I
  366. use more. However seeing all this stuff makes me want to turn them back
  367. on.  (Actually I use the 64 quite a bit for playing games, plus the
  368. 1702 monitor works great with a Super Nintendo!)  I used to be quite
  369. proficient at the 64, but it is slipping.  I will try to get my butt
  370. back in gear so maybe I can post an article or two.... Geesh, and just
  371. last year I got rid of all my Run and Compute's Gazette magazines....
  372. Oh well I will look through the cobwebs and see what I can come up
  373. with.   Anyway, congrats on the mag, I think it's going great.
  374.  
  375. @(A)r:
  376. We appreciate the thanks.  And, if we can get one person to pull a C64
  377. or other CBM machines out of the closet and turn it back on through what we
  378. do, it is worth it.
  379.  
  380. @(A)c: C=Hacking Flunked Geography
  381.        
  382. From: Peter Karlsson <dat95pkn@idt.mdh.se>
  383.  
  384. Dear C=Hacking,
  385. I saw your mention of Atta Bitar in Commodore Hacking.
  386.  
  387. German? Heheheh... :-)
  388.  
  389. Anyway, the English information page is available now, but not much will=20
  390. be in English (sorry). It is a Swedish paper :)
  391.  
  392. From: Erik Paulsson <ep@algonet.se>
  393.  
  394. Dear C=Hacking,
  395. I'm the editor of the Swedish mag Atta Bitar (8 bitter), so I thought I 
  396. should drop you a line.       
  397.  
  398. I really like the "new" C= Hacking it's really great, keep up the good work!
  399.  
  400. One small comment regarding Atta Bitar, it's not in German, it's in swedish.
  401. I just thought you should know...       
  402.  
  403. @(A)r:
  404. Picky, picky, picky.  It's not like we would react that way if you said
  405. Commodore Hacking came from CANADA.  Wait, hold it.... I guess we would.
  406. Correction made.  Thanks for the update, and if we ever learn Swedish, we'll
  407. try to read it again.  (Anyone want to translate for us?)
  408.  
  409. =========================================================================
  410.  
  411. @(#)news: Newsfront
  412.  
  413. *  Matthew Desmond, the author of Desterm, has recently resurfaced and
  414.    states that he is once again working on something.  Although Commodore
  415.    Hacking discourages hourds from emailing him to ask about Desterm
  416.    progress, Matt's email address is mdesmond@ionline.net, for those
  417.    who wish to register Desterm or express their support.  
  418.  
  419. *  Speaking of email addresses, LOADSTAR will be changing theirs.  As
  420.    the online service GEnie has recently been purchased and new fares
  421.    have been put in place, LOADSTAR finds its monthly bill rising too 
  422.    high for pleasure.  As of March, 1996, the Internet address for
  423.    LOADSTAR will be loadstar@softdisk.com.
  424.  
  425. *  While we're on the subject of email addresses, CMD has expanded their
  426.    set of Internet email address contacts in order to better support its
  427.    online users.  The following addresses are now valid:
  428.    
  429.    Email Address             Usage
  430.    
  431.    cmd.sales@the-spa.com     Questions relating to product prices, 
  432.                              catalog requests, ordering onformation,
  433.  
  434.    cmd.support@the-spa.com   Technical questions concerning CMD products.
  435.  
  436.    cmd.cw@the-spa.com        Questions or comments relating to Commodore
  437.                              World magazine.
  438.  
  439.    doug.cotton@the-spa.com   superceded the cmd-doug@genie.geis.com address
  440.                              previously used for all CMD inquires.  Should
  441.                              be used items not applicable to the above 
  442.                              addresses
  443.                              
  444.    cmd.cac@the-spa.com       Direct link to Charles A. Christianson, VP of
  445.                              Sales and Marketing.  Again, shuld be used for
  446.                              items not applicable to above email addresses.
  447.  
  448. *  We're not done yet, as COMMODORE CEE has recently moved its office and
  449.    is now at:
  450.    
  451.    
  452.       COMMODORE CEE
  453.       5443 College Oak Drive #26
  454.       Sacramento, CA 95841
  455.       Jack Vanderwhite@cee-64.wmeonlin.sacbbx.com (Contact)
  456.       ceejack@crl.com (Contact)
  457.       Jack Vanderwhite, editor.
  458.       Fidonet: 1:203/999
  459.       (916) 339-3403 (Bulletin Board System)
  460.  
  461. *  The Commodore Zone.  No, it's not an alternate universe, but a magazine
  462.    for the Commodore gamer and/or demo fan.  Each issue's 40 pages is full
  463.    of reviews, interviews with top programmers, and an exclusive comic
  464.    strip done by Alf Yngve.  Accompanying each issue is a 5.25" disk or
  465.    tape containing game demos, demos, and full games.  Free software is
  466.    often included.
  467.    
  468.    More information can be obtained through:
  469.    
  470.       Commodore Zone
  471.       34 Portland Road
  472.       Droitwich
  473.       Worcestershire
  474.       WR9 7QW
  475.       England
  476.                  
  477.    Copies are available for UK3.00.  Make checks payable to Binary
  478.    Zone PD.
  479.       
  480. *  Also in the magazine front, Computer Workshops, Inc. is planning a
  481.    World Wide Web magazine to feature gaming.  The blurb follows:
  482.    
  483.       CWI is working on a new Web magazine to feature the newest and
  484.       hottest in c64/128 Gaming. But, before we can do that, we need 
  485.       your help. Send us what you're working on, or, if you're a 
  486.       programmer with something for review, send us that too! Also,
  487.       if you've got a product you'd like to advertise, we'd like to
  488.       hear that too (a la Yahoo).
  489.  
  490.       Send it to either, or both:
  491.  
  492.          spectre@deepthought.armory.com
  493.  
  494.          Computer Workshops/Cameron Kaiser
  495.          ATTN: Commodore Gamer
  496.          3612 Birdie Drive
  497.          La Mesa, CA 91941-8044
  498.  
  499.       (Please don't send binaries to the spectre@ address.)
  500.       
  501.       Thanks for your support, and barring any unforseen difficulties,
  502.       Commodore Gamer should be ready to premiere in about two months.
  503.  
  504.       Cameron Kaiser
  505.  
  506. *  The December 10, 1995 edition of the Waco Tribune Herald put one of our
  507.    own in the spotlight.  The headline read "'Antique' PCs have loyal 
  508.    fans here, elsewhere." and was written by Sherry W. Evans,  
  509.    Tribune-Herald staff writer.  The Commodore user taking the spotlight 
  510.    was Karen Allison, known on the FIDO network.  Sharing the spotlight
  511.    with Karen was Brad Jackson, of Commodore Country, who said that
  512.    a C64 was raced against an Intel 386 using identical programs, and 
  513.    the 64 won.  Allison claims in the article that "the challenge is finding
  514.    creative ways to solve problems since Commies have had no ... support..."
  515.    Allison indirectly mentioned GeoFAX, the GEOS Fax program, and a low
  516.    cost Tax program she uses to pay the IRS every year.  Allison, a diehard
  517.    "Commie", explained in the article that "(People who use IBMs) all
  518.    think my Commodore can't do much and is just a toy.  But for a toy,
  519.    this computer does pretty good."
  520.  
  521. *  For those good with an assembler and the VIC/SID registers, Driven 
  522.    Magazine is sponsoring a 4K Demo competition.  The deadline is July
  523.    1st 1996.  Although the program must run on an NTSC 64, PAL programmers
  524.    are encouraged to enter.  The entries will be released as a group at the
  525.    close of the contest, and entrants can re-use their entries.  The
  526.    complete rules follow:
  527.    
  528.                       4k Demo Contest Rules
  529.  
  530.    - 1 file only (no secondary loading)
  531.    - max file size is $1000 bytes
  532.    - must be started with BASIC 'run'
  533.    - 1 demo per coder; multiple entries per group are allowed.
  534.      Multiple coders can collaborate on a single demo, so long
  535.      as there remains only 1 demo per coder.
  536.    - credits for all parts of an entry must be given at time of entry;
  537.      if a particular credit is unknown, mark it as "unknown"
  538.    - demos will be evaluated on NTSC c64.
  539.    
  540.    Anything not specifically denied above is allowed; e.g. packing + 
  541.    crunching, use or non-use of music or graphics, entries by PAL 
  542.    sceners, etc.
  543.              
  544.    Deadline = July 1.
  545.    
  546.    Entries need to go to coolhand:
  547.    
  548.       coolhand@kaiwan.com
  549.    
  550.    or postal mail to:
  551.    
  552.       Bill Lueck
  553.       17411 Mayor Lane
  554.       Huntington Beach, California, 92647
  555.       USA
  556.    
  557.    Evaluators will be selected shortly, but will include Coolhand and 2-3
  558.    other non-demomaking NTSC demo enthusiasts.
  559.    
  560.    There will be categories for evaluation, but there will not be separate
  561.    winners - the scores from the categories will be added together.  The
  562.    categories will be announced after the evaluation team is established,
  563.    but they will include design, originality, technical difficulty,
  564.    artistic impact, and best overall impact, etc (all tentative at this
  565.    time).
  566.    
  567. *  Bo Zimmerman has put his Commodore 128 on the net.  No, he didn't
  568.    log into some Internet service from his 128, he actually PUT it on
  569.    the 'Net.  Running the BBS program called "Zelch", the machine can be
  570.    accessed by telntting to 147.26.162.107 and giving "zelch" as the
  571.    login.  Bo warns that the system is running off a single 1571 at 2400
  572.    bps, so don't hog the system, OK.  
  573.    
  574.    For the technical types, the 128 is connected to the serial port
  575.    of a Linux PC hooked up the Internet.  Nonetheless, we're getting 
  576.    closer to the standalone CBM Internet server.
  577.  
  578. *  In the March 1996 issue of _Next Generation_ magazine, on pages 31 
  579.    and 32, NG published a very unflattering definition of the Commodore
  580.    64 as part of their: "The Next Generation 1996 Lexicon A to Z:
  581.    A definitive guide to gaming terminology".  Among other things, the
  582.    definition's writer confused the Apple II with the Commodore 64 and
  583.    stated that the C64 could not display lowercase, a common problem
  584.    on early Apples.  The writer was biased in favor of the Apple II line,
  585.    but evidently had never used a C64 or never owned an early Apple II.
  586.    In either case, the fervor caused by the definition sparked an outrage
  587.    in the USENET newsgroup comp.sys.cbm.  See UseNuggets (Reference: usenet)
  588.    for the scoop.
  589.    
  590.    If you would like to write to _Next Generation_, even though the
  591.    article claimed no comments would be heard on the subject, or to
  592.    request a copy of the article, their address is:
  593.    
  594.    Editorial:
  595.    
  596.       Email:   ngonline@imagine-inc.com
  597.       Fax:     (415) 696-1678
  598.       Phone:   (415) 696-1688
  599.       
  600.    Subscriptions:
  601.    
  602.       Email:   ngsubs@aol.com
  603.       Phone:   (415) 696-1661
  604.  
  605.    Post Office Mail:
  606.    
  607.       Next Generation
  608.       Imagine Publishing, Inc.
  609.       1350 Old Bayshore Highway, Suite 210
  610.       Burlingame, CA 94010
  611.  
  612. =========================================================================
  613.  
  614. @(#): trick: RUN64: Moving to 64 Mode
  615.              by Doug Cotton (doug.cotton@the-spa.com)
  616.              
  617. Reprinted with permission. Copyright (c) 1996 Creative Micro Designs, Inc.
  618.  
  619. Various routines have been used over the years to allow programs to move
  620. from 128 mode to 64 mode without user intervention. With the advent of
  621. modified Kernal ROMs (JiffyDOS, RAMLink, and others) many of the methods
  622. that work on stock machines have either failed to do the job completely,
  623. and in some cases fail all together.
  624.  
  625. RUN64 is the answer to those users looking to worm their way into
  626. 64 mode without having to be concerned with the different Kernal ROMs. The
  627. program is presented here in two ways: as a BASIC program that will move to
  628. 64 mode and load the program you request, and as assembly language source
  629. for ML programmers.
  630.  
  631. BASIC Notes: The BASIC version uses the ML code produced by the
  632. assembly language source. This is found in the data statements beginning at
  633. line 660. When you run it, the program will ask for the file name, device
  634. number, and file load type (BASIC or ML). The first two parameters should
  635. be self-explanatory, but the load type may confuse you. If the file you're
  636. loading is itself a small loader (1, 2 or 3 blocks) then it will almost
  637. always be an ML program. Likewise, if you usually load the file with a
  638. ",8,1" at the end of the load statement, it's ML. If you're loading a
  639. larger file, or a file that you normally load with just a ",8", then use
  640. the BASIC option.
  641.  
  642. Also, if you remove the REM instructions from lines 150 through 180
  643. the program becomes a dedicated loader. Just specify the file name and
  644. other options within those lines.
  645.  
  646. @(A): How The Routine Works
  647.  
  648. RUN64 performs its trick by masquerading as a cartridge.  When started,
  649. the code copies the payload routines into $8000, with the special header 
  650. that signifies a cartridge is present.  It then resets the system.  The
  651. system initializes and checks for a cartridge.  When it finds the payload
  652. routines, it executes them just like it would any cartridge.  The
  653. pseudo-cartridge routines then switch out BASIC, call the remainder of
  654. the KERNAL init routines, switch BASIC in, call some BASIC init routines,
  655. set the "load" and "run" lines on screen, dump some "returns" into the
  656. keyboard buffer, and finally jump into the BASIC interpreter.
  657.  
  658. @(A): Assembly Language Notes: 
  659.  
  660. The source code is pretty well documented, and ML programmers should have 
  661. little trouble figuring out what everything does. Take note of the Buddy 
  662. Assembler .off pseudo-op used a few lines below the code label. This 
  663. adjusts all fixed references within the code that follows it to execute 
  664. properly at $8000.
  665.  
  666. The code uses some indirect vectors (ibv, ibr and ibm) to overcome not
  667. having an indirect jsr opcode, and switches out BASIC ROM temporarily since
  668. the KERNAL finishes intializing by indirectly jumping through the address
  669. at $a000.  Since the target application hasn't been loaded yet, the code
  670. must put its own address at $a000 to regain control.
  671.  
  672. To use the routine, just set up a file name at filename, put a
  673. device number in $ba, set the load type in sa1flag, then execute the
  674. routine.
  675.  
  676.  
  677.    100 rem run64.bas (c) 1996 creative micro designs, inc.
  678.    110 :
  679.    120 print "{CLEAR/HOME}run64"
  680.    130 print
  681.    140 :
  682.    150 rem f$="filename" : rem filename
  683.    160 rem dv=peek(186)  : rem device number (8, 9, 10, etc.)
  684.    170 rem l$="a"        : rem load type (a=basic, b=ml [,1])
  685.    180 rem goto 310
  686.    190 :
  687.    200 input "filename";f$
  688.    210 input "{2 SPACES}device";dv$ : if dv$="" then 230
  689.    220 poke 186,val(dv$)
  690.    230 dv = peek(186)
  691.    240 print
  692.    250 print "select a or b"
  693.    260 print "{2 SPACES}a.
  694.    load";chr$(34);f$;chr$(34);",";right$(str$(dv),len(str$(dv))-1)
  695.    270 print "{2 SPACES}b.
  696.    load";chr$(34);f$;chr$(34);",";right$(str$(dv),len(str$(dv))-1);",1"
  697.    280 get l$ : if l$<>"a" and l$<>"b" then goto 280
  698.    290 print
  699.    300 print l$;" selected"
  700.    310 print
  701.    320 print "going to 64 mode!"
  702.    330 :
  703.    340 : rem poke in main ml
  704.    350 :
  705.    360 i = 6144
  706.    370 read d
  707.    380 if d = -1 then 450
  708.    390 poke i,d
  709.    400 i = i + 1
  710.    410 goto 370
  711.    420 :
  712.    430 : rem poke in filename
  713.    440 :
  714.    450 for i = 0 to len(f$)-1
  715.    460 : poke 6356+i, asc(mid$(f$,i+1,1))
  716.    470 next i
  717.    480 poke 6356+i,0
  718.    490 :
  719.    500 : rem poke in device number
  720.    510 :
  721.    520 if dv$="" then 570
  722.    530 poke 186,val(dv$)
  723.    540 :
  724.    550 : rem check load type
  725.    560 :
  726.    570 poke 6324,0
  727.    580 if l$="b" then poke 6324,1
  728.    590 :
  729.    600 : rem sys to ml
  730.    610 :
  731.    620 sys6144
  732.    630 :
  733.    640 : rem ml data
  734.    650 :
  735.    660 data 32,115,239,160,0,185,22,24
  736.    670 data 153,0,128,200,208,247,165,186
  737.    680 data 141,157,128,76,77,255,9,128
  738.    690 data 9,128,195,194,205,56,48,169
  739.    700 data 0,141,4,128,120,169,0,141
  740.    710 data 22,208,32,132,255,32,135,255
  741.    720 data 169,230,133,1,169,43,141,0
  742.    730 data 160,169,128,141,1,160,76,248
  743.    740 data 252,169,231,133,1,32,148,128
  744.    750 data 32,151,128,32,154,128,162,0
  745.    760 data 189,159,128,240,6,32,210,255
  746.    770 data 232,208,245,162,0,189,190,128
  747.    780 data 240,6,32,210,255,232,208,245
  748.    790 data 162,0,189,180,128,240,6,32
  749.    800 data 210,255,232,208,245,173,158,128
  750.    810 data 240,10,169,44,32,210,255,169
  751.    820 data 49,32,210,255,169,145,32,210
  752.    830 data 255,32,210,255,173,157,128,133
  753.    840 data 186,162,0,189,185,128,240,6
  754.    850 data 157,119,2,232,208,245,173,158
  755.    860 data 128,208,2,169,4,133,198,76
  756.    870 data 157,227,108,149,227,108,152,227
  757.    880 data 108,155,227,0,0,17,17,68
  758.    890 data 86,61,80,69,69,75,40,49
  759.    900 data 56,54,41,58,76,79,65,68
  760.    910 data 34,0,34,44,68,86,0,13
  761.    920 data 82,213,13,0,70,73,76,69
  762.    930 data 78,65,77,69,0,-1
  763.  
  764.  
  765.  
  766. ; RUN64.SRC
  767. ; Doug Cotton & Mark Fellows
  768. ; (c) 1996 Creative Micro Designs, Inc.
  769. ;
  770.         .org    $1800
  771.         .obj    run64.obj
  772.  
  773. run64   jsr     $ef73   ; go slow
  774. ;
  775.         ldy     #0      ; copy cartridge
  776. -       lda     code,y  ; code to $8000
  777.         sta     $8000,y
  778.         iny
  779.         bne     -
  780. ;
  781.         lda     $ba     ; get device number
  782.         sta     dvtemp  ; and store it
  783. ;
  784.         jmp     $ff4d   ; go 64
  785. ;
  786. code    .byt    $09,$80 ; cold start
  787.         .byt    $09,$80 ; warm start
  788.         .byt    $c3,$c2,$cd,$38,$30     ; cbm80
  789. ;
  790.         .off    $8009   ; offset code
  791. ;
  792.         lda     #$00    ; disable
  793.         sta     $8004   ; cartridge code
  794.         sei             ; disable interrupts
  795. ;
  796.         lda     #$00    ; zero out
  797.         sta     $d016   ; VIC control Register
  798. ;
  799.         jsr     $ff84   ; initialize I/O
  800.         jsr     $ff87   ; initialize RAM
  801.         lda     #$e6    ; switch in RAM
  802.         sta     $01     ; at $A000
  803.         lda     #<reenter       ; set up return vector
  804.         sta     $a000   ; at $A000 to bypass
  805.         lda     #>reenter       ; BASIC statup during
  806.         sta     $a001   ; initialization
  807. ;
  808.         jmp     $fcf8   ; let Kernal finish up
  809. ;
  810. reenter lda     #$e7    ; back from Kernal, set
  811.         sta     $01     ; $A000 back to ROM
  812. ;
  813.         jsr     ibv     ; initialize vectors
  814.         jsr     ibr     ; initialize RAM
  815.         jsr     ibm     ; initialize memory
  816. ;
  817.         ldx     #$00    ; output screen text
  818. -       lda     part1,x ; to form LOAD statement
  819.         beq     +
  820.         jsr     $ffd2
  821.         inx
  822.         bne     -
  823. ;
  824. +       ldx     #$00    ; print filename to be
  825. -       lda     filename,x      ; loaded at end of
  826.         beq     +       ; LOAD statement
  827.         jsr     $ffd2
  828.         inx
  829.         bne     -
  830.  
  831. ;
  832. +       ldx     #$00    ; print device
  833. -       lda     part2,x ; variable at end
  834.         beq     +       ; of LOAD statement
  835.         jsr     $ffd2
  836.         inx
  837.         bne     -
  838. ;
  839. +       lda     sa1flag ; check secondary
  840.         beq     +       ; address flag for load
  841.         lda     #','    ; type, and print a
  842.         jsr     $ffd2   ; comma and a 1 at end
  843.         lda     #'1'    ; of LOAD statement if
  844.         jsr     $ffd2   ; load type is ML
  845. ;
  846. +       lda     #$91    ; print two CRSR up
  847.         jsr     $ffd2
  848.         jsr     $ffd2
  849. ;
  850.         lda     dvtemp  ; get device number
  851.         sta     $ba     ; and store
  852. ;
  853. +       ldx     #$00    ; put [RETURN]rU[RETURN]
  854. -       lda     keydata,x       ; into keyboard buffer
  855.         beq     +
  856.         sta     $0277,x
  857.         inx
  858.         bne     -
  859. ;
  860. +       lda     sa1flag ; get load type and
  861.         bne     +       ; branch if it is ML (1)
  862.         lda     #$04    ; if not ML, change .A
  863. +       sta     $c6     ; store kybd buffer NDX
  864. ;
  865.         jmp     $e39d   ; enter BASIC
  866. ;
  867. ibv     jmp     ($e395) ; initialize vectors
  868. ibr     jmp     ($e398) ; initialize RAM
  869. ibm     jmp     ($e39b) ; initialize memory
  870. ;
  871. dvtemp  .byt    $00     ; device number temp
  872. sa1flag .byt    $00     ; load type (1=ML,
  873.                         ; 0=BASIC)
  874. ;
  875. part1   .byt    $11,$11 ; 2 CRSR up
  876.         .byt    'dv=peek(186):load'
  877.         .byt    $22     ; quote
  878.         .byt $00
  879. ;
  880. part2   .byt    $22     ; quote
  881.         .byt    ',dv'
  882.         .byt $00
  883. ;
  884. keydata .byt    $0d     ; [RETURN]
  885.         .byt    'rU'    ; shortcut for RUN
  886.         .byt    $0d     ; [RETURN]
  887.         .byt    $00
  888. ;
  889. filename        .byt    'filename'      ; name of file to load
  890.         .byt $00        ; 00 byte must follow filename!
  891. ;
  892.         .end
  893.  
  894. =========================================================================
  895.  
  896. @(#)mags: Hacking the Mags
  897.  
  898. Not everything good and/or technical comes from Commodore Hacking, which
  899. is as it should be.  (I still think we have the most, though...)  Thus,
  900. let's spotlight some good and/or technical reading from the other
  901. Commodore publications.
  902.  
  903. If you know of a magazine that you would like to see summarized here, let 
  904. C=Hacking know about it.  These summaries are only limited by Commodore 
  905. Hacking's inability to purchase subscriptions to all the Commodore 
  906. publications available.  We are very grateful to those publications that
  907. send complimentary copies of their publications for review.
  908.     
  909. @(A): COMMODORE CEE
  910.    At press time, Issue #5 was in the works, so we'll detail the contents
  911.    next time. However, see Newsfront (Reference: news) for address changes
  912.    for COMMODORE CEE.       
  913.  
  914. @(A): Commodore 128/64 Power User Newsletter (CPU)
  915.    A while back, Gosser Games, Ltd., Inc. sent us a sample issue of this
  916.    publication, which is published exclusively with a Commodore 128
  917.    machine, much like the defunct dieHard.  For those just getting into
  918.    the BBS arena, the "Cyberspace Cowboy", R.J. Smulkowski, previously
  919.    writing this article in dieHard, has moved his column to CPU.  The 
  920.    content is light, but useful, and a godsend for new users.  Reviews
  921.    of GeoFAX and "Radio Controlled Flight Simulator" also grace the
  922.    pages.  Printed on regular bond at 7" by 9", the 16 page publication
  923.    is small but full of potential.  
  924.  
  925. @(A): Commodore World
  926.    If you remember last time we spoke of Commodore World, we asked the
  927.    rhetorical question: What's up with those funky graphics?  We didn't
  928.    expect an answer, but editor Doug Cotton called to explain the curious
  929.    eye-catchers.  He also mentioned that asst. editor Jenifer Esile was
  930.    having trouble creating them now that we made fun of them.  We're sorry
  931.    Jenifer.  We want you to continue, since they save us the cost of 
  932.    commercial inkblot cards for our self-psycho-analysis sessions here
  933.    at Hacking Headquarters. (just joshing, we can be so mean sometimes).
  934.    Speaking of Jenifer, we're not sure when she started, but the last few 
  935.    issues seem more colorful.  Sure, content is great, but packaging is
  936.    everything.  We've even caught PC-centric folks perusing our copy.
  937.    Kudos to CMD for that effect.
  938.   
  939.    Obviously, Commodore World iisn't for all, but the content is
  940.    consistent.  Issues 11 and 12 are no exception.  In issue 11, Doug 
  941.    tackles high level serial bus routines and includes ML source, 
  942.    Gaelyne Moranec shares some useful WWW pages, and Jim Butterfield 
  943.    explains the nasty NULL character and its implications.  Of special
  944.    interest in this issue is the two page spread on changing device
  945.    numbers on the pesky 1541 drives.  The article is worthy of archival
  946.    for reference. CMD also takes time to note that the SuperCPU cartridge 
  947.    will contain a 65C816 8/16 bit CPU, not the earlier mentioned 65C02
  948.    8-bit CPU.
  949.    
  950.    Issue 12 should be subtitled the "SuperCPU" issue.  We think its
  951.    great, but it's definitely not subtle.  Doug Cotton and Mark Fellows
  952.    preview the unit while Jim Brain details the CPU inside it.  CMD 
  953.    ntes that the 10 MHz version has been scrapped, but the 128 version 
  954.    has been added, dealying introduction until April for the 64 version.
  955.    C=H was hoping to review a prototype unit this issue, but we'll do it
  956.    next time.  Jason Compton and Katherine Nelson describe HTML, the
  957.    markup language for World Wide Web pages, and Jim Butterfield explains
  958.    using KERNAL devices 0 (keyboard) and 3 (screen).  For those wanting 
  959.    to run a Bulletin Board System, Max Cottrell describes how to ensure 
  960.    success. Of special interest in this issue is a photo of the prototype 
  961.    accelerator.  We won't even hint of our opinions on this round of
  962.    funky graphics....  
  963.    
  964. @(A): Driven
  965.    Driven #11 waxes somewhat philosophic about the demo scene in 1995.  The
  966.    tone expresses a tinge of disappoinment with the hope that 1996 will
  967.    be a better year for demos.  This issue also ushers in Driven's first
  968.    crack at covering the PAL scene.  As part of the 1995 year-end review,
  969.    a complete list of releases is given.  In the news section, Charles
  970.    Christianson's blurb on the CMD SuperCPU is reprinted, and King Fisher
  971.    of Triad discusses the origins of the demo scene in "Cyberpunk".
  972.    
  973.    If you've ever wondered what goes on inside the mind of a demo "scene"
  974.    programmer, Driven #12 will fill you in.  Interviews with Phantom of
  975.    the group FOE and Zyron of F4CG are included, both telling it as it is.
  976.    For those wanting to set up or design a BBS system Mitron takes a look
  977.    at CNET DS2  and details some general guidelines on how the networking
  978.    code works.  Of special note is a review of this issue's Polygonamy
  979.    sample code (Reference: polygon).  
  980.  
  981. @(A): LOADSTAR
  982.    Issue 139 starts off with the announcement that LOADSTAR is taking over
  983.    the dieHard Spinner disk subscriptions, as reported in C=H#11.  File
  984.    Base 64 from John Serafino will be useful for anyone organizing their
  985.    disk collection.  Fender Tucker claims it is better than DCMR, the
  986.    supposed standard.  Jeff Jones cooks up the "Ultimate INPUT" for people
  987.    wanting the perfect BASIC INPUT routine.  The claims are substantial and
  988.    Jeff delivers.  The included LOADSTAR LETTER #29 contains another
  989.    article in the Internet series.
  990.  
  991.    As we started Issue 140, we noticed something was different.  We
  992.    couldn't place it at first, but then Jeff alerted us to the change.
  993.    LOADSTAR now has highlighted words in the text, and the color scheme
  994.    can be changed and saved.  Nice for the eyes.  In addition, LS#140 can
  995.    mark up text using highlights, bold, and underline on printers that
  996.    support such features.  Bob Markland presents a ML module that
  997.    provides better random numbers, and Fender Tucker challenges
  998.    programmers ML programmers to write a routine that searches an in
  999.    memory dictionary for a word.  Speed is the key.  C=H gets some space,
  1000.    as Issue 11 is reprinted in the 3.5" version.  Of particular note to
  1001.    programmers is Don Forsythe's "Hidden Clocks" article that describes
  1002.    in detail the CIA TOD clocks and their bugs, err "features".                  
  1003.  
  1004.    It's funny, but the LOADSTAR LETTER #40 that comes with LS #140 is 
  1005.    subtitled "Special Commodore Hacking Issue".  We were expecting C=H
  1006.    articles, but that shows just how egotistical we can be.  Jeff Jones
  1007.    filled the issue with rumors of new products, handy tips, and
  1008.    information about CMD's SuperCPU.  Of particular interest is the
  1009.    information about Craig Bruce modifying his Swiftlink to do 115,200 bps.
  1010.  
  1011.    Right before we went to press, issue 141 showed up in the mailbox.  #141
  1012.    starts off with the changes of operation since LOADSTAR publication
  1013.    was taken over by J & F Publishing.  The first is their new address:
  1014.  
  1015.    LOADSTAR
  1016.    606 Common Street
  1017.    Shreveport, LA  71101
  1018.    
  1019.    Also, they say checks should now be made out to LOADSTAR, not Softdisk.
  1020.    
  1021.    For all you TUI (Text User Interface) folks, Jeff Jones goes over how
  1022.    to create "buttons" that depress on screen when activated.  Source code
  1023.    is provided as well, which is rare for LOADSTAR.  Of particular interest
  1024.    to us was Terry Flynn's "Virtual Optics" slideshow.  Hard to describe,
  1025.    it displays impossible constructions and 3D illusions.  Even C=H gets
  1026.    some space, as issues 3 and 4 are available on the 3.5" disk version.
  1027.    Jim Brain supplies article 4 in the Internet series on LOADSTAR LETTER
  1028.    #31, included with the issue.  Of special note is LOADSTAR's new 
  1029.    Internet address, given in the LL as loadstar@softdisk.com.  See 
  1030.    Newsfront (Reference: news) for more information.
  1031.  
  1032. @(A): LOADSTAR 128
  1033.    We loaded up LS128 #30 for a look-see.  Dave's Term, the 128 
  1034.    Telecommunications Program presented in the last 4 issues, seems to be
  1035.    one focus of this issue.  Don Graham supplies a keyboard overlay and
  1036.    macros for the terminal program, while David Jensen includes a spell
  1037.    checker.  In the issue as well is ZED, the 128 editor of editors from
  1038.    Craig Bruce.
  1039.    
  1040. @(A): Vision
  1041.    At press time, Issue #8 was in the works, so we'll detail the contents
  1042.    next time.
  1043.  
  1044. Other magazines not covered in this rundown include:
  1045.  
  1046. *  _The Underground_ 
  1047. *  _Gatekeeper_
  1048. *  _Commodore Network_
  1049. *  _64'er_
  1050. *  _Atta Bitar_ (_8 bitter_)
  1051. *  _Commodore Zone_
  1052. *  _Commodore Gazette_
  1053.  
  1054. In addition, others exist that C=Hacking is simply not aware of.  As soon
  1055. as we can snag a copy of any of these, or get the foreign language ones 
  1056. in English :-), we will give you the scoop on them.  
  1057.  
  1058. ============================================================================
  1059.  
  1060. @(#): Polygonamy: A Study in 3 Dimensions
  1061.       by Stephen L. Judd (sjudd@nwu.edu)
  1062.  
  1063. We've been making some pretty small potatoes for a while now, so
  1064. the time has come for a little more ambition and challenge.  I decided to
  1065. think up a real challenge, containing problems that I had no idea how to
  1066. solve, and see what I could come up with.
  1067.  
  1068. I set out to create a 3D virtual world for the C64, e.g. a space
  1069. populated with various three-dimensional objects, which I could wander around
  1070. in.  I wanted it to be full-screen 320x200 hires bitmapped.  Furthermore, I
  1071. wanted the objects to be solid, and since there are only two colors I
  1072. wanted to be able to put patterns on the faces.  I also wanted it to
  1073. translate nicely to the 128's VDC chip, in 2MHz mode.  Finally, naturally, I
  1074. wanted the program to be fast.  This was the framework in which I placed
  1075. myself, and a few other ideas presented themselves along the way.  The
  1076. outcome of all of this is Polygonamy.
  1077.  
  1078. Just a brief history of this project: I have wanted to do a 3D
  1079. world for a very long time, and have been thinking about it for some
  1080. time in the back of my head; my imagination was probably first fired
  1081. the first time I played Elite.  I wrote down the necessary equations one
  1082. afternoon last summer, for a high school student I was teaching, and
  1083. the equations are very simple.  I took a break to get some work of
  1084. measureable value accomplished, but in October I began work on the graphics
  1085. algorithm.  I worked steadily on this for two months, and in December I
  1086. finally began to code the graphics.  In mid-January, I got them to work.
  1087. Adding the rest took a few weekends more.  I have about 128 pages of notes,
  1088. analytical calculations, and BASIC test programs in my C64 notebook (which
  1089. is, I think, a nice number of pages to have :).  My original plans were
  1090. to place five objects in the world, but time and memory constraints whittled
  1091. that down to three.  One of my disks self-destructed about the day I was
  1092. ready to finish, so I had to reconstruct a bunch of tables, but other than
  1093. that I finally managed to finish it up, albeit with a few rough edges ;).
  1094.  
  1095. Although the concepts from previous articles are used as a solid
  1096. foundation, the code is almost 100% from scratch -- I only borrowed a
  1097. tiny piece of code from an earlier program, and even that I modified
  1098. somewhat.
  1099.  
  1100. One caveat before we begin: I am primarily interested in the
  1101. challenge of designing the algorithms, which means I like to come up
  1102. with my own solutions.  Thus, you may find more efficient methods
  1103. in a graphics book or perhaps in someone else's code; I have examined
  1104. neither, so I have no idea what the relative merit of my algorithms
  1105. may be.  These are simply my solutions to challenges placed before me.
  1106. And if you know of a better way to do things, please feel free to email
  1107. me!
  1108.  
  1109. Furthermore, I consider the code a test of the theory.  Some of my
  1110. assumptions work and some do not, and these will be considered at the end
  1111. of this article.
  1112.  
  1113. Finally, I am not including the source code.  For one thing, it is big.  
  1114. Like, _HUGE_, man.  I had to split it up when I ran out of editor memory
  1115. on my 128 (which, incidentally, forced me to figure out Merlin 128's very
  1116. cool and very powerful linker feature).  I will include numerous code 
  1117. fragments in assembly and BASIC which demonstrate all the important 
  1118. concepts.
  1119.  
  1120. By the way, if you are interested in measuring frame rates, you can
  1121. use the first object.  Every full 360 degree revolution is 128 frames. 
  1122. So time how long it takes to complete a full rev (or maybe several), and 
  1123. divide that number into 128, to get an idea of frames per second.
  1124. For a rundown of frame rates for stock and SuperCPU operation, see
  1125. "Underneath the Hood of the SuperCPU" (Reference: cmdcpu) found
  1126. elsewhere in thi issue.
  1127.  
  1128. Some brief acknowledgements: This project would not have happened without
  1129. the extremely powerful macro and linking capabilities of the Merlin 128
  1130. assembler, by Glen Bredon.  It would have been _really_ tough without
  1131. JiffyDOS and my FD-2000, from CMD.  I used my Action Replay extensively
  1132. for debugging, and without the excellent documentation for the 64, such as
  1133. the PRG and Mapping the 64, this would have been a nightmare.  Finally, I 
  1134. must acknowledge my friend George Taylor; a few days before I was all 
  1135. finished I explained some routines to him, and he made a great suggestion 
  1136. which made my fast fill routine blaze.
  1137.  
  1138. Okay, WAY too much talk.  There are a ton of issues involved with this 
  1139. project so let's just wade in hip-deep and deal with them as they come.
  1140.  
  1141. @(A): The Equations
  1142.       -------------
  1143.  
  1144. First some relaxing abstraction.  In previous articles we have discussed
  1145. how to project an object in three dimensions through the origin into a 
  1146. plane.  We have also discussed rotations in three dimensions.  In 
  1147. principle, then, we have all the mathematics we need to do a 3D world.
  1148.  
  1149. But we should be thoughtful.  Let's say we're standing in the world and 
  1150. turn to the right; we can either rotate ourselves, and change the 
  1151. direction we are looking, or we can rotate the world around us, so that 
  1152. we are always looking 'forward'.  This may bother you on physical grounds,
  1153. but the two are mathematically equivalent.  Given the way we have derived
  1154. our projection routines, it should be clear that we want to rotate the 
  1155. objects in the world around us.
  1156.  
  1157. (Or, to put it another way, we are at the center of the world, and the 
  1158. world revolves around us.)
  1159.  
  1160. We have another issue: how do we know when an object is visible or not?
  1161. How do we know when we've bumped into an object (or blown it out of the
  1162. sky :)?  Moreover, if we have ten objects, and each object has six points,
  1163. it would be a real drag to have to rotate all sixty points, especially
  1164. if none of the objects were even visible.      
  1165.  
  1166. It should be clear that we really want to define every object relative
  1167. to some center of the object.  So we keep track of the center of each 
  1168. object, and rotate and translate the centers, and only calculate the 
  1169. full object if it is visible.  We of course want to define the object 
  1170. relative to this center.
  1171.  
  1172. What happens to this center when we translate or rotate the world?
  1173.  
  1174. Let's simplify our model a little bit and only deal with rotations about 
  1175. one axis, e.g. we are driving a tank and can move forwards and backwards,
  1176. and turn left or right.  The generalization to other axes is very 
  1177. straightforward, but this way we can think in two dimensions instead 
  1178. of three.
  1179.  
  1180. First we need to agree on a coordinate system.  For my system I let the 
  1181. x-axis go _up_ a page of paper, the y-axis comes up out of the page, and 
  1182. the z-axis goes from left to right.  Thus, I am standing on the paper in
  1183. the x-z plane, at the origin, with the y-axis extending upwards from me. 
  1184. If you still don't understand my orientation, draw a little picture.
  1185.  
  1186. I am going to choose my orientation so that I am always looking straight
  1187. down the x-axis, e.g. in the direction that x is increasing.  Thus, if I
  1188. walk forwards or backwards, this corresponds to decreasing or increasing
  1189. the x-component of the center coordinate:
  1190.  
  1191.    let C=(cx,cy,cz)
  1192.    move forwards => cx=cx-1
  1193.    move backwards=> cx=cx+1
  1194.  
  1195. So far so good.  As always, draw a picture if you can't visualize it.  
  1196. That takes care of translations, what about rotations?
  1197.  
  1198. We certainly know how to rotate points about the origin.  In particular,
  1199. if we have a point with coordinates (x1,z1) and rotate it clockwise by 
  1200. an angle s, we get the new point as follows:   
  1201.  
  1202.    (x1,z1) -> (x1*cos(s)+z1*sin(s), z1*cos(s)-x1*sin(s))
  1203.  
  1204. So that's easy enough.  The problem is that we have this big object
  1205. sitting around this point, and need to figure out what to do with it!
  1206.  
  1207. Consider the following: let's say we have a line out some distance from 
  1208. the origin,
  1209.  
  1210.                          X
  1211.                          X
  1212.             |            X
  1213.  z-axis ----O------------c----     c=center
  1214.             |            X
  1215.             |            X
  1216.           Origin         X <---- line
  1217.  
  1218. and we rotate it by some amount theta about the origin:
  1219.  
  1220.                       X
  1221.                       XX
  1222.                        Xc      c=rotated center
  1223.             |           XX 
  1224.  z-axis  ---O------------XX-
  1225.             |             X
  1226.                           XX
  1227.  
  1228. You can see (from my incredible ASCII artwork) that the line is now at an
  1229. angle with respect to the origin.
  1230.  
  1231. Imagine that we draw a line from the origin to the center of the point, 
  1232. in the first picture (or get a pencil and paper and actually do it), so 
  1233. that we have the letter "T" laying on its side.  Now we rotate this "T" 
  1234. by some angle theta, so that the top of the "T" -- our line -- has now
  1235. been rotated.
  1236.  
  1237. The stem of the "T" meets the top of the "T" at the center point c.  Drop
  1238. a line from the rotated center straight down to the z-axis, and call this
  1239. line l2.  Since the T is at a right angle, and we have rotated it by an
  1240. angle theta, the angle between our line and the z-axis is 90-theta.  But
  1241. this means that the angle between our line (the top of the "T") and the
  1242. line l2 is just theta.
  1243.  
  1244. Thus, if we rotate the center by an amount theta, all we have to do 
  1245. is rotate the object by an amount theta *about the center*, and our 
  1246. perspectives will all be correct.  How is that for simple?  It should
  1247. be clear now that this works no matter where the "center" of the object
  1248. is chosen.  Thus, our center is not some physical center of the object,
  1249. but rather the center of rotation of the object.
  1250.  
  1251. Since this is true of rotations about any axis, we now know how to 
  1252. generalize to higher dimensions.
  1253.  
  1254. Note further that we can now implement local rotations -- that is, let's 
  1255. say the object is a tank, and this tank turns independently of whether 
  1256. or not we turn.  Piece of cake.
  1257.  
  1258. You can also see that the rotations are cumulative.  If we turn to the 
  1259. left, and then turn left again, we can simply apply two rotations to the 
  1260. points of the object.  In fact, if we turn left, move forwards, and then
  1261. move left again, we still apply just two rotations to the points of the
  1262. object; the center, however, has moved.
  1263.  
  1264. This is quite important, as it allows us to measure an object's relative
  1265. rotation to us, whether or not it is visible.  Remember that we only 
  1266. want to rotate the points that define an object when the object is 
  1267. visible.  We never actually change the points which define an object.
  1268. Instead, we track how much the object needs to rotate, and rotate the
  1269. original points by that amount.
  1270.  
  1271. The center of the object will change with each rotation and translation.
  1272. We never change how we define an object about this center, though.  We
  1273. simply apply a rotation to the original points when appropriate.  The 
  1274. object centers must be kept track of because they can undergo translation
  1275. as well as rotation.
  1276.  
  1277. To summarize then: we define each object relative to a center of 
  1278. rotation.  The center determines where the object is located in the
  1279. world, and allows us to operate on centers when we need to rotate or
  1280. translate the world.  It also lets us perform local operations on an
  1281. object, so that we could, for instance, have a spinning cube located
  1282. inside our world.  If an object's center is visible then we can consider
  1283. the object to be visible, and plot it.
  1284.  
  1285. Whoops -- what does it mean to be 'visible'?  Well, think about yourself.
  1286. You can see things when they are in front of you.  Or, to be more 
  1287. precise, you have a field of vision.  Perhaps a decent model of this 
  1288. would be a cone.  I think a better model, certainly one which is
  1289. easier to deal with computationally, is the intersection of two planes:
  1290. a pyramid.  Anything which lies within this pyramid we consider visible,
  1291. and anything which lies outside we consider not visible.
  1292.  
  1293. Two-dimensionally, we draw a little wedge extending from the origin.  
  1294. Anything within the wedge we count as visible, and anything outside
  1295. of it we count as not visible.  The sides of this wedge are two lines, 
  1296. with equal but opposite slope (i.e. slope=+/-m).
  1297.     
  1298.  \ Visible /
  1299.   \  View /  Outside of visual area
  1300.    \Area /
  1301.     \   /
  1302.      \ /
  1303.       * <--- Me
  1304.  
  1305. Probably lines at some angle are more reasonable than others.  But I'm a
  1306. simple guy, and the two simplest lines I can draw are at 45 degree angles
  1307. from the axis, so their slope is +/-1.  Thus, any points which lie 
  1308. between the lines x+z=0 and x-z=0 are visible.  If the center of an 
  1309. object is within this area, we will consider the object visible.  That 
  1310. is, if cx+cz>0 and cx-cz>0 the object is visible.        
  1311.  
  1312. One last thing: if we are too close to the object, we either want to 
  1313. bump into it (i.e. not move) or else not display it.  So we also need to 
  1314. check if cx<x0 for some x0.
  1315.  
  1316. We are now in a position to write some simple code.  I wrote the
  1317. following in evil Microsoft QBasic, but BASIC7.0 on the 128 would work
  1318. just as well, although you need to change the variables (I didn't have my
  1319. 128 handy, otherwise I would have written this on the 128):
  1320.  
  1321. @(A): Polygon Prototype Code
  1322.  
  1323.    SCREEN 1 '320x200
  1324.  
  1325.    delta= 3    'Rotations will be in 3 degree increments
  1326.    rad= 3.1415926/180
  1327.    cdel= COS(rad*delta)
  1328.    sdel= SIN(rad*delta)
  1329.    theta=0
  1330.    d=-135
  1331.    x0= 60      'Bumped into the object?
  1332.    REM z0 y0 would be 160,100 to place the object in the center
  1333.    REM of the screen
  1334.    y0= 170  'I want the bottom of screen to be ground
  1335.    z0= 160
  1336.  
  1337.    REM Set up the object
  1338.    REM Tetrahedron: 0,sqrt(3),0  0,0,1  0,0,-1  2,0,0
  1339.    DIM obx(4), oby(4), obz(4)
  1340.  
  1341.    obx(1)= 0
  1342.    oby(1)= 50*SQR(3)
  1343.    obz(1)= 0
  1344.    obx(2)= 0
  1345.    oby(2)= 0
  1346.    obz(2)= 50
  1347.    obx(3)= 0
  1348.    oby(3)= 0
  1349.    obz(3)= -50
  1350.    obx(4)= 100
  1351.    oby(4)= 0
  1352.    obz(4)= 0
  1353.  
  1354.    cx= 100
  1355.    cy= -10
  1356.    cz= 0
  1357.  
  1358.    REM Get input
  1359.    main:
  1360.  
  1361.    DO
  1362.      a$=INKEY$
  1363.    LOOP UNTIL a$<>""
  1364.  
  1365.    IF a$="[" THEN cx=cx-20
  1366.    IF a$="/" THEN cx=cx+20
  1367.    IF a$=";" THEN GOSUB rotl
  1368.    IF a$="'" THEN GOSUB rotr
  1369.  
  1370.    IF cx<x0 THEN CLS: GOTO main:
  1371.    IF cx<cz OR cx+cz<0 THEN CLS: GOTO main:
  1372.  
  1373.    ctheta= COS(rad*theta)
  1374.    stheta= SIN(rad*theta)
  1375.  
  1376.    p1x= cx + ctheta*obx(1) + stheta*obz(1)   'Rotate and add to center
  1377.    p1y= cy + oby(1)
  1378.    p1z= cz + ctheta*obz(1) - stheta*obx(1)
  1379.    p1y= y0 + d*p1y/p1x          'Project and add offset
  1380.    p1z= z0 + d*p1z/p1x
  1381.    [... similar for p2x,p2y,p2z,...,p4x,p4y,p4z]
  1382.  
  1383.    CLS
  1384.    LINE (p1z, p1y)-(p2z, p2y)
  1385.    [... lines between p2-p3, p3-p1, p1-p4, p4-p2, p4-p3]
  1386.  
  1387.    GOTO main:    'Main loop
  1388.  
  1389.    REM rotate left
  1390.    rotl:
  1391.        theta= theta + delta
  1392.        blah= cdel*cx + sdel*cz
  1393.        cz= -sdel*cx + cdel*cz
  1394.        cx= blah
  1395.    RETURN
  1396.  
  1397.    rotr:
  1398.        theta= theta-delta
  1399.        blah= cdel*cx - sdel*cz
  1400.        cz= sdel*cx + cdel*cz
  1401.        cx= blah
  1402.    RETURN
  1403.  
  1404. (You may note that cx=cx+20 is used for a translation, instead of cx=cx+1.
  1405. This will be detailed later).
  1406.  
  1407. So much for the easy part.
  1408.  
  1409. @(A): Filling
  1410.       -------
  1411.  
  1412. If there is one thing that the previous programs have taught us, it is 
  1413. that graphics are slow.  At least, they are far and above the major thing
  1414. slowing down the program, and deserve the most attention and thought for
  1415. improvement.  Moreover, because there is lots of looping involved, the
  1416. elimination of just a few instructions can translate to thousands of 
  1417. cycles saved.
  1418.       
  1419. We have examined several fill routines up to now, but neither of them is
  1420. up to the task of Polygonamy.  The cookie-cutter method is OK, but doesn't
  1421. allow multiple objects, and certainly doesn't allow pattern fills.  Using
  1422. an EOR-buffer is just plain slow and inefficient and a big drag.  So it's
  1423. time to rethink this problem.
  1424.     
  1425. Recall that on the 64 the bitmap screen is divided into 8x8 cells, which
  1426. are arranged horizontally in rows.  It's a pretty kooky way of doing 
  1427. things, but we shall overcome.
  1428.  
  1429. First of all it should be clear that we want to fill from left to right
  1430. (as opposed from top to bottom).  We can then fill a byte at a time, 
  1431. instead of dinking in little pixels at a time.
  1432.  
  1433. Previously we used a custom character set to plot into.  One of the major
  1434. reasons for doing so was to use Y as the Y-coordinate, so that storing a
  1435. particular point was as simple as STA COLUMN,Y.  We can still use this
  1436. idea, but only within each row.  That is, if we let Y=0..7, we can address
  1437. each individual pixel-row within each 8x8 block row with an STA ADDRESS,Y.
  1438.  
  1439. For real speed, we are going to want an unrolled fill routine.  That is,
  1440. we don't want to mess around with loop counters and updating pointers and
  1441. such.  Since there are 25 rows on the screen (25 times 8 = 200 pixels
  1442. high) we are probably going to need 25 separate fill routines.      
  1443.      
  1444. I constructed my fill routine as follows:
  1445.  
  1446.             STA COL1,Y
  1447.             DEX
  1448.             BEQ :DONE
  1449.             STA COL2,Y
  1450.             DEX
  1451.             BEQ :DONE
  1452.             STA COL3,Y
  1453.             ... etc.
  1454.    :DONE    RTS
  1455.    
  1456. Thus X would be my counter into the number of columns to fill, A can
  1457. contain our pattern to fill with, and Y can range from 0..7 to index the
  1458. individual rows within the block.  The first thing to notice is that each
  1459. STA/DEX/BEQ code chunk is six bytes.  So, all we need to do is calculate
  1460. which row to start filling at, multiply by six, and add that number to
  1461. the start of the fill routine.  The idea is then to jump into the correct
  1462. place in the fill, and let it fill the right number of columns, stored in
  1463. X.
  1464.  
  1465. There is a little problem though -- what we're talking about doing is an 
  1466. indirect JSR, and there is no such thing.  But it's easy enough to fake,
  1467. because we can use an indirect JMP.  So a call to the fill routine would
  1468. look like the following:
  1469.  
  1470.          ...
  1471.          JSR FILL
  1472.          ...
  1473. FILL     JMP (ADDRESS)
  1474.  
  1475. where ADDRESS simply points to the correct entry point in the fill routine.
  1476.  
  1477. Moreover, you may also note that 40 columns times 6 bytes/column is 240
  1478. bytes, so that each little fill routine handily fits in a page.  Thus,
  1479. moving between rows in the bitmap corresponds to a simple decrement or
  1480. increment of the high byte of the ADDRESS pointer.  
  1481.  
  1482. This was the state of things when, days before I was to be all done with
  1483. Polygonamy, I mentioned it to my friend George Taylor, who suggested the
  1484. following modification: instead of using X to count how many columns to
  1485. fill, just make the fill routine:
  1486.  
  1487.          STA COL1,Y
  1488.          STA COL2,Y
  1489.          STA COL3,Y
  1490.          ...
  1491.  
  1492. Then, insert an RTS into the right place in the routine.  Thus, we 
  1493. calculate which column to stop filling at, multiply by three, and stick
  1494. an RTS in the fill routine at that point.  To fix it up we stick an
  1495. STA ..,Y back on top of the RTS.
  1496.         
  1497. I don't think you're going to make a fill routine faster than that :).
  1498.  
  1499. Moreover, note that each fill routine takes up just 120 bytes, so we can
  1500. now fit two fill routines in each page.  I did not do this, but it is
  1501. easy to do, and instantly frees up 25 pages.           
  1502.  
  1503. @(A): Filled Polygons
  1504.       ---------------
  1505.       
  1506. I mean, hey, this _is_ "Polygonamy", so let's talk polygons, and lots of
  1507. them.
  1508.  
  1509. Clearly all that is needed to draw an object are the left and right
  1510. endpoints of the object, since everything in-between will be filled.
  1511.  
  1512. An observation to make is that if you take a slice out of a convex
  1513. polygon, the slice will intersect the polygon at exactly two points.
  1514. Another, more important, observation is to note that the highest and
  1515. lowest point of a polygon will always be at a vertex.  Finally, it is
  1516. important to note that any vertex of a polygon has exactly two lines
  1517. extending out of it, one to the left, and one to the right.
  1518.  
  1519. Consider a piece of a polygon:
  1520.  
  1521.   \         /
  1522.    \       /
  1523.     \     /
  1524.      \   /
  1525.       \ /
  1526.        *  <--- Vertex v0
  1527.  
  1528. where the vertex v0 is the lowest point of the polygon.  All that needs
  1529. to be done is to move upwards (DEY), compute the left and right points
  1530. of the polygon at that point, and then fill between the two (JSR FILL).
  1531.       
  1532. The idea then is to start at the bottom (or the top) and to steadily move
  1533. upwards while _simultaneously_ calculating the endpoints of the left and
  1534. right lines, and filling in-between.  But we need the equations of the
  1535. left and right lines to do this.
  1536.     
  1537. Now it's time for another observation.  Let's say we have a polygon with
  1538. n vertices v1, v2, ..., vn, and furthermore that as we move between these
  1539. points we move around the polygon counter-clockwise.  Thus v3 is to the
  1540. right of v2, v1 is to the left of v2, v4 is to the right of v3, etc.
  1541. For example:
  1542.  
  1543.       v1____v3
  1544.         \  /
  1545.          \/
  1546.          v2
  1547.  
  1548. What happens if we rotate this polygon?
  1549.  
  1550.       v2____v1
  1551.         \  /
  1552.          \/
  1553.          v3
  1554.  
  1555. The vertices have changed position, but *their order has not*.  v3 is
  1556. still to the right of v2, and v1 is still to the left.
  1557.  
  1558. Now we have a real plan.  We simply define the polygon as a list of
  1559. points v1 v2 v3 ... vn.  We then figure out which one is lowest, i.e. has
  1560. the smallest (or greatest) y-coordinate, call this vertex vm (vmax).  The
  1561. endpoints of the left and right lines are vm-1,vm and vm,vm+1.  So move
  1562. along those lines until the next vertex is reached.  At that point,
  1563. recompute the appropriate line, and keep moving upwards until the top of
  1564. the polygon is reached.
  1565.  
  1566. Perhaps an example would be helpful:
  1567.  
  1568.         v1
  1569.         |\
  1570.         | \ v3
  1571.         | /
  1572.         |/
  1573.         v2
  1574.  
  1575. v2 is the minimum.  The left line has endpoints (v1,v2) and the right
  1576. line has endpoints (v2,v3).  We steadily move along the left and right
  1577. lines as we creep upwards.  At some point we hit v3, and at this point
  1578. we compute a new equation for the right line, this time with endpoints
  1579. (v3,v1).  Now we continue to creep upwards and move along the left and
  1580. right lines, until we hit v1, at which point we are finished.
  1581.  
  1582. It is important to keep in mind that the order of the points never
  1583. changes.  We don't need to do anything complicated like sorting the 
  1584. points; we only need to find the lowest point, and branch left and right
  1585. from there, keeping in mind that the points are cyclic (i.e. v1 is to the
  1586. right of vn).
  1587.  
  1588. It is now time to start thinking about code.  One aspect of the fill 
  1589. routine we haven't considered is the clear.  In the past the entire draw 
  1590. buffer was cleared and then the new stuff was drawn into it.  But this 
  1591. seems like a bit of a waste; it seems wasteful to clear a bunch of memory 
  1592. that is just going to be overwritten again.  So, as long as we can do it
  1593. efficiently, it might be smart to combine the clear and fill routines.
  1594.  
  1595. Here is how Polygonamy does it: If a line needs to be cleared, then it
  1596. is cleared up to the edges of the object, but the part that is going to
  1597. be filled is ignored.  (It isn't clear if this provides any substantial 
  1598. efficiency gains, though).
  1599.  
  1600. To see the status of a particular line, a table is used, containing a 
  1601. value for each Y-coordinate.  If the entry is 255 then the line is clear,
  1602. if it's 0 then the line has old junk in it, and if it's 1 then the line
  1603. has new junk in it.  Thus we only clear the line if its entry in the fill
  1604. table is a zero.
  1605.  
  1606. So a fill routine might flow like the following:
  1607.  
  1608.    let Y count from 7..0
  1609.  
  1610.    If we are at the left endpoint then recalculate the left line.
  1611.    If we are at the right endpoint the recalculate the right line.
  1612.    Update xleft & xright
  1613.    If line needs to be cleared then clear line.
  1614.    If the starting fill column is different than the previous fill
  1615.        column then update the pointers, etc.
  1616.    Plot the left and right endpoints (since the fill routine only plots
  1617.        eight bits at a time)
  1618.    Fill the in-between parts
  1619.    Update Y
  1620.    If Y passes through zero then update fill entry point, set Y=7 etc.
  1621.    Keep going until we reach the top
  1622.  
  1623. The next thing to figure out is how to calculate the left and right
  1624. lines.  We do have the old line routine, which we could use to advance
  1625. to the left and right endpoints, but clearly this isn't too efficient.
  1626.  
  1627. The question is: if the y-coordinate increases by one, then how much does
  1628. the x-coordinate increase by?  The equation of a line is:
  1629.  
  1630.    (y-y0) = m*(x-x0)  m=slope
  1631.    
  1632. or
  1633.  
  1634.    change in y = m*change in x
  1635.  
  1636. So, if the change in y is 1, then then the change in x is 1/m.  All we
  1637. need to do then is calculate the inverse-slope=dx/dy, where dx=x2-x1 and
  1638. dy=y2-y1, and add this to the x-coordinate with each step in y.
  1639.  
  1640. Isn't this a fraction?  Sure, big deal.  The fraction can be written
  1641. as dx/dy = N + Rem/dy, where N is an integer, and Rem is the remainder,
  1642. which is always less than dy.  So to calculate x=x+dx/dy:
  1643.  
  1644.    x= x+N
  1645.    xrem= xrem+Rem
  1646.    If xrem>=dy then x=x+1:xrem=xrem-dy
  1647.  
  1648. As usual, we want to start xrem at dy/2, which has the effect of rounding
  1649. numbers up.
  1650.  
  1651.    10 REM LINE ROUTINE TAKE TWO SLJ 11/24/95
  1652.    12 REM ACTUALLY IT'S A FILL RTY NOW
  1653.    15 GRAPHIC 1,1
  1654.    20 X0=160:Y0=100
  1655.    30 X1=5:Y1=-50:X2=7:Y2=11:XL=X1:YL=Y1:Y=Y1
  1656.    35 X3=50:Y3=Y1:X4=X3+100:Y4=Y2:XR=X3:YR=Y3
  1657.    40 D1=Y2-Y1+1:DX=X2-X1:LI=INT(DX/D1):LR=DX-LI*D1
  1658.    45 TL=INT(D1/2)
  1659.    46 D2=Y4-Y3+1:DX=X4-X3:RI=INT(DX/D2):RR=DX-RI*D2
  1660.    48 TR=INT(D2/2)
  1661.    50 DRAW1, X0+X1,Y0-Y1 TO X0+X2,Y0-Y2, X0+X3,Y0-Y3 TO X0+X4,Y0-Y4
  1662.    60 REM MAIN LOOP
  1663.    70 XR=XR+RI:TR=TR+RR:IF TR>=D2 THEN TR=TR-D2:XR=XR+1
  1664.    75 DRAW1, X0+XL,Y0-Y TO X0+XR,Y0-Y
  1665.    80 XL=XL+LI:TL=TL+LR:IF TL>=D1 THEN TL=TL-D1:XL=XL+1
  1666.    90 REM DRAW1, X0+XL,Y0-Y TO X0+XR,T0-T
  1667.    100 Y=Y+1:IF Y<=Y2 THEN 60
  1668.  
  1669. In this program (x1,y1)-(x2,y2) is the left line, and (x3,y3)-(x4,y4) is
  1670. the right line.  The first thing to note is that in lines 40 and 46, 
  1671. Y=y2-y1+1.  This issue was discussed in the very first C=Hacking 
  1672. 3D-graphics article.  The problem is that although the line will be 
  1673. anatomically correct with DY=y2-y1, it will look silly.  The easiest way
  1674. to see this is to consider y2-y1=1, e.g. say we draw a line between
  1675. (0,10) to (50,11).  Ideally this line will consist of two line segments,
  1676. one from (0,10) to (25,10) and the other from (26,11) to (50,11).  But ifi
  1677. we use DY=1 we will have one line segment from (0,10) to (50,10), and a
  1678. single point at (50,11).
  1679.  
  1680. Adding one to DY is just a simple cheat.  Most of the time the lines will
  1681. look just fine, but lines which have a slope near one will come out a bit
  1682. wrong.  The other, accurate solution, which was used in the first
  1683. article, is more complicated to implement in this routine.  Adding one to
  1684. DY will also have a useful benefit which we shall shortly see.   
  1685.  
  1686. In line 50 above the boundaries of our object are drawn in, to check the
  1687. accuracy of the algorithm.
  1688.  
  1689. In lines 70-80 the right point is updated, then the thing is filled, then
  1690. the left point is updated.  This is because both lines are moving to the
  1691. right, e.g. they both have positive slope.  Think about how the line
  1692. segments will be drawn; in general, we want to draw from the left end of
  1693. the left line segment to the right end of the right line segment.  
  1694. (Sometimes this will look a little off where the two lines meet).
  1695.  
  1696. Since the left and right lines can each have either positive or negative
  1697. slopes, there are four possibilities: Plus-Plus, Plus-Minus, Minus-Minus,
  1698. and Minus-Plus.
  1699.  
  1700.    Plus-Plus:  Update right, fill, then update left
  1701.    Plus-Minus: Fill, update left, update right
  1702.    Minus-Minus:Update left, fill, update right
  1703.    Minus-Plus: Update left, update right, fill
  1704.    
  1705. If this is still confusing, try out the above program with various left
  1706. and right line segments, and these things will jump right out.
  1707.  
  1708. Now we need to think about implementing this in assembly.  Since this is
  1709. being done in hires 320x200, the x-coordinate requires two bytes, and the
  1710. y-coordinate requires one.  We also need another byte to store the
  1711. remainder portion of the x-coordinate.
  1712.  
  1713. The most glaring question is the calculation of dx/dy: somehow we need a
  1714. fast way of exactly dividing an eight bit number dy into a nine bit
  1715. number dx.  Recall that we always add one to dy, so that dy actually
  1716. ranges from 2 to 200.  Since the maximum value of dx is 320 or so, the
  1717. largest value of dx/dy that we can have is 320/2 = 160.  In other words,
  1718. both the integer and remainder part of dx/dy will fit in a byte.  Simply
  1719. adding one to dy makes life pretty easy at this end.
  1720.  
  1721. One very fast method of doing division is of course by using logarithms.
  1722. But they have a problem with accuracy.  One the other hand, one thing we
  1723. know how to do very quickly is multiplication.
  1724.  
  1725. This then is the plan: use logarithmic division to get an estimate for N,
  1726. the integer part.  Then calculate N*dy, compare with dx, and adjust the
  1727. integer part accordingly.                             
  1728.  
  1729. A quick reminder of how logarithms can be used for division:
  1730.  
  1731.    log(a/b) = log(a) - log(b)
  1732.    exp(log(x)) = x
  1733.  
  1734. thus
  1735.  
  1736.    a/b = exp(log(a)-log(b)).
  1737.  
  1738. How do we take the log of a 9-bit number?  We don't.  Instead, we
  1739. construct a table of f(x)=log(2*x), and use, not x, but x/2, as a
  1740. parameter.  Remember that the logarithms merely give an estimate to the
  1741. integer part.
  1742.  
  1743. Moreover, if the tables are constructed carefully we can insure that the
  1744. estimate for N is either exact or too small.  Thus we only need to check
  1745. for undershoots, which simplifies the calculation considerably.  In
  1746. particular, the tables were constructed as follows:
  1747.  
  1748.    10 DIM L1%(160), L2%(200), EX%(255): C=255/LOG(160)
  1749.    20 FOR I=1 TO 160
  1750.    30 L1%(I)=INT(C*LOG(I))
  1751.    40 NEXT
  1752.    50 FOR I=2 TO 200
  1753.    60 L2%(I)=INT(C*LOG(I/2)+0.5)
  1754.    70 NEXT
  1755.    80 FOR I=0 TO 255
  1756.    90 EX%(I)=INT(EXP(I/C))
  1757.    95 IF(I=129)OR(I=148)OR(I=153)OR(I=81)OR(I=98)THEN EX%(I)= EX%(I)-1
  1758.    100 NEXT
  1759.    110 L2%(3)=L2%(3)+1
  1760.  
  1761. The constant C is needed obviously to improve accuracy (log(160) simply
  1762. isn't a very large number).  Note that I divided the arguments of the
  1763. logarithms in half; instead of calculating 2*dx/dy I calculate dx/(dy/2),
  1764. which is of course the same thing.  This was done to make C work out.
  1765. By 'fixing' the tables in this manner, exactly 3927 calculations will
  1766. undershoot, which works out to about 6% of all possible calculations we
  1767. may perform.
  1768.  
  1769. The actual division routine works out pretty slick in assembly:
  1770.  
  1771.    DIVXY    MAC      ;Macro to compute 2*X/Y
  1772.             LDA LOG1,X  ;This is the division part
  1773.             SEC
  1774.             SBC LOG2,Y
  1775.             BCS CONT
  1776.             LDX #00     ;dx/dy < 1
  1777.             LDA ]1      ;LDA dx, since dx is exactly the remainder
  1778.             BCC L2
  1779.    CONT
  1780.             TAX
  1781.             LDA EXP,X
  1782.             TAX      ;X is now integer estimate
  1783.             STA MULT1
  1784.             EOR #$FF
  1785.             ADC #00     ;Carry is guaranteed set
  1786.             STA MULT2
  1787.             LDA ]1      ;ldxlo or rdxlo (i.e. low byte of dx)
  1788.             ADC (MULT2),Y
  1789.             SEC
  1790.             SBC (MULT1),Y  ;Calculate remainder
  1791.    L2       CMP ]2      ;ldy or rdy (i.e. ]2 = dy)
  1792.             BCC DONE
  1793.    L1       INX      ;Remainder is too large, so up int estimate
  1794.             SBC ]2      ;and subtract dy
  1795.             CMP ]2      ;Repeat until remainder<dy
  1796.             BCS L1
  1797.    DONE     <<<      ;Now X contains integer, A remainder
  1798.    
  1799. Do you see how it works?  First the initial guess N is calculated.  If
  1800. log(x) - log(y/2) is negative then dx/dy is less that one, so the
  1801. remainder is simply dx and the integer part is zero.  Otherwise,
  1802. R= dx - N*dy is calculated.  Since N always undershoots, dx-N*dy will
  1803. always be positive, so the high byte of dx isn't needed.  This quantity
  1804. R is the remainder, so if it is larger than dy simply increase the
  1805. integer estimate and subtract dy from R, and repeat if necessary.
  1806.  
  1807. The end result then is a 9-bit/8-bit divide which takes 52 cycles
  1808. in the best case.  Pretty neat, huh?  And quite adequate for our
  1809. purposes.
  1810.  
  1811. Wait just a minute there, bub... what about when dy=0?  Consider what
  1812. dy=0 means: it means that two vertices lie along the same line.  That in
  1813. turn means that the next vertex can be immediately skipped to.  That is,
  1814. simply move on to the next point in the list, be it to the right or to
  1815. the left, if dy=0.
  1816.  
  1817. Well, ah reckon that that just about completes the polygon fill routine.
  1818. To summarize: start at the bottom (top, whatever) of the polygon. 
  1819. Calculate the "slopes" of the right and left lines from that point.  
  1820. Update the coordinates, fill the in-between parts, and plot the 
  1821. end-sections.  Then update Y and keep going.  If another vertex is hit,
  1822. then recalculate the corresponding line.                       
  1823.  
  1824. Alert people may have noticed that this algorithm translates very nicely
  1825. to the 128's VDC chip.
  1826.  
  1827. I should probably briefly mention the pattern fills.  I use Y as an index
  1828. to a pattern table, so it was very natural to use 8x8 character patterns.
  1829. With different indexing of course more complicated patterns can be used.
  1830. Moreover, it dawned on me that animated patterns were just as easy as 
  1831. normal ones, so I tried to think up a few interesting animated patterns
  1832. (there are two in Polygonamy, each pattern is eight frames).
  1833.  
  1834. So that's the graphics part, more or less.
  1835.  
  1836. We ain't even CLOSE to being done yet.
  1837.  
  1838. @(A): 3D Code
  1839.       -------
  1840.       
  1841. Now it's FINALLY time to start writing the master program to control the
  1842. 3D world.  Luckily we have the BASIC program from waaaay up above to
  1843. work from.
  1844.  
  1845. First is to decide how angles will be measured.  The smart thing to do is
  1846. to let the angle variable vary between 0..127 or 0..255; that is, to
  1847. measure angles in units of 2*pi/128 (or 2*pi/256).  The reason this is
  1848. smart is because the angle is now periodic, wrapping around 256.  Angles
  1849. can be added together without checking for overflow, etc. (257=1, 258=2,
  1850. 259=3, etc.).  Note that in previous programs I did a very dumb thing
  1851. and let the angle variable vary from 0..119, so angles were measured in
  1852. three degree increments, and I had to place all sorts of checks into the
  1853. code.  Polygonamy uses angle increments of delta=2*pi/128.
  1854.  
  1855. Next there is the issue of cx=cx+20 instead of cx=cx+1.  The problem is
  1856. that if cx=cx+1 is used it takes forever to move around in the world.
  1857. Moreover, the objects get really small at around cx=5000.  What this
  1858. means is that in the assembly version we can use a single byte for cx,
  1859. and just treat each unit of cx as 20 "real world" units.  That is, in
  1860. the assembly program, we will keep track of cx/20 instead of cx.
  1861.  
  1862. Sort-of.
  1863.  
  1864. Consider the rotation which takes place when we turn left or right: the
  1865. world is rotated through an angle delta=2*pi/128, so the calculation is:
  1866.  
  1867.    blah= cdel*cx + sdel*cz.
  1868.    cz= -sdel*cx + cdel*cz
  1869.  
  1870. The problem is that sin(2*pi/128)=0.049 and cos(delta)=0.9988, which
  1871. means that, in practice, cdel*cx=cx.  Equally bad is that sdel*cz is very
  1872. small when cz starts to get small (e.g. 10*sdel = 0.49).  The result of
  1873. this is that objects close to the origin (e.g. us) will not be rotated at
  1874. all!
  1875.  
  1876. Thus the centers need to be calculated more accurately.  In particular, a
  1877. second byte is needed to store the 'decimal' part of the center.  To be
  1878. precise, this second byte will contain the decimal part of the center
  1879. times 256.  This way we can add and subtract remainders and any over- or
  1880. underflows will then affect the integer parts cx,cy,cz.
  1881.  
  1882. Very quickly we should decide how to represent remainders of negative
  1883. numbers.  A number like -1.5 can be represented as -1 - 0.5, but it can
  1884. just as well be represented as -2.0 + 0.5.  By using the second method
  1885. remainders are always positive, and that's the smart way to do things (if
  1886. nothing else it lets the remainder be a fraction of 256, instead of a
  1887. fraction of 128).  It's also the way any computer will round: type
  1888. INT(-1.5) and see what happens.
  1889.  
  1890. further question arises about how to represent the centers, specifically, 
  1891. how do we represent an object which is behind us, e.g. has a negative 
  1892. value for cx.  The normal way to represent negative numbers is of course 
  1893. to use 2's complement notation, but this has some disadvantages.  One of 
  1894. them is multiplication: recall that in an earlier code some really fancy 
  1895. footwork needed to be done just to be able to multiply numbers between 
  1896. -64..64, and we certainly want the centers to range over more numbers
  1897. than that.  This gets worse if we decide to use more bits to represent
  1898. the centers, as we must do if a larger world is constructed.
  1899.  
  1900. Moreover, Polygonamy is an excuse for testing new and different ideas and
  1901. investigating their strengths and limitations, so why not try something
  1902. different.  As I look through my notes I'm not really sure what motivated
  1903. this choice, but how about the following: let's add 128 to all of our
  1904. numbers.(I think this is called excess-128 notation).  -2 will be
  1905. represented as 126, -1 will be represented as 127, six will be
  1906. represented as 134, etc.
  1907.  
  1908. Shifting between the excess numbers and 'real' numbers is as simple as
  1909. EOR #128.  Recall that to multiply two numbers, let f(x)=x^2/4, so that
  1910. a*b = f(a+b) - f(a-b).  In the new system:
  1911.  
  1912.    xo = 128+x
  1913.    yo = 128+y
  1914.  
  1915. which means:
  1916.  
  1917.    xo+yo = 256 + (x+y)
  1918.    256+xo-yo = 256 + (x-y).
  1919.  
  1920. The 256 added above can be thought of as the carry bit.  What this means
  1921. is that all that is needed is to construct a single function,
  1922.   
  1923.    f(x) = (x-256)^2
  1924.  
  1925. where x=-255..255.  We can now very quickly multiply signed numbers in
  1926. the range -128..128, and with just a single (albeit 512 byte) table,
  1927. using essentially the same multiplication procedure as before.
  1928.  
  1929. Now the downside of this method: adding and subtracting excess-128
  1930. numbers, and in particular checking for overflow.
  1931.  
  1932.    xo+yo = 256 + (x+y)
  1933.    if x+y >= 128 then we have overflow
  1934.    if x+y < -128 then we have underflow
  1935.  
  1936. which implies:
  1937.  
  1938.    xo+yo >= 256+128  implies overflow
  1939.    xo+yo < 128   implies underflow
  1940.  
  1941. with similar results for subtraction.  Note also that after every
  1942. addition or subtraction 128 needs to be either added or subtracted from
  1943. the result, which either way corresponds to an EOR #$80.  So it's a
  1944. little more work to add numbers in this system.  (Of course, adding
  1945. normal numbers to excess-128 numbers is no problem, so INC and DEC work
  1946. fine).
  1947.  
  1948. Back to rotations.  The most obvious thing to do is to create two tables:
  1949.  
  1950.    f(x) = (x-128)*cos(delta) + 128
  1951.    g(x) = (x-128)*sin(delta) + 128
  1952.  
  1953. but remember that the remainders are also needed:
  1954.  
  1955.    fr(x) = 256*(remainder((x-128)*cos(delta)))
  1956.    gr(x) = 256*(remainder((x-128)*sin(delta)))
  1957.  
  1958. Since remainders are always positive none of this excess-128 junk is
  1959. needed.  Note that we could also let f(x) and g(x) be 2's-complement
  1960. tables, then convert from two's-complement into excess-128 after
  1961. performing additions etc.  The conversion is, what do you know, EOR #$80.
  1962. This is the smarter thing to do, and an even smarter thing to do is to
  1963. let the cosine table (f(x) above) to be in excess-128 format, and the
  1964. sine table g(x) in 2's complement.  This way the numbers can be added
  1965. as normal, and no conversion need take place:       
  1966.  
  1967. * Compare to BaSiC subroutine rotl: above
  1968.  
  1969.    ROTL
  1970.             INC THETA
  1971.             LDY #NUMOBJS   ;Y indexes the object
  1972.             DEY
  1973.    
  1974.    :LOOP    LDX CX,Y ;center coordinate
  1975.             LDA CDEL,X  ;CDEL = f(x) above
  1976.             LDX CZ,Y
  1977.             CLC
  1978.             ADC SDEL,X
  1979.             STA TEMP ;t1 = ci+si
  1980.             LDA CXREM,Y
  1981.             CLC
  1982.             ADC SDELREM,Y  ;Add remainders
  1983.             BCC :CONT1
  1984.             INC TEMP
  1985.             CLC
  1986.    :CONT1   LDX CX,Y
  1987.             ADC CDELREM,X
  1988.             BCC :CONT2
  1989.             INC TEMP
  1990.    :CONT2   STA CXREM,Y
  1991.    
  1992.             LDX CZ,Y
  1993.             LDA CDEL,X
  1994.             LDX CX,Y
  1995.             SEC
  1996.             SBC SDEL,X
  1997.             STA TEMP2   ;t2=cz-si
  1998.             LDA CZREM,Y
  1999.             SEC
  2000.             SBC SDELREM,X
  2001.             BCS :CONT3
  2002.             DEC TEMP2
  2003.    :CONT3   LDX CZ,Y
  2004.             CLC
  2005.             ADC CDELREM,X
  2006.             BCC :CONT4
  2007.             INC TEMP2
  2008.    :CONT4   STA CZREM,Y
  2009.             LDA TEMP2
  2010.             STA CZ,Y
  2011.             LDA TEMP
  2012.             STA CX,Y
  2013.             DEY
  2014.             BPL :LOOP
  2015.    
  2016. Well, that takes care of two lines of BASIC code :).  As it turns out,
  2017. using a single byte for the remainder does a pretty good job of holding
  2018. the number.  Rotating by 360 degrees one way, then rotating back again,
  2019. produces a center which is within a few decimal places of the starting
  2020. value.
  2021.  
  2022. Next up: projections.  The projection calcuation is:
  2023.  
  2024.    Proj(P) = d*(P+C)/(px+cx)
  2025.  
  2026. where P=(px,py,pz) and C=(cx,cy,cz).  In terms of the implementation, we
  2027. want to calculate:
  2028.  
  2029.    d*((P-128) + s*(C-128)) / ((px-128) + s*(cx-128))
  2030.  
  2031. where s=20, to translate C into the 'real world'.  To calculate this,
  2032. consider the following function:
  2033.  
  2034.    g(x) = r*d / (s*((px-128)/s + cx-128)) + 128
  2035.  
  2036. where r is some scaling factor.  The projection calculation then becomes:
  2037.  
  2038.    1/r*( (g-128)*(P-128) + s*(g-128)*(C-128) )
  2039.  
  2040. Thus we need some more tables, one of 1/(4r) * (256-x)^2, the other of 
  2041. s/(4r) * (256-x)^2, to do the multiplication.  Furthermore a table of 
  2042. (x-128)/s would be pretty handy, and finally we need a table of 
  2043. g(x) = r*d/(s*(x-128)) + 128.                                     
  2044.  
  2045. The general outline of a program would be:
  2046.  
  2047.    Get keypress
  2048.    1- If translate, then update all cx's (just some INCs and DECs)
  2049.    2- If rotate left or right, then rotate world
  2050.    3- Update angles for global & local rotation matrix (e.g. theta)
  2051.    4- Figure out which objects to display/construct a list
  2052.    5- Call each object in turn
  2053.    6- Update bitmap: clear out remaining garbage and swap bitmaps
  2054.  
  2055. Numbers 1 and 2 are done.  In number three, by global matrix I mean the
  2056. object rotation that results from us turning left or right.  By local
  2057. rotation I mean rotations independent of whether or not we turn.  The
  2058. local rotation allows e.g. the octahedron to spin around in Polygonamy.
  2059.  
  2060. Figuring out which objects to display is easy: just check to make sure it
  2061. lies within the viewing cone/pyramid, that we are not too close, etc.  If
  2062. an object is to be displayed, it needs to be placed in a list.  I
  2063. constructed the list to make sure that objects which are farther away are
  2064. drawn first; that way objects can overlap one another correctly.  This
  2065. was done via a simple insertion sort -- i.e. bump up objects in the list
  2066. until the right spot is reached to insert the object.
  2067.  
  2068. We have most of the tools to deal with #5.  Handling an object consists
  2069. of rotating and projecting it, then displaying it.  Rotation is the same
  2070. as it has always been, albeit now involving sixteen bits, and projection
  2071. is described above.  Then each polygon needs to be drawn, by sticking the
  2072. points of the polygon into the polygon list, setting up the fill pattern
  2073. and the pointer to the minimum Y-value, and calling the polygon fill
  2074. routine.  Of course, if the face is hidden then we certainly don't want
  2075. to plot it.
  2076.  
  2077. The minimum y-value can be found very easily while inserting the points
  2078. into the point list -- just keep track of ymax and compare to each point
  2079. as it is inserted.
  2080.  
  2081. We have discussed several methods of calculating hidden faces --
  2082. cross-product, rotated normal, parallel faces -- each of which involves
  2083. looking at a vector normal to the face, and either projecting it or
  2084. taking the dot product with a vector going to the origin.  What a big
  2085. pain in the butt, especially since values can be sixteen-bits, etc.
  2086.  
  2087. Did you ever stop to wonder about what happens to all the previous
  2088. polygon-fill calculations if the point-list is entered in reverse order?
  2089. Quite simply, left -> right and right -> left.  And what happens when a
  2090. face is invisible?  The polygon is turned away from our eye.  The points
  2091. in the polygon, which go counter-clockwise around the polygon, will go
  2092. clockwise when the polygon is turned around.  (I should point out that at
  2093. least in my code the points on the polygon are actually done in
  2094. clockwise-order, since projection reverses the points).
  2095.  
  2096. So, we have hidden-faces already built-in to the polygon plot routine!
  2097. In essence, we simply don't plot any polygon which the routine will freak
  2098. out on.  We can of course be systematic about this; within the plot
  2099. routine:
  2100.  
  2101.    - Calculate the left and right lines.
  2102.    - Take a trial step along the left and right lines
  2103.    - If xleft < xright then we are OK, otherwise punt.
  2104.  
  2105. In principle we only need to do this on the first calculation, and use
  2106. some properties of the lines to make things easier (for instance, if the
  2107. left line is moving left and the right line is moving right, and they
  2108. emanate from the same point, we know the polygon is visible).
  2109. Unfortunately, nasty situations can arise, for instance when the left and
  2110. right slopes have the same integer parts.  So a check needs to be placed
  2111. within the fill code to make sure the left point doesn't get ahead of the
  2112. right point.  This is unfortunate, as every cycle counts in the fill
  2113. code, but luckily there is (was) a natural place to put in a quick check.
  2114.  
  2115. All that is left then is #6: run through the fill table, and clear any
  2116. lines that still have old junk in them.  Since I used two bitmaps as a
  2117. double-buffer, all that is left is to swap the bitmaps, and do it all
  2118. again.
  2119.  
  2120. Et voila.
  2121.  
  2122. @(A): Analysis and Conclusions
  2123.       ------------------------
  2124.  
  2125. As you can see, the program is not without its flaws.  The biggest one,
  2126. I think, deals with the projection.  Recall that I calculate px/s, where
  2127. s=20, and add it to cx.  My feeling was that px was going to be very
  2128. small compared with cx, and so not modify the projection by much.  But
  2129. either this is a bad assumption, or the rotations are all screwed up,
  2130. because certain rotations look a bit goofy.  For instance, when you walk
  2131. up close to the octahedron it starts to get jumpy, or wobbly.  I note
  2132. further that when you are far away from an object it looks much better,
  2133. so that might be a way to fudge around the problem (e.g. make the value
  2134. of d in the projection much larger).
  2135.  
  2136. Speaking of rotations, the 'funky shake' which used to plague the old
  2137. programs has now been fixed.  For instance, a rotation in the y-direction
  2138. would work well but at some point it would appear to start rotating
  2139. backwards, then start going the right way again.  The problem was due to
  2140. an overflow in the calculation of the rotation matrix, in a term that
  2141. looked like(sin(t1) + sin(t2) - sin(t3) - sin(t4))/4, and the solution is
  2142. to split such terms into two, e.g. (sin(t1)+sin(t2))/4 - 
  2143. (sin(t3)+sin(t4))/4.
  2144.  
  2145. Speaking further of rotations, I find the current system of rotation and
  2146. projection unsatisfying, in particular too slow.  Notice how much the
  2147. program slows down when all three objects are visible; some 40 points
  2148. are being rotated, both locally and globally, at this point.  It is
  2149. possible to reduce the number of matrix multiplications from 9 to 8 (and
  2150. even lower, with lots of extra overhead), but I find this unsatisfying.
  2151. A better method is needed...
  2152.  
  2153. There is another bug somewhere in the global rotations which sometimes
  2154. causes the objects to wander around -- occasionally I can get the ship or
  2155. the octahedron to move close to the pyramid.  Also, when you are really
  2156. close to an object and turn, you might notice the curious effect of the
  2157. object rotating by small amounts, and then jumping position by a large
  2158. amount.  This is due to the 'units of 20' that are used in the program;
  2159. the remainder part of (cx,cy,cz) needs to be used here, and then the
  2160. display will be smooth as well.
  2161.  
  2162. Of course, if multicolor mode was used many of the calculations would be
  2163. much simpler, since the screen x-coordinate would only require one byte
  2164. instead of two.
  2165.  
  2166. The program should be made more efficient memory-wise of course.  Shoving
  2167. the fill routines for each buffer together would help out, and a system
  2168. for rotating points out of a list, similar to that used in the last 3D
  2169. program, would greatly streamline things (although it would be a tad
  2170. slower).
  2171.  
  2172. There is still a minor bug or two in the fill routine, which causes
  2173. little blue chunks to be taken off the ends of some polygons, but I
  2174. didn't feel like tracking it down.
  2175.  
  2176. Note that although Polygonamy only lets you run around in a plane,
  2177. running around in a full three dimensions is quite simple to add.  And,
  2178. although there are only three objects in the world, it is all set up to
  2179. deal with a lot more.  In summary, I see no major problems standing 
  2180. in the way of doing reasonably fast 3D graphics on the 64. 
  2181.  
  2182. The object file for this article is available in "Hacking the Code"
  2183. (Reference: code, SubRef: polycode) found elsewhere in this issue.
  2184.  
  2185. ============================================================================
  2186.  
  2187. @(#)usenet: UseNuggets
  2188.   
  2189. COMP.SYS.CBM:  The breeding ground of programmers and users alike.  Let's
  2190. see what topics are showing up this month:
  2191.  
  2192. @(A): What is the HECK is BCD?
  2193.    As most ML programmers know, the 65XX CPU line has a arithmetic mode
  2194.    called "decimal mode", and is used to manipulate Binary Coded Decimal
  2195.    numbers (BCD).  BCD numbers treat each nybble as a decimal digit. 
  2196.    Possibel values for a byte than ar $00 to $99.  Some fool asked on the
  2197.    group what earthly use BCD has on the 65XX CPU.  Well, among other things,
  2198.    Willem-Jan Monsuwe shared this tidbit:
  2199.    
  2200.       I recall someone asking what the use of BCD (Binary Coded 
  2201.       Decimal) was.  I have here a 99-byte program that uses it to 
  2202.       print out a number stored in the memory in decimal, with a 
  2203.       maximum of more than 10^500 digits, Within 5 seconds ;).  
  2204.       What's the use ??  Well, you can impress your friends by 
  2205.       calculating the answer to the chessboard-problem ( 2^64 
  2206.       - 1 or 0xFFFFFFFFFFFFFFFF ) within 0.06 of a second.  Oh, 
  2207.       and the maximum is pretty easy to overcome, with a slight 
  2208.       code change, if anyone needs numbers greater than, oh, 
  2209.       509 digits.. ;) 
  2210.                      
  2211.       *        = $1000
  2212.       
  2213.       SNUM     = $1100
  2214.       BUFF     = $1200
  2215.       
  2216.       PRINT    = $FFD2
  2217.       
  2218.       SNUMPTR  = $FB
  2219.       SNUMBF   = $FC
  2220.       BUFFEND  = $FD
  2221.       
  2222.                  LDA #0
  2223.                  TAX
  2224.       CLRBUFF    STA BUFF,X
  2225.                  INX
  2226.                  BNE CLRBUFF
  2227.                  SED
  2228.                  STA BUFFPTR
  2229.                  LDY #210
  2230.                  STY SNUMPTR
  2231.       BYTELOOP   LDA SNUM,Y
  2232.                  STA SNUMBF
  2233.                  LDY #8
  2234.       BITLOOP    ASL SNUMBF
  2235.                  LDX #0
  2236.       ADDLOOP    LDA BUFF,X
  2237.                  ADC BUFF,X
  2238.                  STA BUFF,X
  2239.                  INX
  2240.                  BCS ADDLOOP
  2241.                  CPX BUFFEND
  2242.                  BCC ADDLOOP
  2243.                  STX BUFFEND
  2244.                  DEY
  2245.                  BNE BITLOOP
  2246.                  DEC SNUMPTR
  2247.                  LDY SNUMPTR
  2248.                  CPY #$FF
  2249.                  BNE BYTELOOP
  2250.                  CLD
  2251.                  LDA #13
  2252.                  JSR PRINT
  2253.                  DEX
  2254.                  LDA BUFF,X
  2255.                  AND #$F0
  2256.                  BEQ LOWNYB
  2257.       PRINTLOOP  LDA BUFF,X
  2258.                  LSR
  2259.                  LSR
  2260.                  LSR
  2261.                  LSR
  2262.                  CLC
  2263.                  ADC #48
  2264.                  JSR PRINT
  2265.       LOWNYB     LDA BUFF,X
  2266.                  AND #$0F
  2267.                  CLC
  2268.                  ADC #48
  2269.                  JSR PRINT
  2270.                  DEX
  2271.                  CPX #$FF
  2272.                  BNE PRINTLOOP
  2273.  
  2274. @(A): Commodore's Can't Compute! (or can they?)
  2275.    OK, try the following on your beloved 128:
  2276.  
  2277.       print 23.13 - 22.87   hit RETURN
  2278.       
  2279.       Do you get .260000005?
  2280.       
  2281.    The resuling thread after this question was posed started to lean in the
  2282.    direction of attacking the arithmetic units of BASIC in the Commodore
  2283.    8-bit machines.  Then an eloquent post from Alan Jones 
  2284.    (alan.jones@qcs.org) started to set the record straight.  We can't
  2285.    express it any better than Alan:
  2286.    
  2287.       Recently, the C64/128 floating point arithmetic has been maligned
  2288.       here.  The C64/128 has good floating point math.  It uses 5 byte reals
  2289.       with a 4 byte (32 bit) mantissa.  There are no bugs in the basic FP
  2290.       arithmetic.  The reals ARE limited in range and precision.  They are
  2291.       more useful than compters using 32 bit reals, but not up to IEEE
  2292.       standard arithmetic.  IEEE FP arithmetic (double and extended
  2293.       precision...) would be much slower than our existing FP routines.  Of
  2294.       course it might be possible to interface a hardware FPU to the new
  2295.       Super64/128CPU (65816).
  2296.       
  2297.       The other C64/128 FP routines, such as SIN, EXP, and functions that use
  2298.       them are not accurate to full 32 bit FP precision.  When used with
  2299.       care, they are often accurate enough for engineering work.
  2300.       
  2301.       The most annoying inaccuracy may be the conversion between binary FP
  2302.       and decimal for I/O.  BASIC only prints 9 decimal digits of a FP
  2303.       number, but our binary FP number has about 9.6 decimal digits of
  2304.       precision.  What you see is not what you have!  Of course there are
  2305.       some simple tricks that you can use to print the FP number with more
  2306.       decimal precision, and you could do I/O using HEX notation.  If you
  2307.       save intermediate results for later use, make sure you write the FP
  2308.       values as binary rather than ASCII (converted to decimal).
  2309.       
  2310.       If you do accounting type stuff with dollars and cents, using binary FP
  2311.       with its limited precision and rounding can be anoying.  If your
  2312.       results are off one penny, all of your work will be suspect.  Our 6502
  2313.       family of CPUs also has decimal arithmetic.  It can do decimal
  2314.       arithmetic exactly, although you may have to program it yourself.  I
  2315.       think the Paperclip word Processor will do simple calculations with up
  2316.       to 40 decimal digits of precision.
  2317.       
  2318.       If you are using 64+ bit FP you can compute some things in a fast and
  2319.       sloppy manner.  Some programs that work OK on an IBM PC or workstation
  2320.       need more careful attention when coded for a C64/128.
  2321.       
  2322.       Some numbers can not be represented exactly in binary FP formats of any
  2323.       precision.  If you want to calculate:
  2324.       
  2325.         a:=(1/3)*(1/5)*(1/7)*(1/11)
  2326.       
  2327.       You should code it as:
  2328.  
  2329.         a:=1/(3*5*7*11)
  2330.       
  2331.       Aside from being faster, it is more accurate.
  2332.        
  2333.       There are many tips for preserving numerical accuracy in computations.
  2334.       There are often interesting tradoffs between computation speed, memory
  2335.       usage, and accuracy and stability.  There are even some C64/128
  2336.       specific tips.  (e.g. we usually store a real value in 5 bytes of
  2337.       memory but push it onto a stack as 6 bytes when we want to use it.)
  2338.       
  2339.       This is not intended to be a Commodore FP tutorial.  It is reminder
  2340.       that the C64/128 can be used for "heavy math", and there are no bugs
  2341.       in the Commodore +, -, *, /, Floating Point arithmetic routines.  It
  2342.       uses 32 binary bit mantisa FP reals with proper rounding.
  2343.       Simple examples can always be contrived to demonstrate a perceived FP
  2344.       bug by computer illiterates(?).
  2345.       
  2346.    Alan got his dig in at the end there.  That post, and others like it,
  2347.    pretty much squelched the arithmetic discussion.  But, as is usually the
  2348.    case, we all learned a neat trick along the way.  Peter Karlsson shared
  2349.    his easy way of determining whether his programs are running on a C64 or
  2350.    C128 by issueing the following statement:
  2351.  
  2352.       C=64+64*INT(.1+.9)
  2353.  
  2354.    Since the 64 and 128 differ ever so slightly in their arithmetic
  2355.    routines, the above line gives 64 on a C64 and 128 on a C128.
  2356.    
  2357. @(A): We need another OS!
  2358.    It all started when Benjamin Moos posted a message in the newsgroup
  2359.    mentioning that he had been off the net for a while but was returning 
  2360.    and wondered whether anyone would want him to finish work on a C++ based
  2361.    comiler for the GEOS 2.0 environment.  Of course, everyone was for that,
  2362.    but Moos continued on, asking if there was any interest in an alternate
  2363.    OS for the 64 or 128.  Moos mentioned that he had been also working on
  2364.    Common Graphic OPerating Environment (CGOE), and was thinking about
  2365.    finishing the project, which would provide a C= graphics character
  2366.    based graphic windowing system that would allow all 64 programs to run
  2367.    in the 128 80 column screen in 40 column windows.  
  2368.    
  2369.    Well, that brought out some friendly debate, to state the obvious. Part
  2370.    of the group posted words of encouragement, noting that we need to
  2371.    support those programming for the environment.  The other half of
  2372.    the camp echoed the words of Patrick Leung, who expressed concern that
  2373.    there are many programmers in the arena that are doing the same thing
  2374.    separately.  He encouraged programmers to consolidate features and code
  2375.    bases to arrive at robust full-featured programs instead of fragile bare-
  2376.    bones applications that single programmers can't support. ACE, Craig
  2377.    Bruce's UNIX-like OS detailed in earlier C=Hacking issues, was brought
  2378.    up by some, who asked that programmers heed Leung's advice and build
  2379.    modules for the already supported ACE environment.
  2380.    
  2381.    Perhaps J. Shell has the best idea, as he is planning to set up an
  2382.    interactive WWW site to allows programmers to work with him to build
  2383.    COMMIX System II (CX2).  The site will allow programmers to bring new
  2384.    ideas to the table and have them rapidly incorported into the design.
  2385.    We'll see if Mr. Shell can deliver on this neat idea.
  2386.    
  2387.    Going full circle, Benjamin Moos reponded to some of the posts, saying
  2388.    that the OS work was going to be placed on the shelf for now, as many
  2389.    had expressed interest in the C++ like compiler.  However, he did say 
  2390.    that work would begin again at a later date, but no decision was made
  2391.    as to how he will proceed.
  2392.    
  2393. @(A): The "More Power" Swiftlink
  2394.    Ever striving to squeeze the most performance out of his C128 system,
  2395.    Craig Bruce modified his Swiftlink and lived to tell about it in the
  2396.    newsgroup.. Basically, after researching the data sheets for the 6551
  2397.    ACIA IC used in the SL, Craig noted that Dr. Evil Labs (the original
  2398.    creators of the SL) had used a double speed crystal to up the 19,200
  2399.    bps maximum in the ACIA to 38,400 bps.  The IC claims that any baud
  2400.    rate up to 125,000bps can be achieved with the IC, given the correct
  2401.    crystal frequency.  Well, another feature of the 6551 is to use the 
  2402.    crystal frequency/16 as the bps rate, which is 230,400 bps or the 
  2403.    stock crystal.  Too fast for the IC.  However, by replacing the 
  2404.    crystal ( a 3.6864 MHz unit) with a 1.8432 MHz unit, the 1/16 speed
  2405.    becomes 115,200.  That speed, less than 125,000 bps, is the standard
  2406.    top frequency for IBM UARTs and is supported by most newer modems.  
  2407.    Craig verified that his 2MHz 128 can keep up with the extra data
  2408.    that his modofoed SL allows him to receive, but not always.  he
  2409.    claims that every once in a while, the systm gets choked up and 
  2410.    crashes, so he is working on solutions.  Understandably, one will need
  2411.    very tight terminal program code to keep up with this speed, but it
  2412.    will fit nicely with the SuperCPU.
  2413.    
  2414.    As with all things, there is a downside in that 19,200 becomes the
  2415.    next lower bps rate.  38,400 is gone forever.  Craig speculated that
  2416.    perhaps a switch could be installed, but wasn't sure of the effects.
  2417.    
  2418. @(A): The Eternal Problem
  2419.    Although this didn't receive much discussion, C=Hacking feels many users
  2420.    can relate. How many have ever went into the local CompUSA of local
  2421.    computer store and asked to look at modems, printers, or SCSI drives, 
  2422.    only to hear the dreaded laugh and chide that you should "buy a REAL
  2423.    computer", or watch the quizzical look of the sales person as they exclaim
  2424.    "You can't hook that up to a Commodore!"  We particularly enjoyed the
  2425.    ending to the lament that appeared in the newsgroup:
  2426.    
  2427.       When someone keeps an old car around, babies it, works on it,
  2428.       adds to it, drives it around in style, no one says "Look at 
  2429.       this dummy driving an out-dated gas guzzler that can't even do 
  2430.       80, and gets atrocious gas mileage.  The frame is archaic.  
  2431.       The windows aren't electric. Why doesn't he upgrade?".  Nah.. 
  2432.       they are 'enthusiasts of classic automobiles'.
  2433.  
  2434.       Well, ... we are "enthusiasts of a classic computer".
  2435.  
  2436. ============================================================================
  2437.  
  2438. @(#)fido: FIDO's Nuggets
  2439.  
  2440. The CBM and CBM-128 FIDONet echoes.  The place where Commodore users
  2441. unite.  Let's what things they discussed over the past month or two:
  2442.  
  2443. @(A): UNZIP 2 or not UNZIP 2?
  2444.    For a while now, Commodore users have been able to uncompress
  2445.    archives created with the popular PKZIP 1.01 compression program
  2446.    by PKWare or one of its clones.  Well, PKWare upped the ante and
  2447.    upgraded the PKZIP product to version 2, and that left a bunch of
  2448.    Commodore users compressed!  The easy solution is to ask all
  2449.    archive creators to not use version 2 of the ZIP product, but that
  2450.    presents a problem.  Most of the FIDONet crowd reads their mail 
  2451.    offline via popular programs like QWKIE 3.1 on the 64 or QWKRR128
  2452.    4.3 on the 128.  The programs work by retrieving a COMPRESSED
  2453.    packet of news and mail from a BBS.  Well, it turns out that BBS
  2454.    systems have migrated over to the new version of ZIP, and some
  2455.    refuse to offer ZIP version 1 as an optional compression method
  2456.    for retrieval packets.  So, the FIDONet crowd, including David
  2457.    Schmoll and others, have been working on or searching for a way
  2458.    to bring PKZIP 2 functionality to the 64.  Some thought it was a
  2459.    done deal when a FIDNetter contacted Info-Zip, the authors of a 
  2460.    free clone of PKZIP 2 by the same name.  They were told the source
  2461.    code was available.  The catch, it is written in C, and so far, 
  2462.    no compilation on the 64 or 128 has been successful.  
  2463.      
  2464. @(A): QWKIE v3.1 FREE!
  2465.    Many C64 users have delighted over the use of QWKIE v3.1 to read
  2466.    offline news and mail.  However, many had been unable to register
  2467.    the product.  The mystery was solved as of late a letter by the
  2468.    author was read that stated that he was ceasing support for the
  2469.    product and had placed it into the public domain.  As well,
  2470.    interested programmers could contact him about source code.  So,
  2471.    QWKIE FREE, a patched version of the program that is marked as
  2472.    registered, was uplodade to the many CBM BBS systems for users to
  2473.    enjoy.
  2474.  
  2475. @(A): That Darn Internet!
  2476.    As of late, many FIDONet regulars have been diappointed in the 
  2477.    trafiic flow on the CBM echoes.  They blame the growing
  2478.    popularity of the Internet as one reason the amount of messages
  2479.    has dwindled.  Almost immediately, reasons why FIDONet is still
  2480.    useful started popping up in the echoes.  Many claim that the
  2481.    Internet and FIDONet are complementary for the Commodore user, and
  2482.    that both resources are needed.  Others, however, stressed that
  2483.    FIDONet is still the most useful.  While C=Hacking isn't going
  2484.    to cast a vote here, we do hope that interest in the echoes stays
  2485.    high, as some only have access to FIDONet, and Commodore support
  2486.    should be on every network.
  2487.  
  2488. @(A): Let's Randomize
  2489.    Some soul on the echo was looking for a way to generate a random
  2490.    number from 2 to 350.  Well, always eager to help, many FIDONetters
  2491.    came to the rescue, with varying degrees of complexity.
  2492.  
  2493.    The first post, by Ken Waugh, included the text from one of
  2494.    Rick Kepharts WWW Site pages that explained, in two BASIC lines or
  2495.    less, how to create a set of 255 nonrepeating random numbers.                                  
  2496.  
  2497.    Then, ever the guru, George Hug, of 2400 bps on a 64 fame, described
  2498.    a method to find random numbers based on "linear maximal length
  2499.    shift registers", complete with 3 part article on the method.  Wow!
  2500.    needless to say, the method looks promising, but was probably more
  2501.    than what the original author was looking for.  Nonetheless, the
  2502.    treatise looks worthy of inclusion in an upcoming C=Hacking issue.
  2503.  
  2504. @(A): Catch the Wave!
  2505.    By now, most know that Maurice Randall, the author of GeoFAX, has been
  2506.    working on a GEOS telecommunications program that will operate at the
  2507.    14,400 bps or better mark.  It's been discussed in both USENET and
  2508.    FIDONet before, but Gaelyne Moranec reopened the discussion with a 
  2509.    statement that World Wide Web page viewing support might possibly
  2510.    be incoporated and under test.  Mr. Randall was hoping to add such
  2511.    support at some time, but it was unclear when.  It looks like sooner
  2512.    rather than later.
  2513.  
  2514. @(A): Who's First?
  2515.    Rod Gasson posed an interesting question on FIDONet a while back.  He
  2516.    asked which CPU was in control of the 128 when it is first powere up.
  2517.    The abvious answer of "the 8502" was given many times over, but Rod
  2518.    finally noted that it is, in fact, the Z-80 in the system that gains
  2519.    control of the system first.  Herman Yan supplied the relevant page 
  2520.    from the C128 Programmer's Reference Guide that explains the
  2521.    reasons.  If you want to know more, check out page 576 in the manual.
  2522.    
  2523. @(A): Desterm Confusion
  2524.    Many in the 128 arena use a telecommunications program called Desterm,
  2525.    by Matt Desmond.  At present, there are two versions of the shareware
  2526.    application out, 2.00 that works on all drives except the RAMLink, and
  2527.    2.01 that works with RAMLink, but has bugs not present in 2.00.  So,
  2528.    which to use?  That questions gets asked in verious forms in the echoes
  2529.    repeatedly.  That, coupled with the inability to find Mr. Desmond for
  2530.    a while, the supposed hand-over of the code to Steve Cuthbert, and the
  2531.    recent emergence of Matt (Reference: news) added to the confusion.  The
  2532.    current thinking is that Matt will be working on a new release of
  2533.    Desterm that will include CTS/RTS support (the present version only
  2534.    supports XON/XOFF flow control) and some bug fixes.  Somehow, the
  2535.    rumor that Matt will add Z-modem capabilities keeps pooping up, but
  2536.    Matt has denied any such work.  He merely doesn;t see a need, since
  2537.    add in modules can be created to do this.   
  2538.  
  2539. So, that gives you a glimpse into the world of FIDO, the wonder dog of
  2540. networks.  C=Hacking laments that their own FIDO feed has been
  2541. experiencing problems as of late, so we too may have missed some juicy
  2542. tidbits.  We'll catch them later on, though.
  2543.  
  2544. Here, boy....
  2545.  
  2546. =========================================================================
  2547.  
  2548. @(#)cmdcpu: Underneath the Hood of the SuperCPU
  2549.             by Jim Brain   
  2550.  
  2551. Does your mind go blank when you hear about the SuperCPU?  With all the
  2552. mention of it in magazines and newsletters, are you left wondering how
  2553. much of the discussion is hype and how much is true?  Are you worried
  2554. that this latest attempt is just another design destined for failure
  2555. like the others before it?  Well, if so, then you're not alone.  With 
  2556. the reputation accelerator cartridges and their manufacturers have 
  2557. acquired over the years, you are wise to be concerned.  Judge for
  2558. yourself, as we peer under the hood of the Creative Micro Designs
  2559. SuperCPU accelerator cartridges.
  2560.  
  2561. Note:  The information contained in this article has been gleaned from
  2562. talks with CMD, Mr. Charlie Christianson's post to comp.sys.cbm, 
  2563. responses to USENET posts by Mr. Doug Cotton, and information from Commodore
  2564. World Issue #12.  While general information is not likely to change, 
  2565. some details discussed in this article may differ slightly from those
  2566. incorporated in the final product.
  2567.  
  2568. @(A): What's An Accelerator?
  2569.  
  2570. Did you know a Commodore 64 CPU executes things at 1 MHz?  A tiny clock
  2571. inside the 64 ticks off 1 million "cycles" per second, and instructs
  2572. the CPU to move forward one cycle at a time.  The CPU, in turn, 
  2573. either executes an internal operation, reads from memory, or writes
  2574. to memory during that cycle.  These operations are concatenated to
  2575. form funtions, which is the smallest piece of work a programmer can
  2576. ask the CPU to perform.  These function are called instruction, and 
  2577. take an average of 3 cycles each to perform.  So, the typical C64
  2578. CPU does 333,333 things a second.  The C128 fares a bit better, as it
  2579. can run twice as fast when in "fast" mode.  In either case, there is
  2580. an upper bound on the amount of useful work each CPU can do in a
  2581. amount of time.  
  2582.  
  2583. An accelerator increases that amount of work done by substituting a 
  2584. faster CPU and clock speed for the 1 MHz 64 CPU.  The ratio of 
  2585. increase should be as easy to determine as dividing the new clock 
  2586. frequency by 1 MHz for a 64.  If this were true, an accelerator that 
  2587. runs at 4 Mhz would execute things at 4 times the speed of a stock 64.
  2588. Sadly, this is not true, since not all parts of the system can be sped
  2589. up to the higher frequency.  So, the accelerator runs at full speed while
  2590. it utilizes ICs designed for the faster clock speed, and slows down when
  2591. it must "talk" with ICs like the SID and VIC-II in the 64, which run only
  2592. at the slow 1 MHz clock speed.  
  2593.  
  2594. Most accelerators are produced as large cartridges that plug into the
  2595. expansion port of the computer system.  Some require special wires be
  2596. attached to internal components, while others do not.  
  2597.  
  2598. @(A) The New Kid on the Block
  2599.  
  2600. In mid 1995, Creative Micro Designs, after having evaluated the FLASH 8
  2601. accelerator from Europe with only mild success, noted that there might
  2602. possibly be a market for a speedy accelerator that would run GEOS and
  2603. other useful applications in the USA.  After surveying the readership
  2604. of Commodore World, the Internet, and FIDONet, CMD decided that interest
  2605. in such a unit was forthcoming.  Shortly thereafter, the SuperCPU
  2606. announcement was made.
  2607.  
  2608. As development work ensued, progress reports and preliminary information
  2609. about the product surfaced from CMD.  The first items involved the processor
  2610. choice, which was originally the 65C02S but is now its bigger brother, the
  2611. 16 bit 65C816S.  Another piece of information involved the case, which is
  2612. an enclosure 6" wide by 2" deep by 3" wide.  This enclosire contains
  2613. a circuit board protruding from the front of the unit that will plug into
  2614. the Commodore 64 or 128 expansion port.  In back, a complementary card
  2615. edge connector is provided to pass signals through the cartridge.  This
  2616. will allow users to attach other expansion port cartidges to the
  2617. system.  On top sit three switches, described below.
  2618.  
  2619. The first switch enables or disables the SuperCPU unit.  The second switch
  2620. enables or disables JiffyDOS, which is built into the unit.  The third
  2621. switch determines the speed of the unit.  This third switch has three
  2622. positions.  The first position forces the accelerator to operate at 1
  2623. MHz speed (the same speed as the stock C64).  The second position allows
  2624. the programmer to change the speed via a register in the SuperCPU memory
  2625. map.  The third position locks the SuperCPU into 20 MHz mode, regardless
  2626. of register settings.  
  2627.  
  2628. The use of the CMD SuperCPU will be straightforward.  Simply plug the
  2629. unit into the expansion port, set the appropriate switches on the top of
  2630. the unit, and powering on the unit.
  2631.  
  2632. @(A) Technical Details
  2633.  
  2634. The basic system utilizes a WDC W65C816S 16 bit microprocessor running at
  2635. 20 MHz.  This CPU can not only fully emulate a CMOS 6502, it can be
  2636. switched into "native" mode which allows access to 16 bit registers and
  2637. 16 megabytes of RAM without bank switching, DMA, or paging.  
  2638.  
  2639. Attached to the CPU is a bank of 64 kilobytes of Read Only Memory (ROM)
  2640. and 128 bilobytes of high speed static RAM (SRAM).  The extra RAM above
  2641. 64 kB is used to "mirror" the contents of the slower ROM.  See below for
  2642. details.
  2643.  
  2644. A number of features designed to maximize the performance of the 
  2645. SuperCPU are being developed into the unit.  Since the late 1980's 
  2646. ROM speeds have not been able to keep pace with CPU clock frequencies.
  2647. With the CMD accelerator moving into the frequency range of newer
  2648. PC systems, this becomes a problem for the SuperCPU as well.  The
  2649. Commodore typically stores its KERNAL and BASIC code in ROMS, and the
  2650. SuperCPU will need to read that code.  The easiest solution is to read
  2651. the stock ROMs in the computer, but those ICs can only be accessed
  2652. at 1 MHz (they are part of that set of older ICs that cannot be utilized
  2653. at 20 MHz).  So, the next option is to copy that code into faster ROMs
  2654. and instal those ROMs int the cartridge.  Well, as stated earlier,
  2655. ROMs of sufficient speed are very expensive and not widely available.  
  2656. So, the third option, which is the one CMD will use, is to copy the
  2657. KERNAL and BASIC at startup to RAM and write protect the RAM area, making
  2658. it look like ROM.  Fast static RAM (SRAM) is available to meet the
  2659. 20 MHz clock requirements, and is not terribly expensive, as most new
  2660. PC systems use the same memory for similar uses.  This technique is
  2661. called ROM shadowing and has been utilized for a few years in the IBM
  2662. PC community.  
  2663.  
  2664. The heart of the unit is the Altera Complex Programmable Logic Device
  2665. (CPLD).  Analogous to electonic "glue", this single chip can replace
  2666. ten or hundreds of discrete ICs in circuits.  This unit is responsible
  2667. for decoding the complex series of signals presented in the expansion
  2668. port, handling DMA requests to an REU unit, emulating the specialize
  2669. I/O port found at locations $00 and $01 on the 6510 CPU, and handling
  2670. the synchronization of the SuperCPU memory and C64 memory.
  2671.  
  2672. One item that has plagued accelerator designers for years and minimized
  2673. the widespread acceptance of accelerators invoves this RAM sync operation
  2674. the Altera CPLD handles.  In areas of the stock C64 memory map where 
  2675. only RAM is present, like $0002 - $40959, the synchronization of
  2676. memory can be handled very easily.  However, when dealing with areas
  2677. like $d000, where RAM AND IO can be present, the situation becomes more
  2678. complex.  The SuperCPU overcomes this problem as well, which is important
  2679. since many video applications use the RAM under IO at $d000 for graphics
  2680. or text.
  2681.  
  2682. As the VIC-II IC in the C64 and C128 requires that screen information be
  2683. present in on-board memory, memory "mirriring" is necessary.  However,
  2684. CMD has introduced two new technologies, called WriteSmart(tm) and
  2685. CacheWrite(tm) to reduce the slowdown associated with mirroring the
  2686. SuperCPU SRAM and the slower on-board DRAM.  According to documentation,
  2687. WriteSmart allows the programmer to decide which portions of memory need
  2688. mirroring.  The four selections include "BASIC", where only text and
  2689. color memory are mirrored, "GEOS", where GEOS foreground bitmap and color
  2690. memory are mirrored, "ALL", where all 64 kB of RAM is mirrored, and 
  2691. "NONE", where the SuperCPU does not attempt to syncronize memory contents
  2692. between the two RAM areas.
  2693.  
  2694. The other technology, called CacheWrite(tm), minimizes the effect of
  2695. this mirroring.  When storing a value into SuperCPU RAM in a range of
  2696. RAM that requires mirroring, the value is stored not only in SuperCPU
  2697. RAM, but also into a special cache memory location.  The SuperCPU is
  2698. allowed to continue processing, while the system waits for the on board
  2699. DRAM to acknowledge readiness to store a value.  When successive stores 
  2700. to mirror ranges are done, the system must slow down, but can still 
  2701. operate at about 4 MHz.  This speed is achieved because the SuperCPU need
  2702. not wait for the value to be successfully stored before it attempts to 
  2703. fetch the next opcode and operand.  Since opcodes that write value to
  2704. memory avarage 4 cycles to complete, the SuperCPU can effectively do 4
  2705. cycles worth of processing in 1 period of the 1 MHz clock.  Note that
  2706. this slowdown does not occur if the cache is not full when a store
  2707. instruction is executed.
  2708.  
  2709. @(A) Features
  2710.  
  2711. Being a CMD product, the CMD SuperCPU comes with JiffyDOS, CMD's
  2712. flagship speed enhancement routines, installed.  However, JiffyDOS
  2713. can be switched out for those applications that fail to run with this
  2714. serial bus enhancement functionality.
  2715.  
  2716. The unit also features compatibility with RAMLink, CMD's RAM drive unit.
  2717. As the RAMLink fucntions by sharing the CPU with the computer system and
  2718. runs a special set of instructions called RL-DOS, the SuperCPU contains its
  2719. own version of RL-DOS optimized to take advantage of the speed and extra
  2720. features available in the 65C816S.  Preliminary information suggests that
  2721. RAMLink data retrieval, typicially much slower the REU data retrieval,
  2722. will now operate at speeds approaching that of the REU.  In addition, the
  2723. on-baord RL-DOS will handle usage of the special parallel CMD HD drive
  2724. cable available with the RAMLink.
  2725.  
  2726. For those with expansion in mind, CMD has incorporated a special
  2727. expansion port internal to the unit.  The port, called the "Rocket
  2728. Socket", will allow access to the complete signal set from the W65C816S
  2729. CPU and possibly other support ICs.  This will allow developers to
  2730. produce peripheral cards for the unit containing hardware that will run 
  2731. at 20 MHz (The cartridge port will still be limited to slow speed).
  2732.  
  2733. @(A): Myths About the Unit
  2734.  
  2735. In the early phases of development, CMD hinted that possibly extra RAM
  2736. installed in the unit could be used as a fast RAM disk, a la RAMLink.
  2737. However, the inability to battery back up that RAM area, coupled with the 
  2738. small increase in speed gained form doing so and the lengthy development
  2739. time needed to realize this feature, has prompted CMD to abandon this 
  2740. idea for the time being.  Later in the development cycle, such an idea
  2741. might resurface, but the feature is most likely never to be implemented.
  2742.  
  2743. Also, early information about the units noted that two speed options would
  2744. be available, but low support for the slower 10 MHz model prompted CMD to
  2745. discontinue development on that version.  As of now, there is only one
  2746. speed option available: 20 MHz.
  2747.  
  2748. When CMD first announced the unit to the public, it was to include the
  2749. Western Design Center W65C02S microprocessor.  However, in late 1995/early
  2750. 1996, CMD opted to switch from that CPU to its bigger brother, the W65C816
  2751. 16 bit CPU, owing to small increase in per item cost, more flexibility, and
  2752. more expansion options.
  2753.  
  2754. Although the speed of the CPU in the SuperCPU unit is running at 20 MHz,
  2755. that does not imply all operations will occur twenty times faster.  Some
  2756. operations, like reads from I/O ICs, derial bus operation, and mirroring
  2757. of video memory, require the CPU to slow down temporarily.  This will
  2758. reduce the effective speed to about 17-18 MHz.
  2759.  
  2760. @(A): Compatibility Issues
  2761.  
  2762. All legal 6502/6510/8502 opcodes are supported in the accelerator.  
  2763. Undocumented or "illegal" opcodes are not supported and will fail.  
  2764.  
  2765. Although not a compatibility issue, some applications that rely on the
  2766. CPU running at a certain speed to correctly time events will most likely
  2767. fail or operate too quickly to be useful.  Event or interrupt driven
  2768. code should operate correctly.
  2769.  
  2770. The SuperCPU 64 model will operate correctly with any C64 or C64C model
  2771. of computer system, as well as with any C128 or C128D in 64 mode.  However,
  2772. CMD has recently announced a 128 native version of the cartridge.
  2773.  
  2774. @(A): Super128CPU
  2775.        
  2776. In early 1996, CMD announced that interest was compelling and that would 
  2777. begin development on a 128 version of the SuperCPU.  As a result of this
  2778. announcement, the ship date was moved from Februarty to April as CMD 
  2779. validated the SuperCPU design so that it could be used to manufacture 
  2780. both the SuperCPU 64 and SuperCPU 128.  Both units will operate at a 
  2781. maximum of 20 MHz, and will most likely be packaged in the same enclosure.
  2782. The SuperCPU 128 will operate in both 64 mode and native 128 mode.  It
  2783. will not enhance CP/M mode on the C128.  CMD announced that the
  2784. availability of this unit would be Auguest or September ot 1996.  As far
  2785. as cost is concerned, a current estimate falls at $300.00, and advance
  2786. orders are being taken with a security deposit of US$50.00 needed to
  2787. place an advance order.
  2788.  
  2789. As this announcement was made, some confusion has resulted in the naming
  2790. scheme.  Previously called the SuperCPU or SuperCPU 64/20 (64 model at
  2791. 20 MHz), the new models are referred to as alternately:
  2792.  
  2793. 128 model         64 model
  2794.  
  2795. Super128CPU       Super64CPU
  2796. SuperCPU 128/20   SuperCPU 64/20
  2797.  
  2798. @(A) Prototype Testing and Benchmarks
  2799.  
  2800. As no developer unit have shipped as of this date, CMD has the sole unit
  2801. availabel for be testing and benchmarks.  CMD's prototype unit consists
  2802. of a handwired unit on perfboard.  At first, CMD was hesitant that the
  2803. prototype would actually run at 20 MHz, since such designs are not
  2804. "clean" and can suffer from eignal degradation, signal skew, and 
  2805. crosstalk, which inhibits operation at higher frequencies.  So, with
  2806. that in mind, early tests were done at 4 MHz.  CMD reported in late
  2807. Fenbruary 1996 that the prototype had been ramped up to 20 MHz and was
  2808. operating correctly.  In fact, the unit appears to run faster than it
  2809. can, illustrated by the following example:
  2810.  
  2811. CMD tested the following program at 1 MHz on a Commodore 64
  2812.  
  2813. 10 TI$="000000"
  2814. 20 FORI=1TO10000:NEXT
  2815. 30 PRINTTI
  2816.  
  2817. The result from this test was 660.  After enabling the unit, the test was
  2818. rerun and the result printed out again: 31.    
  2819.  
  2820. Quick calculations by the CMD personnel verified that the unit was
  2821. executing this program 21.29 times the normal speed.  However, that
  2822. is impossible, as the CPU is only clocked 20 times the nortmal speed.
  2823.  
  2824. The supposed impossibility is explained if you delve deeper into the
  2825. timing of the 64.  As many know, the VIC-II "steals" cycles from the CPU
  2826. in order to refresh the VIC-II video screen.  Extra cycles are "stolen"
  2827. for sprites.  With the SuoperCPU disabled, the above code runs at 1 MHz
  2828. minus the amount of time the VIC-II "steals" from the CPU.  With the
  2829. SuperCPU enabled, the VIC-II does not "steal" cycles from the unit, as
  2830. the accelerator uses it own private memory area for operation.  The VIC,
  2831. meanwhile, uses the on-board C64 memory.  
  2832.  
  2833. CMD notes that games that use timers or are event driven function
  2834. correctly, but hotse that count processor cycles or utilize spin-wait
  2835. loops run so quickly as to be virtually unusable.
  2836.  
  2837. Of partiular note to Commodore Hacking readers is the test done with the
  2838. object code for the Polygonamy (Reference: polygon) article elsewhere in
  2839. this issue.  On a stock 64, the program renderes approximately 12-13
  2840. frames per second.  With the SuperCPU enabled, the frame rate jumped to 128
  2841. fps.  CMD notes that further gains might be realized if the code was
  2842. modified to cooperate more fully with the CupserCPU memory scheme.
  2843.  
  2844. As for Ram Expansion Unit compatibility, CMD responds that the issues
  2845. have been tackled and that DMA operation is available on the SuperCPU
  2846. unit.  In adiition, CMD notes that the CPU need not be running at 1 MHz
  2847. to initiate a DMA transfer.  
  2848.  
  2849. As stated from the beginning, the 64 model of the SuperCPU accelerator
  2850. wil work on the Commodore 128 in 64 mode, and test have confirmed that
  2851. the prototype 64 model does indeed frunction correctly any the C128 and
  2852. C128D.
  2853.  
  2854. @(A): Conclusion
  2855.  
  2856. While it is too early to determine the success of the CMD SuperCPU 
  2857. product, the company has a reputation for delivering stable products
  2858. packed with features.  While no accelerator can guarantee 100%
  2859. compatibility with all Commodore software, the CMD offering should provide
  2860. the best compatibility options thus far, due to its solutions to
  2861. RAM synchronization problems that have plagued accelerator designers for
  2862. years.  The fact that CMD also owns the marketing rights to the GEOS
  2863. family of software products and manufacturers a wide variety of
  2864. successful mass media storage devices bodes well for compatibility with
  2865. those applications and peripherals.
  2866.  
  2867. @(A): For More Information
  2868.  
  2869. TO find out more about the CMD SuperCPU family of accelerators, contact
  2870. CMD at the following address of via email:
  2871.  
  2872. Creative Micro Designs, Inc.
  2873. P.O. Box 646
  2874. East Longmeadow,  MA  01028-0646
  2875. (413) 525-0023  (Information)
  2876. (800) 638-3263  (Ordering only)
  2877. cmd.sales@the-spa.com  (Internet Contact for Sales)
  2878.  
  2879. Advance orders are being taken for all units, and the cost to place an
  2880. advance order is $50.00.
  2881.  
  2882. For programmers, CMD is planning to make available a Developer's Package,
  2883. which will help those wanting to exploit the potential of the new unit to
  2884. achieve success.  A W65C816S assembler supporting all the new opcodes and
  2885. addressing modes will be provided, as will documentation pertaining to the
  2886. unit, the CPU, and its capabilities.
  2887.  
  2888. =========================================================================
  2889.  
  2890. @(#)surf: Hack Surfing
  2891.   
  2892. For those who can access that great expanse of area called the World Wide
  2893. Web, here is some new places to visit that are of interest to the Commodore
  2894. community.  In early 1994, when the US Commodore WWW Site started, the number
  2895. of sites online that catered to Commodore numbered in the 10's.  Now, the
  2896. number is in the 100's.  What a change.
  2897.  
  2898. If you know of a site that is not listed here, please feel free to send it
  2899. to the magazine.  The following links have been gleaned from those recently
  2900. changed or added to the US Commodore WWW Site Links page 
  2901. (http://www.msen.com/~brain/cbmlinks/).  
  2902.  
  2903. To encourage these sites to strive to continually enhance their creations,
  2904. and because we like to gripe :-), we'll point out an improvements that 
  2905. could be made at each site. 
  2906.  
  2907. @(A): Companies
  2908.  
  2909. o  http://www.armory.com/~spectre/cwi.html
  2910.    Computer Workshops Incorporated.  CWI shows off their newest software
  2911.    offerings on this well-crafted WWW site.  The darkbackground provides
  2912.    for visual effects, and the content is good as well.  At the time we "hit"
  2913.    the page, CWI was working on a new game called Nether for the 64/128.  
  2914.    From the information, it looks like a 3D action adventure.  CWI offers
  2915.    both CBM and MS-DOS titles.  Some are shareware, while others are
  2916.    commercial.  C=Hacking gripe:  We don't mind the MS-DOS information, but 
  2917.    the diehard CBM user should be able to skip it.  As of now, it's all on
  2918.    the same page.
  2919.  
  2920. o  http://www.msen.com/~brain/guest/Gaelyne_Moranec/qwkrr/
  2921.    QWKRR128, by Rod Gasson.  Gaelyne Moranec, a supporter of QWKRR, presents
  2922.    this site for new and advanced users.  The site is devoted to QWKRR128, a
  2923.    QWK-based offline mail reading program for BBS and Internet use, and 
  2924.    Browser, a utility for reading large files on the 64/128.  The site
  2925.    is clean and simple, with no fancy graphics, but lots of meaty information.
  2926.    Links include the QWKRR128 user's manual, the actual product's binaries,
  2927.    and helper applications needed to use QWKRR128.  C=H gripe: It's hard to
  2928.    tell what all I need to read Internet email via QWKRR128.  
  2929.  
  2930. o  http://www.msen.com/~brain/guest/rms/
  2931.    RMS Computer Systems.  RMS offers up its line of services from this site,
  2932.    including software distribution, parts and accessories, and consulting/
  2933.    training.  RMS can even design your WWW pages.  The pages are colorful
  2934.    and clean, using either Microsoft Explorer or Netscape Navigator
  2935.    extension depending on the browser chosen off the home page.  RMS offers 
  2936.    the C-Net BBS software for sale and present information on the 64 and
  2937.    128 versions of the program.  C=H gripe:  The home page offers a choice
  2938.    of using Netscape of Microsoft Explorer.  What about the Lynx text mode
  2939.    browser?  Which do they pick?
  2940.  
  2941. @(A): Publications
  2942.    
  2943. o  http://www.the-spa.com/cmd/cwhome.html
  2944.    Commodore World.  CMD's publications is presented at this site, with 
  2945.    select articles, and information for potential writers and subscribers
  2946.    is detailed.  The site is laid out well and provides for easy reading.
  2947.    Of course, we're not sure it does justice to the magazine, but that's 
  2948.    true of LOADSTAR's home page as well.  C=H gripe: the site needs updating,
  2949.    as the change dates are 9-95.  When they do update it, we hope they'll
  2950.    remove that annoying "blink" tag!
  2951.    
  2952. @(A): User's Groups
  2953.  
  2954. o  http://www.ccn.cs.dal.ca/Technology/CUGNS/CBM.html
  2955.    Cnada Commodore Users Group of Nova Scotia.  The site makes use of
  2956.    color and grpahics to provide links to a number of Commodore content
  2957.    sites on the Internet.  It links up with other user groups on the 'Net,
  2958.    and provides a public download area for software retrieval. C=H gripe:
  2959.    We still think this is a user's group, but no meetings, minutes, 
  2960.    newsletters, or times and dates were mentioned.  Whare are they?
  2961.    
  2962. o  http://www.fastlane.net/homepages/msessums/64.html
  2963.    Metro C-64/128 User's Group.  Meeting dates, times, agendas, and some
  2964.    general information are provided on this page.  You can also learn about
  2965.    this groups parent organization, the Metroplex Commodore Computer Club.  
  2966.    C=H gripe: some newsletters from past meetings and a bit more about the 
  2967.    group would be nice.
  2968.    
  2969. o  http://www.inna.net/mpcug/mpcug.html
  2970.    The Middle Peninsula Computer Users Group.  Go here to find out just
  2971.    WHY the groups is named this way.  Meeting times, dates, places, past
  2972.    newsletter articles, and background information is provided.  The site
  2973.    has a sprinkle of color and graphcis to break up the text.  C=H gripe:
  2974.    It looks like the group is multi-platform, but no mention is made of
  2975.    what Commodore 8-bit owners will find at meetings.  Maybe we missed it.
  2976.    
  2977. @(A): Demo Groups
  2978.  
  2979. o  http://rphc1.physik.uni-regensburg.de/~pem03049/eqx/
  2980.    The EQUINOXE WWW Site.  This demo group puts on a good show, with
  2981.    content and color on their WWW site.  Here is where you can find 
  2982.    the announcement on the upcoming Shout! #2 magazine release.  The list
  2983.    of links is implressive as well.  C=H gripe:  The front page use of large
  2984.    fonts sizes is a bit overdone.
  2985.    
  2986. o  http://flash.lakeheadu.ca/~jgvotour/index.html
  2987.    The OMNI/Revenge WWW Site.  Color and content are mixed well on this 
  2988.    site as well.  A bit of history about Revenge is given, links to the
  2989.    demos to download is present, and information about upcoming releases
  2990.    is detailed.  C=H gripe: We'd like to know more about the person behind
  2991.    the well-done page.  
  2992.  
  2993. @(A): Miscellaneous
  2994.  
  2995. o  http://vanbc.wimsey.com/~danf/cbm/languages.html
  2996.    Dan Fandrich's Commodore Languages List.  Extensive doesn't really
  2997.    describe this page, which provides information on assemblers, compilers,
  2998.    cross-compilers, and interpreters for many different programming
  2999.    langauges supported by the Commodore 8-bit.  Rare items like language
  3000.    support for the 264 series and the SuperPET are described as well. 
  3001.    C=H gripe:  the page is HUGE.  Any chance of a breakdown into spearate
  3002.    files?
  3003.  
  3004. o  http://rrnet.com/~bfrandse/viccarts.html
  3005.    The Commodore VIC-20 Cartridge List.  Cartridges from many different
  3006.    software companies are detailed, and both games and utilities are listed.
  3007.    As with the Programming Language Page, this list is extensive.  It notes
  3008.    in the opening credits the trasnsitions the list has made to arrive at
  3009.    this current form.  C=H gripe: same as for the langauge list.  This thing
  3010.    is LARGE, and might benefit from a more heirachial listing treatment.
  3011.  
  3012. o  http://fox.nstn.ca/~ptiwana/john/webpage1.html
  3013.    John Elliot's WWW Site.  This page explores the use of Commodore computers
  3014.    and other "orphan" machines to better education by improving the student/
  3015.    computer ratio.  The information presented in this site is heartwarming,
  3016.    as it shows practical uses to dispel the myth that 8-bits are truly
  3017.    useless.  C=H gripe: Not really a gripe, but we sure would like to see more
  3018.    of these reall world examples.
  3019.  
  3020. o  http://www.ksk.sala.se/~sp93rob/dungeon/
  3021.    The Alternate Reality WWW Site.  For those wanting to relive the best of
  3022.    this game for the 64, visit this site.  Everything from tips to tricks,
  3023.    stories to confidential material, and screenshots are available at this
  3024.    site.  C=H gripe:  The color scheme is a bit rough on the eyes, but it
  3025.    does look neat.
  3026.  
  3027. o  http://www.lysator.liu.se/tolkien-games/c64.html
  3028.    Fredrik Ekman's Tolkien Games WWW Site.  The name says it all.  If
  3029.    you've ever played a Tolkien game, here is where they are listed and
  3030.    examined.  Fredrik give the history of each game, the solutions if there are
  3031.    any, and describes the game itself.  C=H gripe:  We left impressed with the
  3032.    information but wondering why someone would go to this effort.  Tell us, 
  3033.    Fredrik.
  3034.  
  3035. o  http://ubmail.ubalt.edu/~telliott/commodore.html
  3036.    Todd Elliott's Commodore 64/128 WWW Site. Todd provides some commentary
  3037.    and links to hardware hacks and ML tips.  Of particular interst is his
  3038.    introduction to the Commodore C64 and C128 computers, which explains
  3039.    some of the history behind the machines.  Our favorite passage in this
  3040.    page details his experisnces with Radio Shack.... C=H gripe:  We'd like 
  3041.    to know how Todd Elliott fits into the Commodore 8-bit arena.
  3042.    
  3043. @(A): Change of Address
  3044.  
  3045. o  CMD recently moved to http://www.the-spa.com/cmd/
  3046.    CMD heard our issue #11 gripe, as the home page now has links directly
  3047.    to the SuperCPU information.
  3048.  
  3049. o  LOADSTAR has moved to http://www.softdisk.com/comp/loadstar/
  3050.  
  3051. o  Marc-Jano Knopp's CBM WWW Site is at:
  3052.    http://www.student.informatik.th-darmstadt.de/~supermjk/c64.html
  3053.  
  3054. o  The US Commodore WWW Links Site has moved to:
  3055.    http://www.msen.com/~brain/cbmlinks/
  3056.  
  3057. ============================================================================
  3058.  
  3059. @(#)trivia: Commodore Trivia
  3060.             by Jim Brain (brain@mail.msen.com)
  3061.           
  3062. @(A): Introduction
  3063.  
  3064. I had the good fortune of receiving some fine back issue of magazine and
  3065. old books from a friend in Michigan (thanks Gaelyne), so I got busy reading
  3066. and gleaning.  The result is a new crop of trivia questions guaranteed to
  3067. rack your brain and have you reachin' for those numerous Commodore
  3068. publications.  Go ahead, I won't mind.  
  3069.  
  3070. As some may know, these questions are part of a contest held each month on
  3071. the Internet, in which the winner receives a donated prize.  I encourage
  3072. those who can received the newest editions of trivia to enter the contest.
  3073.  
  3074. This article contains the questions and answers for trivia editions #23-26,
  3075. with questions for the current contest, #27.
  3076.  
  3077. If you wish, you can subscribe to the trivia mailing list and receive the
  3078. newest editions of the trivia via Internet email.  To add your name to the
  3079. list, please mail a message:
  3080.    
  3081. To: brain@mail.msen.com
  3082. Subject: MAILSERV
  3083. Body:
  3084. subscribe trivia Firstname Lastname
  3085. help
  3086. quit
  3087.    
  3088. @(A): Trivia Questions
  3089.  
  3090.         A publication describing BASIC on the Commodore makes the claim that
  3091.         BASIC variables are limited to 5 characters, with the first two being
  3092.         significant.  The example to prove this point in the book is given as:
  3093.  
  3094.         ABCDE=5   works, while
  3095.         ABCDEF=6  does not.
  3096.  
  3097.         The following questions refer to this claim:
  3098.  
  3099. Q $160) What is wrong with the above statement?
  3100.  
  3101. A $160) Variables can indeed be longer than 5 characters.
  3102.  
  3103. Q $161) What causes the variable ABCDEF to fail?
  3104.  
  3105. A $161) The variable name fails becase the BASIC keyword "DEF" in it.
  3106.  
  3107. Q $162) How long can variable names really be?
  3108.  
  3109.         Extra Credit:  Who was the book publisher?
  3110.  
  3111. A $162) As long as the maximum command line length.  Theoretically, using
  3112.         automated code generation, you can get a variable name that is
  3113.         just shy of 255 characters in length.
  3114.         
  3115.         Oh, and Abacus wrote the offending book.
  3116.  
  3117.         The Commodore LCD Computer system, much like the Commodore 65,
  3118.         was a product that never reached the market.  Do you remember this
  3119.         pint-size CBM machine?
  3120.  
  3121. Q $163) How many keys were on the CLCD keyboard?
  3122.  
  3123. A $163) 72 keys, including 8 function keys and 4 separate cursor keys.
  3124.  
  3125. Q $164) What does LCD in the Commodore LCD stand for?
  3126.  
  3127. A $164) Liquid Crystal Display.
  3128.  
  3129. Q $165) Was an internal modem to be includes?
  3130.  
  3131. A $165) Yep, A 300 bps auto dial/auto answer modem.
  3132.  
  3133. Q $166) Like the Plus/4 the CLCD unit had integrated software.  What programs
  3134.         were included?
  3135.  
  3136. A $166) As referenced in $158, there are 8 integrated programs:
  3137.  
  3138.         Word Processor
  3139.         File Manager
  3140.         Spreadsheet
  3141.         Address Book
  3142.         Scheduler
  3143.         Calculator
  3144.         Memo Pad
  3145.         Telecommunications Package
  3146.  
  3147. Q $167) How many batteries of what type did the CLCD use for power?
  3148.  
  3149. A $167) 4 AA alkaline batteries.
  3150.  
  3151. Q $168) Approximately how much did the CLCD unit weigh?
  3152.  
  3153. A $168) 5 pounds.
  3154.  
  3155. Q $169) What version of BASIC was to be included with the CLCD computer?
  3156.  
  3157. A $169) 3.6.  It contained all of Basic 3.5 plus a few extras.
  3158.  
  3159. Q $16A) The CLCD unit contained a port that could be used with a 
  3160.         Hewlett-Packard device.  What did the device do?
  3161.  
  3162. A $16A) An HP bar code reader.  
  3163.  
  3164. Q $16B) What microprocessor did the CLCD unit utilize?
  3165.  
  3166. A $16B) The 65C102 CPU.  This CPU was built using the 65C02 core from
  3167.         Western Design Center, who licenses the popular 65C816S CPU
  3168.         as well.  CBM licensed this chip at little or no cost as a result 
  3169.         of a lawsuit settlement between WDC and CBM over 6502 architecture
  3170.         patent infringements.
  3171.  
  3172. Q $16C) In addition to the usual inclusion of standard Commodore ports,
  3173.         what two industry standard ports were included on the CLCD?
  3174.  
  3175. A $16C) Centronics Parallel (printer) port, and an EIA-232 (RS-232C) port.
  3176.  
  3177. Q $16D) How much RAM did the CLCD computer include?
  3178.  
  3179. A $16D) 32kB of battery backed RAM.
  3180.  
  3181. Q $16E) How many pixels are on the LCD screen on the CLCD machine?
  3182.  
  3183. A $16E) 480 x 128 or 61440 pixels
  3184.  
  3185. Q $16F) How much ROM did the CLCD computer contain?
  3186.  
  3187. A $16F) 96kB of ROM, which held the OS and the integrated programs.
  3188.  
  3189. Q $170) What text is displayed on the screen of a Commodore 128 upon
  3190.         bootup?
  3191.  
  3192. A $170) The following text is centered on either the 40 or 80 column
  3193.         screen:
  3194.  
  3195.         COMMODORE BASIC V7.0 122365 BYTES FREE
  3196.           (C)1985 COMMODORE ELECTRONICS, LTD.
  3197.                 (C)1977 MICROSOFT CORP.
  3198.                   ALL RIGHTS RESERVED
  3199.  
  3200. Q $171) How many bytes free does a Commodore 128 have on powerup?
  3201.  
  3202. A $171) As shown above in Q $170, 122365 bytes.
  3203.  
  3204. Q $172) On the Commodore B-128 series, the bell beeps at the right margin.
  3205.         What column is the default right margin on the B-128?
  3206.  
  3207. A $172) Column 70.
  3208.  
  3209. Q $173) When a Commodore C64 is hooked up to a 1541 and an MPS 801
  3210.         printer, everything is powered up and connected correctly, and
  3211.         the floppy won't load.  What is wrong?
  3212.  
  3213. A $173) The printer is offline.  Put the printer on-line, and the floppy
  3214.         will operate correctly.
  3215.  
  3216. Q $174) How do you access the "hidden message" in the C128DCR?
  3217.  
  3218. A $174) One brute force way:
  3219.  
  3220.         While in the machine language monitor, type:
  3221.        
  3222.           m f63f5 f640b
  3223.  
  3224. Q $175) Some of you may remember the Commodore Magic Voice cartridge.
  3225.         If so, how many words was in the base unit's vocabulary?
  3226.  
  3227. A $175) 235
  3228.  
  3229. Q $176) Who write the 3+1 software bundled with the Commodore
  3230.         Plus/4 in ROM.
  3231.         
  3232. A $176) Tri Micro wrote the code, and created a version for the C64.
  3233.         It turns out that the 3+1 software included with the Commodore
  3234.         Plus/4 was originally designed to be but one of the many choices
  3235.         for bundled software with the 264.  When the focus changed, 3+1
  3236.         became the only software bundled, and some assumed Commodore
  3237.         had written it.  (Ref. RUN April 1985:43)
  3238.  
  3239. Q $177) The BASIC extension "Simon's BASIC" was created by whom?
  3240.  
  3241. A $177) David Simons (Ref: Commodore Power/Play April/May 1985:56-7)
  3242.  
  3243. Q $178) Simons' BASIC was influenced a lot by what other computer
  3244.         manufacturer's BASIC?
  3245.  
  3246. A $178) Hewlett Packard.  (Commodore Power/Play April/May 1985:56)
  3247.  
  3248. Q $179) How many commands does Simons' BASIC add to the Commodore 64?
  3249.  
  3250. A $179) 114. (P/P Apr/May 1985:57)
  3251.  
  3252. Q $17A) In the United Kingdom, there was an extension to Simons' BASIC
  3253.         developed by David.  Among other things, what major complaint
  3254.         about the original BASIC extension does it address?
  3255.  
  3256. A $17A) Renumbering GOTOs and GOSUBs when renumbering a program.
  3257.  
  3258. Q $17B) In the Commodore Plus/4 File Manager, there exists two bugs, 
  3259.         which show up if you have over a certain number of records.  What
  3260.         is this magic number?
  3261.  
  3262. A $17B) When merging over 255 records in the Word Processor, a printout might
  3263.         stop early int the file and continually reprint a single record, or
  3264.         entering one record might trash another record. (RUN April 1985:43)
  3265.  
  3266. Q $17C) Commodore Semiconductor Group (CSG) manufactured an 8500 IC.
  3267.         What common IC number is this IC functionally equivalent to?
  3268.  
  3269. A $17C) The 6502.  The change in number owes more to a change in 
  3270.         manufacturing process than anything else.
  3271.  
  3272. Q $17D) How many BASIC commands were included in BASIC 3.5, not
  3273.         including the monitor commands?
  3274.  
  3275. A $17D) 80. (RUN November 1984:37)
  3276.  
  3277. Q $17E) On the Commodore VIC-20, 64, and C16 keyboards, what row and
  3278.         column pins on the keyboard connector does the letter D
  3279.         correspond to?
  3280.  
  3281. A $17E) Row 2 Column 2. (RUN July 1984:109)
  3282.  
  3283. Q $17F) What is special about the keys in Row 4 of the hardware keyboard
  3284.         matrix?
  3285.  
  3286. A $17F) Column 2-4 spell out CBM. (RUN July 84:109)
  3287.  
  3288. Q $180) Most people know what CPU is in a Commodore disk drive, but what
  3289.         CPU powers the venerable CBM 1525 printer?
  3290.  
  3291. A $180) You had better sit down.... The 1525 is powered by an Intel 8039
  3292.         8-bit microcontroller.  Actually, this isn't so hard to believe, 
  3293.         since Commodore didn't actually develop the printer, but used a
  3294.         Seikosha GP-100 printer mechanism for the unit, and most likely
  3295.         contracted Seikosha to develop the firmware.
  3296.  
  3297. Q $181) What is the maximum number of characters per line on a CBM 1520?
  3298.  
  3299. A $181) 80.  22 columns per inch times 3.63... inches of usable paper width.
  3300.  
  3301. Q $182) Commodore rarely manufactured its own printer mechanisms.  Who's
  3302.         mechanism did Commodore use in the DPS 1101?
  3303.  
  3304. A $182) The Juki 6100 printer mechanism.
  3305.  
  3306. Q $183) What is unique about the DPS 1101 printer?
  3307.  
  3308. A $183) It is daisy-wheel, but Commodore made other daisy-wheel printers. what
  3309.         makes it unique is that it is the only such serial daisy-wheel made 
  3310.         for the Commodore line.
  3311.  
  3312. Q $184) Which was the first Commodore modem with DTMF dialling capabilities?
  3313.  
  3314. A $184) The first to offer some kind of DTMF support was the Commodore 1660
  3315.         modem.  The modem itself didn't provide any DTMF support, but included
  3316.         a cable to allow the SID to output to the phone line.  Thus, with the
  3317.         SID's ability to reproduce DTMF tones, the modem could tone dial. 
  3318.         Note that this was only possible on the C64, which has a SID.  The
  3319.         first mode to INCORPORATE DTMF into the modem itself was the 1670.
  3320.  
  3321. Q $185) Which was the last Commodore 8-bit peripheral drive developed?
  3322.  
  3323. A $185) By develop, we are referring to actually produced models.  With that
  3324.         definition, the 1581 holds this title.  For models not actually
  3325.         produced, The prototype 1590-D-1 3.5" 1.44 MB model owned by Jack
  3326.         Vander White probably was the last under development.
  3327.  
  3328. Q $186) What is the maximum size of RAM available for use for program
  3329.         storage on an expanded VIC-20
  3330.  
  3331. A $186) 3583 bytes are available for BASIC programs and their variables.
  3332.  
  3333. Q $187) One of the most poular magazines for computers in the 1980's was
  3334.         COMPUTE!  What Commodore content magazine did it give birth to?
  3335.  
  3336. A $187) COMPUTE!'s Gazette. 
  3337.  
  3338. Q $188) In a strange twist of irony, COMPUTE! was itself descended from a
  3339.         Commodore content magazine.  Which one?
  3340.  
  3341. A $188) The PET Gazette.  The PET Gazette was started in April 1978 by Len
  3342.         Lindsey.  For the first year, the magazine was sent out for free to
  3343.         at times 4000 people.  In August of 1979, Small Systems Services, 
  3344.         headed by Robert Lock, purchased the magazine from Len and changed
  3345.         the name to COMPUTE.  The focus changed from PETs to all computer
  3346.         systems at that time.  The first issue of COMPUTE. appeared in the
  3347.         Fall of 1979.  It seems the relationship between Len Lindsay and 
  3348.         Robert Lock was less than ideal, but I refer readers to INFO #15,
  3349.         page 8 for the scoop.
  3350.  
  3351. Q $189) COMPUTE! underwent a name change very shortly after introduction.
  3352.         What subtle change was made to the name?
  3353.  
  3354. A $189) COMPUTE. changed to COMPUTE!  Notice the change?
  3355.  
  3356. Q $18A) How were LOADSTAR and Commodore Microcomputing-Power/Play once
  3357.         connected?
  3358.  
  3359. A $18A) In the mid 1980's, LOADSTAR distributed the type in programs for
  3360.         both magazines in the disk magazine.
  3361.  
  3362. Q $18B) What is the fastest Commodore ever clocked a 6502 or derivative
  3363.         CPU in a machine?
  3364.  
  3365. A $18B) The CSG65CE02 CPU, clocked at up to 3.54 MHz in the Commodore 65
  3366.         (64DX) prototype. 
  3367.  
  3368. Q $18C) Name one byte that yields the same character when printed and poked
  3369.         to a Commodore screen.
  3370.  
  3371. A $18C) Any byte between 32 and 63 will produce identical results.
  3372.  
  3373. Q $18D) Quick, which chr$ value flips to uppercase/lowercase mode?
  3374.  
  3375. A $18D) chr$(14)
  3376.  
  3377. Q $18E) Quicker, which chr$ value flips it back to uppercase/graphics?
  3378.  
  3379. A $18E) chr$(142)
  3380.  
  3381. Q $18F) How do you get INPUT to not display a question mark?
  3382.  
  3383. A $18F) open 1,0:input#0,a$
  3384.  
  3385. Q $190) In reference to Commodore, what does TOI stand for?
  3386.  
  3387. A $190) The Other Intellect.  Evidently, it was the computer the CBM
  3388.         engineers were working on before the VIC-20 project.  The name
  3389.         sounds like it was dreamed up after the fact.  In either case, this 
  3390.         machine might have been the "Color PET" mention in _The Home
  3391.         Computer Wars_ that Chuck Peddle was designing before company 
  3392.         shifted to the VIC architecture.
  3393.  
  3394. Q $191) Name two values that, when poked to the screen, will yield the
  3395.         identical character appearance.
  3396.  
  3397. A $191) 32 and 96 or 160 and 224.  Space and reverse space.
  3398.         103 and 106 or 101 and 116.  Left and right lines.
  3399.      
  3400. Q $192) What chr$ codes lock out and re enable the shift/commodore keyboard
  3401.         flip from uppercase to lowercase on the VIC-20?
  3402.  
  3403. A $192) chr$(8) and chr$(9), respectively.
  3404.      
  3405. Q $193) What chr$ codes lock out and re enable the shift/commodore keyboard
  3406.         flip from uppercase to lowercase on the C64?
  3407.  
  3408. A $193) chr$(8) and chr$(9), respectively.
  3409.      
  3410. Q $194) What chr$ codes lock out and re enable the shift/commodore keyboard
  3411.         flip from uppercase to lowercase on the C128?
  3412.  
  3413. A $194) chr$(11) and chr$(12), respectively, while in 128 mode.
  3414.      
  3415. Q $195) On CBM machines prior to the VIC-20, what chr$ code outputs the
  3416.         same character as chr$(44), the comma.
  3417.  
  3418. A $195) 108.
  3419.      
  3420. Q $196) Is the character described in $195 of any use?
  3421.  
  3422. A $196) To put commas in strings read via INPUT.  Remember, INPUT treats
  3423.         a comma (chr$(44)) as a delimiter between input fields, but chr$(108)
  3424.         does not produce the same effect, so you could replace 44 with 108 in
  3425.         data written to disk, and read it in with INPUT.
  3426.  
  3427. Q $197) The speed of Commmodore BASIC increased dramatically after the first
  3428.         OS upgrade in 1979.  Why?
  3429.  
  3430. A $197) Jim Butterfield supplies us the answer:
  3431.  
  3432.            "The original PET 2001 suffered from the same kind of "screen 
  3433.            sparkle" that was later seen in the early Commodore 64.  So 
  3434.            the original code would write to screen memory only during 
  3435.            the "refresh" period; that really slowed down the speed of 
  3436.            output to the screen.  By the time the first revised PET came 
  3437.            out, the screen sparkle was solved, and characters were 
  3438.            delivered to the screen with no wait. (The new operating 
  3439.            system also did a massive relocation of system variables, 
  3440.            and used zero page very heavily, to the dismay of home 
  3441.            programmers.  When asked about this, Commodore pointed 
  3442.            proudly at the "new, higher speed".  But in fact it was 
  3443.            the screen reorganization that caused 95% of the 
  3444.            improvement)."
  3445.                                           --Jim
  3446.         
  3447.         Related to this question is $00C, which implies that the
  3448.         "sparkle" problem was fixed in the original PETs, so some people
  3449.         increased the performance of the original PET by setting the RETRACE
  3450.         line mentioned above to an output, which fooled the system into 
  3451.         thinking the video was ALWAYS in RETRACE mode.  
  3452.  
  3453. Q $198) COMAL, a programming language available for Commodore computers, was
  3454.         created by whom?
  3455.  
  3456. A $198) Borge Christensen and Benedict Lofstedt, although Borge is given
  3457.         the most credit.
  3458.      
  3459. Q $199) At the 1980 COMDEX, Commodore PETs proved instrumental during a
  3460.         crisis.  What happened?
  3461.  
  3462. A $199) The following is excerpted from _The Whole PET Catalog_, page 21:
  3463.  
  3464.            "PET PROVEN USEFUL"  During the 1980 MGM Grand fire in Las 
  3465.            Vegas, Commodore moved its entire COMDEX '80 booth dowstairs 
  3466.            to help track rooms, guests, etc.  According to _InfoWorld_, 
  3467.            7 PETs with OZZ data-bases (predecessor to SILICON OFFICE)
  3468.            were used for two straight days.  Local police agreed they
  3469.            could not have kept of the guests as well as the PETs did.
  3470.            Also, untrained operators quickly learned the system.  In the
  3471.            crisis, PET was both powerful and useable.
  3472.  
  3473. Q $19A) Who designed the PET/CBM 8032 computer?
  3474.  
  3475. A $19A) Bill Seiler, the able assistant to Chuck Peddle, designed the unit.
  3476.      
  3477. Q $19B) What was the "cursor gone out to lunch" bug in the first PETs?
  3478.  
  3479. A $19B) No answer available yet (I can't find my notes!)
  3480.      
  3481. Q $19C) On a PET/CBM (early models), what will "POKE 14,1" do?
  3482.  
  3483. A $19C) If done immediately prior to an INPUT, the poke will suppress the
  3484.         question mark prompt.
  3485.  
  3486. Q $19D) What version of BASIC would not utilize disk drives?
  3487.     
  3488. A $19D) BASIC 1.0
  3489.      
  3490. Q $19E) Who is Lyman Duggan and why is he important?
  3491.  
  3492. A $19E) He is one of the founding fathers of the Toronto PET User's Group
  3493.         (TPUG), along with Jim Butterfield.
  3494.  
  3495. Q $19F) Jim Butterfield notes to me that he received plenty of help in
  3496.         creating the first PET memory map (Q $0D8) from the Sphinx group,
  3497.         who published critical information in their early newsletters.  How
  3498.         did Commodore influence the name of the group?
  3499.  
  3500. A $19F) The name "Sphinx" was chosen because of the way early PETs resembled
  3501.         the Great Sphinx, the Lion with the head of a pharoah.
  3502.  
  3503. Q $1A0) Commodore produced an assembler for the 128 called HCD65.  What
  3504.         does HCD stand for?
  3505.  
  3506. Q $1A1) Who wrote most of RAM DOS?
  3507.  
  3508. Q $1A2) What is the name of the first C64 disk copy program?  (hint: it
  3509.         sported a "gas gauge".)
  3510.  
  3511. Q $1A3) What was the case color of the original Commodore 64s?
  3512.  
  3513. Q $1A4) There are at least two ways to enter 64 mode from 128 mode on a C128:
  3514.         go 64 and sys 65357.  They produce the same result (64 mode), but
  3515.         they differ in at least one noticable way.  How?
  3516.  
  3517. Q $1A5) What CPU powers the B-128 computer system?
  3518.  
  3519. Q $1A6) What type of drive mechanisms are in the D series hard drives from
  3520.         Commodore? 
  3521.  
  3522. Q $1A7) Commodore produced a 16kB RAM expander for the Commodore VIC-20.
  3523.         What is its model number?
  3524.  
  3525. Q $1A8) Commodore produced at least one disk drive with an optical track
  3526.         one sensor.  Which drive?
  3527.  
  3528. Q $1A9) The Commodore PET series used the IEEE bus to communicate with
  3529.         peripherals.  Each peripheral had a unique ID.  What range of IDs
  3530.         are supported by the PET?
  3531.  
  3532. Q $1AA) Many people have developed Commodore software with the PAL assembler.
  3533.         What does PAL stand for?
  3534.  
  3535. Q $1AB) Many people remember Compute's Gazette.  This magazine is best known
  3536.         for the word processor program it shared with thousands of
  3537.         subscribers.  Name the program?
  3538.  
  3539. Q $1AC) In some 6502 assemblers, the opcode "bge" is available.  It stands 
  3540.         for "branch if greater than or equal to".  What more common opcode 
  3541.         is this opcode referring to?
  3542.  
  3543. Q $1AD) If I wanted to do a "blt" (branch if result less than), what 6502 
  3544.         opcode would i use?
  3545.  
  3546. Q $1AE) Each Commodore peripheral has a device number, which is associated
  3547.         with a type of device.  8-15 implied disk drive, 4-5 implies
  3548.         printer.  These have remained constant from the PET to the C128.
  3549.         However, one peripheral in the PET was phased out and its device
  3550.         number was reused.  What device number was reused?
  3551.  
  3552. Q $1AF) What is the maximum amount of general purpose RAM can one utilize
  3553.         in a stock C64?  (I need an exact number here)
  3554.  
  3555. =========================================================================
  3556.  
  3557. @(#)gfx: Talking to TED: The MOS 7360/8360 Text Display ICs
  3558.          by Harsfalvi Levente (TLC@MSZI.PMMF.HU)
  3559.  
  3560. @(A): Introduction
  3561.  
  3562. This information file is based on my old books, descriptions, and especially
  3563. my experiences while I was coding.  That's no mistake.  The Plus/4 series
  3564. was not very famous in the world, but they were very poular in mideast
  3565. Europe.  In fact, there were even demo groups for the machine.  I learned
  3566. some of this information while writing demos for the machine in demo groups,
  3567. while other things were gleaned from personal work on the machine.  These
  3568. computers did indeed play an important part in Commodore computer history.
  3569.  
  3570. I started my first code development on a Plus/4 in late 1986.  After I saw a
  3571. HomeLab 3 (made in Hungary, U880 - GDR made Z80 compatible proc, B/W, 16K),
  3572. I started writing demos and other software for the Plus/4 machine I owned. 
  3573. It actually wasn't that strange to see demo groups sprout up for all 
  3574. kinds of machines, including the Plus/4.  All over, there were groups
  3575. and individuals, writing software while trying to keep the flame lit for
  3576. each machine.  In fact, I know people currently working in groups writing
  3577. for the Plus/4 in Hungary, Germany, and as far away as Alaska.
  3578.  
  3579. @(A): Overview
  3580.  
  3581. Let's discuss the TExt Editor (TED) IC and its environment. This DIL-48 IC
  3582. was designed specifically for the 264 series of machines, which initially
  3583. included the CV364 and the 264, evolving into the Plus/4, C16, and C116 
  3584. machines.  Unlike the CIA or ACIA or other machines, this IC isn't well 
  3585. suited to any other system.
  3586.         
  3587. The TED contains all functions done by several chips in former Commodore 
  3588. computers. The TED is a complete video-interface and composite video
  3589. signal generator, sound generator, keyboard input latch, timer, 
  3590. clock generator, memory manager and DRAM refresher in a single IC.  It can
  3591. address the full memory map of the 264 series machines, and it generates
  3592. the RAS', CAS', and MUX signals for the DRAM memory used in that series.
  3593. For ROM, it generates the chip select (CS) lines, depending on the state
  3594. of the internal registers.  So, in addition to all the above duties, the
  3595. TED IC is a simplistic MMU as well.
  3596.  
  3597. @(A): Video Information
  3598.  
  3599. We see the TED chip shine as it does its primary job, displaying graphics.
  3600. Its abilities mostly parallel those of the uniquitous VIC-II video IC in the
  3601. C64.  It has the following modes:
  3602.  
  3603. *  40x25 screen (characters)
  3604. *  enhanced color mode
  3605. *  multicolor mode
  3606. *  320x200 Hi-Res Graphics
  3607. *  160x200 Multicolor Graphics
  3608.  
  3609. Of course, there are differences.  TED does not contain sprite support.
  3610.  
  3611. To offset this omission, the TED chip can select 8 intensities for each of
  3612. the 16 supported colors, giving 121 colors (the 8 shades of black are all
  3613. black).  Other features include a hardware cursor, hardware text blinking,
  3614. and hardware inverse character support.  Character sets, screen and color
  3615. memory, and graphics bitplanes can be addressed directly, without additional
  3616. logic as found on the C64.  In fact, even RAM/ROM selection requires change
  3617. of a single bit.
  3618.  
  3619. Character modes need $800 bytes of RAM for screen and color memory. The
  3620. first $400 bytes act as color memory (the memory permanently located at 
  3621. $d800 on the C64), with the lower 4 bits containing color codes, exactly
  3622. as found on the 64.  Bits 4-6 denote the intensity level of the color, while
  3623. the high bit select flashing/no-flashing attributes. The other $400 bytes 
  3624. contain the screen codes for the displayed characters.  If hardware
  3625. character inversion is selected, the lower 7 bits hold the screen code and
  3626. the high bit selects inversion for the character.  If character inversion
  3627. is not selected, all 8 bits denote the screen code. Extended Color Mode (ECM)
  3628. and Multi Color Mode (MCM) modes work exactly as described on the 64.  While
  3629. these two modes are in effect, inversion and blinking are disabled.  
  3630.  
  3631. Things get a bit more complex in graphics mode (pun unintentional).  In
  3632. graphcis mode, the bitplane occupies $2000 bytes and is handled just like a
  3633. VIC-II biplane.  The colors are handled differently.  $800 bytes are needed
  3634. for color memory, which is laid out in $400 bytes of intensity memory
  3635. and $400 bytes of color memory.  An "off" bit in the bitplane uses the 
  3636. lowest nybble of the appropriate color memory location as the color and
  3637. retreieves the intensity from bits 4-6 of the appropriate intensity memory
  3638. location.  For an "on" bit, the color is taken from the high nybble of the
  3639. appropriate color memory location, while the intensity is taken from bits 
  3640. 0-2 of the intensity memory location.  Bits 3 and 7 in intensity memory are
  3641. unused.
  3642.  
  3643. In multicolor mode, differences abound.  The 64's VIC-II enabled one to 
  3644. utilize 3 different colors in each 8x8 cell and a single background.  The
  3645. TED simply cannot accomplish this due to the lack of adequate color memory.
  3646. So, TED allows only 2 varying colors per 8x8 cell. Those colors are chosen
  3647. from the palette of 121.  The remaining 2 colors are chosen for the
  3648. entire screen, again from the 121 color palette.  The mapping is as 
  3649. follows:
  3650.  
  3651.    00   background color
  3652.    01   same as "off" color in hires mode
  3653.    10   same as "on" color in hires mode
  3654.    11   another "background" color
  3655.    
  3656. The TED IC is able to generate both PAL and NTSC compatible signals from
  3657. a single IC.  Only the crystal need be changed to go from one standard to
  3658. the other.  In PAL mode, there are 312 lines hown, while NTSC only has 262
  3659. lines of display.  The line synchronization is the same in either PAL or 
  3660. NTSC mode.  It's always 57 clock cycles per rasterline.  The TED divides 
  3661. the supplied crystal frequency by 20 for PAL display and by 16 for NTSC.  
  3662.  
  3663. For the serious video programmer, raster interrupts are implemented as on the
  3664. VIC-II.  However, the 0 line of the register corresponds to the first line
  3665. of the character screen area, not the top of the border.  In addition, the
  3666. current raster line can be read from TED registers.  you can modify the
  3667. counter as well.  Doing so will most likely affect the screen display.  As
  3668. a bonus, the horizontal location of the raster can be read and modified in
  3669. the same way.  Unfortunately, these registers provide the basis for most
  3670. effects, as the TED can't handle sprites.
  3671.  
  3672. @(A): Running The Show
  3673.  
  3674. As earlier mentioned, the TED IC does more than produce graphics.  One of
  3675. its tasks involves generating the clock signal for the 7501/8501 
  3676. microprocessor.  The clock is not constant, as it switches from from
  3677. 885 kHz and twice that speed, 1.773 Mhz.  The speed depends on TED's current
  3678. task.  It generates the slower clock signal when refreshing DRAM or fetching
  3679. data for the video screen.  Otherwise, the high clock signal is generated.
  3680. The user can disable fast clock generation via a register.  The end result
  3681. is a machine that operates at approximately 1 MHz, as the CPU runs in slow
  3682. mode while the screen is displayed, and operates in fast mode when the
  3683. TED starts drawing the top and bottom borders.
  3684.  
  3685. @(A): Sound Advice
  3686.  
  3687. As far as a sound device is concerned, the TED doesn't stack up to the
  3688. SID in the 64.  Just 2 squarewave generators, of which the second can be 
  3689. switched to generate white-noise, are available for sound generation. 
  3690. Volume control is available in 8 levels.  
  3691.  
  3692. To play samples, the TED can switch the sound generators to constant level
  3693. outputs.  D/A is then done by changing the volume register setting.  Each
  3694. generator can generate frequencies from 100Hz to 23kHz.  
  3695.  
  3696. @(A): Other features
  3697.  
  3698. The timers available in the TED appear to be nothing more than 16
  3699. bit decrementing timers.  They are always clocked with the slow clock.  
  3700. The first timer reloads its starting value when it reaches 0, the other 2
  3701. are free-running.   
  3702.  
  3703. Since it already does almost everything else, it's not unusual to notice
  3704. the TED handles the keyboard matrix.  A simple 8-bit imput latch handles
  3705. keyboard interfacing.  
  3706.  
  3707. As noted above, a single bit in the register space will page ROM or
  3708. RAM into the upper 32kB of the address map.  Since the TED knows what is
  3709. paged in at all times, it knows what to output to access the memory
  3710. locations in this area.
  3711.  
  3712. @(A): Conclusion
  3713.  
  3714. Well, that about wraps up the TED IC.  All that is left is a map of the
  3715. registers.  Assume all registers are read/write unless noted otherwise.
  3716. If you have questions, I cna be reached at the Internet address listed above
  3717. or at:
  3718.  
  3719. Harsfalvi Levente
  3720. 7200 Dombovar
  3721. Gorkij 33.
  3722. Hungary
  3723.          
  3724. By the way, catch FLI ED. V1.0; Its info file may contain some more about
  3725. TED's screen-handling. It may be retrieved as 
  3726. ftp://ftp.funet.fi/pub/cbm/plus4/tlc/cns.lzh
  3727.  
  3728. @(A): Register Map
  3729.  
  3730. Register      Description
  3731. --------      -----------
  3732. $ff00- $ff01: Counter #01. It always starts to decrement from the last
  3733.               written value into it.
  3734. $ff02- $ff03: Counter #02. It runs freely from $ffff.
  3735. $ff04- $ff05: Counter #03. Same as above.
  3736. $ff06       : Mostly the same as VIC's $d011.
  3737.               Bit 0,1,2 : Vertical smooth-scrolling
  3738.               Bit 3     : 24/25 rows screen
  3739.               Bit 4     : Blank screen
  3740.               Bit 5     : Bitplane mode
  3741.               Bit 6     : Enhanced color mode
  3742.               Bit 7     : TED's internal test, it should be 0.
  3743. $ff07       : Most similar VIC-reg is $d016.
  3744.               Bit 0,1,2 : Horizontal smooth-scrolling
  3745.               Bit 3     : 40/38 columns screen
  3746.               Bit 4     : Multicolor mode
  3747.               Bit 5     : TED stop. If set, the TED stops it's counters and
  3748.                           screen-generating, only single clock and refresh
  3749.                           cycles remain.
  3750.               Bit 6     : PAL/NTSC. 0:PAL, 1:NTSC
  3751.               Bit 7     : Disable reverse mode. If 0, we got 128 characters
  3752.                           and higmost bit tells if the character should
  3753.                           appear in inverse. If set, no inverse mode but
  3754.                           256 characters.
  3755. $ff08       : Keyboard input latch. Giving a strobe - writing to the register,
  3756.               the latch stores the values of the input-lines. Then, we
  3757.               can read them from this register.
  3758. $ff09       : Interrupt request register. When a counter sends want to send
  3759.               an IRQ, it's bit will appear as a 0; then, if the IRQ was
  3760.               caused then highmost bit is set.
  3761.               Bit 0     : Unused
  3762.               Bit 1     : Raster-counter
  3763.               Bit 2     : Lightpen. Not implemented.
  3764.               Bit 3     : Counter #1
  3765.               Bit 4     : Counter #2
  3766.               Bit 5     : Unused
  3767.               Bit 6     : Counter #3
  3768.               Bit 7     : Interrupt occured. This bit is set when an IRQ
  3769.                           was enabled and therefore, the IRQ was sent to the
  3770.                           processor. Physically, this is the negated level of
  3771.                           the TED's IRQ output. The IRQ should be deleted
  3772.                           with writing the register-value back after
  3773.                           accepting an interrupt.
  3774. $ff0a       : Interrupt mask register. These bits could be used to disable and
  3775.               enable interrupt-sources. When a place is set to 1, that will
  3776.               be able to cause an interrupt to the processor. If not, the sign
  3777.               of the interrupt request will only be appear in the above
  3778.               register.
  3779.               Bit 0     : 9th bit of $ff0b (see there)
  3780.               Bit 1     : Raster-counter
  3781.               Bit 2     : Lightpen. Not implemented.
  3782.               Bit 3     : Counter #1
  3783.               Bit 4     : Counter #2
  3784.               Bit 5     : Unused
  3785.               Bit 6     : Counter #3
  3786.               Bit 7     : Unused
  3787. $ff0b       : Raster interrupt register. Same as $d012 when writing; it stores
  3788.               the position of occuring raster interrupt. Higmost bit is in
  3789.               $ff0a's 0. bit.
  3790. $ff0c,$ff0d : Hardware-cursor position (10 bits). Lower bits: $ff0d, higher
  3791.               2 bits in $ff0c's 0. and 1. places. Beyond 1000 the cursor is
  3792.               not seeable.
  3793. $ff0e       : This reg is the first sound-source's frq-value's lowmost 8 bit.
  3794.               More 2 bits are in $ff10's 0. and 1. places.
  3795. $ff0f       : 2nd. source, lowmost 8 bits. More 2 bits in $ff12, 0. and 1.
  3796.               places.
  3797.               The soundregister-value can be calculated as
  3798.                 reg=1024-(111860.781/frq[Hz]) (NTSC)
  3799.                 reg=1024-(111840.45 /frq[Hz]) (PAL)
  3800. $ff10       : 1st. sound-source, higmost 2 bits. 2-7 bits are unused.
  3801. $ff11       : Sound control register.
  3802.               Bit 0-3   : Volume. Maximum value is 8.
  3803.               Bit 4     : Sound #1 on/off.
  3804.               Bit 5     : Sound #2 squarewave on/off.
  3805.               Bit 6     : Sound #2 noise on/off. If You set both, the square
  3806.                           will sound.
  3807.               Bit 7     : D/A mode. See above for more.
  3808. $ff12       : Bit 0,1   : 2nd sound-source, highmost bits.
  3809.               Bit 2     : Character generator in ROM or RAM. When set, TED
  3810.                           will enable ROM when trying to get data from the
  3811.                           charactergenerator to build screen. Else, it will
  3812.                           give out control-signals to the DRAM's.
  3813.               Bit 3,4,5 : These bits tell, where to find bitplane in the
  3814.                           memory when using bitplane-mode. TED assumes them
  3815.                           as A15,A14 and A13 bits. So, the bitplanes can be
  3816.                           switched as 8K pages, anywhere in the 64K.
  3817.               Bit 6-7   : Unused.
  3818. $ff13         Bit 0     : A sign to having control about memory paging. This
  3819.                           bit always sets to 1 when ROM is active over $8000.
  3820.                           Else, it will be 0. READ ONLY.
  3821.               Bit 1     : Force single clock mode. Then, TED will disable to
  3822.                           generate twiee clock.
  3823.               Bit 2-7   : Charactergenerator. Bit 7 corresponds to A15, 6 to
  3824.                           A14 and so on. This value shows and sets the start
  3825.                           of the charactergenerator. It can be paged as $400
  3826.                           bytes. Use with addition of $ff12-2.bit.
  3827. $ff14         Bit 0-2   : Unused
  3828.               Bit 3-7   : Start of the video-ram. Bit 7 also corresponds to
  3829.                           the A15 line as above. So, video-ram is mappable
  3830.                           as $800 bytes - 2K. The above $ff12-2.bit doesn't
  3831.                           affect this, but the actual RAM/ROM mapping (see at
  3832.                           $ff3e/$ff3f and $ff13/0) does.
  3833. $ff15       : Background. Lower bits contain color-code, higher 3 luminance
  3834.               and higmost is ignored.
  3835. $ff16       : Color-reg 1
  3836. $ff17       : Color-reg 2
  3837. $ff18       : Color reg 3. This and the above are used in ECM and MCM modes.
  3838. $ff19       : Border. All color registers use codes as described in $ff15.
  3839. $ff1a       : Bit 0-1   : Higmost bits of the next $ff1b
  3840.               Bit 2-7   : Unused
  3841. $ff1b       : Actual character-position. Higmost bits in the above register.
  3842.               TED counts the characters that it had fetched and put out to
  3843.               the screen. The number is increasing by 40 after every
  3844.               characterline (8 rasterline).
  3845. $ff1c       : Bit 0     : Higmost bit of $ff1d
  3846.               Bit 1-7   : Unused
  3847. $ff1d       : Actual position of vertical scanning. Higmost
  3848.               bit is in $ff1c. Read/Writeable!
  3849. $ff1e       : Actual position of horizontal scanning. R/W!. Lowmost bit is
  3850.               unused. It contains the TED's internal counter's highmost 8
  3851.               bits. So, it increases 4 with every character. When writing,
  3852.               it seems to put the value to a functionally different register
  3853.               (writing back a reading value in right time affects the screen).
  3854. $ff1f       : Bit 0,1,2 : Actual vertical scanning-line in a character-row.
  3855.                           R/W!.
  3856.               Bit 3-6   : Flashing counter. It's value increases with every
  3857.                           frame, and TED fits it's flashing feature to this
  3858.                           register's reaching to 15.
  3859.               Bit 7     : Unused
  3860. $ff3e       : Switching to ROM. A writing statement to this address will
  3861.               cause to turn on the ROM between $8000-$ffff. It's an other
  3862.               matter, which one; this time, only sure thing that it'll give
  3863.               CS signals instead of RAS', CAS' and MUX.
  3864.               See $ff13/0 and $ff14
  3865. $ff3f       : Switching to RAM. The opposite of the above.
  3866.  
  3867. ============================================================================
  3868.  
  3869. @(#)error: ? DS, DS$: rem The Error Channel
  3870.  
  3871. We are not aware of any errors with issue 11, save the changes to some WWW
  3872. addresses as noted in Hack Surfing (Reference: surf).
  3873.  
  3874. ============================================================================
  3875.  
  3876. @(#)next: The Next Hack
  3877.   
  3878. "... and that's not all you get."  Well, it is for this issue, but here's
  3879. what Commodore Hacking is cooking in its TV informercial cookware for
  3880. issue #13:
  3881.  
  3882. o  CMD has announced that SuperCPU development units should be made
  3883.    available shortly, so C=Hacking will scrutinize it and detail the
  3884.    registers of interest as soon as it shows up.
  3885.  
  3886. o  Exploiting the 65C816S.  We're holding this article over to next issue
  3887.    to allow testing of the examples with the CMD SuperCPU.  This article
  3888.    will detail the new opcodes available to programmers, show how to 
  3889.    detect CPU clock speed on any C64, accelerated or not, and discuss 
  3890.    pitfalls in code migration.
  3891.    
  3892. o  Let's get HTMLized!  It's about time the Commodore 8-bit learned to
  3893.    do HTML.  There's nothing that says this popular WWW markup language 
  3894.    can't do used to create nice disk magazines and newsletters on the 
  3895.    CBM system, so C=Hacking begins a 4 part series on the language and
  3896.    how to render HTML pages on a Commodore machine.
  3897.  
  3898. o  And, of course, C=Hacking's regular goodies.
  3899.  
  3900. So, go ahead, buy that box of disks, and label one now for Commodore
  3901. Hacking Issue #13. 
  3902.  
  3903. ============================================================================
  3904.  
  3905. @(#)editor: Hacking the Code
  3906.  
  3907. For articles in Commodore Hacking that include binary files as part
  3908. of their article, these binaries files are made available in this section
  3909. as encoded text files.  The format used for encoding is called UUCode,
  3910. which is a standard widely used on the Internet to transmit binary files
  3911. using only printable ASCII characters.  To that end, each of these files
  3912. must be decoded with a suitable decoding program before they can executed.
  3913. Typical examples inlucde UUXFER for the 64, uudecode on the ACE OS for the
  3914. 64 and 128, and uudecode on most UNIX OS machines.  Some encoders can decode
  3915. multiple files, while others will require the user to manually split this 
  3916. section into individual pieces prior to decoding.
  3917.  
  3918. WARNING:  The UUCode format trasnlates files from binary to ASCII, not
  3919. PETSCII.  Therefore, either decode this section before downloading this
  3920. section to a PETSCII mode computer system, or download this section without
  3921. translation to PETSCII.  Some decoder programs can handle PETSCII converted
  3922. UUCode files, but the practice is not recommended because conversion is
  3923. typically done in a telecommunications program and cannot be guaranteed to
  3924. be accurate.
  3925.  
  3926. @(A)polycode: Binary for Polygonamy
  3927.  
  3928. begin 600 polygonamy
  3929. M`0@0",0'GC(P-C8@5C4N,````'BB_YJ]-PB=^`#*T/>.$=#N,-"&`:G-H&F%
  3930. M+80NA:Z$KZ`Y3``!`*@%D3_,:;TL"9WH!^C0]^X"`>X%`8C0[J("()T!\"S)
  3931. M!I`2*0&H()H!:0:0"*H@G0&%^1#CA8NE_#CEBX7\A8RE_>D`A?V%C2"&`:;Y
  3932. M\`3&^1#%()T!\`D@F@&B`H:+D!OH()T!\`GH()T!()H!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Z2E
  4249. MIJ>GJ*FJJZRMK:ZOL+"QLK.SM+6UMK>WN+FYNKN[O+R]OKZ_O\#`P<'"P\/$
  4250. MQ,7%QL;'Q\?(R,G)RLK+R\S,S,W-SL[/S\_0T-'1T=+2T]/3U-34U=75UM;7
  4251. MU]?8V-C9V9#F`;``@(03))0PO3'JI$?^2O.1\@[R4/(S\U?QRO'M]C[Q+_-F
  4252. M_J7T[?4!L$6,`P"]`0$`O1H:&AH:&AH:&AH:&AH:&AH:&AH:&AH:&AH:&AH:
  4253. ,&AH:&AH:&AH:&AH:
  4254. `
  4255. end
  4256.  
  4257. =========================================================================
  4258. @(#): bottom
  4259.