forked from Laubersheini/johnny
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
665 lines (571 loc) · 29.8 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
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
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
<!Doctype HTML>
<!--
Johnny 2.0
Copyright (C) 2019,2021 David Laubersheimer
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
mit dank an Dr. Peter Dauscher
-->
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, height=device-height,initial-scale=1.0">
<meta charset="utf-8"/>
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="./ios-pwa-promt/promt_pwa.css">
<link rel="stylesheet" type="text/css" href="./style.css">
<link rel="manifest" href="./johnny.webmanifest">
<link rel="apple-touch-icon" sizes="256x256" href="./icons/firefox/firefox-general-256-256.png">
<title>Johnny 2.0</title>
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/focus@3.x.x/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/ramda@0.29.1/dist/ramda.min.js"></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js'></script>
<script>
var LoadStart = new Date().getTime();//this is so that the splash screen is always on for the same time
if ('serviceWorker' in navigator) {
//navigator.serviceWorker.register('./service-worker.js'); //for testing this should be commented out so the reloading does take the cached conntent
}
</script>
</head>
<body class="bg-gray-700 w-full h-full font-mono">
<div
class="flex flex-col text-center text-gray-400 bg-gray-700 w-screen h-screen "
x-show="$store.default.showStartScreen"
x-on:click.once="keyDownHandler()"
x-on:keyup.escape.window.once="keyDownHandler()"
x-init
>
<p class="text-[15vmin]">Johnny 2.0</p>
<p class="text-[7vmin]" x-text="$store.default.loadMsg">Loading</p>
<p class="text-[6vmin]">Simulation of a simplified Von Neumann Computer</p>
<p class="text-[4vmin]">David Laubersheimer</p>
<p class="text-[4vmin]">2019-2021</p>
<p class="text-[4vmin]">Peter Dauscher</p>
<p class="text-[4vmin]">2009-2014</p>
</div>
<div
x-data=""
id="program"
x-show="!$store.default.showStartScreen"
x-init
x-cloak
>
<div class="flex items-center justify-center fixed w-[37vw] h-[73vmin] top-[19vh] left-[36.5vw] bg-gray-400 z-20 text-2xl font-bold text-gray-600 "
x-show="!$store.default.showDetailControl"
x-transition.opacity
>
CONTROL UNIT
</div>
<svg
class="fixed left-[49.2vw] top-[19vh] w-[5vw] fill-current text-blue-500"
:class="$store.default.mcOpHighlight[4] && 'text-blue-700'"
viewBox="0 0 39 103">
<path d="M9.579 25.849h-9.58L19.45 0l19.449 25.849h-9.725v76.636H9.579z"/></svg>
<svg
class="fixed left-[65.3vw] top-[19vh] w-[5vw] fill-current text-blue-500"
:class="$store.default.mcOpHighlight[8] && 'text-blue-700'"
viewBox="0 0 39 103">
<path d="M9.579 25.849h-9.58L19.45 0l19.449 25.849h-9.725v76.636H9.579z"/></svg>
<svg
class="fixed left-[55vw] top-[36.5vh] w-[9vw] h-[7vh] fill-current text-blue-500"
:class="$store.default.mcOpHighlight[11] && 'text-blue-700'"
viewBox="0 0 71 39">
<path d="M53.28 9.58V0l17.972 19.45L53.28 38.897v-9.724H0V9.579Z"/></svg>
<svg
class="fixed left-[44.3vw] top-[43vh] w-[5vw] h-[12vh] fill-current text-red-500"
:class="$store.default.mcOpHighlight[5] && 'text-red-700'"
viewBox="0 0 26 75">
<path d="M26.414 63.392 13.207 75.416 0 63.392h6.836V0h12.948v63.392Z"/></svg>
<svg
class="fixed left-[14.5vw] top-[80vh] w-[5vw] h-[12vh] fill-current text-green-500"
:class="$store.default.mcOpHighlight[1] && 'text-green-700'"
viewBox="0 0 49 72">
<path d="M0 24.321 24.218-.001l24.529 24.322H37.259v47.505H11.281V24.321z"/> </svg>
<svg
class="fixed left-[21.2vw] top-[80.2vh] w-[5vw] h-[12vh] fill-current text-green-500"
:class="$store.default.mcOpHighlight[2] && 'text-green-700'"
viewBox="0 0 49 72">
<path d="M48.747 47.505 24.529 71.827 0 47.505h11.488V0h25.978v47.505z"/></svg>
<svg
class="fixed left-[3vw] top-[9.6vh] w-[11vw] h-[12vh] fill-current text-blue-500"
viewBox="0 0 94 54">
<path d="M.132 48.332V6.472H65.52V.309l28.579 27.046L65.52 54.11v-5.779z"/></svg>
<svg
class="fixed left-[3vw] top-[89.3vh] w-[11vw] h-[12vh] fill-current text-green-500"
viewBox="0 0 94 54">
<path d="M.132 48.332V6.472H65.52V.309l28.579 27.046L65.52 54.11v-5.779z"/></svg>
<svg
class="fixed left-[17vw] top-[15vh] w-[6vw] h-[12vh] fill-current text-blue-500"
viewBox="0 0 50 22">
<path d="M14.289.132v8.504H.509l24.27 13.539 24.332-13.54H35.145V.133z"/> </svg>
<svg
class="fixed left-[88.3vw] top-[61vh] w-[6vw] h-[30vh] fill-current text-green-500"
:class="$store.default.mcOpHighlight[15] && 'text-green-700'"
viewBox="0 0 49 189">
<path d="m48.747 165-24.218 24.322L0 165h11.488L11.375 0H37.44l.025 165z"/> </svg>
<svg class="fixed left-[79vw] top-[53vh] w-[6vw] h-[38vh] fill-current text-green-500"
:class="$store.default.mcOpHighlight[18] && 'text-green-700'"
viewBox="0 0 51 231">
<path d="M0 12.132h38.186V0l13.052 24.579-13.052 24.334V36.961H25.367v194.065H0Z" /></svg>
<svg class="fixed left-[37.8vw] top-[36vh] w-[6vw] h-[55vh] fill-current text-green-500"
:class="$store.default.mcOpHighlight[3] && 'text-green-700'"
viewBox="0 0 54 334">
<path d="M0 12.132h41.36V0l13.053 24.579-13.052 24.334V36.961H25.367v297.253H0Z" /></svg>
<svg class="fixed left-[71.5vw] top-[47vh] w-[14vw] h-[3vh] fill-current text-gray-500" viewBox="0 0 106 11">
<path d="M.399 5.48 15.062.188v3.97h91.012v2.645H15.062v3.704z" /></svg>
<svg class="h-screen fixed left-[75.5vw]">
<defs>
<pattern id="Pattern" width="1" height="15" patternUnits="userSpaceOnUse">
<path fill="#778191" fill-rule="evenodd" d="M.132.132H3.46V9.69H.132z" />
</pattern>
</defs>
<rect fill="url(#Pattern)" width="3" height="100%" />
</svg>
<svg class="h-screen fixed left-[35vw]">
<defs>
<pattern id="Pattern" width="1" height="15" patternUnits="userSpaceOnUse">
<path fill="#778191" fill-rule="evenodd" d="M.132.132H3.46V9.69H.132z" />
</pattern>
</defs>
<rect fill="url(#Pattern)" width="3" height="100%" />
</svg>
<!--Bilder der Kopfzeile -->
<div class="flex justify-between z-20 fixed items-center p-4 w-[100vw] bg-gray-500">
<div class="flex space-x-8 ">
<div class="flex space-x-2 items-center ">
<abbr title="New Ram"><img tabindex=0 src="./images/macro_new.svg" onclick="newRam()" class="icon"></img></abbr>
<abbr title="Save ram as Johnny file"><img tabindex=0 src="./images/ram_save.svg" onclick="downloadRam()"
class="icon"></img></abbr>
<abbr title="Load ram file "><img tabindex=0 src="./images/ram_open.svg" onclick="uploadRam()"
class="icon"></img></abbr>
<abbr title="edit ram ">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
class="w-10 h-10 icon bg-slate-500 text-gray-400" tabindex=0 onclick="editRam()"
>
<path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
</svg>
</abbr>
</div>
<div class="flex space-x-2 items-center">
<abbr title="One macro step"><img tabindex=0 src="./images/macro_step.svg" onclick="SingleMacroStep()"
class="icon blackborder"></img></abbr>
<abbr title="Run Program"><img tabindex=0 src="./images/macro_run.svg" onclick="executeProgram(0)"
class="icon blackborder"></img></abbr>
<abbr title="Program execution speed"><input type="range" min="0" max="3000" step="1.0"
class="w-[7vw]"
x-model="$store.default.executionSpeed"
x-on:change.debounce="updateSpeed"
></abbr>
<abbr title="Pause program"><img tabindex=0 src="./images/macro_pause.svg" onclick="pauseProgram()"
class="icon blackborder"></img></abbr>
<abbr title="Reset"><img tabindex=0 src="./images/reset.png" onclick="resetComputer()"
class="icon blackborder"></img></abbr>
</div>
<div id="controlUnitToggle" class="flex space-x-2">
<abbr title="show control unit">
<img tabindex=0 src="./images/show_control.svg" class="w-[5.4vmin] h-[4vmin] max-w-[100vw] max-h-[100vh]" id="crtIcon"></img>
</abbr>
<abbr title="show control unit"><input id="controlUnitCheckbox" type="checkbox"
x-model="$store.default.showDetailControl"></abbr>
</div>
<div id="mcOptions" class="flex space-x-2 items-center"
x-show="$store.default.showDetailControl"
>
<abbr title="new microcode"><img src="./images/micro_new.svg" onclick="resetMicrocode()" class="icon"></img></abbr>
<abbr title="One micro step"><img tabindex=0 src="./images/micro_step.svg" onclick="microStep(true)"
class="icon blackborder"></img></abbr>
<abbr title="Save microcode as mc file"><img tabindex=0 src="./images/micro_save.svg" onclick="downloadMc()"
class="icon"></img></abbr>
<abbr title="load microcode file"><img tabindex=0 src="./images/micro_open.svg" onclick="uploadMc()"
class="icon"></img></abbr>
</div>
<div class=" flex space-x-2 items-center px-1"
:class="$store.default.recordBlink"
x-show="$store.default.showDetailControl"
>
<abbr title="Record macrocode"><img tabindex=0 src="./images/macro_record.svg" onclick="aufnahme()"
class="icon"></img></abbr>
<abbr title="Address in micro program memory of new Macrocode ">
<input class="w-[5vmin] text-sm px-1" type="number" istep="10" x-model="$store.default.recordNum"
min="0" max="200" ></abbr>
<abbr title="Name of new macro program">
<input class="w-[5vmin] text-sm px-1" type="text" x-model="$store.default.recordName" maxlength="5" ></abbr>
</div>
</div>
<abbr title="Settings">
<div
x-on:click="$store.default.showModal=true"
class="mr-6"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-[4vmin] w-full text-gray-600 stroke-current stroke-2" fill="none" viewBox="0 0 24 24" >
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
</div>
</abbr>
</div>
<div class="fixed left-[14.7vw] top-[7.5vh] text-[2vmin] font-medium text-gray-400 ">MEMORY</div>
<div class="fixed left-[47vw] top-[7.5vh] text-[2vmin] font-medium text-gray-400 ">CONTROL UNIT</div>
<div class="fixed left-[77vw] top-[7.5vh] text-[2vmin] font-medium text-gray-400 ">ARITHMETIC LOGIC UNIT</div>
<div class="flex items-center fixed left-[14.7vw] top-[12vh] h-[7vh] w-[59vw] border border-red-800 text-gray-100 bg-blue-500">
<div class="text-4xl w-1/2 text-center">Address Bus</div>
<p class="text-2xl w-1/2 text-center" x-text="$store.default.r_addressBus()" />
</div>
<div class="flex items-center fixed left-[14.7vw] top-[91.8vh] h-[7vh] w-[82vw] text-gray-100 bg-green-500 border border-red-800">
<div class="text-4xl w-1/2 text-center">Data Bus</div>
<p class=" text-2xl w-1/2 text-center" x-text="$store.default.r_databus()"/>
</div>
<div class="fixed left-[85.8vw] top-[41vh] w-[11vw] h-[19.5vh] border border-red-800 bg-gray-500 p-2">
<p class="text-right pr-2 pb-1 text-gray-400 font-semibold text-xs"> Accumulator</p>
<p class="text-center text-[3vmin] text-gray-100" x-text="$store.default.r_accumulator()"/>
</div>
<div class="flex flex-col fixed left-[44.7vw] top-[36.5vh] w-[10vw] h-[6vh] p-1 bg-gray-500 border border-red-800">
<p class="text-right px-1 pb-1 text-gray-400 font-semibold text-xs truncate">Instruct Register</p>
<p id="InstructionalRegister"
class=" text-2xl text-center"
x-show="$store.default.showDetailControl">
<span class="text-red-500" x-text="$store.default.r_instructHi()">00</span>.
<span class="text-blue-500" x-text="$store.default.r_instructLo()" >000</span>
</p>
</div>
<div class="flex flex-col fixed left-[64.5vw] top-[36.5vh] w-[10vw] h-[6vh] p-1 bg-gray-500 border border-red-800"
x-show="$store.default.showDetailControl"
>
<p class=" text-right px-1 pb-1 text-gray-400 font-semibold text-xs truncate" >Program Counter</p>
<p class=" text-2xl text-gray-100 text-center" x-text="$store.default.r_programCounter()" >000</p>
</div>
<div
class="fixed left-[78.8vw] top-[47vh] w-[4vw] border border-red-800 px-1 rounded"
:class="{'bg-yellow-200' : $store.default.is_accuZero()}">
<p class=" text-[2.2vmin] text-gray-400"> =0?</p>
</div>
<div class="flex flex-col space-y-1 fixed left-[5vw] top-[93vh] w-[5vw] text-sm">
<input type="number" id="DataBusInput" class="border border-solid border-gray-400 px-1" x-model="$store.default.DataBusInput" @keydown.enter="ManuellDb">
<abbr title="set Data Bus"><button onclick="ManuellDb()" id="DbInputButton" class="w-full btn">Set Db</button> </abbr>
</div>
<div class="flex flex-col space-y-1 fixed left-[5vw] top-[13.5vh] w-[5vw] text-sm">
<input type="number" id="AddressBusInput" min="0" max="999" class="border border-solid border-gray-400 px-1" x-model="$store.default.AddressBusInput" @keydown.enter="ManuellAB">
<abbr title="set Address Bus"><button onclick="ManuellAB()" id="ABInputButton" class="w-full btn">Set Ab</button> </abbr>
</div>
<button onclick="mcEffect(RamDb)" class="fixed left-[21.3vw] top-[85vh] w-[5vw] btn">ram-->db</button>
<button onclick="mcEffect(DbRam)" class="fixed left-[14.4vw] top-[85vh] w-[5vw] btn">db-->ram</button>
<button onclick="mcEffect(DbAcc)" class="fixed left-[78vw] top-[62vh] w-[5vw] btn">db-->acc</button>
<button onclick="mcEffect(AccDb)" class="fixed left-[88.9vw] top-[62vh] w-[5vw] btn">acc-->db</button>
<div class="flex flex-col space-y-1 fixed left-[88vw] top-[24vh] w-[5vw]">
<button onclick="mcEffect(IncAcc)" class="btn">acc++</button>
<button onclick="mcEffect(DecAcc)" class="btn">acc--</button>
<button onclick="mcEffect(NullAcc)" class="btn" x-show="!$store.default.bonsaiMode">acc=0</button>
</div>
<button onclick="mcEffect(AddAcc)" class="fixed left-[78vw] top-[65vh] w-[5vw] btn" x-show="!$store.default.bonsaiMode">plus</button>
<button onclick="mcEffect(SubAcc)" class="fixed left-[78vw] top-[68vh] w-[5vw] btn" x-show="!$store.default.bonsaiMode">minus</button>
<button onclick="mcEffect(DbIns)" class="fixed left-[36.5vw] top-[62vh] w-[5vw] btn" x-show="$store.default.showDetailControl">db-->ins</button>
<button onclick="mcEffect(InsMc)" class="fixed left-[44.3vw] top-[47vh] w-[5vw] btn" x-show="$store.default.showDetailControl">ins-->mc</button>
<button onclick="mcEffect(InsAd)" class="fixed left-[49.2vw] top-[27vh] w-[5vw] btn" x-show="$store.default.showDetailControl">ins-->ab</button>
<button onclick="mcEffect(InsPc)" class="fixed left-[56vw] top-[38.5vh] w-[5vw] btn" x-show="$store.default.showDetailControl" >ins-->pc</button>
<button onclick="mcEffect(PcAd)" class="fixed left-[65.5vw] top-[27vh] w-[5vw] btn" x-show="$store.default.showDetailControl">pc-->ab</button>
<div class="flex flex-col space-y-1 fixed left-[65.5vw] top-[44vh] w-[5vw]">
<button onclick="mcEffect(IncPc)" class="btn" x-show="$store.default.showDetailControl">pc++</button>
<button onclick="mcEffect(IncPc0)" class="btn" x-show="$store.default.showDetailControl">=0:pc++</button>
</div>
<div class="flex flex-col space-y-1 fixed left-[61.5vw] top-[80vh] w-[5vw]">
<button onclick="mcEffect(NullMc)" class="btn" x-show="$store.default.showDetailControl">mc:=0</button>
<button onclick="mcEffect(Halt)" class="btn" x-show="$store.default.showDetailControl">stop</button>
</div>
<!--nicht entfernen onclick der Bilder greift hierdrauf zu -->
<input type='file' accept='.mc' id='microcodefile' style="display:none" x-on:change="readMCFile($el)">
<input type='file' accept='.ram' id='ramfile' style="display:none" x-on:change="readRamFile($el)">
<!-- RamTable -->
<div id="RamDiv"
x-ref="ramdiv"
class="flex flex-col space-y-1 fixed left-[8vw] top-[23vh] h-[56.5vh] w-[25vw] bg-gray-500 border border-red-800 p-3"
x-on:resize.window.debounce.500ms="resize()"
>
<p class="text-right px-1 pb-1 text-gray-400 font-semibold text-xs">Ram</p>
<div class="overflow-auto bg-gray-100 text-xs text-gray-600"
x-ref="innerramdiv"
id="innerRamDiv"
x-init="$el.scrollTop=0">
<table class="table w-full" >
<thead>
<colgroup>
<col class="w-1/4">
<col class="w-1/4">
<col class="w-1/4">
<col class="w-1/4">
</colgroup>
<tr class="bg-gray-500 text-left" >
<th class="sticky top-0 bg-gray-300 px-1">Address</th>
<th class="sticky top-0 bg-gray-300 px-1">Data</th>
<th class="sticky top-0 bg-gray-300 px-1">Asm</th>
<th class="sticky top-0 bg-gray-300 px-1">Opnd</th>
</tr>
</thead>
<tbody class="h-full">
<template x-for="r in $store.default.r_ram()" >
<tr class="border border-gray-200 "
:id="r.id"
:class="{'bg-yellow-200' : r.selected , 'bg-green-400': r.highlight }"
x-on:click="EditRam(r.id)"
x-init="$watch('r.selected', value => {
if (value) positionRamInput(r.id,$el,$refs.ramdiv,$refs.ramInput,$refs.innerramdiv)});
"
>
<td class="px-1" x-text="r.id"></td>
<td class="px-1" x-text="r.data" />
<td class="px-1" x-text="r.asm" />
<td class="px-1" x-text="r.op" />
</tr>
</template>
</tbody>
</table>
</div>
</div>
<div id="MicroCodeDiv" class="flex flex-col space-y-1 fixed left-[44vw] top-[56vh] h-[34vh] w-[17vw] text-xs text-gray-600 bg-gray-500 border border-red-800 p-3"
x-show="$store.default.showDetailControl">
<div class="flex justify-between items-baseline px-1 ">
<p
class=" text-3xl text-gray-100"
x-show="$store.default.showDetailControl" x-text="$store.default.r_mcCounter()" />
<p class="text-right text-gray-400 font-semibold">Micro Code</p>
</div>
<div class=" h-[28vh] overflow-auto bg-gray-100"
id="testdiv"
>
<table class="table border-collapse w-full" >
<tbody />
<template x-for="r in $store.default.r_microCode()">
<tr class="MicroCodeTable border border-gray-200"
:class="r.highlight && 'bg-yellow-200'"
x-init="$watch( 'r.highlight', v => {if (v) $el.scrollIntoView()})"
>
<td class="Mccol1" x-text="r.id" />
<td class="Mccol2" x-text="r.mc" />
</tr>
</template>
</table>
</div>
</div>
<!-- Ram Input -->
<div
x-ref="ramInput"
class="flex items-center fixed left-[0.5vw] top-[45vh] w-[8vw] h-[18vh] bg-[url('images/ram_input.svg')]"
:style="{top: $store.default.ramInputTop}"
x-init
>
<div class="flex flex-col space-y-1 ml-2 w-[5vw] text-sm">
<input type="text"
@keydown.enter="ManuellRam"
x-model="$store.default.ramInput"
class="border border-gray-400 border-solid"
>
<select id="CommandSelect"
x-on:change="CommandSelectChange()"
class="border border-gray-400 border-solid text-xs"
x-model="$store.default.commandSelection"
>
<template x-for="o in $store.commandSelect.items">
<option :value="o.id" x-text="o.val"/>
</template>
</select>
<button
onclick="ManuellRam()"
class="btn"
>write</button>
</div>
</div>
<!-- The Modal -->
<div
class=" overflow-auto bg-gray-500 bg-opacity-[85%]"
x-show="$store.default.showModal"
:class="{ 'absolute inset-0 z-50 flex items-center justify-center': $store.default.showModal }"
>
<!-- Modal content -->
<div class="bg-gray-100 w-4/5 p-5 text-center shadow-xl border-2 border-gray-800 rounded-md" x-on:click.away="$store.default.showModal=false">
<span
class="gray-500 float-right text-2xl font-semibold focus:gray-800 cursor-pointer"
x-on:click="$store.default.showModal=false">×</span>
<button
id="bonsaiModeButton"
class="px-3 py-1 rounded border border-gray-400"
x-on:click="toggleBonsai()"
x-text="($store.default.bonsaiMode ? 'normal' : 'bonsai') + ' mode'"></button>
<p>Johnny can also be installed as an app. Click<a
href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Developer_guide/Installing#the_install_user_experience"
target="_blank"> here</a> to learn how to install Johnny on your device</p>
<p>This program is licenced under the GNU Affero General Public License. You can find the sourcecode at <a
href="https://github.com/laubersheini/johnny">https://github.com/laubersheini/johnny</a></p>
<p>Feel free to report any bugs on the programs <a href="https://github.com/laubersheini/johnny/issues">Github
page</a></p>
</div>
</div>
<div id="defaultModal"
@keyup.escape="$store.default.showEditor=false"
tabindex="-1"
aria-hidden="$store.default.showEditor"
x-show="$store.default.showEditor"
x-trap="$store.default.showEditor"
class=" overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-modal h-full">
<div class="relative p-4 pl-6 w-full max-w-2xl h-full ">
<!-- Modal content -->
<div x-data="inputs" class="relative bg-white rounded-lg shadow dark:bg-gray-700 ">
<!-- Modal header -->
<div class="flex justify-between items-center p-2 rounded-t border-b dark:border-gray-600">
<h3 class=" font-semibold text-gray-900 dark:text-white">
Edit
</h3>
<button type="button"
x-on:click="$store.default.showEditor=false"
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-toggle="defaultModal">
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
<span class="sr-only">Close modal</span>
</button>
</div>
<!-- Modal body -->
<div class="h-96">
<textarea x-trap="$store.default.showEditor" x-ref="inputt"></textarea>
</div>
<!-- Modal footer -->
<div class="flex items-center p-2 space-x-2 rounded-b border-t border-gray-200 dark:border-gray-600">
<button data-modal-toggle="defaultModal" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">ok</button>
<button data-modal-toggle="defaultModal" type="button" class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-blue-300 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">Cancel</button>
</div>
</div>
</div>
</div>
<!--This is for showing a hint for IOS users that they can install Johnny as a PWA-->
<div
class = "hidden pwaPromptOverlay visibilityClass iOSClass iOSPWA-overlay "
aria-label="Close"
role="button"
onClick= "iosPromtPwa.dismissPrompt()"
></div>
<div
class="hidden pwaPrompt visibilityClass iOSClass iOSPWA-container "
>
<div class="pwaPromptHeader iOSPWA-header">
<p
id="pwa-prompt-title"
class="pwaPromptTitle iOSPWA-title"
>
Add to Home Screen
</p>
<button
class="pwaPromptCancel iOSPWA-cancel"
onClick=iosPromtPwa.dismissPrompt()
>
Cancel
</button>
</div>
<div class="pwaPromptBody iOSPWA-body">
<div class="pwaPromptDescription iOSPWA-description">
<p
id="pwa-prompt-description"
class="pwaPromptCopy iOSPWA-description-copy"
>
Add Johnny to your home screen to use it in fullscreen and while offline.
</p>
</div>
</div>
<div class="pwaPromptInstruction iOSPWA-steps">
<div class="pwaPromptInstructionStep iOSPWA-step1">
<div class="pwaPromptShareIcon iOSPWA-step1-icon">
<svg
xmlns="http://www.w3.org/2000/svg"
className={className}
viewBox="0 0 120 169">
<g fill="currentColor">
<path d="M60 0l28 28-2 2a586 586 0 0 0-4 4L64 15v90h-8V15L38 34l-4-4-2-2L60 0z" />
<path d="M0 49h44v8H8v104h104V57H76v-8h44v120H0V49z" />
</g>
</svg>
</div>
<p
class="pwaPromptCopy styles.bold iOSPWA-step1-copy"
>
1) Press the 'Share' button on the menu bar below.
</p>
</div>
<div class="pwaPromptInstructionStep iOSPWA-step2">
<div class ="pwaPromptHomeIcon iOSPWA-step2-icon">
<svg
xmlns="http://www.w3.org/2000/svg"
className={className}
viewBox="55.99425507 31.98999977 157.76574707 157.76371765"
>
<path
fill="#58595b"
d="M90.49 32.83a54.6 54.6 0 019.55-.84c23.98.03 47.96 0 71.94.01 8.5.07 17.3 1.74 24.4 6.65 10.94 7.28 16.52 20.54 17.35 33.3.06 26.03 0 52.06.03 78.08 0 10.16-3.59 20.56-10.95 27.73-7.93 7.61-18.94 11.43-29.79 11.98-25.71.03-51.42 0-77.12.01-10.37-.11-21.01-3.77-28.17-11.48-8.22-8.9-11.72-21.29-11.73-33.21.01-23.03-.03-46.05.02-69.07-.01-9.14 1.33-18.71 6.65-26.4 6.21-9.4 16.97-14.79 27.82-16.76m38.18 41.09c-.05 10.25.01 20.5 0 30.75-9.58-.03-19.16.02-28.75-.04-2.27.08-4.98-.25-6.68 1.61-2.84 2.34-2.75 7.12.01 9.48 1.8 1.69 4.46 1.57 6.75 1.64 9.56-.04 19.12-.01 28.67-.03.02 10.24-.06 20.48.01 30.72-.14 2.66 1.36 5.4 3.95 6.3 3.66 1.66 8.52-1.13 8.61-5.23.26-10.59.02-21.2.09-31.79 9.88 0 19.76.02 29.64.01 2.74.12 5.85-.67 7.14-3.34 2.23-3.75-.61-9.34-5.08-9.29-10.57-.14-21.14-.01-31.7-.04-.01-10.25.04-20.49 0-30.74.3-3.5-2.66-7.09-6.3-6.79-3.65-.33-6.66 3.26-6.36 6.78z"
/>
<path
fill="transparent"
d="M128.67 73.92c-.3-3.52 2.71-7.11 6.36-6.78 3.64-.3 6.6 3.29 6.3 6.79.04 10.25-.01 20.49 0 30.74 10.56.03 21.13-.1 31.7.04 4.47-.05 7.31 5.54 5.08 9.29-1.29 2.67-4.4 3.46-7.14 3.34-9.88.01-19.76-.01-29.64-.01-.07 10.59.17 21.2-.09 31.79-.09 4.1-4.95 6.89-8.61 5.23-2.59-.9-4.09-3.64-3.95-6.3-.07-10.24.01-20.48-.01-30.72-9.55.02-19.11-.01-28.67.03-2.29-.07-4.95.05-6.75-1.64-2.76-2.36-2.85-7.14-.01-9.48 1.7-1.86 4.41-1.53 6.68-1.61 9.59.06 19.17.01 28.75.04.01-10.25-.05-20.5 0-30.75z"
/>
</svg>
</div>
<p
class="pwaPromptCopy styles.bold iOSPWA-step2-copy"
>
2) Press 'Add to Home Screen'.
</p>
</div>
</div>
</div>
<!-- <script src="./ios-pwa-promt/showPromt.js" charset="utf-8"></script> -->
<!-- <script type="text/javascript" src="./promt_pwa.js"></script> -->
<script type="text/javascript" src="./script.js"></script>
<script type="text/javascript" src="./microcode.js"></script>
<script type="text/javascript" src="./table.js"></script>
<script type="text/javascript" src="./buttons.js"></script>
<script type="text/javascript" src="./writing.js"></script>
<script>{
let ua = window.navigator.userAgent;
// if( !!ua.match(/iPad/i) || !!ua.match(/iPhone/i)){
//this apperantly also fixes chrome mobile?
if((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)){ //this seems to detect mobile browsers(which need this the most )
viewportUnitsBuggyfill.init({force: true}); //does this make it worse for everyone? almost for sure but ipads are the thing for schools now :(
}
}
</script>
</div>
<script id="rendered-js" >
document.addEventListener('alpine:init', () => {
Alpine.data('inputs', () => ({
init() {
let editor = CodeMirror.fromTextArea(this.$refs.inputt , {
styleActiveLine: true,
lineNumbers: true,
firstLineNumber: 0,
autofocus: true
});
editor.setSize("100%", "100%");
Alpine.effect(() => {
if (Alpine.store('default').showEditor){
editor.setValue (Alpine.store('default').editorContent)
const timer = setInterval(() => {
editor.focus()
if(editor.hasFocus()) {
editor.refresh()
editor.setCursor({line: 0,ch: 1})
console.log('interval out');
clearInterval(timer);
}
}, 100);
}
})
},
}))
})
//html_value = editor.getValue();
</script>
</body>
</html>