home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 222 / 222.d81 / t.atari2600 < prev    next >
Text File  |  2022-08-26  |  7KB  |  218 lines

  1. u
  2.              A DISCUSSION
  3.                 of the
  4.        ATARI 2600 and PITFALL!
  5.  
  6.            By Robin Harbron
  7.  
  8.  
  9.     The Atari 2600 has a 6507
  10. processor, which is nearly identical
  11. to the 6510 in the Commodore 64. It
  12. lacks the extra I/O ports which the
  13. C-64 uses to map memory and talk to
  14. the datasette (locations 0 & 1). It
  15. can only address 8k of memory, rather
  16. than the 64k the 6510 can see. And it
  17. has no facilities for accepting
  18. interrupts, while the C-64 has both
  19. NMI and IRQ -- and we programmers love
  20. them, once we understand how to use
  21. them!
  22.  
  23.     In all other respects, the 6507
  24. and 6510 are identical, meaning if you
  25. know how to program in assembly on
  26. one, you can do it on the other.
  27.  
  28.     While the 6507 can address 8k, the
  29. designers of the 2600 thought 4k was
  30. plenty for game code, and all the
  31. earliest games were stuck with this
  32. limit until bank switching schemes
  33. were developed on newer models of game
  34. cartridges. The other 4k is sparsely
  35. populated by the video and sound and
  36. input/output chips -- and the 128
  37. bytes of RAM that are at the
  38. programmer's disposal.
  39.  
  40.  [DAVE'S INTERRUPTION]: Did he say 128
  41. BYTES of RAM? Obviously, all the code
  42. was in ROM Cartridges. But only 128
  43. bytes of RAM! Golly!
  44.  
  45.  
  46.     The Atari 2600 has a very simple
  47. video chip -- technically inferior to
  48. the VIC-II in the C-64 in every way
  49. save one -- it can display it's 16
  50. colours in 8 different shades each,
  51. giving a total of 128 colours. But
  52. where the C-64 has 8 sprites that are
  53. 24 bits wide, the 2600 has 5 sprites,
  54. 2 of which are 8 bits wide, 3 of them
  55. are just 1 bit wide. The C-64 has a
  56. 320 pixel wide hi-res screen, the
  57. Atari only a 40 bit screen (and only
  58. 20 of them are directly programmable
  59. without tricks!)
  60.  
  61.     It doesn't end there! You can set
  62. various registers and memory locations
  63. in the C-64 once, say to print some
  64. text on the screen and put up a
  65. sprite, and expect the display to
  66. continue until you tell the computer
  67. to do otherwise. On the Atari 2600,
  68. it can only remember one rasterline at
  69. a time, and it's up to the programmer
  70. to keep changing those graphics every
  71. scanline (say, 200 scanlines for every
  72. frame, each frame lasting 1/60 of a
  73. second on an NTSC system) -- if you
  74. don't keep changing the graphics,
  75. you'll just get vertical stripes down
  76. the screen!
  77.  
  78.     The code that handles this screen
  79. drawing is typically called a kernal,
  80. and it's this kernal that decides what
  81. the game can and can't do graphically.
  82.  You have a maximum of 71 cycles per
  83. raster line to do as much as possible
  84. - do you move a couple sprites in that
  85. time? Redefine the sprite graphics?
  86. Change colours? You don't have time to
  87. do everything!
  88.  
  89.     But it's exactly this flexibility
  90. that made so many Atari 2600 games so
  91. amazing -- instead of being tied to
  92. doing exactly what the hardware
  93. demanded, programmers thought of how
  94. they could make these limitations work
  95. for them, instead of against them.
  96. This same spirit still exists today in
  97. Commodore 64 demo coders, and the few
  98. that are still making new Atari 2600
  99. games.
  100.  
  101.     Looking at Pitfall! (I add the "!"
  102. because it was part of the name on the
  103. original Atari 2600 cartridge) you can
  104. see how Atari 2600 limitations shaped
  105. the design of the game. Although it's
  106. not true on the C-64, on the original
  107. Atari 2600 version the background (the
  108. trees) was always either mirrored or
  109. duplicated, left half to right half,
  110. since only the first 20 bits of the 40
  111. bits for the background were
  112. programmable -- the other 20 were
  113. either duplicated or reflected.
  114.  
  115.     The surface that Pitfall Harry
  116. runs on is always symmetrical -- one
  117. pit in the middle, or three evenly
  118. spaced pits, or the symmetrical holes
  119. that disappear and then expand.
  120. There's just one 8-bit sprite on the
  121. surface besides Harry (well, sometimes
  122. there's two or three, but they are all
  123. duplicates -- the 2600 would do that
  124. automatically, create 1 or 2 identical
  125. sprites to the right of the "real" one
  126. if you asked it to). The scorpion only
  127. shows up on levels where there isn't
  128. an underground wall to use up the one
  129. available 8-bit sprite.
  130.  
  131.     One other interesting thing about
  132. Pitfall! is the way the levels are
  133. generated. Pitfall! has 256 levels --
  134. the 20 minute limit isn't long enough
  135. to see all of them (that's why you
  136. need to go underground to finish the
  137. game in time - you actually "warp"
  138. ahead 3 levels each time you go
  139. through an underground level). And 4k
  140. surely doesn't seem to be enough room
  141. to hold all these levels! David Crane
  142. says he used something called an 8-bit
  143. "polynomial counter" to generate the
  144. levels.
  145.  
  146.     A regular 2-bit counter, for
  147. example, would simply count 0,1,2,3
  148. and then repeat. A 2-bit polynomial
  149. counter could count, for example, like
  150. this: 2,0,1,3 and then repeat. Back to
  151. the 8-bit counter, David Crane then
  152. decided that, for example, the first
  153. bit would represent one of two tree
  154. line styles. Then perhaps the next two
  155. bits would decide which (if any)
  156. creatures would appear on the level.
  157. Then perhaps the next bit would decide
  158. whether there would be any ladders on
  159. this level. And so on. He then played
  160. with different combinations until he
  161. found one that was playable all the
  162. way through all 256 levels - but he
  163. didn't need several 256 byte tables
  164. that would use up valuable ROM space -
  165. just a couple short routines to work
  166. through the polynomial counter.
  167.  
  168.     I used these same ideas in my two
  169. minigames that I entered in the 2001
  170. and 2002 mingame competitions,
  171. allowing me to squeeze a 24k game map
  172. in my 2k Minima game, and 9 large
  173. platform levels in my 1k Splatform
  174. game.
  175.  
  176.     For more facinating tales about
  177. these early days of video game
  178. development, try to locate the
  179. excellent "Stella at 20" video
  180. documentaries, produced by Cyberpunks
  181. Entertainment in 1999 - David Crane
  182. and many other alumni are featured.
  183.  
  184.  RH
  185.  
  186. [DAVE AGAIN]: I have always believed
  187. that "limitations" are "opportunities"
  188. for those who understand the reason
  189. behind the limitation. Of course, most
  190. computer users in the United States
  191. (at least) believe that limitions are
  192. reasons to build or buy a bigger,
  193. faster computer.
  194.  
  195. Programming by limitation -- as with
  196. the polynomial bit-logic bytes -- is a
  197. nothing less than excellent
  198. programming. We who love the C-64
  199. platform have a hard time explaining
  200. that love to others, because they
  201. simply do not "get it!"
  202.  
  203. Robin's excellent explanation of the
  204. innards of the 2600 help make sense of
  205. the C=MOS engineers' desire to create
  206. the Ultimate Video and Sound chips --
  207. the VIC II and SID. Atari needed them
  208. to move to the next level.
  209. Unfortunately, in 1981, the Atari
  210. cartridge market was reaching over-
  211. saturation. And Atari was looking to
  212. make its own real computer.
  213.  
  214. Anyway, thanks, Robin. Now we know.
  215.  
  216.  DMM
  217.  
  218.  
  219.