EXAPUNKS - Teil 2
Teil 2 meiner EXAPUNKS-Lösungen, Level 11-20
11 - UC Berkeley
Cycles: 553 / Size: 38 / Activity: 7
; EXA 'LC'
; GET DATA
GRAB 300
COPY F M
COPY F M
WIPE
; PREPARE NEW FILE
MAKE
COPY M X
MARK LOOP
COPY M F
SUBI X 1 X
TEST X = 0
FJMP LOOP
DROP
HALT
; EXA 'RM'
; MOVE TO CORRECT HOST
LINK 800
COPY M X
MARK LOOP
LINK 800
LINK 800
HOST T
TEST X = T
FJMP LOOP
; REACHED HOST
COPY M X
GRAB 200
MARK NEXT
COPY F T
TEST X = T
FJMP NEXT
; FOUND IT
; POS TO REGISTER T
; LENGTH TO REGISTER X
COPY F T
COPY F X
COPY X M
; READ THE ACTUAL DATA
SEEK -9999
SEEK T
MARK READ
COPY F M
SUBI X 1 X
TEST X = 0
FJMP READ
; TERMINATE
HALT
12 - Workhouse
Cycles: 517 / Size: 30 / Activity: 2
; EXA 'XA'
; GET USER NAME
GRAB 300
COPY F X
DROP
; GET USER FILE ID
LINK 800
GRAB 199
MARK USERFILEID
TEST F = X
FJMP USERFILEID
SEEK 1
COPY F X
DROP
; GET USER FILE
LINK 799
GRAB X
COPY 0 X
SEEK 2
; EXISTING VALUES
MARK REPLACEVALUE
ADDI X F X
SEEK -1
COPY 75 F
SUBI X 75 X
TEST EOF
FJMP REPLACEVALUE
; NEW VALUES
MARK ADD75
COPY 75 F
SUBI X 75 X
TEST X < 75
FJMP ADD75
COPY X F
DROP
HALT
13 - Equity First Bank
Cycles: 5025 / Size: 21 / Activity: 10
; EXA 'XA'
LINK 800
LINK 800
LINK 800
COPY 800 X
; CREATE EXAS
MARK LOOPREPL
REPL GOTOATM
ADDI X 1 X
TEST X = 807
FJMP LOOPREPL
MARK GOTOATM
LINK X
; DISPENSE CASH
MARK DISPENSE
COPY #CASH X
MARK LOOPDISPENSE
TEST X = 0
TJMP EXITLOOP
COPY 20 #DISP
SUBI X 1 X
JUMP LOOPDISPENSE
MARK EXITLOOP
; TERMINATE
HALT
14 - Mitsuzen HDI-10
Single EXA Solution:
Cycles: 559 / Size: 33 / Activity: 239
; EXA 'XA'
; MOVE TO POSITION
LINK 800
; PREPARE
MARK LOOPMAIN
MAKE
COPY 40 F
COPY -70 F
COPY -70 F
COPY 40 F
COPY #NERV T
DIVI T -10 T
SUBI T 2 T
MARK LOOPPREPARE
FJMP CONTWRITE
COPY -70 F
COPY -70 F
SUBI T 1 T
JUMP LOOPPREPARE
MARK CONTWRITE
; WRITE SEQUENCE
SEEK -9999
MARK LOOPWRITE
LINK 1
LINK 1
COPY F #NERV
LINK -1
LINK -1
LINK 3
LINK 3
COPY F #NERV
LINK -3
LINK -3
TEST EOF
FJMP LOOPWRITE
WIPE
JUMP LOOPMAIN
Multiple EXA Solution:
Cycles: 86 / Size: 32 / Activity: 7
; EXA 'RD'
LINK 800
MARK LOOP
COPY #NERV X
DIVI X -10 X
SUBI X 2 X
COPY X M
COPY X M
JUMP LOOP
; EXA 'WS'
LINK 800
LINK 1
LINK 1
MARK OUTER
COPY 40 #NERV
COPY -70 #NERV
COPY M T
MARK INNER
COPY -70 #NERV
SUBI T 1 T
TJMP INNER
JUMP OUTER
; EXA 'WA'
LINK 800
LINK 3
LINK 3
MARK OUTER
COPY -70 #NERV
COPY 40 #NERV
COPY M T
MARK INNER
COPY -70 #NERV
SUBI T 1 T
TJMP INNER
JUMP OUTER
15 - Trash World News
Cycles: 3669 / Size: 42 / Activity: 4
; EXA 'RD'
GRAB 300
; WAIT FOR TRANSMISSION
MARK LOOPFILE
COPY M T
FJMP ABORT
SEEK -9999
MARK LOOPWORD
COPY F M
COPY F M
TEST EOF
FJMP LOOPWORD
; SEND EOF TO WR
COPY 0 M
JUMP LOOPFILE
MARK ABORT
DROP
LINK 800
GRAB 200
LINK 800
DROP
HALT
; EXA 'WR'
LINK 800
LINK 799
GRAB 212
; PROCESS FILE
MARK LOOPFILE
TEST EOF
TJMP ABORT
COPY F X
; START TRANSMISSION
COPY 1 M
; SEE IF WORD MATCHES
MARK LOOPWORD
COPY M T
FJMP LOOPFILE
TEST X = T
TJMP REPLACE
VOID M
JUMP LOOPWORD
MARK REPLACE
SEEK -1
COPY M F
JUMP LOOPWORD
JUMP LOOPFILE
; SEND ABORT TO RD
MARK ABORT
COPY 0 M
HALT
16 - KGOG-TV
Cycles: - / Size: - / Activity: -
; EXA 'XA'
LINK 800
KILL
KILL
GRAB 210
LINK 809
DROP
GRAB 265
LINK -1
DROP
GRAB 211
LINK 867
DROP
HALT
17 - TEC Redshift
Cycles: 6011 / Size: 24 / Activity: 13
; EXA 'XA'
LINK 800
; TRY 999-000 BACKWARDS
COPY 999 T
MARK LOOP
SWIZ T 3 #PASS
SWIZ T 2 #PASS
SWIZ T 1 #PASS
REPL CHECK
SUBI T 1 T
TJMP LOOP
; SEE IF LINK EXISTS
; KILL XA ON WAY BACK
MARK CHECK
LINK 800
GRAB 199
COPY F X
DROP
MAKE
SWIZ T 3 F
SWIZ T 2 F
SWIZ T 1 F
COPY X F
LINK -1
KILL
LINK -1
DROP
HALT
18 - Digital Library Project
Cycles: 377 / Size: 43 / Activity: 74
; EXA 'XA'
GRAB 300
MARK LOOPBOOKS
COPY F X
REPL GETBOOK
TEST EOF
FJMP LOOPBOOKS
HALT
MARK GETBOOK
; GO TO HOST
LINK 800
SWIZ X 3 T
MARK LOOPWALK
LINK 800
SUBI T 1 T
TJMP LOOPWALK
; GRAB BOOK & SEND IT
SWIZ X 021 X
ADDI X 200 X
GRAB X
MODE
REPL WRITEBOOK
MARK SENDBOOK
COPY F M
TEST EOF
JUMP SENDBOOK
HALT
; COPY TO BOOK
MARK WRITEBOOK
MAKE
MARK RECEIVEBOOK
TEST MRD
FJMP WRITEFINISH
COPY M F
NOOP
JUMP RECEIVEBOOK
; DELIVER BOOK
MARK WRITEFINISH
SEEK -9999
COPY F X
SWIZ X 3 T
ADDI T 1 T
MARK LOOPWALKBACK
LINK -1
SUBI T 1 T
TJMP LOOPWALKBACK
DROP
HALT
19 - TEC Exa-Blaster Modem
Cycles: 1084 / Size: 53 / Activity: 17
; EXA 'XA'
; INIT FILE POS COUNTER
COPY 0 X
MARK LOOPSTATION
GRAB 301
; SEEK NEXT NUMBER
SEEK X
; EOF?
TEST EOF
TJMP EXIT
; SEND CONTINUE
COPY 1 M
; SEND NUMBER
COPY 11 T
MARK LOOPDIAL
COPY F M
SUBI T 1 T
TJMP LOOPDIAL
DROP
GRAB 300
; SEND DATA TO WRITE
MARK SENDDATA
COPY M T
FJMP ENDSEND
COPY F M
COPY F M
SEEK -2
JUMP SENDDATA
MARK ENDSEND
DROP
; ADVANCE TO NEXT NUMBER
ADDI X 11 X
JUMP LOOPSTATION
MARK EXIT
COPY 0 M
DROP
HALT
; EXA 'XB'
LINK 800
MARK NEXTSTATION
; CHECK FINISHED
COPY M T
FJMP EXIT
; DIAL
COPY 11 T
MARK LOOPDIAL
COPY M #DIAL
SUBI T 1 T
TJMP LOOPDIAL
; ENTER STATION
LINK 800
GRAB 200
; MANIPULATE LIST
MARK WRITEDATA
COPY 1 M
COPY M F
COPY M F
TEST EOF
FJMP WRITEDATA
COPY 0 M
DROP
LINK -1
; HANG UP
COPY -1 #DIAL
JUMP NEXTSTATION
; EXIT
MARK EXIT
HALT
20 - Emerson’s Guide
Cycles: 50 / Size: 48 / Activity: 6
; EXA 'RD'
GRAB 300
COPY F X
COPY F M
COPY F M
COPY X M
HALT
; EXA 'WR'
LINK 800
COPY M T
FJMP SKIPEAST
MARK WALKEAST
LINK 801
SUBI T 1 T
TJMP WALKEAST
MARK SKIPEAST
COPY M X
TEST X = 0
TJMP EDITFILE
TEST X < 0
TJMP EMBARKSOUTH
COPY X T
MARK WALKNORTH
LINK 800
SUBI T 1 T
TJMP WALKNORTH
JUMP EDITFILE
MARK EMBARKSOUTH
COPY X T
SWIZ T -1 T
MARK WALKSOUTH
LINK 802
SUBI T 1 T
TJMP WALKSOUTH
MARK EDITFILE
COPY M X
GRAB 200
MARK LOOPFILE
TEST F = X
TJMP ADDSTARS
SEEK 5
JUMP LOOPFILE
MARK ADDSTARS
COPY F X
COPY 4 T
MARK LOOPSTARS
COPY X F
SUBI T 1 T
TJMP LOOPSTARS
HALT