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

offsetlen queries #11

Open
eekee opened this issue Feb 2, 2018 · 1 comment
Open

offsetlen queries #11

eekee opened this issue Feb 2, 2018 · 1 comment

Comments

@eekee
Copy link

eekee commented Feb 2, 2018

Documentation for the offsetlen instruction left me unsure whether it shifts the source data or not. testoffsetlen.tasm was uninstructive as its test data is uniform. I assumed it shifts because of the "offset" in the name, but output from my tests seems to indicate it truncates. I'm wondering, is it meant to shift, or shall I correct the documentation?

here's my intended documentation:

"offsetlen"
-0-++0
defines a masking window, only trits visible 
through the window are written to the destination.

usage:
	offsetlen|A,B,C
if A is "off", the remaining trits in the destination are preserved.
if it is "on", they are overwritten with 0.
B is the offset for the window's low-value edge (the right side).
C is the size of the window, the length extending toward high values.
affected operations are read and write to IO and memory.
the window remains active until reset with "offsetlen|off,0,9".
see also: romread* setdata IOread* IOwrite*

test code:
https://github.com/eekee/SBCTVM_Mk2_VMUSER/blob/master/offsetlen.tasm
https://github.com/eekee/SBCTVM_Mk2_VMUSER/blob/master/offsetlen.tasm

@ThomasTheSpaceFox
Copy link

The users manual has information on this on page 28

so essentially what it does is act like a sort of mask.

i.e. if i have a value in ram, say: +0+---++0
and i set offsetlength as such:
tasm: offsetlen|off,1,1
and i have register 1 set to ---------
then i copy that memory value to register 1 and we now have register 1 as:
-------+-

here is a gist with a short bit of tasm code used to verify the example:
https://gist.github.com/ThomasTheSpaceFox/0e623cb5b799cdf988705230a39b851d

does that make any sense.

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

No branches or pull requests

2 participants