forked from wisk/esl_snes_demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.asm
136 lines (96 loc) · 1.59 KB
/
main.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.include "header.inc"
.include "register.inc"
.include "esl_logo.inc"
.include "snes_init.asm"
.include "utils.asm"
.include "video.asm"
.bank 0 slot 0
.org 0
.section "MainCode"
.define VblankValue $1f00
.define MosaicValue $1f02
VblankHandler:
php
sep #$10
lda hdmaWaveEffectOffset
ina
cmp #$e0
bcc store_wave_offset
lda #$00
pha
lda hdmaWaveType
cmp #$02
bne set_horiz_wave
lda #$04
sta hdmaWaveType
pla
bra store_wave_offset
set_horiz_wave:
lda #$02
sta hdmaWaveType
pla
store_wave_offset:
sta hdmaWaveEffectOffset
rep #$10
jsr hdmaUpdateWaveEffect
rep #$10 ; 16-bit x,y
sep #$20 ; 8-bit a
lda VblankValue
ina
sta VblankValue
and #$07 ; Slow down the mosaic effect
bne skip_mosaic
lda MosaicValue
cmp #$1f
beq inc_mosaic
cmp #$10
beq inc_mosaic
cmp #$0f
bpl dec_mosaic
inc_mosaic:
ina
and #$0f
sta MosaicValue
bra update_mosaic
dec_mosaic:
dea
ora #$10
sta MosaicValue
update_mosaic:
asl a
asl a
asl a
asl a
and #$f0
ora #$0f
;sta MOSAIC
skip_mosaic:
plp
rti
Start:
SnesInit
stz VblankValue
stz MosaicValue
lda #$80
sta NMITIMEN
rep #$10 ; 16-bit x,y
sep #$20 ; 8-bit a
; Copy palette using the CPU
ldx #$0000
pal_cpy:
lda.w EslLogoPalBeg, x
sta CGDATA
inx
cpx #$200
bne pal_cpy
; Copy pattern
vramLoadData EslLogoPatBeg, $1000, EslLogoPatEnd - EslLogoPatBeg
; Copy map
vramLoadData EslLogoMapBeg, $400, EslLogoMapEnd - EslLogoMapBeg
jsr bgSetup
jsr hdmaSetupWaveEffect
loop:
;wai
jmp loop
.ends
.emptyfill $00