amiga.org
     
iconAll times are GMT -6. The time now is 06:40 PM. | Welcome to Forum, please register to access all of our features.

Amiga.org Amiga computer related discussion Amiga Software Issues and Discussion C++ on Amiga

Amiga Software Issues and Discussion This forum exists for the discussion of the use, issues with, and fun brought about by classic and next generation Amiga software.

Reply
 
Thread Tools Display Modes
Old 08-30-2009, 09:42 AM   #1
hayashi
Too much caffeine
Points: 1,768, Level: 24 Points: 1,768, Level: 24 Points: 1,768, Level: 24
Activity: 1% Activity: 1% Activity: 1%
 
hayashi's Avatar
 
Join Date: Jan 2009
Location: Knaresborough, UK
Posts: 82
Blog Entries: 2
Send a message via MSN to hayashi Send a message via Yahoo to hayashi
Default C++ on Amiga

Hi,

After looking into programming in E, I'm considering learning C++ with intentions of either programming games for, or porting them to, 68k Amigas. (Someone I may be working on games with is already learning C++/OpenGL, so I could possibly share non-graphical code with/bug him for help)

Does anyone know what sort of material I should be getting, in terms of software and tutorials? I know I'll need to find a C compiler, standard libraries, and the AmigaOS 3 APIs, and some tutorials both on C++ (easy to find, google would probably work for me here) and how to code for the APIs (much harder to find). I'll also need some sort of library for playing back ProTracker modules.

Thanks, Matt
__________________
[UK] A1200 with 2GB hard drive and Apollo 1240 040/33MHz/16MB FastRAM | A500+ with trapdoor memory upgrade and A520 modulator and no battery or power supply

Floppy Drive Grim Reaper and DPaint lover
hayashi is offline   Reply With Quote
Old 08-30-2009, 10:53 AM   #2
matthey
Cult Member
Points: 6,809, Level: 54 Points: 6,809, Level: 54 Points: 6,809, Level: 54
Activity: 33% Activity: 33% Activity: 33%
 
Join Date: Aug 2007
Location: Kansas
Posts: 830
Default Re: C++ on Amiga

You should head over to http://www.utilitybase.com for help. I would recommend staying with C on the Amiga although GCC supports C++ on the Amiga. C++ is rarely used on the Amiga and it's slower. GCC is a major pain to set up on the Amiga. VBCC is a light weight Amiga compiler that is much easier to work with on the Amiga but does not support C++.

VBCC is here...

http://sun.hasenbraten.de/vbcc/

GCC is from the GeekGadgets CD on backtoroots.org (good luck!)...

http://geekgadgets.back2roots.org/

You should have the ROM Kernal Reference Manuals for documentation. The Libraries is the most important. They can be found on the internet. They are not updated past AmigaOS 2.x. You should have the latest SDK for AmigaOS 3.9. It can be found here...

http://aweb.sunsite.dk/download.php

That might get you started. It's not easy developing in C on a low end classic Amiga. There is some ide's available that help like this...

http://devplex.awardspace.biz/

or Murk's (free) may work already...

http://utilitybase.com/forum/index.p...ic=1791&page=0
matthey is offline   Reply With Quote
Old 08-30-2009, 11:26 AM   #3
SamuraiCrow
Premium Member
Points: 14,084, Level: 77 Points: 14,084, Level: 77 Points: 14,084, Level: 77
Activity: 11% Activity: 11% Activity: 11%
 
SamuraiCrow's Avatar
 
Join Date: Feb 2002
Location: Colorado, USA
Posts: 2,065
Blog Entries: 2
Send a message via Yahoo to SamuraiCrow Send a message via Skype™ to SamuraiCrow
Default Re: C++ on Amiga

http://aminet.net/mus/play/ptreplay_ahi.lha is what you want for playing ProTracker modules. (This archive includes MorphOS as well as AmigaOS 3.x library versions.)

-edit-
http://aminet.net/package/mus/play/ptreplay66 is the original hardware-banging version BTW.

Last edited by SamuraiCrow; 08-30-2009 at 11:30 AM..
SamuraiCrow is offline   Reply With Quote
Old 08-30-2009, 11:34 AM   #4
Caius
VIP / Donor
Points: 3,808, Level: 39 Points: 3,808, Level: 39 Points: 3,808, Level: 39
Activity: 11% Activity: 11% Activity: 11%
 
Caius's Avatar
 
Join Date: Nov 2007
Location: Norway
Posts: 294
Default Re: C++ on Amiga

Quote:
Originally Posted by matthey View Post
C++ is rarely used on the Amiga and it's slower.
That's highly debatable. If you simply compile C sources with a C++ compiler there's no difference unless you're using a retarded compiler. C++ function objects can be inlined, while function pointers in C can not. Some sorting algorithms have proven to be many times faster on C++ due to this.

It is true that certain parts of the C++ language are slow, like using virtual functions in a tight loop. It's really a matter of knowing your language, knowing the little 'gotchas'.

In my experience, the main disadvantage with C++ is slower compiling, especially when using templates. But I'm a little tired of reading "use C instead" every time someone mentions C++ on the Amiga.
__________________
Theology is just a debate over who to frame for creating reality.
Caius is offline   Reply With Quote
Old 08-30-2009, 11:58 AM   #5
bburtonpa
Merely Curious
Points: 5,420, Level: 47 Points: 5,420, Level: 47 Points: 5,420, Level: 47
Activity: 2% Activity: 2% Activity: 2%
 
bburtonpa's Avatar
 
Join Date: Sep 2006
Posts: 17
Default Re: C++ on Amiga

I agree with Matthey about staying with C and avoiding C++ on the Amiga. If you use any part of the standard library e. g. streams, vectors, list, etc. expect code bloat. That's not a problem if you have gigabytes of memory, but on Amiga systems, we're talking megabytes.
bburtonpa is offline   Reply With Quote
Old 08-30-2009, 12:17 PM   #6
Karlos
Sockologist
Points: 50,135, Level: 100 Points: 50,135, Level: 100 Points: 50,135, Level: 100
Activity: 10% Activity: 10% Activity: 10%
 
Karlos's Avatar
 
Join Date: Nov 2002
Location: Barishabaad, Sardistan
Posts: 16,646
Blog Entries: 18
Default Re: C++ on Amiga

I use C++ on the 68k miggy all the time. It's fine, provided you know what you are doing. It's also a lot more convenient than C at times.

If you use heavyweight features like templates and RTTI, you'll get bloat, but metaprogramming and reflection aren't free.

On the other hand, you can create code that is effectively "C with classes", that is both compact and fast.
__________________
OCA
This isn't SCSI... This is SATA!!!
I have CDO. It's like OCD except all the letters are in ascending order. The way they should be.
Core2 Quad Q9450 2.66GHz / X48T / 4GB DDR3 / nVidia GTX275 / Linux x64, AROS, Win64
A1XE 800MHz / 512MB / Radeon 9200 / OS4.1
A1200T BPPC 240MHz / 256MB / Permedia 2 / OS 3.1 - OS3.9, OS4
A1200T Apollo 1240 28MHz / 32MB / Mediator1200 / Voodoo 3000 / OS3.9
A1200D Apollo 1240 25MHz (ejector seat ROM edition) / 32MB
Karlos is offline   Reply With Quote
Old 08-30-2009, 12:48 PM   #7
Beast96GT
Technoid
Points: 5,071, Level: 45 Points: 5,071, Level: 45 Points: 5,071, Level: 45
Activity: 32% Activity: 32% Activity: 32%
 
Beast96GT's Avatar
 
Join Date: Aug 2008
Location: Plano, Texas
Posts: 171
Default Re: C++ on Amiga

Has anyone mentioned AmiDevCpp? It's a cross-platform IDE (I can use in on WinXP), that will let you choose your target like 68k, or PPC, etc. It's pretty good, but I haven't had much time to really spend on it.

Since I'm a PC graphics guy, I don't know (or can find) anything about graphics programming on the old miggy, which is what I'm trying to do with it.

Here's the link to AmiDevCpp:
http://amidevcpp.amiga-world.de/inde...R_LANG=english
Beast96GT is offline   Reply With Quote
Old 08-30-2009, 05:39 PM   #8
NovaCoder
Premium Member
Points: 10,401, Level: 67 Points: 10,401, Level: 67 Points: 10,401, Level: 67
Activity: 41% Activity: 41% Activity: 41%
 
NovaCoder's Avatar
 
Join Date: Apr 2008
Location: Oz
Posts: 1,517
Blog Entries: 2
Default Re: C++ on Amiga

Yep I think the idea that C++ is slower is not accurate these days, it's similar to the idea the C is slower than assembler (modern compilers produce very efficient assembler).

Anyway I've been using C++ on my 1200 for a port of DOTT.

I use StormC V4 which uses the GCC compiler and features an IDE with built in debugger which makes everything a lot easier. You can still buy StromC V4 new for about $50.

