;;; lexicographical duty cycle prefix ;;; by HertzDevil ;;; untested on real music data ; driver.s var_ch_DutyCycle: .res SFX_WAVE_CHANS ;; existing var_ch_LexDuty: .res SFX_WAVE_CHANS ; player.s, command table ft_command_table: ;; existing ; ... .word ft_cmd_dpcm_pitch ;; existing .word ft_cmd_lex_duty ; update the command_t enum in ; PatternCompiler.cpp accordingly ; with CMD_EFF_LEX_DUTY = 29 ; player.s, effect table ft_cmd_lex_duty: jsr ft_get_pattern_byte sta var_ch_LexDuty, x jmp ft_read_note ; player.s, line 333 lda var_ch_LexDuty, x beq :+++ cmp #$05 bcs :+ ; one frame sbc #$00 jmp @PrepareDuty : cmp #$15 bcs :+ ; two frames sbc #$04 and #$03 jmp @PrepareDuty : ; three frames sbc #$14 and #$03 jmp @PrepareDuty : lda var_ch_DutyCycle, x ;; existing and #$F0 ;; existing sta var_ch_DutyCycle, x ;; existing lsr a ;; existing lsr a ;; existing lsr a ;; existing lsr a ;; existing bpl @WriteDuty ; always @PrepareDuty: pha lda var_ch_DutyCycle, x and #$F0 sta var_ch_DutyCycle, x pla @WriteDuty: ora var_ch_DutyCycle, x ;; existing sta var_ch_DutyCycle, x ;; existing lda var_ch_LexDuty, x beq :+++ cmp #$05 bcs :+ lda #$00 bpl @DoneLexDuty ; always : cmp #$15 bcs :+ sbc #$04 lsr a lsr a sec adc #$04 bpl @DoneLexDuty ; always : sbc #$14 lsr a lsr a sec adc #$14 @DoneLexDuty: sta var_ch_LexDuty, x : ; ...