diff --git a/play.asm b/play.asm index c767448..0bbe50a 100644 --- a/play.asm +++ b/play.asm @@ -26,7 +26,7 @@ play_init: jsr clear_screen +prtext 0, 0, WHITE, txt_t1, 7 +prtext 0, 7, CYAN, txt_t2, 3 - +prtext 0, 28, LGREY, txt_goal, txt_goale-txt_goal + +prtext 0, 34, LGREY, txt_goal, txt_goale-txt_goal +prtext 24, 6, DGREY, txt_hint, txt_hinte-txt_hint lda #COL_WALL @@ -124,6 +124,9 @@ ps_exit: sta sy sta cool sta rotflash + sta tframe ; the clock starts when the maze is done + sta tsec + sta tmin lda #1 sta cfheld sta rfheld @@ -420,6 +423,25 @@ ecoltab: ; anything but the white runner / grey walls ; one frame of play ; ============================================================ play_update: + inc tframe ; the round clock: 50 frames = one second + lda tframe + cmp #50 + bne pu_clock + lda #0 + sta tframe + inc tsec + lda tsec + cmp #60 + bne pu_clock + lda #0 + sta tsec + inc tmin + lda tmin + cmp #100 ; the clock pegs at 99:59 + bne pu_clock + lda #99 + sta tmin +pu_clock: lda cool ; the spin recharge ticks down beq pu_nocool dec cool @@ -434,6 +456,7 @@ pu_nocool: jsr upd_cursor jsr upd_flash jsr upd_status + jsr upd_clock jmp upd_sprites pu_end: cmp #1 @@ -1046,7 +1069,7 @@ upd_status: us_show: lda cool beq us_ready - +prtext 0, 12, LRED, txt_wait, 4 + +prtext 0, 17, LRED, txt_wait, 4 lda cool ; pixels left: cool / 2 = 0-80 lsr sta ptmp @@ -1070,23 +1093,43 @@ us_part: us_empty: lda #$20 us_put: - sta SCREEN+18,x ; bar cells: row 0, columns 18-27 + sta SCREEN+23,x ; bar cells: row 0, columns 23-32 lda #LRED - sta COLRAM+18,x + sta COLRAM+23,x inx cpx #10 bne us_bar rts us_ready: - +prtext 0, 12, LGREEN, txt_ready, 5 + +prtext 0, 17, LGREEN, txt_ready, 5 lda #$20 ; clear the bar area ldx #9 us_clr: - sta SCREEN+18,x + sta SCREEN+23,x dex bpl us_clr rts +; ---- the round clock, live on the status row ---- +upd_clock: + lda tmin + jsr two_digits + stx SCREEN+11 ; clock cells: row 0, columns 11-15 + sta SCREEN+12 + lda #$3a ; ':' + sta SCREEN+13 + lda tsec + jsr two_digits + stx SCREEN+14 + sta SCREEN+15 + ldx #4 +ucl_col: + lda #LGREY + sta COLRAM+11,x + dex + bpl ucl_col + rts + ; ---- drive the eight sprites from the grid state ---- upd_sprites: lda framectr @@ -1195,7 +1238,7 @@ us_dead: ebit: !byte 8, 16, 32, 64 ; ---- play texts ---- -txt_goal: !scr "reach the " +txt_goal: !scr "exit " !byte CH_EXIT txt_goale: txt_hint: !scr "p1: joy2/wasd p2: joy1/ijkl" @@ -1238,6 +1281,9 @@ wch: !byte 0 hlcol: !byte 0 ; mark_slots color parameter latwcol: !byte 0 ; draw_lattice colors: walls, posts latpcol: !byte 0 +tframe: !byte 0 ; round clock: frame, second, minute +tsec: !byte 0 +tmin: !byte 0 frame8: !byte 0 ; framectr / 8: the animation beat ei: !byte 0 ; enemy loop index etries: !byte 0 diff --git a/sound.asm b/sound.asm index 44873ed..79dcf0b 100644 --- a/sound.asm +++ b/sound.asm @@ -9,6 +9,8 @@ sfx_init: sta SID_VOL lda #0 sta SID_V1CR + sta SID_V1FH + sta SID_V1FL sta sfx_timer rts @@ -44,9 +46,10 @@ sfx_update: beq su_idle dec sfx_timer bne su_slide - lda sfx_ctrl ; time is up: gate off - and #$fe - sta SID_V1CR + lda #0 ; time is up: hard-silence the voice - + sta SID_V1CR ; waveform and frequency go too, so a + sta SID_V1FH ; hung envelope (the 6581 ADSR bug on + sta SID_V1FL ; fast retriggers) cannot whistle on rts su_slide: lda sfx_fh ; bend the pitch by the slide value diff --git a/win.asm b/win.asm index 9c5b427..2e92e53 100644 --- a/win.asm +++ b/win.asm @@ -11,6 +11,17 @@ win_init: +prtext 11, 15, WHITE, txt_welldone, txt_welldonee-txt_welldone +prtext 13, 10, LGREY, txt_beaten, txt_beatene-txt_beaten + ; the round time into the readout: "time: mm:ss" + lda tmin + jsr two_digits + stx txt_timev + sta txt_timev+1 + lda tsec + jsr two_digits + stx txt_timev+3 + sta txt_timev+4 + +prtext 15, 14, CYAN, txt_time, txt_timee-txt_time + lda #0 sta washphase +setupd win_update @@ -75,11 +86,26 @@ wu_input: wu_stay: rts +two_digits: ; A (0-99) -> X / A: two digit screen codes + ldx #$30 +td_tens: + cmp #10 + bcc td_ones + sbc #10 ; carry is set here + inx + bne td_tens +td_ones: + ora #$30 + rts + ; ---- win texts ---- txt_escaped: !scr "escaped" txt_welldone: !scr "well done!" txt_welldonee: txt_beaten: !scr "you beat labyrintwo" txt_beatene: +txt_time: !scr "time: " +txt_timev: !scr "00:00" +txt_timee: txt_firemenu: !scr "fire = menu" txt_firemenue: