本專案以 Web Simulator 方式模擬 Gakken GMC-4 4-bit 微電腦,參考硬體規格與指令說明,並於瀏覽器中以 HTML/CSS/JavaScript 實現核心邏輯、UI 顯示與音效。
透過鍵盤輸入指令碼,使用 ASET 設定記憶體位址,INCR 寫入並前進。完成後按 RUN 執行。HARD RESET 可清空記憶體。
Code | Mnemonic | Action | Flag | Detail |
---|---|---|---|---|
0 | KA | K->Ar | 0, 1 | Keypad to A register. Flag=1 if no key pressed. |
1 | AO | Ar->Op | 1 | Display A register. |
2 | CH | Ar<=>Br, Yr<=>Zr | 1 | Exchange A<=>B and Y<=>Z. (Not Implemented) |
3 | CY | Ar<=>Yr | 1 | Exchange A<=>Y. (Not Implemented) |
4 | AM | Ar->M | 1 | Write A to memory (addr 50+Y). |
5 | MA | M->Ar | 1 | Read from memory (addr 50+Y) to A. |
6 | M+ | M+Ar->Ar | 0, 1 | Add memory to A. Flag=1 on overflow. |
7 | M- | M-Ar->Ar | 0, 1 | Subtract A from memory. Flag=1 if negative. |
8 | TIA [ ] | [ ]->Ar | 1 | Transfer immediate to A. |
9 | AIA [ ] | Ar+[ ]->Ar | 0, 1 | Add immediate to A. Flag=1 on overflow. |
A | TIY [ ] | [ ]->Yr | 1 | Transfer immediate to Y. |
B | AIY [ ] | Yr+[ ]->Yr | 0, 1 | Add immediate to Y. Flag=1 on overflow. |
C | CIA [ ] | Ar!=[ ]? | 0, 1 | Compare immediate to A. Flag=1 if not equal. |
D | CIY [ ] | Yr!=[ ]? | 0, 1 | Compare immediate to Y. Flag=1 if not equal. |
E | - | - | - | Extended code (see table below). |
F | JUMP [ ][ ] | JUMP | 1 | Jump to immediate address if Flag=1. |
Code | Mnemonic | Flag | Detail |
---|---|---|---|
E0 | CAL RSTO | 1 | Clear the 7-segment readout. |
E1 | CAL SETR | 1 | Turn on 2-pin LED at index Y (0-6). |
E2 | CAL RSTR | 1 | Turn off 2-pin LED at index Y (0-6). |
E4 | CAL CMPL | 1 | Complement the A register. |
E7 | CAL ENDS | 1 | Play the End sound. |
E8 | CAL ERRS | 1 | Play the Error sound. |
E9 | CAL SHTS | 1 | Play a short sound. |
EA | CAL LONS | 1 | Play a longer sound. |
EB | CAL SUND | 1 | Play a note based on A register (1-E). |
EC | CAL TIMR | 1 | Pause for (A+1) * 0.1 seconds. |
ED | CAL DSPR | 1 | Set 2-pin LEDs from data memory (5F & 5E). |
EE | CAL DEM- | 1 | M[Y] -= A, then Y--. |
EF | CAL DEM+ | 1 | M[Y] += A, then Y--. Handles carry to M[Y-1]. |