3 ms·
They say BASIC programmers never die, the just GOSUB and never RETURN.
by moron4hire 2y ago
They say BASIC programmers never die, the just GOSUB and never RETURN.
- Yoric 2y agoOr we get lost in DATA.
- readyplayernull 2y agoJust PEEK every address.
- hallway_monitor 2y agoCareful doing that, you could POKE your eye out
- versteegen 2y agoTrivia: at least in some BASICs (QBasic, QuickBasic, FreeBASIC) it's not necessary for every GOSUB to be matched with a RETURN, since the GOSUB is a single 'call' instruction that pushes onto the stack (and RETURN is a single 'ret' instruction, hence GOSUB-RETURN is highly efficient!) so it gets removed when you exit the function if you didn't RETURN, like alloca(). I actually re-implemented GOSUB this way using macros and inline assembly. I called it GOSUB/RETRACE.
- tasty_freeze 2y agoIn Wang BASIC, there was the "RETURN CLEAR" statement which cleared the stack up to and including the most recent GOSUB call frame. This includes any FOR loop frames that were push on the stack in the subroutine before the GOSUB. This was intended to be used for handling error conditions. https://www.wang2200.org/basic_comparison.html#retclear https://www.wang2200.org/basic_comparison.html#retclear
- p0w3n3d 2y agoI remember my Atari behaving awfully slow (whole atari basic environment, even after the program finished) because I did many GOSUBs without the amount of RETURNs necessary, and didn't understand why because I was only 9yo at that time...