Amiga.org

Operating System Specific Discussions => Other Operating Systems => Topic started by: trekiej on May 14, 2013, 06:51:16 AM

Title: Cross Platform Programming
Post by: trekiej on May 14, 2013, 06:51:16 AM
Outside of Hollywood, how could some one make software that can be relatively easy to port from platform to platform?

I know this is an old topic.
Is there any reason why software can not be made for Amiga os anymore?
Title: Re: Cross Platform Programming
Post by: NovaCoder on May 14, 2013, 06:55:46 AM
I think you mean languages, in which case, yes lots of languages are portable and are supported on AmigaOS (classic).   The most common example is good on C, which in theory is protable by just a recompile (not actually true of course but it's a good story).

And yes new AmigaOS software is still being 'made'.

:)
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 07:09:27 AM
Thanks, I know that Amiga OS4.X software is being made. How about classic?
Is there a way to go from Aros or Linux to Classic fairly easy?
I feel Hollywood was a good idea and maybe Xamos is a possible answer.
Title: Re: Cross Platform Programming
Post by: NovaCoder on May 14, 2013, 07:30:41 AM
Quote from: trekiej;734853
Is there a way to go from Aros or Linux to Classic fairly easy?
I feel Hollywood was a good idea and maybe Xamos is a possible answer.


No, like I said it's not really that easy to do cross platform programming.   If I take a program written in C for Unix then sure I can get it working on Classic but only after replacing all the Unix specific functions, fixing up endian issues and replacing input, sound and video for AmigaOS equivalents.

Trouble with things like Holywood and SDL is that they are high level by design, this is fine if you have a lot to cycles to play with but on real classic hardware it's just too slow.
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 08:38:28 AM
I see. That takes me to an Emulator, but why not just use an Amiga or clone. :)
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 09:03:34 AM
When Novacoder says "AmigaOS" he means not "AmigaOS 4.X" :-)
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 09:06:33 AM
I think PortablE supports different platforms, then VBCC has different targets too (not AROS though) and then of course AmiDevCPP. And there is FreePascal but only different implementations (AROS version is the newest). Amiblitz now works everywhere (as far as I know) including AROS 68k (that is my personal favorite)
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 09:17:04 AM
How would the FPGA-Arcade (Replay) fair as a dev. platform?
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 09:24:37 AM
AROS 68k was already running on Arcade but I do not know the situation now because Jason is very busy right now. But I assume it will run on it (at least as one option). The Tina project even makes marketing on their site with AROS Vision :-). So it is common for both new platforms. Generally I think Amiblitz is easier to learn and perfect for 68k but of course not for AmigaOS or MorphOS. So if you want to make 68k programs and want to have something that is easy to learn, offers full system support (68k) and that also runs in most cases on other platforms I think it is a good option. If your main target are MorphOS or AmigaOS a crosscompiler like AmidevCPP (C) is the better option (harder to learn of course). Amiblitz was used for lots of different projects including commercial games so it is certainly not a bad choice. One example for applications developed with Amiblitz is HD-Rec. And it is still in development.
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 09:38:37 AM
Download Amiblitz from sourceforge and test it. There are examples in it including 3D Cube using Stormmesa and at least on my emulated system it runs like hell :-). I have not done that much with Hollywood (yet) but I think it is basic "inspired". So it is easier to learn another basic than jumping to C. XAMOS development is stopped atm.
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 09:41:30 AM
Thanks, I need to pick up Amiga Forever 2013. edit:
I miss having it.
I miss new hardware more.
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 09:42:49 AM
AF?
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 09:48:57 AM
Quote from: trekiej;734869
Thanks, I need to pick up Amiga Forever 2013. edit:
I miss having it.
I miss new hardware more.


ah I see. Amiga Forever is one good option. And Aros 68k another one. And for real hardware there is now FPGA Arcade (and hopefully even better hardware in future)
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 09:54:02 AM
even from a commercial view is 68k the best option right now (most users and developers, most software including compilers, most documentation, running almost everywhere including Android). That "might" change with a native Raspberry AROS version but that is not reality right now. AROS 68k is even used in Icaros and Aeros for 68k emulation so 68k offers the biggest base. Only if you want to use specific features of f.e. AmigaOS (4.X) or MorphOS you have to use real crossplatform compilers for development.
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 10:06:00 AM
http://www.youtube.com/watch?v=E2lrma-wd8U
http://dwcope.freeshell.org/projects/c64/
Here is some cool stuff.
Title: Re: Cross Platform Programming
Post by: SysAdmin on May 14, 2013, 10:12:25 AM
Any Hollywood programmers here? Could Hollywood be used to code something more complex like LightWave 3D 5.x for example or is that beyond what it can do? I don't know so just asking.
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 10:13:52 AM
it is certainly too slow for highend graphic applications. I do not think the results would be very fun. But perhaps others with more Hollywood experience can say more about it.
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 10:22:23 AM
We need a Hollywood Application list.
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 10:39:03 AM
https://www.youtube.com/watch?v=BKiftizQoNY
I noticed in this demo that there is multiple layers.
How is this?
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 10:43:52 AM
nice demo. But demos are all coded in assembler and not in a high level language. I do not know if that is possible (supported) by any of the languages. But a really good effect.
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 10:56:16 AM
Quote from: trekiej;734878
https://www.youtube.com/watch?v=BKiftizQoNY
I noticed in this demo that there is multiple layers.
How is this?


there is a thread about this topic:
http://www.lemonamiga.com/forum/viewtopic.php?p=28957&sid=70fb69a1f6a2d05a5b2c01a05cc477ea
Title: Re: Cross Platform Programming
Post by: woof on May 14, 2013, 01:31:57 PM
@Olaf

Could you say more about amiblitz 3D support via stormmesa?
Perhaps post a basic example listing?

Does amiblitz support   .library calls?  so allowing to use microbe3d.library that is (imho) more efficient

Alain Thellier
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 02:31:07 PM
I am not a expert (yet) but i know that there is a example that is using stormmesa and it is full supported

(http://www.aros-platform.de/3d_Cube.jpg)
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 14, 2013, 03:28:41 PM
I found a explanation from "Wanderer" Thilo Köhler that MESA is full integrated

Source-Code (screenshot) from example 3d_cube

(http://www.aros-platform.de/Source_3d.jpg)
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 06:03:15 PM
How is amiblitz with gui programming?
Title: Re: Cross Platform Programming
Post by: billt on May 14, 2013, 06:17:21 PM
Quote from: trekiej;734849
Outside of Hollywood, how could some one make software that can be relatively easy to port from platform to platform?


Use an OS-agnostic APU like SDL, QT, GTK, WxWidgets, etc. in C, C++, etc. If we had Java JVM, that could be another option.

My favorite is WxWidgets, as one of the mian goals wiht it is to make an app appear and behave as an OS-native one. Other of these APIs may look foreign on your OS of choice, such as a QT app always looking like a QT app, regardless of what OS it is running on. WxWidgets apps intend to look like MS Windows app on MS Windows, or look like an OSX app on OSX, etc... I'm really hoping we get a WxWidets port to AmigaOS and -alikes. If only I had free time...

Quote
Is there any reason why software can not be made for Amiga os anymore?


No. I just bought Stormc4 a few days ago...
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 06:45:22 PM
made or bought :D
Title: Re: Cross Platform Programming
Post by: Crumb on May 14, 2013, 06:49:23 PM
You have to design your code to be portable. Take a look at BasiliskII for example, it was designed with portability in mind. Split the parts that are platform specific, you'll probably gain readability too. Many linux apps are just "hardcoded" posix apps not easily portable to non posix systems (that's why Cygwin exists for Linux and ixemul for Amiga). Take as an example SheepShaver, the latest maintainer posixified all the code making it non-portable to non-posix platforms.

If you decide to learn C amiga is a good platform for that too, the most important part is that you learn to use pointers properly, otherwise there's no much sense in using C.

If you decide to develop games you could use SDL library, it won't be fun to use on miggies. You can create your own functions for drawing sprites, backgrounds... and once SDL works then you can try to make an OCS/AGA/CGX version (it won't be easy but will be more effective than embedding SDL calls everywhere in your code).

If you decide to create an app try to split the logic part from the GUI and the storage one. You may have to rewrite small parts of storage part for taking care of endianness and you will have to rewrite GUI part for sure but it's not such a big problem, there are usually tools for that.

On Amiga systems the GUI of choice would be MUI as it's supported on all systems and for other OSes you can choose GTK, QT... keep in mind that these alien GUIs run awfully on Amiga if they run at all.
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 07:12:14 PM
Great.
I have studied C and C++ and got into using pointers.
I have a blog on pointers, not much is there.

I see for the most part what you are saying about organising your code for portability.
I would like to bring more programmers to the Amiga. The ability to bring code from other platforms seems to be a must these days.
Title: Re: Cross Platform Programming
Post by: trekiej on May 14, 2013, 08:04:20 PM
Would Amigans be willing to buy software for a dollar or 99 cents?
Title: Re: Cross Platform Programming
Post by: Crumb on May 15, 2013, 12:40:25 AM
@trekiej:

Quote
I would like to bring more programmers to the Amiga. The ability to bring code from other platforms seems to be a must these days.


Doing proper ports takes much more effort but the result is much more pleasant for both users and developers. I prefer quality rather than quantity. Typing "make" and porting cli linux tools to produce hundreds of ported cli tools that use ixemul doesn't help to make our platform interesting. Imagine that Fab never did a proper OWB*MorphOS*port or that Chris never did a proper Netsurf OS4 port... even if we could run SDL versions I highly doubt it would appeal users much.

It's better to invest more time porting correctly libraries making 1 proper shared library than producing a handful of static libs. As an user it's simply better and as a coder it presents advantages:
-if a library has a bug you can fix it without recompiling&relinking your main app.
-allows using different compilers:*this library may only compile with GCC4.x but another one perhaps can be compiled with GCC2.95 as GCC3 generates buggy code in some situations. You could even create a library using AmigaE for example and call it from C and the opposite too.
-allows more collaboration (using static libs could produce problems: what do you use? ixemul, libnix, clib2...?)
-allows using native library versions if available even if your app is 68k only

For amiga "portability" there are SDI headers, these are used in various amiga projects and make easier making native versions.
Title: Re: Cross Platform Programming
Post by: ferrellsl on May 15, 2013, 12:15:46 PM
The best environment for cross platform development for all Amigas including classics, NG, AROS and MorphOS is by using C/C++ and AmiDevCpp.  You can get it here:  http://amidevcpp.amiga-world.de/index.php?HR_LANG=english
Title: Re: Cross Platform Programming
Post by: OlafS3 on May 15, 2013, 01:05:55 PM
What software?

And it all depends on what you want to do. If you want to do crossplatform-development (that here would mean covering all "amigian" platforms) you will (propably) have to use C or (perhaps) PortablE or Hollywood. If you want to develop 68k software for 68k environments you have different additional choices.
Title: Re: Cross Platform Programming
Post by: ChaosLord on May 15, 2013, 10:38:37 PM
Quote from: novacoder;734851
  The most common example is good on c, which in theory is protable by just a recompile (not actually true of course but it's a good story).

hehehehe
+9999999

In particular, writing structures out to disk in a multiplatform compatible way is quite a spectacular pain when using C.
Title: Re: Cross Platform Programming
Post by: trekiej on May 15, 2013, 10:59:17 PM
Is it not possible to use your own functions to call other functions in SDL or OpenGL?
Then change the header file that contains your functions for different platforms.