home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 #32 / q32side2.d64 / t.control80-c < prev    next >
Text File  |  2022-08-30  |  13KB  |  279 lines

  1.  
  2.  
  3.                            C O N T R O L 8 0 - C
  4.  
  5.                       Program and Text by Jon Mattson
  6.  
  7.  
  8.     CONTROL80 is an extension of the BASIC 7.0 which adds many new keywords
  9. to the language. These new functions and commands are specifically designed
  10. to make using the 80-column screen easier.  Those who have tried to work
  11. with 80-columns in BASIC 7.0 will realize just what a boon this is: you
  12. can't even PEEK or POKE to the VDC with normal BASIC!  CONTROL80 solves
  13. that problem and many others, as well.
  14.  
  15.      Using C80-C is simple.  First, set aside a section of memory to hold
  16. it by opening up the area normally used for hires graphics.  GRAPHIC1,1
  17. will accomplish this, although it should be followed by GRAPHIC0,1 to get
  18. out of hires mode and GRAPHIC5 to return the screen editor controls to the
  19. 80-column screen.  Then, just BLOAD C80-C into memory and SYS 4864, either
  20. in direct mode or early on in your program.  Generally a simple BLOAD will
  21. suffice, but, if you have been playing around with BANKs and the like, you
  22. might want to use the full syntax.  To summarize:
  23.  
  24.      GRAPHIC1,1:GRAPHIC0,1:GRAPHIC5:BLOAD"C80-C",B0,P4864:SYS4864
  25.  
  26.  NOTE: For card games with a mouse use "c80c-mouse.2300".
  27.  
  28.      C80-C comes with a built-in, card-oriented font, which can be moved to
  29. VDC memory with a simply FCOPY 6880,0,1.  This command will cause the new
  30. font to replace the existing alternate (upper/lower case) font, so that you
  31. can use the CARD command.  The FCOPY should come very shortly after the
  32. set-up commands previously mentioned; however, it should not be on the same
  33. line as those commands.  The reason for this is that the computer deciphers
  34. keywords a line at a time, and, until the SYS 4864 has actually been acted
  35. upon, the FCOPY command will be translated as gibberish, resulting in a
  36. syntax error when that point in the line is reached.
  37.  
  38.      Once C80-C is installed, the new keywords can be used just like any
  39. other BASIC commands.  You can even abbreviate them by shifting the second
  40. letter, as usual.  Remember that C80-C must be active (not just resident)
  41. while you type in a program using its keywords, or they will not be
  42. tokenized correctly.  Note, also, that C80-C uses memory from 4864 to 6879
  43. (once the font has been moved), so avoid POKEing around this area.
  44.  
  45.      Hitting the beloved STOP/RESTORE combination will not deactivate C80-
  46. C.  The QUIT command (previously unimplemented on the 128) will turn it
  47. off, although SYS 4864 will bring it back to life.  Resetting the computer
  48. will also turn it off; however, due to its location, C80-C will still be
  49. resident for later use, as long as you haven't POKEd over its memory space.
  50. In this case, however, the font will likely be lost.
  51.  
  52.      Now let's look at your new resources.  Certain conventions have been
  53. followed in this listing.  Memory addresses are 0-65535, as usual, to allow
  54. use with both 16K and 64K VDCs.  Note, however, that addresses above 16383
  55. wrap around on the 16K chip, i.e. 16384 = 0.  Remember that the basic 8563
  56. chip is set up as follows:
  57.  
  58.      $0000 - 07FF        0 - 2047     Screen
  59.      $0800 - 0FFF     2048 - 4095     Attributes
  60.      $1000 - 1FFF     4096 - 8191     Unused
  61.      $2000 - 2FFF     8192 - 12287    Upper Case/Graphic (normal) Font
  62.      $3000 - 3FFF    12288 - 16383    Upper/Lower Case (alternate) Font
  63.  
  64.     VDC register numbers range from 0-36.  It is not within the scope of
  65. this article to explain the use of every register, but a simplified listing
  66. is given in the previous Control80 article, and a complete description can
  67. be found in the C-128 Programmer's Reference Guide.  When in doubt,
  68. experiment with the WVD command, but be sure that you check the register's
  69. normal value first with the RVD function to set things back to normal!
  70.  
  71.  
  72.  FUNCTIONS
  73.  ---------
  74.  
  75. PEER (VDC address)
  76.  
  77.      This function allows you to check the contents of VDC memory.  It
  78. operates just like BASIC's PEEK.  For example, to find the character in the
  79. top left corner of the screen, PRINT PEER(0).  Note that PEER is the
  80. counterpart of POST, below.
  81.  
  82.  
  83. RVD (reg#)
  84.  
  85.      This function (Read ViDeo register) allows you to check the contents
  86. of any of the 37 VDC registers.  For example, A=RVD(12) would put the
  87. contents of register 12 into the variable A.  Note that RVD is the
  88. counterpart of WVD, below.
  89.  
  90.  
  91.  COMMANDS
  92.  --------
  93.  
  94. BLOCK VDC address, number, value
  95.  
  96.      This command allows you to fill any small section of VDC memory with a
  97. single value.  "Address" indicates the starting position of the fill, and
  98. "number" (2-255) indicates how many consecutive locations to fill with the
  99. specified "value" (0-255), from that point on.  One of the best uses of
  100. BLOCK is to highlight a line on the screen by filling attribute memory with
  101. a different color value and/or reverse.  For example, BLOCK 2048,80,72
  102. would highlight the entire first line of the screen by coloring it red and
  103. using reverse characters.  See FILL for more information on attribute
  104. memory.
  105.  
  106.  
  107. CARD top left corner address, card number
  108.  
  109.      This command draws the specified card on the screen with its top left
  110. corner positioned over the indicated address.  Card numbers are from 0-51
  111. for the basic deck and 52+ for Jokers.  The basic deck is divided into four
  112. groups of thirteen cards, in the following order: Clubs (0-12),  Spades
  113. (13-25), Hearts (26-38) and Diamonds (39-51).  Thus, 0 is the Ace of Clubs,
  114. 12 is the King of Clubs, 13 is the Ace of Spades, and so on.  The command
  115. CARD 0,2 would draw a three of Clubs in the top left corner of the screen.
  116. For this command to work properly, the C80-C font must be installed, the
  117. screen should be white (VCOL 16,1) and the background should be filled with
  118. a non-space character.  Due to the restrictions of the 80-column screen
  119. (i.e. no multicolor or extended color) and the fact that I wanted the cards
  120. to look as realistic and colorful as possible, I was forced to do without
  121. any sort of outlining.  This may sound like a restriction, but, after
  122. playing with the Tiles feature in SLIDE POKER for a few seconds, I'm sure
  123. you'll agree that it is a fairly trivial one.
  124.  
  125.  
  126. DICE type, number
  127.  
  128.      This command effectively rolls the indicated "type" of dice the
  129. specified "number" of times and puts the total in memory location 250.  For
  130. example, DICE 8,3:A=PEEK(250) would roll three eight-sided dice, for a
  131. result of 3 to 24, and put the total in the variable A.  A "type" of less
  132. than 2 returns a roll of 0-255, regardless of the "number".  A "type" of
  133. greater than 128, returns one roll of the appropriate type, regardless of
  134. the "number".  Since only one byte is used to store the result, the roll
  135. cannot exceed 255; thus, a DICE 50,50 command (with a maximum possible
  136. result of 2500) would return a pretty meaningless result most of the time.
  137. The best thing about this command, aside from its convenience, is that it
  138. does not use the random function of the SID chip and, thus, will never
  139. conflict with voice 3.  Like the RND function, this command should be re-
  140. seeded the first time it is called upon (only), as follows:
  141.  
  142.      I=RND(-TI):FORI=.TO15:POKE6025+I,INT(RND(1)*256):NEXT
  143.  
  144.  
  145. FCOPY address, bank, character set (0 or 1)
  146.  
  147.      This command allows you to convert and copy a standard 40-column font
  148. already in normal memory, at the "address" and "bank" specified, to the
  149. 8563 chip.  Since the 8563 allows two character sets to be displayed on the
  150. screen simultaneously, you must specify which one to replace: 0 for upper
  151. case/graphics (normal) or 1 for lower/upper case (alternate).  The font
  152. used with CARD should always be copied to the alternate set.
  153.  
  154.  
  155. FILL top left corner address, width, length, value
  156.  
  157.      This command fills a rectangular section of memory of the indicated
  158. "width" and "length" (height) with the specified "value", starting with the
  159. "top left corner address".  For example FILL 0,80,25,33 would fill the
  160. whole screen with exclamation marks (screen code 33); FILL 2048,40,10,154
  161. would cause a rectangular 40 by 10 area in the top left corner of the
  162. screen to be "painted" with purple, flashing, alternate characters.  When
  163. using FILL and similar commands, remember that the attribute codes are as
  164. follows:
  165.  
  166.      Bit 7 (128)  Alternate