Need some help with BASIC
-
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 Kenobi -
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 KenobiOk, so you should ask the proper question in the Q&A section...
[www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.
-
Ok, so you should ask the proper question in the Q&A section...
[www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.
Now, the replies I would like to see :) A question about taking apart and modifying an more than 30 years old interpreter on a machine and CPU most people here will never have heard of. I guess, I will have to do that all by myself :) I just matched the title of the topic further down, but found the fact of an intermediate language at work in such an old thing very interesting.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
Now, the replies I would like to see :) A question about taking apart and modifying an more than 30 years old interpreter on a machine and CPU most people here will never have heard of. I guess, I will have to do that all by myself :) I just matched the title of the topic further down, but found the fact of an intermediate language at work in such an old thing very interesting.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan KenobiYes - I wonder if we should have a retrocomputing forum. I don't know how frequently this area comes up on CP as there are probably lots of retrocomputing sites out there.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
-
Yes - I wonder if we should have a retrocomputing forum. I don't know how frequently this area comes up on CP as there are probably lots of retrocomputing sites out there.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
-
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 KenobiCrimeny, 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.
-
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.
Oh, I know how tight memory and mass storage used to be. And expensive. Far more expensive than I could afford, because I was 12 years old when I soldered together that old computer and this Tiny BASIC was the first programming language I got hold of (except, of course, doing everything in machine code). But also other resources were not as unlimited as we would have liked to have had them. If you look carefully, you will discover that not the BASIC programs were translated to IL, but that the BASIC interpreter itself was implemented on a simpler interpreter. This was done to make it easier to port between different machines and CPUs, just the underlying simple interpreter had to be rewritten. But with the slow CPUs this also made running the BASIC programs a very sluggish affair. In all the years I never had to modify the interpreter and I was surprised to discover such an approach. Practically everything else on this old computer was hand written machine code in order to make most of the little memory and the weak CPU. Implementing an interpreter on top of another interpreter appears somewhat wasteful.
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
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 KenobiI'd like to see a VAX/VMS, Z80, 8080, 6502...
0x2B || ~0x2B
-
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 KenobiWhew, you had me puzzled there for a bit. :) I wrote the 68000 version of Tiny BASIC (it's one of the links on that Wikipedia page), and I didn't remember anything about an IL interpreter. So, I just had to hop over to my web site and downloaded my source code (I'm not at my home computer) and do a quickie review. Luckily, my memory's not as bad as I feared. :-D I based my version on Li-Chen Wang's Palo Alto Tiny BASIC, which is a direct interpreter; no IL is involved. That Wikipedia page is a bit misleading in that respect -- I think I have some Wiki-editing to do. I do still occasionally get questions about my interpreter, though of course that's dropped off over the years. I haven't received any at all this year so far. On the other hand, I did get questions from a whole three people (I think) last year. I found Li-Chen Wang's source code reasonably easy to read, and the translation I did to 68000 assembler was fairly straightforward, as I remember. So, if you run into trouble with your conversion efforts and you're not using Palo Alto TB, I would definitely recommend using that as a base to start from. I might even remember enough about my interpreter to answer a few questions. Maybe. :) By the way, the closest I ever got to an 1802 was seeing a couple of COSMAC ELFs in operation at my local computer club. I sure did like their low power drain -- just never had a chance to design 'em into anything.
“The definition of embedded system has broadened over the geezerhood.”
-
Whew, you had me puzzled there for a bit. :) I wrote the 68000 version of Tiny BASIC (it's one of the links on that Wikipedia page), and I didn't remember anything about an IL interpreter. So, I just had to hop over to my web site and downloaded my source code (I'm not at my home computer) and do a quickie review. Luckily, my memory's not as bad as I feared. :-D I based my version on Li-Chen Wang's Palo Alto Tiny BASIC, which is a direct interpreter; no IL is involved. That Wikipedia page is a bit misleading in that respect -- I think I have some Wiki-editing to do. I do still occasionally get questions about my interpreter, though of course that's dropped off over the years. I haven't received any at all this year so far. On the other hand, I did get questions from a whole three people (I think) last year. I found Li-Chen Wang's source code reasonably easy to read, and the translation I did to 68000 assembler was fairly straightforward, as I remember. So, if you run into trouble with your conversion efforts and you're not using Palo Alto TB, I would definitely recommend using that as a base to start from. I might even remember enough about my interpreter to answer a few questions. Maybe. :) By the way, the closest I ever got to an 1802 was seeing a couple of COSMAC ELFs in operation at my local computer club. I sure did like their low power drain -- just never had a chance to design 'em into anything.
“The definition of embedded system has broadened over the geezerhood.”
My old computer is a Netronics Elf II and I keep it in its original state, so that there used to be little reason to modify any of the old software. But I also wanted to build a more modern Elf, just for the fun of it. I heard of an idea to synchronize up to eight CDP1802s (or CDP1804s) and have been trying to make something out of it ever since. This 'Parallelf' will certainly not be able to comply to even those few conventions the old Elf used to have, so we must adapt it. I now have found a complete annotated listing of Tiny BASIC for the CDP1802 and it turned out to be like described in the Wikipedia article. The author already anticipated the need to relocate the interpreter to other memory areas and the part in IL code is documented well enough to expand the language as you like. Who would have thought that someone would ever try to port it to a machine with up to eight CPUs and up to eight mb memory :)
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi -
I'd like to see a VAX/VMS, Z80, 8080, 6502...
0x2B || ~0x2B
-
Oh no! The enemies! Back then the religious wars were about CPUs :)
"Dark the dark side is. Very dark..." - Yoda ---
"Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi:laugh: :laugh: Yeah they each had there merits. I spent a lot of years on VAX/VMS and see that there are a lot of people that still have old MicroVaxes. I'd love to have one but have no idea what I would do with it?
0x2B || ~0x2B
-
I'd like to see a VAX/VMS, Z80, 8080, 6502...
0x2B || ~0x2B
Mike Hankey wrote:
I'd like to see a VAX/VMS, Z80, 8080, 6502...
Don't forget Abacus 2769
The 3-legged stool of understanding is held up by history, languages, and mathematics. Equipped with these three you can learn anything you want to learn. But if you lack any one of them you are just another ignorant peasant with dung on your boots. R. A. H.
-
Mike Hankey wrote:
I'd like to see a VAX/VMS, Z80, 8080, 6502...
Don't forget Abacus 2769
The 3-legged stool of understanding is held up by history, languages, and mathematics. Equipped with these three you can learn anything you want to learn. But if you lack any one of them you are just another ignorant peasant with dung on your boots. R. A. H.
:laugh: :laugh: Couldn't list em all, that was more for the Asian market anyway wasn't it? :)
0x2B || ~0x2B
-
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