The DM16 has no natural mechanism for passing parameters to subroutines other than using register storage. However if only 1 or 2 parameters are required the stack can provide a viable alternative. The code
x and y. Lines 2 to 4 are for copying x into Last x, with lines 5 to 7 filling the stack with y. The rolls and exchanges in the rest of the code are to circumvent the automatic replication of the t register. The code is called by ''y'''' <ENTER> 'x' <GSB> 'D'.
is for copying[DM16] Duplicating stack x and y into z and t
Re: [DM16] Duplicating stack x and y into z and t
I have never seen a 16C, but restricting myself to ABS, ENTER, RDN and X<>Y, I come up with
Or, a version that keeps L intact, and uses RUP (edited to remove a superfluous ENTER!)
Cheers, Werner
Code: Select all
ABS
RDN
ENTER
ENTER
LASTX
X<>Y
LASTX
Code: Select all
ENTER
ENTER
RUP
ENTER
RDN
X<>Y
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
Re: [DM16] Duplicating stack x and y into z and t
thanks, my HP16C bought in 1982 and still on its second set of batteries us one of my prized possessions. The DM16 code was intended of what was possible using the stack rather than optimal. thanks again Iain