Post Reply 
HP41: Updated RUBIK's / CHESS modules
12-28-2017, 11:52 AM
Post: #16
RE: HP41: Updated RUBIK's / CHESS modules
(12-28-2017 07:46 AM)Ángel Martin Wrote:  Here's a quick & dirty SHOW routine to view the board configuration at any given time. The main issue is that you cannot really use it during the game because it overwrites R00 and the stack; so it's of limited interest.

The routine lists all the 64 board squares in algebraic notation, adding the piece name and the color if a piece is there, or "EMPTY" otherwise. The color depends on whether HP plays white or black, as determined by flag 04.

Code:
1    LBL "SHOW"
2    21,084
3    STO 00
4    LBL 10
5    XEQ 00
6    ISG 00
7    GTO 10
8    RTN
9    LBL 00
10    CLA 
11    RCL 00
12    INT
13    20
14    -
15    8
16    MOD
17    X=0?
18    8
19    FC? 04
20    9
21    FC? 04
22    -
23    ABS
24    64
25    +
26    XTOA
27    RCL 00
28    INT
29    21
30    -
31    8
32    /
33    INT
34    E
35    +
36    FC? 04
37    9
38    FC? 04
39    -
40    ABS
41    ARCLI
42    "|- : "
43    RCL IND 00
44    INT
45    SF 25
46    GTO IND X
47    LBL 00
48    "|-EMPTY"
49    AVIEW
50    RTN
51    LBL 01
52    LBL 11
53    "|-PAWN"
54    GTO 00
55    LBL 02
56    LBL 12
57    "|-KNIGHT"
58    GTO 00
59    LBL 03
60    LBL 13
61    "|-BISHOP"
62    GTO 00
63    LBL 05
64    LBL 15
65    "|-ROOK"
66    GTO 00
67    LBL 08
68    LBL 18
69    "|-QUEEN"
70    GTO 00
71    LBL 09
72    LBL 19
73    "|-KING"
74    LBL 00
75    CF 25
76    CLX
77    10
78    "|- - "
79    FS? 04
80    GTO 00
81    X>Y?
82    "|-W"
83    X<Y?
84    "|-B"
85    AVIEW
86    RTN
87    LBL 00
88    X>Y?
89    "|-B"
90    X<Y?
91    "|-W"
92    AVIEW
93    END

I've made some tweaks to the CHESS ROM to make the prompting more intuitive, will post the updated ROM image in a coupe of days. I could add this SHOW routine if something else gets removed, it's packed as it is...

PS. ARCLI in line 41 is included in the OS/X, and can be replaced with FIX 0, ARCL X

PSS. "|-" is the append sign.

Well since the program is not that long, I started typing it into emu41.

What key do I press for line 34 E ?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP41: Updated RUBIK's / CHESS modules - mstram - 12-28-2017 11:52 AM



User(s) browsing this thread: 1 Guest(s)