;SEUCK School: ;New score panel - Part 2 ;Custom score panel for 2 player ;games. ;You are very much welcome to use this ;source to import new SEUCK score ;panels into your very own SEUCK game ;projects, and expand it even further. ;If you use this source, please credit ;Richard/TND. ;Source: ACME format ;------------------- ;command: ;ACME -v3 SEUCKGAME.ASM ;(Alternatively import and compile ;into C64Studio). The syntax is ;exactly the same. ;You will need a packer/cruncher to ;create an executable version of the ;the project to run in VICE or on ;your C64. ;The jump address for this is $0810 ; Values for each character set ;Score digits char_0 = scorecharset char_1 = scorecharset+8 char_2 = scorecharset+16 char_3 = scorecharset+24 char_4 = scorecharset+32 char_5 = scorecharset+40 char_6 = scorecharset+48 char_7 = scorecharset+56 char_8 = scorecharset+64 char_9 = scorecharset+72 ;Lives icon char_lives = scorecharset+80 char_colon = scorecharset+88 ;Letters S and C char_s = scorecharset+96 char_c = scorecharset+104 ;Score values for player score_player1 = $5ea3 score_player2 = $5ea9 lives_player1 = $5db7 lives_player2 = $5db8 ;Sprite location where SEUCK score ;panel is stored. scoresprite_player1 = $f080 scoresprite_player2 = $f200 ;Generate program !to "seuckgame.prg",cbm *=$0810 ;Start address ;Fill scoring code memory, as we ;no longer need that! ldx #$00 fill1 lda #$60 sta $4426,x inx cpx #$443a-$4426 bne fill1 ;Fill player 1 score plot code ldx #$00 fill2 lda #$60 sta $5a25,x inx cpx #$5ad5-$5a25 bne fill2 ;Fill player 2 score plot code ldx #$00 fill3 lda #$60 sta $5ad5,x inx cpx #$5b3d-$5ad5 bne fill3 ;Fill player 1 and player 2 ;lives plot code ldx #$00 fill4 lda #$60 sta $5b3d,x inx cpx #$5ba5-$5b3d bne fill4 ;Player 1 and player 2 are both ;enabled during play lda #$01 sta $40af ;Player 1 enabled Y/N? sta $40c2 ;Player 2 enabled Y/N? ;Trigger border to be blue in game lda #$06 sta $4410 ;Run to main game title screen jmp $4245 ;Import complete SEUCK data ;as saved finished game or ;save as all data. *=$0900 !bin "c64/rayfish.prg",,2 ;Initialize the game before ;starting it. *=$41a4 jmp initializegame ;Call in game enhancements *=$4503 jsr enhancements ;Sprite colour setup ;(Alternatively you won't need ;this if both player 1 and player ;2 are the same colour. If this is ;the case - comment out. *=$455c jsr $6580 ;NO MSB is required for score ;panel when central. Since the ;sprites X position will not need ;more than 256 pixels *=$455f lda #%00000000 ;Set all sprites multicolour on *=$4564 lda #$ff sta $d01c ;Sprite position table for ;the new score panel (X/Y) *=$5eb0 !byte $3F,$07,$57,$07,$77,$07,$8F,$07 !byte $A7,$07,$BF,$07,$E7,$07,$FF,$07 ;Sprite frames for the new score ;panel *=$5ec0 !byte $C2,$C3,$C4,$C5,$C6,$C7,$C8,$C9 ;During all sprite enhancements, ;keep all sprites on screen inside ;the score panel *=$6580 lda #$ff sta $d015 lda #$0e ;Actual colour of panel sta $d027 ;(if needed) sta $d028 sta $d029 ;Colour is light blue! sta $d02a sta $d02b sta $d02c sta $d02d sta $d02e rts ;Initialize game function *=$6700 initializegame ;Copy new panel sprites to old SEUCK ;panel sprites memory. ldx #$00 getspr lda spritepanel,x sta $f080,x lda spritepanel+$40,x sta $f0c0,x lda spritepanel+$80,x sta $f100,x lda spritepanel+$c0,x sta $f140,x lda spritepanel+$100,x sta $f180,x lda spritepanel+$140,x sta $f1c0,x lda spritepanel+$180,x sta $f200,x lda spritepanel+$1c0,x sta $f240,x inx cpx #$40 ;$40 bytes (64 bytes per ;sprite) bne getspr ;Initialize both player's score ldx #$00 zeroscore lda #$00 sta $5ea3,x sta $5ea9,x inx cpx #6 bne zeroscore ;Initialize the SID sound chip so that ;sound effects (or music if you add it) ldx #$00 sidoff lda #$00 sta $d400,x inx cpx #$18 bne sidoff ;Set side border colour lda #6 sta $d020 ; Jump to main game jmp $4260 *=$6900 ;In game enhancements enhancements ;Subroutine to update scoring and ;convert the characters into ;sprites. jsr render_new_score_panel ;Play sound effects (You can change ;this to play music if you want) jsr $5c94 rts ;Import custom sprites data (This has ;to be 8 sprites. The sprites are used ;to decorate the char/sprite score ;panel. *=$7000 spritepanel !bin "c64/panelsprites.bin" ;Import custom character set. Your ;character set should look like the ;example character set accompanied in ;the SEUCK School tutorial. ;0,1,2,3,4,5,6,7,8,9,lives,colon,s,c *=$7400 scorecharset !bin "c64/panelchars.bin" ;Score panel rendering subroutine. This ;routine will calculate the values of ;the player's score and then transfer ;the characters to sprite locations. *=$7800 render_new_score_panel ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 1 ldy #$00 ldx score_player1,y lda font_mem_low,x sta scfont1a+1 lda font_mem_hi,x sta scfont1a+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 2 ldx score_player1,y lda font_mem_low,x sta scfont1b+1 lda font_mem_hi,x sta scfont1b+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 3 ldx score_player1,y lda font_mem_low,x sta scfont1c+1 lda font_mem_hi,x sta scfont1c+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 4 ldx score_player1,y lda font_mem_low,x sta scfont1d+1 lda font_mem_hi,x sta scfont1d+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 5 ldx score_player1,y lda font_mem_low,x sta scfont1e+1 lda font_mem_hi,x sta scfont1e+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 6 ldx score_player1,y lda font_mem_low,x sta scfont1f+1 lda font_mem_hi,x sta scfont1f+2 ;------------------------------- ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 2 score. ;DIGIT 1 ldy #$00 ldx score_player2,y lda font_mem_low,x sta scfont2a+1 lda font_mem_hi,x sta scfont2a+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 2 score. ;DIGIT 2 ldx score_player2,y lda font_mem_low,x sta scfont2b+1 lda font_mem_hi,x sta scfont2b+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 2 score. ;DIGIT 3 ldx score_player2,y lda font_mem_low,x sta scfont2c+1 lda font_mem_hi,x sta scfont2c+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 2 score. ;DIGIT 4 ldx score_player2,y lda font_mem_low,x sta scfont2d+1 lda font_mem_hi,x sta scfont2d+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 5 ldx score_player2,y lda font_mem_low,x sta scfont2e+1 lda font_mem_hi,x sta scfont2e+2 iny ;Allocate and render digits to ;self-modifying char/sprite ;conversion code ;player 1 score. ;DIGIT 6 lda score_player2,y lda font_mem_low,x sta scfont2f+1 lda font_mem_hi,x sta scfont2f+2 ;Render lives for player 1 ldy #$00 ldx lives_player1,y cpx #$ff ;Lives <1 (0) = no lives beq nolivesplayer1 cpx #$09 ;Lives cannot go over 9 bcc skiplives1 ldx #$09 ;Max lives set jmp skiplives1 nolivesplayer1 ldx #$00 skiplives1 lda font_mem_low,x sta lvfont1+1 lda font_mem_hi,x sta lvfont1+2 ;Render lives for player 2 ldy #0 ldx lives_player2,y cpx #$ff ;Lives <1 (0) = no lives beq nolivesplayer2 cpx #$09 ;Lives cannot go over 9 bcc skiplives2 ldx #$09 ;Max lives set jmp skiplives2 nolivesplayer2 ldx #$00 skiplives2 lda font_mem_low,x sta lvfont2+1 lda font_mem_hi,x sta lvfont2+2 ;--------------------------------- ;Copy font data to sprite copyfonttosprite ldx #$00 ldy #$00 renderscoreandlivesloop ;Rendering score panel for player 1 scfont1a lda scorecharset,x ;Digit 1 character (selfmod) sta scoresprite_player1,y ;Transformed to sprite scfont1b lda scorecharset,x ;Digit 2 character (selfmod) sta scoresprite_player1+1,y ;Trandformed to sprite scfont1c lda scorecharset,x ;... etc all the way to the last digit sta scoresprite_player1+2,y scfont1d lda scorecharset,x sta scoresprite_player1+$40,y scfont1e lda scorecharset,x sta scoresprite_player1+$41,y scfont1f lda scorecharset,x sta scoresprite_player1+$42,y ;Rendering score panel for player 2 scfont2a lda scorecharset,x ;Do the same as above but for all sta scoresprite_player2,y ;digits for player 2 scfont2b lda scorecharset,x sta scoresprite_player2+1,y scfont2c lda scorecharset,x sta scoresprite_player2+2,y scfont2d lda scorecharset,x sta scoresprite_player2+$40,y scfont2e lda scorecharset,x sta scoresprite_player2+$41,y scfont2f lda scorecharset,x sta scoresprite_player2+$42,y ;Rendering lives for player 1 and 2 ;First char: lives symbol lda char_lives,x ;Lives symbol for players sta scoresprite_player1+$21,y ;Render to sprite for player 1 sta scoresprite_player2+$21,y ;Render to sprite for player 2 lda char_colon,x ;Colon character sta scoresprite_player1+$22,y ;Render to sprite for player 1 sta scoresprite_player2+$22,y ;Render to sprite for player 2 lvfont1 lda char_0,x ;Amount of lives for player 1 sta scoresprite_player1+$23,y ;Render to sprite for player 1 lvfont2 lda char_0,x ;Amount of lives for player 2 sta scoresprite_player2+$23,y ;Render to sprite for player 2 iny iny iny inx cpx #8 bne renderscoreandlivesloop rts *=$7a00 ;This is the low/hi byte table address ;of where each character is read. font_mem_low !byte char_0 !byte >char_1 !byte >char_2 !byte >char_3 !byte >char_4 !byte >char_5 !byte >char_6 !byte >char_7 !byte >char_8 !byte >char_9