@name Robotboy655's Wire Gate: RAM (128 KBytes)
@inputs AddressRead AddressWrite DataWrite Fire Reset
@outputs DataRead
@persist Memory:array
@model models/cheeze/wires/ram.mdl

interval(10)

if(first())
{
    Memory = array()
}

if(Fire > 0 & AddressWrite >= 0 & AddressWrite < 131072)
{
    Memory[AddressWrite,number] = DataWrite
}
if(Reset > 0)
{
    Memory = array()
}

DataRead = Memory[AddressRead,number]
