array-forth- A simple interpreter for arrayForth, the language used on GreenArrays chips.

Safe HaskellSafe-Inferred




type F18Word = Word18Source

The 18-bit word type used by Greenarrays chips.

data Opcode Source

Each F18A instruction, ordered by opcode.

names :: [String]Source

The names of the different instructions, ordered by opcode.

opcodes :: [Opcode]Source

All of the opcodes, in order.

readOpcode :: String -> Either ParseError OpcodeSource

Tries to read a given string as an opcode from the list of names.

toOpcode :: F18Word -> OpcodeSource

Converts a word to an opcode. The word has to be < 32.

fromOpcode :: Opcode -> F18WordSource

Converts an Opcode to its 18-bit word representation.

isJump :: Opcode -> BoolSource

Returns whether the given opcode is a jump instruction expecting an address.

slot3 :: Opcode -> BoolSource

Can the given opcode go in the last slot?

opcodeTime :: Opcode -> DoubleSource

Estimates how long a given opcode will take to execute. Normal opcodes take 1.5 nanoseconds where ones that access the memory take 5 nanoseconds.