Horribly nested BASIC is just what you did before you did it better.
On the Commodore 64, it was the only option. It had minimal support for a thing it called a "subroutine", but what it really was was a GOTO that pushed the source on to the stack and could be RETURN'd to that source. In particular, no concept of return value, no concept of parameters; everything's global. Modification of global values prior to the "call" is the argument passing, and modification of global values is the "return".
Commodore 64 BASIC, and 8-bit BASIC in general, was fully in the paradigm that Dijkstra was referring to when he wrote Goto Considered Harmful. (Not exclusively, of course.)
The 6502 processor itself also has very poor "stack" support, the hardware-supported stack is limited to 256 bytes at a fixed location. It's one of the things that make it hard to compile a modern language like C for the architecture, so even among compiled languages one would prefer something FORTRAN/BASIC-like.
To be fair, the 256 byte stack can essentially be used in assembly as 256 registers, which is also one of the features (along with indirect addressing) that make assembly on it awesome.
My relatively poorly researched impression of it is that it's half-way to portable C, with a proto-stack and pointers, essentially.
Re:BASIC Computer Games
by jim_lawless on Wednesday April 10, 2019 @08:19AM
(#19623865)
You're thinking of zero page ($0000-$00ff), not the stack $0100-$01FF).
Yes I am! Thanks!
The on-chip stack on the 6502 was not intended to be used for implementing the stack for programming language procedure calls; it was intended to provide system extension functions that provide things missing in the 6502 instruction set,(for example, multiply), which had to be implemented with multiple instructions. For "modern" languages like C, 16-bit 2's complement integer arithmetic was expected but the 6502 native instructions were for 8-bit numbers.
It was “GOSUB” if I remember correctly!! Ah good old times!!
But it felt so liberating and high-level, compared to the assembly we wrote before. :)
They Create Worlds is a fantastic podcast in general, and I encourage folks with an interest in the history of games--or of computer tech in general, given the way it's historically tracked--to give it a listen. Alex is one of the true scholars of the topic.
Re:BASIC Computer Games
by abecedarius on Tuesday April 09, 2019 @04:56PM
(#19618850)
Actual title More BASIC Computer Games.
Growing up I had a Commodore 64 and for some reason came into possession of another of David Ahl's books ("More Computer Games" I think it was called). It contained Eliza as one of the listings and it was a program that fascinated me so much I ended up creating a ton of clones, in horribly nested BASIC (though, to be fair, is there any other kind?)