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

If you think you've found a bug in one of these machines, post about it here indicating the steps you perform in order to reproduce it.

Please prefix your topic with the model number in question and firmware version this way:

[DM16 V22] CHS gives unexpected results
michaelzinn
Posts: 37
Joined: Tue Apr 10, 2018 9:34 pm

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

Post by michaelzinn » Tue May 28, 2019 9:09 pm

rprosperi wrote:
Tue May 28, 2019 9: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?

rprosperi
Posts: 501
Joined: Mon Apr 24, 2017 5:48 pm
Location: New York

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

Post by rprosperi » Wed May 29, 2019 2:01 pm

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.
--bob p

DM42: β00071 & 00282

Post Reply