Post Reply 
HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
09-12-2022, 12:27 PM (This post was last modified: 09-13-2022 08:03 AM by Bernd Grubert.)
Post: #17
RE: HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
Hi Gene,
Thanks for the interesting contest.
Here's my solution for the HP-41CX. It uses 78 bytes without the alpha label at the beginning.
No registers used.

I have added a new version "P2" which is 8 bytes (length is now 70 bytes) shorter and should be nearly two times faster. I replaced some of the x=0 with x=y tests, which allowed me to remove some stack clean-up code and eliminated one of the palindrom generations.

Regards
Bernd

Edit: added register usage.
Edit: added new version

Code:
 01◆LBL "P"
 02 FIX 0
 03 CF 29
 04 .05
 05 X<>Y
 06◆LBL 03
 07 XEQ 02
 08 +
 09 ENTER↑
 10 ENTER↑
 11 DSE X
 12 -
 13 X=0?
 14 GTO 04
 15 RDN
 16 XEQ 02
 17 X<>Y
 18 -
 19 LASTX
 20 X<>Y
 21 ISG Z
 22 X=Y?
 23 GTO 04
 24 X≠0?
 25 RDN
 26 X≠0?
 27 GTO 03
 28 RDN
 29 X<>Y
 30 INT
 31 X<>Y
 32 RTN
 33◆LBL 04
 34 CLX
 35 ENTER↑
 36 RTN
 37◆LBL 02
 38 ENTER↑
 39 CLA
 40◆LBL 00
 41 10
 42 /
 43 FRC
 44 10
 45 ST* Y
 46 RDN
 47 ARCL X
 48 RDN
 49 LASTX
 50 INT
 51 X=0?
 52 GTO 01
 53 GTO 00
 54◆LBL 01
 55 RDN
 56 ANUM
 57 END

Version P2:

Code:
 01◆LBL "P2"
 02 FIX 0
 03 CF 29
 04 ,05
 05 X<>Y
 06 XEQ 02
 07◆LBL 03
 08 +
 09 ENTER↑
 10 DSE X
 11 X=Y?
 12 GTO 04
 13 RDN
 14 ISG Y
 15 X=0?
 16 GTO 04
 17 XEQ 02
 18 X≠Y?
 19 GTO 03
 20 RDN
 21 X<>Y
 22 INT
 23 X<>Y
 24 RTN
 25◆LBL 04
 26 CLX
 27 ENTER↑
 28 RTN
 29◆LBL 02
 30 ENTER↑
 31 CLA
 32◆LBL 00
 33 10
 34 /
 35 FRC
 36 10
 37 ST* Y
 38 RDN
 39 ARCL X
 40 RDN
 41 LASTX
 42 INT
 43 X=0?
 44 GTO 01
 45 GTO 00
 46◆LBL 01
 47 RDN
 48 ANUM
 49 END


Attached File(s)
.zip  HHC-2022_BG.ZIP (Size: 608 bytes / Downloads: 2)
.zip  HHC-2022_2_BG.ZIP (Size: 453 bytes / Downloads: 3)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL - Bernd Grubert - 09-12-2022 12:27 PM



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