- data Instrs
- type NativeProgram = [Instrs]
- splitWords :: (a -> Bool) -> [a] -> [[a]]
- readNativeProgram :: String -> Either ParseError NativeProgram
- toBits :: Instrs -> F18Word
- fromBits :: F18Word -> Instrs
- toOpcodes :: Instrs -> [Opcode]
- runningTime :: NativeProgram -> Double
Represents a word in memory. This word can either contain opcodes, opcodes and a jump address or just a constant number.
|Instrs Opcode Opcode Opcode Opcode|
|Jump3 Opcode Opcode Opcode F18Word|
|Jump2 Opcode Opcode F18Word|
|Jump1 Opcode F18Word|
Splits a list into chunks of at most four, breaking off a chunk whenever it sees an element matching the given predicate. This is useful for splitting a program along word boundaries, accounting for jump addresses.
Read a whole program, splitting instructions up into words.
Returns the given instructions as an actual word. This assumes the address is sized appropriately.
Returns the opcodes in the given instruction word. A constant corresponds to not having any opcodes.