Skip to content

Commit

Permalink
Add docs to copy() and inc in malloc()
Browse files Browse the repository at this point in the history
  • Loading branch information
pickle committed Oct 9, 2023
1 parent db1eed2 commit 99d2469
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void* malloc(int size)__naked{
pop bc
push bc
push hl

inc bc
jp __malloc
__endasm;
}
Expand Down Expand Up @@ -534,7 +534,13 @@ void* calloc(int size)__naked{
__endasm;
}


/** @brief Copy a region of memory
* @param[dst] Location to copy to
* @param[source] Location to copy from
* @param[size] Amount of ram to copy.
*
* This is <b>not</b> strncpy and will disregard null termination.
*/
void copy(void* dst, void* source, int size)__naked{
__asm
pop af
Expand All @@ -545,7 +551,7 @@ void copy(void* dst, void* source, int size)__naked{
push hl
push de
push af

ldir
ret
__endasm;
Expand Down

0 comments on commit 99d2469

Please sign in to comment.