6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu May 16, 2024 9:31 am

All times are UTC




Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: Sun Jan 22, 2006 9:22 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
daivox wrote:
No, I don't like o65 format. I know someone will ask, "Why don't you just use o65+luna+lupo+lld for everything?" I am of the opinion that it's an unnecessary burden to use a generic executable format that is designed to accomodate multiple 8-bit processors and operating systems when I can make a better format that will cut down on the size of the dynamic linking loader a lot. Just wanted to cut that one off before it comes up. :P


I thought the o65 format was actually rather elegant, and didn't at all seem too 'generic' for 8-bit processors. In fact, all the relocation records it supported seemed, to me, to be quite specific to the 6502 and 65816 processors.

Quote:
I can't think of a single disk operating system for the 64 off the top of my head, unless GEOS counts.


Commodore put the DOS inside the ROMs of the disk drives themselves, and not on the host computer. Communications with the disk units were through file-like interfaces in the Commodore Kernal (<-- yes, that's how they spelt it for some reason), sending streams of commands and data through what basically amounted to IEEE-488 interfaces (both serial and parallel).

GEOS was not a DOS as such; it was more of a real OS that happened to include disk acceleration capability. However, I do love its VLIR files. I was strongly considering making a similar library to implement VLIR file capabilities in Linux using portable C, albeit with support for more than 127 records per file. :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 22, 2006 10:54 pm 
Offline

Joined: Sat Sep 04, 2004 4:17 am
Posts: 30
Location: Last Ninja 2: Basement
Where can one find more information on VLIR? I have been curious for 10 years, but never actually found out what made it such a special thing.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jan 22, 2006 11:53 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
daivox wrote:
Where can one find more information on VLIR? I have been curious for 10 years, but never actually found out what made it such a special thing.


You're going to be embarrased, because it is so simple. I can describe them entirely from memory here, and any GEOS programmer at the time can vouch for its accuracy.

Prepare . . .

A VLIR file is essentially an array of sequential files. There is a central sector (256 bytes), which was treated as an array of two-byte pointers (itself consisting first of a track byte then a sector byte) -- thus, the array had 128 elements in it. This was set in stone.

Element 0 was, traditionally, a link to another sector continuing the chain of sectors making up the array. However, it was never used, and GEOS itself didn't support it in any commercially available release. Therefore, it was always set to $00,$00.

Elements 1 through 127 were used as pointers to normal CBM-DOS-style sequential files. These are referred to as records. Because each record was organized as a unique sequential file, each could be a different length (hence, Variable Length Indexed Records, or VLIR). Note that VLIR records did not have corresponding CBM-DOS directory entries. For this reason, you must never use CBM-DOS's V command (to validate / fsck / chkdisk the disk), because all allocated sectors not belonging to a normal CBM-DOS file entry will be marked as free. You must always use GEOS to validate the disk, which is aware of VLIR files innately.

Code:
     Index Sectors
     (Pointed to by CBM-DOS'
     directory entry)

     +---------------------+
     |      .........      |
     |    Standard GEOS    | 
     |     File Header     |   
     |      .........      |
     +---------------------+
+$00 | Next Block (unused) |
     +---------------------+        +------+    +------+    +------+    +------+
+$02 | Record 0 pointer    |------->| Next |--->| Next |--->| Next |--->| 0,0  |
     +---------------------+        +------+    +------+    +------+    +------+
+$04 | Record 1 Pointer    |        | .... |    | .... |    | .... |    | .... |
     +---------------------+        +------+    +------+    +------+    +------+
     |      ........       |
     +---------------------+
+$FE | Record 126 Pointer  |
     +---------------------+



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 23, 2006 1:13 am 
Offline

Joined: Sat Nov 19, 2005 11:44 pm
Posts: 10
Location: London
kc5tja wrote:
I remember AmigaOS blasting away 20fps to 30fps, full-screen video, reading it in from floppy, in near real-time (in particular, I'm referring to Space Ace game, as shipped on floppy). It was obviously compressed on the disk, which made for faster I/O. Still, no other computer at the time could touch this level of performance. Of course, today things are much different.


*choke* Acorn ARM prototype ... this was in 1987, on an 8MHz CPU with 1Mb of RAM and was realtime 3d with multi channel sound: http://www.nightsoil.co.uk/blog/images/ ... -small.gif .. It's a shame that RISCOS didn't get over the US in any knowledgeable quantity. After all it was Acorn that invented the ARM processor because they weren't happy with moving to the 65c816. I still like the simplicity of the 65xxx series though which is why I'm here. It does the job :)

kc5tja wrote:
Of course, I worked for Amiga, Inc. after Commodore disbanded, so I am biased.


Ack I understand the Amiga love now. I had a friend (only 2 years ago) that would not part with his A1200 so I can see there is a strong attachment there!

kc5tja wrote:
That being said, I was doing some research on RiscOS (BTW, no matter what Linux distribution I use, I always make it a point: the #1 thing I compile is ROX-Filer) a while ago, and was quite deeply impressed. The only thing that bummed me out was the decision to use cooperative multitasking instead of preemptive. Other than that, it looked like a really nice environment.


Ironically cooperative multi-tasking is great. Most of the apps are written directly in ARM assembler so the people writing them are 100% aware of how to write good apps that play nicely. I've had a RiscPC up and running without a crash on daily use for about 3 months at a time. Cooperative multi tasking - these are VIDEO streams playing:

http://www.worldofwibble.com/images/riscos/rs-3.jpg

kc5tja wrote:
Going back to MOS and related topics, I am curious to learn what would happen if you issued the wrong filesystem. For example, supposing you have a volume ADFS::MyVolume with a file called data/txt in the root directory, what would happen if you issued CDFS::MyVolume.$.data/txt as a filename to work with?
Thanks.


File would not be found. Basically the filesystem is contained within CDFS or ADFS modules, so it'd ask the respective module to return the file.

Anyway back to sleep :(


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 23, 2006 6:10 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
cseemeuk wrote:
*choke* Acorn ARM prototype ... this was in 1987, on an 8MHz CPU with 1Mb of RAM and was realtime 3d with multi channel sound:


Not to put the Acorn Archimedes series down, but, you can't argue with the numbers: Amiga 500 equipped with a 7.15909MHz 68000, 512KB of RAM, and an 880KB floppy drive. The game in question was Space Ace, which even off of a floppy, was indistinguishable from the video disc stand-up arcade version.

Quote:
It's a shame that RISCOS didn't get over the US in any knowledgeable quantity.


Agreed; I was unaware of its existance even after I'd left Amiga, Inc. However, I suspect Commodore had a lot to do with that, as they were in charge of nearly the entire production line of their computers, and therefore had the ability to utterly undercut anyone who dared compete with them. You can thank the VIC-20 for the failure of the MSX-standard machines from ever entering the American market. I suspect it was the Commodore 64 that prevented Acorn's BBC series, and the Amiga which prevented the Archimedes. Commodore had a *damn* powerful computer lineup under its belt.

Too bad Irving Gould went all retarded on Tramiel. If I ever see Irving Gould in person, I'll rip his private parts off and stuff 'em down his throat. He built the company, then threw it all away. I just don't understand it. Sorry, I'm venting.

Quote:
After all it was Acorn that invented the ARM processor because they weren't happy with moving to the 65c816.


The 65816 has performance comparable to a similarly clocked 68000, so I can also see why they didn't go with the 68000. Too bad Texas Instruments hadn't modernized their TMS9900 by that time -- the TMS9900 equipped with the 6502's bus architecture would have **DESTROYED** the 6502 and 65816 combined. I wish I could have gotten to know it better. Although still CISC, it came so close to being RISC that you could just smell it. Check it out at
http://www.stanford.edu/~thierry1/ti99/assembly.htm -- one of the few places on the Internet where you'll find real meaty information on the chip.

Quote:
I still like the simplicity of the 65xxx series though which is why I'm here. It does the job :)


You know, it's funny -- I am sticking with the 65816 for the Kestrel designs (my own homebrew 8/16-bit computer design, which I hope to bring up to the level at least of the Apple IIgs if not further, but being fully openly documented and GPLed), but I was thinking of a different homebrew line after the Kestrel potential was exhausted that was based on the ARM architecture.

Quote:
Ironically cooperative multi-tasking is great.


Yes!!! I agree wholeheartedly! But, the problem is that you must always write perfect programs for it to be great. Cooperative multitasking is a "Code Quality Amplifier" -- poorly written software will have an incredibly adverse affect on the performance of a cooperatively multitasked system, while it'd barely be noticable (if at all) on a preemptively multitasking system.

Quote:
File would not be found. Basically the filesystem is contained within CDFS or ADFS modules, so it'd ask the respective module to return the file.


Gotcha. In that case, I must question the use of all the special syntax then. Why not just express a filename using a fixed template, like /filesystem/volume/dir/dir/dir/file?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 23, 2006 6:12 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Quote:
http://www.worldofwibble.com/images/riscos/rs-3.jpg


403 Forbidden error. File permissions set right?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 23, 2006 6:20 am 
Offline

Joined: Sat Sep 04, 2004 4:17 am
Posts: 30
Location: Last Ninja 2: Basement
Click the link, then go to the address bar and hit enter.

It's blocking you based on the HTTP referrer being an external site. Trick used by Imageshack also---I've seen it in use a lot lately.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 24, 2006 12:31 pm 
Offline

Joined: Sat Nov 19, 2005 11:44 pm
Posts: 10
Location: London
Quote:
You know, it's funny -- I am sticking with the 65816 for the Kestrel designs (my own homebrew 8/16-bit computer design, which I hope to bring up to the level at least of the Apple IIgs if not further, but being fully openly documented and GPLed), but I was thinking of a different homebrew line after the Kestrel potential was exhausted that was based on the ARM architecture.


There are some dirt cheap ARM eval systems now - LPC2100 based which are a good basis. I was thinking about grabbing one of those nice ARM+FPGA development kits and having a play but I have precisely zero money at the moment :(

I'I'm going to attempt to build a Forth CPU from TTL one day. Should keep me busy for a couple of years.

Quote:
Gotcha. In that case, I must question the use of all the special syntax then. Why not just express a filename using a fixed template, like /filesystem/volume/dir/dir/dir/file?


Legacy support - typically. One reason I like Apple - they're not afraid to chuck it all every few years.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 24, 2006 7:50 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
cseemeuk wrote:
I'I'm going to attempt to build a Forth CPU from TTL one day. Should keep me busy for a couple of years.


Shouldn't be all that hard. I remember building a 4-bit non-Forth CPU back when I was a teenager, that lacked many features, but otherwise worked. It had something like 9 opcodes, as I recall, none of which was useful, except for NOP. ;D

I would like to revisit the homebrew CPU at some point as well. Discrete HC/AC TTL components just adds to the mystique. However, I would also like to play with FPGAs too, not only for Forth CPU research, but also to make a clone of the TMS9900, just so I can play with a 33MHz 9900 with single-cycle bus access (no, I have NO intention to replicate the abomination that is TI-99/4A). :twisted: Maybe I can expand the address space a bit too.

But this is starting to veer wildly off-topic. I recommend PMing me for further responses to this sub-thread.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 14, 2006 12:34 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
After reading through a few papers on how Plan 9 supports every major system service via a true filesystem interface (making Unix look pathetically archaic in comparison). And, I got to thinking: Commodore had Plan 9 beat by 10 or more years. There were only two things that were critically lacking, and one not-really-quite-so-critical thing.

First, in Commodore's kernel (sorry, but I refuse to use the CBM-misspelt name ;)), all I/O is performed over a byte-stream service. This is precisely the same interface as Plan 9. This is theoretically the same class of service that Unix also offers, but over time, Unix (instead of making use of special control files like Plan 9 does) introduced such meta-operations as ioctl(), fctl(), sockopt(), etc. In both the Commodore and the Plan 9 universes, this is done using special control files.

I therefore did some research on the Commodore Kernel, and found out that there were only ten or so kernel functions that were truely "portable" (in the sense that you could implement them on virtually any microprocessor). Of these, however, only six require any significant porting effort (by which, I mean having to spend more than two hours writing the code for the new platform): OPEN, CLOSE, CHKIN, CHKOUT, CHRIN, and CHROUT. The remainder are utility functions such as CLALL that are so trivial to port that they don't require any significant porting effort.

It is also interesting that these functions assume all devices are GPIB devices. And, it just so happens that all of them are vectored through RAM, thus allowing for future capabilities (like, mapping devices 32-63 to a second IEEE-488 bus, for example). Well, what happens if we define a pseudo-device 255 such that it's filename space happens to be a generic, hierarchial namespace?

I am attempting to implement such an extension now, and it's being defined for the Commodore 64 for the time being. I suspect that it would be easy to port to the +4, Commodore 128, and for that matter, even a PET or VIC-20. This new subsystem is called Colonel. :)

Initial estimates indicates that Colonel can fit in 2KB of space or less, not including dynamic data (like device node structures), thus making it viable also for an unexpanded VIC-20. Barely. :) I'm writing the sources using noweb, a literate programming tool. This will therefore allow me to fully document the internal structure of the software in a way that no other Commodore documentation has been able to provide in the past. Indeed, looking at the Linux sources sure isn't helpful in determining how its VFS system is implemented. The book that will result from this will be very enlightening. English only, I'm afraid, as I'm only English literate.

I posit, therefore, that the Commodore Kernel already makes an ideal "BIOS" of sorts for a standard, 6502-targeted CP/M-like operating system. All that needs to really be written is a replacement for BASIC which serves as the command-line shell.

For those platforms which do not have the Commodore Kernel in place already, let it be known that the overwhelming majority of the Commodore Kernel functions are related to either the screen editor, or to hardware specific functionality (e.g., IEEE-488 or IEC buses, reading/writing the VDC chip in the Commodore 128 and B-series computers, etc). Therefore, they're relatively rarely used, and the programs that do use them make obvious assumptions about the underlying hardware. Thus, we can claim that the Commodore Kernel really consists only of OPEN, CLOSE, CHKIN, CHKOUT, CHRIN, CHROUT, CLALL, SETNAM, SETLFS, and maybe even READST. The rest are user interface amenities or utility functions to help with lower level I/O facilities (e.g., bit-banging the serial IEC bus). With so few core functions, it should be quite possible to "port" the Kernel to other 6502 platforms easily. Thus, as with CP/M, the "BIOS" (kernel) is implementation dependent, while the BDOS and other layers on top of it are relatively portable.

Anyway, enough background. The basic idea in Colonel is the implementation of a hierarchial, uniform namespace with support for installable device drivers that run locally on the machine. This flat space is assigned pseudo-device 255. For example, here is a simple hypothetical BASIC 2.0 program that makes use of the mouse (assumes Colonel and a mouse driver are already loaded):

Code:
10 PRINT "{clrhome}CLICK ON [QUIT] TO EXIT."
20 Q=0:REM QUIT INDICATOR
30 OPEN 1,255,0,"DEVS:MOUSE:0"
40 IF Q<>0 THEN GOTO 90
50 INPUT#1,X,Y,B
60 PRINT "{home}{down}X=";X;"Y=";Y;"B=";B
70 IF B<>0 THEN Q=1
80 GOTO 40
90 CLOSE 1


Colon is used instead of the slash since CBM-DOS lets slashes appear in filenames. I didn't use a comma because, as with VMS, the comma appears to be used to append options to specific arguments (e.g., OPEN 1,8,1,"COLONEL,P,W").

Anyway, you get the idea. Drivers are selected based on longest match of the given filename. The filename is available in its entirety for the driver to examine (for example, the driver itself may be bound only to DEVS:MOUSE, treating the :0 suffix as a parameter for something -- in this case, which port the mouse would be hooked into).

This should work also with LOAD and SAVE as well. In fact, a better form of directory support should be implementable with yet another special driver:

Code:
LOAD"CATALOG:DEVS",255
LIST


could be used to get a directory listing of what's currently inside the DEVS directory.

Since the C64 lacks any concept of "current directory," it follows that all paths specified are inherently anchored at the Colonel's root namespace. Therefore, there is no need for a leading colon (contrast with Unix, where to specify an absolute path, you need to specify the leading slash). Support for "current directories" shouldn't be too hard to implement, but at this stage of the game, I don't yet see any need for it.

Just giving an update on my rationale and thinking processes. I'll update here once I finish Colonel to a point where it's usable.


Last edited by kc5tja on Tue Feb 14, 2006 7:25 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 14, 2006 3:01 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Oops -- I forgot to list the 2 critical missing links (although I discussed the first one above just after the example):

(1) Uniform namespace following well-known conventions.
(2) A means of "mounting" new device drivers so that accessing devices was intrinsically location independent (e.g., the device could reside on the 1541, or it could reside on the local computer, with equal ease).

(1) was discussed above.

(2) is achieved by forwarding requests out to the appropriate device. For example, DRV:8:0:FOOBAR would refer to a file called FOOBAR on device 8, first drive. (So, for dual-drive units like the Commodore 8050 disk drive, you could theoretically refer to a file DRV:8:1:BEERBAZ.) Since all Commodore disks have volume labels associated with them, you could reference them like subdirectories too (provided the local forwarding driver supported auto-mounting, which allows things like VOLS:GEOS SYSTEM:KERNAL, which is awfully convenient because now you don't need to know which physical unit number or drive number for the disk you put it in with. Anyone familiar with MacOS or AmigaOS will immediately know just how incredibly adorable this feature is!). For drives that support subdirectories or named, hierarchial partitions that can be used as subdirectories (e.g., the Commodore 1581 disk drive), the forwarder obviously can perform the required translation for names like VOLS:MY DISK:GEOS FILES:GEOWRITE:MOM'S LETTER 02.2005.

The third item that wasn't quite so critical, as evidenced by the success of CP/M versus MP/M, was support for multitasking.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Sep 14, 2006 4:46 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 994
Location: near Heidelberg, Germany
Hi guys,

only found this thread recently....

As for writing a new 6502 operating system with microkernel architecture, you might want to have a look at my GeckOS http://www.6502.org/users/andre/osa/ operating system. Although I have to admit I plan to overwork the inter-process/thread communications part a bit, as it is not performing well for bulk data (like loading files).
It has a CLI interface only at this time, but filesystems for Commodore disk drives, as well as FAT12/FAT16 filesystems (the latter is experimental) and device drivers for SCSI drives for example.

The microkernel supports only the most basic functionalities, so you can easily use it in embedded devices for example. Wrapped around this is a "lib6502" layer, that defines standard library operations: http://www.6502.org/users/andre/lib6502/index.html
The lib6502 layer could even be ported to other operating systems, the library is designed for applications to run on multitasking, single-tasking whatever systems, as long as the library calls are used.

The lib6502 also has a "semantic" understanding of filenames, which - depending on the system - can be single character drive names/numbers or even multi-char names for a device.

It normally (with the current lib6502 impl.) uses the o65 file format to load files into memory. Concerning the "complexity" - for any system you can define that you do support only a subset of the features. e.g. with the current version there is bit to define "block-wise" alignment, reducing the file size and loader code a bit.

Now I don't want you to use this (of course I'd be happy if you would... ;-), but you may want to have a look at it for some new ideas for your approach.

Andre


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 27, 2022 5:58 pm 
Offline

Joined: Sun Nov 27, 2022 5:53 pm
Posts: 3
Strangely enough, only 17 years later, this idea got realized: https://github.com/davidgiven/cpm65


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 27, 2022 6:27 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
(welcome!)

See also the more recent thread by Dietrich
CPM-65 - yet another approach


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 28, 2022 3:24 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8186
Location: Midwestern USA
olav wrote:
Strangely enough, only 17 years later, this idea got realized: https://github.com/davidgiven/cpm65

There are several CP/M lookalikes around that target the 6502. The oldest of them all, as far as I know, is Richard Leary’s DOS/65, which dates back to 1983, I seem to recall.

User floobydust modified Richard’s code to take advantage of the features of the 65C02, resulting in a code shrink and (probably) some performance improvement.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: