Merge pull request #228 from yenatch/nuke-globals

Nuke globals.asm
This commit is contained in:
Bryan Bishop 2014-02-04 07:25:51 -08:00
commit 1202e68d2f
81 changed files with 2473 additions and 2474 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
# generated
globals.asm
*.tx
*.o

View File

@ -27,13 +27,9 @@ OBJS := $(CRYSTAL_OBJS)
ROMS := pokecrystal.gbc
ALL_DEPENDENCIES :=
# generate a list of dependencies for each object file
$(shell $(foreach obj, $(OBJS), \
$(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) $(POKEMONTOOLS)/scan_includes.py $(obj:.o=.asm) | sed s/globals.asm//g)) \
))
$(shell $(foreach obj, $(OBJS), \
$(eval ALL_DEPENDENCIES += $($(obj:.o=)_DEPENDENCIES)) \
$(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) $(POKEMONTOOLS)/scan_includes.py $(obj:.o=.asm))) \
))
@ -44,7 +40,6 @@ crystal: pokecrystal.gbc
clean:
rm -f $(ROMS)
rm -f $(OBJS)
rm -f globals.asm
find -iname '*.tx' -exec rm {} +
baserom.gbc: ;
@ -53,20 +48,16 @@ baserom.gbc: ;
%.asm: ;
.asm.tx:
$(eval TEXTQUEUE := $(TEXTQUEUE) $<)
$(eval TEXTQUEUE += $<)
@rm -f $@
globals.asm: $(ALL_DEPENDENCIES:.asm=.tx) $(OBJS:.o=.tx)
@touch $@
@$(PYTHON) prequeue.py $(TEXTQUEUE)
globals.tx: globals.asm
@cp $< $@
$(OBJS): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_DEPENDENCIES))
@$(PYTHON) prequeue.py $(TEXTQUEUE)
$(eval TEXTQUEUE :=)
rgbasm -o $@ $*.tx
pokecrystal.gbc: globals.tx $(CRYSTAL_OBJS)
rgblink -n $*.sym -m $*.map -o $@ $(CRYSTAL_OBJS)
pokecrystal.gbc: $(CRYSTAL_OBJS)
rgblink -n $*.sym -m $*.map -o $@ $^
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
cmp baserom.gbc $@

View File

@ -166,7 +166,7 @@ INCBIN "baserom.gbc",$17982d, $1799ef - $17982d
SECTION "Cries", ROMX, BANK[CRIES]
CryHeaders: INCLUDE "audio/cry_headers.asm"
CryHeaders:: INCLUDE "audio/cry_headers.asm"
INCBIN "baserom.gbc",$f2d69, $f3fb6 - $f2d69

View File

@ -7,7 +7,7 @@
; PlayStereoSFX
; PlayCry
_SoundRestart: ; e8000
_SoundRestart:: ; e8000
; restart sound operation
; clear all relevant hardware registers & wram
push hl
@ -84,7 +84,7 @@ MusicOff: ; e8057
ret
; e805c
_UpdateSound: ; e805c
_UpdateSound:: ; e805c
; called once per frame
; no use updating audio if it's not playing
ld a, [MusicPlaying]
@ -2322,7 +2322,7 @@ SetLRTracks: ; e8b1b
ret
; e8b30
_PlayMusic: ; e8b30
_PlayMusic:: ; e8b30
; load music
call MusicOff
ld hl, MusicID
@ -2365,7 +2365,7 @@ _PlayMusic: ; e8b30
ret
; e8b79
PlayCry: ; e8b79
PlayCry:: ; e8b79
; Play cry de using parameters:
; CryPitch
; CryEcho
@ -2479,7 +2479,7 @@ PlayCry: ; e8b79
ret
; e8c04
_PlaySFX: ; e8c04
_PlaySFX:: ; e8c04
; clear channels if they aren't already
call MusicOff
ld hl, $c1cc ; Channel5Flags
@ -2580,7 +2580,7 @@ _PlaySFX: ; e8c04
; e8ca6
PlayStereoSFX: ; e8ca6
PlayStereoSFX:: ; e8ca6
; play sfx de
call MusicOff
@ -2759,7 +2759,7 @@ ChannelInit: ; e8d5b
ret
; e8d76
LoadMusicByte: ; e8d76
LoadMusicByte:: ; e8d76
; input:
; de = current music address
; output:
@ -3156,7 +3156,7 @@ ChannelPointers: ; e8fd9
dw Channel8
; e8fe9
ClearChannels: ; e8fe9
ClearChannels:: ; e8fe9
; runs ClearChannel for all 4 channels
; doesn't seem to be used, but functionally identical to SoundRestart
ld hl, rNR50

