English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 02 June 2010, 14:46   #1
bburtonpa
Amiga user since 1985
 
Join Date: Apr 2005
Location: Middlesex, NJ USA
Posts: 14
C# Framework

Like many old time Amiga coders, I find myself irresistibly drawn back to the platform these days. I no longer have any Amiga hardware, only Amiga Forever to play around with.

For many years, I have been kicking around in my head a plan for wrapping the Amiga API within C++ header files to make a bit easier to use. Work, life, etc. always seemed to get in the way for my doing anything about it until now.

I am aware of the stillborn Amiga Java project(s). There is also a C# project going on based on Mono, but who has the time to spend on all of that. My thoughts were to create a C# like framework for C++ that gave the modern coder a familiar environment. I think I have succeeded in doing just that (see attached).

To do this, I needed properties and events. A quick Google search and I had exactly what I needed. As anyone familiar with C# (and to some degree Java) can see by the attached code sample, I have put together a simple, event driven demo with all the flavor of C# and very little C++. The executable was compiled using AmiDevCpp and is just 75kb. A bit large for Amiga apps, but certainly acceptable given the ease of use. You will notice there is no message loop. That is contained in the forms.h header file which I have chosen not to release just yet as there is still a LOT more to do. When I do release the code, it will be done so under GPL type licensing without any restrictions on it's use. BTW - Since all of the code is in the form of C++ headers, there is no reason at all that the framework could not be used "as is" on Amiga 4.x, AROS and/or MorphOS systems.

My next task will be to wrap the menu and gadget subsystems and provide event driven notifications similar to what I have already produced for window events.

Here is where I need some help. It's been a LONG time since I have done any C++ coding...most of the past ten years have been spent with Java and/or C#. It's been almost fifteen years since I've done any serious Amiga coding. What I am looking for is a person or persons interested in helping make some of the decisions on this project, specifically in regards to message handling. For instance, do we do it the Windows way and handle ALL messages in the message loop or do we allow users to turn off specific, resource eating messages of (e. g. ReportMouse). I'll do the work, I just need someone who is more up to date with the Amiga API than I am, involved with the project. I don't see this as comsuming a lot of anyone's time...

I would appreciate any comments you may have on the work I have done so far and suggesstions on how it should proceed in the future.

Barry

p. s. I am cross-posting this message in a couple of other locations in order to generate interest in the project.
Attached Files
File Type: zip asharp.zip (71.0 KB, 501 views)
bburtonpa is offline  
Old 17 June 2020, 17:40   #2
danilos
Registered User
 
Join Date: Jun 2020
Location: Bondy
Posts: 1
Hi, I realize it has been a long time since this message was posted, but did you make any further progress on this project? I also thought it would be interesting to have a port or some sort of c# in the Amiga.
danilos is offline  
Old 18 June 2020, 08:45   #3
Tigerskunk
Inviyya Dude!
 
Tigerskunk's Avatar
 
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
There is a usable compiled Java around, at least, I remember..
Tigerskunk is offline  
Old 18 June 2020, 21:08   #4
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,771
Who on earth would prefer C# over C++?
Hewitson is offline  
Old 18 June 2020, 22:18   #5
TomXP411
Registered User
 
Join Date: May 2020
Location: California, USA
Posts: 18
Quote:
Originally Posted by Hewitson View Post
Who on earth would prefer C# over C++?
I do. The runtime is much more complete, with a ton of stuff you have to roll yourself (or buy) in c++. Mostly, though, I like not having to deal with pointers and memory allocation. The runtime does that for you.

Of course, you can't have real c# on an Amiga, because the CLR would use way too much memory to run effectively. However, there's a movement toward native compilation of c# code, and I'd love to see streamlined, native c# compilers for other platforms.
TomXP411 is offline  
Old 18 June 2020, 22:46   #6
S0ulA55a551n
Registered User
 
S0ulA55a551n's Avatar
 
Join Date: Nov 2010
Location: South Wales
Age: 46
Posts: 934
Quote:
Originally Posted by TomXP411 View Post
I do. The runtime is much more complete, with a ton of stuff you have to roll yourself (or buy) in c++. Mostly, though, I like not having to deal with pointers and memory allocation. The runtime does that for you.

Of course, you can't have real c# on an Amiga, because the CLR would use way too much memory to run effectively. However, there's a movement toward native compilation of c# code, and I'd love to see streamlined, native c# compilers for other platforms.
But isn't the power and speed of C and C++ that it isn't a managed language like Java or .net with all the over head of virtual machines.

Wrapping C, C++ to give C# , is the plan to make a managed version of C or C++ on the amiga, won't that kill the speed ?
S0ulA55a551n is offline  
Old 18 June 2020, 22:49   #7
matburton
Registered User
 
matburton's Avatar
 
Join Date: Apr 2017
Location: Cambridge
Posts: 136
Quote:
Originally Posted by TomXP411 View Post
Of course, you can't have real c# on an Amiga, because the CLR would use way too much memory to run effectively. However, there's a movement toward native compilation of c# code, and I'd love to see streamlined, native c# compilers for other platforms.
Yes this has been demonstrated with a 8kB Windows 3.11 C# program (which includes the parts of the .NET runtime needed for that minimal program, but not really any framework)

It'd be cool if Rust could target retro platforms going forward!
matburton is offline  
Old 19 June 2020, 03:37   #8
TomXP411
Registered User
 
Join Date: May 2020
Location: California, USA
Posts: 18
Quote:
Originally Posted by S0ulA55a551n View Post
But isn't the power and speed of C and C++ that it isn't a managed language like Java or .net with all the over head of virtual machines.

Wrapping C, C++ to give C# , is the plan to make a managed version of C or C++ on the amiga, won't that kill the speed ?
the language is not inherently any slower. In fact, c# can be very fast, as it's JIT compiled down to machine code, anyway.

What makes c# slow at times is the fact that it runs in a virtual machine. And this very thing becomes a non-issue when you switch from a CLR based runtime to native compiled code.

A native compiled version of c#, coupled with the GDI+ drawing framework would be both programmer friendly and could perform very well on a 2D GUI like the Amiga's operating system.
TomXP411 is offline  
Old 19 June 2020, 12:23   #9
clebin
Registered User
 
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 405
Quote:
Originally Posted by Steril707 View Post
There is a usable compiled Java around, at least, I remember..
Here it is:

https://www.mikekohn.net/micro/amiga_java.php

Java running on an A1000 at decent speed is frankly stunning. It'll be my first port of call whenever I come to writing another Amiga game.

Coincidentally, I've just started using C# to write a game for modern platforms and it's a lovely language. I love the syntax for creating a new object and assigning values at the same time for instance. I didn't see this thread at the time and it's shame it didn't get the attention it deserved as compiled C# would be great on Amiga.

I also enjoyed using C to write Landfill and learning the nuts & bolts of Amiga hardware, but quite frankly, I don't need pointers to have a good time!
clebin is offline  
Old 19 June 2020, 16:32   #10
gimbal
cheeky scoundrel
 
gimbal's Avatar
 
Join Date: Nov 2004
Location: Spijkenisse/Netherlands
Age: 42
Posts: 6,903
It would be stunning, but it isn't actually happening. You are running a native Amiga program, Java is completely out of the picture. It is exactly that fact that makes it at all possible.

That doesn't make it any less clever though, if someone manages to make a full game with it that performs reasonably well then I'd be mighty impressed.
gimbal is offline  
Old 19 June 2020, 19:14   #11
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,771
Quote:
Originally Posted by TomXP411 View Post
I do. The runtime is much more complete, with a ton of stuff you have to roll yourself (or buy) in c++. Mostly, though, I like not having to deal with pointers and memory allocation. The runtime does that for you.
I disagree. You've almost got to be a rocket scientist to code in C#. C and C++ are simple, elegant, and easy for anyone to learn.

Yet another attempt by M$ to make something unnecessarily difficult.
Hewitson is offline  
Old 19 June 2020, 19:19   #12
clebin
Registered User
 
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 405
Quote:
Originally Posted by gimbal View Post
It would be stunning, but it isn't actually happening. You are running a native Amiga program, Java is completely out of the picture. It is exactly that fact that makes it at all possible.

That doesn't make it any less clever though, if someone manages to make a full game with it that performs reasonably well then I'd be mighty impressed.
Yeah, I realise that! I should’ve been more precise with my language. Stunning is still the word I’d use though! Too much on plate right now but I’m itching to give it a try.
clebin is offline  
Old 19 June 2020, 19:22   #13
clebin
Registered User
 
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 405
Quote:
Originally Posted by Hewitson View Post
I disagree. You've almost got to be a rocket scientist to code in C#. C and C++ are simple, elegant, and easy for anyone to learn.

Yet another attempt by M$ to make something unnecessarily difficult.
Not true. I’m using it now, for the first time. I picked it up in no time at all. Way less time than it took me to learn C. I think your use of “M$” says everything we need to know here.
clebin is offline  
Old 20 June 2020, 13:27   #14
nogginthenog
Amigan
 
Join Date: Feb 2012
Location: London
Posts: 1,309
Quote:
Originally Posted by Hewitson View Post
I disagree. You've almost got to be a rocket scientist to code in C#. C and C++ are simple, elegant, and easy for anyone to learn.

Yet another attempt by M$ to make something unnecessarily difficult.
C# is a great language that is getting better now they have moved to .NET Core. It has so many features that makes my life easier (lambdas, generics, entity framework). It could probably be ported but it would need 10s of Mb of RAM just for a hello world.

C is definitely better suited to low level stuff. Problem with C is that you really have to know what you are doing. I do like it as a language though.
nogginthenog is offline  
Old 20 June 2020, 14:55   #15
asymetrix
Registered User
 
Join Date: Jul 2009
Location: UK
Posts: 112
A professional got the classic snake game written in C# in under 8k, further work on optimization hope to get it under 512 bytes.
https://medium.com/@MStrehovsky/buil...s-74c3cf60ea04
asymetrix is offline  
Old 21 June 2020, 11:08   #16
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,771
Quote:
Originally Posted by nogginthenog View Post
C# is a great language that is getting better now they have moved to .NET Core. It has so many features that makes my life easier (lambdas, generics, entity framework). It could probably be ported but it would need 10s of Mb of RAM just for a hello world.
If a Hello World would require 10s of MB of RAM, then it's obviously not a great language at all...
Hewitson is offline  
Old 21 June 2020, 13:27   #17
clebin
Registered User
 
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 405
Quote:
Originally Posted by Hewitson View Post
If a Hello World would require 10s of MB of RAM, then it's obviously not a great language at all...
That’s the runtime, OS libraries, etc. Nothing to do with the language - as seen in asymetrix’s post. The compiled Java demo for Amiga is 138k, for a sense of what could be achieved.
clebin 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
Porting Qt Framework to Amiga OS enviroments Pyromania Coders. General 2 24 July 2013 06:42

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 10:22.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.17061 seconds with 16 queries