Skip to content

Buffered command support#90

Merged
breakintoprogram merged 10 commits intobreakintoprogram:mainfrom
stevesims:upstream-buffered
Sep 15, 2023
Merged

Buffered command support#90
breakintoprogram merged 10 commits intobreakintoprogram:mainfrom
stevesims:upstream-buffered

Conversation

@stevesims
Copy link
Copy Markdown
Contributor

Adds support for buffered VDU commands

This is achieved thru VDU 23, 0, &A0, bufferId; command, <args>

There are commands to write a stream to a given buffer ID, "call" the VDU stream with a given buffer ID (send it to a VDU stream processor), clear a buffer ID, and to adjust the contents of a buffer.

This system allows for multiple streams to be stored against a given buffer ID. This allows for data to be sent over in multiple packets, of variable size. A bitmap or sound sample can therefore be sent over in multiple packets, rather than having to be sent over in a single data packet. When a stream is written to a buffer ID it is retained, and is not cleared after the buffer has been "called". Therefore if your intent is to use this functionality purely for packeted comms with the VDP you will need to explicitly clear a buffer after using it.

Commands are also present to allow for adjusting values within buffers, conditionally calling buffers (if conditions are met) and allowing data packets that would otherwise have been sent from the VDP to the eZ80 to be captured into a buffer. These essentially allow for reasonably complex functions to be able to be run on the VDP.

Another PR will come soon that provides documentation and examples for this command set. (Some limited documentation is already present in the code.)

also include temporary experimental call to check this works
adds a set of commands for buffered VDP operations, effectively allowing for both packetted comms to VDP, and stored functions on the VDP
allows for more command buffers to be used

this may help when using buffers for logic and programming - being limited to 256 buffers could have proven too restrictive.  moving to a 16-bit identifier gives room to breath and space out bufferIds

also add support for clearing all buffers by sending the “clear buffer” command with a buffer ID of 65535
VDUStreamProcessor now handles input and output streams separately.  They’re now stored using shared_ptr for safer memory management

set output buffer command added, allowing output to be redirected to a buffer instead of only to the ez80.  this allows, for instance, capturing mode information in a buffer for use in stored functions VDP side

WritableBufferStream added, which supports `write` - buffers created with the new “buffer create” use this class, whereas other buffers do not.  this makes it harder to overwrite command buffers with information packets
optimise how getBuffer works so it doesn’t need to iterate over all buffers on every call
incomplete adjust command - supports basic add, set, and not operations.  also supports getting operand values from a buffer+offset

other operations will be added once “multi” variants have been worked out
@breakintoprogram breakintoprogram merged commit 01b9c0a into breakintoprogram:main Sep 15, 2023
@breakintoprogram breakintoprogram added the enhancement New feature or request label Sep 15, 2023
@stevesims
Copy link
Copy Markdown
Contributor Author

hey @breakintoprogram thanks for merging this in. this merge actually puts Quark ahead of my Console8 fork 😀

sorry for not raising a PR yet with docs. I've got most of the commands documented, but need to improve them a bit and write some more examples. I'd hoped to make more progress, but I've caught a cold and just haven't fancied trying to write anything. 😀 I expect I'll get back to it after the weekend.

@breakintoprogram
Copy link
Copy Markdown
Owner

No worries - thanks for all the contributions so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

2 participants