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

Safe HaskellSafe-Inferred
LanguageHaskell98

Language.ArrayForth.Opcode

Synopsis

Documentation

type F18Word = Word18 Source

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 Opcode Source

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

toOpcode :: F18Word -> Opcode Source

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

fromOpcode :: Opcode -> F18Word Source

Converts an Opcode to its 18-bit word representation.

isJump :: Opcode -> Bool Source

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

slot3 :: Opcode -> Bool Source

Can the given opcode go in the last slot?

opcodeTime :: Opcode -> Double Source

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.