floobydust wrote:
Also, I tend to agree that implementing an OS form the 70's/80's is probably not the goal here, much less having filesystem compatibility for things like CP/M.
The CP/M filesystem is extremely primitive—more so than the filesystem implemented by Commodore in their floppy disks—and is easily corrupted (I have experience with this from many years ago). If at some point it is desired to be able to read and write CP/M files that capability can be addressed in a filesystem driver that can be attached to the kernel, same as is done in modern systems.
Quote:
I'm also specifically stating the 65C02 as an 8-bit implementation, not the 65C816 (at least not for now).
However, a 65C02 implementation should be able to work with the '816 running in either mode as long as the RMB/SMB and BBR/BBS instructions are not used—their opcodes on the '816 are used for other purposes. Once a 65C02 kernel is stable a native mode '816 version can be developed.
Quote:
For the past two years, I've been sporadically working on a 16-bit IDE interface for my own C02 Pocket SBC. This is a separate I/O adapter which has a 44-pin (2.5-inch) IDE port and a realtime clock. I'm about ready to pull the trigger on getting the PCBs made, but as of yet to have written any code, except for adding I/O port definitions to my existing BIOS. Having giving this lots of thought, I'm basically taking the path of using the older (16-bit) FAT filesystem for disk layout. The reasons are fairly simple:
1- It's well documented and shouldn't be overly complex to implement.
2- Every current OS supports the file format for compatibility.
3- Based on above, you can always use another OS to format the media and check (and hopefully) repair the filesystem.
FAT would not be my choice as a primary filesystem. It too is easily corrupted (Peter Norton made his millions because of that "feature," something that was not lost on Microsoft when they developed Windows NT 25 years ago—the NTFS was the result), and FAT12 and FAT16 are significantly limited in maximum file and filesystem size. You'd really need a FAT32 implementation to support modern mass storage.
Also, like CP/M's filesystem, FAT doesn't distinguish file types except by filename extension. File type should be an immutable structural feature, not something that is interpreted from an arbitrarily-assigned name. What's to stop me from renaming
abcdefgh.123 into
abcdefgh.exe or
abcdefgh.com and thus potentially fooling the operating system into thinking it's an executable binary?
Quote:
I also tend to like the Commodore concept of using a separate CPU system to implement the filesystem and have a simple, albeit faster, connection to a main SBC setup. It offloads a lot of work and allows a more complex subsystem to be implemented without worrying too much about the resources (ROM/RAM, CPU cycles) required.
Commodore's approach came about because they had a chip foundry at their disposal and they would be using fewer host resources than if they had decided to run the DOS in the computer, as was done with CP/M and is done with all modern systems. Also, for reasons that had to do with marketing, the PET and CBM machines (as well as the B-128) were equipped with an IEEE-488 interface to attach peripherals, which meant said peripherals had to be intelligent. This concept was carried over to the VIC-20, C-64 and C-128 (and others) mostly so kernel code could be reused and older disk designs could be adapted to newer models—the Commodore serial bus is basically IEEE-488 minus the 8-bit parallel interface (and it's greater speed).
However, working with Commodore's DOS is akin to trying to drive a car through a slalom while sitting in the back seat, a concept with which I became all too familiar back when I did professional development on the C-128 and its horrid (and slow) floppy disks. It was for this reason, and others, that the Xetec Lt. Kernal hard disk subsystem moved the DOS back into host processing space (specifically, into RAM inside the SCSI host adapter, which appeared at $8000 when disk communication was in process). In the process, the Lt. Kernal DOS ended up being far more powerful than anything Commodore developed, despite it being confined to 8KB of "shadow" RAM and despite having to bit-bang the SCSI bus.
Quote:
I also opted to use the older IDE interface as it too is well documented and is easily interfaced to a 65xx system.
IDE is good and although it disappeared from PC hardware over a dozen years ago, disks and CD drives are still available.
When the time came for me to add some mass storage to my POC unit I went with SCSI. The choice came about because I have a lot of experience with SCSI (dating back to before it was an ANSI standard) and I could get my hands on intelligent SCSI controller ASICs (specifically the AMD/NCR 53CF94, which is readily interfaced to a 65C02 or 65C816). Also, I have ready access to a lot of SCSI hardware scavenged out of old servers that have been rehabbed in my shop. SCSI is heavily documented (more so than IDE) and has the additional advantage of greater device intelligence and higher bus speeds, although the latter is of little importance in a 65C02 system.
What would be nice would be to figure out how to interface SATA disks to a 65xx system. SATA disks are cheap these days, reliable and available almost anywhere. Unfortunately, I know of no SATA ASICs that are available for the purpose—everything seems to be embedded in motherboard chipsets and not in discrete devices. In theory, bit-banging SATA should be possible, if slow. However, the SATA standard appears to be impenetrable unless one wants to spend a lot of money to purchase documentation.
However, I must hasten to add that the type of mass storage in itself has no bearing on the type of filesystem used. The two are completely separate entities that happen to be synergistic. In modern operating systems, mass storage of any kind is interfaced to the kernel with a suitable device driver—the kernel itself doesn't include the necessary software (also true about the filesystem—that too is implemented in a device driver module). By keeping the two as separate entities you pave the way for the use of different types filesystems in conjunction with different types of storage devices by developing appropriate drivers and devising a convention for passing commands from the kernel proper to the device driver and passing the results from the device driver back to the kernel. Modularity is the key.
Quote:
Needless to say, this could turn out to be a very long project for me personally, given my retirement status and the fact that I'm now more busy than I ever imagined! So... post away... the good, the bad and even the ugly!
That's the beauty of a hobby: there's usually no deadline—unless your death is imminent.
Dr Jefyll wrote:
Hmm, interesting project! But if bridging across platforms is your goal, then how much sense does the " 'C02 only " stipulation make?
I think his meaning of "bridging across platforms" is that of developing a common OS that works with homebrew machines, not the Apples and Commodores of the world. I suppose one could reach back to the NMOS hardware by carefully choosing the instructions to be used. However, it would be a shame to not take advantage of the greater power of the 65C02 (and '816) just to maintain some yet-to-be-specified compatibility with the NMOS universe.
Quote:
Garth has noted that C64, Apple II, etc. already have file systems, but owners of those machines still could be a target audience, it seems to me. The common medium could be an IDE adapter (to Compact Flash or an actual IDE HDD), or floppies, or a wired link between machines.
Interesting you mention that, as I earlier mentioned the Xetec Lt. Kernal (LK). That was a (very complex) adaptation of SASI disks to the C-64 and later the C-128. As one of the few people who had access to the technical details of the adaptation, I came to appreciate just how tightly integrated everything is in those machines. Roy Southwick and Lloyd Sponenburgh had something like three man-years invested in developing the LK, with about seventy percent of it in working around the rigid hardware architecture of the system. No Commodore 8-bit machine was ever intended to have a DOS running within, and the hoop-jumping it took to get there with the LK was mind-boggling (in fact, the "Lt. Kernal" monicker was a treacherous pun on the enormity of what was accomplished in getting the system to work).
While I would never discourage anyone from trying to repeat what Roy and Lloyd accomplished 35 years ago (it would be somewhat simpler with modern programmable logic), I'd say such an effort would be of limited value. If that sort of arrangement for a C-64 or C-128 were truly desirable the Rear Admiral subsystem, which was a second generation version of the LK (I have one in storage, along with my C-128D), would have been a resounding success.
The Rear Admiral was a dismal failure.
Something of a similar concept to the LK might be simpler with an Apple ][c (and possibly a ][e) due to a better machine architecture. In my opinion, if this was what Apple 8-bit users wanted it would have already been hatched.
I think the initial approach of targeting 65C02 systems makes sense, with a caveat. As we've seen here in different projects, memory maps can be idiosyncratic. That will pose a problem with portability. Going back to CP/M for a minute, CP/M placed certain requirements on the machine architecture, as contiguous RAM had to be available for the CCM, TEA, etc., and couldn't be interrupted by ROM. Unlike the 65xx family, the 8080 and Z80 have a separate I/O address space and a set of machine instructions to access it—this baggage continues to be carried in the x86 MPUs. This is not the case with the 6502, which sees I/O as ordinary memory. That gives rise to the specter of I/O breaking up the memory map in an odd way.
There would have to be some basic requirements about machine architecture if any kind of OS portability is to be achieved. I think that will be a significant stumbling block in trying to bridge the chasm between homebrew systems.