05 February 2015, 23:36 | #1 |
Coder of Games
Join Date: Feb 2015
Location: Sweden
Posts: 17
|
Any C/C++ example code?
I did manage to get a small hello world compiling in AmigaDevCpp so that's a small step forward. Made a small guide also. Some questions if anyone has some answers.
AmiDevCpp only seems to be able to build for AmigaOS 3.x or have i just failed to find the settings for it? Would be nice to be able to build for Amiga 500. Anyone that have some basic example program in C or C++ i could look at? Trying to make sense of the library's and the hardware usage. |
06 February 2015, 06:25 | #2 |
Banned
Join Date: Dec 2014
Location: Montreal
Posts: 129
|
You can find some examples of OS-respectful programming in the Rom Kernel Manuals "Libraries Manual": http://amigadev.elowar.com/read/ADCD.../node0000.html
However, this is quite far away from the metal and you will have quite a few graphics.library structures to initialize and prepare before you can just display an empty screen. Example: http://amigadev.elowar.com/read/ADCD.../node032C.html If you want to toy directly with the hardware (which frankly is more fun) you can start reading the real bible of the Amiga, the Hardware Reference Manual: http://amigadev.elowar.com/read/ADCD.../node0000.html. Inside you will find low level descriptions of the machine and how to program it via its custom chips registers. There's a lot to read but it's quite fascinating and very well written overall: if you know nothing about bitplanes for example you will find a complete explanation of how they are used to construct the display. As for programming the hardware using C, all the hardware registers can be written-to/read-from using pointers. For example, changing the colour 0 of the palette can be done via: Code:
*((unsigned short*)0xDFF180) = 0x0FFF; // Set colour 0 to white. I guess more seasoned Amiga coders will point you to more recent and/or elaborated examples and/or docs though since I essentially gave you what I started with back in the days where there was no Internet yet. |
06 February 2015, 09:32 | #3 |
Coder of Games
Join Date: Feb 2015
Location: Sweden
Posts: 17
|
Thanks. I had some luck and also manage to find the Hardware Reference Manual at my local library. Now i can chill out at work and read it over lunch .
|
06 February 2015, 20:02 | #4 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
|
06 February 2015, 22:51 | #5 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,604
|
Thread moved to the C/C++ forum
|
09 February 2015, 04:05 | #6 | |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
Quote:
Not sure what you mean about the difference between compiling for OS 3.x and an A500...you do know that an A500 can run OS 3.x don't you? I wrote some example C++ that might help you get started, it's a bit shit but will give you some ideas http://eab.abime.net/showthread.php?t=61692 |
|
10 February 2015, 05:34 | #7 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,334
|
Here is the annotated source for a system friendly (?) version of Tetris: http://monkeyfighter.com/tetris.html
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
start up code help | simon_m74 | New to Emulation or Amiga scene | 2 | 08 April 2013 22:24 |
What's this code doing? | Jherek Carnelia | Coders. General | 13 | 15 August 2011 17:55 |
Source Code | Thalion | project.WinUAE - Kaillera | 3 | 28 April 2006 09:55 |
Looking for some routine code | Amiga1992 | Coders. General | 4 | 17 December 2003 23:51 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|