It will take you longer to learn C++ of course, I spent a year learning straight C before I started looking at C++.
__________________
Life begins at 100 MIPS!


AmiWolf AGA, AmiSpear AGA, BOOM AGA, ZDOOM AGA, ODAMEX AGA, AmiQuake AGA, AmiQuake 2 AGA
NovaCoder is offline   Reply With Quote
Old 08-30-2009, 05:42 PM   #9
SamuraiCrow
Premium Member
Points: 14,084, Level: 77 Points: 14,084, Level: 77 Points: 14,084, Level: 77
Activity: 11% Activity: 11% Activity: 11%
 
SamuraiCrow's Avatar
 
Join Date: Feb 2002
Location: Colorado, USA
Posts: 2,065
Blog Entries: 2
Send a message via Yahoo to SamuraiCrow Send a message via Skype™ to SamuraiCrow
Default Re: C++ on Amiga

@Hayashi

What made you decide to give up E? It's not as powerful as C++ but it's as efficent as some C compilers and a LOT easier than C++.

@Beast96GT

What do you want to know about Amiga graphics programming? You can find out a lot by getting the Amiga Developer CD version 2.1 and looking at the graphics libraries section of the RKRMs.

Last edited by SamuraiCrow; 08-30-2009 at 05:45 PM..
SamuraiCrow is offline   Reply With Quote
Old 08-30-2009, 08:27 PM   #10
hayashi
Too much caffeine
Points: 1,768, Level: 24 Points: 1,768, Level: 24 Points: 1,768, Level: 24
Activity: 1% Activity: 1% Activity: 1%
 
hayashi's Avatar
 
Join Date: Jan 2009
Location: Knaresborough, UK
Posts: 82
Blog Entries: 2
Send a message via MSN to hayashi Send a message via Yahoo to hayashi
Default Re: C++ on Amiga

@SamuraiCrow: A friend and I have had an idea for an RPG, which (if it ever moves out of planning) will likely be made first for Windows (and maybe Linux etc) using C++/OpenGL. If this happens, I really want to make an Amiga version (not a straight port, of course), and using the same language will of course help as we can trade core game code.

I was looking at trying to learn E, but now believe it's useless to spend time learning it when I could be learning a language that would both lend itself well to the above situation and be useful outside the Amiga.
__________________
[UK] A1200 with 2GB hard drive and Apollo 1240 040/33MHz/16MB FastRAM | A500+ with trapdoor memory upgrade and A520 modulator and no battery or power supply

Floppy Drive Grim Reaper and DPaint lover
hayashi is offline   Reply With Quote
Old 08-30-2009, 08:41 PM   #11
Karlos
Sockologist
Points: 50,135, Level: 100 Points: 50,135, Level: 100 Points: 50,135, Level: 100
Activity: 10% Activity: 10% Activity: 10%
 
Karlos's Avatar
 
Join Date: Nov 2002
Location: Barishabaad, Sardistan
Posts: 16,646
Blog Entries: 18
Default Re: C++ on Amiga

Quote:
I was looking at trying to learn E, but now believe it's useless to spend time learning it when I could be learning a language that would both lend itself well to the above situation and be useful outside the Amiga.
To be fair, this is why I've never really bothered with amiga specific programming languages. Whatever I can't implement efficiently in C/C++, there's always assembler
__________________
OCA
This isn't SCSI... This is SATA!!!
I have CDO. It's like OCD except all the letters are in ascending order. The way they should be.
Core2 Quad Q9450 2.66GHz / X48T / 4GB DDR3 / nVidia GTX275 / Linux x64, AROS, Win64
A1XE 800MHz / 512MB / Radeon 9200 / OS4.1
A1200T BPPC 240MHz / 256MB / Permedia 2 / OS 3.1 - OS3.9, OS4
A1200T Apollo 1240 28MHz / 32MB / Mediator1200 / Voodoo 3000 / OS3.9
A1200D Apollo 1240 25MHz (ejector seat ROM edition) / 32MB
Karlos is offline   Reply With Quote
Old 08-30-2009, 09:44 PM   #12
Beast96GT
Technoid
Points: 5,071, Level: 45 Points: 5,071, Level: 45 Points: 5,071, Level: 45
Activity: 32% Activity: 32% Activity: 32%
 
Beast96GT's Avatar
 
Join Date: Aug 2008
Location: Plano, Texas
Posts: 171
Default Re: C++ on Amiga

Quote:
Originally Posted by SamuraiCrow View Post
@Beast96GT

