6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Mar 28, 2024 2:16 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: CP/M-65 or DOS-65
PostPosted: Sat Sep 01, 2007 10:24 am 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
Hallo allemaal,


The question about the Z80 -> 6502 conversion triggered the following question? Is it possible to build something like CP/M-65 or DOS-65?

So far we have Apple's, Orics, Commodores, BBC's, Acorn Atoms and a lot of other 6502 based computers. And all with their own OS and file sytem. But can all those different systems run the same software? IMHO, yes. But there is a price to pay: the orignal ROM has to go [*].

The idea is to replace the original ROM with one that just contains the starting-up routines and the BIOS. The BIOS contains all subroutines to handle call from the program regarding the drive(s), keyboard, video and other peripherals like RS232, joystick and printerport.

Is this an idea that can gain enough interest to be realised?

I know there are a lot of questions to be asked, and more important, to be answered. But that's why they invented forums :)

[*] In some cases that can be realised without soldering. A Commodore 64 for example can load the BIOS in the RAM under the ROM and start it up. A VIC-20 could use the area reserved for games at $A000. Please think about how you could add a BIOS to your system.

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 24, 2007 3:01 am 
Offline

Joined: Sat Sep 04, 2004 4:17 am
Posts: 30
Location: Last Ninja 2: Basement
Ruud, I don't think it would really be all that practical to ask everyone to toss out their ROMs in their old computers.

I am currently in the preliminary stages of planning out development of a cross-platform 6500-series-based OS which I intend to market and license (and yes, there will be hobbyist licenses for you all!) The key goal of the system will be the ability to run on any 6502/65816 core system, regardless of whether it is a Commodore, Oric, Acorn, BBC Micro, Rockwell modem, C64DTV, Atari, Kestrel...whatever. The key will be in designing a system-specific Hardware Abstraction Layer (HAL) that provides the most low-level hardware abstractions to the OS such as timers, memory banking, and IRQ management. In a C64, for example, the CIA chips would be used to set up necessary timers, shuffle the I/O bank in and out as needed, and perhaps trigger a soft-IRQ for the keyboard which can typically only be polled. On a C128, a process switch to a different memory bank would be preceded by a call that would ensure said bank is in fact banked in properly. Things like that.

It's aggravating to design an OS, that's absolutely certain, and the details will certainly change before I am done, but the general idea will be that device drivers will be portable across 65xx platforms and all that is needed for a new system is a reworked HAL to handle the nasty details of that specific system that would otherwise waste many kilobytes of "which system are we running on?" routines and generally annoy me a lot.

I don't understand why the 65xx processors aren't used in more and more embedded applications; I'm guessing that the lack of a ready-to-use 32-bit CPU is one thing, because that makes it awful hard to even come close to competing with such things as ARMs, but the other thing surely is a complete lack of a licensable system that handles yucky details and leaves the embedded system designer to work on the guts of the actual needed code. There isn't a "65816 VxWorks" out there, and if that changes, perhaps the 6500's will see a resurgence, especially given their ridiculously low cost per unit and the inherent power of the esoteric 65xx architecture.

A computer for the price of LOTS of toys! From China! With lead paint!

(End rant.)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 24, 2007 8:33 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
It's not that writing an OS is hard.

It's writing an OS that will run virtually unaltered on anything is what's hard.

There do exist some operating systems for the 65xx architecture (e.g., Contiki, Lunix) which are highly portable already, and which are freely available. They even already have TCP/IP network stacks.

I think there will be something more that's needed to make the 65xx architecture more appealing. Some things I can immediately think of:

* Improved instruction timing. I'm not talking about shaving a few cycles off here and there either; I'm talking about single cycle instruction execution for most, if not all, instructions. This is very much doable by using a CPU that has an internal cache.

* A more orthogonal instruction set. This will make it easier to port higher-level languages to. In particular, the 65xx desperately needs improved support for indirect subroutine calls, thus enabling not only object oriented programming, but also higher-order functional programming (which is becoming a significantly more important programming methodology, independent of language). This also includes instructions which can (at the very least) add sign-extended, immediate values directly to the X and Y registers.

* End the bus-width tyranny. The accumulator, X, Y, and S registers need to become at least as wide as the memory address bus.

