diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2019-02-17 13:19:24 -0500 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2019-02-17 13:19:24 -0500 |
commit | df4b4ee4dd3adc7d44d495e650be48434ee32c59 (patch) | |
tree | a3fa4fc3fbb3b57ca95000bac1cadd33787833f6 | |
parent | d19b13e4c22280ba8e4b394a89e9daf723729157 (diff) |
- Move assembly programming links from docs to the wiki
- Move music ID behavior from the wiki to docs
-rw-r--r-- | Add-a-new-map-and-landmark.md | 2 | ||||
-rw-r--r-- | Add-a-new-music-song.md | 2 | ||||
-rw-r--r-- | Assembly-programming.md | 23 | ||||
-rw-r--r-- | Hard-coded-logic.md | 125 | ||||
-rw-r--r-- | Links.md | 19 | ||||
-rw-r--r-- | Tutorials.md | 1 |
6 files changed, 35 insertions, 137 deletions
diff --git a/Add-a-new-map-and-landmark.md b/Add-a-new-map-and-landmark.md index fa8535b..6a87890 100644 --- a/Add-a-new-map-and-landmark.md +++ b/Add-a-new-map-and-landmark.md @@ -289,7 +289,7 @@ The `map` macro defines these different properties: - `GATE`: Indoors. Won't show pop-up location name signs. - `DUNGEON`: Indoors. Can't use the Bicycle. Can use Dig or Escape Rope just like `CAVE`. - **location:** Which landmark corresponds to the map. This affects where you appear on the Town Map and what the pop-up location name sign will say. Note that the `GLOBAL_TERMINAL` landmark hasn't been defined yet; we'll do that later. -- **music:** What music plays on the map. Some music constants can have unusual behavior; see the [hard-coded logic](Hard-coded-logic#some-high-values-for-maps-music-ids-play-incorrectly) page about that. +- **music:** What music plays on the map. Some music constants can have unusual behavior; if a map plays the wrong music, you can [correct this design flaw](../blob/master/docs/design_flaws.md#music-ids-64-and-80-or-above-have-special-behavior). - **phone service flag:** `TRUE` if Pokégear phone service is disabled, otherwise `FALSE`. - **time of day:** Controls the color palette. One of `PALETTE_AUTO`, `PALETTE_MORN`, `PALETTE_DAY`, `PALETTE_NITE`, or `PALETTE_DARK`. `PALETTE_AUTO` is based on the actual time of day. `PALETTE_DARK` requires Flash. - **fishing group:** Controls the group of wild Pokémon available by fishing. Valid fishing groups are defined in [constants/map_data_constants.asm](../blob/master/constants/map_data_constants.asm): diff --git a/Add-a-new-music-song.md b/Add-a-new-music-song.md index 20d9c42..b205a0d 100644 --- a/Add-a-new-music-song.md +++ b/Add-a-new-music-song.md @@ -94,7 +94,7 @@ Edit [audio.asm](../blob/master/audio.asm): That's it! Now you can use `MUSIC_ROUTE_47` like any other music constant—try assigning it to a map in [data/maps/maps.asm](../blob/master/data/maps/maps.asm). -There is one thing to be aware of if you plan to add a lot of new songs. Crystal's music IDs go from $00, `MUSIC_NONE`, to $66, `MUSIC_MOBILE_CENTER`. If the IDs reach $80 or above they have their high bit set and start getting interpreted differently by `GetMapMusic`. There's a full explanation and fix at the [hard-coded logic](Hard-coded-logic#some-high-values-for-maps-music-ids-play-incorrectly) page. +There is one thing to be aware of if you plan to add a lot of new songs. Crystal's music IDs go from $00, `MUSIC_NONE`, to $66, `MUSIC_MOBILE_CENTER`. If the IDs reach $80 or above they have their high bit set and start getting interpreted differently by `GetMapMusic`. There's a full explanation and fix in the [design flaws](../blob/master/docs/design_flaws.md#music-ids-64-and-80-or-above-have-special-behavior) documentation. ## 5. Composing your own music diff --git a/Assembly-programming.md b/Assembly-programming.md new file mode 100644 index 0000000..ae06829 --- /dev/null +++ b/Assembly-programming.md @@ -0,0 +1,23 @@ +- [**RGBDS documentation**][rgbds-doc]: Includes information on the RGBDS tools and the assembly language syntax. + - [**GBZ80 instructions**][gbz80-instructions]: List of CPU instructions and their effects. + - [**RGBASM features**][rgbasm-features]: How to use the assembler features: constants, labels, sections, macros, etc. + - [**RGBLINK features**][rgblink-features]: How to use the linker, including the [pokecrystal.link](/pokecrystal.link) linkerscript. +- [**ASMSchool**][asmschool]: A gameboy assembly tutorial. +- [**GB ASM Tutorial**][gb-asm-tutorial]: A newer but still in-progress asm tutorial. +- [**Pan Docs**][pan-docs]: Everything You Always Wanted To Know About GAMEBOY (but were afraid to ask). +- [**GameBoy Programming Manual**][gb-manual]: The official GameBoy programming and hardware manual by Nintendo. +- [**GameBoy Opcode Summary**][gb-opcodes]: Describes the opcodes of GameBoy assembly language. +- [**GameBoy Memory Map**][gb-memory-map]: Describes the GameBoy Color address space. +- [**awesome-gbdev**][awesome-gbdev]: A curated list of Game Boy development resources such as tools, docs, emulators, related projects and open-source ROMs. + +[rgbds-doc]: https://rednex.github.io/rgbds/ +[rgbasm-features]: https://rednex.github.io/rgbds/rgbasm.5.html +[rgblink-features]: https://rednex.github.io/rgbds/rgblink.5.html +[gbz80-instructions]: https://rednex.github.io/rgbds/gbz80.7.html +[asmschool]: http://gameboy.mongenel.com/asmschool.html +[gb-asm-tutorial]: https://eldred.fr/gb-asm-tutorial/ +[pan-docs]: http://bgb.bircd.org/pandocs.htm +[gb-manual]: https://ia801906.us.archive.org/19/items/GameBoyProgManVer1.1/GameBoyProgManVer1.1.pdf +[gb-opcodes]: http://www.devrs.com/gb/files/opcodes.html +[gb-memory-map]: http://gameboy.mongenel.com/dmg/asmmemmap.html +[awesome-gbdev]: https://github.com/avivace/awesome-gbdev diff --git a/Hard-coded-logic.md b/Hard-coded-logic.md index ce5c863..34f3975 100644 --- a/Hard-coded-logic.md +++ b/Hard-coded-logic.md @@ -7,7 +7,6 @@ Much of the game logic can be changed via the files in [data/](../blob/master/da - [Maps that don't display a location sign](#maps-that-dont-display-a-location-sign) - [Outdoor maps within indoor maps don't confuse Dig or Escape Rope](#outdoor-maps-within-indoor-maps-dont-confuse-dig-or-escape-rope) - [Landmark limits when scrolling in the Town Map](#landmark-limits-when-scrolling-in-the-town-map) -- [Some high values for maps' music IDs play incorrectly](#some-high-values-for-maps-music-ids-play-incorrectly) - [Trainer classes with different battle music](#trainer-classes-with-different-battle-music) - [`RIVAL1`'s first Pokémon has no held item](#rival1s-first-pokémon-has-no-held-item) - [`RIVAL1` and `RIVAL2` don't print their trainer class in battle](#rival1-and-rival2-dont-print-their-trainer-class-in-battle) @@ -131,130 +130,6 @@ This is caused by `InitEnemyTrainer` in [engine/battle/core.asm](../blob/master/ ``` -## Some high values for maps' music IDs play incorrectly - -If a map's music ID in [data/maps/maps.asm](../blob/master/data/maps/maps.asm) is $64 (the value of `MUSIC_MAHOGANY_MART` or `MUSIC_SUICUNE_BATTLE`) it will play either `MUSIC_ROCKET_HIDEOUT` or `MUSIC_CHERRYGROVE_CITY`. Moreover, if a map's music ID is $80 or above (the value of `RADIO_TOWER_MUSIC`) it might play `MUSIC_ROCKET_OVERTURE` or something else. - -This is caused by `GetMapMusic` in [home/map.asm](../blob/master/home/map.asm): - -```asm -GetMapMusic:: - push hl - push bc - ld de, MAP_MUSIC - call GetMapField - ld a, c - cp MUSIC_MAHOGANY_MART - jr z, .mahoganymart - bit RADIO_TOWER_MUSIC_F, c - jr nz, .radiotower - farcall Function8b342 - ld e, c - ld d, 0 -.done - pop bc - pop hl - ret - -.radiotower - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a - jr z, .clearedradiotower - ld de, MUSIC_ROCKET_OVERTURE - jr .done - -.clearedradiotower - ; the rest of the byte - ld a, c - and RADIO_TOWER_MUSIC - 1 - ld e, a - ld d, 0 - jr .done - -.mahoganymart - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F, a - jr z, .clearedmahogany - ld de, MUSIC_ROCKET_HIDEOUT - jr .done - -.clearedmahogany - ld de, MUSIC_CHERRYGROVE_CITY - jr .done -``` - -This can cause problems if you add too many new songs, or rearrange the existing ones. A solution would be to redefine the special music constants in [constants/music_constants.asm](../blob/master/constants/music_constants.asm): - -```diff --; GetMapMusic picks music for this value (see home/map.asm) --MUSIC_MAHOGANY_MART EQU $64 -+; GetMapMusic picks music for these values (see home/map.asm) -+MUSIC_MAHOGANY_MART EQU $fc -+MUSIC_RADIO_TOWER EQU $fd - - ; ExitPokegearRadio_HandleMusic uses these values - RESTART_MAP_MUSIC EQU $fe - ENTER_MAP_MUSIC EQU $ff -- --; GetMapMusic picks music for this bit flag --RADIO_TOWER_MUSIC_F EQU 7 --RADIO_TOWER_MUSIC EQU 1 << RADIO_TOWER_MUSIC_F -``` - -And then edit `GetMapMusic`: - -```diff - GetMapMusic:: - push hl - push bc - ld de, MAP_MUSIC - call GetMapField - ld a, c - cp MUSIC_MAHOGANY_MART - jr z, .mahoganymart -- bit RADIO_TOWER_MUSIC_F, c -- jr nz, .radiotower -+ cp MUSIC_RADIO_TOWER -+ jr z, .radiotower - farcall Function8b342 - ld e, c - ld d, 0 - .done - pop bc - pop hl - ret - - .radiotower - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a - jr z, .clearedradiotower - ld de, MUSIC_ROCKET_OVERTURE - jr .done - - .clearedradiotower -- ; the rest of the byte -- ld a, c -- and RADIO_TOWER_MUSIC - 1 -- ld e, a -- ld d, 0 -+ ld de, MUSIC_GOLDENROD_CITY - jr .done - - .mahoganymart - ld a, [wStatusFlags2] - bit STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F, a - jr z, .clearedmahogany - ld de, MUSIC_ROCKET_HIDEOUT - jr .done - - .clearedmahogany - ld de, MUSIC_CHERRYGROVE_CITY - jr .done -``` - -You'll also need to edit [data/maps/maps.asm](../blob/master/data/maps/maps.asm) so the Radio Tower maps use `MUSIC_RADIO_TOWER` instead of `RADIO_TOWER_MUSIC | MUSIC_GOLDENROD_CITY`. - - ## Trainer classes with different battle music This is caused by `PlayBattleMusic` in [engine/battle/start_battle.asm](../blob/master/engine/battle/start_battle.asm). The routine's logic is: @@ -1,24 +1,23 @@ -This page contains links to user-created content that could be useful for people hacking on pokecrystal. -Such content includes patches, utilities, resources, documents, and probably a bunch more. +This page contains links to user-created content that could be useful for people hacking on pokecrystal. Such content includes patches, utilities, resources, documents, and probably a bunch more. -Utilities ---------- -- [Polished Map](https://github.com/Rangi42/polished-map) - C++-based map and tileset editor. -- [Crowdmap](https://github.com/yenatch/crowdmap) - Javascript-based map and event editor. (Not updated since 2017, doesn't work with pokecrystal any more.) +## Utilities + +- [Polished Map](https://github.com/Rangi42/polished-map) - Map and tileset editor for Windows or Linux. +- [Crowdmap](https://github.com/yenatch/crowdmap) - Cross-platform map and event editor. (Not updated since 2017, doesn't work with pokecrystal any more.) - [GB Note](https://hax.iimarckus.org/topic/7113/) - ASM and MIDI music editor. - [MIDI2GSC](http://www.mediafire.com/file/je58y68i7us1ud6/GSCImport+Midi2GSC.rar) - Converts MIDI to ASM (one file per channel). Requires [gs2c.py](https://github.com/Rangi42/polishedcrystal/blob/master/utils/gs2c.py) post-processing for updated pokecrystal ASM format. - [sprites.scm](https://raw.githubusercontent.com/mid-kid/config/master/gimp/.config/GIMP/2.10/scripts/sprites.scm) - GIMP script to aid with creating a proper Pokémon sprite. - [free_space.awk](https://github.com/pret/pokecrystal/blob/master/tools/free_space.awk) - Calculates available space in the ROM from the pokecrystal.map file. -Documents ---------- + +## Documents - [Trainer AI in GSC](https://pastebin.com/EjAW76cx) - Details the behavior of the AI in human-readable form. - [Sound engine commands](Sound-engine-commands) - Describes all commands that are used by the sound engine. -Feature branches ----------------- + +## Feature branches - [pokecrystal-optimization](https://github.com/mid-kid/pokecrystal/tree/optimization) - Aims to remove all of the unused code/data. - [pokecrystal-60fps-example](https://github.com/hyperdriveguy/pokecrystal-60fps-example) - 60 fps and running shoes on vanilla pokecrystal. diff --git a/Tutorials.md b/Tutorials.md index b48b563..237384c 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -20,6 +20,7 @@ Tutorials may use diff syntax to show edits: ## Miscellaneous +- [Assembly programming](Assembly-programming) - [Tips and tricks](Tips-and-tricks) - [Useful unused data and routines](Useful-unused-data-and-routines) |