summaryrefslogtreecommitdiff
path: root/audio/engine.asm
diff options
context:
space:
mode:
Diffstat (limited to 'audio/engine.asm')
-rw-r--r--audio/engine.asm73
1 files changed, 44 insertions, 29 deletions
diff --git a/audio/engine.asm b/audio/engine.asm
index ea48825d4..12512263e 100644
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -1060,27 +1060,28 @@ ReadNoiseSample: ; e85af
; sample struct:
; [wx] [yy] [zz]
; w: ? either 2 or 3
-; x: ? 0-7
-; zzyy: pointer to sample data
-; NOTE: these seem to have $4000 added to them later
+; x: duration
+; zz: intensity
+; yy: frequency
- ; de = NoiseSampleAddress
+ ; de = [NoiseSampleAddress]
ld hl, NoiseSampleAddress
ld e, [hl]
inc hl
ld d, [hl]
+
; is it empty?
ld a, e
or d
jr z, .quit
- ; get the noise sample
+
ld a, [de]
inc de
- ; are we done?
- cp a, $ff
+
+ cp $ff
jr z, .quit
- ;
- and a, $0f ; bottom nybble
+
+ and $f
inc a
ld [$c2a2], a
ld a, [de]
@@ -1091,11 +1092,12 @@ ReadNoiseSample: ; e85af
ld [$c294], a
xor a
ld [$c295], a
- ;
+
ld hl, NoiseSampleAddress
ld [hl], e
inc hl
ld [hl], d
+
ld hl, Channel1NoteFlags - Channel1
add hl, bc
set 4, [hl]
@@ -1113,7 +1115,7 @@ ParseMusic: ; e85e1
jr c, .readnote
; then it's a command
.readcommand
- call ParseCommand
+ call ParseMusicCommand
jr ParseMusic ; start over
.readnote
@@ -1319,7 +1321,7 @@ GetNoiseSample: ; e86c5
ret
; e870f
-ParseCommand ; e870f
+ParseMusicCommand: ; e870f
; reload command
ld a, [CurMusicByte]
; get command #
@@ -1341,13 +1343,13 @@ MusicCommands: ; e8720
; pointer to each command in order
; octaves
dw MusicD0 ; octave 8
- dw MusicD0 ; octave 7
- dw MusicD0 ; octave 6
- dw MusicD0 ; octave 5
- dw MusicD0 ; octave 4
- dw MusicD0 ; octave 3
- dw MusicD0 ; octave 2
- dw MusicD0 ; octave 1
+ dw MusicD1 ; octave 7
+ dw MusicD2 ; octave 6
+ dw MusicD3 ; octave 5
+ dw MusicD4 ; octave 4
+ dw MusicD5 ; octave 3
+ dw MusicD6 ; octave 2
+ dw MusicD7 ; octave 1
dw MusicD8 ; note length + intensity
dw MusicD9 ; set starting octave
dw MusicDA ; tempo
@@ -1374,13 +1376,13 @@ MusicCommands: ; e8720
dw MusicEF ; stereo panning
dw MusicF0 ; sfx noise sampling
dw MusicF1 ; nothing
- dw MusicF1 ; nothing
- dw MusicF1 ; nothing
- dw MusicF1 ; nothing
- dw MusicF1 ; nothing
- dw MusicF1 ; nothing
- dw MusicF1 ; nothing
- dw MusicF1 ; nothing
+ dw MusicF2 ; nothing
+ dw MusicF3 ; nothing
+ dw MusicF4 ; nothing
+ dw MusicF5 ; nothing
+ dw MusicF6 ; nothing
+ dw MusicF7 ; nothing
+ dw MusicF8 ; nothing
dw MusicF9 ;
dw MusicFA ;
dw MusicFB ;
@@ -1391,6 +1393,13 @@ MusicCommands: ; e8720
; e8780
MusicF1: ; e8780
+MusicF2: ; e8780
+MusicF3: ; e8780
+MusicF4: ; e8780
+MusicF5: ; e8780
+MusicF6: ; e8780
+MusicF7: ; e8780
+MusicF8: ; e8780
ret
; e8781
@@ -1932,12 +1941,18 @@ MusicDA: ; e899a
; e89a6
MusicD0: ; e89a6
-; used by d0-d7
+MusicD1: ; e89a6
+MusicD2: ; e89a6
+MusicD3: ; e89a6
+MusicD4: ; e89a6
+MusicD5: ; e89a6
+MusicD6: ; e89a6
+MusicD7: ; e89a6
; set octave based on lo nybble of the command
ld hl, Channel1Octave - Channel1
add hl, bc
- ld a, [CurMusicByte] ; get current command
- and a, $07
+ ld a, [CurMusicByte]
+ and 7
ld [hl], a
ret
; e89b1