UtilityBase
Your guide to Amiga development |
|
|
|
|
|
|
| |
| |
| |
|
|
|
Online members:
abalaban 26 min(s) ago tboeckel 34 min(s) ago
26 guests are online.
You are an Anonymous user. You can register for free by clicking here. |
|
|
| |
| |
| |
| |
| |
| |
UtilityBase needs your
help!
How to write portable code for Amiga (english) by corto Link: How to write portable code for Amiga (english) (pdf)
This document explains the specificities of each system or compiler. It gives information to program in a portable way. Write once, compile everywhere !
The main chapters are :
1. Includes : understand and manage these files, helping to obtain an organization for several compilers
2. OS specificities : define usage for conditional compilation, OS4 interfaces, amiga.lib and DoSuperNew management, various topics (tasks, memory, ...)
3. Compiler specificities and how to handle them with SDI_headers, hook management
4. Resources : documentation, SDK, support, ...
Please report bugs or questions.
|
|
| Last poster |
Message |
|
Posted: 2006-Feb-16 00:04:43
Interesting PDF.
Few notes:
Alignment issues. On PPC ULONGs are automatically aligned to ULONG boundary, i.e.
struct foobar
{
 UWORD foo;
 ULONG bar;
};
would be 8 bytes on PPC but 6 bytes on 68k. If it must be exactly same on 68k and PPC either use #pragma pack():
#pragma pack(2)
struct foobar
{
 UWORD foo;
 ULONG bar;
};
#pragma pack()
This is important issue especially when porting larger programs from 68k. If in doubt use #pragma pack(2) everywhere and sort it out later when better knowledge over it... performance loss is minimal anyway.
Another thing is SDI_stdarg.h. I dont think it works on AROS... |
|
Posted: 2006-Feb-16 16:51:58
Oops ! You're right, I forgot the alignment issue ... I will wait for other comments before updating the document.
Thank you for your compliment, itix !
About portability, we may add a part dedicated to SDL ? This well known lib is often used for Amiga projects now. |
|
Posted: 2006-Feb-16 23:09:45
SDL always same was it OS3, OS4, MOS or AROS... do you have something specific in mind? |
|
Posted: 2006-Feb-17 14:24:04
I have nothing specific in mind ... there could have differences in compilation commands and mainly in features (joystick support, OpenGL, ...). But it's not really the goal of this document. What you wrote about alignment issues is far more important.
For those who could be interested in my portable Amiga developments, I recently opened my blog :) |
|
Posted: 2006-Feb-17 17:31:27
Joystick internals are hidden behind SDL API and depending on SDL implementation it either works or not... In MOS it is based on lowlevel.library and on OS4 on amigainput.library but to SDL program it doesnt make difference. In practise all issues with SDL are porting issues from other OS'es and that is whole new matter...
Btw there is no libamiga.a in MorphOS SDK but it is libabox.a and libaboxstubs.a. In VBCC it is libamiga.a still. Anyway it doesnt matter because they are automatically linked in and it is not necessary include them on the linking stage. |
|
Posted: 2008-Nov-17 14:36:53
@itix
I found out this alignment thing the hard way when attempting to recreate a 68k system library for OS4 PPC and it just kept crashing at these strange offsets. Very annoying! |
|
Posted: 2009-Jun-29 04:58:36
|
|
Posted: 2009-Jun-29 16:34:01
@manola
And what's this ringtone crap got to do with alignments? |
|
Posted: 2009-Jun-29 17:47:39
@hypex: do you really expect an answer? |
|
Posted: 2009-Jun-30 15:46:39
@wawa
No, just like to voice an opinion.
Hey you answered, thanks! That makes it all worth while! :-D
The profile looked more together than most. Should we spam the guy? ;-) |
|
|
|
UtilityBase is a site focused on development for Amiga systems,
spanning over all different Amiga clones, that be AmigaOS 3.x, 4.x,
MorphOS, AROS or AmigaDE/Anywhere. News syndication:  Contact address: mail@utilitybase com
|
|
|