// *********************************** // nas test extension // *********************************** .struct 0 VMEM_LFO: .space 1 .text .align //------------------------------------------------------------------------------ // program header //------------------------------------------------------------------------------ .global nasTestProgram nasTestProgram: .word START // program binary start .hword (END-START)/4 // program binary size .hword 0 // ??? .byte 0 // global memory alloc .byte 0 // channel memory alloc .byte 1 // voice memory alloc .byte 4 // modifier flags .align //============================================================================== START: //============================================================================== //------------------------------------------------------------------------------ // program vectors //------------------------------------------------------------------------------ .word reset-START // global:reset .word 0 // global:pulse .word 0 // global:tick .word 0 // global:user .word 0 // global:preprocess .word 0 // global:postprocess .word 0 // global:reserved1 .word 0 // global:reserved2 .word 0 // channel:reset .word 0 // channel:pulse .word 0 // channel:tick .word 0 // channel:user .word 0 // channel:reserved1 .word 0 // channel:reserved2 .word 0 // channel:reserved3 .word 0 // channel:reserved4 .word voice_newnote-START // voice:newnote .word 0 // voice:pulse .word voice_tick-START // voice:tick .word 0 // voice:user .word 0 // voice:losefocus .word 0 // voice:release .word 0 // voice:reserved1 .word 0 // voice:reserved2 .arm //============================================================================== reset: //============================================================================== mov r0, #5 add r0, #6 bx lr voice_newnote: @ reset lfo position mov r3, #0 @ strb r3, [r2, #VMEM_LFO] @ bx lr @ voice_tick: push {r0} ldrb r0, [r2, #VMEM_LFO] add r0, #3 strb r0, [r2, #VMEM_LFO] push {r1,lr} bl get_sine @mov r1, #128 @add r0, r1, r0, asr#8 pop {r1,lr} mov r0, r0, asr#12 strb r0, [r1, #4] @ mod:panning mov r0, #2<<2 strb r0, [r1, #7] @ mod:modes pop {r0} ldrb r1, [r0, #7] @ df|=panning orr r1, #4 strb r1, [r0, #7] bx lr @-------------------------------------------------------------------------- get_sine: movs r1, r0, lsr#6 ands r1, #0x3 and r0, #0x3F beq .first_4th cmp r1, #2 beq .third_4th blt .second_4th .fourth_4th: swi 0x1A0000 sub r0, #0x8000 bx lr .third_4th: swi 0x1A0000 rsb r0, r0, #0 bx lr .second_4th: swi 0x1A0000 rsb r0, r0, #0x8000 bx lr .first_4th: swi 0x1A0000 bx lr .pool .align END: