Skip to content

Commit fd3e129

Browse files
authored
Rename Memcopy to MemCopy in P2 (#178)
& make text references consistent.
1 parent bcb3c91 commit fd3e129

File tree

12 files changed

+54
-54
lines changed

12 files changed

+54
-54
lines changed

src/part2/functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ So far, we have only written a single "flow" of code, but we can already spot so
44
Let's use **functions** to "factor out" code!
55

66
For example, in three places, we are copying chunks of memory around.
7-
Let's write a function below the `jp Main`, and let's call it `Memcpy`, like [the similar C function](https://man7.org/linux/man-pages/man3/memcpy.3.html):
7+
Let's write a function below the `jp Main`, and let's call it `MemCopy`, like the similar C function [`memcpy`](https://man7.org/linux/man-pages/man3/memcpy.3.html):
88

99
```rgbasm,linenos,start={{#line_no_of "" ../../unbricked/functions/main.asm:memcpy}}
1010
{{#include ../../unbricked/functions/main.asm:memcpy}}
@@ -20,8 +20,8 @@ Notice the comment above the function, explaining which registers it takes as in
2020
This comment is important so that you know how to interface with the function; assembly has no formal parameters, so comments explaining them are even more important than with other languages.
2121
We'll see more of those as we progress.
2222

23-
There are three places in the initialization code where we can use the `Memcpy` function.
24-
Find each of these copy loops and replace them with a call to `Memcpy`; for this, we use the `call` instruction.
23+
There are three places in the initialization code where we can use the `MemCopy` function.
24+
Find each of these copy loops and replace them with a call to `MemCopy`; for this, we use the `call` instruction.
2525
The registers serve as parameters to the function, so we'll leave them as-is.
2626

2727
<div class="table-wrapper"><table><thead><tr><th>Before</th><th>After</th></tr></thead><tbody><tr><td>

src/part2/input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ We have the building blocks of a game here, but we're still lacking player input
44
A game that plays itself isn't very much fun, so let's fix that.
55

66
Paste this code below your `Main` loop.
7-
Like `Memcpy`, this is a function that can be reused from different places, using the `call` instruction.
7+
Like `MemCopy`, this is a function that can be reused from different places, using the `call` instruction.
88

99
```rgbasm,linenos,start={{#line_no_of "" ../../unbricked/input/main.asm:input-routine}}
1010
{{#include ../../unbricked/input/main.asm:input-routine}}

src/part2/title-screen.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Then copy and paste the following after waiting for VBlank:
1313
```rgbasm,linenos,start={{#line_no_of "" ../../unbricked/title-screen/main.asm:title_screen}}
1414
{{#include ../../unbricked/title-screen/main.asm:title_screen}}
1515
```
16-
Note that we are using our `Memcopy` function from the [Functions](./functions.md) lesson! Isn't it handy to have reusable code? We are also using our `UpdateKeys` function from the [Input](./input.md) lesson to determine when to stop displaying the title screen and move on to the game itself. To do so, we loop until the start button has been pressed.
16+
Note that we are using our `MemCopy` function from the [Functions](./functions.md) lesson! Isn't it handy to have reusable code? We are also using our `UpdateKeys` function from the [Input](./input.md) lesson to determine when to stop displaying the title screen and move on to the game itself. To do so, we loop until the start button has been pressed.
1717

1818
And just like that we have ourselves a title screen!
1919

unbricked/audio/main.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ WaitVBlank:
2727
ld de, Tiles
2828
ld hl, $9000
2929
ld bc, TilesEnd - Tiles
30-
call Memcopy
30+
call MemCopy
3131

3232
; Copy the tilemap
3333
ld de, Tilemap
3434
ld hl, $9800
3535
ld bc, TilemapEnd - Tilemap
36-
call Memcopy
36+
call MemCopy
3737

3838
; Copy the paddle tile
3939
ld de, Paddle
4040
ld hl, $8000
4141
ld bc, PaddleEnd - Paddle
42-
call Memcopy
42+
call MemCopy
4343

4444
; Copy the ball tile
4545
ld de, Ball
4646
ld hl, $8010
4747
ld bc, BallEnd - Ball
48-
call Memcopy
48+
call MemCopy
4949

5050
xor a, a
5151
ld b, 160
@@ -351,14 +351,14 @@ Input:
351351
; @param de: Source
352352
; @param hl: Destination
353353
; @param bc: Length
354-
Memcopy:
354+
MemCopy:
355355
ld a, [de]
356356
ld [hli], a
357357
inc de
358358
dec bc
359359
ld a, b
360360
or a, c
361-
jp nz, Memcopy
361+
jp nz, MemCopy
362362
ret
363363

364364
; ANCHOR: bounce-sound

unbricked/bcd/main.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ WaitVBlank:
3131
ld de, Tiles
3232
ld hl, $9000
3333
ld bc, TilesEnd - Tiles
34-
call Memcopy
34+
call MemCopy
3535

3636
; Copy the tilemap
3737
ld de, Tilemap
3838
ld hl, $9800
3939
ld bc, TilemapEnd - Tilemap
40-
call Memcopy
40+
call MemCopy
4141

4242
; Copy the paddle tile
4343
ld de, Paddle
4444
ld hl, $8000
4545
ld bc, PaddleEnd - Paddle
46-
call Memcopy
46+
call MemCopy
4747

4848
; Copy the ball tile
4949
ld de, Ball
5050
ld hl, $8010
5151
ld bc, BallEnd - Ball
52-
call Memcopy
52+
call MemCopy
5353

5454
xor a, a
5555
ld b, 160
@@ -382,14 +382,14 @@ Input:
382382
; @param de: Source
383383
; @param hl: Destination
384384
; @param bc: Length
385-
Memcopy:
385+
MemCopy:
386386
ld a, [de]
387387
ld [hli], a
388388
inc de
389389
dec bc
390390
ld a, b
391391
or a, c
392-
jp nz, Memcopy
392+
jp nz, MemCopy
393393
ret
394394

395395
Tiles:

unbricked/bricks/main.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ WaitVBlank:
2727
ld de, Tiles
2828
ld hl, $9000
2929
ld bc, TilesEnd - Tiles
30-
call Memcopy
30+
call MemCopy
3131

3232
; Copy the tilemap
3333
ld de, Tilemap
3434
ld hl, $9800
3535
ld bc, TilemapEnd - Tilemap
36-
call Memcopy
36+
call MemCopy
3737

3838
; Copy the paddle tile
3939
ld de, Paddle
4040
ld hl, $8000
4141
ld bc, PaddleEnd - Paddle
42-
call Memcopy
42+
call MemCopy
4343

4444
; Copy the ball tile
4545
ld de, Ball
4646
ld hl, $8010
4747
ld bc, BallEnd - Ball
48-
call Memcopy
48+
call MemCopy
4949

5050
xor a, a
5151
ld b, 160
@@ -347,14 +347,14 @@ Input:
347347
; @param de: Source
348348
; @param hl: Destination
349349
; @param bc: Length
350-
Memcopy:
350+
MemCopy:
351351
ld a, [de]
352352
ld [hli], a
353353
inc de
354354
dec bc
355355
ld a, b
356356
or a, c
357-
jp nz, Memcopy
357+
jp nz, MemCopy
358358
ret
359359

360360
Tiles:

unbricked/collision/main.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@ WaitVBlank:
2121
ld de, Tiles
2222
ld hl, $9000
2323
ld bc, TilesEnd - Tiles
24-
call Memcopy
24+
call MemCopy
2525

2626
; Copy the tilemap
2727
ld de, Tilemap
2828
ld hl, $9800
2929
ld bc, TilemapEnd - Tilemap
30-
call Memcopy
30+
call MemCopy
3131

3232
; Copy the paddle tile
3333
ld de, Paddle
3434
ld hl, $8000
3535
ld bc, PaddleEnd - Paddle
36-
call Memcopy
36+
call MemCopy
3737

3838
; ANCHOR: ball-copy
3939
; Copy the ball tile
4040
ld de, Ball
4141
ld hl, $8010
4242
ld bc, BallEnd - Ball
43-
call Memcopy
43+
call MemCopy
4444
; ANCHOR_END: ball-copy
4545

4646
xor a, a
@@ -334,14 +334,14 @@ UpdateKeys:
334334
; @param de: Source
335335
; @param hl: Destination
336336
; @param bc: Length
337-
Memcopy:
337+
MemCopy:
338338
ld a, [de]
339339
ld [hli], a
340340
inc de
341341
dec bc
342342
ld a, b
343343
or a, c
344-
jp nz, Memcopy
344+
jp nz, MemCopy
345345
ret
346346

347347
Tiles:

unbricked/functions/main.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ WaitVBlank:
2222
ld de, Tiles
2323
ld hl, $9000
2424
ld bc, TilesEnd - Tiles
25-
call Memcopy
25+
call MemCopy
2626
; ANCHOR_END: copy_tiles
2727

2828
; ANCHOR: copy_map
2929
; Copy the tilemap
3030
ld de, Tilemap
3131
ld hl, $9800
3232
ld bc, TilemapEnd - Tilemap
33-
call Memcopy
33+
call MemCopy
3434
; ANCHOR_END: copy_map
3535

3636
; ANCHOR: copy_paddle
3737
; Copy the paddle tile
3838
ld de, Paddle
3939
ld hl, $8000
4040
ld bc, PaddleEnd - Paddle
41-
call Memcopy
41+
call MemCopy
4242
; ANCHOR_END: copy_paddle
4343

4444
xor a, a
@@ -104,14 +104,14 @@ WaitVBlank2:
104104
; @param de: Source
105105
; @param hl: Destination
106106
; @param bc: Length
107-
Memcopy:
107+
MemCopy:
108108
ld a, [de]
109109
ld [hli], a
110110
inc de
111111
dec bc
112112
ld a, b
113113
or a, c
114-
jp nz, Memcopy
114+
jp nz, MemCopy
115115
ret
116116
; ANCHOR_END: memcpy
117117

unbricked/input/main.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ WaitVBlank:
2222
ld de, Tiles
2323
ld hl, $9000
2424
ld bc, TilesEnd - Tiles
25-
call Memcopy
25+
call MemCopy
2626
; ANCHOR_END: copy_tiles
2727

2828
; ANCHOR: copy_map
2929
; Copy the tilemap
3030
ld de, Tilemap
3131
ld hl, $9800
3232
ld bc, TilemapEnd - Tilemap
33-
call Memcopy
33+
call MemCopy
3434
; ANCHOR_END: copy_map
3535

3636
; ANCHOR: copy_paddle
3737
; Copy the paddle tile
3838
ld de, Paddle
3939
ld hl, $8000
4040
ld bc, PaddleEnd - Paddle
41-
call Memcopy
41+
call MemCopy
4242
; ANCHOR_END: copy_paddle
4343

4444
xor a, a
@@ -163,14 +163,14 @@ UpdateKeys:
163163
; @param de: Source
164164
; @param hl: Destination
165165
; @param bc: Length
166-
Memcopy:
166+
MemCopy:
167167
ld a, [de]
168168
ld [hli], a
169169
inc de
170170
dec bc
171171
ld a, b
172172
or a, c
173-
jp nz, Memcopy
173+
jp nz, MemCopy
174174
ret
175175
; ANCHOR_END: memcpy
176176

unbricked/serial-link/demo.asm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ WaitVBlank:
9797
ld de, Tiles
9898
ld hl, $9000
9999
ld bc, TilesEnd - Tiles
100-
call Memcopy
100+
call MemCopy
101101

102102
; clear BG tilemap
103103
ld hl, $9800
@@ -663,14 +663,14 @@ Input:
663663
; @param de: Source
664664
; @param hl: Destination
665665
; @param bc: Length
666-
Memcopy:
666+
MemCopy:
667667
ld a, [de]
668668
ld [hli], a
669669
inc de
670670
dec bc
671671
ld a, b
672672
or a, c
673-
jp nz, Memcopy
673+
jp nz, MemCopy
674674
ret
675675

676676
Tiles:

0 commit comments

Comments
 (0)