-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathz80js.html
494 lines (436 loc) · 20.9 KB
/
z80js.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>A Javascript based Z80 Disassembler and Simulator
</title>
<style>
.box {
float: left;
width: 50%;
padding: 0px;
}
.clearfix::after {
clear: both;
display: table;
}
</style>
<script src="z80cpu.js"></script>
</head>
<body>
<!--<div style="background-color:#ddd">
<p style="margin-left:2.5%;margin-right:2.5%;width:90%">Assembly Listing</p>
<textarea name="iHex" id="iHex" rows="4" style="margin-left:2.5%;margin-right:2.5%;width:95%">
</textarea><br/>
<button style="margin-left:2.5%;margin-right:0%;">Assemble to Binary</button>
</div>
<hr style="border:solid #aaaaff 1px;height:1px;margin-top"/>
-->
<div class="">
<div class="box" style="background-color:#eee">
<p style="margin-left:5%;margin-right:5%;width:90%">Binary Code (Hex-Binary)</p>
<textarea name="binary" id="binary" rows="4" style="margin-left:5%;margin-right:5%;width:90%">
3E0FD302D30318287036737A7D74360F
6D682D2A632C606E4C74C1549A701919
5927ED78A358494A111674D277505110
1100020E0179D3012108007EADD30006
8010FE23AF79174FD30130EF1BAFBB20
E2BA20DF1100020E0179D3012110007E
ADD300068010FE23AF79174FD30130EF
1BAFBB20E2BA20DF1100020E0179D301
2118007EADD300068010FE23AF79174F
D30130EF1BAFBB20E2BA20DF1100020E
0179D3012120007EADD300068010FE23
AF79174FD30130EF1BAFBB20E2BA20DF
1100020E0179D3012128007EADD30006
8010FE23AF79174FD30130EF1BAFBB20
E2BA20DF110002189200000000000000
783F7971717938000000000000000000
7D793F39773976790000000000000000
546DDB4F865B6D3F0000000000000000
7906CF5BE66D7D6D0000000000000000
393F5EF93F7F066D
</textarea><br/>
<button style="margin-left:5%;margin-right:0%;" onclick="javascript:disassemble()">Disassemble</button>
<button style="margin-left:0%;margin-right:0%;" onclick="">Convert to I08Hex</button>
<button style="margin-left:0%;margin-right:0%;" onclick="">Convert to S-Record</button>
</div>
<div class="box" style="background-color:#ddd">
<p style="margin-left:5%;margin-right:5%;width:90%">Binary Code (I08HEX or S-Record Format)</p>
<textarea name="iHex" id="iHex" rows="4" style="margin-left:5%;margin-right:5%;width:90%">
</textarea><br/>
<button style="margin-left:5%;margin-right:0%;">Convert I08Hex to Binary</button>
<button style="margin-left:0%;margin-right:0%;">Convert S-Record to Binary</button>
</div>
</div>
<hr style="border:solid #aaaaff 1px;height:1px;margin-top"/>
<div>
<p>Z80 Archictecture and Register</p>
<!--<div style="width:100%;height:*;position:relative;background-Image:url(Z80_arch.svg);background-size:100%;background-repeat:no-repeat;">-->
<div style="width:100%;height:*;max-width:250mm;position:relative;background-color:#dbf1ff">
<img src="Z80_arch.svg" style="width:100%;opacity: 0.7;">
<div style="position:absolute;left:14.5%;top:22%">
<label for="I">I <input type=text name="I" id="I" value="0x00" style="width:2.5em;background-color:#ccc"/> </label></div>
<div style="position:absolute;left:20.8%;top:22%">
<label for="R">R <input type=text name="R" id="R" value="0x00" style="width:2.5em;background-color:#ccc"/> </label></div>
<div style="position:absolute;left:35.6%;top:25%">
<label for="Wdash"> W'<input type=text name="Wdash" id="Wdash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label></div>
<div style="position:absolute;left:43%;top:25%">
<label for="Zdash">Z'<input type=text name="Zdash" id="Zdash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/></label> </div>
<div style="position:absolute;left:36%;top:30%">
<label for="Bdash">B'<input type=text name="Bdash" id="Bdash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:43%;top:30%">
<label for="Cdash">C'<input type=text name="Cdash" id="Cdash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label></div>
<div style="position:absolute;left:36%;top:36%">
<label for="Ddash">D'<input type=text name="Ddash" id="Ddash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:43%;top:36%">
<label for="Edash">E'<input type=text name="Edash" id="Edash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:36%;top:42%">
<label for="Hdash">H'<input type=text name="Hdash" id="Hdash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:43%;top:42%">
<label for="Ldash">L'<input type=text name="Ldash" id="Ldash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:50.9%;top:25%">
<label for="W">W <input type=text name="W" id="W" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:58%;top:25%">
<label for="Z" >Z <input type=text name="Z" id="Z" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:51%;top:30%">
<label for="B" >B <input type=text name="B" id="B" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:58%;top:30%">
<label for="C">C <input type=text name="C" id="C" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:51%;top:36%">
<label for="D" >D <input type=text name="D" id="D" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:58%;top:36%">
<label for="E" >E <input type=text name="E" id="E" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:51%;top:42%">
<label for="H" >H <input type=text name="H" id="H" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:58%;top:42%">
<label for="L" >L <input type=text name="L" id="L" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:46%;top:47%">
<label for="IX" >IX <input type=text name="IX" id="IX" value="0x0000" style="width:4em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:46%;top:52%">
<label for="IY" >IY <input type=text name="IY" id="IY" value="0x0000" style="width:4em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:46%;top:57%">
<label for="SP" >SP <input type=text name="SP" id="SP" value="0x0000" style="width:4em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:46%;top:62%">
<label for="PC" >PC <input type=text name="PC" id="PC" value="0x0000" style="width:4em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:76.2%;top:32%">
<label for="Adash" >A'<input type=text name="Adash" id="Adash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:76.2%;top:26%">
<label for="A" >A <input type=text name="A" id="A" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:86%;top:32%">
<label for="Fdash" >F'<input type=text name="Fdash" id="Fdash" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:86%;top:26%">
<label for="F" >F <input type=text name="F" id="F" value="0x00" style="width:2.5em;background-color:#f4d7d7"/> </label> </div>
<div style="position:absolute;left:92%;top:26%">
<label for="Flong" ><input type=text name="Flong" id="Flong" value="SZ_H_PNC" style="width:5.3em;background-color:#dbf1ff"/> </label> </div>
<div style="position:absolute;left:92%;top:32%">
<label for="Flong" ><input type=text name="Fdashlong" id="Fdashlong" value="SZ_H_PNC" style="width:5.3em;background-color:#dbf1ff"/> </label> </div>
<div style="position:absolute;left:92%;top:37%">
<label for="F" >Out <br/> <textarea name="Out" id="Out" rows="10" style="width:4em;background-color:#dbf1ff;overflow: hidden;"></textarea> </label> </div>
</div>
<p style="text-align:left;color:#aaa;font-size:small;margin-top:0px;margin-bottom:0px"> Image credit: Appaloosa, 17 October 2007, https://commons.wikimedia.org/wiki/File:Z80_arch.svg</p>
</div>
<hr style="border:solid #aaaaff 1px;height:1px;margin-top"/>
<p>Z80 Disassembler and Simulator</p>
<div class="clearfix">
<button onclick="javascript:reset()">Reset</button>
<button onclick="javascript:run()">Run</button>
<button onclick="javascript:halt()">Halt</button><br/>
<button onclick="javascript:halt()">Step into</button>
<button onclick="javascript:halt()">Step over</button>
<button onclick="javascript:halt()">Step out</button>
<button onclick="javascript:step()">Step 1</button>
<button onclick="javascript:stepN()">Step N</button>
<label for="N">N <input type=text name="N" id="N" value="2" style="width:4em;background-color:#f4d7d7"/> </label>
<label for="autoStep">Auto Step<input type="checkbox" name="autoStep" id="autoStep" onclick="javascript:autoStep()"/></label>
<label for="Hz"><input type=text name="Hz" id="Hz" value="1" style="width:2em;background-color:#f4d7d7"/>Hz</label><br/>
<button onclick="javascript:runToAddr()">Run to addr</button>
<label for="Bkpt1">Addr <input type=text name="Addr" id="Addr" value="0x0030" style="width:4em;background-color:#f4d7d7"/> </label>
<label for="Bkpt1">Bkpt1 <input type=text name="Bkpt1" id="Bkpt1" value="0x0000" style="width:4em;background-color:#f4d7d7"/><input type="checkbox" name="Bkpt1Enabled" id="Bkpt1Enabled" disabled="disabled" /> </label>
<label for="Bkpt2">Bkpt2 <input type=text name="Bkpt2" id="Bkpt2" value="0x0000" style="width:4em;background-color:#f4d7d7"/><input type="checkbox" name="Bkpt2Enabled" id="Bkpt2Enabled" disabled="disabled" /> </label><br/>
<button onclick="javascript:interrupt()">INT</button>
<button onclick="javascript:nminterrupt()">NMI</button>
</div>
<hr style="border:solid #aaaaff 1px;height:1px;margin-top"/>
<p>Output</p>
<!-- I shall not use spaces to format text -->
<div class="clearfix">
<div class="box" style="background-color:#ddd">
<p style="margin-left:5%;margin-right:5%;width:90%">Disassembly</p>
<p style="margin-left:5%;margin-right:5%;width:90%;margin-bottom:0px;">address cmd+data mnemonic</p>
<textarea name="disassembly" id="disassembly" rows="20" style="margin-left:5%;margin-right:5%;width:90%">
</textarea><br/>
</div>
<div class="box" style="background-color:#eee">
<p style="margin-left:5%;margin-right:5%;width:90%">Exceution Log</p>
<p style="margin-left:5%;margin-right:5%;width:90%;margin-bottom:0px;">step address cmd+data mnemonic</p>
<textarea name="disassembly" id="excection" rows="20" style="margin-left:5%;margin-right:5%;width:90%">
</textarea><br/>
</div>
</div>
<hr style="border:solid #aaaaff 1px;height:1px;margin-top"/>
<p>Call Graph</p>
<button onclick="javascript:drawCallGraph()">Draw Call Graph</button>
<div style="background-color:#ddd">
<p style="margin-left:2.5%;margin-right:2.5%;width:90%">SVG Call Graph of Excecution</p>
<canvas id="CallGraph" width="200" height="100"></canvas>
</div>
<hr style="border:solid #aaaaff 1px;height:1px;margin-top"/>
<p>Address Based Flow Graph</p>
<button onclick="javascript:drawFlowGraph()">Draw Flow Graph</button>
<div style="background-color:#ddd">
<p style="margin-left:2.5%;margin-right:2.5%;width:90%">SVG Flow Graph of Excecution</p>
<canvas id="FlowGraph" width="200" height="100"></canvas>
</div>
<hr style="border:solid #aaaaff 1px;height:1px;margin-top"/>
<p>Further reading</p>
Zilog Z80 CPU User Manual <a href="http://z80.info/zip/z80cpu_um.pdf">http://z80.info/zip/z80cpu_um.pdf</a><br/>
Z80 Family Interrupt Structure by Michael Moor <a href="http://z80.info/1653.htm">http://z80.info/1653.htm</a><br/>
Kurze Übersicht über die Befehle des Z80 by Matthias Buchhorn <a href="https://www.mikrocontroller.net/attachment/235150/Instruction_Card_Z80.pdf">https://www.mikrocontroller.net/attachment/235150/Instruction_Card_Z80.pdf</a><br/>
Z80 Instruction Set <a href="http://wikiti.brandonw.net/index.php?title=Z80_Instruction_Set">http://wikiti.brandonw.net/index.php?title=Z80_Instruction_Set</a>
<script language="javascript">
var logger={
log:function(text){console.log(text);},
warn:function(text){console.warn(text);},
error:function(text){console.error(text);},
};
logger.log("z80js - Z80 Disassembler and Simulator starting");
var stepCounter = 0;
var maxSteps=100;
var autoStepTimer;
var stepCount=0;
var cpu=Object.create(Z80CPU);
logger.log("z80js - Z80 Disassembler and Simulator ready");
function pad(value, width) {
value = value + "";
return value.length >= width ? value : new Array(width - value.length + 1).join('0') + value;
}
function asQwordHex(value){
return "0x"+pad(value.toString(16),16);
}
function asDwordHex(value){
return "0x"+pad(value.toString(16),8);
}
function asWordHex(value){
return "0x"+pad(value.toString(16),4);
}
function asByteHex(value){
if(Array.isArray(value)){
var tmp="";
for(var i=0;i<value.length;i++){
tmp+=asByteHex(value[i])+" ";
}
return tmp;
}
if(value==null){
return "____";
}
return "0x"+pad(value.toString(16),2);
}
function run(){
document.getElementById("autoStep").checked=false;
autoStepTimer=setInterval(step, 1);
}
function halt(){
document.getElementById("autoStep").checked=false;
clearTimeout(autoStepTimer);
}
function reset(){
stepCount=0;
halt();
document.getElementById("excection").value="";
disassemble();
cpu.reset();
updateGUI();
}
function step(){
document.getElementById("excection").value+=""+(stepCount++)+":\t"+cpu.step();
updateGUI();
}
function stepN(){
var i=0;
var j=document.getElementById("N").value;
while(i<j){
step();
i++;
}
}
function autoStep(){
if(document.getElementById("autoStep").checked==true){
logger.log("auto step on");
var hz=document.getElementById("Hz").value;
autoStepTimer=setInterval(step, 1000/hz);
}else{
logger.log("auto step off");
clearTimeout(autoStepTimer);
}
}
function runToAddr(){
var addr = parseInt(document.getElementById("Addr").value, 16);
//while(pc!=addr&&excecute('RUN')){
logger.error("needs fixing");
//}
}
function interrupt(){
logger.log("Interrupt caught");
cpu.interrupt();
updateGUI();
}
function nminterrupt(){
logger.log("Non maskable interrupt caught");
cpu.nonmaskableinterrupt();
updateGUI();
}
function flagBit(flag){
//F register holds flags
//bit 7 S - sign flag
//bit 6 Z - zero flag
//bit 5 X - not used / undocumented flag
//bit 4 H - half carry flag (carry from bit 3 to bit 3. used for BCD arithmetic)
//bit 3 X - not used / undocumented flag
//bit 2 P/V - parity or overflow
//bit 1 N - last operation was subtract
//bit 0 C - carry
switch(flag){
case "S":
return 7;
break;
case "Z":
return 6;
break;
case "H":
return 4;
break;
case "P":
case "V":
return 2;
break;
case "N":
return 1;
break;
case "C":
return 0;
break;
default:
return -1;
}
}
function setFlag(flag, value){
cpu.flags.F|=(1<<flagBit(flag));
}
function getFlag(F,flag){
return (F&(1<<flagBit(flag)));
}
function clearFlag(flag, value){
cpu.flags.F&=~(1<<flagBit(flag));
}
function clearFlags(){
cpu.flags.F=0;
}
function flagsToString(f){
var flagArray=[..."SZ_H_PNC"];
for(var i=0;i<flagArray.length;i++){
if(!getFlag(f,flagArray[i])){
flagArray[i]="_";
//logger.log("flag "+flagArray[i]+" is not set");
}else{
//logger.log("flag "+flagArray[i]+" is set");
}
}
return flagArray.join('');
}
function disassemble(){
var binary=document.getElementById("binary").value;
binary = binary.toUpperCase();
binary = binary.replace(/[^A-Z0-9]/gi,"");
logger.log("Ascii Encoded length: "+binary.length);
var binaryBytes = new Uint8Array(binary.length/2);
logger.log("Binary length: "+binaryBytes.length);
for(var i=0;i<binary.length/2;i++){
//disassembly+=binary[2*i]+""+binary[2*i+1]+"\n";
binaryBytes[i]=parseInt("0x"+binary[2*i]+""+binary[2*i+1]);
//logger.log(binaryBytes[i]);
}
cpu.reset();
cpu.programMemory(binaryBytes);
document.getElementById("disassembly").value=cpu.disassemble();
cpu.reset();
}
function updateGUI(){
//document.getElementById("excection").value=excection;
highlightUpdateValue(document.getElementById("I"),""+asByteHex(cpu.registers.I));
highlightUpdateValue(document.getElementById("R"),""+asByteHex(cpu.registers.R));
highlightUpdateValue(document.getElementById("A"),""+asByteHex(cpu.registers.A));
highlightUpdateValue(document.getElementById("Adash"),""+asByteHex(cpu.registers.Adash));
highlightUpdateValue(document.getElementById("F"),""+asByteHex(cpu.registers.F));
highlightUpdateValue(document.getElementById("Fdash"),""+asByteHex(cpu.registers.Fdash));
highlightUpdateValue(document.getElementById("W"),""+asByteHex(cpu.registers.W));
highlightUpdateValue(document.getElementById("Wdash"),""+asByteHex(cpu.registers.Wdash));
highlightUpdateValue(document.getElementById("Z"),""+asByteHex(cpu.registers.Z));
highlightUpdateValue(document.getElementById("Zdash"),""+asByteHex(cpu.registers.Zdash));
highlightUpdateValue(document.getElementById("B"),""+asByteHex(cpu.registers.B));
highlightUpdateValue(document.getElementById("Bdash"),""+asByteHex(cpu.registers.Bdash));
highlightUpdateValue(document.getElementById("C"),""+asByteHex(cpu.registers.C));
highlightUpdateValue(document.getElementById("Cdash"),""+asByteHex(cpu.registers.Cdash));
highlightUpdateValue(document.getElementById("D"),""+asByteHex(cpu.registers.D));
highlightUpdateValue(document.getElementById("Ddash"),""+asByteHex(cpu.registers.Ddash));
highlightUpdateValue(document.getElementById("E"),""+asByteHex(cpu.registers.E));
highlightUpdateValue(document.getElementById("Edash"),""+asByteHex(cpu.registers.Edash));
highlightUpdateValue(document.getElementById("H"),""+asByteHex(cpu.registers.H));
highlightUpdateValue(document.getElementById("Hdash"),""+asByteHex(cpu.registers.Hdash));
highlightUpdateValue(document.getElementById("L"),""+asByteHex(cpu.registers.L));
highlightUpdateValue(document.getElementById("Ldash"),""+asByteHex(cpu.registers.Ldash));
highlightUpdateValue(document.getElementById("IX"),""+asWordHex(cpu.registers.IX));
highlightUpdateValue(document.getElementById("IY"),""+asWordHex(cpu.registers.IY));
highlightUpdateValue(document.getElementById("SP"),""+asWordHex(cpu.registers.SP));
highlightUpdateValue(document.getElementById("PC"),""+asWordHex(cpu.registers.PC));
document.getElementById("Out").value=""+(cpu.registers.inOut[0]==undefined?"--":asByteHex(cpu.registers.inOut[0]))+"\n"+(cpu.registers.inOut[1]==undefined?"--":asByteHex(cpu.registers.inOut[1]))+"\n"+(cpu.registers.inOut[2]==undefined?"--":asByteHex(cpu.registers.inOut[2]))+"\n"+(cpu.registers.inOut[3]==undefined?"--":asByteHex(cpu.registers.inOut[3]))+"\n";
document.getElementById("Out").scrollTop=document.getElementById("Out").scrollHeight;
document.getElementById("excection").scrollTop=document.getElementById("excection").scrollHeight;
highlightUpdateValue(document.getElementById("Flong"),flagsToString(cpu.registers.F));
highlightUpdateValue(document.getElementById("Fdashlong"),flagsToString(cpu.registers.Fdash));
}
function highlightUpdateValue(field, value){
if(field.value==value){
field.style.backgroundColor = "white";
}else{
field.style.backgroundColor = "red";
field.value=value;
}
}
function drawCallGraph(){
var canvas = document.getElementById("CallGraph");
var canvasContext = canvas.getContext("2d");
canvasContext.moveTo(0, 0);
canvasContext.lineTo(200, 100);
canvasContext.stroke();
}
function drawFlowGraph(){
var canvas = document.getElementById("FlowGraph");
var canvasContext = canvas.getContext("2d");
canvasContext.moveTo(0, 100);
canvasContext.lineTo(200, 0);
canvasContext.stroke();
}
/*
for(var i=0;i<256;i++){
document.getElementById("excection").value+="{opcode:"+asByteHex(i)+",length:1,mnemonic:\"\",operands:\"\",mcycles:[4],conditions:\"\",execute:function(){logger.log(\"not implemented\");}},\n";
}*/
/* https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format/4673436#4673436 */
/*
if (!String.format) {
String.format = function(format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
console.log(String.format('{0} is dead, but {1} is alive! {0} {1}', 'ASP', 'ASP.NET'));
*/
</script>
</body>
</html>