!zone sprite_logo
;VIC_BANK             = $4000
;SCREEN_MEM1          = (VIC_BANK)
;SPRITE_DATA_0_MEM1   = (SCREEN_MEM1 + $03f8)

.sprites_start       = ((sprite_logo_visible_area-$0000)/64)

;VIC_SPRITE_SWITCH   = $d015 ;Each bit in $d015 controls whether the corresponding sprite is displayed or not. The lowest bit controls Sprite0 and so on.
;VIC_SPRITE_MODE     = $d01c ;Each bit in $d01c controls whether the corresponding sprite is displayed in multicolor mode or not. The lowest bit controls Sprite0 and so on.
;VIC_SPRITE_PRIORITY = $d01b
;VIV_SPRITE_STETCH_V = $d017
;VIV_SPRITE_STETCH_H = $d01d

;;The X coordinates are 9 bit long, and the 9th bit of all sprites are collected at $d010, similarly as $d015 works.
;SPRITE_H_POSITION_0 = $d000
;SPRITE_V_POSITION_0 = $d001
;SPRITE_H_POSITION_1 = $d002
;SPRITE_V_POSITION_1 = $d003
;SPRITE_H_POSITION_2 = $d004
;SPRITE_V_POSITION_2 = $d005
;SPRITE_H_POSITION_3 = $d006
;SPRITE_V_POSITION_3 = $d007
;SPRITE_H_POSITION_4 = $d008
;SPRITE_V_POSITION_4 = $d009
;SPRITE_H_POSITION_5 = $d00A
;SPRITE_V_POSITION_5 = $d00B
;SPRITE_H_POSITION_6 = $d00C
;SPRITE_V_POSITION_6 = $d00D
;SPRITE_H_POSITION_7 = $d00E
;SPRITE_V_POSITION_7 = $d00F
;SPRITE_H_MSB        = $d010
;
;SPRITE_COLOR_0      = $d027
;SPRITE_COLOR_1      = $d028
;SPRITE_COLOR_2      = $d029
;SPRITE_COLOR_3      = $d02A
;SPRITE_COLOR_4      = $d02B
;SPRITE_COLOR_5      = $d02C
;SPRITE_COLOR_6      = $d02D
;SPRITE_COLOR_7      = $d02E

current_d010:
!byte %00000000
sprite_logo_v_position:
!byte $6f,$9f,$cf,$70,$a0,$d0

logo_reinit_sprites:
          ldx #.sprites_start
          !For ROW = 1 TO 3
            stx SPRITE_DATA_0_MEM1+ROW
            stx SPRITE_DATA_0_MEM1+ROW+3
            inx
          !End
          ldy #$4d
          sty SPRITE_H_POSITION_0+3
          sty SPRITE_H_POSITION_0+5
          sty SPRITE_H_POSITION_0+7
          iny ; ldy #$3f
          sty SPRITE_H_POSITION_0+9
          sty SPRITE_H_POSITION_0+11
          sty SPRITE_H_POSITION_0+13

          ldy sprite_logo_v_position
          sty SPRITE_H_POSITION_0+2
          
          ldy sprite_logo_v_position+1
          sty SPRITE_H_POSITION_0+4

          ldy sprite_logo_v_position+2
          sty SPRITE_H_POSITION_0+6

          ldy sprite_logo_v_position+3
          sty SPRITE_H_POSITION_0+8
          
          ldy sprite_logo_v_position+4
          sty SPRITE_H_POSITION_0+10
          
          ldy sprite_logo_v_position+5
          sty SPRITE_H_POSITION_0+12          
          
        ; set spritecolors
          lda #$01
          sta SPRITE_COLOR_0+1
          sta SPRITE_COLOR_0+2
          sta SPRITE_COLOR_0+3
          lda #$09;#$0b;#$0b         
          sta SPRITE_COLOR_0+4
          sta SPRITE_COLOR_0+5
          sta SPRITE_COLOR_0+6
          
          lda current_d010
;          sta VIC_SPRITE_MODE
          sta SPRITE_H_MSB
          lda #%01111110
          ;lda #%01110000
          ;lda #%00000000
          ;lda #%00001110
          lda #%00001110
          sta VIC_SPRITE_PRIORITY

          lda #%11111111
          sta VIV_SPRITE_STETCH_V
;          sta VIV_SPRITE_STETCH_H
          rts
;.enable_all_sprites:
;          lda #%01111110
;          sta VIC_SPRITE_SWITCH
;          rts
;
;.disable_all_sprites:
;          lda #%00000000
;          sta VIC_SPRITE_SWITCH
;          rts

logo_set_line2:
          !fi 10, $ea ;NOP    
          ldy #$77
          sty SPRITE_H_POSITION_0+3
          sty SPRITE_H_POSITION_0+5
          sty SPRITE_H_POSITION_0+7

          ldy #.sprites_start+3
          sty SPRITE_DATA_0_MEM1+1
          iny
          sty SPRITE_DATA_0_MEM1+2
          iny
          sty SPRITE_DATA_0_MEM1+3

          ldy #$78
          sty SPRITE_H_POSITION_0+9
          sty SPRITE_H_POSITION_0+11
          sty SPRITE_H_POSITION_0+13
          !fi 2, $ea ;NOP             
          ldy #.sprites_start+3
          sty SPRITE_DATA_0_MEM1+4
          iny
          sty SPRITE_DATA_0_MEM1+5
          iny
          sty SPRITE_DATA_0_MEM1+6
          rts

logo_set_line3:
          !fi 10, $ea ;NOP    
          ldy #$a1
          sty SPRITE_H_POSITION_0+3
          sty SPRITE_H_POSITION_0+5
          sty SPRITE_H_POSITION_0+7
          ldy #.sprites_start+6
          sty SPRITE_DATA_0_MEM1+1
          iny
          sty SPRITE_DATA_0_MEM1+2
          iny
          sty SPRITE_DATA_0_MEM1+3

;logo_set_line3_2:
          !fi 2, $ea ;NOP  
          ldy #$a2
          sty SPRITE_H_POSITION_0+9
          sty SPRITE_H_POSITION_0+11
          sty SPRITE_H_POSITION_0+13
          ldy #.sprites_start+6
          sty SPRITE_DATA_0_MEM1+4
          iny
          sty SPRITE_DATA_0_MEM1+5
          iny
          sty SPRITE_DATA_0_MEM1+6
          rts


  
