Post Reply 
Free42 with big stack, test version
02-07-2021, 05:20 PM
Post: #62
RE: Free42 with big stack, test version
Like I said before, I think the NLBL/LBL/RTN/END is the safest way to distinguish between two programs and their stack mode usage.

This is what I would do if I was doing it:
  • at program startup
    • alloc a temporary n-levels stack (running-nstk) and running-nstk = empty
    • alloc a temporary 4-levels stack (running-4stk) and running-4stk = 0
    • alloc a temporary L register (running-lreg) and running-lreg = 0
    • if interactive mode is n-levels → push interactive n-levels stack (interactive-nstk) in running-nstk, running-nstk is activated
    • if interactive mode is 4-levels → copy interactive 4-levels stack (interactive-4stk) over running-4stk, running-4stk is activated
    • running-lreg = interactive-lreg
  • mode switch on LBL, NLBL, RTN and END
    • switch from 4-levels to 4-levels → nothing to copy, running-4stk stay active
    • switch from n-levels to n-levels → nothing to copy, running-nstk stay active
    • switch from 4-levels to n-levels → copy running-4stk to running-nstk (see note #1), running-nstk is activated
    • switch from n-levels to 4-levels → copy running-nstk to running-4stk (see note #2), running-4stk is activated
  • at program exit
    • if interactive mode is n-levels → apply mode switch if needed, flush interactive-nstk, push running-nstk in interactive-nstk, interactive-lreg = running-lreg, free running-nstk, free running-4stk, free running-lreg
    • if interactive mode is 4-levels → apply mode switch if needed, copy running-4stk over interactive-4stk, interactive-lreg = running-lreg, free running-nstk, free running-4stk, free running-lreg
Note #1: copy 4stk to nstk (running & interactive)
  • if nstk depth < 5 then flush nstk, push 4stk into nstk
  • if nstk depth > 4 then drop 4 data from nstk, push 4stk into nstk
Note #2: copy nstk to 4stk (running & interactive)
  • if nstk depth > 3 then copy nstk 4th lowest levels to 4stk
  • if nstk depth = 3 then copy nstk 3th lowest levels to 4stk, T=Z
  • if nstk depth = 2 then copy nstk 2th lowest levels to 4stk, TZ=Y
  • if nstk depth = 1 then copy nstk 1st level to 4stk, TZY=X
  • if nstk depth = 0 then TZYX=0
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Free42 with big stack, test version - Sylvain Cote - 02-07-2021 05:20 PM



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