HP41C - workaround for the SIZE? missing
|
04-19-2016, 02:49 PM
Post: #1
|
|||
|
|||
HP41C - workaround for the SIZE? missing
How would you determine the number of data registers set in the past (and forgotten) in the HP41C?
There is no SIZE? command in this calculator. |
|||
04-19-2016, 03:21 PM
Post: #2
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 02:49 PM)wojtek Wrote: How would you determine the number of data registers set in the past (and forgotten) in the HP41C? This is a question people had been asking since the machine was introduced. It was solved relatively early on in the PPC ROM with the "S?" (Size Finder) routine, which contains a call to another routine within the module. If you can't get your hands on a PPC ROM module, perhaps others here can chime in with a reasonable alternative. Jake |
|||
04-19-2016, 03:42 PM
Post: #3
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 02:49 PM)wojtek Wrote: How would you determine the number of data registers set in the past (and forgotten) in the HP41C?Very simple. Start RCL-ing from maximum possible register number down. Depending on how much memory is available will take you less than a minute to figure it out. |
|||
04-19-2016, 04:11 PM
(This post was last modified: 04-19-2016 04:13 PM by wojtek.)
Post: #4
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 03:42 PM)RMollov Wrote:(04-19-2016 02:49 PM)wojtek Wrote: How would you determine the number of data registers set in the past (and forgotten) in the HP41C?Very simple. Start RCL-ing from maximum possible register number down. Depending on how much memory is available will take you less than a minute to figure it out. :-) :-) good joke, thank you, I know that way of course. Less than a minute? Even if you have quad memory installed? |
|||
04-19-2016, 07:12 PM
Post: #5
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing | |||
04-19-2016, 07:39 PM
Post: #6
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 07:12 PM)BobVA Wrote:(04-19-2016 04:11 PM)wojtek Wrote: ...Less than a minute? Even if you have quad memory installed? Maybe. Allowing for the worst case - 317 data registers it would take 8 steps: 318/159/240/270/295/307/313/316=HIT (or something like this) I would rather think about a procedure based on bisection search and hit or miss rule and using the flag 25 - error ignore. |
|||
04-19-2016, 08:40 PM
(This post was last modified: 04-19-2016 08:41 PM by Dieter.)
Post: #7
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 02:49 PM)wojtek Wrote: How would you determine the number of data registers set in the past (and forgotten) in the HP41C? In the early HP41 days, SIZE finders were among the most popular routines. They could be found in several issues of HP key notes and most probably many similar publications. With the advent of Synthetic Programming, faster synthetic versions became available. And of course the PPC ROM includes such a function. You may take a look at the books by Bill Wickes and/or the documentation of the mentioned ROM. Eventually the X-Functions module became available, and so the problem was solved by the included SIZE? command. Since it offers many other useful functions, I would recommend getting such a module. Dieter |
|||
04-19-2016, 08:55 PM
Post: #8
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 04:11 PM)wojtek Wrote: :-) :-) good joke, thank you, I know that way of course. Hmmm... I tried this very (!) simple program... Code: LBL"SIZE??" ... and my physical '41 required 9 seconds for SIZE 050. So even in the worst case the result indeed should appear within about a minute. ;-) Dieter |
|||
04-19-2016, 11:06 PM
(This post was last modified: 04-19-2016 11:08 PM by RMollov.)
Post: #9
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 08:55 PM)Dieter Wrote: Hmmm... I tried this very (!) simple program... It took 17 secs to find out there were 100 registers allocated on my beast (which I already knew anyway). Nice program BTW, I love watching the flying goose. Cheers, |
|||
04-20-2016, 04:57 AM
(This post was last modified: 04-20-2016 05:10 AM by Sylvain Cote.)
Post: #10
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
The following program (64 bytes) will find the number of registers in nine lookup. (160, 80, 40, 20, 10, 5, 3, 2, 1)
Code: 01 LBL "SIZE?" // Entry Point On a unmodified HP-41CX Halfnut, the program consistently runs in 5.7 seconds. Measured with the stopwatch Insert after LBL "SIZE?" -> 0, SETSW, RUNSW Insert before END -> STOPSW, RCLSW, X<>Y Have fun! Sylvain Edit: add run time |
|||
04-20-2016, 08:40 AM
(This post was last modified: 04-21-2016 09:11 AM by Werner.)
Post: #11
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
Here's my non-synthetic version, 36 bytes without the END
Code: >LBL"SIZE?" Cheers, Werner *Edited a few times. Now, after 25 years or so, I seem to be able to find improvements I couldn't find before.. 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
04-20-2016, 12:03 PM
Post: #12
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-19-2016 11:06 PM)RMollov Wrote: It took 17 secs to find out there were 100 registers allocated on my beast Twice the SIZE, twice the time. ;-) But... (04-19-2016 11:06 PM)RMollov Wrote: Nice program BTW, I love watching the flying goose. ...OK, it's a nice program for goose watchers, but otherwise it's simply stupid. #-) I also tried a bisection method, and this runs in about 5 seconds for any SIZE. Dieter |
|||
04-21-2016, 11:14 AM
Post: #13
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing | |||
04-21-2016, 11:27 AM
Post: #14
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
Some 30+ years ago, a structural engineer I worked for had a 41cv program to calculate if pile depth is enough to support future structure or something; I only did surveying work for him. The program used to run for more than 5 hours, sometimes 6 or 7. We used to sit in the pub nearby watching the flying goose while sipping gin and tonic and other similar stuff. That was great! That's how I fell in love with the goose.
|
|||
04-21-2016, 05:24 PM
(This post was last modified: 04-21-2016 05:49 PM by Dieter.)
Post: #15
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-20-2016 08:40 AM)Werner Wrote: *Edited a few times. Now, after 25 years or so, I seem to be able to find improvements I couldn't find before.. I prefer the original version – the new one is slightly shorter (while I doubt it's faster), but the display looks a bit weird because of the VIEW / CLD sequence. Here's another option that does not require a second flag test: Code: >LBL"SIZE?" The CLX disables stack lift so that the RCL overwrites X if the register is available, otherwise it leaves a zero. Otherwise I really like your code. It's short, fast and effective. Dieter |
|||
04-21-2016, 05:49 PM
Post: #16
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
Couple of items from PPC Journal issues, just for the fun of it.
HP-41C Shortest Size Finder by Rolf R. Schmitt - 21 bytes PPC Calculator Journal V7 N8 P26 October 1980 Code: 01 LBL "S" ;Shortest Size Finder Routine HP-41C Short Size Finder Routine by Geoff Smith - 25 bytes PPC Calculator Journal V7 N6 Pg 36 Jul/Aug 1980 Code: 01 LBL "S" ;Short Size Finder Routine HP-41C Size Finder Routine by Justus A. Villa - 31 bytes[/php] PPC Calculator Journal V7 N6 P36 Jul/Aug 1980 Code: 01 LBL "S" ;Size Finder Routine HP-41C Small Size Finder Routine by Ron Knapp - 34 bytes PPC Calculator Journal V7 N2 P38 Feb-Mar 1980 Code: 01 LBL "S" ;Small Size Finder Routine |
|||
04-21-2016, 07:19 PM
(This post was last modified: 04-22-2016 05:31 AM by Werner.)
Post: #17
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-21-2016 05:24 PM)Dieter Wrote: The previous version at 37 bytes used almost exactly that trick. Almost, since ENTER itself also disables stack lift and so the CLX is not needed ;-)) And I tried out the VIEW/CLD on a real 41, the VIEWs do not show, that's why I thought it was acceptable. Cheers, Werner And now I'm going to read Gene's post ;-) 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
04-21-2016, 07:38 PM
Post: #18
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-21-2016 07:19 PM)Werner Wrote: The previous version at 37 bytes used almost exactly that trick. Almost, since ENTER itself also disables stack lift and so the CLX is not needed ;-)) Arrrrgghh... *facepalm* OK, I was really blind here. #-) (04-21-2016 07:19 PM)Werner Wrote: And I tried out the VIEW/CLD on a real 41, the VIEWs do not show, that's why I thought it was acceptable. I do not like the goose jumping back on every CLD. Among the versions posted by Gene some use ARCL instead of RCL so that the stack is not affected. I wonder if this may slow down the program. Dieter |
|||
04-22-2016, 04:16 AM
Post: #19
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-20-2016 08:40 AM)Werner Wrote: Here's my non-synthetic version, 36 bytes without the ENDI got rid of CLD and replaced VIEW IND Y with ARCL IND Y and it's now slightly quicker plus the goose flies smoooothly Cheers |
|||
04-22-2016, 05:36 AM
(This post was last modified: 04-22-2016 05:41 AM by Werner.)
Post: #20
|
|||
|
|||
RE: HP41C - workaround for the SIZE? missing
(04-21-2016 07:38 PM)Dieter Wrote: I do not like the goose jumping back on every CLD. The goose jumping backward doesn't bother me - the MATRIX program in the standard module used CLD as a NOP after ISG, so it showed that behaviour, too. I didn't want to use ARCL, I always try to use as few resources as possible. Also, again I must praise Free42: did you know that (for any x) SF 25 SIZE x ENTER RCL x still has stack lift disabled? I didn't. But that's how it is in the 41 and 42. And Free42. Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)