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

Arpeggios disable the "length" bit in NRx4 #3

Closed
ISSOtm opened this issue Oct 24, 2022 · 1 comment
Closed

Arpeggios disable the "length" bit in NRx4 #3

ISSOtm opened this issue Oct 24, 2022 · 1 comment

Comments

@ISSOtm
Copy link
Owner

ISSOtm commented Oct 24, 2022

fortISSimO/fortISSimO.asm

Lines 1119 to 1122 in b51ebdb

ld a, 0
adc a, [hl]
; TODO: whoops, where did the ctrl mask go? But there's not enough room...
ldh [c], a

As the comment mentions, this is blocked by #2, since there isn't enough room to fit extra instructions in this code.

@ISSOtm
Copy link
Owner Author

ISSOtm commented Nov 3, 2022

Turns out the fix is fairly simple:

diff --git a/fortISSimO.asm b/fortISSimO.asm
index 298da85..71145e1 100644
--- a/fortISSimO.asm
+++ b/fortISSimO.asm
@@ -1101,12 +1101,14 @@ FxArpeggio:
 	ld hl, whUGEch1.period - whUGEch1.note
 	add hl, de
 	add a, [hl]
-	ldh [c], a
 	inc hl
+	ldh [c], a
 	inc c
-	ld a, 0
-	adc a, [hl]
-	; TODO: whoops, where did the ctrl mask go? But there's not enough room...
+	ld a, [hld]
+	adc a, 0
+	dec hl
+	assert whUGEch1.period - 1 == whUGEch1.ctrlMask
+	or [hl]
 	ldh [c], a
 	ret
 

...but hUGEDriver also overwrites the flag.

https://github.com/SuperDisk/hUGEDriver/blob/5e4c77d2abbfeb75e80b4d0da1ddc370053e1c88/hUGEDriver.asm#L1081

https://github.com/SuperDisk/hUGEDriver/blob/5e4c77d2abbfeb75e80b4d0da1ddc370053e1c88/hUGEDriver.asm#L424-L427

@ISSOtm ISSOtm closed this as completed in 09d5727 Feb 11, 2023
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

No branches or pull requests

1 participant