diff --git a/README.md b/README.md
index 96ce9fa2..aa15c2b1 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# banjo (90.3042%)
+# banjo (90.4260%)
diff --git a/progress/progress_core1.svg b/progress/progress_core1.svg
index c28e3a1f..d78f9e1c 100644
--- a/progress/progress_core1.svg
+++ b/progress/progress_core1.svg
@@ -9,7 +9,7 @@
-
+
@@ -17,7 +17,7 @@
core1
- 79.0887%
- 79.0887%
+ 79.9278%
+ 79.9278%
\ No newline at end of file
diff --git a/progress/progress_total.svg b/progress/progress_total.svg
index 92d3e7e4..960be9cb 100644
--- a/progress/progress_total.svg
+++ b/progress/progress_total.svg
@@ -17,7 +17,7 @@
Banjo-Kazooie (us.v10)
- 90.3042%
- 90.3042%
+ 90.4260%
+ 90.4260%
\ No newline at end of file
diff --git a/src/core1/audio/n_env.c b/src/core1/audio/n_env.c
deleted file mode 100644
index 2dc98d04..00000000
--- a/src/core1/audio/n_env.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include
-#include "functions.h"
-#include "variables.h"
-
-
-#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_env/func_80260860.s")
-
-#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_env/func_802609E0.s")
-
-#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_env/func_80260BD4.s")
-
-#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_env/n_alEnvmixerPull.s")
diff --git a/src/core1/audio/n_seq.c b/src/core1/audio/n_seq.c
deleted file mode 100644
index aaae0fc3..00000000
--- a/src/core1/audio/n_seq.c
+++ /dev/null
@@ -1,99 +0,0 @@
-#include
-#include "functions.h"
-#include "variables.h"
-
-typedef struct struct_core2_25E20_0{
- s32 unk0;
- s32 unk4;
- s32 unk8;
- s16 unkC;
- u8 padE[2];
- u8 pad10[0xA];
- s16 unk1A;
-};
-
-typedef struct struct_core2_25E20_1{
- s32 unk0;
- s32 unk4;
- s32 unk8;
- s32 unkC;
- u8 pad10[0xA];
- s16 unk1A;
-};
-
-void func_80263840(void){}
-
-void func_80263848(void){}
-
-#pragma GLOBAL_ASM("asm/nonmatchings/core1/audio/n_seq/func_80263850.s")
-
-void func_802639FC(struct struct_core2_25E20_1 *arg0, struct struct_core2_25E20_0 *arg1, u32 arg2) {
- u32 var_v0;
- s32 var_s4;
- u32 var_s6;
- s16 var_s5;
- s16 sp50;
- s32 sp4C;
- s32 sp48;
- u32 sp44;
- s32 sp40;
- s16 sp3E;
-
- if(arg2 == 0){
- arg1->unk0 = (s32) arg0->unk4;
- arg1->unkC = 0;
- arg1->unk4 = 0U;
- arg1->unk8 = 0U;
- return;
- }
-
- sp4C = arg0->unk8;
- sp3E = arg0->unk1A;
- sp44 = arg0->unkC;
- arg0->unk1A = 0;
- arg0->unkC = 0;
- arg0->unk8 = arg0->unk4;
-
- // var_v0 = 0;
- do{
- var_s4 = arg0->unk8;
- var_s5 = arg0->unk1A;
- var_s6 = arg0->unkC;
- func_80263850(arg0, &sp50);
- if(sp50 == 4){
- var_s4 = arg0->unk8;
- var_s5 = arg0->unk1A;
- var_s6 = arg0->unkC;
- break;
- }
- // var_v0 = arg0->unkC;
- }while(arg0->unkC < arg2);
-
- arg1->unk0 = var_s4;
- arg1->unkC = var_s5;
- arg1->unk4 = var_s6;
- arg1->unk8 = arg0->unkC;
-
- arg0->unk8 = sp4C;
- arg0->unk1A = sp3E;
- arg0->unkC = sp44;
-
-// var_v0 = 0;
-// loop_3:
-
-
-// if (sp50 == 4) {
-
-// } else {
-// var_v0 = arg0->unkC;
-// if (var_v0 < arg2) {
-// goto loop_3;
-// }
-// }
-
-}
-
-
-void func_80263B1C(void){}
-
-void func_80263B24(void){}
diff --git a/src/core1/done/audio/n_seq.c b/src/core1/done/audio/n_seq.c
new file mode 100644
index 00000000..ff34182a
--- /dev/null
+++ b/src/core1/done/audio/n_seq.c
@@ -0,0 +1,196 @@
+#include
+#include "functions.h"
+#include "variables.h"
+
+
+#define IFF_FILE_HDR 0x4d546864 /* 'MThd' */
+#define IFF_TRACK_HDR 0x4d54726b /* 'MTrk' */
+
+static s32 readVarLen(ALSeq *s);
+static u8 read8(ALSeq *s);
+static s16 read16(ALSeq *s);
+static s32 read32(ALSeq *s);
+
+void n_alSeqEvent(ALSeq *seq, ALEvent *event)
+{
+ u8 status;
+ s16 delta;
+ s32 len;
+ s32 deltaTicks;
+ s32 i;
+
+#ifdef _DEBUG
+ /* sct 1/17/96 - Warn if curPtr is beyond the end of sequence. */
+ if (seq->curPtr >= seq->base + seq->len)
+ __osError(ERR_ALSEQOVERRUN, 0);
+#endif
+
+ deltaTicks = readVarLen(seq); /* read the delta time */
+ seq->lastTicks += deltaTicks;
+ status = read8(seq);
+
+#if _DEBUG
+ /*
+ * System exclusives are not supported, so just skip them and read
+ * the next event
+ */
+ if ((status == 0xf0) || (status == 0xf7)) {
+ __osError(ERR_ALSEQSYSEX, 0);
+ len = readVarLen(seq);
+ for (i = 0; i < len; i++) {
+ read8(seq);
+ }
+ n_alSeqEvent(seq,event);
+ return;
+ }
+#endif
+
+ if (status == AL_MIDI_Meta) {
+ u8 type = read8(seq);
+
+ if (type == AL_MIDI_META_TEMPO) {
+ event->type = AL_TEMPO_EVT;
+ event->msg.tempo.ticks = deltaTicks;
+ event->msg.tempo.status = status;
+ event->msg.tempo.type = type;
+ event->msg.tempo.len = read8(seq);
+ event->msg.tempo.byte1 = read8(seq);
+ event->msg.tempo.byte2 = read8(seq);
+ event->msg.tempo.byte3 = read8(seq);
+ } else if (type == AL_MIDI_META_EOT) {
+ event->type = AL_SEQ_END_EVT;
+ event->msg.end.ticks = deltaTicks;
+ event->msg.end.status = status;
+ event->msg.end.type = type;
+ event->msg.end.len = read8(seq);
+ } else {
+#ifdef _DEBUG
+ __osError(ERR_ALSEQMETA, 1, type);
+ len = readVarLen(seq);
+ for (i = 0; i < len; i++) {
+ read8(seq);
+ }
+ n_alSeqEvent(seq,event);
+ return;
+#endif
+ }
+
+ seq->lastStatus = 0;
+
+ } else {
+ event->type = AL_SEQ_MIDI_EVT;
+ event->msg.midi.ticks = deltaTicks;
+ if (status & 0x80) {
+ event->msg.midi.status = status;
+ event->msg.midi.byte1 = read8(seq);
+ seq->lastStatus = status;
+ } else {
+ /* running status */
+ event->msg.midi.status = seq->lastStatus;
+ event->msg.midi.byte1 = status;
+ }
+
+ event->msg.midi.byte2 =(((event->msg.midi.status & 0xf0) != AL_MIDI_ProgramChange) && ((event->msg.midi.status & 0xf0) != AL_MIDI_ChannelPressure)) ? read8(seq) : 0;
+
+ }
+}
+
+
+void n_alSeqNewMarker(ALSeq *seq, ALSeqMarker *m, u32 ticks)
+{
+ ALEvent evt;
+ u8 *savePtr, *lastPtr;
+ s32 saveTicks, lastTicks;
+ s16 saveStatus, lastStatus;
+
+ /* does not check that ticks is within bounds */
+
+ if (ticks == 0) { /* common case */
+ m->curPtr = seq->trackStart;
+ m->lastStatus = 0;
+ m->lastTicks = 0;
+ m->curTicks = 0;
+ return;
+ } else {
+ savePtr = seq->curPtr;
+ saveStatus = seq->lastStatus;
+ saveTicks = seq->lastTicks;
+
+ seq->curPtr = seq->trackStart;
+ seq->lastStatus = 0;
+ seq->lastTicks = 0;
+
+ do {
+ lastPtr = seq->curPtr;
+ lastStatus = seq->lastStatus;
+ lastTicks = seq->lastTicks;
+
+ n_alSeqEvent(seq, &evt);
+
+ if (evt.type == AL_SEQ_END_EVT)
+ {
+ lastPtr = seq->curPtr;
+ lastStatus = seq->lastStatus;
+ lastTicks = seq->lastTicks;
+ break;
+ }
+
+ } while (seq->lastTicks < ticks);
+
+ m->curPtr = lastPtr;
+ m->lastStatus = lastStatus;
+ m->lastTicks = lastTicks;
+ m->curTicks = seq->lastTicks; /* Used by test loop condition. */
+
+ seq->curPtr = savePtr;
+ seq->lastStatus = saveStatus;
+ seq->lastTicks = saveTicks;
+
+ }
+}
+
+
+/* non-aligned byte reading routines */
+static u8 read8(ALSeq *seq)
+{
+ return *seq->curPtr++;
+}
+
+static s16 read16(ALSeq *seq)
+{
+ s16 tmp;
+
+ tmp = *seq->curPtr++ << 8;
+ tmp |= *seq->curPtr++;
+
+ return tmp;
+}
+
+static s32 read32(ALSeq *seq)
+{
+ s32 tmp;
+
+ tmp = *seq->curPtr++ << 24;
+ tmp |= *seq->curPtr++ << 16;
+ tmp |= *seq->curPtr++ << 8;
+ tmp |= *seq->curPtr++;
+
+ return tmp;
+}
+
+static s32 readVarLen(ALSeq *seq)
+{
+ s32 value;
+ s32 c;
+
+ c = *seq->curPtr++;
+ value = c;
+ if ( c & 0x80 ) {
+ value &= 0x7f;
+ do {
+ c = *seq->curPtr++;
+ value = (value << 7) + (c & 0x7f);
+ } while (c & 0x80);
+ }
+ return (value);
+}
diff --git a/src/core1/done/audio/n_seqplayer.c b/src/core1/done/audio/n_seqplayer.c
index 69b4da09..31b167d5 100644
--- a/src/core1/done/audio/n_seqplayer.c
+++ b/src/core1/done/audio/n_seqplayer.c
@@ -24,7 +24,7 @@ void __n_setInstChanState(N_ALSeqPlayer *seqp, ALInstrument *inst, s32 chan);
void __n_resetPerfChanState(N_ALSeqPlayer *seqp, s32 chan);
void __n_initChanState(N_ALSeqPlayer *seqp);
void __n_seqpStopOsc(N_ALSeqPlayer *seqp, N_ALVoiceState *vs);
-void func_80263850(ALSeq *, N_ALEvent *);
+void n_alSeqEvent(ALSeq *, N_ALEvent *);
static ALMicroTime __n_seqpVoiceHandler(void *node);
@@ -323,7 +323,7 @@ __n_handleNextSeqEvent(N_ALSeqPlayer *seqp)
if (seqp->target == NULL)
return;
- func_80263850(seqp->target, &evt);
+ n_alSeqEvent(seqp->target, &evt);
switch (evt.type)
{
diff --git a/subyaml/core1.us.v10.yaml b/subyaml/core1.us.v10.yaml
index bd9e8c08..f5993950 100644
--- a/subyaml/core1.us.v10.yaml
+++ b/subyaml/core1.us.v10.yaml
@@ -101,21 +101,21 @@ segments:
- [0x22D50, c, done/audio/n_save] #DONE
- [0x22DA0, c, done/audio/n_envresample] #DONE
- [0x22E40, c, done/audio/n_env] #DONE
- - [0x237F0, c, done/audio/n_seqplayer] #DONE
+ - [0x237F0, c, done/audio/n_seqplayer] #DONE
- [0x25360, c, done/audio/n_synstartvoiceparam] #DONE
- - [0x25440, c, done/audio/n_mainbus] #DONE
- - [0x254C0, c, done/audio/n_load] #DONE
+ - [0x25440, c, done/audio/n_mainbus] #DONE
+ - [0x254C0, c, done/audio/n_load] #DONE
- [0x25680, c, audio/n_adpcm]
- - [0x25C40, c, done/audio/n_resample] #DONE
- - [0x25E20, c, audio/n_seq]
+ - [0x25C40, c, done/audio/n_resample] #DONE
+ - [0x25E20, c, done/audio/n_seq] #DONE
- [0x26110, c, done/audio/n_synsetpriority] #DONE
- - [0x26120, asm, os/invaldcache] #DONE
- - [0x261C0, asm, os/writebackdcacheall] #DONE
- - [0x261F0, c, os/initialize] #DONE
- - [0x26480, c, done/os/createthread] #DONE
- - [0x265D0, c, done/gu/sinf] #DONE
- - [0x26790, c, done/audio/cents2ratio] #DONE
- - [0x267E0, c, done/audio/heapinit] #DONE
+ - [0x26120, asm, os/invaldcache] #DONE
+ - [0x261C0, asm, os/writebackdcacheall] #DONE
+ - [0x261F0, c, os/initialize] #DONE
+ - [0x26480, c, done/os/createthread] #DONE
+ - [0x265D0, c, done/gu/sinf] #DONE
+ - [0x26790, c, done/audio/cents2ratio] #DONE
+ - [0x267E0, c, done/audio/heapinit] #DONE
- [0x26820, asm, padding] # 0x60 bytes of zeroes?
- [0x26880, c, done/os/createmesgqueue] #DONE
- [0x268B0, c, done/io/aisetfreq] #DONE