View File

@ -1,6 +1,6 @@
; Currently, must be in the same bank as the sound engine.
PlayTrainerEncounterMusic: ; e900a
PlayTrainerEncounterMusic:: ; e900a
; input: e = trainer type
; turn fade off
xor a

View File

@ -335,7 +335,7 @@ Functioncc293: ; cc293
; no known jump sources
BattleAnimCommands: ; cc2a4 (33:42a4)
BattleAnimCommands:: ; cc2a4 (33:42a4)
dw BattleAnimCmd_D0
dw BattleAnimCmd_D1
dw BattleAnimCmd_D2

View File

@ -1,4 +1,4 @@
BattleAnimations: ; c906f
BattleAnimations:: ; c906f
dw BattleAnim_0
dw BattleAnim_Pound
dw BattleAnim_KarateChop

View File

@ -4761,7 +4761,7 @@ Function3df2c: ; 3df2c
Function3df48: ; 3df48
Function3df48:: ; 3df48
push hl
push de
push bc
@ -4907,7 +4907,7 @@ PrintPlayerHUD: ; 3dfbf
jp PrintLevel
; 3e036
Function3e036: ; 3e036
Function3e036:: ; 3e036
push hl
push de
push bc
@ -7191,7 +7191,7 @@ EmptyBattleTextBox: ; 3edd1
; 3edd8
_BattleRandom: ; 3edd8
_BattleRandom:: ; 3edd8
; If the normal RNG is used in a link battle it'll desync.
; To circumvent this a shared PRNG is used instead.

View File

