dos33fsprogs/xmas_2018/wreath.s

279 lines
4.7 KiB
ArmAsm
Raw Normal View History

;=====================================
; XMAS2018 -- Wreath Part
;=====================================
wreath:
;===================
; init screen
;===================
; init vars
lda #15
sta XPOS
lda #38
sta YPOS
lda #0
sta FRAME
sta FRAMEH
;=============================
2018-12-18 18:43:56 +00:00
; Wreath image already loaded to $2000 (HGR Page 0)
;==============================
; 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
2018-12-17 16:44:56 +00:00
; FIXME: clear page0 screen
2018-12-18 18:43:56 +00:00
2018-12-17 16:44:56 +00:00
jsr clear_top ; 6+5410
2018-12-11 22:01:18 +00:00
2018-12-17 16:44:56 +00:00
; now we have left
; GR part
2018-12-11 22:01:18 +00:00
; bit HIRES ; 4
bit SET_GR ; 4
bit FULLGR ; 4
2018-12-11 22:01:18 +00:00
; 9620
2018-12-17 16:44:56 +00:00
;-5416 clear gr page0 top
2018-12-11 22:01:18 +00:00
; -8 mode set
; - 3 for jmp
;=======
2018-12-17 16:44:56 +00:00
; 4193
2018-12-17 16:44:56 +00:00
; Try X=25 Y=32 cycles=4193
2018-12-17 16:44:56 +00:00
ldy #32 ; 2
wrloopA:ldx #25 ; 2
2018-12-12 17:33:05 +00:00
wrloopB:dex ; 2
bne wrloopB ; 2nt/3
dey ; 2
2018-12-12 17:33:05 +00:00
bne wrloopA ; 2nt/3
2018-12-11 21:39:28 +00:00
jmp wreath_begin_loop
2018-12-19 19:16:37 +00:00
.include "sprites.inc"
.align $100
;================================================
2018-12-11 21:39:28 +00:00
; Wreath 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
2018-12-11 21:39:28 +00:00
wreath_begin_loop:
2018-12-11 21:39:28 +00:00
wreath_display_loop:
2018-12-11 22:01:18 +00:00
; (40*65)-4 = 2596
2018-12-11 22:01:18 +00:00
; 40 lines of LORES
bit LORES ; 4
2018-12-11 22:01:18 +00:00
; Try X=42 Y=12 cycles=2593 R3
2018-12-11 22:01:18 +00:00
lda $0 ; nop ; 3
2018-12-11 22:01:18 +00:00
ldy #12 ; 2
wrloopC:ldx #42 ; 2
2018-12-11 21:39:28 +00:00
wrloopD:dex ; 2
bne wrloopD ; 2nt/3
dey ; 2
2018-12-11 21:39:28 +00:00
bne wrloopC ; 2nt/3
2018-12-11 22:01:18 +00:00
; rest of screen is hires page0
; (152*65)-4 = 9876
2018-12-11 22:01:18 +00:00
bit HIRES ; 4
2018-12-11 22:01:18 +00:00
; Try X=13 Y=139 cycles=9870 R6
2018-12-11 22:01:18 +00:00
nop
nop
nop
2018-12-11 22:01:18 +00:00
ldy #139 ; 2
wrloopE:ldx #13 ; 2
2018-12-11 21:39:28 +00:00
wrloopF:dex ; 2
bne wrloopF ; 2nt/3
dey ; 2
2018-12-11 21:39:28 +00:00
bne wrloopE ; 2nt/3
;======================================================
; We have 4550 cycles in the vblank, use them wisely
;======================================================
; do_nothing should be 4550
; play music 1023
2018-12-19 19:16:37 +00:00
; sprites 10+(403*3+310*2)= 1839
2018-12-18 18:43:56 +00:00
; -18 frame adjust
; -7 end detect
2018-12-11 22:01:18 +00:00
; -10 keypress
; ===========
2018-12-19 19:16:37 +00:00
; 1653
2018-12-18 18:43:56 +00:00
inc FRAME ; 5
lda FRAME ; 3
and #63 ; 2
beq wframing ; 3
; -1
lda $0 ; 3
jmp done_wframing ; 3
wframing:
inc FRAMEH ; 5
done_wframing:
;=============
; 18
jsr play_music ; 6+1017
2018-12-16 03:47:11 +00:00
;========================
; draw sprites
;========================
2018-12-19 19:16:37 +00:00
lda FRAME ; 3
lsr ; 2
and #3 ; 2
sta FLAME_STATE ; 3
;===========
; 10
; Candle 1 (Hope)
2018-12-16 03:47:11 +00:00
lda #>wide_flame0 ; 2
sta INH ; 3
2018-12-19 19:16:37 +00:00
ldx FLAME_STATE ; 3
lda wide_lookup,X ; 4
2018-12-16 03:47:11 +00:00
sta INL ; 3
2018-12-16 03:47:11 +00:00
lda #4 ; 2
sta XPOS ; 3
lda #4 ; 2
sta YPOS ; 3
jsr put_sprite_no_transparency ; 6+372
;===============
2018-12-19 19:16:37 +00:00
; 403
; Candle 2 (Peace)
lda #>flame0 ; 2
sta INH ; 3
2018-12-19 19:16:37 +00:00
ldx FLAME_STATE ; 3
lda flame_lookup,X ; 4
sta INL ; 3
lda #14 ; 2
sta XPOS ; 3
lda #4 ; 2
sta YPOS ; 3
2018-12-18 19:57:44 +00:00
jsr put_sprite_no_transparency ; 6+279
;===============
2018-12-19 19:16:37 +00:00
; 310
; Candle 3 (Joy)
lda #>flame0 ; 2
sta INH ; 3
2018-12-19 19:16:37 +00:00
ldx FLAME_STATE ; 3
lda flame_lookup,X ; 4
sta INL ; 3
lda #31 ; 2
sta XPOS ; 3
lda #4 ; 2
sta YPOS ; 3
2018-12-18 19:57:44 +00:00
jsr put_sprite_no_transparency ; 6+279
;===============
2018-12-19 19:16:37 +00:00
; 310
; Candle 4 (Love)
2018-12-19 19:16:37 +00:00
lda #>wide_flame0 ; 2
sta INH ; 3
2018-12-19 19:16:37 +00:00
ldx FLAME_STATE ; 3
lda wide_lookup,X ; 4
sta INL ; 3
lda #26 ; 2
sta XPOS ; 3
lda #4 ; 2
sta YPOS ; 3
2018-12-19 19:16:37 +00:00
jsr put_sprite_no_transparency ;31+372
;===============
2018-12-19 19:16:37 +00:00
; 403
; Candle 5 (Christmas)
lda #>wide_flame0 ; 2
sta INH ; 3
2018-12-19 19:16:37 +00:00
ldx FLAME_STATE ; 3
lda wide_lookup,X ; 4
sta INL ; 3
lda #20 ; 2
sta XPOS ; 3
lda #4 ; 2
sta YPOS ; 3
2018-12-18 19:57:44 +00:00
jsr put_sprite_no_transparency ; 6+372
2018-12-16 03:47:11 +00:00
;===============
2018-12-19 19:16:37 +00:00
; 403
2018-12-16 03:47:11 +00:00
2018-12-19 19:16:37 +00:00
; Try X=164 Y=2 cycles=1653
2018-12-16 03:47:11 +00:00
2018-12-19 19:16:37 +00:00
ldy #2 ; 2
wrloop1:ldx #164 ; 2
2018-12-11 21:39:28 +00:00
wrloop2:dex ; 2
bne wrloop2 ; 2nt/3
dey ; 2
2018-12-11 21:39:28 +00:00
bne wrloop1 ; 2nt/3
2018-12-19 19:16:37 +00:00
lda FRAMEH ; 3
cmp #30 ; length of song? ; 2
beq wreath_done ; 3
; -1
;===============
; 7
; no keypress = 10+(24) = 34
lda KEYPRESS ; 4
2018-12-11 21:39:28 +00:00
bpl wr_no_keypress ; 3
; -1
2018-12-18 18:43:56 +00:00
jmp wreath_done ; 3
2018-12-11 21:39:28 +00:00
wr_no_keypress:
jmp wreath_display_loop ; 3
2018-12-18 18:43:56 +00:00
wreath_done:
bit KEYRESET ; clear keypress ; 4
rts ; 6
2018-12-19 19:16:37 +00:00
2018-12-18 18:43:56 +00:00