Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;"ferragosto" greetings, with a recreated sprite from bubble bobble and a watermelon background
- ;code by Francesco Clementoni aka Arturo Dente, for Retro Programmers Inside facebook group, with big thanks to Bed Time Coding lessons from Phaze101
- ;launch with SYS49152
- ScrBase = $0400
- ColBase = $d800
- startcol = $d027
- pointer0 = 2040
- bubstart = 60
- pointer0val = 254
- pointer1val = 255
- spritelocation0 = 16256
- vic = $d000
- spriteEnable = $d015
- ;Temp Memory Locations in Page Zero
- ZeroTmpMem01 = $02
- ZeroTmpMem02 = $2a
- ZeroTmpMem03 = $52
- ZeroTmpMem04 = $5a
- ZeroPtr1Low = $03
- ZeroPtr1High = $04
- ZeroPtr2Low = $05
- ZeroPtr2High = $06
- ;C64 colours Definitions
- Black = 0
- White = 1
- Red = 2
- Cyan = 3
- Purple = 4
- Green = 5
- Blue = 6
- Yellow = 7
- Orange = 8
- Brown = 9
- LightRed = 10
- DarkGray = 11
- MediumGray = 12
- LightGreen = 13
- LightBlue = 14
- LightGray = 15
- *=$c000
- printbackground logochar,logocol
- jsr makebub
- ; animation
- firstanim
- lda $d012
- clc
- cmp #0
- bne firstanim
- secondwait
- lda $d012
- clc
- cmp #200
- bne secondwait
- lda direction
- beq dirup
- dirdown
- inx
- cpx #180
- beq invup
- lda #0
- jsr setspritey
- jmp firstanim
- dirup
- dex
- cpx #125
- beq invdown
- lda #0
- jsr setspritey
- jmp firstanim
- invup
- lda #0
- sta direction
- jmp firstanim
- invdown
- lda #1
- sta direction
- jmp firstanim
- direction
- byte 1;0=is going up
- rts
- ;=============================================
- ;sprites libs
- ;=============================================
- ;--------------------------------------------
- ;fn init sprite: initialize sprite number 'y'
- ;where 'y' is the register and y in 0-7
- ;and 'a' is the sprite's shape location /64
- ;--------------------------------------------
- initsprite
- sta pointer0,y;POKE 204x, 192
- rts
- ;-----------------------------------------
- ;fn init sprites: initialize sprites based
- ;on binary bits of a
- ;-----------------------------------------
- ;example a=00000011: sprite 0 and 1 initialized
- initsprites
- ldy #0
- sta initcache; contains initial argument
- lda #%00000001
- sta ZeroTmpMem01; contains actual bitmask
- initspritesloop
- and initcache; bitwise and
- beq afterspriteinit; if it's not to init, go further
- lda #pointer0val
- sty ZeroTmpMem02
- clc
- adc ZeroTmpMem02
- sta pointer0,y
- afterspriteinit
- asl ZeroTmpMem01;moving bitmask
- sta ZeroTmpMem01
- iny
- tya
- cmp #8
- beq endinitsprites
- lda initcache
- jmp initspritesloop
- endinitsprites
- rts
- initcache
- byte $0
- ;--------------------------------------------
- ;fn colorSprite: colours sprite num. y with
- ;colour x
- ;--------------------------------------------
- colorsprite
- lda #<startcol
- sta $fb
- lda #>startcol
- sta $fc
- txa
- sta ($fb),y
- rts
- ;--------------------------------------------
- ;fn setspritex: sets x of sprite numb. a with x value
- ;--------------------------------------------
- setspritex
- ;devo memorizzare x in vic+ (2*a)
- asl ;a=a*2
- tay ;offset pronto
- txa ;valore di x pronto
- sta vic,y
- rts
- ;--------------------------------------------
- ;fn setspritey: sets y sprite numb. a with x value
- ;--------------------------------------------
- setspritey
- ;devo memorizzare y in vic+1+ (2*a)
- asl ;a=a*2
- tay ;offset = a*2
- txa ;valore di x pronto
- iny ;offset=2a+1
- sta vic,y
- rts
- ;---------------------------------------------
- ;get position x of sprite a. changes a value
- ;with result
- ;---------------------------------------------
- getspritex
- asl
- tay
- lda vic,y ;now a=position x of sprite
- rts
- ;---------------------------------------------
- ;get position y of sprite a. changes a value
- ;with result
- ;---------------------------------------------
- getspritey
- asl
- tay
- iny
- lda vic,y ;now a=position x of sprite
- rts
- ;---------------------------------------------
- ;set "big" setting horizontal for sprite pattern in a
- ;---------------------------------------------
- setBigX
- ;example: lda #%00000001 for first sprite
- STA $D01D
- rts
- ;---------------------------------------------
- ;set "big" setting vertical for sprite pattern in a
- ;---------------------------------------------
- setBigY
- ;example: lda #%00000001 for first sprite
- STA $D017
- rts
- ;------------------------------------------------------
- ;setMultiColSpr
- ;------------------------------------------------------
- setMultiColSpr
- ;example: lda #%00000001 for first sprite
- STA $D01C
- rts
- ;------------------------------------------------------
- ;setSpriteColorA
- ;------------------------------------------------------
- setSpriteColorA
- sta $D025
- rts
- ;------------------------------------------------------
- ;setSpriteColorB
- ;------------------------------------------------------
- setSpriteColorB
- sta $D026
- rts
- ;------------------------------------------
- ;Macro printbackground from data
- ;/1 = label for pic data
- ;/2 = label for pic colors data
- ;------------------------------------------
- defm printbackground
- ;jsr saveregisters
- ldx #0
- @fill
- lda /1,x
- sta ScrBase,x
- lda /2,x
- sta ColBase,x
- inx
- cpx #200
- bne @fill
- ldx #0
- @fill2
- lda /1+#200,x
- sta ScrBase+#200,x
- lda /2+#200,x
- sta ColBase+#200,x
- inx
- cpx #200
- bne @fill2
- ldx #0
- @fill3
- lda /1+#400,x
- sta ScrBase+#400,x
- lda /2+#400,x
- sta ColBase+#400,x
- inx
- cpx #200
- bne @fill3
- ldx #0
- @fill4
- lda /1+#600,x
- sta ScrBase+#600,x
- lda /2+#600,x
- sta ColBase+#600,x
- inx
- cpx #200
- bne @fill4
- ldx #0
- @fill5
- lda /1+#800,x
- sta ScrBase+#800,x
- lda /2+#800,x
- sta ColBase+#800,x
- inx
- cpx #200
- bne @fill5 ;end logo
- ;jsr loadregisters
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement