EXAPUNKS

EXAPUNKS

View Stats:
Polarosity Aug 17, 2018 @ 7:47pm
KGOG TV - Satellite Uplink Hint (possible spoilers)
Been stuck on this day 2 now. Rewritten my original code as I was passed my line limit and have been having trouble on my encryption process. Any hints?

My main hurdle is how to calculate values that reach over 9999 and have that wrap back to 0.

First attempt had me add both numbers using 2EXAS, if = 9999, I'd add it again, but with SUBI 5000 twice before adding the second number. Issue was this was very line costly and my poorly written code had me calculate this rewriting the original file, then after it was done, attempting to transmit. Initial attempt passed. Test 2 Failed. Adjustments passed line limit.

Second attempt has a lot cleaner code. My goal was to write the numbers into X and T respectfully and add to X by 1 until T = 0 (Thought it was a clever way to utilize TJMP) But now I'm back at figuring out what to do if X = 9999 as now I obviously can't test it with this method.
Originally posted by Vanilla 4/4 for 4:
Your protip of the day is you can also count down all the way to -9999.
I personally started there, and added to that. Be careful of 0!
< >
Showing 1-4 of 4 comments
The author of this thread has indicated that this post answers the original topic.
Vanilla 4/4 for 4 Aug 18, 2018 @ 1:35am 
Your protip of the day is you can also count down all the way to -9999.
I personally started there, and added to that. Be careful of 0!
Last edited by Vanilla 4/4 for 4; Aug 18, 2018 @ 1:36am
Ra-Ra-Rasputin Aug 18, 2018 @ 1:57am 
I started off by setting X to -9999, adding them together and testing if the value was negative or 0, if not, sending it through, relevant code underneath in spoiler. It's a bit of a slow way, but it works. Written off of memory


MARK SENDDAT
COPY -9999 X
NOTE global communication
ADDI M X X
ADDI F X X
TEST X < 1
TJMP LESS
NOTE I forgot if this needs
NOTE ADDI X 1 X
[send it]
JUMP SENDDAT

MARK LESS
ADDI X 9999 X
<send it>
JUMP SENDDAT


There are much more elaborate and better ways of doing this, this is just my base first prototype that worked.
Last edited by Ra-Ra-Rasputin; Aug 18, 2018 @ 2:04am
MetaMarty Aug 18, 2018 @ 3:13am 
You can actually make sure that you never get into an overflow situation by fully using the value-space of the registers. Remember they go from -9999 to 9999. Instead of processing the encoding key values with a COPY instruction, it's just as fast to process (key-9999) with a SUBI instruction. Adding this to your input file is always guaranteed to be withing -9999 to 9999, so no overflow happens.

You can then postprocess the final value by checking if the result > 0.


MARK LOOP
TEST EOF
TJMP DONE
ADDI F M X
TEST X > 0 ' Check for overfow
TJMP WRITE ' Overflow happened, final value x-1
ADDI X 9999 X ' No overflow happend, final value = x + 9999
MARK WRITE
SUBI X T X ' Correct based on test outcome
SEEK -1
COPY X F ' Overwrite original file to encoded file
JUMP LOOP
MARK DONE

EXA for providing the encoding keys:

LINK 800
MODE
GRAB 199
MARK LOOP
SUBI F 9999 M 'send out key-9999
TEST EOF
FJMP LOOP
SEEK -9999
JUMP LOOP
Last edited by MetaMarty; Aug 18, 2018 @ 3:14am
Polarosity Aug 18, 2018 @ 12:10pm 
Of course! Thanks for the assist everyone.
I failed to realize I can count both ways.
The optimization tips were very helpful also!
< >
Showing 1-4 of 4 comments
Per page: 1530 50

Date Posted: Aug 17, 2018 @ 7:47pm
Posts: 4