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

Safe HaskellNone




data Addr Source


data Instruction Source

Represents a single instruction as viewed by the synthesizer. This can be an opcode, a numeric literal or a token representing an unused slot.

type Program = [Instruction] Source

A program to be manipulated by the MCMC synthesizer

readInstruction :: String -> Either ParseError Instruction Source

Tries to parse the given string as an instruction, which can either be a number, an opcode or "_" representing Unused.

readProgram :: String -> Either ParseError Program Source

Reads a program in the synthesizer's format.

toNative :: Program -> NativeProgram Source

Takes a program as handled by the synthesizer and makes it native by turning literal numbers into @p and fixing any issues with instructions going into the last slot as well as prepending nops before + instructions.

boundary :: Instruction -> Bool Source

Does this instruction force a word boundary?

labels :: F18Word -> Program -> Program Source

Resolves labels into addresses, assuming the program starts at the given memory location.

fixSlot3 :: Program -> Program Source

Insert extra nops to account for instructions that cannot go into the last slot.

fromNative :: NativeProgram -> Program Source

Gets a synthesizer program from a native program. Currently does not support jumps.

runProgram :: State -> Program -> State Source

Runs a given program from the default starting state.

load :: Program -> State -> State Source

Loads the given synthesizer-friendly program into the given state.