You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/part2/functions.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ So far, we have only written a single "flow" of code, but we can already spot so
4
4
Let's use **functions** to "factor out" code!
5
5
6
6
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):
@@ -20,8 +20,8 @@ Notice the comment above the function, explaining which registers it takes as in
20
20
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.
21
21
We'll see more of those as we progress.
22
22
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.
25
25
The registers serve as parameters to the function, so we'll leave them as-is.
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.
17
17
18
18
And just like that we have ourselves a title screen!
0 commit comments