sm64

A Super Mario 64 decompilation
Log | Files | Refs | README | LICENSE

seq_macros.inc (10319B)


      1 // Macros for disassembled sequence files. This file was automatically generated by seq_decoder.py.
      2 // To regenerate it, run: ./tools/seq_decoder.py --emit-asm-macros > include/seq_macros.inc
      3 
      4 // seq commands
      5 
      6 .macro seq_testchdisabled a
      7     .byte 0x0 + \a
      8 .endm
      9 
     10 .macro seq_subvariation a=0
     11     .byte 0x50 + \a
     12 .endm
     13 
     14 .macro seq_setvariation a=0
     15     .byte 0x70 + \a
     16 .endm
     17 
     18 .macro seq_getvariation a=0
     19     .byte 0x80 + \a
     20 .endm
     21 
     22 .macro seq_startchannel a, b
     23     .byte 0x90 + \a
     24     .byte (\b - sequence_start) >> 8, (\b - sequence_start) & 0xff
     25 .endm
     26 
     27 .macro seq_subtract a
     28     .byte 0xc8
     29     .byte \a
     30 .endm
     31 
     32 .macro seq_bitand a
     33     .byte 0xc9
     34     .byte \a
     35 .endm
     36 
     37 .macro seq_setval a
     38     .byte 0xcc
     39     .byte \a
     40 .endm
     41 
     42 .macro seq_setnoteallocationpolicy a
     43     .byte 0xd0
     44     .byte \a
     45 .endm
     46 
     47 .macro seq_setshortnotedurationtable a
     48     .byte 0xd1
     49     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
     50 .endm
     51 
     52 .macro seq_setshortnotevelocitytable a
     53     .byte 0xd2
     54     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
     55 .endm
     56 
     57 .macro seq_setmutebhv a
     58     .byte 0xd3
     59     .byte \a
     60 .endm
     61 
     62 .macro seq_mute
     63     .byte 0xd4
     64 .endm
     65 
     66 .macro seq_setmutescale a
     67     .byte 0xd5
     68     .byte \a
     69 .endm
     70 
     71 .macro seq_disablechannels a
     72     .byte 0xd6
     73     .byte \a >> 8, \a & 0xff
     74 .endm
     75 
     76 .macro seq_initchannels a
     77     .byte 0xd7
     78     .byte \a >> 8, \a & 0xff
     79 .endm
     80 
     81 .macro seq_changevol a
     82     .byte 0xda
     83     .byte \a
     84 .endm
     85 
     86 .macro seq_setvol a
     87     .byte 0xdb
     88     .byte \a
     89 .endm
     90 
     91 .macro seq_addtempo a
     92     .byte 0xdc
     93     .byte \a
     94 .endm
     95 
     96 .macro seq_settempo a
     97     .byte 0xdd
     98     .byte \a
     99 .endm
    100 
    101 .macro seq_transposerel a
    102     .byte 0xde
    103     .byte \a
    104 .endm
    105 
    106 .macro seq_transpose a
    107     .byte 0xdf
    108     .byte \a
    109 .endm
    110 
    111 .macro seq_bgez a
    112     .byte 0xf5
    113     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    114 .endm
    115 
    116 .macro seq_loopend
    117     .byte 0xf7
    118 .endm
    119 
    120 .macro seq_loop a
    121     .byte 0xf8
    122     .byte \a
    123 .endm
    124 
    125 .macro seq_bltz a
    126     .byte 0xf9
    127     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    128 .endm
    129 
    130 .macro seq_beqz a
    131     .byte 0xfa
    132     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    133 .endm
    134 
    135 .macro seq_jump a
    136     .byte 0xfb
    137     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    138 .endm
    139 
    140 .macro seq_call a
    141     .byte 0xfc
    142     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    143 .endm
    144 
    145 .macro seq_delay a
    146     .byte 0xfd
    147     var \a
    148 .endm
    149 
    150 .macro seq_delay1
    151     .byte 0xfe
    152 .endm
    153 
    154 .macro seq_end
    155     .byte 0xff
    156 .endm
    157 
    158 #if defined(VERSION_SH) || defined(VERSION_CN)
    159 
    160 .macro seq_unreservenotes
    161     .byte 0xf0
    162 .endm
    163 
    164 .macro seq_reservenotes a
    165     .byte 0xf1
    166     .byte \a
    167 .endm
    168 
    169 #else
    170 
    171 #ifdef VERSION_EU
    172 
    173 .macro seq_unreservenotes
    174     .byte 0xf0
    175 .endm
    176 
    177 .macro seq_reservenotes a
    178     .byte 0xf1
    179     .byte \a
    180 .endm
    181 
    182 #else
    183 
    184 .macro seq_unreservenotes
    185     .byte 0xf1
    186 .endm
    187 
    188 .macro seq_reservenotes a
    189     .byte 0xf2
    190     .byte \a
    191 .endm
    192 
    193 #endif
    194 
    195 #endif
    196 
    197 // chan commands
    198 
    199 .macro chan_startchannel a, b
    200     .byte 0x10 + \a
    201     .byte (\b - sequence_start) >> 8, (\b - sequence_start) & 0xff
    202 .endm
    203 
    204 .macro chan_disablechannel a
    205     .byte 0x20 + \a
    206 .endm
    207 
    208 .macro chan_iowriteval2 a, b
    209     .byte 0x30 + \a
    210     .byte \b
    211 .endm
    212 
    213 .macro chan_ioreadval2 a, b
    214     .byte 0x40 + \a
    215     .byte \b
    216 .endm
    217 
    218 .macro chan_ioreadvalsub a
    219     .byte 0x50 + \a
    220 .endm
    221 
    222 .macro chan_iowriteval a
    223     .byte 0x70 + \a
    224 .endm
    225 
    226 .macro chan_dynsetlayer a
    227     .byte 0xb0 + \a
    228 .endm
    229 
    230 .macro chan_setinstr a
    231     .byte 0xc1
    232     .byte \a
    233 .endm
    234 
    235 .macro chan_setdyntable a
    236     .byte 0xc2
    237     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    238 .endm
    239 
    240 .macro chan_largenotesoff
    241     .byte 0xc3
    242 .endm
    243 
    244 .macro chan_largenoteson
    245     .byte 0xc4
    246 .endm
    247 
    248 .macro chan_dynsetdyntable
    249     .byte 0xc5
    250 .endm
    251 
    252 .macro chan_setbank a
    253     .byte 0xc6
    254     .byte \a
    255 .endm
    256 
    257 .macro chan_subtract a
    258     .byte 0xc8
    259     .byte \a
    260 .endm
    261 
    262 .macro chan_bitand a
    263     .byte 0xc9
    264     .byte \a
    265 .endm
    266 
    267 .macro chan_setmutebhv a
    268     .byte 0xca
    269     .byte \a
    270 .endm
    271 
    272 .macro chan_readseq a
    273     .byte 0xcb
    274     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    275 .endm
    276 
    277 .macro chan_setval a
    278     .byte 0xcc
    279     .byte \a
    280 .endm
    281 
    282 .macro chan_stereoheadseteffects a
    283     .byte 0xd0
    284     .byte \a
    285 .endm
    286 
    287 .macro chan_setnoteallocationpolicy a
    288     .byte 0xd1
    289     .byte \a
    290 .endm
    291 
    292 .macro chan_setsustain a
    293     .byte 0xd2
    294     .byte \a
    295 .endm
    296 
    297 .macro chan_pitchbend a
    298     .byte 0xd3
    299     .byte \a
    300 .endm
    301 
    302 .macro chan_setreverb a
    303     .byte 0xd4
    304     .byte \a
    305 .endm
    306 
    307 .macro chan_setupdatesperframe_unimplemented a
    308     .byte 0xd6
    309     .byte \a
    310 .endm
    311 
    312 .macro chan_setvibratorate a
    313     .byte 0xd7
    314     .byte \a
    315 .endm
    316 
    317 .macro chan_setvibratoextent a
    318     .byte 0xd8
    319     .byte \a
    320 .endm
    321 
    322 .macro chan_setdecayrelease a
    323     .byte 0xd9
    324     .byte \a
    325 .endm
    326 
    327 .macro chan_setenvelope a
    328     .byte 0xda
    329     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    330 .endm
    331 
    332 .macro chan_transpose a
    333     .byte 0xdb
    334     .byte \a
    335 .endm
    336 
    337 .macro chan_setpanmix a
    338     .byte 0xdc
    339     .byte \a
    340 .endm
    341 
    342 .macro chan_setpan a
    343     .byte 0xdd
    344     .byte \a
    345 .endm
    346 
    347 .macro chan_freqscale a
    348     .byte 0xde
    349     .byte \a >> 8, \a & 0xff
    350 .endm
    351 
    352 .macro chan_setvol a
    353     .byte 0xdf
    354     .byte \a
    355 .endm
    356 
    357 .macro chan_setvolscale a
    358     .byte 0xe0
    359     .byte \a
    360 .endm
    361 
    362 .macro chan_setvibratoratelinear a, b, c
    363     .byte 0xe1
    364     .byte \a
    365     .byte \b
    366     .byte \c
    367 .endm
    368 
    369 .macro chan_setvibratoextentlinear a, b, c
    370     .byte 0xe2
    371     .byte \a
    372     .byte \b
    373     .byte \c
    374 .endm
    375 
    376 .macro chan_setvibratodelay a
    377     .byte 0xe3
    378     .byte \a
    379 .endm
    380 
    381 .macro chan_dyncall
    382     .byte 0xe4
    383 .endm
    384 
    385 .macro chan_hang
    386     .byte 0xf3
    387 .endm
    388 
    389 .macro chan_bgez a
    390     .byte 0xf5
    391     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    392 .endm
    393 
    394 .macro chan_break
    395     .byte 0xf6
    396 .endm
    397 
    398 .macro chan_loopend
    399     .byte 0xf7
    400 .endm
    401 
    402 .macro chan_loop a
    403     .byte 0xf8
    404     .byte \a
    405 .endm
    406 
    407 .macro chan_bltz a
    408     .byte 0xf9
    409     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    410 .endm
    411 
    412 .macro chan_beqz a
    413     .byte 0xfa
    414     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    415 .endm
    416 
    417 .macro chan_jump a
    418     .byte 0xfb
    419     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    420 .endm
    421 
    422 .macro chan_call a
    423     .byte 0xfc
    424     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    425 .endm
    426 
    427 .macro chan_delay a
    428     .byte 0xfd
    429     var \a
    430 .endm
    431 
    432 .macro chan_delay1
    433     .byte 0xfe
    434 .endm
    435 
    436 .macro chan_end
    437     .byte 0xff
    438 .endm
    439 
    440 .macro chan_writeseq val, pos, offset
    441     .byte 0xc7, \val
    442     .byte (\pos - sequence_start + \offset) >> 8, (\pos - sequence_start + \offset) & 0xff
    443 .endm
    444 
    445 .macro chan_writeseq_nextinstr val, offset
    446     .byte 0xc7, \val
    447     .byte (writeseq\@ - sequence_start + \offset) >> 8, (writeseq\@ - sequence_start + \offset) & 0xff
    448     writeseq\@:
    449 .endm
    450 
    451 .macro layer_portamento a, b, c
    452     .byte 0xc7, \a, \b
    453     .if ((\a & 0x80) == 0)
    454         var \c
    455     .else
    456         .byte \c
    457     .endif
    458 .endm
    459 
    460 .macro chan_delay_long a
    461     .byte 0xfd
    462     var_long \a
    463 .endm
    464 
    465 #if defined(VERSION_SH) || defined(VERSION_CN)
    466 
    467 .macro chan_setnotepriority a
    468     .byte 0xe9
    469     .byte \a
    470 .endm
    471 
    472 .macro chan_unreservenotes
    473     .byte 0xf0
    474 .endm
    475 
    476 .macro chan_reservenotes a
    477     .byte 0xf1
    478     .byte \a
    479 .endm
    480 
    481 .macro chan_testlayerfinished a
    482     .byte 0x80 + \a
    483 .endm
    484 
    485 .macro chan_setlayer a, b
    486     .byte 0x88 + \a
    487     .byte (\b - sequence_start) >> 8, (\b - sequence_start) & 0xff
    488 .endm
    489 
    490 .macro chan_ioreadval a
    491     .byte 0x60 + \a
    492 .endm
    493 
    494 .macro chan_freelayer a
    495     .byte 0x90 + \a
    496 .endm
    497 
    498 #else
    499 
    500 .macro chan_testlayerfinished a
    501     .byte 0x0 + \a
    502 .endm
    503 
    504 .macro chan_ioreadval a
    505     .byte 0x80 + \a
    506 .endm
    507 
    508 .macro chan_setlayer a, b
    509     .byte 0x90 + \a
    510     .byte (\b - sequence_start) >> 8, (\b - sequence_start) & 0xff
    511 .endm
    512 
    513 .macro chan_freelayer a
    514     .byte 0xa0 + \a
    515 .endm
    516 
    517 #ifdef VERSION_EU
    518 
    519 .macro chan_setnotepriority a
    520     .byte 0xe9
    521     .byte \a
    522 .endm
    523 
    524 .macro chan_unreservenotes
    525     .byte 0xf0
    526 .endm
    527 
    528 .macro chan_reservenotes a
    529     .byte 0xf1
    530     .byte \a
    531 .endm
    532 
    533 #else
    534 
    535 .macro chan_setnotepriority a
    536     .byte 0x60 + \a
    537 .endm
    538 
    539 .macro chan_unreservenotes
    540     .byte 0xf1
    541 .endm
    542 
    543 .macro chan_reservenotes a
    544     .byte 0xf2
    545     .byte \a
    546 .endm
    547 
    548 #endif
    549 
    550 #endif
    551 
    552 // layer commands
    553 
    554 .macro layer_note0 a, b, c, d
    555     .byte 0x0 + \a
    556     var \b
    557     .byte \c
    558     .byte \d
    559 .endm
    560 
    561 .macro layer_note1 a, b, c
    562     .byte 0x40 + \a
    563     var \b
    564     .byte \c
    565 .endm
    566 
    567 .macro layer_note2 a, b, c
    568     .byte 0x80 + \a
    569     .byte \b
    570     .byte \c
    571 .endm
    572 
    573 .macro layer_delay a
    574     .byte 0xc0
    575     var \a
    576 .endm
    577 
    578 .macro layer_setshortnotevelocity a
    579     .byte 0xc1
    580     .byte \a
    581 .endm
    582 
    583 .macro layer_transpose a
    584     .byte 0xc2
    585     .byte \a
    586 .endm
    587 
    588 .macro layer_setshortnotedefaultplaypercentage a
    589     .byte 0xc3
    590     var \a
    591 .endm
    592 
    593 .macro layer_somethingon
    594     .byte 0xc4
    595 .endm
    596 
    597 .macro layer_somethingoff
    598     .byte 0xc5
    599 .endm
    600 
    601 .macro layer_setinstr a
    602     .byte 0xc6
    603     .byte \a
    604 .endm
    605 
    606 .macro layer_disableportamento
    607     .byte 0xc8
    608 .endm
    609 
    610 .macro layer_setshortnoteduration a
    611     .byte 0xc9
    612     .byte \a
    613 .endm
    614 
    615 .macro layer_setpan a
    616     .byte 0xca
    617     .byte \a
    618 .endm
    619 
    620 .macro layer_setshortnotevelocityfromtable a
    621     .byte 0xd0 + \a
    622 .endm
    623 
    624 .macro layer_setshortnotedurationfromtable a
    625     .byte 0xe0 + \a
    626 .endm
    627 
    628 .macro layer_loopend
    629     .byte 0xf7
    630 .endm
    631 
    632 .macro layer_loop a
    633     .byte 0xf8
    634     .byte \a
    635 .endm
    636 
    637 .macro layer_jump a
    638     .byte 0xfb
    639     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    640 .endm
    641 
    642 .macro layer_call a
    643     .byte 0xfc
    644     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    645 .endm
    646 
    647 .macro layer_end
    648     .byte 0xff
    649 .endm
    650 
    651 .macro layer_delay_long a
    652     .byte 0xc0
    653     var_long \a
    654 .endm
    655 
    656 .macro layer_note1_long a, b, c
    657     .byte 0x40 + \a
    658     var_long \b
    659     .byte \c
    660 .endm
    661 
    662 // envelope commands
    663 
    664 .macro envelope_disable a
    665     .byte 0x0, 0x0
    666     .byte \a >> 8, \a & 0xff
    667 .endm
    668 
    669 .macro envelope_hang a=0
    670     .byte 0xff, 0xff
    671     .byte \a >> 8, \a & 0xff
    672 .endm
    673 
    674 .macro envelope_goto a
    675     .byte 0xff, 0xfe
    676     .byte \a >> 8, \a & 0xff
    677 .endm
    678 
    679 .macro envelope_restart a=0
    680     .byte 0xff, 0xfd
    681     .byte \a >> 8, \a & 0xff
    682 .endm
    683 
    684 .macro envelope_line a, b
    685     .byte \a >> 8, \a & 0xff
    686     .byte \b >> 8, \b & 0xff
    687 .endm
    688 
    689 // other commands
    690 
    691 .macro var_long x
    692      .byte (0x80 | (\x & 0x7f00) >> 8), (\x & 0xff)
    693 .endm
    694 
    695 .macro var x
    696     .if (\x >= 0x80)
    697         var_long \x
    698     .else
    699         .byte \x
    700     .endif
    701 .endm
    702 
    703 .macro sound_ref a
    704     .byte (\a - sequence_start) >> 8, (\a - sequence_start) & 0xff
    705 .endm