-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBANK_RECON.asm
117 lines (76 loc) · 3 KB
/
BANK_RECON.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
SLOT 1
NEWBANK RECON
;---------------------------------------------------------------------------------------------------
DEF SAFE_showMoveCaptures
SUBROUTINE
VEND SAFE_showMoveCaptures
jsr UNSAFE_showMoveCaptures
lda savedBank
sta SET_BANK
rts
;---------------------------------------------------------------------------------------------------
DEF UNSAFE_showMoveCaptures
SUBROUTINE
REFER SAFE_showMoveCaptures
VAR __toSquareX12, 1
VAR __fromPiece, 1
VAR __aiMoveIndex, 1
VEND UNSAFE_showMoveCaptures
; place a marker on the board for any square matching the piece
; EXCEPT for squares which are occupied (we'll flash those later)
; x = movelist item # being checked
lda savedBank
pha
lda #BANK_UNSAFE_showMoveCaptures
sta savedBank
.next ldx aiMoveIndex
stx __aiMoveIndex
bmi .skip ; no moves in list
lda INTIM
cmp #20
bcc .skip
dec aiMoveIndex
jsr GetP_MoveFrom
cmp fromX12
bne .next
jsr GetP_MoveTo
sta __toSquareX12
tay
jsr GetBoard
and #PIECE_MASK
beq .next
; There's something on the board at destination, so it's a capture
; Let's see if we are doing a pawn promote...
ldy fromX12
jsr GetBoard
sta __fromPiece
jsr GetP_MovePiece
eor __fromPiece
and #PIECE_MASK
beq .legit ; from == to, so not a promote
; Have detected a promotion duplicate - skip all 3 of them
dec aiMoveIndex ; skip "KBRQ" promotes
dec aiMoveIndex
dec aiMoveIndex
.legit
;TIMECHECK COPYSINGLEPIECE, restoreIndex ; not enough time to draw
lda __toSquareX12
sta squareToDraw
jsr CopySinglePiece;@0
.skip pla
sta savedBank
rts
;---------------------------------------------------------------------------------------------------
DEF showPromoteOptions
SUBROUTINE
REFER aiRollPromotionPiece
REFER aiChoosePromotePiece
VEND showPromoteOptions
; X = character shape # (?/N/B/R/Q)
ldy toX12
sty squareToDraw
jsr CopySetupForMarker
jmp InterceptMarkerCopy
;---------------------------------------------------------------------------------------------------
CHECK_BANK_SIZE "BANK_RECON"
; EOF