-
Notifications
You must be signed in to change notification settings - Fork 0
/
BOMB.X68
188 lines (177 loc) · 7.21 KB
/
BOMB.X68
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
; =============================================================================
; BOMB MANAGEMENT
; =============================================================================
; -----------------------------------------------------------------------------
BOMBINIT
; INTIALIZES THE BOMB IF THERE IS NOT ANOTHER STILL ACTIVE
; INPUT - D1.W X COORDINATE (PIXELS)
; D2.W Y COORDINATE (PIXELS)
; OUTPUT - NONE
; MODIFIES - NONE
; -----------------------------------------------------------------------------
MOVEM.L D0-D2/D7,-(A7)
MOVE.W BOMBSTA,D0 ; GET BOMB FLAG
CMP.W #BOMBNAC,D0 ; CHECK IF ACTIVE BOMB
BNE .END ; END IF ACTIVE BOMB
JSR MAPGTCOD
* CMP.B #MAPOBS,D7 ; IS IT AN OBSTACLE?
* BEQ .END ; YES: END
MOVE.W #BOMBACT,BOMBSTA ; NO : START PHASE 1
MOVE.B GENFRMCT,BOMBTIM ; SAVE INITIAL FRAME
AND.W #$FFE0,D1 ; X BLOCK COORDINATE
AND.W #$FFE0,D2 ; Y BLOCK COORDINATE
MOVE.W D1,BOMBPOX ; SET BOMB COORDINATES
MOVE.W D2,BOMBPOY
.END MOVEM.L (A7)+,D0-D2/D7
RTS
; -----------------------------------------------------------------------------
BOMBUPD
; UPDATES THE BOMB STATUS FROM ACTIVE TO EXPLODING AND NOT ACTIVE, BY CHECKING
; THE TIME THOSE PHASES STARTED.
; INPUT - NONE
; OUTPUT - NONE
; MODIFIES - NONE
; -----------------------------------------------------------------------------
MOVEM.L D0,-(A7)
MOVE.W BOMBSTA,D0 ; GET BOMB FLAG
TST.W D0
BEQ .END ; IF NO BOMB, END
CMP.W #BOMBEXP,D0 ; CHECK IF PHASE 2
BEQ .EXP ; IF NOT, CONTINUE
MOVE.B BOMBTIM,D0
ADD.B #BOMB1PH,D0
CMP.B GENFRMCT,D0 ; CHECK IF PHASE 1 OVER
BNE .END ; IF NOT, END
MOVE.W #BOMBEXP,BOMBSTA ; ELSE, START PHASE 2
MOVE.B GENFRMCT,BOMBTIM ; SAVE INITIAL FRAME
JSR BOMBBRK ; BREAKS SURROUNDING BRICK BLOCKS
BRA .END
.EXP MOVE.B BOMBTIM,D0
ADD.B #BOMB2PH,D0
CMP.B GENFRMCT,D0 ; CHECK IF PHASE 2 OVER
BNE .END ; IF NOT, END
MOVE.W #BOMBNAC,BOMBSTA ; ELSE, END PHASE 2
CLR.B BOMBTIM
.END MOVEM.L (A7)+,D0
RTS
; -----------------------------------------------------------------------------
BOMBPLOT
; PLOTS THE BOMB AND THE EXPLOSION
; INPUT - NONE
; OUTPUT - NONE
; MODIFIES - NONE
; -----------------------------------------------------------------------------
MOVEM.L D0-D7/A0-A1,-(A7)
MOVE.W BOMBSTA,D0
TST.W D0
BEQ .END ; IF NO ACTIVE BOMB, END
LEA GFXLST,A0 ; GET GRAPHICS DATA
MOVE.W BOMBPOX,D5
MOVE.W BOMBPOY,D6
CMP.W #BOMBEXP,D0 ; CHECK IF IT ALREADY EXPLODED
BEQ .EXPLO ; IF IT HAS, DRAW EXPLOSION
MOVE.W #BOMBID,D7
JSR GFXDRIDP ; DRAW BOMB
BRA .END
.EXPLO MOVE.W #EXPLID,D7
JSR GFXDRIDP ; DRAW CENTRAL BLOCK
SUB.W #MAPTILEW,D5
JSR MAPGTTIL
CMP.W #WALL,D7
BEQ .RIGHT
MOVE.W #EXPLID,D7
JSR GFXDRIDP ; DRAW LEFT BLOCK
.RIGHT ADD.W #MAPTILEW*2,D5
JSR MAPGTTIL
CMP.W #WALL,D7
BEQ .UP
MOVE.W #EXPLID,D7
JSR GFXDRIDP ; DRAW RIGHT BLOCK
.UP SUB.W #MAPTILEW,D5
SUB.W #MAPTILEH,D6
JSR MAPGTTIL
CMP.W #WALL,D7
BEQ .DOWN
MOVE.W #EXPLID,D7
JSR GFXDRIDP ; DRAW UPPER BLOCK
.DOWN ADD.W #MAPTILEH*2,D6
JSR MAPGTTIL
CMP.W #WALL,D7
BEQ .END
MOVE.W #EXPLID,D7
JSR GFXDRIDP ; DRAW LOWER BLOCK
.END MOVEM.L (A7)+,D0-D7/A0-A1
RTS
; -----------------------------------------------------------------------------
BOMBBRK
; DESTROYS THE BRICK BLOCKS AFFECTED BY THE EXPLOSION
; INPUT - NONE
; OUTPUT - NONE
; MODIFIES - NONE
; -----------------------------------------------------------------------------
MOVEM.L D5-D6,-(A7)
MOVE.W BOMBPOX,D5
MOVE.W BOMBPOY,D6
SUB.W #MAPTILEW,D5
JSR MAPGRND ; LEFT BLOCK
ADD.W #MAPTILEW*2,D5
JSR MAPGRND ; RIGHT BLOCK
SUB.W #MAPTILEW,D5
SUB.W #MAPTILEH,D6
JSR MAPGRND ; UPPER BLOCK
ADD.W #MAPTILEH*2,D6
JSR MAPGRND ; LOWER BLOCK
MOVEM.L (A7)+,D5-D6
RTS
; -----------------------------------------------------------------------------
BOMBRNG
; DETERMINES IF THE PROVIDED COORDINATES ARE IN THE RANGE OF AN EXPLOSION
; INPUT - D5.W X COORDINATE (PIXELS)
; D6.W Y COORDINATE (PIXELS)
; OUTPUT - D7.B CODE:
; $00 NOT IN RANGE (BOMBNIR)
; $FF IN RANGE (BOMBIR)
; MODIFIES - NONE
; -----------------------------------------------------------------------------
MOVEM.L D4-D6,-(A7)
MOVE.W BOMBSTA,D4
CMP.W #BOMBEXP,D4 ; CHECK IF BOMB EXPLODING
BNE .NIR ; IF NOT, END
AND.W #$FFE0,D5 ; GET BLOCK X
AND.W #$FFE0,D6 ; GET BLOCK Y
CMP.W BOMBPOX,D5 ; CHECK SAME BLOCK
BNE .LEFT
CMP.W BOMBPOY,D6
BEQ .IR
.LEFT SUB.W #MAPTILEW,D5
CMP.W BOMBPOX,D5 ; CHECK LEFT BLOCK
BNE .RIGHT
CMP.W BOMBPOY,D6
BEQ .IR
.RIGHT ADD.W #MAPTILEW*2,D5
CMP.W BOMBPOX,D5
BNE .UP
CMP.W BOMBPOY,D6
BEQ .IR
.UP SUB.W #MAPTILEW,D5
SUB.W #MAPTILEH,D6
CMP.W BOMBPOX,D5
BNE .DOWN
CMP.W BOMBPOY,D6
BEQ .IR
.DOWN ADD.W #MAPTILEH*2,D6
CMP.W BOMBPOX,D5
BNE .NIR
CMP.W BOMBPOY,D6
BEQ .IR
BRA .NIR
.END MOVEM.L (A7)+,D4-D6
RTS
.NIR MOVE.B #BOMBNIR,D7
BRA .END
.IR MOVE.B #BOMBIR,D7
BRA .END
*~Font name~Courier New~
*~Font size~10~
*~Tab type~0~
*~Tab size~4~