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

add flag operating utility functions #19

Merged
merged 1 commit into from
Jun 24, 2024
Merged

Conversation

koron
Copy link
Contributor

@koron koron commented Jun 24, 2024

fix #18

@koron
Copy link
Contributor Author

koron commented Jun 24, 2024

Three functions GetFlag, SetFlag, ResetFlag are implemented to z80.GRP.
Those functions accepts a value of z80.Flag type.

Because z80.GPR is embedded to z80.CPU via z80.States, we can apply those functions on z80.CPU directly.
For example:

var cpu z80.CPU
carryFlag := cpu.GetFlag(z80.FlagC)

// this is equivalent to:
// cpu.States.GPR.GetFlag(z80.FlagC)

@koron koron merged commit 307c189 into main Jun 24, 2024
3 checks passed
@koron koron deleted the flagoperating-utilfuncs-18 branch June 24, 2024 02:56
@koron koron mentioned this pull request Jun 24, 2024
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

Successfully merging this pull request may close these issues.

Allow get/set of the flags
1 participant