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

Buffer commands improvements #94

Merged
merged 2 commits into from
Sep 24, 2023

Conversation

stevesims
Copy link
Contributor

@stevesims stevesims commented Sep 19, 2023

In writing documentation for the new buffered commands VDU calls, some adjustments and improvements have been made.

The first changes made were to the numbering of the "adjust" command operations. the issue was primarily with the numbering of the "not" and "negate" instructions. they are the only two operations that don't require a separate operand, but they had been placed them at the end of the instruction list. with the current set of operations that's potentially OK, but there are several new adjust instructions that we may wish to add in the future (multiply, shift, etc) - any/all new operations will want a separate operand.

the renumbering in this PR means that it's the first two instructions that don't require a separate operand (rather than the last two). this (now) mirrors the "conditional call" command. this renumbering will make it more straightforward to add in new operations in the future, and makes the documentation slightly simpler.

since all the buffered command operations are new, and the documentation has not yet been published, this feels like a safe thing to do right now, rather than living with the earlier "mistake". (to be honest, I'd already half realised this when I raised the PR with buffered commands, as the logic between "conditional call" and "adjust" was inconsistent.)

This PR also improves how "call" (and "conditional call") operates when a buffer is calling itself. When this is detected, the VDU input stream is now just rewound to the beginning, rather than a new instance of the VDU command processor being created.

Finally there is a small bug fix for the discardBytes call.

The documentation for the buffered commands API follows the numbering and behaviour of the API as in this PR.

@breakintoprogram breakintoprogram added the enhancement New feature or request label Sep 20, 2023
calling a buffer from itself now rewinds the buffer, rather than starting a new vdu stream processor.  this reduces call stack usage, fixing an issue whereby simple loops would quickly run out of stack.

also bug fix `discardBytes`
@stevesims stevesims changed the title renumber buffer adjust commands Buffer commands improvements Sep 22, 2023
@breakintoprogram breakintoprogram merged commit 5b8121e into breakintoprogram:main Sep 24, 2023
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