|
54 | 54 | se. 3,2,14 |
55 | 55 | endif |
56 | 56 |
|
57 | | -' Memory area for the board |
58 | | -mainBoard = $7000 + 19 |
59 | | -fullBoard = $7000 + 16 |
60 | | -' Clear board, needed to detect bad moves |
61 | | -mset $7000, 192, 0 |
| 57 | +' Array to hold the board, cleared on DIM |
| 58 | +dim board(192) byte |
| 59 | +mainBoard = adr(board) + 19 |
| 60 | +fullBoard = adr(board) + 16 |
62 | 61 |
|
63 | 62 | hiScore = 0 |
64 | 63 | screen = dpeek(88) |
@@ -144,32 +143,25 @@ endproc |
144 | 143 | ' Make pieces fall in the board |
145 | 144 | proc FallPieces |
146 | 145 |
|
147 | | - ' Loop until there are holes in the board |
148 | | - repeat |
149 | | - |
150 | | - endFall = 1 |
151 | | - |
152 | | - ' Move board to screen |
153 | | - move fullBoard, screen, 160 |
154 | | - |
155 | | - ' Search for holes in the board |
156 | | - for A=mainBoard to mainBoard + 151 step 16 |
157 | | - for P=A to A+9 |
158 | | - if peek(P) & 63 = 9 |
159 | | - ' If we found a hole, fall pieces! |
160 | | - i = P |
161 | | - while i > mainBoard + 15 |
162 | | - poke i, peek(i-16) |
163 | | - i = i-16 |
164 | | - wend |
165 | | - ' Set new piece and set A to exit outer loop |
166 | | - poke i, pieces(rand(6)) |
167 | | - A = mainBoard + 152 |
168 | | - endFall = 0 |
169 | | - endif |
170 | | - next P |
171 | | - next A |
172 | | - until endFall |
| 146 | + ' Move board to screen |
| 147 | + move fullBoard, screen, 160 |
| 148 | + |
| 149 | + ' Search for holes in the board |
| 150 | + for A=mainBoard to mainBoard + 151 step 16 |
| 151 | + for P=A to A+9 |
| 152 | + if peek(P) & 63 = 9 |
| 153 | + ' If we found a hole, fall pieces! |
| 154 | + i = P |
| 155 | + while i > mainBoard + 15 |
| 156 | + poke i, peek(i-16) |
| 157 | + i = i-16 |
| 158 | + wend |
| 159 | + ' Set new piece and display current position |
| 160 | + poke i, pieces(rand(6)) |
| 161 | + move fullBoard, screen, 160 |
| 162 | + endif |
| 163 | + next P |
| 164 | + next A |
173 | 165 |
|
174 | 166 | endproc |
175 | 167 |
|
|
0 commit comments