EMU10K1 DSP Documentation
-------------------------

Most of the following information was obtained by trial-and-error.

Use it at your own risk!

Please send any comments, corrections or additions to
<dkoukola@atrey.karlin.mff.cuni.cz>.


Instruction Format
------------------

       31    23       20 19     10 9       0
  0   |                 |    x    |    y    |
  1   |     |  opcode   |    w    |    z    |


Opcodes
-------

   0x0 : z = w + (x * y >> 31)   ; saturation
   0x1 : z = w + (-x * y >> 31)  ; saturation
   0x2 : z = w + (x * y >> 31)   ; wraparound
   0x3 : z = w + (-x * y >> 31)  ; wraparound
   0x4 : z = w + x * y  ; saturation
   0x5 : z = w + x * y  ; wraparound (31-bit)
   0x6 : z = w + x + y  ; saturation
   0x7 : z = w, acc += x * y >> 31
   0x8 : z = (w & x) ^ y
   0x9 : z = (w >= y) ? x : ~x
   0xa : z = (w >= y) ? x : y
   0xb : z = (w < y) ? x : y
   0xc : linear -> logarithmic representation (?)
   0xd : logarithmic -> linear representation (?)
   0xe : z = w + (x * (y - w) >> 31)  ; saturation
   0xf : z = 0 (?)


Operands
--------

   0x00n : FX send bus
   0x010 : in0 l (AC '97 codec)
   0x011 : in0 r
   0x012 : in1 l (S/PDIF)
   0x013 : in1 r
   0x014 : in2 l (mic?)
   0x015 : in2 r
   0x016 : in3 l (APS only?)
   0x017 : in3 r
   0x018 : in4 l (LiveDrive -- mic, line in)
   0x019 : in4 r
   0x01a : in5 l (LiveDrive -- S/PDIF coax in)
   0x01b : in5 r
   0x020 : out0 l (AC '97 codec)
   0x021 : out0 r
   0x022 : out1 l (TOSlink MiniDisc optical out ?)
   0x023 : out1 r
   0x024 : out2 l (?)
   0x025 : out2 r
   0x026 : out3 l (LiveDrive -- headphone out)
   0x027 : out3 r
   0x028 : out4 l (rear channel)
   0x029 : out4 r
   0x02a : out5 l (ADC recording buffer)
   0x02b : out5 r
   0x02c : out6 (microphone recording buffer)

   0x040 : 00000000
   0x041 : 00000001
   0x042 : 00000002
   0x043 : 00000003
   0x044 : 00000004
   0x045 : 00000008
   0x046 : 00000010
   0x047 : 00000020
   0x048 : 00000100
   0x049 : 00010000
   0x04a : 00080000
   0x04b : 10000000
   0x04c : 20000000
   0x04d : 40000000
   0x04e : 80000000
   0x04f : 7fffffff

   0x05n : (unknown)
   0x056 : accumulator
   0x058 : noise source (?)
   0x059 : noise source (?)

   0x1nn : general purpose registers
   0x2nn : tank memory data registers
   0x3nn : tank memory address registers (0x380-0x39f external TRAM)
