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

Finish implementation of LOOPXY #23

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

DerelictDrone
Copy link
Member

@DerelictDrone DerelictDrone commented Nov 24, 2023

LOOPXY was an unfinished instruction for 2D looping using the ECX and EDX registers, introduced during the vectors expansion, it took two pointers, we may never know how blackphoenix intended its implementation so this is my guess on how to make it useful from what little remnants there were of it in the code & documentation.

This is, so far, the only LOOP instruction that exits on -1 rather than 0, so it can access 0 indexes for things.

Pseudocode for how the instruction actually works:

Decrement EDX
if EDX == -1 Decrement ECX
if ECX == -1 exit loop, else JMP to operand 1 end
else JMP to operand 2 end

Usage example, iterating over 6 vector 4's to get an estimate of F=MA using the first three indices to get a constant velocity for A and the 4th as M
image

This may be a gimmicky instruction/usecase, but it's been compileable and useless for more than 5 years now, if desired by maintainers the instruction can be removed instead.

@thegrb93 thegrb93 merged commit f87abea into wiremod:master Nov 27, 2023
1 check failed
@DerelictDrone DerelictDrone deleted the loopxy branch November 28, 2023 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants