git.y1.nz

gbdk-2020

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

commit 38ffd7bc61ac5ee8ca9284f56857e7d72ed9f17a
parent ca326fbe45e0b00107c6f2960bee994743afba63
Author: Toxa <untoxa@mail.ru>
Date:   Mon,  6 Sep 2021 16:20:44 +0300

SMS/GG: fix ___strreverse_reg

Diffstat:
Agbdk-lib/examples/sms/test/Makefile30++++++++++++++++++++++++++++++
Agbdk-lib/examples/sms/test/test.c11+++++++++++
Mgbdk-lib/libc/asm/z80/__strreverse.s4++--
3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/gbdk-lib/examples/sms/test/Makefile b/gbdk-lib/examples/sms/test/Makefile @@ -0,0 +1,30 @@ +CC = ../../../bin/lcc -mz80:sms -Wm-yoA -Wl-j + +BINS = test.sms + +all: $(BINS) + +ASRC = $(wildcard *.s) +CSRC = $(wildcard *.c) + +OBJS = $(CSRC:%.c=%.o) $(ASRC:%.s=%.o) + +compile.bat: Makefile + @echo "REM Automatically generated from Makefile" > compile.bat + @make -sn | sed y/\\//\\\\/ | grep -v make >> compile.bat + +# Compile and link single file in one pass + +%.o: %.c + $(CC) -c -o $@ $< + +%.o: %.s + $(CC) -c -o $@ $< + +$(BINS): $(OBJS) + $(CC) -Wm-yS -o $@ $^ + rm -f *.map *.noi *.ihx *.lst + +clean: + rm -f *.o *.lst *.map *.sms *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + diff --git a/gbdk-lib/examples/sms/test/test.c b/gbdk-lib/examples/sms/test/test.c @@ -0,0 +1,11 @@ +#include <sms/sms.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +void main() { + uint8_t data[32]; + uint16_t score = 75; + printf("%d %s", strlen(uitoa(score, data, 10)), data); +} diff --git a/gbdk-lib/libc/asm/z80/__strreverse.s b/gbdk-lib/libc/asm/z80/__strreverse.s @@ -44,6 +44,7 @@ ___strreverse:: ;in: HL - pointer to end of string (null symbol), DE - pointer to start of string ; ___strreverse_reg:: + push de jr 110$ 100$: add hl, de @@ -58,6 +59,5 @@ ___strreverse_reg:: or a, a sbc hl, de jr NC, 100$ - add hl, de - inc hl + pop hl 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.