Allow Adding to Ram or CU
This commit is contained in:
44
src/Main.elm
44
src/Main.elm
@ -201,7 +201,9 @@ type Msg
|
||||
| MsgManualStep UAction
|
||||
| MsgRamEditAddress Int String
|
||||
| MsgRamEditInstr Int String
|
||||
| MsgRamAddBelow
|
||||
| MsgCuEditAction Int String
|
||||
| MsgCuAddBelow
|
||||
| MsgLocalSessionRecieve String
|
||||
|
||||
|
||||
@ -256,6 +258,14 @@ update msg model =
|
||||
({ model | pc = new_pc }
|
||||
, Cmd.none )
|
||||
_ -> ( model, Cmd.none )
|
||||
|
||||
MsgRamAddBelow ->
|
||||
let
|
||||
old_pc = model.pc
|
||||
new_pc = {old_pc | ram = old_pc.ram ++ [0]}
|
||||
in
|
||||
|
||||
({model | pc = new_pc}, Cmd.none)
|
||||
|
||||
MsgCuEditAction addr may_action ->
|
||||
case string2uAction may_action of
|
||||
@ -266,6 +276,12 @@ update msg model =
|
||||
({ model | uCode = newCode }, Cmd.none)
|
||||
_ -> ( model, Cmd.none )
|
||||
|
||||
MsgCuAddBelow ->
|
||||
( {model | uCode = model.uCode ++ [ ActNothing ]}
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
MsgAutoscrollUpdate ->
|
||||
( { model | autoscroll = not model.autoscroll }
|
||||
, Cmd.none
|
||||
@ -438,7 +454,19 @@ viewRamContent model =
|
||||
]
|
||||
]
|
||||
in
|
||||
Html.tbody [] (List.map ram2table indexedRam)
|
||||
Html.tbody []
|
||||
((List.map ram2table indexedRam)
|
||||
++
|
||||
[ Html.tr []
|
||||
[ Html.td [] []
|
||||
, Html.td []
|
||||
[ button
|
||||
[ onClick MsgRamAddBelow ]
|
||||
[ text "Add Entry"]
|
||||
]
|
||||
]
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
viewCu : Model -> Html Msg
|
||||
@ -517,7 +545,19 @@ viewCuUCodeContent model =
|
||||
]
|
||||
|
||||
in
|
||||
Html.tbody [] (List.map list2table indexedList)
|
||||
Html.tbody []
|
||||
((List.map list2table indexedList)
|
||||
++
|
||||
[ Html.tr []
|
||||
[ Html.td [] []
|
||||
, Html.td []
|
||||
[ button
|
||||
[ onClick MsgCuAddBelow ]
|
||||
[ text "Add Entry"]
|
||||
]
|
||||
]
|
||||
]
|
||||
)
|
||||
|
||||
viewCuInstrSelect : Int -> UAction -> Html Msg
|
||||
viewCuInstrSelect id current =
|
||||
|
Reference in New Issue
Block a user