Magma logic works, but - like all fluid logic - messily and with unnecessary complications. I built a thing that does nothing fancier than making a bunch of bitwise NAND comparisons between one fixed and one switchable input (three choices). It got a bit large, mainly because i decided to use 12-bit registers, but in the end i mixed it about 60% water, 40% magma constructions. Water's just a lot easier to construct for. Actual operation is a bit nightmarish, the two main headaches were
a) writing results back into the fixed input is fiddly, because, well, it's a permanent input, so a change of its value may change the input it receives. Most importantly, when it turns "off", the NAND will again turn "on". If you could get near-instant liquid transport in your switches, this wouldn't be much of an issue, but especially with magma, you're limited to what your pumps can move; i estimate that i got delays of up to fifty steps, definitely longer than a single dwarf's double lever pull. I did four backwards writes, two succeeded and two failed, meaning i just went and copied the result over from the control.
b) vermin. A water logic array directly under the surface attracts random spawns of vermin fish, who'll then get smashed in the door jambs and clog up the works.
To check basic computing possibilities, i calculated the XOR and NXOR of two arbitrarily chosen twelve-bit numbers, 101100 101011 and 011010 110001. Results were, eventually (with the aforementioned two manual copies when the designated write screwed up) 110110 011010 and its inverse. Operation progression was: A - fixed input; B, C, D - switchable inputs; numbers originally in A, B
A NAND B -> write to C
A NAND C -> write to D
A NAND X -> write to A (sets all bits in A)
A NAND B -> write to A, B (inverse of B)
A NAND B -> write to A (B copied to A), B (as control)
A NAND C -> write to A, B (control)
A NAND D -> write to A (XOR result), B (control)
A NAND B -> write to B (NXOR result)
Took several dwarf weeks to finish, not to mention several days spent pushing a "perch remains" around via remote water pressure until it was over a bridge and could be crushed.
I also built a magma repeater, a ring counter and a binary counter, all in pure fluid logic. I laid out but didn't connect a "program reader/decoder" thingy; in theory, all the bits required for a programmable, autonomously-operating computer are there and _could_ be run without any need for power - all you need is a really big water reservoir providing the working pressure. It all works, but many components - like the ring counter - need precisely-timed signals, which escalates the component count and, eventually, actual operation times. Unfortunately, even with pressure, magma isn't a very good logic fluid. Gravitic pressurising gives water a massive advantage.
I was curious how viable pure fluid logic really is, considering the fluid D-Latch is probably the compactest, lowest-tech way to hold a single bit:
####~
#^++~
####~
One pressure plate, two doors. That's it. The doors are linked to "Data" line (outer door) and "Enable" (inner door). The plate responds to 5-7 fluid. Whenever the enable door opens, the pressure plate takes on the value of the Data input - if Data is on, fluid rushes in and tops off the plate, if Data is off, water sloshes off the pressure plate into the tile of the open Enable door, lowering depth to 3-4 if it was full previously. When the enable door is closed, changes of the data input have no effect.
As shown on the wiki, fluid logic gates without constant flow are entirely possible. You just need to base them on complementary logic: whenever an input changes, fluid level on the sensing plate(s) is adjusted to the correct value by either opening access to incoming fluid or by opening open space for the fluid to spread into. As a small but important improvement, the basic logic gates don't actually need _any_ drain. The spread space offered by raising/lowering bridges is enough. That's how i built my complementary drainless NAND gates:
###
#B###
#^^DD
#B###
###
Two pressure plates to give both the AND and NAND output, although i didn't use the "and". Two doors and two bridges, one door and one bridge linked to each input. Since in the least-different case, you spread three full tiles of liquid over four tiles of space (21 liquid spread over four gives 3x5, 1x6), the "high" plate must respond to 7/7 fluid only, the lower (NAND) one must respond to at least 5/7, preferably 6/7, too. Since NAND activates as reaction to a bridge lowering, the switch time is quite long.
The wiki contributors for some reason called their complementary fluid logic CMOS, which struck me as patently silly - MOS (metal-oxide-semiconductor) denotes the specific materials from which electronic switches are constructed, which has no bearing on DF mechanised logic (we don't even have electricity!). Still, i _did_ build a CMOS logic device, a simple inverter:
#+# elsewhere: ň #
#^#
#B#
###
Lever linked to both bridge and door in the logic cell, the pressure plate reacts to low fluid. When the lever switches to "on", the door opens, the bridge raises, magma on the plate goes to 7/7, switches the plate off which closes the ("inverted") grate next to the lever. When the lever is switched "off", the door closes and the bridge lowers, magma on the plate recedes to 3-4/7, plate activates and opens the grate.
But that's still just normal fluid logic. Where does the MOS come in? As in electronics, in the materials. The regulating lever is made of copper (metal), the connecting mechanisms of quarzite (Oxide, to wit SiO2, which _is_ a common dielectric in MOS manufacture) and the door and bridge of sphalerite (ZnS, a semiconductor). It's the same in the plate->grate connection, except the pressure plate is made of steel (since this just had to be built in magma). Thus, i claim the first dwarven logic device really fabricated in CMOS.