SHARE
TWEET

Oxx

HertzDevil Feb 10th, 2015 224 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;;; lexicographical duty cycle prefix
  2. ;;; by HertzDevil
  3. ;;; untested on real music data
  4.  
  5. ; driver.s
  6. var_ch_DutyCycle:       .res SFX_WAVE_CHANS ;; existing
  7. var_ch_LexDuty:         .res SFX_WAVE_CHANS
  8.  
  9. ; player.s, command table
  10. ft_command_table:               ;; existing
  11.     ; ...
  12.     .word ft_cmd_dpcm_pitch     ;; existing
  13.     .word ft_cmd_lex_duty
  14.     ; update the command_t enum in
  15.     ; PatternCompiler.cpp accordingly
  16.     ; with CMD_EFF_LEX_DUTY = 29
  17.  
  18. ; player.s, effect table
  19. ft_cmd_lex_duty:
  20.     jsr ft_get_pattern_byte
  21.     sta var_ch_LexDuty, x
  22.     jmp ft_read_note
  23.  
  24. ; player.s, line 333
  25.     lda var_ch_LexDuty, x
  26.     beq :+++
  27.     cmp #$05
  28.     bcs :+
  29.     ; one frame
  30.     sbc #$00
  31.     jmp @PrepareDuty
  32. :   cmp #$15
  33.     bcs :+
  34.     ; two frames
  35.     sbc #$04
  36.     and #$03
  37.     jmp @PrepareDuty
  38. :   ; three frames
  39.     sbc #$14
  40.     and #$03
  41.     jmp @PrepareDuty
  42. :   lda var_ch_DutyCycle, x     ;; existing
  43.     and #$F0                    ;; existing
  44.     sta var_ch_DutyCycle, x     ;; existing
  45.     lsr a                       ;; existing
  46.     lsr a                       ;; existing
  47.     lsr a                       ;; existing
  48.     lsr a                       ;; existing
  49.     bpl @WriteDuty ; always
  50. @PrepareDuty:
  51.     pha
  52.     lda var_ch_DutyCycle, x
  53.     and #$F0
  54.     sta var_ch_DutyCycle, x
  55.     pla
  56. @WriteDuty:
  57.     ora var_ch_DutyCycle, x     ;; existing
  58.     sta var_ch_DutyCycle, x     ;; existing
  59.     lda var_ch_LexDuty, x
  60.     beq :+++
  61.     cmp #$05
  62.     bcs :+
  63.     lda #$00
  64.     bpl @DoneLexDuty ; always
  65. :   cmp #$15
  66.     bcs :+
  67.     sbc #$04
  68.     lsr a
  69.     lsr a
  70.     sec
  71.     adc #$04
  72.     bpl @DoneLexDuty ; always
  73. :   sbc #$14
  74.     lsr a
  75.     lsr a
  76.     sec
  77.     adc #$14
  78. @DoneLexDuty:
  79.     sta var_ch_LexDuty, x
  80. :
  81.     ; ...
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top