@ -1,9 +1,4 @@
; macros require rst vectors to be defined
FarCall EQU $08
Bankswitch EQU $10
JumpTable EQU $28
INCLUDE "macros.asm"
INCLUDE "gbhw.asm"
@ -26,169 +21,6 @@ INCLUDE "constants/music_constants.asm"
INCLUDE "constants/sfx_constants.asm"
INCLUDE "constants/animation_constants.asm"
INCLUDE "constants/gfx_constants.asm"
NONE EQU 0
; egg group constants
MONSTER EQU $01
AMPHIBIAN EQU $02
INSECT EQU $03
AVIAN EQU $04
FIELD EQU $05
FAIRY EQU $06
PLANT EQU $07
HUMANSHAPE EQU $08
INVERTEBRATE EQU $09
INANIMATE EQU $0A
AMORPHOUS EQU $0B
FISH EQU $0C
LADIES_MAN EQU $0D
REPTILE EQU $0E
NO_EGGS EQU $0F
; menu sprites
ICON_POLIWAG EQU $01
ICON_JIGGLYPUFF EQU $02
ICON_DIGLETT EQU $03
ICON_PIKACHU EQU $04
ICON_STARYU EQU $05
ICON_FISH EQU $06
ICON_BIRD EQU $07
ICON_MONSTER EQU $08
ICON_CLEFAIRY EQU $09
ICON_ODDISH EQU $0a
ICON_BUG EQU $0b
ICON_GHOST EQU $0c
ICON_LAPRAS EQU $0d
ICON_HUMANSHAPE EQU $0e
ICON_FOX EQU $0f
ICON_EQUINE EQU $10
ICON_SHELL EQU $11
ICON_BLOB EQU $12
ICON_SERPENT EQU $13
ICON_VOLTORB EQU $14
ICON_SQUIRTLE EQU $15
ICON_BULBASAUR EQU $16
ICON_CHARMANDER EQU $17
ICON_CATERPILLAR EQU $18
ICON_UNOWN EQU $19
ICON_GEODUDE EQU $1a
ICON_FIGHTER EQU $1b
ICON_EGG EQU $1c
ICON_JELLYFISH EQU $1d
ICON_MOTH EQU $1e
ICON_BAT EQU $1f
ICON_SNORLAX EQU $20
ICON_HO_OH EQU $21
ICON_LUGIA EQU $22
ICON_GYARADOS EQU $23
ICON_SLOWPOKE EQU $24
ICON_SUDOWOODO EQU $25
ICON_BIGMON EQU $26
; evolution types
EVOLVE_LEVEL EQU 1
EVOLVE_ITEM EQU 2
EVOLVE_TRADE EQU 3
EVOLVE_HAPPINESS EQU 4
EVOLVE_STAT EQU 5
BASE_HAPPINESS EQU 70
; happiness evolution triggers
HAPPINESS_TO_EVOLVE EQU 220
TR_ANYTIME EQU 1
TR_MORNDAY EQU 2
TR_NITE EQU 3
; stat evolution triggers
ATK_GT_DEF EQU 1
ATK_LT_DEF EQU 2
ATK_EQ_DEF EQU 3
; name length
PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11
; predefs
PREDEF_FLAG EQU $03
PREDEF_FILLPP EQU $05
PREDEF_ADDPARTYMON EQU $06
PREDEF_FILLSTATS EQU $0C
PREDEF_PRINT_MOVE_DESCRIPTION EQU $11
PREDEF_UPDATE_PLAYER_HUD EQU $12
PREDEF_FILL_BOX EQU $13
PREDEF_UPDATE_ENEMY_HUD EQU $15
PREDEF_START_BATTLE EQU $16
PREDEF_FILL_IN_EXP_BAR EQU $17
PREDEF_FILLMOVES EQU $1B
PREDEF_GET_GENDER EQU $24
PREDEF_STATS_SCREEN EQU $25
PREDEF_DRAW_PLAYER_HP EQU $26
PREDEF_DRAW_ENEMY_HP EQU $27
PREDEF_GET_TYPE_NAME EQU $29
PREDEF_PRINT_MOVE_TYPE EQU $2A
PREDEF_PRINT_TYPE EQU $2B
PREDEF_GET_UNOWN_LETTER EQU $2D
PREDEF_LOAD_SGB_LAYOUT EQU $31
PREDEF_CHECK_CONTEST_MON EQU $33
PREDEF_BATTLE_TRANSITION EQU $34
PREDEF_PARTYMON_ITEM_NAME EQU $3B
PREDEF_DECOMPRESS EQU $40
; flag manipulation
RESET_FLAG EQU 0
SET_FLAG EQU 1
CHECK_FLAG EQU 2
; joypad
BUTTONS EQU %00010000
D_PAD EQU %00100000
NO_INPUT EQU %00000000
A_BUTTON EQU %00000001
B_BUTTON EQU %00000010
SELECT EQU %00000100
START EQU %00001000
D_RIGHT EQU %00010000
D_LEFT EQU %00100000
D_UP EQU %01000000
D_DOWN EQU %10000000
; screen
HP_BAR_LENGTH EQU 6
HP_BAR_LENGTH_PX EQU 48
EXP_BAR_LENGTH EQU 8
EXP_BAR_LENGTH_PX EQU 64
SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18
SCREEN_WIDTH_PX EQU 160
SCREEN_HEIGHT_PX EQU 144
BG_MAP_WIDTH EQU 32
BG_MAP_HEIGHT EQU 32
TILE_WIDTH EQU 8
; movement
STEP_SLOW EQU 0
STEP_WALK EQU 1
STEP_BIKE EQU 2
STEP_LEDGE EQU 3
STEP_ICE EQU 4
STEP_TURN EQU 5
STEP_BACK_LEDGE EQU 6
STEP_WALK_IN_PLACE EQU 7
INCLUDE "constants/pokemon_data_constants.asm"
INCLUDE "constants/misc_constants.asm"

