From: Lukas Krickl Date: Sun, 11 Jan 2026 04:51:04 +0000 (+0100) Subject: map: tiles are now loaded from the actual tile table X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=03d0c04a8e515dab2632d27824da45c1c5d37835;p=gbrg%2F.git map: tiles are now loaded from the actual tile table --- diff --git a/src/map.s b/src/map.s index b81a113..95727bb 100644 --- a/src/map.s +++ b/src/map.s @@ -92,14 +92,34 @@ map_tiles_load: add hl, de ; hl = first tile to load - ; hl = first tile in buffer - ld de, tiles+t_flags0 ; load flags + ; de = first tile in buffer + ld de, tiles ; start at first tile ld bc, MAP_TILES ; loop counter @load_loop: ; load a tile ld a, [hl+] ; load and tile++ - ld [de], a ; write flags + add a, a ; * 2 for table offset + + push_all + + push de ; de = destination tile... + + ld hl, tile_table + ld d, 0 + ld e, a + add hl, de ; hl = correct tile ptr + ld a, [hl+] + ld h, [hl] + ld l, a ; hl = tile ptr + push hl + pop de ; de = src tile + + pop hl ; hl = destination tile + ld bc, t_size + call memcpy + + pop_all ; next tile .rep i, t_size, 1, inc de