Page 2 of 2

Re: [DM15L M1B V28] Using R/S in a subroutine reached by line number wipes the call stack

Posted: Tue May 28, 2019 11:09 pm
by michaelzinn
rprosperi wrote:
Tue May 28, 2019 11:01 pm

But how does that help if one has no available labels, which was the reason for switching from GSB Label to GSB I ?

Anyhow, I'd say you'd get better results reorganizing the program to somehow get it done with 25 labels and using flags or register contents as flags if more is absolutely needed.
You only need one label:

LBL 2
GTO I

You can then GSB to any line number you want by doing 123 CHS STO I GSB 2

Reorganizing the program is not an option, the whole point is that you can just compile any CommodoreBASIC program without worrying about details like limited amount of labels.

It's actually done now and will be released when firmware V29 becomes available. Have a look at the compiled code: https://pastebin.com/svGJk9Mh

What do you mean regarding flags? How would flags help here?

Re: [DM15L M1B V28] Using R/S in a subroutine reached by line number wipes the call stack

Posted: Wed May 29, 2019 4:01 pm
by rprosperi
Ah... I see now that this is directly related to your project to 'compile' existing code (btw, coming along nicely!) so I agree my suggestion isn't helpful for that use.

My suggestion about flags - I was thinking of using a single LBL/RTN subroutine which would dispatch to a series of other places via GTO -I based on various flag settings; Flag-xx=true?, GTO Here, Flag-xy=true? GTO There, etc. and each would end with a common return back to the appropriate place, but again no help for your scenario.