What do you want to know about Amiga graphics programming? You can find out a lot by getting the Amiga Developer CD version 2.1 and looking at the graphics libraries section of the RKRMs.
On the PC I used BitBlt (Win32 C++) to write to a 32-bit back buffer that's swapped to the front buffer for a GDI game I wrote. Now I work with OpenGL and DirectX that provide higher level access to graphics programming (I'm a console game developer), though still through C++.

I was kid when I had my Amiga and know nothing of the architecture. I'm a very experienced C++ programmer, but I simply don't have the time to try and figure everything out from scratch with regards to the Amiga. Maybe I can make it a process, but resources are what I need--else I get frustrated and take large breaks.

What can you tell me about this Ami Dev CD, and what are the RKRMs? Thanks.
Beast96GT is offline   Reply With Quote
Old 08-30-2009, 11:49 PM   #13
matthey
Cult Member
Points: 6,809, Level: 54 Points: 6,809, Level: 54 Points: 6,809, Level: 54
Activity: 33% Activity: 33% Activity: 33%
 
Join Date: Aug 2007
Location: Kansas
Posts: 830
Default Re: C++ on Amiga

@Beast96GT

RKRM stands for ROM Kernal Reference Manual. Libraries and Devices are the most important ones. Look here for more...

http://gega.homelinux.net/AmigaDevDocs/

Also get the SDK for 3.9 from the AWeb site I listed above and look at the autodocs.

Here is a guide to setting up an Amiga C programming environment...

http://code.google.com/p/guidetoamig...leprogramming/

Warp3D developer archive...

http://aminet.net/dev/misc/Warp3DDev-4.2a.lha

StormMesa developer archive...

http://aminet.net/util/libs/StormMesa_Dev.lha

Info on developing in 3D on Amiga...

http://vague.lorraine-design.com/the_vague_1.html
matthey is offline   Reply With Quote
Old 08-31-2009, 12:13 AM   #14
matthey
Cult Member
Points: 6,809, Level: 54 Points: 6,809, Level: 54 Points: 6,809, Level: 54
Activity: 33% Activity: 33% Activity: 33%
 
Join Date: Aug 2007
Location: Kansas
Posts: 830
Default Re: C++ on Amiga

Quote:
Originally Posted by NovaCoder View Post
Yep I think the idea that C++ is slower is not accurate these days, it's similar to the idea the C is slower than assembler (modern compilers produce very efficient assembler).
C IS slower than assembler. GCC's code optimization is a joke. Why is ffmpeg for the 68060 twice as fast with a few assembler routines compared to all C routines? I don't know much about C++ compared to C but I have seen too much assembly output from C programs to believe C is as fast as assembler. Plus I can beat it 95% of the time with assembler.
matthey is offline   Reply With Quote
Old 08-31-2009, 12:23 AM   #15
NovaCoder
Premium Member
Points: 10,401, Level: 67 Points: 10,401, Level: 67 Points: 10,401, Level: 67
Activity: 41% Activity: 41% Activity: 41%
 
NovaCoder's Avatar
 
Join Date: Apr 2008
Location: Oz
Posts: 1,517
Blog Entries: 2
Default Re: C++ on Amiga

Quote:
Originally Posted by matthey View Post
C IS slower than assembler. GCC's code optimization is a joke. Why is ffmpeg for the 68060 twice as fast with a few assembler routines compared to all C routines? I don't know much about C++ compared to C but I have seen too much assembly output from C programs to believe C is as fast as assembler. Plus I can beat it 95% of the time with assembler.

Well obviously over the years C/C++ compilers have improved massively and these days you'll improve performance more from looking at what the code is doing from a high-level rather than trying to hand-optimize algorithms (the quickest code is code you don't actually execute).

I remember reading an assembler 'tuning' article which had an exercise to improve some compiler generated assembler by-hand. When I went to make the change myself, I found that my newer version of the compiler had already produced exactly the same assembler as the article suggested

I wasn't talking specifically about GCC, I was talking about modern compilers C++ in general.
__________________
Life begins at 100 MIPS!


AmiWolf AGA, AmiSpear AGA, BOOM AGA, ZDOOM AGA, ODAMEX AGA, AmiQuake AGA, AmiQuake 2 AGA

Last edited by NovaCoder; 08-31-2009 at 05:40 PM..
NovaCoder is offline   Reply With Quote
Reply

Bookmarks

Tags
c++ , api , amigaos3 , amigaos apis , amiga

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump