Skip to content

Remove the now-redundant comments #302

Description

@Rangi42

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.

Activity

  1. Rangi42 commented on Jan 29, 2025

    @Rangi42
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions