daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Jun 26th, 2018 144 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   .inesprg 1   ; 1x 16KB PRG code
  2.   .ineschr 1   ; 1x  8KB CHR data
  3.   .inesmap 0   ; mapper 0 = NROM, no bank swapping
  4.   .inesmir 1   ; background mirroring
  5.  
  6.  
  7. ;;;;;;;;;;;;;;;
  8.  
  9. ;; VARIABLES
  10.   .rsset $0000  ;;start variables at ram location 0
  11.  
  12. BALL_POS_X              .rs 1 ;$0000
  13. BALL_POS_Y              .rs 1 ;$0001
  14. BALL_DIRECTION_X        .rs 1
  15. BALL_DIRECTION_Y        .rs 1
  16. BALL_IS_DIR_X_POSITIVE  .rs 1
  17. BALL_IS_DIR_Y_POSITIVE  .rs 1
  18. PADDLE_RIGHT_X_POSITION .rs 1
  19. PADDLE_LEFT_X_POSITION  .rs 1
  20. BRICK_Y_MAX             .rs 1
  21. BALL_IS_COLL_WITH_BRICK .rs 1
  22. BALL_POS_X_ON_TILE      .rs 1
  23. BALL_POS_Y_ON_TILE      .rs 1
  24. BALL_POS_X_ON_TILE_PREV .rs 1
  25. BALL_POS_Y_ON_TILE_PREV .rs 1
  26. BALL_POS_NEXT_TILE      .rs 1
  27. NAMETABLE_TO_LOAD       .rs 2
  28.  
  29. ; CONSTANTS
  30.  
  31. WALL_RIGHT   = $B8
  32. WALL_LEFT    = $0F
  33. WALL_TOP     = $0F
  34. WALL_BOTTOM  = $E9
  35. PADDLE_Y_POS = $D4
  36.  
  37. ;;;;;;;;;;;;;;;
  38.  
  39.    
  40.   .bank 0
  41.   .org $C000
  42. RESET:
  43.   SEI          ; disable IRQs
  44.   CLD          ; disable decimal mode
  45.   LDX #$40
  46.   STX $4017    ; disable APU frame IRQ
  47.   LDX #$FF
  48.   TXS          ; Set up stack
  49.   INX          ; now X = 0
  50.   STX $2000    ; disable NMI
  51.   STX $2001    ; disable rendering
  52.   STX $4010    ; disable DMC IRQs
  53.  
  54. vblankwait1:       ; First wait for vblank to make sure PPU is ready
  55.   BIT $2002
  56.   BPL vblankwait1
  57.  
  58. clrmem:
  59.   LDA #$00
  60.   STA $0000, x
  61.   STA $0100, x
  62.   STA $0300, x
  63.   STA $0400, x
  64.   STA $0500, x
  65.   STA $0600, x
  66.   STA $0700, x
  67.   LDA #$FE
  68.   STA $0200, x    ;move all sprites off screen
  69.   INX
  70.   BNE clrmem
  71.    
  72. vblankwait2:      ; Second wait for vblank, PPU is ready after this
  73.   BIT $2002
  74.   BPL vblankwait2
  75.  
  76.  
  77.  
  78. LoadPalettes:
  79.   LDA $2002    ; read PPU status to reset the high/low latch
  80.   LDA #$3F
  81.   STA $2006    ; write the high byte of $3F00 address
  82.   LDA #$00
  83.   STA $2006    ; write the low byte of $3F00 address
  84.   LDX #$00
  85. LoadPalettesLoop:
  86.   LDA palette, x        ;load palette byte
  87.   STA $2007             ;write to PPU
  88.   INX                   ;set index to next byte
  89.   CPX #$20            
  90.   BNE LoadPalettesLoop  ;if x = $20, 32 bytes copied, all done
  91.  
  92. ;===================================
  93. ; Start Settings
  94. ;===================================
  95.  
  96.   LDA #$C8
  97.   STA BALL_POS_Y ; Posizione iniziale della palla sull'asse Y
  98.  LDA #$20
  99.  STA BALL_POS_X ; Posizione iniziale della palla sull'asse X
  100.   LDA #$01
  101.   STA BALL_DIRECTION_Y ; Direzione verticale iniziale verso l'alto
  102.  LDA #$00
  103.  STA BALL_DIRECTION_X ; Direzione orizzontale iniziale zero
  104.  LDA #$01
  105.  STA BALL_IS_DIR_Y_POSITIVE
  106.  LDA #$01
  107.  STA BALL_IS_DIR_X_POSITIVE
  108.  
  109. ;===================================
  110. ; Player Graphics
  111. ;===================================
  112. LoadSprites:
  113.  LDX #$00              ;start X register at 0
  114. LoadSpritesLoop:
  115.  LDA player_sprites, x ;load data from address ( player_sprites + x )
  116.  STA $0200, x          ;store int RAM address ( $0200 + x ), lo scriviamo in RAM incrementando
  117.                        ;la locazione
  118.  INX                   ; X++
  119.  CPX #$20              ; Compare X to hex $10, decimal 16 - copying 16 bytes = 4 sprites
  120.  BNE LoadSpritesLoop   ; if ( !CPX #$20 ( 16 bytes == 4 sprites ) ), loop at LoadSpritesLoop
  121.  
  122. ;===================================
  123. ; Ball Graphics
  124. ;===================================
  125. LoadBallSprites:
  126.  LDX #$00
  127. LoadBallSpriteLoop:
  128.  LDA ball_sprites, x
  129.  STA $0210, x
  130.  INX
  131.  CPX #$04
  132.  BNE LoadBallSpriteLoop
  133.  
  134. ;===================================
  135. ; Bricks Graphics
  136. ;===================================
  137.  
  138. ;LoadBricksSprites:
  139. ;  LDX #$00
  140. ;LoadBricksSpritesLoop:
  141. ;  LDA brick_sprites, x
  142. ;  STA $0214, x
  143. ;  INX
  144. ;  CPX #$FF
  145. ;  BNE LoadBricksSpritesLoop
  146.  
  147. ;===================================
  148. ; Background
  149. ;===================================  
  150.  
  151. LoadBackground:
  152.  LDA $2002             ; read PPU status to reset the high/low latch
  153.  LDA #$20
  154.  STA $2006             ; write the high byte of $2000 address
  155.  LDA #$00
  156.  STA $2006             ; write the low byte of $2000 address
  157.  
  158.  LDX #$00              ; start out at 0
  159. ; Disegnamo lo sfondo del livello di Arkanoid
  160. LoadBackgroundLoop:
  161.  LDA bg_raw, x      
  162.  STA $2007              
  163.  INX                    
  164.  CPX #$20                
  165.  BNE LoadBackgroundLoop
  166.  
  167.  LDX #$00
  168. LoadBackgroundTopCornerLoop:
  169.  LDA bg_lvl_top_corner, x      
  170.  STA $2007              
  171.  INX                    
  172.  CPX #$20                
  173.  BNE LoadBackgroundTopCornerLoop
  174.  
  175.  ;ASL A
  176.  ;TAX
  177.  ;LDX #$00
  178.  ;LDA LevelPointers + 0, x
  179.  ;STA NAMETABLE_TO_LOAD + 0
  180.  ;LDA LevelPointers + 1, x
  181.  ;STA NAMETABLE_TO_LOAD + 1
  182.  ;LDA LevelPointers + 2, x
  183.  ;STA NAMETABLE_TO_LOAD + 2
  184.  
  185.  ;multiply the index by 2, since each pointer is 2 bytes, and put it in an index register
  186.  asl A
  187.  tay
  188.  
  189.  ;copy the pointer to zero page
  190.  lda LevelPointers+0, y
  191.  sta NAMETABLE_TO_LOAD+0
  192.  lda LevelPointers+1, y
  193.  sta NAMETABLE_TO_LOAD+1
  194.  
  195.  ;copy 1024 bytes from the location indicated by the pointer to VRAM
  196.  ldx #$04
  197.  ldy #$00
  198. CopyByte:
  199.  lda (NAMETABLE_TO_LOAD), y
  200.  sta $2007
  201.  iny
  202.  bne CopyByte ;go copy another byte if less than 256 have been copied
  203.  inc NAMETABLE_TO_LOAD+1 ;advance the pointer by 256 positions
  204.  dex
  205.  bne CopyByte ;go copy 256 more bytes if less than 1024 have been copied
  206.  
  207.  
  208.              
  209. LoadAttribute:
  210.  LDA $2002             ; read PPU status to reset the high/low latch
  211.  LDA #$23
  212.  STA $2006             ; write the high byte of $23C0 address
  213.  LDA #$C0
  214.  STA $2006             ; write the low byte of $23C0 address
  215.  LDX #$00              ; start out at 0
  216. LoadAttributeLoop:
  217.  LDA attribute, x      ; load data from address (attribute + the value in x)
  218.  STA $2007             ; write to PPU
  219.  INX                   ; X = X + 1
  220.  CPX #$08              ; Compare X to hex $08, decimal 8 - copying 8 bytes
  221.  BNE LoadAttributeLoop  ; Branch to LoadAttributeLoop if compare was Not Equal to zero
  222.                        ; if compare was equal to 128, keep going down
  223.  
  224.  ;;This is the PPU clean up section, so rendering the next frame starts properly.
  225.  LDA #%10010000   ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1
  226.  STA $2000
  227.  LDA #%00011110   ; enable sprites, enable background, no clipping on left side
  228.  STA $2001
  229.  LDA #$00        ;;tell the ppu there is no background scrolling
  230.  STA $2005
  231.  STA $2005
  232.  
  233. Forever:
  234.  JMP Forever     ;jump back to Forever, infinite loop
  235.  
  236. NMI:
  237.  LDA #$00
  238.  STA $2003  ; set the low byte (00) of the RAM address
  239.  LDA #$02
  240.  STA $4014  ; set the high byte (02) of the RAM address, start the transfer
  241.  
  242. ;===================================
  243. ; Ball Movements
  244. ;===================================  
  245.  
  246. MoveBallY:
  247.  LDA #$01                    ; Carichiamo un valore positivo
  248.  CMP BALL_IS_DIR_Y_POSITIVE  ; Confrontiamo con l'attuale direzione
  249.   BEQ MoveBallUp
  250.  
  251. MoveBallDown:
  252.   LDA BALL_POS_Y
  253.   CLC
  254.   ADC #BALL_DIRECTION_Y
  255.   STA BALL_POS_Y
  256.  
  257.   JMP EndCheckBallMovementY
  258.  
  259. MoveBallUp:
  260.   LDA BALL_POS_Y
  261.   SEC
  262.   SBC #BALL_DIRECTION_Y
  263.   STA BALL_POS_Y
  264.  
  265.   JMP EndCheckBallMovementY
  266.  
  267. EndCheckBallMovementY:
  268.   LDA BALL_POS_Y
  269.   STA $0210       ; Inserisco il valore nell'indirizzo di memoria che detiene la posizione Y
  270.                  ; della pallina
  271.  
  272. MoveBallX:
  273.  LDA #$01                    ; Carichiamo un valore positivo
  274.  CMP BALL_IS_DIR_X_POSITIVE  ; Confrontiamo con l'attuale direzione
  275.   BEQ MoveBallRight
  276.  
  277. MoveBallLeft:
  278.   LDA BALL_POS_X
  279.   SEC
  280.   SBC #BALL_DIRECTION_X
  281.   STA BALL_POS_X
  282.  
  283.   JMP EndCheckBallMovementX
  284.  
  285. MoveBallRight:
  286.   LDA BALL_POS_X
  287.   CLC
  288.   ADC #BALL_DIRECTION_X
  289.   STA BALL_POS_X
  290.  
  291.   JMP EndCheckBallMovementX
  292.  
  293. EndCheckBallMovementX:
  294.   LDA BALL_POS_X
  295.   STA $0213         ; Inserisco il valore nell'indirizzo di memoria che detiene la posizione X
  296.                    ; della pallina
  297.  
  298. PerformCheckWallHitTop:
  299.  LDA BALL_POS_Y
  300.  CMP #WALL_TOP
  301.  BCC PerformHitWallTop
  302.  JMP PerformNotHitWallTop
  303.  
  304. PerformHitWallTop:
  305.  LDA #$00
  306.  STA BALL_IS_DIR_Y_POSITIVE
  307.  
  308. PerformNotHitWallTop:
  309.  ;do nothing
  310.  
  311. PerformCheckWallBottom:
  312.  LDA BALL_POS_Y
  313.  CMP #WALL_BOTTOM
  314.  BCC PerformNotHitWallBottom
  315.  JMP PerformHitWallBottom
  316.  
  317. PerformHitWallBottom:
  318.  LDA #$01
  319.  STA BALL_IS_DIR_Y_POSITIVE
  320.  
  321. PerformNotHitWallBottom:
  322.  ;do nothing
  323.  
  324. PerformCheckWallHitLeft:
  325.  LDA BALL_POS_X
  326.  CMP #WALL_LEFT
  327.  BCC PerformHitWallLeft
  328.  JMP PerformNotHitWallLeft
  329.  
  330. PerformHitWallLeft:
  331.  LDA #$01
  332.  STA BALL_IS_DIR_X_POSITIVE
  333.  
  334. PerformNotHitWallLeft:
  335.  ;do nothing
  336.  
  337. PerformCheckWallRight:
  338.  LDA BALL_POS_X
  339.  CMP #WALL_RIGHT
  340.  BCC PerformNotHitWallRight
  341.  JMP PerformHitWallRight
  342.  
  343. PerformHitWallRight:
  344.  LDA #$00
  345.  STA BALL_IS_DIR_X_POSITIVE
  346.  
  347. PerformNotHitWallRight:
  348.  ;do nothing
  349.  
  350. ;=====================================
  351. ; Ball Collision Detection With Paddle
  352. ;=====================================  
  353.  
  354. CheckPaddleHit:
  355.  LDA BALL_POS_Y
  356.  CMP #PADDLE_Y_POS
  357.  BEQ PerformBallIsHittingPaddle
  358.  JMP PerformBallNotHitPaddle
  359.  
  360. PerformBallIsHittingPaddle:
  361.  ; La palla è alla stessa altezza della racchetta,
  362.  ; dobbiamo calcolare la collisione
  363.  
  364.  LDA BALL_POS_X
  365.  CMP PADDLE_LEFT_X_POSITION
  366.  BCC PerformEndCollisionDetection
  367.  
  368. PeformCheckBallInXCollision:
  369.  LDA BALL_POS_X
  370.  CMP PADDLE_RIGHT_X_POSITION
  371.  BCC PerformBallHitByPaddle
  372.  JMP PerformEndCollisionDetection
  373.  
  374. PerformBallHitByPaddle:
  375.  ; Abbiamo colpito la racchetta!
  376.  LDA #$01
  377.  STA BALL_IS_DIR_Y_POSITIVE
  378.  
  379. PerformEndCollisionDetection:
  380.  ;do nothing
  381.  
  382. PerformBallNotHitPaddle:
  383.  ; do nothing
  384.  
  385. ;=====================================
  386. ; Ball Collision Detection With Bricks
  387. ;=====================================  
  388.  
  389.  LDA BALL_POS_X_ON_TILE        ; we need this for collision detection
  390.  STA BALL_POS_X_ON_TILE_PREV
  391.  LDA BALL_POS_Y_ON_TILE
  392.  STA BALL_POS_Y_ON_TILE_PREV
  393.  
  394.  LDA #$00
  395.  STA BALL_POS_X_ON_TILE
  396.  STA BALL_POS_Y_ON_TILE
  397.  
  398.  LDA BALL_POS_X
  399.  ;CLC
  400.  ;ADC #$04                ; Aggiungiamo 4 pixel per centrare la posizione
  401.  LSR A
  402.     LSR A
  403.     LSR A                   ; Divide by 8
  404.  STA BALL_POS_X_ON_TILE
  405.  
  406.  LDA BALL_POS_Y          
  407.  ;CLC
  408.  ;ADC #$04                ; Aggiungiamo 4 pixel per centrare la posizione
  409.  SEC
  410.  SBC #$0F                 ; subtrack 16 pixel to put x in the same x space of the tiles
  411.  
  412.  LSR A
  413.  LSR A
  414.  LSR A                   ; Divide by 8
  415.  STA BALL_POS_Y_ON_TILE
  416.  
  417.        ; TOGLIERE!!
  418.        LDA BALL_POS_Y_ON_TILE
  419.        CMP #$08
  420.        BCC _ContinueCheckColl ; Saltiamo il controllo se ci troviamo oltre il Tile 7
  421.        JMP PerformBallNotHitBrick
  422.        ; TOGLIERE!!
  423.  
  424. _ContinueCheckColl:
  425.  LDX #$00
  426. ComputeXYOnTile:
  427.  LDA BALL_POS_X_ON_TILE
  428.  CLC
  429.  ADC #$20
  430.  STA BALL_POS_X_ON_TILE
  431.  INX
  432.  CPX BALL_POS_Y_ON_TILE
  433.  BNE ComputeXYOnTile
  434.  
  435.  ;Verify the collision with the left part of the brick
  436. PerformBallColWithBrickLeft:
  437.  LDX BALL_POS_X_ON_TILE
  438.  LDA bg_lvl_1_0, x
  439.  CMP #$2D
  440.  BEQ PerformBallCollisionWithBrick
  441.  
  442. PerformBallColWithBrickRight:
  443.  LDX BALL_POS_X_ON_TILE
  444.  LDA bg_lvl_1_0, x
  445.  CMP #$2E
  446.  BEQ PerformBallCollisionWithBrick
  447.  JMP PerformBallNotHitBrick
  448.  
  449.  ; Collision
  450. PerformBallCollisionWithBrick:
  451.  LDA #$01
  452.  STA $0212
  453.  
  454.  ;Ricordiamo che questo il tile preciso dove è avvenuta la collisione
  455.  
  456.  LDA BALL_POS_X_ON_TILE_PREV
  457.  CLC
  458.  ADC #$01
  459.  STA BALL_POS_X_ON_TILE_PREV
  460.  LDA BALL_POS_X_ON_TILE
  461.  CMP BALL_POS_X_ON_TILE_PREV
  462.  BEQ _BounchLeft
  463.  
  464.  LDA BALL_POS_X_ON_TILE_PREV
  465.  SEC
  466.  SBC #$02
  467.  STA BALL_POS_X_ON_TILE_PREV
  468.  LDA BALL_POS_X_ON_TILE
  469.  CMP BALL_POS_X_ON_TILE_PREV
  470.  BEQ _BounchRight
  471.  
  472.  LDA BALL_POS_X_ON_TILE_PREV
  473.  CLC
  474.  ADC #$21
  475.  STA BALL_POS_X_ON_TILE_PREV
  476.  LDA BALL_POS_X_ON_TILE
  477.  CMP BALL_POS_X_ON_TILE_PREV
  478.  BEQ _BounchUp
  479.  
  480.  LDA BALL_POS_X_ON_TILE_PREV
  481.  SEC
  482.  SBC #$40
  483.  STA BALL_POS_X_ON_TILE_PREV
  484.  LDA BALL_POS_X_ON_TILE
  485.  CMP BALL_POS_X_ON_TILE_PREV
  486.  BEQ _BounchDown
  487.  
  488.  JMP _CheckCollDiagonals
  489.  
  490. _BounchDown:
  491.  LDA #$00
  492.  STA BALL_IS_DIR_Y_POSITIVE
  493.  JMP CCCOABContinueLoop
  494.  
  495. _BounchUp:
  496.  LDA #$01
  497.  STA BALL_IS_DIR_Y_POSITIVE
  498.  JMP CCCOABContinueLoop
  499.  
  500. _BounchRight:
  501.  LDA #$01
  502.  STA BALL_IS_DIR_X_POSITIVE
  503.  JMP CCCOABContinueLoop
  504.  
  505. _BounchLeft:
  506.  LDA #$00
  507.  STA BALL_IS_DIR_X_POSITIVE
  508.  JMP CCCOABContinueLoop
  509.  
  510. _CheckCollDiagonals:
  511.  ; Controlliamo le diagonali
  512.  
  513.  ; Alto Sinitra
  514.  LDA BALL_POS_X_ON_TILE_PREV
  515.  CLC
  516.  ADC #$41
  517.  STA BALL_POS_X_ON_TILE_PREV
  518.  LDA BALL_POS_X_ON_TILE
  519.  CMP BALL_POS_X_ON_TILE_PREV
  520.  BNE _ContinueCheckUpRight
  521.  
  522.  JMP _BounchUpLeft
  523.  
  524. _ContinueCheckUpRight:
  525.  ; Alto a Destra
  526.  LDA BALL_POS_X_ON_TILE_PREV
  527.  SEC
  528.  SBC #$02
  529.  STA BALL_POS_X_ON_TILE_PREV
  530.  LDA BALL_POS_X_ON_TILE
  531.  CMP BALL_POS_X_ON_TILE_PREV
  532.  BNE _ContinueCheckDownRight
  533.  
  534.  JMP _BounchUpRight
  535.  
  536. _ContinueCheckDownRight:
  537.  ; Basso Destra
  538.  LDA BALL_POS_X_ON_TILE_PREV
  539.  SEC
  540.  SBC #$40
  541.  STA BALL_POS_X_ON_TILE_PREV
  542.  LDA BALL_POS_X_ON_TILE
  543.  CMP BALL_POS_X_ON_TILE_PREV
  544.  BEQ _BounchDownRight
  545.  
  546.  ; Basso Sinistra
  547.  LDA BALL_POS_X_ON_TILE_PREV
  548.  CLC
  549.  ADC #$02
  550.  STA BALL_POS_X_ON_TILE_PREV
  551.  LDA BALL_POS_X_ON_TILE
  552.  CMP BALL_POS_X_ON_TILE_PREV
  553.  BEQ _BounchDownLeft
  554.  JMP CCCOABContinueLoop
  555.  
  556. _BounchDownLeft:
  557.  ;Controlliamo che a sinistra sia libero
  558.  LDX #$00
  559.  LDA BALL_POS_X_ON_TILE_PREV
  560.  SEC
  561.  SBC #$01
  562.  STA BALL_POS_X_ON_TILE_PREV
  563.  
  564.  LDX BALL_POS_X_ON_TILE_PREV
  565.  LDA bg_lvl_1_0, x
  566.  CMP #$27
  567.  BNE _BounchDownLeftCheckDown
  568.  
  569.  ;E' libero a sinistra, rimbalza verso sinistra e su allora
  570.   LDA #$00
  571.   STA BALL_IS_DIR_X_POSITIVE
  572.   LDA #$01
  573.   STA BALL_IS_DIR_Y_POSITIVE
  574.   JMP CCCOABContinueLoop
  575.  
  576. _BounchDownLeftCheckDown:
  577.   ;Controlliamo che a sotto sia libero
  578.   LDX #$00
  579.   LDA BALL_POS_X_ON_TILE_PREV
  580.   CLC
  581.   ADC #$21
  582.   STA BALL_POS_X_ON_TILE_PREV
  583.  
  584.   LDX BALL_POS_X_ON_TILE_PREV
  585.   LDA bg_lvl_1_0, x
  586.   CMP #$27
  587.   BNE _BounchDownLeftPerfect
  588.  
  589.   ; E' libero sotto, rimbalzo verso il basso
  590.  LDA #$01
  591.  STA BALL_IS_DIR_X_POSITIVE
  592.  LDA #$00
  593.  STA BALL_IS_DIR_Y_POSITIVE
  594.  JMP CCCOABContinueLoop
  595.  
  596. _BounchDownLeftPerfect:
  597.  LDA #$00
  598.  STA BALL_IS_DIR_X_POSITIVE
  599.  LDA #$00
  600.  STA BALL_IS_DIR_Y_POSITIVE
  601.  JMP CCCOABContinueLoop
  602.  
  603. _BounchDownRight:
  604.  ;Controlliamo che a destra sia libero
  605.  LDX #$00
  606.  LDA BALL_POS_X_ON_TILE_PREV
  607.  CLC
  608.  ADC #$01
  609.  STA BALL_POS_X_ON_TILE_PREV
  610.  
  611.  LDX BALL_POS_X_ON_TILE_PREV
  612.  LDA bg_lvl_1_0, x
  613.  CMP #$27
  614.  BNE _BounchDownRightCheckDown
  615.  
  616.  ;E' libero a destra, rimbalza verso l'alto
  617.  LDA #$01
  618.  STA BALL_IS_DIR_X_POSITIVE
  619.  LDA #$01
  620.  STA BALL_IS_DIR_Y_POSITIVE
  621.  JMP CCCOABContinueLoop
  622.  
  623. _BounchDownRightCheckDown:
  624.  ;Controlliamo se sotto è libero
  625.  LDX #$00
  626.  LDA BALL_POS_X_ON_TILE_PREV
  627.  CLC
  628.  ADC #$1F
  629.  STA BALL_POS_X_ON_TILE_PREV
  630.  
  631.  LDX BALL_POS_X_ON_TILE_PREV
  632.  LDA bg_lvl_1_0, x
  633.  CMP #$27
  634.  BNE _BounchDownRightPerfect
  635.  
  636.  ; E' libero sotto, rimbalzo verso il basso
  637.   LDA #$00
  638.   STA BALL_IS_DIR_X_POSITIVE
  639.   LDA #$00
  640.   STA BALL_IS_DIR_Y_POSITIVE
  641.   JMP CCCOABContinueLoop
  642.  
  643. _BounchDownRightPerfect:
  644.   LDA #$01
  645.   STA BALL_IS_DIR_X_POSITIVE
  646.   LDA #$00
  647.   STA BALL_IS_DIR_Y_POSITIVE
  648.   JMP CCCOABContinueLoop
  649.  
  650. _BounchUpRight:
  651.   ;Controlliamo che sopra sia libero
  652.   LDX #$00
  653.   LDA BALL_POS_X_ON_TILE_PREV
  654.   SEC
  655.   SBC #$20
  656.   STA BALL_POS_X_ON_TILE_PREV
  657.  
  658.   LDX BALL_POS_X_ON_TILE_PREV
  659.   LDA bg_lvl_1_0, x
  660.   CMP #$27
  661.   BNE _BounchUpRightCheckDown
  662.  
  663.   ;E' libero sopra, rimbalza verso sinistra allora
  664.  LDA #$00
  665.  STA BALL_IS_DIR_X_POSITIVE
  666.  LDA #$01
  667.  STA BALL_IS_DIR_Y_POSITIVE
  668.  JMP CCCOABContinueLoop
  669.  
  670. _BounchUpRightCheckDown:
  671.  ;Controlliamo che a destra sia libero
  672.  LDX #$00
  673.  LDA BALL_POS_X_ON_TILE_PREV
  674.  CLC
  675.  ADC #$21
  676.  STA BALL_POS_X_ON_TILE_PREV
  677.  
  678.  LDX BALL_POS_X_ON_TILE_PREV
  679.  LDA bg_lvl_1_0, x
  680.  CMP #$27
  681.  BNE _BounchUpRightPerfect
  682.  
  683.  ; E' libero a destra, rimbalzo verso il basso
  684.   LDA #$01
  685.   STA BALL_IS_DIR_X_POSITIVE
  686.   LDA #$00
  687.   STA BALL_IS_DIR_Y_POSITIVE
  688.   JMP CCCOABContinueLoop
  689.  
  690. _BounchUpRightPerfect:
  691.   LDA #$01
  692.   STA BALL_IS_DIR_X_POSITIVE
  693.   LDA #$01
  694.   STA BALL_IS_DIR_Y_POSITIVE
  695.   JMP CCCOABContinueLoop
  696.  
  697. _BounchUpLeft:
  698.  
  699.   ;Controlliamo che sopra AL PUNTO DI COLLISIONE sia libero
  700.   LDX #$00
  701.   LDA BALL_POS_X_ON_TILE_PREV
  702.   SEC
  703.   SBC #$20
  704.   STA BALL_POS_X_ON_TILE_PREV
  705.  
  706.   LDX BALL_POS_X_ON_TILE_PREV
  707.   LDA bg_lvl_1_0, x
  708.   CMP #$27
  709.   BNE _BounchUpLeftCheckDown
  710.  
  711.   ;E' libero sopra, rimbalza verso destra allora
  712.  LDA #$01
  713.  STA BALL_IS_DIR_X_POSITIVE
  714.  LDA #$01
  715.  STA BALL_IS_DIR_Y_POSITIVE
  716.  JMP CCCOABContinueLoop
  717.  
  718. _BounchUpLeftCheckDown:
  719.  
  720.  ;Controlliamo che a sinistra sia libero
  721.  LDX #$00
  722.  LDA BALL_POS_X_ON_TILE_PREV
  723.  CLC
  724.  ADC #$1F
  725.  STA BALL_POS_X_ON_TILE_PREV
  726.  
  727.  LDX BALL_POS_X_ON_TILE_PREV
  728.  LDA bg_lvl_1_0, x
  729.  CMP #$27
  730.  BNE _BounchUpLeftPerfect
  731.  
  732.  ; E' libero a sinistra, rimbalzo verso il basso
  733.   LDA #$00
  734.   STA BALL_IS_DIR_X_POSITIVE
  735.   LDA #$00
  736.   STA BALL_IS_DIR_Y_POSITIVE
  737.   JMP CCCOABContinueLoop
  738.  
  739. _BounchUpLeftPerfect:
  740.   LDA #$00
  741.   STA BALL_IS_DIR_X_POSITIVE
  742.   LDA #$01
  743.   STA BALL_IS_DIR_Y_POSITIVE
  744.   JMP CCCOABContinueLoop
  745.  
  746. PerformBallNotHitBrick:
  747.   LDA #$00
  748.   STA $0212
  749.   JMP CCCOABContinueLoop
  750.  
  751. CCCOABContinueLoop:
  752.  
  753. LatchController:
  754.   LDA #$01
  755.   STA $4016
  756.   LDA #$00
  757.   STA $4016       ; tell both the controllers to latch buttons
  758.  
  759.  
  760. ReadA:
  761.   LDA $4016       ; player 1 - A
  762.   AND #%00000001  ; only look at bit 0
  763.   BEQ ReadADone   ; branch to ReadADone if button is NOT pressed (0)
  764.                   ; add instructions here to do something when button IS pressed (1)
  765.  
  766. PlayerTranslateOnRight:
  767.   LDX #$00                        ; start X register at 0
  768. PlayerTranslateOnRightLoop:
  769.   LDA $0203, x                    ; load sprite X position
  770.   CLC                             ; make sure the carry flag is clear
  771.   ADC #$01                        ; A = A + 1
  772.   STA $0203, x                    ; save sprite X position
  773.   INX                             ; X++
  774.   INX                             ; X++
  775.   INX                             ; X++
  776.   INX                             ; X++
  777.   CPX #$10                        ; if ( !CPX #$20 ( - bytes == - sprites ) ), loop at PlayerTranslateOnRightLoop
  778.   BNE PlayerTranslateOnRightLoop
  779.  
  780. ReadADone:        ; handling this button is done
  781.  
  782. ReadB:
  783.   LDA $4016       ; player 1 - B
  784.   AND #%00000001  ; only look at bit 0
  785.   BEQ ReadBDone   ; branch to ReadBDone if button is NOT pressed (0)
  786.                   ; add instructions here to do something when button IS pressed (1)
  787. PlayerTranslateOnLeft:
  788.   LDX #$00                        ; start X register at 0
  789. PlayerTranslateOnLeftLoop:
  790.   LDA $0203, x                    ; load sprite X position
  791.   SEC                             ; make sure the carry flag is clear
  792.   SBC #$01                        ; A = A - 1
  793.   STA $0203, x                    ; save sprite X position
  794.   INX                             ; X++
  795.   INX                             ; X++
  796.   INX                             ; X++
  797.   INX                             ; X++
  798.   CPX #$10                        ; if ( !CPX #$20 ( 1-6 bytes == 4- sprites ) ), loop at PlayerTranslateOnRightLoop
  799.   BNE PlayerTranslateOnLeftLoop
  800.  
  801. ReadBDone:        ; handling this button is done
  802.  
  803. UpdateAndSavePaddlePosition:
  804.   ; Salviamo la posizione della racchetta
  805.   LDA $0203
  806.   SEC
  807.   SBC #$0A
  808.   STA PADDLE_LEFT_X_POSITION
  809.   LDA $020F
  810.   CLC
  811.   ADC #$0A
  812.   STA PADDLE_RIGHT_X_POSITION
  813.  
  814.   RTI             ; return from interrupt
  815.  
  816. ;;;;;;;;;;;;;;  
  817.  
  818.  
  819.  
  820.   .bank 1
  821.   .org $E000
  822. palette:
  823.  .db $22,$29,$1A,$0F,  $22,$36,$17,$0F,  $22,$30,$21,$0F,  $22,$27,$17,$0F   ;;background palette
  824.  .db $22,$1C,$15,$14,  $22,$02,$38,$3C,  $22,$1C,$15,$14,  $22,$02,$38,$3C   ;;sprite palette
  825.  
  826. player_sprites:
  827.      ;yPos tile attr xPos
  828.   .db $DC, $00, $0B, $80   ;sprite 0
  829.   .db $DC, $01, $0B, $88   ;sprite 1
  830.   .db $DC, $01, $0B, $90   ;sprite 2
  831.   .db $DC, $02, $0B, $98   ;sprite 3
  832.  
  833. ball_sprites:
  834.      ;yPos tile attr xPos
  835.   .db $C8, $03, $00, $80   ;sprite 0
  836.  
  837. brick_sprites:
  838.       ;yPos tile attr xPos
  839.  
  840.   ;.db $3A, $04, $0A, $70   ;sprite 0
  841.   ;.db $3A, $05, $0A, $78   ;sprite 1
  842.   ;.db $3A, $06, $0A, $7F   ;sprite 2
  843.  
  844.  
  845. bg_raw:
  846.   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24 ; 0 raw background
  847. bg_lvl_top_corner:  
  848.   .db $24,$2B,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2B,$24,$24,$24,$24,$24,$24,$24 ; 1 top corner
  849. bg_lvl_1_0:
  850.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 2
  851.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 3
  852.   .db $24,$2B, $2D,$2D,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$1C,$1D,$1E,$0D,$12,$18 ; 4
  853.   .db $24,$2B, $2D,$2D,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27,$27,$27,$27,$27, $2B,$24,$15,$0E,$0A,$1F,$0E,$1C ; 5
  854.   .db $24,$2B, $2D,$2D,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27, $2B,$24,$24,$24,$02,$00,$01,$08 ; 6
  855.   .db $24,$2B, $2D,$2D,$27,$27,$27,$27,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D, $2B,$24,$24,$24,$24,$24,$24,$24 ; 7
  856.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 8
  857.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 9
  858.  
  859. bg_lvl_1_1:
  860.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 10
  861.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 11
  862.   .db $24,$2B, $27,$27,$27,$2D,$2D,$2D,$2D,$2D,$2D,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 12
  863.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 13
  864.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 14
  865.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 15
  866.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 16
  867.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 17
  868.  
  869. bg_lvl_1_2
  870.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 18
  871.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 19
  872.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 20
  873.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 21
  874.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 22
  875.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 23
  876.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 24
  877.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 25
  878.  
  879. bg_lvl_1_3
  880.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 26
  881.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 27
  882.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 28
  883.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 29
  884.  
  885. bg_lvl_2_0:
  886.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 2
  887.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 3
  888.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$1C,$1D,$1E,$0D,$12,$18 ; 4
  889.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27,$27,$27,$27,$27, $2B,$24,$15,$0E,$0A,$1F,$0E,$1C ; 5
  890.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27, $2B,$24,$24,$24,$02,$00,$01,$08 ; 6
  891.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D,$2D, $2B,$24,$24,$24,$24,$24,$24,$24 ; 7
  892.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 8
  893.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 9
  894.  
  895. bg_lvl_2_1:
  896.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 10
  897.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 11
  898.   .db $24,$2B, $27,$27,$27,$2D,$2D,$2D,$2D,$2D,$2D,$27,$27,$27,$27,$27,$27,$2D,$2D,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 12
  899.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 13
  900.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 14
  901.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 15
  902.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 16
  903.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 17
  904.  
  905. bg_lvl_2_2
  906.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 18
  907.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 19
  908.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 20
  909.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 21
  910.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 22
  911.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 23
  912.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 24
  913.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 25
  914.  
  915. bg_lvl_2_3
  916.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 26
  917.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 27
  918.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 28
  919.   .db $24,$2B, $27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27,$27, $2B,$24,$24,$24,$24,$24,$24,$24 ; 29
  920.  
  921. LevelPointers:
  922.   .dw bg_lvl_1_0, bg_lvl_1_1, bg_lvl_1_2, bg_lvl_1_2, bg_lvl_1_3, bg_lvl_2_0, bg_lvl_2_1, bg_lvl_2_2, bg_lvl_2_3
  923.  
  924. attribute:
  925.   .db %0000000, %00000010, %00000010, %00000010, %00000011, %00000010, %00000010, %00000000011
  926.  
  927.   ; ATTR ordine
  928.   ; 2 3
  929.   ; 0 1
  930.  
  931.   .db $24,$24,$24,$24, $47,$47,$24,$24 ,$47,$47,$47,$47, $47,$47,$24,$24 ; background palette
  932.   .db $24,$24,$24,$24 ,$24,$24,$24,$24, $24,$24,$24,$24, $55,$56,$24,$24 ; sprite palette
  933.  
  934.  
  935.   .org $FFFA     ;first of the three vectors starts here
  936.   .dw NMI        ;when an NMI happens (once per frame if enabled) the
  937.                    ;processor will jump to the label NMI:
  938.   .dw RESET      ;when the processor first turns on or is reset, it will jump
  939.                    ;to the label RESET:
  940.   .dw 0          ;external interrupt IRQ is not used in this tutorial
  941.  
  942.  
  943. ;;;;;;;;;;;;;;  
  944.  
  945.  
  946.   .bank 2
  947.   .org $0000
  948.   .incbin "ArkanoidClone.chr"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top