The Museum of HP Calculators

HP Articles Forum

[Return to the Index ]
[ Previous | Next ]


HP-41 MCODE: Checking ROMs Configuration

Posted by Ángel Martin on 18 Mar 2012, 3:23 a.m.

Problem Description.

You just plugged a module (Clonix, Standard, or "virtual" on the CL / MLDL) and your trusty 41 starts acting up when you try to execute any function. You of course suspect the amateur programmer who put it together and didn't do enough testing - but on second thought you wonder if there could be any XROM conflict in the current configuration.

Even HP-made modules suffered from this in the old days (they were marked with an "x" on the module case label) - but today is more frequent given the open access to every module on Clonix/MLDL, with the CL topping the list: a simple PLUG command for a ROM in its vast library can take you there.

Function Features.

The Function listed below determines whether such a conflict really exists. It shows a "CONFIG OK/BAD" statement to assess the status, and if there are conflicts it will sequentially show ALL conflicting XROM numbers if multiple offenders, ending with the BAD status message.

It will also discard "false positives" caused by multi-page ROMS (i.e. 2 or more 4k-blocks) with just one single FAT.

Checking Method.

Here's a crude sketch in basic to help define the context to get started. The idea is to check the first byte in pages 3 to F, looking for duplicates.

FOR J= 3 TO 14
W = FETCH(J)
FOR K=J+1 TO 15
V = FETCH (K)
IF V=W THEN -> BAD STUFF
NEXT K
NEXT J

A check for the second byte is used to determine whether the 4k page has an XROM id# but it has NO functions.

Routine Code.

Listed below is my implementation of CHKCGF. It assumes a system with the CX OS, as there are a couple of calls to the message routines.

The FOR-NEXT loop J and K indexes are stored in CPU registers N and M respectively.

The enumeration starts at page#3, thus catching the CX-XFUNCT. It is compatible with Page#4-equipped systems, since its "fake" XROM id# is 35 - more about this on another article.

1	REPORT	215	?NC XQ	    Build Msg - all cases
2		0FC	->3F85	    [APRMSG2]
3		003	"C"	
4		00F	"O"	
5		00E	"N"	
6		006	"F"	
7		009	"I"	
8		007	"G"	
9		220	" "	
10		24C	?FSET 9     were there issues?
11		037	JC  +06	    [BADONE]
12		3BD	?NC XQ	
13		01C	->07EF	    [MESSL]
14		00F	"O"	
15		20B	"K"	
16		033	JNC  +06    [SHOWME]	
17	BADONE	3BD	?NC XQ	
18		01C	->07EF	    [MESSL]
19		002	"B"	
20		001	"A"	
21		204	"D"	
22	SHOWME	1F1	?NC GO	    Show and Halt
23		0FE	->3F7C	    [APEREX]
24		087	"G"	
25		006	"F"	
26		003	"C"	
27		00B	"K"	
28		008	"H"	
29		003	"C"	
30	CHKCFG	1A0	A=B=C=0	    Start w/ clean slate
31		244	CLRF 9	
32		15C	PT=  6	
33		090	LD@PT- 2    puts "2" in C(6)
34		070	N=C ALL	    now in N(6)
35	NEXTJ	0B0	C=N ALL	
36		15C	PT=  6	
37		222	C=C+1 @R    increases page#
38			JC  -37d    [REPORT]
39		070	N=C ALL	    update 1st. Counter
40		330	FETCH S&X   get 1st. Word (j)
41		106	A=C  S&X    store in A[S&X]
42		23A	C=C+1 M     increase address
43		330	FETCH S&X   get 2nd. Word (j)
44		2E6	?C#0 S&X    empty FAT?
45		3B3	JNC -10d    yes, [NEXTKJ]
46		0B0	C=N ALL	    bring counter back
47		222	C=C+1 @R    add one: out of bounds?
48		28F	JC  -47d    yes, we're done
49		158	M=C ALL     reset 2nd. Counter
50		033	JNC +06	    1st. Time is different
51	NEXTK	198	C=M ALL
52		15C	PT=  6	
53		222	C=C+1 @R    increases page#
54		36F	JC -19d	    checked all pages?
55		158	M=C ALL	    update 2nd. Counter
56	1STONE	330	FETCH S&X   get 1st. Word (k)
57		0E6	C<>B S&X    store in B[S&X]
58		23A	C=C+1 M     increase address
59		330	FETCH S&X   get 2nd. Word (k)
60		2E6	?C#0 S&X    empty FAT?
61		3B3	JNC -10d    yes, -> [NEXTK]
62		0C6	C=B  S&X    get 1st. Word (k)
63		366	?A#C S&X    same xrom id#'s ?
64		39F	JC -13d	    no, -> [NEXTK]
65		248	SETF  9	    yes, flag it as "dirty" cfg
66		215	?NC XQ	    Build Msg - all cases
67		0FC	->3F85	    [APRMSG2]
68		004	"D"	
69		015	"U"	
70		010	"P"	
71		020	" "	
72		018	"X"	
73		012	"R"	
74		00F	"O"	
75		00D	"M"	
76		220	" "	
77		066	A<>B S&X    value to convert in A[S&X]
78		01E	A=0 MS	
79		3A1	?NC XQ	    Generate number ->display!
80		014	->05E8	    [GENNUM]
81		031	?NC XQ	    Display not halting
82		100	->400C	    [APERX4]
83		37D	?NC XQ	    Cancels TURBO mode
84		13C	->4FDF	    [TURBO0]
85		046	C=0 S&X	
86		2A6	C=-C-1 S&X  Delay loop
87		266	C=C-1 S&X	
88		3FB	JNC  -01	
89		38D	?NC XQ	    Sets TURBO mode
90		13C	->4FE3	    [TURB50]
91		2C3	JNC -40d    [NEXTK]

Notes.

Lines 83-84 and 89-90 are used to remove the TURBO mode during the displaying of the messages. They're only relevant to CL systems and have no effect on other setups.

Lines 81-82 are a call to the Page#4 Library. It's for a non-halting [APEREX].

As you can see it's relatively simple and requires no deep knowledge of the 41 OS internals. I use it all the time on my CL - for obvious reasons - where I´m changing the configuration very frequently, and now that I have it I can´t live without it. It´s a very handy tool, I´m surprised nobody has done it before.

"AM

Edited: 19 Mar 2012, 4:31 p.m.

Password:

[ Return to the Message Index ]

Go back to the main exhibit hall