Skip to content

Commit cc1adf9

Browse files
committed
Document devices, fix read-write highlight bug, add reset mode to ascii display, fix PDWM instruction
1 parent d23f1e0 commit cc1adf9

14 files changed

+394
-33
lines changed

_css/editor.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040

4141
.e-decimal{
42-
color: #00BBDD;
42+
color: #00FFCC;
4343
font-weight: bold;
4444
}
4545

_css/popup.css

+52-10
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,76 @@
2727

2828
.popup{
2929
display: none;
30-
background-color: #F8F8FF;
31-
border: 1px rgba(0, 0, 0, 0.8) solid;
3230
max-width: 600px;
3331
width: 90%;
34-
min-height: 200px;
35-
margin: 50px auto;
36-
overflow: hidden;
37-
top: 10%;
32+
margin: 50px auto 0px auto;
33+
position: relative;
34+
height: calc(85% - 60px);
35+
}
36+
37+
.popup section, .popup h2{
38+
border: 1px rgba(0, 0, 0, 0.8) solid;
39+
box-sizing: border-box;
3840
}
3941

4042
.popup h2{
4143
display: block;
42-
width: 100%;
4344
background-color: #EEEEFF;
4445
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.05));
4546
padding-left: 5px;
4647
padding-top: 3px;
47-
border-bottom: 1px rgba(0, 0, 0, 0.8) solid;
48+
border-bottom: 0px;
49+
}
50+
51+
.popup h3{
52+
font-weight: 500;
53+
margin: 7px 0px;
54+
}
55+
56+
.popup section{
57+
display: block;
58+
padding: 5px;
59+
font-family: OpenSans, sans-serif;
60+
background-color: #F8F8FF;
61+
min-height: 200px;
62+
height: 100%;
63+
overflow-y: auto;
64+
}
65+
66+
.popup table{
67+
border-collapse: collapse;
68+
margin-bottom: 7px;
69+
}
70+
71+
.popup table td, .popup table th{
72+
border: 1px #CCCCCC solid;
73+
background-color: #FEFEFF;
74+
text-align: left;
75+
padding: 3px;
76+
}
77+
78+
.popup table th{
79+
font-weight: 500;
80+
}
81+
82+
.popup code{
83+
box-sizing: border-box;
84+
border: 1px #CCCCCC solid;
85+
background-color: #FEFEFF;
86+
margin-bottom: 10px;
87+
display: block;
88+
width: 100%;
89+
padding: 5px;
4890
}
4991

5092
.popup .popupCloseButton{
5193
float: right;
5294
display: block;
53-
margin: -2px 6px -2px -2px;
95+
margin: -2px 1px -2px -2px;
5496
height: 19px;
5597
width: 19px;
5698
text-align: center;
57-
padding: 0px 5px;
99+
padding: 0px 6px;
58100
line-height: 1em;
59101
font-family: OpenSans, sans-serif;
60102
}

_js/AsciiDisplay.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
2-
A dot matrix display.
2+
An ASCII text display.
33
44
Address | Mode
55
--------+----------------
6-
040 | push ASCII character
7-
041 | set or replace character at caret
6+
040 | Push ASCII character
7+
041 | Set or replace character at caret
8+
042 | Clear and reset
89
*/
910

1011
var AsciiDisplay = new function(){
@@ -49,6 +50,9 @@ var AsciiDisplay = new function(){
4950
handleControlCharacter(character);
5051
}
5152
break;
53+
case "042": // Clear
54+
reset();
55+
break;
5256
}
5357
}
5458

