From b460637b812f9829b69203f32e9a4f42a43070b6 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:07:17 -0500 Subject: Avoid using `EQUS` when `EQU` or `MACRO` will do (#496) --- macros/coords.asm | 42 +++++++++++++++++++++++++++++++++--------- macros/scripts/maps.asm | 12 +++++++++--- macros/scripts/text.asm | 45 +++++++++++++++++++++++++++++++++++---------- 3 files changed, 77 insertions(+), 22 deletions(-) (limited to 'macros') diff --git a/macros/coords.asm b/macros/coords.asm index 81388895..984073ed 100644 --- a/macros/coords.asm +++ b/macros/coords.asm @@ -11,9 +11,17 @@ MACRO validate_coords ENDC ENDM -DEF hlcoord EQUS "coord hl," -DEF bccoord EQUS "coord bc," -DEF decoord EQUS "coord de," +MACRO hlcoord + coord hl, \# +ENDM + +MACRO bccoord + coord bc, \# +ENDM + +MACRO decoord + coord de, \# +ENDM MACRO coord ; register, x, y[, origin] @@ -25,9 +33,17 @@ MACRO coord ENDC ENDM -DEF hlbgcoord EQUS "bgcoord hl," -DEF bcbgcoord EQUS "bgcoord bc," -DEF debgcoord EQUS "bgcoord de," +MACRO hlbgcoord + bgcoord hl, \# +ENDM + +MACRO bcbgcoord + bgcoord bc, \# +ENDM + +MACRO debgcoord + bgcoord de, \# +ENDM MACRO bgcoord ; register, x, y[, origin] @@ -39,9 +55,17 @@ MACRO bgcoord ENDC ENDM -DEF hlowcoord EQUS "owcoord hl," -DEF bcowcoord EQUS "owcoord bc," -DEF deowcoord EQUS "owcoord de," +MACRO hlowcoord + owcoord hl, \# +ENDM + +MACRO bcowcoord + owcoord bc, \# +ENDM + +MACRO deowcoord + owcoord de, \# +ENDM MACRO owcoord ; register, x, y, map width diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index b5799e64..2837d0c0 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -225,8 +225,14 @@ MACRO connection dw wOverworldMap + _win ENDM -DEF def_script_pointers EQUS "const_def" +MACRO def_script_pointers + const_def +ENDM -DEF def_text_pointers EQUS "const_def 1" +MACRO def_text_pointers + const_def 1 +ENDM -DEF object_const_def EQUS "const_def 1" +MACRO object_const_def + const_def 1 +ENDM diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index 418e839c..a848f587 100644 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -1,13 +1,38 @@ -DEF text EQUS "db TX_START," ; Start writing text. -DEF next EQUS "db \"\"," ; Move a line down. -DEF line EQUS "db \"\"," ; Start writing at the bottom line. -DEF para EQUS "db \"\"," ; Start a new paragraph. -DEF cont EQUS "db \"\"," ; Scroll to the next line. -DEF done EQUS "db \"\"" ; End a text box. -DEF prompt EQUS "db \"\"" ; Prompt the player to end a text box (initiating some other event). - -DEF page EQUS "db \"\"," ; Start a new Pokédex page. -DEF dex EQUS "db \"\", \"@\"" ; End a Pokédex entry. +MACRO text + db TX_START, \# ; Start writing text +ENDM + +MACRO next + db "", \# ; Move a line down +ENDM + +MACRO line + db "", \# ; Start writing at the bottom line +ENDM + +MACRO para + db "", \# ; Start a new paragraph +ENDM + +MACRO cont + db "", \# ; Scroll to the next line +ENDM + +MACRO done + db "" ; End a text box +ENDM + +MACRO prompt + db "" ; Prompt the player to end a text box (initiating some other event) +ENDM + +MACRO page + db "", \# ; Start a new Pokédex page +ENDM + +MACRO dex + db "@" ; End a Pokédex entry +ENDM ; TextCommandJumpTable indexes (see home/text.asm) -- cgit v1.3.1-sl0p From 617a729b0f21b542e80d8f45983d972f4c9d6ca2 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Sat, 10 May 2025 12:47:40 -0400 Subject: Use features new to RGBDS 0.9.2 (#506) --- .github/workflows/main.yml | 2 +- INSTALL.md | 20 ++++++++++---------- macros/asserts.asm | 2 +- rgbdscheck.asm | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'macros') diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55ec218d..4f1e352f 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.9.0 + ref: v0.9.2 repository: gbdev/rgbds - name: Install rgbds diff --git a/INSTALL.md b/INSTALL.md index 3eb3b34b..047dc211 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** install instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.9.0**. +Then follow the [**rgbds** install instructions](https://rgbds.gbdev.io/install#pre-built) for Windows with Cygwin to install **rgbds 0.9.2**. -**Note:** If you already have an installed rgbds older than 0.9.0, you will need to update to 0.9.0. Ignore this if you have never installed rgbds before. If a version newer than 0.9.0 does not work, try downloading 0.9.0. +**Note:** If you already have an installed rgbds older than 0.9.2, you will need to update to 0.9.2. Ignore this if you have never installed rgbds before. If a version newer than 0.9.2 does not work, try downloading 0.9.2. 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.9.0**. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#pre-built) for macOS to install **rgbds 0.9.2**. Now you're ready to [build **pokered**](#build-pokered). @@ -84,7 +84,7 @@ To install the software required for **pokered**: sudo apt-get install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.2** from source. ### OpenSUSE @@ -94,7 +94,7 @@ To install the software required for **pokered**: sudo zypper install make gcc git ``` -Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.0** from source. +Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install#building-from-source) to build **rgbds 0.9.2** from source. ### Arch Linux @@ -104,7 +104,7 @@ To install the software required for **pokered**: sudo pacman -S make gcc git 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.9.0** 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.9.2** from source. ### Termux @@ -120,7 +120,7 @@ To install **rgbds**: pkg 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.9.0** 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.9.2** from source. ### Other distros @@ -131,7 +131,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.9.0** 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.9.2** from source. Now you're ready to [build **pokered**](#build-pokered). @@ -153,8 +153,8 @@ 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.9.0 globally. Instead, you can put its files in a directory within pokered, such as `pokered/rgbds-0.9.0/`. 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.9.2 globally. Instead, you can put its files in a directory within pokered, such as `pokered/rgbds-0.9.2/`. Then specify it when you run `make`: ```bash -make RGBDS=rgbds-0.9.0/ +make RGBDS=rgbds-0.9.2/ ``` diff --git a/macros/asserts.asm b/macros/asserts.asm index 7fb7f96b..402d97dd 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -44,7 +44,7 @@ MACRO list_start ENDM MACRO li - ASSERT !STRIN(\1, "@"), STRCAT("String terminator \"@\" in list entry: ", \1) + ASSERT STRFIND(\1, "@") == -1, STRCAT("String terminator \"@\" in list entry: ", \1) db \1, "@" DEF list_index += 1 ENDM diff --git a/rgbdscheck.asm b/rgbdscheck.asm index 7cc7b0d0..9b215d5d 100644 --- a/rgbdscheck.asm +++ b/rgbdscheck.asm @@ -1,6 +1,6 @@ IF !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__) - fail "pokered requires rgbds v0.9.0 or newer." + fail "pokered requires rgbds v0.9.2 or newer." ENDC -IF __RGBDS_MAJOR__ == 0 && __RGBDS_MINOR__ < 9 - fail "pokered requires rgbds v0.9.0 or newer." +IF __RGBDS_MAJOR__ == 0 && (__RGBDS_MINOR__ < 9 || (__RGBDS_MINOR__ == 9 && __RGBDS_PATCH__ < 2)) + fail "pokered requires rgbds v0.9.2 or newer." ENDC -- cgit v1.3.1-sl0p