A big ton of refactoring. Basically split up Main.elm into a hand full smaller (more manageable) files.
This commit is contained in:
78
src/PC/Types.elm
Normal file
78
src/PC/Types.elm
Normal file
@ -0,0 +1,78 @@
|
||||
module PC.Types exposing (..)
|
||||
|
||||
import Array exposing (Array)
|
||||
|
||||
pcModelVersion = "3"
|
||||
|
||||
type alias PC_Model =
|
||||
{ pc : PC
|
||||
, uCodes : Array UAction
|
||||
}
|
||||
|
||||
type alias PC =
|
||||
{ ram : Array (Int, String)
|
||||
, dataBus : Int
|
||||
, addressBus : Int
|
||||
, instructionReg : Int
|
||||
, programmCounter : Int
|
||||
, uCounter : Int
|
||||
, accumulator : Int
|
||||
}
|
||||
|
||||
type alias UCode =
|
||||
{ variant : UAction
|
||||
, id : String
|
||||
, action : PC -> PC
|
||||
, label : String
|
||||
}
|
||||
|
||||
type UAction
|
||||
= UA_Accumulator2DataBus
|
||||
| UA_AccumulatorDecrement
|
||||
| UA_AccumulatorIncrement
|
||||
| UA_DataBus2Accumulator
|
||||
| UA_DataBus2InstructionReg
|
||||
| UA_DataBus2Ram
|
||||
| UA_InstructionReg2AddressBus
|
||||
| UA_InstructionReg2ProgrammCounter
|
||||
| UA_InstructionReg2UCounter
|
||||
| UA_ProgrammCounterIncrement
|
||||
| UA_InstructionReg2ProgrammCounterIfAccEq0
|
||||
| UA_Ram2DataBus
|
||||
| UA_ResetUCounter
|
||||
| UA_ProgrammCounter2AddressBus
|
||||
| UA_Nothing
|
||||
|
||||
|
||||
-- To make it easier to understand everything has name convention
|
||||
-- PM_ -> PC_Msg in general
|
||||
-- PM_B_ -> for a Button
|
||||
-- PM_C_ -> for a Checkbox
|
||||
-- PM_F_ -> for a TextField
|
||||
type PC_Msg
|
||||
= PM_B_UCycleStep
|
||||
| PM_B_InstructionStep
|
||||
| PM_B_Reset
|
||||
| PM_B_RamAddBelow
|
||||
| PM_B_CuAddBelow
|
||||
| PM_F_RamEditInstr Int String
|
||||
| PM_F_RamEditAddress Int String
|
||||
| PM_F_RamEditComment Int String
|
||||
| PM_F_CuEditAction Int String
|
||||
| PM_F_CuInstrRegEditAddr String
|
||||
| PM_F_CuInstrRegEditInstr String
|
||||
| PM_F_CuProgCounterEdit String
|
||||
| PM_F_CuUCounterEdit String
|
||||
| PM_F_EditAddressBus String
|
||||
| PM_F_EditDataBus String
|
||||
| PM_F_AluEdit String
|
||||
| PM_ManualStep UAction
|
||||
|
||||
|
||||
-- Tells main what is supposed
|
||||
-- to happen after a update
|
||||
type PC_AfterUpdateAction
|
||||
= PUA_Nothing -- Do nothing
|
||||
| PUA_Storage -- Update localStorage
|
||||
| PUA_Scroller -- Scroll to value
|
||||
| PUA_Storage_And_Scroller -- Update localStorage and scroll to values
|
Reference in New Issue
Block a user