;--------------------------------------- ;ROCKET N ROLL ENHANCEMENTS ;(W)2019 Richard Bayliss for ;THE NEW DIMENSION - SEUCK SCHOOL ;http:// ;tnd64.unikat.sk/Seuck¤School.html ; ;Installation code ;--------------------------------------- scoretext = $0820 ;Where to put score ;and hiscore p1scorepos = $0820+29-11 ;Positions to p2scorepos = $0820+69-11 ;place score hiscorepos = $0820+109-11 ;characters screenpos = $e828 ;SCREEN RAM area ;Relocated music address is at $9000 rasstore1 = $7c00 musicinit = $9000 ;Init addr musicplay = $9003 ;Play addr gamemusicinit = $a000 gamemusicplay = $a003 message = $8000 ;Scroll text *= $7000 ;SYS28672 to run! lda #$20 ;JSR ldx #killcheck sta $55c3 ;Override old stx $55c4 ;kill score sty $55c5 ;code lda #$4c ;JMP ;New game code ldx #gameinit ;game. sta $41a4 stx $41a5 sty $41a6 lda #$20 ;JSR ;New respawn ldx #respawnp1;init shield. sta $4b6c ;for player 1 stx $4b6d sty $4b6e lda #$20 ;New respawn ldx #respawnp2;init shield sta $4e7c ;for player 2 stx $4e7d sty $4e7e ;Plug enhancements loop to ;original sfx player call ;subroutine. lda #$20 ldx #enhancecode sta $4503 stx $4504 sty $4505 ;Fix score bug in SEUCK ;game. lda #$4c ;JMP ldx #fixscorebug sta $54a2 stx $54a3 sty $54a4 ;Fix random firing lda #$50 sta $54f1 ;Force new title init ;code for hi score check ;and init music lda #$20 ldx #titleinit sta $40dd stx $40de sty $40df ;New routines for front end ;-Hi score, music player, ;new joystick functions lda #$4c ldx #titleloop sta $41bc stx $41bd sty $41be ;Since one time code, zero ;fill score+hi score ldx #$00 zerofill lda #$00 sta $5ea3,x ;Player 1 score sta $5ea9,x ;Player 2 score sta hiscore,x inx cpx #6 bne zerofill ldx #$00 clearrows lda #$20 sta $0820,x inx cpx #$78 bne clearrows ;Make correct text case ldx #$00 makecase lda txt1up,x cmp #$3b bcc next sec sbc #$c0 next sta $0400,x ;backup lda txt2up,x cmp #$3b bcc next2 sec sbc #$c0 next2 sta $0428,x lda txthi,x cmp #$3b bcc next3 sec sbc #$c0 next3 sta $0450,x inx cpx #txtend-txtstart bne makecase ;Set position of text ;for score+hiscore ldx #$00 putinplace lda $0400,x sta $0820+8,x lda $0428,x sta $0820+8+40,x lda $0450,x sta $0820+8+80,x inx cpx #txtend-txtstart bne putinplace ;Set player 1 up, down, left and right ;position to player 2 for fairer ;movement lda $409f ;P1 up stop sta $40b2 ;P2 up stop lda $40a2 ;P1 down stop sta $40b5 ;P2 down stop lda $409d ;P1 left stop sta $40b0 ;P1 left stop lda $409e ;P1 left stop msb sta $40b1 ;P2 left stop msv lda $40a0 ;P1 right stop sta $40b3 ;P2 right stop lda $40a1 ;P1 right stop msb lda $40b4 ;P2 right stop msb ;Finally execute SEUCK prog jmp $4245 ;Run SEUCK title ;--------------------------------------- ; ; SEUCK automatically displays the game ; title on to the screen, but before ; doing this. Allow SEUCK to call a hi ; score check, and also init music titleinit lda #$00 ;Init music jsr musicinit ;Initialise colour position for ;raster colour backup ldx #$00 copyras lda rascol,x sta rasstore1,x inx cpx #80 bne copyras ;Reset scrolltext lda #message sta messread+2 ;Calculate total score + hiscore lda $5ea3 ;Score for player 1 sec lda hiscore+5 sbc $5ea3+5 lda hiscore+4 sbc $5ea3+4 lda hiscore+3 sbc $5ea3+3 lda hiscore+2 sbc $5ea3+2 lda hiscore+1 sbc $5ea3+1 lda hiscore sbc $5ea3 bpl chkp2sc ;No hi player 1 ;Player 1 score is new hi ;score ldx #$00 newp1hi lda $5ea3,x sta hiscore,x inx cpx #6 bne newp1hi ;Now check player 2 hiscore ldx #$00 chkp2sc lda $5ea9 sec lda hiscore+5 sbc $5ea9+5 lda hiscore+4 sbc $5ea9+4 lda hiscore+3 sbc $5ea9+3 lda hiscore+2 sbc $5ea9+2 lda hiscore+1 sbc $5ea9+1 lda hiscore sbc $5ea9 bpl nohiscore ;Player 2's score is new ;hi score ldx #$00 newhip2 lda $5ea9,x sta hiscore,x inx cpx #6 bne newhip2 ;Convert all score and hi score bytes ;into the status panel charset and ;manually position the characters nohiscore ldx #$00 ldy #$00 convloop lda $5ea3,x ;Player 1 bytes jsr convert sta p1scorepos,y lda p1scorepos,y clc adc #1 sta p1scorepos+1,y lda $5ea9,x ;Player 2 bytes jsr convert sta p2scorepos,y lda p2scorepos,y clc adc #1 sta p2scorepos+1,y lda hiscore,x jsr convert sta hiscorepos,y clc adc #1 sta hiscorepos+1,y iny iny inx cpx #$06 ;Score length bne convloop rts ;Byte to character conversion convert cmp #$00 bne not0 lda #$21 rts not0 cmp #$01 bne not1 lda #$23 rts not1 cmp #$02 bne not2 lda #$25 rts not2 cmp #$03 bne not3 lda #$27 rts not3 cmp #$04 bne not4 lda #$29 rts not4 cmp #$05 bne not5 lda #$2b rts not5 cmp #$06 bne not6 lda #$2d rts not6 cmp #$07 bne not7 lda #$2f rts not7 cmp #$08 bne not8 lda #$31 rts not8 cmp #$09 bne not9 lda #$33 not9 rts ;Text/Hi score placement displayscores ldx #$00 disploop lda scoretext,x eor #$80 sta screenpos,x inx cpx #$78 bne disploop rts ;--------------------------------------- ;Main title screen loop (Inside the ;rolling rasters code) titleloop ;Raster bar control jsr rasterbars ;Colour scroll routine jsr scrollcolour ;Sound control jsr soundcontrol ;Player control option jsr playercontrol ;Joystick control jsr joycontrol ;Display hi score table jsr displayscores ;Scroll text jsr scrolltext ;Play music jsr musicplay ;Return to title code jmp titleloop ;--------------------------------------- ;Setup raster split positions and ;raster bars rasterbars lda #$3a cmp $d012 bne *-3 lda rasstore1+10 sta $d021 lda #8 sta $d016 lda #$44 cmp $d012 bne *-3 lda rasstore1+20 sta $d021 lda #$4c cmp $d012 bne *-3 lda rasstore1+30 sta $d021 lda #$5a cmp $d012 bne *-3 ldy $d012 ldx #54 loop lda rasstore1,x cpy $d012 beq *-3 sta $d021 iny dex bpl loop ldx #$08 dex bne *-1 ldy $d012 ldx #56 loop2 lda rascol2,x cpy $d012 beq *-3 sta $d021 iny dex bpl loop2 lda #$d2 cmp $d012 bne *-3 lda xpos sta $d016 ldy $d012 ldx #$00 loop3 lda rasstore1,x cpy $d012 beq *-3 sta $d021 iny inx cpx #20 bne loop3 lda #$f1 cmp $d012 bne *-3 lda #$08 sta $d016 lda rasstore1+72 sta $d021 rts ;--------------------------------------- scrollcolour lda rasdelay cmp #2 beq rasdelayok inc rasdelay rts rasdelayok lda #0 sta rasdelay lda rasstore1 sta rastemp ldx #$00 shiftit lda rasstore1+1,x sta rasstore1,x inx cpx #79 bne shiftit lda rastemp sta rasstore1+79 lda rascol2+7 sta rasstore1+$0100 ldx #$07 shiftit2 lda rascol2,x sta rascol2+1,x dex bpl shiftit2 lda rasstore1+$0100 sta rascol2 rts ;Title screen sound options selection soundcontrol lda soundoption cmp #1 bne music ;Restore SFX to game ;sound player sfx lda #<$5c94 sta soundplr+1 lda #>$5c94 sta soundplr+2 lda #$8d sta $5c0d sta $5c10 sta $5c13 sta $5c24 sta $5c27 sta $5c2a lda #$9d sta $5c2f sta $5c52 sta $5c55 sta $5c58 ldx #$00 putsfxtxt lda txtsfx,x cmp #$20 beq isspace eor #$c0 sta $ebe7-5,x jmp xnext isspace eor #$80 sta $ebe7-5,x xnext inx cpx #5 bne putsfxtxt rts ;In game music selected so ;BIT out the SID voice ;routines which use SFX and ;replace SFX play routine ;with in game music instead. music lda #gamemusicplay sta soundplr+2 ;Overwrite SFX player with ;music player lda #$2c sta $5c0d sta $5c10 sta $5c13 sta $5c17 sta $5c24 sta $5c27 sta $5c2a sta $5c2f sta $5c52 sta $5c55 sta $5c58 ;Display music text ldx #$00 dispmstxt lda txtmusic,x eor #$c0 sta $ebe7-5,x inx cpx #$05 bne dispmstxt rts ;--------------------------------------- ;Check player option ;-Display player option ;-Set no. of players according to the ; value of pointer (playeroption) playercontrol ;Display player text ldx #$00 setplrtxt lda txtplr,x cmp #$3f bcc skip eor #$40 stor sta $ebc2,x skip inx cpx #txtplrend-txtplrstart bne setplrtxt lda playeroption cmp #0 bne game2plrs jmp set1player rts game2plrs jmp set2player ;--------------------------------------- ;Title screen joystick control - for ;reasons to set amount of players ;to start the game, sound options, etc joycontrol jsr readport2 jsr readport1 rts readport2 lda $dc00 lsr a ;Read up bcs notup1 lda #0 ;1 player game sta playeroption rts notup1 lsr a ;Read down bcs notdown1 lda #1 ;2 player game sta playeroption rts notdown1 lsr a ;Read left bcs notleft1 jmp setmusicopt ;Music set notleft1 lsr a ;Read right bcs notright1 jmp setsfxopt ;SFX Set notright1 lda $dc00 lsr a lsr a lsr a lsr a lsr a bcs notfire jmp gameinit notfire rts ;Do exactly the same for ;joystick port 1 readport1 lda $dc01 lsr a bcs notup2 lda #0 sta playeroption rts notup2 lsr a bcs notdown2 lda #1 sta playeroption rts notdown2 lsr a bcs notleft2 jmp setmusicopt notleft2 lsr a bcs notright2 jmp setsfxopt notright2 lda $dc01 lsr a lsr a lsr a lsr a lsr a bcs notfire jmp gameinit ;--------------------------------------- ;Player mode again ... Setting amount ;of players per game set1player ;Enable player 1 lda #1 sta $40af ;Disable player 2 lda #0 sta $40c2 lda #$37 eor #$80 sta $ebc0 rts set2player ;Enable 1 and player 2 lda #1 sta $40c2 lda #1 sta $40af lda #$38 eor #$80 sta $ebc0 rts ;--------------------------------------- ;In game sound options again, setting ;game music to production setmusicopt lda #$00 sta soundoption rts setsfxopt lda #$01 sta soundoption rts ;--------------------------------------- ;Title screen scroll read routine scrolltext lda xpos sec sbc #1 and #7 sta xpos bcs endscroll ldx #$00 shifttext lda $eb49,x sta $eb48,x inx cpx #39 bne shifttext messread lda message cmp #$00 ;@ end byte bne storechr ;reset scroll message lda #message sta messread+2 jmp messread storechr eor #$80 ;Inverted ;char sta $eb6f inc messread+1 bne endscroll inc messread+2 endscroll rts ;======================================= ;Initialise game code ... Every time ;a brand new game starts. gameinit lda #$00 ;Initialise exp timer sta exppointer ;for boss sta $d011 ;Screen off while ;inverting panel ldx #$00 invertpanel lda $f400,x eor #$ff sta $f400,x lda $f500,x eor #$ff sta $f500,x inx bne invertpanel ;Init shield for both players jsr initshieldp1 jsr initshieldp2 ;Clear the SID chip ldx #$00 initsid lda #$00 sta $d400,x inx cpx #$18 bne initsid lda #$0e sta $2ccf lda #$0a sta $2c93 ;Check if 2 player mode has ;been selected. So that both ;players can appear at the ;same time in 2 player mode lda playeroption cmp #1 bne not2players lda #2 ;Temporarily set 2 sta 16578 ;players linked not2players ;Finally check if sound option ;is in game music before ;running the game. If in game ;music, init in game music. lda soundoption cmp #1 ;sfx mode check bne initgamemusic jmp $4260 ;Run game ;Init in game music initgamemusic lda #$00 jsr gamemusicinit jmp $4260 ;Run game ;--------------------------------------- ;Respawn code for player 1 respawnp1 sta $5db7 ;Life lost jsr initshieldp1 rts ;Respawn code for player 2 respawnp2 sta $5db8 ;Life lost jsr initshieldp2 rts ;-------------------------------------- ;Shield reset for player 1 every time ;a collectible is picked up, player ;respawned after a life is lost or ;every new game start initshieldp1 lda #255 ;Shield time :) sta shieldtimer lda #255 ;Collision char sta $40ac;P1 Sprite/Char lda #0 sta p1flashdelay sta p1flashpointer ;Make player 1 invincible ;to enemies lda #$ea sta $4b03 sta $4b04 sta $4b05 rts ;Shield reset for player 2 - same as ;player 1's shield reset initshieldp2 lda #255 ;Shield time sta shieldtimer2 lda #255 ;Collision char sta $40bf ;P2 sprite/char lda #0 sta p2flashdelay sta p2flashpointer ;Make player 2 invincible to ;enemies lda #$ea sta $4e12 sta $4e13 sta $4e14 rts ;--------------------------------------- ;Object killed detection for activating ;the shield (if hit). ;Objects are as follows: ;22 - Shield collectible ;27 - Boss piece ;28 - Boss piece ;35 - Boss piece ;38 - Boss piece ;39 - Boss piece ;47 - Boss piece ;49 - Boss piece ;54 - Boss piece killcheck sta $5dbb ;Detect object hit lda $bc00,y ;SEUCK object sta objectkilled lda $09 ;Player that did it sta playerhit ;Store to pointer lda objectkilled cmp #22 ;Actual enemy #1 / ;object 22 bne notshield jmp awardshield notshield ;Now check if object is boss ;if it is, then force new ;game code to destroy the ;object as a whole and ;set the STILL counter to 0 cmp #27 ;Object 27 = boss part bne notboss1 jmp explodeall notboss1 cmp #28 bne notboss2 jmp explodeall notboss2 cmp #35 bne notboss3 jmp explodeall notboss3 cmp #38 bne notboss4 jmp explodeall notboss4 cmp #39 bne notboss5 jmp explodeall notboss5 cmp #47 bne notboss6 jmp explodeall notboss6 cmp #48 bne notboss7 jmp explodeall notboss7 cmp #54 bne notboss8 jmp explodeall ;No more bosses notboss8 lda $bd06,y ;Scoring code rts ;Boss is destroyed, so force ;boss to die and set level ;timer to 0 explodeall lda #$0a ;Explosion set on sta exppointer lda #$00 sta $408d lda $bd06,y rts ;Shield awarded, but which player ;picked it up first? awardshield lda playerhit cmp #$01 ;Was it player 1 bne player1get ;Player 1 gets the shield player1get jsr initshieldp1 lda $bd06,y ;Score rts ;Player 2 gets the shield player2get jsr initshieldp2 lda $bd06,y ;Score rts ;--------------------------------------- ;Main shield code testshieldp1 lda shieldtimer cmp #0 bne shieldnotout ;Shield is out ;Restore all collision ;with sprites and set ;background colour lda #146 ;Collision with char sta $40ac lda #$0a ;Colour sta $2c93;Player 1 lda #$ad sta $4b03 lda #$bd sta $4b04 lda #$5d sta $4b05 ;Also force die to player ;to background collision lda #1 sta $40ab rts ;Player shield isn't out, so decrement ;a single value from the shield timer ;and perform a delay on the flashing ;subroutine. shieldnotout dec shieldtimer lda p1flashdelay cmp #2 beq p1timedflash inc p1flashdelay rts ;Reset flashdelay and perform flashing ;shield on player sprite p1timedflash lda #$00 sta p1flashdelay ldx p1flashpointer lda p1shieldcolour,x sta $2c93 ;P1 colour inx cpx #8 beq resetflashp1 inc p1flashpointer rts ;Reset flash pointer resetflashp1 ldx #$00 stx p1flashpointer rts ;Test shield for player 2 testshieldp2 lda shieldtimer2 cmp #0 bne shieldnotout2 lda #$0e ;Colour of player 2 sta $2ccf lda #$ad ;Restore player 2 sta $4e12;sprite/sprite lda #$be ;collision on killer sta $4e13;enemies lda #$5d sta $4e14 lda #146 ;Collision with char sta $40bf;for player 2 ;Force die to player 2 lda #1 sta $40be rts shieldnotout2 dec shieldtimer2;Dec shield for lda p2flashdelay;player 2 cmp #$02 ;and delay beq flashok2 ;flashing code inc p2flashdelay rts flashok2 lda #$00 sta p2flashdelay ldx p2flashpointer lda p2shieldcolour,x sta $2ccf inx cpx #8 ;No of colours to flash beq resetflashp2 inc p2flashpointer rts resetflashp2 ldx #$00 stx p2flashpointer rts ;--------------------------------------- ;Fix the game scoring bug so that the ;correct player gets the points scored ;every time a collectible is picked up fixscorebug sta $5dbb lda #$00 sta $09 jmp $54a5 ;--------------------------------------- ;In game background animation bgranimation jsr scrollscene jsr scrolldeadly jsr explodechk rts ;Scroll scene, contolled by vertical ;scroller routine. Will continue to ;scroll background in stop mode also. scrollscene lda $d011 cmp voidbyte bne scroll1 rts scroll1 lda $f800+(2*8) sta voidstore1 lda $f800+(96*8) sta voidstore2 lda $f800+(97*8) sta voidstore3 ldx #$00 scrollup1 lda $f800+(2*8+1),x sta $f800+(2*8),x lda $f800+(96*8+1),x sta $f800+(96*8),x lda $f800+(97*8+1),x sta $f800+(97*8),x inx cpx #7 bne scrollup1 lda voidstore1 sta $f800+(2*8+7) lda voidstore2 sta $f800+(96*8+7) lda voidstore3 sta $f800+(97*8+7) rts ;Scroll deadly char (253), upwards scrolldeadly lda dbscrdelay cmp #$01 beq scrollup2 inc dbscrdelay rts scrollup2 lda #$00 sta dbscrdelay lda $f800+(253*8) sta dbchrstore ldx #$00 shiftchrup lda $f800+(253*8+1),x sta $f800+(253*8),x inx cpx #7 bne shiftchrup lda dbchrstore sta $f800+(253*8+7) rts ;--------------------------------------- ;Smart bomb effect / boss full ;explosion explodechk lda exppointer bne turnexpon lda #$00 sta exppointer lda #$4c ;Restore features sta $55e1 ;so that any newer lda #$a5 ;enemies that come sta $55e2 ;on screen wont die lda #$5b ;instantly, after sta $55e3 ;the boss stage is lda #$08 ;successfully sta $531d ;completed. lda #$bd sta $5568 lda #$f7 sta $5569 lda #$b6 sta $556a rts ;Explosion switched on ;trigger main explode routine ;to all enemy object ;properties. turnexpon dec exppointer lda #$00 sta $531d lda #$4c sta $5568 lda #expmain sta $556a rts expmain lda #$60 ;Main explosion sta $55e1 ;routine. jsr $55b6 lda #$4c sta $55e1 rts ;--------------------------------------- ;Seuck enhancement loop code enhancecode ;Because the player has been ;linked in 2 player mode, ;remove the 2 player 1 joy link ;so players can move ;respectably lda playeroption cmp #1 bne oneplayermode lda #1 sta 16578 oneplayermode jsr testshieldp1 ;Test shield jsr testshieldp2 ;for both plrs jsr bgranimation soundplr jsr $5c94 ;SFX SEUCK rts ;--------------------------------------- xpos .byte 0 ;Smooth scroll shieldtimer .byte 0 ;Player 1 timer shieldtimer2 .byte 0;Player 2 timer p1flashdelay .byte 0;Player 1 flash del. p2flashdelay .byte 0;Player 2 flash del. p1flashpointer .byte 0 ;Player 1 flash p p2flashpointer .byte 0 ;Player 2 flash p objectkilled .byte 0 ;SEUCK object hit playerhit .byte 0 ;Player 1 or 2? exppointer .byte 0 ;Boss explosion ;Important, you may need to adjust ;the frame type + colour to the ;player, to get correct animation. ; ;.byte $XY - Where: ; ;X=ANIM TYPE, Y = ANIM COLOUR ;Shiny red flashing colour scheme p1shieldcolour .byte $02,$0a,$07,$01 .byte $07,$0a,$02,$09 ;Shiny blue flashing colour scheme p2shieldcolour .byte $04,$0e,$03,$01 .byte $03,$0e,$04,$06 ;Background animation properties ;Deadly block delay for scrolling dbscrdelay .byte 0 ;Deadly block store pointer dbchrstore .byte 0 ;Level scroll control voidbyte .byte 0 voidstore1 .byte 0 voidstore2 .byte 0 voidstore3 .byte 0 ;-------------------------------------- ;Title screen properties soundoption .byte 0 ;in game sound ;options playeroption .byte 0 ;No of players rastemp .byte 0 rasdelay .byte 0 txtmusic .text "music" txtsfx .text " sfx" txtplrstart txtplr .text "PLAYER GAME" txtplrend txtstart txt1up .text "7UP SCORE " txtend txt2up .text "8UP SCORE " txthi .text "HI SCORE " ;Bytes value for hiscore hiscore .byte $00,$00,$00,$00,$00,$00 ;Some raster colours for the front ;end. rascol .byte $06,$0e,$04,$03 .byte $01,$03,$0e,$04 .byte $06,$00,$09,$02 .byte $08,$07,$01,$07 .byte $08,$02,$09,$00 .byte $0b,$0c,$0f,$07 .byte $01,$07,$0f,$0c .byte $0b,$00,$06,$04 .byte $0a,$0d,$01,$0d .byte $0a,$04,$06,$00 .byte $09,$05,$03,$0d .byte $01,$0d,$03,$05 .byte $09,$00,$09,$0b .byte $08,$0a,$01,$0a .byte $08,$0b,$09,$00 .byte $02,$04,$0e,$07 .byte $01,$07,$0e,$04 .byte $02,$00,$05,$0d .byte $0f,$03,$01,$03 .byte $0d,$0f,$05,$00 ;Some new raster colours for the ;static text rascol2 .byte $0b,$0c,$0f,$01 .byte $0f,$0c,$0b,$00 rascol2end .byte $06,$0e,$03,$01 .byte $03,$0e,$06,$00 .byte $02,$0a,$07,$01 .byte $07,$0a,$02,$00 .byte $06,$0e,$03,$01 .byte $03,$0e,$06,$00 .byte $0b,$05,$0d,$01 .byte $0d,$05,$0b,$00 .byte $02,$0a,$07,$01 .byte $07,$0a,$02,$00 .byte $06,$0e,$03,$01 .byte $03,$0e,$06,$00 .byte $06,$0e,$03,$01 .byte $03,$0e,$06,$00 .byte $02,$0a,$07,$01 .byte $07,$0a,$02,$00 .byte $09,$08,$07,$01 .byte $07,$08,$09,$00 ;And we're done !!! ;--------------------------------------