Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCLZ8 - Fetch_opcode() is wrongly used to retrieve immediate values, displacements or offsets in an instruction. #10

Open
hlide opened this issue Jan 24, 2023 · 1 comment

Comments

@hlide
Copy link

hlide commented Jan 24, 2023

This function is called too often wrongly to retrieve immediate values, displacements or offsets in an instruction. You should use a MEM_READ_BYTE (3 T-states) and not an OPCODE_READ_M1 (4 T-states) for them!

uint8_t Fetch_opcode() {

There is no M1 = 0 and no refresh when retrieving immediate values, displacements or offsets in an instruction!

See here a complex example here: https://floooh.github.io/2021/12/06/z80-instruction-timing.html#dd-and-fd-prefixes. Be aware the table are showing steps per half-cycle (half T-state) so a MEM_READ_BYTE would be 6 rows for 3 T-states.

@hlide hlide changed the title Fetch_opcode() is wrongly use to retrieve immediate values, displacements or offsets in an instruction. Fetch_opcode() is wrongly used to retrieve immediate values, displacements or offsets in an instruction. Jan 24, 2023
@hlide hlide changed the title Fetch_opcode() is wrongly used to retrieve immediate values, displacements or offsets in an instruction. MCLZ8: Fetch_opcode() is wrongly used to retrieve immediate values, displacements or offsets in an instruction. Jan 24, 2023
@MicroCoreLabs
Copy link
Owner

Thank you for finding this bug! Code updated.

@hlide hlide changed the title MCLZ8: Fetch_opcode() is wrongly used to retrieve immediate values, displacements or offsets in an instruction. MCLZ8 - Fetch_opcode() is wrongly used to retrieve immediate values, displacements or offsets in an instruction. Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants