Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 148 lines (137 sloc) 4.18 kb
aff68663 »
2012-04-04 Initial commit
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
6 <title>DCPU-16</title>
e7ef12e4 »
2012-04-04 (Kind of) improved the interface, added memory reset
7 <style type="text/css">
8 @font-face { font-family: Electronic Highway Sign; src: url('EHSMB.TTF'); }
9 #container {
10 margin:16px;
11 background: #22a;
12 color: #fff;
13 font-family: Electronic Highway Sign;
14 padding: 6px;
15 }
16 #container a {
17 color: #fff;
18 }
19 button {
20 border: 0;
21 background: #fff;
22 font-size: 32px;
23 font-family: Electronic Highway Sign;
24 color: #22a;
25 }
26 button:active {
27 background: #aaf;
28 }
29 </style>
0b0453f1 »
2012-04-04 Added code compilation
30 <script type="text/javascript" src="dcpu16.js"></script>
31 <script type="text/javascript">
32 function compile() {
33 try {
7ac2e350 »
2012-04-04 Added code cleaning
34 dcpu.compile(dcpu.clean(document.getElementById('editor').value));
fb41ca7f »
2012-04-04 Fixed browser compatibility issues
35 document.getElementById('debug').value = dcpu.getDump();
0b0453f1 »
2012-04-04 Added code compilation
36 } catch(e) {
fb41ca7f »
2012-04-04 Fixed browser compatibility issues
37 document.getElementById('debug').value = e;
0b0453f1 »
2012-04-04 Added code compilation
38 }
39 }
397e034c »
2012-04-04 Added analytics
40 function step() {
41 dcpu.step();
fb41ca7f »
2012-04-04 Fixed browser compatibility issues
42 document.getElementById('debug').value = dcpu.getDump();
397e034c »
2012-04-04 Added analytics
43 }
0b0453f1 »
2012-04-04 Added code compilation
44 function run() {
73391ab4 »
2012-04-04 Fixed runtime and compilation bugs, Notch's example program now works
45 dcpu.run(function() {
fb41ca7f »
2012-04-04 Fixed browser compatibility issues
46 document.getElementById('debug').value = dcpu.getDump();
73391ab4 »
2012-04-04 Fixed runtime and compilation bugs, Notch's example program now works
47 });
fb41ca7f »
2012-04-04 Fixed browser compatibility issues
48 document.getElementById('debug').value = dcpu.getDump();
397e034c »
2012-04-04 Added analytics
49 }
50 function stop() {
51 dcpu.stop();
fb41ca7f »
2012-04-04 Fixed browser compatibility issues
52 document.getElementById('debug').value = dcpu.getDump();
0b0453f1 »
2012-04-04 Added code compilation
53 }
e7ef12e4 »
2012-04-04 (Kind of) improved the interface, added memory reset
54 function reset() {
55 dcpu.clear();
fb41ca7f »
2012-04-04 Fixed browser compatibility issues
56 document.getElementById('debug').value = dcpu.getDump();
868ac27f »
2012-04-04 Console is now cleared on Reset
57 document.getElementById('console').value = '';
e7ef12e4 »
2012-04-04 (Kind of) improved the interface, added memory reset
58 }
05174ea8 »
2012-04-04 Added I/O operations (non-standard)
59 function sendInput() {
60 dcpu.input(document.getElementById('input').value);
61 document.getElementById('input').value = '';
62 }
3cb61383 »
2012-04-04 Added non-standard console print instruction
63
64 dcpu.output(function(c) {
65 document.getElementById('console').value += c;
66 });
0b0453f1 »
2012-04-04 Added code compilation
67 </script>
397e034c »
2012-04-04 Added analytics
68 <script type="text/javascript">
69
70 var _gaq = _gaq || [];
71 _gaq.push(['_setAccount', 'UA-30599135-1']);
72 _gaq.push(['_trackPageview']);
73
74 (function() {
75 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
76 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
77 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
78 })();
79
80 </script>
aff68663 »
2012-04-04 Initial commit
81 </head>
82 <body>
e7ef12e4 »
2012-04-04 (Kind of) improved the interface, added memory reset
83 <div id="container">
84 <a href="http://github.com/mappum/DCPU-16"><h1>DCPU-16 Emulator</h1></a>
868ac27f »
2012-04-04 Console is now cleared on Reset
85 <h2>V0.6 - By Mappum</h2>
e7ef12e4 »
2012-04-04 (Kind of) improved the interface, added memory reset
86 <textarea id="editor" cols="60" rows="40">
b066e7ac »
2012-04-04 Fixed subroutines and various bugs
87 ; Try some basic stuff
88 SET A, 0x30 ; 7c01 0030
89 SET [0x1000], 0x20 ; 7de1 1000 0020
90 SUB A, [0x1000] ; 7803 1000
91 IFN A, 0x10 ; c00d
92 SET PC, crash ; 7dc1 001a [*]
93
94 ; Do a loopy thing
95 SET I, 10 ; a861
96 SET A, 0x2000 ; 7c01 2000
97 :loop SET [0x2000+I], [A] ; 2161 2000
98 SUB I, 1 ; 8463
99 IFN I, 0 ; 806d
100 SET PC, loop ; 7dc1 000d [*]
101
102 ; Call a subroutine
103 SET X, 0x4 ; 9031
104 JSR testsub ; 7c10 0018 [*]
105 SET PC, crash ; 7dc1 001a [*]
106
107 :testsub SHL X, 4 ; 9037
108 SET PC, POP ; 61c1
84875d56 »
2012-04-04 Fixed demo program
109
3cb61383 »
2012-04-04 Added non-standard console print instruction
110 ; "Hello, world!" PRT is a non-standard instruction.
111 ; Pass it an ASCII value to output to console
112 PRT 72
113 PRT 101
114 PRT 108
115 PRT 108
116 PRT 111
117 PRT 44
118 PRT 32
119 PRT 119
120 PRT 111
121 PRT 114
122 PRT 108
123 PRT 100
124 PRT 33
125
126 ; BRK (break) is also non-standard
127 BRK
84875d56 »
2012-04-04 Fixed demo program
128
129 ; Hang forever. X should now be 0x40 if everything went right.
130 :crash SET PC, crash ; 7dc1 001a [*]
b066e7ac »
2012-04-04 Fixed subroutines and various bugs
131 </textarea>
0b0453f1 »
2012-04-04 Added code compilation
132 <textarea id="debug" cols="45" rows="40" readonly="readonly"></textarea>
133 <div style="clear:both;">
134 <button onclick="compile()">Compile</button>
397e034c »
2012-04-04 Added analytics
135 <button onclick="step()">Step</button>
0b0453f1 »
2012-04-04 Added code compilation
136 <button onclick="run()">Run</button>
397e034c »
2012-04-04 Added analytics
137 <button onclick="stop()">Stop</button>
e7ef12e4 »
2012-04-04 (Kind of) improved the interface, added memory reset
138 <button onclick="reset();">Reset</button>
aff68663 »
2012-04-04 Initial commit
139 </div>
3cb61383 »
2012-04-04 Added non-standard console print instruction
140 <hr />
141 <h2>Console:</h2>
05174ea8 »
2012-04-04 Added I/O operations (non-standard)
142 <textarea id="console" cols="110" rows="20" readonly="readonly"></textarea>
143 <input id="input" type="text" style="width:800px; height:32px; vertical-align: bottom" />
144 <button id="submit" style="width:92px" onclick="sendInput()">>></button>
e7ef12e4 »
2012-04-04 (Kind of) improved the interface, added memory reset
145 </div>
aff68663 »
2012-04-04 Initial commit
146 </body>
147 </html>
Something went wrong with that request. Please try again.