{ Mu-Law Compression routine. Calling Parameters R0 = Linear input value Result Registers R0 = Compressed 8-bit value Altered Registers R0, R13, R15 Cycle Time 19 Cycles The Applications Library Gordon A. Sterling 3/20/90 } #include "asm_glob.h" .SEGMENT/PM Assembly_Library_Code_Space; .GLOBAL ucompress; ucompress: R15=ABS R0; {Take absolute value} R13=33; {Add offset of boundries} R15=R15+R13; R13=8191; {Maximum PCM value} R15=MIN(R15,R13); {Cap input} R13=EXP R15; {Find exponent adjustment} R13=-R13; R15=ASHIFT R15 BY R13; {Normalize input} R15=BCLR R15 BY 30; {Remove first significant bit} R15=LSHIFT R15 BY -26; {Shift position bits} R0=PASS R0; {Test sign of input} IF LT R15=BSET R15 BY 7; {Set sign bit if necessary} R0=25; R0=R0-R13; {Compute segment} IF LT R0=R0-R0; R15=R15 OR LSHIFT R0 BY 4; {Position segment bits} RTS (DB); R13=H#FF; R0=R15 XOR R13; {Invert bits} .ENDSEG;