4 ms·
>> Late 70s and 80s: forget BASIC, we had Pascal and C Well for once, PCs were ridiculously expensive back in the day so that rules out using the PC version of
by MichaelRo 3y ago
>> Late 70s and 80s: forget BASIC, we had Pascal and C
Well for once, PCs were ridiculously expensive back in the day so that rules out using the PC version of Borland Pascal / C. I had them in school, but we had mostly CP/M based machines and only two PCs. A 286 AT and an 8086 XT. If I recall correctly we had Borland Pascal 5.0 and it worked blazingly fast on both machines. Then some dumbass decided to upgrade to Borland Pascal 6.0 and wiped out 5.0 from the XT machine (lack of space, maybe? but mostly supidity) and replaced it with 6.0. It was horrendously slow. Like I got my first look into today's "enterprise" compile times :) Pressing F5 (or F9 or something to compile, I don't recall the exact key) took about a minute to start showing the compilation dialog. Several more minutes to compile. Compared to instantaneous on 5.0. Rendered the whole thing unusable on the XT.
On the other hand I hated working on school's computers. They were overcrowded, too few for too many students and I always had barely enough time to type the examination programs (I was studying computer science) needed to get my grades, never enough time to fiddle and experiment. Or game.
So for that I used my dear home computer, a ZX-Spectrum compatible clone manufactured locally: http://retroit.ro/wp-content/uploads/2019/12/hc-85-maro-678x381.jpg http://retroit.ro/wp-content/uploads/2019/12/hc-85-maro-678x...
Initially I did BASIC but as time progressed, I needed more speed and interpreted BASIC was hopelessly slow. I wanted to program TETRIS actually :) So I switched to Pascal, more precisely HiSoft Pascal for ZX Spectrum. Here's the book I learned from, there was no Internet back then so the book was quintesential: https://imgur.com/a/qweDG2E https://imgur.com/a/qweDG2E
Actually that's also where I learned and understood memory management. Linked lists, allocation, deallocation. Before C, for me there was Pascal. One thing that blew my mind and didn't understood it until I programmed and ran it with my own hands was recursively referring to the defined structure ... in the very structure. You know the C definition:
typedef struct node {
int val;
struct node * next;
} node_t;
How the heck can you refer to something that's not yet defined in a way, I was thinking.
So, I eventually implemented that TETRIS in Pascal and I've no idea how I did it without a debugger... I guess with print statements and just thinking with pen an paper. Worked well enough although it did crash on occasion and I never figured out why :)
Anyhow, sometime later I got my hands on HiSoft's compiler for BASIC. Very cool thing, you'd load the compiler from cassette then you'd write your program in the regular ZX-Spectrum BASIC and then RANDOMIZE USR <some number> (address of loaded compiler) and the thing would put machine code somewhere in the remaining memory and provide you with the address and size. So you could save the machine code directly on cassette and run it directly next time. And all that in less than 40Kb of memory for BASIC code, compiler code, resulting compiled program and stacks etc. Believe it or not, I rewrote that TETRIS in BASIC and was able to compile and run it. Bonus it never crashed, I guess the BASIC version was inherently more stable.