View File

@ -0,0 +1,81 @@
; name length
PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11
; predefs
PREDEF_FLAG EQU $03
PREDEF_FILLPP EQU $05
PREDEF_ADDPARTYMON EQU $06
PREDEF_FILLSTATS EQU $0C
PREDEF_PRINT_MOVE_DESCRIPTION EQU $11
PREDEF_UPDATE_PLAYER_HUD EQU $12
PREDEF_FILL_BOX EQU $13
PREDEF_UPDATE_ENEMY_HUD EQU $15
PREDEF_START_BATTLE EQU $16
PREDEF_FILL_IN_EXP_BAR EQU $17
PREDEF_FILLMOVES EQU $1B
PREDEF_GET_GENDER EQU $24
PREDEF_STATS_SCREEN EQU $25
PREDEF_DRAW_PLAYER_HP EQU $26
PREDEF_DRAW_ENEMY_HP EQU $27
PREDEF_GET_TYPE_NAME EQU $29
PREDEF_PRINT_MOVE_TYPE EQU $2A
PREDEF_PRINT_TYPE EQU $2B
PREDEF_GET_UNOWN_LETTER EQU $2D
PREDEF_LOAD_SGB_LAYOUT EQU $31
PREDEF_CHECK_CONTEST_MON EQU $33
PREDEF_BATTLE_TRANSITION EQU $34
PREDEF_PARTYMON_ITEM_NAME EQU $3B
PREDEF_DECOMPRESS EQU $40
; flag manipulation
RESET_FLAG EQU 0
SET_FLAG EQU 1
CHECK_FLAG EQU 2
; joypad
BUTTONS EQU %00010000
D_PAD EQU %00100000
NO_INPUT EQU %00000000
A_BUTTON EQU %00000001
B_BUTTON EQU %00000010
SELECT EQU %00000100
START EQU %00001000
D_RIGHT EQU %00010000
D_LEFT EQU %00100000
D_UP EQU %01000000
D_DOWN EQU %10000000
; screen
HP_BAR_LENGTH EQU 6
HP_BAR_LENGTH_PX EQU 48
EXP_BAR_LENGTH EQU 8
EXP_BAR_LENGTH_PX EQU 64
SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18
SCREEN_WIDTH_PX EQU 160
SCREEN_HEIGHT_PX EQU 144
BG_MAP_WIDTH EQU 32
BG_MAP_HEIGHT EQU 32
TILE_WIDTH EQU 8
; movement
STEP_SLOW EQU 0
STEP_WALK EQU 1
STEP_BIKE EQU 2
STEP_LEDGE EQU 3
STEP_ICE EQU 4
STEP_TURN EQU 5
STEP_BACK_LEDGE EQU 6
STEP_WALK_IN_PLACE EQU 7

View File

