Hacker News new | ask | show | jobs
by ikari_pl 908 days ago
On an Amstrad,

    10 level=1
    20 GOSUB 40
    30 END
    40 PRINT"Current level: ",level
    50 level=level+1
    60 GOSUB 40
Prints a "Memory full in 50" after printing level 84. At first I thought it dedicated about 168 bytes for GOSUB stack, but the "memory full" happens on the level assignment.

You can erase this stack explicitly by calling `CLEAR` (will also close open files and clear ALL variables).

1 comments

Does the RETURN statement work correctly on Amstrad when there are multiple subroutines in the call stack? I.e., does every RETURN return to the line after the corresponding GOSUB or after the latest one?