ISSOtm / fortISSimO

A speed-and size-focused Game Boy music driver, drop-in replacement for hUGEDriver ~ Try the demo!
http://eldred.fr/fortISSimO/
Other
20 stars 3 forks source link

optimize hUGE_SelectSong #22

Open MrBlinky opened 2 weeks ago

MrBlinky commented 2 weeks ago

https://github.com/ISSOtm/fortISSimO/blob/48496a968a4458c8028785131f7d27da7238daff/fortISSimO.asm#L119-L147

optimized suggestion :

    ldh a, [hUGE_MutedChannels]
    ld hl, rNR12
    ld bc, AUDENV_UP ; B = 0
    rra
    jr c, .ch1NotOurs
    ld [hl], b
    ld [hl], c
.ch1NotOurs
    rra
    jr c, .ch2NotOurs
    ld l,rNR22 & $FF
    ld [hl], b
    ld [hl], c
.ch2NotOurs
    rra
    jr c, .ch3NotOurs
    ld l, rNR30 & $FF
    ld [hl], l ; This has bit 7 reset.
    ld [hl], h ; This has bit 7 set.
.ch3NotOurs
    rra
    jr c, .ch4NotOurs
    ld l,rNR42 & $FF
    ld [hl], b
    ld [hl], c
.ch4NotOurs
ISSOtm commented 2 weeks ago

This looks about fine, thank you! Would you like to submit a PR?

MrBlinky commented 2 weeks ago

PR submitted