Miner Assembly System
It should be possible to control a programmable mining rig in a manor similar to an embedded computer. Operations would not be at a high level but would be similar to an Application Specific Integrated Circuit operating on optimal instructions.
I see the mining rig having the following topology:
(mem mapped) Registers:
Facing: [0-31]
(currently only 5 bits: correlates to the outer ring of the 9x9 area an OV scanner traditionally covers, enumerated clockwise from face on direction 0 being 0. (In debug there is a direction indicator: this has a rang 0-3 which maps on to this if left-shifted by 3.))
Scanreg0
Scanreg...
ScanregN
(register mapped array, slots 0 through 3 for OV scanner, 0-1 for OD scanner, value dependent on current layer and facing direction; changes to layer tracked; the value of each register yields the a value representing that block (suggest use the actual block value))
Scanreg-1: A special register, with any scanner it returns the value of the block immediately beneath the shaft's current depth; otherwise it returns if it's block that can be mined (-1 if it cannot be mined, a scanner should only return -1 if the block's mining is impossible; not improbable (bedrock mining programs might be desired))
ChestCheck: Write a block ID to this, read returns the current count of the last written block ID in the chest.
StatusReg: (contains machine status; might include power/etc, will include a bit that reveals if there is more pipe, if a pump is attached with empty cells waiting)
(actual) Registers:
G0
G1
G2
Instruction Pointer
Three bits for pseudo-registers, and 2 bits for actual registers. A sliver of ram (maybe 8 words?) implemented similar to core memory might exist; the instructions would be mapped in to the same address space (various possibilities, and opportunities for 'danger'). I also propose MASS (add storage to the end) as the name for the instruction roms for miners.
It may be desirable to make a more advanced miner that has 4-16 slots in the center instead of just one. With the map height now only defaulting to 128 and not limited to it having the ability to load from multiple pipe stores would be excellent. There are also some additional operations that I would like to use this 'input' material.
Possible instructions:
Obviously the various copy (immediate), register, memory to register; store register to memory would be required. Standard logic and arithmetic ops: (and, or, invert/ add, subtract, compare).
Then there would be operations dictated by 'writes' to the status register.
Mine the next block being faced.
Mine the next block down the stack (and advance).
Replace the (nth farthest away) being faced (for simple programs if the block is too far place it in the first possible slot or not at all; unable to replace block might be a status flag).
Replace the block beneath.
The replace and mining operations should all reference a given 'slot'; replacing a pipe section with anything else also requires a storage operation so that should go back to the pipe stacks.
Mining operations also have a storage result, which might go to EITHER the stacks OR the chest.