_js/Assembler.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ var Assembler = new function(){
3737
lines.splice(i, 1);
3838
continue;
3939
}
40-
40+
41+
lines[i] = lines[i].replace(/\B' '\B/g, "'SPACE'"); // replace ' ' with 'SPACE', to avoid it being split(' ');
4142
lines[i] = lines[i].split(" ");
4243
var l = lines[i].length;
4344
while(l--){
@@ -74,6 +75,10 @@ var Assembler = new function(){
7475

7576
// Translate printable ascii chars (syntax: 'a')
7677
// to octal
78+
if(lines[i][l] === "'SPACE'"){ // first, revert placeholder 'SPACE'
79+
lines[i][l] = "' '";
80+
}
81+
7782
if(/'[ -~]'/g.test(lines[i][l]) === true){
7883
var character = lines[i][l].charCodeAt(1);
7984
lines[i][l] = decToOct(character);

_js/Devices.js

+1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ var Dev = {
4242
,new Device('034', DotMatrix)
4343
,new Device('040', AsciiDisplay)
4444
,new Device('041', AsciiDisplay)
45+
,new Device('042', AsciiDisplay)
4546
]
4647
}

_js/DotMatrix.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
44
Address | Mode
55
--------+----------------
6-
030 | Flip pixel at pdout XXXX YYYY
7-
031 | Turn on pixel at pdout XXXX YYYY
8-
032 | Turn off pixel at pdout XXXX YYYY
6+
030 | Flip pixel at pdout YYYY XXXX
7+
031 | Turn on pixel at pdout YYYY XXXX
8+
032 | Turn off pixel at pdout YYYY XXXX
99
033 | Feed pdout to dot matrix, each byte controlling a pixel.
1010
034 | Fill matrix with pattern in pdout
1111
*/

_js/Editor.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ function Editor(
5151
if(comment.length > 0){
5252
comment = '<span class="e-comment">'+comment+"</span>";
5353
}
54-
54+
55+
code = code.replace(/\B' '\B/g, "'SPACE'");
5556
code = code.split(" ");
5657
var c = code.length;
5758
while(c--){
@@ -65,6 +66,9 @@ function Editor(
6566
code[c] = '<span class="e-valid-instruction" title="Opcode '+oct+'">'+fragment+"</span>";
6667
}
6768
} else if(fragment.substring(0, 1) == "'"){
69+
if(fragment === "'SPACE'"){
70+
fragment = "' '";
71+
}
6872
if(/'[ -~]'/g.test(fragment) === false){ // Invalid character
6973
code[c] = '<span class="e-invalid-char" title="Invalid character">'+fragment+"</span>";
7074
} else { // Valid character
@@ -79,8 +83,8 @@ function Editor(
7983
}
8084
} else if(fragment.substring(0, 1) == "#"){ // Binary value
8185
code[c] = '<span class="e-binary" title="Octal: '+binToOct(fragment)+'">'+fragment+"</span>";
82-
} else if(fragment.substring(fragment.length-1, fragment.length) == "."){ // Decimal value
83-
code[c] = '<span class="e-decimal" title="Octal: '+binToOct(fragment)+'">'+fragment+"</span>";
86+
} else if(fragment.substring(fragment.length-1, fragment.length) == "."){ // Decimal value
87+
code[c] = '<span class="e-decimal" title="Octal: '+decToOct(fragment.substring(0, fragment.length-1))+'">'+fragment+"</span>";
8488
} else if(/^([0-7]*)$/.test(fragment) === true && fragment.length > 0){ // Octal value
8589
code[c] = '<span class="e-octal" title="Binary: '+octToBin(fragment)+'">'+fragment+"</span>";
8690
}

_js/Flag.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ function Flag(id){
1515
element.innerHTML = value;
1616

1717
if(Config.useAnimations){
18-
element.className += ' written';
19-
setTimeout(function(){element.className = ""}, 10);
18+
element.className = 'written';
19+
setTimeout(function(){element.className = ""}, 50);
2020
}
2121
}
2222
function get(){
2323
if(Config.useAnimations){
24-
element.className += ' read';
25-
setTimeout(function(){element.className = ""}, 10);
24+
element.className = 'read';
25+
setTimeout(function(){element.className = ""}, 50);
2626
}
2727

2828
return value;

_js/Ins.js

+1
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ var Ins = {
563563
Reg.abr.set(Reg.ar.get());
564564
mem.read();
565565
Reg.pdout.set(Reg.din.get());
566+
Dev.update();
566567
}
567568
,pdwa: function(){
568569
// Write accumulator value to periphery data out bus

_js/Mem.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ var Mem = function(
4949
memory[addr].element.innerHTML = binToOct(memory[addr].data);
5050

5151
if(Config.useAnimations){
52-
memory[addr].element.className += ' written';
53-
setTimeout(function(){memory[addr].element.className = ""}, 10);
52+
memory[addr].element.className = 'written';
53+
setTimeout(function(){memory[addr].element.className = ""}, 50);
5454
}
5555
}
5656

@@ -62,8 +62,8 @@ var Mem = function(
6262
dInReg.set(memory[addr].data);
6363

6464
if(Config.useAnimations){
65-
memory[addr].element.className += ' read';
66-
setTimeout(function(){memory[addr].element.className = ""}, 10);
65+
memory[addr].element.className = 'read';
66+
setTimeout(function(){memory[addr].element.className = "";}, 50);
6767
}
6868
}
6969

_js/Register.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ function Register(id){
1616
element.title = "Dec:\t"+binToDec(value) + " \nBin:\t"+ value;
1717

1818
if(Config.useAnimations){
19-
element.className += ' written';
20-
setTimeout(function(){element.className = "registerValue"}, 10);
19+
element.className = 'registerValue written';
20+
setTimeout(function(){element.className = "registerValue"}, 50);
2121
}
2222
}
2323
function get(){
2424
if(Config.useAnimations){
25-
element.className += ' read';
26-
setTimeout(function(){element.className = "registerValue"}, 10);
25+
element.className = 'registerValue read';
26+
setTimeout(function(){element.className = "registerValue"}, 50);
2727
}
2828

2929
return value;

0 commit comments

Comments
 (0)