EXAPUNKS - Teil 4
Teil 4 meiner EXAPUNKS-Lösungen, Level 31-39
31 - TEC Exa-Blaster Modem
Cycles: 2512 / Size: 52 / Activity: 10
; EXA 'XA'
GRAB 300
LINK 800
MARK LOOP
; SELECT LAST NUMBER
SEEK -11
; NO NUMBER?
TEST EOF
TJMP FINISHALL
; DIAL NUMBER
MARK DIALNUMBER
COPY 11 T
MARK DIALDIGIT
COPY F #DIAL
SEEK -1
VOID F
SUBI T 1 T
TJMP DIALDIGIT
; SEND EXA
REPL DATAPHONE
; SEE IF LINK EXISTS
; WAIT FOR EXA TO ARRIVE
@REP 4
NOOP
@END
TEST MRD
FJMP LOOP
; CHECK FOR WORK
MARK LOOPRECEIVE
COPY M X
TEST X = -9999
TJMP FINISHRECEIVE
COPY X F
; RECEIVE REST
COPY 10 T
MARK LOOPDIGITS
COPY M F
SUBI T 1 T
TJMP LOOPDIGITS
JUMP LOOPRECEIVE
MARK FINISHRECEIVE
; HANGUP
COPY -1 #DIAL
JUMP LOOP
MARK FINISHALL
LINK -1
HALT
MARK DATAPHONE
LINK 800
GRAB 200
; PROCESS CONTACTS
MARK NEXTCONTACT
; SKIP NAME
SEEK 1
; SEND NUMBER
COPY 11 T
MARK NEXTDIGIT
COPY F M
SUBI T 1 T
TJMP NEXTDIGIT
TEST EOF
FJMP NEXTCONTACT
; SEND FINISH
COPY -9999 M
HALT
32 - Last Stop Snaxnet
Cycles: 515 / Size: 63 / Activity: 24
; EXA 'RD'
LINK 800
LINK 799
; STORE PRESSURE IN FILE
MARK READPRESSURE
MAKE
@REP 5
COPY @{0,1} F
COPY #ZGC@{0,1} F
@END
MARK FIND
COPY -1 X
; FIND HIGHEST
SEEK -9999
MARK LOOP
TEST EOF
TJMP FINISHED
SEEK 1
TEST F > X
FJMP LOOP
SEEK -1
COPY F X
JUMP LOOP
MARK FINISHED
; ALL SHUTDOWN?
TEST X = 0
TJMP ALLDONE
SEEK -9999
MARK LOOP2
TEST F = X
FJMP LOOP2
SEEK -2
COPY F M
WIPE
; WAIT FOR SHUTDOWN
COPY M X
JUMP READPRESSURE
MARK ALLDONE
WIPE
; SEND EXIT
COPY -9999 M
HALT
; EXA 'WR'
LINK 800
LINK 798
MARK LOOP
COPY M X
TEST X = -9999
TJMP FINISHED
COPY X T
MARK STEPFORWARD
FJMP REACHEDCENTRIFUGE
LINK 800
SUBI T 1 T
JUMP STEPFORWARD
MARK REACHEDCENTRIFUGE
COPY 0 #POWR
COPY X T
MARK STEPBACK
FJMP REACHED0
LINK -1
SUBI T 1 T
JUMP STEPBACK
MARK REACHED0
COPY -9999 M
JUMP LOOP
MARK FINISHED
HALT
33 - Mitsuzen HDI-10
Cycles: 665 / Size: 39 / Activity: 273
; EXA 'XA'
LINK 800
LINK 1
LINK 3
; MAIN LOOP
; READ AND REPL
MARK LOOP
; RESET X
COPY 0 X
REPL SCANEXAS
ADDI X M X
ADDI X M X
ADDI X M X
MULI X 5 X
SUBI X 75 #NERV
JUMP LOOP
; THE SCANNERS
MARK SCANEXAS
LINK -3
REPL ROW1
REPL ROW3
JUMP SCAN
MARK ROW1
LINK 1
JUMP SCAN
MARK ROW3
LINK -1
MARK SCAN
TEST #NERV > -55
FJMP CONT
ADDI X 1 X
MARK CONT
LINK -3
TEST #NERV > -55
FJMP CONT2
ADDI X 1 X
MARK CONT2
LINK -3
TEST #NERV > -55
FJMP CONT3
ADDI X 1 X
MARK CONT3
COPY X M
HALT
34 - Holman Dynamics
Cycles: 11.6K / Size: 63 / Activity: 3
; EXA 'CL'
; CALCULATOR
MODE
MARK LOOP
COPY 0 X
COPY 16 T
MARK RECEIVENEXTDIGIT
ADDI X M X
SUBI T 1 T
TJMP RECEIVENEXTDIGIT
; LAST DIGIT MATTERS
SWIZ X 0001 T
MARK CONT
; SEND RESULT TO WR
COPY T M
FJMP FOUND
JUMP LOOP
MARK FOUND
HALT
; EXA 'RD'
LINK 800
LINK 802
LINK 799
GRAB 199
MARK LOOP
; CHECK FINISH
COPY M T
FJMP FINISH
; SCAN FOR GARBAGE
MARK RESTART
COPY 16 X
MARK SCANNEXTDIGIT
TEST F = -9999
TJMP RESTART
SUBI X 1 X
TEST X = 0
FJMP SCANNEXTDIGIT
; PROCESS NUMBER
SEEK -16
; READ AND COPY NUMBER
COPY 16 T
MARK TRANSMITNEXTDIGIT
COPY F M
SUBI T 1 T
TJMP TRANSMITNEXTDIGIT
SEEK -15
JUMP LOOP
MARK FINISH
HALT
; EXA 'WR'
; RECEIVE NUMBER
MARK RECEIVE
MAKE
COPY 1 M
COPY 16 T
MARK RECEIVENEXTDIGIT
COPY M F
SUBI T 1 T
TJMP RECEIVENEXTDIGIT
; CALCULATE CHECKSUM
MODE
SEEK -16
MARK PROCESSNEXTDIGIT
; ODD: DO MAGIC
COPY F X
MULI X 2 X
TEST X > 9
FJMP CONT
SUBI X 9 X
MARK CONT
COPY X M
; EVEN: DO NOTHING
COPY F M
TEST EOF
FJMP PROCESSNEXTDIGIT
; VALID NUMBER?
COPY M T
FJMP FINISH
WIPE
MODE
JUMP RECEIVE
MARK FINISH
; SEND FINISH TO RD
MODE
COPY 0 M
HALT
35 - Aberdeen
Cycles: - / Size: - / Activity: -
; EXA 'XA'
; STRAIGHT FORWARD
LINK 800
MARK LOOP
@REP 3
REPL @{800,1}
@END
REPL 799
REPL BACK
JUMP LOOP
@REP 3
MARK @{800,1}
LINK @{800,1}
JUMP LOOP
@END
MARK 799
LINK 799
JUMP LOOP
MARK BACK
LINK -1
JUMP LOOP
36 - U.S. Government
Cycles: 1818 / Size: 136 / Activity: 44
; EXA 'BF'
; BUFFER
MODE
MAKE
MARK LOOPMODIFY
SEEK -9999
COPY 10 T
MARK WRITE
COPY M F
SUBI T 1 T
TJMP WRITE
SEEK -9999
COPY 10 T
MARK READ
COPY F M
SUBI T 1 T
TJMP READ
JUMP LOOPMODIFY
; EXA 'MA'
; FIRST THE PRESIDENT
GRAB 300
COPY F M
DROP
MAKE
COPY 10 T
MARK RECEIVESOURCE
COPY M F
COPY -9999 F
SUBI T 1 T
TJMP RECEIVESOURCE
; THEN THE SENATOR
DROP
GRAB 300
SEEK 1
COPY F M
DROP
GRAB 401
COPY 10 T
MARK RECEIVEDEST
SEEK 1
COPY M F
SUBI T 1 T
TJMP RECEIVEDEST
; THE MODIFICATION
SEEK -9999
; SEND CHUNK TO READ
MARK LOOPMODIFY
COPY F M
COPY 10 T
MARK WRITESOURCE
COPY M X
MODE
COPY X M
MODE
SUBI T 1 T
TJMP WRITESOURCE
; SEND CHUNK TO WRITE
COPY F M
COPY 10 T
MARK READDEST
MODE
COPY M X
MODE
COPY X M
SUBI T 1 T
TJMP READDEST
TEST EOF
FJMP LOOPMODIFY
; SEND FINISHED
COPY -9999 M
; CLEANUP
WIPE
KILL
GRAB 400
WIPE
HALT
; EXA 'SL'
; GET CHUNKS TO MODIFY
COPY M X
LINK 800
LINK 801
; FIRST THE PRESIDENT
GRAB 200
MARK FINDSOURCE
TEST F = X
TJMP FOUNDSOURCE
SEEK 10
JUMP FINDSOURCE
MARK FOUNDSOURCE
COPY 10 T
MARK SOURCELOOP
COPY F M
SUBI T 1 T
TJMP SOURCELOOP
; THEN THE SENATOR
COPY M X
SEEK -9999
MARK FINDDEST
TEST F = X
TJMP FOUNDDEST
SEEK 10
JUMP FINDDEST
MARK FOUNDDEST
COPY 10 T
MARK DESTLOOP
COPY F M
SUBI T 1 T
TJMP DESTLOOP
DROP
LINK -1
; THE MODIFICATION
MARK LOOPMODIFY
; READ
; RECEIVE CHUNK
COPY M X
; FINISHED?
TEST X = -9999
TJMP FINISHED
; DRIVE
SWIZ X 0003 T
ADDI T 800 T
LINK T
; FILE
SWIZ X 0002 T
ADDI T 200 T
GRAB T
; CHUNK
SWIZ X 0001 T
MULI T 10 T
SEEK T
; READ
COPY 10 T
MARK READSOURCE
COPY F M
SUBI T 1 T
TJMP READSOURCE
DROP
LINK -1
; WRITE
; RECEIVE CHUNK
COPY M X
; DRIVE
SWIZ X 0003 T
ADDI T 800 T
LINK T
; FILE
SWIZ X 0002 T
ADDI T 200 T
GRAB T
; CHUNK
SWIZ X 0001 T
MULI T 10 T
SEEK T
; READ
COPY 10 T
MARK WRITEDEST
COPY M F
SUBI T 1 T
TJMP WRITEDEST
DROP
LINK -1
JUMP LOOPMODIFY
MARK FINISHED
HALT
37 - Unknown Network 2
Cycles: 323 / Size: 47 / Activity: 53
; EXA 'XA'
; GO TO CENTRAL HOST
@REP 5
LINK 800
@END
; KILL OTHER EXAS
@REP 6
KILL
@END
; GRAB FILES AND RUN
COPY 99 T
MARK NEXTGRABBER
REPL RELEASEGRABBER
SUBI T 1 T
TJMP NEXTGRABBER
REPL RELEASEGRABBER
; GIVE EXAS TIME TO FLEE
@REP 3
NOOP
@END
; MOVE BACKWARDS
LINK -1
REPL CLEANER
@REP 2
KILL
@END
MARK CLEANER
LINK -1
REPL CLEANER2
@REP 2
KILL
@END
MARK CLEANER2
LINK -1
REPL CLEANER3
@REP 2
KILL
@END
MARK CLEANER3
LINK -1
@REP 2
KILL
@END
MARK RELEASEGRABBER
ADDI T 200 T
GRAB T
@REP 5
LINK -1
@END
HALT
38 - TEC Exa-Blaster Modem
Cycles: 1153 / Size: 70 / Activity: 11
; EXA 'MS'
; MESSAGE SENDER
GRAB 300
LINK 800
; DETERMINE TEXT LENGTH
MARK LOOPCOUNT
COPY F T
ADDI X 1 X
TEST EOF
FJMP LOOPCOUNT
; COPY LENGTH TO M
MODE
COPY X M
MODE
MARK LOOPEXA
SEEK -9999
; SEND MESSAGE LENGTH
COPY X M
MARK LOOPSEND
COPY F M
TEST EOF
FJMP LOOPSEND
MODE
COPY 1 M
MODE
JUMP LOOPEXA
; EXA 'XA'
GRAB 301
LINK 800
; LOCAL
MODE
COPY M X
; PREPARE MESSAGE
MARK LOOPPREPARE
COPY 11 T
MARK DIALNUMBER
COPY F #DIAL
SUBI T 1 T
TJMP DIALNUMBER
REPL PAGER
;WAIT FOR NEXT EXA
VOID M
COPY -1 #DIAL
TEST EOF
FJMP LOOPPREPARE
; KILL MESSAGE SENDER
KILL
; GLOBAL
MODE
; SEND MESSAGE
SEEK -9999
COPY 8 X
MARK LOOPACTIVATE
COPY 11 T
MARK DIALAGAIN
COPY F #DIAL
SUBI T 1 T
TJMP DIALAGAIN
; SEND DELAY TO EXA
COPY X M
SUBI X 1 X
COPY -1 #DIAL
TEST EOF
FJMP LOOPACTIVATE
; CLEANUP
WIPE
GRAB 300
WIPE
HALT
MARK PAGER
LINK 800
MODE
; MESSAGE LENGTH
COPY M T
MARK WRITEMESSAGE
COPY M #DATA
SUBI T 1 T
TJMP WRITEMESSAGE
;WAIT
COPY M X
MULI X 20 T
MARK WAITACTIVATE
SUBI T 1 T
TJMP WAITACTIVATE
COPY 1 #PAGE
HALT
39 - Mitsuzen HDI-10
Cycles: 1178 / Size: 116 / Activity: 17
; EXA 'XB'
MAKE
COPY 10 T
MARK WAIT
NOOP
SUBI T 1 T
TJMP WAIT
MARK LOOP
COPY M F
@REP 10
NOOP
@END
TEST MRD
TJMP LOOP
; CALL EXAS
; FIND SMALLEST
MARK NEXTEXA
SEEK -9999
TEST EOF
TJMP DONE
COPY F X
MARK FILELOOP
TEST EOF
TJMP NEXT
TEST F < X
FJMP NEXT
SEEK -1
COPY F X
MARK NEXT
TEST EOF
FJMP FILELOOP
; STORE SMALLEST
MODE
COPY X M
MODE
; SEEK SMALLEST
SEEK -9999
MARK NEXTHOST
TEST F = X
FJMP NEXTHOST
; ASK FOR VALUE
MARK WAITFORANSWER
SEEK -1
COPY F M
COPY M X
TEST X < 0
TJMP GOTVALUE
; IF NOT RELAY
JUMP WAITFORANSWER
MARK GOTVALUE
MODE
COPY X M
MODE
; REMOVE SMALLEST
SEEK -1
VOID F
JUMP NEXTEXA
MARK DONE
KILL
HALT
; EXA 'XA'
LINK 800
COPY -1 X
; DON'T GO BACK
MARK REPL
TEST X = 3
TJMP SKIP3
REPL MARK3
MARK SKIP3
TEST X = -3
TJMP SKIPX3
REPL MARKX3
MARK SKIPX3
TEST X = 1
TJMP SKIP1
REPL MARK1
MARK SKIP1
TEST X = -1
TJMP SKIPX1
REPL MARKX1
MARK SKIPX1
; THIS WILL KILL EXAS
; ON EMPTY HOST
COPY #NERV X
HOST M
; PREVENT INTERFERING
; WITH HOSTNAMES
COPY 40 T
MARK DELAY
NOOP
SUBI T 1 T
TJMP DELAY
; WAIT UNTIL CALL
MARK WAIT
COPY M X
HOST T
; IS IT ME?
TEST T = X
TJMP DONE
; IF NOT - RELAY
COPY X M
JUMP WAIT
MARK DONE
COPY #NERV M
HALT
MARK MARK3
COPY -3 X
LINK 3
JUMP REPL
MARK MARKX3
COPY 3 X
LINK -3
JUMP REPL
MARK MARK1
COPY -1 X
LINK 1
JUMP REPL
MARK MARKX1
COPY 1 X
LINK -1
JUMP REPL
; EXA 'XC'
; WRITE EVERYTHING
MAKE
MODE
MARK LOOP
COPY M F
JUMP LOOP