floooh / chips

8-bit chip and system emulators in standalone C headers
zlib License
947 stars 73 forks source link

Z80 idea: get rid of instruction start lookup table #97

Open floooh opened 2 months ago

floooh commented 2 months ago

...each instruction payload starts the case step of its own opcode (with offset for ED and CB prefixes), so case steps 0..767 are occupied by the first payload clock cycle.

Each case step explicitly writes the next step (instead of step++).

Instructions that are longer than M1 put their additional case blocks starting at 768.

The remaining special case cycle blocks are grouped at the end.

This gets rid of the indirection 'optables' but results in a switch-case that's just as compact as now.

floooh commented 2 weeks ago

The idea is implemented here in Zig, with a backport to the C version planned:

https://github.com/floooh/chipz