From a45cd5e2c76f2e6fbfa28236d87591ab4635b392 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 1 Oct 2024 17:09:00 +0200 Subject: [PATCH] strings: fixed puts printing the 0 character --- src/strings.s | 11 +++++++---- src/video.s | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/strings.s b/src/strings.s index 5fd229c..e2691bd 100644 --- a/src/strings.s +++ b/src/strings.s @@ -3,8 +3,10 @@ .rep i, 26, 1, .scc i + 'a' = i + 10 .rep i, 26, 1, .scc i + 'A' = i + 10 +#define EMPTY_TILE 0x30 + ; map space to empty tile -.scc 0x20 = 0x30 +.scc 0x20 = EMPTY_TILE STR_TITLE: .str "game" @@ -18,9 +20,10 @@ STR_TITLE: puts: @loop: ld a, [hl+] + cp a, 0 + jr z, @done REL ld [de], a inc de - cp a, 0 - jp nz, @loop - + jr @loop REL +@done: ret diff --git a/src/video.s b/src/video.s index 7b2144c..d7b97dd 100644 --- a/src/video.s +++ b/src/video.s @@ -28,7 +28,6 @@ lcd_off: lcd_on: ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON ld [RLCD], a - call vblank_wait ret @@ -37,7 +36,7 @@ video_init: ld hl, SCRN0 ld bc, 1024 - ld d, 0 + ld d, EMPTY_TILE call memset ; set up bgp -- 2.30.2