@ -0,0 +1,83 @@
; egg group constants
MONSTER EQU $01
AMPHIBIAN EQU $02
INSECT EQU $03
AVIAN EQU $04
FIELD EQU $05
FAIRY EQU $06
PLANT EQU $07
HUMANSHAPE EQU $08
INVERTEBRATE EQU $09
INANIMATE EQU $0A
AMORPHOUS EQU $0B
FISH EQU $0C
LADIES_MAN EQU $0D
REPTILE EQU $0E
NO_EGGS EQU $0F
; menu sprites
ICON_POLIWAG EQU $01
ICON_JIGGLYPUFF EQU $02
ICON_DIGLETT EQU $03
ICON_PIKACHU EQU $04
ICON_STARYU EQU $05
ICON_FISH EQU $06
ICON_BIRD EQU $07
ICON_MONSTER EQU $08
ICON_CLEFAIRY EQU $09
ICON_ODDISH EQU $0a
ICON_BUG EQU $0b
ICON_GHOST EQU $0c
ICON_LAPRAS EQU $0d
ICON_HUMANSHAPE EQU $0e
ICON_FOX EQU $0f
ICON_EQUINE EQU $10
ICON_SHELL EQU $11
ICON_BLOB EQU $12
ICON_SERPENT EQU $13
ICON_VOLTORB EQU $14
ICON_SQUIRTLE EQU $15
ICON_BULBASAUR EQU $16
ICON_CHARMANDER EQU $17
ICON_CATERPILLAR EQU $18
ICON_UNOWN EQU $19
ICON_GEODUDE EQU $1a
ICON_FIGHTER EQU $1b
ICON_EGG EQU $1c
ICON_JELLYFISH EQU $1d
ICON_MOTH EQU $1e
ICON_BAT EQU $1f
ICON_SNORLAX EQU $20
ICON_HO_OH EQU $21
ICON_LUGIA EQU $22
ICON_GYARADOS EQU $23
ICON_SLOWPOKE EQU $24
ICON_SUDOWOODO EQU $25
ICON_BIGMON EQU $26
; evolution types
EVOLVE_LEVEL EQU 1
EVOLVE_ITEM EQU 2
EVOLVE_TRADE EQU 3
EVOLVE_HAPPINESS EQU 4
EVOLVE_STAT EQU 5
BASE_HAPPINESS EQU 70
; happiness evolution triggers
HAPPINESS_TO_EVOLVE EQU 220
TR_ANYTIME EQU 1
TR_MORNDAY EQU 2
TR_NITE EQU 3
; stat evolution triggers
ATK_GT_DEF EQU 1
ATK_LT_DEF EQU 2
ATK_EQ_DEF EQU 3

View File

@ -865,7 +865,7 @@ Function9853: ; 9853
; 9890
Function9890: ; 9890
Function9890:: ; 9890
call CheckCGB
ret z
ld a, $1

View File

@ -114,7 +114,7 @@ const_value SET -7
const CREDITS_END
Function109847: ; 109847
Function109847:: ; 109847
bit 6, b
ld a, $0
jr z, .asm_10984f

View File

@ -3,7 +3,7 @@ INCLUDE "includes.asm"
SECTION "Events", ROMX, BANK[EVENTS]
OverworldLoop: ; 966b0
OverworldLoop:: ; 966b0
xor a
ld [MapStatus], a
.loop
@ -30,7 +30,7 @@ Function966cb: ; 966cb
ret
; 966d0
Function966d0: ; 966d0
Function966d0:: ; 966d0
ld a, $ff
ld [ScriptFlags3], a
ret
@ -419,7 +419,7 @@ CheckTileEvent: ; 96874
; 968c7
Function968c7: ; 968c7
Function968c7:: ; 968c7
ld hl, $d452
ld a, [hl]
and a

View File

