call (without parameters) and gosub appear to be similar. and technical they are. they use the same stack space.
but there are differences :
- with config submode=new, only used sub routines will be included but all gosub routines are included.
- you can use a gosub inside a sub, but you can not nest a call within a sub.
sub test()
gosub L1
gosub L2
exit sub
L1:
nop
return
L2:
nop
return
end sub
so above code works. but you can not do it the other way around.
gosub is an inheritance from old GW basic. But there is no need to use it.
locals :
a local is good for saving memory. the ram used by the local is freed after the sub ends. so it is not only the scoop that is local, but also the memory.
when you post code you should show the $regfile directive. but also the $hwstack,$swstack and $framesize settings.
in your case you probably do not have enough stack or framespace to store the local.
↧