Need some help with BASIC
-
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 -
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