3 ms·
The early BASICs, on the TRS80, the PET 4032 and the like, were all dreadful, but they were the only game in town. All variables were globals, the nearest thing
by greenbit 4y ago
The early BASICs, on the TRS80, the PET 4032 and the like, were all dreadful, but they were the only game in town. All variables were globals, the nearest thing to a procedure call was the 'GOSUB', there were inexplicable hold overs from punch-card systems like the READ/DATA thing.
Those were the days of typing it in from a listing printed in a book or magazine. 16K of RAM was plenty, because any BASIC program more than 100 lines long was simply incomprehensible w/o some cheat sheet notes on the side.
About the most interesting thing that could be done with those machines was to learn the assembly language for the underlying processor. People said that assembly language was going extinct even in 1980, that it was a step backwards, but BASIC didn't seem to be the way forward, either.
Recalling fondly now the sheer delight of that first university class in Pascal.
- musicale 4y agoBASIC was designed to be learned in an afternoon. Nothing wrong with Pascal, but it's drastically more complex to learn and to implement. The original BASIC user manual was just 23 pages long! https://www.dartmouth.edu/basicfifty/basicmanual_1964.pdf https://www.dartmouth.edu/basicfifty/basicmanual_1964.pdf The goals on page 1 are particularly relevant: 1) easy to learn, 2) efficient/compiled, 3) stepping stone to more advanced languages (s/Algol/Pascal/), and 4) general purpose. This simplicity paid off for early microcomputers and microcontrollers which could fit a BASIC interpreter, hardware drivers, and a user program into a few kilobytes of memory, creating a system that could run any of the programs in the above Dartmouth BASIC manual.
- bouncycastle 4y agoBASIC itself was written in Assembler, with the nearest thing to a procedure call was the 'JMP' instruction. It's amazing how any of such scale software was written in Assembler. See here https://github.com/microsoft/GW-BASIC https://github.com/microsoft/GW-BASIC
- musicale 4y agoMost microprocessors include some sort of a procedure call and return instructions, such as CALL and RET on the 8080/Z-80/x86, as well as stack push and pop instructions. RISC type processors can usually store the return address in a register and jump to an address stored in a register. On ARM you can also do an x86-like return with pop {pc}. Many large programs such the first Unix kernel, and many video games, were written in assembly language. My experience is that assembly language seems fine when you're writing it, but it's a pain when you go back some months later and try to read it. Good structure and comments help. I just read and wrote some RISC-V assembly language and it wasn't terrible, even though I'd never used RISC-V before. Writing assembly language makes you appreciate why (and how) programming languages exist.
- bouncycastle 4y agoyes, I just remembered! JMP is more like an if...then. There was a JSR (Jump to Sub Routine) instruction on the good old C64, good times!
- WalterBright 4y agoHal Finney (yes, that Hal) wrote a BASIC interpreter in a 2K EPROM in the 1970s. Quite an achievement! That left no room for error messages. Hal proudly showed me his solution. It was one error message for all errors: EH? consuming only 3 bytes!
- bouncycastle 4y agoInteresting! Are the roms available on any emulator where I could try it?
- greenbit 4y agoThe 'Level I' BASIC in the TRS80 managed to distinguish three errors WHAT? HOW? SORRY What a difference 4K made!