megademo: add leaving screen

This commit is contained in:
Vince Weaver 2018-10-14 00:50:15 -04:00
parent 3c1ad19fc6
commit 78896d009f
4 changed files with 208 additions and 22 deletions

View File

@ -32,6 +32,7 @@ megademo.o: megademo.s \
starring.s starring1.inc starring2.inc starring3.img.lz4\
starring_people.s fs.inc FS_HGRC.BIN.lz4 deater.inc DEATER_HGRC.BIN.lz4\
check_email.s email_40_96.inc \
leaving.s leaving.inc \
bird_mountain.s \
waterfall.s gr_unrolled_copy.s waterfall_page1.inc waterfall_page2.inc \
takeoff.s takeoff.inc takeoff.img.lz4 \
@ -76,6 +77,10 @@ starring3.img: ./starring_3_hgr.png
../hgr-utils/png2hgr starring_3_hgr.png > starring3.img
####
leaving.inc: ./leaving.png
$(PNG_TO_RLE) asm ./leaving.png leaving > leaving.inc
####
takeoff.inc: ./takeoff.png
$(PNG_TO_RLE) asm ./takeoff.png takeoff > takeoff.inc

View File

@ -93,6 +93,37 @@ bird_mountain:
ldy #10 ; 6 lines ; 2
jsr clear_page_loop ; 2693
jsr draw_moon_sky ; 6+54
; vapor lock returns with us at beginning of hsync in line
; 114 (7410 cycles), so with 5070 cycles to go
; 5070+4550 = 9620
; -2757 (draw text)
; ===========
; 6863
;; Try X=97 Y=14 cycles=6875
; Try X=136 Y=10 cycles=6861 R2
nop
ldy #10 ; 2
bmloopA:ldx #136 ; 2
bmloopB:dex ; 2
bne bmloopB ; 2nt/3
dey ; 2
bne bmloopA ; 2nt/3
jmp bm_display_loop
;====================
; draw moon sky
; 54 cycles
draw_moon_sky:
; 1 2
; 0123456789abcdef0123456789abcdef0123456
;line1:.asciiz " * . " $400
@ -120,27 +151,8 @@ bird_mountain:
sta $583 ; 4
;============
; 18
rts ; 6
; vapor lock returns with us at beginning of hsync in line
; 114 (7410 cycles), so with 5070 cycles to go
; 5070+4550 = 9620
; -2745 (draw text)
; ===========
; 6875
; Try X=97 Y=14 cycles=6875
ldy #14 ; 2
bmloopA:ldx #97 ; 2
bmloopB:dex ; 2
bne bmloopB ; 2nt/3
dey ; 2
bne bmloopA ; 2nt/3
jmp bm_display_loop
.align $100
;=====================================================

165
megademo/leaving.s Normal file
View File

@ -0,0 +1,165 @@
; Leaving house
; Simple Text/GR split
; STATE1 = Walk over to bird
; STATE2 = get on bird
; STATE3 = ride off on bird
leaving_home:
;===================
; init screen
bit KEYRESET
setup_leaving:
;===================
; init vars
lda #8
sta DRAW_PAGE
;=============================
; Load graphic page0
lda #$0c
sta BASH
lda #$00
sta BASL ; load image to $c00
lda #<leaving
sta GBASL
lda #>leaving
sta GBASH
jsr load_rle_gr
lda #$a0
ldy #10
jsr clear_page_loop ; make top 6 lines spaces
lda #0
sta DRAW_PAGE
bit PAGE0
;==============================
; setup graphics for vapor lock
;==============================
jsr vapor_lock ; 6
; vapor lock returns with us at beginning of hsync in line
; 114 (7410 cycles), so with 5070 lines to go
jsr gr_copy_to_current ; 6+ 9292
; now we have 322 left
; GR part
bit LORES ; 4
bit SET_GR ; 4
bit FULLGR ; 4
jsr draw_moon_sky ; 6+54
; 322 - 12 = 310
; - 3 for jmp
; 307 - 60 for sky = 247
; Try X=9 Y=6 cycles=307
; Try X=7 Y=6 cycles=247
ldy #6 ; 2
lvloopA:ldx #7 ; 2
lvloopB:dex ; 2
bne lvloopB ; 2nt/3
dey ; 2
bne lvloopA ; 2nt/3
jmp lv_begin_loop
.align $100
;================================================
; Leaving Loop
;================================================
; each scan line 65 cycles
; 1 cycle each byte (40cycles) + 25 for horizontal
; Total of 12480 cycles to draw screen
; Vertical blank = 4550 cycles (70 scan lines)
; Total of 17030 cycles to get back to where was
; want 12*4 = 48 lines of HIRES = 3120-4=3116
; want 192-48=144 lines of LORES = 9360-4=9356
lv_begin_loop:
bit SET_TEXT ; 4
; Try X=11 Y=51 cycles=3112 R4
nop
nop
ldy #51 ; 2
lvloop8:ldx #11 ; 2
lvloop9:dex ; 2
bne lvloop9 ; 2nt/3
dey ; 2
bne lvloop8 ; 2nt/3
bit SET_GR ; 4
; Try X=10 Y=167 cycles=9353 R3
lda $0
ldy #167 ; 2
lvloop6:ldx #10 ; 2
lvloop7:dex ; 2
bne lvloop7 ; 2nt/3
dey ; 2
bne lvloop6 ; 2nt/3
;======================================================
; We have 4550 cycles in the vblank, use them wisely
;======================================================
; do_nothing should be 4550
; -10 keypress
; ===========
; 4540
; Try X=9 Y=89 cycles=4540
ldy #89 ; 2
lvloop1:ldx #9 ; 2
lvloop2:dex ; 2
bne lvloop2 ; 2nt/3
dey ; 2
bne lvloop1 ; 2nt/3
lda KEYPRESS ; 4
bpl lv_no_keypress ; 3
jmp lv_start_over
lv_no_keypress:
jmp lv_begin_loop ; 3
lv_start_over:
bit KEYRESET ; clear keypress ; 4
rts ; 6

View File

@ -27,7 +27,7 @@ apple_iie:
;===================
jsr HOME
jsr space_bars
jsr leaving_home
; C64 Opening Sequence
@ -49,6 +49,7 @@ apple_iie:
jsr check_email
; Leaving house
jsr leaving_home
; Riding bird
jsr bird_mountain
@ -105,6 +106,7 @@ loop_forever:
.include "mode7.s"
.include "space_bars.s"
.include "takeoff.s"
.include "leaving.s"
.include "waterfall.s"
.include "text_print.s"
.align $100
@ -120,11 +122,13 @@ loop_forever:
;============================
; Include Lores Graphics
;============================
; leaving
.include "leaving.inc"
; waterfall
.include "waterfall_page1.inc"
.include "waterfall_page2.inc"
;============================
; Include Hires Graphics
;============================