agon-mos icon indicating copy to clipboard operation
agon-mos copied to clipboard

Allow the ability to unset VDP flags

Open stevesims opened this issue 2 years ago • 2 comments

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.

stevesims avatar Aug 04 '23 13:08 stevesims

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.

stevesims avatar Aug 11 '23 09:08 stevesims

I agree, probably sits better in MOS.

breakintoprogram avatar Aug 13 '23 21:08 breakintoprogram