UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
ratwolf
Posts: 52
Joined: Fri Feb 12, 2021 1:00 am

UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by ratwolf »

Ad1) If dynamic stack extension and NSTK is enabled there is a strange display behaviour after CLST.
Ad2) a simple Program to determine Pi by Monte Carlo runs perfectly on free42 Ver. 3.02 (MacOS version) in both configurations 4STK and NSTK
But this program fails with insufficient memory on DM42 with NSTK enabled. In 4STK it is working.
Attachments
PiMCx.txt.zip
(780 Bytes) Downloaded 123 times
NSTK&CLST.bmp
NSTK&CLST.bmp (12.31 KiB) Viewed 2735 times
PiMCx.raw
(159 Bytes) Downloaded 112 times
ratwolf
Posts: 52
Joined: Fri Feb 12, 2021 1:00 am

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by ratwolf »

more simple program version attached
Attachments
PiMC.raw
(131 Bytes) Downloaded 120 times
Last edited by ratwolf on Thu Apr 22, 2021 9:42 pm, edited 1 time in total.
gopper
Posts: 21
Joined: Tue Mar 05, 2019 11:18 am

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by gopper »

ratwolf wrote:
Thu Apr 22, 2021 8:38 pm
Ad1) If dynamic stack extension and NSTK is enabled there is a strange display behaviour after CLST.
It's not the expected behaviour/visualisation? Beside the subjective aesthetic aspect (looks great for me), it works fine.

Gop.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by Thomas Okken »

With empty stack, the label 1: is shown just so the display isn't completely empty. For RPLishness, I should have made it show 2: and 1:... maybe I'll do that in the next update. :oops:
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by Thomas Okken »

ratwolf wrote:
Thu Apr 22, 2021 8:38 pm
Ad2) a simple Program to determine Pi by Monte Carlo runs perfectly on free42 Ver. 3.02 (MacOS version) in both configurations 4STK and NSTK
But this program fails with insufficient memory on DM42 with NSTK enabled. In 4STK it is working.
https://thomasokken.com/free42/#big-stack
Big Stack mode is quite powerful, but please be aware that existing programs will typically not work correctly in this mode, since they expect the fixed four-level stack. Use this mode only for programs you have verified to be compatible, or for programs specifically written for Big Stack mode.
ratwolf
Posts: 52
Joined: Fri Feb 12, 2021 1:00 am

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by ratwolf »

But why the program is running properly on free42 e.g. MacOS version, both in 4STK and NSTK?
Guess DM42 is different here?

Also in free42 (again MacOS version :-)) after CLST in NSTK mode it shows exactly 1: and 2:
rprosperi
Posts: 1703
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by rprosperi »

On a typical Mac, you can probably use millions of stack levels before running out of memory, whereas on a DM42, that limit is closer to ~1000 levels; the platform simply does not as much RAM as your Mac, which probably has many GBytes of RAM available.
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
ratwolf
Posts: 52
Joined: Fri Feb 12, 2021 1:00 am

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by ratwolf »

yup forgot that my Mac is a bit more capable than my DM42 :-)
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by dlachieze »

Yes, the DM42 has a limited memory, so you reach the insufficient memory condition earlier on the DM42 than on a Mac.

Your program is pushing values on the stack at each loop. This is not a problem in 4STK mode because when a value is pushed out of T it just disappears, but in NSTK mode you're filling the stack and at some point the stack is full hence the insufficient memory condition.

So when you're writing a program to be run in NSTK mode you need to ensure it will consume the data put on the stack and not fill it indefinitely. This is a good example of a standard RPN program written for the classic 4-level stack and not compatible with a RPL-like big stack.
DM42: 00425 - DM41X: β00066 - WP43: 00042
ratwolf
Posts: 52
Joined: Fri Feb 12, 2021 1:00 am

Re: UPDATE: DMCP-3.21 / DM42-3.18 and dynamic stack extension

Post by ratwolf »

Yes, I probably already became aware of this during the program execution in 4STK mode. Since you can watch :-) how stack contents alternate. I haven't used my HP-50g in a long time because the DM42 is more fascinating ... :-)
Post Reply