From 42ba9bbbe12a4d8ef80b9215e7ed481729f93823 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 2 Oct 2022 21:52:02 -0400 Subject: [PATCH] Require rgbds 0.6.0 --- .github/workflows/main.yml | 2 +- INSTALL.md | 24 +++++------ Makefile | 34 +++++++-------- audio.asm | 3 -- data/maps/map_data.asm | 3 -- data/pokemon/dex_entries_gold.asm | 3 -- data/pokemon/dex_entries_silver.asm | 3 -- data/pokemon/egg_moves.asm | 3 -- data/pokemon/evos_attacks.asm | 3 -- data/pokemon/palettes.asm | 12 +++--- data/text/common.asm | 3 -- engine/link/mystery_gift.asm | 7 ++++ engine/movie/credits.asm | 3 -- engine/overworld/events.asm | 3 -- gfx/pics_gold.asm | 3 -- gfx/pics_silver.asm | 3 -- gfx/tilesets.asm | 2 - home.asm | 2 - home/delay.asm | 3 +- home/text.asm | 2 +- constants.asm => includes.asm | 21 +++++++++- macros.asm | 20 --------- macros/data.asm | 8 ++-- main.asm | 3 -- ram.asm | 2 - rgbdscheck.asm | 12 +++--- tools/free_space.awk | 2 +- tools/used_space.py | 64 ----------------------------- vc/pokegold.constants.asm | 2 - vc/pokesilver.constants.asm | 2 - 30 files changed, 75 insertions(+), 182 deletions(-) rename constants.asm => includes.asm (76%) delete mode 100644 macros.asm delete mode 100755 tools/used_space.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index beb23359..94d4911a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@master with: path: rgbds - ref: v0.5.2 + ref: v0.6.0 repository: gbdev/rgbds - name: Install rgbds diff --git a/INSTALL.md b/INSTALL.md index ff7d0b69..06037bb0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -42,9 +42,9 @@ Run setup and leave the default settings. At the "**Select Packages**" step, cho Double click on the text that says "**Skip**" next to each package to select the most recent version to install. -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.5.2**. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.6.0**. -**Note:** If you already have an older rgbds, you will need to update to 0.5.2. Ignore this if you have never installed rgbds before. If a version newer than 0.5.2 does not work, try downloading 0.5.2. +**Note:** If you already have an older rgbds, you will need to update to 0.6.0. Ignore this if you have never installed rgbds before. If a version newer than 0.6.0 does not work, try downloading 0.6.0. Now open the **Cygwin terminal** and enter the following commands. @@ -67,7 +67,7 @@ Install [**Homebrew**](https://brew.sh/). Follow the official instructions. Open **Terminal** and prepare to enter commands. -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.5.2**. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.6.0**. Now you're ready to [build **pokegold**](#build-pokegold). @@ -84,7 +84,7 @@ To install the software required for **pokegold**: sudo apt-get install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.5.2** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.0** from source. ### OpenSUSE @@ -94,7 +94,7 @@ To install the software required for **pokegold**: sudo zypper install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.5.2** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.0** from source. ### Arch Linux @@ -104,9 +104,9 @@ To install the software required for **pokegold**: sudo pacman -S make gcc git rgbds ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for Arch Linux to install **rgbds 0.5.2**. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for Arch Linux to install **rgbds 0.6.0**. -If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.5.2** from source. +If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.0** from source. ### Termux @@ -122,7 +122,7 @@ To install **rgbds**: sudo apt install rgbds ``` -If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.5.2** from source. +If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.0** from source. ### Other distros @@ -133,7 +133,7 @@ If your distro is not listed here, try to find the required software in its repo - `git` - `rgbds` -If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.5.2** from source. +If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.6.0** from source. Now you're ready to [build **pokegold**](#build-pokegold). @@ -167,12 +167,12 @@ make ### Build with a local rgbds version -If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.5.2 globally. Instead, you can put its files in a directory within pokegold, such as `pokegold/rgbds-0.5.2/`. Then specify it when you run `make`: +If you have different projects that require different versions of `rgbds`, it might not be convenient to install rgbds 0.6.0 globally. Instead, you can put its files in a directory within pokegold, such as `pokegold/rgbds-0.6.0/`. Then specify it when you run `make`: ```bash -make RGBDS=rgbds-0.5.2/ gold +make RGBDS=rgbds-0.6.0/ gold ``` ```bash -make RGBDS=rgbds-0.5.2/ silver +make RGBDS=rgbds-0.6.0/ silver ``` diff --git a/Makefile b/Makefile index 5aca10cb..8c13a235 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,7 @@ tools: $(MAKE) -C tools/ -RGBASMFLAGS = -L -Weverything -Wnumeric-string=2 -Wtruncation=1 +RGBASMFLAGS = -hL -Q8 -P includes.asm -Weverything -Wnumeric-string=2 -Wtruncation=1 # Create a sym/map for debug purposes if `make` run with `DEBUG=1` ifeq ($(DEBUG),1) RGBASMFLAGS += -E @@ -130,7 +130,7 @@ rgbdscheck.o: rgbdscheck.asm # As a side effect, they're evaluated immediately instead of when the rule is invoked. # It doesn't look like $(shell) can be deferred so there might not be a better way. define DEP -$1: $2 $$(shell tools/scan_includes $2) | rgbdscheck.o +$1: $2 $$(shell tools/scan_includes $2) | includes.asm rgbdscheck.o $$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$< endef @@ -167,8 +167,8 @@ $(foreach obj, $(silver_vc_excl_obj), \ $(eval $(call DEP,$(obj),$(obj:_silver_vc.o=_silver.asm)))) # Dependencies for VC files that need to run scan_includes -%.constants.sym: %.constants.asm $(shell tools/scan_includes %.constants.asm) | rgbdscheck.o - $(RGBASM) $< > $@ +%.constants.sym: %.constants.asm $(shell tools/scan_includes %.constants.asm) | includes.asm rgbdscheck.o + $(RGBASM) $(RGBASMFLAGS) $< > $@ endif @@ -197,13 +197,13 @@ include gfx/lz.mk ### Misc file-specific graphics rules -gfx/pokemon/%/front.2bpp: rgbgfx += -h -gfx/pokemon/%/front_gold.2bpp: rgbgfx += -h -gfx/pokemon/%/front_silver.2bpp: rgbgfx += -h +gfx/pokemon/%/front.2bpp: rgbgfx += -Z -c embedded +gfx/pokemon/%/front_gold.2bpp: rgbgfx += -Z -c embedded +gfx/pokemon/%/front_silver.2bpp: rgbgfx += -Z -c embedded -gfx/pokemon/%/back.2bpp: rgbgfx += -h -gfx/pokemon/%/back_gold.2bpp: rgbgfx += -h -gfx/pokemon/%/back_silver.2bpp: rgbgfx += -h +gfx/pokemon/%/back.2bpp: rgbgfx += -Z -c embedded +gfx/pokemon/%/back_gold.2bpp: rgbgfx += -Z -c embedded +gfx/pokemon/%/back_silver.2bpp: rgbgfx += -Z -c embedded gfx/pokemon/%/back_gold.2bpp: gfx/pokemon/%/back.png $(RGBGFX) $(rgbgfx) -o $@ $< @@ -215,15 +215,15 @@ gfx/pokemon/%/back_silver.2bpp: gfx/pokemon/%/back.png $(if $(tools/gfx),\ tools/gfx $(tools/gfx) -o $@ $@) -gfx/trainers/%.2bpp: rgbgfx += -h +gfx/trainers/%.2bpp: rgbgfx += -Z -c embedded gfx/intro/fire.2bpp: tools/gfx += --remove-whitespace gfx/intro/fire1.2bpp: gfx/intro/charizard1.2bpp gfx/intro/charizard2_top.2bpp gfx/intro/space.2bpp ; cat $^ > $@ gfx/intro/fire2.2bpp: gfx/intro/charizard2_bottom.2bpp gfx/intro/charizard3.2bpp ; cat $^ > $@ gfx/intro/fire3.2bpp: gfx/intro/fire.2bpp gfx/intro/unused_blastoise_venusaur.2bpp ; cat $^ > $@ -gfx/new_game/shrink1.2bpp: rgbgfx += -h -gfx/new_game/shrink2.2bpp: rgbgfx += -h +gfx/new_game/shrink1.2bpp: rgbgfx += -Z +gfx/new_game/shrink2.2bpp: rgbgfx += -Z gfx/mail/dragonite.1bpp: tools/gfx += --remove-whitespace gfx/mail/large_note.1bpp: tools/gfx += --remove-whitespace @@ -233,7 +233,7 @@ gfx/mail/litebluemail_border.1bpp: tools/gfx += --remove-whitespace gfx/pokedex/pokedex.2bpp: tools/gfx += --trim-whitespace gfx/pokedex/pokedex_sgb.2bpp: tools/gfx += --trim-whitespace -gfx/pokedex/question_mark.2bpp: rgbgfx += -h +gfx/pokedex/question_mark.2bpp: rgbgfx += -Z gfx/pokedex/slowpoke.2bpp: tools/gfx += --trim-whitespace gfx/pokegear/pokegear.2bpp: rgbgfx += -x2 @@ -277,8 +277,8 @@ gfx/battle_anims/rocks.2bpp: tools/gfx += --remove-whitespace gfx/battle_anims/skyattack.2bpp: tools/gfx += --remove-whitespace gfx/battle_anims/status.2bpp: tools/gfx += --remove-whitespace -gfx/player/chris.2bpp: rgbgfx += -h -gfx/player/chris_back.2bpp: rgbgfx += -h +gfx/player/chris.2bpp: rgbgfx += -Z +gfx/player/chris_back.2bpp: rgbgfx += -Z gfx/trainer_card/leaders.2bpp: tools/gfx += --trim-whitespace @@ -286,7 +286,7 @@ gfx/overworld/chris_fish.2bpp: tools/gfx += --trim-whitespace gfx/sprites/big_onix.2bpp: tools/gfx += --remove-whitespace --remove-xflip -gfx/battle/dude.2bpp: rgbgfx += -h +gfx/battle/dude.2bpp: rgbgfx += -Z gfx/font/unused_bold_font.1bpp: tools/gfx += --trim-whitespace diff --git a/audio.asm b/audio.asm index 2eb4ce97..c1be1a8d 100644 --- a/audio.asm +++ b/audio.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Audio", ROMX INCLUDE "audio/engine.asm" diff --git a/data/maps/map_data.asm b/data/maps/map_data.asm index 125f4474..8874deec 100644 --- a/data/maps/map_data.asm +++ b/data/maps/map_data.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Maps", ROMX INCLUDE "data/maps/scenes.asm" diff --git a/data/pokemon/dex_entries_gold.asm b/data/pokemon/dex_entries_gold.asm index 2d4a9029..f2efc354 100644 --- a/data/pokemon/dex_entries_gold.asm +++ b/data/pokemon/dex_entries_gold.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Pokedex Entries 001-064", ROMX BulbasaurPokedexEntry:: INCLUDE "data/pokemon/dex_entries/gold/bulbasaur.asm" diff --git a/data/pokemon/dex_entries_silver.asm b/data/pokemon/dex_entries_silver.asm index 0cf54646..01d3accb 100644 --- a/data/pokemon/dex_entries_silver.asm +++ b/data/pokemon/dex_entries_silver.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Pokedex Entries 001-064", ROMX BulbasaurPokedexEntry:: INCLUDE "data/pokemon/dex_entries/silver/bulbasaur.asm" diff --git a/data/pokemon/egg_moves.asm b/data/pokemon/egg_moves.asm index 9378a871..266ebfac 100644 --- a/data/pokemon/egg_moves.asm +++ b/data/pokemon/egg_moves.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Egg Moves", ROMX INCLUDE "data/pokemon/egg_move_pointers.asm" diff --git a/data/pokemon/evos_attacks.asm b/data/pokemon/evos_attacks.asm index 42ca37d4..251b5641 100644 --- a/data/pokemon/evos_attacks.asm +++ b/data/pokemon/evos_attacks.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Evolutions and Attacks", ROMX ; Evos+attacks data structure: diff --git a/data/pokemon/palettes.asm b/data/pokemon/palettes.asm index 421fa57c..86b0fc5e 100644 --- a/data/pokemon/palettes.asm +++ b/data/pokemon/palettes.asm @@ -92,9 +92,9 @@ INCBIN "gfx/pokemon/vulpix/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/vulpix/shiny.pal" INCBIN "gfx/pokemon/ninetales/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/ninetales/shiny.pal" -INCBIN "gfx/pokemon/jigglypuff/back.gbcpal", middle_colors +INCBIN "gfx/pokemon/jigglypuff/front_gold.gbcpal", middle_colors ; the back does not use all four colors INCLUDE "gfx/pokemon/jigglypuff/shiny.pal" -INCBIN "gfx/pokemon/wigglytuff/back.gbcpal", middle_colors +INCBIN "gfx/pokemon/wigglytuff/front_gold.gbcpal", middle_colors ; the back does not use all four colors INCLUDE "gfx/pokemon/wigglytuff/shiny.pal" INCBIN "gfx/pokemon/zubat/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/zubat/shiny.pal" @@ -186,7 +186,7 @@ INCBIN "gfx/pokemon/doduo/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/doduo/shiny.pal" INCBIN "gfx/pokemon/dodrio/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/dodrio/shiny.pal" -INCBIN "gfx/pokemon/seel/back.gbcpal", middle_colors +INCBIN "gfx/pokemon/seel/front_gold.gbcpal", middle_colors ; the back does not use all four colors INCLUDE "gfx/pokemon/seel/shiny.pal" INCBIN "gfx/pokemon/dewgong/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/dewgong/shiny.pal" @@ -242,7 +242,7 @@ INCBIN "gfx/pokemon/rhydon/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/rhydon/shiny.pal" INCBIN "gfx/pokemon/chansey/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/chansey/shiny.pal" -INCBIN "gfx/pokemon/tangela/back.gbcpal", middle_colors +INCBIN "gfx/pokemon/tangela/front_gold.gbcpal", middle_colors ; the back does not use all four colors INCLUDE "gfx/pokemon/tangela/shiny.pal" INCBIN "gfx/pokemon/kangaskhan/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/kangaskhan/shiny.pal" @@ -256,7 +256,7 @@ INCBIN "gfx/pokemon/seaking/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/seaking/shiny.pal" INCBIN "gfx/pokemon/staryu/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/staryu/shiny.pal" -INCBIN "gfx/pokemon/starmie/back.gbcpal", middle_colors +INCBIN "gfx/pokemon/starmie/front_gold.gbcpal", middle_colors ; the back does not use all four colors INCLUDE "gfx/pokemon/starmie/shiny.pal" INCBIN "gfx/pokemon/mr__mime/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/mr__mime/shiny.pal" @@ -382,7 +382,7 @@ INCBIN "gfx/pokemon/bellossom/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/bellossom/shiny.pal" INCBIN "gfx/pokemon/marill/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/marill/shiny.pal" -INCBIN "gfx/pokemon/azumarill/back.gbcpal", middle_colors +INCBIN "gfx/pokemon/azumarill/front_gold.gbcpal", middle_colors ; the back does not use all four colors INCLUDE "gfx/pokemon/azumarill/shiny.pal" INCBIN "gfx/pokemon/sudowoodo/back.gbcpal", middle_colors INCLUDE "gfx/pokemon/sudowoodo/shiny.pal" diff --git a/data/text/common.asm b/data/text/common.asm index d1fbb8b1..301eecb1 100644 --- a/data/text/common.asm +++ b/data/text/common.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Text 1", ROMX INCLUDE "data/text/common_1.asm" diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm index 2049b832..e927a74e 100644 --- a/engine/link/mystery_gift.asm +++ b/engine/link/mystery_gift.asm @@ -642,6 +642,7 @@ ReceiveInfraredLEDOn: xor a ldh [rIF], a halt + nop ldh a, [c] bit rRP_RECEIVING, a jr z, .recv_loop @@ -656,6 +657,7 @@ ReceiveInfraredLEDOff: xor a ldh [rIF], a halt + nop ldh a, [c] bit rRP_RECEIVING, a jr nz, .no_recv_loop @@ -672,6 +674,7 @@ SendInfraredLEDOn: xor a ldh [rIF], a halt + nop jr .wait SendInfraredLEDOff: @@ -684,6 +687,7 @@ SendInfraredLEDOff: xor a ldh [rIF], a halt + nop jr .wait InitializeIRCommunicationRoles: @@ -880,6 +884,7 @@ SendIRDataMessage: xor a ldh [rIF], a halt + nop ld a, rRP_ENABLE_READ_MASK | (1 << rRP_LED_ON) ldh [rRP], a ; Turn the LED off for longer if the bit is 1 @@ -900,6 +905,7 @@ SendIRDataMessage: xor a ldh [rIF], a halt + nop .no_halt ldh a, [hMGNumBits] dec a @@ -913,6 +919,7 @@ SendIRDataMessage: xor a ldh [rIF], a halt + nop ld d, 5 call SendInfraredLEDOn diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 14d0e886..b42d3792 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Credits", ROMX Credits:: diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index ec2bb11c..73686c29 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "Events", ROMX OverworldLoop:: diff --git a/gfx/pics_gold.asm b/gfx/pics_gold.asm index e106f505..cc31f6ae 100644 --- a/gfx/pics_gold.asm +++ b/gfx/pics_gold.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - ; PokemonPicPointers and UnownPicPointers are assumed to start at the same ; address, but in different banks. This is enforced in layout.link. diff --git a/gfx/pics_silver.asm b/gfx/pics_silver.asm index d6c77c74..e8e4cf0f 100644 --- a/gfx/pics_silver.asm +++ b/gfx/pics_silver.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - ; PokemonPicPointers and UnownPicPointers are assumed to start at the same ; address, but in different banks. This is enforced in layout.link. diff --git a/gfx/tilesets.asm b/gfx/tilesets.asm index d3fbcf0e..a897ce22 100644 --- a/gfx/tilesets.asm +++ b/gfx/tilesets.asm @@ -1,5 +1,3 @@ -INCLUDE "constants.asm" - MACRO tilecoll ; used in data/tilesets/*_collision.asm db COLL_\1, COLL_\2, COLL_\3, COLL_\4 diff --git a/home.asm b/home.asm index 9f0633e6..f8d123e6 100644 --- a/home.asm +++ b/home.asm @@ -1,5 +1,3 @@ -INCLUDE "constants.asm" - SECTION "NULL", ROM0 NULL:: diff --git a/home/delay.asm b/home/delay.asm index 4ad25ef2..ebdcccb1 100644 --- a/home/delay.asm +++ b/home/delay.asm @@ -5,7 +5,8 @@ DelayFrame:: ; Wait for the next VBlank, halting to conserve battery .halt - halt ; rgbasm adds a nop after this instruction by default + halt + nop ld a, [wVBlankOccurred] and a jr nz, .halt diff --git a/home/text.asm b/home/text.asm index b473a395..297798ec 100644 --- a/home/text.asm +++ b/home/text.asm @@ -187,7 +187,7 @@ MACRO dict jr nz, .not\@ ld a, \2 .not\@: - elif STRSUB("\2", 1, 1) == "." + elif !STRCMP(STRSUB("\2", 1, 1), ".") ; Locals can use a short jump jr z, \2 else diff --git a/constants.asm b/includes.asm similarity index 76% rename from constants.asm rename to includes.asm index 2577b08f..93823af1 100644 --- a/constants.asm +++ b/includes.asm @@ -1,6 +1,25 @@ INCLUDE "charmap.asm" -INCLUDE "macros.asm" +INCLUDE "macros/asserts.asm" +INCLUDE "macros/const.asm" +INCLUDE "macros/predef.asm" +INCLUDE "macros/farcall.asm" +INCLUDE "macros/data.asm" +INCLUDE "macros/code.asm" +INCLUDE "macros/gfx.asm" +INCLUDE "macros/coords.asm" +INCLUDE "macros/vc.asm" + +INCLUDE "macros/scripts/audio.asm" +INCLUDE "macros/scripts/maps.asm" +INCLUDE "macros/scripts/events.asm" +INCLUDE "macros/scripts/text.asm" +INCLUDE "macros/scripts/movement.asm" +INCLUDE "macros/scripts/battle_commands.asm" +INCLUDE "macros/scripts/battle_anims.asm" +INCLUDE "macros/scripts/oam_anims.asm" + +INCLUDE "macros/legacy.asm" INCLUDE "constants/hardware_constants.asm" INCLUDE "constants/deco_constants.asm" diff --git a/macros.asm b/macros.asm deleted file mode 100644 index 20d9c530..00000000 --- a/macros.asm +++ /dev/null @@ -1,20 +0,0 @@ -INCLUDE "macros/asserts.asm" -INCLUDE "macros/const.asm" -INCLUDE "macros/predef.asm" -INCLUDE "macros/farcall.asm" -INCLUDE "macros/data.asm" -INCLUDE "macros/code.asm" -INCLUDE "macros/gfx.asm" -INCLUDE "macros/coords.asm" -INCLUDE "macros/vc.asm" - -INCLUDE "macros/scripts/audio.asm" -INCLUDE "macros/scripts/maps.asm" -INCLUDE "macros/scripts/events.asm" -INCLUDE "macros/scripts/text.asm" -INCLUDE "macros/scripts/movement.asm" -INCLUDE "macros/scripts/battle_commands.asm" -INCLUDE "macros/scripts/battle_anims.asm" -INCLUDE "macros/scripts/oam_anims.asm" - -INCLUDE "macros/legacy.asm" diff --git a/macros/data.asm b/macros/data.asm index 041ed3a3..9b19dbcc 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -105,10 +105,8 @@ MACRO bcd ENDM MACRO sine_table -; \1 samples of sin(x) from x=0 to x<32768 (pi radians) - DEF x = 0 - rept \1 - dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up - DEF x += DIV(32768, \1) ; a circle has 65536 "degrees" +; \1 samples of sin(x) from x=0 to x<0.5 turns (pi radians) + for x, \1 + dw sin(x * 0.5 / (\1)) endr ENDM diff --git a/main.asm b/main.asm index ea0ca836..8679154d 100644 --- a/main.asm +++ b/main.asm @@ -1,6 +1,3 @@ -INCLUDE "constants.asm" - - SECTION "bank1", ROMX INCLUDE "engine/link/place_waiting_text.asm" diff --git a/ram.asm b/ram.asm index 077ae799..cfeb5997 100644 --- a/ram.asm +++ b/ram.asm @@ -1,5 +1,3 @@ -INCLUDE "constants.asm" - INCLUDE "macros/ram.asm" diff --git a/rgbdscheck.asm b/rgbdscheck.asm index 42e22ea8..7f278ebe 100644 --- a/rgbdscheck.asm +++ b/rgbdscheck.asm @@ -1,18 +1,16 @@ MAJOR EQU 0 -MINOR EQU 5 -PATCH EQU 2 +MINOR EQU 6 +PATCH EQU 0 -MACRO wrong_rgbds - fail "pokegold requires rgbds v0.5.2 or newer." -ENDM +WRONG_RGBDS EQUS "fail \"pokegold requires rgbds v0.6.0 or newer.\"" IF !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__) - wrong_rgbds + WRONG_RGBDS ELSE IF (__RGBDS_MAJOR__ < MAJOR) || \ (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ < MINOR) || \ (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ == MINOR && __RGBDS_PATCH__ < PATCH) || \ (__RGBDS_MAJOR__ == MAJOR && __RGBDS_MINOR__ == MINOR && __RGBDS_PATCH__ == PATCH && DEF(__RGBDS_RC__)) - wrong_rgbds + WRONG_RGBDS ENDC ENDC diff --git a/tools/free_space.awk b/tools/free_space.awk index 45984ca7..2de11cc0 100755 --- a/tools/free_space.awk +++ b/tools/free_space.awk @@ -39,7 +39,7 @@ function register_bank(amount) { } } -rom_bank && toupper($0) ~ /^[ \t]*EMPTY/ { +rom_bank && toupper($0) ~ /^[ \t]*EMPTY$/ { # Empty bank register_bank(16384) } diff --git a/tools/used_space.py b/tools/used_space.py deleted file mode 100755 index 89a1be44..00000000 --- a/tools/used_space.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -""" -Usage: python used_space.py [pokegold.map] [used_space.png] - -Generate a PNG visualizing the space used by each bank in the ROM. -""" - -import sys -from colorsys import hls_to_rgb - -import png -from mapreader import MapReader - -def main(): - mapfile = sys.argv[1] if len(sys.argv) >= 2 else 'pokegold.map' - outfile = sys.argv[2] if len(sys.argv) >= 3 else 'used_space.png' - - num_banks = 0x80 - bank_mask = 0x3FFF - bank_size = 0x4000 # bytes - - bpp = 8 # bytes per pixel - height = 256 # pixels - assert bank_size % bpp == 0 and (bank_size // bpp) % height == 0 - - pixels_per_bank = bank_size // bpp # 2048 pixels - bank_width = pixels_per_bank // height # 8 pixels - width = bank_width * num_banks # 1024 pixels - - reader = MapReader() - with open(mapfile, 'r', encoding='utf-8') as file: - reader.read_map_data(file.readlines()) - - hit_data = [] - default_bank_data = {'sections': [], 'used': 0, 'slack': bank_size} - for bank in range(num_banks): - hits = [0] * pixels_per_bank - bank_data = reader.bank_data['ROM0 bank' if bank == 0 else 'ROMX bank'] - data = bank_data.get(bank, default_bank_data) - for s in data['sections']: - beg = s['beg'] & bank_mask - end = s['end'] & bank_mask - for i in range(beg, end + 1): - hits[i // bpp] += 1 - hit_data.append(hits) - - pixels = [[(0xFF, 0xFF, 0xFF)] * width for _ in range(height)] - for bank, hits in enumerate(hit_data): - hue = 0 if bank == 0 else 210 if bank % 2 else 270 - for i, hit in enumerate(hits): - x, y = i % bank_width + bank * bank_width, i // bank_width - hls = (hue / 360, 1 - (85 * hit / bpp) / 100, 1) - rgb = tuple(int(c * 0xFF) for c in hls_to_rgb(*hls)) - pixels[y][x] = rgb - - png_data = [tuple(c for pixel in row for c in pixel) for row in pixels] - with open(outfile, 'wb') as file: - writer = png.Writer(width, height, greyscale=False, bitdepth=8, compression=9) - writer.write(file, png_data) - -if __name__ == '__main__': - main() diff --git a/vc/pokegold.constants.asm b/vc/pokegold.constants.asm index 03aae1a6..a5b30e2f 100644 --- a/vc/pokegold.constants.asm +++ b/vc/pokegold.constants.asm @@ -1,5 +1,3 @@ -INCLUDE "constants.asm" - ; These are all the asm constants needed to make the gold_vc patch. MACRO vc_const diff --git a/vc/pokesilver.constants.asm b/vc/pokesilver.constants.asm index 372a368b..31d92789 100644 --- a/vc/pokesilver.constants.asm +++ b/vc/pokesilver.constants.asm @@ -1,5 +1,3 @@ -INCLUDE "constants.asm" - ; These are all the asm constants needed to make the silver_vc patch. MACRO vc_const