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

Remove the now-redundant comments #302

Open
Rangi42 opened this issue Nov 5, 2020 · 1 comment
Open

Remove the now-redundant comments #302

Rangi42 opened this issue Nov 5, 2020 · 1 comment

Comments

@Rangi42
Copy link
Member

Rangi42 commented Nov 5, 2020

Many lines have comments that are trivial if you know the basics of GBZ80 assembly. Some also appear to have been added before functions and variables had meaningful labels. For example:

  • ldh [hMapROMBank], a ; save map ROM bank
  • call PrintStatusAilment ; print status condition
	ld a, [wListPointer]
	ld l, a
	ld a, [wListPointer + 1]
	ld h, a ; hl = address of the list

Some will also be redundant once we add more labels and constants. For example, bit 0, a ; was the A button pressed? should be bit BIT_A_BUTTON, a.

@Rangi42
Copy link
Member Author

Rangi42 commented Jan 29, 2025

Some regexes that help find many instances of redundant comments:

  • git grep -P '^\t(ld [abcdehl],|call( n?[zc],)?|j[pr]( n?[zc],)?|cp) [A-Z][A-Za-z0-9_]+ ; '
  • git grep -P '^\tldh? a, \[[whv][A-Z].+\] ; '
  • git grep -P '^\t(bit|res|set) [A-Z][A-Za-z0-9_]+, \S+ ; '

(Those turn up hundreds of lines, and many of them are false positives, useful comments that we should keep or maybe reword or occasionally turn into ASSERTs.)

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

No branches or pull requests

1 participant