Need some help with BASIC
-
Crimeny, didn't you learn anything in school? :rolleyes: The only difference between interpreted and compiled languages is when the source is compiled. An interpreted language like BASIC or FORTRAN is stored as source code, which is loaded into memory, compiled into an intermediate language at run-time, then run by the computer's version of a CLR. A compiled language such as COBOL or C is compiled separately from run-time and the intermediate form is stored as a run-time image, which can be quickly loaded into memory and executed. Compiled languages have an added flexibility in that they can be linked to other compiled modules, allowing for custom libraries. In either case, the IL is run by the same interpreter regardless of how the language was translated: the old VAX-VMS that I used in college *cough* years ago cared only that the IL was in the proper syntax, not the language of the originating source. Remember, computer memory used to be extraordinarily tight. Source code had to be size optimized as much as possible in order to get the largest programs possible, and the software that ran the programs had to be agnostic as to the program's source. This design concept was implemented with the first computers because they, too, had tight memory: early computers were only 8 bit and were limited to a maximum of 64k to hold the operating system, drivers, graphics code plus your program. (Remember, many of these computers did not have hard drives so everything -- everything -- had to fit into memory at the same time.) Given the technology limitations, it would have been very surprising to find a language that did not use an IL.
Hmm what version of Fortran was supplied with an interprer? - every version I've come across has been compiled. Compiling to intermediate code which is then interpreted was a lot more commonplace in the 70s and 80s. Acornsoft used this on their BCPL compiler for the BBC Micro.
-
It would be fun. Just how many people are there who still hack around on some ancient hardware and use such a forum?
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
Hmm what version of Fortran was supplied with an interprer? - every version I've come across has been compiled. Compiling to intermediate code which is then interpreted was a lot more commonplace in the 70s and 80s. Acornsoft used this on their BCPL compiler for the BBC Micro.
I've still got a pair of 8 channel punched paper tapes for a 2 pass BCPL compiler . BCPL -> ICode and a code generator for ICode -> OCode. Ocode was a published interpretable language and all you needed to do was write an interpreter for it. Then write a new code generator for ICode -> target machine code (in BCPL), run the compiler through it self, and BCPL is then ported to the new environment. Sadly I no longer have a paper tape reader. ~A
-
It would be fun. Just how many people are there who still hack around on some ancient hardware and use such a forum?
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan KenobiCDP1802 wrote:
Just how many people are there who still hack around on some ancient hardware and use such a forum
I can still code on such ancient hardware, but I prefer not to :) I could probably even still do some hardware hacking on those older systems, having grown up with them.. but these days I just fire up the Amiga 1000 every few years for fun and call it good :) Those older systems are just too much trouble to bother with. I've always wanted to add a USB interface to one of the 4K core (as in ferrite core) modules I have from the CDC-6500, but aside from creating the world's lowest capacity, largest volume, heaviest and most cumbersome non-volatile USB drive, there isn't much point :) Besides, I don't even know if they work.. they were removed because they failed after the computing center had a power failure, after all. Yeah, there's some of us old timers still around here. The sorts that still have the family Texas Instruments SR-10 lying around in a drawer someplace.. and know it still works too.
patbob
-
Tiny BASIC[^], to be exact. I am adapting a version of it for my old computer. The interesting part is that it internally used an interpreted language (IL) to implement the BASIC interpreter and only the IL interpreter was adapted for every system. Very interesting approach, considering this was used on 1970s homemade computers.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan KenobiWhen I took my first C programming class, a few of the homework problems were of things that would probably be useful, if I ever got around to writing a BASIC from scratch. Stuff like - take an algebraic expression and convert it to a Polish expression. Evaulate a Polish expression on a stack. I don't remember "manage a symbol table" being explicitly covered, but the general idea holds from the problem of "search a list" such as an array of records for a given key string, usually for some simple application like a mailing list problem. In simpler terms you might search a symbol table for the variable "A" in order to find the value 1.23456 which you then feed into your algebraic converter, which goes to the Polish stack evaluator, and there you have a big part of your BASIC interpreter or compiler even. Well, that's where I would start. Write the BASIC interpreter in C, and then find a way to cross compile it to your target platrom. Should be pretty easy. On the other hand, it might be a bit of work to get a decent floating point package up and running for one of those old machines, that is to say, if you decide to code all of that from scratch. But then again, if you already have an old BASIC that you are tearing apart, you can probably adapt some of those routines. A few people have done some interesting things like building (in the present day), VGA cards and IDE controllers and such for such ancient machines as the Apple II. Now that would get really interesting, that is to say, if someone were to put an accelerated graphics card together, that supports OpenGL (lets say), that you could pop into an old II+ or even an S-100 system. Those old II+'s and IIe's etc. were after all great platforms for kids to learn on, given that anyone could pretty much sit down with the manual or a crib sheet and begin programming in an afternoon. As for myself, back in the day, I had a pretty easy time learning Pascal and Fortran even (punch cards on an IBM System 3 Mainframe), but when I got to C, I found the learning curve with header files, make files, linker options, dll hell, compiler options, etc, very steep - and the fact was that I didn't even bother until 32 bit came along and I wasn't being coerced into thinking about segment registers, near and far pointers, etc. Have fun. P.S. I have an old Altair 8800B that I'll probably fix up and get running some day.
-
It would be fun. Just how many people are there who still hack around on some ancient hardware and use such a forum?
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
CDP1802 wrote:
Just how many people are there who still hack around on some ancient hardware and use such a forum
I can still code on such ancient hardware, but I prefer not to :) I could probably even still do some hardware hacking on those older systems, having grown up with them.. but these days I just fire up the Amiga 1000 every few years for fun and call it good :) Those older systems are just too much trouble to bother with. I've always wanted to add a USB interface to one of the 4K core (as in ferrite core) modules I have from the CDC-6500, but aside from creating the world's lowest capacity, largest volume, heaviest and most cumbersome non-volatile USB drive, there isn't much point :) Besides, I don't even know if they work.. they were removed because they failed after the computing center had a power failure, after all. Yeah, there's some of us old timers still around here. The sorts that still have the family Texas Instruments SR-10 lying around in a drawer someplace.. and know it still works too.
patbob
Actually, I now mostly use Visual Studio when I write code for my old computer. Somebody has come up with a C compiler and I have made a project template to use it. There even is an emulator, so that I can test my program on the PC and don't have to transfer it to tape first. It's far less troublesome than you might think. I can immagine that there is much more stuff available for your Amiga which would make it even more comfortable.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
Great. The first time I got my hands on a computer was when I had to spend a day in a shopping mall in order to avoid complications with my parents. It was a TRS 80 model 1. After that the little disagreement was forgotten and I told my parents that I needed a computer. At once, if possible. :)
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
Actually, I now mostly use Visual Studio when I write code for my old computer. Somebody has come up with a C compiler and I have made a project template to use it. There even is an emulator, so that I can test my program on the PC and don't have to transfer it to tape first. It's far less troublesome than you might think. I can immagine that there is much more stuff available for your Amiga which would make it even more comfortable.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan KenobiThanks, I appreciate the info. Yeah, tape's pretty prehistoric :) If I ever figure out a project that I feel needs to be done for my Amiga, I'll consider what you've said. However, I already have a C compiler and vi editor for it, and there's PC tools for reading/writing Amiga-format floppies, so I probably don't need to look any further.
patbob
-
Thanks, I appreciate the info. Yeah, tape's pretty prehistoric :) If I ever figure out a project that I feel needs to be done for my Amiga, I'll consider what you've said. However, I already have a C compiler and vi editor for it, and there's PC tools for reading/writing Amiga-format floppies, so I probably don't need to look any further.
patbob
patbob wrote:
Thanks, I appreciate the info. Yeah, tape's pretty prehistoric :)
The whole computer is prehestoric. It was a kit and I built it at the time when the very first computers like the TRS 80, the Atari 400 or the Apple II started to appear in the stores. Even a C compiler is pure luxury and also somewhat wasteful when you think how little memory the computer has.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi