Use features of RGBDS 1.0.0 (#69)

This commit is contained in:
Rangi 2025-11-14 00:17:30 -05:00 committed by GitHub
parent 0efdfcf9df
commit 4da89de0c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 164 additions and 136 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "pokemon-reverse-engineering-tools"]
path = pokemon-reverse-engineering-tools
url = https://github.com/kanzure/pokemon-reverse-engineering-tools.git

View File

@ -14,6 +14,17 @@ else
SHA1 := sha1sum
endif
RGBDS ?=
RGBASM ?= $(RGBDS)rgbasm
RGBLINK ?= $(RGBDS)rgblink
RGBFIX ?= $(RGBDS)rgbfix
RGBGFX ?= $(RGBDS)rgbgfx
RGBASMFLAGS ?= -Weverything -Wtruncation=1
RGBLINKFLAGS ?= -Weverything -Wtruncation=1
RGBFIXFLAGS ?= -Weverything
RGBGFXFLAGS ?= -Weverything
all: $(ROM) compare
ifeq (,$(filter tools clean tidy,$(MAKECMDGOALS)))
@ -22,11 +33,13 @@ endif
%.o: dep = $(shell tools/scan_includes $(@D)/$*.asm)
%.o: %.asm $$(dep)
rgbasm -Wunmapped-char=0 -o $@ $<
$(RGBASM) $(RGBASMFLAGS) -o $@ $<
$(ROM): RGBLINKFLAGS += -l contents/contents.link -n $(ROM:.gbc=.sym) -m $(ROM:.gbc=.map)
$(ROM): RGBFIXFLAGS += -jsvc -k 01 -l 0x33 -m 0x1e -p 0 -r 02 -t "POKEPINBALL" -i VPHE
$(ROM): $(OBJS) contents/contents.link
rgblink -n $(ROM:.gbc=.sym) -m $(ROM:.gbc=.map) -l contents/contents.link -o $@ $(OBJS)
rgbfix -jsvc -k 01 -l 0x33 -m 0x1e -p 0 -r 02 -t "POKEPINBALL" -i VPHE $@
$(RGBLINK) $(RGBLINKFLAGS) -o $@ $(OBJS)
$(RGBFIX) $(RGBFIXFLAGS) $@
# For contributors to make sure a change didn't affect the contents of the rom.
compare: $(ROM)
@ -43,14 +56,14 @@ clean: tidy
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pcm' \) -exec rm {} +
%.interleave.2bpp: %.interleave.png
rgbgfx -o $@ $<
$(RGBGFX) -c dmg $(RGBGFXFLAGS) -o $@ $<
tools/gfx --interleave --png $< -o $@ $@
%.2bpp: %.png
rgbgfx -o $@ $<
$(RGBGFX) -c dmg $(RGBGFXFLAGS) -o $@ $<
%.1bpp: %.png
rgbgfx -d1 -o $@ $<
$(RGBGFX) -c dmg $(RGBGFXFLAGS) -d1 -o $@ $<
%.pcm: %.wav
tools/pcm -o $@ $<

View File

@ -1,4 +1,27 @@
charmap "@", $00
charmap " ", $20
charmap "!", $21
charmap "♂", $24
charmap "*", $2A
charmap ",", $2C
charmap "-", $2D
charmap ".", $2E
charmap ":", $3A
charmap "é", $40
charmap "♀", $5C
charmap "`", $60
DEF chars EQUS "0123456789"
FOR x, STRLEN(#chars)
charmap STRSLICE(#chars, x, x + 1), $30 + x
ENDR
REDEF chars EQUS "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
FOR x, STRLEN(#chars)
charmap STRSLICE(#chars, x, x + 1), $41 + x
ENDR
REDEF chars EQUS "abcdefghijklmnopqrstuvwxyz"
FOR x, STRLEN(#chars)
charmap STRSLICE(#chars, x, x + 1), $61 + x
ENDR

View File

@ -987,15 +987,15 @@ ShowCapturedPokemonText: ; 0x106b6
ld bc, Data_2a91
ld a, [hl]
; check if mon's name starts with a vowel, so it can print "an", instead of "a"
cp "A"
cp 'A'
jr z, .asm_106f1
cp "I"
cp 'I'
jr z, .asm_106f1
cp "U"
cp 'U'
jr z, .asm_106f1
cp "E"
cp 'E'
jr z, .asm_106f1
cp "O"
cp 'O'
jr z, .asm_106f1
ld de, YouGotAText ; "You got a"
ld bc, Data_2a79

View File

@ -316,23 +316,23 @@ PlaceTextAlphanumericOnly: ; 0xf7b1 seems to filter out punctuation and other mi
ld a, [hli]
and a
ret z ;if end of text, ret
cp "0"
cp '0'
jr c, .NotADigit ;if a digit, add $56 and skip letter check
cp "9" + 1
cp '9' + 1
jr nc, .NotADigit
add $56
jr .IsValidChar
.NotADigit
cp "A"
cp 'A'
jr c, .NotALetter ;if a letter, add $56 and skip letter check
cp "Z" + 1
cp 'Z' + 1
jr nc, .NotALetter
add $bf
jr .IsValidChar
.NotALetter
cp "e" ;check if acute e
cp 'e' ;check if acute e
jr nz, .NotAcuteE
ld a, $83
jr .IsValidChar
@ -348,9 +348,9 @@ PlaceTextAlphanumericOnly: ; 0xf7b1 seems to filter out punctuation and other mi
ld a, [hli]
and a
ret z
cp "0"
cp '0'
jr c, .asm_f7ef
cp "9" + 1
cp '9' + 1
jr nc, .asm_f7ef
add $56
jr .asm_f809

View File

@ -534,15 +534,15 @@ ShowMonEvolvedText: ; 0x10e0a
ld bc, Data_2b34
ld a, [hl]
; check if mon's name starts with a vowel, so it can print "an", instead of "a"
cp "A"
cp 'A'
jr z, .nameStartsWithVowel
cp "I"
cp 'I'
jr z, .nameStartsWithVowel
cp "U"
cp 'U'
jr z, .nameStartsWithVowel
cp "E"
cp 'E'
jr z, .nameStartsWithVowel
cp "O"
cp 'O'
jr z, .nameStartsWithVowel
ld de, ItEvolvedIntoAText ; "It evolved into a"
ld bc, Data_2b1c

View File

@ -2266,32 +2266,32 @@ PokedexDescriptionVWFCharacterMapping: ; 0x2957c
ret
.checkNumericCharacter
cp "0"
cp '0'
jr c, .checkUpperCaseCharacter
cp "9" + 1
cp '9' + 1
jr c, .asm_295be
.checkUpperCaseCharacter
cp "A"
cp 'A'
jr c, .checkLowerCaseCharacter
cp "Z" + 1
cp 'Z' + 1
jr c, .asm_295c2
.checkLowerCaseCharacter
cp "a"
cp 'a'
jr c, .checkSpecialCharacter
cp "z" + 1
cp 'z' + 1
jr c, .asm_295c6
.checkSpecialCharacter
cp " "
cp ' '
jr z, .asm_295ca
cp ","
cp ','
jr z, .asm_295cd
cp "."
cp '.'
jr z, .asm_295d1
cp "`"
cp '`'
jr z, .asm_295d5
cp "-"
cp '-'
jr z, .asm_295d9
cp "é"
cp 'é'
jr z, .asm_295dd
and a
ret

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 106 B

View File

@ -65,36 +65,36 @@ PlaceText: ; 0x312b loads e chars of text text into de
and a
ret z ;if a = 0, jump
ld c, $81
cp " "
cp ' '
jr z, .space
cp ","
cp ','
jr z, .comma
cp "♂"
cp '♂'
jr z, .male
cp "♀"
cp '♀'
jr z, .female
cp "`"
cp '`'
jr z, .apostrophe
cp "!"
cp '!'
jr z, .exclamation
cp "x"
cp 'x'
jr z, .little_x
cp "e"
cp 'e'
jr z, .e_acute
cp "*"
cp '*'
jr z, .asterisk
cp "."
cp '.'
jr z, .period
cp ":"
cp ':'
jr z, .colon
cp "0"
cp '0'
jr c, .check_AtoZ
cp "9" + 1
cp '9' + 1
jr c, .digit
.check_AtoZ
cp "A"
cp 'A'
jr c, .invalid
cp "Z" + 1
cp 'Z' + 1
jr c, .alphabet
.invalid
jr .next_char
@ -276,13 +276,13 @@ UnusedPlaceString: ; 0x3268 seems to place text based on different, confusing lo
and a
ret z
ld c, $81 ;special space?
cp " "
cp ' '
jr z, .Space ;space
cp ","
cp ','
jr z, .Comma ;comma
cp "0"
cp '0'
jr c, .Punctuation ;less than 0 is punctuation
cp "9" + 1
cp '9' + 1
jr c, .Digits ;less than colon is numbers, more than is a mix of punctuation and AtoZ
.Punctuation
cp $a0
@ -411,10 +411,10 @@ Func_32cc: ; 0x32cc
call Func_3309
dec b
jr nz, .asm_32ec
ld a, "0"
ld a, '0'
ld [de], a
inc de
ld a, " "
ld a, ' '
ld [de], a
inc de
xor a
@ -551,10 +551,10 @@ LoadScoreTextFromStack: ; 0x3372 load stationary text header DE into HL, then lo
call LoadBCDDigitAsText
dec b
jr nz, .Loop ;loop 4 times
ld a, "0"
ld a, '0'
ld [de], a
inc de
ld a, " " ;end with a 0 and a space
ld a, ' ' ;end with a 0 and a space
ld [de], a
inc de
xor a
@ -570,7 +570,7 @@ LoadBCDDigitAsText: ; 0x33a7 Enter BCD digit a into text DE. b is a loop counter
and a
ret nz
.EnterDigit
add "0" ;load digit into de
add '0' ;load digit into de
ld [de], a
inc de
ld c, $0 ;mark that a digit has been entered
@ -580,7 +580,7 @@ LoadBCDDigitAsText: ; 0x33a7 Enter BCD digit a into text DE. b is a loop counter
cp $3
ret nz ;if b is 3 or 6, load a seperator comma into the text
.EnterComma
ld a, ","
ld a, ','
ld [de], a
inc de
ret

View File

@ -1,5 +1,5 @@
; Constant enumeration is useful for mons, maps, etc.
MACRO const_def
MACRO? const_def
if _NARG >= 1
DEF const_value = \1
else
@ -12,7 +12,7 @@ MACRO const_def
endc
ENDM
MACRO const
MACRO? const
DEF \1 EQU const_value
DEF const_value = const_value + const_inc
ENDM
@ -29,50 +29,49 @@ DEF dex_text EQUS "db " ; Start beginning of pokedex description
DEF dex_line EQUS "db $0d," ; Start new line in pokedex description
DEF dex_end EQUS "db $00" ; Terminate the pokedex description
MACRO dbw
MACRO? dbw
db \1
dw \2
ENDM
MACRO dwb
MACRO? dwb
dw \1
db \2
ENDM
MACRO dba
MACRO? dba
dbw BANK(\1), \1
ENDM
MACRO dab
MACRO? dab
dwb \1, BANK(\1)
ENDM
MACRO lb
ld \1, (\2 << 8) | \3
MACRO? lb
ld \1, ((\2) << 8) | (\3)
ENDM
MACRO padded_dab
MACRO? padded_dab
dab \1
db $00
ENDM
MACRO dn
rept _NARG / 2
MACRO? dn
rept? _NARG / 2
db (\1) << 4 + (\2)
shift
shift
shift 2
endr
ENDM
MACRO dx
MACRO? dx
DEF x = 8 * ((\1) - 1)
rept \1
rept? \1
db ((\2) >> x) & $ff
DEF x = x + -8
DEF x -= 8
endr
ENDM
MACRO bigdw ; big-endian word
MACRO? bigdw ; big-endian word
dx 2, \1
ENDM
@ -89,22 +88,21 @@ MACRO callba
ENDC
ENDM
MACRO bigBCD6
MACRO? bigBCD6
; There is probably a better name for this macro.
; It write a BCD in big-endian form.
dn ((\1) / 10) % 10, (\1) % 10
dn ((\1) / 1000) % 10, ((\1) / 100) % 10
dn ((\1) / 100000) % 10, ((\1) / 10000) % 10
dn ((\1) / 10000000) % 10, ((\1) / 1000000) % 10
dn ((\1) / 1000000000) % 10, ((\1) / 100000000) % 10
dn ((\1) / 100000000000) % 10, ((\1) / 10000000000) % 10
FOR x, 6
; 10**10 and 10**11 would overflow a 32-bit integer,
; so split the division into two steps
dn ((\1) / 10**(x + 1) / 10**x) % 10, ((\1) / 10**x / 10**x) % 10
ENDR
ENDM
;\1 = X
;\2 = Y
;\3 = Reference Background Map (e.g. vBGMap or vBGWin)
MACRO coord
ld \1, \4 + $20 * \3 + \2
MACRO? coord
ld \1, (\4) + $20 * (\3) + (\2)
ENDM
DEF hlCoord EQUS "coord hl,"
@ -116,67 +114,67 @@ DEF tile EQUS "+ $10 *"
;\1 = 5-bit Blue value
;\2 = 5-bit Green value
;\3 = 5-bit Red value
MACRO RGB
dw (\3 << 10 | \2 << 5 | \1)
MACRO? RGB
dw (\3) << 10 | (\2) << 5 | (\1)
ENDM
;\1 = pointer to 2bpp tile data
;\2 = destination for tile data in VRAM
;\3 = size of 2bpp tile data to copy
MACRO VIDEO_DATA_TILES
MACRO? VIDEO_DATA_TILES
dw \1
db Bank(\1)
db BANK(\1)
dw \2
dw (\3 << 2)
dw (\3) << 2
ENDM
;\1 = pointer to 2bpp tile data
;\2 = bank of data
;\3 = destination for tile data in VRAM
;\4 = size of 2bpp tile data to copy
MACRO VIDEO_DATA_TILES_BANK
MACRO? VIDEO_DATA_TILES_BANK
dw \1
db \2
dw \3
dw (\4 << 2)
dw (\4) << 2
ENDM
;\1 = pointer to 2bpp tile data
;\2 = destination for tile data in VRAM
;\3 = size of 2bpp tile data to copy
MACRO VIDEO_DATA_TILES_BANK2
MACRO? VIDEO_DATA_TILES_BANK2
dw \1
db Bank(\1)
db BANK(\1)
dw \2
dw (\3 << 2) | $2
dw ((\3) << 2) | $2
ENDM
;\1 = pointer to tilemap data
;\2 = destination for tilemap data in VRAM
;\3 = size of tilemap to copy
MACRO VIDEO_DATA_TILEMAP
MACRO? VIDEO_DATA_TILEMAP
VIDEO_DATA_TILES \1, \2, \3
ENDM
;\1 = pointer to tilemap data
;\2 = destination for tilemap data in VRAM
;\3 = size of tilemap to copy
MACRO VIDEO_DATA_TILEMAP_BANK2
MACRO? VIDEO_DATA_TILEMAP_BANK2
VIDEO_DATA_TILES_BANK2 \1, \2, \3
ENDM
;\1 = pointer to background attribute data
;\2 = destination for background attribute data in VRAM
;\3 = size of background attribute data to copy
MACRO VIDEO_DATA_BGATTR
MACRO? VIDEO_DATA_BGATTR
VIDEO_DATA_TILES_BANK2 \1, \2, \3
ENDM
;\1 = pointer to palette data
;\2 = size of palette data
MACRO VIDEO_DATA_PALETTES
MACRO? VIDEO_DATA_PALETTES
dw \1
db Bank(\1)
db BANK(\1)
dw $0000
dw (\2 << 1) | $1
dw ((\2) << 1) | $1
ENDM

View File

@ -1,71 +1,71 @@
MACRO dex_number
db ((\1 / 100) % 10) + "0"
db ((\1 / 10) % 10) + "0"
db ((\1 / 1) % 10) + "0"
db (((\1) / 100) % 10) + '0'
db (((\1) / 10) % 10) + '0'
db ((\1) % 10) + '0'
db "@"
ENDM
; \1 = feet
; \2 = inches
MACRO dex_height
DEF feet_tens_digit = (\1 / 10) % 10
DEF feet_tens_digit = ((\1) / 10) % 10
IF feet_tens_digit == 0
db " "
ELSE
db feet_tens_digit + "0"
db feet_tens_digit + '0'
ENDC
DEF feet_ones_digit = \1 % 10
db feet_ones_digit + "0"
DEF inches_tens_digit = (\2 / 10) % 10
DEF feet_ones_digit = (\1) % 10
db feet_ones_digit + '0'
DEF inches_tens_digit = ((\2) / 10) % 10
IF inches_tens_digit > 0
db $70
ELSE
db $72
ENDC
DEF inches_ones_digit = \2 % 10
db inches_ones_digit + "0"
DEF inches_ones_digit = (\2) % 10
db inches_ones_digit + '0'
db "@"
ENDM
MACRO dex_weight
IF \1 >= 1000
db ((\1 / 1000) % 10) + "0"
db ((\1 / 1000) % 10) + '0'
ELSE
db " "
ENDC
IF \1 >= 100
db ((\1 / 100) % 10) + "0"
db ((\1 / 100) % 10) + '0'
ELSE
db " "
ENDC
IF \1 >= 10
db ((\1 / 10) % 10) + "0"
db ((\1 / 10) % 10) + '0'
ELSE
db " "
ENDC
db (\1 % 10) + "0"
db ((\1) % 10) + '0'
db $00, $83
ENDM
MACRO dex_weight_decimal
DEF x = \1 * 10
DEF x = (\1) * 10
IF x >= 100
db ((x / 100) % 10) + "0"
db ((x / 100) % 10) + '0'
ELSE
db " "
ENDC
IF x >= 10
db ((x / 100) % 10) + "0"
db ((x / 100) % 10) + '0'
ELSE
db " "
ENDC
db (x % 10) + "0"
db (\2 % 10) + "0"
db (x % 10) + '0'
db ((\2) % 10) + '0'
db $00, $FC
ENDM
@ -73,21 +73,19 @@ ENDM
MACRO dex_species
; Add right padding to format to 11 characters, define 2 bytes
; for each character (using dex_species_char below)
DEF I = 0
REPT STRLEN(\1)
DEF I = I + 1
dex_species_char STRSUB(\1\, I\, 1)
FOR I, STRLEN(\1)
dex_species_char CHARVAL(STRSLICE(\1, I, I + 1))
ENDR
REPT 11 - STRLEN(\1)
dex_species_char " "
dex_species_char ' '
ENDR
db "@"
ENDM
MACRO dex_species_char
IF \1 == " "
IF (\1) == ' '
db $81, $40
ELSE
db $82, \1 + $1F
db $82, (\1) + $1F
ENDC
ENDM

@ -1 +0,0 @@
Subproject commit 979c98a7c0f67ad6b9685b2d532c66a1f76ffb22