File size: 3,629 Bytes
799b3f0
d8afd6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799b3f0
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
<!doctype html>
<html lang="zh-Hant">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>ESP32 Emulator – VGA32 / FabGL / DOS</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
  <h1>ESP32 模擬器 <small>Xtensa LX6 · ROM 開機 · VGA32 週邊</small></h1>
  <div id="toolbar">
    <select id="example" title="內建範例"></select>
    <button id="btnRun" class="primary">▶ 載入並執行</button>
    <button id="btnReset">⟲ 重置</button>
    <button id="btnPause">⏸ 暫停</button>
    <label class="chk"><input type="checkbox" id="chkTurbo"> 全速</label>
    <button id="btnFiles">📂 載入二進位…</button>
    <button id="btnSave" title="下載目前 flash 內容 (含寫入結果)">💾 下載 flash</button>
    <span id="stat" class="stat">未啟動</span>
  </div>
</header>

<main>
  <section id="left">
    <div id="screenWrap" tabindex="0" title="點擊畫面以接管實體鍵盤">
      <canvas id="screen" width="640" height="400"></canvas>
      <div id="noSignal">無 VGA 訊號</div>
      <div id="capHint">點擊此處以使用實體鍵盤輸入 (Esc 取消)</div>
    </div>
    <div class="row">
      <button id="btnFull">⛶ 全螢幕</button>
      <label class="chk"><input type="checkbox" id="chkStretch" checked> 4:3 拉伸</label>
      <label class="chk">速度 <select id="selSpeed"><option value="0.25">¼×</option><option value="0.5">½×</option><option value="1" selected>1×</option><option value="2">2×</option></select></label>
      <span id="vgaInfo" class="stat"></span>
    </div>
    <div id="vkbd" aria-label="虛擬 PS/2 鍵盤"></div>
  </section>

  <aside id="right">
    <details open>
      <summary>序列埠 (UART0 / USB-Serial)</summary>
      <pre id="serial"></pre>
      <div class="row"><input id="serialIn" placeholder="輸入文字後 Enter 送出到 UART0 RX"> <button id="btnSerialClr">清除</button></div>
    </details>
    <details open>
      <summary>VGA32 板子 / GPIO</summary>
      <svg id="board" viewBox="0 0 360 150"></svg>
      <div id="gpioGrid"></div>
      <div class="note">R=22,21 G=19,18 B=5,4 HS=23 VS=15 · PS/2 鍵盤 CLK=33 DATA=32 · 滑鼠 CLK=26 DATA=27 · SD CS=13 MOSI=12 MISO=2 SCK=14 · 音訊=25</div>
    </details>
    <details id="filesBox">
      <summary>Flash 映像 (類似 esptool write_flash)</summary>
      <input type="file" id="fileIn" multiple hidden>
      <table id="fileTbl"><thead><tr><th>檔案</th><th>位址</th><th>大小</th><th></th></tr></thead><tbody></tbody></table>
      <div class="row">
        <button id="btnAddDefaults" title="補上內建 bootloader / 分區表 / boot_app0">補上預設開機檔</button>
        <label class="chk">Flash <select id="selFlash"><option value="2">2 MB</option><option value="4" selected>4 MB</option><option value="8">8 MB</option><option value="16">16 MB</option></select></label>
        <label class="chk"><input type="checkbox" id="chkPsram" checked> PSRAM 4MB</label>
        <button id="btnBoot" class="primary">燒錄並執行</button>
      </div>
      <div class="note">可直接拖放整份 flash (4MB merged)、或個別 bootloader.bin(0x1000) / partitions.bin(0x8000) / boot_app0.bin(0xE000) / 應用程式 .bin(0x10000)。單一 Arduino 應用程式 .bin 會自動補上預設開機檔。</div>
    </details>
  </aside>
</main>
<footer>Xtensa LX6 interpreter · ESP32 ROM(Espressif QEMU 發行檔) · FabGL (GPL-3) 範例韌體 · 全部在瀏覽器內執行</footer>
<script type="module" src="app.js"></script>
</body>
</html>