As much as I would like, this does not involve elves being assimilated and becoming bio-engineered dwarves inside a giant floating obsidian cube.
Instead, after reading an old 40d wiki page on computing, I noticed the section on animal logic (also, Borg logic, whatever difference from animal logic it has :\). Having never considered it as a viable possibility beyond simple repeaters, not being able to find any examples of a practical gate made with it, and knowing that water logic was much more efficient and killed FPS less, I decided to try it and whipped up some designs for logic gates instead of the numerous more important deadlines looming. Hey.
I eventually decided on a mixture of my previous research area, gear logic (which I abandoned after proving that a NOT gate is impossible without triggering, thus also making a NAND, XOR and NOR gate impossible, making any sort of useful logic construction impossible). After searching, I decided that the first prototype will be a simplified Von Neumann architecture (removed CU, opcode comes later when stuff works, AU simplified to an 8 bit adder and rewired some connections to make it run better in DF). So while the first prototype will be a glorified calculator (simple addition and an 'add answer' function), the next prototype will be more complicated. My goal right now is just to prove that my logic gates WORK.
Massive text wall ahead. If you don't want any nitty-gritty details, avert eyes now:
------------------------------------------------------------------------------------------
ComponentsA simplified Von Neumann architecture consisting of an adder, gear memory, lever input, input control and door matrix output
MemoryI adapted this from previous gear logic projects. I call it Power Tested Gear Memory, as that is exactly how it works. Each bit of memory consists of a gear assembly linked up to the corresponding output bit, a power source, and a pump+pressure plate power sensor. The memory stores state as a toggled or disengaged gear. When the +ANS function is used, power is 'flooded' through the gears, testing each for it's state. If it is toggled, it will activate the pump, which will trigger a pressure plate.
Single memory cell (one bit)
# is a wall
| is a horizontal axle carrying >=20 power
X> is a pump pumping east
~ is 7/7 water 1 z level down (pump source)
$ is the drain (probably all drains lead to central reservoir that drains into caverns)
O is the linked gear assembly (* was to hard to see)
D is access door
^ is output pressure plate
###|###
###O###
##~X>^$
##D####
This will suck up a fair bit of power (~20 power X 9 bits= 180 power, about 2 waterwheel's worth), but will only have a 200 step delay, which is important.
The memory is 9 bits to accommodate the addition of two 8-bit numbers (as, for example, 11111111+11111111=111111110, which is obviously 9 bits)
AdderThis would also be 8 bit, to couple with the memory. Since I'm
lazy still in test phase, I'm going to use the simpler ripple-carry adder over a carry-look ahead design. Since I have built half-adders (a) before, that will be first, and then follow up with the 7 full adders (A).
Ripple-carry adder
> is a carry
o is a bend in the linkups
in-------------
| | | | | | | |
a>A>A>A>A>A>A>A-o
| | | | | | | | |
out------------------>
Each adder adds 2 bits (one from each number) and the carry value (except half adder). The carry 'ripples' through from the first to the last adder. Despite deriding, it is actually pretty fast, the carry operations by themselves should end up taking roughly 800 steps. That's not terrible, and actually improves FPS (as not every animal is pathing around at
quite the same time)...
GatesUniversal key:
# is wall
A through G is door
d is normally open door
g through k is pressure plate
M is a meeting area (used to lure animals around)
+ is normal floor
a and b are lever or pressure plate inputs, not actually shown.
O is the on door (this door is triggered after inputs have been inputted, releases animal after inputs are done to prevent mishaps)
AND
############
#+O++g++ABM#
############
Input a is hooked up to door A, and b is hooked up to B. The animal's 'default' position is behind g. I designed an off mechanism to lure them back there to reset the computer, but I'll go into that later. When both a and b are triggered, the animal begins to move towards M. It triggers pressure plate g, sending a on signal as the output and closing doors A and B to prevent it from getting stuck in M (which would require annoying meeting area fiddling to resolve). The previously mentioned off mechanism would then lure it back behind g.
OR
#####
#+M+#
#A#B#
#+#+#
#+#+#
#g#h#
#+++#
##O##
##+##
#####
Obviously this is quite a bit larger than the AND, mainly as it needs two paths for OR to properly work. Otherwise identical to AND. If a is triggered, A opens and g is triggered, closing A and sending ON, same with b (though opening B and triggering h). If both a and b are triggered, then both A and B are opened. g and h will both also be triggered. I'll need to make sure that doesn't mess the computer up.
XOR
###
#M#
#A#
#+#
#+#
#g#
#+#
#O#
#+#
###
This one is easy to understand. Both a and b trigger A. a only sends output on, b only same, both means a opens the door and b closes it (or vice-versa) meaning an output of off.
NAND
#####
#+M+#
#A#B#
#+#+#
#+#+#
#g#h#
#+++#
##O##
##+##
#####
The sharp observer will note that this is the OR gate. It functions in the same way, except that A and B start out open.
NOT
###
#M#
#A#
#+#
#+#
#g#
#+#
#O#
#+#
###
A NOT gate has only one input, a. a is linked to A, which starts out open.
InputsLevers.
Input controllerHard line, huh? Hmph. Input controller basically splices together the number in memory if ANS is selected. It triggers memory to read out, then uses that and the lever pull as inputs. It's hard to diagram since it's spread out among the other parts. Mainly the pressure plates in memory.
Bin to Dec converterI really want one of these. It will convert the 9 bit output to a 3 digit decimal. I'm still working out a design for it though.
Door Matrix OutputBasically a big square of doors that are triggered by the bin-to-dec converter like a standard LCD screen.
D is door
# is untriggered door or wall
###D##DDD##DDD#
###D##D####D#D#
###D##DDD##D#D#
###D####D##D#D#
###D##DDD##DDD#
150
#DDD##DDD##D#D#
###D####D##D#D#
#DDD##DDD###D##
###D####D##D#D#
#DD##DDD###D#D#
33X. Absolutely not a hint at what is eventually planned for this computer.
Planned Testing and DevTest gates, memory, sensors and other components for basic functionality
Test half and full adders
Test basic computer design (what is outlined in this post)
Test basic carry-look-ahead adder
Decide on final architecture of computer
Design other components for architecture
Construct
Program
Profit!