![]() |
![]() |
#21 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,382
|
I enjoy coding games in asm on the amiga, my C++ attempt resulted in a slow game that I now have to rewrite. And I have some routines that I reuse, low level debugging shows exactly your code, high level debugging is pretty difficult with WinUAE.
I saw Bartman C/C++ env. it's impressive but anyone besides the original team use it ? It's good I mean they make great games/demos out of it, but on the miggy at least for games, I feel that asm is the natural way, specially if you're not intending to port anything to non-68k targets (which is my case). On the other hand, an asm toolchain is primitive but simple: vasm+notepad++ => done. On the other hand, I wouldn't touch asm at work with a barge pole. Only C++, Ada and python there. And runs on Windows/Linux/ARM linux without a change and without UB either. |
![]() |
![]() |
#22 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,517
|
Code written for Amiga in C, or even C++ doesn't have to be slow. It depends on how you write it. If you are making frequent allocations and deallocations and/or relying on a lot of runtime abstraction, you're making a conscious trade off. Usually the trade off is the flexibility and extensibility of your code versus the performance.
If you want to write games for 68K, I'd generally suggest doing it in C first and foremost and then profiling to see what needs optimising at a lower level. Optimisation should be algorithmic first. There's no point doing a suave assembler optimisation of a terrible algorithm that doesn't scale unless you know for a fact it doesn't need to and that a simple linear speedup is adequate. It's a lot easier to do algorithm optimisations in C and once you've got the best reimplement as assembler. The alternative, doing everything in assembler, is something you do because you enjoy it. There aren't any really sensible arguments for it otherwise. |
![]() |
![]() |
#23 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,382
|
There is one actually: porting Z80 code to 68000 is way easier than porting to C.
I ported Bagman (C++/SDL) to amiga (keeping SDL interface but using only blitter & native modplayer/soundplayer internally) using Bebbos gcc and it was darn slow. I didn't try to optimize. Maybe I restored the background too much, maybe I checked too much things like bounds, etc... but it was slow. Now I only use Bebbos port of asm (gas). |
![]() |
![]() |
#24 | |
Ex nihilo nihil
Join Date: Oct 2017
Location: CH
Posts: 5,063
|
Quote:
That they considerthe resulting compiled C code acceptable in term of speed and time spent in writing the code are aside the scope of your question. At the end you have to choose and use the language you feel the best with and leave aside all others reasons. |
|
![]() |
![]() |
#25 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,552
|
A good Amiga developer has to be fluent in both languages.
Without knowing C you will have a hard time to finish and maintain bigger projects, or write portable tools. Without knowing 68k assembler your performance-critical code will never be as fast as it should be. |
![]() |
![]() |
#26 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 48
Posts: 3,856
|
|
![]() |
![]() |
#27 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,798
|
I am using ASM because that's what my coder heroes in the 80ies did...
![]() Probably using C is a clever thing these days and highly recommended. |
![]() |
![]() |
#28 | ||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,359
|
Quote:
I've done it. Even ones i didn't have the original sources. Quote:
Quote:
Now indeed if your program compiles, you have a big part of the deal - as changing something often leads to a heap of compilation errors. Where in asm you can rewrite your code part by part and test them easily even if the rest of the code is wrong, try to do that in C (or worse, C++ with all those classes around). Quote:
Quote:
Yes in asm a pointer is a pointer, hopefully - and it allows using the pointed data the way you want. There can be reasons why in C that's not the case, but i can't see a good one. This is reciprocal. No. The stupid way is trusting the compiler too much. Quote:
Again you must know what you are doing. Both structures may have a lot in common, and using same code for handling this common part is nice (C++ can do this to some extent, but not C). Do this by mistake, and you don't need a compiler to warn you - the code will simply not work. The problem in C is that just too many things are UB, and the compiler will not warn you for most of them : signed integer overflow, division by zero, out of array bounds access, null pointer dereference, modification of string literal. If you pass in several parameters to a function, you don't even know in which order they will be evaluated ! There is nothing like that in asm. Quote:
Quote:
You must document your intents with comments in your source. Code itself is poor documentation - always have, always will. In many projects i've seen see whole sources without a hint on what they are for, the only comment in said sources being the license ! |
||||||||
![]() |
![]() |
#29 | |
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 855
|
@Steam Ranger
Quote:
In relation to what others said, here are my experiences/thoughts. To make the most of the limited resources of Amiga machines (especially the stock ones), assembly is required - for example, for SkillGrid I needed every byte and every CPU cycle, so I wrote it entirely in assembly. When the constraints are not too tight, C and other languages can of course be used and, when needed, assembly can be used only for the most critical parts - for example, Ring around the World is mostly written in AMOS Professional (which is quite inefficient), but I wrote some graphics/calculations-heavy routines in assembly. Also, assembly can used just for fun - for example, MeMO is written in 100% assembly, despite not requiring it at all, because I simply felt like so. |
|
![]() |
![]() |
#30 | |||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,326
|
Lack of professional experience, I call it. Face reality, this is the life of a software engineer (compared to a "coder").
Quote:
Quote:
No, but replacing a couple of arguments to a function by a member function of some data structure is not, provided you organized your code logically. Quote:
Quote:
Quote:
Same goes for "out of bounds accesses". The "same thing" happens in assembly and C. You trash memory. Oh, what a fun! Whereas, if you had used C++ and vector, you would have had the chance to detect the issue. Or if you had used proper abstractions in C such as "an array is not quite the right abstraction". Even in C you can write accessor functions, and do bounds checking there. Well, yes, I understand, for assembly language authors the array is the only data structure, but there is really more to discover. (-; Actually, these arguments are pretty silly - you complain that C does not react properly for errors you can do even easier in assembly. Of course, there are better languages than C. C++ is one I use on a daily basis. Whom? The authors of the console.device are missing, long retired, out of reach. There is "nobody to ask". Helping you to write programs *is* the job of the language, and helping you to detect problems in the code is exactly the reason for languages and why we have them. Despite abstracting from the actual machine, of course. Quote:
Quote:
Well, all I can say from your comments I can only judge that you haven't seen sufficiently many. I'm talking about "real life projects", not the average toy code. |
|||||||
![]() |
![]() |
#31 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,382
|
did someone mention flame wars before?
|
![]() |
![]() |
#32 |
HOL/FTP busy bee
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 32,039
|
|
![]() |
![]() |
#33 | |
Registered User
Join Date: May 2023
Location: Norwich
Posts: 437
|
Quote:
Of course if you want to write assembly because you enjoy it, well then that's a whole other story. |
|
![]() |
![]() |
#34 | ||||||||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,359
|
Quote:
And i see you go into ad hominem once again. Quote:
Quote:
![]() Quote:
This can be done in asm as well. Quote:
And again, personal attack. Quote:
Quote:
Quote:
And, even in asm you can write accessor functions and do bounds checking. My dynamic array functions do this. Quote:
Quote:
Signed arithmetic overflow isn't "error" if you know what you're doing. Out of bounds access can be shortcut to access nearby memory. Altering string constant defined with DC directive is perfectly permitted and works just fine. And so on. UB in case of an error is something. UB in case of something that's actually useful is something else. Consider using function call return values as parameters of another function call. In asm you perfectly know in which order these functions will be called. Same if you read from a data stream with postfix operator. Quote:
Quote:
Quote:
Oh you will find programmers who pretend their code is. But it isn't. Quote:
They're actually much worse than toy code. And always remember this thread is about assembler on Amiga. Not about professionnal programming. |
||||||||||||||
![]() |
![]() |
#35 | ||||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,326
|
Quote:
Quote:
That is, higher languages offer expressiveness by syntax elements - they allow you to declare what you want, and then later on offer the service of testing your code against your declaration. That is quite some help. Sure, by the amount of nonsense you have stated.... What else to say? Quote:
Quote:
Quote:
Quote:
At which point you shoot yourself into the foot because 3 years later you forgot your dirty trick. In C, you can have a pointer *behind* the last element of an array, and that is all that is ensured because on some architectures, everything else causes already a violation. Quote:
That is actually *quite* helpful if you want to write code that should run fine from the kickstart ROM. Just to mention one very obvious usage. Quote:
Fine, except that this is a job for a software engineer. "Coders" we have, indeed, more than enough... In *your* life maybe... |
||||||||
![]() |
![]() |
#36 | ||||||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,359
|
At least it is enjoyable rather than boring.
Quote:
It really is type checking, not syntax checking. Quote:
In asm when you add two things you know what they are because the instruction isn't exactly the same. In C when we have "+" we don't know what we're adding - in C++, worse, it could even be totally unrelated to an addition. In C when you see a closing curly brace you never know immediately what kind of structure it is (Basic is much better in that aspect). In asm you directly see your loop or branch instruction. If a is signed and b is unsigned (or vice versa), C will not tell you what it chooses to do when you write if (a < b). So much for C's expressiveness. Quote:
Assembler does not pretend to be portable. Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
![]() Quote:
![]() Forbidding something for everyone just because it won't work in ROM is very poor and very stupid. Quote:
Quote:
No, in yours too. Don't be naive. |
||||||||||||
![]() |
![]() |
#37 |
cheeky scoundrel
Join Date: Nov 2004
Location: Spijkenisse/Netherlands
Age: 43
Posts: 6,989
|
No but neither do walls of text. As soon as you have to create posts with 20 quotes in them you're just wasting screen real-estate for everyone else.
If it can't be said short and sweet, you're probably overthinking it. |
![]() |
![]() |
#38 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 48
Posts: 3,856
|
Quote:
And remember, 68k asm programming is a hobby and is used for smaller projects, and not for one million lines of code sized projects. Perfectly valid. Don't fall for that silly coders vs software engineers elitist crap. Coder is just slang for programmer, and programmer is just the simple word for software engineer. |
|
![]() |
![]() |
#39 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,019
|
Using C or other equivalents to write tools is sensible, because usually a tool itself doesn't need to be lightning quick, but the coding of it can be significantly faster than using ASM to do simple things like open file requesters, file handling, displaying something to screen etc where its speed doing that simply doesn't require optimised code.
But for the actual point where you need you code to be as fast as possible, ASM has no substitutes on 68000 based systems. Having said that, a programmer that has used ASM for so long, likely has a library of routines that use sane equates and parameters so that writing a tool or utility in ASM need not be a headache and can be just as quick a process as writing in C. |
![]() |
![]() |
#40 | |
Ex nihilo nihil
Join Date: Oct 2017
Location: CH
Posts: 5,063
|
Quote:
At the end, asm & C are languages. And languages can be learned, like French, German, Italian, Russian, Chinese, English, etc. Some may say that 68k asm is complicated as Chinese and that, therefore, it is better to learn or use C (English). Those people forget that Chinese, as 1st languages, is spoken by 927 million people. Only 379 million speak English as 1st language. Given that about 3 times more people speak Chinese over English, we can easily say that Chinese is not such a difficult language ![]() Last edited by malko; 27 June 2023 at 22:22. Reason: typo |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Chat GPT Amiga Assembly | rcman | Coders. Asm / Hardware | 3 | 26 March 2023 20:24 |
An Amiga coder was banned without a reason - is it ok? | litwr | project.EAB | 1 | 18 June 2021 20:38 |
Beginning Amiga Assembly Tutorial(s) | Curbie | Coders. Asm / Hardware | 15 | 29 May 2020 00:21 |
Beginning Amiga Assembly Programming | Hewitson | Coders. Tutorials | 32 | 09 October 2012 18:25 |
Amiga Assembly sources - Please help! | W4r3DeV1L | Amiga scene | 21 | 16 July 2008 08:13 |
|
|