mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-25 20:30:31 +00:00
xmas2018: more cleanup, more asserts, more timing
This commit is contained in:
parent
980e89c315
commit
d0cee7e602
@ -27,10 +27,17 @@ xmas2018.o: xmas2018.s \
|
||||
vapor_lock.s delay_a.s wait_keypress.s gr_putsprite.s \
|
||||
play_music.s mockingboard.s rts.s \
|
||||
wreath.s wreath.img.lz4 sprites.inc \
|
||||
ball.s ball.img.lz4 greets.raw.lz4 gr_scroll.s \
|
||||
ball.s ball.img.lz4 greets.raw.lz4t gr_scroll.s \
|
||||
merry.s merry.img.lz4
|
||||
ca65 -o xmas2018.o xmas2018.s -l xmas2018.lst
|
||||
|
||||
#####
|
||||
|
||||
greets.raw.lz4t: greets.raw.lz4
|
||||
dd if=greets.raw.lz4 of=greets.raw.lz4t bs=1 skip=11
|
||||
truncate greets.raw.lz4t -s -8
|
||||
|
||||
|
||||
####
|
||||
|
||||
MUSIC.lz4t: MUSIC.lz4
|
||||
|
@ -36,9 +36,9 @@ ball:
|
||||
lda #>greets
|
||||
sta LZ4_SRC+1
|
||||
|
||||
lda #<(greets_end-8) ; skip checksum at end
|
||||
lda #<(greets_end)
|
||||
sta LZ4_END
|
||||
lda #>(greets_end-8) ; skip checksum at end
|
||||
lda #>(greets_end)
|
||||
sta LZ4_END+1
|
||||
|
||||
lda #<$800
|
||||
@ -174,7 +174,7 @@ done_framing:
|
||||
|
||||
|
||||
lda FRAMEH ; 3
|
||||
cmp #14 ; length of song? ; 2
|
||||
cmp #13 ; length of song? ; 2
|
||||
beq ball_done ; 3
|
||||
; -1
|
||||
;===============
|
||||
@ -244,5 +244,5 @@ ball_done:
|
||||
|
||||
.include "gr_scroll.s"
|
||||
greets:
|
||||
.incbin "greets.raw.lz4",11
|
||||
.incbin "greets.raw.lz4t"
|
||||
greets_end:
|
||||
|
@ -2,3 +2,6 @@ gr_offsets:
|
||||
.word $400,$480,$500,$580,$600,$680,$700,$780
|
||||
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
||||
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
||||
gr_offsets_end:
|
||||
|
||||
.assert >gr_offsets = >gr_offsets_end, error, "gr_offsets crosses page"
|
||||
|
@ -4,6 +4,14 @@
|
||||
|
||||
merry:
|
||||
|
||||
;====================================================
|
||||
; ensure we have proper graphics mode (page1 visible)
|
||||
|
||||
bit HIRES ; 4
|
||||
bit SET_GR ; 4
|
||||
bit FULLGR ; 4
|
||||
bit PAGE1 ; 4
|
||||
|
||||
;===================
|
||||
; init vars
|
||||
|
||||
@ -15,89 +23,13 @@ merry:
|
||||
; Load graphic hgr -- already loaded at $6000
|
||||
|
||||
|
||||
;==============================
|
||||
; 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
|
||||
|
||||
; so we have 5070 + 4550 = 9620 to kill
|
||||
|
||||
; FIXME: clear page0/page1 screens
|
||||
|
||||
; jsr gr_copy_to_current ; 6+ 9292
|
||||
|
||||
; now we have 322 left
|
||||
|
||||
; GR part
|
||||
bit HIRES ; 4
|
||||
bit SET_GR ; 4
|
||||
bit FULLGR ; 4
|
||||
bit PAGE1 ; 4
|
||||
|
||||
; 9620
|
||||
; -12 mode set
|
||||
; - 3 for jmp
|
||||
;=======
|
||||
; 9605
|
||||
|
||||
; Try X=136 Y=14 cycles=9605
|
||||
|
||||
; ldy #14 ; 2
|
||||
;meloopA:ldx #136 ; 2
|
||||
;meloopB:dex ; 2
|
||||
; bne meloopB ; 2nt/3
|
||||
; dey ; 2
|
||||
; bne meloopA ; 2nt/3
|
||||
|
||||
; jmp merry_begin_loop
|
||||
;.align $100
|
||||
|
||||
|
||||
;================================================
|
||||
; Merry Christmas 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
|
||||
|
||||
merry_begin_loop:
|
||||
merry_begin:
|
||||
|
||||
merry_display_loop:
|
||||
|
||||
; 192 lines of hires page1
|
||||
; (192*65) = 12480
|
||||
|
||||
; Try X=24 Y=99 cycles=12475 R5
|
||||
|
||||
; lda $0
|
||||
; nop
|
||||
|
||||
; ldy #99 ; 2
|
||||
;meloopE:ldx #24 ; 2
|
||||
;meloopF:dex ; 2
|
||||
; bne meloopF ; 2nt/3
|
||||
; dey ; 2
|
||||
; bne meloopE ; 2nt/3
|
||||
|
||||
|
||||
|
||||
;======================================================
|
||||
; We have 4550 cycles in the vblank, use them wisely
|
||||
;======================================================
|
||||
|
||||
; do_nothing should be 4550
|
||||
; -10 keypress
|
||||
; ===========
|
||||
; 4540
|
||||
|
||||
|
||||
; cli ; start music interrupt
|
||||
cli ; start music interrupt
|
||||
|
||||
; jsr play_music ; 6+1032
|
||||
|
||||
@ -114,29 +46,10 @@ merry_display_loop:
|
||||
sta scroll_hgr_smc+1
|
||||
jsr scroll_hgr_left
|
||||
|
||||
; Try X=9 Y=89 cycles=4540
|
||||
|
||||
; ldy #89 ; 2
|
||||
;meloop1:ldx #9 ; 2
|
||||
;meloop2:dex ; 2
|
||||
; bne meloop2 ; 2nt/3
|
||||
; dey ; 2
|
||||
; bne meloop1 ; 2nt/3
|
||||
|
||||
; no keypress = 10+(24) = 34
|
||||
|
||||
bit KEYRESET ; clear keypress ; 4
|
||||
|
||||
me_keyloop:
|
||||
lda KEYPRESS ; 4
|
||||
bpl me_keyloop ; 3
|
||||
; -1
|
||||
; jmp me_handle_keypress ; 3
|
||||
me_no_keypress:
|
||||
; jmp merry_display_loop ; 3
|
||||
sei ; disable interrupts/music
|
||||
|
||||
me_handle_keypress:
|
||||
bit KEYRESET ; clear keypress ; 4
|
||||
rts ; 6
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@ interrupt_handler:
|
||||
|
||||
bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4
|
||||
|
||||
; jsr play_music
|
||||
jsr play_music
|
||||
|
||||
pla
|
||||
tay ; restore Y
|
||||
|
@ -11,7 +11,7 @@ wide_flame0:
|
||||
.byte $2,$3
|
||||
.byte $dd,$dd
|
||||
.byte $dd,$dd
|
||||
.byte $dd,$dd
|
||||
.byte $79,$79
|
||||
; = 33 + Y*(51+31*X) = 33 + 3*(51+62) = 372
|
||||
|
||||
wide_flame1:
|
||||
@ -25,14 +25,14 @@ wide_flame2:
|
||||
.byte $2,$3
|
||||
.byte $dd,$dd
|
||||
.byte $dd,$dd
|
||||
.byte $99,$99
|
||||
.byte $79,$79
|
||||
; = 33 + Y*(51+31*X) = 33 + 3*(51+62) = 372
|
||||
|
||||
wide_flame3:
|
||||
.byte $2,$3
|
||||
.byte $dd,$dd
|
||||
.byte $dd,$dd
|
||||
.byte $d9,$d9
|
||||
.byte $dd,$9d
|
||||
.byte $79,$79
|
||||
; = 33 + Y*(51+31*X) = 33 + 3*(51+62) = 372
|
||||
|
||||
empty:
|
||||
@ -53,14 +53,14 @@ flame1:
|
||||
.byte $1,$3
|
||||
.byte $dd
|
||||
.byte $dd
|
||||
.byte $99
|
||||
.byte $9d
|
||||
; = 33 + Y*(51+31*X) = 33 + 3*(51+31) = 279
|
||||
|
||||
flame2:
|
||||
.byte $1,$3
|
||||
.byte $dd
|
||||
.byte $dd
|
||||
.byte $d9
|
||||
.byte $99
|
||||
; = 33 + Y*(51+31*X) = 33 + 3*(51+31) = 279
|
||||
|
||||
flame3:
|
||||
|
@ -325,7 +325,7 @@ wrloop2:dex ; 2
|
||||
|
||||
|
||||
lda FLAME1 ; 3
|
||||
cmp #15 ; length of song? ; 2
|
||||
cmp #16 ; length of song? ; 2
|
||||
beq wreath_done ; 3
|
||||
; -1
|
||||
;===============
|
||||
|
@ -175,21 +175,25 @@ game_over_man:
|
||||
jmp game_over_man
|
||||
|
||||
|
||||
; Things included here should be aligned
|
||||
; as they are called during cycle-counting
|
||||
.align $100
|
||||
.include "wreath.s"
|
||||
.include "ball.s"
|
||||
.include "merry.s"
|
||||
.include "lz4_decode.s"
|
||||
.include "rts.s"
|
||||
.include "gr_offsets.s"
|
||||
.include "gr_hline.s"
|
||||
.include "gr_fast_clear.s"
|
||||
.include "vapor_lock.s"
|
||||
.include "delay_a.s"
|
||||
.include "wait_keypress.s"
|
||||
.include "gr_putsprite.s"
|
||||
.include "delay_a.s"
|
||||
.include "play_music.s"
|
||||
|
||||
; Things here alignment doesn't matter
|
||||
.include "wait_keypress.s"
|
||||
.include "merry.s"
|
||||
.include "lz4_decode.s"
|
||||
.include "rts.s"
|
||||
|
||||
; filename to open is 30-character Apple text:
|
||||
wreath_filename: ; .byte "WREATH.LZ4",0
|
||||
.byte 'W'|$80,'R'|$80,'E'|$80,'A'|$80,'T'|$80,'H'|$80,'.'|$80,'L'|$80
|
||||
|
Loading…
Reference in New Issue
Block a user