private void AddJASMSequence(Subroutine sub, int id) { pushJASMString(":TRK" + id); JaiEventType lastOp = JaiEventType.UNKNOWN; while (lastOp != JaiEventType.JUMP & lastOp != JaiEventType.HALT) { lastOp = sub.loadNextOp(); var state = sub.State; OpMap[sub.State.current_address] = lineMax; switch (lastOp) { case JaiEventType.DELAY: { pushJASMString("DEL " + state.delay); break; } case JaiEventType.NEW_TRACK: { trackid++; pushJASMString("NTK TRK" + trackid); subs[trackid] = new Subroutine(ref BMSData, state.track_address); break; } case JaiEventType.BANK_CHANGE: { pushJASMString("BCN " + state.voice_bank); break; } case JaiEventType.NOTE_OFF: { pushJASMString("NOF " + state.voice); break; } case JaiEventType.NOTE_ON: { pushJASMString("NON " + state.voice + "," + state.note + "," + state.vel); break; } case JaiEventType.PARAM: { pushJASMString("PAR " + state.param + "," + state.param_value); break; } case JaiEventType.PAUSE: case JaiEventType.UNKNOWN: { pushJASMString("NOP"); break; } case JaiEventType.PROG_CHANGE: { pushJASMString("PRC " + state.voice_program); break; } case JaiEventType.PERF: { pushJASMString("PRF " + state.perf + "," + state.perf_value + "," + state.perf_duration); break; } case JaiEventType.TIME_BASE: { pushJASMString("TBS " + state.bpm + "," + state.ppqn); break; } case JaiEventType.JUMP: { var addr = state.jump_address; var line = OpMap[addr]; addJump(line); pushJASMString("JMP JPOS" + jumpPosID); break; } case JaiEventType.CALL: { var sub_re = sub.nextOpAddress(); if (JaiFunMap[state.jump_address] == 0) { sub.jump(state.jump_address); AddJASMCall(sub); pushJASMString("CAL JFUN" + (JaiFunID - 1)); JaiFunMap[state.jump_address] = JaiFunID - 1; sub.jump(sub_re); } else { pushJASMString("CAL JFUN" + JaiFunMap[state.jump_address]); } break; } case JaiEventType.HALT: { pushJASMString("HAL"); break; } default: { pushJASMString("NOP"); break; } } } }