5 ms·
As a BASIC programmer from the 1980s, thank you for that heart attack.
by jfengel 2y ago
As a BASIC programmer from the 1980s, thank you for that heart attack.
- sharktheone 2y agolol GOSUB as a BASIC command, yes I can see the reference. It actually referes to the BASIC command.
- IshKebab 2y agoIt's a great name!
- moron4hire 2y agoThey 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...
- arethuza 2y agoFor some reason your comment made me think about computed gosubs - pretty sure I've managed to forget about those for ~40 years!
- deleted 2y ago[deleted]