EXAPUNKS

EXAPUNKS

View Stats:
KGOG-TV Satellite transfer
My problem with this level (aside from being over the size limit) is with syncing the EXAS to make sure that transfer begins only after azimuth, elevation and frequency has been set. It works on the first test run because the encryption key is short, so the EXA copying it will be done and in position with the copied file by the time the EXA adjusting azimuth, elevation and frequency finishes and sends the start signals to M. But if copying the encryption key takes longer than adjusting azim/elev/freq, the start signals are sent before the encryption key is ready and everything is out of sync.

Also, I'm pretty sure the code for adjusting azim/elev/freq could be optimized since azimuth and elevation are exactly the same process, but since there's no way to keep #elev or #azim in memory, I can't figure out a way to avoid writing practically the same code twice.

My code:

(EXAs are set to local)
First EXA:
GRAB 300
LINK 800
LINK 799
MARK AZIM
LINK 800
SEEK 1
COPY F X
SUBI X #AZIM X
TEST X < 0
TJMP SUBAZIM
MARK ADDAZIM
COPY 1 #MOTR
SUBI X 1 X
TEST X = 0
TJMP ELEV
JUMP ADDAZIM
MARK SUBAZIM
COPY -1 #MOTR
ADDI X 1 X
TEST X = 0
TJMP ELEV
JUMP SUBAZIM
MARK ELEV
LINK -1
LINK 801
SEEK 1
COPY F X
SUBI X #ELEV X
TEST X < 0
TJMP SUBELEV
MARK ADDELEV
COPY 1 #MOTR
SUBI X 1 X
TEST X = 0
TJMP DONE
JUMP ADDELEV
MARK SUBELEV
COPY -1 #MOTR
ADDI X 1 X
TEST X = 0
TJMP DONE
JUMP SUBELEV
MARK DONE
LINK -1
SEEK 1
COPY F #FREQ
WIPE
COPY 0 M
COPY 0 M

Second EXA:
LINK 800
GRAB 199
REPL WRITER
MARK READLOOP
COPY F M
TEST EOF
TJMP DONEREAD
COPY 0 M
JUMP READLOOP
MARK DONEREAD
COPY -9999 M
HALT
MARK WRITER
MAKE
MARK WRITELOOP
COPY M F
TEST M = -9999
TJMP DONE
JUMP WRITELOOP
MARK DONE
LINK 799
SEEK -9999
VOID M
NOOP
MARK TRANSFER
COPY F M
TEST EOF
TJMP GOBACK
MARK TRANSFER2
TEST M = -9999
TJMP HALT
JUMP TRANSFER
MARK GOBACK
SEEK -9999
JUMP TRANSFER2
MARK HALT
WIPE

Third EXA:
GRAB 301
LINK 800
LINK 799
SEEK 1
VOID M
MARK LOOP
ADDI -9999 F X
ADDI X M X
TEST X < 0
TJMP NEGRESULT
SUBI X 1 X
COPY X #DATA
TEST EOF
TJMP DONE
COPY 0 M
JUMP LOOP
MARK NEGRESULT
ADDI X 9999 #DATA
COPY 0 M
JUMP LOOP
MARK DONE
COPY -9999 M
WIPE

< >
Showing 1-6 of 6 comments
There are two ways to handle later EXAs starting things while earlier ones are still working and not ready:

1) Have the later EXA wait for a signal from the earlier one.
2) Have the earlier one replicate the later one only after it is finished.
[3) Edit: Another, bad, way is to make the later one wait for a while using NOOPs or loops that do nothing.]

I don't remember exactly but I think I had one EXA sending the encryption key to another one in the same host standing by to do the computation necessary and then sending that to one that actually inputs the data.
And the encryption one I made to wait for 3 signals (one from each satellite targeting EXA) before replicating the data sending EXA and then starting the whole sending process.

Or something like that.
Thanks! Having a single EXA in charge of transmission wait for a signal from each other EXA seems really obvious but it helped me a lot. Now I'm just trying to see where I can shave off at least 5 instructions to make it fit within the space limit... I've tried using the T register to hold the counter for the azim and elev loops so I can save on a test instruction, but since I need to check whether that counter is positive or negative to determine whether I should subtract or add, that doesn't work. Changing modes between local and global to avoid having to move EXAs around to send signals also seems to be a zero-sum game in this case. There's still a few possibilities I haven't tried.
Well, good luck! Without knowing your current solution I can't give you any hints on reducing instructions but maybe also take a closer look at your encryption and see if you can optimize that?
I've been able to shave off exactly one instruction by realizing that the data that has to be transmitted always has a length of 24 values so I don't really need to test eof. I'm sure there's something else to be done to optimize encoding but I'm not seeing it.

My solution right now:
First EXA:
GRAB 300
LINK 800
LINK 799
SEEK 1
COPY F X
REPL AZIM
SEEK 1
COPY F X
REPL ELEV
SEEK 1
COPY F #FREQ
WIPE
JUMP TRANSMIT
MARK AZIM
LINK 800
SUBI X #AZIM X
JUMP ADJUST
MARK ELEV
LINK 801
SUBI X #ELEV X
MARK ADJUST
TEST X < 0
TJMP SUB
MARK ADD
COPY 1 #MOTR
SUBI X 1 X
TEST X = 0
TJMP ADJDONE
JUMP ADD
MARK SUB
COPY -1 #MOTR
ADDI X 1 X
TEST X = 0
TJMP ADJDONE
JUMP SUB
MARK ADJDONE
LINK -1
COPY 0 M
HALT
MARK TRANSMIT
VOID M
VOID M
VOID M
REPL ENCODER
GRAB 301
SEEK 1
MARK TRANSMITLOOP
ADDI F -9999 X
ADDI X M X
TEST X < 0
TJMP NEGATIVE
SUBI X 1 #DATA
MARK TRANSMITLOOP2
TEST EOF
TJMP DONE
JUMP TRANSMITLOOP
MARK NEGATIVE
ADDI X 9999 #DATA
JUMP TRANSMITLOOP2
MARK DONE
WIPE
HALT
MARK ENCODER
GRAB 400
COPY 24 X
MARK ENCODE
COPY F M
SUBI X 1 X
TEST X = 0
TJMP OVER
TEST EOF
TJMP LOOP
JUMP ENCODE
MARK LOOP
SEEK -9999
JUMP ENCODE
MARK OVER
WIPE

Second EXA:
LINK 800
REPL READER
MAKE
MARK WRITE
COPY M F
TEST M = -9999
TJMP WRITEDONE
JUMP WRITE
MARK WRITEDONE
LINK 799
COPY 0 M
HALT
MARK READER
GRAB 199
MARK READ
COPY F M
TEST EOF
TJMP READDONE
COPY 0 M
JUMP READ
MARK READDONE
COPY -9999 M

Third EXA:
GRAB 301
LINK 800
LINK 799
In the first EXA you could get rid of DONE section substituting it for OVER. They are doing the same thing.
Ok here is a major tip that can effect almost every puzle... mabey don't look unless you're sure

big hint

the conditional jumps only care about if the T register is zero or not.



which means that...

if you put your loop counter in T, you can skip the need for a TEST instruction.
This save lines, cycles, and frees-up the X register for other tasks.
< >
Showing 1-6 of 6 comments
Per page: 1530 50