-
Notifications
You must be signed in to change notification settings - Fork 2
/
Effect_2_rocking.asm
152 lines (140 loc) · 5.9 KB
/
Effect_2_rocking.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
;**********************
;* Gray Defender
;* 02/12/2020
;* Rock Back and Forth
;* Semi-Optimized
;**********************
*=$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
inc Current_Effect; Loop through all effects
@cont1 lda effect_dir,x
; *Create Rocking Effect *
inc counter
lda counter
cmp #150
bne @cont
lda effect_dir,x
cmp #0
beq @make1
lda #0
sta effect_dir,x
jmp @cont
@make1 lda #1
sta effect_dir,x
@cont lda Current_Effect;
cmp Total_Effects;
bne @MOVE_EFFECT
lda #0 ;
sta Current_Effect; Start Over
;*******************************************
@MOVE_EFFECT
lda effect_bgcol,x
inc effect_bgcol,x
;*** Limit Colors
cmp #9
bcc @cont1a
lda #5
sta effect_bgcol,x
;*****************
@cont1a
jsr delay
ldx Current_Effect
lda effect_bgcol,x
Place_Color1
;*******************************************
ldx Current_Effect
lda horizontal,x
beq HORIZ
;*******************************************
Vertical
lda effect_updown,x
bne UP
DOWN inc effect_cury,x
ChkDirection effect_cury,start_ymax,#0,#1,effect_updown
UP
dec effect_cury,x
ChkDirection effect_cury,start_ymin,#0,#0,effect_updown
HORIZ
lda effect_dir,x
bne RIGHT
LEFT
inc effect_fgcol,x
dec effect_curx,x
ChkDirection effect_curx,start_xmin,#1,#1,effect_dir
RIGHT
inc effect_curx,x
ChkDirection effect_curx,start_xmax,#1,#0,effect_dir
defm ChkDirection
lda /1,x
cmp /2,x
bne @exit
lda /3
sta horizontal,x; Switch to horizontal
lda /4
sta /5,x ; Switch to down
@exit jmp master_loop
endm
;*******************************************
delay
txa
pha
tya
pha
ldx #7
@lp1 ldy #5
@lp2 dey
bne @lp2
dex
bne @lp1
pla
tay
pla
tax
rts
;*******************************************
defm Place_Color1
sta @ch_color1+1 ; Grab Y value
ldx Current_Effect ;
lda effect_cury,x ;
tay
ldx Current_Effect ; Grab X value
lda effect_curx,x ;
tax ;
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
@ch_color1 lda #$00 ; Load color to store
@screen sta $d800,x ; Store color on screen
endm
;*******************************************
; VARIABLES
;*******************************************
start_xmin byte 00,01,02,03,04,05,06,07,08,09,10,11,10
start_ymin byte 00,01,02,03,04,05,06,07,08,09,10,11,10
start_xmax byte 39,38,37,36,35,34,33,32,31,30,29,28,27
start_ymax byte 24,23,22,21,20,19,18,17,16,15,14,13,12
horizontal byte 00,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,01 ; 00 = left 01 = Right
effect_updown byte 00,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,10 ; Current xmin of effect
effect_cury byte 00,01,02,03,04,05,06,07,08,09,10,11,11 ; Current ymin of effect
effect_fgcol byte 00,00,00,02,08,00,10,11,01,03,04,05,05 ; effect one front color
effect_bgcol byte 00,00,00,00,05,01,07,08,14,07,16,08,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
counter byte 00