Implement most of mima-run CLI
This commit is contained in:
parent
a1f532172a
commit
082a205a7e
3 changed files with 57 additions and 12 deletions
|
|
@ -63,7 +63,7 @@ data Instruction
|
|||
deriving (Show, Eq)
|
||||
|
||||
instance ToText Instruction where
|
||||
toText (SmallInstruction oc addr) = toText oc <> " 0x" <> addrToHex addr
|
||||
toText (SmallInstruction oc addr) = T.justifyLeft 4 ' ' (toText oc) <> " " <> addrToDec addr
|
||||
toText (LargeInstruction oc) = toText oc
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,13 @@ memoryToWords mem = map (\addr -> readAt addr mem) $ addressRange mem
|
|||
|
||||
addressWordToText :: MimaAddress -> MimaWord -> T.Text
|
||||
addressWordToText addr word =
|
||||
addrToHex addr <> " (" <> addrToDec addr <> ") - " <> wordToHex word <> " (" <> wordToDec word <> ")"
|
||||
let separator = " - "
|
||||
addrText = addrToHex addr <> " (" <> addrToDec addr <> ")"
|
||||
wordText = wordToHex word <> " (" <> wordToDec word <> ")"
|
||||
instrText = case wordToInstruction word of
|
||||
Left _ -> ""
|
||||
Right i -> separator <> toText i
|
||||
in addrText <> separator <> wordText <> instrText
|
||||
|
||||
memoryToText :: Bool -> MimaMemory -> T.Text
|
||||
memoryToText sparse mem@(MimaMemory m)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue