2018-12-10 17:55:48 +00:00
|
|
|
;=====================================
|
|
|
|
; XMAS2018 -- Wreath Part
|
|
|
|
;=====================================
|
|
|
|
|
|
|
|
|
|
|
|
wreath:
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; init screen
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; init vars
|
|
|
|
lda #15
|
|
|
|
sta XPOS
|
|
|
|
lda #38
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta FRAME
|
|
|
|
sta FRAMEH
|
|
|
|
|
|
|
|
;=============================
|
|
|
|
; Load graphic hgr
|
|
|
|
|
2018-12-13 22:15:39 +00:00
|
|
|
; lda #<wreath_hgr
|
|
|
|
; sta LZ4_SRC
|
|
|
|
; lda #>wreath_hgr
|
|
|
|
; sta LZ4_SRC+1
|
|
|
|
|
|
|
|
; lda #<(wreath_hgr_end-8) ; skip checksum at end
|
|
|
|
; sta LZ4_END
|
|
|
|
; lda #>(wreath_hgr_end-8) ; skip checksum at end
|
|
|
|
; sta LZ4_END+1
|
|
|
|
|
|
|
|
; lda #<$2000
|
|
|
|
; sta LZ4_DST
|
|
|
|
; lda #>$2000
|
|
|
|
; sta LZ4_DST+1
|
|
|
|
|
|
|
|
; jsr lz4_decode
|
2018-12-10 17:55:48 +00:00
|
|
|
|
|
|
|
;==============================
|
|
|
|
; 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-11 22:01:18 +00:00
|
|
|
; FIXME: clear page0/page1 screens
|
|
|
|
|
2018-12-10 18:06:21 +00:00
|
|
|
; jsr gr_copy_to_current ; 6+ 9292
|
2018-12-10 17:55:48 +00:00
|
|
|
|
|
|
|
; now we have 322 left
|
|
|
|
|
|
|
|
; GR part
|
2018-12-11 22:01:18 +00:00
|
|
|
; bit HIRES ; 4
|
2018-12-10 17:55:48 +00:00
|
|
|
bit SET_GR ; 4
|
|
|
|
bit FULLGR ; 4
|
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; 9620
|
|
|
|
; -8 mode set
|
|
|
|
; - 3 for jmp
|
|
|
|
;=======
|
|
|
|
; 9609
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; Try X=239 Y=8 cycles=9609
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
ldy #8 ; 2
|
2018-12-12 17:33:05 +00:00
|
|
|
wrloopA:ldx #239 ; 2
|
|
|
|
wrloopB:dex ; 2
|
|
|
|
bne wrloopB ; 2nt/3
|
2018-12-10 17:55:48 +00:00
|
|
|
dey ; 2
|
2018-12-12 17:33:05 +00:00
|
|
|
bne wrloopA ; 2nt/3
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 21:39:28 +00:00
|
|
|
jmp wreath_begin_loop
|
2018-12-10 17:55:48 +00:00
|
|
|
.align $100
|
|
|
|
|
|
|
|
|
|
|
|
;================================================
|
2018-12-11 21:39:28 +00:00
|
|
|
; Wreath Loop
|
2018-12-10 17:55:48 +00:00
|
|
|
;================================================
|
|
|
|
; 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-10 17:55:48 +00:00
|
|
|
|
2018-12-11 21:39:28 +00:00
|
|
|
wreath_display_loop:
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; (40*65)-4 = 2596
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; 40 lines of LORES
|
|
|
|
bit LORES ; 4
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; Try X=42 Y=12 cycles=2593 R3
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
lda $0 ; nop ; 3
|
2018-12-10 17:55:48 +00:00
|
|
|
|
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
|
2018-12-10 17:55:48 +00:00
|
|
|
dey ; 2
|
2018-12-11 21:39:28 +00:00
|
|
|
bne wrloopC ; 2nt/3
|
2018-12-10 17:55:48 +00:00
|
|
|
|
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; rest of screen is hires page0
|
|
|
|
; (152*65)-4 = 9876
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
bit HIRES ; 4
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; Try X=13 Y=139 cycles=9870 R6
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
2018-12-10 17:55:48 +00:00
|
|
|
|
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
|
2018-12-10 17:55:48 +00:00
|
|
|
dey ; 2
|
2018-12-11 21:39:28 +00:00
|
|
|
bne wrloopE ; 2nt/3
|
2018-12-10 17:55:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;======================================================
|
|
|
|
; We have 4550 cycles in the vblank, use them wisely
|
|
|
|
;======================================================
|
|
|
|
|
|
|
|
; do_nothing should be 4550
|
2018-12-11 22:01:18 +00:00
|
|
|
; -10 keypress
|
2018-12-10 17:55:48 +00:00
|
|
|
; ===========
|
2018-12-11 22:01:18 +00:00
|
|
|
; 4540
|
2018-12-10 17:55:48 +00:00
|
|
|
|
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; jsr play_music ; 6+1032
|
2018-12-10 17:55:48 +00:00
|
|
|
|
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
; Try X=9 Y=89 cycles=4540
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 22:01:18 +00:00
|
|
|
ldy #89 ; 2
|
|
|
|
wrloop1:ldx #9 ; 2
|
2018-12-11 21:39:28 +00:00
|
|
|
wrloop2:dex ; 2
|
|
|
|
bne wrloop2 ; 2nt/3
|
2018-12-10 17:55:48 +00:00
|
|
|
dey ; 2
|
2018-12-11 21:39:28 +00:00
|
|
|
bne wrloop1 ; 2nt/3
|
2018-12-10 17:55:48 +00:00
|
|
|
|
|
|
|
; no keypress = 10+(24) = 34
|
|
|
|
|
|
|
|
lda KEYPRESS ; 4
|
2018-12-11 21:39:28 +00:00
|
|
|
bpl wr_no_keypress ; 3
|
2018-12-10 17:55:48 +00:00
|
|
|
; -1
|
2018-12-11 21:39:28 +00:00
|
|
|
jmp wr_handle_keypress ; 3
|
|
|
|
wr_no_keypress:
|
|
|
|
jmp wreath_display_loop ; 3
|
2018-12-10 17:55:48 +00:00
|
|
|
|
2018-12-11 21:39:28 +00:00
|
|
|
wr_handle_keypress:
|
2018-12-10 17:55:48 +00:00
|
|
|
bit KEYRESET ; clear keypress ; 4
|
|
|
|
rts ; 6
|
|
|
|
|
|
|
|
|