Skip to content

Commit 0949766

Browse files
authored
Z80 code generated decoder structure rework. (#106)
1 parent 865aa69 commit 0949766

File tree

13 files changed

+2064
-5892
lines changed

13 files changed

+2064
-5892
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.vscode/
2+
.venv/
3+
__pycache__/
24
#>fips
35
# this area is managed by fips, do not edit
46
.fips-*

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
## What's New
22

3+
* **02-Jan-2024**: Integrated some 'structural ideas' from the Zig Z80 emulator into z80.h
4+
(everything backward compatible and no behaviour changes):
5+
- Got rid of lookup tables which mapped opcodes to the first instruction
6+
payload step in the decoder switch-case statement. Instead the first
7+
512 case-branches in the decoder switch-case directly map to the first
8+
(and for 4-cycle instructions: only) payload step (256 for the main
9+
instruction subset and the next 256 for the ED-prefixed subset).
10+
- Stepping to the next decoder step is now always 'exclusive', instead
11+
of incrementing the current step, an explicit step number is written.
12+
This appears to be a tiny faster.
13+
- The separate input template files for the code generation of the Z80
14+
and M6502 emulators have been removed, instead the generated code is
15+
now injected into the actual source files (search for `<%` and `%>` markers).
16+
317
* **24-Dec-2024**: complete UI overhaul:
418

519
- switched to the Dear ImGui docking branch

chips/m6502.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ uint64_t m6502_tick(m6502_t* c, uint64_t pins) {
768768
// reads are default, writes are special
769769
_RD();
770770
switch (c->IR++) {
771+
// <% decoder
771772
/* BRK */
772773
case (0x00<<3)|0: _SA(c->PC);break;
773774
case (0x00<<3)|1: if(0==(c->brk_flags&(M6502_BRK_IRQ|M6502_BRK_NMI))){c->PC++;}_SAD(0x0100|c->S--,c->PC>>8);if(0==(c->brk_flags&M6502_BRK_RESET)){_WR();}break;
@@ -3072,7 +3073,7 @@ uint64_t m6502_tick(m6502_t* c, uint64_t pins) {
30723073
case (0xFF<<3)|5: c->AD++;_SD(c->AD);_m6502_sbc(c,c->AD);_WR();break;
30733074
case (0xFF<<3)|6: _FETCH();break;
30743075
case (0xFF<<3)|7: assert(false);break;
3075-
3076+
// %>
30763077
}
30773078
M6510_SET_PORT(pins, c->io_pins);
30783079
c->PINS = pins;

0 commit comments

Comments
 (0)