home *** CD-ROM | disk | FTP | other *** search
/ Scene World 22 / Scene_World_22_2014-01-22_People_of_Liberty_Scene_World_Magazine_Side_1_of_3.d64 / planet.code+ < prev    next >
Text File  |  2023-02-26  |  35KB  |  1,688 lines

  1. ;--------------------------------------
  2. ;Scene World #22
  3. ;
  4. ;C64 6502 Assembly Game Programming
  5. ;tutorial
  6. ;--------------------------------------
  7. ;PLANET POPPER V2
  8. ;================
  9. ;Programming, Planet Sprites,
  10. ;Charset and Music by Richard Bayliss
  11. ;Bitmap screen and game sprites by
  12. ;Johan Janssen.
  13. ;--------------------------------------
  14.  
  15. ;Last time in the assembly programming
  16. ;tutorial. We started making a simple
  17. ;shoot 'em up game. Now we are going
  18. ;to tweak it to make it look better.
  19. ;In this part of the tutorial, we are
  20. ;going to turn it into an actual game.
  21. ;Also slightly different to the
  22. ;previous chapter.
  23.  
  24. ;The new version of the game will
  25. ;allow you to display a picture, a new
  26. ;charset, new sprites and also play
  27. ;music. We have started from scratch
  28. ;to make way for some new features in
  29. ;the game. Enjoy playing around with
  30. ;this source.
  31.  
  32. ;We also have a simple front end for
  33. ;the game as well.
  34.  
  35. ;--------------------------------------
  36.  
  37. ;First of all, some variables in which
  38. ;represent various features for the
  39. ;game.
  40.  
  41. raspos1  = $00;Raster position before
  42.               ;calling an interrupt
  43.               ;frame.
  44.  
  45. raspos2  = $2e;Raster position for irq1
  46.               ;
  47.               ;Displays game background
  48.               ;and game sprites
  49.  
  50. raspos3  = $f1;Raster position for irq2
  51.               ;
  52.               ;Displays status bar for
  53.               ;score. Also hides
  54.               ;visible sprites.
  55.  
  56. raspos4  = $fa;Raster position for
  57.               ;syncronizing timers and
  58.               ;playing music.
  59.  
  60. delaytime = $0801 ;Sync timer
  61.  
  62.  
  63. ;Object pointers in which are used as a
  64. ;ghost sprite. This needs to be used to
  65. ;store to an actual hardware sprite
  66. ;pointer.
  67.  
  68. scoreval = $07c7 ;First digit for score
  69. shieldval = $07e5;First Digit for the
  70.                  ;Player's shield.
  71. objpos   = $0810 ;Temporary software
  72.                  ;sprite pointers. For
  73.                  ;positioning sprites.
  74.  
  75. animpointer = $0820 ;Counter for main
  76.                     ;sprite animation
  77.  
  78. animdelay = $0821 ;Delay pointer for
  79.                   ;sprite animation.
  80.  
  81. planetstore1 = $0822;Planet animation
  82. planetstore2 = $0823;storage pointers.
  83. planetstore3 = $0824;Where a frame is
  84. planetstore4 = $0825;read from the
  85. planetstore5 = $0826;frame table and
  86. planetstore6 = $0827;then stored to the
  87. playerstore = $0828 ;planets. Or Player
  88.  
  89. explodedelay = $0829 ;Timing and count
  90. explodeptr = $082a   ;for the explosion
  91. explodestore = $082b ;animation
  92.  
  93. collstore = $0830    ;Software Sprite
  94.                      ;to sprite
  95.                      ;collision
  96.  
  97. planet1hit = $0840   ;Pointers to check
  98. planet2hit = $0841   ;to see whether or
  99. planet3hit = $0842   ;not the planets
  100. planet4hit = $0852   ;have been shot by
  101. planet5hit = $0862   ;the player.
  102. planet6hit = $0872   ;
  103.  
  104. planet1speed = $0873 ;Generated speed
  105. planet2speed = $0874 ;pointers in which
  106. planet3speed = $0875 ;are stored to the
  107. planet4speed = $0876 ;planet's movement
  108. planet5speed = $0877 ;routine.
  109. planet6speed = $0878 ;
  110.  
  111. planetdir = $0879    ;Direction pointer
  112.  
  113. planettime = $087a   ;Duration and
  114. dirpointer = $087b   ;direction for
  115.                      ;moving planets
  116.  
  117. colourstore = $0880  ;Sprite colour
  118.                      ;pointers for
  119.                      ;raster IRQ.
  120.  
  121. randcounter = $0890  ;Pointer to call
  122.                      ;a random position
  123.  
  124. randpos  = $0891     ;Random position
  125. randspeed = $0892    ;Random speed
  126.  
  127. firebutton = $0893   ;Joystick fire
  128.                      ;pressed and
  129.                      ;released.
  130.  
  131. xpos     = $0894     ;Title soft scroll
  132.                      ;pointer
  133.  
  134. titlescreentext = $3800;Where the title
  135.                        ;screen text has
  136.                        ;been stored.
  137.  
  138. scrolltext = $3c00     ;Same for the
  139.                        ;scrolling msg.
  140.  
  141. titlelast = $06c0      ;First digit for
  142.                        ;last score
  143.  
  144. titlebest = $06c0+40   ;First digit for
  145.                        ;high score.
  146.  
  147.  
  148. ;Music ...
  149. ;
  150. ;Most music editors/composers in the
  151. ;C64 demo scene plays tunes using:
  152. ;
  153. ;LDA #$00
  154. ;JSR $1000 ;init music
  155. ;
  156. ;JSR $1003
  157. ;
  158. ;DMC, JCH, GoatTracker, Voicetracker,
  159. ;SidWizard, etc use this.
  160. ;
  161.  
  162.  
  163. songno   = $00      ;Song number
  164. musicinit = $1000   ;Initialise music
  165. musicplay = $1003   ;Play music
  166.  
  167. ;Start code. Using crunchers / packers
  168. ;set $2800 as JMP address. Antwere else
  169. ;will not really help much :) #$37 as
  170. ;$01 can be set.
  171.  
  172.          *= $2800
  173.  
  174. ;Initialize Richard's music, as
  175. ;this will be used only once for both
  176. ;front end and game.
  177.  
  178.          lda #songno
  179.          jsr musicinit
  180.  
  181.  
  182. titlescreen
  183.  
  184.          sei ;Set IRQ interrupt
  185.  
  186.          lda #$00  ;Black border
  187.          sta $d020 ;and screen.
  188.          sta $d021
  189.  
  190.  
  191. ;Setup the title screen text display
  192.  
  193.          ldx #$00     ;
  194. puttitle lda $3800,x  ;Copy whole text
  195.          sta $0400,x  ;memory from
  196.          lda $3900,x  ;$3800-$3be7 and
  197.          sta $0500,x  ;put it in the
  198.          lda $3a00,x  ;default screen
  199.          sta $0600,x  ;position in VIC
  200.          lda $3ae8,x  ;Bank #$03.
  201.          sta $06e8,x
  202.          lda #$0c ;Grey text
  203.          sta $d800,x
  204.          sta $d900,x
  205.          sta $da00,x
  206.          sta $dae8,x
  207.          inx
  208.          bne puttitle
  209.  
  210. ;Ensure all sprites are switched off.
  211.  
  212.          lda #$00
  213.          sta $d015
  214.          sta $d01b
  215.          sta $d01d
  216.          sta $d017
  217.  
  218. ;Setup up VIC Bank #$03, and other
  219. ;hardware pointers for front end.
  220.  
  221.          lda #$03  ;VIC Bank #$03
  222.          sta $dd00
  223.  
  224.  
  225.          lda #$08  ;Multicolour OFF
  226.          sta $d016
  227.  
  228.          lda #$18  ;Charset at $2000
  229.          sta $d018
  230.  
  231.          lda #$00       ;Initialize the
  232.          sta firebutton ;fire button +
  233.          sta xpos       ;soft scroll
  234.  
  235.          lda #<scrolltext ;And of
  236.          sta messread+1   ;course reset
  237.          lda #>scrolltext ;the scroll
  238.          sta messread+2   ;message.
  239.  
  240.  
  241. ;Copy the final score and high score to
  242. ;where final and top scores are set.
  243.  
  244.          ldx #$00
  245. copyscores
  246.          lda finalscore,x
  247.          sta titlelast,x
  248.          lda topscore,x
  249.          sta titlebest,x
  250.          inx
  251.          cpx #6
  252.          bne copyscores
  253.  
  254. ;Setup title screen interrupts.
  255.  
  256.          lda #<tirq1 ;Low bit of irq
  257.          sta $0314   ;Store to vector
  258.          lda #>tirq1 ;Hi bit of irq
  259.          sta $0315   ;Store to vector
  260.          lda #raspos1;Default raster
  261.          sta $d012   ;position
  262.          lda #$7f    ;CIA set to
  263.          sta $dc0d   ;Interrupt
  264.          lda #$1b    ;
  265.          sta $d011   ;Screen on
  266.          lda #$01    ;IRQ sync set
  267.          sta $d01a
  268.          ror $d019
  269.          cli         ;Clear IRQ flag
  270.  
  271. ;The main loop of the title screen.
  272.  
  273. titleloop
  274.          lda #0        ;Synchronize the
  275.          sta delaytime ;timer.
  276.          cmp delaytime
  277.          beq *-3
  278.          jsr scrollmess ;Call scroller
  279.          lda $dc00      ;Wait for fire
  280.          lsr a          ;on joystick
  281.          lsr a          ;in port 2
  282.          lsr a
  283.          lsr a
  284.          lsr a
  285.          bit firebutton
  286.          ror firebutton
  287.          bmi titleloop
  288.          bvc titleloop
  289.          jmp gamestart  ;Run game.
  290.  
  291. ;The main scroll text routine.
  292.  
  293. scrollmess lda xpos ;Control the
  294.          sec        ;speed and the
  295.          sbc #1     ;smoothness of the
  296.          and #$07   ;scroll.
  297.          sta xpos
  298.          bcs endscr
  299.          ldx #$00    ;Pull all chars
  300. scroll   lda $07c1,x ;inside the loop
  301.          sta $07c0,x ;continuously.
  302.          inx
  303.          cpx #40     ;40 chars row
  304.          bne scroll
  305. messread lda scrolltext ;Check if @ is
  306.          cmp #$00       ;detected ...
  307.          bne nowrap
  308.          lda #<scrolltext ;Reset text
  309.          sta messread+1   ;for scroll
  310.          lda #>scrolltext ;text.
  311.          sta messread+2
  312.          jmp messread
  313. nowrap   sta $07e7
  314.          inc messread+1
  315.          bne endscr
  316.          inc messread+2
  317. endscr   rts
  318.  
  319. ;Interrupts for the title screen
  320.  
  321. tirq1    asl $d019    ;SYNC interrupt
  322.          lda $dc0d    ;--------------
  323.          sta $dd0d
  324.          lda #raspos2 ;Second raster
  325.          sta $d012
  326.          lda xpos     ;Smooth scroll at
  327.          sta $d016    ;bottom of screen
  328.          lda #$01
  329.          sta delaytime;Add 1 Sync timer
  330.          lda #<tirq2  ;Point low and hi
  331.          sta $0314    ;bits to next
  332.          lda #>tirq2  ;interrupt TIRQ2
  333.          sta $0315
  334.          pla          ;Infinite loop
  335.          tay
  336.          pla
  337.          tax
  338.          pla
  339.          rti
  340.  
  341. tirq2    asl $d019    ;Do same as above
  342.          lda #raspos3 ;3rd raster set
  343.          sta $d012
  344.          lda #$08     ;No smooth scroll
  345.          sta $d016    ;or multicolour
  346.          lda #<tirq3  ;Point to next
  347.          sta $0314    ;interrupt TIRQ3
  348.          lda #>tirq3
  349.          sta $0315
  350.          pla
  351.          tay
  352.          pla
  353.          tax
  354.          pla
  355.          rti
  356.  
  357. tirq3    asl $d019    ;Third interrupt
  358.          lda #raspos4 ;4th raster
  359.          sta $d012
  360.          lda xpos     ;Smooth scroll
  361.          sta $d016
  362.          jsr musicplay ;Play music
  363.          lda #<tirq1   ;Point back to
  364.          sta $0314     ;interrupt1
  365.          lda #>tirq1
  366.          sta $0315
  367.          pla           ;Inifinite loop
  368.          tay
  369.          pla
  370.          tax
  371.          pla
  372.          rti
  373.  
  374. ;Main game code. GAMESTART.
  375.  
  376. gamestart
  377.  
  378.          sei
  379.  
  380. ;Put all of the colour data into the
  381. ;COLOUR RAM ($d800). The picture's
  382. ;colour RAM data lies at $5800. I used
  383. ;VIDCOM paint for this example.
  384.  
  385.          ldx #$00
  386. setcolrs lda $5800,x
  387.          sta $d800,x
  388.          lda $5900,x
  389.          sta $d900,x
  390.          lda $5a00,x
  391.          sta $da00,x
  392.          lda $5ae8,x
  393.          sta $dae8,x
  394.          inx
  395.          bne setcolrs
  396.  
  397. ;Draw the status chars on to the bottom
  398. ;of the screen. Text must be fixed
  399. ;to display correctly.
  400.  
  401.          ldx #$00
  402. drawstatus
  403.          lda status,x
  404.          cmp #$3f ;If lower case then
  405.          bcc statok ;no change.
  406.          sec
  407.          sbc #$40
  408. statok   sta $07c0,x
  409.          lda #$0e ;Light blue text
  410.          sta $dbc0,x
  411.          inx
  412.          cpx #$28 ;40 chars
  413.          bne drawstatus
  414.  
  415. ;Enable sprites on screen. Also allow
  416. ;multicolour
  417.  
  418.          lda #$ff
  419.          sta $d015 ;Sprites on
  420.          sta $d01c ;Sprite MCOL on
  421.  
  422. ;Setup the main 2 outline colours for
  423. ;every single sprite.
  424.  
  425.          lda #$0b
  426.          sta $d025 ;Spr. Mcol 1
  427.          lda #$01
  428.          sta $d026 ;Spr. Mcol 2
  429.  
  430. ;Now setup the sprite position ghost
  431. ;regs as a start up.
  432.  
  433.          ldx #$00
  434. setupspr lda dfltpos,x
  435.          sta objpos,x
  436.          inx
  437.          cpx #$10
  438.          bne setupspr
  439.  
  440. ;Also setup the default frame for the
  441. ;sprites. Because of the sprites
  442. ;appearing on the space background (A
  443. ;VIDCOM bitmap). The SCREEN SPRITE RAM
  444. ;at $5FF8-$5FFF is being used for the
  445. ;main sprite type.  Also we are setting
  446. ;up the default sprite colours for
  447. ;everything.
  448.  
  449.          ldx #$00
  450. setsprdflt
  451.          lda dfltframe,x
  452.          sta $5ff8,x
  453.          lda dfltcols,x
  454.          sta colourstore,x
  455.          inx
  456.          cpx #$08
  457.          bne setsprdflt
  458.  
  459. ;Initialise all game pointers so we
  460. ;can default this game. (See pointers
  461. ;to understand what those are).
  462.  
  463.          lda #$00      ;Initialize all.
  464.          sta animdelay ;pointers.
  465.          sta animpointer
  466.          sta planet1hit
  467.          sta planet2hit
  468.          sta planet3hit
  469.          sta planet4hit
  470.          sta planet5hit
  471.          sta planet6hit
  472.          sta explodedelay
  473.          sta explodeptr
  474.          sta randcounter
  475.          sta firebutton
  476.          sta planettime
  477.          sta dirpointer
  478.          sta planetdir
  479.  
  480.          lda #$03 ;Start frame
  481.          sta explodestore ;explosion
  482.          lda #1           ;Default
  483.          sta planet1speed ;speed for
  484.          lda #2           ;all planets.
  485.          sta planet2speed
  486.          lda #3
  487.          sta planet3speed
  488.          lda #4
  489.          sta planet4speed
  490.          lda #3
  491.          sta planet5speed
  492.          lda #2
  493.          sta planet6speed
  494.  
  495. ;Set low+hi byte pointers to the IRQ
  496. ;raster interrupt vectors.
  497.  
  498.          lda #<irq1
  499.          sta $0314
  500.          lda #>irq1
  501.          sta $0315
  502.  
  503. ;Initialise raster position
  504.  
  505.          lda #raspos1
  506.          sta $d012
  507.  
  508. ;Setup CIA Timers
  509.  
  510.          lda #$7f
  511.          sta $dc0d
  512.  
  513. ;Screen enabled
  514.  
  515.          lda #$1b
  516.          sta $d011
  517.  
  518. ;Delay interrupt registers to slow
  519. ;things down a little.
  520.  
  521.          lda #$01
  522.          sta $d01a
  523.          ror $d019
  524.  
  525.          cli ;Clear IRQ flag
  526.  
  527. ;This is our main in game loop. Sync
  528. ;timer and call additional routines.
  529.  
  530. mainloop lda #$00
  531.          sta delaytime
  532.          cmp delaytime
  533.          beq *-3
  534.          jsr expandpos
  535.          jsr moveplayer
  536.          jsr movebullet
  537.          jsr moveplanets
  538.          jsr animation
  539.          jsr collision
  540.          jmp mainloop
  541.  
  542. ;Expand the sprite positions and
  543. ;correctly display them in place to the
  544. ;hardware sprite registry.
  545.  
  546. expandpos ldx #$00
  547. exploop  lda objpos+1,x
  548.          sta $d001,x
  549.          lda objpos+0,x
  550.          asl a
  551.          ror $d010
  552.          sta $d000,x
  553.          inx
  554.          inx
  555.          cpx #$10
  556.          bne exploop
  557.          rts
  558.  
  559. ;Control the player using a joystick
  560. ;plugged into port 2.
  561.  
  562. moveplayer
  563.          ldy #$02   ;Default ship
  564.          sty $5ff8  ;frame. (Ship front)
  565.          lda $dc00  ;Read joystick p2
  566.          lsr a
  567.          bcs notup
  568.  
  569.          ldx objpos+1 ;Move player up
  570.          dex
  571.          dex
  572.          cpx #$32
  573.          bcs upok
  574.          ldx #$32
  575. upok     stx objpos+1
  576.  
  577. notup    lsr a
  578.          bcs notdown
  579.          ldx objpos+1 ;Move player down
  580.          inx
  581.          inx
  582.          cpx #$d0
  583.          bcc downok
  584.          ldx #$d0
  585. downok   stx objpos+1
  586.  
  587. notdown  lsr a
  588.          bcs notleft
  589.          ldy #$00    ;Ship tilts left
  590.          sty $5ff8
  591.          ldx objpos  ;Move ship left
  592.          dex
  593.          cpx #$0c
  594.          bcs leftok
  595.          ldx #$0c
  596. leftok   stx objpos
  597.  
  598. notleft  lsr a
  599.  
  600.          bcs notright
  601.          ldy #$01   ;Ship tilts right
  602.          sty $5ff8
  603.          ldx objpos ;Move ship right
  604.          inx
  605.          cpx #$a2
  606.          bcc rightok
  607.          ldx #$a2
  608. rightok  stx objpos
  609.  
  610.  
  611. ;When pressing fire, the player cannot
  612. ;autofire when shooting a laser. This
  613. ;is where the BIT firebutton and ROR
  614. ;firebutton command takes place.
  615.  
  616. notright lsr a
  617.          bit firebutton
  618.          ror firebutton
  619.          bmi notfire
  620.          bvc notfire
  621.  
  622. ;Is the bullet still on screen and
  623. ;moving. If so, then ignore the
  624. ;process, else disable the button
  625. ;pressed. Until released again.
  626.  
  627.          ldy objpos+2
  628.          cpy #$00
  629.          bne lockfire
  630.          ldy objpos
  631.          sty objpos+2
  632.          ldy objpos+1
  633.          sty objpos+3
  634. lockfire lda #$00
  635.          sta firebutton
  636. notfire
  637.          rts
  638.  
  639. ;Test the player's bullet to see if
  640. ;it is enabled. If so, then the bullet
  641. ;can move. Otherwise ignore it!
  642.  
  643. movebullet
  644.          ldy objpos+3
  645.          dey ;A few of these are for
  646.          dey ;speed.
  647.          dey
  648.          dey
  649.          dey
  650.          dey
  651.          dey
  652.          dey
  653.          dey
  654.          dey
  655.          dey
  656.          dey
  657.          cpy #$0b ;Offset
  658.          bcs notoffset
  659.          ldy #$00
  660.          sty objpos+2
  661. notoffset sty objpos+3
  662.          rts
  663.  
  664. ;Call subroutines to move planets. Last
  665. ;time, we used a loop. This time round
  666. ;since there are going to be different
  667. ;things occuring to the game. We are
  668. ;going to use a subroutine for each
  669. ;planet. Mainly to test each planet.
  670.  
  671. moveplanets
  672.  
  673.          jsr timemovement
  674.          jsr testplanet1
  675.          jsr testplanet2
  676.          jsr testplanet3
  677.          jsr testplanet4
  678.          jsr testplanet5
  679.          jsr testplanet6
  680.          rts
  681.  
  682. ;Time X movement of the planets.
  683. ;Default = 0
  684.  
  685. timemovement
  686.          lda planettime
  687.          cmp #$a8
  688.          beq movedir
  689.          inc planettime
  690.          rts
  691. movedir  lda #$00
  692.          sta planettime
  693.          ldx dirpointer
  694.          lda dirtable,x
  695.          sta planetdir
  696.          inx
  697.          cpx #25
  698.          beq resetpdir
  699.          inc dirpointer
  700.          rts
  701. resetpdir
  702.          ldx #$00
  703.          stx dirpointer
  704.          rts
  705.  
  706.  
  707. ;Test the first planet. If planet is
  708. ;hit. Don't let it move. Otherwise
  709. ;allow it to animate and move. Other
  710. ;Planet tests are exactly the same.
  711.  
  712. testplanet1
  713.          lda planet1hit  ;Planet hit?
  714.          cmp #$01
  715.          beq destroyplanet1
  716.          lda planetstore1;Animate
  717.          sta $5ffa
  718.          lda objpos+4
  719.          clc
  720.          adc planetdir
  721.          sta objpos+4    ;Move X-POS
  722.          lda objpos+5    ;Move Y-POS
  723.          clc
  724.          adc planet1speed
  725.          cmp #$fa
  726.          bcc p1ok
  727.          jmp resetplan1
  728. p1ok     sta objpos+5
  729.          rts
  730. destroyplanet1
  731.          jsr explode     ;Blow up
  732.          lda explodestore;Planet
  733.          sta $5ffa
  734.          ldx explodeptr
  735.          cpx #7
  736.          beq resetplan1
  737.          rts
  738. resetplan1
  739.          jsr randomizer
  740.          lda randspeed
  741.          sta planet1speed
  742.          lda randpos
  743.          sta objpos+4
  744.          lda #$00
  745.          sta objpos+5
  746.          sta planet1hit
  747.  
  748.          rts
  749.  
  750. ;Now test the second planet
  751.  
  752. testplanet2
  753.  
  754.          lda planet2hit
  755.          cmp #$01
  756.          beq destroyplanet2
  757.          lda planetstore2
  758.          sta $5ffb
  759.          lda objpos+6
  760.          clc
  761.          adc planetdir
  762.          sta objpos+6
  763.          lda objpos+7
  764.          clc
  765.          adc planet2speed
  766.          cmp #$fa
  767.          bcc p2ok
  768.          jmp resetplan2
  769. p2ok     sta objpos+7
  770.          rts
  771. destroyplanet2
  772.          jsr explode
  773.          lda explodestore
  774.          sta $5ffb
  775.          ldx explodeptr
  776.          cpx #7
  777.          beq resetplan2
  778.          rts
  779. resetplan2
  780.          jsr randomizer
  781.          lda randspeed
  782.          sta planet2speed
  783.          lda randpos
  784.          sta objpos+6
  785.          lda #$00
  786.          sta objpos+7
  787.          sta planet2hit
  788.          rts
  789.  
  790. ;Now test the third planet
  791.  
  792. testplanet3
  793.          lda planet3hit
  794.          cmp #$01
  795.          beq destroyplanet3
  796.          lda planetstore3
  797.          sta $5ffc
  798.          lda objpos+8
  799.          clc
  800.          adc planetdir
  801.          sta objpos+8
  802.          lda objpos+9
  803.          clc
  804.          adc planet3speed
  805.          cmp #$fa
  806.          bcc p3ok
  807.          jmp resetplan3
  808. p3ok     sta objpos+9
  809.          rts
  810. destroyplanet3
  811.          jsr explode
  812.          lda explodestore
  813.          sta $5ffc
  814.          ldx explodeptr
  815.          cpx #7
  816.          beq resetplan3
  817.          rts
  818. resetplan3
  819.          jsr randomizer
  820.          lda randpos
  821.          sta objpos+8
  822.          lda randspeed
  823.          sta planet3speed
  824.          lda #$00
  825.          sta objpos+9
  826.          sta planet3hit
  827.          rts
  828.  
  829. ;Test the forth planet
  830.  
  831. testplanet4
  832.          lda planet4hit
  833.          cmp #$01
  834.          beq destroyplanet4
  835.          lda planetstore4
  836.          sta $5ffd
  837.          lda objpos+10
  838.          clc
  839.          adc planetdir
  840.          sta objpos+10
  841.          lda objpos+11
  842.          clc
  843.          adc planet4speed
  844.          cmp #$fa
  845.          bcc p4ok
  846.          jmp resetplan4
  847. p4ok     sta objpos+11
  848.          rts
  849. destroyplanet4
  850.          jsr explode
  851.          lda explodestore
  852.          sta $5ffd
  853.          ldx explodeptr
  854.          cpx #7
  855.          beq resetplan4
  856.          rts
  857. resetplan4
  858.          jsr randomizer
  859.          lda randpos
  860.          sta objpos+10
  861.          lda randspeed
  862.          sta planet4speed
  863.          lda #$00
  864.          sta objpos+11
  865.          lda #$00
  866.          sta planet4hit
  867.          rts
  868.  
  869. ;Test the fith planet
  870.  
  871. testplanet5
  872.          lda planet5hit
  873.          cmp #$01
  874.          beq destroyplanet5
  875.          lda planetstore5
  876.          sta $5ffe
  877.          lda objpos+12
  878.          clc
  879.          adc planetdir
  880.          sta objpos+12
  881.          lda objpos+13
  882.          clc
  883.          adc planet5speed
  884.          cmp #$fa
  885.          bcc p5ok
  886.          jmp resetplanet5
  887. p5ok     sta objpos+13
  888.          rts
  889. destroyplanet5
  890.          jsr explode
  891.          lda explodestore
  892.          sta $5ffe
  893.          ldx explodeptr
  894.          cpx #7
  895.          beq resetplanet5
  896.          rts
  897. resetplanet5 jsr randomizer
  898.          lda randpos
  899.          sta objpos+12
  900.          lda randspeed
  901.          sta planet5speed
  902.          lda #$00
  903.          sta objpos+13
  904.          sta planet5hit
  905.          rts
  906.  
  907. ;Test the last planet
  908.  
  909. testplanet6
  910.          lda planet6hit
  911.          cmp #$01
  912.          beq destroyplanet6
  913.          lda planetstore6
  914.          sta $5fff
  915.          lda objpos+14
  916.          clc
  917.          adc planetdir
  918.          sta objpos+14
  919.          lda objpos+15
  920.          clc
  921.          adc planet6speed
  922.          cmp #$fa
  923.          bcc p6ok
  924.          jmp resetplan6
  925. p6ok     sta objpos+15
  926.          rts
  927. destroyplanet6
  928.          jsr explode
  929.          lda explodestore
  930.          sta $5fff
  931.          ldx explodeptr
  932.          cpx #$07
  933.          beq resetplan6
  934.          rts
  935. resetplan6
  936.          jsr randomizer
  937.          lda randspeed
  938.          sta planet6speed
  939.          lda randpos
  940.          sta objpos+14
  941.          lda #$00
  942.          sta objpos+15
  943.          sta planet6hit
  944.          rts
  945.  
  946. ;Position randomizer (Count 25 times)
  947.  
  948. randomizer
  949.          ldx randcounter
  950.          lda randtable,x
  951.          sta randpos
  952.          lda randspeedtable,x
  953.          sta randspeed
  954.          inx
  955.          cpx #25
  956.          beq resetrand
  957.          inc randcounter
  958.          rts
  959. resetrand ldx #$00
  960.          stx randcounter
  961.          rts
  962.  
  963. ;Animation for explosion routine
  964.  
  965. explode
  966.          lda explodedelay
  967.          cmp #$02
  968.          beq expfast
  969.          inc explodedelay
  970.          rts
  971. expfast  lda #$00
  972.          sta explodedelay
  973.          ldx explodeptr
  974.          lda explodetable,x
  975.          sta explodestore
  976.          inx
  977.          cpx #$06
  978.          beq stopexplode
  979.          inc explodeptr
  980.          rts
  981. stopexplode
  982.          ldx #$07
  983.          stx explodeptr
  984.          rts
  985.  
  986. ;Animation for main enemy sprites
  987.  
  988. animation
  989.          lda animdelay
  990.          cmp #$04
  991.          beq fastenough
  992.          inc animdelay
  993.          rts
  994. fastenough
  995.          lda #$00
  996.          sta animdelay
  997.          ldx animpointer
  998.          lda planetframe1,x
  999.          sta planetstore1
  1000.          lda planetframe2,x
  1001.          sta planetstore2
  1002.          lda planetframe3,x
  1003.          sta planetstore3
  1004.          lda planetframe4,x
  1005.          sta planetstore4
  1006.          lda planetframe5,x
  1007.          sta planetstore5
  1008.          lda planetframe6,x
  1009.          sta planetstore6
  1010.          inx
  1011.          cpx #$06
  1012.          beq resetframe
  1013.          inc animpointer
  1014.          rts
  1015. resetframe
  1016.          ldx #$00
  1017.          stx animpointer
  1018.          rts
  1019.  
  1020. ;Test the sprite to sprite collision
  1021.  
  1022. collision
  1023.          jsr tbullcol
  1024.          jsr tplayercol
  1025.          jsr planetcol1
  1026.          jsr planetcol2
  1027.          jsr planetcol3
  1028.          jsr planetcol4
  1029.          jsr planetcol5
  1030.          jsr planetcol6
  1031.          rts
  1032.  
  1033. ;Test the bullet to see if it hits
  1034. ;the enemies, using a box co-ords type
  1035. ;collision (see swo #20).
  1036.  
  1037. tbullcol lda objpos+2
  1038.          sec
  1039.          sbc #$06
  1040.          sta collstore
  1041.          clc
  1042.          adc #$0c
  1043.          sta collstore+1
  1044.          lda objpos+3
  1045.          sec
  1046.          sbc #$0c
  1047.          sta collstore+2
  1048.          clc
  1049.          adc #$18
  1050.          sta collstore+3
  1051.          rts
  1052.  
  1053. tplayercol
  1054.          lda objpos
  1055.          sec
  1056.          sbc #$06
  1057.          sta collstore+4
  1058.          clc
  1059.          adc #$0c
  1060.          sta collstore+5
  1061.          lda objpos+1
  1062.          sec
  1063.          sbc #$0c
  1064.          sta collstore+6
  1065.          clc
  1066.          adc #$18
  1067.          sta collstore+7
  1068. nocoll   rts
  1069.  
  1070. ;To make a fair collision for each of
  1071. ;the planets. If a planet is exploding
  1072. ;we ensure that no collision is made
  1073. ;for that particular planet. Simply by
  1074. ;jumping straight to the end of the
  1075. ;RETURN TO SUBROUTINE command (RTS).
  1076.  
  1077. planetcol1
  1078.  
  1079.          lda planet1hit
  1080.          cmp #$01
  1081.          beq nothit1b
  1082.          lda objpos+4
  1083.          cmp collstore
  1084.          bcc nothit1a
  1085.          cmp collstore+1
  1086.          bcs nothit1a
  1087.          lda objpos+5
  1088.          cmp collstore+2
  1089.          bcc nothit1a
  1090.          cmp collstore+3
  1091.          bcs nothit1a
  1092.          jmp killplanet1
  1093.  
  1094.  
  1095. nothit1a
  1096.          lda objpos+4
  1097.          cmp collstore+4
  1098.          bcc nothit1b
  1099.          cmp collstore+5
  1100.          bcs nothit1b
  1101.          lda objpos+5
  1102.          cmp collstore+6
  1103.          bcc nothit1b
  1104.          cmp collstore+7
  1105.          bcs nothit1b
  1106.          jmp playerhit
  1107. nothit1b rts
  1108.  
  1109. planetcol2
  1110.          lda planet2hit
  1111.          cmp #$01
  1112.          beq nothit2b
  1113.          lda objpos+6
  1114.          cmp collstore
  1115.          bcc nothit2a
  1116.          cmp collstore+1
  1117.          bcs nothit2a
  1118.          lda objpos+7
  1119.          cmp collstore+2
  1120.          bcc nothit2a
  1121.          cmp collstore+3
  1122.          bcs nothit2a
  1123.          jmp killplanet2
  1124. nothit2a
  1125.          lda objpos+6
  1126.          cmp collstore+4
  1127.          bcc nothit2b
  1128.          cmp collstore+5
  1129.          bcs nothit2b
  1130.          lda objpos+7
  1131.          cmp collstore+6
  1132.          bcc nothit2b
  1133.          cmp collstore+7
  1134.          bcs nothit2b
  1135.          jmp playerhit
  1136. nothit2b rts
  1137.  
  1138. planetcol3
  1139.          lda planet3hit
  1140.          cmp #$01
  1141.          beq nothit3b
  1142.          lda objpos+8
  1143.          cmp collstore
  1144.          bcc nothit3a
  1145.          cmp collstore+1
  1146.          bcs nothit3a
  1147.          lda objpos+9
  1148.          cmp collstore+2
  1149.          bcc nothit3a
  1150.          cmp collstore+3
  1151.          bcs nothit3a
  1152.          jmp killplanet3
  1153. nothit3a
  1154.          lda objpos+8
  1155.          cmp collstore+4
  1156.          bcc nothit3b
  1157.          cmp collstore+5
  1158.          bcs nothit3b
  1159.          lda objpos+9
  1160.          cmp collstore+6
  1161.          bcc nothit3b
  1162.          cmp collstore+7
  1163.          bcc nothit3b
  1164.          jmp playerhit
  1165. nothit3b rts
  1166.  
  1167. planetcol4
  1168.          lda planet4hit
  1169.          cmp #$01
  1170.          beq nothit4b
  1171.          lda objpos+10
  1172.          cmp collstore
  1173.          bcc nothit4a
  1174.          cmp collstore+1
  1175.          bcs nothit4a
  1176.          lda objpos+11
  1177.          cmp collstore+2
  1178.          bcc nothit4a
  1179.          cmp collstore+3
  1180.          bcs nothit4a
  1181.          jmp killplanet4
  1182. nothit4a
  1183.          lda objpos+10
  1184.          cmp collstore+4
  1185.          bcc nothit4b
  1186.          cmp collstore+5
  1187.          bcs nothit4b
  1188.          lda objpos+11
  1189.          cmp collstore+6
  1190.          bcc nothit4b
  1191.          cmp collstore+7
  1192.          bcs nothit4b
  1193.          jmp playerhit
  1194. nothit4b rts
  1195.  
  1196. planetcol5
  1197.          lda planet5hit
  1198.          cmp #$01
  1199.          beq nothit5b
  1200.          lda objpos+12
  1201.          cmp collstore
  1202.          bcc nothit5a
  1203.          cmp collstore+1
  1204.          bcs nothit5a
  1205.          lda objpos+13
  1206.          cmp collstore+2
  1207.          bcc nothit5a
  1208.          cmp collstore+3
  1209.          bcs nothit5a
  1210.          jmp killplanet5
  1211. nothit5a
  1212.          lda objpos+12
  1213.          cmp collstore+4
  1214.          bcc nothit5b
  1215.          cmp collstore+5
  1216.          bcs nothit5b
  1217.          lda objpos+13
  1218.          cmp collstore+6
  1219.          bcc nothit5b
  1220.          cmp collstore+7
  1221.          bcs nothit5b
  1222.          jmp playerhit
  1223. nothit5b rts
  1224.  
  1225. planetcol6
  1226.          lda planet6hit
  1227.          cmp #$01
  1228.          beq nothit6b
  1229.          lda objpos+14
  1230.          cmp collstore
  1231.          bcc nothit6a
  1232.          cmp collstore+1
  1233.          bcs nothit6a
  1234.          lda objpos+15
  1235.          cmp collstore+2
  1236.          bcc nothit6a
  1237.          cmp collstore+3
  1238.          bcs nothit6a
  1239.          jmp killplanet6
  1240. nothit6a lda objpos+14
  1241.          cmp collstore+4
  1242.          bcc nothit6b
  1243.          cmp collstore+5
  1244.          bcs nothit6b
  1245.          lda objpos+15
  1246.          cmp collstore+6
  1247.          bcc nothit6b
  1248.          cmp collstore+7
  1249.          bcs nothit6b
  1250.          jmp playerhit
  1251. nothit6b rts
  1252.  
  1253. ;The player has been hit by a planet
  1254. ;therefore damage points will of course
  1255. ;be taken off the player's shield.
  1256.  
  1257. playerhit
  1258.          jsr drainshield
  1259.          jsr drainshield
  1260.          rts
  1261. drainshield
  1262.          dec shieldval+2
  1263.          ldx #$03
  1264. drainloop lda shieldval+0,x
  1265.          cmp #$2f
  1266.          bne shieldok
  1267.          lda #$39
  1268.          sta shieldval+0,x
  1269.          dec shieldval-1,x
  1270. shieldok dex
  1271.          bne drainloop
  1272.  
  1273. ;Check if the shield is below 000
  1274.  
  1275.          lda shieldval+0
  1276.          cmp #$2f
  1277.          beq shipdoomed
  1278.          rts
  1279.  
  1280. ;The player ship is doomed. So now we
  1281. ;blow the ship up in a cool way.
  1282.  
  1283. shipdoomed
  1284.          lda #$30
  1285.          sta shieldval+0 ;zero counter
  1286.          sta shieldval+1
  1287.          sta shieldval+2
  1288.  
  1289.  
  1290.          lda #$00
  1291.          sta explodedelay
  1292.          ldx #$00
  1293.          stx explodeptr
  1294. doomloop
  1295.          lda #$00
  1296.          sta delaytime
  1297.          cmp delaytime
  1298.          beq *-3
  1299.          lda #$01
  1300.          sta $d017 ;expand x and 7
  1301.          sta $d01d
  1302.  
  1303.          jsr expandpos
  1304.          jsr destroyplayer
  1305.          jmp doomloop
  1306.  
  1307. destroyplayer
  1308.  
  1309.          lda explodedelay
  1310.          cmp #$02
  1311.          beq delayfast
  1312.          inc explodedelay
  1313.          rts
  1314. delayfast
  1315.          lda #$00
  1316.          sta explodedelay
  1317.          ldx explodeptr
  1318.          lda explodetable,x
  1319.          sta $5ff8
  1320.          inx
  1321.          cpx #6
  1322.          beq finishedexp
  1323.          inc explodeptr
  1324.          rts
  1325. finishedexp
  1326.          ldx #$00
  1327.          stx explodeptr
  1328.  
  1329.          lda #$00
  1330.          sta $d015
  1331.  
  1332. ;Copy the player's score from the
  1333. ;screen ram. directly over to the
  1334. ;game over message.
  1335.  
  1336.          ldx #$00
  1337. copyscore lda scoreval,x
  1338.          sta finalscore,x
  1339.          inx
  1340.          cpx #6
  1341.          bne copyscore
  1342.  
  1343.          ldx #$00
  1344. copyend  lda deadmsg,x
  1345.          cmp #$3f
  1346.          bcc msgok
  1347.          sec
  1348.          sbc #$40
  1349. msgok    sta $07c0,x
  1350.          inx
  1351.          cpx #$28
  1352.          bne copyend
  1353.  
  1354. ;Now see if the player's score has
  1355. ;beaten the top score.
  1356.  
  1357.          lda finalscore+5
  1358.          sec
  1359.          lda topscore+5
  1360.          sbc finalscore+5
  1361.          lda topscore+4
  1362.          sbc finalscore+4
  1363.          lda topscore+3
  1364.          sbc finalscore+3
  1365.          lda topscore+2
  1366.          sbc finalscore+2
  1367.          lda topscore+1
  1368.          sbc finalscore+1
  1369.          lda topscore+0
  1370.          sbc finalscore+0
  1371.          bpl nohiscore
  1372.  
  1373. ;High score achieved so this will
  1374. ;final score will become the new high
  1375. ;score, before jumping back to the
  1376. ;front end.
  1377.  
  1378.          ldx #$00
  1379. puthi    lda finalscore,x
  1380.          sta topscore,x
  1381.          inx
  1382.          cpx #6
  1383.          bne puthi
  1384.  
  1385. nohiscore
  1386.          lda #$00
  1387.          sta firebutton
  1388.  
  1389. gameover
  1390.  
  1391.  
  1392. ;Wait for the player to press fire
  1393. ;to play again.
  1394.  
  1395. waitfire lda $dc00
  1396.          lsr a
  1397.          lsr a
  1398.          lsr a
  1399.          lsr a
  1400.          lsr a
  1401.          bit firebutton
  1402.          ror firebutton
  1403.          bmi waitfire
  1404.          bvc waitfire
  1405.          jmp titlescreen
  1406.  
  1407.  
  1408. ;The player successfully shot the first
  1409. ;planet. So engage destruction mode.
  1410.  
  1411. killplanet1
  1412.  
  1413.          ldx #$00
  1414.          stx explodeptr
  1415.          lda #$01
  1416.          sta planet1hit
  1417.          jsr score
  1418.          jmp removebullet
  1419.  
  1420. killplanet2
  1421.          ldx #$00
  1422.          stx explodeptr
  1423.          lda #$01
  1424.          sta planet2hit
  1425.          jsr score
  1426.          jmp removebullet
  1427.  
  1428. killplanet3
  1429.          ldx #$00
  1430.          stx explodeptr
  1431.          lda #$01
  1432.          sta planet3hit
  1433.          jsr score
  1434.          jmp removebullet
  1435. killplanet4
  1436.          ldx #$00
  1437.          stx explodeptr
  1438.          lda #$01
  1439.          sta planet4hit
  1440.          jsr score
  1441.          jmp removebullet
  1442. killplanet5
  1443.          ldx #$00
  1444.          stx explodeptr
  1445.          lda #$01
  1446.          sta planet5hit
  1447.          jsr score
  1448.          jmp removebullet
  1449. killplanet6
  1450.          ldx #$00
  1451.          stx explodeptr
  1452.          lda #$01
  1453.          sta planet6hit
  1454.          jsr score
  1455.  
  1456. removebullet
  1457.          ldx #$00
  1458.          stx objpos+2
  1459.          rts
  1460.  
  1461. ;Player scores points per planet shot
  1462.  
  1463. score    inc scoreval+4
  1464.          ldx #$04
  1465. scloop   lda scoreval+0,x
  1466.          cmp #$3a
  1467.          bne scoreok
  1468.          lda #$30
  1469.          sta scoreval+0,x
  1470.          inc scoreval-1,x
  1471. scoreok  dex
  1472.          bne scloop
  1473.          rts
  1474.  
  1475. ;The first main interrupt. This will
  1476. ;switch the sync timer on (delaytime).
  1477.  
  1478. irq1     asl $d019
  1479.          lda $dc0d
  1480.          sta $dd0d
  1481.          lda #raspos2
  1482.          sta $d012
  1483.          lda #$01     ;See TIRQ
  1484.          sta delaytime
  1485.          lda #<irq2
  1486.          sta $0314
  1487.          lda #>irq2
  1488.          sta $0315
  1489.          pla
  1490.          tay
  1491.          pla
  1492.          tax
  1493.          pla
  1494.          rti
  1495.  
  1496. ;The next interrupt will display the
  1497. ;bitmap picture.
  1498.  
  1499. irq2     asl $d019
  1500.          lda #raspos3
  1501.          sta $d012
  1502.  
  1503.          lda #$3b  ;Bitmap mode
  1504.          sta $d011
  1505.  
  1506.          lda #$18  ;Multicolour on
  1507.          sta $d016
  1508.  
  1509.          lda #$78  ;Read VideoRAM $5c00
  1510.          sta $d018
  1511.  
  1512.          lda #$02
  1513.          sta $dd00 ;VIC BANK #$02
  1514.  
  1515.          lda #$00
  1516.          sta $d01b ;Sprites in front
  1517.  
  1518.          lda #$ff
  1519.          sta $d01c ;Sprite multicolour
  1520.                    ;on.
  1521.          ldx #$00
  1522. setcols2
  1523.          lda colourstore,x ;Sprite cols
  1524.          sta $d027,x       ;set
  1525.          inx
  1526.          cpx #8
  1527.          bne setcols2
  1528.  
  1529.          lda #<irq3
  1530.          sta $0314
  1531.          lda #>irq3
  1532.          sta $0315
  1533.          pla
  1534.          tay
  1535.          pla
  1536.          tax
  1537.          pla
  1538.          rti
  1539.  
  1540. ;This interrupt will display the status
  1541. ;bar at the bottom of the screen. The
  1542. ;VIC Bank $03 is used, and charset is
  1543. ;at $2000, so we use $18. Screen
  1544. ;multicolour is disabled. Also mask the
  1545. ;sprites to go behind the status bar
  1546. ;invisibly
  1547.  
  1548. irq3     asl $d019
  1549.          lda #raspos4
  1550.          sta $d012
  1551.  
  1552.          lda #$08
  1553.          sta $d016
  1554.  
  1555.          lda #$18
  1556.          sta $d018
  1557.  
  1558.          lda #$03
  1559.          sta $dd00
  1560.  
  1561.          lda #$00
  1562.          sta $d01c
  1563.  
  1564.          lda #$ff
  1565.          sta $d01b
  1566.  
  1567.          lda #$1b
  1568.          sta $d011
  1569.  
  1570.          ldx #$00
  1571. makecols lda #$00
  1572.          sta $d027,x
  1573.          inx
  1574.          cpx #8
  1575.          bne makecols
  1576.  
  1577.          lda #<irq1
  1578.          sta $0314
  1579.          lda #>irq1
  1580.          sta $0315
  1581.  
  1582.          jsr $1003
  1583.          pla
  1584.          tay
  1585.          pla
  1586.          tax
  1587.          pla
  1588.          rti
  1589.  
  1590. ;Status panel for the game:
  1591.  
  1592. status
  1593.          .text "score: 000"
  1594.          .text "000  -plan"
  1595.          .text "et  popper"
  1596.          .text "!-  [: 100"
  1597.  
  1598. ;Death message for game over
  1599.  
  1600. deadmsg
  1601.          .text "ship destr"
  1602.          .text "oyed - fin"
  1603.          .text "al score w"
  1604.          .text "as: "
  1605. finalscore
  1606.          .text "000000"
  1607. topscore
  1608.          .text "000000"
  1609.  
  1610.  
  1611. ;Default sprite frame table.
  1612.  
  1613. dfltframe .byte $02,$0e,$0a,$0a
  1614.          .byte $0a,$0a,$0a,$0a
  1615.  
  1616. ;Sprite colour table
  1617.  
  1618. dfltcols .byte $09,$01,$07,$03
  1619.          .byte $0e,$05,$04,$0d
  1620.  
  1621. ;Position table
  1622.  
  1623. dfltpos  .byte $58,$d0 ;Player start
  1624.          .byte $00,$00 ;Bullet start
  1625.          .byte $20,$00 ;Planet 1
  1626.          .byte $30,$00 ;Planet 2
  1627.          .byte $40,$00 ;Planet 3
  1628.          .byte $50,$00 ;Planet 4
  1629.          .byte $60,$00 ;Planet 5
  1630.          .byte $a0,$00 ;Planet 6
  1631.  
  1632. ;Animation frame tables for sprites
  1633.  
  1634. planetframe1
  1635.          .byte $0d,$08,$09,$0a
  1636.          .byte $0b,$0c
  1637. planetframe2
  1638.  
  1639.          .byte $0c,$0d,$08,$09
  1640.          .byte $0a,$0b
  1641. planetframe3
  1642.  
  1643.          .byte $0b,$0c,$0d,$08
  1644.          .byte $09,$0a
  1645. planetframe4
  1646.  
  1647.          .byte $0a,$0b,$0c,$0d
  1648.          .byte $08,$09
  1649. planetframe5
  1650.  
  1651.          .byte $09,$0a,$0b,$0c
  1652.          .byte $0d,$08
  1653. planetframe6
  1654.  
  1655.          .byte $08,$09,$0a,$0b
  1656.          .byte $0c,$0d
  1657.  
  1658. explodetable
  1659.  
  1660.          .byte $03,$04,$05,$06
  1661.          .byte $10,$10,$10,$10
  1662.  
  1663. ;Random position and speed tables
  1664.  
  1665. randtable
  1666.          .byte $10,$98,$30,$20,$a0
  1667.          .byte $48,$60,$80,$78,$28
  1668.          .byte $50,$38,$20,$60,$10
  1669.          .byte $88,$90,$30,$18,$50
  1670.          .byte $48,$a0,$58,$20,$90
  1671.  
  1672. randspeedtable
  1673.  
  1674.          .byte $01,$04,$02,$03,$05
  1675.          .byte $04,$01,$02,$03,$03
  1676.          .byte $01,$03,$04,$01,$02
  1677.          .byte $03,$02,$03,$04,$01
  1678.          .byte $05,$01,$04,$03,$01
  1679.  
  1680. dirtable
  1681.          .byte $00,$00,$01,$01,$ff
  1682.          .byte $ff,$00,$00,$02,$02
  1683.          .byte $fe,$fe,$01,$01,$ff
  1684.          .byte $ff,$00,$00,$01,$01
  1685.          .byte $02,$02,$fe,$fe,$01
  1686.          .byte $01,$ff,$ff,$02,$02
  1687.  
  1688.