WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@Rangi42
Copy link
Member

@Rangi42 Rangi42 commented Nov 23, 2025

Fixes #539

@Rangi42
Copy link
Member Author

Rangi42 commented Nov 23, 2025

This is another macro like dbit that Gen 2 doesn't use often enough to be worth factoring out, if at all. (I only see the bold "VS" in pokecrystal.) Edit: git grep -niE "ld (a|b|c|d|e|\[hl\]), '[a-z]'" can help find possibilities too.

@vulcandth
Copy link
Contributor

vulcandth commented Nov 23, 2025

Using macros to output data tables is one thing; but I'm not entirely sure how I feel about outputting multiple instructions (code) using a macro in the main repos. So far the most we've done for code output in the main repos list this is things like farcall and the lb macros? Unless i'm wrong.

Mainly cause it obscures the code itself.. Would definitely use it in a hack though!

Anyways not saying no, just wanted to see your thoughts on that, oh and dannye's thoughts too! :)

@Narishma-gb
Copy link
Contributor

So far the most we've done for code output in the main repos list this is things like farcall and the lb macros?

In Gen 1, macro/events.asm does output a lot of code, with multiple IF conditions.

@vulcandth
Copy link
Contributor

So far the most we've done for code output in the main repos list this is things like farcall and the lb macros?

In Gen 1, macro/events.asm does output a lot of code, with multiple IF conditions.

I stand corrected.

@Rangi42
Copy link
Member Author

Rangi42 commented Nov 23, 2025

macros/code.asm is where we keep other such macros, including dict (which Gen 1 uses somewhere else besides home/text.asm), maskbits (not yet ported to Gen 1, and ideally would be a user-defined function like ld a, maskbits(NUM_THINGS)), jumptable, calc_sine_wave (only because it's repeated so many times), etc.

@Rangi42
Copy link
Member Author

Rangi42 commented Nov 23, 2025

Mainly cause it obscures the code itself.

Yes, but I think un-obscuring the string values is worth that cost.

Copy link
Member

@dannye dannye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it a lot 👍

@dannye dannye merged commit 308189b into pret:master Nov 24, 2025
1 check passed
@Rangi42 Rangi42 deleted the ld-hli-a-string branch November 24, 2025 04:01
SwimmingLink pushed a commit to SwimmingLink/SwimmsPokeRed that referenced this pull request Nov 29, 2025
SwimmingLink added a commit to SwimmingLink/SwimmsPokeRed that referenced this pull request Nov 29, 2025
* Use the same tools/make_patch.c as Gen 2

The `--ignore` flag is not needed in Gen 1

* Use features of RGBDS 1.0.0 (pret#537)

* Add `_vc` patch targets to `.PHONY`

* Use more hardware and graphics constants (pret#532)

- Use `OBJ_SIZE` and `TILE_SIZE` from hardware.inc.
- `SPRITESTATEDATA1_LENGTH`, `NUM_SPRITESTATEDATA_STRUCTS`
  and `TILE_1BPP_SIZE` are used in some places.
- Highlight an oversight in `OakSpeech` where several
  direct MBC bank switches are requested.
- Remove redundant comments in home/overworld.asm.
- Add unreferenced `FillBgMap` function to avoid a byte
  of dead code.
- Some constants added in wram.asm.
- Correctly separate the commented code in `SaveMainData`.

* Use `ld_hli_a_string` macro to make byte-by-byte strings more obvious (pret#540)

* Avoid magic numbers for most `CopyData` calls (pret#542)

* Use more Pokemon data constants, create MOVE_NAME_LENGTH (pret#543)

---------

Co-authored-by: Rangi42 <[email protected]>
Co-authored-by: Rangi <[email protected]>
Co-authored-by: Narishma-gb <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion: use a macro when loading strings one char a time

4 participants