The Unofficial Access Virus & Virus TI Forum - since 2002

The Unofficial Access Virus & Virus TI Forum - since 2002 (http://www.infekted.org/virus/forum.php)
-   General discussion about Access Virus (http://www.infekted.org/virus/forumdisplay.php?f=105)
-   -   What code do thy use to make the Virus? (http://www.infekted.org/virus/showthread.php?t=25248)

Juho L 19.03.2005 11:46 AM

Quote:

Originally Posted by hatembr
sounds, pictures, videos, text, windows all that doesn't really exist at a low-level speaking. They are all sequences of instructions the CPU executes, to reflect a virtual image on your screen.

Or we might say that any kind of data can be presented as numbers - This is why Gauss said maths is the queen of sciences. For example pictures can be presented with raw numbers like coordinates + colour code. The instructions to read the data or what to do with the data is not contained in the picture data. Messing the picture data with isntructions would be silly. Naturally there are tags in the start and/or end of a data area to tell the possible preferences of the data (like packing method, size, etc).

Quote:

As far as sounds go, after a long analyzing phase (the hardest work), they can be translated into instructions the CPU in the virus executes and sends to the appropriate part of the machine to make it audibale.
But at the beginning, it is just a set of instructions.
Easier to say that sounds are waves, and waves can be presented as continuous functions (I assume functions are familiar to everyone from school), and, as Mr.Fourier proved, any continuous function can be divided into a finite number of sine and cosine components. All computer audio is more or less based on Fourier analysis either dividing incoming audio to components or reconstructing audo from components.

Juho L 19.03.2005 11:51 AM

Quote:

Originally Posted by jasedee
and am having to get my head around Binary, hexidecimal, learning that all mathematics in binary are performed by addition (what a headfuck!!

It's fairly easy when you get hang of it. Just spend some free time on those things and you save lots of time in the future. I recommend that you always transform binary values to hexadecimal to ease up (and shorten) the calculations and then transform the result back to binary.

Quote:

And then there's the electronics side of things......jeez!
My favourite! Call me geek, but there's nothing more fun (besides music) than design & build computer controlled electronic devices. Shucks that I don't have chip programming boards and PCB stuff around... Maybe I should get those and start building stuff again for that synth project.

Nigel Harkness 19.03.2005 12:02 PM

Quote:

Originally Posted by jasedee
that synth project.

:?: :?: :?:

Do tell, what project?

DIGITAL SCREAMS 19.03.2005 12:43 PM

Truth is guys....i think ive discovered what i want to do in life. Build analog synths weeeeee

DS

hatembr 19.03.2005 12:53 PM

Quote:

Originally Posted by Juho L
...and this way we get a EPROM full of ASCII characters. Yay! As someone pointed out, the code is just a pseudo language that coding would be easier for humans. To make computer to execute the program, the code has to be translated (compiling, building, linking...) to create a binary code.


:D

yeah it's me, I said it is just a symbolic representation of binary instructions, but in that example (the first one), it is true i didn't mention the compiling phase, (which is quite important :) btw)

dries 19.03.2005 03:35 PM

for that kind of stuff you use c with lots of inline assembler.

every dsp has its own tricks and trouble.

you need some sollid hardware knowledge too, to understand all that stuff.

here some code for a reverb section:

/******************************************************************************** ****************
* *
* Reverberation Audio Effect program as described by James A. Moorer in *
* "About This Reverberation Business," Computer Music Journal, *
* Vol. 3, No. 2, pp. 13-28, 1979. *
* *
* Based on reference code created for the ADSP-2181 EZ-KIT Lite *
* by Brian C. Neunaber, St. Louis Music Electronics *
* *
* Created for the 21065L EZ-LAB Evaluation Platform to include on-the-fly selection *
* of reverb comb filter gains/lengths, ER gain/length presets, and left/right panning *
* via IRQ1 or RS232 control *
* John Tomarakos *
* ADI DSP Applications *
* Revision 3.0 *
* 9/30/98 *
* *
******************************************************************************** *****************/

/* ADSP-21060 System Register bit definitions */
#include "def21065l.h"
#include "new65Ldefs.h"

.GLOBAL Digital_Reverberator;
.GLOBAL Init_Reverb_Buffers;
.GLOBAL change_reverb_settings;
.EXTERN Left_Channel_In;
.EXTERN Right_Channel_In;
.EXTERN Left_Channel_Out;
.EXTERN Right_Channel_Out;



/* Reverb DM Variables and pointers */
.segment /dm rev_vars;
.VAR reverb_result;
.VAR er_output;
.VAR all_pass_ptr;
.VAR early_refl_ptr;
.VAR comb1_ptr;
.VAR comb2_ptr;
.VAR comb3_ptr;
.VAR comb4_ptr;
.VAR comb5_ptr;
.VAR comb6_ptr;
.VAR comb1_lpf_state;
.VAR comb2_lpf_state;
.VAR comb3_lpf_state;
.VAR comb4_lpf_state;
.VAR comb5_lpf_state;
.VAR comb6_lpf_state;
.VAR comb_output[6];
.VAR all_pass[336]; /* 7 ms, rounded to prime number */
.VAR early_refl[3520];
.endseg;


/* comb lengths are rounded to nearest prime number */
#define C1_LENGTH 1915 /* 1915 */ /* 40 ms @ 48 KHz} */
#define C2_LENGTH 2121 /* 2121 */ /* 44 ms */
#define C3_LENGTH 2300 /* 2300 */ /* 48 ms */
#define C4_LENGTH 2496 /* 2496 */ /* 52 ms */
#define C5_LENGTH 2685 /* 2685 */ /* 56 ms */
#define C6_LENGTH 2881 /* 2881 */ /* 60 ms */

/* -------------DATA MEMORY COMB FILTER BUFFERS ---------------------------------*/
.segment /dm dm_revrb;
.VAR comb1[C1_LENGTH];
.VAR comb2[C2_LENGTH];
.VAR comb3[C3_LENGTH];
.VAR comb4[C4_LENGTH];
.VAR comb5[C5_LENGTH];
.VAR comb6[C6_LENGTH];

.endseg;


/* ----------- INTERRUPT/FLAG AUDIO DEMO CONTROL PARAMETERS ---------*/
.segment /dm IRQ_ctl;
.VAR COMB1_GAIN = 0x50710000;
.VAR COMB2_GAIN = 0x4FD40000;
.VAR COMB3_GAIN = 0x4F390000;
.VAR COMB4_GAIN = 0x4EA10000;
.VAR COMB5_GAIN = 0x4E0B0000;
.VAR COMB6_GAIN = 0x4D770000;
.VAR COMB1_LENGTH = 1915; /* Comb Filter lengths initially set to constants defined above */
.VAR COMB2_LENGTH = 2121; /* These are used to set the L registers for the comb filters */
.VAR COMB3_LENGTH = 2300; /* When modifying these values for simulating different enclosed */
.VAR COMB4_LENGTH = 2496; /* spaces, ONLY MAKE THEM SMALLER !! */
.VAR COMB5_LENGTH = 2685; /* If you make them larger, reverb buffers will overlap */
.VAR COMB6_LENGTH = 2881;

.VAR IRQ1_counter = 0x00000004; /* selects preset 1 first on IRQ1 assertion */

/* mask register and select bits for early reflection length and gain presets */
.VAR EAR_REF_MASK = 0x00000000;
#define DEFAULT_ER 0
#define SELECT_LEN1 1
#define SELECT_LEN2 2
#define SELECT_LEN3 3
#define SELECT_GAIN1 4
#define SELECT_GAIN2 5
#define SELECT_GAIN3 6

.VAR DRY_GAIN_LEFT = 0x7FFFFFFF; /* Gain Control for left channel */
/* scale between 0x00000000 and 0x7FFFFFFF */
.VAR DRY_GAIN_RIGHT = 0x7FFFFFFF; /* Gain Control for right channel */
/* scale between 0x00000000 and 0x7FFFFFFF */
.VAR ER_GAIN_LEFT = 0x7FFFFFFF; /* Gain Control for early_reflections left output */
/* scale between 0x00000000 and 0x7FFFFFFF */
.VAR ER_GAIN_RIGHT = 0x7FFFFFFF; /* Gain Control for early_reflections right output */
/* scale between 0x00000000 and 0x7FFFFFFF */
.VAR REV_GAIN_LEFT = 0x7FFFFFFF; /* Gain for reverb result */
/* scale between 0x00000000 and 0x7FFFFFFF */
.VAR REV_GAIN_RIGHT = 0x7FFFFFFF; /* Gain for reverb result */
/* scale between 0x00000000 and 0x7FFFFFFF */

/* Early Reflection Filter Tap Lengths */
.VAR er_length1[18] = -190, -759, -44, -190, -9, -123, -706, -119, -384,
-66, -35, -75, -419, -4, -79, -66, -53, -194;
.VAR er_length2[18] = -127, -524, -99, -166, -40, -188, -500, -156, -180,
-250, -40, -700, -50, -80, -100, -350, -50,-100;
.VAR er_length3[18] = -400, -800, -550, -345, -200, -225, -150, -90, -75,
-60, -175, -150, -90, -65, -45, -30, -40, -20;
.endseg;

.segment /pm IRQ_pm;
.VAR er_gain1[18] = 0x6BA60000,
0x40830000,
0x3ED90000,
0x30830000,
0x30A40000,
0x2C4A0000,
0x24FE0000,
0x22D10000,
0x18930000,
0x18B40000,
0x1BC70000,
0x172B0000,
0x170A0000,
0x172B0000,
0x16870000,
0x122D0000,
0x15600000,
0x11270000;

.VAR er_gain2[18] = 0x62A60000,
0x7A0C0D00,
0x5ED90FF0,
0x608302D0,
0x6FA4AB00,
0x654A0054,
0x53FE9200,
0x52D100ED,
0x65930AC1,
0x70B49973,
0x4BC74425,
0x542BAA46,
0x430A22DC,
0x372BAA56,
0x4687DA23,
0x352D4254,
0x5600ABCD,
0x41279245;

.VAR er_gain3[18] = 0x12A60000,
0x2A0C0D00,
0x3ED90FF0,
0x208302D0,
0x3FA4AB00,
0x454A0054,
0x33FE9200,
0x52D100ED,
0x45930AC1,
0x70B49973,
0x6BC74425,
0x542BAA46,
0x630A22DC,
0x572BAA56,
0x6687DA23,
0x652D4254,
0x5600ABCD,
0x71279245;
.endseg;

/* -------------PROGRAM MEMORY CODE---------------------------------*/
.segment /pm pm_code;

Init_Reverb_Buffers:
B0 = er_length1; /* initialize early reflection delay tap lengths*/
B8 = er_gain1; /* initialize early reflection gains */
/* always use I0 and I8 for ER FIR filter, place in internal mem */
L0 = @er_length1; L8 = @er_gain1;

B1 = early_refl; /* initialize early reflections pointer to top of buffer */
DM(early_refl_ptr) = B1;

B1 = comb1; /* initialize pointers to comb filter buffers */
DM(comb1_ptr) = B1;
B2 = comb2;
DM(comb2_ptr) = B2;
B3 = comb3;
DM(comb3_ptr) = B3;
B4 = comb4;
DM(comb4_ptr) = B4;
B5 = comb5;
DM(comb5_ptr) = B5;
B6 = comb6;
DM(comb6_ptr) = B6;

B7 = all_pass; /* initialize all-pass filter pointer to top of buffer */
DM(all_pass_ptr) = B7;


RTS;

/* //////////////////////////////////////////////////////////////////////////////////////////// */
/* */
/* Digital Reverb Filter Routines */
/* */
/* //////////////////////////////////////////////////////////////////////////////////////////// */

Digital_Reverberator:
r14 = DM(Left_Channel_In);
r15 = DM(Right_Channel_In);

r1 = 0x40000000; /* sum input samples */
mrf = r14*r1 (SSF); /* 1/2 xleft(n) + 1/2 xright(n) */
mrf = mrf + r15*r1 (SSFR);

call (PC, early_reflections); /* early reflections */
r6 = mr1f;
DM(er_output) = r6;

call (PC, comb_filters); /* comb filters */

r0 = mr1f;
call (PC, all_pass_filter); /* all pass filter */
dm(reverb_result) = r3;

call reverb_mixer;

rts;

/* --------------------------------------------------------- */

reverb_mixer:
r2 = 0x2AAA0000; /* set up scaling factor for result */
/* mix input with eref & reverb result by 1/3 */

r10 = DM(Left_Channel_In); /* get current left input sample */
r11 = DM(DRY_GAIN_LEFT); /* scale between 0x0 and 0x7FFFFFFF */
r10 = r10 * r11(ssf); /* x(n) *(G_left) */
mrf = r2 * r10(ssf); /* 0.33 * (G_left) * x(n) */

r1 = dm(reverb_result); /* get reverb result */
r11 = DM(REV_GAIN_LEFT); /* scale reverb between 0x0 and 0x7FFFFFFF */
r1 = r1 * r11 (ssf); /* x_reverb(n) * RG_left */
mrf = mrf + r1*r2 (ssf); /* add reverb to input sample */
r10 = mr1f; /* 0.33*x(n) +0.33*x(rev_result) */

r1 = dm(er_output);
r4 = DM(ER_GAIN_LEFT); /* scale between 0x0 and 0x7FFFFFFF */
r3 = r1 * r4 (ssf); /* x_er(n) * (ER_G_left) */
mrf = mrf + r3*r2 (ssfr); /* yL(n)=0.33*x(n) +0.33*x(rev_result) + 0.33*x(ear_ref) */
r10 = mr1f;
dm(Left_Channel_Out) = r10; /* output left result */


r10 = DM(Right_Channel_In); /* get current right input sample */
r11 = DM(DRY_GAIN_RIGHT); /* scale between 0x0 and 0x7FFFFFFF */
r10 = r10 * r11(ssf); /* x(n) *(G_right) */
mrf = r2 * r10(ssf); /* 0.33 * (G_right) * x(n) */

r1 = dm(reverb_result); /* get reverb result */
r11 = DM(REV_GAIN_RIGHT); /* scale reverb between 0x0 and 0x7FFFFFFF */
r1 = r1 * r11 (ssf); /* x_reverb(n) * RG_right */
mrf = mrf + r1*r2 (ssf); /* add reverb to input sample */
r10 = mr1f; /* 0.33*x(n) +0.33*x(rev_result) */

r1 = dm(er_output);
r4 = DM(ER_GAIN_RIGHT); /* scale between 0x0 and 0x7FFFFFFF */
r3 = r1 * r4 (ssf); /* x_er(n) * (ER_G_right) */
mrf = mrf + r3*r2 (ssfr); /* yR(n)=0.33*x(n) +0.33*x(rev_result) + 0.33*x(ear_ref) */
r10 = mr1f;
dm(Right_Channel_Out) = r10; /* output right result */
rts;


/*------------ Early Reflections FIR Filter ------------*
* *
* input -> MR1F *
* *
* MR1F <- output *
* *
*-------------------------------------------------------*/
early_reflections:
L0 = 18; /* L0 register set back to 18, since modified in comb routine */
B8 = er_gain1; /* I8 is ptr to tap gains */
B0 = er_length1; /* I0 is ptr to tap lengths */

/* select desired gain and filter tap lengths from presets */
R10 = DM(EAR_REF_MASK);

check_er_gain_length:
BTST R10 by DEFAULT_ER; /* Default preset */
IF sz JUMP check_er_len1;
B8 = er_gain1; /* If at default setting, do not change */
B0 = er_length1;

check_er_len1:
BTST R10 by SELECT_LEN1;
IF sz JUMP check_er_len2;
B0 = er_length1; /* point to length 1 buffer if selected */

check_er_len2:
BTST R10 by SELECT_LEN2;
IF sz JUMP check_er_len3;
B0 = er_length2; /* point to length 2 buffer if selected */

check_er_len3:
BTST R10 by SELECT_LEN3;
IF sz JUMP check_er_gain1;
B0 = er_length3; /* point to length 3 buffer if selected */

check_er_gain1:
BTST R10 by SELECT_GAIN1;
IF sz JUMP check_er_gain2;
B8 = er_gain1; /* point to gain 1 buffer if selected */

check_er_gain2:
BTST R10 by SELECT_GAIN2;
IF sz JUMP check_er_gain3;
B8 = er_gain2; /* point to gain 2 buffer if selected */

check_er_gain3:
BTST R10 by SELECT_GAIN3;
IF sz JUMP start_fir_filtering;
B8 = er_gain3; /* point to gain 3 buffer if selected */

start_fir_filtering:
M8 = 1;
B7 = early_refl;
L7 = @early_refl;
I7 = DM(early_refl_ptr); /* I7 is ptr to buffer */
R10 = MR1F;
DM(I7,1) = R10; /* write current sample to buffer */
DM(early_refl_ptr) = I7; /* save updated pointer */

R1 = DM(I0,1); /* get first delay tap length */
M7 = R1;
MODIFY(I7,M7); /* buffer pointer now points to first tap */

R1 = DM(I0,1); /* get next tap length */
M7 = R1;
R3 = DM(I7,M7), R4 = PM(I8,M8); /* get first sample and first tap gain for MAC */

LCNTR = 17, DO er_sop UNTIL LCE; /* number of early reflections = 18 */
R1 = DM(I0,1); /* get next tap length */
M7 = R1; /* put tap length in M7 */
er_sop: MRF = MRF + R3*R4 (SSF),R3 = DM(I7,M7), R4 = PM(I8,M8);
/* compute sum of products, get next sample, get next tap gain */
MRF = MRF + R3*R4 (SSFR); /* last sample to be computed */
MRF = SAT MRF;

RTS;


/* ----------------- Cascaded Comb Filters Routine -------------------- */
/* */
/* R6 <- input */
/* output -> MR1F */
/* */
/* Note: R6 must not be corrupted until all 6 comb filters are */
/* computed */
/* Also, it is not necessary to save and restore all comb filter */
/* FIR or all-pass filter index and length registers, if only */
/* doing this reverb demo. These extra instructions are included */
/* so that this example can easily be combined with other audio */
/* effects that require the use of multiple buffers */
/* -------------------------------------------------------------------- */

comb_filters:

L0 = @comb_output;
B0 = comb_output;

/* comb 1 */
R0 = DM(COMB1_GAIN); /* gf = Gf/(1+gl) -- comb feedback gain */
R1 = 0x26660000; /* gl -- low pass filter gain */

L1 = DM(COMB1_LENGTH);
I1 = DM(comb1_ptr);
R4 = DM(I1,0); /* read comb buffer -> output */

R5 = DM(comb1_lpf_state); /* read previous low pass filter state */
MRF = R4*R0 (SSF), DM(I0,1) = R4; /* save output, feedback comb output */
MRF = MRF + R5*R1 (SSFR); /* add low pass filter state */
R10 = MR1F;
DM(comb1_lpf_state) = R10; /* replace with new filter state */

MR1F = R5; /* get old low pass filter output */
R7 = 0x46760000; /* gi = 1/(1 + gf + gf*gl) */
MRF = MRF + R6*R7 (SSFR); /* mac lpf output with input */
R10 = MR1F;
DM(I1,1) = R10; /* write sample to buffer */
DM(comb1_ptr) = I1; /* save updated pointer */


/* comb 2 */
R0 = DM(COMB2_GAIN); /* gf = Gf/(1+gl) -- comb feedback gain */
R1 = 0x27AE0000; /* gl -- low pass filter gain */

L2 = DM(COMB2_LENGTH);
I2 = DM(comb2_ptr);
R4 = DM(I2,0); /* read comb buffer -> output */

R5 = DM(comb2_lpf_state); /* read previous low pass filter state */
MRF = R4*R0 (SSF), DM(I0,1) = R4; /* save output, feedback comb output */
MRF = MRF + R5*R1 (SSFR); /* add low pass filter state */
R10 = MR1F;
DM(comb2_lpf_state) = R10; /* replace with new filter state */

MR1F = R5; /* get old low pass filter output */
R7 = 0x46760000; /* gi = 1/(1 + gf + gf*gl) */
MRF = MRF + R6*R7 (SSFR); /* mac lpf output with input */
R10 = MR1F;
DM(I2,1) = R10; /* write sample to buffer */
DM(comb2_ptr) = I2; /* save updated pointer */


/* comb 3 */
R0 = DM(COMB3_GAIN); /* gf = Gf/(1+gl) -- comb feedback gain */
R1 = 0x28F60000; /* gl -- low pass filter gain */

L3 = DM(COMB3_LENGTH);
I3 = DM(comb3_ptr);
R4 = DM(I3,0); /* read comb buffer -> output */

R5 = DM(comb3_lpf_state); /* read previous low pass filter state */
MRF = R4*R0 (SSF), DM(I0,1) = R4; /* save output, feedback comb output */
MRF = MRF + R5*R1 (SSFR); /* add low pass filter state */
R10 = MR1F;
DM(comb3_lpf_state) = R10; /* replace with new filter state */

MR1F = R5; /* get old low pass filter output */
R7 = 0x46760000; /* gi = 1/(1 + gf + gf*gl) */
MRF = MRF + R6*R7 (SSFR); /* mac lpf output with input */
R10 = MR1F;
DM(I3,1) = R10; /* write sample to buffer */
DM(comb3_ptr) = I3; /* save updated pointer */


/* comb 4 */
R0 = DM(COMB4_GAIN); /* gf = Gf/(1+gl) -- comb feedback gain */
R1 = 0x2A3D0000; /* gl -- low pass filter gain */

L4 = DM(COMB4_LENGTH);
I4 = DM(comb4_ptr);
R4 = DM(I4,0); /* read comb buffer -> output */

R5 = DM(comb4_lpf_state); /* read previous low pass filter state */
MRF = R4*R0 (SSF), DM(I0,1) = R4; /* save output, feedback comb output */
MRF = MRF + R5*R1 (SSFR); /* add low pass filter state */
R10 = MR1F;
DM(comb4_lpf_state) = R10; /* replace with new filter state */

MR1F = R5; /* get old low pass filter output */
R7 = 0x46760000; /* gi = 1/(1 + gf + gf*gl) */
MRF = MRF + R6*R7 (SSFR); /* mac lpf output with input */
R10 = MR1F;
DM(I4,1) = R10; /* write sample to buffer */
DM(comb4_ptr) = I4; /* save updated pointer */


/* comb 5 */
R0 = DM(COMB5_GAIN); /* gf = Gf/(1+gl) -- comb feedback gain */
R1 = 0x2B850000; /* gl -- low pass filter gain */

L5 = DM(COMB5_LENGTH);
I5 = DM(comb5_ptr);
R4 = DM(I5,0); /* read comb buffer -> output */

R5 = DM(comb5_lpf_state); /* read previous low pass filter state */
MRF = R4*R0 (SSF), DM(I0,1) = R4; /* save output, feedback comb output */
MRF = MRF + R5*R1 (SSFR); /* add low pass filter state */
R10 = MR1F;
DM(comb5_lpf_state) = R10; /* replace with new filter state */

MR1F = R5; /* get old low pass filter output */
R7 = 0x46760000; /* gi = 1/(1 + gf + gf*gl) */
MRF = MRF + R6*R7 (SSFR); /* mac lpf output with input */
R10 = MR1F;
DM(I5,1) = R10; /* write sample to buffer */
DM(comb5_ptr) = I5; /* save updated pointer */


/* comb 6 */
R0 = DM(COMB6_GAIN); /* gf = Gf/(1+gl) -- comb feedback gain */
R1 = 0x2CCD0000; /* gl -- low pass filter gain */

L6 = DM(COMB6_LENGTH);
I6 = DM(comb6_ptr);
R4 = DM(I6,0); /* read comb buffer -> output */

R5 = DM(comb6_lpf_state); /* read previous low pass filter state */
MRF = R4*R0 (SSF), DM(I0,1) = R4; /* save output, feedback comb output */
MRF = MRF + R5*R1 (SSFR); /* add low pass filter state */
R10 = MR1F;
DM(comb6_lpf_state) = R10; /* replace with new filter state */

MR1F = R5; /* get old low pass filter output */
R7 = 0x46760000; /* gi = 1/(1 + gf + gf*gl) */
MRF = MRF + R6*R7 (SSFR); /* mac lpf output with input */
R10 = MR1F;
DM(I6,1) = R10; /* write sample to buffer */
DM(comb6_ptr) = I6; /* save updated pointer */


B0 = comb_output; /* sum outputs of comb filters */
R1 = 0x15555555; /* scale comb outputs by 1/6 */
R0 = DM(I0,1); /* load comb output */
MRF = R0*R1 (SSF), R0 = DM(I0,1); /* compute product, load next comb output*/
MRF = MRF + R0*R1 (SSF), R0 = DM(I0,1); /* compute sum of products */
MRF = MRF + R0*R1 (SSF), R0 = DM(I0,1); /* and so on ... */
MRF = MRF + R0*R1 (SSF), R0 = DM(I0,1);
MRF = MRF + R0*R1 (SSF), R0 = DM(I0,1);
MRF = MRF + R0*R1 (SSFR);

RTS;


/* --------------- All Pass Filter Routine ---------------------- */
/* */
/* input -> R0 */
/* output -> R3 */
/* */
/* -------------------------------------------------------------- */

all_pass_filter:
B7 = all_pass;
I7 = DM(all_pass_ptr);
L7 = @all_pass;
R1 = 0x599A0000; /* feedback gain */

R10 = DM(I7,0); /* load output of buffer */
MR1F = R10;
MRF = MRF + R1*R0 (SSFR); /* add to (feedback gain)*(input) */
MRF = SAT MRF;
R3 = MR1F; /* output of all pass in R3 */

MR1F = R0; /* put input of all pass in MR1F */
MRF = MRF - R1*R3 (SSFR); /* input - (feedback gain)*(output) */
MRF = SAT MRF;
R10 = MR1F;
DM(I7,1) = R10; /* save to input of buffer */
DM(all_pass_ptr) = I7;

RTS;

/* ------------------------------------------------------------------------------------- */
/* */
/* IRQ1 Pushbutton Interrupt Service Routine */
/* */
/* This routine allows the user to modify reverb presets on-the-fly to allow for */
/* emulation of either large auditoriums, medium size enclosures, or small rooms. */
/* */
/* Default before 1st IRQ push: Reverb Setting #1 - Large Auditorium/Gym */
/* 1st Pushbutton Press: Reverb Setting #1 - Small Room - Bathroom or Hallway */
/* 2nd Pushbutton Press: Reverb Setting #2 - Medium Size Room with increasing ER */
/* 3rd Pushbutton Press: Reverb Setting #3 - Large Gym with R to L panning effect */
/* 4th Pushbutton Press: Reverb Setting #4 - Large Cave with L to R pan */
/* 5th Pushbutton Press: Reverb Setting #4 - Large Gym with L to R pan */
/* 6th Pushbutton Press: Reverb Setting #4 - Large Auditorium with L to R pan */
/* 7th Pushbutton Press: Reverts back to setting #1 */
/* */
/* Also note, early reflections and later reverberations are panned differently */
/* between left and right channels for all reverb presets. For example, early */
/* reflections may come from the left speaker, while the later reverberations */
/* come from the right speaker. */
/* */
/* yL(n)=0.33*(Gain)*x(n) +0.33*(Gain)*x(rev_result) + 0.33*(Gain)*x(ear_ref) */
/* yR(n)=0.33*(Gain)*x(n) +0.33*(Gain)*x(rev_result) + 0.33*(Gain)*(x(ear_ref) */
/* ------------------------------------------------------------------------------------- */

change_reverb_settings:
bit set mode1 SRRFH; /* enable background register file */
NOP; /* 1 CYCLE LATENCY FOR WRITING TO MODE1 REGISER!! */

r13 = 6; /* number of presets */
r15 = DM(IRQ1_counter); /* get preset count */
r15 = r15 + 1; /* increment preset */
comp (r15, r13);
if ge r15 = r15 - r15; /* reset to zero */
DM(IRQ1_counter) = r15; /* save preset count */

r10 = pass r15; /* get preset mode */
if eq jump reverb_settings_2; /* check for count == 0 */
r10 = r10 - 1;
if eq jump reverb_settings_3; /* check for count == 1 */
r10 = r10 - 1;
if eq jump reverb_settings_4; /* check for count == 3 */
r10 = r10 - 1;
if eq jump reverb_settings_5; /* check for count == 4 */
r10 = r10 - 1;
if eq jump reverb_settings_6; /* check for count == 5 */

reverb_settings_1: /* count therefore, is == 6 if you are here */
r14 = 0x00000024; DM(EAR_REF_MASK) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_LEFT) = r14;
r14 = 0x2FFFFFFF; DM(DRY_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_LEFT) = r14;
r14 = 0x0FFFFFFF; DM(ER_GAIN_RIGHT) = r14;
r14 = 0x07FFFFFF; DM(REV_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(REV_GAIN_RIGHT) = r14;

/* When modifying length values for simulating different enclosed spaces, ONLY MAKE THEM SMALLER !! */
/* If you make them larger than defined lengths, reverb buffers will overlap */
/* Default Comb1 Length 1915 - 40 ms @ 48 KHz} */
/* Default Comb2 Length 2121 - 44 ms */
/* Default Comb3 Length 2300 - 48 ms */
/* Default Comb4 Length 2496 - 52 ms */
/* Default Comb5 Length 2685 - 56 ms */
/* Default Comb6 Length 2881 - 60 ms */

r14 = 1115; DM(COMB1_LENGTH) = r14;
r14 = 1321; DM(COMB2_LENGTH) = r14;
r14 = 1500; DM(COMB3_LENGTH) = r14;
r14 = 1796; DM(COMB4_LENGTH) = r14;
r14 = 1985; DM(COMB5_LENGTH) = r14;
r14 = 2281; DM(COMB6_LENGTH) = r14;

r14 = 0x30710000; DM(COMB1_GAIN) = r14;
r14 = 0x2FD40000; DM(COMB2_GAIN) = r14;
r14 = 0x2F390000; DM(COMB3_GAIN) = r14;
r14 = 0x2EA10000; DM(COMB4_GAIN) = r14;
r14 = 0x1E0B0000; DM(COMB5_GAIN) = r14;
r14 = 0x1D770000; DM(COMB6_GAIN) = r14;
bit set ustat1 0x3E; /* turn on Flag4 LED */
bit clr ustat1 0x01;
dm(IOSTAT)=ustat1;
jump done;

reverb_settings_2:
r14 = 0x00000048; DM(EAR_REF_MASK) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_RIGHT) = r14;
r14 = 0x00000000; DM(ER_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(REV_GAIN_LEFT) = r14;
r14 = 0x00000000; DM(REV_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_LEFT) = r14;

r14 = 800; DM(COMB1_LENGTH) = r14;
r14 = 1121; DM(COMB2_LENGTH) = r14;
r14 = 1200; DM(COMB3_LENGTH) = r14;
r14 = 1596; DM(COMB4_LENGTH) = r14;
r14 = 1685; DM(COMB5_LENGTH) = r14;
r14 = 2081; DM(COMB6_LENGTH) = r14;

r14 = 0x20710012; DM(COMB1_GAIN) = r14;
r14 = 0x2FD45476; DM(COMB2_GAIN) = r14;
r14 = 0x2F390776; DM(COMB3_GAIN) = r14;
r14 = 0x1EA10001; DM(COMB4_GAIN) = r14;
r14 = 0x1E0B0999; DM(COMB5_GAIN) = r14;
r14 = 0x1D770cff; DM(COMB6_GAIN) = r14;
bit set ustat1 0x3D; /* turn on Flag5 LED */
bit clr ustat1 0x02;
dm(IOSTAT)=ustat1;
jump done;

reverb_settings_3:
r14 = 0x00000028; DM(EAR_REF_MASK) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_LEFT) = r14;
r14 = 0x00000000; DM(ER_GAIN_RIGHT) = r14;
r14 = 0x00000000; DM(REV_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(REV_GAIN_RIGHT) = r14;

r14 = 1742; DM(COMB1_LENGTH) = r14;
r14 = 2087; DM(COMB2_LENGTH) = r14;
r14 = 2202; DM(COMB3_LENGTH) = r14;
r14 = 2487; DM(COMB4_LENGTH) = r14;
r14 = 2577; DM(COMB5_LENGTH) = r14;
r14 = 2743; DM(COMB6_LENGTH) = r14;

r14 = 0x40712344; DM(COMB1_GAIN) = r14;
r14 = 0x3FD42525; DM(COMB2_GAIN) = r14;
r14 = 0x3A392465; DM(COMB3_GAIN) = r14;
r14 = 0x3AA14343; DM(COMB4_GAIN) = r14;
r14 = 0x3C0B2344; DM(COMB5_GAIN) = r14;
r14 = 0x2F771141; DM(COMB6_GAIN) = r14;
bit set ustat1 0x3B; /* turn on Flag6 LED */
bit clr ustat1 0x04;
dm(IOSTAT)=ustat1;
jump done;

reverb_settings_4:
r14 = 0x00000000; DM(EAR_REF_MASK) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_RIGHT) = r14;
r14 = 0x00000000; DM(ER_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(REV_GAIN_LEFT) = r14;
r14 = 0x00000000; DM(REV_GAIN_RIGHT) = r14;

r14 = 1179; DM(COMB1_LENGTH) = r14;
r14 = 1372; DM(COMB2_LENGTH) = r14;
r14 = 1573; DM(COMB3_LENGTH) = r14;
r14 = 1832; DM(COMB4_LENGTH) = r14;
r14 = 2185; DM(COMB5_LENGTH) = r14;
r14 = 2381; DM(COMB6_LENGTH) = r14;

r14 = 0x30711200; DM(COMB1_GAIN) = r14;
r14 = 0x3FD4aa00; DM(COMB2_GAIN) = r14;
r14 = 0x4F390012; DM(COMB3_GAIN) = r14;
r14 = 0x3EA10000; DM(COMB4_GAIN) = r14;
r14 = 0x3E0B0120; DM(COMB5_GAIN) = r14;
r14 = 0x2D770240; DM(COMB6_GAIN) = r14;
bit set ustat1 0x37; /* turn on Flag7 LED */
bit clr ustat1 0x08;
dm(IOSTAT)=ustat1;
jump done;

reverb_settings_5:
r14 = 0x00000000; DM(EAR_REF_MASK) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(REV_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(REV_GAIN_RIGHT) = r14;

r14 = 1915; DM(COMB1_LENGTH) = r14;
r14 = 2121; DM(COMB2_LENGTH) = r14;
r14 = 2300; DM(COMB3_LENGTH) = r14;
r14 = 2496; DM(COMB4_LENGTH) = r14;
r14 = 2685; DM(COMB5_LENGTH) = r14;
r14 = 2881; DM(COMB6_LENGTH) = r14;

r14 = 0x50710011; DM(COMB1_GAIN) = r14;
r14 = 0x4FD40100; DM(COMB2_GAIN) = r14;
r14 = 0x4F390020; DM(COMB3_GAIN) = r14;
r14 = 0x3EA100aa; DM(COMB4_GAIN) = r14;
r14 = 0x2E0B00bb; DM(COMB5_GAIN) = r14;
r14 = 0x3D770012; DM(COMB6_GAIN) = r14;
bit set ustat1 0x2F; /* turn on Flag8 LED */
bit clr ustat1 0x10;
dm(IOSTAT)=ustat1;
jump done;

reverb_settings_6:
r14 = 0x00000000; DM(EAR_REF_MASK) = r14;
r14 = 0x2FFFFFFF; DM(DRY_GAIN_LEFT) = r14;
r14 = 0x7FFFFFFF; DM(DRY_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(ER_GAIN_LEFT) = r14;
r14 = 0x4FFFFFFF; DM(ER_GAIN_RIGHT) = r14;
r14 = 0x7FFFFFFF; DM(REV_GAIN_LEFT) = r14;
r14 = 0x4FFFFFFF; DM(REV_GAIN_RIGHT) = r14;

r14 = 1915; DM(COMB1_LENGTH) = r14;
r14 = 2121; DM(COMB2_LENGTH) = r14;
r14 = 2300; DM(COMB3_LENGTH) = r14;
r14 = 2496; DM(COMB4_LENGTH) = r14;
r14 = 2685; DM(COMB5_LENGTH) = r14;
r14 = 2881; DM(COMB6_LENGTH) = r14;

r14 = 0x50711234; DM(COMB1_GAIN) = r14;
r14 = 0x4FD45647; DM(COMB2_GAIN) = r14;
r14 = 0x4F390579; DM(COMB3_GAIN) = r14;
r14 = 0x4EA10120; DM(COMB4_GAIN) = r14;
r14 = 0x4E0Babba; DM(COMB5_GAIN) = r14;
r14 = 0x4D77dead; DM(COMB6_GAIN) = r14;
bit set ustat1 0x1F; /* turn on Flag9 LED */
bit clr ustat1 0x20;
dm(IOSTAT)=ustat1;

done:
rti(db);
bit clr mode1 SRRFH; /* switch back to primary register set */
nop; /* 1 cycle latency for switching to occur */


.endseg;

have fun ;-)

harrystainer 19.03.2005 04:20 PM

I won't bother quoting what he just wrote but wtf? 8O

wildbill 19.03.2005 04:28 PM

to further demonstrate my lack of knowledge:

what's compiling?

from what you've all said, it sounds like you use assembly language, or C or C++ or something, which is actually a shorthand for all those 0's and 1's, and then you do something with a compiler.

it sounds like the compiler is what my original question was about - the interpretation of all that raw data.
for instance, does the data refer to sound, graphics, or something else.

is the compiler another program?

are there one's specific to music applications?

are there more compilers than languages? or are there relatively a few of them.

i know i could google this, but it's easier when it comes from a discussion sometimes.

hatembr 19.03.2005 05:30 PM

Quote:

From what you've all said, it sounds like you use assembly language, or C or C++ or something, which is actually a shorthand for all those 0's and 1's, and then you do something with a compiler.
correct!


Quote:

is the compiler another program?

correct.

The compiler, which is also a binary program, takes all the symbolic representation of binary instructions you write, and translates them into binary instructions, compiled into an executable file (EXE, COM, SYS, VXD....) the computer can understand and run.
There is a compiler for C, one for C++, one for ASM, one for Pascal, Delphi etc etc etc.
Every language has its own compiler, because every language has its own and specific semantics and syntax.
If you talk to a chineese guy, you'll need a translator who speaks chineese, same for any other language.


Quote:

are there one's specific to music applications?
no, music applcations are normal applications that require classic compilers depending on the language they have originally been written in.

For eg. winamp is written in C++, so Nullsoft developers compiled it using a C++ compiler to get that winamp.exe and all its related DLLs and files, same for Cubase or Sonar.


Quote:

are there more compilers than languages? or are there relatively
a few of them.
there is a compiler for each language, i've never heard of any polyglot compiler :)

Quote:

i know i could google this, but it's easier when it comes from a discussion sometimes.
i agree :D

Househead 19.03.2005 06:03 PM

I tried to learn Assembler back on the old amiga days...lasted about 2 weeks

8O 8O

I tried to code amiga demos.... :?


All times are GMT. The time now is 01:46 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2002-2022, Infekted.org