git.y1.nz

gbdk-2020

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

commit d124b6c3fb4319adc99a744419a8fe1ec2897abb
parent 7fcbf25f39b82e833eacae2f339da44ed1878e37
Author: Toxa <untoxa@mail.ru>
Date:   Sat,  6 Feb 2021 16:58:57 +0300

gb-decompress to VRAM tile wrapping

Diffstat:
MREADME.md2+-
Mgbdk-lib/include/gb/gbdecompress.h4----
Mgbdk-lib/libc/gb/gb_decompress_tiles.s28+++++++++++++++-------------
3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/README.md b/README.md @@ -45,4 +45,4 @@ Unless you are interested on recompiling the sources for some reason (like fixin - Download and install [**sdcc nightlies from 4.0.7 #12016 onwards**](http://sdcc.sourceforge.net/snap.php) (SDCC is no longer part of GDDK so you need to download it (just the binaries) in the platform you need) - On Linux **don't use package managers** The latest release available won't work, you need to compile or download one of the nightlies - Create **SDCCDIR** environment variable, that points into the folder, where you installed sdcc -- Open a command prompt or a terminal, go the root directory of the repo and run **make** +- Open command prompt or a terminal, go to the root directory of the repo and run **make** diff --git a/gbdk-lib/include/gb/gbdecompress.h b/gbdk-lib/include/gb/gbdecompress.h @@ -20,8 +20,4 @@ void gb_decompress_win_data(UINT8 first_tile, const unsigned char * sour) __pres */ void gb_decompress_sprite_data(UINT8 first_tile, const unsigned char * sour) __preserves_regs(b, c); -/** gb-decompress data from sour into dest (VRAM-safe) - */ -void gb_decompress_vram(const unsigned char * sour, unsigned char * dest) __preserves_regs(b, c); - #endif diff --git a/gbdk-lib/libc/gb/gb_decompress_tiles.s b/gbdk-lib/libc/gb/gb_decompress_tiles.s @@ -3,18 +3,14 @@ ; GB-Decompress tiledata directly to VRAM ; Compatible with GBTD - .area _CODE +.macro WRAP_VRAM regH, ?loc + bit 3, regH + jr z, loc + res 4, regH +loc: +.endm -_gb_decompress_vram:: - lda hl,5(SP) - ld a,(hl-) - ld d,a - ld a,(hl-) - ld e,a - ld a,(hl-) - ld l,(hl) - ld h,a - jr gb_decompress_vram + .area _CODE _gb_decompress_bkg_data:: _gb_decompress_win_data:: @@ -38,6 +34,7 @@ _gb_decompress_sprite_data:: ld a, e and #0xF0 ; Get low bits only ld e, a + WRAP_VRAM d ld a, (hl+) ld h, (hl) @@ -49,7 +46,7 @@ gb_decompress_vram:: 1$: ld a,(hl+) ; load command or a - jr z,9$ ; exit, if last byte + jp z,9$ ; exit, if last byte bit 7,a jr nz,5$ ; string functions bit 6,a @@ -63,6 +60,7 @@ gb_decompress_vram:: ld a,(hl) ld (de),a inc de + WRAP_VRAM d dec b jr nz,2$ inc hl @@ -80,10 +78,12 @@ gb_decompress_vram:: ld a,b ; store word ld (de),a inc de + WRAP_VRAM d WAIT_STAT ld a,c ld (de),a inc de + WRAP_VRAM d pop af dec a jr nz,4$ @@ -107,6 +107,7 @@ gb_decompress_vram:: ld a,(hl+) ld (de),a inc de + WRAP_VRAM d dec b jr nz,6$ pop hl @@ -122,9 +123,10 @@ gb_decompress_vram:: ld a,(hl+) ld (de),a inc de + WRAP_VRAM d dec b jr nz,8$ - jr 1$ ; next command + jp 1$ ; next command 9$: pop bc 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.