From c69fa60b63769547244c42602a5eb67ff43cf4c3 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 21 Oct 2018 23:12:49 -0400 Subject: [PATCH] megademo: starring_people: timeout --- megademo/SIZE | 1 + megademo/starring.s | 2 +- megademo/starring_people.s | 56 ++++++++++++++++++++++++++++++-------- 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/megademo/SIZE b/megademo/SIZE index fde9ae6e..a8f98b9b 100644 --- a/megademo/SIZE +++ b/megademo/SIZE @@ -22,6 +22,7 @@ 28594 -- c64 opener actually works 28483 -- move falling apple to megademo file 28553 -- fill in the starring animation a bit more + 28809 -- add timeouts to starring people Graphics sizes: (LG lores=300B) diff --git a/megademo/starring.s b/megademo/starring.s index e7fbd52b..5ba7727c 100644 --- a/megademo/starring.s +++ b/megademo/starring.s @@ -222,7 +222,7 @@ done_st_vblank: st_nowrap: ;-1 lda $0 ; nop ; 3 - bne st_wrap_done ; 3 + jmp st_wrap_done ; 3 st_wrap: inc FRAMEH ; 5 st_wrap_done: diff --git a/megademo/starring_people.s b/megademo/starring_people.s index 679ce7ec..537e0b3d 100644 --- a/megademo/starring_people.s +++ b/megademo/starring_people.s @@ -15,7 +15,8 @@ starring_people: lda #0 sta DRAW_PAGE - + sta FRAME + sta FRAMEH ;============================= ; Load graphic hgr @@ -179,23 +180,56 @@ sp_outer_loop: ; want to kill 44*65 -3 = 2857 - ;====================================================== - ; We have 4550 cycles in the vblank, use them wisely - ;====================================================== +;====================================================== +; We have 4550 cycles in the vblank, use them wisely +;====================================================== ; do_nothing should be 4550 ; +2857 fallthrough from above + ; -23 increase frame + ; -7 exit on timeout ; -10 keypress ; -2 ldy at top ; =========== - ; 7395 + ; 7365 + + + ;================ + ; wrap counter + ;================ + ; nowrap = 13+10=23 + ; wrap = 13+10=23 + inc FRAME ; 5 + lda FRAME ; 3 + cmp #4 ; 20Hz ; 2 + beq sp_wrap ; 3 +sp_nowrap: + ;-1 + lda $0 ; nop ; 3 + lda $0 ; nop ; 3 + nop ; 2 + jmp sp_wrap_done ; 3 +sp_wrap: + lda #0 ; 2 + sta FRAME ; 3 + inc FRAMEH ; 5 +sp_wrap_done: + + ;============== + ; timeout after 5s or so? + ;============== + ; 7 cycles +sp_timeout: + lda FRAMEH ; 3 + cmp #80 ; 2 + beq sp_done ; 3 + ; -1 ; Try X=18 Y=77 cycles=7393 R2 + ; Try X=104 Y=14 cycles=7365 - nop - - ldy #77 ; 2 -sploop1:ldx #18 ; 2 + ldy #14 ; 2 +sploop1:ldx #104 ; 2 sploop2:dex ; 2 bne sploop2 ; 2nt/3 dey ; 2 @@ -203,12 +237,12 @@ sploop2:dex ; 2 lda KEYPRESS ; 4 bpl sp_no_keypress ; 3 - jmp sp_start_over + jmp sp_done sp_no_keypress: jmp sp_display_loop ; 3 -sp_start_over: +sp_done: bit KEYRESET ; clear keypress ; 4 rts ; 6