{ A-Law compression routine. Calling Parameters R0 = Linear Input Value Result Registers R0 = Compressed 8-bit value Altered Registers R0, R1, R13, R15; Cycles Time 20 Cycles Version 0.01 8/10/90 Gordon A. Sterling } #include "asm_glob.h" .SEGMENT/PM Assembly_Library_Code_Space; .GLOBAL acompress; acompress: R15=ABS R0; {Take absolute value} R13=4095; {Maximum PCM value} R15=MIN(R15,R13); {Cap input} R1=LSHIFT R15 BY -1; {Prepare for possible zero seg} R13=31; {Check for zero segment} COMP(R15,R13); IF LE JUMP sign_invert; {Append sign and invert bits} 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} R1=26; R13=R1-R13, R1=R15; {Compute segment} R1=R1 OR LSHIFT R13 BY 4; {Position segment bits} sign_invert: R0=PASS R0; {Append the sign bit and invert} IF GE R1=BSET R1 BY 7; RTS (DB); R13=H#55; R0=R1 XOR R13; {Invert bits} .ENDSEG;