The Museum of HP Calculators


Simplified Chess for the HP-42S

This program is by Paul Dale and is used here by permission.

This program is supplied without representation or warranty of any kind. Paul Dale and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

A simple chess playing program where the calculator plays white with a full set of pieces and the human operator plays black with a lone king. The human's task is to survive past the sixth move. This program is based on Valentin Albillo's chess playing program for the HP-67 which first appeared in V7N6P18 (July/Aug 1980) issue of PPC Journal.

The major improvements in this version of the code are the use of one of the standard chess notations for the calculator's moves; no need for the human to specify a capture any differently to a normal move and more comprehensive testing for check conditions.

The calculator will display its move and in response the human should enter the column / row of their move. E.g. K7 would be entered as 57 and QN3 as 23.

Listing

00 { 498-Byte Prgm }
 01  LBL "CHESS"
 02  CLX
 03  STO 00
 04  "P-K4"
 05  XEQ 02
 06  47
 07  X=Y?
 08  SF 07
 09  "Q-N4"
 10  XEQ 07
 11  IP
 12  6
 13  X=Y?
 14  GTO 12
 15  LASTX
 16  FP
 17  0.7
 18  X=Y?
 19  SF 07
 20  "Q-N7"
 21  XEQ 07
 22  FP
 23  0.8
 24  X=Y?
 25  GTO 13
 26  LASTX
 27  3.5
 28  X=Y?
 29  SF 07
 30  "P-Q4"
 31  XEQ 02
 32  26
 33  X≠Y?
 34  GTO 00
 35  "Q-Q7"
 36* LBL 08
 37  XEQ 02
 38  "Q-N5"
 39  GTO 09
 40* LBL 00
 41  XEQ 06
 42  X≠Y?
 43  GTO 00
 44  "B-KB4"
 45  XEQ 02
 46  GTO 05
 47* LBL 00
 48  XEQ 06
 49  X≠Y?
 50  GTO 00
 51  "B-KB4"
 52  SF 07
 53  XEQ 02
 54  56
 55  X≠Y?
 56  GTO 05
 57  "P-Q5"
 58  GTO 09
 59* LBL 00
 60  XEQ 06
 61  X≠Y?
 62  GTO 00
 63  "B-QN5"
 64  XEQ 02
 65* LBL 04
 66  "Q-Q7"
 67  GTO 09
 68* LBL 00
 69  R↓
 70  15
 71  X≠Y?
 72  GTO 00
 73  "Q-QN7"
 74  GTO 08
 75* LBL 00
 76  "Q-K5"
 77  GTO 08
 78* LBL 13
 79  "B-N5"
 80  XEQ 02
 81  18
 82  X≠Y?
 83  GTO 00
 84  "B-B6"
 85  SF 07
 86  GTO 03
 87* LBL 00
 88  XEQ 06
 89  X≠Y?
 90  GTO 00
 91  "B-R6"
 92  GTO 03
 93* LBL 00
 94  XEQ 06
 95  X≠Y?
 96  GTO 04
 97  "B-B6"
 98  XEQ 02
 99  28
100  X≠Y?
101  GTO 04
102  "Q-N7"
103  GTO 09
104* LBL 12
105  LASTX
106  FP
107  0.7
108  X=Y?
109  SF 07
110  "Q-Q7"
111  XEQ 07
112  FP
113  0.8
114  X=Y?
115  GTO 11
116  5.5
117  LASTX
118  X=Y?
119  SF 07
120  "P-Q4"
121  XEQ 02
122  66
123  X≠Y?
124  GTO 00
125  "B-QB4"
126  XEQ 02
127* LBL 05
128  "Q-B7"
129  GTO 09
130* LBL 00
131  XEQ 06
132  X≠Y?
133  GTO 00
134  "Q-K7"
135  GTO 08
136* LBL 00
137  R↓
138  54
139  X≠Y?
140  GTO 00
141  "B-Q3"
142  GTO 09
143* LBL 00
144  "Q-KN7"
145  GTO 08
146* LBL 11
147  "P-QN3"
148  XEQ 02
149  68
150  X≠Y?
151  GTO 00
152  "B-N2"
153  GTO 03
154* LBL 00
155  XEQ 06
156  X≠Y?
157  GTO 00
158  "B-B4"
159  SF 07
160  XEQ 02
161  68
162  X=Y?
163  GTO 05
164  "B-N2"
165  GTO 09
166* LBL 00
167  "B-N2"
168  SF 07
169* LBL 03
170  XEQ 02
171  "Q-N7"
172  GTO 09
173* LBL 06
174  10
175  +
176  RTN
177* LBL 07
178  XEQ 02
179  10
180  ÷
181  RTN
182* LBL 02
183  ASTO ST L
184  ISG 00
185  π
186  CLA
187  RCL 00
188  AIP
189  ⊢":"
190  ARCL ST L
191  FS? 07
192  ⊢"+"
193  FS? 06
194  ⊢"++"
195  AVIEW
196  FS?C 07
197  TONE 8
198  FC?C 06
199  STOP
200  RTN
201* LBL 09
202  SF 06
203  XEQ 02
204  BEEP
205  CLST
206  END

Go back to the software library
Go back to the main exhibit hall