File tree Expand file tree Collapse file tree 1 file changed +20
-32
lines changed
Expand file tree Collapse file tree 1 file changed +20
-32
lines changed Original file line number Diff line number Diff line change @@ -30,26 +30,12 @@ TitleScreen:
3030 ld de , Unbricked_Title_Screen_Tileset_Begin
3131 ld hl , $ 9000
3232 ld bc , Unbricked_Title_Screen_Tileset_End - Unbricked_Title_Screen_Tileset_Begin
33- CopyTitleScreenTiles:
34- ld a , [ de ]
35- ld [ hli ], a
36- inc de
37- dec bc
38- ld a , b
39- or a , c
40- jp nz , CopyTitleScreenTiles
33+ call Memcopy
4134
4235 ld de , Unbricked_Title_Screen_Map_Begin
4336 ld hl , $ 9800
4437 ld bc , Unbricked_Title_Screen_Map_End - Unbricked_Title_Screen_Map_Begin
45- CopyTitleScreenMap:
46- ld a , [ de ]
47- ld [ hli ], a
48- inc de
49- dec bc
50- ld a , b
51- or a , c
52- jp nz , CopyTitleScreenMap
38+ call Memcopy
5339
5440 ; Turn the LCD on
5541 ld a , LCDCF_ON | LCDCF_BGON
@@ -91,29 +77,15 @@ ClearVRAM:
9177 ld de , Tiles
9278 ld hl , $ 9000
9379 ld bc , TilesEnd - Tiles
94- CopyTiles:
95- ld a , [ de ]
96- ld [ hli ], a
97- inc de
98- dec bc
99- ld a , b
100- or a , c
101- jp nz , CopyTiles
80+ call Memcopy
10281; ANCHOR_END: copy_tiles
10382
10483; ANCHOR: copy_map
10584 ; Copy the tilemap
10685 ld de , Tilemap
10786 ld hl , $ 9800
10887 ld bc , TilemapEnd - Tilemap
109- CopyTilemap:
110- ld a , [ de ]
111- ld [ hli ], a
112- inc de
113- dec bc
114- ld a , b
115- or a , c
116- jp nz , CopyTilemap
88+ call Memcopy
11789; ANCHOR_END: copy_map
11890
11991 ; Turn the LCD on
@@ -127,6 +99,22 @@ Done:
12799 jp Done
128100; ANCHOR_END: end
129101
102+ ; ANCHOR: memcpy
103+ ; Copy bytes from one area to another.
104+ ; @param de: Source
105+ ; @param hl: Destination
106+ ; @param bc: Length
107+ Memcopy:
108+ ld a , [ de ]
109+ ld [ hli ], a
110+ inc de
111+ dec bc
112+ ld a , b
113+ or a , c
114+ jp nz , Memcopy
115+ ret
116+ ; ANCHOR_END: memcpy
117+
130118Tiles:
131119 dw ` 33333333
132120 dw ` 33333333
You can’t perform that action at this time.
0 commit comments