Post Reply 
HP-41CV Cross Compiler
07-20-2018, 06:00 AM (This post was last modified: 07-20-2018 08:36 AM by Thomas Klemm.)
Post: #6
RE: HP-41CV Cross Compiler
Shell Sort
From page 66 with a minor change:
Code:
LBL "SHELL"
STO 00
STO 01
LBL 09
RCL 01
2
/
INT
STO 01
X=0?
RTN
1
STO 02
LBL 10
STO 03
LBL 11
RCL 01
+
RCL 04
+
RCL IND X
RCL 03
RCL 04
+
X<>Y
RCL IND Y
X<=Y?
GTO 12
STO IND T
X<>Y
STO IND Z
RCL 03
RCL 01
-
STO 03
X>0?
GTO 11
LBL 12
RCL 00
RCL 01
-
RCL 02
1
+
STO 02
X<=Y?
GTO 10
GTO 09
END

I've tried it with the example in Problem Solving with Algorithms and Data Structures using Python and started with register 10:

54 STO 10
26 STO 11
93 STO 12
17 STO 13
77 STO 14
31 STO 15
44 STO 16
55 STO 17
20 STO 18


Thus the BASE is set to 9:

9 STO 04

The number of data points is passed as an argument to the program.
Instead of register 15 the register 00 is used:

9 XEQ "SHELL"

RCL 10: 17
RCL 11: 20
RCL 12: 26
RCL 13: 31
RCL 14: 44
RCL 15: 54
RCL 16: 55
RCL 17: 77
RCL 18: 93


Thanks for sharing the paper.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP-41CV Cross Compiler - twdeckard - 07-20-2018, 01:57 AM
RE: HP-41CV Cross Compiler - mfleming - 07-20-2018, 02:24 AM
RE: HP-41CV Cross Compiler - Thomas Klemm - 07-20-2018 06:00 AM



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