diff options
28 files changed, 233 insertions, 146 deletions
diff --git a/src/constants/map_constants.asm b/src/constants/map_constants.asm index 84656c4..be5ee7d 100644 --- a/src/constants/map_constants.asm +++ b/src/constants/map_constants.asm @@ -68,13 +68,13 @@ MAP_SCRIPT_CLOSE_TEXTBOX EQU $0e ; map palettes for use in SGB mode const_def 1 - const MAP_SGB_PALETTE_1 ; $1 - const MAP_SGB_PALETTE_2 ; $2 - const MAP_SGB_PALETTE_3 ; $3 - const MAP_SGB_PALETTE_4 ; $4 - const MAP_SGB_PALETTE_5 ; $5 - const MAP_SGB_PALETTE_6 ; $6 - const MAP_SGB_PALETTE_7 ; $7 - const MAP_SGB_PALETTE_8 ; $8 - const MAP_SGB_PALETTE_9 ; $9 - const MAP_SGB_PALETTE_10 ; $a + const MAP_SGB_PALS_1 ; $1 + const MAP_SGB_PALS_2 ; $2 + const MAP_SGB_PALS_3 ; $3 + const MAP_SGB_PALS_4 ; $4 + const MAP_SGB_PALS_5 ; $5 + const MAP_SGB_PALS_6 ; $6 + const MAP_SGB_PALS_7 ; $7 + const MAP_SGB_PALS_8 ; $8 + const MAP_SGB_PALS_9 ; $9 + const MAP_SGB_PALS_10 ; $a diff --git a/src/data/map_headers.asm b/src/data/map_headers.asm index cf91df2..01b67c8 100644 --- a/src/data/map_headers.asm +++ b/src/data/map_headers.asm @@ -1,37 +1,37 @@ ; TODO: figure out the rest of the data for each map ; related to the table at 20:4e5d MapHeaders: ; 1c374 (7:4374) - db TILEMAP_OVERWORLD_MAP, TILEMAP_OVERWORLD_MAP_CGB, $00, MAP_SGB_PALETTE_1, $01, MUSIC_OVERWORLD ; OVERWORLD_MAP - db TILEMAP_MASON_LABORATORY, TILEMAP_MASON_LABORATORY_CGB, $00, MAP_SGB_PALETTE_2, $02, MUSIC_OVERWORLD ; MASON_LABORATORY - db TILEMAP_DECK_MACHINE_ROOM, TILEMAP_DECK_MACHINE_ROOM_CGB, $00, MAP_SGB_PALETTE_2, $02, MUSIC_OVERWORLD ; DECK_MACHINE_ROOM - db TILEMAP_ISHIHARA, TILEMAP_ISHIHARA_CGB, $00, MAP_SGB_PALETTE_3, $03, MUSIC_OVERWORLD ; ISHIHARAS_HOUSE - db TILEMAP_FIGHTING_CLUB_ENTRANCE, TILEMAP_FIGHTING_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $04, MUSIC_OVERWORLD ; FIGHTING_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; FIGHTING_CLUB_LOBBY - db TILEMAP_FIGHTING_CLUB, TILEMAP_FIGHTING_CLUB_CGB, $00, MAP_SGB_PALETTE_4, $0d, MUSIC_CLUB_3 ; FIGHTING_CLUB - db TILEMAP_ROCK_CLUB_ENTRANCE, TILEMAP_ROCK_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $05, MUSIC_OVERWORLD ; ROCK_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; ROCK_CLUB_LOBBY - db TILEMAP_ROCK_CLUB, TILEMAP_ROCK_CLUB_CGB, $00, MAP_SGB_PALETTE_4, $0e, MUSIC_CLUB_2 ; ROCK_CLUB - db TILEMAP_WATER_CLUB_ENTRANCE, TILEMAP_WATER_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $06, MUSIC_OVERWORLD ; WATER_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; WATER_CLUB_LOBBY - db TILEMAP_WATER_CLUB, TILEMAP_WATER_CLUB_CGB, $00, MAP_SGB_PALETTE_2, $0f, MUSIC_CLUB_2 ; WATER_CLUB - db TILEMAP_LIGHTNING_CLUB_ENTRANCE, TILEMAP_LIGHTNING_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $07, MUSIC_OVERWORLD ; LIGHTNING_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; LIGHTNING_CLUB_LOBBY - db TILEMAP_LIGHTNING_CLUB, TILEMAP_LIGHTNING_CLUB_CGB, $00, MAP_SGB_PALETTE_5, $10, MUSIC_CLUB_1 ; LIGHTNING_CLUB - db TILEMAP_GRASS_CLUB_ENTRANCE, TILEMAP_GRASS_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $08, MUSIC_OVERWORLD ; GRASS_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; GRASS_CLUB_LOBBY - db TILEMAP_GRASS_CLUB, TILEMAP_GRASS_CLUB_CGB, $00, MAP_SGB_PALETTE_6, $11, MUSIC_CLUB_1 ; GRASS_CLUB - db TILEMAP_PSYCHIC_CLUB_ENTRANCE, TILEMAP_PSYCHIC_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $09, MUSIC_OVERWORLD ; PSYCHIC_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; PSYCHIC_CLUB_LOBBY - db TILEMAP_PSYCHIC_CLUB, TILEMAP_PSYCHIC_CLUB_CGB, $00, MAP_SGB_PALETTE_7, $12, MUSIC_CLUB_2 ; PSYCHIC_CLUB - db TILEMAP_SCIENCE_CLUB_ENTRANCE, TILEMAP_SCIENCE_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $0a, MUSIC_OVERWORLD ; SCIENCE_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; SCIENCE_CLUB_LOBBY - db TILEMAP_SCIENCE_CLUB, TILEMAP_SCIENCE_CLUB_CGB, $00, MAP_SGB_PALETTE_6, $13, MUSIC_CLUB_3 ; SCIENCE_CLUB - db TILEMAP_FIRE_CLUB_ENTRANCE, TILEMAP_FIRE_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $0b, MUSIC_OVERWORLD ; FIRE_CLUB_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; FIRE_CLUB_LOBBY - db TILEMAP_FIRE_CLUB, TILEMAP_FIRE_CLUB_CGB, $00, MAP_SGB_PALETTE_8, $14, MUSIC_CLUB_3 ; FIRE_CLUB - db TILEMAP_CHALLENGE_HALL_ENTRANCE, TILEMAP_CHALLENGE_HALL_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_3, $04, MUSIC_OVERWORLD ; CHALLENGE_HALL_ENTRANCE - db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALETTE_3, $0c, MUSIC_OVERWORLD ; CHALLENGE_HALL_LOBBY - db TILEMAP_CHALLENGE_HALL, TILEMAP_CHALLENGE_HALL_CGB, $00, MAP_SGB_PALETTE_9, $15, MUSIC_OVERWORLD ; CHALLENGE_HALL - db TILEMAP_POKEMON_DOME_ENTRANCE, TILEMAP_POKEMON_DOME_ENTRANCE_CGB, $00, MAP_SGB_PALETTE_10, $16, MUSIC_OVERWORLD ; POKEMON_DOME_ENTRANCE - db TILEMAP_POKEMON_DOME, TILEMAP_POKEMON_DOME_CGB, $00, MAP_SGB_PALETTE_10, $17, MUSIC_POKEMON_DOME ; POKEMON_DOME - db TILEMAP_HALL_OF_HONOR, TILEMAP_HALL_OF_HONOR_CGB, $00, MAP_SGB_PALETTE_10, $18, MUSIC_HALL_OF_HONOR ; HALL_OF_HONOR + db TILEMAP_OVERWORLD_MAP, TILEMAP_OVERWORLD_MAP_CGB, $00, MAP_SGB_PALS_1, $01, MUSIC_OVERWORLD ; OVERWORLD_MAP + db TILEMAP_MASON_LABORATORY, TILEMAP_MASON_LABORATORY_CGB, $00, MAP_SGB_PALS_2, $02, MUSIC_OVERWORLD ; MASON_LABORATORY + db TILEMAP_DECK_MACHINE_ROOM, TILEMAP_DECK_MACHINE_ROOM_CGB, $00, MAP_SGB_PALS_2, $02, MUSIC_OVERWORLD ; DECK_MACHINE_ROOM + db TILEMAP_ISHIHARA, TILEMAP_ISHIHARA_CGB, $00, MAP_SGB_PALS_3, $03, MUSIC_OVERWORLD ; ISHIHARAS_HOUSE + db TILEMAP_FIGHTING_CLUB_ENTRANCE, TILEMAP_FIGHTING_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $04, MUSIC_OVERWORLD ; FIGHTING_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; FIGHTING_CLUB_LOBBY + db TILEMAP_FIGHTING_CLUB, TILEMAP_FIGHTING_CLUB_CGB, $00, MAP_SGB_PALS_4, $0d, MUSIC_CLUB_3 ; FIGHTING_CLUB + db TILEMAP_ROCK_CLUB_ENTRANCE, TILEMAP_ROCK_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $05, MUSIC_OVERWORLD ; ROCK_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; ROCK_CLUB_LOBBY + db TILEMAP_ROCK_CLUB, TILEMAP_ROCK_CLUB_CGB, $00, MAP_SGB_PALS_4, $0e, MUSIC_CLUB_2 ; ROCK_CLUB + db TILEMAP_WATER_CLUB_ENTRANCE, TILEMAP_WATER_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $06, MUSIC_OVERWORLD ; WATER_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; WATER_CLUB_LOBBY + db TILEMAP_WATER_CLUB, TILEMAP_WATER_CLUB_CGB, $00, MAP_SGB_PALS_2, $0f, MUSIC_CLUB_2 ; WATER_CLUB + db TILEMAP_LIGHTNING_CLUB_ENTRANCE, TILEMAP_LIGHTNING_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $07, MUSIC_OVERWORLD ; LIGHTNING_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; LIGHTNING_CLUB_LOBBY + db TILEMAP_LIGHTNING_CLUB, TILEMAP_LIGHTNING_CLUB_CGB, $00, MAP_SGB_PALS_5, $10, MUSIC_CLUB_1 ; LIGHTNING_CLUB + db TILEMAP_GRASS_CLUB_ENTRANCE, TILEMAP_GRASS_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $08, MUSIC_OVERWORLD ; GRASS_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; GRASS_CLUB_LOBBY + db TILEMAP_GRASS_CLUB, TILEMAP_GRASS_CLUB_CGB, $00, MAP_SGB_PALS_6, $11, MUSIC_CLUB_1 ; GRASS_CLUB + db TILEMAP_PSYCHIC_CLUB_ENTRANCE, TILEMAP_PSYCHIC_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $09, MUSIC_OVERWORLD ; PSYCHIC_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; PSYCHIC_CLUB_LOBBY + db TILEMAP_PSYCHIC_CLUB, TILEMAP_PSYCHIC_CLUB_CGB, $00, MAP_SGB_PALS_7, $12, MUSIC_CLUB_2 ; PSYCHIC_CLUB + db TILEMAP_SCIENCE_CLUB_ENTRANCE, TILEMAP_SCIENCE_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $0a, MUSIC_OVERWORLD ; SCIENCE_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; SCIENCE_CLUB_LOBBY + db TILEMAP_SCIENCE_CLUB, TILEMAP_SCIENCE_CLUB_CGB, $00, MAP_SGB_PALS_6, $13, MUSIC_CLUB_3 ; SCIENCE_CLUB + db TILEMAP_FIRE_CLUB_ENTRANCE, TILEMAP_FIRE_CLUB_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $0b, MUSIC_OVERWORLD ; FIRE_CLUB_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; FIRE_CLUB_LOBBY + db TILEMAP_FIRE_CLUB, TILEMAP_FIRE_CLUB_CGB, $00, MAP_SGB_PALS_8, $14, MUSIC_CLUB_3 ; FIRE_CLUB + db TILEMAP_CHALLENGE_HALL_ENTRANCE, TILEMAP_CHALLENGE_HALL_ENTRANCE_CGB, $00, MAP_SGB_PALS_3, $04, MUSIC_OVERWORLD ; CHALLENGE_HALL_ENTRANCE + db TILEMAP_CLUB_LOBBY, TILEMAP_CLUB_LOBBY_CGB, $00, MAP_SGB_PALS_3, $0c, MUSIC_OVERWORLD ; CHALLENGE_HALL_LOBBY + db TILEMAP_CHALLENGE_HALL, TILEMAP_CHALLENGE_HALL_CGB, $00, MAP_SGB_PALS_9, $15, MUSIC_OVERWORLD ; CHALLENGE_HALL + db TILEMAP_POKEMON_DOME_ENTRANCE, TILEMAP_POKEMON_DOME_ENTRANCE_CGB, $00, MAP_SGB_PALS_10, $16, MUSIC_OVERWORLD ; POKEMON_DOME_ENTRANCE + db TILEMAP_POKEMON_DOME, TILEMAP_POKEMON_DOME_CGB, $00, MAP_SGB_PALS_10, $17, MUSIC_POKEMON_DOME ; POKEMON_DOME + db TILEMAP_HALL_OF_HONOR, TILEMAP_HALL_OF_HONOR_CGB, $00, MAP_SGB_PALS_10, $18, MUSIC_HALL_OF_HONOR ; HALL_OF_HONOR diff --git a/src/data/sgb_data/aerodactyl_intro_pals.bin b/src/data/sgb_data/aerodactyl_intro_pals.bin Binary files differnew file mode 100644 index 0000000..81f53ff --- /dev/null +++ b/src/data/sgb_data/aerodactyl_intro_pals.bin diff --git a/src/data/sgb_data/card_pop_pals.bin b/src/data/sgb_data/card_pop_pals.bin Binary files differnew file mode 100644 index 0000000..1cae5fe --- /dev/null +++ b/src/data/sgb_data/card_pop_pals.bin diff --git a/src/data/sgb_data/charizard_intro_pals.bin b/src/data/sgb_data/charizard_intro_pals.bin Binary files differnew file mode 100644 index 0000000..b3bc55a --- /dev/null +++ b/src/data/sgb_data/charizard_intro_pals.bin diff --git a/src/data/sgb_data/colosseum_booster_pals.bin b/src/data/sgb_data/colosseum_booster_pals.bin Binary files differnew file mode 100644 index 0000000..5b42426 --- /dev/null +++ b/src/data/sgb_data/colosseum_booster_pals.bin diff --git a/src/data/sgb_data/evolution_booster_pals.bin b/src/data/sgb_data/evolution_booster_pals.bin Binary files differnew file mode 100644 index 0000000..7c4d31d --- /dev/null +++ b/src/data/sgb_data/evolution_booster_pals.bin diff --git a/src/data/sgb_data/gameboy_link_pals.bin b/src/data/sgb_data/gameboy_link_pals.bin Binary files differnew file mode 100644 index 0000000..1a097e4 --- /dev/null +++ b/src/data/sgb_data/gameboy_link_pals.bin diff --git a/src/data/sgb_data/gameboy_printer_pals.bin b/src/data/sgb_data/gameboy_printer_pals.bin Binary files differnew file mode 100644 index 0000000..7475429 --- /dev/null +++ b/src/data/sgb_data/gameboy_printer_pals.bin diff --git a/src/data/sgb_data/laboratory_booster_pals.bin b/src/data/sgb_data/laboratory_booster_pals.bin Binary files differnew file mode 100644 index 0000000..a89ff66 --- /dev/null +++ b/src/data/sgb_data/laboratory_booster_pals.bin diff --git a/src/data/sgb_data/map_pals_1.bin b/src/data/sgb_data/map_pals_1.bin Binary files differnew file mode 100644 index 0000000..3fc62ba --- /dev/null +++ b/src/data/sgb_data/map_pals_1.bin diff --git a/src/data/sgb_data/map_pals_10.bin b/src/data/sgb_data/map_pals_10.bin Binary files differnew file mode 100644 index 0000000..8864b19 --- /dev/null +++ b/src/data/sgb_data/map_pals_10.bin diff --git a/src/data/sgb_data/map_pals_2.bin b/src/data/sgb_data/map_pals_2.bin Binary files differnew file mode 100644 index 0000000..b13d54b --- /dev/null +++ b/src/data/sgb_data/map_pals_2.bin diff --git a/src/data/sgb_data/map_pals_3.bin b/src/data/sgb_data/map_pals_3.bin Binary files differnew file mode 100644 index 0000000..2f7f104 --- /dev/null +++ b/src/data/sgb_data/map_pals_3.bin diff --git a/src/data/sgb_data/map_pals_4.bin b/src/data/sgb_data/map_pals_4.bin Binary files differnew file mode 100644 index 0000000..334a8a7 --- /dev/null +++ b/src/data/sgb_data/map_pals_4.bin diff --git a/src/data/sgb_data/map_pals_5.bin b/src/data/sgb_data/map_pals_5.bin Binary files differnew file mode 100644 index 0000000..d37ad71 --- /dev/null +++ b/src/data/sgb_data/map_pals_5.bin diff --git a/src/data/sgb_data/map_pals_6.bin b/src/data/sgb_data/map_pals_6.bin Binary files differnew file mode 100644 index 0000000..2c79bd3 --- /dev/null +++ b/src/data/sgb_data/map_pals_6.bin diff --git a/src/data/sgb_data/map_pals_7.bin b/src/data/sgb_data/map_pals_7.bin Binary files differnew file mode 100644 index 0000000..73c3d8b --- /dev/null +++ b/src/data/sgb_data/map_pals_7.bin diff --git a/src/data/sgb_data/map_pals_8.bin b/src/data/sgb_data/map_pals_8.bin Binary files differnew file mode 100644 index 0000000..0349fca --- /dev/null +++ b/src/data/sgb_data/map_pals_8.bin diff --git a/src/data/sgb_data/map_pals_9.bin b/src/data/sgb_data/map_pals_9.bin Binary files differnew file mode 100644 index 0000000..7804d5a --- /dev/null +++ b/src/data/sgb_data/map_pals_9.bin diff --git a/src/data/sgb_data/mystery_booster_pals.bin b/src/data/sgb_data/mystery_booster_pals.bin Binary files differnew file mode 100644 index 0000000..2cc6efe --- /dev/null +++ b/src/data/sgb_data/mystery_booster_pals.bin diff --git a/src/data/sgb_data/scyther_intro_pals.bin b/src/data/sgb_data/scyther_intro_pals.bin Binary files differnew file mode 100644 index 0000000..3b9634d --- /dev/null +++ b/src/data/sgb_data/scyther_intro_pals.bin diff --git a/src/data/sgb_data/title_screen_pals.bin b/src/data/sgb_data/title_screen_pals.bin Binary files differnew file mode 100644 index 0000000..be1e506 --- /dev/null +++ b/src/data/sgb_data/title_screen_pals.bin diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 3657fb5..700ebb4 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -496,7 +496,7 @@ Func_c38f: ; c38f (3:438f) jr z, .skip push hl - ld b, HIGH(wc000) + ld b, HIGH(wDecompressionSecondaryBuffer) call InitDataDecompression ld a, [wd23d] ld [wTempPointerBank], a diff --git a/src/engine/bank1c.asm b/src/engine/bank1c.asm index 1408f18..2207d2e 100644 --- a/src/engine/bank1c.asm +++ b/src/engine/bank1c.asm @@ -260,7 +260,7 @@ Func_701e9: ; 701e9 (1c:41e9) push bc ld e, l ld d, h - ld b, HIGH(wc000) + ld b, HIGH(wDecompressionSecondaryBuffer) call InitDataDecompression pop bc pop de @@ -377,17 +377,17 @@ SetSGB2AndSGB3MapPalette: ; 7036a (1c:436a) ret .pal_data_pointers - dw $722f ; unused - dw $722f ; MAP_SGB_PALETTE_1 - dw $7253 ; MAP_SGB_PALETTE_2 - dw $7277 ; MAP_SGB_PALETTE_3 - dw $729a ; MAP_SGB_PALETTE_4 - dw $72bd ; MAP_SGB_PALETTE_5 - dw $72e0 ; MAP_SGB_PALETTE_6 - dw $7304 ; MAP_SGB_PALETTE_7 - dw $7328 ; MAP_SGB_PALETTE_8 - dw $734b ; MAP_SGB_PALETTE_9 - dw $736f ; MAP_SGB_PALETTE_10 + dw SGBData_MapPals1 ; unused + dw SGBData_MapPals1 ; MAP_SGB_PALS_1 + dw SGBData_MapPals2 ; MAP_SGB_PALS_2 + dw SGBData_MapPals3 ; MAP_SGB_PALS_3 + dw SGBData_MapPals4 ; MAP_SGB_PALS_4 + dw SGBData_MapPals5 ; MAP_SGB_PALS_5 + dw SGBData_MapPals6 ; MAP_SGB_PALS_6 + dw SGBData_MapPals7 ; MAP_SGB_PALS_7 + dw SGBData_MapPals8 ; MAP_SGB_PALS_8 + dw SGBData_MapPals9 ; MAP_SGB_PALS_9 + dw SGBData_MapPals10 ; MAP_SGB_PALS_10 ; 0x703cb Func_703cb: ; 703cb (1c:43cb) @@ -429,7 +429,7 @@ DecompressSGBPalette: ; 70403 (1c:4403) push bc ld e, l ld d, h - ld b, HIGH(wc000) + ld b, HIGH(wDecompressionSecondaryBuffer) call InitDataDecompression pop bc ld de, wDecompressionBuffer @@ -502,48 +502,92 @@ Func_704c7: ; 704c7 (1c:44c7) ret ; 0x704d3 - INCROM $704d3, $73393 + INCROM $704d3, $7322f + +SGBData_MapPals1: ; 7322f (1c:722f) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_1.bin" + +SGBData_MapPals2: ; 73253 (1c:7253) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_2.bin" + +SGBData_MapPals3: ; 73277 (1c:7277) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_3.bin" + +SGBData_MapPals4: ; 7329a (1c:729a) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_4.bin" + +SGBData_MapPals5: ; 732bd (1c:72bd) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_5.bin" + +SGBData_MapPals6: ; 732e0 (1c:72e0) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_6.bin" + +SGBData_MapPals7: ; 73304 (1c:7304) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_7.bin" + +SGBData_MapPals8: ; 73328 (1c:7328) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_8.bin" + +SGBData_MapPals9: ; 7334b (1c:734b) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_9.bin" + +SGBData_MapPals10: ; 7336f (1c:736f) + dw $20 ; length + INCBIN "data/sgb_data/map_pals_10.bin" SGBData_CharizardIntro: ; 73393 (1c:7393) - dw $20 ; width - INCROM $73395, $733b8 + dw $20 ; length + INCBIN "data/sgb_data/charizard_intro_pals.bin" SGBData_ScytherIntro: ; 733b8 (1c:73b8) - dw $20 ; width - INCROM $733ba, $733dd + dw $20 ; length + INCBIN "data/sgb_data/scyther_intro_pals.bin" SGBData_AerodactylIntro: ; 733dd (1c:73dd) - dw $20 ; width - INCROM $733df, $73402 + dw $20 ; length + INCBIN "data/sgb_data/aerodactyl_intro_pals.bin" SGBData_ColosseumBooster: ; 73402 (1c:7402) - dw $20 ; width - INCROM $73404, $73427 + dw $20 ; length + INCBIN "data/sgb_data/colosseum_booster_pals.bin" SGBData_EvolutionBooster: ; 73427 (1c:7427) - dw $20 ; width - INCROM $73429, $7344c + dw $20 ; length + INCBIN "data/sgb_data/evolution_booster_pals.bin" SGBData_MysteryBooster: ; 7344c (1c:744c) - dw $20 ; width - INCROM $7344e, $73471 + dw $20 ; length + INCBIN "data/sgb_data/mystery_booster_pals.bin" SGBData_LaboratoryBooster: ; 73471 (1c:7471) - dw $20 ; width - INCROM $73473, $73aa8 + dw $20 ; length + INCBIN "data/sgb_data/laboratory_booster_pals.bin" + + INCROM $73496, $73aa8 SGBData_GameBoyLink: ; 73aa8 (1c:7aa8) - dw $40 ; width - INCROM $73aaa, $73ad8 + dw $40 ; length + INCBIN "data/sgb_data/gameboy_link_pals.bin" SGBData_CardPop: ; 73ad8 (1c:7ad8) - dw $40 ; width - INCROM $73ada, $73b05 + dw $40 ; length + INCBIN "data/sgb_data/card_pop_pals.bin" SGBData_GameBoyPrinter: ; 73b05 (1c:7b05) - dw $40 ; width - INCROM $73b07, $73b33 + dw $40 ; length + INCBIN "data/sgb_data/gameboy_printer_pals.bin" SGBData_TitleScreen: ; 73b33 (1c:7b33) - dw $40 ; width - INCROM $73b35, $74000 + dw $40 ; length + INCBIN "data/sgb_data/title_screen_pals.bin" + + INCROM $73b63, $74000 diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm index 0d79171..d6a7ac0 100644 --- a/src/engine/bank20.asm +++ b/src/engine/bank20.asm @@ -109,7 +109,7 @@ Func_800bd: ; 800bd (20:40bd) ld a, [wTempPointer + 1] adc $00 ld d, a - ld b, HIGH(wc000) + ld b, HIGH(wDecompressionSecondaryBuffer) call InitDataDecompression ld a, [wVRAMPointer] ld e, a diff --git a/src/engine/home.asm b/src/engine/home.asm index c23b544..5a8c822 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -1534,33 +1534,31 @@ UpdateRNGSources: ; 089b (0:089b) pop hl ret -; initilizes variables used to decompress -; data in DecompressData -; de points to the source of compressed data -; b is used as the HIGH byte of the -; WRAM address to write to ($100 bytes of buffer space) +; initilizes variables used to decompress data in DecompressData +; de = source of compressed data +; b = HIGH byte of secondary buffer ($100 bytes of buffer space) ; also clears this $100 byte space InitDataDecompression: ; 08bf (0:08bf) - ld hl, wcad6 + ld hl, wDecompSourcePosPtr ld [hl], e inc hl ld [hl], d - ld hl, wcad8 - ld [hl], $1 + ld hl, wDecompNumCommandBitsLeft + ld [hl], 1 inc hl xor a - ld [hli], a ; wcad9 - ld [hli], a ; wcada - ld [hli], a ; wcadb - ld [hli], a ; wcadc - ld [hl], b ; wcadd + ld [hli], a ; wDecompCommandByte + ld [hli], a ; wDecompRepeatModeToggle + ld [hli], a ; wDecompRepeatLengths + ld [hli], a ; wDecompNumBytesToRepeat + ld [hl], b ; wDecompSecondaryBufferPtrHigh inc hl - ld [hli], a ; wcade - ld [hl], $ef ; wcadf + ld [hli], a ; wDecompRepeatSeqOffset + ld [hl], LOW(wDecompressionSecondaryBufferStart) ; wDecompSecondaryBufferPtrLow ; clear buffer ld h, b - ld l, LOW(wc000) + ld l, LOW(wDecompressionSecondaryBuffer) xor a .loop ld [hl], a @@ -1570,7 +1568,7 @@ InitDataDecompression: ; 08bf (0:08bf) ; decompresses data ; uses values initialized by InitDataDecompression -; wcad6 holds the pointer for compressed source +; wDecompSourcePosPtr holds the pointer for compressed source ; input: ; bc = row width ; de = buffer to place decompressed data @@ -1591,99 +1589,110 @@ DecompressData: ; 08de (0:08de) pop hl ret -; instructions start with a byte stored in wcad9 -; its bits are read from higher to lower bit -; wcad8 stores the current bit being read -; bit set: -; - 1 byte read and copied literally -; bit not set: -; - 2 bytes read WW XY ZZ, byte in pos WW -; copied (X + 1) times, then in pos ZZ -; copied (Y + 1) times +; decompression works as follows: +; first a command byte is read that will dictate how the +; following bytes will be copied +; the position will then move to the next byte (0xXY), and +; the command byte's bits are read from higher to lower bit +; - if command bit is set, then copy 0xXY to buffer; +; - if command bit is not set, then decompression enters "repeat mode," +; which means it stores 0xXY in memory as number of bytes to repeat +; from a given offset. This offset is in the next byte in the data, +; 0xZZ, which tells the offset to start repeating. A toggle is switched +; each time the algorithm hits "repeat mode": +; - if off -> on it reads 0xXY and stores it, +; then repeats (0x0X + 2) bytes from the offset starting at 0xZZ; +; - if on -> off, then the data only provides the offset, +; and the previous byte read for number of bytes to repeat, 0xXY, is reused +; in which case (0x0Y + 2) bytes are repeated starting from the offset. .Decompress: ; 08ef (0:08ef) - ld hl, wcadc + ld hl, wDecompNumBytesToRepeat ld a, [hl] or a - jr z, .read_instruction + jr z, .read_command -; still repeating byte +; still repeating sequence dec [hl] inc hl .repeat_byte - ld b, [hl] ; wcadd + ld b, [hl] ; wDecompSecondaryBufferPtrHigh inc hl - ld c, [hl] ; wcade + ld c, [hl] ; wDecompRepeatSeqOffset inc [hl] inc hl ld a, [bc] - ld c, [hl] ; wcadf + ld c, [hl] ; wDecompSecondaryBufferPtrLow inc [hl] ld [bc], a ret -.read_instruction - ld hl, wcad6 +.read_command + ld hl, wDecompSourcePosPtr ld c, [hl] inc hl ld b, [hl] - inc hl ; wcad8 + inc hl ; wDecompNumCommandBitsLeft dec [hl] - inc hl ; wcad9 - jr nz, .asm_914 - dec hl ; wcad8 - ld [hl], $8 ; number of bits - inc hl ; wcad9 + inc hl ; wDecompCommandByte + jr nz, .read_command_bit + dec hl ; wDecompNumCommandBitsLeft + ld [hl], 8 ; number of bits + inc hl ; wDecompCommandByte ld a, [bc] inc bc ld [hl], a -.asm_914 +.read_command_bit rl [hl] ld a, [bc] inc bc - jr nc, .asm_92a + jr nc, .repeat_command ; copy 1 byte literally - ld hl, wcad6 + ld hl, wDecompSourcePosPtr ld [hl], c inc hl ld [hl], b - ld hl, wcadd + ld hl, wDecompSecondaryBufferPtrHigh ld b, [hl] inc hl inc hl - ld c, [hl] ; wcadf + ld c, [hl] ; wDecompSecondaryBufferPtrLow inc [hl] ld [bc], a ret -.asm_92a - ld [wcade], a - ld hl, wcada +.repeat_command + ld [wDecompRepeatSeqOffset], a ; save the offset to repeat from + ld hl, wDecompRepeatModeToggle bit 0, [hl] - jr nz, .asm_94a + jr nz, .repeat_mode_toggle_on set 0, [hl] inc hl +; read byte for num of bytes to read +; and use its higher nybble ld a, [bc] inc bc - ld [hli], a ; wcadb + ld [hli], a ; wDecompRepeatLengths swap a -.asm_93c +.get_sequence_len and $f inc a ; number of times to repeat - ld [hli], a ; wcadc + ld [hli], a ; wDecompNumBytesToRepeat push hl - ld hl, wcad6 + ld hl, wDecompSourcePosPtr ld [hl], c inc hl ld [hl], b pop hl jr .repeat_byte -.asm_94a +.repeat_mode_toggle_on +; get the previous byte (num of bytes to repeat) +; and use its lower nybble res 0, [hl] inc hl - ld a, [hli] ; wcadb - jr .asm_93c + ld a, [hli] ; wDecompRepeatLengths + jr .get_sequence_len ; set attributes for [hl] sprites starting from wOAM + [wOAMOffset] / 4 ; return carry if reached end of wOAM before finishing diff --git a/src/wram.asm b/src/wram.asm index 85c839b..e5f8b9c 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -15,6 +15,22 @@ NEXTU wc000:: ; c000 ds $100 +NEXTU + +; aside from wDecompressionBuffer, which stores the +; de facto final decompressed data after decompression, +; this buffer stores a secondary buffer that is used +; for "lookbacks" when repeating byte sequences. +; actually starts in the middle of the buffer, +; at wDecompressionSecondaryBufferStart, then wraps back up +; to wDecompressionSecondaryBuffer. +; this is used so that $00 can be "looked back", since anything +; before $ef is initialized to 0 when starting decompression. +wDecompressionSecondaryBuffer:: ; c000 + ds $ef +wDecompressionSecondaryBufferStart:: ; ; c0ef + ds $11 + ENDU ds $100 @@ -543,30 +559,48 @@ wDoFrameFunction:: ; cad3 wcad5:: ; cad5 ds $1 -wcad6:: ; cad6 +; pointer to keep track of where +; in the source data we are while +; running the decompression algorithm +wDecompSourcePosPtr:: ; cad6 ds $2 -wcad8:: ; cad8 +; number of bits that are still left +; to read from the current command byte +wDecompNumCommandBitsLeft:: ; cad8 ds $1 -wcad9:: ; cad9 +; command byte from which to read the bits +; to decompress source data +wDecompCommandByte:: ; cad9 ds $1 -wcada:: ; cada +; if bit 7 is changed from off to on, then +; decompression routine will read next two bytes +; for repeating previous sequence (num of bytes, offset) +; if changes from off to on, then the routine +; will only read one byte, and reuse previous num of bytes +wDecompRepeatModeToggle:: ; cada ds $1 -wcadb:: ; cadb +; stores in both nybbles the length of the +; sequences to copy in decompression +; the high nybble is used first, then the low nybble +; for a subsequent sequence repition +wDecompRepeatLengths:: ; cadb ds $1 -wcadc:: ; cadc +wDecompNumBytesToRepeat:: ; cadc ds $1 -wcadd:: ; cadd +wDecompSecondaryBufferPtrHigh:: ; cadd ds $1 -wcade:: ; cade +; offset to repeat byte from decompressed data +wDecompRepeatSeqOffset:: ; cade ds $1 +wDecompSecondaryBufferPtrLow:: ; cadf ds $1 wTempSGBPacket:: ; cae0 |