From 8396935a07863484d1ce8a620511fbe645980fde Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 11 Jul 2014 11:02:04 -0700 Subject: Comment the makefile. --- Makefile | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index ec1ca455..7b297059 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,22 @@ +# If your default python is 3, you may want to change this to python27. PYTHON := python + +# md5sum -c is used to compare rom hashes. The options may vary across platforms. MD5 := md5sum -c --quiet +# Clear the default suffixes. .SUFFIXES: .SUFFIXES: .asm .tx .o .gbc + .PHONY: all clean red blue yellow compare -.PRECIOUS: %.2bpp + +# Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: +# Suppress annoying intermediate file deletion messages. +.PRECIOUS: %.2bpp + +# Filepath shortcuts to avoid overly long recipes. poketools := extras/pokemontools gfx := $(PYTHON) $(poketools)/gfx.py pic := $(PYTHON) $(poketools)/pic.py @@ -16,6 +26,8 @@ pre := $(PYTHON) prequeue.py versions := red blue yellow +# Collect file dependencies for objects in red/, blue/ and yellow/. +# These aren't provided by rgbds by default, so we have to look for file includes ourselves. $(foreach ver, $(versions), \ $(eval $(ver)_asm := $(shell find $(ver) -iname '*.asm')) \ $(eval $(ver)_obj := $($(ver)_asm:.asm=.o)) \ @@ -26,6 +38,7 @@ $(foreach obj, $(all_obj), \ ) +# Build Red/Blue. Yellow is WIP. roms := pokered.gbc pokeblue.gbc all: $(roms) @@ -40,22 +53,34 @@ clean: find . \( -iname '*.tx' -o -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} + +# Image files are added to a queue to reduce build time. They're converted when building parent objects. +%.2bpp: %.png ; $(eval 2bppq += $<) @rm -f $@ +%.1bpp: %.png ; $(eval 1bppq += $<) @rm -f $@ +%.pic: %.2bpp ; $(eval picq += $<) @rm -f $@ + +# Source files are not fed directly into rgbasm. +# A python preprocessor runs over them first, replacing ascii strings with correct character codes. +# It spits out the new file with extension .tx. +# The text preprocessor also uses a queue. %.asm: ; -%.tx: %.asm - $(eval txq += $<) - @rm -f $@ +%.tx: %.asm ; $(eval txq += $<) @rm -f $@ $(all_obj): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_dep)) + @# The queue payloads are here. + @# These are made silent since there may be hundreds of targets. @$(pre) $(txq); $(eval txq :=) @$(gfx) 2bpp $(2bppq); $(eval 2bppq :=) @$(gfx) 1bpp $(1bppq); $(eval 1bppq :=) @$(pic) compress $(picq); $(eval picq :=) + @# rgbasm -h for manual halt-nops. rgbasm -h -o $@ $*.tx +# Link objects together to build a rom. +# Make a symfile for debugging. rgblink will segfault if a mapfile isn't made too. link = rgblink -n $*.sym -m $*.map -dmg_opt := -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -cgb_opt := -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03 +dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 +cgb_opt = -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03 pokered.gbc: $(red_obj) $(link) -o $@ $^ @@ -68,14 +93,3 @@ pokeblue.gbc: $(blue_obj) pokeyellow.gbc: $(yellow_obj) $(link) -o $@ $^ rgbfix $(cgb_opt) -t "POKEMON YELLOW" $@ - - -%.2bpp: %.png - $(eval 2bppq += $<) - @rm -f $@ -%.1bpp: %.png - $(eval 1bppq += $<) - @rm -f $@ -%.pic: %.2bpp - $(eval picq += $<) - @rm -f $@ -- cgit v1.2.3 From 8f7135aa693f8606aa90aa1d4f099ee965c5fe84 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 11 Jul 2014 11:50:02 -0700 Subject: Reorganize makefile targets for clarity. --- Makefile | 62 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 7b297059..12e23297 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,39 @@ +# Build Red/Blue. Yellow is WIP. +roms := pokered.gbc pokeblue.gbc + + +.PHONY: all clean red blue yellow compare + +all: $(roms) +red: pokered.gbc +blue: pokeblue.gbc +yellow: pokeyellow.gbc + +versions := red blue yellow + + +# Header options for rgbfix. +dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 +cgb_opt = -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03 + +red_opt = $(dmg_opt) -t "POKEMON RED" +blue_opt = $(dmg_opt) -t "POKEMON BLUE" +yellow_opt = $(cgb_opt) -t "POKEMON YELLOW" + + + # If your default python is 3, you may want to change this to python27. PYTHON := python # md5sum -c is used to compare rom hashes. The options may vary across platforms. -MD5 := md5sum -c --quiet +MD5 := md5sum -c --quiet +compare: + @$(MD5) roms.md5 # Clear the default suffixes. .SUFFIXES: .SUFFIXES: .asm .tx .o .gbc -.PHONY: all clean red blue yellow compare - # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: @@ -24,7 +48,6 @@ includes := $(PYTHON) $(poketools)/scan_includes.py pre := $(PYTHON) prequeue.py -versions := red blue yellow # Collect file dependencies for objects in red/, blue/ and yellow/. # These aren't provided by rgbds by default, so we have to look for file includes ourselves. @@ -38,21 +61,6 @@ $(foreach obj, $(all_obj), \ ) -# Build Red/Blue. Yellow is WIP. -roms := pokered.gbc pokeblue.gbc - -all: $(roms) -red: pokered.gbc -blue: pokeblue.gbc -yellow: pokeyellow.gbc - -compare: - @$(MD5) roms.md5 -clean: - rm -f $(roms) $(all_obj) - find . \( -iname '*.tx' -o -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} + - - # Image files are added to a queue to reduce build time. They're converted when building parent objects. %.2bpp: %.png ; $(eval 2bppq += $<) @rm -f $@ %.1bpp: %.png ; $(eval 1bppq += $<) @rm -f $@ @@ -77,19 +85,23 @@ $(all_obj): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_dep)) # Link objects together to build a rom. + # Make a symfile for debugging. rgblink will segfault if a mapfile isn't made too. -link = rgblink -n $*.sym -m $*.map -dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -cgb_opt = -cjsv -k 01 -l 0x33 -m 0x1b -p 0 -r 03 +link = rgblink -n $*.sym -m $*.map pokered.gbc: $(red_obj) $(link) -o $@ $^ - rgbfix $(dmg_opt) -t "POKEMON RED" $@ + rgbfix $(red_opt) $@ pokeblue.gbc: $(blue_obj) $(link) -o $@ $^ - rgbfix $(dmg_opt) -t "POKEMON BLUE" $@ + rgbfix $(blue_opt) $@ pokeyellow.gbc: $(yellow_obj) $(link) -o $@ $^ - rgbfix $(cgb_opt) -t "POKEMON YELLOW" $@ + rgbfix $(yellow_opt) $@ + + +clean: + rm -f $(roms) $(all_obj) + find . \( -iname '*.tx' -o -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} + -- cgit v1.2.3 From 9ab6327361190b04b27a2ada2a83210e1cb963b5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 11 Jul 2014 12:01:05 -0700 Subject: Remove inline comments in an object recipe. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 12e23297..0d8db6bd 100644 --- a/Makefile +++ b/Makefile @@ -73,14 +73,14 @@ $(foreach obj, $(all_obj), \ %.asm: ; %.tx: %.asm ; $(eval txq += $<) @rm -f $@ +# Assemble source files into objects. +# Queue payloads are here. These are made silent since there may be hundreds of targets. +# Use rgbasm -h to use halts without nops. $(all_obj): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_dep)) - @# The queue payloads are here. - @# These are made silent since there may be hundreds of targets. @$(pre) $(txq); $(eval txq :=) @$(gfx) 2bpp $(2bppq); $(eval 2bppq :=) @$(gfx) 1bpp $(1bppq); $(eval 1bppq :=) @$(pic) compress $(picq); $(eval picq :=) - @# rgbasm -h for manual halt-nops. rgbasm -h -o $@ $*.tx -- cgit v1.2.3 From dbef0efa6c44245907bea443fdee58c937ee54c7 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 11 Jul 2014 12:14:39 -0700 Subject: Add image suffixes to the makefile. Explicitly define png dependencies (none). This keeps make from looking for nonexistent dependencies with extensions like ".png.o". This doesn't make it go any faster, but it at least makes debug easier. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0d8db6bd..b61c0502 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ compare: # Clear the default suffixes. .SUFFIXES: -.SUFFIXES: .asm .tx .o .gbc +.SUFFIXES: .asm .tx .o .gbc .png .2bpp .1bpp .pic # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: @@ -62,6 +62,7 @@ $(foreach obj, $(all_obj), \ # Image files are added to a queue to reduce build time. They're converted when building parent objects. +%.png: ; %.2bpp: %.png ; $(eval 2bppq += $<) @rm -f $@ %.1bpp: %.png ; $(eval 1bppq += $<) @rm -f $@ %.pic: %.2bpp ; $(eval picq += $<) @rm -f $@ -- cgit v1.2.3 From 4ad367ba98b15a8b03d25963cd7b9a8125d2285f Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 13 Jul 2014 20:42:46 -0700 Subject: Combine poke%.gbc build targets into a generalized one. Now only one target is needed for all versions. $$* also works instead of %, but in a pattern rule % is probably clearer. --- Makefile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b61c0502..37a9ea76 100644 --- a/Makefile +++ b/Makefile @@ -90,17 +90,9 @@ $(all_obj): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_dep)) # Make a symfile for debugging. rgblink will segfault if a mapfile isn't made too. link = rgblink -n $*.sym -m $*.map -pokered.gbc: $(red_obj) +poke%.gbc: $$(%_obj) $(link) -o $@ $^ - rgbfix $(red_opt) $@ - -pokeblue.gbc: $(blue_obj) - $(link) -o $@ $^ - rgbfix $(blue_opt) $@ - -pokeyellow.gbc: $(yellow_obj) - $(link) -o $@ $^ - rgbfix $(yellow_opt) $@ + rgbfix $($*_opt) $@ clean: -- cgit v1.2.3 From 8dd46620bc7e17c4c582a391fb95c9e29ef58576 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 16 Jul 2014 15:28:46 -0700 Subject: Add a comment to the "compare" target. --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 37a9ea76..e3616361 100644 --- a/Makefile +++ b/Makefile @@ -27,9 +27,15 @@ PYTHON := python # md5sum -c is used to compare rom hashes. The options may vary across platforms. MD5 := md5sum -c --quiet + + +# The compare target is a shortcut to check that the build matches the original roms exactly. +# This is for contributors to make sure a change didn't affect the contents of the rom. +# More thorough comparison can be made by diffing the output of hexdump -C against both roms. compare: @$(MD5) roms.md5 + # Clear the default suffixes. .SUFFIXES: .SUFFIXES: .asm .tx .o .gbc .png .2bpp .1bpp .pic -- cgit v1.2.3 From 1cf79b6f15761ec95ba1b0f9d6d83781c4240612 Mon Sep 17 00:00:00 2001 From: yenatch Date: Thu, 7 Aug 2014 21:17:44 -0700 Subject: Fix static banks passed into GetName. This appears to be the only other use of wPredefBank. Chances are there are more uncaught banks. Known cases are marked as "hardcoded" or similar. --- engine/battle/4_2.asm | 2 +- engine/battle/core.asm | 13 ++++++++----- engine/battle/e.asm | 2 +- engine/evos_moves.asm | 2 +- home.asm | 8 ++++---- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/engine/battle/4_2.asm b/engine/battle/4_2.asm index c5c62796..b53ea6e4 100755 --- a/engine/battle/4_2.asm +++ b/engine/battle/4_2.asm @@ -391,7 +391,7 @@ GetTrainerName_: ; 13a58 (4:7a58) ld [wd0b5], a ld a, TRAINER_NAME ld [W_LISTTYPE], a - ld a, $e + ld a, BANK(TrainerNames) ld [wPredefBank], a call GetName ld hl, wcd6d diff --git a/engine/battle/core.asm b/engine/battle/core.asm index b3495a29..399a8ee7 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2184,7 +2184,9 @@ asm_3d00e: ; 3d00e (f:500e) jr Func_3d03c OldManItemList: ; 3d02d (f:502d) - db $01, POKE_BALL, 50, $ff + db 1 ; # items + db POKE_BALL, 50 + db -1 Func_3d031 ld hl, wNumBagItems ; wNumBagItems @@ -5471,7 +5473,7 @@ asm_3e70b: ; 3e70b (f:670b) res 6, [hl] ; no longer invulnerable to typcial attacks ld a, [W_ENEMYMOVENUM] ; W_ENEMYMOVENUM ld [wd0b5], a - ld a, $2c + ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME ld [W_LISTTYPE], a @@ -5950,10 +5952,11 @@ GetCurrentMove: ; 3eabe (f:6abe) call AddNTimes ld a, BANK(Moves) call FarCopyData - ld a, $2c + + ld a, BANK(MoveNames) ld [wPredefBank], a - ld a, $2 - ld [W_LISTTYPE], a ; list type 2 = move name + ld a, MOVE_NAME + ld [W_LISTTYPE], a call GetName ld de, wcd6d jp CopyStringToCF4B diff --git a/engine/battle/e.asm b/engine/battle/e.asm index 8b0476ca..a0d9d80c 100755 --- a/engine/battle/e.asm +++ b/engine/battle/e.asm @@ -587,7 +587,7 @@ Func_39b87: ; 39b87 (e:5b87) jr z, .asm_39bc1 push hl ld [wd0b5], a - ld a, $2c + ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME ld [W_LISTTYPE], a diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index fd93fa14..9869153e 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -135,7 +135,7 @@ Func_3ad71: ; 3ad71 (e:6d71) ld [wHPBarMaxHP + 1], a ld a, MONSTER_NAME ld [W_LISTTYPE], a - ld a, $e + ld a, BANK(TrainerNames) ; bank is not used for monster names ld [wPredefBank], a call GetName push hl diff --git a/home.asm b/home.asm index dc0b0889..8c8f5c35 100644 --- a/home.asm +++ b/home.asm @@ -2044,7 +2044,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) .skipGettingQuantity ld a,[wcf91] ld [wd0b5],a - ld a,$01 + ld a,BANK(ItemNames) ld [wPredefBank],a call GetName jr .storeChosenEntry @@ -3782,7 +3782,7 @@ GetName:: ; 376b (0:376b) ; returns pointer to name in de ld a,[wd0b5] ld [wd11e],a - cp a,$C4 ;it's TM/HM + cp HM_01 jp nc,GetMachineName ld a,[H_LOADEDROMBANK] push af @@ -3858,8 +3858,8 @@ GetItemPrice:: ; 37df (0:37df) ld a, [H_LOADEDROMBANK] push af ld a, [wListMenuID] ; wListMenuID - cp $1 - ld a, $1 ; hardcoded Bank + cp MOVESLISTMENU + ld a, BANK(ItemPrices) jr nz, .asm_37ed ld a, $f ; hardcoded Bank .asm_37ed -- cgit v1.2.3 From cf399a8c86a7340a8c3162400657dca1c5d3ba0a Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 12 Aug 2014 00:01:04 -0700 Subject: Split copy and serial functions out of home.asm. --- home.asm | 573 +------------------------------------------------------- home/copy.asm | 24 +++ home/copy2.asm | 228 ++++++++++++++++++++++ home/serial.asm | 304 ++++++++++++++++++++++++++++++ home/timer.asm | 3 + 5 files changed, 563 insertions(+), 569 deletions(-) create mode 100644 home/copy.asm create mode 100644 home/copy2.asm create mode 100644 home/serial.asm create mode 100644 home/timer.asm diff --git a/home.asm b/home.asm index 8c8f5c35..ad010cde 100644 --- a/home.asm +++ b/home.asm @@ -79,30 +79,7 @@ HideSprites:: jr nz, .loop ret -FarCopyData:: -; Copy bc bytes from a:hl to de. - ld [wBuffer], a - ld a, [H_LOADEDROMBANK] - push af - ld a, [wBuffer] - ld [H_LOADEDROMBANK], a - ld [MBC3RomBank], a - call CopyData - pop af - ld [H_LOADEDROMBANK], a - ld [MBC3RomBank], a - ret - -CopyData:: -; Copy bc bytes from hl to de. - ld a, [hli] - ld [de], a - inc de - dec bc - ld a, c - or b - jr nz, CopyData - ret +INCLUDE "home/copy.asm" SECTION "Entry", ROM0[$100] @@ -908,556 +885,14 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea) INCLUDE "data/collision.asm" - - -FarCopyData2:: -; Identical to FarCopyData, but uses $ff8b -; as temp space instead of wBuffer. - ld [$ff8b],a - ld a,[H_LOADEDROMBANK] - push af - ld a,[$ff8b] - ld [H_LOADEDROMBANK],a - ld [MBC3RomBank],a - call CopyData - pop af - ld [H_LOADEDROMBANK],a - ld [MBC3RomBank],a - ret - -FarCopyData3:: -; Copy bc bytes from a:de to hl. - ld [$ff8b],a - ld a,[H_LOADEDROMBANK] - push af - ld a,[$ff8b] - ld [H_LOADEDROMBANK],a - ld [MBC3RomBank],a - push hl - push de - push de - ld d,h - ld e,l - pop hl - call CopyData - pop de - pop hl - pop af - ld [H_LOADEDROMBANK],a - ld [MBC3RomBank],a - ret - -FarCopyDataDouble:: -; Expand bc bytes of 1bpp image data -; from a:hl to 2bpp data at de. - ld [$ff8b],a - ld a,[H_LOADEDROMBANK] - push af - ld a,[$ff8b] - ld [H_LOADEDROMBANK],a - ld [MBC3RomBank],a -.loop - ld a,[hli] - ld [de],a - inc de - ld [de],a - inc de - dec bc - ld a,c - or b - jr nz,.loop - pop af - ld [H_LOADEDROMBANK],a - ld [MBC3RomBank],a - ret - -CopyVideoData:: -; Wait for the next VBlank, then copy c 2bpp -; tiles from b:de to hl, 8 tiles at a time. -; This takes c/8 frames. - - ld a, [H_AUTOBGTRANSFERENABLED] - push af - xor a ; disable auto-transfer while copying - ld [H_AUTOBGTRANSFERENABLED], a - - ld a, [H_LOADEDROMBANK] - ld [$ff8b], a - - ld a, b - ld [H_LOADEDROMBANK], a - ld [MBC3RomBank], a - - ld a, e - ld [H_VBCOPYSRC], a - ld a, d - ld [H_VBCOPYSRC + 1], a - - ld a, l - ld [H_VBCOPYDEST], a - ld a, h - ld [H_VBCOPYDEST + 1], a - -.loop - ld a, c - cp 8 - jr nc, .keepgoing - -.done - ld [H_VBCOPYSIZE], a - call DelayFrame - ld a, [$ff8b] - ld [H_LOADEDROMBANK], a - ld [MBC3RomBank], a - pop af - ld [H_AUTOBGTRANSFERENABLED], a - ret - -.keepgoing - ld a, 8 - ld [H_VBCOPYSIZE], a - call DelayFrame - ld a, c - sub 8 - ld c, a - jr .loop - -CopyVideoDataDouble:: -; Wait for the next VBlank, then copy c 1bpp -; tiles from b:de to hl, 8 tiles at a time. -; This takes c/8 frames. - ld a, [H_AUTOBGTRANSFERENABLED] - push af - xor a ; disable auto-transfer while copying - ld [H_AUTOBGTRANSFERENABLED], a - ld a, [H_LOADEDROMBANK] - ld [$ff8b], a - - ld a, b - ld [H_LOADEDROMBANK], a - ld [MBC3RomBank], a - - ld a, e - ld [H_VBCOPYDOUBLESRC], a - ld a, d - ld [H_VBCOPYDOUBLESRC + 1], a - - ld a, l - ld [H_VBCOPYDOUBLEDEST], a - ld a, h - ld [H_VBCOPYDOUBLEDEST + 1], a - -.loop - ld a, c - cp 8 - jr nc, .keepgoing - -.done - ld [H_VBCOPYDOUBLESIZE], a - call DelayFrame - ld a, [$ff8b] - ld [H_LOADEDROMBANK], a - ld [MBC3RomBank], a - pop af - ld [H_AUTOBGTRANSFERENABLED], a - ret - -.keepgoing - ld a, 8 - ld [H_VBCOPYDOUBLESIZE], a - call DelayFrame - ld a, c - sub 8 - ld c, a - jr .loop - -ClearScreenArea:: -; Clear tilemap area cxb at hl. - ld a, $7f ; blank tile - ld de, 20 ; screen width -.y - push hl - push bc -.x - ld [hli], a - dec c - jr nz, .x - pop bc - pop hl - add hl, de - dec b - jr nz, .y - ret - -CopyScreenTileBufferToVRAM:: -; Copy wTileMap to the BG Map starting at b * $100. -; This is done in thirds of 6 rows, so it takes 3 frames. - - ld c, 6 - - ld hl, $600 * 0 - ld de, wTileMap + 20 * 6 * 0 - call .setup - call DelayFrame - - ld hl, $600 * 1 - ld de, wTileMap + 20 * 6 * 1 - call .setup - call DelayFrame - - ld hl, $600 * 2 - ld de, wTileMap + 20 * 6 * 2 - call .setup - jp DelayFrame - -.setup - ld a, d - ld [H_VBCOPYBGSRC+1], a - call GetRowColAddressBgMap - ld a, l - ld [H_VBCOPYBGDEST], a - ld a, h - ld [H_VBCOPYBGDEST+1], a - ld a, c - ld [H_VBCOPYBGNUMROWS], a - ld a, e - ld [H_VBCOPYBGSRC], a - ret - -ClearScreen:: -; Clear wTileMap, then wait -; for the bg map to update. - ld bc, 20 * 18 - inc b - ld hl, wTileMap - ld a, $7f -.loop - ld [hli], a - dec c - jr nz, .loop - dec b - jr nz, .loop - jp Delay3 - - +INCLUDE "home/copy2.asm" INCLUDE "home/text.asm" INCLUDE "home/vcopy.asm" INCLUDE "home/init.asm" INCLUDE "home/vblank.asm" INCLUDE "home/fade.asm" - - -Serial:: ; 2125 (0:2125) - push af - push bc - push de - push hl - ld a, [$ffaa] - inc a - jr z, .asm_2142 - ld a, [$ff01] - ld [$ffad], a - ld a, [$ffac] - ld [$ff01], a - ld a, [$ffaa] - cp $2 - jr z, .asm_2162 - ld a, $80 - ld [$ff02], a - jr .asm_2162 -.asm_2142 - ld a, [$ff01] - ld [$ffad], a - ld [$ffaa], a - cp $2 - jr z, .asm_215f - xor a - ld [$ff01], a - ld a, $3 - ld [rDIV], a ; $ff04 -.asm_2153 - ld a, [rDIV] ; $ff04 - bit 7, a - jr nz, .asm_2153 - ld a, $80 - ld [$ff02], a - jr .asm_2162 -.asm_215f - xor a - ld [$ff01], a -.asm_2162 - ld a, $1 - ld [$ffa9], a - ld a, $fe - ld [$ffac], a - pop hl - pop de - pop bc - pop af - reti - -Func_216f:: ; 216f (0:216f) - ld a, $1 - ld [$ffab], a -.asm_2173 - ld a, [hl] - ld [$ffac], a - call Func_219a - push bc - ld b, a - inc hl - ld a, $30 -.asm_217e - dec a - jr nz, .asm_217e - ld a, [$ffab] - and a - ld a, b - pop bc - jr z, .asm_2192 - dec hl - cp $fd - jr nz, .asm_2173 - xor a - ld [$ffab], a - jr .asm_2173 -.asm_2192 - ld [de], a - inc de - dec bc - ld a, b - or c - jr nz, .asm_2173 - ret - -Func_219a:: ; 219a (0:219a) - xor a - ld [$ffa9], a - ld a, [$ffaa] - cp $2 - jr nz, .asm_21a7 - ld a, $81 - ld [$ff02], a -.asm_21a7 - ld a, [$ffa9] - and a - jr nz, .asm_21f1 - ld a, [$ffaa] - cp $1 - jr nz, .asm_21cc - call Func_2237 - jr z, .asm_21cc - call Func_2231 - push hl - ld hl, wcc48 - inc [hl] - jr nz, .asm_21c3 - dec hl - inc [hl] -.asm_21c3 - pop hl - call Func_2237 - jr nz, .asm_21a7 - jp Func_223f -.asm_21cc - ld a, [rIE] ; $ffff - and $f - cp $8 - jr nz, .asm_21a7 - ld a, [W_NUMHITS] ; wd074 - dec a - ld [W_NUMHITS], a ; wd074 - jr nz, .asm_21a7 - ld a, [wd075] - dec a - ld [wd075], a - jr nz, .asm_21a7 - ld a, [$ffaa] - cp $1 - jr z, .asm_21f1 - ld a, $ff -.asm_21ee - dec a - jr nz, .asm_21ee -.asm_21f1 - xor a - ld [$ffa9], a - ld a, [rIE] ; $ffff - and $f - sub $8 - jr nz, .asm_2204 - ld [W_NUMHITS], a ; wd074 - ld a, $50 - ld [wd075], a -.asm_2204 - ld a, [$ffad] - cp $fe - ret nz - call Func_2237 - jr z, .asm_221f - push hl - ld hl, wcc48 - ld a, [hl] - dec a - ld [hld], a - inc a - jr nz, .asm_2219 - dec [hl] -.asm_2219 - pop hl - call Func_2237 - jr z, Func_223f -.asm_221f - ld a, [rIE] ; $ffff - and $f - cp $8 - ld a, $fe - ret z - ld a, [hl] - ld [$ffac], a - call DelayFrame - jp Func_219a - -Func_2231:: ; 2231 (0:2231) - ld a, $f -.asm_2233 - dec a - jr nz, .asm_2233 - ret - -Func_2237:: ; 2237 (0:2237) - push hl - ld hl, wcc47 - ld a, [hli] - or [hl] - pop hl - ret - -Func_223f:: ; 223f (0:223f) - dec a - ld [wcc47], a - ld [wcc48], a - ret - -Func_2247:: ; 2247 (0:2247) - ld hl, wcc42 - ld de, wcc3d - ld c, $2 - ld a, $1 - ld [$ffab], a -.asm_2253 - call DelayFrame - ld a, [hl] - ld [$ffac], a - call Func_219a - ld b, a - inc hl - ld a, [$ffab] - and a - ld a, $0 - ld [$ffab], a - jr nz, .asm_2253 - ld a, b - ld [de], a - inc de - dec c - jr nz, .asm_2253 - ret - -Func_226e:: ; 226e (0:226e) - call SaveScreenTilesToBuffer1 - callab PrintWaitingText - call Func_227f - jp LoadScreenTilesFromBuffer1 - -Func_227f:: ; 227f (0:227f) - ld a, $ff - ld [wcc3e], a -.asm_2284 - call Func_22c3 - call DelayFrame - call Func_2237 - jr z, .asm_22a0 - push hl - ld hl, wcc48 - dec [hl] - jr nz, .asm_229f - dec hl - dec [hl] - jr nz, .asm_229f - pop hl - xor a - jp Func_223f -.asm_229f - pop hl -.asm_22a0 - ld a, [wcc3e] - inc a - jr z, .asm_2284 - ld b, $a -.asm_22a8 - call DelayFrame - call Func_22c3 - dec b - jr nz, .asm_22a8 - ld b, $a -.asm_22b3 - call DelayFrame - call Func_22ed - dec b - jr nz, .asm_22b3 - ld a, [wcc3e] - ld [wcc3d], a - ret - -Func_22c3:: ; 22c3 (0:22c3) - call asm_22d7 - ld a, [wcc42] - add $60 - ld [$ffac], a - ld a, [$ffaa] - cp $2 - jr nz, asm_22d7 - ld a, $81 - ld [$ff02], a -asm_22d7:: ; 22d7 (0:22d7) - ld a, [$ffad] - ld [wcc3d], a - and $f0 - cp $60 - ret nz - xor a - ld [$ffad], a - ld a, [wcc3d] - and $f - ld [wcc3e], a - ret - -Func_22ed:: ; 22ed (0:22ed) - xor a - ld [$ffac], a - ld a, [$ffaa] - cp $2 - ret nz - ld a, $81 - ld [$ff02], a - ret - -Func_22fa:: ; 22fa (0:22fa) - ld a, $2 - ld [$ff01], a - xor a - ld [$ffad], a - ld a, $80 - ld [$ff02], a - ret - - -; timer interrupt is apparently not invoked anyway -Timer:: ; 2306 (0:2306) - reti - - +INCLUDE "home/serial.asm" +INCLUDE "home/timer.asm" INCLUDE "home/audio.asm" diff --git a/home/copy.asm b/home/copy.asm new file mode 100644 index 00000000..a6c298e4 --- /dev/null +++ b/home/copy.asm @@ -0,0 +1,24 @@ +FarCopyData:: +; Copy bc bytes from a:hl to de. + ld [wBuffer], a + ld a, [H_LOADEDROMBANK] + push af + ld a, [wBuffer] + ld [H_LOADEDROMBANK], a + ld [MBC3RomBank], a + call CopyData + pop af + ld [H_LOADEDROMBANK], a + ld [MBC3RomBank], a + ret + +CopyData:: +; Copy bc bytes from hl to de. + ld a, [hli] + ld [de], a + inc de + dec bc + ld a, c + or b + jr nz, CopyData + ret diff --git a/home/copy2.asm b/home/copy2.asm new file mode 100644 index 00000000..f7e0a9da --- /dev/null +++ b/home/copy2.asm @@ -0,0 +1,228 @@ +FarCopyData2:: +; Identical to FarCopyData, but uses $ff8b +; as temp space instead of wBuffer. + ld [$ff8b],a + ld a,[H_LOADEDROMBANK] + push af + ld a,[$ff8b] + ld [H_LOADEDROMBANK],a + ld [MBC3RomBank],a + call CopyData + pop af + ld [H_LOADEDROMBANK],a + ld [MBC3RomBank],a + ret + +FarCopyData3:: +; Copy bc bytes from a:de to hl. + ld [$ff8b],a + ld a,[H_LOADEDROMBANK] + push af + ld a,[$ff8b] + ld [H_LOADEDROMBANK],a + ld [MBC3RomBank],a + push hl + push de + push de + ld d,h + ld e,l + pop hl + call CopyData + pop de + pop hl + pop af + ld [H_LOADEDROMBANK],a + ld [MBC3RomBank],a + ret + +FarCopyDataDouble:: +; Expand bc bytes of 1bpp image data +; from a:hl to 2bpp data at de. + ld [$ff8b],a + ld a,[H_LOADEDROMBANK] + push af + ld a,[$ff8b] + ld [H_LOADEDROMBANK],a + ld [MBC3RomBank],a +.loop + ld a,[hli] + ld [de],a + inc de + ld [de],a + inc de + dec bc + ld a,c + or b + jr nz,.loop + pop af + ld [H_LOADEDROMBANK],a + ld [MBC3RomBank],a + ret + +CopyVideoData:: +; Wait for the next VBlank, then copy c 2bpp +; tiles from b:de to hl, 8 tiles at a time. +; This takes c/8 frames. + + ld a, [H_AUTOBGTRANSFERENABLED] + push af + xor a ; disable auto-transfer while copying + ld [H_AUTOBGTRANSFERENABLED], a + + ld a, [H_LOADEDROMBANK] + ld [$ff8b], a + + ld a, b + ld [H_LOADEDROMBANK], a + ld [MBC3RomBank], a + + ld a, e + ld [H_VBCOPYSRC], a + ld a, d + ld [H_VBCOPYSRC + 1], a + + ld a, l + ld [H_VBCOPYDEST], a + ld a, h + ld [H_VBCOPYDEST + 1], a + +.loop + ld a, c + cp 8 + jr nc, .keepgoing + +.done + ld [H_VBCOPYSIZE], a + call DelayFrame + ld a, [$ff8b] + ld [H_LOADEDROMBANK], a + ld [MBC3RomBank], a + pop af + ld [H_AUTOBGTRANSFERENABLED], a + ret + +.keepgoing + ld a, 8 + ld [H_VBCOPYSIZE], a + call DelayFrame + ld a, c + sub 8 + ld c, a + jr .loop + +CopyVideoDataDouble:: +; Wait for the next VBlank, then copy c 1bpp +; tiles from b:de to hl, 8 tiles at a time. +; This takes c/8 frames. + ld a, [H_AUTOBGTRANSFERENABLED] + push af + xor a ; disable auto-transfer while copying + ld [H_AUTOBGTRANSFERENABLED], a + ld a, [H_LOADEDROMBANK] + ld [$ff8b], a + + ld a, b + ld [H_LOADEDROMBANK], a + ld [MBC3RomBank], a + + ld a, e + ld [H_VBCOPYDOUBLESRC], a + ld a, d + ld [H_VBCOPYDOUBLESRC + 1], a + + ld a, l + ld [H_VBCOPYDOUBLEDEST], a + ld a, h + ld [H_VBCOPYDOUBLEDEST + 1], a + +.loop + ld a, c + cp 8 + jr nc, .keepgoing + +.done + ld [H_VBCOPYDOUBLESIZE], a + call DelayFrame + ld a, [$ff8b] + ld [H_LOADEDROMBANK], a + ld [MBC3RomBank], a + pop af + ld [H_AUTOBGTRANSFERENABLED], a + ret + +.keepgoing + ld a, 8 + ld [H_VBCOPYDOUBLESIZE], a + call DelayFrame + ld a, c + sub 8 + ld c, a + jr .loop + +ClearScreenArea:: +; Clear tilemap area cxb at hl. + ld a, $7f ; blank tile + ld de, 20 ; screen width +.y + push hl + push bc +.x + ld [hli], a + dec c + jr nz, .x + pop bc + pop hl + add hl, de + dec b + jr nz, .y + ret + +CopyScreenTileBufferToVRAM:: +; Copy wTileMap to the BG Map starting at b * $100. +; This is done in thirds of 6 rows, so it takes 3 frames. + + ld c, 6 + + ld hl, $600 * 0 + ld de, wTileMap + 20 * 6 * 0 + call .setup + call DelayFrame + + ld hl, $600 * 1 + ld de, wTileMap + 20 * 6 * 1 + call .setup + call DelayFrame + + ld hl, $600 * 2 + ld de, wTileMap + 20 * 6 * 2 + call .setup + jp DelayFrame + +.setup + ld a, d + ld [H_VBCOPYBGSRC+1], a + call GetRowColAddressBgMap + ld a, l + ld [H_VBCOPYBGDEST], a + ld a, h + ld [H_VBCOPYBGDEST+1], a + ld a, c + ld [H_VBCOPYBGNUMROWS], a + ld a, e + ld [H_VBCOPYBGSRC], a + ret + +ClearScreen:: +; Clear wTileMap, then wait +; for the bg map to update. + ld bc, 20 * 18 + inc b + ld hl, wTileMap + ld a, $7f +.loop + ld [hli], a + dec c + jr nz, .loop + dec b + jr nz, .loop + jp Delay3 diff --git a/home/serial.asm b/home/serial.asm new file mode 100644 index 00000000..02eb3534 --- /dev/null +++ b/home/serial.asm @@ -0,0 +1,304 @@ +Serial:: ; 2125 (0:2125) + push af + push bc + push de + push hl + ld a, [$ffaa] + inc a + jr z, .asm_2142 + ld a, [$ff01] + ld [$ffad], a + ld a, [$ffac] + ld [$ff01], a + ld a, [$ffaa] + cp $2 + jr z, .asm_2162 + ld a, $80 + ld [$ff02], a + jr .asm_2162 +.asm_2142 + ld a, [$ff01] + ld [$ffad], a + ld [$ffaa], a + cp $2 + jr z, .asm_215f + xor a + ld [$ff01], a + ld a, $3 + ld [rDIV], a ; $ff04 +.asm_2153 + ld a, [rDIV] ; $ff04 + bit 7, a + jr nz, .asm_2153 + ld a, $80 + ld [$ff02], a + jr .asm_2162 +.asm_215f + xor a + ld [$ff01], a +.asm_2162 + ld a, $1 + ld [$ffa9], a + ld a, $fe + ld [$ffac], a + pop hl + pop de + pop bc + pop af + reti + +Func_216f:: ; 216f (0:216f) + ld a, $1 + ld [$ffab], a +.asm_2173 + ld a, [hl] + ld [$ffac], a + call Func_219a + push bc + ld b, a + inc hl + ld a, $30 +.asm_217e + dec a + jr nz, .asm_217e + ld a, [$ffab] + and a + ld a, b + pop bc + jr z, .asm_2192 + dec hl + cp $fd + jr nz, .asm_2173 + xor a + ld [$ffab], a + jr .asm_2173 +.asm_2192 + ld [de], a + inc de + dec bc + ld a, b + or c + jr nz, .asm_2173 + ret + +Func_219a:: ; 219a (0:219a) + xor a + ld [$ffa9], a + ld a, [$ffaa] + cp $2 + jr nz, .asm_21a7 + ld a, $81 + ld [$ff02], a +.asm_21a7 + ld a, [$ffa9] + and a + jr nz, .asm_21f1 + ld a, [$ffaa] + cp $1 + jr nz, .asm_21cc + call Func_2237 + jr z, .asm_21cc + call Func_2231 + push hl + ld hl, wcc48 + inc [hl] + jr nz, .asm_21c3 + dec hl + inc [hl] +.asm_21c3 + pop hl + call Func_2237 + jr nz, .asm_21a7 + jp Func_223f +.asm_21cc + ld a, [rIE] ; $ffff + and $f + cp $8 + jr nz, .asm_21a7 + ld a, [W_NUMHITS] ; wd074 + dec a + ld [W_NUMHITS], a ; wd074 + jr nz, .asm_21a7 + ld a, [wd075] + dec a + ld [wd075], a + jr nz, .asm_21a7 + ld a, [$ffaa] + cp $1 + jr z, .asm_21f1 + ld a, $ff +.asm_21ee + dec a + jr nz, .asm_21ee +.asm_21f1 + xor a + ld [$ffa9], a + ld a, [rIE] ; $ffff + and $f + sub $8 + jr nz, .asm_2204 + ld [W_NUMHITS], a ; wd074 + ld a, $50 + ld [wd075], a +.asm_2204 + ld a, [$ffad] + cp $fe + ret nz + call Func_2237 + jr z, .asm_221f + push hl + ld hl, wcc48 + ld a, [hl] + dec a + ld [hld], a + inc a + jr nz, .asm_2219 + dec [hl] +.asm_2219 + pop hl + call Func_2237 + jr z, Func_223f +.asm_221f + ld a, [rIE] ; $ffff + and $f + cp $8 + ld a, $fe + ret z + ld a, [hl] + ld [$ffac], a + call DelayFrame + jp Func_219a + +Func_2231:: ; 2231 (0:2231) + ld a, $f +.asm_2233 + dec a + jr nz, .asm_2233 + ret + +Func_2237:: ; 2237 (0:2237) + push hl + ld hl, wcc47 + ld a, [hli] + or [hl] + pop hl + ret + +Func_223f:: ; 223f (0:223f) + dec a + ld [wcc47], a + ld [wcc48], a + ret + +Func_2247:: ; 2247 (0:2247) + ld hl, wcc42 + ld de, wcc3d + ld c, $2 + ld a, $1 + ld [$ffab], a +.asm_2253 + call DelayFrame + ld a, [hl] + ld [$ffac], a + call Func_219a + ld b, a + inc hl + ld a, [$ffab] + and a + ld a, $0 + ld [$ffab], a + jr nz, .asm_2253 + ld a, b + ld [de], a + inc de + dec c + jr nz, .asm_2253 + ret + +Func_226e:: ; 226e (0:226e) + call SaveScreenTilesToBuffer1 + callab PrintWaitingText + call Func_227f + jp LoadScreenTilesFromBuffer1 + +Func_227f:: ; 227f (0:227f) + ld a, $ff + ld [wcc3e], a +.asm_2284 + call Func_22c3 + call DelayFrame + call Func_2237 + jr z, .asm_22a0 + push hl + ld hl, wcc48 + dec [hl] + jr nz, .asm_229f + dec hl + dec [hl] + jr nz, .asm_229f + pop hl + xor a + jp Func_223f +.asm_229f + pop hl +.asm_22a0 + ld a, [wcc3e] + inc a + jr z, .asm_2284 + ld b, $a +.asm_22a8 + call DelayFrame + call Func_22c3 + dec b + jr nz, .asm_22a8 + ld b, $a +.asm_22b3 + call DelayFrame + call Func_22ed + dec b + jr nz, .asm_22b3 + ld a, [wcc3e] + ld [wcc3d], a + ret + +Func_22c3:: ; 22c3 (0:22c3) + call asm_22d7 + ld a, [wcc42] + add $60 + ld [$ffac], a + ld a, [$ffaa] + cp $2 + jr nz, asm_22d7 + ld a, $81 + ld [$ff02], a +asm_22d7:: ; 22d7 (0:22d7) + ld a, [$ffad] + ld [wcc3d], a + and $f0 + cp $60 + ret nz + xor a + ld [$ffad], a + ld a, [wcc3d] + and $f + ld [wcc3e], a + ret + +Func_22ed:: ; 22ed (0:22ed) + xor a + ld [$ffac], a + ld a, [$ffaa] + cp $2 + ret nz + ld a, $81 + ld [$ff02], a + ret + +Func_22fa:: ; 22fa (0:22fa) + ld a, $2 + ld [$ff01], a + xor a + ld [$ffad], a + ld a, $80 + ld [$ff02], a + ret diff --git a/home/timer.asm b/home/timer.asm new file mode 100644 index 00000000..8578df1a --- /dev/null +++ b/home/timer.asm @@ -0,0 +1,3 @@ +; timer interrupt is apparently not invoked anyway +Timer:: ; 2306 (0:2306) + reti -- cgit v1.2.3 From 365ae68d80683deab0e2e721b8ff79dda4047513 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 22 Aug 2014 23:17:47 -0700 Subject: Use PARTY_LENGTH and related constants in menu and hud code. This should allow reducing PARTY_LENGTH to work as intended. Increasing it also works provided space is provided in wram, but breaks pc/saving. --- engine/battle/e.asm | 6 ++-- engine/give_pokemon.asm | 16 +++++------ engine/items/items.asm | 6 ++-- engine/menu/bills_pc.asm | 74 +++++++++++++++++++++--------------------------- engine/save.asm | 10 +++---- main.asm | 10 +++---- scripts/daycarem.asm | 8 +++--- scripts/route5gate.asm | 8 +++--- 8 files changed, 64 insertions(+), 74 deletions(-) diff --git a/engine/battle/e.asm b/engine/battle/e.asm index a0d9d80c..9abeeec8 100755 --- a/engine/battle/e.asm +++ b/engine/battle/e.asm @@ -1407,14 +1407,14 @@ SetupEnemyPartyPokeballs: ; 3a887 (e:6887) ld [hl], $20 ld a, $f8 ld [wTrainerEngageDistance], a - ld hl, wOAMBuffer + $18 + ld hl, wOAMBuffer + PARTY_LENGTH * 4 jp Func_3a8e1 SetupPokeballs: ; 0x3a8a6 ld a, [de] push af ld de, wBuffer - ld c, $6 ; max num of partymons + ld c, PARTY_LENGTH ld a, $34 ; empty pokeball .emptyloop ld [de], a @@ -1462,7 +1462,7 @@ PickPokeball: ; 3a8c2 (e:68c2) Func_3a8e1: ; 3a8e1 (e:68e1) ld de, wHPBarMaxHP - ld c, $6 + ld c, PARTY_LENGTH .asm_3a8e6 ld a, [W_BASECOORDY] ; wd082 ld [hli], a diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index 9399fb05..f3bd7f78 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -3,10 +3,10 @@ _GivePokemon: ; 4fda5 (13:7da5) xor a ld [wccd3], a ld a, [wPartyCount] ; wPartyCount - cp $6 + cp PARTY_LENGTH jr c, .asm_4fe01 ld a, [W_NUMINBOX] ; wda80 - cp $14 + cp MONS_PER_BOX jr nc, .asm_4fdf9 xor a ld [W_ENEMYBATTSTATUS3], a ; W_ENEMYBATTSTATUS3 @@ -18,18 +18,18 @@ _GivePokemon: ; 4fda5 (13:7da5) ld hl, wcf4b ld a, [wd5a0] and $7f - cp $9 + cp 9 jr c, .asm_4fdec - sub $9 - ld [hl], $f7 + sub 9 + ld [hl], "1" inc hl - add $f6 + add "0" jr .asm_4fdee .asm_4fdec - add $f7 + add "1" .asm_4fdee ld [hli], a - ld [hl], $50 + ld [hl], "@" ld hl, SetToBoxText call PrintText scf diff --git a/engine/items/items.asm b/engine/items/items.asm index 830f0dfc..0609e685 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -110,10 +110,10 @@ ItemUseBall: ; d687 (3:5687) dec a jr z,.UseBall ld a,[wPartyCount] ;is Party full? - cp a,6 + cp a,PARTY_LENGTH jr nz,.UseBall ld a,[W_NUMINBOX] ;is Box full? - cp a,20 + cp a,MONS_PER_BOX jp z,BoxFullCannotThrowBall .UseBall ;$56a7 ;ok, you can use a ball @@ -421,7 +421,7 @@ ItemUseBall: ; d687 (3:5687) predef ShowPokedexData .checkParty ;$58f4 ld a,[wPartyCount] - cp a,6 ;is party full? + cp a,PARTY_LENGTH ;is party full? jr z,.sendToBox xor a ld [wcc49],a diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index 3edaadd8..b06927d8 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -88,25 +88,13 @@ Func_213c8:: ; 213c8 (8:53c8) ld [H_AUTOBGTRANSFERENABLED], a ; $ffba ret -SomeonesPCText: ; 2148b (8:548b) - db "SOMEONE's PC@" +SomeonesPCText: db "SOMEONE's PC@" +BillsPCText: db "BILL's PC@" +PlayersPCText: db "'s PC@" +OaksPCText: db "PROF.OAK's PC@" +PKMNLeaguePCText: db $4a, "LEAGUE@" +LogOffPCText: db "LOG OFF@" -BillsPCText: ; 21497 (8:5497) - db "BILL's PC@" - -PlayersPCText: ; 214a0 (8:54a0) - db "'s PC@" - -OaksPCText: ; 214a5 (8:54a5) - db "PROF.OAK's PC@" - -PKMNLeaguePCText: ; 214b2 (8:54b2) - db $4a,"LEAGUE@" - -LogOffPCText: ; 214ba (8:54ba) - db "LOG OFF@" - -Func_214c2:: ; 214c2 (8:54c2) BillsPC_:: ; 0x214c2 ld hl, wd730 set 6, [hl] @@ -167,15 +155,15 @@ BillsPCMenu: call TextBoxBorder ld a, [wd5a0] and $7f - cp $9 + cp 9 jr c, .asm_2154f - sub $9 + sub 9 hlCoord 17, 16 - ld [hl], $f7 - add $f6 + ld [hl], "1" + add "0" jr .asm_21551 .asm_2154f - add $f7 + add "1" .asm_21551 Coorda 18, 16 hlCoord 10, 16 @@ -227,7 +215,7 @@ BillsPCDeposit: jp BillsPCMenu .asm_215bb ld a, [W_NUMINBOX] ; wda80 - cp $14 + cp MONS_PER_BOX jr nz, .asm_215cb ld hl, BoxFullText ; $5802 call PrintText @@ -251,15 +239,15 @@ BillsPCDeposit: ld hl, wWhichTrade ; wWhichTrade ld a, [wd5a0] and $7f - cp $9 + cp 9 jr c, .asm_2160a - sub $9 - ld [hl], $f7 + sub 9 + ld [hl], "1" inc hl - add $f6 + add "0" jr .asm_2160c .asm_2160a - add $f7 + add "1" .asm_2160c ld [hli], a ld [hl], $50 @@ -276,7 +264,7 @@ Func_21618: ; 21618 (8:5618) jp Func_214e8 .asm_21627 ld a, [wPartyCount] ; wPartyCount - cp $6 + cp PARTY_LENGTH jr nz, .asm_21637 ld hl, CantTakeMonText ; $5811 call PrintText @@ -353,7 +341,12 @@ Func_216be: ; 216be (8:56be) ret BillsPCMenuText: ; 216e1 (8:56e1) - db "WITHDRAW ",$4a,$4e,"DEPOSIT ",$4a,$4e,"RELEASE ",$4a,$4e,"CHANGE BOX",$4e,"SEE YA!@" + db "WITHDRAW ", $4a + next "DEPOSIT ", $4a + next "RELEASE ", $4a + next "CHANGE BOX" + next "SEE YA!" + db "@" BoxNoPCText: ; 21713 (8:5713) db "BOX No.@" @@ -389,7 +382,7 @@ HMMoveArray: ; 21745 (8:5745) db SURF db STRENGTH db FLASH - db $ff + db -1 Func_2174b: ; 2174b (8:574b) hlCoord 9, 10 @@ -458,14 +451,11 @@ Func_2174b: ; 2174b (8:574b) call LoadGBPal jr .asm_2178f -DepositPCText: ; 217cb (8:57cb) - db "DEPOSIT@" - -WithdrawPCText: ; 217d3 (8:57d3) - db "WITHDRAW@" - -StatsCancelPCText: ; 217dc (8:57dc) - db "STATS",$4e,"CANCEL@" +DepositPCText: db "DEPOSIT@" +WithdrawPCText: db "WITHDRAW@" +StatsCancelPCText: + db "STATS" + next "CANCEL@" SwitchOnText: ; 0x217e9 TX_FAR _SwitchOnText @@ -523,7 +513,7 @@ PrintJustAMomentText1:: ; 5824 (8:5825) cp $c ret nz ld a, [W_CURMAP] - cp $ef + cp BATTLE_CENTER ld a, $2 jr z, .asm_2183a inc a @@ -541,7 +531,7 @@ PrintJustAMomentText2:: ; 5845 (8:5845) cp $8 ret nz ld a, [W_CURMAP] - cp $ef + cp BATTLE_CENTER ld a, $2 jr z, .asm_2185a inc a diff --git a/engine/save.asm b/engine/save.asm index fcfbd133..b473f1cd 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -445,15 +445,15 @@ Func_7393f: ; 7393f (1c:793f) res 2, [hl] ld a, [wd5a0] and $7f - cp $9 + cp 9 jr c, .asm_739a6 - sub $9 + sub 9 hlCoord 8, 2 - ld [hl], $f7 - add $f6 + ld [hl], "1" + add "0" jr .asm_739a8 .asm_739a6 - add $f7 + add "1" .asm_739a8 Coorda 9, 2 hlCoord 1, 2 diff --git a/main.asm b/main.asm index 32a3db2c..96a1df8e 100755 --- a/main.asm +++ b/main.asm @@ -3419,7 +3419,7 @@ _AddPartyMon: ; f2e5 (3:72e5) .asm_f2f2 ld a, [de] inc a - cp $7 + cp PARTY_LENGTH + 1 ret nc ld [de], a ld a, [de] @@ -3681,7 +3681,7 @@ AddPartyMon_WriteMovePP: ; f476 (3:7476) _AddEnemyMonToPlayerParty: ; f49d (3:749d) ld hl, wPartyCount ld a, [hl] - cp $6 + cp PARTY_LENGTH scf ret z ; party full, return failure inc a @@ -3750,13 +3750,13 @@ Func_f51e: ; f51e (3:751e) jr z, .asm_f575 ld hl, W_NUMINBOX ; wda80 ld a, [hl] - cp $14 + cp MONS_PER_BOX jr nz, .partyOrBoxNotFull jr .boxFull .checkPartyMonSlots ld hl, wPartyCount ; wPartyCount ld a, [hl] - cp $6 + cp PARTY_LENGTH jr nz, .partyOrBoxNotFull .boxFull scf @@ -3899,7 +3899,7 @@ Func_f51e: ; f51e (3:751e) ld a, d ld [W_CURENEMYLVL], a ; W_CURENEMYLVL pop hl - ld bc, $21 + ld bc, wBoxMon2 - wBoxMon1 add hl, bc ld [hli], a ld d, h diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index e463d380..373a9349 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -67,9 +67,9 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) call LoadMonData callab Func_58f43 ld a, d - cp $64 + cp MAX_LEVEL jr c, .asm_56315 - ld d, $64 + ld d, MAX_LEVEL callab CalcExperience ld hl, wDayCareMonExp ld a, [H_NUMTOPRINT] @@ -78,7 +78,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) ld [hli], a ld a, [$ff98] ld [hl], a - ld d, $64 + ld d, MAX_LEVEL .asm_56315 xor a @@ -100,7 +100,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1) .asm_56333 call PrintText ld a, [wPartyCount] - cp $6 + cp PARTY_LENGTH ld hl, DayCareMText_56440 jp z, .asm_56403 ld de, wTrainerFacingDirection diff --git a/scripts/route5gate.asm b/scripts/route5gate.asm index d7abeff5..0e8d0d1c 100755 --- a/scripts/route5gate.asm +++ b/scripts/route5gate.asm @@ -27,11 +27,11 @@ Route5GateScript0: ; 1df50 (7:5f50) xor a ld [hJoyHeld], a callba RemoveGuardDrink - ld a, [$ff00+$db] + ld a, [$ffdb] and a jr nz, .asm_1df82 ; 0x1df70 $10 ld a, $2 - ld [$ff00+$8c], a + ld [$ff8c], a call DisplayTextID call Route5GateScript_1df43 ld a, $1 @@ -39,7 +39,7 @@ Route5GateScript0: ; 1df50 (7:5f50) ret .asm_1df82 ld a, $3 - ld [$ff00+$8c], a + ld [$ff8c], a call DisplayTextID ld hl, wd728 set 6, [hl] @@ -74,7 +74,7 @@ Route5GateText1: ; 1dfaa (7:5faa) bit 6, a jr nz, .asm_88856 ; 0x1dfb0 $2c callba RemoveGuardDrink - ld a, [$ff00+$db] + ld a, [$ffdb] and a jr nz, .asm_768a2 ; 0x1dfbd $11 ld hl, Route5GateText2 -- cgit v1.2.3 From 8f49e37b82a90bbef8c7133c4adea8f82abf00e7 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 30 Aug 2014 19:48:49 -0700 Subject: Use hram constants for remaining joypad variables. --- engine/cable_club.asm | 4 +-- engine/evolution.asm | 2 +- engine/menu/main_menu.asm | 4 +-- engine/menu/pokedex.asm | 6 ++-- engine/slot_machine.asm | 2 +- engine/town_map.asm | 8 ++--- home.asm | 74 +++++++++++++++++++++++------------------------ hram.asm | 41 ++++++++++++++------------ 8 files changed, 72 insertions(+), 69 deletions(-) diff --git a/engine/cable_club.asm b/engine/cable_club.asm index fc049ceb..06f69a73 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -537,7 +537,7 @@ TradeCenter_SelectMon: ld [wTileMap + $141], a .asm_574a call JoypadLowSensitivity - ld a, [$ffb5] + ld a, [hJoy5] and a jr z, .asm_574a ; 0x5750 $f8 bit 0, a @@ -896,7 +896,7 @@ Func_5a5f: ; 5a5f (1:5a5f) ld [W_GRASSRATE], a ; W_GRASSRATE inc a ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE - ld [$ffb5], a + ld [hJoy5], a ld a, $a ld [wMusicHeaderPointer], a ld a, BANK(Music_Celadon) diff --git a/engine/evolution.asm b/engine/evolution.asm index 07ccdbda..a52e0071 100755 --- a/engine/evolution.asm +++ b/engine/evolution.asm @@ -140,7 +140,7 @@ asm_7befa: ; 7befa (1e:7efa) call DelayFrame push bc call JoypadLowSensitivity - ld a, [$ffb5] + ld a, [hJoy5] pop bc and $2 jr nz, .asm_7bf0d diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 4044da43..5f8f0c1d 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -307,7 +307,7 @@ Func_5d5f: ; 5d5f (1:5d5f) xor a ld [hJoyPressed], a ld [hJoyHeld], a - ld [$ffb5], a + ld [hJoy5], a ld [wd72d], a ld hl, wd732 set 0, [hl] @@ -461,7 +461,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a) call SetOptionsFromCursorPositions .getJoypadStateLoop call JoypadLowSensitivity - ld a,[$ffb5] + ld a,[hJoy5] ld b,a and a,%11111011 ; any key besides select pressed? jr z,.getJoypadStateLoop diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 63e440f8..f35b93e0 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -10,7 +10,7 @@ ShowPokedexMenu: ; 40000 (10:4000) ld [wLastMenuItem],a inc a ld [wd11e],a - ld [$ffb7],a + ld [hJoy7],a .setUpGraphics ld b,$08 call GoPAL_SET @@ -35,7 +35,7 @@ ShowPokedexMenu: ; 40000 (10:4000) ld [wcc37],a ld [wCurrentMenuItem],a ld [wLastMenuItem],a - ld [$ffb7],a + ld [hJoy7],a ld [wcd3a],a ld [wcd3b],a pop af @@ -550,7 +550,7 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2) ld [$fff4],a .waitForButtonPress call JoypadLowSensitivity - ld a,[$ffb5] + ld a,[hJoy5] and a,%00000011 ; A button and B button jr z,.waitForButtonPress pop af diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index e43cc9ab..9ded4f36 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -797,7 +797,7 @@ SlotMachine_3784e: ; 3784e (d:784e) SlotMachine_37882: ; 37882 (d:7882) call DelayFrame call JoypadLowSensitivity - ld a, [$ffb5] + ld a, [hJoy5] and $1 ret z ld hl, wTrainerSpriteOffset diff --git a/engine/town_map.asm b/engine/town_map.asm index 2cd37284..5e8b77de 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -6,7 +6,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e) ld [hl], $ff push hl ld a, $1 - ld [$ffb7], a + ld [hJoy7], a ld a, [W_CURMAP] ; W_CURMAP push af ld b, $0 @@ -66,7 +66,7 @@ Func_70e92: ; 70e92 (1c:4e92) .asm_70ec8 call Func_716c6 call JoypadLowSensitivity - ld a, [$ffb5] + ld a, [hJoy5] ld b, a and $c3 jr z, .asm_70ec8 @@ -78,7 +78,7 @@ Func_70e92: ; 70e92 (1c:4e92) jr nz, .asm_70f01 xor a ld [wd09b], a - ld [$ffb7], a + ld [hJoy7], a ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM call Func_711ab pop hl @@ -188,7 +188,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90) push hl call DelayFrame call JoypadLowSensitivity - ld a, [$ffb5] + ld a, [hJoy5] ld b, a pop hl and $c3 diff --git a/home.asm b/home.asm index ad010cde..f83662ca 100644 --- a/home.asm +++ b/home.asm @@ -102,34 +102,34 @@ Start:: INCLUDE "home/joypad.asm" - INCLUDE "data/map_header_pointers.asm" - INCLUDE "home/overworld.asm" -; this is used to check if the player wants to interrupt the opening sequence at several points -; XXX is this used anywhere else? -; INPUT: -; c = number of frames to wait -; sets carry if Up+Select+B, Start, or A is pressed within c frames -; unsets carry otherwise + CheckForUserInterruption:: ; 12f8 (0:12f8) +; Return carry if Up+Select+B, Start or A are pressed in c frames. +; Used only in the intro and title screen. call DelayFrame + push bc call JoypadLowSensitivity pop bc - ld a,[hJoyHeld] ; currently pressed buttons - cp a,%01000110 ; Up, Select button, B button - jr z,.setCarry ; if all three keys are pressed - ld a,[$ffb5] ; either newly pressed buttons or currently pressed buttons at low sampling rate - and a,%00001001 ; Start button, A button - jr nz,.setCarry ; if either key is pressed + + ld a, [hJoyHeld] + cp D_UP + SELECT + B_BUTTON + jr z, .input + + ld a, [hJoy5] + and START | A_BUTTON + jr nz, .input + dec c - jr nz,CheckForUserInterruption -.unsetCarry + jr nz, CheckForUserInterruption + and a ret -.setCarry + +.input scf ret @@ -1347,7 +1347,7 @@ DisplayListMenuID:: ; 2be6 (0:2be6) xor a ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer ld a,1 - ld [$ffb7],a ; joypad state update flag + ld [hJoy7],a ; joypad state update flag ld a,[W_BATTLETYPE] and a ; is it the Old Man battle? jr nz,.specialBattleType @@ -1501,7 +1501,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) ld a,[wCurrentMenuItem] ld [wd12d],a xor a - ld [$ffb7],a ; joypad state update flag + ld [hJoy7],a ; joypad state update flag ld hl,wd730 res 6,[hl] ; turn on letter printing delay jp BankswitchBack @@ -1662,7 +1662,7 @@ ExitListMenu:: ; 2e3b (0:2e3b) ld [wd12e],a ld [wcc37],a xor a - ld [$ffb7],a + ld [hJoy7],a ld hl,wd730 res 6,[hl] call BankswitchBack @@ -3347,29 +3347,29 @@ CopyString:: ; 3829 (0:3829) ret ; this function is used when lower button sensitivity is wanted (e.g. menus) -; OUTPUT: [$ffb5] = pressed buttons in usual format -; there are two flags that control its functionality, [$ffb6] and [$ffb7] +; OUTPUT: [hJoy5] = pressed buttons in usual format +; there are two flags that control its functionality, [hJoy6] and [hJoy7] ; there are esentially three modes of operation ; 1. Get newly pressed buttons only -; ([$ffb7] == 0, [$ffb6] == any) -; Just copies [hJoyPressed] to [$ffb5]. +; ([hJoy7] == 0, [hJoy6] == any) +; Just copies [hJoyPressed] to [hJoy5]. ; 2. Get currently pressed buttons at low sample rate with delay -; ([$ffb7] == 1, [$ffb6] != 0) +; ([hJoy7] == 1, [hJoy6] != 0) ; If the user holds down buttons for more than half a second, ; report buttons as being pressed up to 12 times per second thereafter. ; If the user holds down buttons for less than half a second, ; report only one button press. ; 3. Same as 2, but report no buttons as pressed if A or B is held down. -; ([$ffb7] == 1, [$ffb6] == 0) +; ([hJoy7] == 1, [hJoy6] == 0) JoypadLowSensitivity:: ; 3831 (0:3831) call Joypad - ld a,[$ffb7] ; flag + ld a,[hJoy7] ; flag and a ; get all currently pressed buttons or only newly pressed buttons? ld a,[hJoyPressed] ; newly pressed buttons jr z,.storeButtonState ld a,[hJoyHeld] ; all currently pressed buttons .storeButtonState - ld [$ffb5],a + ld [hJoy5],a ld a,[hJoyPressed] ; newly pressed buttons and a ; have any buttons been newly pressed since last check? jr z,.noNewlyPressedButtons @@ -3383,18 +3383,18 @@ JoypadLowSensitivity:: ; 3831 (0:3831) jr z,.delayOver .delayNotOver xor a - ld [$ffb5],a ; report no buttons as pressed + ld [hJoy5],a ; report no buttons as pressed ret .delayOver -; if [$ffb6] = 0 and A or B is pressed, report no buttons as pressed +; if [hJoy6] = 0 and A or B is pressed, report no buttons as pressed ld a,[hJoyHeld] and a,%00000011 ; A and B buttons jr z,.setShortDelay - ld a,[$ffb6] ; flag + ld a,[hJoy6] ; flag and a jr nz,.setShortDelay xor a - ld [$ffb5],a + ld [hJoy5],a .setShortDelay ld a,5 ; 1/12 of a second delay ld [H_FRAMECOUNTER],a @@ -3421,7 +3421,7 @@ WaitForTextScrollButtonPress:: ; 3865 (0:3865) pop hl call JoypadLowSensitivity predef Func_5a5f - ld a, [$ffb5] + ld a, [hJoy5] and A_BUTTON | B_BUTTON jr z, .asm_3872 pop af @@ -3888,7 +3888,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) .getJoypadState pop hl call JoypadLowSensitivity - ld a,[$ffb5] + ld a,[hJoy5] and a ; was a key pressed? jr nz,.keyPressed push hl @@ -3911,7 +3911,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) .keyPressed xor a ld [wcc4b],a - ld a,[$ffb5] + ld a,[hJoy5] ld b,a bit 6,a ; pressed Up key? jr z,.checkIfDownPressed @@ -3953,7 +3953,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) and b ; does the menu care about any of the pressed keys? jp z,.loop1 .checkIfAButtonOrBButtonPressed - ld a,[$ffb5] + ld a,[hJoy5] and a,%00000011 ; pressed A button or B button? jr z,.skipPlayingSound .AButtonOrBButtonPressed @@ -3971,7 +3971,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) ld [H_DOWNARROWBLINKCNT1],a ; restore previous values xor a ld [wMenuWrappingEnabled],a ; disable menu wrapping - ld a,[$ffb5] + ld a,[hJoy5] ret .noWrappingAround ld a,[wcc37] diff --git a/hram.asm b/hram.asm index b88c248b..4599e950 100644 --- a/hram.asm +++ b/hram.asm @@ -1,8 +1,8 @@ -H_SPRITEWIDTH EQU $FF8B ; in bytes +H_SPRITEWIDTH EQU $FF8B ; in tiles H_SPRITEINTERLACECOUNTER EQU $FF8B -H_SPRITEHEIGHT EQU $FF8C ; in bytes -H_SPRITEOFFSET EQU $FF8D +H_SPRITEHEIGHT EQU $FF8C ; in tiles +H_SPRITEOFFSET EQU $FF8D hSoftReset EQU $FF8A ; Initialized to 16. @@ -14,28 +14,31 @@ hSoftReset EQU $FF8A H_DOWNARROWBLINKCNT1 EQU $FF8B H_DOWNARROWBLINKCNT2 EQU $FF8C -; Note: the following multiplication and division addresses are used for multiple purposes -; and so they overlap with each other +; Multiplcation and division variables are meant +; to overlap for back-to-back usage. Big endian. -H_MULTIPLICAND EQU $FF96 ; 3 bytes, big endian order +H_MULTIPLICAND EQU $FF96 ; 3 bytes H_MULTIPLIER EQU $FF99 ; 1 byte -H_PRODUCT EQU $FF95 ; 4 bytes, big endian order +H_PRODUCT EQU $FF95 ; 4 bytes -H_DIVIDEND EQU $FF95 ; 4 bytes, big endian order +H_DIVIDEND EQU $FF95 ; 4 bytes H_DIVISOR EQU $FF99 ; 1 byte -H_QUOTIENT EQU $FF95 ; 4 bytes, big endian order +H_QUOTIENT EQU $FF95 ; 4 bytes H_REMAINDER EQU $FF99 ; 1 byte -; used to convert numbers to decimal -H_PASTLEADINGZEROES EQU $FF95 ; flag to indicate that a nonzero digit has been printed -H_NUMTOPRINT EQU $FF96 ; 3 bytes, big endian order -H_POWEROFTEN EQU $FF99 ; 3 bytes, big endian order -H_SAVEDNUMTOPRINT EQU $FF9C ; 3 bytes, big endian order (to back out of a subtraction) - -hJoyHeldLast EQU $FFB1 -hJoyReleased EQU $FFB2 -hJoyPressed EQU $FFB3 -hJoyHeld EQU $FFB4 +; PrintNumber (big endian). +H_PASTLEADINGZEROES EQU $FF95 ; last char printed +H_NUMTOPRINT EQU $FF96 ; 3 bytes +H_POWEROFTEN EQU $FF99 ; 3 bytes +H_SAVEDNUMTOPRINT EQU $FF9C ; 3 bytes + +hJoyHeldLast EQU $FFB1 +hJoyReleased EQU $FFB2 +hJoyPressed EQU $FFB3 +hJoyHeld EQU $FFB4 +hJoy5 EQU $FFB5 +hJoy6 EQU $FFB6 +hJoy7 EQU $FFB7 H_LOADEDROMBANK EQU $FFB8 -- cgit v1.2.3 From 342791a001cecbfd8192ced7dd2478485d98fa45 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 1 Sep 2014 17:59:10 -0700 Subject: Use a macro for move attributes. The formatting was pretty bad, so that's fixed too. --- data/moves.asm | 345 +++++++++++++++++++++++++++++---------------------------- macros.asm | 3 + 2 files changed, 180 insertions(+), 168 deletions(-) diff --git a/data/moves.asm b/data/moves.asm index 08da533d..22165b7d 100755 --- a/data/moves.asm +++ b/data/moves.asm @@ -1,168 +1,177 @@ -Moves: ; 38000 (e:4000) -; characteristics of each move -; animation, effect, power, type, accuracy, PP - db POUND ,NO_ADDITIONAL_EFFECT ,$28,NORMAL, $FF,35 - db KARATE_CHOP ,NO_ADDITIONAL_EFFECT ,$32,NORMAL, $FF,25 - db DOUBLESLAP ,TWO_TO_FIVE_ATTACKS_EFFECT,$0F,NORMAL, $D8,10 - db COMET_PUNCH ,TWO_TO_FIVE_ATTACKS_EFFECT,$12,NORMAL, $D8,15 - db MEGA_PUNCH ,NO_ADDITIONAL_EFFECT ,$50,NORMAL, $D8,20 - db PAY_DAY ,PAY_DAY_EFFECT ,$28,NORMAL, $FF,20 - db FIRE_PUNCH ,BURN_SIDE_EFFECT1 ,$4B,FIRE, $FF,15 - db ICE_PUNCH ,FREEZE_SIDE_EFFECT ,$4B,ICE, $FF,15 - db THUNDERPUNCH,PARALYZE_SIDE_EFFECT1 ,$4B,ELECTRIC,$FF,15 - db SCRATCH ,NO_ADDITIONAL_EFFECT ,$28,NORMAL, $FF,35 - db VICEGRIP ,NO_ADDITIONAL_EFFECT ,$37,NORMAL, $FF,30 - db GUILLOTINE ,OHKO_EFFECT ,$01,NORMAL, $4C,5 - db RAZOR_WIND ,CHARGE_EFFECT ,$50,NORMAL, $BF,10 - db SWORDS_DANCE,ATTACK_UP2_EFFECT ,$00,NORMAL, $FF,30 - db CUT ,NO_ADDITIONAL_EFFECT ,$32,NORMAL, $F2,30 - db GUST ,NO_ADDITIONAL_EFFECT ,$28,NORMAL, $FF,35 - db WING_ATTACK ,NO_ADDITIONAL_EFFECT ,$23,FLYING, $FF,35 - db WHIRLWIND ,SWITCH_AND_TELEPORT_EFFECT,$00,NORMAL, $D8,20 - db FLY ,FLY_EFFECT ,$46,FLYING, $F2,15 - db BIND ,TRAPPING_EFFECT ,$0F,NORMAL, $BF,20 - db SLAM ,NO_ADDITIONAL_EFFECT ,$50,NORMAL, $BF,20 - db VINE_WHIP ,NO_ADDITIONAL_EFFECT ,$23,GRASS, $FF,10 - db STOMP ,FLINCH_SIDE_EFFECT2 ,$41,NORMAL, $FF,20 - db DOUBLE_KICK ,ATTACK_TWICE_EFFECT ,$1E,FIGHTING,$FF,30 - db MEGA_KICK ,NO_ADDITIONAL_EFFECT ,$78,NORMAL, $BF,5 - db JUMP_KICK ,JUMP_KICK_EFFECT ,$46,FIGHTING,$F2,25 - db ROLLING_KICK,FLINCH_SIDE_EFFECT2 ,$3C,FIGHTING,$D8,15 - db SAND_ATTACK ,ACCURACY_DOWN1_EFFECT ,$00,NORMAL, $FF,15 - db HEADBUTT ,FLINCH_SIDE_EFFECT2 ,$46,NORMAL, $FF,15 - db HORN_ATTACK ,NO_ADDITIONAL_EFFECT ,$41,NORMAL, $FF,25 - db FURY_ATTACK ,TWO_TO_FIVE_ATTACKS_EFFECT,$0F,NORMAL, $D8,20 - db HORN_DRILL ,OHKO_EFFECT ,$01,NORMAL, $4C,5 - db TACKLE ,NO_ADDITIONAL_EFFECT ,$23,NORMAL, $F2,35 - db BODY_SLAM ,PARALYZE_SIDE_EFFECT2 ,$55,NORMAL, $FF,15 - db WRAP ,TRAPPING_EFFECT ,$0F,NORMAL, $D8,20 - db TAKE_DOWN ,RECOIL_EFFECT ,$5A,NORMAL, $D8,20 - db THRASH ,THRASH_PETAL_DANCE_EFFECT ,$5A,NORMAL, $FF,20 - db DOUBLE_EDGE ,RECOIL_EFFECT ,$64,NORMAL, $FF,15 - db TAIL_WHIP ,DEFENSE_DOWN1_EFFECT ,$00,NORMAL, $FF,30 - db POISON_STING,POISON_SIDE_EFFECT1 ,$0F,POISON, $FF,35 - db TWINEEDLE ,TWINEEDLE_EFFECT ,$19,BUG, $FF,20 - db PIN_MISSILE ,TWO_TO_FIVE_ATTACKS_EFFECT,$0E,BUG, $D8,20 - db LEER ,DEFENSE_DOWN1_EFFECT ,$00,NORMAL, $FF,30 - db BITE ,FLINCH_SIDE_EFFECT1 ,$3C,NORMAL, $FF,25 - db GROWL ,ATTACK_DOWN1_EFFECT ,$00,NORMAL, $FF,40 - db ROAR ,SWITCH_AND_TELEPORT_EFFECT,$00,NORMAL, $FF,20 - db SING ,SLEEP_EFFECT ,$00,NORMAL, $8C,15 - db SUPERSONIC ,CONFUSION_EFFECT ,$00,NORMAL, $8C,20 - db SONICBOOM ,SPECIAL_DAMAGE_EFFECT ,$01,NORMAL, $E5,20 - db DISABLE ,DISABLE_EFFECT ,$00,NORMAL, $8C,20 - db ACID ,DEFENSE_DOWN_SIDE_EFFECT ,$28,POISON, $FF,30 - db EMBER ,BURN_SIDE_EFFECT1 ,$28,FIRE, $FF,25 - db FLAMETHROWER,BURN_SIDE_EFFECT1 ,$5F,FIRE, $FF,15 - db MIST ,MIST_EFFECT ,$00,ICE, $FF,30 - db WATER_GUN ,NO_ADDITIONAL_EFFECT ,$28,WATER, $FF,25 - db HYDRO_PUMP ,NO_ADDITIONAL_EFFECT ,$78,WATER, $CC,5 - db SURF ,NO_ADDITIONAL_EFFECT ,$5F,WATER, $FF,15 - db ICE_BEAM ,FREEZE_SIDE_EFFECT ,$5F,ICE, $FF,10 - db BLIZZARD ,FREEZE_SIDE_EFFECT ,$78,ICE, $E5,5 - db PSYBEAM ,CONFUSION_SIDE_EFFECT ,$41,PSYCHIC, $FF,20 - db BUBBLEBEAM ,SPEED_DOWN_SIDE_EFFECT ,$41,WATER, $FF,20 - db AURORA_BEAM ,ATTACK_DOWN_SIDE_EFFECT ,$41,ICE, $FF,20 - db HYPER_BEAM ,HYPER_BEAM_EFFECT ,$96,NORMAL, $E5,5 - db PECK ,NO_ADDITIONAL_EFFECT ,$23,FLYING, $FF,35 - db DRILL_PECK ,NO_ADDITIONAL_EFFECT ,$50,FLYING, $FF,20 - db SUBMISSION ,RECOIL_EFFECT ,$50,FIGHTING,$CC,25 - db LOW_KICK ,FLINCH_SIDE_EFFECT2 ,$32,FIGHTING,$E5,20 - db COUNTER ,NO_ADDITIONAL_EFFECT ,$01,FIGHTING,$FF,20 - db SEISMIC_TOSS,SPECIAL_DAMAGE_EFFECT ,$01,FIGHTING,$FF,20 - db STRENGTH ,NO_ADDITIONAL_EFFECT ,$50,NORMAL, $FF,15 - db ABSORB ,DRAIN_HP_EFFECT ,$14,GRASS, $FF,20 - db MEGA_DRAIN ,DRAIN_HP_EFFECT ,$28,GRASS, $FF,10 - db LEECH_SEED ,LEECH_SEED_EFFECT ,$00,GRASS, $E5,10 - db GROWTH ,SPECIAL_UP1_EFFECT ,$00,NORMAL, $FF,40 - db RAZOR_LEAF ,NO_ADDITIONAL_EFFECT ,$37,GRASS, $F2,25 - db SOLARBEAM ,CHARGE_EFFECT ,$78,GRASS, $FF,10 - db POISONPOWDER,POISON_EFFECT ,$00,POISON, $BF,35 - db STUN_SPORE ,PARALYZE_EFFECT ,$00,GRASS, $BF,30 - db SLEEP_POWDER,SLEEP_EFFECT ,$00,GRASS, $BF,15 - db PETAL_DANCE ,THRASH_PETAL_DANCE_EFFECT ,$46,GRASS, $FF,20 - db STRING_SHOT ,SPEED_DOWN1_EFFECT ,$00,BUG, $F2,40 - db DRAGON_RAGE ,SPECIAL_DAMAGE_EFFECT ,$01,DRAGON, $FF,10 - db FIRE_SPIN ,TRAPPING_EFFECT ,$0F,FIRE, $B2,15 - db THUNDERSHOCK,PARALYZE_SIDE_EFFECT1 ,$28,ELECTRIC,$FF,30 - db THUNDERBOLT ,PARALYZE_SIDE_EFFECT1 ,$5F,ELECTRIC,$FF,15 - db THUNDER_WAVE,PARALYZE_EFFECT ,$00,ELECTRIC,$FF,20 - db THUNDER ,PARALYZE_SIDE_EFFECT1 ,$78,ELECTRIC,$B2,10 - db ROCK_THROW ,NO_ADDITIONAL_EFFECT ,$32,ROCK, $A5,15 - db EARTHQUAKE ,NO_ADDITIONAL_EFFECT ,$64,GROUND, $FF,10 - db FISSURE ,OHKO_EFFECT ,$01,GROUND, $4C,5 - db DIG ,CHARGE_EFFECT ,$64,GROUND, $FF,10 - db TOXIC ,POISON_EFFECT ,$00,POISON, $D8,10 - db CONFUSION ,CONFUSION_SIDE_EFFECT ,$32,PSYCHIC, $FF,25 - db PSYCHIC_M ,SPECIAL_DOWN_SIDE_EFFECT ,$5A,PSYCHIC, $FF,10 - db HYPNOSIS ,SLEEP_EFFECT ,$00,PSYCHIC, $99,20 - db MEDITATE ,ATTACK_UP1_EFFECT ,$00,PSYCHIC, $FF,40 - db AGILITY ,SPEED_UP2_EFFECT ,$00,PSYCHIC, $FF,30 - db QUICK_ATTACK,NO_ADDITIONAL_EFFECT ,$28,NORMAL, $FF,30 - db RAGE ,RAGE_EFFECT ,$14,NORMAL, $FF,20 - db TELEPORT ,SWITCH_AND_TELEPORT_EFFECT,$00,PSYCHIC, $FF,20 - db NIGHT_SHADE ,SPECIAL_DAMAGE_EFFECT ,$00,GHOST, $FF,15 - db MIMIC ,MIMIC_EFFECT ,$00,NORMAL, $FF,10 - db SCREECH ,DEFENSE_DOWN2_EFFECT ,$00,NORMAL, $D8,40 - db DOUBLE_TEAM ,EVASION_UP1_EFFECT ,$00,NORMAL, $FF,15 - db RECOVER ,HEAL_EFFECT ,$00,NORMAL, $FF,20 - db HARDEN ,DEFENSE_UP1_EFFECT ,$00,NORMAL, $FF,30 - db MINIMIZE ,EVASION_UP1_EFFECT ,$00,NORMAL, $FF,20 - db SMOKESCREEN ,ACCURACY_DOWN1_EFFECT ,$00,NORMAL, $FF,20 - db CONFUSE_RAY ,CONFUSION_EFFECT ,$00,GHOST, $FF,10 - db WITHDRAW ,DEFENSE_UP1_EFFECT ,$00,WATER, $FF,40 - db DEFENSE_CURL,DEFENSE_UP1_EFFECT ,$00,NORMAL, $FF,40 - db BARRIER ,DEFENSE_UP2_EFFECT ,$00,PSYCHIC, $FF,30 - db LIGHT_SCREEN,LIGHT_SCREEN_EFFECT ,$00,PSYCHIC, $FF,30 - db HAZE ,HAZE_EFFECT ,$00,ICE, $FF,30 - db REFLECT ,REFLECT_EFFECT ,$00,PSYCHIC, $FF,20 - db FOCUS_ENERGY,FOCUS_ENERGY_EFFECT ,$00,NORMAL, $FF,30 - db BIDE ,BIDE_EFFECT ,$00,NORMAL, $FF,10 - db METRONOME ,METRONOME_EFFECT ,$00,NORMAL, $FF,10 - db MIRROR_MOVE ,MIRROR_MOVE_EFFECT ,$00,FLYING, $FF,20 - db SELFDESTRUCT,EXPLODE_EFFECT ,$82,NORMAL, $FF,5 - db EGG_BOMB ,NO_ADDITIONAL_EFFECT ,$64,NORMAL, $BF,10 - db LICK ,PARALYZE_SIDE_EFFECT2 ,$14,GHOST, $FF,30 - db SMOG ,POISON_SIDE_EFFECT2 ,$14,POISON, $B2,20 - db SLUDGE ,POISON_SIDE_EFFECT2 ,$41,POISON, $FF,20 - db BONE_CLUB ,FLINCH_SIDE_EFFECT1 ,$41,GROUND, $D8,20 - db FIRE_BLAST ,BURN_SIDE_EFFECT2 ,$78,FIRE, $D8,5 - db WATERFALL ,NO_ADDITIONAL_EFFECT ,$50,WATER, $FF,15 - db CLAMP ,TRAPPING_EFFECT ,$23,WATER, $BF,10 - db SWIFT ,SWIFT_EFFECT ,$3C,NORMAL, $FF,20 - db SKULL_BASH ,CHARGE_EFFECT ,$64,NORMAL, $FF,15 - db SPIKE_CANNON,TWO_TO_FIVE_ATTACKS_EFFECT,$14,NORMAL, $FF,15 - db CONSTRICT ,SPEED_DOWN_SIDE_EFFECT ,$0A,NORMAL, $FF,35 - db AMNESIA ,SPECIAL_UP2_EFFECT ,$00,PSYCHIC, $FF,20 - db KINESIS ,ACCURACY_DOWN1_EFFECT ,$00,PSYCHIC, $CC,15 - db SOFTBOILED ,HEAL_EFFECT ,$00,NORMAL, $FF,10 - db HI_JUMP_KICK,JUMP_KICK_EFFECT ,$55,FIGHTING,$E5,20 - db GLARE ,PARALYZE_EFFECT ,$00,NORMAL, $BF,30 - db DREAM_EATER ,DREAM_EATER_EFFECT ,$64,PSYCHIC, $FF,15 - db POISON_GAS ,POISON_EFFECT ,$00,POISON, $8C,40 - db BARRAGE ,TWO_TO_FIVE_ATTACKS_EFFECT,$0F,NORMAL, $D8,20 - db LEECH_LIFE ,DRAIN_HP_EFFECT ,$14,BUG, $FF,15 - db LOVELY_KISS ,SLEEP_EFFECT ,$00,NORMAL, $BF,10 - db SKY_ATTACK ,CHARGE_EFFECT ,$8C,FLYING, $E5,5 - db TRANSFORM ,TRANSFORM_EFFECT ,$00,NORMAL, $FF,10 - db BUBBLE ,SPEED_DOWN_SIDE_EFFECT ,$14,WATER, $FF,30 - db DIZZY_PUNCH ,NO_ADDITIONAL_EFFECT ,$46,NORMAL, $FF,10 - db SPORE ,SLEEP_EFFECT ,$00,GRASS, $FF,15 - db FLASH ,ACCURACY_DOWN1_EFFECT ,$00,NORMAL, $B2,20 - db PSYWAVE ,SPECIAL_DAMAGE_EFFECT ,$01,PSYCHIC, $CC,15 - db SPLASH ,SPLASH_EFFECT ,$00,NORMAL, $FF,40 - db ACID_ARMOR ,DEFENSE_UP2_EFFECT ,$00,POISON, $FF,40 - db CRABHAMMER ,NO_ADDITIONAL_EFFECT ,$5A,WATER, $D8,10 - db EXPLOSION ,EXPLODE_EFFECT ,$AA,NORMAL, $FF,5 - db FURY_SWIPES ,TWO_TO_FIVE_ATTACKS_EFFECT,$12,NORMAL, $CC,15 - db BONEMERANG ,ATTACK_TWICE_EFFECT ,$32,GROUND, $E5,10 - db REST ,HEAL_EFFECT ,$00,PSYCHIC, $FF,10 - db ROCK_SLIDE ,NO_ADDITIONAL_EFFECT ,$4B,ROCK, $E5,10 - db HYPER_FANG ,FLINCH_SIDE_EFFECT1 ,$50,NORMAL, $E5,15 - db SHARPEN ,ATTACK_UP1_EFFECT ,$00,NORMAL, $FF,30 - db CONVERSION ,CONVERSION_EFFECT ,$00,NORMAL, $FF,30 - db TRI_ATTACK ,NO_ADDITIONAL_EFFECT ,$50,NORMAL, $FF,10 - db SUPER_FANG ,SUPER_FANG_EFFECT ,$01,NORMAL, $E5,10 - db SLASH ,NO_ADDITIONAL_EFFECT ,$46,NORMAL, $FF,20 - db SUBSTITUTE ,SUBSTITUTE_EFFECT ,$00,NORMAL, $FF,10 - db STRUGGLE ,RECOIL_EFFECT ,$32,NORMAL, $FF,10 +Moves: +; Characteristics of each move. + +move: macro + db \1 ; animation (interchangeable with move id) + db \2 ; effect + db \3 ; power + db \4 ; type + db \5 percent ; accuracy + db \6 ; pp +endm + + move POUND, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 + move KARATE_CHOP, NO_ADDITIONAL_EFFECT, 50, NORMAL, 100, 25 + move DOUBLESLAP, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 10 + move COMET_PUNCH, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 85, 15 + move MEGA_PUNCH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 85, 20 + move PAY_DAY, PAY_DAY_EFFECT, 40, NORMAL, 100, 20 + move FIRE_PUNCH, BURN_SIDE_EFFECT1, 75, FIRE, 100, 15 + move ICE_PUNCH, FREEZE_SIDE_EFFECT, 75, ICE, 100, 15 + move THUNDERPUNCH, PARALYZE_SIDE_EFFECT1, 75, ELECTRIC, 100, 15 + move SCRATCH, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 + move VICEGRIP, NO_ADDITIONAL_EFFECT, 55, NORMAL, 100, 30 + move GUILLOTINE, OHKO_EFFECT, 1, NORMAL, 30, 5 + move RAZOR_WIND, CHARGE_EFFECT, 80, NORMAL, 75, 10 + move SWORDS_DANCE, ATTACK_UP2_EFFECT, 0, NORMAL, 100, 30 + move CUT, NO_ADDITIONAL_EFFECT, 50, NORMAL, 95, 30 + move GUST, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 + move WING_ATTACK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35 + move WHIRLWIND, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 85, 20 + move FLY, FLY_EFFECT, 70, FLYING, 95, 15 + move BIND, TRAPPING_EFFECT, 15, NORMAL, 75, 20 + move SLAM, NO_ADDITIONAL_EFFECT, 80, NORMAL, 75, 20 + move VINE_WHIP, NO_ADDITIONAL_EFFECT, 35, GRASS, 100, 10 + move STOMP, FLINCH_SIDE_EFFECT2, 65, NORMAL, 100, 20 + move DOUBLE_KICK, ATTACK_TWICE_EFFECT, 30, FIGHTING, 100, 30 + move MEGA_KICK, NO_ADDITIONAL_EFFECT, 120, NORMAL, 75, 5 + move JUMP_KICK, JUMP_KICK_EFFECT, 70, FIGHTING, 95, 25 + move ROLLING_KICK, FLINCH_SIDE_EFFECT2, 60, FIGHTING, 85, 15 + move SAND_ATTACK, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 15 + move HEADBUTT, FLINCH_SIDE_EFFECT2, 70, NORMAL, 100, 15 + move HORN_ATTACK, NO_ADDITIONAL_EFFECT, 65, NORMAL, 100, 25 + move FURY_ATTACK, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20 + move HORN_DRILL, OHKO_EFFECT, 1, NORMAL, 30, 5 + move TACKLE, NO_ADDITIONAL_EFFECT, 35, NORMAL, 95, 35 + move BODY_SLAM, PARALYZE_SIDE_EFFECT2, 85, NORMAL, 100, 15 + move WRAP, TRAPPING_EFFECT, 15, NORMAL, 85, 20 + move TAKE_DOWN, RECOIL_EFFECT, 90, NORMAL, 85, 20 + move THRASH, THRASH_PETAL_DANCE_EFFECT, 90, NORMAL, 100, 20 + move DOUBLE_EDGE, RECOIL_EFFECT, 100, NORMAL, 100, 15 + move TAIL_WHIP, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30 + move POISON_STING, POISON_SIDE_EFFECT1, 15, POISON, 100, 35 + move TWINEEDLE, TWINEEDLE_EFFECT, 25, BUG, 100, 20 + move PIN_MISSILE, TWO_TO_FIVE_ATTACKS_EFFECT, 14, BUG, 85, 20 + move LEER, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30 + move BITE, FLINCH_SIDE_EFFECT1, 60, NORMAL, 100, 25 + move GROWL, ATTACK_DOWN1_EFFECT, 0, NORMAL, 100, 40 + move ROAR, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 100, 20 + move SING, SLEEP_EFFECT, 0, NORMAL, 55, 15 + move SUPERSONIC, CONFUSION_EFFECT, 0, NORMAL, 55, 20 + move SONICBOOM, SPECIAL_DAMAGE_EFFECT, 1, NORMAL, 90, 20 + move DISABLE, DISABLE_EFFECT, 0, NORMAL, 55, 20 + move ACID, DEFENSE_DOWN_SIDE_EFFECT, 40, POISON, 100, 30 + move EMBER, BURN_SIDE_EFFECT1, 40, FIRE, 100, 25 + move FLAMETHROWER, BURN_SIDE_EFFECT1, 95, FIRE, 100, 15 + move MIST, MIST_EFFECT, 0, ICE, 100, 30 + move WATER_GUN, NO_ADDITIONAL_EFFECT, 40, WATER, 100, 25 + move HYDRO_PUMP, NO_ADDITIONAL_EFFECT, 120, WATER, 80, 5 + move SURF, NO_ADDITIONAL_EFFECT, 95, WATER, 100, 15 + move ICE_BEAM, FREEZE_SIDE_EFFECT, 95, ICE, 100, 10 + move BLIZZARD, FREEZE_SIDE_EFFECT, 120, ICE, 90, 5 + move PSYBEAM, CONFUSION_SIDE_EFFECT, 65, PSYCHIC, 100, 20 + move BUBBLEBEAM, SPEED_DOWN_SIDE_EFFECT, 65, WATER, 100, 20 + move AURORA_BEAM, ATTACK_DOWN_SIDE_EFFECT, 65, ICE, 100, 20 + move HYPER_BEAM, HYPER_BEAM_EFFECT, 150, NORMAL, 90, 5 + move PECK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35 + move DRILL_PECK, NO_ADDITIONAL_EFFECT, 80, FLYING, 100, 20 + move SUBMISSION, RECOIL_EFFECT, 80, FIGHTING, 80, 25 + move LOW_KICK, FLINCH_SIDE_EFFECT2, 50, FIGHTING, 90, 20 + move COUNTER, NO_ADDITIONAL_EFFECT, 1, FIGHTING, 100, 20 + move SEISMIC_TOSS, SPECIAL_DAMAGE_EFFECT, 1, FIGHTING, 100, 20 + move STRENGTH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 15 + move ABSORB, DRAIN_HP_EFFECT, 20, GRASS, 100, 20 + move MEGA_DRAIN, DRAIN_HP_EFFECT, 40, GRASS, 100, 10 + move LEECH_SEED, LEECH_SEED_EFFECT, 0, GRASS, 90, 10 + move GROWTH, SPECIAL_UP1_EFFECT, 0, NORMAL, 100, 40 + move RAZOR_LEAF, NO_ADDITIONAL_EFFECT, 55, GRASS, 95, 25 + move SOLARBEAM, CHARGE_EFFECT, 120, GRASS, 100, 10 + move POISONPOWDER, POISON_EFFECT, 0, POISON, 75, 35 + move STUN_SPORE, PARALYZE_EFFECT, 0, GRASS, 75, 30 + move SLEEP_POWDER, SLEEP_EFFECT, 0, GRASS, 75, 15 + move PETAL_DANCE, THRASH_PETAL_DANCE_EFFECT, 70, GRASS, 100, 20 + move STRING_SHOT, SPEED_DOWN1_EFFECT, 0, BUG, 95, 40 + move DRAGON_RAGE, SPECIAL_DAMAGE_EFFECT, 1, DRAGON, 100, 10 + move FIRE_SPIN, TRAPPING_EFFECT, 15, FIRE, 70, 15 + move THUNDERSHOCK, PARALYZE_SIDE_EFFECT1, 40, ELECTRIC, 100, 30 + move THUNDERBOLT, PARALYZE_SIDE_EFFECT1, 95, ELECTRIC, 100, 15 + move THUNDER_WAVE, PARALYZE_EFFECT, 0, ELECTRIC, 100, 20 + move THUNDER, PARALYZE_SIDE_EFFECT1, 120, ELECTRIC, 70, 10 + move ROCK_THROW, NO_ADDITIONAL_EFFECT, 50, ROCK, 65, 15 + move EARTHQUAKE, NO_ADDITIONAL_EFFECT, 100, GROUND, 100, 10 + move FISSURE, OHKO_EFFECT, 1, GROUND, 30, 5 + move DIG, CHARGE_EFFECT, 100, GROUND, 100, 10 + move TOXIC, POISON_EFFECT, 0, POISON, 85, 10 + move CONFUSION, CONFUSION_SIDE_EFFECT, 50, PSYCHIC, 100, 25 + move PSYCHIC_M, SPECIAL_DOWN_SIDE_EFFECT, 90, PSYCHIC, 100, 10 + move HYPNOSIS, SLEEP_EFFECT, 0, PSYCHIC, 60, 20 + move MEDITATE, ATTACK_UP1_EFFECT, 0, PSYCHIC, 100, 40 + move AGILITY, SPEED_UP2_EFFECT, 0, PSYCHIC, 100, 30 + move QUICK_ATTACK, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 30 + move RAGE, RAGE_EFFECT, 20, NORMAL, 100, 20 + move TELEPORT, SWITCH_AND_TELEPORT_EFFECT, 0, PSYCHIC, 100, 20 + move NIGHT_SHADE, SPECIAL_DAMAGE_EFFECT, 0, GHOST, 100, 15 + move MIMIC, MIMIC_EFFECT, 0, NORMAL, 100, 10 + move SCREECH, DEFENSE_DOWN2_EFFECT, 0, NORMAL, 85, 40 + move DOUBLE_TEAM, EVASION_UP1_EFFECT, 0, NORMAL, 100, 15 + move RECOVER, HEAL_EFFECT, 0, NORMAL, 100, 20 + move HARDEN, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 30 + move MINIMIZE, EVASION_UP1_EFFECT, 0, NORMAL, 100, 20 + move SMOKESCREEN, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 20 + move CONFUSE_RAY, CONFUSION_EFFECT, 0, GHOST, 100, 10 + move WITHDRAW, DEFENSE_UP1_EFFECT, 0, WATER, 100, 40 + move DEFENSE_CURL, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 40 + move BARRIER, DEFENSE_UP2_EFFECT, 0, PSYCHIC, 100, 30 + move LIGHT_SCREEN, LIGHT_SCREEN_EFFECT, 0, PSYCHIC, 100, 30 + move HAZE, HAZE_EFFECT, 0, ICE, 100, 30 + move REFLECT, REFLECT_EFFECT, 0, PSYCHIC, 100, 20 + move FOCUS_ENERGY, FOCUS_ENERGY_EFFECT, 0, NORMAL, 100, 30 + move BIDE, BIDE_EFFECT, 0, NORMAL, 100, 10 + move METRONOME, METRONOME_EFFECT, 0, NORMAL, 100, 10 + move MIRROR_MOVE, MIRROR_MOVE_EFFECT, 0, FLYING, 100, 20 + move SELFDESTRUCT, EXPLODE_EFFECT, 130, NORMAL, 100, 5 + move EGG_BOMB, NO_ADDITIONAL_EFFECT, 100, NORMAL, 75, 10 + move LICK, PARALYZE_SIDE_EFFECT2, 20, GHOST, 100, 30 + move SMOG, POISON_SIDE_EFFECT2, 20, POISON, 70, 20 + move SLUDGE, POISON_SIDE_EFFECT2, 65, POISON, 100, 20 + move BONE_CLUB, FLINCH_SIDE_EFFECT1, 65, GROUND, 85, 20 + move FIRE_BLAST, BURN_SIDE_EFFECT2, 120, FIRE, 85, 5 + move WATERFALL, NO_ADDITIONAL_EFFECT, 80, WATER, 100, 15 + move CLAMP, TRAPPING_EFFECT, 35, WATER, 75, 10 + move SWIFT, SWIFT_EFFECT, 60, NORMAL, 100, 20 + move SKULL_BASH, CHARGE_EFFECT, 100, NORMAL, 100, 15 + move SPIKE_CANNON, TWO_TO_FIVE_ATTACKS_EFFECT, 20, NORMAL, 100, 15 + move CONSTRICT, SPEED_DOWN_SIDE_EFFECT, 10, NORMAL, 100, 35 + move AMNESIA, SPECIAL_UP2_EFFECT, 0, PSYCHIC, 100, 20 + move KINESIS, ACCURACY_DOWN1_EFFECT, 0, PSYCHIC, 80, 15 + move SOFTBOILED, HEAL_EFFECT, 0, NORMAL, 100, 10 + move HI_JUMP_KICK, JUMP_KICK_EFFECT, 85, FIGHTING, 90, 20 + move GLARE, PARALYZE_EFFECT, 0, NORMAL, 75, 30 + move DREAM_EATER, DREAM_EATER_EFFECT, 100, PSYCHIC, 100, 15 + move POISON_GAS, POISON_EFFECT, 0, POISON, 55, 40 + move BARRAGE, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20 + move LEECH_LIFE, DRAIN_HP_EFFECT, 20, BUG, 100, 15 + move LOVELY_KISS, SLEEP_EFFECT, 0, NORMAL, 75, 10 + move SKY_ATTACK, CHARGE_EFFECT, 140, FLYING, 90, 5 + move TRANSFORM, TRANSFORM_EFFECT, 0, NORMAL, 100, 10 + move BUBBLE, SPEED_DOWN_SIDE_EFFECT, 20, WATER, 100, 30 + move DIZZY_PUNCH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 10 + move SPORE, SLEEP_EFFECT, 0, GRASS, 100, 15 + move FLASH, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 70, 20 + move PSYWAVE, SPECIAL_DAMAGE_EFFECT, 1, PSYCHIC, 80, 15 + move SPLASH, SPLASH_EFFECT, 0, NORMAL, 100, 40 + move ACID_ARMOR, DEFENSE_UP2_EFFECT, 0, POISON, 100, 40 + move CRABHAMMER, NO_ADDITIONAL_EFFECT, 90, WATER, 85, 10 + move EXPLOSION, EXPLODE_EFFECT, 170, NORMAL, 100, 5 + move FURY_SWIPES, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 80, 15 + move BONEMERANG, ATTACK_TWICE_EFFECT, 50, GROUND, 90, 10 + move REST, HEAL_EFFECT, 0, PSYCHIC, 100, 10 + move ROCK_SLIDE, NO_ADDITIONAL_EFFECT, 75, ROCK, 90, 10 + move HYPER_FANG, FLINCH_SIDE_EFFECT1, 80, NORMAL, 90, 15 + move SHARPEN, ATTACK_UP1_EFFECT, 0, NORMAL, 100, 30 + move CONVERSION, CONVERSION_EFFECT, 0, NORMAL, 100, 30 + move TRI_ATTACK, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 10 + move SUPER_FANG, SUPER_FANG_EFFECT, 1, NORMAL, 90, 10 + move SLASH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 20 + move SUBSTITUTE, SUBSTITUTE_EFFECT, 0, NORMAL, 100, 10 + move STRUGGLE, RECOIL_EFFECT, 50, NORMAL, 100, 10 diff --git a/macros.asm b/macros.asm index 8244c8c9..52518d47 100644 --- a/macros.asm +++ b/macros.asm @@ -11,6 +11,9 @@ page EQUS "db $49," ; Start a new Pokedex page. dex EQUS "db $5f, $50" ; End a Pokedex entry. +percent EQUS "* $ff / 100" + + homecall: MACRO ld a, [H_LOADEDROMBANK] push af -- cgit v1.2.3 From 29aff84107a6463a94f0d7d81de8a1603e0d741f Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 17 Sep 2014 12:35:51 -0700 Subject: Enumerate move constants and add unnamed animation constants. --- constants/move_constants.asm | 390 +++++++++++++++++++++++-------------------- macros.asm | 11 ++ 2 files changed, 219 insertions(+), 182 deletions(-) diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 816bd115..0899c594 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -1,184 +1,210 @@ -NUM_ATTACKS EQU $A4 +const_value = 1 -POUND EQU $01 -KARATE_CHOP EQU $02 -DOUBLESLAP EQU $03 -COMET_PUNCH EQU $04 -MEGA_PUNCH EQU $05 -PAY_DAY EQU $06 -FIRE_PUNCH EQU $07 -ICE_PUNCH EQU $08 -THUNDERPUNCH EQU $09 -SCRATCH EQU $0A -VICEGRIP EQU $0B -GUILLOTINE EQU $0C -RAZOR_WIND EQU $0D -SWORDS_DANCE EQU $0E -CUT EQU $0F -GUST EQU $10 -WING_ATTACK EQU $11 -WHIRLWIND EQU $12 -FLY EQU $13 -BIND EQU $14 -SLAM EQU $15 -VINE_WHIP EQU $16 -STOMP EQU $17 -DOUBLE_KICK EQU $18 -MEGA_KICK EQU $19 -JUMP_KICK EQU $1A -ROLLING_KICK EQU $1B -SAND_ATTACK EQU $1C -HEADBUTT EQU $1D -HORN_ATTACK EQU $1E -FURY_ATTACK EQU $1F -HORN_DRILL EQU $20 -TACKLE EQU $21 -BODY_SLAM EQU $22 -WRAP EQU $23 -TAKE_DOWN EQU $24 -THRASH EQU $25 -DOUBLE_EDGE EQU $26 -TAIL_WHIP EQU $27 -POISON_STING EQU $28 -TWINEEDLE EQU $29 -PIN_MISSILE EQU $2A -LEER EQU $2B -BITE EQU $2C -GROWL EQU $2D -ROAR EQU $2E -SING EQU $2F -SUPERSONIC EQU $30 -SONICBOOM EQU $31 -DISABLE EQU $32 -ACID EQU $33 -EMBER EQU $34 -FLAMETHROWER EQU $35 -MIST EQU $36 -WATER_GUN EQU $37 -HYDRO_PUMP EQU $38 -SURF EQU $39 -ICE_BEAM EQU $3A -BLIZZARD EQU $3B -PSYBEAM EQU $3C -BUBBLEBEAM EQU $3D -AURORA_BEAM EQU $3E -HYPER_BEAM EQU $3F -PECK EQU $40 -DRILL_PECK EQU $41 -SUBMISSION EQU $42 -LOW_KICK EQU $43 -COUNTER EQU $44 -SEISMIC_TOSS EQU $45 -STRENGTH EQU $46 -ABSORB EQU $47 -MEGA_DRAIN EQU $48 -LEECH_SEED EQU $49 -GROWTH EQU $4A -RAZOR_LEAF EQU $4B -SOLARBEAM EQU $4C -POISONPOWDER EQU $4D -STUN_SPORE EQU $4E -SLEEP_POWDER EQU $4F -PETAL_DANCE EQU $50 -STRING_SHOT EQU $51 -DRAGON_RAGE EQU $52 -FIRE_SPIN EQU $53 -THUNDERSHOCK EQU $54 -THUNDERBOLT EQU $55 -THUNDER_WAVE EQU $56 -THUNDER EQU $57 -ROCK_THROW EQU $58 -EARTHQUAKE EQU $59 -FISSURE EQU $5A -DIG EQU $5B -TOXIC EQU $5C -CONFUSION EQU $5D -PSYCHIC_M EQU $5E -HYPNOSIS EQU $5F -MEDITATE EQU $60 -AGILITY EQU $61 -QUICK_ATTACK EQU $62 -RAGE EQU $63 -TELEPORT EQU $64 -NIGHT_SHADE EQU $65 -MIMIC EQU $66 -SCREECH EQU $67 -DOUBLE_TEAM EQU $68 -RECOVER EQU $69 -HARDEN EQU $6A -MINIMIZE EQU $6B -SMOKESCREEN EQU $6C -CONFUSE_RAY EQU $6D -WITHDRAW EQU $6E -DEFENSE_CURL EQU $6F -BARRIER EQU $70 -LIGHT_SCREEN EQU $71 -HAZE EQU $72 -REFLECT EQU $73 -FOCUS_ENERGY EQU $74 -BIDE EQU $75 -METRONOME EQU $76 -MIRROR_MOVE EQU $77 -SELFDESTRUCT EQU $78 -EGG_BOMB EQU $79 -LICK EQU $7A -SMOG EQU $7B -SLUDGE EQU $7C -BONE_CLUB EQU $7D -FIRE_BLAST EQU $7E -WATERFALL EQU $7F -CLAMP EQU $80 -SWIFT EQU $81 -SKULL_BASH EQU $82 -SPIKE_CANNON EQU $83 -CONSTRICT EQU $84 -AMNESIA EQU $85 -KINESIS EQU $86 -SOFTBOILED EQU $87 -HI_JUMP_KICK EQU $88 -GLARE EQU $89 -DREAM_EATER EQU $8A -POISON_GAS EQU $8B -BARRAGE EQU $8C -LEECH_LIFE EQU $8D -LOVELY_KISS EQU $8E -SKY_ATTACK EQU $8F -TRANSFORM EQU $90 -BUBBLE EQU $91 -DIZZY_PUNCH EQU $92 -SPORE EQU $93 -FLASH EQU $94 -PSYWAVE EQU $95 -SPLASH EQU $96 -ACID_ARMOR EQU $97 -CRABHAMMER EQU $98 -EXPLOSION EQU $99 -FURY_SWIPES EQU $9A -BONEMERANG EQU $9B -REST EQU $9C -ROCK_SLIDE EQU $9D -HYPER_FANG EQU $9E -SHARPEN EQU $9F -CONVERSION EQU $A0 -TRI_ATTACK EQU $A1 -SUPER_FANG EQU $A2 -SLASH EQU $A3 -SUBSTITUTE EQU $A4 -STRUGGLE EQU $A5 + const POUND + const KARATE_CHOP + const DOUBLESLAP + const COMET_PUNCH + const MEGA_PUNCH + const PAY_DAY + const FIRE_PUNCH + const ICE_PUNCH + const THUNDERPUNCH + const SCRATCH + const VICEGRIP + const GUILLOTINE + const RAZOR_WIND + const SWORDS_DANCE + const CUT + const GUST + const WING_ATTACK + const WHIRLWIND + const FLY + const BIND + const SLAM + const VINE_WHIP + const STOMP + const DOUBLE_KICK + const MEGA_KICK + const JUMP_KICK + const ROLLING_KICK + const SAND_ATTACK + const HEADBUTT + const HORN_ATTACK + const FURY_ATTACK + const HORN_DRILL + const TACKLE + const BODY_SLAM + const WRAP + const TAKE_DOWN + const THRASH + const DOUBLE_EDGE + const TAIL_WHIP + const POISON_STING + const TWINEEDLE + const PIN_MISSILE + const LEER + const BITE + const GROWL + const ROAR + const SING + const SUPERSONIC + const SONICBOOM + const DISABLE + const ACID + const EMBER + const FLAMETHROWER + const MIST + const WATER_GUN + const HYDRO_PUMP + const SURF + const ICE_BEAM + const BLIZZARD + const PSYBEAM + const BUBBLEBEAM + const AURORA_BEAM + const HYPER_BEAM + const PECK + const DRILL_PECK + const SUBMISSION + const LOW_KICK + const COUNTER + const SEISMIC_TOSS + const STRENGTH + const ABSORB + const MEGA_DRAIN + const LEECH_SEED + const GROWTH + const RAZOR_LEAF + const SOLARBEAM + const POISONPOWDER + const STUN_SPORE + const SLEEP_POWDER + const PETAL_DANCE + const STRING_SHOT + const DRAGON_RAGE + const FIRE_SPIN + const THUNDERSHOCK + const THUNDERBOLT + const THUNDER_WAVE + const THUNDER + const ROCK_THROW + const EARTHQUAKE + const FISSURE + const DIG + const TOXIC + const CONFUSION + const PSYCHIC_M + const HYPNOSIS + const MEDITATE + const AGILITY + const QUICK_ATTACK + const RAGE + const TELEPORT + const NIGHT_SHADE + const MIMIC + const SCREECH + const DOUBLE_TEAM + const RECOVER + const HARDEN + const MINIMIZE + const SMOKESCREEN + const CONFUSE_RAY + const WITHDRAW + const DEFENSE_CURL + const BARRIER + const LIGHT_SCREEN + const HAZE + const REFLECT + const FOCUS_ENERGY + const BIDE + const METRONOME + const MIRROR_MOVE + const SELFDESTRUCT + const EGG_BOMB + const LICK + const SMOG + const SLUDGE + const BONE_CLUB + const FIRE_BLAST + const WATERFALL + const CLAMP + const SWIFT + const SKULL_BASH + const SPIKE_CANNON + const CONSTRICT + const AMNESIA + const KINESIS + const SOFTBOILED + const HI_JUMP_KICK + const GLARE + const DREAM_EATER + const POISON_GAS + const BARRAGE + const LEECH_LIFE + const LOVELY_KISS + const SKY_ATTACK + const TRANSFORM + const BUBBLE + const DIZZY_PUNCH + const SPORE + const FLASH + const PSYWAVE + const SPLASH + const ACID_ARMOR + const CRABHAMMER + const EXPLOSION + const FURY_SWIPES + const BONEMERANG + const REST + const ROCK_SLIDE + const HYPER_FANG + const SHARPEN + const CONVERSION + const TRI_ATTACK + const SUPER_FANG + const SLASH + const SUBSTITUTE -; these do double duty as animation identifiers -SHOWPIC_ANIM EQU $A6 ; redraw monster pic -STATUS_AFFECTED_ANIM EQU $A7 ; effect when monster receives a status aliment -XSTATITEM_ANIM EQU $AE ; use X Attack/Defense/Speed/Special -BURN_PSN_ANIM EQU $BA ; Plays when a monster is burned or poisoned -SLP_ANIM EQU $BD ; sleeping monster -CONF_ANIM EQU $BF ; confused monster -TOSS_ANIM EQU $C1 ; toss Poké Ball -SHAKE_ANIM EQU $C2 ; shaking Poké Ball when catching monster -POOF_ANIM EQU $C3 ; puff of smoke -BLOCKBALL_ANIM EQU $C4 ; trainer knocks away Poké Ball -GREATTOSS_ANIM EQU $C5 ; toss Great Ball -ULTRATOSS_ANIM EQU $C6 ; toss Ultra Ball or Master Ball -HIDEPIC_ANIM EQU $C8 ; monster disappears -ROCK_ANIM EQU $C9 ; throw rock -BAIT_ANIM EQU $CA ; throw bait +NUM_ATTACKS EQU const_value + -1 + + const STRUGGLE + + ; Moves do double duty as animation identifiers. + + const SHOWPIC_ANIM + const STATUS_AFFECTED_ANIM + const ANIM_A8 + const ANIM_A9 + const ANIM_AA + const ANIM_AB + const ANIM_AC + const ANIM_AD + const XSTATITEM_ANIM ; use X Attack/Defense/Speed/Special + const ANIM_AF + const ANIM_B0 + const ANIM_B1 + const ANIM_B2 + const ANIM_B3 + const ANIM_B4 + const ANIM_B5 + const ANIM_B6 + const ANIM_B7 + const ANIM_B8 + const ANIM_B9 + const BURN_PSN_ANIM ; Plays when a monster is burned or poisoned + const ANIM_BB + const ANIM_BC + const SLP_ANIM ; sleeping monster + const ANIM_BE + const CONF_ANIM ; confused monster + const ANIM_C0 + const TOSS_ANIM ; toss Poké Ball + const SHAKE_ANIM ; shaking Poké Ball when catching monster + const POOF_ANIM ; puff of smoke + const BLOCKBALL_ANIM ; trainer knocks away Poké Ball + const GREATTOSS_ANIM ; toss Great Ball + const ULTRATOSS_ANIM ; toss Ultra Ball or Master Ball + const ANIM_C7 + const HIDEPIC_ANIM ; monster disappears + const ROCK_ANIM ; throw rock + const BAIT_ANIM ; throw bait diff --git a/macros.asm b/macros.asm index 52518d47..ca2dc82d 100644 --- a/macros.asm +++ b/macros.asm @@ -14,6 +14,17 @@ dex EQUS "db $5f, $50" ; End a Pokedex entry. percent EQUS "* $ff / 100" +; Constant enumeration is useful for monsters, items, moves, etc. +const_def: MACRO +const_value = 0 +ENDM + +const: MACRO +\1 EQU const_value +const_value = const_value + 1 +ENDM + + homecall: MACRO ld a, [H_LOADEDROMBANK] push af -- cgit v1.2.3 From aa361c3bf7a302dd9a883ff869c06305f3fc0436 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 17 Sep 2014 12:37:47 -0700 Subject: Use move animation constants instead of static values. This allows new moves and animations to be added without overlap. --- engine/battle/animations.asm | 14 +++++++------- engine/battle/core.asm | 24 ++++++++++++------------ engine/trade.asm | 12 ++++++------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index cc598de4..a8ed3865 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -525,9 +525,9 @@ Func_78e23: ; 78e23 (1e:4e23) ld [wcc79], a ld b, $e4 ld a, [W_ANIMATIONID] ; W_ANIMATIONID - cp $aa + cp ANIM_AA jr c, .asm_78e3f - cp $ae + cp ANIM_AD + 1 jr nc, .asm_78e3f ld b, $f0 .asm_78e3f @@ -697,13 +697,13 @@ AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5) db ROCK_SLIDE dw DoRockSlideSpecialEffects - db $AA + db ANIM_AA dw Func_79041 - db $AB + db ANIM_AB dw Func_7904c - db $AC + db ANIM_AC dw Func_7907c db TOSS_ANIM @@ -2855,10 +2855,10 @@ TossBallAnimation: ; 79e16 (1e:5e16) .PokeBallAnimations: ; 79e50 (1e:5e50) ; sequence of animations that make up the Poké Ball toss - db POOF_ANIM,HIDEPIC_ANIM,$C2,POOF_ANIM,SHOWPIC_ANIM + db POOF_ANIM,HIDEPIC_ANIM,SHAKE_ANIM,POOF_ANIM,SHOWPIC_ANIM .BlockBall ; 5E55 - ld a,$C1 + ld a,TOSS_ANIM ld [W_ANIMATIONID],a call PlayAnimation ld a,(SFX_08_43 - SFX_Headers_08) / 3 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 399a8ee7..4baa7a76 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -7062,16 +7062,16 @@ PoisonEffect: ; 3f24f (f:724f) dec de ld a, [H_WHOSETURN] ; $fff3 and a - ld b, $c7 + ld b, ANIM_C7 ld hl, W_PLAYERBATTSTATUS3 ; W_PLAYERBATTSTATUS3 ld a, [de] ld de, W_PLAYERTOXICCOUNTER ; wd06c jr nz, .asm_3f2b0 - ld b, $a9 + ld b, ANIM_A9 ld hl, W_ENEMYBATTSTATUS3 ; W_ENEMYBATTSTATUS3 ld de, W_ENEMYTOXICCOUNTER ; wd071 .asm_3f2b0 - cp $5c + cp TOXIC jr nz, .asm_3f2bd set 0, [hl] xor a @@ -7173,14 +7173,14 @@ FreezeBurnParalyzeEffect: ; 3f30c (f:730c) ld a, 1 << PAR ld [wEnemyMonStatus], a call Func_3ed27 ;quarter speed of affected monster - ld a, $a9 + ld a, ANIM_A9 call Func_3fbb9 ;animation jp PrintMayNotAttackText ;print paralysis text .burn ld a, 1 << BRN ld [wEnemyMonStatus], a call Func_3ed64 - ld a, $a9 + ld a, ANIM_A9 call Func_3fbb9 ;animation ld hl, BurnedText jp PrintText @@ -7188,7 +7188,7 @@ FreezeBurnParalyzeEffect: ; 3f30c (f:730c) call Func_3f9cf ;resets bit 5 of the D063/D068 flags ld a, 1 << FRZ ld [wEnemyMonStatus], a - ld a, $a9 + ld a, ANIM_A9 call Func_3fbb9 ;animation ld hl, FrozenText jp PrintText @@ -7726,7 +7726,7 @@ BideEffect: ; 3f6e5 (f:76e5) inc a ld [bc], a ld a, [H_WHOSETURN] - add $ae + add XSTATITEM_ANIM jp Func_3fb96 ThrashPetalDanceEffect: ; 3f717 (f:7717) @@ -7745,7 +7745,7 @@ ThrashPetalDanceEffect: ; 3f717 (f:7717) inc a ld [de], a ld a, [H_WHOSETURN] ; $fff3 - add $b0 + add ANIM_B0 jp Func_3fb96 SwitchAndTeleportEffect: ; 3f739 (f:7739) @@ -7941,11 +7941,11 @@ ChargeEffect: ; 3f88c (f:788c) ld de, W_PLAYERMOVEEFFECT ; wcfd3 ld a, [H_WHOSETURN] ; $fff3 and a - ld b, $ae + ld b, XSTATITEM_ANIM jr z, .asm_3f8a1 ld hl, W_ENEMYBATTSTATUS1 ; W_ENEMYBATTSTATUS1 ld de, W_ENEMYMOVEEFFECT ; W_ENEMYMOVEEFFECT - ld b, $af + ld b, ANIM_AF .asm_3f8a1 set 4, [hl] ld a, [de] @@ -7953,13 +7953,13 @@ ChargeEffect: ; 3f88c (f:788c) cp FLY_EFFECT jr nz, .asm_3f8ad set 6, [hl] ; mon is now invulnerable to typical attacks (fly/dig) - ld b, $64 + ld b, TELEPORT .asm_3f8ad ld a, [de] cp DIG jr nz, .asm_3f8b6 set 6, [hl] ; mon is now invulnerable to typical attacks (fly/dig) - ld b, $c0 + ld b, ANIM_C0 .asm_3f8b6 xor a ld [wcc5b], a diff --git a/engine/trade.asm b/engine/trade.asm index 54abdab6..199513af 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -203,9 +203,9 @@ Func_41245: ; 41245 (10:5245) and a jr nz, .asm_41273 call Delay50 - ld a, $ad + ld a, ANIM_AD call Func_41676 - ld a, $aa + ld a, ANIM_AA call Func_41676 ld a, [wWhichTrade] ; wWhichTrade call PlayCry @@ -242,9 +242,9 @@ Func_41298: ; 41298 (10:5298) ret Func_412d2: ; 412d2 (10:52d2) - ld a, $ab + ld a, ANIM_AB call Func_41676 - ld c, $a + ld c, 10 call DelayFrames ld a, $e4 ld [rOBP0], a ; $ff48 @@ -295,7 +295,7 @@ UnknownOAM_4132e: ; 4132e (10:532e) db $7E,$40,$7E,$60 Func_41336: ; 41336 (10:5336) - ld a, $ac + ld a, ANIM_AC call Func_41676 call Func_415c8 hlCoord 4, 10 @@ -308,7 +308,7 @@ Func_41336: ; 41336 (10:5336) ld [H_AUTOBGTRANSFERENABLED], a ; $ffba ld a, [wTrainerEngageDistance] call Func_415a4 - ld a, $ad + ld a, ANIM_AD call Func_41676 ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a ; $ffba -- cgit v1.2.3 From a850331d313e0575c48af865eb62dc9c7a3850c6 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 17 Sep 2014 12:57:02 -0700 Subject: Use a macro to define version constants. --- version.asm | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/version.asm b/version.asm index 6f80aa1c..7d9fa036 100644 --- a/version.asm +++ b/version.asm @@ -1,20 +1,11 @@ -if !def(_RED) -_RED EQU 0 -endc - -if !def(_BLUE) -_BLUE EQU 0 -endc - -if !def(_JAPAN) -_JAPAN EQU 0 -endc - -if !def(_GREEN) -_GREEN EQU 0 -endc - -if !def(_YELLOW) -_YELLOW EQU 0 +check_ver: MACRO +if !def(\1) +\1 EQU 0 endc +ENDM + check_ver _RED + check_ver _BLUE + check_ver _JAPAN + check_ver _GREEN + check_ver _YELLOW -- cgit v1.2.3 From fcfed136c6a0c094314bf75441af4d4b43cfc999 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 17 Sep 2014 13:16:34 -0700 Subject: Don't define addresses for ROM0 sections in home.asm. Instead, occupy the space reserved for the rom header so there is no collision. --- home.asm | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/home.asm b/home.asm index f83662ca..112bf265 100644 --- a/home.asm +++ b/home.asm @@ -1,35 +1,36 @@ + ; The rst vectors are unused. -SECTION "rst00", ROM0[$00] +SECTION "rst 00", ROM0 [$00] rst $38 -SECTION "rst08", ROM0[$08] +SECTION "rst 08", ROM0 [$08] rst $38 -SECTION "rst10", ROM0[$10] +SECTION "rst 10", ROM0 [$10] rst $38 -SECTION "rst18", ROM0[$18] +SECTION "rst 18", ROM0 [$18] rst $38 -SECTION "rst20", ROM0[$20] +SECTION "rst 20", ROM0 [$20] rst $38 -SECTION "rst28", ROM0[$28] +SECTION "rst 28", ROM0 [$28] rst $38 -SECTION "rst30", ROM0[$30] +SECTION "rst 30", ROM0 [$30] rst $38 -SECTION "rst38", ROM0[$38] +SECTION "rst 38", ROM0 [$38] rst $38 -; interrupts -SECTION "vblank", ROM0[$40] +; Hardware interrupts +SECTION "vblank", ROM0 [$40] jp VBlank -SECTION "lcdc", ROM0[$48] +SECTION "hblank", ROM0 [$48] rst $38 -SECTION "timer", ROM0[$50] +SECTION "timer", ROM0 [$50] jp Timer -SECTION "serial", ROM0[$58] +SECTION "serial", ROM0 [$58] jp Serial -SECTION "joypad", ROM0[$60] +SECTION "joypad", ROM0 [$60] reti -SECTION "bank0",ROM0[$61] +SECTION "Home", ROM0 DisableLCD:: xor a @@ -82,12 +83,23 @@ HideSprites:: INCLUDE "home/copy.asm" -SECTION "Entry", ROM0[$100] + +SECTION "Entry", ROM0 [$100] + nop jp Start -SECTION "Start", ROM0[$150] +SECTION "Header", ROM0 [$104] + + ; The header is generated by rgbfix. + ; The space here is allocated to prevent code from being overwritten. + + ds $150 - $104 + + + +SECTION "Main", ROM0 Start:: cp GBC -- cgit v1.2.3 From 3de9d14d3e1ed14b880c0064a6141d9d9ca9b828 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 17 Sep 2014 21:02:59 -0700 Subject: Recomment misc functions in home.asm. --- constants/misc_constants.asm | 22 +- home.asm | 861 ++++++++++++++++++++++--------------------- 2 files changed, 447 insertions(+), 436 deletions(-) diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 29f15035..62067171 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -1,12 +1,3 @@ -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 - MAX_LEVEL EQU 100 NUM_MOVES EQU 4 @@ -18,3 +9,16 @@ NUM_BOXES EQU 12 HOF_MON EQU $10 HOF_TEAM EQU PARTY_LENGTH * HOF_MON NUM_HOF_TEAMS EQU 50 + + +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_WIDTH EQU 20 +SCREEN_HEIGHT EQU 18 diff --git a/home.asm b/home.asm index 112bf265..7b5c8c6b 100644 --- a/home.asm +++ b/home.asm @@ -169,63 +169,76 @@ LoadDestinationWarpPosition:: ; 1313 (0:1313) ld [$2000],a ret -; INPUT: -; c: if nonzero, show at least a sliver of health -; d = number of HP bar sections (normally 6) -; e = health (in eighths of bar sections) (normally out of 48) + DrawHPBar:: ; 1336 (0:1336) +; Draw an HP bar d tiles long, and fill it to e pixels. +; If c is nonzero, show at least a sliver regardless. +; The right end of the bar changes with [wListMenuID]. + push hl push de push bc - ld a,$71 ; left of HP bar tile 1 - ld [hli],a - ld a,$62 ; left of HP bar tile 2 - ld [hli],a + + ; Left + ld a, $71 ; "HP:" + ld [hli], a + ld a, $62 + ld [hli], a + push hl - ld a,$63 ; empty bar section tile -.drawEmptyBarLoop + + ; Middle + ld a, $63 ; empty +.draw ld [hli],a dec d - jr nz,.drawEmptyBarLoop + jr nz, .draw + + ; Right ld a,[wListMenuID] - dec a ; what should the right of HP bar tile be? - ld a,$6d ; right of HP bar tile, in status screen and battles - jr z,.writeTile - dec a ; right of HP bar tile, in pokemon menu -.writeTile + dec a + ld a, $6d ; status screen and battle + jr z, .ok + dec a ; pokemon menu +.ok ld [hl],a + pop hl - ld a,e - and a ; is there enough health to show up on the HP bar? - jr nz,.loop ; if so, draw the HP bar - ld a,c - and a ; should a sliver of health be shown no matter what? - jr z,.done - ld e,1 ; if so, fill one eighth of a bar section -; loop to draw every full bar section -.loop - ld a,e - sub a,8 - jr c,.drawPartialBarSection - ld e,a - ld a,$6b ; filled bar section tile - ld [hli],a - ld a,e + + ld a, e and a - jr z,.done - jr .loop -; draws a partial bar section at the end (if necessary) -; there are 7 possible partial bar sections from 1/8 to 7/8 full -.drawPartialBarSection - ld a,$63 ; empty bar section tile - add e ; add e to get the appropriate partial bar section tile - ld [hl],a ; write the tile + jr nz, .fill + + ; If c iz nonzero, draw a pixel anyway. + ld a, c + and a + jr z, .done + ld e, 1 + +.fill + ld a, e + sub 8 + jr c, .partial + ld e, a + ld a, $6b ; full + ld [hli], a + ld a, e + and a + jr z, .done + jr .fill + +.partial + ; Fill remaining pixels at the end if necessary. + ld a, $63 ; empty + add e + ld [hl], a .done pop bc pop de pop hl ret + ; loads pokemon data from one of multiple sources to wcf98 ; loads base stats to W_MONHDEXNUM ; INPUT: @@ -240,22 +253,22 @@ DrawHPBar:: ; 1336 (0:1336) ; wcf98 = base address of pokemon data ; W_MONHDEXNUM = base address of base stats LoadMonData:: ; 1372 (0:1372) - ld hl,LoadMonData_ - ld b,BANK(LoadMonData_) + ld hl, LoadMonData_ + ld b, BANK(LoadMonData_) jp Bankswitch ; writes c to wd0dc+b Func_137a:: ; 137a (0:137a) ld hl, wd0dc ld e, b - ld d, $0 + ld d, 0 add hl, de ld a, c ld [hl], a ret LoadFlippedFrontSpriteByMonIndex:: ; 1384 (0:1384) - ld a, $1 + ld a, 1 ld [W_SPRITEFLIPPED], a LoadFrontSpriteByMonIndex:: ; 1389 (0:1389) @@ -271,9 +284,9 @@ LoadFrontSpriteByMonIndex:: ; 1389 (0:1389) ld [hl], b and a pop hl - jr z, .invalidDexNumber ; dex #0 invalid + jr z, .invalidDexNumber ; dex #0 invalid cp NUM_POKEMON + 1 - jr c, .validDexNumber ; dex >#151 invalid + jr c, .validDexNumber ; dex >#151 invalid .invalidDexNumber ld a, RHYDON ; $1 ld [wcf91], a @@ -298,41 +311,44 @@ LoadFrontSpriteByMonIndex:: ; 1389 (0:1389) ld [$2000], a ret -; plays the cry of a pokemon -; INPUT: -; a = pokemon ID + PlayCry:: ; 13d0 (0:13d0) +; Play monster a's cry. call GetCryData - call PlaySound ; play cry - jp WaitForSoundToFinish ; wait for sound to be done playing + call PlaySound + jp WaitForSoundToFinish -; gets a pokemon's cry data -; INPUT: -; a = pokemon ID GetCryData:: ; 13d9 (0:13d9) +; Load cry data for monster a. dec a - ld c,a - ld b,0 - ld hl,CryData - add hl,bc - add hl,bc - add hl,bc - ld a,Bank(CryData) + ld c, a + ld b, 0 + ld hl, CryData + add hl, bc + add hl, bc + add hl, bc + + ld a, Bank(CryData) call BankswitchHome - ld a,[hli] - ld b,a - ld a,[hli] - ld [wc0f1],a - ld a,[hl] - ld [wc0f2],a + ld a, [hli] + ld b, a ; cry id + ld a, [hli] + ld [wc0f1], a + ld a, [hl] + ld [wc0f2], a call BankswitchBack - ld a,b ; a = cryID - ld c,$14 ; base sound ID for pokemon cries - rlca - add b ; a = cryID * 3 - add c ; a = $14 + cryID * 3 + + ; Cry headers have 3 channels, + ; and start from index $14, + ; so add 3 times the cry id. + ld a, b + ld c, $14 + rlca ; * 2 + add b + add c ret + DisplayPartyMenu:: ; 13fc (0:13fc) ld a,[$ffd7] push af @@ -354,42 +370,42 @@ GoBackToPartyMenu:: ; 1411 (0:1411) jp HandlePartyMenuInput PartyMenuInit:: ; 1420 (0:1420) - ld a,$01 + ld a, 1 ; hardcoded bank call BankswitchHome call LoadHpBarAndStatusTilePatterns - ld hl,wd730 - set 6,[hl] ; turn off letter printing delay + ld hl, wd730 + set 6, [hl] ; turn off letter printing delay xor a - ld [wcc49],a - ld [wcc37],a - ld hl,wTopMenuItemY + ld [wcc49], a + ld [wcc37], a + ld hl, wTopMenuItemY inc a - ld [hli],a ; top menu item Y + ld [hli], a ; top menu item Y xor a - ld [hli],a ; top menu item X - ld a,[wcc2b] + ld [hli], a ; top menu item X + ld a, [wcc2b] push af - ld [hli],a ; current menu item ID + ld [hli], a ; current menu item ID inc hl - ld a,[wPartyCount] + ld a, [wPartyCount] and a ; are there more than 0 pokemon in the party? - jr z,.storeMaxMenuItemID + jr z, .storeMaxMenuItemID dec a ; if party is not empty, the max menu item ID is ([wPartyCount] - 1) ; otherwise, it is 0 .storeMaxMenuItemID - ld [hli],a ; max menu item ID - ld a,[wd11f] + ld [hli], a ; max menu item ID + ld a, [wd11f] and a - ld a,%00000011 ; A button and B button - jr z,.next + ld a, A_BUTTON + B_BUTTON + jr z, .next xor a - ld [wd11f],a + ld [wd11f], a inc a .next - ld [hli],a ; menu watched keys + ld [hli], a ; menu watched keys pop af - ld [hl],a ; old menu item ID + ld [hl], a ; old menu item ID ret HandlePartyMenuInput:: ; 145a (0:145a) @@ -672,7 +688,7 @@ PrintBCDNumber:: ; 15cd (0:15cd) ret PrintBCDDigit:: ; 1604 (0:1604) - and a,%00001111 + and $f and a jr z,.zeroDigit .nonzeroDigit @@ -1403,7 +1419,7 @@ DisplayListMenuID:: ; 2be6 (0:2be6) ld [wTopMenuItemY],a ld a,5 ld [wTopMenuItemX],a - ld a,%00000111 ; A button, B button, Select button + ld a,A_BUTTON | B_BUTTON | SELECT ld [wMenuWatchedKeys],a ld c,10 call DelayFrames @@ -1827,7 +1843,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) ld bc,20 + 8 ; 1 row down and 8 columns right add hl,bc ld a,"×" - ldi [hl],a + ld [hli],a ld a,[wd11e] push af ld a,[de] @@ -2653,8 +2669,8 @@ FuncTX_ItemStoragePC:: ; 3460 (0:3460) FuncTX_BillsPC:: ; 346a (0:346a) call SaveScreenTilesToBuffer2 - ld b, BANK(Func_214c2) - ld hl, Func_214c2 + ld b, BANK(BillsPC_) + ld hl, BillsPC_ jr bankswitchAndContinue FuncTX_SlotMachine:: ; 3474 (0:3474) @@ -3064,65 +3080,63 @@ Func_366b:: ; 366b (0:366b) pop hl ret -; copies the tile patterns for letters and numbers into VRAM -LoadFontTilePatterns:: ; 3680 (0:3680) - ld a,[rLCDC] - bit 7,a ; is the LCD enabled? - jr nz,.lcdEnabled -.lcdDisabled - ld hl,FontGraphics - ld de,vFont - ld bc,$400 - ld a,BANK(FontGraphics) + +LoadFontTilePatterns:: + ld a, [rLCDC] + bit 7, a ; is the LCD enabled? + jr nz, .on +.off + ld hl, FontGraphics + ld de, vFont + ld bc, $400 + ld a, BANK(FontGraphics) jp FarCopyDataDouble ; if LCD is off, transfer all at once -.lcdEnabled - ld de,FontGraphics - ld hl,vFont - ld bc,(BANK(FontGraphics) << 8 | $80) +.on + ld de, FontGraphics + ld hl, vFont + ld bc, BANK(FontGraphics) << 8 | $80 jp CopyVideoDataDouble ; if LCD is on, transfer during V-blank -; copies the text box tile patterns into VRAM -LoadTextBoxTilePatterns:: ; 36a0 (0:36a0) - ld a,[rLCDC] - bit 7,a ; is the LCD enabled? - jr nz,.lcdEnabled -.lcdDisabled - ld hl,TextBoxGraphics - ld de,vChars2 + $600 - ld bc,$200 - ld a,BANK(TextBoxGraphics) +LoadTextBoxTilePatterns:: + ld a, [rLCDC] + bit 7, a ; is the LCD enabled? + jr nz, .on +.off + ld hl, TextBoxGraphics + ld de, vChars2 + $600 + ld bc, $200 + ld a, BANK(TextBoxGraphics) jp FarCopyData2 ; if LCD is off, transfer all at once -.lcdEnabled - ld de,TextBoxGraphics - ld hl,vChars2 + $600 - ld bc,(BANK(TextBoxGraphics) << 8 | $20) +.on + ld de, TextBoxGraphics + ld hl, vChars2 + $600 + ld bc, BANK(TextBoxGraphics) << 8 | $20 jp CopyVideoData ; if LCD is on, transfer during V-blank -; copies HP bar and status display tile patterns into VRAM -LoadHpBarAndStatusTilePatterns:: ; 36c0 (0:36c0) - ld a,[rLCDC] - bit 7,a ; is the LCD enabled? - jr nz,.lcdEnabled -.lcdDisabled - ld hl,HpBarAndStatusGraphics - ld de,vChars2 + $620 - ld bc,$1e0 - ld a,BANK(HpBarAndStatusGraphics) +LoadHpBarAndStatusTilePatterns:: + ld a, [rLCDC] + bit 7, a ; is the LCD enabled? + jr nz, .on +.off + ld hl, HpBarAndStatusGraphics + ld de, vChars2 + $620 + ld bc, $1e0 + ld a, BANK(HpBarAndStatusGraphics) jp FarCopyData2 ; if LCD is off, transfer all at once -.lcdEnabled - ld de,HpBarAndStatusGraphics - ld hl,vChars2 + $620 - ld bc,(BANK(HpBarAndStatusGraphics) << 8 | $1e) +.on + ld de, HpBarAndStatusGraphics + ld hl, vChars2 + $620 + ld bc, BANK(HpBarAndStatusGraphics) << 8 | $1e jp CopyVideoData ; if LCD is on, transfer during V-blank -;Fills memory range with the specified byte. -;input registers a = fill_byte, bc = length, hl = address -FillMemory:: ; 36e0 (0:36e0) + +FillMemory:: +; Fill bc bytes at hl with a. push de ld d, a .loop ld a, d - ldi [hl], a + ld [hli], a dec bc ld a, b or c @@ -3130,15 +3144,16 @@ FillMemory:: ; 36e0 (0:36e0) pop de ret -; loads sprite that de points to -; bank of sprite is given in a + UncompressSpriteFromDE:: ; 36eb (0:36eb) +; Decompress pic at a:de. ld hl, W_SPRITEINPUTPTR ld [hl], e inc hl ld [hl], d jp UncompressSpriteData + SaveScreenTilesToBuffer2:: ; 36f4 (0:36f4) ld hl, wTileMap ld de, wTileMapBackup2 @@ -3229,8 +3244,12 @@ GetName:: ; 376b (0:376b) ; returns pointer to name in de ld a,[wd0b5] ld [wd11e],a + + ; TM names are separate from item names. + ; BUG: This applies to all names instead of just items. cp HM_01 - jp nc,GetMachineName + jp nc, GetMachineName + ld a,[H_LOADEDROMBANK] push af push hl @@ -3400,7 +3419,7 @@ JoypadLowSensitivity:: ; 3831 (0:3831) .delayOver ; if [hJoy6] = 0 and A or B is pressed, report no buttons as pressed ld a,[hJoyHeld] - and a,%00000011 ; A and B buttons + and A_BUTTON | B_BUTTON jr z,.setShortDelay ld a,[hJoy6] ; flag and a @@ -3513,7 +3532,7 @@ PrintLetterDelay:: ; 38d3 (0:38d3) bit 0,a jr z,.waitOneFrame ld a,[W_OPTIONS] - and a,$0f + and $f ld [H_FRAMECOUNTER],a jr .checkButtons .waitOneFrame @@ -3966,7 +3985,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2) jp z,.loop1 .checkIfAButtonOrBButtonPressed ld a,[hJoy5] - and a,%00000011 ; pressed A button or B button? + and A_BUTTON | B_BUTTON jr z,.skipPlayingSound .AButtonOrBButtonPressed push hl @@ -3996,14 +4015,14 @@ PlaceMenuCursor:: ; 3b7c (0:3b7c) and a ; is the y coordinate 0? jr z,.adjustForXCoord ld hl,wTileMap - ld bc,20 ; screen width + ld bc,SCREEN_WIDTH .topMenuItemLoop add hl,bc dec a jr nz,.topMenuItemLoop .adjustForXCoord ld a,[wTopMenuItemX] - ld b,$00 + ld b,0 ld c,a add hl,bc push hl @@ -4156,7 +4175,7 @@ AutoTextBoxDrawingCommon:: ; 3c41 (0:3c41) ret PrintText:: ; 3c49 (0:3c49) -; given a pointer in hl, print the text there +; Print text hl at (1, 14). push hl ld a,1 ld [wd125],a @@ -4168,256 +4187,244 @@ Func_3c59:: ; 3c59 (0:3c59) bcCoord 1, 14 jp TextCommandProcessor -; converts a big-endian binary number into decimal and prints it -; INPUT: -; b = flags and number of bytes -; bit 7: if set, print leading zeroes -; if unset, do not print leading zeroes -; bit 6: if set, left-align the string (do not pad empty digits with spaces) -; if unset, right-align the string -; bits 4-5: unused -; bits 0-3: number of bytes (only 1 - 3 bytes supported) -; c = number of decimal digits -; de = address of the number (big-endian) -PrintNumber:: ; 3c5f (0:3c5f) + +PrintNumber:: ; 3c5f +; Print the c-digit, b-byte value at de. +; Allows 2 to 7 digits. For 1-digit numbers, add +; the value to char "0" instead of calling PrintNumber. +; Flags LEADING_ZEROES and LEFT_ALIGN can be given +; in bits 7 and 6 of b respectively. +LEADING_ZEROES EQU 7 +LEFT_ALIGN EQU 6 + push bc xor a - ld [H_PASTLEADINGZEROES],a - ld [H_NUMTOPRINT],a - ld [H_NUMTOPRINT + 1],a - ld a,b - and a,%00001111 - cp a,1 - jr z,.oneByte - cp a,2 - jr z,.twoBytes -.threeBytes - ld a,[de] - ld [H_NUMTOPRINT],a + ld [H_PASTLEADINGZEROES], a + ld [H_NUMTOPRINT], a + ld [H_NUMTOPRINT + 1], a + ld a, b + and $f + cp 1 + jr z, .byte + cp 2 + jr z, .word +.long + ld a, [de] + ld [H_NUMTOPRINT], a inc de - ld a,[de] - ld [H_NUMTOPRINT + 1],a + ld a, [de] + ld [H_NUMTOPRINT + 1], a inc de - ld a,[de] - ld [H_NUMTOPRINT + 2],a - jr .checkNumDigits -.twoBytes - ld a,[de] - ld [H_NUMTOPRINT + 1],a + ld a, [de] + ld [H_NUMTOPRINT + 2], a + jr .start + +.word + ld a, [de] + ld [H_NUMTOPRINT + 1], a inc de - ld a,[de] - ld [H_NUMTOPRINT + 2],a - jr .checkNumDigits -.oneByte - ld a,[de] - ld [H_NUMTOPRINT + 2],a -.checkNumDigits + ld a, [de] + ld [H_NUMTOPRINT + 2], a + jr .start + +.byte + ld a, [de] + ld [H_NUMTOPRINT + 2], a + +.start push de - ld d,b - ld a,c - ld b,a - xor a - ld c,a - ld a,b ; a = number of decimal digits - cp a,2 - jr z,.tensPlace - cp a,3 - jr z,.hundredsPlace - cp a,4 - jr z,.thousandsPlace - cp a,5 - jr z,.tenThousandsPlace - cp a,6 - jr z,.hundredThousandsPlace -.millionsPlace - ld a,1000000 >> 16 - ld [H_POWEROFTEN],a - ld a,(1000000 >> 8) & $FF - ld [H_POWEROFTEN + 1],a - ld a,1000000 & $FF - ld [H_POWEROFTEN + 2],a - call PrintNumber_PrintDigit - call PrintNumber_AdvancePointer -.hundredThousandsPlace - ld a,100000 >> 16 - ld [H_POWEROFTEN],a - ld a,(100000 >> 8) & $FF - ld [H_POWEROFTEN + 1],a - ld a,100000 & $FF - ld [H_POWEROFTEN + 2],a - call PrintNumber_PrintDigit - call PrintNumber_AdvancePointer -.tenThousandsPlace - xor a - ld [H_POWEROFTEN],a - ld a,10000 >> 8 - ld [H_POWEROFTEN + 1],a - ld a,10000 & $FF - ld [H_POWEROFTEN + 2],a - call PrintNumber_PrintDigit - call PrintNumber_AdvancePointer -.thousandsPlace - xor a - ld [H_POWEROFTEN],a - ld a,1000 >> 8 - ld [H_POWEROFTEN + 1],a - ld a,1000 & $FF - ld [H_POWEROFTEN + 2],a - call PrintNumber_PrintDigit - call PrintNumber_AdvancePointer -.hundredsPlace - xor a - ld [H_POWEROFTEN],a + + ld d, b + ld a, c + ld b, a xor a - ld [H_POWEROFTEN + 1],a - ld a,100 - ld [H_POWEROFTEN + 2],a - call PrintNumber_PrintDigit - call PrintNumber_AdvancePointer -.tensPlace - ld c,00 - ld a,[H_NUMTOPRINT + 2] -.loop - cp a,10 - jr c,.underflow - sub a,10 + ld c, a + ld a, b + + cp 2 + jr z, .tens + cp 3 + jr z, .hundreds + cp 4 + jr z, .thousands + cp 5 + jr z, .ten_thousands + cp 6 + jr z, .hundred_thousands + +print_digit: macro + +if (\1) / $10000 + ld a, \1 / $10000 % $100 +else xor a +endc + ld [H_POWEROFTEN + 0], a + +if (\1) / $100 + ld a, \1 / $100 % $100 +else xor a +endc + ld [H_POWEROFTEN + 1], a + + ld a, \1 / $1 % $100 + ld [H_POWEROFTEN + 2], a + + call .PrintDigit + call .NextDigit +endm + +.millions print_digit 1000000 +.hundred_thousands print_digit 100000 +.ten_thousands print_digit 10000 +.thousands print_digit 1000 +.hundreds print_digit 100 + +.tens + ld c, 0 + ld a, [H_NUMTOPRINT + 2] +.mod + cp 10 + jr c, .ok + sub 10 inc c - jr .loop -.underflow - ld b,a - ld a,[H_PASTLEADINGZEROES] + jr .mod +.ok + + ld b, a + ld a, [H_PASTLEADINGZEROES] or c - ld [H_PASTLEADINGZEROES],a - jr nz,.pastLeadingZeroes - call PrintNumber_PrintLeadingZero - jr .advancePointer -.pastLeadingZeroes - ld a,"0" + ld [H_PASTLEADINGZEROES], a + jr nz, .past + call .PrintLeadingZero + jr .next +.past + ld a, "0" add c - ld [hl],a -.advancePointer - call PrintNumber_AdvancePointer -.onesPlace - ld a,"0" + ld [hl], a +.next + + call .NextDigit +.ones + ld a, "0" add b - ld [hli],a + ld [hli], a pop de dec de pop bc ret -; prints a decimal digit -; This works by repeatedely subtracting a power of ten until the number becomes negative. -; The number of subtractions it took in order to make the number negative is the digit for the current number place. -; The last value that the number had before becoming negative is kept as the new value of the number. -; A more succinct description is that the number is divided by a power of ten -; and the quotient becomes the digit while the remainder is stored as the new value of the number. -PrintNumber_PrintDigit:: ; 3d25 (0:3d25) - ld c,0 ; counts number of loop iterations to determine the decimal digit +.PrintDigit: +; Divide by the current decimal place. +; Print the quotient, and keep the modulus. + ld c, 0 .loop - ld a,[H_POWEROFTEN] - ld b,a - ld a,[H_NUMTOPRINT] - ld [H_SAVEDNUMTOPRINT],a + ld a, [H_POWEROFTEN] + ld b, a + ld a, [H_NUMTOPRINT] + ld [H_SAVEDNUMTOPRINT], a cp b - jr c,.underflow0 + jr c, .underflow0 sub b - ld [H_NUMTOPRINT],a - ld a,[H_POWEROFTEN + 1] - ld b,a - ld a,[H_NUMTOPRINT + 1] - ld [H_SAVEDNUMTOPRINT + 1],a + ld [H_NUMTOPRINT], a + ld a, [H_POWEROFTEN + 1] + ld b, a + ld a, [H_NUMTOPRINT + 1] + ld [H_SAVEDNUMTOPRINT + 1], a cp b - jr nc,.noBorrowForByte1 -.byte1BorrowFromByte0 - ld a,[H_NUMTOPRINT] - or a,0 - jr z,.underflow1 + jr nc, .noborrow1 + + ld a, [H_NUMTOPRINT] + or 0 + jr z, .underflow1 dec a - ld [H_NUMTOPRINT],a - ld a,[H_NUMTOPRINT + 1] -.noBorrowForByte1 + ld [H_NUMTOPRINT], a + ld a, [H_NUMTOPRINT + 1] +.noborrow1 + sub b - ld [H_NUMTOPRINT + 1],a - ld a,[H_POWEROFTEN + 2] - ld b,a - ld a,[H_NUMTOPRINT + 2] - ld [H_SAVEDNUMTOPRINT + 2],a + ld [H_NUMTOPRINT + 1], a + ld a, [H_POWEROFTEN + 2] + ld b, a + ld a, [H_NUMTOPRINT + 2] + ld [H_SAVEDNUMTOPRINT + 2], a cp b - jr nc,.noBorrowForByte2 -.byte2BorrowFromByte1 - ld a,[H_NUMTOPRINT + 1] + jr nc, .noborrow2 + + ld a, [H_NUMTOPRINT + 1] and a - jr nz,.finishByte2BorrowFromByte1 -.byte2BorrowFromByte0 - ld a,[H_NUMTOPRINT] + jr nz, .borrowed + + ld a, [H_NUMTOPRINT] and a - jr z,.underflow2 + jr z, .underflow2 dec a - ld [H_NUMTOPRINT],a + ld [H_NUMTOPRINT], a xor a -.finishByte2BorrowFromByte1 +.borrowed + dec a - ld [H_NUMTOPRINT + 1],a - ld a,[H_NUMTOPRINT + 2] -.noBorrowForByte2 + ld [H_NUMTOPRINT + 1], a + ld a, [H_NUMTOPRINT + 2] +.noborrow2 sub b - ld [H_NUMTOPRINT + 2],a + ld [H_NUMTOPRINT + 2], a inc c jr .loop + .underflow2 - ld a,[H_SAVEDNUMTOPRINT + 1] - ld [H_NUMTOPRINT + 1],a + ld a, [H_SAVEDNUMTOPRINT + 1] + ld [H_NUMTOPRINT + 1], a .underflow1 - ld a,[H_SAVEDNUMTOPRINT] - ld [H_NUMTOPRINT],a + ld a, [H_SAVEDNUMTOPRINT] + ld [H_NUMTOPRINT], a .underflow0 - ld a,[H_PASTLEADINGZEROES] + ld a, [H_PASTLEADINGZEROES] or c - jr z,PrintNumber_PrintLeadingZero - ld a,"0" + jr z, .PrintLeadingZero + + ld a, "0" add c - ld [hl],a - ld [H_PASTLEADINGZEROES],a + ld [hl], a + ld [H_PASTLEADINGZEROES], a ret -; prints a leading zero unless they are turned off in the flags -PrintNumber_PrintLeadingZero:: ; 3d83 (0:3d83) - bit 7,d ; print leading zeroes? +.PrintLeadingZero: + bit LEADING_ZEROES, d ret z - ld [hl],"0" - ret - -; increments the pointer unless leading zeroes are not being printed, -; the number is left-aligned, and no nonzero digits have been printed yet -PrintNumber_AdvancePointer:: ; 3d89 (0:3d89) - bit 7,d ; print leading zeroes? - jr nz,.incrementPointer - bit 6,d ; left alignment or right alignment? - jr z,.incrementPointer - ld a,[H_PASTLEADINGZEROES] + ld [hl], "0" + ret + +.NextDigit: +; Increment unless the number is left-aligned, +; leading zeroes are not printed, and no digits +; have been printed yet. + bit LEADING_ZEROES, d + jr nz, .inc + bit LEFT_ALIGN, d + jr z, .inc + ld a, [H_PASTLEADINGZEROES] and a ret z -.incrementPointer +.inc inc hl ret -; calls a function from a table of function pointers -; INPUT: -; a = index within table -; hl = address of function pointer table -CallFunctionInTable:: ; 3d97 (0:3d97) + +CallFunctionInTable:: +JumpTable:: +; Call function a in jumptable hl. +; de is not preserved. push hl push de push bc add a - ld d,0 - ld e,a - add hl,de - ld a,[hli] - ld h,[hl] - ld l,a - ld de,.returnAddress + ld d, 0 + ld e, a + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld de, .returnAddress push de jp [hl] .returnAddress @@ -4570,7 +4577,7 @@ Random:: push de push bc callba Random_ - ld a,[hRandomAdd] + ld a, [hRandomAdd] pop bc pop de pop hl @@ -4623,95 +4630,95 @@ Func_3eb5:: ; 3eb5 (0:3eb5) PrintPredefTextID:: ; 3ef5 (0:3ef5) ld [H_DOWNARROWBLINKCNT2], a ; $ff8c - ld hl, PointerTable_3f22 + ld hl, TextPredefs call Func_3f0f ld hl, wcf11 set 0, [hl] call DisplayTextID Func_3f05:: ; 3f05 (0:3f05) - ld hl, W_MAPTEXTPTR ; wd36c + ld hl, W_MAPTEXTPTR ld a, [$ffec] ld [hli], a - ld a, [$ffed] + ld a, [$ffec + 1] ld [hl], a ret Func_3f0f:: ; 3f0f (0:3f0f) - ld a, [W_MAPTEXTPTR] ; wd36c + ld a, [W_MAPTEXTPTR] ld [$ffec], a ld a, [W_MAPTEXTPTR + 1] - ld [$ffed], a + ld [$ffec + 1], a ld a, l - ld [W_MAPTEXTPTR], a ; wd36c + ld [W_MAPTEXTPTR], a ld a, h ld [W_MAPTEXTPTR + 1], a ret -PointerTable_3f22:: ; 3f22 (0:3f22) - dw CardKeySuccessText ; id = 01 - dw CardKeyFailText ; id = 02 - dw RedBedroomPC ; id = 03 - dw RedBedroomSNESText ; id = 04 - dw PushStartText ; id = 05 - dw SaveOptionText ; id = 06 - dw StrengthsAndWeaknessesText ; id = 07 - dw OakLabEmailText ; id = 08 - dw AerodactylFossilText ; id = 09 - dw Route15UpstairsBinocularsText ; id = 0A - dw KabutopsFossilText ; id = 0B - dw GymStatueText1 ; id = 0C - dw GymStatueText2 ; id = 0D - dw BookcaseText ; id = 0E - dw ViridianCityPokecenterBenchGuyText ; id = 0F - dw PewterCityPokecenterBenchGuyText ; id = 10 - dw CeruleanCityPokecenterBenchGuyText ; id = 11 - dw LavenderCityPokecenterBenchGuyText ; id = 12 - dw VermilionCityPokecenterBenchGuyText ; id = 13 - dw CeladonCityPokecenterBenchGuyText ; id = 14 - dw CeladonCityHotelText ; id = 15 - dw FuchsiaCityPokecenterBenchGuyText ; id = 16 - dw CinnabarIslandPokecenterBenchGuyText ; id = 17 - dw SaffronCityPokecenterBenchGuyText ; id = 18 - dw MtMoonPokecenterBenchGuyText ; id = 19 - dw RockTunnelPokecenterBenchGuyText ; id = 1A - dw UnusedBenchGuyText1 ; id = 1B - dw UnusedBenchGuyText2 ; id = 1C - dw UnusedBenchGuyText3 ; id = 1D - dw TerminatorText_62508 ; id = 1E - dw PredefText1f ; id = 1F - dw ViridianSchoolNotebook ; id = 20 - dw ViridianSchoolBlackboard ; id = 21 - dw JustAMomentText ; id = 22 - dw PredefText23 ; id = 23 - dw FoundHiddenItemText ; id = 24 - dw HiddenItemBagFullText ; id = 25 - dw VermilionGymTrashText ; id = 26 - dw IndigoPlateauHQText ; id = 27 - dw GameCornerOutOfOrderText ; id = 28 - dw GameCornerOutToLunchText ; id = 29 - dw GameCornerSomeonesKeysText ; id = 2A - dw FoundHiddenCoinsText ; id = 2B - dw DroppedHiddenCoinsText ; id = 2C - dw BillsHouseMonitorText ; id = 2D - dw BillsHouseInitiatedText ; id = 2E - dw BillsHousePokemonList ; id = 2F - dw MagazinesText ; id = 30 - dw CinnabarGymQuiz ; id = 31 - dw GameCornerNoCoinsText ; id = 32 - dw GameCornerCoinCaseText ; id = 33 - dw LinkCableHelp ; id = 34 - dw TMNotebook ; id = 35 - dw FightingDojoText ; id = 36 - dw FightingDojoText_52a10 ; id = 37 - dw FightingDojoText_52a1d ; id = 38 - dw NewBicycleText ; id = 39 - dw IndigoPlateauStatues ; id = 3A - dw VermilionGymTrashSuccesText1 ; id = 3B - dw VermilionGymTrashSuccesText2 ; id = 3C - dw VermilionGymTrashSuccesText3 ; id = 3D - dw VermilionGymTrashFailText ; id = 3E - dw TownMapText ; id = 3F - dw BookOrSculptureText ; id = 40 - dw ElevatorText ; id = 41 - dw PokemonStuffText ; id = 42 +TextPredefs:: + dw CardKeySuccessText ; 01 + dw CardKeyFailText ; 02 + dw RedBedroomPC ; 03 + dw RedBedroomSNESText ; 04 + dw PushStartText ; 05 + dw SaveOptionText ; 06 + dw StrengthsAndWeaknessesText ; 07 + dw OakLabEmailText ; 08 + dw AerodactylFossilText ; 09 + dw Route15UpstairsBinocularsText ; 0A + dw KabutopsFossilText ; 0B + dw GymStatueText1 ; 0C + dw GymStatueText2 ; 0D + dw BookcaseText ; 0E + dw ViridianCityPokecenterBenchGuyText ; 0F + dw PewterCityPokecenterBenchGuyText ; 10 + dw CeruleanCityPokecenterBenchGuyText ; 11 + dw LavenderCityPokecenterBenchGuyText ; 12 + dw VermilionCityPokecenterBenchGuyText ; 13 + dw CeladonCityPokecenterBenchGuyText ; 14 + dw CeladonCityHotelText ; 15 + dw FuchsiaCityPokecenterBenchGuyText ; 16 + dw CinnabarIslandPokecenterBenchGuyText ; 17 + dw SaffronCityPokecenterBenchGuyText ; 18 + dw MtMoonPokecenterBenchGuyText ; 19 + dw RockTunnelPokecenterBenchGuyText ; 1A + dw UnusedBenchGuyText1 ; 1B + dw UnusedBenchGuyText2 ; 1C + dw UnusedBenchGuyText3 ; 1D + dw TerminatorText_62508 ; 1E + dw PredefText1f ; 1F + dw ViridianSchoolNotebook ; 20 + dw ViridianSchoolBlackboard ; 21 + dw JustAMomentText ; 22 + dw PredefText23 ; 23 + dw FoundHiddenItemText ; 24 + dw HiddenItemBagFullText ; 25 + dw VermilionGymTrashText ; 26 + dw IndigoPlateauHQText ; 27 + dw GameCornerOutOfOrderText ; 28 + dw GameCornerOutToLunchText ; 29 + dw GameCornerSomeonesKeysText ; 2A + dw FoundHiddenCoinsText ; 2B + dw DroppedHiddenCoinsText ; 2C + dw BillsHouseMonitorText ; 2D + dw BillsHouseInitiatedText ; 2E + dw BillsHousePokemonList ; 2F + dw MagazinesText ; 30 + dw CinnabarGymQuiz ; 31 + dw GameCornerNoCoinsText ; 32 + dw GameCornerCoinCaseText ; 33 + dw LinkCableHelp ; 34 + dw TMNotebook ; 35 + dw FightingDojoText ; 36 + dw FightingDojoText_52a10 ; 37 + dw FightingDojoText_52a1d ; 38 + dw NewBicycleText ; 39 + dw IndigoPlateauStatues ; 3A + dw VermilionGymTrashSuccesText1 ; 3B + dw VermilionGymTrashSuccesText2 ; 3C + dw VermilionGymTrashSuccesText3 ; 3D + dw VermilionGymTrashFailText ; 3E + dw TownMapText ; 3F + dw BookOrSculptureText ; 40 + dw ElevatorText ; 41 + dw PokemonStuffText ; 42 -- cgit v1.2.3 From d59dfadf66926ea0c7b5f8bbeaa9b83ee7bb3cb5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 17 Sep 2014 21:15:11 -0700 Subject: Add macros for text predefs. --- home.asm | 132 ++++++++++++++++++++++++++++++------------------------------- macros.asm | 18 +++++++++ 2 files changed, 84 insertions(+), 66 deletions(-) diff --git a/home.asm b/home.asm index 7b5c8c6b..26ce6341 100644 --- a/home.asm +++ b/home.asm @@ -4656,69 +4656,69 @@ Func_3f0f:: ; 3f0f (0:3f0f) ret TextPredefs:: - dw CardKeySuccessText ; 01 - dw CardKeyFailText ; 02 - dw RedBedroomPC ; 03 - dw RedBedroomSNESText ; 04 - dw PushStartText ; 05 - dw SaveOptionText ; 06 - dw StrengthsAndWeaknessesText ; 07 - dw OakLabEmailText ; 08 - dw AerodactylFossilText ; 09 - dw Route15UpstairsBinocularsText ; 0A - dw KabutopsFossilText ; 0B - dw GymStatueText1 ; 0C - dw GymStatueText2 ; 0D - dw BookcaseText ; 0E - dw ViridianCityPokecenterBenchGuyText ; 0F - dw PewterCityPokecenterBenchGuyText ; 10 - dw CeruleanCityPokecenterBenchGuyText ; 11 - dw LavenderCityPokecenterBenchGuyText ; 12 - dw VermilionCityPokecenterBenchGuyText ; 13 - dw CeladonCityPokecenterBenchGuyText ; 14 - dw CeladonCityHotelText ; 15 - dw FuchsiaCityPokecenterBenchGuyText ; 16 - dw CinnabarIslandPokecenterBenchGuyText ; 17 - dw SaffronCityPokecenterBenchGuyText ; 18 - dw MtMoonPokecenterBenchGuyText ; 19 - dw RockTunnelPokecenterBenchGuyText ; 1A - dw UnusedBenchGuyText1 ; 1B - dw UnusedBenchGuyText2 ; 1C - dw UnusedBenchGuyText3 ; 1D - dw TerminatorText_62508 ; 1E - dw PredefText1f ; 1F - dw ViridianSchoolNotebook ; 20 - dw ViridianSchoolBlackboard ; 21 - dw JustAMomentText ; 22 - dw PredefText23 ; 23 - dw FoundHiddenItemText ; 24 - dw HiddenItemBagFullText ; 25 - dw VermilionGymTrashText ; 26 - dw IndigoPlateauHQText ; 27 - dw GameCornerOutOfOrderText ; 28 - dw GameCornerOutToLunchText ; 29 - dw GameCornerSomeonesKeysText ; 2A - dw FoundHiddenCoinsText ; 2B - dw DroppedHiddenCoinsText ; 2C - dw BillsHouseMonitorText ; 2D - dw BillsHouseInitiatedText ; 2E - dw BillsHousePokemonList ; 2F - dw MagazinesText ; 30 - dw CinnabarGymQuiz ; 31 - dw GameCornerNoCoinsText ; 32 - dw GameCornerCoinCaseText ; 33 - dw LinkCableHelp ; 34 - dw TMNotebook ; 35 - dw FightingDojoText ; 36 - dw FightingDojoText_52a10 ; 37 - dw FightingDojoText_52a1d ; 38 - dw NewBicycleText ; 39 - dw IndigoPlateauStatues ; 3A - dw VermilionGymTrashSuccesText1 ; 3B - dw VermilionGymTrashSuccesText2 ; 3C - dw VermilionGymTrashSuccesText3 ; 3D - dw VermilionGymTrashFailText ; 3E - dw TownMapText ; 3F - dw BookOrSculptureText ; 40 - dw ElevatorText ; 41 - dw PokemonStuffText ; 42 + add_tx_pre CardKeySuccessText ; 01 + add_tx_pre CardKeyFailText ; 02 + add_tx_pre RedBedroomPC ; 03 + add_tx_pre RedBedroomSNESText ; 04 + add_tx_pre PushStartText ; 05 + add_tx_pre SaveOptionText ; 06 + add_tx_pre StrengthsAndWeaknessesText ; 07 + add_tx_pre OakLabEmailText ; 08 + add_tx_pre AerodactylFossilText ; 09 + add_tx_pre Route15UpstairsBinocularsText ; 0A + add_tx_pre KabutopsFossilText ; 0B + add_tx_pre GymStatueText1 ; 0C + add_tx_pre GymStatueText2 ; 0D + add_tx_pre BookcaseText ; 0E + add_tx_pre ViridianCityPokecenterBenchGuyText ; 0F + add_tx_pre PewterCityPokecenterBenchGuyText ; 10 + add_tx_pre CeruleanCityPokecenterBenchGuyText ; 11 + add_tx_pre LavenderCityPokecenterBenchGuyText ; 12 + add_tx_pre VermilionCityPokecenterBenchGuyText ; 13 + add_tx_pre CeladonCityPokecenterBenchGuyText ; 14 + add_tx_pre CeladonCityHotelText ; 15 + add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 16 + add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 17 + add_tx_pre SaffronCityPokecenterBenchGuyText ; 18 + add_tx_pre MtMoonPokecenterBenchGuyText ; 19 + add_tx_pre RockTunnelPokecenterBenchGuyText ; 1A + add_tx_pre UnusedBenchGuyText1 ; 1B + add_tx_pre UnusedBenchGuyText2 ; 1C + add_tx_pre UnusedBenchGuyText3 ; 1D + add_tx_pre TerminatorText_62508 ; 1E + add_tx_pre PredefText1f ; 1F + add_tx_pre ViridianSchoolNotebook ; 20 + add_tx_pre ViridianSchoolBlackboard ; 21 + add_tx_pre JustAMomentText ; 22 + add_tx_pre PredefText23 ; 23 + add_tx_pre FoundHiddenItemText ; 24 + add_tx_pre HiddenItemBagFullText ; 25 + add_tx_pre VermilionGymTrashText ; 26 + add_tx_pre IndigoPlateauHQText ; 27 + add_tx_pre GameCornerOutOfOrderText ; 28 + add_tx_pre GameCornerOutToLunchText ; 29 + add_tx_pre GameCornerSomeonesKeysText ; 2A + add_tx_pre FoundHiddenCoinsText ; 2B + add_tx_pre DroppedHiddenCoinsText ; 2C + add_tx_pre BillsHouseMonitorText ; 2D + add_tx_pre BillsHouseInitiatedText ; 2E + add_tx_pre BillsHousePokemonList ; 2F + add_tx_pre MagazinesText ; 30 + add_tx_pre CinnabarGymQuiz ; 31 + add_tx_pre GameCornerNoCoinsText ; 32 + add_tx_pre GameCornerCoinCaseText ; 33 + add_tx_pre LinkCableHelp ; 34 + add_tx_pre TMNotebook ; 35 + add_tx_pre FightingDojoText ; 36 + add_tx_pre FightingDojoText_52a10 ; 37 + add_tx_pre FightingDojoText_52a1d ; 38 + add_tx_pre NewBicycleText ; 39 + add_tx_pre IndigoPlateauStatues ; 3A + add_tx_pre VermilionGymTrashSuccesText1 ; 3B + add_tx_pre VermilionGymTrashSuccesText2 ; 3C + add_tx_pre VermilionGymTrashSuccesText3 ; 3D + add_tx_pre VermilionGymTrashFailText ; 3E + add_tx_pre TownMapText ; 3F + add_tx_pre BookOrSculptureText ; 40 + add_tx_pre ElevatorText ; 41 + add_tx_pre PokemonStuffText ; 42 diff --git a/macros.asm b/macros.asm index ca2dc82d..f219d25c 100644 --- a/macros.asm +++ b/macros.asm @@ -203,6 +203,24 @@ predef_jump: MACRO ENDM +add_tx_pre: MACRO +\1_id:: dw \1 +ENDM + +tx_pre_id: MACRO + ld a, (\1_id - TextPredefs) / 2 +ENDM + +tx_pre: MACRO + tx_pre_id \1 + call PrintPredefTextID +ENDM + +tx_pre_jump: MACRO + tx_pre_id \1 + jp PrintPredefTextID +ENDM + ;1_channel EQU $00 ;2_channels EQU $40 -- cgit v1.2.3 From f1667eb6b533eafbb5121ac605401df69960f6df Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 19 Sep 2014 13:09:37 -0700 Subject: Fix the symfile and mapfile filenames. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e3616361..20e86bb2 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ $(all_obj): $$*.tx $$(patsubst %.asm, %.tx, $$($$*_dep)) # Link objects together to build a rom. # Make a symfile for debugging. rgblink will segfault if a mapfile isn't made too. -link = rgblink -n $*.sym -m $*.map +link = rgblink -n poke$*.sym -m poke$*.map poke%.gbc: $$(%_obj) $(link) -o $@ $^ -- cgit v1.2.3