summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-05-09 12:47:43 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2021-05-09 12:47:43 -0400
commit65d1e12d6ac15937977d28651a656ff255ea0d5d (patch)
tree53cecd90548df6957851b2341cdaf2a060d68255
parent2a9ae6ecefe12e798c15e7a37a77005f5373aa9d (diff)
Require rgbds 0.5.1
Use some new features: \<10> macro args, SECTION UNION, SIZEOF/STARTOF, and CHARLEN/CHARSUB
-rw-r--r--.travis.yml2
-rw-r--r--INSTALL.md24
-rw-r--r--data/events/npc_trades.asm5
-rw-r--r--data/pokemon/unown_words.asm4
-rw-r--r--engine/games/unown_puzzle.asm4
-rw-r--r--home/text.asm14
-rw-r--r--layout.link1
-rw-r--r--macros/legacy.asm7
-rw-r--r--macros/scripts/maps.asm19
-rw-r--r--rgbdscheck.asm4
-rwxr-xr-xtools/unnamed.py6
-rw-r--r--wram.asm97
12 files changed, 101 insertions, 86 deletions
diff --git a/.travis.yml b/.travis.yml
index b26c13d0..15dd16b9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ install:
HOMEBREW_NO_AUTO_UPDATE=1 brew install bison
export PATH="/usr/local/opt/bison/bin:$PATH"
fi
- git clone -b v0.5.0 --depth=1 https://github.com/gbdev/rgbds
+ git clone -b v0.5.1 --depth=1 https://github.com/gbdev/rgbds
sudo make -C rgbds install
rm -rf rgbds
)
diff --git a/INSTALL.md b/INSTALL.md
index 6bca1417..6706a359 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/windows) for Windows with Cygwin to install **rgbds 0.5.0**.
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/windows) for Windows with Cygwin to install **rgbds 0.5.1**.
-**Note:** If you already have an older rgbds, you will need to update to 0.5.0. Ignore this if you have never installed rgbds before. If a version newer than 0.5.0 does not work, try downloading 0.5.0.
+**Note:** If you already have an older rgbds, you will need to update to 0.5.1. Ignore this if you have never installed rgbds before. If a version newer than 0.5.1 does not work, try downloading 0.5.1.
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/macos) for macOS to install **rgbds 0.5.0**.
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/macos) for macOS to install **rgbds 0.5.1**.
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/source) to build **rgbds 0.5.0** from source.
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** 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/source) to build **rgbds 0.5.0** from source.
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** 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/arch) for Arch Linux to install **rgbds 0.5.0**.
+Then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/arch) for Arch Linux to install **rgbds 0.5.1**.
-If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.0** from source.
+If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** 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/source) to build **rgbds 0.5.0** from source.
+If you want to compile and install **rgbds** yourself instead, then follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** 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/source) to build **rgbds 0.5.0** from source.
+If `rgbds` is not available, you'll need to follow the [**rgbds** instructions](https://rgbds.gbdev.io/install/source) to build **rgbds 0.5.1** 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.0 globally. Instead, you can put its files in a directory within pokegold, such as `pokegold/rgbds-0.5.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.5.1 globally. Instead, you can put its files in a directory within pokegold, such as `pokegold/rgbds-0.5.1/`. Then specify it when you run `make`:
```bash
-make RGBDS=rgbds-0.5.0/ gold
+make RGBDS=rgbds-0.5.1/ gold
```
```bash
-make RGBDS=rgbds-0.5.0/ silver
+make RGBDS=rgbds-0.5.1/ silver
```
diff --git a/data/events/npc_trades.asm b/data/events/npc_trades.asm
index 42715df1..47352952 100644
--- a/data/events/npc_trades.asm
+++ b/data/events/npc_trades.asm
@@ -1,9 +1,8 @@
npctrade: MACRO
; dialog set, requested mon, offered mon, nickname, dvs, item, OT ID, OT name, gender requested
db \1, \2, \3, \4, \5, \6, \7
- shift
- dw \7
- db \8, \9, 0
+ dw \8
+ db \9, \<10>, 0
ENDM
NPCTrades:
diff --git a/data/pokemon/unown_words.asm b/data/pokemon/unown_words.asm
index 7c41e19a..11ddd46b 100644
--- a/data/pokemon/unown_words.asm
+++ b/data/pokemon/unown_words.asm
@@ -1,6 +1,6 @@
unownword: MACRO
-for x, STRLEN(\1)
- db STRSUB(\1, x + 1, 1) - "A" + FIRST_UNOWN_CHAR
+for n, CHARLEN(\1)
+ db CHARSUB(\1, n + 1) - "A" + FIRST_UNOWN_CHAR
endr
db -1
ENDM
diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm
index d230c534..41b33055 100644
--- a/engine/games/unown_puzzle.asm
+++ b/engine/games/unown_puzzle.asm
@@ -14,8 +14,8 @@ _UnownPuzzle:
xor a
ldh [hBGMapMode], a
call DisableLCD
- ld hl, wUnownPuzzle ; includes wPuzzlePieces
- ld bc, wUnownPuzzleEnd - wUnownPuzzle
+ ld hl, STARTOF("Miscellaneous") ; includes wPuzzlePieces
+ ld bc, SIZEOF("Miscellaneous")
xor a
call ByteFill
ld hl, UnownPuzzleCursorGFX
diff --git a/home/text.asm b/home/text.asm
index 47881803..26f73c11 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -176,24 +176,22 @@ NextChar::
CheckDict::
dict: MACRO
+assert CHARLEN(\1) == 1
if \1 == 0
and a
else
cp \1
endc
-
if ISCONST(\2)
-; Replace a character with another one
- jr nz, ._\@
+ ; Replace a character with another one
+ jr nz, .not\@
ld a, \2
-._\@:
-else
- if STRSUB("\2", 1, 1) == "."
+.not\@:
+elif STRSUB("\2", 1, 1) == "."
; Locals can use a short jump
jr z, \2
- else
+else
jp z, \2
- endc
endc
ENDM
diff --git a/layout.link b/layout.link
index 43a5d3b9..c543da32 100644
--- a/layout.link
+++ b/layout.link
@@ -269,6 +269,7 @@ WRAM0
"Sprites"
"Tilemap"
"Miscellaneous"
+ "Unused Map Buffer"
align 8
"Overworld Map"
align 4
diff --git a/macros/legacy.asm b/macros/legacy.asm
index 1c0ec2ab..8058a7ac 100644
--- a/macros/legacy.asm
+++ b/macros/legacy.asm
@@ -223,12 +223,7 @@ signpost: MACRO
ENDM
person_event: MACRO
-_s = \1
-_y = \2
-_x = \3
-_m = \4
- shift 4
- object_event _x, _y, _s, _m, \1, \2, \3, \4, \5, \6, \7, \8, \9
+ object_event \3, \2, \1, \4, \5, \6, \7, \8, \9, \<10>, \<11>, \<12>, \<13>
ENDM
PERSONTYPE_SCRIPT EQUS "OBJECTTYPE_SCRIPT"
diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm
index fc6d201b..0e952c76 100644
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -102,21 +102,16 @@ object_event: MACRO
; * if h1 == -1, h2 is treated as a time-of-day value:
; a combo of MORN, DAY, and/or NITE, or -1 to always appear
;\9: color: a PAL_NPC_* constant, or 0 for sprite default
-;\10: function: a OBJECTTYPE_* constant
-;\11: sight range: applies to OBJECTTYPE_TRAINER
-;\12: script pointer
-;\13: event flag: an EVENT_* constant, or -1 to always appear
+;\<10>: function: a OBJECTTYPE_* constant
+;\<11>: sight range: applies to OBJECTTYPE_TRAINER
+;\<12>: script pointer
+;\<13>: event flag: an EVENT_* constant, or -1 to always appear
db \3, \2 + 4, \1 + 4, \4
dn \6, \5
db \7, \8
- shift
- dn \8, \9
- shift
- db \9
- shift
- dw \9
- shift
- dw \9
+ dn \9, \<10>
+ db \<11>
+ dw \<12>, \<13>
; the dummy PlayerObjectTemplate object_event has no def_object_events
if DEF(_NUM_OBJECT_EVENTS)
{_NUM_OBJECT_EVENTS} = {_NUM_OBJECT_EVENTS} + 1
diff --git a/rgbdscheck.asm b/rgbdscheck.asm
index f86bfd0b..bdaf053e 100644
--- a/rgbdscheck.asm
+++ b/rgbdscheck.asm
@@ -1,9 +1,9 @@
MAJOR EQU 0
MINOR EQU 5
-PATCH EQU 0
+PATCH EQU 1
wrong_rgbds: MACRO
- fail "pokegold requires rgbds v0.5.0 or newer."
+ fail "pokegold requires rgbds v0.5.1 or newer."
ENDM
IF !DEF(__RGBDS_MAJOR__) || !DEF(__RGBDS_MINOR__) || !DEF(__RGBDS_PATCH__)
diff --git a/tools/unnamed.py b/tools/unnamed.py
index 70424ab1..94ec9d51 100755
--- a/tools/unnamed.py
+++ b/tools/unnamed.py
@@ -82,14 +82,14 @@ for objfile in objects:
elif magic == b'RGB9':
obj_ver = 10 + unpack_file("<I", f)[0]
- if obj_ver not in [6, 10, 11, 12, 13, 15, 16, 17]:
+ if obj_ver not in [6, 10, 11, 12, 13, 15, 16, 17, 18]:
print("Error: File '%s' is of an unknown format." % objfile, file=stderr)
exit(1)
num_symbols = unpack_file("<I", f)[0]
unpack_file("<I", f) # skip num sections
- if obj_ver in [16, 17]:
+ if obj_ver in [16, 17, 18]:
node_filenames = []
num_nodes = unpack_file("<I", f)[0]
for x in range(num_nodes):
@@ -109,7 +109,7 @@ for objfile in objects:
sym_type = symtype(unpack_file("<B", f)[0] & 0x7f)
if sym_type == symtype.IMPORT:
continue
- if obj_ver in [16, 17]:
+ if obj_ver in [16, 17, 18]:
sym_fileno = unpack_file("<I", f)[0]
sym_filename = node_filenames[sym_fileno]
else:
diff --git a/wram.asm b/wram.asm
index b4386501..c1aeb316 100644
--- a/wram.asm
+++ b/wram.asm
@@ -166,41 +166,39 @@ wTilemap::
wTilemapEnd::
-SECTION "Miscellaneous", WRAM0
-
; This union spans 480 bytes.
-UNION
+SECTION UNION "Miscellaneous", WRAM0
+
; surrounding tiles
; This buffer determines the size for the rest of the union;
; it uses exactly 480 bytes.
wSurroundingTiles:: ds SURROUNDING_WIDTH * SURROUNDING_HEIGHT
-NEXTU
+
+SECTION UNION "Miscellaneous", WRAM0
+
; box save buffer
; SaveBoxAddress uses this buffer in three steps because it
; needs more space than the buffer can hold.
wBoxPartialData:: ds 480
wBoxPartialDataEnd::
-NEXTU
+
+SECTION UNION "Miscellaneous", WRAM0
+
; 20x18 grid of 8x8 tiles
wTempTilemap::
ds SCREEN_WIDTH * SCREEN_HEIGHT
-NEXTU
-; unown puzzle
-wUnownPuzzle::
- ds 200
-wPuzzlePieces:: ds 6 * 6
- ds 244
-wUnownPuzzleEnd::
-NEXTU
+SECTION UNION "Miscellaneous", WRAM0
+
; link patch lists
wPlayerPatchLists:: ds 200
wOTPatchLists:: ds 200
-NEXTU
+
+SECTION UNION "Miscellaneous", WRAM0
; This union spans 200 bytes.
UNION
@@ -397,29 +395,36 @@ wBetaPokerSGBPals:: db
wBetaPokerSGBAttr:: db
wBetaPokerSGBCol:: db
wBetaPokerSGBRow:: db
-ENDU
+NEXTU
+; unown puzzle
+wPuzzlePieces:: ds 6 * 6
ENDU
+
+SECTION "Unused Map Buffer", WRAM0
+
; This was a buffer for map-related pointers in the 1997 G/S prototype.
; See wMapBuffer in pokegold-spaceworld's wram.asm.
wUnusedMapBuffer:: ds 24
wUnusedMapBufferEnd::
-SECTION "Overworld Map", WRAM0, ALIGN[8]
-; LCD expects wLYOverrides to have an alignment of $100
+SECTION UNION "Overworld Map", WRAM0
-UNION
; overworld map blocks
wOverworldMapBlocks:: ds 1300
wOverworldMapBlocksEnd::
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; decompress buffer in wram
wDecompressScratch:: ds 40 tiles
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; GB Printer data
wGameboyPrinterRAM::
wGameboyPrinter2bppSource:: ds 40 tiles
@@ -453,7 +458,9 @@ wPrinterExposureTime:: db
ds 16
wGameboyPrinterRAMEnd::
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; bill's pc data
wBillsPCData::
wBillsPCPokemonList::
@@ -472,27 +479,37 @@ wBillsPC_MonHasMail:: db
ds 5
wBillsPCDataEnd::
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; Hall of Fame data
wHallOfFamePokemonList:: hall_of_fame wHallOfFamePokemonList
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; debug color picker
wDebugOriginalColors:: ds 256 * 4
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; unused sprite anims
ds 4
wUnusedPikachuFrameset:: db
ds 18
wUnusedJigglypuffNoteXCoord:: db
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; raw link data
wLinkData:: ds 1300
wLinkDataEnd::
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; link data members
wLinkPlayerName:: ds NAME_LENGTH
wLinkPartyCount:: db
@@ -545,7 +562,9 @@ wLinkPatchList1:: ds SERIAL_PATCH_LIST_LENGTH
wLinkPatchList2:: ds SERIAL_PATCH_LIST_LENGTH
ENDU
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; link data prep
ds 1000
wCurLinkOTPartyMonTypePointer:: dw
@@ -556,7 +575,9 @@ for n, 1, PARTY_LENGTH + 1
wLinkOTPartyMon{d:n}Type:: dw
endr
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; link mail data
ds 500
wLinkPlayerMail::
@@ -573,13 +594,17 @@ wOTPlayerMailPatchSet:: ds 103 + SERIAL_MAIL_PREAMBLE_LENGTH
wLinkOTMailEnd::
ds 10
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; received link mail data
ds 500
wLinkReceivedMail:: ds MAIL_STRUCT_LENGTH * PARTY_LENGTH
wLinkReceivedMailEnd:: db
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; mystery gift data
wMysteryGiftStaging:: ds 80
@@ -614,7 +639,9 @@ wMysteryGiftPlayerBackupItem:: db
ds 1
wMysteryGiftPlayerDataEnd::
-NEXTU
+
+SECTION UNION "Overworld Map", WRAM0
+
; LCD expects wLYOverrides to have an alignment of $100
wLYOverrides:: ds SCREEN_HEIGHT_PX
wLYOverridesEnd::
@@ -1003,8 +1030,10 @@ wBattleEnd::
ENDU
+
IF DEF(_DEBUG)
-NEXTU
+SECTION UNION "Overworld Map", WRAM0
+
; debug room paged values
UNION
; debug room new item values
@@ -1028,9 +1057,8 @@ NEXTU
; debug room GB ID values
wDebugRoomGBID:: dw
ENDU
-ENDC
-ENDU
+ENDC
SECTION "Video", WRAM0
@@ -2511,7 +2539,6 @@ wCurBox:: db
ds 2
-; 8 chars + $50
wBoxNames:: ds BOX_NAME_LENGTH * NUM_BOXES
ds 2