* Enable rapid subroutines using a new set of instructions which places (or fetches) the return address in a special register R, and include instructions PHR and PLR. I list what I would like to see below:
Code:
JPR :: Save PC in R, jump to effective address
  Addressing Modes:
    000  (denotes XPR instruction)
    001  X                PC loaded directly from 0:X
    010  rel16            PC adjusted by displacement (as per Bxx instructions)
    011  rel32            PC adjusted by displacement (as per Bxx instructions)
    100  (abs16)          PC loaded from value at PBR:abs16
    101  (abs32)          PC loaded from value at abs32
    110  (abs16,X)        PC loaded from value at PBR:(abs16+X)
    111  (abs32,X)        PC loaded from value at (abs32+X)

XPR :: Exchange PC and R contents
  Addressing Modes:
    000  Implied          Swaps PC and R for the purposes of fetching next instruction
    001  See JPR
    010  See JPR
    011  See JPR
    100  See JPR
    101  See JPR
    110  See JPR
    111  See JPR

Advantages: lightning fast subroutines at the leaves of the call graph.
XPR can be used to implement simple co-routine support as well (user must
take care to preserve CPU registers prior to issuing XPR however).

TAR :: Transfer A to R
TRA :: Transfer R to A
TXR :: Transfer X to R
TRX :: Transfer R to X
PHR :: Push R on stack
PLR :: Pull R from stack
XRZ :: Exchange PC and R if AND ONLY if R != 0


Anyway, that's my two cents. :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Sep 25, 2007 2:30 am 
Offline

Joined: Sat Sep 04, 2004 4:17 am
Posts: 30
Location: Last Ninja 2: Basement
The only problem with that is that it wouldn't be a 6502...it'd be a 6502 on steroids! :)

Unfortunately, we have to work with what we've been given.

Also, Contiki and LUnix LNG are nice semi-portable hobbyist operating systems, but they're not exactly "supported" or designed with embedded stuff in mind, AFAIK. They aren't designed to address COMMERCIAL needs, and they shouldn't be, either--after all, they're by hobbyists, for hobbyists.

But you know 10,000 times more than I do about this mess, so I can't argue on your level in the first place. I can hope to get a good one out every now and then, though! :P


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Sep 25, 2007 2:38 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
You know, I've more than once written about my ideas to Western Design Center, under the preliminary name of "65000", for no other reason than "it sounds cool and intimidating." :) Hopefully, some of my ideas have made it into the Terbium 32-bit architecture. BUT, until I see real silicon, sitting on my desk, with a databook describing it to its immediate right, and flickering address bus traces on the o'scope to the immediate left, it'll be nothing but vaporware to me.

Regarding the OS: I do hope you are successful in your ventures. Lord knows that I've missed many opportunities because I thought one thing, and reality was another. Don't let me stop you from your endeavors, no matter how much I nay-say. :)

I grew up a negative kid, in a negative family, with negative role-models (and to think, I'm NOWHERE near as bad as they are!). So, I may "know my stuff" when it comes to OSes, but that doesn't mean I know my stuff when it comes to opportunity. My history is noticably lacking in that department. :) I'm interested in seeing your results when they're available, although I'm more of a language-as-the-OS kinda guy.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Sep 25, 2007 4:53 am 
Offline

Joined: Sat Sep 04, 2004 4:17 am
Posts: 30
Location: Last Ninja 2: Basement
Well, I'm one of those people who sees things from many perspectives; I run a business, so I can see the business side of things where most of us tech-heads see only things like cool stuff that can be done with X, Y, and Z, or dream about the ideal and say "if only this worked like this!" I love to dream about what can be, but I also am so firmly seated in reality that I see what there is and what it is useful for as-is. BSD, Linux, VxWorks, QNX...they're all designed specifically to be used for certain purposes, and without those purposes, they would never have become the successes in their fields that they are. It's too easy to shoot off on trying to make something awesome, and I suppose that's really why the 6500 series lies somewhat stagnant: there is no SERIOUS BUSINESS about the CPU to speak of. No one takes it seriously enough to design a highly flexible operating system that will address the business concerns that must be addressed to make a 6500-series CPU useful to an embedded designer. Having a MIPS VxWorks-based design is all fine and great, because there's nothing cheaper that may be able to do the job. The 6500's are DIRT DIRT CHEAP, and having an OS available that can make it shine to a BUSINESS, as well as be pretty damned awesome for us HOBBYISTS as well, is really what I see lacking.

I'd love to have a Terbium or a 65816 MMU, but it ain't there, and if it was, the software ain't there that can QUICKLY be switched to support such a radical change in how the basic memory interaction works. Some of the software designs I am making target precisely this problem, and they're ugly as hell, but they'll rock when I get them hammered out.

And besides, YOU probably DON'T want to do that kind of dirty work. Not when you can roll your own for your own special system and enjoy that more. And you shouldn't, because that's not what you'd like. I'd like to make the 6502 live like it did in the early 80's, and that's what I'm shooting for, because that would make me quite happy. We'll see if I ever make it happen, but hell, someone's got to try. WDC obviously isn't going terribly far beyond providing datasheets and compilers, after all...or at least, from what I can tell.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Sep 25, 2007 7:26 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
Quote:
I don't understand why the 65xx processors aren't used in more and more embedded applications
. . .
and if that changes, perhaps the 6500's will see a resurgence
. . .
and I suppose that's really why the 6500 series lies somewhat stagnant: there is no SERIOUS BUSINESS about the CPU to speak of.
. . .
I'd like to make the 6502 live like it did in the early 80's

It may interest you to know that 6502 processors are going into products today at the unprecedented rate of hundreds of millions of units per year, according to WDC.  The reason you can't see these processors is that they're at the heart of custom ICs going into all kinds of consumer applications (most of them having no OS).  You may own a bunch that you didn't even know about.  WDC's main business is not selling hardware, but rather licensing the IP.

Nevertheless, I read this thread with interest, and it has me thinking about adding to an old thread about the possibility of a modern 65K-based PC, scaled down not just to fit a 65816's capabilities, but intentionally to get away from the frustrating and unnecessary complexity and bloat into which the market has driven PCs and their software [edit, 1/4/24: which I just found out is called "Wirth's law."  The Wikipedia article starts with, "Wirth's law is an adage on computer performance which states that software is getting slower more rapidly than hardware is becoming faster.  The adage is named after Niklaus Wirth, a computer scientist who discussed it in his 1995 article 'A Plea for Lean Software'."].

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 04, 2008 11:14 pm 
Offline

Joined: Tue Sep 24, 2002 4:56 pm
Posts: 50
Location: Essex, UK
(I know it's been a while since this thread was last replied to, but bear with me - the reason for my post should become clear.)

A thought came to me in the last few days: CP/M was (AIUI) written as cross-platform hobbyist/commercial OS for early Intel 8080-based computers, and caught on because (as much as anything else) it was relatively easily adaptable to a range of designs - such as whether or not the computer had a "local" console (built-in keyboard and graphics hardware), or used a serial port-connected console - and gave a "standardised" OS, with access to all the application software available for that OS, different disc formats notwithstanding.

However, I've not really heard of anything directly equivalent for the 6502 - perhaps there was too much of a "the-chicken-or-the-egg" problem (the OS needed to be available on different early computers to gain support, but needed to gain support before being made available for different early computers), or perhaps there wasn't the same "coming together" of different early computers, to _allow_ for a common OS - I'm not *quite* old enough to have got caught up in the KIM-1/SYM-1 scene of the mid-to-late 70's, and my knowledge of this point in time is imperfect.

As to trying to develop a common OS for a (wide) range of 6502-based machines - _I'd_ not want to write a suitable HAL, due to the wide range of 6502-based machines, which (from one point of view) seem to have little enough in common, apart from being 6502-based.

*However* (and thanks to anyone who's stuck with my - hopefully not _too_ uninformed - rambling so far), there _is_ an OS that this forum's readers could work on - and that's an OS for Daryl's SBC-3.

So - I've put my £0.02's worth forward; comments, anyone?

--Martin

_________________
Martin Penny

.sig in beta - full release to follow.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 04, 2008 11:43 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Actually, a number of solid OS designs have come out for the 6502; Commodore's KERNAL is remarkably competent, even in supporting installable filesystems despite not being designed for this task! Acorn's OS looks quite capable, and Atari's OS equally impresses me. What is lacking in each of these, however, is the desire to retarget their respective kernels, and the desire to write a usable shell around them.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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: