Skip to content

Commit 59da8c8

Browse files
Clean up home/copy2.asm (#531)
* Use `SCREEN_WIDTH`, rename loop, and remove obsolete comment in `ClearScreenArea` * Use `SCREEN_HEIGHT` and `lb` in `CopyScreenTileBufferToVRAM` * Use `SCREEN_AREA` in `ClearScreen`
1 parent 108bf29 commit 59da8c8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

home/copy2.asm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,39 +161,39 @@ CopyVideoDataDouble::
161161

162162
ClearScreenArea::
163163
; Clear tilemap area cxb at hl.
164-
ld a, " " ; blank tile
165-
ld de, 20 ; screen width
166-
.y
164+
ld a, " "
165+
ld de, SCREEN_WIDTH
166+
.loopRows
167167
push hl
168168
push bc
169-
.x
169+
.loopTiles
170170
ld [hli], a
171171
dec c
172-
jr nz, .x
172+
jr nz, .loopTiles
173173
pop bc
174174
pop hl
175175
add hl, de
176176
dec b
177-
jr nz, .y
177+
jr nz, .loopRows
178178
ret
179179

180180
CopyScreenTileBufferToVRAM::
181181
; Copy wTileMap to the BG Map starting at b * $100.
182182
; This is done in thirds of 6 rows, so it takes 3 frames.
183183

184-
ld c, 6
184+
ld c, SCREEN_HEIGHT / 3
185185

186-
ld hl, $600 * 0
186+
lb hl, 0, 0
187187
decoord 0, 6 * 0
188188
call .setup
189189
call DelayFrame
190190

191-
ld hl, $600 * 1
191+
lb hl, SCREEN_HEIGHT / 3, 0
192192
decoord 0, 6 * 1
193193
call .setup
194194
call DelayFrame
195195

196-
ld hl, $600 * 2
196+
lb hl, 2 * SCREEN_HEIGHT / 3, 0
197197
decoord 0, 6 * 2
198198
call .setup
199199
jp DelayFrame
@@ -215,7 +215,7 @@ CopyScreenTileBufferToVRAM::
215215
ClearScreen::
216216
; Clear wTileMap, then wait
217217
; for the bg map to update.
218-
ld bc, 20 * 18
218+
ld bc, SCREEN_AREA
219219
inc b
220220
hlcoord 0, 0
221221
ld a, " "

0 commit comments

Comments
 (0)