-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
104 lines (89 loc) · 6.82 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Trincot's home page</title>
<style>
table { border-collapse: collapse; }
td, th { border: 1px solid }
</style>
</head>
<body>
<h1>Trincot</h1>
<h3>Little Man Computer</h3>
<ul>
<li><a href="https://github.com/trincot/lmc">JavaScript implementation</a></li>
<li><a href="lmc.html">Online Emulator</a></li>
</ul>
<h4>LMC Solutions on Stack Overflow:</h4>
<ul>
<li><a href="https://stackoverflow.com/a/64062369/5459839">Least of two</a></li>
<li><a href="https://stackoverflow.com/a/59051937/5459839">Count down from 10 to 0</a></li>
<li><a href="https://stackoverflow.com/a/59040818/5459839">Count up from 0 to 10</a></li>
<li><a href="https://stackoverflow.com/a/59022938/5459839">Input is odd or even</a></li>
<li><a href="https://stackoverflow.com/a/63473805/5459839">Sum input numbers</a></li>
<li><a href="https://stackoverflow.com/a/64387413/5459839">Sum input numbers and output whether that sum is odd</a></li>
<li><a href="https://stackoverflow.com/a/63871507/5459839">Greatest among input</a></li>
<li><a href="https://stackoverflow.com/a/58962577/5459839">Count numbers that are positive and are negative (10-complement)</a></li>
<li><a href="https://stackoverflow.com/q/66300173/5459839">Bubble sort 3 inputs</a></li>
<li><a href="https://stackoverflow.com/a/63863921/5459839">Bubble sort 4 inputs</a></li>
<li><a href="https://stackoverflow.com/a/59022003/5459839">Integer division</a></li>
<li><a href="https://stackoverflow.com/a/63783281/5459839">Convert input to binary</a></li>
<li><a href="https://stackoverflow.com/a/66998074/5459839">Convert reversed binary to decimal</a></li>
<li><a href="https://stackoverflow.com/a/59021844/5459839">Convert input to a chosen base (between 2 and 9)</a></li>
<li><a href="https://stackoverflow.com/a/64418779/5459839">Collect input in array</a></li>
<li><a href="https://stackoverflow.com/a/59022060/5459839">Calculate a² + (b x c)</a></li>
<li><a href="https://stackoverflow.com/a/64516006/5459839">Output all divisors of the input</a></li>
<li><a href="https://stackoverflow.com/a/64076008/5459839">Sieve of Eratosthenes</a></li>
<li><a href="https://stackoverflow.com/a/64558379/5459839">Buble sort (with terminating zero)</a></li>
<li><a href="https://stackoverflow.com/a/64587801/5459839">Buble sort (first input is array size)</a></li>
</ul>
<style>
.red { background: red }
.orange { background: orange }
</style>
<h4>Other Emulators</h4>
<table>
<tr><th>Feature</th><th>Trincot's</th><th>www.101computing.net/LMC/</th><th>peterhigginson.co.uk/lmc/</th></tr>
<tr><td>Assembler syntax</td><td>STA + OTC</td><td>STA</td><td>STA + OTC</td></tr>
<tr><td>Assembles into 3-digit numbers</td><td>yes</td><td class="red">no, middle zero is omited! LDA 1 becomes 51 instead of 501. It executes correctly, but it is problematic for self modifying code</td><td>yes</td></tr>
<tr><td>Comment start character</td><td>Any non-alphanumerical</td><td class="red">not supported</td><td>slash /</td></tr>
<tr><td>Labels case sensitive</td><td>no</td><td>no</td><td>yes</td></tr>
<tr><td>Rejects unresolved labels</td><td>yes</td><td class="red">no, the label name gets stored in the mailbox</td><td>yes</td></tr>
<tr><td>Rejects mnemonics as labels</td><td>yes</td><td>yes</td><td>yes</td></tr>
<tr><td>Can use mailbox numbers</td><td>yes</td><td>yes</td><td>yes</td></tr>
<tr><td>Rejects numerical labels</td><td>yes</td><td class="red">no, overrides mailbox number</td><td>no, ignores them</td></tr>
<tr><td>DAT range</td><td>{0,...,999}</td><td class="red">any string</td><td class="red">any decimal number</td></tr>
<tr><td>DAT parses hexadecimal</td><td>no</td><td>no</td><td>yes</td></tr>
<tr><td>DAT parses binary</td><td>no</td><td>no</td><td>yes</td></tr>
<tr><td>DAT parses scientific notation</td><td>no</td><td>no</td><td>yes</td></tr>
<tr><td>DAT parses label reference</td><td>yes</td><td>no</td><td>yes</td></tr>
<tr><td>DAT forbids decimals</td><td>yes</td><td class="red">no</td class="red"><td>no</td></tr>
<tr><td>DAT forbids non-numerical</td><td>yes</td><td class="red">no</td><td>yes</td></tr>
<tr><td>DAT default value</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>DAT without label definition</td><td>yes</td><td class="red">no</td><td>yes</td></tr>
<tr><td>DAT is optional</td><td>yes</td><td>no</td><td>no</td></tr>
<tr><td>DAT without value, with comment</td><td>yes</td><td>no</td><td class="red">no</td></tr>
<tr><td>INP range</td><td>{0,...,999}</td><td class="red">any string</td><td>{-999,...,999}</td></tr>
<tr><td>INP parses hexadecimal</td><td>no</td><td>no, but calculation does</td><td>yes</td></tr>
<tr><td>INP parses binary</td><td>no</td><td>no</td><td>yes</td></tr>
<tr><td>INP parses scientific notation</td><td>no</td><td>no</td><td>yes, but only loads part before E</td></tr>
<tr><td>INP parses label reference</td><td>no</td><td>no</td><td>no</td></tr>
<tr><td>INP forbids decimals</td><td>yes, non-digit is taken as delimeter</td><td class="red">no</td><td>yes, it ignores them</td></tr>
<tr><td>BRA without argument is error</td><td>yes</td><td>no, execution stops</td><td class="red">no, default mailbox is 0</td></tr>
<tr><td>INP with argument is error</td><td>yes</td><td class="red">no, is appended to opcode</td><td>no, is ignored</td></tr>
<tr><td>Accumulator after LDA</td><td>{0,...,999}</td><td class="red">result of parseInt: floating point, NaN, Infinity</td><td class="red">[-999.0, 1000.0) - Hangs when reading really BIG numbers with 300 digits</td></tr>
<tr><td>Accumulator after INP</td><td>{0,...,999}</td><td class="red">exact copy (string)</td><td>{-999,...,999}</td></tr>
<tr><td>99: LDA 0 behaviour</td><td>error on mailbox 99</td><td class="red">continues to 100 and remains in executing state</td><td class="red">continues to 100 and stops in fast mode, but in non-fast mode will continue to 101, 102, ... reading undefined</td></tr>
<tr><td>99: BRA 0 works</td><td>yes</td><td>yes</td><td class="orange">yes, but have to encode the BRA instruction inside the mailbox</td></tr>
<tr><td>Loading too large program is rejected</td><td>yes</td><td class="red">no, execution remains at PC=100</td><td>yes, clipped at 98, and mailbox 99 is always 0</td></tr>
<tr><td>BRP branches when</td><td>flag is not set</td><td>accumulator is not negative and not NaN</td><td>accumulator is not negative</td></tr>
<tr><td>BRZ branches when</td><td>accumulator is zero and flag is not set</td><td>accumulator is zero</td><td>accumulator is zero</td></tr>
<tr><td>0xx is executed as HLT</td><td>yes</td><td class="red">no, left-most digit is taken as opcode</td><td>yes</td></tr>
<tr><td>4xx is an error</td><td>yes</td><td>no-op</td><td>yes</td></tr>
<tr><td>999 is an error</td><td>yes</td><td>no-op</td><td>yes</td></tr>
<tr><td>Can run Sort program</td><td>yes</td><td>yes</td><td>yes</td></tr>
</table>
</body>
</html>