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

API to unset/clear VDP flags #105

Open
stevesims opened this issue Dec 2, 2024 · 1 comment
Open

API to unset/clear VDP flags #105

stevesims opened this issue Dec 2, 2024 · 1 comment
Milestone

Comments

@stevesims
Copy link
Contributor

As communications with the VDP are asynchronous one needs to be able to wait until a command has been processed before the status/result of that command can be read.

The mechanism to do this is to check the VDP status flags in MOS, which can be read from BASIC using OSBYTE &A0. However these flags are only ever set by MOS on receipt from messages from the VDP. MOS itself does not provide a mechanism to clear these flags, so instead callers need to explicitly clear those flags. Examples of clearing appropriate flags can be seen in the BASIC assembler source code, like this.

Unfortunately this means that at present it's not possible to write BASIC code to synchronise comms with the VDP, as once a VDP status flag has been set it cannot be easily unset.

We therefore need a mechanism to allow us to clear these flags.

Originally filed against Quark MOS as breakintoprogram/agon-mos#82

@stevesims stevesims added this to the MOS 3 milestone Dec 2, 2024
@stevesims
Copy link
Contributor Author

It might be worth considering also adding a "wait for flag" API call. this should probably have a timeout

it is probably best to not combine that with a "clear" in one API, as what one should do is clear a flag, send a command to the VDP, and then wait for the flag bit to get set. an all-in-one "clear and wait" would need to get called after sending the command, which stands a chance of getting a response before the "clear and wait" gets executed.

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

1 participant