-
Notifications
You must be signed in to change notification settings - Fork 2
/
Effect_4_BothDirections.asm
160 lines (157 loc) · 6.65 KB
/
Effect_4_BothDirections.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
;**********************
;* Gray Defender
;* 02/12/2020
;* BORDER EFFECTS Demo
;* Effect-Both Directon
;* Illusion looks like colors
;* going either left or right
;* depending on how long you stare at it
;* Try changing Total_Effect to 2 or 3
;**********************
*=$2000
;******************************************************
; CLEAR SCREEN
;******************************************************
lda #42
ldx #0
@clr_loop sta $400,x
sta $500,x
sta $600,x
sta $700,x
dex
bne @clr_loop
;*******************************************
@master_loop jsr MOVE_ALL
jmp @master_loop
MOVE_ALL
inc Current_Effect; Loop through all effects
lda Current_Effect;
cmp Total_Effects;
bne MOVE_ONCE ;
lda #0 ;
sta Current_Effect; Start Over
;*******************************************
MOVE_ONCE
jsr delay
inc effect_bgcol,x
;*** Limit Colors
lda effect_bgcol,x
cmp #10
bcc @cont
lda #6
sta effect_bgcol,x
;*****************
@cont ldx Current_Effect
lda effect_bgcol,x
jsr Place_Color1
jsr CHECK_XY ; Adjust XY Coordinates
rts
;*******************************************
delay
txa
pha
tya
pha
ldx #5
@lp1 ldy #10
@lp2 dey
bne @lp2
dex
bne @lp1
pla
tay
pla
tax
rts
;*******************************************
pokecoloraxy
sta @char+1 ; Save character to poke
lda map_off_l,y ; Load low byte pos of color
sta @screen+1 ; on the screen
lda map_off_h,y ; Load high byte pos of color
sta @screen+2 ; on the screen
@char lda #$00 ; Load color to store
@screen sta $d800,x ; Store color on screen
rts
;*******************************************
Place_Color1
sta @ch_color1+1 ; Store chacter to poke
ldx Current_Effect ; Load Y position into
lda effect_cury,x ; Y Register
tay ;
ldx Current_Effect ; Load X Position into
lda effect_curx,x ; X Register
tax ;
@ch_color1 lda #3 ;
jsr pokecoloraxy ; Poke A into pos x,y
rts
;*******************************************
CHECK_XY
ldx Current_Effect
lda horizontal,x
beq @horizontal
;*******************************************
@vertical
lda effect_updown,x
bne @up
@down
inc effect_cury,x
lda effect_cury,x
cmp start_ymax,x
bne @exit
lda #0
sta horizontal,x; Switch to horizontal
lda #1
sta effect_updown,x; Switch to up
rts
@up
dec effect_cury,x
lda effect_cury,x
cmp start_ymin,x
bne @exit
lda #0
sta horizontal,x; Switch to horizontal
sta effect_updown,x; Switch to down
@exit rts
;*******************************************
@horizontal
lda effect_dir,x
bne @right
@left
dec effect_curx,x
lda effect_curx,x
cmp start_xmin,x
bne @exit1
lda #1
sta horizontal,x; Switch to vertical
sta effect_dir,x; Right for when horiz
@exit1 rts
;*******************************************
@right
inc effect_curx,x
lda effect_curx,x
cmp start_xmax,x
bne @rts
lda #1
sta horizontal,x; Switch to vertical
lda #0 ; left for when horiz
sta effect_dir,x
@rts rts
;*******************************************
; VARIABLES
;*******************************************
start_xmin byte 00,01,02,03,04,05,06,07,08,09,10,11
start_ymin byte 00,01,02,03,04,05,06,07,08,09,10,11
start_xmax byte 39,38,37,36,35,34,33,32,31,30,29,28
start_ymax byte 24,23,22,21,20,19,18,17,16,15,14,13
horizontal byte 00,00,00,00,00,00,00,00,00,00,00,00 ; 00= Horiz 01= Vertical
effect_dir byte 00,01,01,00,01,00,01,00,01,00,01,00 ; 00 = left 01 = Right
effect_updown byte 00,00,00,00,00,00,00,00,00,00,00,00 ; 00=Down 01=Up
effect_curx byte 15,15,20,20,15,16,17,18,15,16,17,12 ; Current xmin of effect
effect_cury byte 00,01,02,03,04,05,06,07,08,09,10,11 ; Current ymin of effect
effect_fgcol byte 00,00,00,02,08,00,10,11,01,03,04,05 ; effect one front color
effect_bgcol byte 00,00,00,00,05,01,07,08,14,07,16,08 ; effect one back color
Total_Effects byte 01 ; Maximum effects in play
Current_Effect byte 00 ; Current effect being worked on
map_off_l byte $00,$28,$50,$78,$A0,$C8,$F0,$18,$40,$68,$90,$b8,$E0,$08,$30,$58,$80,$a8,$d0,$f8,$20,$48,$70,$98,$c0
map_off_h byte $D8,$D8,$D8,$D8,$D8,$D8,$D8,$D9,$D9,$D9,$D9,$D9,$D9,$DA,$DA,$DA,$DA,$DA,$DA,$DA,$DB,$DB,$DB,$DB,$DB