Open stevesims opened 1 year ago
It's probably more sensible to implement clearing of VDP comms flags via a MOS call.
If we do that and also implement a SYS command as I've suggested in breakintoprogram/agon-bbc-basic#58 then it would be easy to reset these flags from BASIC code.
I agree, probably sits better in MOS.
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 unset.
We therefore need a mechanism to allow us to clear these flags.