@ -5,14 +5,14 @@ INCLUDE "includes.asm"
SECTION "Events 2", ROMX, BANK[EVENTS]
Function97c28: ; 97c28
Function97c28:: ; 97c28
ld hl, StatusFlags2
res 1, [hl]
res 2, [hl]
ret
; 97c30
Function97c30: ; 97c30
Function97c30:: ; 97c30
ld a, [$d45c]
and a
ret z
@ -32,7 +32,7 @@ Function97c30: ; 97c30
ret
; 97c4f
Function97c4f: ; 97c4f
Function97c4f:: ; 97c4f
ld hl, $d45c
ld a, [hl]
and a
@ -48,7 +48,7 @@ Function97c4f: ; 97c4f
ret
; 97c5f
Function97c5f: ; 97c5f
Function97c5f:: ; 97c5f
call GetFacingTileCoord
ld [EngineBuffer1], a
ld c, a
@ -99,7 +99,7 @@ Function97c5f: ; 97c5f
; 97cc0
Function97cc0: ; 97cc0
Function97cc0:: ; 97cc0
; Rock Smash encounter
call Function968c7
@ -146,7 +146,7 @@ RockSmashBattleScript: ; 97cf9
end
; 97cfd
Function97cfd: ; 97cfd
Function97cfd:: ; 97cfd
ld hl, StatusFlags
bit 5, [hl]
jr nz, .asm_97d21
@ -178,7 +178,7 @@ Function97d23: ; 97d23
ret
; 97d31
Function97d31: ; 97d31
Function97d31:: ; 97d31
; Pick a random mon out of ContestMons.
.asm_97d31
@ -266,7 +266,7 @@ ContestMons: ; 97d87
db -1, VENOMOTH, 30, 40
; 97db3
Function97db3: ; 97db3
Function97db3:: ; 97db3
nop
nop
; fallthrough
@ -319,7 +319,7 @@ Function97db5: ; 97db5
ret
; 97df9
Function97df9: ; 97df9
Function97df9:: ; 97df9
ld hl, $d6de
ld de, $0006
ld c, $4
@ -332,7 +332,7 @@ Function97df9: ; 97df9
ret
; 97e08
Function97e08: ; 97e08
Function97e08:: ; 97e08
ld hl, $d6de
xor a
.asm_97e0c
@ -365,7 +365,7 @@ Function97e25: ; 97e25
ret
; 97e31
Function97e31: ; 97e31
Function97e31:: ; 97e31
push bc
push de
call Function97e45
@ -403,7 +403,7 @@ Function97e45: ; 97e45
ret
; 97e5c
Function97e5c: ; 97e5c
Function97e5c:: ; 97e5c
ld hl, $d6de
ld de, $0006
ld c, $4

View File

@ -1,4 +1,4 @@
FruitTreeScript: ; 44000
FruitTreeScript:: ; 44000
3callasm GetCurTreeFruit
loadfont
copybytetovar CurFruit

View File

@ -15,7 +15,7 @@ GetLandmarkCoords: ; 0x1ca896
; 0x1ca8a5
GetLandmarkName: ; 0x1ca8a5
GetLandmarkName:: ; 0x1ca8a5
; Copy the name of landmark e to StringBuffer1.
push hl
push de

View File

@ -1,7 +1,7 @@
; Event scripting commands.
Function96c56: ; 96c56
Function96c56:: ; 96c56
push af
ld a, 1
ld [ScriptMode], a
@ -10,7 +10,7 @@ Function96c56: ; 96c56
; 96c5e
ScriptEvents: ; 96c5e
ScriptEvents:: ; 96c5e
call StartScript
.loop
ld a, [ScriptMode]
@ -1658,7 +1658,7 @@ ScriptCall: ; 0x974cb
ret
; 0x974f3
Unknown_0x974f3: ; 0x974f3
Unknown_0x974f3:: ; 0x974f3
ld a, [ScriptBank]
or $80
ld [ScriptBank], a
@ -2952,7 +2952,7 @@ Script_changeblock: ; 0x97acc
ret
; 0x97ae3
Script_reloadmappart: ; 0x97ae3
Script_reloadmappart:: ; 0x97ae3
; script command 0x7c
xor a

View File

@ -1,4 +1,4 @@
StdScripts: ; bc000
StdScripts:: ; bc000
dbw BANK(PokeCenterNurseScript), PokeCenterNurseScript
dbw BANK(UnknownScript_0xbc162), UnknownScript_0xbc162
dbw BANK(UnknownScript_0xbc166), UnknownScript_0xbc166

346
home.asm

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More