diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-09-13 19:56:55 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-09-13 19:56:55 -0400 |
commit | 24efa227b1f3934660d29ab5c930ec167079f5f1 (patch) | |
tree | 684a892dfdecd00560a9045e19ddef476a574150 /source | |
parent | 8e7d7737aba30506c2689d3ba422c5c8c5785b44 (diff) |
Disassemble the decompression routine
Diffstat (limited to 'source')
-rw-r--r-- | source/bank_00.asm | 65 | ||||
-rw-r--r-- | source/bank_28.asm | 20 |
2 files changed, 85 insertions, 0 deletions
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 |