Post Reply 
HP41C - workaround for the SIZE? missing
04-22-2016, 06:02 AM
Post: #21
RE: HP41C - workaround for the SIZE? missing
(04-21-2016 05:49 PM)Gene Wrote:  Couple of items from PPC Journal issues, just for the fun of it.

Thanks, Gene!
The first two are sequential, so I won't consider them.
The third is really interesting, but fails for SIZE 0 and SIZE 257 (possibly more).
And the last is shorter only because the label is shorter ;-)) It's an exact match of what I used to have. Perhaps I found it in the PPC Journal myself ;-)

Thanks,
Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
04-22-2016, 06:57 AM (This post was last modified: 04-23-2016 12:06 PM by Werner.)
Post: #22
RE: HP41C - workaround for the SIZE? missing
If speed is what you're after, then this is probably better:
(number entry is slow on a 41 compared to other instructions)

(38 bytes without END, 29 without LBL and END)

Code:
>LBL"SIZE?"
 255
 ABS
 50
 LASTX
 ISG X
>LBL 01
 SF 25
 ARCL IND Z
 %
 FC?C 25
 CHS
 ST+ Z
 ABS
 INT
 X>0?
 GTO 01
 LASTX
 RUP
 +
 CLA
 END

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
04-22-2016, 10:03 PM (This post was last modified: 04-22-2016 10:16 PM by RMollov.)
Post: #23
RE: HP41C - workaround for the SIZE? missing
(04-22-2016 06:57 AM)Werner Wrote:  If speed is what you're after, then this is probably better:
(number entry is slow on a 41 compared to other instructions)

(38 bytes without END, 29 without LBL and END)

Code:
>LBL"SIZE?"
 255
 ABS
 50
 LASTX
 ISG X
>LBL 01
 SF 25
 ARCL IND Z
 %
 FC?C 25
 CHS
 ST+ Z
 ABS
 IP
 X>0?
 GTO 01
 X<>Y
 RDN
 +
 CLA
 END

Cheers, Werner

Something is wrong here. What is IP? If you meant INT, then program ends up with 99.5 registers. So half a register got lost? No good!
It isn't quicker than the previous one either. I'm getting 4 seconds within a tolerance of .05 sec timing it by hand. All measured with 100 regs currently allocated.
Cheers
Find all posts by this user
Quote this message in a reply
04-23-2016, 12:09 PM
Post: #24
RE: HP41C - workaround for the SIZE? missing
The wrapup code at the end was wrong, I corrected it.
I use Free42 on my phone to test these things, and there INT is IP..
and it's true I didn't do a speed test - the difference would've been small, but should still be noticeable, or so I thought.
Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 




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