41-MCODE: a weekend challenge


Here's a great opportunity for all those "closet Mcoders" to go public and show up their prowess to the world, or to dust off those thinking caps if your old MCODE skills are rusty...

Problem Statement:

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 (er, never happened to me!) but on second thought you wonder if there could be any XROM conflict in the current configuration.

The Challenge:

Your mision is to write a routine in MCODE to determine whether such a conflict really exists. There are three leves of implementation, in growing difficulty (and usefulness), as follows:-

Level 1: show a OK/BAD statement to assess the status

Level 2: if BAD, show the conflicting XROM number as well, then issue the BAD message.

Level 3: if BAD, sequentially show ALL conflicting XROM numbers if multiple offenders, ending with the BAD status message.


None. The beauty of MCODE is that there are literally hundreds of ways to skin the cat. So it's ok to use calls to the OS routines, or even assume it's the CX OS. Not that this particular exercise requires lots of internals knowledge - save perhaps the display message routines.

This is not a contest, every part-taker is automatically a winner for participating. And sorry, no prizes - other than your sheer enjoyment while you crack the nut.

A jump start:

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

FOR J= 3 TO 14
FOR K=J+1 TO 15

A refinement would check for the first TWO bytes to discard "false positives" caused by 8k-ROMS with just one single FAT...

I'll post my version on Sunday in an article. 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.

Until then, happy MCODING !!



Well, no solution here, just some comments. IMHO the problem of conflicting XROMs comes up with emulators or RAM-Box options. The original HP41 has only 4 ports and in those days ROMs did cost a lot. So before the acquisition of a module you planned it in every aspect.

Using the HP41 on "virtual" hardware you have the chance to solve conflicts by changing the XROM No. That is quck'n'dirty as your programs will do no good when accidentally using the original ROMs.

For my 'NutEm' (simulation of the NUT CPU using FORTRAN, only implementation yet on VM/ESA) I tested for ROM conflicts when defining which ROM to load on which page, so _before_ running the
emlator/simulator. Alas this does _not_ prevent running programs with the wrong module. There would help a test of the required ROM-ID/XROM correlation for a program. Or a documentation of the prerequisites.

Nevertheless is Angels XROM conflict checker a big help for RAM-Box, Clonix, or MLDL user.


Edited: 16 Mar 2012, 5:27 a.m.


The article is posted:

HP41 Configuration Check

obviously a strong candidate for the best-seller contribution of the month :-)


Edited: 18 Mar 2012, 3:29 a.m.


Thank you.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP-41 MCODE: The Last Function - at last! Ángel Martin 0 1,032 11-08-2013, 05:11 AM
Last Post: Ángel Martin
  41-MCODE: Auto XEQ+ALPHA possible? Ángel Martin 5 1,931 05-29-2013, 06:15 AM
Last Post: Ángel Martin
  HP 41 Mcode related Questions Michael Fehlhammer 4 1,931 05-10-2013, 07:09 PM
Last Post: Michael Fehlhammer
  [43S] For your weekend pleasure Walter B 87 17,107 01-28-2013, 09:49 AM
Last Post: Guenter Schink
  A weekend quickie Valentin Albillo 64 12,455 01-26-2013, 10:29 AM
Last Post: C.Ret
  41-MCODE: Breaking the FAT barrier. Ángel Martin 0 907 09-03-2012, 06:31 AM
Last Post: Ángel Martin
  41-MCODE: Dr. Jekyll & Mr. Hyde Ángel Martin 9 2,967 07-09-2012, 09:41 AM
Last Post: Monte Dalrymple
  Weekend programming challenge: Euler's Totient function Allen 36 8,921 06-03-2012, 10:39 PM
Last Post: Paul Dale
  HP41C: Factorial (kind of) in MCODE Frido Bohn 7 2,421 05-26-2012, 09:18 AM
Last Post: Frido Bohn
  Weekend Reading NateB 2 1,319 05-19-2012, 06:20 PM
Last Post: Matt Agajanian

Forum Jump: