41CX-MCODE: Digit Sum function



#19

So who said the 41 was an outdated platform? Here's a tidbit that may make you think it twice:-

Since I didn´t find any routine to calculate the digit sum I took upon writing one myself - here's the deceptively simple code for a CX environment - may you enjoy it as much as I do !

087	"G"	
009 "I"
004 "D"
04E "Sigma"
0F8 READ 3(X)
00E A=0 ALL
39C PT= 0
33C RCR 1
3C6 RSHFC S&X
3C6 RSHFC S&X
146 A=A+C S&X value to convert in A[S&X]
3DC PT=PT+1
0D4 ?PT= 10
3D3 JNC -06 [NEXTD]
17D ?NC GO CX-only!!
0C6 ->315F [ATOX20]


Best,
'AM


#20

Hi Angel, I have been a FOCAL programmer for a long time; however your solutions and challenges on HP-41 MCODE as well as being a proud owner of a HP-41CL and a NoVRAM-64 got me very interested in getting into HP-41 MCODE, and explore the further potentials of the HP-41 beyond FOCAL.
How can I write this code you provided into a HP-41? I would appreciate. Thanks, Kerem


#21

Easiest way is to buy an HP 41CL ! :-)


#22

He already got one. And a NoVRAM-64, too, which can emulate HEPAX and thus is perfect for getting into MCODE.

#23

There are many ways to do that. I would recommend to have a look at the famous and exciting HEPAX module. The manuals are available on TOS; the second part contains information about MCODE.

If you don't know what TOS means google for 'HP-41 archive'. Why TOS is used in this forum is another story ...


#24

Thanks for the pointers, and yes I do have a 41CL (thanks to Monte!) and NoVRAM-64(receving soon, thanks to Diego!). I will read the HEPAX module documentation on MCODE and try it first on my HP41 emulator (i41CX) which has the HEPAX module capability, see what will it take to enter Angel's code in my HP-41. I never though I would be going into MCODE, but now with all the available hardware, software and the knowledge base, seems like a great way to explore HP-41 beyond FOCAL and Syntetic.


#25

I believe there are some issues with the NoVRAM 64 and the 41CL.

certain NoVRAMs do not work properly?


#26

I received heads up that NoVRAM-64 may not work properly on the 41CL which is OK, because I was able to replace the dead CPU board on my HP-41C with the CL to give it a new and improved life while my 41CV will be receiving the NoVRAM-64 module (awaiting delivery). 41CL provides everything I need, memory, speed, modules and much more, while NoVRAM gives me HEPAX and MEMORY and module/program transferability on my HP-41CV. I don’t see the need to use CL and NoVRAM together, except the idea of using NoVRAM with USB programmer to download programs and modules and later transfer them to the 41CL (didn’t get the serial port with this one).

#27

Quote:
I believe there are some issues with the NoVRAM 64 and the 41CL.

My first try to plug in a Nov64 into the 41CL rendered pure chaos. I had "YFNZ" in Page 8 because I wanted to use the HPIL. But somehow the HEPAX system of the Nov64 doesn't like Page 8 to be occupied by somewhat else because it expects to get HEPAX RAM into there. Well, this may be also true for the real HEPAX module, but I have no chance to check this. To make things work in the 41CL, I accommodated YFNZ into Page E (PLUG4L). In the Nov64 Pages E and F have to be free so that there is no conflict with YFNZ of the 41 CL and the HEPAX OS (HEPAX 1D) of the Nov64 gets the chance to instal itself into Page F.

Edited: 9 Dec 2011, 3:41 a.m.


#28

The Real HEPAX module re-allocates itself to the lowest available port upon each CALC_ON event. This includes pages 5,6 and 8, - as well of course as the "outside" ports.

#29

Here is the mail I sent to "Monte's 20" after I get back home (a few of weeks ago) and tested with my own 41CL:

__________________________________________________________

Hi there,

I just get back home a couple of days ago. Yesterday night finally get my 41CL comfortably installed into a donor CV housing and start some Clonix/NoV's compatibility test.

Good to know that Clonix has been proven useful to move pages to/from 41CL's. Sorry about the serial programmer issue Geoff (they're known not to work with laptops.)

I've tested, Clonix-41 and Clonix-D and they both work as expected. Tested NoV-64 -ver.08r- and it also works as it should. I remember some users reported NoV-64 issues when plugged into 41CL's, please contact me to diagnose the trouble.

Also tested NoVRAM and NoV-32, and they DOES NOT work. Occasionaly, when using an older NoVRAM software version it turns up and seemed to work, but it is not a stable situation whatsoever and trends to crash.

Of course, I'll check the NoVRAM and NoV-32 code in order to find a suitable solution as soon as I can.

Tests have been performed with 41CL "out-of-the-box" (-YFSN 1A) no mods or upgrades.

All the best from the Canary Islands.

_______________________________________________________________

When using NoV it assumes port 1 or 2, therefore page 8 *must* be free for proper operation.

I've also tested Real Adv. HEPAX placed into port 2 and another ROM into port 1 and the 41 doesn't turn on or crashes.

As stated above, NoVRAM and NoV-32 are not compatible with CL at the moment, and I'm seeking the causes for this issue.

My best wishes for the upcoming Xmas season.

Diego.

#30

Quote:
I will read the HEPAX module documentation on MCODE and try it first on my HP41 emulator (i41CX) which has the HEPAX module capability, see what will it take to enter Angel's code in my HP-41.

I recommend to check for Section 12 in Vol. 2 of the HEPAX Module manuals. There, the development of an own ROM is explained step by step. Especially the sub-section "Example of a user-developed ROM" was very helpful for me. If you want to dive deeper into MCODE an ultimate must is Ken Emery's "MCODE for Beginners"!
#31

I´d say the HEPAX is the only thing you need. Its image is available on the CL so you´re all set - can use the NoVO on your other machine if you want, that's what I also do.

Using HEXEDIT it´s just a few keystrokes away, directly on the HEPAX RAM - also available in the CL library.

The CLUTILS ROM (also included) has HEPCL, a function to setup the HEPAX in the CL, it will PLUG the ROM in page B and 4 HEPAX RAM blocks in pages C-F.

For the new revision of CLUTILS I have prepared two versions of HEPCL, one setting up 16k of HRAM, the other only 8k. Also have a mini-HPX routine that sets up only 4k, perfect for testing and quick checking of things. Let me know if you'd need any of these as well.

Make sure your batteries are fresh!


#32

Here's the mini-HPX routine - it plugs the HPX ROM in page A and the HRAM in page B so the layout takes up port 2, a minimal footprint.

Mini-HEPAX: 	
port #2, id#="C"

1 LBL "HPX4"
2 TURBO50
3 "0B9>808"
4 AVIEW
5 YMCPY
6 "808000-000C"
7 YPOKE
8 "808-RAM"
9 PLUG2U
10 "HEPX"
11 PLUG2L
12 HEPDIR
13 END


Unfortunately neither page 6 or 7 support bank-switching - so the HEPAX ROM must be in the "upper space" - I use page 7 for the AMC/OSX module (my tweak of the CCD/OSX, itself a CCD derivative), an absolute must.

#33

Hi Kerem,

You (and any other interested user) may found this .pdf document easier to handle than the scanned copy.

Hope this helps.

Cheers from Spain.

Diego.


#34

Hi Diego,

Thanks for the file, it is much easier to read and search for keywords. Hopefully by the end of this weekend I will figure out how to input Angel's MCODE in my HP-41 using the NoVRAM-64 and 41CL independently (for the moment).
Regards,
Kerem

#35

Quote:
So who said the 41 was an outdated platform?

Certainly not me!

Quote:
Since I didn´t find any routine to calculate the digit sum I took upon writing one myself

By calculating "the digit sum", did you mean computing the sum of all the digits of a decimal number?

For instance, are you expecting that 123.509 return twenty?


Quote:
here's the deceptively simple code for a CX environment - may you enjoy it as much as I do !

I only own an HP-41C with two memory modules, but no other exotic modules that are in question here.
I have no clue at all about what your code is doing and how it is doing it !!
But, I really enjoy if I may learn it!


#36

Quote:
For instance, are you expecting that 123.509 return twenty?


indeed.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 258 12-10-2013, 06:49 PM
Last Post: Han
  HP-41 MCODE: The Last Function - at last! Ángel Martin 0 147 11-08-2013, 05:11 AM
Last Post: Ángel Martin
  Prime: sum-of Paul D. Fox 2 182 10-13-2013, 10:22 AM
Last Post: Tim Wessman
  41-MCODE: Auto XEQ+ALPHA possible? Ángel Martin 5 273 05-29-2013, 06:15 AM
Last Post: Ángel Martin
  HP 41 Mcode related Questions Michael Fehlhammer 4 248 05-10-2013, 07:09 PM
Last Post: Michael Fehlhammer
  41-MCODE: Breaking the FAT barrier. Ángel Martin 0 116 09-03-2012, 06:31 AM
Last Post: Ángel Martin
  41-MCODE: Dr. Jekyll & Mr. Hyde Ángel Martin 9 373 07-09-2012, 09:41 AM
Last Post: Monte Dalrymple
  HP41C: Factorial (kind of) in MCODE Frido Bohn 7 333 05-26-2012, 09:18 AM
Last Post: Frido Bohn
  41-MCODE: SOLVE & INTEG - 4k ROM Ángel Martin 9 364 04-19-2012, 05:29 AM
Last Post: fhub
  SUM function on WP-34S Thomas Scott 11 423 04-18-2012, 06:10 PM
Last Post: fhub

Forum Jump: