Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion m6502/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ def execute(self, cycles: int = 0) -> None:
"""
while (self.cycles < cycles) or (cycles == 0):
opcode = self.fetch_byte()
eval("self.ins_" + self.OPCODES[opcode] + "_" + self.ADDRESSING[opcode] + "()") # noqa: PLW0123
name = "ins_" + self.OPCODES[opcode] + "_" + self.ADDRESSING[opcode]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about building the name string with f-strings?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now done it that way.

method = getattr(self, name)
method()

def ins_nop_imp(self) -> None:
"""
Expand Down