diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 0104af9f1..864a4bd50 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -4,6 +4,8 @@ LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes NUM_PAL_COLORS EQU 4 +PALRGB_WHITE EQUS "palred 31 + palgreen 31 + palblue 31" ; $7fff + SCREEN_WIDTH EQU 20 ; tiles SCREEN_HEIGHT EQU 18 ; tiles SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels diff --git a/gfx/sgb/roof_pal_inds.asm b/data/maps/sgb_roof_pal_inds.asm similarity index 100% rename from gfx/sgb/roof_pal_inds.asm rename to data/maps/sgb_roof_pal_inds.asm diff --git a/gfx/sgb/data_snd_packets.asm b/data/sgb_ctrl_packets.asm similarity index 81% rename from gfx/sgb/data_snd_packets.asm rename to data/sgb_ctrl_packets.asm index c2521b845..7ca77fa34 100644 --- a/gfx/sgb/data_snd_packets.asm +++ b/data/sgb_ctrl_packets.asm @@ -2,6 +2,34 @@ ; names taken from pandocs ; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands +sgb_pal_trn: MACRO + db (SGB_PAL_TRN << 3) + 1 + ds 15 +ENDM + +sgb_mlt_req: MACRO + db (SGB_MLT_REG << 3) + 1 + db \1 - 1 + ds 14 +ENDM + +sgb_chr_trn: MACRO + db (SGB_CHR_TRN << 3) + 1 + db \1 + (\2 << 1) + ds 14 +ENDM + +sgb_pct_trn: MACRO + db (SGB_PCT_TRN << 3) + 1 + ds 15 +ENDM + +sgb_mask_en: MACRO + db (SGB_MASK_EN << 3) + 1 + db \1 + ds 14 +ENDM + sgb_data_snd: MACRO db (SGB_DATA_SND << 3) + 1 dw \1 ; address @@ -10,6 +38,18 @@ sgb_data_snd: MACRO ENDM +; Crystal does not support SGB, so this is unused. + +PalTrnPacket: sgb_pal_trn +MltReq1Packet: sgb_mlt_req 1 +MltReq2Packet: sgb_mlt_req 2 +ChrTrnPacket: sgb_chr_trn 0, 0 +PctTrnPacket: sgb_pct_trn + +MaskEnFreezePacket: sgb_mask_en 1 +MaskEnCancelPacket: sgb_mask_en 0 + + ; These are packets containing SNES code. ; This set of packets is found in several Japanese SGB-compatible titles. ; It appears to be part of NCL's SGB devkit. diff --git a/engine/color.asm b/engine/color.asm index 827a49184..870dfd85b 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -514,10 +514,10 @@ LoadPalette_White_Col1_Col2_Black: ld a, BANK(wBGPals1) ld [rSVBK], a - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [de], a inc de - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [de], a inc de @@ -903,9 +903,9 @@ InitCGBPals:: ld [rBGPI], a ld c, 4 * 8 .bgpals_loop - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [rBGPD], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [rBGPD], a dec c jr nz, .bgpals_loop @@ -913,9 +913,9 @@ InitCGBPals:: ld [rOBPI], a ld c, 4 * 8 .obpals_loop - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [rOBPD], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [rOBPD], a dec c jr nz, .obpals_loop @@ -934,9 +934,9 @@ InitCGBPals:: .LoadWhitePals: ld c, 4 * 16 .loop - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [hli], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [hli], a dec c jr nz, .loop @@ -1189,7 +1189,7 @@ SGBDelayCycles: INCLUDE "gfx/sgb/blk_packets.asm" INCLUDE "gfx/sgb/pal_packets.asm" -INCLUDE "gfx/sgb/data_snd_packets.asm" +INCLUDE "data/sgb_ctrl_packets.asm" PredefPals: INCLUDE "gfx/sgb/predef.pal" diff --git a/engine/init_hof_credits.asm b/engine/init_hof_credits.asm index e72ae011c..d8eb7670a 100644 --- a/engine/init_hof_credits.asm +++ b/engine/init_hof_credits.asm @@ -46,9 +46,9 @@ InitDisplayForRedCredits: ; 4e8c2 ld hl, wBGPals1 ld c, 4 tiles .load_white_palettes - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [hli], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [hli], a dec c jr nz, .load_white_palettes diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm index a2d0201a2..bc9f35c27 100644 --- a/engine/sgb_layouts.asm +++ b/engine/sgb_layouts.asm @@ -595,7 +595,7 @@ endr ret ; 8a45 -INCLUDE "gfx/sgb/roof_pal_inds.asm" +INCLUDE "data/maps/sgb_roof_pal_inds.asm" _LoadSGBLayout_ReturnFromJumpTable: ; 8a60 push de diff --git a/gfx/sgb/pal_packets.asm b/gfx/sgb/pal_packets.asm index d9a4e5225..237909159 100644 --- a/gfx/sgb/pal_packets.asm +++ b/gfx/sgb/pal_packets.asm @@ -16,34 +16,6 @@ sgb_pal23: MACRO db (SGB_PAL23 << 3) + 1 ENDM -sgb_pal_trn: MACRO - db (SGB_PAL_TRN << 3) + 1 - ds 15 -ENDM - -sgb_mlt_req: MACRO - db (SGB_MLT_REG << 3) + 1 - db \1 - 1 - ds 14 -ENDM - -sgb_chr_trn: MACRO - db (SGB_CHR_TRN << 3) + 1 - db \1 + (\2 << 1) - ds 14 -ENDM - -sgb_pct_trn: MACRO - db (SGB_PCT_TRN << 3) + 1 - ds 15 -ENDM - -sgb_mask_en: MACRO - db (SGB_MASK_EN << 3) + 1 - db \1 - ds 14 -ENDM - PalPacket_GSTitleScreen: sgb_pal_set GS_TITLE_SCREEN_0, GS_TITLE_SCREEN_1, GS_TITLE_SCREEN_2, GS_TITLE_SCREEN_3 @@ -108,6 +80,7 @@ PalPacket_TradeTube: PalPacket_GamefreakLogo: sgb_pal_set GS_INTRO_GAMEFREAK_LOGO, 00, 00, 00 + PalPacket_9ce6: sgb_pal01 RGB 31, 31, 31 @@ -123,12 +96,3 @@ rept 6 RGB 00, 00, 00 endr ds 1 - -PalTrnPacket: sgb_pal_trn -MltReq1Packet: sgb_mlt_req 1 -MltReq2Packet: sgb_mlt_req 2 -ChrTrnPacket: sgb_chr_trn 0, 0 -PctTrnPacket: sgb_pct_trn - -MaskEnFreezePacket: sgb_mask_en 1 -MaskEnCancelPacket: sgb_mask_en 0 diff --git a/mobile/mobile_42.asm b/mobile/mobile_42.asm index e68721650..b1c305392 100644 --- a/mobile/mobile_42.asm +++ b/mobile/mobile_42.asm @@ -1484,7 +1484,7 @@ Function108b45: ; 108b45 push af ld a, $5 ld [rSVBK], a - ld de, palred 31 + palgreen 31 + palblue 31 + ld de, PALRGB_WHITE ld hl, wBGPals1 ld a, e ld [hli], a @@ -1525,7 +1525,7 @@ Function108b78: ; 108b78 ld a, c and $2 jr z, .Orange - ld de, palred 31 + palgreen 31 + palblue 31 + ld de, PALRGB_WHITE jr .load_pal .Orange: diff --git a/mobile/mobile_45.asm b/mobile/mobile_45.asm index 6a2db672e..46122d5dc 100644 --- a/mobile/mobile_45.asm +++ b/mobile/mobile_45.asm @@ -7611,9 +7611,9 @@ Function117c4a: ld c, 8 .loop push hl - ld a, LOW(palred 31 + palgreen 31 + palblue 31) + ld a, LOW(PALRGB_WHITE) ld [hli], a - ld a, HIGH(palred 31 + palgreen 31 + palblue 31) + ld a, HIGH(PALRGB_WHITE) ld [hl], a pop hl add hl, de