English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 07 June 2019, 22:12   #1
Rango
Registered User
Rango's Avatar
 
Join Date: Oct 2017
Location: Chicago, IL, USA
Posts: 34
Is Practicing C coding on real Amiga 1200 or 500+ hardware a good idea?

Hi guys. I've decided i'm going to learn C programming (from C programming A modern approach 2nd edition C99) but is practicing C (C99?) coding on real Amiga 1200 or 500+ hardware a good idea? Or is there better way to practice your code on?

I think, maybe incorrectly that real 16 bit hardware with 2MB of ram would be a good task? PC may be too challenging for beginner hence this idea.

I don't really want to deviate too much from C to Blitz or Assembly too much as that's not the goal here however some tweaks to code no problem however. Any recommendation on compiler too? @Zetr0

I also looked into Arm Cortex STM32 development boards which are way faster 52Mhz but flash memory is only 64Kb so not much one can do with graphics hence my interest in real amiga with ~2000Kb of Ram. Also i don't think anyone uses original cpu amiga cycle as everyone is using accelerators now a days so that would also be most likely implemented and hence original cpu cycle non issue.

The goal would be to perfect C on real hardware but not as advanced as PC or Linux. Baby steps is goal here, hence 16 bit attempt. The Amiga advantage here is RAM but disadvantage is CPU cycle speed unless accelerated.

The only problem i see is humongous price tag on A1200 with ~$550USD price tag.

Maybe Raspberry Pi 3 with emulation but isn't that going to create just debug nightmare?

Maybe amiga has too many eccentricities that C programming practice would not be ideal? Thoughts guys?

Last edited by Rango; 07 June 2019 at 23:20.
Rango is offline  
Old 07 June 2019, 22:27   #2
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 45
Posts: 1,310
Send a message via Yahoo to Samurai_Crow
Real Amigas should only be used for testing and running code. With Bebbo's GCC cross compiler on a Linux box you will get much better code. A RasPi 3 will likely work for running the cross compiler, but won't have enough RAM for parallel builds in large projects.

I hope this helps!
Samurai_Crow is offline  
Old 07 June 2019, 23:03   #3
Rango
Registered User
Rango's Avatar
 
Join Date: Oct 2017
Location: Chicago, IL, USA
Posts: 34
Thank you. Sorry i meant running /executing the code on Amiga, not writing code on it. I do have Mx linux 18.3 distro installed my laptop and windows 7 box on my desktop.

My issue with STM32 dev board is RAM limitation on what can be executed on it, although maybe for noob like me that's not a bad thing. You can't really develop any game on STM32 board but simple things one can. I guess i'm thinking a bit ahead of myself.

I guess what i'm asking is what hardware i should use to execute my own code i will write on to check if it works and amuse myself if it does as that can be quite rewarding which in turn will help me with motivation of writing C code fruther.

I was thinking 16 bit code would be easy and simple enough to play around with vs running code on 64/32 bit code. Same applies i guess to reading that 16 bit code vs some complex 32/64 bit code, hence the Amiga hardware question.

Last edited by Rango; 07 June 2019 at 23:23.
Rango is offline  
Old 07 June 2019, 23:06   #4
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 45
Posts: 1,310
Send a message via Yahoo to Samurai_Crow
There is a Windows 7 compatible build of Bebbo's GCC also.
Samurai_Crow is offline  
Old 08 June 2019, 02:56   #5
Rango
Registered User
Rango's Avatar
 
Join Date: Oct 2017
Location: Chicago, IL, USA
Posts: 34
What you're saying is if C code will compile on Bebbo's GCC compiler it will run on hardware of Amiga 500 threw 1200 ?

For curiosity it would also run on Vampire v4 Standalone version as well?, or is that test and see type of a thing?
Rango is offline  
Old 08 June 2019, 03:08   #6
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 45
Posts: 1,310
Send a message via Yahoo to Samurai_Crow
Yes. That's how cross compilation works. You compile Amiga applications on Windows. The Vampire stand-alone won't have enough RAM to run Bebbo's GCC natively though. It comes with a half-gig of RAM last I heard. GCC requires at least twice that in modern times.
Samurai_Crow is offline  
Old 08 June 2019, 03:15   #7
Rango
Registered User
Rango's Avatar
 
Join Date: Oct 2017
Location: Chicago, IL, USA
Posts: 34
Sorry i meant if code compiles on Bebbi's GCC it will also RUN on Vampire V4 stand alone?

I have that MX linux box and windows so working on code no issue. I mean executing the code on Vampire or amiga physical hardware to test?

Are there instances where code will compile on Bebbi's GCC but it won't on physical hardware?
Rango is offline  
Old 08 June 2019, 03:39   #8
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 45
Posts: 1,310
Send a message via Yahoo to Samurai_Crow
It should work but always test to be certain.
Samurai_Crow is offline  
Old 08 June 2019, 08:58   #9
Bruce Abbott
Registered User

Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 286
Quote:
Originally Posted by Rango View Post
Are there instances where code will compile on Bebbi's GCC but it won't on physical hardware?
Barring compiler bugs there is no reason it wouldn't work - assuming your own code is bug-free of course.


Quote:
Originally Posted by Samurai_Crow
GCC requires at least twice that in modern times.
That sucks.

Quote:
With Bebbo's GCC cross compiler on a Linux box you will get much better code.
'Much' better code? A bit better perhaps, but even ancient Amiga compilers like SASC do a pretty good job.
Bruce Abbott is offline  
Old 08 June 2019, 09:51   #10
Locutus
Registered User

 
Join Date: Jul 2014
Location: Finland
Posts: 969
Probably an unpopular opinion for this board:

Learning on old hardware is a /terrible/ idea, modern development environments are much better (integrated docs, direct linting and analysis, completion helps with discovery, way better error reporting, integrated VC lets you easily trace back your errors and learn, etc).

If you are new to it, first learn on a modern platform so you understand properly what you are doing and then work backwards (or just cross develop).
Locutus is offline  
Old 08 June 2019, 10:50   #11
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,303
I used to run native gcc, SAS-C, and another one with a nice IDE with colors and all I don't remember the name of.

(Amoric, the Oric emu, has a C part. I even ported one very early version of MAME, with mixed results...)

My experience is that those compilers don't comply to the standard very well in C and it's worse in C++. I did that when I had no choice but it was extremely frustrating when at work I had access to modern compilers on windows/linux.

Now I would rather use vbcc or gcc 6 on Windows, then test on emulator. When it's beginning to work, try it on a real machine. bad performance can be a very bad surprise, specially with SDL or OS-compliant games. But for "serious" applications it should be okay.

I did the same migration for asm projects, from Barfly/CED on A1200/060 then Winuaue to vasm/notepad++ on windows and I wouldn't go back ever.
jotd is offline  
Old 08 June 2019, 15:30   #12
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,378
If you want to learn how to program in C or C++, I'd suggest using modern tools and creating code for modern platforms. This is most likely easier than using any form of retro platform as your target, if only because of much better debugger support and (in general) much more (and arguably better) documentation being available.

Secondly, I'd start with getting to grips with the language before tackling hardware or OS specifics, but that is just my preference.

On the other hand, if what you really want is to learn Amiga C/C++ programming, I'd suggest following jotd's advice.
roondar is offline  
Old 08 June 2019, 15:36   #13
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,485
Quote:
Originally Posted by Rango View Post
Hi guys. I've decided i'm going to learn C programming (from C programming A modern approach 2nd edition C99) but is practicing C (C99?) coding on real Amiga 1200 or 500+ hardware a good idea? Or is there better way to practice your code on?
Your intention is not absolutely clear to me. What is the goal? Just to learn (standard, portable) C or to write a game in it, as you mentioned in a following post?

You can learn C everywhere, if you restrict yourself to the library functions defined by ISO-C. The code will be perfectly portable and can be compiled and run on any system with a valid C compiler. Pick the system and development environment you are most comfortable with.

For a game you will usually have to select a target architecture, unless it is a really simple game (without graphics and sound) or uses a portable game library (like SDL, which hurts performance, especially on older/slower systems). Here you have to learn everything about the target's hardware and operating system, which has not necessarily much to do with C.

