I have been restructuring Richard Garriott's DND1 code that was written in BASIC. The old kind of BASIC where you had line numbers and did a lot of GOTO a line number.
It is fascinating trying to move it around with more modern eyes and years of programming dogma.
The code only has the concept of global variables. Every variable you make is then in the global space.
You can reuse a bit of code anywhere by just doing a GOTO line number. But it makes it very difficult to reason about because you might think of a stack of lines as a function and want to group them together, but some code somewhere else might just jump right into the middle of it!
Some bit of code might rely on some variable from somwhere else but it is difficult to know if some other bit of code is clobbering it.
Anyhow, this is the restructured version I put together.
https://codeberg.org/random-wizard/dnd1/src/branch/main/restructured/dnd1.basic
I moved things into GOSUB sections. Each GOSUB gets 1000 lines (usually it goes by 10s so only 100 lines) and the last line always ends in 999 and is a RETURN. A REM SUBROUTINE means nothing will GOTO in the middle of it.
This way it sort of acts like a traditional function. Still does not have arguments though.
I wonder if there are any companies out there looking for BASIC programmers.