opcode_description.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #include "opcode_description.h"
  2. #include <stdint.h>
  3. static const OpcodeDescription opcode_desc[] =
  4. {
  5. {TE_EFFECT_ARPEGGIO, 0x7f00, "RELATIVE ARPEGGIO NOTE", ""},
  6. {TE_EFFECT_PORTAMENTO_UP, 0x7f00, "PORTAMENTO UP", "PORTUP"},
  7. {TE_EFFECT_PORTAMENTO_DOWN, 0x7f00, "PORTAMENTO DOWN", "PORTDN"},
  8. {TE_EFFECT_SLIDE, 0x7f00, "SLIDE", "SLIDE"},
  9. {TE_EFFECT_VIBRATO, 0x7f00, "VIBRATO", "VIB"},
  10. {TE_EFFECT_VOLUME_FADE, 0x7f00, "VOLUME FADE", "V.FADE"},
  11. {TE_EFFECT_SKIP_PATTERN, 0x7f00, "SKIP PATTERN", "P.SKIP"},
  12. {TE_EFFECT_EXT_NOTE_DELAY, 0x7ff0, "NOTE DELAY", "N.DEL."},
  13. {TE_EFFECT_SET_SPEED_PROG_PERIOD, 0x7f00, "SET SPEED (PROG.PER.IN PROGRAM)", "P.PER."},
  14. {TE_PROGRAM_LOOP_BEGIN, 0x7f00, "PROGRAM LOOP BEGIN", "L.BEG."},
  15. {TE_PROGRAM_LOOP_END, 0x7f00, "PROGRAM LOOP END", "L.END"},
  16. {TE_PROGRAM_NOP, 0x7fff, "NO OPERATION", ""},
  17. {TE_PROGRAM_END, 0x7fff, "PROGRAM END", "PR.END"},
  18. {TE_PROGRAM_JUMP, 0x7f00, "JUMP TO POSITION", "GOTO"},
  19. {0, 0, NULL, NULL},
  20. };
  21. char *get_opcode_description(uint16_t opcode, bool short_description)
  22. {
  23. for (int i = 0; opcode_desc[i].name != NULL; i++)
  24. {
  25. if (opcode_desc[i].opcode == (opcode & opcode_desc[i].mask))
  26. {
  27. return short_description ? opcode_desc[i].shortname : opcode_desc[i].name;
  28. }
  29. }
  30. return NULL;
  31. }