Peter wrote: Sun Nov 12, 2023 10:15 am
tofro wrote: Sat Nov 11, 2023 9:40 pm
Actually, it's perfectly possible to circumvent slaving in a driver completely: All the code to retrieve the bytes simply needs to go into the access layer of the driver rather than in an interrupt or polling loop.
Is this more than a theoretical possibility? If neither Tony Tebby, Wolfgang nor Marcel managed to do it, there must be a reason.
Of course it is. To quote the QL Technical guide:
It is left to the device driver to decide what the slave blocks are used for but it must be prepared to release a slave block if requested to do so by the memory manager.
And if the device driver decides it doesn't want to use slave blocks at all, it can do so. The point is just that you'd need to re-write all the existing device drivers for that. It's a bit of an urban myth that a QDOS device driver
has to use slave blocks. And I'm pretty sure not using slave blocks will have very negative impact on multitasking-friendliness on slower than basically "instant" hardware. And I can very well understand that at times when there was no such "instant" hardware, you could argue it's impossible to get rid of slaving (and retain acceptable performance). It's a very different story with flash-based storage, however.
Slave blocks are the main means to allow the access layer of the device driver to communicate with the interrupt back-end (what Tebby used to call the "task"). If you have no interrupt back-end because you do all of the hardware access in the access layer (and there is no need to use the asynchronous nature of the device driver structure because the device is communicating synchronously), no slaving is necessary (but you obviously also don't get the benefits, so all read and write access directly goes to the hardware, regardless of whether some data might already be in a buffer somewhere.) That executes all of the driver code basically in the context of the calling job.
I have a half-baked QL-SD driver somewhere here that runs on exactly two 512 bytes buffers and nothing more. Shoot me an e-mail if you want to have a play.