Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistaken alternative mnemonics #37

Closed
Rangi42 opened this issue Dec 5, 2024 · 8 comments · Fixed by #38
Closed

Mistaken alternative mnemonics #37

Rangi42 opened this issue Dec 5, 2024 · 8 comments · Fixed by #38

Comments

@Rangi42
Copy link

Rangi42 commented Dec 5, 2024

https://gbdev.io/gb-opcodes/optables/classic claims:

  • LDH A, [a8] has the alternative mnemonic LD A, [$FF00+a8]
  • LDH [a8], A has the alternative mnemonic LD [$FF00+a8], A

These are not true; a8 is "8-bit unsigned data", and $FF00+a8 just results in a single number $FFa8 which does not get auto-converted from LD to LDH.

@Rangi42
Copy link
Author

Rangi42 commented Dec 5, 2024

The table also shows LD [C], A / LD A, [C] as the "primary" instructions, with LD A, [$FF00+C] / LD [$FF00+C], A listed as alternative mnemonics and LDH [C], A / LDH A, [C] not even mentioned as possible. I think LDH should be "primary" with LD and $FF00+ listed as the alternatives.

@Rangi42
Copy link
Author

Rangi42 commented Dec 5, 2024

Furthermore, LDHL SP, e8 is listed as an alternative for LD HL, SP+e8, when RGBASM has never supported LDHL. (Apparently ASMotor did, but it was removed by RGBDS 0.1.0.)

@nummacway
Copy link

The table also shows LD [C], A / LD A, [C] as the "primary" instructions

Even though I usually like backwards compatibility, I would call this notation "plain wrong". To me, it suggests that it addressed $0000 to $00FF, when in fact it addresses $FF00 to $FFFF.
I agree that LDH should be the preferred syntax for consistency with what you say in OP.

@aaaaaa123456789
Copy link
Member

The ld a, [c] notation is just derived from the official syntax, I believe. But ldh a, [c] should definitely be the preferred form.

@Rangi42
Copy link
Author

Rangi42 commented Dec 6, 2024

The "official" syntax is also (deref) and ldhl and jp (hl). Given that we never even supported ldhl, maybe we should deprecate ld [c] too.

@Rangi42
Copy link
Author

Rangi42 commented Dec 6, 2024

Remaining non-deprecated redundant syntaxes as of 0.9.0:

  • ldi/ldd [hl] vs ld [hli/hld] vs ld [hl+/hl-]
  • ldh [c] vs ld [c] vs ld [$ff00+c] (but can we deprecate ld [c] too?)
  • ldh [a8] vs ld [$ff00+a8]

@ISSOtm
Copy link
Member

ISSOtm commented Dec 11, 2024

I think only the first of these ought to remain, and $ff00+c as seen in gbdev/rgbds#1567. We've deprecated the second and third bullets.

@ISSOtm ISSOtm transferred this issue from gbdev/rgbds-www Dec 11, 2024
@Rangi42
Copy link
Author

Rangi42 commented Dec 11, 2024

Yes, 0.9.0 will have deprecated ld [c] and ldh [a8]. That leaves:

  • ldi/ldd [hl] vs ld [hli/hld] vs ld [hl+/hl-] (all of which get used by someone)
  • ldh [c] vs ld [$ff00+c] (a poll found 7 votes to keep ld [$ff00+c] vs 9 to deprecate it)
  • ldh [a8] (ld [$ff00+a8] is not even an alias, just a mistaken in the docs here, and absolutely should be corrected)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants