Can we learn from Amiga OS?

A place to discuss general QL issues.
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Can we learn from Amiga OS?

Post by Peter »

In the "Beyond Super Gold Card" topic an interesting point was raised:
XorA wrote:
For me, figures like this prove again that ideas of native hardware with Raspberry as coprocessor are pointless.
I would have to agree with Peter on this.

And AROS (Amiga Research Operating System, an AmigaOS 3.1 compatible OS) proves you can take and old 68k OS and "convert" it to other CPUs. It even automagically runs a 68k emulator for old executables so they function on the new CPU seamlessly.
The point here seems to be that AmigaOS is mainly written in C and only minimal 68K assembler. That probably explains the portability to other CPUs.

At the turn of the century, I provided proof of concept for QL native TCP/IP mainly written in C and was still so motivated that I wanted to make it part of SMSQ/E. Back then, it was politically impossible, both by a proprietary OS license and style/tool restrictions solely allowing assembler code. By now, these restrictions have been removed. It seems unlikely that we still have enough development manpower and motivation today, but in principle I find a defined way to add C language portions to SMSQ/E an interesting thought!

Not only for TCP/IP, also GUI for example. Some have seen a demonstration at the Edinburg meeting 5 years ago, a native GUI with proportional fonts, rounded shapes and theming. Yet another unfinished one-man project, but it shows how much more we might have today, if C language was nicely usable for parts of the OS.

I suspect similar advantages for C when it comes to hardware driver writing. All my machines from Q40 to Q68 were developed with (mainly) C language drivers written by myself. Even QL-SD ran only my own C code at first. That code was later rewritten in assembler. But without C language code as starting point, I guess none of those pioneer projects would have ever gotten driver support. If the need to (re)wite driver code in assembler was removed, it might encourage new hardware.

Can we learn from AmigaOS in this regard? Or would the SMS/QDOS system interface work too inefficiently in combination with C language code?


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Can we learn from Amiga OS?

Post by tofro »

Peter,

well, of course you could implement stuff for new hardware using C (or whatever "modern" language) to make it portable.

This has, however, a number of implications:
  • Speed. C is, compared to pure machine code, typically about 2 to 5 times slower. This might or might not be important, for fast graphics on a Q68, for example, it is simply too slow. Used for a network stack for the Q68, for example, it eats too much background CPU to make working with it really interesting (just my opinion). In addition, the compilers still available for the 68k are not particularily good at optimizing - GCC is by far the best, but, derived from an old version, a lot worse than modern C compilers for the PC. Being an outdated platform, there's also not much hope for getting better compilers. GCC support for the 68k has even become significantly worse over the years due to lack of support and maintenance. Speed is, however, not important for quick prototypes or proof-of-concept. Don't get me wrong: C68, for example, is really good, but it has its limits.
  • Programming in C on a QL is not much different than programming in C on a modern PC, challenge-wise. The rewards, however, are less encouraging on the QL than on a PC (On a PC, speed and performance will always be "enough", on the QL, a C program will always feel a bit sluggish and slow - well, you'll always know it could be faster...). So, if I'm into programming, why should I limit myself to a platform that offers less rewards? Some of the motivation for developers into programming an old platform like the QL is in "making it do things that you didn't think it was capable of" - Starting in C somewhat deprives you of that motivation. At least true for me.
  • To get something going, for example with new hardware, C is ideal. You can build a quick prototype, and prove your hardware is working, but otherwise size and performance of the outcome will always leave a bit to be desired.
  • Support for the "keepers of the black box": C68 on an original BBQL with, for example, a Trump Card, is just painfully slow (both development and the resulting programs). I typically work on QPC, cross-developing for the BB, and am really shocked how the final outcome runs on the target: "How did we ever manage to do serious work with such limited resources?". At home, the TC QL relatively rarely leaves its den for me - It's just too depressing... SuperGoldCard is what I use these days. But you can do serious things with a BBQL and assembly (as long as you do yourself a favor and don't develop there).
In a nutshell: SMSQE is good as it is, don't dilute it with slow and bulky C drivers and extensions. If, because of simplicity and speed of development, someone comes up with an add-on driver for specific hardware written in C, fine. But don't include it in the SMSQE source tree.

What I do these days is build application prototypes of something in C, find out where the performance bottlenecks are, and translate that into machine code - Using the best of both worlds. That's fine for applications, but probably not the way to go for OS and drivers.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
RalfR
Aurora
Posts: 870
Joined: Fri Jun 15, 2018 8:58 pm

Re: Can we learn from Amiga OS?

Post by RalfR »

tofro wrote:on the QL, a C program will always feel a bit sluggish and slow
Hmm, text87 is mainly written in C (cross-compiled on an Atari ST), I do not find it "sluggish", though I think, the screen things were mainly written in assembler.


4E75 7000
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Can we learn from Amiga OS?

Post by Peter »

tofro wrote:Speed. C is, compared to pure machine code, typically about 2 to 5 times slower.
This might be true for C68, but does not correlate with my own experience using GCC 2.95. I often had cases where I thought I wrote nice machine code, but the GCC result was faster! (A little machine code for critical parts is easy with C.) Of course I can not speak for excellent assembler authors. But maybe the dependency on excellent assembler authors is part of why we are so extremely far behind the development of Amiga OS.
tofro wrote:In addition, the compilers still available for the 68k are not particularily good at optimizing - GCC is by far the best, but, derived from an old version, a lot worse than modern C compilers for the PC. Being an outdated platform, there's also not much hope for getting better compilers.
I did not want to bring up this issue in my first post already, but it is a problem of course. With folks like Thierry and Richard still showing up now and then, I don't find a newer compiler totally unrealistic though. It does not have to be the latest version.
tofro wrote:To get something going, for example with new hardware, C is ideal. You can build a quick prototype, and prove your hardware is working, but otherwise size and performance of the outcome will always leave a bit to be desired.
A look at QL-HD might be interesting here. A lot of it is written in C, but it fits into 16 KB and I never noticed a performance issue compared to Qubide/SMS storage drivers.
tofro wrote:What I do these days is build application prototypes of something in C, find out where the performance bottlenecks are, and translate that into machine code - Using the best of both worlds. That's fine for applications, but probably not the way to go for OS and drivers.
But why did Amiga OS succeed with C then?


Derek_Stewart
Font of All Knowledge
Posts: 3929
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Can we learn from Amiga OS?

Post by Derek_Stewart »

Hi,

I was given an A500 motherboard in 1990, I did think about swit hing to the Amiga. However, the limiting factor was AmigaDOS. It seemed that all the Amiga people I knew, could only use the Workbench system, mind you they were all Geordies...

I used to use AmigaDOS from the CLI and type every AmigaDOS command, create scripts, rather like Linux now. But the hardware in Amiga was now too bad. The QL did have any comparison, till Super Gold Card, Aurora, Minerva.

AmigaDOS 1.3 was written in C, but I thought in v2.04 or v3.01 the rom code was written in assembler, making it more slicker

Some people Amiga games great, well they are, but Sony launched the Playstation in 1994, which changed the games playing world better sound and graphics, which the Amiga could not compete with.

Today, I have 2 x A600, CD32 needing re-capping due to the rubbish components fitted, 3 x A500, all live in a box in the garage.

The Raspberry PI Amiga emulators out perform the real hardware, much like QPC2 on a Multi Core PC running many Gigabytes.

I remember Phil Borman saying he could understand port C source code to the QL, which needed Gold Card type hardware to run, when could write the same code in 500 bytes of assembler.

Maybe QL-HD could be re-written in Assembler, how many assembler writer are there that could this?
Last edited by Derek_Stewart on Tue Mar 12, 2024 4:02 pm, edited 1 time in total.


Regards,

Derek
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Can we learn from Amiga OS?

Post by pjw »

Im all with Tobias on this one.

Its funny how some people are totally nativist when it comes to the cheap, crappy hardware that was the original QL, but who are happy to mess about with the heart and soul of the QL, which to me at least, has always been the only bit worth having.

Yes, I'll admit, the case was quite sexy ;) Also, I never had any problems with microdrives. They where great to have early on, when the alternatives were tape decks or ridiculously expensive floppies. But nowadays I prefer a hard disk, LCD monitor, and all the other creature comforts, while I work and play with my favourite OS.


Per
dont be happy. worry
- ?
User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Can we learn from Amiga OS?

Post by bwinkel67 »

I can't speak to writing system critical software since most of the stuff I wrote/write runs on top of the OS (though speed is important on many occasions). I will say one of the charms for me is to use the limited hardware and the limiting development platform to create what I want to build. I've had fun recently writing the ZXSimulator on an unexpanded QL using Digital 'C' and optimizing it so it can run as close to real-time as possible. Granted there are frustrations with the languages limits, esp when they are not clear and/or clearly documented. The less powerful a compiler is, sometimes the easier it is to optimize it in code if you know what your are doing (and/or know what compilers do when optimizing).

Also, it is easier, for me at least, to restart an old project when I'm looking at higher level source code. The BASIC interpreter I wrote was 30 year old source code and I'm getting more familiar with what I did back then but the code-base is familiar since it still reflects modern programming languages including Java/C++/etc... (well, not Python, that is different). I've had the opportunity to use state-of-the art development tools while at Microsoft and various startups in my career and now that I teach this stuff, I find using the limiting scope of the QL more refreshing and challenging. That said, I also want stuff like the Q68 and perhaps having it support ethernet (and hopefully those cheap USB-to-PS2 converters -- wink wink) in the future so I do realize some of this may not be done with a high level language.


stephen_usher
Gold Card
Posts: 429
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Can we learn from Amiga OS?

Post by stephen_usher »

Of course, if we are talking about the history of the Amiga we have to remember that the first (pre-release) version of AmigaDOS was written in BCPL by Metacommco (I believe on QLs).

Similarly, the pre-release version of Atari TOS was written by Metacommco in C, maybe QLs again?

With respect of C's speed, it very much depends upon two factors: The optimiser. The Programmer.

If the programmer understands the underlying architecture (including the number of registers etc.) then they can write code which assists the compiler to make good choices about how to generate the assembler. Of course, this depends upon the compiler writers being good at translating the C to assembler intelligently.

It does help that traditional C is heavily influenced by the DEC PDP7 instruction set, as is the M68K instruction set.


User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Can we learn from Amiga OS?

Post by Peter »

Derek_Stewart wrote:Maybe QL-HD could be re-written in Assembler, how many assembler writer are ther that could this?
The QL-HD driver is partly written in assembler - which is the reason why I never could iron out all CHS relics, even with the help of a person with very good assembler knowledge.
If I had been able to change it toward LBA, the first QL-SD driver would have been QL-HD based! And in retrospective more stable than the Qubide derivative that was eventually used.

I mentioned the QL-HD driver because it proves three interesting facts:

- Despite large C language parts, it has about the same size as other QL mass storage drivers
- It is as fast as other QL mass storage drivers
- The C language allowed me to add FAT32 support and the whole SDHC support

It was the first fully working driver for QL-SD! Just crippled by the fact that the assembler portions were so hard to read and debug that even relatively small changes could not be done in a practical time frame. I'm saying that because a driver like that is typical OS code, and it is neither slow nor large! One can not say it was not QL style - it ran on black bloxes with XT harddisks!

AmigaOS was as suitable for low-end 68K as SMSQ/E and made much more progress being based on C/BCPL with small assembler parts. Given the QL-HD example, I still read no strong point explaining why everything must be assembler code.

Maybe the SMS/QDOS system interface works less efficiently in combination with C than AmigaOS. Anyone here who can judge that?


User avatar
Pr0f
QL Wafer Drive
Posts: 1298
Joined: Thu Oct 12, 2017 9:54 am

Re: Can we learn from Amiga OS?

Post by Pr0f »

C compilers - certainly in the microcontroller world - can produce assembler as output, so that any critical timing loops can be tweaked. Optimising compilers usually produce quite efficient code, so there is no outright reason why c could not be used.

The hard task would be rewriting all the routine to use C instead and then abstracting out hardware and driver code - so that it would be more portable.


Post Reply