Trailing-Edge
-
PDP-10 Archives
-
SRI_NIC_PERM_SRC_3_19910112
-
utilities/chess2.mid
There are no other files named chess2.mid in the archive.
.SYMTAB 5000.
TITLE CHESS2
; (A LIST OF COMMANDS IS ON PAGE 2)
IFNDEF GAMEL, GAMEL==300.
IFNDEF PDLL, PDLL==3500.
IRP AC,,[A,B,C,D,E,F,S,T,I,P,Q,R,V]
AC=.IRPCNT+1 ? TERMIN ; AC'S
CHOUT=1_33 ? STOUT=2_33 ? TYI=3_33 ; UUO'S
.DECSAV
LOC 41
JSR UUOH
LOC 120
BOARD: BLOCK 170
PIECEL: BLOCK 40
PIECE: BLOCK 40
PPIECL: IRP A,,[137,136,133,142,135,140,134,141]
BOARD+A ? TERMIN
REPEAT 8,BOARD+130-.RPCNT
IRP A,,[31,30,25,34,27,32,26,33]
BOARD+A ? TERMIN
REPEAT 8,BOARD+46-.RPCNT
PPIECE: 5 ? 4 ? 3 ? 3 ? 2 ? 2 ? 1 ? 1
PLYN: 0
WPCS: 0
BPCS: 0
FLAGS: 0
PCHTAB: "P ? "N ? "B ? "R ? "Q ? "K
TOTTIM: BLOCK 2
PDL: BLOCK 110.
INTSER: MOVEM INTAC0
MOVSI (JUMP I,)
HLLM PJUMP
MOVSI (POPJ P,)
MOVEM NEXTMV
MOVE INTAC0
DEBRK%
INTAC0: BLOCK 1
INTPC: BLOCK 1
LEVTAB: INTPC ? 0 ? 0
CHNTAB: BLOCK 1
1,,INTSER
REPEAT 36.-<.-CHNTAB>,0
BDCLR: SETZM TOTTIM ? SETZM TOTTIM+1
SETZM VALUE'
MOVEI A,6003
MOVSI B,WOO+WOOO+BOO+BOOO
MOVEM B,FLAGS
BDI1: SETOM BOARD(B)
SETOM BOARD+9(B)
HRLI B,-8
BDI2: SETOM BOARD+1(B)
TRNN A,1
SETZM BOARD+1(B)
AOBJN B,BDI2
ADDI B,2
LSH A,-1
JUMPG A,BDI1
SETZB I,PLYN
MOVSI A,-8
SETZM PIECE+10(A)
SETZM PIECE+30(A)
AOBJN A,.-2
MOVE [PPIECE,,PIECE]
BLT PIECE+7
MOVE [PPIECE,,PIECE+20]
BLT PIECE+27
MOVE [PPIECL,,PIECEL]
BLT PIECEL+37
MOVE T,[-PDLL,,SPDL-1]
JRST SVDTIM
BDINIT: MOVEI 4025. ? MOVEM WPCS ? MOVEM BPCS
MOVEI 20 ? HRRM PLAUS
SETZM NACTIV
PUSHJ P,BDCLR
MOVSI A,-40
BDINI2: MOVEI B,PIECE(A)
MOVEM B,@PIECEL(A)
AOBJN A,BDINI2
CPOPJ: POPJ P,
BPRINT: STOUT CR
MOVSI -8
MOVEI A,
BP1: HRLI A,-8
BP2: SKIPL D,BOARD+25(A)
JRST BP3
STOUT [ASCIZ /XX/]
JRST BP9
BP3: JUMPE D,BP4
CAIGE D,PIECE+20
CHOUT "W
CAIL D,PIECE+20
CHOUT "B
MOVE D,(D)
CHOUT @PCHTAB(D)
JRST BP9
BP4: MOVE D,
XOR D,A
ANDI D,1
STOUT BPT1(D)
BP9: AOBJP A,BP91
CHOUT " ; SPACE
JRST BP2
BP91: STOUT CR
ADDI A,2
AOBJN BP1
POPJ P,
BPT1: ASCIZ /--/ ? ASCIZ /**/
MPRINT: MOVE A,PLYN
LSH A,-1
AOS A
STOUT [ASCIZ / /]
CAIG A,9
CHOUT "
PUSHJ P,DPT
STOUT (I)[ASCIZ / W / ? ASCIZ / B /]
LDB A,[ORIGIN]
PUSHJ P,SQOUT
TRNE 740000
CHOUT "*
TRNN 740000
CHOUT "-
LDB A,[DESTIN]
PUSHJ P,SQOUT
JUMPG 2SP
CHOUT "=
LDB A,[PROMOT]
CHOUT @PCHTAB+1(A)
2SP: STOUT [ASCIZ / /]
POPJ P,
SQOUT: IDIVI A,12
MOVNS A
CHOUT "A-1(B)
CHOUT "8+2(A)
POPJ P,
MPT1: "W ? "B
HUUOAC: BLOCK 20
BSAV=HUUOAC+B
UUOH: 0
MOVEM B,BSAV
LDB B,[331100,,40]
CAIG B,TYI_-33
JRST @UUODSP(B)
CAIL B,NUUOS
UUOLUZ: HALTF%
MOVEM HUUOAC ; SAVE AC'S FOR CONSOLE PGM UUO'S
MOVE [1,,HUUOAC+1]
MOVE B,BSAV
BLT HUUOAC+17
MOVE HUUOAC
LDB B,[331100,,40]
MOVEI B,@UUODSP(B)
HRRM B,.+2
MOVE B,BSAV
PUSHJ P,
MOVSI 17,HUUOAC
BLT 17,17
JRST UUORET
UUODSP: UUOLUZ
.CHOUT ? .STOUT ? .TYI
NUUOS==.-UUODSP
.CHOUT: JSR TTYOUT ? 40
MOVE B,40
JSR LINELH
UUORET: MOVE B,BSAV
JRST 2,@UUOH
.STOUT: MOVEI B,440700
HRLM B,40
.SOUT2: ILDB B,40
JUMPE B,UUORET
JSR TTYOUT ? B
JSR LINELH
JRST .SOUT2
.TYI: MOVEI B,B
CAIE B,@40 ? JRST .+3
MOVEI B,BSAV
HRRM B,40
.RDTTY: EXCH A,B
PBIN%
CAIN A,177
PUSHJ P,[HRROI A,[ASCIZ/XXX? /]
PSOUT%
MOVEI A,177
POPJ P,]
EXCH A,B
CAIL B,140 ? CAIL B,173 ? CAIA ? SUBI B,40
MOVEM B,@40
JRST UUORET
LINELH: 0
ANDI B,177
CAIE B,11 ? CAIE B,12 ? AOS LINPOS
CAIN B,15 ? SETZM LINPOS
MOVE B,LINPOS
CAMGE B,LINEL ? JRST 2,@LINELH
JSR TTYOUT ? [^M]
JSR TTYOUT ? [^J]
SETZM LINPOS
JRST 2,@LINELH
LINPOS: 0
LINEL: 80.
TTYOUT: 0
HRL B,@TTYOUT
JRA B,.+1
ANDI B,177
CAIE B,^I ? JRST TTYO1
MOVE B,LINPOS
ADDI B,8.
TRZ B,7
MOVEM B,LINPOS
MOVEI B,^I
TTYO1: EXCH A,B
PBOUT%
EXCH A,B
TTYO2: AOS TTYOUT
JRST @TTYOUT
CAPTUR=160400,,
ORIGIN=700,,
DESTIN=70700,,
PROMOT=410200,,
WOO==2000 ? WOOO==1000 ? BOO==400 ? BOOO==200
VALTAB: 100. ? 325. ? 350. ? 500. ? 875. ? 0
VALTB2: 225. ? 250. ? 400. ? 775. ; VALUE OF PROMOTING TO N, B, R, OR Q
MMOVE: LDB A,[CAPTUR]
JUMPE A,NOCAP
MOVE B,@(I)[LMGT15+20(A) ? LMGT15(A)]
TDNE B,FLAGS
IOR B
MOVSI B,400000
IORB B,@MMVT1(I)
SETZM (B)
MOVE A,@MMVT10(I)
MOVN A,VALTAB(A)
ADDM A,@MMVT9(I)
NOCAP: XORM FLAGS
LDB B,[ORIGIN]
MOVEI A,
EXCH A,BOARD(B)
LDB C,[DESTIN]
MOVEI B,BOARD(C)
MOVEM B,PIECEL-PIECE(A)
MOVEM A,BOARD(C)
JUMPG MVCAS
LDB C,[PROMOT]
ADDI C,1
MOVEM C,(A)
MOVE C,VALTB2-1(C)
ADDM C,WPCS(I)
JRST MMV9
MVCAS: TDNE MMVT3(I)
JRST MVCAS1
MMV9: AOS A,PLYN
XORI I,1
MOVEM GAME-1(A)
CAIGE A,GAMEL
JRST (V)
JRST 4,. ; TOO MANY MOVES MADE IN GAME
MVCAS1: HRRZ A,
MOVEI C,(I)
CAMN A,MMVT4(I)
JRST MVCAS2
CAME A,MMVT5(I)
JRST MMV9
IORI C,2
MVCAS2: MOVEI A,
EXCH A,@MMVT6(C)
MOVEI B,@MMVT7(C)
MOVEM A,(B)
MOVEM B,@MMVT8(C)
JRST MMV9
MMVT1: PIECEL+20(A) ? PIECEL(A)
MMVT3: WOO+WOOO,,0 ? BOO+BOOO,,0
MMVT4: 141_7+137 ? 33_7+31
MMVT5: 135_7+137 ? 27_7+31
MMVT6: BOARD+142 ? BOARD+34 ? BOARD+133 ? BOARD+25
MMVT7: BOARD+140 ? BOARD+32 ? BOARD+136 ? BOARD+30
MMVT8: PIECEL+3 ? PIECEL+23 ? PIECEL+2 ? PIECEL+22
MMVT9: BPCS ? WPCS
MMVT10: PIECE+20(A) ? PIECE(A)
MMVT11: IRP A,,[WOO,BOO]
A+A!O+177 ? 177 ? A!O+177 ? A+177 ? REPEAT 14,177
TERMIN
UNMOVE: XORI I,1
SOS A,PLYN
MOVE GAME(A)
XORM FLAGS
JUMPG UNCAS
LDB A,[DESTIN]
MOVEI C,0
EXCH C,@BOARD(A)
MOVN C,VALTB2-1(C)
ADDM C,WPCS(I)
JRST UNM2
UNCAS: TDNE MMVT3(I)
JRST UNCAS1
UNM2: LDB C,[DESTIN]
MOVEI A,
EXCH A,BOARD(C)
LDB B,[ORIGIN]
MOVEM A,BOARD(B)
ADDI B,BOARD
MOVEM B,PIECEL-PIECE(A)
LDB A,[CAPTUR]
JUMPE A,(V)
MOVSI B,(JSP S,)
MOVEI C,@MMVT10(I)
MOVE B,(C)
MOVE A,VALTAB(B)
ADDM A,@MMVT9(I)
HRRZS B,PIECEL-PIECE(C)
MOVEM C,(B)
JRST (V)
UNCAS1: HRRZ A,0
MOVE C,I
CAMN A,MMVT4(I)
JRST UNCAS2
CAME A,MMVT5(I)
JRST UNM2
ADDI C,2
UNCAS2: MOVEI A,
EXCH A,@MMVT7(C)
MOVEI B,@MMVT6(C)
MOVEM A,(B)
MOVEM B,@MMVT8(C)
JRST UNM2
STAB: 1 ? 13 ? 12 ? 11 ? -1 ? -13 ? -12 ? -11
STAB1: 1(E) ? 13(E) ? 12(E) ? 11(E) ? ,-1(E) ? ,-13(E) ? ,-12(E) ? ,-11(E)
NTAB: 14(E) ? 25(E) ? 23(E) ? 10(E) ? ,-14(E) ? ,-25(E) ? ,-23(E) ? ,-10(E)
INCHK: MOVE E,@ICHT1(A)
INCHK1: AOS ICH'
PUSH P,V
SKIPLE D,@ICHT2(A)
XCT ICHT3(A)
JRST ICH1
SKIPN (D)
JRST CPOPJ1
ICH1: SKIPLE D,@ICHT2A(A)
XCT ICHT3(A)
JRST ICH2
SKIPN (D)
JRST CPOPJ1
ICH2: MOVE C,[CSLUP,,13]
BLT C,22
MOVSI C,-10
JRST SLUP
CSLUP: OFFSET 13-.
SLUP: MOVEI B,(E)
SLUP1: ADD B,STAB(C)
SKIPGE D,(B)
JRST NLUP
JUMPE D,SLUP1
XCT ICHT3(A)
JRST NLUP
JRST SLUP2
OFFSET 0
SLUP2: MOVE D,(D)
CAIE D,4
XCT ICHT4(C)
JRST CPOPJ1
CAIN D,5
CAIE B,@STAB1(C)
JRST NLUP
CPOPJ1: AOS (P)
POPJ P,
NLUP: SKIPLE D,@NTAB(C)
XCT ICHT3(A)
JRST ICH9
MOVE D,(D)
SOJE D,CPOPJ1
ICH9: AOBJN C,SLUP
POPJ P,
ICHT1: PIECEL ? PIECEL+20
ICHT2: ,-13(E) ? 11(E)
ICHT2A: ,-11(E) ? 13(E)
ICHT3: CAIGE D,PIECE+20 ? CAIL D,PIECE+20
ICHT4: REPEAT 4,CAIN D,3 ? CAIN D,2
LMG: MOVE FLAGS
MOVE F,LMG1
TDNN LMGT1(I)
JRST LMQCAS
SKIPN @LMGT2(I)
SKIPE @LMGT3(I)
JRST LMQCAS
MOVEI A,(I)
LMG1: JSP V,INCHK
TLCA F,(JFCL#<JSP V,>)
JRST LMLUP
MOVE E,LMGT2(I)
JSP V,INCHK1
SKIPA A,LMGT5(I)
JRST LMQCAS
AND A,FLAGS
HRR A,MMVT4(I)
PUSH T,A
PUSH T,[0]
LMQCAS: TDNN LMGT6(I)
JRST LMLUP
SKIPN @LMGT7(I)
SKIPE @LMGT8(I)
JRST LMLUP
SKIPE @LMGT8A(I)
JRST LMLUP
MOVEI A,(I)
XCT F ; SKIP IF IN CHECK
SKIPA E,LMGT7(I)
JRST LMLUP
JSP V,INCHK1
SKIPA A,LMGT5(I)
JRST LMLUP
AND A,FLAGS
HRR A,MMVT5(I)
PUSH T,A
PUSH T,[0]
LMLUP: MOVE F,LMGT12(I)
MOVEM P,PSAV'
MOVSI 177
AND FLAGS
MOVEM FLAGS2'
MOVE [LMCODE,,12]
BLT 21
JRST LMLUP1
LMCODE: OFFSET 12-.
LMLUP1: SKIPG A,PIECEL-PIECE(F)
JRST LMLUP9
MOVE B,(F)
MOVE FLAGS2'
JRST @LMGDSP(B)
LMLUP9: AOBJN F,LMLUP1
MOVE P,PSAV
POPJ P,
OFFSET 0
LMGDSP: LMPAWN ? LMKNT ? LMBISH ? LMROOK ? LMQUEN ? LMKING
LMGT1: WOO,, ? BOO,,
LMGT2: BOARD+140 ? BOARD+32
LMGT3: BOARD+141 ? BOARD+33
LMGT4: BOARD+137 ? BOARD+31
LMGT5: 3177,,0 ? 777,,0
LMGT6: WOOO,, ? BOOO,,
LMGT7: BOARD+136 ? BOARD+30
LMGT8: BOARD+135 ? BOARD+27
LMGT8A: BOARD+134 ? BOARD+26
LMGT12: -20,,PIECE ? -20,,PIECE+20
LMGT13: PIECE+23 ? PIECE+3
LMGT14: PIECE+22 ? PIECE+2
LMGT15: 0?0?WOOO,,?WOO,,?REPEAT 16,[0?]BOOO,,?BOO,,?REPEAT 14,0
LMGT16: IRP A,,[WOO,BOO]
A+A!O,, ? 0 ? A!O,, ? A,, ? REPEAT 14,0
TERMIN
SHFTAB: REPEAT 142-25+1,<25+.RPCNT>_7
SHFTB2: REPEAT 40,<.RPCNT&17>_16
DEFINE LMGENR
LMGNRL==.? HRRI -BOARD(A)
IOR SHFTAB-25-BOARD(C)
IOR SHFTB2-PIECE(B)
PUSH T,0
MOVE D,(B)
PUSH T,VALTAB(D)
LMGNRL==.-LMGNRL
TERMIN
DEFINE LMGNR2
HRRI -BOARD(A)
IOR SHFTAB-25-BOARD(C)
PUSH T,0
PUSH T,[0]
TERMIN
LMPAWN: SKIPLE B,@LMPT1(I)
XCT LMPT2(I)
JRST LMP2
MOVE C,PIECEL-PIECE(B)
XCT LMPT10(I)
JSP E,LMPGEN
LMGENR
LMP2: SKIPLE B,@LMPT3(I)
XCT LMPT2(I)
JRST LMP3
MOVE C,PIECEL-PIECE(B)
XCT LMPT10(I)
JSP E,LMPGEN
LMGENR
LMP3: MOVS B,0
CAIE A,@LMPT7(I)
CAIN A,@LMPT8(I)
JRST LMP4 ; EP
LMP3A: SKIPE @LMPT4(I)
JRST LMLUP9
MOVEI B,PIECE
MOVEI C,@LMPT4(I)
XCT LMPT10(I)
JSP E,LMPGEN
LMGNR2
JRST .+2 ? BLOCK 1
XCT LMPT5(I)
SKIPE @LMPT6(I)
JRST LMLUP9
TLC -BOARD(C)
MOVEI C,@LMPT6(I)
LMGNR2
JRST LMLUP9
LMP4: MOVEI C,BOARD(B)
MOVE B,@LMPT9(I)
LMGENR
JRST LMP3A
LMPGEN: TLO 400000
LMGENR
MOVEI D,325.-100.
ADDM D,(T)
TLO 100000
LMGENR
MOVEI D,350.-100.
ADDM D,(T)
TLC 300000
LMGENR
MOVEI D,500.-100.
ADDM D,(T)
TLO 100000
LMGENR
MOVEI D,875.-100.
ADDM D,(T)
TLZ 700000
JRST LMGNRL(E)
LMPT1: ,-13(A) ? 11(A)
LMPT2: CAIGE B,PIECE+20 ? CAIL B,PIECE+20
LMPT3: ,-11(A) ? 13(A)
LMPT4: ,-12(A) ? 12(A)
LMPT5: CAIL A,BOARD+121 ? CAIG A,BOARD+46
LMPT6: ,-24(A) ? 24(A)
LMPT7: BOARD+11(B) ? BOARD-13(B)
LMPT8: BOARD+13(B) ? BOARD-11(B)
LMPT9: 12(C) ? ,-12(C)
LMPT10: CAIG C,BOARD+34 ? CAIL C,BOARD+133
LMPT11: CAILE C,BOARD+34 ? CAIGE C,BOARD+133
LMKNT: MOVSI E,-8
LMKNT1: SKIPGE B,@NTAB2(E)
JRST LMKNT9
JUMPE B,LMKNT2
XCT LMPT2(I)
JRST LMKNT9
LMKNT3: MOVEI C,@NTAB2(E)
LMGENR
LMKNT9: AOBJN E,LMKNT1
JRST LMLUP9
LMKNT2: MOVEI B,PIECE
JRST LMKNT3
LMQUEN: MOVSI E,-8
JSP S,LMSLDR
AOBJN E,.-1
JRST LMLUP9
LMROOK: MOVSI E,-4
MOVE B,(A)
MOVE D,LMGT15-PIECE(B)
TDNE D,FLAGS
XOR D
LMR1: JSP S,LMSLDR
AOJ E,
AOBJN E,LMR1
JRST LMLUP9
LMBISH: MOVSI E,-4
LMB1: AOJ E,
JSP S,LMSLDR
AOBJN E,LMB1
JRST LMLUP9
LMSLDR: MOVE C,A
LMS1: ADD C,STAB(E)
SKIPGE B,(C)
JRST (S)
JUMPG B,LMS2
LMGNR2
JRST LMS1
LMS2: XCT LMPT2(I)
JRST (S)
LMGENR
JRST (S)
LMKING: MOVSI E,-8
IOR MMVT3(I)
AND FLAGS
LMK1: SKIPGE B,@STAB2(E)
JRST LMK9
JUMPG B,LMK3
MOVEI C,@STAB2(E)
LMGNR2
AOBJN E,LMK1
JRST LMLUP9
LMK2: MOVEI C,@STAB2(E)
LMGENR
LMK9: AOBJN E,LMK1
JRST LMLUP9
LMK3: XCT LMPT2(I)
JRST LMK9
JRST LMK2
NTAB2: 14(A) ? 25(A) ? 23(A) ? 10(A) ? ,-14(A) ? ,-25(A) ? ,-23(A) ? ,-10(A)
STAB2: 1(A) ? 13(A) ? 12(A) ? 11(A) ? ,-1(A) ? ,-13(A) ? ,-12(A) ? ,-11(A)
BLURB: ASCIZ \
Enter moves in algebraic notation, e.g. E2E4 or B2B1=Q.
(In algebraic notation white castles king-side by E1G1, etc.) or
in English notation e.g. P-K4 or P/K2-K4 or KP-K4, O-O for
castling kingside, X or * for captures, e.g. NXB, promotion by
=, e.g. P-N8=N. Terminate moves by space or CR if in English
notation. Rubout flushes previous typein, echoes as "XXX?".
Acceptance of move or non-typing command is confirmed by
backarrow.
In move typeout e.g. " 1 W E2-E4 3 0 0.5 IN 1.6" the "1"
is the move number, the "W" (white) is the side moving, E2-E4 is
the move in algebraic notation, the "3" is the maximum depth
setting, the "0" is the value return from TECH II's point of view
(-100 = TECH II is a pawn down) the "0.5" is the run time of the
last search (at depth 3), and the 1.6 is the total real time for
all searches made for this move (if in tournament mode, (set by
$T) it will be the time for searches at depths 1, 2, and 3).
List of commands
PW Play white.
PB Play black.
PS Play self.
PN Play neither side.
^R Resets board to initial position, clears clock, does a "PN".
^U Takes back a move, does a "PN".
^B Prints board.
^E Causes program to make a move.
^G Quit thinking. Does a "PN".
^P Print principal variation of last search.
^W Print statistics of last search.
LMM legal moves made during search.
ILM illegal moves made, and immediately taken back.
TRM terminal nodes in tree.
LMG legal moves generations.
ICH calls to routine which checks for check.
PSM moves made up to set depth.
STV captures made after set depth.
FED replies to check made after set depth.
Sum of PSM ("plausible moves"), STV ("static evaluator moves"),
and FED ("feedovers") equals LMM.
LMS legal moves per second of run time.
$C $C<n>,<nmoves>,<nmin>, sets time control N to NMOVES in
NMIN minutes total time from start of game. N may be 0 to 6.
Time controls must be in ascending order, and a margin of about
three times the mean time per move should be left or else TECH II
may overstep on its last move. T.C. 0 is assembled as 2 moves in
zero seconds for book purposes and is normally not to be changed.
Default settings of T.C.'s are 1 move/minute, good for hacker
games.
$A $A <maxtim>,<mintim>,<mintim2>, sets the parameters which
control use of the active schema in tournament mode. MAXTIM is
the number of minutes after which to abort the active search,
MINTIM is the minimum number of seconds per move which must be
left in order not to abort the active search, and MINTIM2 is the
minimum number of seconds per move which must be left to start an
active search.
$D $D<integer>, where <integer> is of the form ZZYYXXDD, the
letters representing digits, leaves tournament mode, and sets
four search parameters from <integer>. DD is the (weighted)
depth up to which the search examines all moves at each node. Up
to depth YY, safe active moves are examined, and all safe replies
are considered at nodes following an active move, and all moves
at depth YY+1 if the move from depth YY was active. Safe checks
are examined up to depth YY, and all checks from YY+1 to XX.
Safe captures are always examined, and after depth YY all
captures are examined. All replies to check are always examined.
Leading zeroes may be omitted in <integer>. $D3050701 is roughly
equivalent to, but much faster than, $D6 .
$T Enter "tournament", or variable parameter mode. If there
is enough time per move left (see the $C and $A commands) for an
active search, the "DD" parameter (see $D command) is set to one
and a single active search is performed in accordance with the
ZZ, YY, and XX parameters set by the last $D command. Otherwise,
or if the active search is aborted, the "XX" and "YY" parameters
are set to zero and the program iteratively searches starting at
the depth specified by the "DD" part of the last $D command and
deepening by one with each iteration. However, the iteration
always begun at depth at least 2, and for the first 4 plies is
begun at exactly 2 irrespective of the "DD" setting. Suggested
tournament settings are $D3050704 followed by $T, with
appropriate $C and $A settings.
$S Setup board. Scan from queen-side to king-side, black's
first rank first; e.g. $S 4BK3 8 8 8 8 8 8 4WK3_, where spaces
and _ are typed by the program, sets up the kings in their
original position. At end of setup it will be white's turn to
move and neither side will have castling or immediate en passant
privileges.
$V Types game
$? Type this cruft.
(To display the board, type ^B)
\
GO: SETOM PSAV
MOVE P,[-100.,,PDL-1]
STOUT [ASCIZ /Type $? for help.
/]
MOVEI A,.FHSLF
CIS%
EIR%
MOVE B,[LEVTAB,,CHNTAB]
SIR%
MOVSI B,200000
AIC%
MOVE A,[^G,,1]
ATI%
$RESET: PUSHJ P,BDINIT
ZZMLMG: MOVE P,[-100.,,PDL-1]
MOVE T,[-PDLL,,SPDL-1]
MOVEM T,TSAV'
PUSHJ P,LMG
ZZM: HLLI I,
MOVEI A,.PRIIN
SIBE%
SKIPA
PJUMP: JUMP LOOK
TYI B
CAIN B,^Z ? HALTF%
CAIN B,"- ? JRST ZZM
CAIN B,^B ? JRST [PUSHJ P,BPRINT ? JRST ZZM]
CAIN B,^E ? JRST LOOK
CAIN B,^P ? JRST PSVDP
CAIN B,^R ? JRST [PUSHJ P,BDINIT ? JRST PN]
CAIN B,^U ? JRST TAKBAC
CAIN B,^W ? JRST WALLPP
CAIN B,"$ ? JRST DOLLAR
CAIE B,176 ? CAIN B,33 ? JRST DOLLAR
JRST RDMV
DOLLAR: TYI B
CAIN B,"A ? JRST ASET
CAIN B,"C ? JRST CLKSET
CAIN B,"D ? JRST DSET
CAIN B,"T ? JRST [SETOM TMODEF ? JRST DSET3]
CAIN B,"S ? JRST BDSET
CAIN B,"V ? JRST SAVGAM
CAIN B,"? ? STOUT BLURB
JRST ZZM
RDMV: IRP A,,[HYPHEN,OOS,RPROM,RANK,FILE,BDSIDE,TPIECE,NPIECE]
SETZM A' ? TERMIN
SKIPA C,B
RDMV1: TYI C
MOVE B,[-6,,1]
CAME C,PCHTAB-1(B)
AOBJN B,.-1
JUMPG B,RDMV6
HRRZ A,RANK
JUMPN A,RDMV24
HRRM B,TPIECE
RDMV2: TYI A
MOVSI B,-6
CAME A,PCHTAB(B)
AOBJN B,.-1
MOVE C,A
JUMPG B,RDMV4
TRNN B,-1
JRST RDMV3
MOVE D,B
MOVE B,TPIECE
SOJE B,RDMV28
SUBI B,3
JUMPLE B,RDMV1
MOVE C,@-1(B)+[-1(D)+[6?4?2?1?0] ? -1(D)+[7?5?3?1?0]]
HRRM C,NPIECE
AOS NPIECE
TYI C
CAIE C,"P
JRST RDMV4
RDMV3: PUSHJ P,PCSFS ; CONVERT PIECE SPEC TO FILE SPEC
MOVEI 1
HRRM TPIECE
TYI C
RDMV4: CAIE C,"/
JRST RDMV8
MOVE RANK
RDMV5: TYI C
RDMV6: CAIL C,"1
CAILE C,"8
JRST RDMV7
RDMV6A: SUBI C,"0-1
HRRM C,RANK
JRST RDMV1
RDMV7: MOVSI B,-6
CAME C,PCHTAB(B)
AOBJN B,.-1
JUMPG B,RDMV4
HRRM RANK
HLLZS BDSIDE
MOVE (B)[9 ? 2 ? 3 ? 1 ? 4 ? 4]
HRRM FILE
CAIL 4
AOS BDSIDE
AOBJN B,.+2
AOS BDSIDE
TYI C
MOVSI B,-3
CAME C,PCHTAB+1(B)
AOBJN B,.-1
JUMPG B,RDMV6
MOVE (B)[2 ? 3 ? 1]
HRRM FILE
JRST RDMV5
RDMV8: CAIE C,"X
CAIN C,"*
JRST [MOVEI 2 ? PUSHJ P,RDMV9 ? JRST RDMV1]
CAIL C,"1
CAILE C,"8
JRST .+3
PUSHJ P,PCSFS ? JRST RDMV6A
CAIE C,"-
JRST RDMV10
MOVEI 1
PUSHJ P,RDMV9
MOVEI 2
JRST RDMV5
RDMV9: MOVEM HYPHEN
RDMV9A: IRP A,,[RANK,FILE,BDSIDE,TPIECE,NPIECE]
MOVSS A ? TERMIN
POPJ P,
RDMV10: CAIE C,"O
CAIN C,"0
AOSA OOS
JRST RDMV11
JRST RDMV1
RDMV11: CAIE C,"=
JRST RDMV12
MOVEI 7
MOVEM RPROM
SKIPN HYPHEN
PUSHJ P,RDMV9A
TYI C
MOVE B,[-4,,4]
CAME C,PCHTAB-3(B)
AOBJN B,.-1
JUMPG B,RDMV7
HRRZM B,RPROM
JRST RDMV1
RDMV12: CAIE C," ; SPACE
CAIN C," ; TAB
JRST RDMV13
CAIE C,^M
CAIN C,"E
JRST RDMV13
CAIE C,"C
CAIN C,"M
JRST RDMV13
JRST RDMV23
RDMV13: SKIPN A,RPROM
HRL A,HYPHEN
JUMPE A,RDMV23
SOSG A,OOS
JRST RDM13A
MOVSI 1
MOVEM NPIECE
MOVE [2,,2]
MOVEM BDSIDE
MOVEM RANK
MOVE [4,,2]
MOVEM FILE
SOJE A,RDM13A
MOVEI 1
HRRM BDSIDE
MOVEI 3
HRRM FILE
RDM13A: SETOM NMVS'
HRRZ Q,TSAV
RDMV14: CAIGE Q,(T)
JRST RDMV15
SKIPE NMVS
JRST ZZM
MOVE LMV'
JRST RDMV27
RDMV15: MOVE 1(Q)
PUSH P,Q
JSP V,MMOVE
SETCMI A,-2(I)
JSP V,INCHK
JRST .+3
JSP V,UNMOVE ? JRST RDMV16
JSP V,UNMOVE
LDB A,[410300,,]
MOVE B,RPROM
CAIE A,(B)
CAIN A,7(B)
JRST RDMV20
RDMV16: POP P,Q ? ADDI Q,2 ? JRST RDMV14
RDMV20: JSP S,RDMV17
HLRZ A,NPIECE
LDB B,[ORIGIN]
MOVE C,BOARD(B)
HLRZ A,TPIECE
LDB B,[ORIGIN]
HLRZ A,RANK
HLRZ A,FILE
HLRZ A,BDSIDE
MOVE A,HYPHEN
SOJE A,[TRNE 740000 ? JRST RDMV16 ? JRST RDMV22]
SOJE A,[TRNN 740000 ? JRST RDMV16 ? JRST RDMV22]
RDMV22: JSP S,RDMV17
HRRZ A,NPIECE
LDB B,[CAPTUR]
MOVEI C,@(I)[PIECE+20(B) ? PIECE(B)]
HRRZ A,TPIECE
LDB B,[DESTIN]
HRRZ A,RANK
HRRZ A,FILE
HRRZ A,BDSIDE
AOS NMVS
MOVEM LMV
JRST RDMV16
RDMV23: CAIL C,"A
CAILE C,"H
JRST RDMV28
RDMV24: MOVE B,C
HRRZ A,RANK
JUMPE A,RDMV25
MOVNI A,-13(A)
MOVEI 12
IMULI (A)
ADDI 2
JRST RDMV26
RDMV28: MOVEI 1
CAME TPIECE
JRST ZZM
MOVE B,C
JRST SETP+1
PCSFS: HRRZ A,NPIECE
JUMPE A,PCSFS2
MOVE B,-1(A)+[4 ? 4 ? 1 ? 1 ? 3 ? 3 ? 2 ? 2]
HRRM B,FILE
MOVE B,-1(A)+[2 ? 1 ? 1 ? 2 ? 1 ? 2 ? 1 ? 2]
HRRM B,BDSIDE
HLLZS NPIECE
PCSFS1: HLLZS TPIECE
POPJ P,
PCSFS2: HRRZ A,TPIECE
JUMPE A,CPOPJ
MOVE B,-1(A)+[9 ? 2 ? 3 ? 1 ? 4 ? 4]
HLLZM BDSIDE
CAIL A,5
AOS BDSIDE
HRRM B,FILE
CAIL A,6
AOS BDSIDE
JRST PCSFS1
RDMV17: XCT 1(S)
XCT 2(S)
XCT (S)
SOJL A,RDMV18
XORI A,-PIECE(C)
TRNE A,17
JRST RDMV16
JRST RDMV19
RDMV18: XCT 3(S)
SOJL A,RDMV19
CAME A,(C)
JRST RDMV16
RDMV19: XCT 4(S)
IDIVI B,12
TRNN I,-1
MOVNI B,-13(B)
CAILE C,4
SKIPA D,[1]
TDZA D,D
MOVNI C,-9(C)
XCT 5(S)
JUMPE A,.+3
CAIE A,(B)
JRST RDMV16
XCT 6(S)
JUMPE A,.+3
CAIE A,(C)
JRST RDMV16
XCT 7(S)
SOJL A,.+3
CAIE A,(D)
JRST RDMV16
JRST 10(S)
RDMV25: PUSHJ P,MTEST
MOVE B
TYI B
RDMV26: PUSHJ P,MTEST
DPB B,[DESTIN]
HRRZ A,TSAV
MRLUP: ADDI A,2
CAIL A,2(T)
JRST ZZM
MOVEI B,37777
AND B,-1(A)
CAME B
JRST MRLUP
SKIPL B,-1(A)
JRST MR2
MOVSI D,-4
TYI C
CAIN C,"=
JRST .-2
CAME C,PCHTAB+1(D)
AOBJN D,.-1
JUMPG D,ZZM
DPB D,[PROMOT B]
MR2: MOVE B
RDMV27: JSP V,MMOVE
SETCMI A,-2(I)
JSP V,INCHK
JRST [PUSHJ P,SVDTIM ? SETZM DPTHTB-1(A) ? JRST MR3]
JSP V,UNMOVE
JRST ZZM
MR3: STOUT BKAROW
JRST ZZMLMG
TAKBAC: SKIPG PLYN
JRST ZZM
JSP V,UNMOVE
PN: MOVSI (JUMP)
HLLM PJUMP
JRST DSET3
SETP: TYI B
MOVSI A,-4
CAME B,(A)["N ? "W ? "B ? "S]
AOBJN A,.-1
JUMPG A,ZZM
MOVE (A)[JUMP I,? JUMPE I,? JUMPN I,? JUMPA I,]
HLLM PJUMP
JRST DSET3
CLKSET: CHOUT "
PUSHJ P,RDNUM
CAILE A,6
JRST ZZM
JUMPL A,ZZM
MOVE C,A
PUSHJ P,RDNUM
ASH A,1
MOVEM A,TCTAB(C)
PUSHJ P,RDNUM
IMULI A,30.*60.
MOVEM A,TCTIME(C)
JRST DSET3
RFNAME: MOVSI A,-4
RFNAM1: PUSHJ P,RFNAM2
JUMPE C,[CAIE B," ? POPJ P, ? JRST RFNAM1]
CAIN B,":
JRST [MOVEM C,FNAME+2 ? JRST RFNAM1]
CAIN B,";
JRST [MOVEM C,FNAME+3 ? JRST RFNAM1]
SKIPG A
MOVEM C,FNAME(A)
CAIE B,"
POPJ P,
AOBJN A,RFNAM1
JRST RFNAM1
RFNAM2: MOVEI C,
MOVE D,[440600,,C]
RFNM2A: TYI B
CAIN B,^Q
JRST [TLO D,40 ? JRST RFNM2A]
CAIL B,41
CAILE B,137
POPJ P,
TLZE D,40
JRST RFNM2B
CAIE B,":
CAIN B,";
POPJ P,
RFNM2B: SUBI B,40
TLNE D,770000
IDPB B,D
JRST RFNM2A
RJDPT: IDIVI A,12
HRLM B,(P)
SOJ C,CPOPJ ; SOJL C,CPOPJ FOR TRUNCATING VERSION
JUMPE A,RJDPT3
PUSHJ P,RJDPT
RJDPT2: HLRZ A,(P)
CHOUT "0(A)
POPJ P,
RJDPT3: JUMPLE C,RJDPT2
PUSH P,[" -"0,,RJDPT2]
SOJA C,RJDPT3
.TAB: CAMG C,LINPOS
POPJ P,
CHOUT "
JRST .TAB
DEVICE: 0
FNAME: SIXBIT /GAME > DSK AGB/
SAVGAM: CHOUT "
PUSH P,LINEL ? MOVEI 72. ? MOVEM LINEL
STOUT [ASCIZ /
White Real CPU D Black Real CPU D
/]
SETZB E,TREALT
MOVE F,[TREALT,,TREALT+1]
BLT F,TCPUTM+1
MOVE F,PLYN
SVGLUP: SOJL F,SVG2
MOVEI C,3
MOVEI A,2(E)
ASH A,-1
PUSHJ P,RJDPT
PUSHJ P,SVGSEQ
STOUT [ASCIZ / /]
SOJL F,SVG2
PUSHJ P,SVGSEQ
STOUT CR
JRST SVGLUP
SVG2: STOUT CR
STOUT [ASCIZ /Total Min. /]
MOVE A,TREALT
PUSHJ P,SVGSQ5
MOVE A,TCPUTM
PUSHJ P,SVGSQ5
MOVEI C,42.
PUSHJ P,.TAB
MOVE A,TREALT+1
PUSHJ P,SVGSQ5
MOVE A,TCPUTM+1
PUSHJ P,SVGSQ5
STOUT CR
POP P,LINEL
JRST DSET3
SVGSEQ: XCT 2SP
MOVE GAME(E)
LDB A,[ORIGIN]
PUSHJ P,SQOUT
LDB A,[DESTIN]
PUSHJ P,SQOUT
JUMPG [XCT 2SP ? JRST SVGSQ2]
CHOUT "=
LDB A,[PROMOT]
CHOUT @PCHTAB+1(A)
SVGSQ2: LDB Q,[100,,E]
MOVE A,REALTM+1(E)
SUB A,REALTM(E)
ADDM A,TREALT(Q)
PUSHJ P,SVGSQ3
MOVE A,RUNTIM+1(E)
SUB A,RUNTIM(E)
ADDM A,TCPUTM(Q)
PUSHJ P,SVGSQ3
MOVE A,DPTHTB(E)
MOVEI C,3
AOJA E,RJDPT
SVGSQ3: IDIVI A,30.
PUSH P,B
MOVEI C,6
PUSHJ P,RJDPT
POP P,A
IDIVI A,3
CHOUT ".
JRST DPT
SVGSQ5: IDIVI A,60.
JRST SVGSQ3
TREALT: BLOCK 2
TCPUTM: BLOCK 2
TIMSAC: BLOCK 2 ;AC SAVE AREA FOR TIME% JSYS
SVDTIM: MOVE A,PLYN
MOVEM A,TIMSAC
TIME%
IMULI A,3
IDIVI A,100.
MOVE B,A
MOVE A,TIMSAC
MOVEM B,REALTM(A)
MOVEM A,TIMSAC
MOVEI A,.FHSLF
RUNTM%
MOVE B,A
MOVE A,TIMSAC
IMULI B,250.
ASH B,-15
MOVEM B,RUNTIM(A)
MOVE B,DEPTH
MOVEM B,DPTHTB-1(A)
POPJ P,
BDSET: HLLZS PLAUS
PUSHJ P,BDCLR
SETZM WPCS
SETZM BPCS
SETZM FLAGS
SETOM PIECEL
MOVE [PIECEL,,PIECEL+1]
BLT PIECEL+37
MOVEI A,BOARD+25
BDSLUP: HRLI A,-8
CHOUT "
BDSLP1: TYI 0
CAIN "W
JRST BDS2
CAIE "B
JRST BDS3
SKIPA B,[-8,,20]
BDS2: MOVSI B,-8
TYI D
MOVSI C,-6
CAME D,PCHTAB(C)
AOBJN C,.-1
JUMPG C,BDSLUZ
MOVEI D,(C)
CAMN D,PIECE(B)
SKIPL PIECEL(B)
AOBJN B,.-2
JUMPL B,BDS1
HRLI B,-8
SKIPL PIECEL(B)
AOBJN B,.-1
JUMPG B,BDSLUZ
BDS1: MOVEM D,PIECE(B)
MOVE VALTAB(D)
LDB C,[40100,,B]
ADDM WPCS(C)
HRRZM A,PIECEL(B)
MOVEI PIECE(B)
MOVEM (A)
AOBJN A,BDSLP1
BDS4: ADDI A,2
CAIG A,BOARD+142
JRST BDSLUP
MOVE WPCS
SUB BPCS
MOVEM VALUE
JRST MR3
BDSLUZ: STOUT [ASCIZ / ? ^R /]
JRST $RESET
BDS3: CAIN "
MOVEI "1
CAIL "1
CAILE "8
JRST BDSLUZ
SUBI "0
AOBJP A,BDS4
SOJG .-1
JRST BDSLP1
ASET: CHOUT "
PUSHJ P,RDNUM ? IMULI A,1800. ? MOVEM A,ABRTT1
PUSHJ P,RDNUM ? IMULI A,30. ? HRRM A,ABRTT2
PUSHJ P,RDNUM ? IMULI A,30. ? MOVNM A,ABRTT3
JRST DSET3
ABRTT1: 20.*1800.
ABRTT3: -30000.
DSET: SETZM TMODEF
PUSHJ P,RDNUM
REPEAT 3, IDIVI A,100. ? MOVEM B,DEPTH+.RPCNT
MOVEM A,CKAUXD ? MOVE DEPTH ? SOJG .+2 ? MOVEI 1 ? HRRM IDEPTH
DSET3: STOUT BKAROW
JRST ZZMLMG
BKAROW: ASCIZ /_ /
RDNUM: TYI B
CAIN B,177 ? POPJ P,
CAIL B,"0 ? CAILE B,"9 ? JRST RDNUM
TDZA A,A
RDNUM1: TYI B
CAIL B,"0 ? CAILE B,"9 ? POPJ P,
IMULI A,10.
ADDI A,-"0(B)
JRST RDNUM1
TMODEF: -1
WALLP1: MOVE TIME2
IDIVI 740000
EXCH A
STOUT [ASCIZ /Time /]
PUSHJ P,DPT
CHOUT ".
IDIVI 60000
MOVE A,
PUSHJ P,DPT
STOUT [ASCIZ / in /]
MOVE TIME
IDIVI 30.
EXCH A
PUSHJ P,DPT
CHOUT ".
IDIVI 3
MOVE A,
JRST DPT
WALLPP: MOVSI C,-8
WALLP2: STOUT CR
STOUT WALTAB(C)
MOVE A,@LTAB(C)
PUSHJ P,DPT
AOBJN C,WALLP2
STOUT CR
STOUT [ASCIZ /LMS /]
MOVE A,LMM
MULI A,740000
DIV A,TIME2'
DPTCRZ: PUSHJ P,DPT
ZZMCR: STOUT CR
JRST ZZMLMG
CR: ASCIZ /
/
WALTAB: IRP A,,[LMM,ILM,TRM,LMG,ICH,PSM,STV,FED]
ASCIZ /A / ? TERMIN
PSVDP: STOUT CR
MOVE C,VARL2
PUSH P,PLYN
PUSH P,I
MOVE PPLYN' ? MOVEM PLYN
SETCM I,
PSVDP1: JUMPLE C,PSVDP2
ANDCAI I,1
MOVE VARL1-VARL2(C)
PUSHJ P,MPRINT
MOVE C,(C)
AOS PLYN
JRST PSVDP1
PSVDP2: POP P,I ? POP P,PLYN
JRST ZZM
MTEST: CAIL B,"A ? CAILE B,"H ? JRST MTEST2
TYI A
CAIL A,"1 ? CAILE A,"8 ? JRST MTEST2
IMULI A,12
SUB B,A
ADDI B,-"A+133+12*"1
POPJ P,
MTEST2: POP P, ? JRST ZZM
DPT: SKIPGE A
CHOUT "-
MOVMS A
IDIVI A,12
HRLM B,(P)
SKIPE A
PUSHJ P,DPT
HLRZ B,(P)
CHOUT "0(B)
POPJ P,
ALPHA: 0
VARL2 ; POINTER TO PRINCIPAL VARIATION CHAIN
BETA: 0
SPDL: BLOCK PDLL ? -1
IRP A,,[GAME,REALTM,RUNTIM,DPTHTB]
A: BLOCK GAMEL ? TERMIN
LOOK: MOVEI A,5
CAME A,PLYN
JRST LOOK02
HRRZ GAME-1(A)
CAMN (A)-1+[20325 ? 15643 ? 23141 ? 12626 ? 15140]
SOJG A,.-2
MOVEI 10632
JUMPE A,LOOK01 ; ANSWER RUY LOPEZ BY 3...B-K2 (BOOK)
MOVEI A,5
HRRZ GAME-1(A)
CAMN (A)-1+[20325 ? 15643 ? 20526 ? 520467 ? 17740]
SOJG A,.-2
JUMPG A,LOOK02
MOVE [54015442] ; ANSWER BISHOP'S GAMBIT BY 3...P-Q4 (BOOK)
LOOK01: PUSHJ P,MPRINT
JSP V,MMOVE
PUSHJ P,SVDTIM
SETZM DPTHTB-1(A)
STOUT [ASCIZ /(Book)
/]? JRST ZZMLMG
LOOK02: MOVE [JFCL 8,NEXTMV+1]
MOVEM NEXTMV
DMOVEM A,TIMSAC
TIME%
IMULI A,3
IDIVI A,100.
MOVE A
DMOVE A,TIMSAC
MOVEM TIME'
SKIPE TMODEF
JRST TMODE
PUSHJ P,LOOK1
JRST LKRT2
TMODE: MOVE PLYN
ASH -1
IDIVI 10.
ASK: CAI A,5 ; CAIE TO ASK FOR TIME
JRST TM1
STOUT [ASCIZ /Type time used in minutes: /]
PUSHJ P,RDNUM
CAIN B,177 ? JRST .-2
MUL A,[30.*60._9]
DIV A,TOTTIM(I)
HRRM A,TM4
TM1: PUSHJ P,PLAUS
TM1A: MOVE PLYN
CAIGE 4
SKIPA A,[1]
IDEPTH: MOVEI A,1 ; ONE LESS THAN MINIMUM DEPTH SETTING
MOVEM A,DEPTH
MOVSI A,-7
TM2: MOVE C,TCTAB(A)
SUB C,
JUMPG C,TM3
AOBJN A,TM2
STOUT [ASCIZ /Set time control with $C, then PW or PB.
/]? MOVSI (JUMP)
HLLM PJUMP
JRST ZZM
TM3: MOVE TOTTIM(I)
TM4: IMULI 1000 ; CORRECT FOR OPERATOR DELAY
ASH -9
SUB TCTIME(A)
AOJ C,
ASH C,-1
IDIVI (C)
MOVNM TIME3' ; TIME ALLOTTED FOR THIS MOVE
CAMG ABRTT3
SKIPE NACTIV'
JRST TMLUP
SETZM DEPTH
MOVN
ABRTT2: SUBI 2400.
IMULI (C)
CAMLE ABRTT1
MOVE ABRTT1
ASH 1
TMLUP: AOS DEPTH
PUSHJ P,LOOK1
MOVM ALPHA
ADD DEPTH
CAIGE 77774
SKIPG VARL2
JRST LKRT2 ; NO MOVE OR SHORTEST MATE, DON'T SEARCH AGAIN
MOVE DEPTH ? SOJE LKRT2 ; ITERATE ONLY ONCE FOR ACTIVE SEARCH
DMOVEM A,TIMSAC
TIME%
IMULI A,3
IDIVI A,100.
MOVE A
DMOVE A,TIMSAC
SUB TIME
ASH 2
CAMG TIME3 ; SEARCH AGAIN IF FOR THIS MOVE TIME < 1/4*(ALLOTTED TIME)
JRST TMLUP
JRST LKRT2
RCLOCK: 0 ? 77 ? 5 ? 0
TCTAB: IRP A,,[2,40,50,60,70,80,90]
2*A!. ? TERMIN ; TIME CONTROLS IN PLIES
TCTIME: IRP A,,[0,40,50,60,70,80,90]
1800.*A!. ? TERMIN ; TIME CTRLS IN 30THS OF SECS
LOOK1: DMOVEM A,TIMSAC
MOVEI A,.FHSLF
RUNTM%
IMULI A,250.
MOVEM A,TIME2
DMOVE A,TIMSAC
MOVEI 1 ? SKIPE TMODEF ? CAMN DEPTH ? JRST LOOK1A
MOVSI (CAI) ? HLLM SRCOND ? T.SRC: MOVEI A.SRC ? JRST LOOK1B
LOOK1A: MOVEI AC.SRC ? HRRM SEARCH ? MOVSI (PUSHJ T,) ? HLLM SRCOND
MOVE THR.D ? JUMPG .+5
MOVEI B.SRC ? HRRM SEARCH ? MOVSI (CAI) ? HLLM SRCOND
MOVEI A.SRC ? SKIPG THR.D ? SKIPE CHK.D ? CAIA ? LOOK1B: HRRM SEARCH
LTAB: IRP A,,[LMM',ILM,TRM,LMGN,ICH,PSM,STV,FED,KILLER']
SETZM A ? TERMIN
XCT (I)[MOVE VALUE ? MOVN VALUE]
SUBI 25. ? MOVEM ALPHA ? ADDI 50. ? MOVNM BETA
LOOK2A: SETZM LSHRTF'
LOOK2: SETZM LMGD'
MOVE ALPHA ? MOVNM SALPHA'
MOVE [JSP B,PLS4] ? MOVE A,[JSP B,EVL2]
MOVSI B,(CAMGE S,(A)) ? HRLOI C,(TDNN A,(T)) ? MOVSI D,-321.
CAMLUP: MOVEM B,CAMTAB(D) ? MOVEM A,CAMTAB+1(D)
MOVEM C,PLSTAB(D) ? MOVEM PLSTAB+1(D)
SUBI C,2 ? HRRI B,-2(B)
AOJ D, ? AOBJN D,CAMLUP
SETOM VARL2
MOVE [EXCH A,VARL2+1] ? MOVSI A,-158. ? MOVEM CONS
AOJ ? MOVEM VARL2+1(A) ? AOBJN A,.-2
MOVE [JRST 4,CONS] ? MOVEM VARL2+159.
MOVE DEPTH
ASH 1
IRP A,,[2,3,4]
HRRM DEPTH!A ? TERMIN
SETZM WDEPTH'
SKIPE LSHRTF
JRST LOOK5 ; "SHORT SEARCH", DON'T RECONSIDER OLD MOVES
MOVE T,[-PDLL,,BETA]
HRROI 3+[MOVE B,WDEPTH ? SUB A,@MMVT9(I) ? XORI I,1 ? PUSHJ P,.PLAUS]
IRP A,,[PLS2,EGPC9+1,EVAL1]
POP A ? TERMIN
TLZ I,300
HRRZ SEARCH ? MOVEM ISRC'
PUSHJ P,EVAL
JRST LOOKRT
LOOK5: PUSHJ P,SEARCH
LOOKRT: MOVE T,TSAV2
MOVE [JFCL 8,NEXTMV+1]
EXCH NEXTMV
CAME CPOPJ ? JRST NQUIT
AOSGE NACTIV ? JRST ABORT
STOUT [ASCIZ / Quit /]
JRST ZZMLMG
ABORT: STOUT [ASCIZ / Active Search Aborted /]
POP P,
HRRZ IDEPTH ? MOVEM DEPTH
JRST TMLUP
NQUIT: SKIPG A,VARL2
JRST LKRT0
MOVE A,VARL1-VARL2(A)
MOVE Q,TSAV
SUBI Q,2(T)
ASH Q,21
HRR Q,TSAV
LK2LUP: AOBJP Q,[JRST 4,.] ; HALT IF BEST MOVE NOT IN LIST
MOVE B,(Q)
XOR B,A
TDNE B,[700000037777]
AOJA Q,LK2LUP
SETCMM 1(Q) ; REPLAUSIFY BEST MOVE
SETOM LSHRTF ; PREPARE NOT TO SEARCH PREVIOUS MOVES
LKRT0: MOVNI A,77777
MOVN ALPHA
CAMLE BETA
JRST LOOKR1
ADDI 25. ; TOO GOOD FOR US
MOVNM ALPHA
MOVEM A,BETA
JRST LOOK2
LOOKR1: CAME SALPHA
JRST LKRT1 ; NOT TOO BAD FOR US, OR ELSE WE'RE MATED
SUBI 25.
CAME A,BETA
MOVEM BETA
MOVEM A,ALPHA
JRST LOOK2A
LKRT1: MOVE ALPHA
XCT (I)[MOVEM VALUE ? MOVNM VALUE]
DMOVEM A,TIMSAC
MOVEI A,.FHSLF
RUNTM%
IMULI A,250.
MOVE A
DMOVE A,TIMSAC
SUBM TIME2
POPJ P,
LKRT2: MOVE PSM ? ADD STV ? ADD FED ? MOVEM LMM
DMOVEM A,TIMSAC
TIME%
IMULI A,3
IDIVI A,100.
MOVE A
DMOVE A,TIMSAC
SUBB TIME
ADDM TOTTIM(I)
SKIPG A,VARL2
JRST LOOKR2
MOVE VARL1-VARL2(A)
PUSHJ P,MPRINT
JSP V,MMOVE
MOVN PLYN ? SETCAM PPLYN
MOVE ALPHA
XCT (I)[MOVNM VALUE ? MOVEM VALUE]
PUSHJ P,SVDTIM
LOOKR2: MOVE A,DEPTH
PUSHJ P,DPT
CHOUT "
MOVE A,ALPHA
PUSHJ P,DPT
STOUT [ASCIZ / /]
PUSHJ P,WALLP1
MOVSI (JUMP)
SKIPG VARL2
HLLM PJUMP
STOUT CR
JRST ZZMLMG
VARL1: BLOCK 160.
VARL2: BLOCK 160.
; MAGIC BITS IN LEFT HALF OF I
NCHEKF==1 ; 0 IF IN CHECK
NLEGMF==2 ; 1 IF NO LEGAL MOVE SO FAR AT THIS LEVEL
KILLR2==4 ; 1 IF KILLER HAS KILLED TWICE
NTHRET==10 ; 0 IF THREATENED
NNONLZ==20 ; 0 IF A NON-LOSING MOVE WAS TRIED
; SIGN BIT 0 MEANS LOOK AT CAPTURES ONLY
EVAL: MOVEM T,TSAV
TLO I,-301#KILLR2
LDB A,[300200,,I] ; BITS ASSUMED 0 IF NOT YET AT SET DEPTH
JRST @(A)[.+1 ? EVCHK ? EVTHRT ? EVNTHR]
MOVEI A,(I)
JSP V,INCHK
JRST DEPTH2
EVCHK: JRST TRYAL2
DEPTH2: MOVEI F,
CAMLE F,WDEPTH
JRST TRYALL
SRCOND: CAI THRETP ; CAI OR PUSHJ T,
EVNTHR: SKIPA A,WPCS(I)
EVTHRT: JRST [TLZ I,777400\NTHRET ? JRST EVAL1A]
EVAL1: SUB A,@MMVT9(I) ; GET PIECE COUNT FROM OUR PT OF VIEW
TLZ I,777700 ; IN STATEV, EXAMINE CAPTURES ONLY
CAMG A,ALPHA
EVAL1A: JRST TRYALL
MOVEM A,ALPHA ; NULL MOVE IS BEST SO FAR
ADD A,(T) ; BETA
JUMPGE A,[AOS TRM' ? POPJ P,] ; TERMINAL POS, A-B FLUSH BY NULL MOVE
EVAL1B: JRST TRYALL
TRYAL2: TLZ I,NCHEKF ; WE'RE IN CHECK
TRYALL: PUSHJ P,LMG ; GENERATE MOVE LIST
EVAL2: AOS LMGN'
CAMG T,TSAV ? JUMPGE I,NOGEN ; NO MOVES GENERATED
MOVE Q,T ? SUB Q,TSAV
HRLI Q,(T) ? MOVSM Q,TSAV2'
PLS2: TLNN I,KILLR2 ; ACCEPT ONLY TWO-TIME KILLERS
JRST SEARCH
MOVE [JRST PLS9] ? EXCH PLSTAB(Q)
SETCM A,KILLER ? AND A,[700000037777]
PLSTAB: BLOCK 642.
JRST 4,.
PLS4: MOVE C,@-2(B)
XOR C,KILLER
TDNE C,[700000037777]
JRST (B)
MOVEI A,@-2(B)
MOVEM PLSTAB(Q)
MOVEI 77777
MOVEM 1(A)
JRST SEARCH
PLS9: MOVEM PLSTAB(Q)
SEARCH: PUSHJ T,A.SRC
SRC1: TLNN I,NLEGMF ? POPJ P, ; WE HAVE LOOKED AT AT LEAST ONE MOVE AT THIS LEVEL
AOS TRM ; WE HAVE NOT LOOKED AT ANY MOVES AT THIS LEVEL
JUMPL I,.+4
SRC2: HRRZ SEARCH ? CAIN A.SRC ? POPJ P, ; FULL MOVE LIST N/A
TLZ I,377700 ? TLO I,400000
LMTEST: JSP V,NEXTMV
JRST MATE ; NO LEGAL MOVES
HLROM I,(A) ? MOVE -1(A) ? JSP V,MMOVE
SETCMI A,-2(I) ? JSP V,INCHK
JRST [JSP V,UNMOVE ? POPJ P,] ; AT LEAST ONE LEGAL MOVE
JSP V,UNMOVE ? JRST LMTEST
NOGEN: HRRZM T,TSAV2
AOS TRM
JRST SRC2
MATE: SETZM ALPHA
TLNE I,NCHEKF ? POPJ P, ; STALEMATE
HRROI -77776 ; CHECKMATE
ADD LMGD
MOVEM ALPHA
POPJ P,
MAKMOV: MOVE -1(A)
HRROI B,
MOVEM B,(A) ; DEPLAUSIFY SO MOVE WON'T BE LOOKED AT AGAIN
JSP V,MMOVE ; ALL MOVES DURING A-SEARCH ARE MADE HERE
MAKMV2: SETCMI A,-2(I)
JSP V,INCHK
JRST LEGAL
ILEG: AOS ILM' ; MOVE LEFT US IN CHECK OR DIDN'T CAPTURE
JSP V,UNMOVE
HRROI S, ; LOW NUMBER WON'T CONFUSE ABTEST
POPJ T,
LEGAL:
DEPTH3: MOVEI A,
CAMLE A,WDEPTH ; SKIP IF IN STATEV
JRST PSMGEN
TLNN I,NCHEKF
JRST [AOS FED' ? JRST WPUSH] ; FEEDOVER IF IN CHECK
STVCNT: AOSA STV'
PSMGEN: AOS PSM'
WPUSH: TLZ I,NLEGMF
HRROI A,-1
CONS: EXCH A,VARL2+1 ; SAVE MOVE IN PRINCIPAL VARIATION LIST
EXCH A,CONS
MOVEM VARL1-VARL2(A)
IRP A,,[WDEPTH,KILLER,TSAV2,TSAV,I,A,ALPHA]
PUSH T,A ? TERMIN
MOVE A,TSAV
POP A,ALPHA ; SET ALPHA FOR LEVEL+1 FROM LEVEL-1
AOS LMGD
TLNN I,NCHEKF
JRST RECURSE
AOS WDEPTH
JUMPL RECURSE
AOS WDEPTH
RECURSE: PUSHJ P,EVAL ; CALL SELF RECURSIVELY
WPOP: MOVN S,ALPHA ; SAVE RETURNED VALUE
MOVE T,TSAV
IRP A,,[ALPHA,CVAR',I,TSAV,TSAV2,KILLER,WDEPTH]
POP T,A ? TERMIN
JSP V,UNMOVE
SOSE A,LMGD
JRST COMPAR
MOVE B,PLYN
SOJLE B,COMPAR
MOVE B,[700000740000]
MOVE C,PLYN
TDNN B,GAME-1+1(C)
TDNE B,GAME-1-1(C)
JRST COMPAR
LDB B,[DESTIN GAME-1+1(C)]
XOR B,GAME-1-1(C)
TRNE B,177
JRST COMPAR
LDB B,[DESTIN GAME-1-1(C)]
XOR B,GAME-1+1(C)
TRNE B,177
JRST COMPAR
JUMPLE S,COMPAR
MOVEI S,
COMPAR: CAMG S,ALPHA
JRST NOTBET ; NOT BETTER THAN PREVIOUS VALUE
MOVEM S,ALPHA ; BETTER VALUE REPLACES PREVIOUS VALUE
SKIPA B,CVAR
DPV: SETO B,
MOVE C,TSAV
EXCH B,@-1(C) ; NEW VARIATION
JUMPLE B,CPOPJT
DPV1: MOVE A,B ; RESTORE OLD PV TO FREE STORAGE
EXCH A,CONS
DPV2: SKIPG C,(B) ? JRST DPV3
SKIPL B,(C) ? JRST DPV2
MOVEM A,(C) ? POPJ T,
DPV3: MOVEM A,(B) ? POPJ T,
NOTBET: SKIPG B,@CVAR
JRST NTBET1 ; MOVE FLUSHED WITHOUT REPLY
MOVE B,VARL1-VARL2(B) ; GET REPLY
EXCH B,KILLER ? XOR B,KILLER
TDNN B,[700000037777]
TLOA I,KILLR2
TLZ I,KILLR2
NTBET1: MOVE B,CVAR
JRST DPV1
NEXTMV: JFCL 8,.+1
MOVE A,TSAV2 ? HLRZ Q,A ? HRROI B,Q+2
MOVE [JRST EVL9] ? EXCH CAMTAB(Q)
HLRE S,I ? ANDCMI S,300
CAMTAB: BLOCK 642.
JRST 4,.
EVL2: MOVE S,@-2(B)
JRST (B)
EVL9: MOVEI A,@-2(B)
MOVEM CAMTAB(Q)
JUMPG B,1(V)
JRST (V)
; CUTOFF DEPTH PARAMETERS
DEPTH: 4 ; STOP CONSIDERING ALL MOVES
CHK.D: 0 ; STOP EXAMINING CHECKS
THR.D: 0 ; STOP CONSIDERING THREATS
CKAUXD: 0 ; STOP INITIALIZING PREDICATES TO EXAMINE CHECKS
A.SRC2: TLZA I,377700
A.SRC: TLZ I,300
JSP V,NEXTMV ; SKIPS IF MOVE
POPJ T,
MOVE -1(A)
PUSHJ T,MAKMOV ? JSP V,ABTEST
JRST A.SRC
B.SRC: PUSHJ T,A.SRC
JUMPL I,CPOPJT
MOVE CHK.D ? CAMG LMGD ? POPJ T, ; POPJ IF TOO DEEP FOR CHECKS
TLZ I,300 ? TLO I,770100 ; TELL NEXT LEVEL THAT IT'S CHECK
B.SRC2: JSP V,NEXTMV
JRST B.SRC3
HRROI 740100 ? MOVEM (A) ? HRRZM A,TEM2'
MOVE -1(A)
JSP V,MMOVE ? MOVEI A,(I) ? JSP V,INCHK
JRST [JSP V,UNMOVE ? JRST B.SRC2] ; NON-CHECKS ARE "ILLEGAL" HERE
HRROI B,? MOVEM B,@TEM2 ; DON'T CLOBBER AC0
PUSHJ T,MAKMV2 ? JSP V,ABTEST ; TRY CHECKING MOVE
JRST B.SRC2
B.SRC3: TLZ I,770000 ? POPJ T,
AC.SRC: JUMPL I,A.SRC ; WDEPTH LOW, TRY ALL MOVES
MOVE THR.D ? CAMLE LMGD ? JRST AC.SR1 ; DEPTH LOW, BE SELECTIVE
MOVE [CAI B.SRC] ? HRRM SEARCH ? HLLM SRCOND
TLNN I,NTHRET ? TLO I,600000 ; TRY ALL IF THREATENED
PUSH T,[CPOPJ] ? PUSHJ P,B.SRC
MOVE [PUSHJ T,AC.SRC] ? MOVEM SEARCH ? HLLM SRCOND
JRST SRC1
AC.SR1: PUSHJ T,TRYMOR ? 540000,,TPOPJ1 ; TRY SAFE CAPTURES
TLO I,750000
PUSHJ T,TRYMOR ? 740100,,CHKTST ; TRY SAFE CHECKS
TLZ I,40000
MOVE THR.D ? CAMG LMGD ? JRST .+3
PUSHJ T,TRYMOR ? 700200,,ACTIVP ; TRY SAFE ACTIVE MOVES
TLNE I,NTHRET ? JRST AC.SR2 ; JUMP IF NOT THREATENED
TLZ I,100000
PUSHJ T,TRYMOR ? 500300,,TPOPJ1 ; TRY SAFE MOVES
TLNE I,NNONLZ ? JRST A.SRC2 ; IF NO SAFE MOVES, TRY ALL MOVES
AC.SR2: ; MOVE A,TSAV ? SUB A,TSAV2 ? ASH A,21 ? HRR A,TSAV2 ? ADDI A,3
AC.SR3: ; MOVEI 10000
; SUBI A,3 ? TDNN (A) ? AOBJN A,.-2 ? JUMPG A,AC.SR4
; TLZ I,300 ? TLO I,100
; PUSH T,A ? PUSHJ T,MAKMOV ? JSP V,ABTEST ? POP T,A ; TRY UNSAFE CHECKS
; AOBJN A,AC.SR3
AC.SR4: SETCM ALPHA
CAIL 70000
JRST A.SRC2 ; IF STILL GETTING MATED, TRY ALL MOVES
TLZ I,400000
POPJ T,
TRYMR2: JSP V,UNMOVE
TRYMOR: JSP V,NEXTMV ; GET NEXT MOVE
JRST TPOPJ1 ; NO MORE MOVES
MOVE WPCS(I) ? SUB @MMVT9(I) ? MOVEM TEM'
MOVE @(T) ? HLROM (A) ? HRLM A,(P)
MOVE -1(A) ? JSP V,MMOVE
HLRZ A,(P) ? HRROI 750000 ? CAMG (A) ? JRST TRYMR3 ; DON'T RECHECK FOR LEGALITY
SETCMI A,-2(I) ? JSP V,INCHK ? CAIA
JRST [PUSHJ T,ILEG ? JRST TRYMOR] ; MOVE WAS ILLEGAL
TRYMR3: HLRZ A,(P) ? MOVE B,(T) ? PUSHJ T,@(B) ? JRST TRYMR2 ; JUMP IF PREDICATE IS FALSE
JRST SAFE.P ; JUMP TO TRYMOR IF UNSAFE
TRYMR4: MOVE -1(A)
HRROI B, ? MOVEM B,(A)
JSP V,MMOVE ; REMAKE MOVE UNMADE BY SAFE.P
LDB B,[300200,,@(T)] ? DPB B,[300200,,I] ; SET THREAT PASS DOWN CODE
PUSHJ T,LEGAL ? JSP V,ABTEST ? JRST TRYMOR ; SAFE, TRY THE MOVE
CHKTST: PUSH T,A ; PREDICATES MUST SAVE A
MOVEI A,(I) ? JSP V,INCHK
JRST [POP T,A ? POPJ T,] ; MOVE DOESN'T CHECK
POP T,A ? MOVEI 510000 ? HRROM (A) ? AOS (T) ? POPJ T, ; MOVE CHECKS
SAFE.P: MOVE B,TSAV ? PUSH T,@-1(B) ? SETOM @-1(B) ? PUSH T,(B)
IRP A,,[A,ALPHA,SEARCH,KILLER,I,SRCOND,PSM,STV,FED,PLS2,TRM,TSAV,TSAV2]
PUSH T,A ? TERMIN
TLZ I,KILLR2\300
MOVE [TLNN I,KILLR2] ? MOVEM PLS2
MOVEI (CAI) ? HRLM SRCOND
MOVE CKAUXD ? CAMLE LMGD ? SKIPA C,[B.SRC] ? MOVEI C,A.SRC ? HRRM C,SEARCH
MOVN TEM
; MOVE C,PLYN ? MOVE C,GAME-1(C) ? TRNE C,740000
ADDI 25.
MOVEM (B) ? SETCAB ALPHA ; MOVE MUST LOSE NO MATERIAL UNLESS CAPT OR PROM
PUSH T,
MOVE C,PLYN ? MOVE GAME-1(C)
PUSHJ T,LEGAL ; MOVE HAS ALREADY BEEN MADE AND TESTED FOR LEGALITY
PUSHJ T,DPV
IRP A,,[D,TSAV2,TSAV,TRM,PLS2,FED,STV,PSM,SRCOND,I,KILLER,SEARCH,C,A]
POP T,A ? TERMIN
MOVE B,TSAV ? POP T,(B) ? POP T,@-1(B)
EXCH C,ALPHA
XORI I,1
CAMG C,D
JRST TRYMOR ; MOVE WAS UNSAFE
TLZ I,NNONLZ ; MOVE WAS SAFE
JRST TRYMR4
ACTIVP: MOVE B,TSAV ? PUSH T,@-1(B) ? SETOM @-1(B)
IRP A,,[A,ALPHA,SEARCH,SRCOND,PSM,STV,FED,I,KILLER,PLS2,TRM,TSAV,TSAV2,FLAGS]
PUSH T,A ? TERMIN
TLZ I,KILLR2\300 ? XORI I,1
MOVSI 177 ? ANDCAM FLAGS
MOVE [TLNN I,KILLR2] ? MOVEM PLS2
MOVSI (CAI) ? HLLM SRCOND
MOVE CKAUXD ? CAMLE LMGD ? SKIPA C,[B.SRC] ? MOVEI C,A.SRC ? HRRM C,SEARCH
MOVE WPCS(I) ? SUB @MMVT9(I)
CAMGE ALPHA ? MOVE ALPHA
MOVEM ALPHA ; ACTIVE MOVE MUST THREATEN BOTH GAIN & BEST SO FAR
SETCAI
PUSH T,-1(B) ? PUSH T,
MOVEI 2 ? ADDM LMGD
PUSHJ P,EVAL
HRROI -2 ? ADDM LMGD
PUSHJ T,DPV
MOVE T,TSAV
IRP A,,[0,B,FLAGS,TSAV2,TSAV,TRM,PLS2,KILLER,I,FED,STV,PSM,SRCOND,SEARCH,B,A]
POP T,A ? TERMIN
MOVE C,TSAV ? POP T,@-1(C)
EXCH B,ALPHA
ADD B ? JUMPL CPOPJT
MOVEI 520000 ? HRROM (A) ; MOVE IS ACTIVE
AOS (T) ? POPJ T,
THRETP: MOVE B,TSAV ? PUSH T,ALPHA
PUSH T,@-1(B) ? PUSH T,(B) ? SETOM @-1(B)
IRP A,,[SEARCH,SRCOND,PSM,STV,FED,TRM,TSAV,I,KILLER,PLS2,FLAGS]
PUSH T,A ? TERMIN
TLZ I,KILLR2\300 ? XORI I,1
MOVSI 177 ? ANDCAM FLAGS
MOVE [TLNN I,KILLR2] ? MOVEM PLS2
MOVSI (CAI) ? HLLM SRCOND
MOVE CKAUXD ? CAML LMGD ? SKIPA C,[B.SRC] ? MOVEI C,A.SRC ? HRRM C,SEARCH
MOVE WPCS(I) ? SUB @MMVT9(I)
CAMGE (B) ? MOVE (B)
MOVEM ALPHA
SETCAI
PUSH T,-1(B) ? PUSH T,
AOS LMGD ? PUSHJ P,EVAL ? PUSHJ T,DPV ? SOS LMGD
MOVE T,TSAV
IRP A,,[0,B,FLAGS,PLS2,KILLER,I,TSAV,TRM,FED,STV,PSM,SRCOND,SEARCH]
POP T,A ? TERMIN
MOVE B,TSAV ? POP T,(B) ? POP T,@-1(B)
ADD ALPHA
POP T,ALPHA
JUMPL .+2
TPOPJ1: AOS (T) ; THERE IS A THREAT
CPOPJT: POPJ T,
ABTEST: MOVE A,TSAV
MOVN (A)
CAML S, ? POPJ P, ; A-B FLUSH
CAIG S,70000 ? JRST (V) ; NOT MATE AT ALL
ADD S,LMGD
CAIN S,77775 ? POPJ P, ; MATE ON MOVE
SUBI S,77774
ASH S,1
DEPTH4: ADDI S,
CAMLE S,WDEPTH
MOVEM S,WDEPTH ; MATE, NOT IN ONE -- RESET DEPTH
JRST (V)
.PLAUS: PUSHJ P,PLAUS
MOVEI Q,(T)
SUB Q,TSAV
HRLI Q,(T)
MOVSM Q,TSAV2
MOVE [TLNN I,KILLR2]
MOVEM PLS2
SOS (P)
SKIPE DEPTH
POPJ P,
MOVN SALPHA ? MOVEM ALPHA
MOVE T,TSAV
SOS LMGN
POP P,
JRST EVAL
PLAUS: MOVEI 16.
SETZM NACTIV
PUSH P,
PUSHJ P,PTABUL
POP P,
HRRZ Q,TSAV
CAIL Q,-50.(T) ? SETOM NACTIV ; DON'T USE ACTIVE MODE IF < 26 MOVES
CAMG PLYN
JRST PLAUS1 ; OPENING IS OVER AFTER 8 MOVES
PUSHJ P,PWNFLS
MOVEI 10.
HRRM WPADV
OPPLS1: CAIL Q,(T)
POPJ P,
HRRZ 1(Q)
LDB A,[ORIGIN]
MOVE D,@BOARD(A)
PUSHJ P,CCNORM
MOVN S,A
LDB A,[DESTIN]
PUSHJ P,CCNORM
ADD S,A
IMUL S,OPNPCM(D)
PUSHJ P,PLCAS
OPPLS2: PUSHJ P,PHEURS
LDB A,[ORIGIN]
SKIPN @BOARD(A)
JRST OPPLS4
IDIVI A,12
CAILE B,4
ADDI S,2 ; PIECE MOVING FROM KING SIDE
OPPLS4: CAME (I)[116_7+141 ? 60_7+33]
CAMN (I)[107_7+134 ? 51_7+26]
SUBI S,15. ; N/N1-R3
MOVE A,PLYN
CAIN A,3
CAIE 56_7+33
JRST OPPLS3
HRRZ GAME
HRRZ A,GAME+1
CAIN 101_7+125
CAIE A,67_7+43
JRST OPPLS3
HRRZ GAME+2
CAIN 114_7+141
SUBI S,50. ; PETROFF'S DEFENSE
OPPLS3: ADDI S,60. ; CONSTANT
MOVEM S,2(Q)
ADDI Q,2
JRST OPPLS1
OPNPCM: 1 ? 4 ? 3 ? 2 ? 1 ? -1 ; OPENING PIECE MULTIPLIER
MDGPCM: 3 ? 4 ? 3 ? 2 ? 1 ? -1 ; MIDDLE GAME PIECE MULTIPLIER
EGGPCM: 0 ? 4 ? 3 ? 1 ? 1 ? 4 ; GENERAL ENDGAME PIECE MULTIPLIER
CCA: 0 ? 1 ? 2 ? 3 ? 3 ? 4 ? 5 ? 6 ? 7 ? 8 ; CENTER CONTROL ARRAY
MDKF: 0 ? 10. ? 8 ? 2 ? 10. ? 8 ? 2 ? 8 ? 2 ? 2 ; MIDDLE GAME KING FIELD
EGPNKF: 0 ? 6 ? 5 ? 3 ? 6 ? 4 ? 2 ? 3 ? 1 ? 1 ; PAWN ENDGAME KING FIELD
EGGNKF: 0 ? 10. ? 10. ? 6 ? 10. ? 10. ? 5 ? 8 ? 4 ? 4 ; GENERAL ENDGAME KING FIELD
EGPCKF: 0 ? 10. ? 9 ? 6 ? 10. ? 10. ? 5 ? 8 ? 4 ? 4 ; PIECE ENDGAME KING FIELD
OWNPWN: 4. ? 12. ? 8 ? 4 ? 15. ? 3 ? 5 ? 15. ? 4 ? 1 ? 2 ? 1 ? 0 ? 0 ? 0
OPPPWN: 24. ? 12. ? 8 ? 8 ? 5 ? 3 ? 7 ? 6 ? 4 ? 5 ? 2 ? 1 ? 1 ? 0 ? 0
CCNORM: SUBI A,25
IDIVI A,12
TRNE A,4 ? ANDCAI A,3
TRNE B,4 ? ANDCAI B,3
CAIGE B,(A) ? EXCH A,B
MOVE A,@(A)[CCA(B)? CCA+3(B)? CCA+5(B)? CCA+6(B)]
POPJ P,
KFNORM: MOVE B,A
PUSH P,0
MOVE @(I)[PIECEL+20 ? PIECEL]
SUBI BOARD
IDIVI 12
IDIVI B,12
SUB B,0
SUB C,A
MOVMS B
MOVMS C
CAIG B,3
CAILE C,3
SETZB B,C
CAILE B,(C)
EXCH B,C
MOVEI A,@(B)[0(C)? 4-1(C)? 4+3-2(C)? 4+3+2-3(C)]
POP P,0
POPJ P,
MOBIL: PUSH P,Q
MOVE 1(Q)
JSP V,MMOVE
MOVSI A,177
PUSH P,FLAGS
ANDCAM A,FLAGS
XORI I,1
PUSH P,TSAV
MOVEM T,TSAV
PUSH P,S
PUSHJ P,LMG
SUB T,TSAV
ASH T,-1
POP P,S
ADDI S,(T)
MOVE T,TSAV
POP P,TSAV
XORI I,1
POP P,FLAGS
JSP V,UNMOVE
POP P,Q
POPJ P,
PWNFLS: SETZM PNFILE
MOVE A,[PNFILE,,PNFILE+1]
BLT A,PNFILE+9
MOVSI A,-8
PWNF1: SKIPLE B,@(I)[PIECEL+10(A) ? PIECEL+30(A)]
SKIPE @(I)[PIECE+10(A) ? PIECE+30(A)]
JRST PWNF2
SUBI B,BOARD
IDIVI B,12
AOS PNFILE(C)
PWNF2: AOBJN A,PWNF1
POPJ P,
PNFILE: BLOCK 10.
PLCAS: LDB A,[ORIGIN]
MOVEI B,5
CAME B,@BOARD(A)
POPJ P,
MOVE B,FLAGS
TDNN B,MMVT3(I)
POPJ P,
HRROI B,-20. ; NON-CAS K MV FORFEITING CAS PRIVILEGE
CAMN MMVT4(I)
MOVEI B,30. ; O-O
CAMN MMVT5(I)
MOVEI B,25. ; O-O-O
ADD S,B
POPJ P,
PHEURS: LDB A,[ORIGIN]
SKIPE @BOARD(A)
JRST PHRS1 ; NOT A PAWN MOVE
CAMN (I)[101_7+125 ? 67_7+43]
ADDI S,30. ; P/K2-K4
CAMN (I)[100_7+124 ? 66_7+42]
ADDI S,16. ; P/Q2-Q4
CAME (I)[101_7+113 ? 67_7+55]
CAMN (I)[100_7+112 ? 66_7+54]
ADDI S,2 ; P/K3-K4 OR P/Q3-Q4
CAME (I)[113_7+125 ? 55_7+43]
CAMN (I)[112_7+124 ? 54_7+42]
ADDI S,8 ; P-K3 OR P-Q3
CAME (I)[75_7+121 ? 63_7+37]
CAMN (I)[104_7+130 ? 72_7+46]
SUBI S,5 ; P/R2-R4
SKIPN @(I)[@BOARD+125 ? @BOARD+43]
SKIPE @(I)[@BOARD+124 ? @BOARD+42]
JRST .+4
CAME A,(I)[125 ? 43]
CAMN A,(I)[124 ? 42]
ADDI S,3 ; MOVING A CENTER PAWN IF BOTH ARE UNMOVED
TRNN 740000
JRST PHRS2
ADD A,(I)[-12 ? 12]
PUSHJ P,CCNORM
MOVE D,A
LDB A,[DESTIN]
PUSHJ P,CCNORM
CAMLE A,D
ADDI S,5 ; CAPTURE TOWARDS CENTER
CAMGE A,D
SUBI S,5 ; CAPTURE AWAY FROM CENTER
LDB A,[ORIGIN]
IDIVI A,12
MOVE A,PNFILE(B)
SOJG A,PHRS4 ; JUMP IF MORE THAN ONE PAWN ON ORIGIN FILE
LDB C,[DESTIN]
IDIVI C,12
MOVEI A,(D)
ASH A,1
SUBI A,(B)
SKIPN PNFILE(A)
SUBI S,6 ; CAPTURE ISOLATES CAPTURING PAWN
SKIPE PNFILE(D)
SUBI S,12. ; DOUBLES CAPTURING PAWN, DOESN'T UNDOUBLE
PHRS4: LDB A,[DESTIN]
JRST PHRS3
PHRS2: LDB A,[ORIGIN] ; NON CAPTURING PAWN MOVE
IDIVI A,12
ADDI B,5
TRNE B,4
WPADV: SUBI S,10. ; WING PAWN ADVANCE
CAIE B,3+5
CAIN B,4+5
JRST BKWD1
CAIE B,5+5
CAIN B,6+5
JRST BKWD2
JRST PHRS2A
BKWD3: HRRZ D,PNFLS1(B) ? HLRZ D,PNFLS2(B)
BKWD1: SKIPA C,[1]
BKWD2: MOVEI C,-1
LDB A,[ORIGIN]
IDIVI A,12
XCT BKWD3(I)
CAME A,D
JRST PHRS2A ; ADVANCING PAWN NOT FARTHEST BACK ON FILE
LDB A,[DESTIN]
IDIVI A,12
ADDI B,(C)
XCT BKWD3(I)
XCT (I)[CAML A,D ? CAMG A,D]
JRST PHRS2A ; NOT ADV BEYOND NEIGHBOR
MOVE A,D
ADDI B,(C)
XCT BKWD3(I)
XCT (I)[CAMLE A,D ? CAMGE A,D]
SUBI S,15. ; MAKES CENTER PAWN BACKWARD
PHRS2A: POPJ P,
PHRS1A: MOVE B,@(I)[PIECEL+13 ? PIECEL+33]
CAMN B,(I)[BOARD+125 ? BOARD+43]
CAME A,(I)[113 ? 55]
JRST .+2
ADD S,C ; PIECE TO/FROM K3 BLOCKING/UNBLOCKING OWN PAWN
MOVE B,@(I)[PIECEL+14 ? PIECEL+34]
CAMN B,(I)[BOARD+124 ? BOARD+42]
CAME A,(I)[112 ? 54]
JRST .+2
ADD S,C ; PIECE TO/FROM Q3 BLOCKING/UNBLOCKING OWN PAWN
POPJ P,
PHRS1: MOVEI C,50. ; PIECE MOVE
PUSHJ P,PHRS1A ; ADD 50. FOR UNBLOCKING OWN UNMOVED CENTER PAWN
MOVNI C,50.
LDB A,[DESTIN]
PUSHJ P,PHRS1A ; SUB 50. FOR BLOCKING OWN UNMOVED CENTER PAWN
TRNN 740000
POPJ P,
PHRS3: SKIPE @BOARD(A) ; MAY REFERENCE AC0
SKIPN BOARD(A)
JRST .+2
POPJ P, ; CAPTURES A PIECE
IDIVI A,12
CAIE B,4
CAIN B,5
JRST .+2
POPJ P,
LDB B,[ORIGIN]
SKIPN @BOARD(B)
ADDI S,20. ; BONUS IF TAKING WITH PAWN
ADDI S,20. ; CAPTURING A CENTER PAWN
LDB A,[DESTIN]
SKIPLE B,@(I)[BOARD-13(A) ? BOARD+11(A)]
XCT (I)[CAIGE B,PIECE+20 ? CAIL B,PIECE+20]
JRST PHRS5
SKIPN (B)
JRST PHRS6
PHRS5: SKIPLE B,@(I)[BOARD-11(A) ? BOARD+13(A)]
XCT (I)[CAIGE B,PIECE+20 ? CAIL B,PIECE+20]
JRST PHRS7
SKIPN (B)
PHRS6: SUBI S,35. ; PAWN WAS DEFENDED BY A PAWN
PHRS7: POPJ P,
PLAUS1: MOVEI 1950.
CAMG WPCS
CAMLE BPCS
JRST PLAUS2 ; ENDGAME
MOVEI 5
HRRM WPADV
PUSHJ P,PWNFLS
MGPLS1: CAIL Q,(T)
POPJ P,
HRRZ 1(Q)
LDB A,[DESTIN]
PUSHJ P,CCNORM
MOVE S,A
LDB A,[ORIGIN]
PUSHJ P,CCNORM
SUB S,A
LDB A,[DESTIN]
PUSHJ P,KFNORM
ADD S,MDKF(A)
LDB A,[ORIGIN]
MOVE D,@BOARD(A)
PUSHJ P,KFNORM
SUB S,MDKF(A)
IMUL S,MDGPCM(D)
PUSHJ P,PLCAS
PUSHJ P,PHEURS
PUSHJ P,MOBIL ; ADD MOBILITY TERM
ADDI S,60. ; CONSTANT
MOVEM S,2(Q)
ADDI Q,2
JRST MGPLS1
PNFLS1: BLOCK 10. ; W PAWNS ON FILES ; LOW RANK IN LH, 11. IF NO PAWN
PNFLS2: BLOCK 10. ; B PAWNS ON FILES ; HIGH RANK IN RH, 0 IF NO PAWN
; RANK # = SQ# / 12
PTABUL: MOVSI A,11.
MOVEM A,PNFLS1
MOVE [PNFLS1,,PNFLS1+1]
BLT PNFLS1+19.
PUSHJ P,PTBL2 ; 0 IN RH OF A
AOJA A,PTBL2 ; 1 IN RH OF A
PTBL2: MOVE B,(A)[-8,,10 ? -8,,30]
PTBL3: SKIPL C,PIECEL(B) ? SKIPE PIECE(B) ? JRST PTBL4
SUBI C,BOARD ? IDIVI C,12
MOVE E,@PTBL5(A) ? CAILE C,(E) ? HRRM C,@PTBL5(A)
MOVSS E ? CAIGE C,(E) ? HRLM C,@PTBL5(A)
PTBL4: AOBJN B,PTBL3
POPJ P,
PTBL5: PNFLS1(D) ? PNFLS2(D)
PLAUS2: MOVSI A,-40
SKIPL PIECEL(A)
SKIPE PIECE(A)
AOBJN A,.-2
JUMPL A,PLAUS3 ; JUMP IF AT LEAST 1 PAWN ON BOARD
SETOM NACTIV ; DON'T USE ACTIVE SCHEMA IN PAWNLESS ENDGAME
MOVE [JRST EVEGPC] ? MOVEM EVAL1 ; USE SPECIAL EVALUATION FUNCTION
HRRZM I,ISAV'
MOVEI 675.
CAME WPCS(I) ; SKIP IF WE HAVE JUST N & B
POPJ P,
MOVE A,(I)[-14,,PIECEL+4 ? -14,,PIECEL+24]
MOVEI 2
SKIPL B,(A)
CAME PIECE-PIECEL(A)
AOBJN A,.-2
SUBI B,BOARD
IDIVI B,12
XOR B,C
ANDI B,1 ; 0 IF B ON BLACK, 1 IF ON WHITE
MOVE (B)[JFCL ? SETCMI B,-9-1(B)]
MOVEM TENT1
MOVE [JRST TENT] ? MOVEM EGPC9+1
POPJ P,
EVEGPC: EXCH I,ISAV ; ENDGAME WITH PIECES ONLY
MOVE A,WPCS(I)
SUB A,@MMVT9(I)
MOVEM A,ASAV' ; TECH2'S MATERIAL ADVANTAGE
MOVE A,@(I)[PIECEL+20 ? PIECEL]
SUBI A,BOARD
PUSHJ P,CCNORM
ASH A,5
SUBM A,ASAV ; 32*<OPP'S KING'S CENTRALITY>-<TECH2'S MATERIAL ADV>
MOVE A,@ICHT1(I)
SUBI A,BOARD
PUSHJ P,KFNORM
MOVE A,EGPCKF(A)
ASH A,4
SUBM A,ASAV ; <TECH2'S MTRL ADV>-32*<OPP'S K CENT>+16*<K PROXIMITY TO K>
MOVE A,@ICHT1(I)
SUBI A,BOARD
PUSHJ P,CCNORM
ADDM A,ASAV ; ADD TECH2'S K CENTRALITY
SETZB E,F
MOVE Q,(I)[-17,, ? -17,,20]
XORI I,1
EGPC1: SKIPG A,PIECEL+1(Q)
JRST EGPC9
SUBI A,BOARD
PUSHJ P,KFNORM
ADD E,EGPCKF(A)
AOJ F,
EGPC9: AOBJN Q,EGPC1
XORI I,1 ; PROGRAM MODIFIED
IDIVI E,(F)
ADDM E,ASAV ; ADD <SUM OF PROXIMITIES OF T'S PIECES TO T'S K>/<# OF T'S NON-K PIECES>
EXCH I,ISAV
MOVEI B,(I)
CAMN B,ISAV
SKIPA A,ASAV
MOVN A,ASAV ; NEGATE IF SIDE TO MOVE ISN'T TECH II
JRST EVAL1+1
TENT: MOVE A,@ICHT1(I) ; USED WHEN TECH HAS N & B
XORI I,1
SUBI A,BOARD
IDIVI A,12
TENT1: JFCL ; IF B ON WHITE, USE MIRROR IMAGE OF BOARD
SUBI A,1(B)
MOVM A,A
IMULI A,60
ADDM A,ASAV ; ADD FUNCTION WHOSE VALUE IS 7*48
JRST EGPC9+2 ; FOR CORNERS CONTROLLED BY B,
; SLOPING DOWN FROM 0 ON DIAGONAL THRU
; CORNERS NOT CONTROLLED BY B
EGPNH: LDB A,[ORIGIN]
SKIPE @BOARD(A)
POPJ P, ; NOT A PAWN
IDIVI A,12
XCT (I)[MOVS C,PNFLS1(B) ? MOVE C,PNFLS2(B)]
CAIE A,(C)
JRST [SUBI S,10. ? POPJ P,] ; NOT FIRST PAWN ON FILE
LDB A,[DESTIN]
IDIVI A,12
XCT (I)[SETCMI C,-12.(A) ? MOVEI C,(A)]
XCT (I)[MOVS D,PNFLS2(B) ? MOVE D,PNFLS1(B)]
XCT EGPNH2(I)
JRST EGPNH1
XCT (I)[MOVS D,PNFLS2-1(B) ? MOVE D,PNFLS1-1(B)]
XCT EGPNH2(I)
JRST EGPNH1
XCT (I)[MOVS D,PNFLS2+1(B) ? MOVE D,PNFLS1+1(B)]
XCT EGPNH2(I)
JRST EGPNH1
ADD S,NOPPSD-4(C) ; ADVANCING A PASSED PAWN, WEIGHT BY DESTIN RANK
POPJ P,
EGPNH1: ADD S,OPPSD-4(C) ; ADVANCING A NON-PASSED PAWN
POPJ P,
EGPNH2: CAILE A,(D) ? CAIGE A,(D)
OPPSD: 2 ? 1 ? 3 ? 4
NOPPSD: 3 ? 7 ? 10. ? 13. ? 23. ? 80.
PLAUS3: MOVE A,(I)[-17,,? -17,,20]
SKIPL PIECEL+1(A)
SKIPN PIECE+1(A)
AOBJN A,.-2
JUMPL A,PLAUS4 ; GENERAL ENDGAME
SETOM NACTIV ; DON'T USE ACTIVE SCHEMA IN PAWN ENDGAME
EGPN1: CAIL Q,(T) ; PAWN ENDGAME
POPJ P,
MOVE 1(Q)
TRNE 740000
SKIPA S,[65.] ; CAPTURE PLUS CONSTANT
MOVEI S,50. ; CONSTANT
PUSHJ P,EGPNH ; ADD BONUS FOR PAWN MOVES
LDB A,[ORIGIN]
MOVE B,@BOARD(A)
CAIE B,5 ; SKIP IF KING MOVE
JRST EGPN2
PUSHJ P,CCNORM
SUB S,A
LDB A,[DESTIN]
PUSHJ P,CCNORM
ADD S,A
LDB A,[ORIGIN]
LDB B,[DESTIN]
SUBI A,(B)
IDIV A,(I)[3 ? -3]
ADD S,A ; BONUS FOR KING ADVANCE
LDB A,[ORIGIN]
PUSHJ P,KFNORM
SUB S,EGPNKF(A)
LDB A,[DESTIN]
PUSHJ P,KFNORM
ADD S,EGPNKF(A)
PUSHJ P,PPFH ; PASSED PAWN FIELD HEURISTICS
ORIGIN
SUB S,R
PUSHJ P,PPFH
DESTIN
ADD S,R
EGPN2: MOVEM S,2(Q)
ADDI Q,2
JRST EGPN1
PPFH: MOVEI R,
MOVSI A,-8
IRP Z1,,[1,2]Z2,,[2,1]Z3,,[L,G]Z4,,[G,L]Z5,,[L,R]Z6,,[2,9] ; US,,[WHITE,BLACK]
PPFH!Z1: H!Z5!RZ B,PNFLS!Z1+1(A) ; ROW OF OUR MOST ADV P ON THIS FILE
H!Z5!RZ C,PNFLS!Z2+1(A) ; ROW OF HIS LEAST ADV PAWN ON THIS FILE
H!Z5!RZ D,PNFLS!Z2(A) ; ROW OF HIS LEAST ADV PAWN ON LEFT ADJ FILE
CAI!Z4!E B,(C) ; SKIP IF BLOCKED OR NO PAWN
CAI!Z3!E B,(D) ; SKIP IF NOT OPPOSED ON LEFT ADJ FILE
JRST PPFH!Z6 ; PAWN NON-EXISTENT OR NOT PASSED
H!Z5!RZ C,PNFLS!Z2+2(A) ; ROW OF HIS LEAST ADV PAWN ON RIGHT ADJ FILE
CAI!Z4 B,(C) ; SKIP IF OPPOSED ON RIGHT ADJ FILE
PUSHJ P,PPF2H!Z1 ; PAWN IS PASSED, ADD FIELD TERM
TERMIN
PPFH9: AOBJNOA,PPFH1ILES
JRST CPOPJ1
PPF2H1: TDZA C,C
PPF2H2: MOVEI C,1
LDB E,@-1(P)
IDIVI E,12
SUBI E,(B)
SUBI F,1(A)
MOVMS F
SKIPG C
MOVNS E
JUMPL E,CPOPJ
CAIG E,4
CAILE F,2
POPJ P,
IMULI E,3
ADDI E,(F)
XOR C,I
ADD R,@(C)[OWNPWN(E) ? OPPPWN(E)]
POPJ P,
PLAUS4: MOVE A,(I)[-20,,20 ? -20,,]
MOVEI 4
SKIPL PIECEL(A)
CAME PIECE(A)
AOBJN A,.-2
JUMPG A,.+2
SETO ; DON'T CENTRALIZE K IF ENEMY HAS Q
MOVEM EGGPCM+5
PLS4A: CAIL Q,(T)
POPJ P,
MOVE 1(Q)
LDB A,[ORIGIN]
PUSHJ P,CCNORM
MOVN S,A
LDB A,[DESTIN]
PUSHJ P,CCNORM
ADD S,A
LDB A,[ORIGIN]
MOVE B,@BOARD(A)
IMUL S,EGGPCM(B)
MOVEI B,5
CAME B,@BOARD(A)
JRST EGGN2
PUSHJ P,KFNORM
SUB S,EGGNKF(A)
LDB A,[DESTIN]
PUSHJ P,KFNORM
ADD S,EGGNKF(A)
EGGN2: PUSHJ P,MOBIL
PUSHJ P,EGPNH
LDB A,[ORIGIN]
MOVEI B,3
CAME B,@BOARD(A)
JRST EGGN9
LDB B,[DESTIN] ; ROOK MOVE
SUB B,A
MOVMS B
CAIL B,12
JRST EGGN9 ; ROOK MOVING ALONG FILE
LDB A,[DESTIN]
IDIVI A,12
IRP Z1,,[L,R]Z2,,[L,G]Z3,,[G,L]Z4,,[3,9]Z6,,[1,2]Z7,,[2,1]
H!Z1!RZ C,PNFLS!Z6(B)
H!Z1!RZ D,PNFLS!Z7(B)
CAI!Z2 A,(C) ; SKIP IF NO PAWN OR IN FRONT OF PAWN
CAI!Z3 D,(C) ; SKIP IF UNBLOCKED IN FILE
JRST EGGN!Z4
H!Z1!RZ A,PNFLS!Z7-1(B)
H!Z1!RZ D,PNFLS!Z7+1(B)
CAI!Z2 A,(C) ; SKIP IF OPPOSED 1 FILE TO Q-SIDE
CAI!Z3!E D,(C) ; SKIP IF NOT OFFOSED 1 FILE TO K-SIDE
JRST EGGN!Z4
CAI!Z3 C,4+Z7 ; SKIP IF FOREMOST PAWN NOT BEYOND 3RD RANK
ADDI S,15. ; ROOK BEHIND (OR TAKES) FOREMOST PASSED PAWN
EGGN!Z4:
TERMIN
TRNE 740000
ADDI S,15. ; CAPTURE
ADDI S,50. ; CONSTANT
MOVEM S,2(Q)
ADDI Q,2
JRST PLS4A
CONSTA?VARIAB?
PAT:
PATCH: BLOCK 40. ? EQV
TOP:
END GO