Only graphics data goes in gfx/

Introduce PALRGB_WHITE constant for $7fff
This commit is contained in:
Remy Oukaour 2018-01-18 11:16:24 -05:00
parent 99f26a6097
commit 226d1812b3
9 changed files with 59 additions and 53 deletions

View File

@ -4,6 +4,8 @@ LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes
NUM_PAL_COLORS EQU 4 NUM_PAL_COLORS EQU 4
PALRGB_WHITE EQUS "palred 31 + palgreen 31 + palblue 31" ; $7fff
SCREEN_WIDTH EQU 20 ; tiles SCREEN_WIDTH EQU 20 ; tiles
SCREEN_HEIGHT EQU 18 ; tiles SCREEN_HEIGHT EQU 18 ; tiles
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels

View File

@ -2,6 +2,34 @@
; names taken from pandocs ; names taken from pandocs
; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands ; 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 sgb_data_snd: MACRO
db (SGB_DATA_SND << 3) + 1 db (SGB_DATA_SND << 3) + 1
dw \1 ; address dw \1 ; address
@ -10,6 +38,18 @@ sgb_data_snd: MACRO
ENDM 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. ; These are packets containing SNES code.
; This set of packets is found in several Japanese SGB-compatible titles. ; This set of packets is found in several Japanese SGB-compatible titles.
; It appears to be part of NCL's SGB devkit. ; It appears to be part of NCL's SGB devkit.

View File

@ -514,10 +514,10 @@ LoadPalette_White_Col1_Col2_Black:
ld a, BANK(wBGPals1) ld a, BANK(wBGPals1)
ld [rSVBK], a ld [rSVBK], a
ld a, LOW(palred 31 + palgreen 31 + palblue 31) ld a, LOW(PALRGB_WHITE)
ld [de], a ld [de], a
inc de inc de
ld a, HIGH(palred 31 + palgreen 31 + palblue 31) ld a, HIGH(PALRGB_WHITE)
ld [de], a ld [de], a
inc de inc de
@ -903,9 +903,9 @@ InitCGBPals::
ld [rBGPI], a ld [rBGPI], a
ld c, 4 * 8 ld c, 4 * 8
.bgpals_loop .bgpals_loop
ld a, LOW(palred 31 + palgreen 31 + palblue 31) ld a, LOW(PALRGB_WHITE)
ld [rBGPD], a ld [rBGPD], a
ld a, HIGH(palred 31 + palgreen 31 + palblue 31) ld a, HIGH(PALRGB_WHITE)
ld [rBGPD], a ld [rBGPD], a
dec c dec c
jr nz, .bgpals_loop jr nz, .bgpals_loop
@ -913,9 +913,9 @@ InitCGBPals::
ld [rOBPI], a ld [rOBPI], a
ld c, 4 * 8 ld c, 4 * 8
.obpals_loop .obpals_loop
ld a, LOW(palred 31 + palgreen 31 + palblue 31) ld a, LOW(PALRGB_WHITE)
ld [rOBPD], a ld [rOBPD], a
ld a, HIGH(palred 31 + palgreen 31 + palblue 31) ld a, HIGH(PALRGB_WHITE)
ld [rOBPD], a ld [rOBPD], a
dec c dec c
jr nz, .obpals_loop jr nz, .obpals_loop
@ -934,9 +934,9 @@ InitCGBPals::
.LoadWhitePals: .LoadWhitePals:
ld c, 4 * 16 ld c, 4 * 16
.loop .loop
ld a, LOW(palred 31 + palgreen 31 + palblue 31) ld a, LOW(PALRGB_WHITE)
ld [hli], a ld [hli], a
ld a, HIGH(palred 31 + palgreen 31 + palblue 31) ld a, HIGH(PALRGB_WHITE)
ld [hli], a ld [hli], a
dec c dec c
jr nz, .loop jr nz, .loop
@ -1189,7 +1189,7 @@ SGBDelayCycles:
INCLUDE "gfx/sgb/blk_packets.asm" INCLUDE "gfx/sgb/blk_packets.asm"
INCLUDE "gfx/sgb/pal_packets.asm" INCLUDE "gfx/sgb/pal_packets.asm"
INCLUDE "gfx/sgb/data_snd_packets.asm" INCLUDE "data/sgb_ctrl_packets.asm"
PredefPals: PredefPals:
INCLUDE "gfx/sgb/predef.pal" INCLUDE "gfx/sgb/predef.pal"

View File

@ -46,9 +46,9 @@ InitDisplayForRedCredits: ; 4e8c2
ld hl, wBGPals1 ld hl, wBGPals1
ld c, 4 tiles ld c, 4 tiles
.load_white_palettes .load_white_palettes
ld a, LOW(palred 31 + palgreen 31 + palblue 31) ld a, LOW(PALRGB_WHITE)
ld [hli], a ld [hli], a
ld a, HIGH(palred 31 + palgreen 31 + palblue 31) ld a, HIGH(PALRGB_WHITE)
ld [hli], a ld [hli], a
dec c dec c
jr nz, .load_white_palettes jr nz, .load_white_palettes

View File

@ -595,7 +595,7 @@ endr
ret ret
; 8a45 ; 8a45
INCLUDE "gfx/sgb/roof_pal_inds.asm" INCLUDE "data/maps/sgb_roof_pal_inds.asm"
_LoadSGBLayout_ReturnFromJumpTable: ; 8a60 _LoadSGBLayout_ReturnFromJumpTable: ; 8a60
push de push de

View File

@ -16,34 +16,6 @@ sgb_pal23: MACRO
db (SGB_PAL23 << 3) + 1 db (SGB_PAL23 << 3) + 1
ENDM 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: PalPacket_GSTitleScreen:
sgb_pal_set GS_TITLE_SCREEN_0, GS_TITLE_SCREEN_1, GS_TITLE_SCREEN_2, GS_TITLE_SCREEN_3 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: PalPacket_GamefreakLogo:
sgb_pal_set GS_INTRO_GAMEFREAK_LOGO, 00, 00, 00 sgb_pal_set GS_INTRO_GAMEFREAK_LOGO, 00, 00, 00
PalPacket_9ce6: PalPacket_9ce6:
sgb_pal01 sgb_pal01
RGB 31, 31, 31 RGB 31, 31, 31
@ -123,12 +96,3 @@ rept 6
RGB 00, 00, 00 RGB 00, 00, 00
endr endr
ds 1 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

View File

@ -1484,7 +1484,7 @@ Function108b45: ; 108b45
push af push af
ld a, $5 ld a, $5
ld [rSVBK], a ld [rSVBK], a
ld de, palred 31 + palgreen 31 + palblue 31 ld de, PALRGB_WHITE
ld hl, wBGPals1 ld hl, wBGPals1
ld a, e ld a, e
ld [hli], a ld [hli], a
@ -1525,7 +1525,7 @@ Function108b78: ; 108b78
ld a, c ld a, c
and $2 and $2
jr z, .Orange jr z, .Orange
ld de, palred 31 + palgreen 31 + palblue 31 ld de, PALRGB_WHITE
jr .load_pal jr .load_pal
.Orange: .Orange:

View File

@ -7611,9 +7611,9 @@ Function117c4a:
ld c, 8 ld c, 8
.loop .loop
push hl push hl
ld a, LOW(palred 31 + palgreen 31 + palblue 31) ld a, LOW(PALRGB_WHITE)
ld [hli], a ld [hli], a
ld a, HIGH(palred 31 + palgreen 31 + palblue 31) ld a, HIGH(PALRGB_WHITE)
ld [hl], a ld [hl], a
pop hl pop hl
add hl, de add hl, de