|
|
@@ -11,10 +11,10 @@
|
|
|
|
;***********************************************************
|
|
|
|
;***********************************************************
|
|
|
|
; SYSTEM EQUATES
|
|
|
|
; SYSTEM EQUATES
|
|
|
|
;***********************************************************
|
|
|
|
;***********************************************************
|
|
|
|
INCHAR EQU 1
|
|
|
|
INCHAR: EQU 1
|
|
|
|
PRINTBUF EQU 9
|
|
|
|
PRINTBUF:EQU 9
|
|
|
|
INBUF EQU 10
|
|
|
|
INBUF: EQU 10
|
|
|
|
SYSTEM EQU 5
|
|
|
|
SYSTEM: EQU 5
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;***********************************************************
|
|
|
|
; EQUATES
|
|
|
|
; EQUATES
|
|
|
@@ -96,7 +96,7 @@ START:
|
|
|
|
ORG START+80H
|
|
|
|
ORG START+80H
|
|
|
|
PUT START+80H
|
|
|
|
PUT START+80H
|
|
|
|
TBASE: EQU START+100H
|
|
|
|
TBASE: EQU START+100H
|
|
|
|
;**********************************************************
|
|
|
|
;***********************************************************
|
|
|
|
; DIRECT -- Direction Table. Used to determine the dir-
|
|
|
|
; DIRECT -- Direction Table. Used to determine the dir-
|
|
|
|
; ection of movement of each piece.
|
|
|
|
; ection of movement of each piece.
|
|
|
|
;***********************************************************
|
|
|
|
;***********************************************************
|
|
|
@@ -163,8 +163,8 @@ PIECES: EQU $-TBASE
|
|
|
|
; 1 -- Black
|
|
|
|
; 1 -- Black
|
|
|
|
; 0 -- White
|
|
|
|
; 0 -- White
|
|
|
|
; Bit 6 -- Not used
|
|
|
|
; Bit 6 -- Not used
|
|
|
|
; Bit 5 -- Not used
|
|
|
|
; Bit 5 -- Pawn attack flag for ATTACK
|
|
|
|
; Bit 4 --Castle flag for Kings only
|
|
|
|
; Bit 4 -- Castle flag for Kings only
|
|
|
|
; Bit 3 -- Piece has moved flag
|
|
|
|
; Bit 3 -- Piece has moved flag
|
|
|
|
; Bits 2-0 Piece type
|
|
|
|
; Bits 2-0 Piece type
|
|
|
|
; 1 -- Pawn
|
|
|
|
; 1 -- Pawn
|
|
|
@@ -213,35 +213,35 @@ PLISTA: DW 0,0,0,0,0,0,0,0,0,0
|
|
|
|
; the black king.
|
|
|
|
; the black king.
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; POSQ -- Position of Queens. Like POSK,but for queens.
|
|
|
|
; POSQ -- Position of Queens. Like POSK,but for queens.
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
POSK: DB 24,95
|
|
|
|
POSK: DB 24,95
|
|
|
|
POSQ: DB 14,94
|
|
|
|
POSQ: DB 14,94
|
|
|
|
DB -1
|
|
|
|
DB -1
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; SCORE -- Score Array. Used during Alpha-Beta pruning to
|
|
|
|
; SCORE -- Score Array. Used during Alpha-Beta pruning to
|
|
|
|
; hold the scores at each ply. It includes two
|
|
|
|
; hold the scores at each ply. It includes two
|
|
|
|
; "dummy" entries for ply -1 and ply 0.
|
|
|
|
; "dummy" entries for ply -1 and ply 0.
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
SCORE: DW 0,0,0,0,0,0
|
|
|
|
SCORE: DW 0,0,0,0,0,0
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; PLYIX -- Ply Table. Contains pairs of pointers, a pair
|
|
|
|
; PLYIX -- Ply Table. Contains pairs of pointers, a pair
|
|
|
|
; for each ply. The first pointer points to the
|
|
|
|
; for each ply. The first pointer points to the
|
|
|
|
; top of the list of possible moves at that ply.
|
|
|
|
; top of the list of possible moves at that ply.
|
|
|
|
; The second pointer points to which move in the
|
|
|
|
; The second pointer points to which move in the
|
|
|
|
; list is the one currently being considered.
|
|
|
|
; list is the one currently being considered.
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
PLYIX: DW 0,0,0,0,0,0,0,0,0,0
|
|
|
|
PLYIX: DW 0,0,0,0,0,0,0,0,0,0
|
|
|
|
DW 0,0,0,0,0,0,0,0,0,0
|
|
|
|
DW 0,0,0,0,0,0,0,0,0,0
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; STACK -- Contains the stack for the program.
|
|
|
|
; STACK -- Contains the stack for the program.
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
ORG START+2FFH
|
|
|
|
ORG START+2FFH
|
|
|
|
STACK:
|
|
|
|
STACK:
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; TABLE INDICES SECTION
|
|
|
|
; TABLE INDICES SECTION
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; M1-M4 -- Working indices used to index into
|
|
|
|
; M1-M4 -- Working indices used to index into
|
|
|
@@ -275,7 +275,7 @@ STACK:
|
|
|
|
; MLNXT -- Pointer to the next available space in the move
|
|
|
|
; MLNXT -- Pointer to the next available space in the move
|
|
|
|
; list.
|
|
|
|
; list.
|
|
|
|
;
|
|
|
|
;
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
ORG START+0
|
|
|
|
ORG START+0
|
|
|
|
PUT START+0
|
|
|
|
PUT START+0
|
|
|
|
M1: DW TBASE
|
|
|
|
M1: DW TBASE
|
|
|
@@ -295,7 +295,7 @@ BESTM: DW 0
|
|
|
|
MLLST: DW 0
|
|
|
|
MLLST: DW 0
|
|
|
|
MLNXT: DW MLIST
|
|
|
|
MLNXT: DW MLIST
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; VARIABLES SECTION
|
|
|
|
; VARIABLES SECTION
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; KOLOR -- Indicates computer's color. White is 0, and
|
|
|
|
; KOLOR -- Indicates computer's color. White is 0, and
|
|
|
@@ -355,7 +355,7 @@ MLNXT: DW MLIST
|
|
|
|
; BMOVES -- Our very tiny book of openings. Determines
|
|
|
|
; BMOVES -- Our very tiny book of openings. Determines
|
|
|
|
; the first move for the computer.
|
|
|
|
; the first move for the computer.
|
|
|
|
;
|
|
|
|
;
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
KOLOR: DB 0
|
|
|
|
KOLOR: DB 0
|
|
|
|
COLOR: DB 0
|
|
|
|
COLOR: DB 0
|
|
|
|
P1: DB 0
|
|
|
|
P1: DB 0
|
|
|
@@ -381,7 +381,7 @@ BMOVES: DB 35,55,10H
|
|
|
|
DB 85,65,10H
|
|
|
|
DB 85,65,10H
|
|
|
|
DB 84,64,10H
|
|
|
|
DB 84,64,10H
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; MOVE LIST SECTION
|
|
|
|
; MOVE LIST SECTION
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; MLIST -- A 2048 byte storage area for generated moves.
|
|
|
|
; MLIST -- A 2048 byte storage area for generated moves.
|
|
|
@@ -424,7 +424,7 @@ BMOVES: DB 35,55,10H
|
|
|
|
; MLVAL -- The field in the move entry which contains the
|
|
|
|
; MLVAL -- The field in the move entry which contains the
|
|
|
|
; score assigned to the move.
|
|
|
|
; score assigned to the move.
|
|
|
|
;
|
|
|
|
;
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
ORG START+300H
|
|
|
|
ORG START+300H
|
|
|
|
PUT START+300H
|
|
|
|
PUT START+300H
|
|
|
|
MLIST: DS 2048
|
|
|
|
MLIST: DS 2048
|
|
|
@@ -435,11 +435,11 @@ MLTOP: EQU 3
|
|
|
|
MLFLG: EQU 4
|
|
|
|
MLFLG: EQU 4
|
|
|
|
MLVAL: EQU 5
|
|
|
|
MLVAL: EQU 5
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; PROGRAM CODE SECTION
|
|
|
|
; PROGRAM CODE SECTION
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; BOARD SETUP ROUTINE
|
|
|
|
; BOARD SETUP ROUTINE
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; FUNCTION: To initialize the board array, setting the
|
|
|
|
; FUNCTION: To initialize the board array, setting the
|
|
|
|
; pieces in their initial positions for the
|
|
|
|
; pieces in their initial positions for the
|
|
|
|
; start of the game.
|
|
|
|
; start of the game.
|
|
|
@@ -449,7 +449,7 @@ MLVAL: EQU 5
|
|
|
|
; CALLS: None
|
|
|
|
; CALLS: None
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; ARGUMENTS: None
|
|
|
|
; ARGUMENTS: None
|
|
|
|
;***********************************************************
|
|
|
|
;*************************************************************
|
|
|
|
INITBD: MOV CX,60 ; Pre-fill board with -1's
|
|
|
|
INITBD: MOV CX,60 ; Pre-fill board with -1's
|
|
|
|
MOV DI,BOARDA
|
|
|
|
MOV DI,BOARDA
|
|
|
|
MOV AX,-1
|
|
|
|
MOV AX,-1
|
|
|
@@ -479,16 +479,16 @@ IB2: MOV AL,[SI-8] ; Fill non-border squares
|
|
|
|
MOV B,[SI+3],94
|
|
|
|
MOV B,[SI+3],94
|
|
|
|
RET
|
|
|
|
RET
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; PATH ROUTINE
|
|
|
|
; PATH ROUTINE
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; FUNCTION: To generate a single possible move for a given
|
|
|
|
; FUNCTION: To generate a single possible move for a given
|
|
|
|
; piece along its current path of motion including:
|
|
|
|
; piece along its current path of motion including:
|
|
|
|
|
|
|
|
;
|
|
|
|
; Fetching the contents of the board at the new
|
|
|
|
; Fetching the contents of the board at the new
|
|
|
|
; position, and setting a flag describing the
|
|
|
|
; position, and setting a flag describing the
|
|
|
|
; contents:
|
|
|
|
; contents:
|
|
|
|
; 0 -- New position is empty
|
|
|
|
; 0 -- New postion is empty
|
|
|
|
; 1 -- Encountered a piece of the
|
|
|
|
; 1 -- Encountered a piece of the
|
|
|
|
; opposite color
|
|
|
|
; opposite color
|
|
|
|
; 2 -- Encountered a piece of the
|
|
|
|
; 2 -- Encountered a piece of the
|
|
|
@@ -504,7 +504,7 @@ IB2: MOV AL,[SI-8] ; Fill non-border squares
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; ARGUMENTS: Direction from the direction array giving the
|
|
|
|
; ARGUMENTS: Direction from the direction array giving the
|
|
|
|
; constant to be added for the new position.
|
|
|
|
; constant to be added for the new position.
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
PATH: ADD [M2],CL ; Add direction constant to previous position
|
|
|
|
PATH: ADD [M2],CL ; Add direction constant to previous position
|
|
|
|
MOV SI,[M2] ; Load board index
|
|
|
|
MOV SI,[M2] ; Load board index
|
|
|
|
MOV AL,[SI+BOARD] ; Get contents of board
|
|
|
|
MOV AL,[SI+BOARD] ; Get contents of board
|
|
|
@@ -523,9 +523,9 @@ PATH: ADD [M2],CL ; Add direction constant to previous position
|
|
|
|
PA2: MOV AL,3 ; Set off board flag
|
|
|
|
PA2: MOV AL,3 ; Set off board flag
|
|
|
|
RET
|
|
|
|
RET
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; PIECE MOVER ROUTINE
|
|
|
|
; PIECE MOVER ROUTINE
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; FUNCTION: To generate all the possible legal moves for a
|
|
|
|
; FUNCTION: To generate all the possible legal moves for a
|
|
|
|
; given piece.
|
|
|
|
; given piece.
|
|
|
|
;
|
|
|
|
;
|
|
|
@@ -537,7 +537,7 @@ PA2: MOV AL,3 ; Set off board flag
|
|
|
|
; ENPSNT
|
|
|
|
; ENPSNT
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; ARGUMENTS: The piece to be moved.
|
|
|
|
; ARGUMENTS: The piece to be moved.
|
|
|
|
;***********************************************************
|
|
|
|
;*************************************************************
|
|
|
|
MPIECE: XOR AL,[BX] ; Piece to move
|
|
|
|
MPIECE: XOR AL,[BX] ; Piece to move
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
CMP AL,BPAWN ; Is it a black Pawn ?
|
|
|
|
CMP AL,BPAWN ; Is it a black Pawn ?
|
|
|
@@ -624,7 +624,7 @@ MP36: CALL ENPSNT ; Try en passant capture
|
|
|
|
; ADJPTR
|
|
|
|
; ADJPTR
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; ARGUMENTS: -- None
|
|
|
|
; ARGUMENTS: -- None
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
ENPSNT: MOV AL,[M1] ; Set position of Pawn
|
|
|
|
ENPSNT: MOV AL,[M1] ; Set position of Pawn
|
|
|
|
TEST B,[P1],080H ; Check color, is it white ?
|
|
|
|
TEST B,[P1],080H ; Check color, is it white ?
|
|
|
|
JZ EP5 ; Yes - skip
|
|
|
|
JZ EP5 ; Yes - skip
|
|
|
@@ -665,9 +665,9 @@ EP10: CMP AL,10 ; Is difference 10 ?
|
|
|
|
MOV AL,[M3] ; Restore "from" position
|
|
|
|
MOV AL,[M3] ; Restore "from" position
|
|
|
|
MOV [M1],AL
|
|
|
|
MOV [M1],AL
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; ADJUST MOVE LIST POINTER FOR DOUBLE MOVE
|
|
|
|
; ADJUST MOVE LIST POINTER FOR DOUBLE MOVE
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; FUNCTION: -- To adjust move list pointer to link around
|
|
|
|
; FUNCTION: -- To adjust move list pointer to link around
|
|
|
|
; second move in double move.
|
|
|
|
; second move in double move.
|
|
|
|
;
|
|
|
|
;
|
|
|
@@ -679,16 +679,16 @@ EP10: CMP AL,10 ; Is difference 10 ?
|
|
|
|
; CALLS: -- None
|
|
|
|
; CALLS: -- None
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; ARGUMENTS: -- None
|
|
|
|
; ARGUMENTS: -- None
|
|
|
|
;***********************************************************
|
|
|
|
;*************************************************************
|
|
|
|
ADJPTR: MOV BX,[MLLST] ; Get list pointer
|
|
|
|
ADJPTR: MOV BX,[MLLST] ; Get list pointer
|
|
|
|
SUB BX,6 ; Back up list pointer
|
|
|
|
SUB BX,6 ; Back up list pointer
|
|
|
|
MOV [MLLST],BX ; Save list pointer
|
|
|
|
MOV [MLLST],BX ; Save list pointer
|
|
|
|
MOV [BX],0 ; Zero out link
|
|
|
|
MOV [BX],0 ; Zero out link
|
|
|
|
RET ; Return
|
|
|
|
RET ; Return
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; CASTLE ROUTINE
|
|
|
|
; CASTLE ROUTINE
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; FUNCTION: -- To determine whether castling is legal
|
|
|
|
; FUNCTION: -- To determine whether castling is legal
|
|
|
|
; (Queen side, King side, or both) and add it
|
|
|
|
; (Queen side, King side, or both) and add it
|
|
|
|
; to the move list if it is.
|
|
|
|
; to the move list if it is.
|
|
|
@@ -700,7 +700,7 @@ ADJPTR: MOV BX,[MLLST] ; Get list pointer
|
|
|
|
; ADJPTR
|
|
|
|
; ADJPTR
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; ARGUMENTS: -- None
|
|
|
|
; ARGUMENTS: -- None
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
CASTLE:
|
|
|
|
CASTLE:
|
|
|
|
TEST B,[P1],008H ; Has king moved ?
|
|
|
|
TEST B,[P1],008H ; Has king moved ?
|
|
|
|
JNZ RET ; Yes - return
|
|
|
|
JNZ RET ; Yes - return
|
|
|
@@ -759,9 +759,9 @@ CA20: MOV AL,CH ; Scan Index
|
|
|
|
MOV CX,01FCH ; Set Queen-side initial values
|
|
|
|
MOV CX,01FCH ; Set Queen-side initial values
|
|
|
|
JMP CA5 ; Jump
|
|
|
|
JMP CA5 ; Jump
|
|
|
|
|
|
|
|
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; ADMOVE ROUTINE
|
|
|
|
; ADMOVE ROUTINE
|
|
|
|
;***********************************************************
|
|
|
|
;************************************************************
|
|
|
|
; FUNCTION: -- To add a move to the move list
|
|
|
|
; FUNCTION: -- To add a move to the move list
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; CALLED BY: -- MPIECE
|
|
|
|
; CALLED BY: -- MPIECE
|
|
|
@@ -771,7 +771,7 @@ CA20: MOV AL,CH ; Scan Index
|
|
|
|
; CALLS: -- None
|
|
|
|
; CALLS: -- None
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; ARGUMENT: -- None
|
|
|
|
; ARGUMENT: -- None
|
|
|
|
;***********************************************************
|
|
|
|
;*************************************************************
|
|
|
|
ADMOVE: MOV DX,[MLNXT] ; Addr of next loc in move list
|
|
|
|
ADMOVE: MOV DX,[MLNXT] ; Addr of next loc in move list
|
|
|
|
MOV BX,MLEND ; Address of list end
|
|
|
|
MOV BX,MLEND ; Address of list end
|
|
|
|
SUB BX,DX ; Calculate difference
|
|
|
|
SUB BX,DX ; Calculate difference
|
|
|
@@ -915,27 +915,27 @@ ATTACK: PUSH CX ; Save Register CX
|
|
|
|
CALL ATKADJ ; Scan adjacent squares
|
|
|
|
CALL ATKADJ ; Scan adjacent squares
|
|
|
|
MOV AH,KNIGHT ; Check for a Knight
|
|
|
|
MOV AH,KNIGHT ; Check for a Knight
|
|
|
|
CALL ATKADJ ; Scan adjacent squares
|
|
|
|
CALL ATKADJ ; Scan adjacent squares
|
|
|
|
MOV AH,20H ; Bit 5 set
|
|
|
|
MOV AH,20H ; Pawn attack flag
|
|
|
|
MOV AL,[BP+11] ; Get piece at +11
|
|
|
|
MOV AL,[BP+11] ; Get piece at +11
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
CMP AL,BPAWN ; Black Pawn ?
|
|
|
|
CMP AL,BPAWN ; Black Pawn ?
|
|
|
|
JNZ AT5 ; No - jump
|
|
|
|
JNZ AT5 ; No - jump
|
|
|
|
OR [BP+11],AH ; Turn on bit 5
|
|
|
|
OR [BP+11],AH ; Set Pawn attack flag
|
|
|
|
AT5: MOV AL,[BP+9] ; Get piece at +9
|
|
|
|
AT5: MOV AL,[BP+9] ; Get piece at +9
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
CMP AL,BPAWN ; Black Pawn ?
|
|
|
|
CMP AL,BPAWN ; Black Pawn ?
|
|
|
|
JNZ AT10 ; No - jump
|
|
|
|
JNZ AT10 ; No - jump
|
|
|
|
OR [BP+9],AH ; Turn on bit 5
|
|
|
|
OR [BP+9],AH ; Set Pawn attack flag
|
|
|
|
AT10: MOV AL,[BP-11] ; Get piece at -11
|
|
|
|
AT10: MOV AL,[BP-11] ; Get piece at -11
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
CMP AL,PAWN ; White Pawn ?
|
|
|
|
CMP AL,PAWN ; White Pawn ?
|
|
|
|
JNZ AT15 ; No - jump
|
|
|
|
JNZ AT15 ; No - jump
|
|
|
|
OR [BP-11],AH ; Turn on bit 5
|
|
|
|
OR [BP-11],AH ; Set Pawn attack flag
|
|
|
|
AT15: MOV AL,[BP-9] ; Get piece at -9
|
|
|
|
AT15: MOV AL,[BP-9] ; Get piece at -9
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
AND AL,87H ; Clear flag bit
|
|
|
|
CMP AL,PAWN ; White Pawn ?
|
|
|
|
CMP AL,PAWN ; White Pawn ?
|
|
|
|
JNZ AT20 ; No - jump
|
|
|
|
JNZ AT20 ; No - jump
|
|
|
|
OR [BP-9],AH ; Turn on bit 5
|
|
|
|
OR [BP-9],AH ; Set Pawn attack flag
|
|
|
|
AT20: MOV SI,DIRECT+TBASE ; Load direction table
|
|
|
|
AT20: MOV SI,DIRECT+TBASE ; Load direction table
|
|
|
|
MOV AH,BISHOP ; Check for a Bishop
|
|
|
|
MOV AH,BISHOP ; Check for a Bishop
|
|
|
|
CALL ATKOUT ; Scan outwards
|
|
|
|
CALL ATKOUT ; Scan outwards
|
|
|
@@ -994,20 +994,20 @@ AO5: MOV DX,0C0H ; Bitmask for color flags
|
|
|
|
MOV DI,BP ; Load pointer to piece
|
|
|
|
MOV DI,BP ; Load pointer to piece
|
|
|
|
AO10: ADD DI,BX ; Add direction constant
|
|
|
|
AO10: ADD DI,BX ; Add direction constant
|
|
|
|
MOV AL,[DI] ; Get attacking piece
|
|
|
|
MOV AL,[DI] ; Get attacking piece
|
|
|
|
AND AL,27H ; Get piece type and bit 5
|
|
|
|
AND AL,27H ; Get piece type and Pawn attack flag
|
|
|
|
JZ AO10 ; No piece, keep going
|
|
|
|
JZ AO10 ; No piece, keep going
|
|
|
|
CMP AL,AH ; Same as what we want ?
|
|
|
|
CMP AL,AH ; Same as what we want ?
|
|
|
|
JZ AO22 ; Yes - jump
|
|
|
|
JZ AO22 ; Yes - jump
|
|
|
|
CMP AL,QUEEN ; Queen ?
|
|
|
|
CMP AL,QUEEN ; Queen ?
|
|
|
|
JZ AO20 ; Yes - jump
|
|
|
|
JZ AO20 ; Yes - jump
|
|
|
|
CMP AL,PAWN+20H ; Pawn with bit 5 ?
|
|
|
|
CMP AL,PAWN+20H ; Pawn with Pawn attack flag ?
|
|
|
|
JZ AO21 ; Yes - jump
|
|
|
|
JZ AO21 ; Yes - jump
|
|
|
|
AO15: LOOP AO5 ; Go check for next direction
|
|
|
|
AO15: LOOP AO5 ; Go check for next direction
|
|
|
|
RET ; Return
|
|
|
|
RET ; Return
|
|
|
|
AO20: INC DH ; Set Queen found flag
|
|
|
|
AO20: INC DH ; Set Queen found flag
|
|
|
|
AO21: AND B,[DI],0DFH ; Remove bit 5 for piece
|
|
|
|
AO21: AND B,[DI],0DFH ; Remove Pawn attack flag
|
|
|
|
AO22: MOV AL,[DI] ; Get piece
|
|
|
|
AO22: MOV AL,[DI] ; Get piece
|
|
|
|
ADD AL,80H ; CY if back, NC if white
|
|
|
|
ADD AL,80H ; CY if black, NC if white
|
|
|
|
RCR AL ; Bit 7 set if black, bit 6 if white
|
|
|
|
RCR AL ; Bit 7 set if black, bit 6 if white
|
|
|
|
AND DL,AL ; Keep only bits 6 and 7
|
|
|
|
AND DL,AL ; Keep only bits 6 and 7
|
|
|
|
JZ AO15 ; Nothing, next direction
|
|
|
|
JZ AO15 ; Nothing, next direction
|
|
|
@@ -1030,7 +1030,8 @@ AO22: MOV AL,[DI] ; Get piece
|
|
|
|
; the aforementioned routines as soon as an
|
|
|
|
; the aforementioned routines as soon as an
|
|
|
|
; attacker of the opposite color is encountered.
|
|
|
|
; attacker of the opposite color is encountered.
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; CALLED BY: -- ATTACK
|
|
|
|
; CALLED BY: -- ATKADJ
|
|
|
|
|
|
|
|
; ATKOUT
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; CALLS: -- None
|
|
|
|
; CALLS: -- None
|
|
|
|
;
|
|
|
|
;
|
|
|
@@ -1046,16 +1047,16 @@ ATKCHK: MOV AL,[DI] ; Get piece
|
|
|
|
MOV AX,0DFFFH ; FF (border) in AL and DF in AH
|
|
|
|
MOV AX,0DFFFH ; FF (border) in AL and DF in AH
|
|
|
|
CMP [BP+9],AL ; Is +9 border ?
|
|
|
|
CMP [BP+9],AL ; Is +9 border ?
|
|
|
|
JZ ACK5 ; Yes, jump
|
|
|
|
JZ ACK5 ; Yes, jump
|
|
|
|
AND [BP+9],AH ; Remove bit 5 for piece
|
|
|
|
AND [BP+9],AH ; Remove Pawn attack flag
|
|
|
|
ACK5: CMP [BP+11],AL ; Is +11 border ?
|
|
|
|
ACK5: CMP [BP+11],AL ; Is +11 border ?
|
|
|
|
JZ ACK6 ; Yes - jump
|
|
|
|
JZ ACK6 ; Yes - jump
|
|
|
|
AND [BP+11],AH ; Remove bit 5 for piece
|
|
|
|
AND [BP+11],AH ; Remove Pawn attack flag
|
|
|
|
ACK6: CMP [BP-9],AL ; Is -9 border ?
|
|
|
|
ACK6: CMP [BP-9],AL ; Is -9 border ?
|
|
|
|
JZ ACK7 ; Yes - jump
|
|
|
|
JZ ACK7 ; Yes - jump
|
|
|
|
AND [BP-9],AH ; Remove bit 5 for piece
|
|
|
|
AND [BP-9],AH ; Remove Pawn attack flag
|
|
|
|
ACK7: CMP [BP-11],AL ; Is -11 border ?
|
|
|
|
ACK7: CMP [BP-11],AL ; Is -11 border ?
|
|
|
|
JZ ACK8 ; Yes - jump
|
|
|
|
JZ ACK8 ; Yes - jump
|
|
|
|
AND [BP-11],AH ; Remove bit 5 for piece
|
|
|
|
AND [BP-11],AH ; Remove Pawn attack flag
|
|
|
|
ACK8: MOV AL,1 ; Set attacker found flag
|
|
|
|
ACK8: MOV AL,1 ; Set attacker found flag
|
|
|
|
POP CX ; Restore CX reg
|
|
|
|
POP CX ; Restore CX reg
|
|
|
|
RET ; Return from ATTACK
|
|
|
|
RET ; Return from ATTACK
|
|
|
@@ -2304,4 +2305,4 @@ IY: DS 2
|
|
|
|
BC: DS 2
|
|
|
|
BC: DS 2
|
|
|
|
DE: DS 2
|
|
|
|
DE: DS 2
|
|
|
|
HL: DS 2
|
|
|
|
HL: DS 2
|
|
|
|
|
|
|
|
|