diff options
-rw-r--r-- | shim.sym | 5 | ||||
-rw-r--r-- | source/bank_00.asm | 65 | ||||
-rw-r--r-- | source/bank_28.asm | 20 |
3 files changed, 90 insertions, 0 deletions
@@ -59,6 +59,10 @@ 3c:4377 function_3c_4377 +6c:7eec compressed_tilemap_6c_7eec + +75:7d35 compressed_gfx_75_7d35 + 7b:41e0 gfx_blank_char 00:a03e s_a03e @@ -88,6 +92,7 @@ 00:c318 w_farcall_target_high 00:c31e w_bank_temp ; db +00:c300 w_c300 00:c301 w_c301 00:c314 w_c314 00:c316 w_c316 diff --git a/source/bank_00.asm b/source/bank_00.asm index ae4a7cb..21d3160 100644 --- a/source/bank_00.asm +++ b/source/bank_00.asm @@ -1472,6 +1472,71 @@ text_draw_char: ld a, e ret +SECTION "decompress", ROM0[$20cf] +decompress:: +; Parameters: +; hl - source +; de - dest +; bc - length (not the actual source or dest length) + ld [w_bank_temp], a + ld a, [w_bank_rom] + push af + ld a, [w_bank_temp] + ld [w_bank_rom], a + ld [rROMB0], a + + xor a + ld [w_c300], a + +.main_loop + push bc + ld a, [hl+] + bit 7, a + jr nz, .alternating + +; uses the next a + 1 bytes of compressed data +; to output a + 1 bytes of decompressed data + inc a + ld c, a + ld a, [w_c300] +.seq_loop + xor [hl] + ld [de], a + inc hl + inc de + dec c + jr nz, .seq_loop + ld [w_c300], a + jr .next + +; uses the next one byte of compressed data +; to output a - $7e bytes of decompressed data, +; alternating between two different values +.alternating + sub $7e + ld c, a + ld a, [w_c300] +.alt_loop + xor [hl] + ld [de], a + inc de + dec c + jr nz, .alt_loop + ld [w_c300], a + inc hl + +.next + pop bc + dec bc + ld a, c + or b + jr nz, .main_loop + + pop af + ld [w_bank_rom], a + ld [rROMB0], a + ret + SECTION "function_00_24b7", ROM0[$24b7] function_00_24b7:: xor a diff --git a/source/bank_28.asm b/source/bank_28.asm new file mode 100644 index 0000000..d798744 --- /dev/null +++ b/source/bank_28.asm @@ -0,0 +1,20 @@ +INCLUDE "hardware.inc" +INCLUDE "macros.inc" + +SECTION "function_28_426a", ROMX[$426a], BANK[$28] + +function_28_426a:: + ld a, $01 + ld [w_d6b5], a + ld a, BANK(compressed_gfx_75_7d35) + ld hl, compressed_gfx_75_7d35 + ld de, _VRAM8800 + ld bc, 182 + call decompress + ld a, BANK(compressed_tilemap_6c_7eec) + ld hl, compressed_tilemap_6c_7eec + ld de, _SCRN0 + ld bc, 82 + call decompress + call function_00_1085 + ; TBC |