Allow Adding to Ram or CU

This commit is contained in:
Christian 2020-12-25 18:08:56 +01:00
parent 0a15d5bef4
commit 0c4c97fc2a
3 changed files with 151 additions and 6 deletions

View File

@ -162,7 +162,7 @@ button {
.pc .scroller table thead.head {
position: sticky;
top: 0;
top: -2px;
left: 0;
height: 1em;
padding: 1em;
@ -204,6 +204,16 @@ button {
padding: 3px 15px;
}
.pc .scroller table tbody button:last-child {
text-decoration: none;
text-transform: none;
height: max-content;
line-height: 2em;
font-weight: normal;
font-size: inherit;
padding: 0px 10px;
}
th.address {
width: 5rem;
padding-left: 8px;
@ -278,10 +288,11 @@ th.address {
.pc .ram input[type=number] {
margin: 0 .5em 0 0;
padding: 1em .25em;
background-color: var(--color-table-ram-select);
color: var(--color-table-ram-select-text);
border-color: var(--color-table-ram-select-border);
height: max-content;
height: 2.5em;
}
.pc .ram input[type=number].instruction {
@ -296,6 +307,12 @@ th.address {
text-align: left;
}
.pc .ram .scroller table tbody button:last-child{
background-color: var(--color-table-ram-select);
color: var(--color-table-ram-select-text);
border-color: var(--color-table-ram-select-border);
}
/* CONTROL UNIT */
@ -316,6 +333,12 @@ th.address {
border: 1px solid var(--color-table-cu-select-border);
}
.pc .cu .scroller table tbody button:last-child {
background-color: var(--color-table-cu-select);
color: var(--color-table-cu-select-text);
border: 1px solid var(--color-table-cu-select-border);
}
/* BUSSES */
.pc .databus,

View File

@ -5706,6 +5706,21 @@ var $author$project$Main$update = F2(
} else {
return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
}
case 'MsgRamAddBelow':
var old_pc = model.pc;
var new_pc = _Utils_update(
old_pc,
{
ram: _Utils_ap(
old_pc.ram,
_List_fromArray(
[0]))
});
return _Utils_Tuple2(
_Utils_update(
model,
{pc: new_pc}),
$elm$core$Platform$Cmd$none);
case 'MsgCuEditAction':
var addr = msg.a;
var may_action = msg.b;
@ -5721,6 +5736,17 @@ var $author$project$Main$update = F2(
} else {
return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
}
case 'MsgCuAddBelow':
return _Utils_Tuple2(
_Utils_update(
model,
{
uCode: _Utils_ap(
model.uCode,
_List_fromArray(
[$author$project$Main$ActNothing]))
}),
$elm$core$Platform$Cmd$none);
default:
return _Utils_Tuple2(
_Utils_update(
@ -5974,6 +6000,7 @@ var $elm$html$Html$table = _VirtualDom_node('table');
var $elm$html$Html$th = _VirtualDom_node('th');
var $elm$html$Html$thead = _VirtualDom_node('thead');
var $elm$html$Html$tr = _VirtualDom_node('tr');
var $author$project$Main$MsgCuAddBelow = {$: 'MsgCuAddBelow'};
var $elm$core$Tuple$pair = F2(
function (a, b) {
return _Utils_Tuple2(a, b);
@ -6069,7 +6096,34 @@ var $author$project$Main$viewCuUCodeContent = function (model) {
return A2(
$elm$html$Html$tbody,
_List_Nil,
A2($elm$core$List$map, list2table, indexedList));
_Utils_ap(
A2($elm$core$List$map, list2table, indexedList),
_List_fromArray(
[
A2(
$elm$html$Html$tr,
_List_Nil,
_List_fromArray(
[
A2($elm$html$Html$td, _List_Nil, _List_Nil),
A2(
$elm$html$Html$td,
_List_Nil,
_List_fromArray(
[
A2(
$elm$html$Html$button,
_List_fromArray(
[
$elm$html$Html$Events$onClick($author$project$Main$MsgCuAddBelow)
]),
_List_fromArray(
[
$elm$html$Html$text('Add Entry')
]))
]))
]))
])));
};
var $author$project$Main$viewCuUCode = function (model) {
return A2(
@ -6300,6 +6354,7 @@ var $author$project$Main$viewDataBus = function (model) {
]))
]));
};
var $author$project$Main$MsgRamAddBelow = {$: 'MsgRamAddBelow'};
var $author$project$Main$MsgRamEditAddress = F2(
function (a, b) {
return {$: 'MsgRamEditAddress', a: a, b: b};
@ -6413,7 +6468,34 @@ var $author$project$Main$viewRamContent = function (model) {
return A2(
$elm$html$Html$tbody,
_List_Nil,
A2($elm$core$List$map, ram2table, indexedRam));
_Utils_ap(
A2($elm$core$List$map, ram2table, indexedRam),
_List_fromArray(
[
A2(
$elm$html$Html$tr,
_List_Nil,
_List_fromArray(
[
A2($elm$html$Html$td, _List_Nil, _List_Nil),
A2(
$elm$html$Html$td,
_List_Nil,
_List_fromArray(
[
A2(
$elm$html$Html$button,
_List_fromArray(
[
$elm$html$Html$Events$onClick($author$project$Main$MsgRamAddBelow)
]),
_List_fromArray(
[
$elm$html$Html$text('Add Entry')
]))
]))
]))
])));
};
var $author$project$Main$viewRam = function (model) {
return A2(

View File

@ -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 =