I'll be the first to admit that I'm not a "coder." I stumble through this stuff as best I can. Sometimes I can grasp it clearly, other times it's utterly opaque. But, I'm retired and what I lack in keen analytical insight I make up in an abundance of free time.

I'm trying to understand Sierpinski and the "RETURN WITHOUT GOSUB ERROR IN 190" thing.

I did something Ahl did in the article, and modified the program so it only drew the first order of the curve, and I did it with the TRACE command enabled, outputting it to the virtual printer. This records each line number as it's executed until the program halts. Because you can have multiple commands within a line number (separated by a colon), it'll repeat each line number for every command it contains.

Well, I got a lot of commands for just one curve, so I counted the number of times the plotting subroutine was called. There are 16 segments in the first order curve, but the plotting routine was called 32 times. It was doing it twice.

That seemed like a clue.

Because I modified the program to only draw the first order curve (DI=0), I didn't need the FOR...NEXT loop, so I just deleted the NEXT line, which also meant I didn't need the GOSUB 100 that was nested in that loop. Removing all that, it runs once and halts with the usual RETURN WITHOUT GOSUB ERROR.

What this suggests to me, kind of apart from the GOSUB and RETURN stuff, is that this "stack" construct is double counting somehow.

That's the next thing to investigate, how often the "PUSH" and "POP" routines are called and where.

While I do have an abundance of spare time, my interest and enthusiasm flags a bit, so I'm putting it aside for now.

But the beat goes on...

✍️ Reply by email

Originally posted at Nice Marmot 15:18 Wednesday, 16 October 2024