Page 2 of 2
Re: Building the "Perfect" Programming Language
Posted: Fri Oct 13, 2017 9:48 pm
by BigDumbDinosaur
I never really had an idea how it worked on the Commodore. I know (I think) that the disk was Device 8, but beyond that, I'm not sure how things like drivers and such were handled there. I don't even know if the Apple had anything close to what the Atari (or even the Commodore) had. Seems like it was just a bunch of well know addresses that it relied on, rather than a first class abstraction.
Commodore's operating environment depended on the fact that the disk drive was intelligent, offloading the details of raw disk management from the host machine. Each disk had a device number, starting at 8 and in the case of dual drive units, e.g., the 8050 and 8250, a "logical unit" number of 0 or 1, which addressed the target drive mechanism. Functions related to file housekeeping were carried out within the drive in response to simple commands passed from the host machine. For all practical purposes, Commodore's disks were special-purpose computers in themselves, as they had a 6502, along with firmware in ROM and some RAM to act as block buffers and workspace.
This scheme was based upon the IEEE-488 parallel bus (aka GPIB or HPIB) protocol, even in the case of the VIC-20, C-64, etc., and their serial buses. The host's "kernal" ROM contained low-level functions for accessing the peripherals and higher-level functionss for accessing files, which were addressed by file number, as is done in UNIX and Linux. In principal, the Commodore DOS was a vague copy of the way in which the DEC PDP series of minicomputers accessed their peripherals. I'm sure this was because Commodore did their cross-development on PDP-11s and later on, VAX 11/70s.
Re: Building the "Perfect" Programming Language
Posted: Fri Oct 13, 2017 11:03 pm
by bdk6
I should clarify one thing that I said a couple times. When I say "self hosting" I mean that the compiler RUNS on and generates code for the same machine. It does NOT necessarily mean that the compiler is BUILT on that machine or that it can build itself on that machine or even that it is written in its own language.
For instance, one might use cc65(I know...) to write the compiler on a PC. Once it's built, the generated program is copied over to, say, a VIC 20 where it can then be used to compile other programs in its language, say BASIC.
The compiler would almost certainly be a bigger program than it could compile reasonably well, for many of the reasons Whartung pointed out. Memory, whether RAM or disk, being the biggest problem.
If I do write a self-hosted compiler, the language will of necessity be rather simple; it will be possible, but not easy, to write a compiler in that language. C is pretty good for writing compilers and C++ is even better, but BASIC is not (my opinions, of course!) I'm crazy, but not crazy enough to try to put a C++ compiler on a VIC 20.
Re: Building the "Perfect" Programming Language
Posted: Sat Oct 14, 2017 8:06 am
by BigEd
That's a good definition of self-hosting, for me, and also a desirable goal.