![]() |
![]() |
#1 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Starting out
Hi Guys,
It’s taken me about a year to complete my Amiga hardware. So I have CD32 + SX-1 with 6 Mb RAM total. The last thing I got was the keyboard. I want suggestions for an easy way to get started with C, and wanting to draw primitive shapes, text, and lines on a screen. What compiler should I use? I don’t care about an IDE, but prefer easy setup. Ok to type into an editor such as Ced, and compile from a shell. Samples would also be handy to show what to do about different screen resolutions, how to know how big the window was made,etc. I could be using an Amiga or WinUAE. Any tips? Cheers, Art. |
![]() |
![]() |
#2 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,207
|
Samples can be found on Aminet.org in dev/c directory.
|
![]() |
![]() |
#3 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,035
|
Quote:
Perhaps Dice C is better for your machine. Installation instructions: http://eab.abime.net/showpost.php?p=874957&postcount=2 aminet.net, not .org http://aminet.net/dev/c |
|
![]() |
![]() |
#4 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Yes I already figured out the first address is dead.
A lot of things I googled: CubicIDE, StormV4, etc. I cannot find free on the net. I will try Dice C then, cheers ![]() Thomas, I notice you made the tutorial, If I compile the test program successfully, would it be too much to ask for you to do a source that: Draws a line or some pixels and writes a Hello World on the same graphics screen? Last edited by xArtx; 08 November 2015 at 11:00. |
![]() |
![]() |
#5 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Stand back, I’m an Amiga programmer now
![]() |
![]() |
![]() |
#6 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,035
|
Quote:
To (re)build it, cd into either demo1 or demo2 directory and enter dmake. |
|
![]() |
![]() |
#7 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Thanks Thomas,
It takes burning a CD for me to get it to the Amiga hardware (I skipped UAE), but my Mac can extract .lha, and I see the first example is a pong ball and the variable size of a resizable window is accounted for. Done for tonight, but will start again tomorrow ![]() I have a 40Mb HDD with 1.4Mb free after the Dice C install. ...had to delete the previous owners game directory and some other stuff. I’ll have a look for more room I can possible make. |
![]() |
![]() |
#8 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,035
|
To save some space you can delete the directories
doc editors examples l libs rexx from Dice as well as all files in the main Dice directory. The NDK_3.9 can be deleted entirely after you copied the includes and linker_libs to Dice. However, you might want to retain the autodocs. |
![]() |
![]() |
#9 |
Registered User
Join Date: Nov 2010
Location: Sweden
Posts: 528
|
Good luck. What will you focus on; OS 3.1 or 3.9?
Trying to learn C for OS 4.1 here. |
![]() |
![]() |
#10 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Hi, It would be OS 3.1 for a CD32 yeah? CD32 is my only real hardware.
I have ideas rather than solid goals for end programs, but fairly proficient with C, so hopefully will gain momentum with more understanding of the Amiga. |
![]() |
![]() |
#11 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Hi again Guys
![]() I want to use the C sin() and cos() functions that are normally in math library. I’ve tried including mathtrans.h and mathieeesingtrans.h, and if I call their respective sine or cosine functions: Code:
SPSin(theta); IEEESPSin(theta); which I Googled to mean the program requires a hardware floating point unit. Is there a way to use sin/cos without the FPU hardware? Cheers, Art. |
![]() |
![]() |
#12 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
|
I don't know but <math.h> have sin() and cos()? Linked with -lm ofcourse.
|
![]() |
![]() |
#13 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
There is no math.h in the SDK. I was talking about a math.h I use on other platforms.
I was talking about this kind of thing. Supposed to use FPU hardware if it exists, CPU otherwise. Code:
struct Library *MathBase; VOID main() { float f1; long i1; if (MathBase = OpenLibrary("mathffp.library", 0)) { i1 = SPFix(f1); // copy float to integer long CloseLibrary(MathBase); } else { printf("Can't open mathffp.library\n"); } Code:
float pi = 3.14159; |
![]() |
![]() |
#14 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
|
But <math.h> is part of any C compiler no platform specific.
Yes, you declared a float in that form and the example seems ok. Perhaps you need to tweak some compiler option? |
![]() |
![]() |
#15 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,035
|
Quote:
Actually the math#?.library's should hide the need for an FPU and switch to software floating point routines automatically. But for some reason the proper libs didn't make it into the A1200/CD32 ROM. math.h is part of the compiler's include files. It should be in DINCLUDE: along with stdio.h and the like. You don't need the SDK to compile an ANSI C program. Last edited by thomas; 10 November 2015 at 17:46. |
|
![]() |
![]() |
#16 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Oh ok.. I couldn’t find it in the NDK_3.9 directory, and then Googled how to use what was there.
I’m trying to rotate a point about an origin and this simple thing has turned into a monster using that mathtrans thing. Code:
theta = rotation; thetab = (3.141592 / 180) * theta; xx = 160; yy = 200; x = xx - 160; y = yy - 140; xnew = cos(thetab)*x - sin(thetab)*y; ynew = sin(thetab)*x + cos(thetab)*y; xnew = xnew + 160; ynew = ynew + 140; |
![]() |
![]() |
#17 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,035
|
There is an example which mixes math.h with AmigaOS functions: http://thomas-rapp.homepage.t-online...les/piechart.c
|
![]() |
![]() |
#18 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Ok, thanks again
![]() Will have to be a job for tomorrow. It’s past 3am here! Just the SetPatch file requires burning another CD, but I’ll try to put more on it this time, like as much of my own C code I can fit on it. |
![]() |
![]() |
#19 |
Registered User
Join Date: Jun 2013
Location: Australia
Posts: 685
|
Success!
![]() The updated SetPatch file was required. The same source I posted above crashes while compiling with my old version. I wish I’d known that. Now the code I posted above compiles as it is written. Though for the Amiga I’m probably going to want to pre-calculate this: Code:
3.141592 / 180 Code:
sin(thetab) cos(thetab) |
![]() |
![]() |
#20 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
|
For sure It's better to precalculate al sin() cos() you can. They are expensive CPU functions.
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Starting out | xArtx | Coders. General | 4 | 13 February 2015 03:55 |
Starting out in C | xArtx | Coders. C/C++ | 2 | 24 June 2013 04:35 |
Help starting with Minimig v1.1 | lolafg | support.Hardware | 17 | 04 May 2010 06:48 |
Starting a program | BippyM | Coders. Tutorials | 10 | 10 February 2006 15:35 |
Starting again | Bad Mr Frosty | support.Apps | 0 | 24 September 2004 21:48 |
|
|