I would also recommend to learn C on different architectures at once if you ever want to write good, portable code. Especially little-endian and big-endian, 16 or 32-bit and 64-bit.
phx is offline  
Old 08 June 2019, 17:44   #14
Doma
Registered User

 
Join Date: Jul 2018
Location: Oslo
Posts: 9
One thing I want to add to this is that unless you have the early version of the A500 with the Hi-Tek mechanical keyboard it is almost impossible to do any serious typing on an A500 or A1200.

The mitsumi keyboard that came later are very bad and I would not recommend doing any coding on them.
Doma is offline  
Old 08 June 2019, 19:01   #15
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 626
One advantage I can see about learning by writing code for a platform like the Amiga is that you will get a feel for which methods are fast and which are slow and wasteful.
If you're running your code on modern hardware you're not going to notice the difference between something taking 1ms and 20ms to complete. You're definitely going to notice the difference between 1 second and 20 seconds when you run the same code on an Amiga!
robinsonb5 is offline  
Old 08 June 2019, 22:55   #16
Rango
Registered User
Rango's Avatar
 
Join Date: Oct 2017
Location: Chicago, IL, USA
Posts: 34
Thanks guys for feedback. My goal is to learn C but with positive reinforcement that i see the results so it can push me fruther with writing.
Originally i was going to learn python as first language but this article convinced me otherwise. And i think this guy is completely right. https://www.evanmiller.org/you-cant-dig-upwards.html

If you ask me what i want to do with any programming language i'm not sure yet where this journey will take me but i want to be able to program to the metal as you guys say. For starters i would like to write my own firmware for radar detector as none of the manufacturers have features i want and need. Not sure how difficult that would be.

Also Ai automation revolution is approaching fast and i think just like in industrial revolution lots of ppl will lose jobs due to automation so i want to get new skills. The opportunities and growth of the jobs in IT in next 20 years will grow exponentially. I don't like my current job (not IT related) and i definitely want to part of next wave of huge job creating in this field. I worked in IT for last 20 yrs but never as programmer. Hoping programming isn't too difficult to grasp it.

I don't know if in first year or two i will be capable to write anything on 64 bit machine hence my idea of maybe trying simple 16 bit Amiga programming.

I mean let's not kid ourselves code in game in 1990 comparing to now is like night and day so that's the idea. That bouncing ball demo would be cool to see code of that too. That code is primitive to what we read now. At least that's what it seems to me, which i could be wrong hence i ask here.

From what i've read this book has ~600 examples so i have plenty of exercises but was thinking some code from 1990 where it's easier to read and create. I could be wrong again. I'm just asking.

Last edited by Rango; 09 June 2019 at 05:08.
Rango is offline  
Old 09 June 2019, 11:08   #17
Antiriad_UK
Registered User

 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 142
If you just started and it’s potentially career focused then the only sensible thing is download visual studio express and start leaning c#. Super easy learning environment and the concepts work for most programming languages.
Antiriad_UK is offline  
Old 09 June 2019, 12:26   #18
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 281
Quote:
Originally Posted by Rango View Post
Hi guys. I've decided i'm going to learn C programming (from C programming A modern approach 2nd edition C99) but is practicing C (C99?) coding on real Amiga 1200 or 500+ hardware a good idea?
No. First of all, the compilers are a bit outdated, and second, the community that could help you in case you get stuck is too small. C is supported both by Linux and Windows very well, and that seems to be a much better entry point to me.

Second, what is it what you attempt to do? Is C the right language? For smaller projects, I found python quite interesting and easier to learn, for larger projects, C++ is certainly more helpful to get your code organized.
Quote:
Originally Posted by Rango View Post
I also looked into Arm Cortex STM32 development boards which are way faster 52Mhz but flash memory is only 64Kb so not much one can do with graphics hence my interest in real amiga with ~2000Kb of Ram. Also i don't think anyone uses original cpu amiga cycle as everyone is using accelerators now a days so that would also be most likely implemented and hence original cpu cycle non issue.
I'm not quite sure on what you are after. Is it hardware programming, looking for a particular language to do that? Is it learning to program (then don't look at particular hardware)? Is it solving a particular problem you have, and looking for a hardware and a development platform that would keep this simple?
Quote:
Originally Posted by Rango View Post
The goal would be to perfect C on real hardware but not as advanced as PC or Linux.
Why do you need "hardware" for that? You don't bang the hardware directly, neither on PC, Linux nor Amiga. If you want to create some graphics easily, I would suggest to go for C, and build on top of libSDL (simple direct media library), which is a cross-platform media library that is quite simple to use, and works quite nicely to get rewarded quickly.
Quote:
Originally Posted by Rango View Post
Baby steps is goal here, hence 16 bit attempt. The Amiga advantage here is RAM but disadvantage is CPU cycle speed unless accelerated.
Do you have a problem to solve that is CPU bound? If not, do not mind about the hardware.
Quote:
Originally Posted by Rango View Post
The only problem i see is humongous price tag on A1200 with ~$550USD price tag.

Maybe Raspberry Pi 3 with emulation but isn't that going to create just debug nightmare?

Maybe amiga has too many eccentricities that C programming practice would not be ideal? Thoughts guys?
First of all, understand what you want, and why you want to learn programming. With that information ready, more help will become available.

With as little as I know now, I would suggest Windows or Linux, Visual Studio or gcc, and look into libSDL which will give you some nice graphics quite easily, without going through all the hassle of the operating system layers.
Thomas Richter is offline  
Old 09 June 2019, 17:25   #19
modrobert
old bearded fool

modrobert's Avatar
 
Join Date: Jan 2010
Location: Bangkok
Age: 52
Posts: 525
Rango,

I can recommend SAS/C 6.58 if you want to do C programming natively on the Amiga with debugger in integrated environment, otherwise vbcc, it's awesome, having both installed is a good idea.

Enjoy programming long hours into the night on an amazing hardware platform and as an added bonus get the "red eye" look from glaring at proper CRT screen, just like the old days. Long beards approve of this, stop recommending bloated systems, cross compile, and platforms which are compromised by design.

Quote:
Real Amigas should only be used for testing and running code.
Pfffft, use it or lose it, my amiga likes to be powered on.

You are coding on silent hardware (eg. A1200 without fan), real keyboard and any code you get working OK on the Amiga will run crazy fast when ported to some lame modern PC or Mac hardware platform. I think you had the right idea in first post, optimization is turning into a lost art. You had the right hunch about learning and coding C on weak system, go for it, and have a great time doing it.

There are plenty of folks on this site who would help you out if you get stuck, me included.

EDIT:

Found my old post with SAS/C manuals linked.

Quote:
Volume 1 of the manual for the primary Amiga C compiler for most of the 1990s. Updated for version 6.5.

SAS/C Development System User's Guide, Volume 1: Introduction, Compiler, Editor, Version 6
https://archive.org/details/sasc-650-vol1


Quote:
Volume 2 of the user's guide for the primary Amiga C compiler for most of the 1990s. Covers version 6.5.

SAS/C Development System User's Guide, Volume 2: Debugger, Utilities, Assembler, Version 6
https://archive.org/details/sasc-650-vol2
modrobert is offline  
Old 09 June 2019, 18:00   #20
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
I don’t get why you feel the need to run real hardware to do this.

I do think that learning C on the Amiga is a good idea, and maybe a bit of assembly to really cement how things really work, but setting up WinUAE and VBCC with a good editor that understands your code will be so much more efficient for a tonne of reasons.
deimos is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Neat coding style and good habits Mrs Beanbag Coders. Asm / Hardware 234 05 May 2019 23:11
Netplay on real Amiga hardware? lesta_smsc support.Hardware 3 04 December 2018 09:03
FS: Several Hardware Amiga 500/1200 etc. Amiga mia MarketPlace 9 14 May 2009 10:27
WTB: Amiga 600, 500, 500 +, 1200 (NTSC) JeremyDay MarketPlace 2 30 November 2006 04:27
An Amiga site with almost every Amiga game (adfs and cds). Good idea/project? Ironclaw Retrogaming General Discussion 19 11 April 2006 21:58

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


All times are GMT +2. The time now is 13:01.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.09327 seconds with 13 queries