Allow editing commands

This commit is contained in:
2020-12-25 17:45:30 +01:00
parent de89a7b8fb
commit 0a15d5bef4
5 changed files with 580 additions and 316 deletions

View File

@ -73,11 +73,17 @@
--color-table-ram-head-text: var(--color-white);
--color-table-ram-highlight: var(--color-ram-light2);
--color-table-ram-highlight-text: var(--color-black);
--color-table-ram-select: transparent;
--color-table-ram-select-text: inherit;
--color-table-ram-select-border: var(--color-grey-light2);
--color-table-cu-head: var(--color-cu-dark1);
--color-table-cu-head-text: var(--color-white);
--color-table-cu-highlight: var(--color-cu-light2);
--color-table-cu-highlight-text: var(--color-black);
--color-table-cu-select: transparent;
--color-table-cu-select-text: inherit;
--color-table-cu-select-border: var(--color-grey-light2);
--color-arrow: var(--color-arrow-main);
--color-arrow-text: var(--color-white);

View File

@ -107,6 +107,7 @@ button {
display: grid;
grid-template-columns: auto auto auto;
/* grid-template-columns: max-content auto max-content; */
gap: 9px;
}
@ -115,6 +116,7 @@ button {
}
.pc .section {
min-height: 20em;
max-height: calc(80vh - 8em);
min-width: 20%;
@ -274,6 +276,26 @@ th.address {
width: 100%;
}
.pc .ram input[type=number] {
margin: 0 .5em 0 0;
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;
}
.pc .ram input[type=number].instruction {
width: 5em;
}
.pc .ram input[type=number].address {
width: 7em;
}
.pc .ram table tr td:nth-child(2){
text-align: left;
}
/* CONTROL UNIT */
@ -285,6 +307,15 @@ th.address {
width: 100%;
}
.pc .cu select{
margin: 0;
width: 100%;
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

@ -5163,63 +5163,13 @@ var $author$project$Main$ActDataBus2Ram = {$: 'ActDataBus2Ram'};
var $author$project$Main$ActInstructionReg2AddressBus = {$: 'ActInstructionReg2AddressBus'};
var $author$project$Main$ActInstructionReg2ProgrammCounter = {$: 'ActInstructionReg2ProgrammCounter'};
var $author$project$Main$ActInstructionReg2UCounter = {$: 'ActInstructionReg2UCounter'};
var $author$project$Main$ActNothing = {$: 'ActNothing'};
var $author$project$Main$ActProgrammCounter2AddressBus = {$: 'ActProgrammCounter2AddressBus'};
var $author$project$Main$ActProgrammCounterIncrement = {$: 'ActProgrammCounterIncrement'};
var $author$project$Main$ActRam2DataBus = {$: 'ActRam2DataBus'};
var $author$project$Main$ActResetUCounter = {$: 'ActResetUCounter'};
var $author$project$Main$initialUCodes = _List_fromArray(
[
$elm$core$Maybe$Just($author$project$Main$ActProgrammCounter2AddressBus),
$elm$core$Maybe$Just($author$project$Main$ActRam2DataBus),
$elm$core$Maybe$Just($author$project$Main$ActDataBus2InstructionReg),
$elm$core$Maybe$Just($author$project$Main$ActProgrammCounterIncrement),
$elm$core$Maybe$Just($author$project$Main$ActInstructionReg2UCounter),
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Just($author$project$Main$ActInstructionReg2AddressBus),
$elm$core$Maybe$Just($author$project$Main$ActRam2DataBus),
$elm$core$Maybe$Just($author$project$Main$ActDataBus2Accumulator),
$elm$core$Maybe$Just($author$project$Main$ActResetUCounter),
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Just($author$project$Main$ActAccumulator2DataBus),
$elm$core$Maybe$Just($author$project$Main$ActInstructionReg2AddressBus),
$elm$core$Maybe$Just($author$project$Main$ActDataBus2Ram),
$elm$core$Maybe$Just($author$project$Main$ActResetUCounter),
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Just($author$project$Main$ActAccumulatorIncrement),
$elm$core$Maybe$Just($author$project$Main$ActResetUCounter),
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Just($author$project$Main$ActInstructionReg2ProgrammCounter),
$elm$core$Maybe$Just($author$project$Main$ActResetUCounter),
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing,
$elm$core$Maybe$Nothing
]);
[$author$project$Main$ActProgrammCounter2AddressBus, $author$project$Main$ActRam2DataBus, $author$project$Main$ActDataBus2InstructionReg, $author$project$Main$ActProgrammCounterIncrement, $author$project$Main$ActInstructionReg2UCounter, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActInstructionReg2AddressBus, $author$project$Main$ActRam2DataBus, $author$project$Main$ActDataBus2Accumulator, $author$project$Main$ActResetUCounter, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActAccumulator2DataBus, $author$project$Main$ActInstructionReg2AddressBus, $author$project$Main$ActDataBus2Ram, $author$project$Main$ActResetUCounter, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActAccumulatorIncrement, $author$project$Main$ActResetUCounter, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActInstructionReg2ProgrammCounter, $author$project$Main$ActResetUCounter, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing, $author$project$Main$ActNothing]);
var $elm$core$Platform$Cmd$batch = _Platform_batch;
var $elm$core$Platform$Cmd$none = $elm$core$Platform$Cmd$batch(_List_Nil);
var $author$project$Main$init = function (flags) {
@ -5235,52 +5185,6 @@ var $author$project$Main$recieveLocalSession = _Platform_incomingPort('recieveLo
var $author$project$Main$subscriptions = function (model) {
return $author$project$Main$recieveLocalSession($author$project$Main$MsgLocalSessionRecieve);
};
var $elm$core$List$filter = F2(
function (isGood, list) {
return A3(
$elm$core$List$foldr,
F2(
function (x, xs) {
return isGood(x) ? A2($elm$core$List$cons, x, xs) : xs;
}),
_List_Nil,
list);
});
var $elm$core$List$head = function (list) {
if (list.b) {
var x = list.a;
var xs = list.b;
return $elm$core$Maybe$Just(x);
} else {
return $elm$core$Maybe$Nothing;
}
};
var $author$project$Main$ActAccumulatorDecrement = {$: 'ActAccumulatorDecrement'};
var $author$project$Main$actAccumulator2DataBus = function (pc) {
return _Utils_update(
pc,
{dataBus: pc.accumulator});
};
var $author$project$Main$actAccumulatorDecrement = function (pc) {
return _Utils_update(
pc,
{accumulator: pc.accumulator - 1});
};
var $author$project$Main$actAccumulatorIncrement = function (pc) {
return _Utils_update(
pc,
{accumulator: pc.accumulator + 1});
};
var $author$project$Main$actDataBus2Accumulator = function (pc) {
return _Utils_update(
pc,
{accumulator: pc.dataBus});
};
var $author$project$Main$actDataBus2InstructionReg = function (pc) {
return _Utils_update(
pc,
{instructionReg: pc.dataBus});
};
var $elm$core$List$append = F2(
function (xs, ys) {
if (!ys.b) {
@ -5457,8 +5361,8 @@ var $elm$core$List$take = F2(
function (n, list) {
return A3($elm$core$List$takeFast, 0, n, list);
});
var $author$project$Main$changeAt = F3(
function (pos, newVal, list) {
var $author$project$Main$changeAt = F4(
function (pos, newVal, _default, list) {
var len = $elm$core$List$length(list);
var before = A2($elm$core$List$take, pos, list);
var after = A2($elm$core$List$drop, pos + 1, list);
@ -5466,7 +5370,7 @@ var $author$project$Main$changeAt = F3(
var before2 = A2(
$elm$core$List$append,
before,
A2($elm$core$List$repeat, pos - len, 0));
A2($elm$core$List$repeat, pos - len, _default));
return A2(
$elm$core$List$append,
before2,
@ -5478,26 +5382,94 @@ var $author$project$Main$changeAt = F3(
A2($elm$core$List$cons, newVal, after));
}
});
var $author$project$Main$changeAtInt = F3(
function (pos, newVal, list) {
return A4($author$project$Main$changeAt, pos, newVal, 0, list);
});
var $author$project$Main$changeAtUCode = F3(
function (pos, newVal, list) {
return A4($author$project$Main$changeAt, pos, newVal, $author$project$Main$ActNothing, list);
});
var $elm$core$List$filter = F2(
function (isGood, list) {
return A3(
$elm$core$List$foldr,
F2(
function (x, xs) {
return isGood(x) ? A2($elm$core$List$cons, x, xs) : xs;
}),
_List_Nil,
list);
});
var $elm$core$List$head = function (list) {
if (list.b) {
var x = list.a;
var xs = list.b;
return $elm$core$Maybe$Just(x);
} else {
return $elm$core$Maybe$Nothing;
}
};
var $author$project$Main$ActAccumulatorDecrement = {$: 'ActAccumulatorDecrement'};
var $author$project$Main$actAccumulator2DataBus = function (pc) {
return _Utils_update(
pc,
{dataBus: pc.accumulator});
};
var $author$project$Main$actAccumulatorDecrement = function (pc) {
return _Utils_update(
pc,
{accumulator: pc.accumulator - 1});
};
var $author$project$Main$actAccumulatorIncrement = function (pc) {
return _Utils_update(
pc,
{accumulator: pc.accumulator + 1});
};
var $author$project$Main$actDataBus2Accumulator = function (pc) {
return _Utils_update(
pc,
{accumulator: pc.dataBus});
};
var $author$project$Main$actDataBus2InstructionReg = function (pc) {
return _Utils_update(
pc,
{instructionReg: pc.dataBus});
};
var $author$project$Main$actDataBus2Ram = function (pc) {
var newRam = A3($author$project$Main$changeAt, pc.addressBus, pc.dataBus, pc.ram);
var newRam = A3($author$project$Main$changeAtInt, pc.addressBus, pc.dataBus, pc.ram);
return _Utils_update(
pc,
{ram: newRam});
};
var $author$project$Main$seperateInstructionsEntry = function (i) {
var instruction = (i / 100000) | 0;
var address = i - (instruction * 100000);
return _Utils_Tuple2(instruction, address);
};
var $author$project$Main$actInstructionReg2AddressBus = function (pc) {
var _v0 = $author$project$Main$seperateInstructionsEntry(pc.instructionReg);
var instruction = _v0.a;
var address = _v0.b;
return _Utils_update(
pc,
{addressBus: pc.instructionReg - (((pc.instructionReg / 100000) | 0) * 100000)});
{addressBus: address});
};
var $author$project$Main$actInstructionReg2ProgrammCounter = function (pc) {
var _v0 = $author$project$Main$seperateInstructionsEntry(pc.instructionReg);
var instruction = _v0.a;
var address = _v0.b;
return _Utils_update(
pc,
{programmCounter: pc.instructionReg - (((pc.instructionReg / 100000) | 0) * 100000)});
{programmCounter: address});
};
var $author$project$Main$actInstructionReg2UCounter = function (pc) {
var _v0 = $author$project$Main$seperateInstructionsEntry(pc.instructionReg);
var instruction = _v0.a;
var address = _v0.b;
return _Utils_update(
pc,
{uCounter: ((pc.instructionReg / 100000) | 0) * 10});
{uCounter: instruction * 10});
};
var $author$project$Main$actProgrammCounter2AddressBus = function (pc) {
return _Utils_update(
@ -5550,7 +5522,12 @@ var $author$project$Main$uCodeMaps = _List_fromArray(
_Utils_Tuple2($author$project$Main$ActProgrammCounterIncrement, $author$project$Main$actProgrammCounterIncrement),
_Utils_Tuple2($author$project$Main$ActRam2DataBus, $author$project$Main$actRam2DataBus),
_Utils_Tuple2($author$project$Main$ActResetUCounter, $author$project$Main$actResetUCounter),
_Utils_Tuple2($author$project$Main$ActProgrammCounter2AddressBus, $author$project$Main$actProgrammCounter2AddressBus)
_Utils_Tuple2($author$project$Main$ActProgrammCounter2AddressBus, $author$project$Main$actProgrammCounter2AddressBus),
_Utils_Tuple2(
$author$project$Main$ActNothing,
function (s) {
return s;
})
]);
var $author$project$Main$getAction = function (uAction) {
var possible_instructions = A2(
@ -5574,11 +5551,48 @@ var $author$project$Main$getAction = function (uAction) {
var $elm$core$Basics$not = _Basics_not;
var $elm$json$Json$Encode$string = _Json_wrap;
var $author$project$Main$sendUUpdate = _Platform_outgoingPort('sendUUpdate', $elm$json$Json$Encode$string);
var $elm$core$Tuple$second = function (_v0) {
var y = _v0.b;
return y;
};
var $author$project$Main$uCodeDescriptions = _List_fromArray(
[
_Utils_Tuple2($author$project$Main$ActAccumulator2DataBus, 'Acc -> DataBus'),
_Utils_Tuple2($author$project$Main$ActAccumulatorDecrement, 'Acc --'),
_Utils_Tuple2($author$project$Main$ActAccumulatorIncrement, 'Acc ++'),
_Utils_Tuple2($author$project$Main$ActDataBus2Accumulator, 'DataBus -> Acc'),
_Utils_Tuple2($author$project$Main$ActDataBus2InstructionReg, 'DataBus -> InstReg'),
_Utils_Tuple2($author$project$Main$ActDataBus2Ram, 'DataBus -> Ram'),
_Utils_Tuple2($author$project$Main$ActInstructionReg2AddressBus, 'InstReg -> AddrBus'),
_Utils_Tuple2($author$project$Main$ActInstructionReg2ProgrammCounter, 'InstReg -> ProgCount'),
_Utils_Tuple2($author$project$Main$ActInstructionReg2UCounter, 'InstReg -> µCounter'),
_Utils_Tuple2($author$project$Main$ActProgrammCounterIncrement, 'ProgCounter ++'),
_Utils_Tuple2($author$project$Main$ActRam2DataBus, 'Ram -> DataBus'),
_Utils_Tuple2($author$project$Main$ActResetUCounter, 'µCounter = 0'),
_Utils_Tuple2($author$project$Main$ActProgrammCounter2AddressBus, 'ProgCounter -> AddrBus'),
_Utils_Tuple2($author$project$Main$ActNothing, 'Empty')
]);
var $author$project$Main$string2uAction = function (msg) {
var filtered_list = A2(
$elm$core$List$filter,
function (s) {
return _Utils_eq(s.b, msg);
},
$author$project$Main$uCodeDescriptions);
var _v0 = $elm$core$List$head(filtered_list);
if (_v0.$ === 'Just') {
var _v1 = _v0.a;
var action = _v1.a;
return $elm$core$Maybe$Just(action);
} else {
return $elm$core$Maybe$Nothing;
}
};
var $author$project$Main$uStepPC = function (model) {
var uCounter = model.pc.uCounter;
var may_instruction = A2($author$project$Main$valueAt, uCounter, model.uCode);
if ((may_instruction.$ === 'Just') && (may_instruction.a.$ === 'Just')) {
var action = may_instruction.a.a;
if (may_instruction.$ === 'Just') {
var action = may_instruction.a;
var possible_instructions = A2(
$elm$core$List$filter,
function (s) {
@ -5644,6 +5658,69 @@ var $author$project$Main$update = F2(
pc: instruction(model.pc)
}),
$elm$core$Platform$Cmd$none);
case 'MsgRamEditAddress':
var addr = msg.a;
var may_int = msg.b;
var _v1 = $elm$core$String$toInt(may_int);
if (_v1.$ === 'Just') {
var _int = _v1.a;
var old_pc = model.pc;
var _v2 = $author$project$Main$seperateInstructionsEntry(
A2($author$project$Main$valueAtInt, addr, model.pc.ram));
var inst = _v2.a;
var new_val = (inst * 100000) + _int;
var new_pc = _Utils_update(
old_pc,
{
ram: A3($author$project$Main$changeAtInt, addr, new_val, old_pc.ram)
});
return _Utils_Tuple2(
_Utils_update(
model,
{pc: new_pc}),
$elm$core$Platform$Cmd$none);
} else {
return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
}
case 'MsgRamEditInstr':
var addr = msg.a;
var may_int = msg.b;
var _v3 = $elm$core$String$toInt(may_int);
if (_v3.$ === 'Just') {
var _int = _v3.a;
var old_pc = model.pc;
var _v4 = $author$project$Main$seperateInstructionsEntry(
A2($author$project$Main$valueAtInt, addr, model.pc.ram));
var address = _v4.b;
var new_val = (_int * 100000) + address;
var new_pc = _Utils_update(
old_pc,
{
ram: A3($author$project$Main$changeAtInt, addr, new_val, old_pc.ram)
});
return _Utils_Tuple2(
_Utils_update(
model,
{pc: new_pc}),
$elm$core$Platform$Cmd$none);
} else {
return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
}
case 'MsgCuEditAction':
var addr = msg.a;
var may_action = msg.b;
var _v5 = $author$project$Main$string2uAction(may_action);
if (_v5.$ === 'Just') {
var action = _v5.a;
var newCode = A3($author$project$Main$changeAtUCode, addr, action, model.uCode);
return _Utils_Tuple2(
_Utils_update(
model,
{uCode: newCode}),
$elm$core$Platform$Cmd$none);
} else {
return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
}
default:
return _Utils_Tuple2(
_Utils_update(
@ -5676,10 +5753,6 @@ var $elm$html$Html$Attributes$stringProperty = F2(
$elm$json$Json$Encode$string(string));
});
var $elm$html$Html$Attributes$class = $elm$html$Html$Attributes$stringProperty('className');
var $elm$core$Tuple$second = function (_v0) {
var y = _v0.b;
return y;
};
var $elm$html$Html$Attributes$classList = function (classes) {
return $elm$html$Html$Attributes$class(
A2(
@ -5831,7 +5904,7 @@ var $author$project$Main$viewAlu = function (model) {
_List_fromArray(
[
$elm$html$Html$text(
'Accumulator: ' + $elm$core$String$fromInt(model.pc.accumulator))
'Accumulator: ' + A2($author$project$Main$addLeadingZero, model.pc.accumulator, 8))
])),
A2(
$elm$html$Html$div,
@ -5907,106 +5980,90 @@ var $elm$core$Tuple$pair = F2(
});
var $elm$html$Html$tbody = _VirtualDom_node('tbody');
var $elm$html$Html$td = _VirtualDom_node('td');
var $author$project$Main$uCodeDescriptions = _List_fromArray(
[
_Utils_Tuple2($author$project$Main$ActAccumulator2DataBus, 'Acc -> DataBus'),
_Utils_Tuple2($author$project$Main$ActAccumulatorDecrement, 'Acc --'),
_Utils_Tuple2($author$project$Main$ActAccumulatorIncrement, 'Acc ++'),
_Utils_Tuple2($author$project$Main$ActDataBus2Accumulator, 'DataBus -> Acc'),
_Utils_Tuple2($author$project$Main$ActDataBus2InstructionReg, 'DataBus -> InstReg'),
_Utils_Tuple2($author$project$Main$ActDataBus2Ram, 'DataBus -> Ram'),
_Utils_Tuple2($author$project$Main$ActInstructionReg2AddressBus, 'InstReg -> AddrBus'),
_Utils_Tuple2($author$project$Main$ActInstructionReg2ProgrammCounter, 'InstReg -> ProgCount'),
_Utils_Tuple2($author$project$Main$ActInstructionReg2UCounter, 'InstReg -> µCounter'),
_Utils_Tuple2($author$project$Main$ActProgrammCounterIncrement, 'ProgCounter ++'),
_Utils_Tuple2($author$project$Main$ActRam2DataBus, 'Ram -> DataBus'),
_Utils_Tuple2($author$project$Main$ActResetUCounter, 'µCounter = 0'),
_Utils_Tuple2($author$project$Main$ActProgrammCounter2AddressBus, 'ProgCounter -> AddrBus')
]);
var $author$project$Main$MsgCuEditAction = F2(
function (a, b) {
return {$: 'MsgCuEditAction', a: a, b: b};
});
var $elm$html$Html$option = _VirtualDom_node('option');
var $elm$html$Html$select = _VirtualDom_node('select');
var $elm$json$Json$Decode$field = _Json_decodeField;
var $author$project$Main$selectCuValueDecoder = A2(
$elm$json$Json$Decode$field,
'target',
A2($elm$json$Json$Decode$field, 'value', $elm$json$Json$Decode$string));
var $elm$html$Html$Attributes$selected = $elm$html$Html$Attributes$boolProperty('selected');
var $author$project$Main$viewCuInstrSelect = F2(
function (id, current) {
var info2option = function (_v0) {
var action = _v0.a;
var info = _v0.b;
return A2(
$elm$html$Html$option,
_List_fromArray(
[
$elm$html$Html$Attributes$selected(
_Utils_eq(action, current))
]),
_List_fromArray(
[
$elm$html$Html$text(info)
]));
};
var listOptions = A2($elm$core$List$map, info2option, $author$project$Main$uCodeDescriptions);
return A2(
$elm$html$Html$select,
_List_fromArray(
[
A2(
$elm$html$Html$Events$on,
'change',
A2(
$elm$json$Json$Decode$map,
$author$project$Main$MsgCuEditAction(id),
$author$project$Main$selectCuValueDecoder))
]),
listOptions);
});
var $author$project$Main$viewCuUCodeContent = function (model) {
var list2table = function (may_t) {
var may_code = may_t.b;
var id = may_t.a;
if (may_code.$ === 'Just') {
var code = may_code.a;
var possibleDescriptions = A2(
$elm$core$List$filter,
function (s) {
return _Utils_eq(s.a, code);
},
$author$project$Main$uCodeDescriptions);
var codeDescription = function () {
var _v1 = $elm$core$List$head(possibleDescriptions);
if (_v1.$ === 'Just') {
var _v2 = _v1.a;
var description = _v2.b;
return description;
} else {
return 'Idk what this is';
}
}();
return A2(
$elm$html$Html$tr,
_List_fromArray(
[
$elm$html$Html$Attributes$classList(
_List_fromArray(
[
_Utils_Tuple2(
'current',
_Utils_eq(id, model.pc.uCounter))
]))
]),
_List_fromArray(
[
A2(
$elm$html$Html$td,
_List_fromArray(
[
$elm$html$Html$Attributes$class('num')
]),
_List_fromArray(
[
$elm$html$Html$text(
A2($author$project$Main$addLeadingZero, id, 3))
])),
A2(
$elm$html$Html$td,
_List_Nil,
_List_fromArray(
[
$elm$html$Html$text(codeDescription)
]))
]));
} else {
return A2(
$elm$html$Html$tr,
_List_fromArray(
[
$elm$html$Html$Attributes$class('empty')
]),
_List_fromArray(
[
A2(
$elm$html$Html$td,
_List_fromArray(
[
$elm$html$Html$Attributes$class('num')
]),
_List_fromArray(
[
$elm$html$Html$text(
A2($author$project$Main$addLeadingZero, id, 3))
])),
A2(
$elm$html$Html$td,
_List_Nil,
_List_fromArray(
[
$elm$html$Html$text('Empty')
]))
]));
}
var list2table = function (t) {
var id = t.a;
var code = t.b;
return A2(
$elm$html$Html$tr,
_List_fromArray(
[
$elm$html$Html$Attributes$classList(
_List_fromArray(
[
_Utils_Tuple2(
'current',
_Utils_eq(id, model.pc.uCounter)),
_Utils_Tuple2(
'empty',
_Utils_eq(code, $author$project$Main$ActNothing))
]))
]),
_List_fromArray(
[
A2(
$elm$html$Html$td,
_List_fromArray(
[
$elm$html$Html$Attributes$class('num')
]),
_List_fromArray(
[
$elm$html$Html$text(
A2($author$project$Main$addLeadingZero, id, 4))
])),
A2(
$elm$html$Html$td,
_List_Nil,
_List_fromArray(
[
A2($author$project$Main$viewCuInstrSelect, id, code)
]))
]));
};
var indexedList = A2($elm$core$List$indexedMap, $elm$core$Tuple$pair, model.uCode);
return A2(
@ -6056,8 +6113,9 @@ var $author$project$Main$viewCuUCode = function (model) {
]));
};
var $author$project$Main$viewInstrEntry = function (i) {
var instruction = (i / 100000) | 0;
var address = i - (instruction * 100000);
var _v0 = $author$project$Main$seperateInstructionsEntry(i);
var instruction = _v0.a;
var address = _v0.b;
return $elm$html$Html$text(
A2($author$project$Main$addLeadingZero, instruction, 3) + (' ' + A2($author$project$Main$addLeadingZero, address, 5)));
};
@ -6242,10 +6300,53 @@ var $author$project$Main$viewDataBus = function (model) {
]))
]));
};
var $author$project$Main$MsgRamEditAddress = F2(
function (a, b) {
return {$: 'MsgRamEditAddress', a: a, b: b};
});
var $author$project$Main$MsgRamEditInstr = F2(
function (a, b) {
return {$: 'MsgRamEditInstr', a: a, b: b};
});
var $elm$html$Html$Events$alwaysStop = function (x) {
return _Utils_Tuple2(x, true);
};
var $elm$virtual_dom$VirtualDom$MayStopPropagation = function (a) {
return {$: 'MayStopPropagation', a: a};
};
var $elm$html$Html$Events$stopPropagationOn = F2(
function (event, decoder) {
return A2(
$elm$virtual_dom$VirtualDom$on,
event,
$elm$virtual_dom$VirtualDom$MayStopPropagation(decoder));
});
var $elm$json$Json$Decode$at = F2(
function (fields, decoder) {
return A3($elm$core$List$foldr, $elm$json$Json$Decode$field, decoder, fields);
});
var $elm$html$Html$Events$targetValue = A2(
$elm$json$Json$Decode$at,
_List_fromArray(
['target', 'value']),
$elm$json$Json$Decode$string);
var $elm$html$Html$Events$onInput = function (tagger) {
return A2(
$elm$html$Html$Events$stopPropagationOn,
'input',
A2(
$elm$json$Json$Decode$map,
$elm$html$Html$Events$alwaysStop,
A2($elm$json$Json$Decode$map, tagger, $elm$html$Html$Events$targetValue)));
};
var $elm$html$Html$Attributes$value = $elm$html$Html$Attributes$stringProperty('value');
var $author$project$Main$viewRamContent = function (model) {
var ram2table = function (entry) {
var val = entry.b;
var id = entry.a;
var _v0 = $author$project$Main$seperateInstructionsEntry(val);
var instruction = _v0.a;
var address = _v0.b;
return A2(
$elm$html$Html$tr,
_List_fromArray(
@ -6279,7 +6380,32 @@ var $author$project$Main$viewRamContent = function (model) {
]),
_List_fromArray(
[
$author$project$Main$viewInstrEntry(val)
A2(
$elm$html$Html$input,
_List_fromArray(
[
$elm$html$Html$Attributes$type_('number'),
$elm$html$Html$Attributes$value(
A2($author$project$Main$addLeadingZero, instruction, 3)),
$elm$html$Html$Events$onInput(
$author$project$Main$MsgRamEditInstr(id)),
$elm$html$Html$Attributes$class('ram-entry'),
$elm$html$Html$Attributes$class('instruction')
]),
_List_Nil),
A2(
$elm$html$Html$input,
_List_fromArray(
[
$elm$html$Html$Attributes$type_('number'),
$elm$html$Html$Attributes$value(
A2($author$project$Main$addLeadingZero, address, 5)),
$elm$html$Html$Events$onInput(
$author$project$Main$MsgRamEditAddress(id)),
$elm$html$Html$Attributes$class('ram-entry'),
$elm$html$Html$Attributes$class('address')
]),
_List_Nil)
]))
]));
};