git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit 05078295b49e42b1c5438460ed47d713716a033a
parent dc96f12d8e42e53df7f9b6600243537ffc72fa57
Author: Toxa <untoxa@mail.ru>
Date:   Mon,  6 Sep 2021 00:34:37 +0300

SMS/GG: memset()

Diffstat:
Mgbdk-lib/include/asm/z80/string.h2+-
Mgbdk-lib/libc/asm/z80/Makefile2+-
Agbdk-lib/libc/asm/z80/memset.s28++++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/gbdk-lib/include/asm/z80/string.h b/gbdk-lib/include/asm/z80/string.h @@ -51,7 +51,7 @@ void *memmove (void *dest, const void *src, size_t n); @param c char value to fill with (truncated from int) @param n Number of bytes to fill */ -void *memset (void *s, int c, size_t n) NONBANKED; +void *memset (void *s, int c, size_t n) __z88dk_callee; /** Reverses the characters in a string diff --git a/gbdk-lib/libc/asm/z80/Makefile b/gbdk-lib/libc/asm/z80/Makefile @@ -10,7 +10,7 @@ ASSRC = __strreverse.s strcpy.s strlen.s \ mul.s mulchar.s \ __itoa.s __ltoa.s \ __uitobcd.s __ultobcd.s \ - memcpy.s memmove.s \ + memcpy.s memmove.s memset.s \ setjmp.s \ abs.s \ rand.s arand.s \ diff --git a/gbdk-lib/libc/asm/z80/memset.s b/gbdk-lib/libc/asm/z80/memset.s @@ -0,0 +1,28 @@ + .area _CODE + +;; void *memset (void *s, int c, size_t n) __z88dk_callee; +_memset:: + pop af + pop hl + pop de + pop bc + push af + + ld a, b + or c + ret z + + ld (hl), e + dec bc + + ld a, b + or c + ret z + + ld d, h + ld e, l + inc de + + ldir + ret +

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.