Trailing-Edge
-
PDP-10 Archives
-
SRI_NIC_PERM_SRC_3_19910112
-
utilities/kalah.mac
There are no other files named kalah.mac in the archive.
TITLE KALAH
SALL
RADIX 10
COMMENT/ REGISTERS /
; 0 WORK
; 1 WORK
M=2 ; 2 MAIN PUSHDOWN LIST
PR=3 ; 3 PARAMETERS FOR ROUTINES
KALAHS=4 ; 4 LH-KALAHS
; 4 RH-
PPITS=5 ; 5 PPITS
MPITS=6 ; 6 MPITS
ALPHA=7 ; 7 FOR TREE PRUNING
BETA=8 ; 8 FOR TREE PRUNING
R=9 ; 9 SECONDARY PUSHDOWN LIST
CNT=10 ;10 TREE DEPTH CUTOFF
NEG=11 ;11 CONSTANT- =^O400000000000
S=12 ;12 LH-SWITCHES
Z=12 ;12 RH-ZERO BYTE
P=13 ;13 WORK
C=14 ;14 CURRENT INPUTED CHARACTER
I=15 ;15 WORK
COMMENT/ SWITCHES /
TECHNICAL=1B35
PDISPLAY=1B34
CHAMPION=1B33
UPDATE=1B32
INTERRUPT=1B31
FIRSTC=1B30
PRVLDG=1B29
VT05=1B28
VT50=1B27
VT52=1B26
HZ=1B25
DP=1B24
TT=1B23
COMMENT/ MISCELLANEOUS /
CR=^O15
LF=^O12
TAB=^O11
ESC=^O33
LINES=20
SCORR=0 ;FIRST ROW OF SCOREPAD
INPTR=LINES-3 ;ROW OF INPUT PROMPTER
TECHR=INPTR-5 ;FIRST ROW OF TECHNICAL INFO
IFL <TECHR-9>,<BORDR=0
BORDS=1>
IFGE <TECHR-9>,<BORDR=TECHR/2-3
BORDS=2>
BORDC=BORDR+BORDS
COMMENT/ MACROS /
DEFINE CALL(ADR)
< PUSHJ M,ADR>
DEFINE RETURN
< POPJ M,>
DEFINE CLEARSCREEN
< CALL $CLEAR>
DEFINE POSITION(X,Y)
< IFB <'Y'>,< MOVE PR,X>
IFNB <'Y'>,< MOVE PR,[XY(X,Y)]>
CALL $POSIT>
DEFINE CLEARLINE(Y)
< IFNB <'Y'>,< HLLZ PR,Y
CALL $POSIT>
CALL $DELET>
DEFINE XY(ROW,COL)
< XWD ROW,COL>
DEFINE CLEARNUMBER
< OUTSTR [ASCIZ/ /]>
DEFINE ERROR(MSG)
< PUSHJ M,$ERROR
ASCIZ/%'MSG'/>
DEFINE GETNUMBER
< CALL $GETNU>
DEFINE PRINT(ADR)
< MOVE PR,ADR
CALL $NUMBE>
DEFINE PRINT2(ADR)
< IFN ADR,< MOVE 0,ADR>
IDIVI 0,10
JUMPG 0,.+3
OUTCHR [" "]
JRST .+3
ADDI 0,"0"
OUTCHR 0
OUTCHR DIGIT(1)>
DEFINE ZERO2
< OUTSTR [ASCIZ/ 0/]>
DEFINE DISTRIBUTE(PIT,I)
< DPB Z,PIT(I)
SOSGE I
MOVEI I,12
LDB 1,PIT(I)
CAILE P,1
JRST .+7
JUMPG 1,.+6
CAIL I,7
JRST .+4
JUMPE I,.+3
LDB 1,PIT'C(I)
DPB Z,PIT'C(I)
ADDI 1,1
DPB 1,PIT(I)
SOJG P,.-13>
NEWGM: CALL SETBRD
NEWMV: POSITION(INPUT)
CLEARLINE
OUTSTR MOVNUM
NEWCMD: INCHWL C
CAIL C,"0"
JRST CHKCMD
CAIN C," "
JRST NEWCMD
CAIN C,ESC
EXIT
CAIE C,CR
JRST INVCMD
INCHWL C
JRST NEWMV
CHKCMD: CAIG C,"6"
JRST PLAY
CAIN C,"M"
JRST MOVEFIRST
CAIN C,"R"
JRST RESTART
CAIN C,"T"
JRST SETECH
CAIN C,"K"
JRST KILL
CAIN C,"B"
JRST BACKUP
CAIN C,"S"
JRST SWITCH
CAIN C,"P"
JRST DSPDL
CAIN C,"L"
JRST SETLIM
CAIN C,"E"
JRST SETEQ
CAIN C,"U"
JRST SETUPD
CAIE C,"N"
JRST INVCMD
INCHWL C
CAIN C,"T"
JRST NOTECH
CAIN C,"K"
JRST NOKILL
CAIN C,"P"
JRST NDSPDL
CAIN C,"U"
JRST NOUPD
INVCMD: ERROR <INVALID COMMAND>
EMPTY: JUMPE MPITS,MMT
MOVEI I,6
LDB P,MPIT
MTM: LDB 0,MPIT(I)
JUMPE 0,MPMT
DPB Z,MPIT(I)
ADD P,0
POSITION(<MPOS(I)>)
ZERO2
MPMT: SOJG I,MTM
DPB P,MPIT
POSITION(MPOS)
PRINT2(P)
MMT: JUMPE PPITS,PMT
MOVEI I,6
LDB P,PPIT
MTP: LDB 0,PPIT(I)
JUMPE 0,MMMT
DPB Z,PPIT(I)
ADD P,0
POSITION(<PPOS(I)>)
ZERO2
MMMT: SOJG I,MTP
DPB P,PPIT
POSITION(PPOS)
PRINT2(P)
PMT: LDB P,MPIT
LDB I,PPIT
SUB P,I
POSITION(INPUT+2)
MOVEI I,1
JUMPL P,UWIN
JUMPE P,NOWIN
IWIN: OUTSTR [ASCIZ/MATTER OVER MIND .../]
POSITION(SCORP+1)
ADDB I,MSCR
JRST SHOWIN
UWIN: OUTSTR [ASCIZ/THAT'S ANOTHER ONE I OWE YOU/]
POSITION(SCORP+0)
ADDB I,PSCR
JRST SHOWIN
NOWIN: OUTSTR [ASCIZ/A TIE/]
POSITION(SCORP+2)
ADDB I,TSCR
SHOWIN: PRINT2(I)
TLNE S,CHAMPION
JRST ASKMOR
MOVN P,P
ADDI P,1
ASH P,-1
JUMPE P,ASKMOR
ADDB P,EQ
TLNN S,TECHNICAL
JRST ASKMOR
POSITION(TECHP+1)
PRINT(P)
ASKMOR: CLRBFI
POSITION(INPUT+1)
OUTSTR [ASCIZ'MORE (Y/N) ? ']
INCHWL C
CLRBFI
CAIE C,"Y"
EXIT
CLEARLINE(INPUT+1)
JRST NEWGM
SETBRD: MOVE P,CNTRS
MOVEI I,6
SETP: DPB P,PPIT(I)
POSITION(<PPOS(I)>)
OUTCHR [" "]
OUTCHR DIGIT(P)
SOJG I,SETP
DPB Z,PPIT
POSITION(PPOS)
ZERO2
MOVEI I,6
SETM: DPB P,MPIT(I)
POSITION(<MPOS(I)>)
OUTCHR [" "]
OUTCHR DIGIT(P)
SOJG I,SETM
DPB Z,MPIT
POSITION(MPOS)
ZERO2
CLEARM MOVE
CLEARM SCORE
MOVE R,MVLBASE
CALL RECORD
RETURN
RECORD: PUSH R,SCORE
PUSH R,KALAHS
PUSH R,PPITS
PUSH R,MPITS
AOS MOVE
RETURN
RESTOR: JUMPLE PR,.+4
SUB R,[4,,4]
SOSLE MOVE
SOJG PR,RESTORE
MOVE MPITS,0(R)
MOVE PPITS,-1(R)
MOVE KALAHS,-2(R)
MOVE I,-3(R)
MOVEM I,SCORE
MOVEI I,6
RSTRP: POSITION(<PPOS(I)>)
LDB 0,PPIT(I)
PRINT2(0)
SOJGE I,RSTRP
MOVEI I,6
RSTRM: POSITION(<MPOS(I)>)
LDB 0,MPIT(I)
PRINT2(0)
SOJGE I,RSTRM
TLNN S,TECHNICAL
RETURN
POSITION(TECHP+2)
CLEARNUMBER
POSITION(TECHP+3)
PRINT(SCORE)
POSITION(TECHP+4)
CLEARNUMBER
POSITION(TECHP+5)
CLEARNUMBER
RETURN
PLAY: MOVE I,C
SUBI I,"0"
LDB P,PPIT(I)
JUMPE P,MTPIT
DPB Z,PPIT(I)
POSITION(<PPOS(I)>)
ZERO2
ULOOP: SOSGE I
MOVEI I,12
LDB 0,PPIT(I)
CAILE P,1
JRST UDPST
JUMPG 0,UDPST
CAIL I,7
JRST UDPST
JUMPE I,UDPST
LDB 0,PPITC(I)
JUMPE 0,UDPST
DPB Z,PPITC(I)
POSITION(<PPOSC(I)>)
ZERO2
UDPST: ADDI 0,1
DPB 0,PPIT(I)
POSITION(<PPOS(I)>)
PRINT2(0)
SOJG P,ULOOP
SKIPE I
JRST REPLY
JUMPE PPITS,EMPTY
JRST NEWCMD
MTPIT: ERROR <PIT IS EMPTY>
MOVEFIRST:MOVE 1,MOVE
CAIN 1,1
JRST REPLY
ERROR < YOUR MOVE !!>
SWITCH: EXCH MPITS,PPITS
LDB 0,MPIT
LDB 1,PPIT
DPB 1,MPIT
DPB 0,PPIT
CALL RECORD
CLEAR PR,
CALL RESTORE
JRST REPLY
REPLY: JUMPE MPITS,EMPTY
CLEARM MOVES
SETAM NEG,MAX
SETCAM NEG,MIN
SETAM NEG,ALPHA
SETCAM NEG,BETA
TLNE S,UPDATE
CALL INT.ON
MOVEM R,MVLSV
CALL MAXIMIZE
TLNE S,UPDATE
CALL INT.OFF
MOVEM 1,SCORE
TLNE S,PDISPLAY
CALL PDLSZ
INEXT: POP R,I
LDB P,MPIT(I)
DPB Z,MPIT(I)
POSITION(<MPOS(I)>)
ZERO2
ILOOP: SOSGE I
MOVEI I,12
LDB 0,MPIT(I)
CAILE P,1
JRST IDPST
JUMPG 0,IDPST
CAIL I,7
JRST IDPST
JUMPE I,IDPST
LDB 0,MPITC(I)
JUMPE 0,IDPST
DPB Z,MPITC(I)
POSITION(<MPOSC(I)>)
ZERO2
IDPST: ADDI 0,1
DPB 0,MPIT(I)
POSITION(<MPOS(I)>)
PRINT2(0)
SOJG P,ILOOP
CAME R,MVLSV
JRST INEXT
TLNE S,TECHNICAL
CALL INFO
SKIPN I
JUMPE MPITS,EMPTY
JUMPE PPITS,EMPTY
CALL RECORD
JRST NEWCMD
MAXIMIZE:PUSH M,KALAHS
PUSH M,PPITS
PUSH M,MPITS
PUSH M,ALPHA
MOVEI I,1
MXLOOP: HRLM I,-4(M)
LDB P,MPIT(I)
JUMPE P,MXNEXT
DISTRIBUTE(MPIT,I)
AOS MOVES
JUMPE I,MXNXT
JUMPE PPITS,MXTRM
SOJLE CNT,MXCUT
CALL PMOVE
AOJA CNT,MXDONE
MXCUT: CALL VALUE
AOJA CNT,MXDONE
MXNXT: JUMPE MPITS,MXTRM
CALL MAXIMIZE
CAMG 1,ALPHA
JRST MXNEXT
JRST MXRCD
MXTRM: CALL VALUE
MXDONE: CAMG 1,ALPHA
JRST MXNEXT
MOVE R,MVLSV
MXRCD: HLRZ I,-4(M)
PUSH R,I
MOVEM 1,ALPHA
MXNEXT: HLRZ I,-4(M)
CAIL I,6
JRST .+5
MOVE MPITS,-1(M)
MOVE PPITS,-2(M)
MOVE KALAHS,-3(M)
AOJA I,MXLOOP
MOVE 1,ALPHA
POP M,ALPHA
POP M,MPITS
POP M,PPITS
POP M,KALAHS
RETURN
MMOVE: PUSH M,KALAHS
PUSH M,PPITS
PUSH M,MPITS
PUSH M,ALPHA
SETAM NEG,ALPHA
MOVEI I,1
MLOOP: HRLM I,-4(M)
LDB P,MPIT(I)
JUMPE P,MNEXT
DPB Z,MPIT(I)
DISTRIBUTE(MPIT,I)
AOS MOVES
JUMPG I,PNXT
JUMPE MPITS,MTRM
CALL MMOVE
JRST MDONE
PNXT: JUMPE PPITS,MTRM
SOJLE CNT,MCUT
CALL PMOVE
AOJA CNT,MDONE
MCUT: CALL VALUE
AOJA CNT,MDONE
MTRM: CALL VALUE
MDONE: CAMLE 1,BETA
JRST MEXIT
CAMLE 1,ALPHA
MOVEM 1,ALPHA
MNEXT: HLRZ I,-4(M)
CAIL I,6
JRST .+5
MOVE MPITS,-1(M)
MOVE PPITS,-2(M)
MOVE KALAHS,-3(M)
AOJA I,MLOOP
MOVE 1,ALPHA
MEXIT: POP M,ALPHA
POP M,MPITS
POP M,PPITS
POP M,KALAHS
RETURN
PMOVE: PUSH M,KALAHS
PUSH M,PPITS
PUSH M,MPITS
PUSH M,BETA
SETCAM NEG,BETA
MOVEI I,1
PLOOP: HRLM I,-4(M)
LDB P,PPIT(I)
JUMPE P,PNEXT
DISTRIBUTE(PPIT,I)
AOS MOVES
JUMPG I,MNXT
JUMPE PPITS,PTRM
CALL PMOVE
JRST PDONE
MNXT: JUMPE MPITS,PTRM
SOJLE CNT,PCUT
CALL MMOVE
AOJA CNT,PDONE
PCUT: CALL VALUE
AOJA CNT,PDONE
JRST PDONE
PTRM: CALL VALUE
PDONE: CAMGE 1,ALPHA
JRST PEXIT
CAMGE 1,BETA
MOVEM 1,BETA
PNEXT: HLRZ I,-4(M)
CAIL I,6
JRST .+5
MOVE MPITS,-1(M)
MOVE PPITS,-2(M)
MOVE KALAHS,-3(M)
AOJA I,PLOOP
MOVE 1,BETA
PEXIT: POP M,BETA
POP M,MPITS
POP M,PPITS
POP M,KALAHS
RETURN
VALUE: LDB 1,MPIT
LDB 0,PPIT
SUB 1,0
JUMPN PPITS,.+5
MOVEI PR,6
LDB 0,MPIT(3)
ADD 1,0
SOJG PR,.-2
JUMPN MPITS,.+5
MOVEI PR,6
LDB 0,PPIT(3)
SUB 1,0
SOJG PR,.-2
CAMLE 1,MAX
MOVEM 1,MAX
CAMGE 1,MIN
MOVEM 1,MIN
TLNE S,CHAMPION
RETURN
SUB 1,EQ
ADD 1,1
SKIPG 1
RETURN
SUBI 1,1
MOVN 1,1
RETURN
SETECH: TLOE S,TECHNICAL
JRST NEWCMD
POSITION(TECHH+0)
OUTSTR [ASCIZ/SEARCH DEPTH LIMIT/]
POSITION(TECHP+0)
PRINT(CNT)
POSITION(TECHH+1)
OUTSTR [ASCIZ/EQUALIZER/]
POSITION(TECHP+1)
TLNN S,CHAMPION
JRST STEQ
OUTSTR [ASCIZ/ *KILL*/]
JRST STMI
STEQ: PRINT(EQ)
STMI: POSITION(TECHH+2)
OUTSTR [ASCIZ/MOVES INVESTIGATED/]
POSITION(TECHH+3)
OUTSTR [ASCIZ/SCORE OF MOVE/]
POSITION(TECHH+4)
OUTSTR [ASCIZ/MAXIMUM/]
POSITION(TECHH+5)
OUTSTR [ASCIZ/MINIMUM/]
JRST NEWCMD
NOTECH: TLZN S,TECHNICAL
JRST NEWCMD
TLNE S,TT
JRST NEWCMD
MOVEI P,5
NTLP: POSITION(<TECHH(P)>)
OUTSTR [ASCIZ/ /]
SOJGE P,NTLP
JRST NEWCMD
DSPDL: TLOE S,PDISPLAY
JRST NEWCMD
POSITION(TECHH+6)
OUTSTR [ASCIZ/PUSHDOWN LIST SIZE/]
CALL PDLSZ
JRST NEWCMD
NDSPDL: TLZN S,PDISPLAY
JRST NEWCMD
TLNE S,TT
JRST NEWCMD
POSITION(TECHH+6)
OUTSTR [ASCIZ/ /]
JRST NEWCMD
SETUPD: TLO S,UPDATE
JRST NEWCMD
NOUPD: TLZ S,UPDATE
JRST NEWCMD
INFO: POSITION(TECHP+2)
PRINT(MOVES)
POSITION(TECHP+3)
MOVE 1,SCORE
TLNE S,CHAMPION
JRST .+7
TRNN 1,1
JRST .+3
MOVN 1,1
ADDI 1,1
ASH 1,-1
ADD 1,EQ
PRINT(1)
POSITION(TECHP+4)
PRINT(MAX)
POSITION(TECHP+5)
PRINT(MIN)
RETURN
PDLSZ: POSITION(TECHP+6)
MOVE 1,PDLSIZ
SKIPE PDL(1)
AOJA 1,.-1
SKIPE PDL+1(1)
AOJA 1,.-2
SKIPE PDL+2(1)
AOJA 1,.-2
CAMN 1,PDLSIZ
RETURN
MOVEM 1,PDLSIZ
PRINT(1)
RETURN
SETLIM: INCHWL C
GETNUMBER
CAMN PR,CNT
JRST NEWCMD+1
MOVEM PR,CNT
TLNN S,TECHNICAL
JRST NEWCMD+1
TLNE S,TT
JRST NEWCMD+1
POSITION(TECHP+0)
PRINT(CNT)
JRST NEWCMD+1
SETEQ: INCHWL C
GETNUMBER
CAMN PR,EQ
JRST NEWCMD+1
MOVEM PR,EQ
TLNE S,CHAMPION
JRST NEWCMD+1
TLNN S,TECHNICAL
JRST NEWCMD+1
TLNE S,TT
JRST NEWCMD+1
POSITION(TECHP+1)
PRINT(EQ)
JRST NEWCMD+1
KILL: TLOE S,CHAMPION
JRST NEWCMD
TLNN S,TECHNICAL
JRST NEWCMD
TLNE S,TT
JRST NEWCMD
POSITION(TECHP+1)
OUTSTR [ASCIZ/ *KILL*/]
JRST NEWCMD
NOKILL: TLZN S,CHAMPION
JRST NEWCMD
TLNN S,TECHNICAL
JRST NEWCMD
TLNE S,TT
JRST NEWCMD
POSITION(TECHP+1)
PRINT(EQ)
JRST NEWCMD
BACKUP: INCHWL C
MOVEI PR,1
CAIL C,"0"
CAILE C,"9"
JRST BACK1
GETNUMBER
BACK1: JUMPLE PR,BBAD
CAML PR,MOVE
JRST BBAD
CALL RESTORE
JRST NEWCMD+1
BBAD: ERROR <INVALID BACKUP>
RESTART:INCHWL C
CAIL C,"0"
CAILE C,"9"
JRST RSAME
GETNUMBER
JUMPLE PR,RBAD
CAILE PR,8
JRST RBAD
MOVEM PR,CNTRS
RSAME: CALL SETBRD
JRST NEWCMD+1
RBAD: ERROR <INVALID RESTART>
COMMENT/ CURSOR CONTROL ROUTINES /
$POSIT: TLNN S,VT50
JRST VT05T
OUTSTR [BYTE (7)ESC,"H",127,127,0]
TRNN PR,^O777770
JRST .+5
IONEOU [TAB]
SUBI PR,8
TRNE PR,^O777770
JRST .-3
TRNN PR,^O777777
JRST .+3
OUTSTR [BYTE (7)ESC,"C",0]
SOJA PR,.-3
HLRZ PR,PR
JUMPE PR,.+3
IONEOU [LF]
SOJG PR,.-1
RETURN
VT05T: TLNN S,VT05
JRST VT52T
ADD PR,[XWD 32,32]
IONEOU [14]
MOVS PR,PR
IONEOU PR
CALL FILL0
HLRZ PR,PR
IONEOU PR
CALL FILL0
RETURN
VT52T: TLNN S,VT52
JRST HZTST
ADD PR,[XWD 32,32]
IONEOU [ESC]
IONEOU ["Y"]
MOVS PR,PR
IONEOU PR
HLRZ PR,PR
IONEOU PR
RETURN
HZTST: TLNN S,HZ
JRST DPTST
IONEOU [126]
IONEOU [17]
ADDI PR,64
IONEOU PR
HLRZ PR,PR
CAIG PR,32
ADDI PR,96
IONEOU PR
RETURN
DPTST: TLNN S,DP
RETURN
OUTSTR [BYTE (7)29,127,127,127,0]
TRNN PR,^O777777
JRST .+3
IONEOU [24]
SOJA PR,.-3
HLRZ PR,PR
JUMPE PR,.+3
IONEOU [27]
SOJG PR,.-1
OUTSTR [BYTE (7)127,127,127,0]
RETURN
$CLEAR: TLNE S,VT50!VT52
OUTSTR [BYTE (7)ESC,"H",ESC,"J",0]
TLNE S,VT05
OUTSTR [BYTE (7)29,127,127,127,31,127,127,127,0]
TLNE S,HZ
OUTSTR [BYTE (7)126,28,127,127,126,31,0]
TLNE S,DP
OUTSTR [BYTE (7)29,127,127,127,31,127,127,127,0]
RETURN
$DELET: TLNE S,VT50!VT52
OUTSTR [BYTE (7)ESC,"K",0]
TLNE S,VT05
OUTSTR [BYTE (7)30,127,127,127,0]
TLNE S,HZ
OUTSTR [BYTE (7)126,19,126,26,0]
TLNE S,DP
OUTSTR [BYTE (7)30,127,127,127,0]
RETURN
FILL0: IONEOU [0]
IONEOU [0]
IONEOU [0]
IONEOU [0]
RETURN
COMMENT/ NUMBER ROUTINES & USER ERROR HANDLER/
$NUMBE: MOVM 0,PR
CAML PR,[-999999]
CAMLE PR,[9999999]
JRST ZAPNUM
MOVEI I,1
IDIVI 0,10
PUSH M,DIGIT(1)
SKIPE 0
AOJA I,.-3
JUMPGE PR,.+4
PUSH M,["-"]
AOSA I
PUSH M,[" "]
CAIGE I,7
AOJA I,.-2
POP M,1
OUTCHR 1
SOJG I,.-2
RETURN
ZAPNUM: OUTSTR [ASCIZ/**ZAP**/]
RETURN
$GETNU: CAIN C,"-"
JRST GETNEG
CALL GETMAG
RETURN
GETNEG: INCHWL C
CALL GETMAG
MOVN PR,PR
RETURN
GETMAG: CAIL C,"0"
CAILE C,"9"
JRST INVNUM
SUBI C,"0"
MOVE PR,C
GETDGT: INCHWL C
CAIL C,"0"
CAILE C,"9"
RETURN
SUBI C,"0"
JOV .+1
IMULI PR,10
JOV TOOBIG
ADD PR,C
JRST GETDGT
INVNUM: ERROR <INVALID NUMBER GIVEN>
TOOBIG: ERROR <NUMBER TOO LARGE>
$ERROR: POSITION(INPUT+1)
OUTSTR @0(M)
CLRBFI
MOVE M,PDLBASE
JRST NEWMV
CTLC: XWD 4,.+4
XWD 0,2
Z
Z
PUSH M,CTLC+2
TLON S,INTERRUPT
JRST ALLOWD
CLRBFI
EXIT 1,
CLEARM CTLC+2
POPJ M,
ALLOWD: CLEARM CTLC+2
TLNN S,TECHNICAL
POPJ M,
PUSH M,3
POSITION(TECHP+2)
PRINT(MOVES)
TLOE S,FIRSTC
JRST .+7
POSITION(INPUT+2)
OUTSTR [BYTE (14)" "(7)13(14)" "(7)0]
POSITION(TECHR+2,57)
SKIPA
OUTSTR [ASCIZ/ /]
POP M,3
TLZ S,INTERRUPT
POPJ M,
INT.ON: POSITION(INPUT+2)
MOVEI 0,CTLC
MOVEM 0,.JBINT##
RETURN
INT.OFF:CLEARM .JBINT
TLZ S,FIRSTC
CLEAR C,
RETURN
PPIT: POINT 7,KALAHS,9
POINT 6,PPITS,5
POINT 6,PPITS,11
POINT 6,PPITS,17
POINT 6,PPITS,23
POINT 6,PPITS,29
POINT 6,PPITS,35
POINT 6,MPITS,5
POINT 6,MPITS,11
POINT 6,MPITS,17
POINT 6,MPITS,23
PPITC: POINT 6,MPITS,29
POINT 6,MPITS,35
POINT 6,MPITS,29
POINT 6,MPITS,23
POINT 6,MPITS,17
POINT 6,MPITS,11
POINT 6,MPITS,5
MPIT: POINT 7,KALAHS,16
POINT 6,MPITS,5
POINT 6,MPITS,11
POINT 6,MPITS,17
POINT 6,MPITS,23
POINT 6,MPITS,29
POINT 6,MPITS,35
POINT 6,PPITS,5
POINT 6,PPITS,11
POINT 6,PPITS,17
POINT 6,PPITS,23
MPITC: POINT 6,PPITS,29
POINT 6,PPITS,35
POINT 6,PPITS,29
POINT 6,PPITS,23
POINT 6,PPITS,17
POINT 6,PPITS,11
POINT 6,PPITS,5
PIT: POINT 3,KALAHS,2
SCORH: XY(SCORR+0,8)
XY(SCORR+1,6)
SCORP: XY(SCORR+2,7)
XY(SCORR+2,12)
XY(SCORR+2,17)
PPOS: XY(BORDC,48)
XY(BORDC+BORDS,45)
XY(BORDC+BORDS,42)
XY(BORDC+BORDS,39)
XY(BORDC+BORDS,36)
XY(BORDC+BORDS,33)
XY(BORDC+BORDS,30)
XY(BORDC-BORDS,30)
XY(BORDC-BORDS,33)
XY(BORDC-BORDS,36)
XY(BORDC-BORDS,39)
PPOSC: XY(BORDC-BORDS,42)
XY(BORDC-BORDS,45)
XY(BORDC-BORDS,42)
XY(BORDC-BORDS,39)
XY(BORDC-BORDS,36)
XY(BORDC-BORDS,33)
XY(BORDC-BORDS,30)
MPOS: XY(BORDC,27)
XY(BORDC-BORDS,30)
XY(BORDC-BORDS,33)
XY(BORDC-BORDS,36)
XY(BORDC-BORDS,39)
XY(BORDC-BORDS,42)
XY(BORDC-BORDS,45)
XY(BORDC+BORDS,45)
XY(BORDC+BORDS,42)
XY(BORDC+BORDS,39)
XY(BORDC+BORDS,36)
MPOSC: XY(BORDC+BORDS,33)
XY(BORDC+BORDS,30)
XY(BORDC+BORDS,33)
XY(BORDC+BORDS,36)
XY(BORDC+BORDS,39)
XY(BORDC+BORDS,42)
XY(BORDC+BORDS,45)
TECHH: XY(TECHR+0,00)
XY(TECHR+1,00)
XY(TECHR+2,00)
XY(TECHR+0,30)
XY(TECHR+1,30)
XY(TECHR+2,30)
XY(TECHR+3,15)
TECHP: XY(TECHR+0,20)
XY(TECHR+1,20)
XY(TECHR+2,20)
XY(TECHR+0,50)
XY(TECHR+1,50)
XY(TECHR+2,50)
XY(TECHR+3,35)
INPUT: XY(INPTR+0,0)
XY(INPTR+1,0)
XY(INPTR+1,30)
MIN: EXP 9999999
MAX: EXP -9999999
SCORE: EXP 0
EQ: EXP 0
MOVES: EXP 0
MSCR: EXP 0
PSCR: EXP 0
TSCR: EXP 0
MOVE: EXP 0
CNTRS: EXP 6
PDLSIZ: EXP 0
MVLSV: EXP 0
DPPOS: EXP 0
DPX: EXP 0
DPY: EXP 0
MOVNUM: ASCIZ/ * /
DIGIT: EXP "0","1","2","3","4","5","6","7","8","9"
LIT
MVLBASE:IOWD 512,MVL
PDLBASE:IOWD 512,PDL
START: MOVE 1,[ EXIT ]
MOVEM 1,START
MOVE M,PDLBASE
MOVE R,MVLBASE
MOVSI NEG,1B18
MOVEI CNT,6
CLEAR S,
GETTY: OUTSTR [ASCIZ/WHICH TERMINAL TYPE (VT05,VT50,VT52,HZ,DP,TT) ? /]
MOVE 1,[POINT 7,0]
CLEAR 0,
INCHWL C
CAIN C,CR
JRST .+4
IDPB C,1
TRNN 1,^O777777
JRST .-5
INCHWL C
CAIE C,LF
JRST .-2
CAMN 0,[ASCII/VT50/]
TLO S,VT50
CAMN 0,[ASCII/VT05/]
TLO S,VT05
CAMN 0,[ASCII/VT52/]
TLO S,VT52
CAMN 0,[ASCII/HZ/]
TLO S,HZ
CAMN 0,[ASCII/DP/]
TLO S,DP
CAMN 0,[ASCII/TT/]
TLO S,TT
TLNN S,^O777777
JRST GETTY
TLNE S,TT
EXIT
PJOB 1,
TRMNO. 1,
EXIT 1,
MOVEM 1,SETCR+1
MOVE 1,[XWD 3,SETCR]
TRMOP. 1,
EXIT 1,
CLEARSCREEN
POSITION(SCORH+0)
OUTSTR [ASCIZ/S C O R E/]
POSITION(SCORH+1)
OUTSTR [ASCIZ/YOU ME TIED/]
JRST NEWGM
SETCR: EXP ^O2010,-1,1
LIT
RELOC START+1
MVL: BLOCK 512
PDL: BLOCK 512
RELOC
END START