Poster | Thread |
cdimauro
|  |
Assembly abuse seriously damages (mental) health Posted on 2-Jul-2023 18:34:12
| | [ #1 ] |
|
|
 |
Elite Member  |
Joined: 29-Oct-2012 Posts: 4127
From: Germany | | |
|
| Assembly abuse seriously damages (mental) health
Too many times assembly programming is deified, often inappropriately.
The questionable statements made by an (Amigan) fanatic provide the cue to address the topic, particularly with regard to a few crucial points.
All this without in any way detracting from the fact that even today in some cases it is still necessary to use it, or it is done for pure retro gaming/computing fun.
P.S. The article is in Italian, but it can be easily translated with DeepL, Google Translate, etc..
#assembly #programming #commodore #amiga #retrogaming #retrocomputing |
|
Status: Offline |
|
|
Karlos
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 2-Jul-2023 21:15:55
| | [ #2 ] |
|
|
 |
Elite Member  |
Joined: 24-Aug-2003 Posts: 4843
From: As-sassin-aaate! As-sassin-aaate! Ooh! We forgot the ammunition! | | |
|
| |
Status: Offline |
|
|
NutsAboutAmiga
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 2-Jul-2023 23:46:44
| | [ #3 ] |
|
|
 |
Elite Member  |
Joined: 9-Jun-2004 Posts: 12960
From: Norway | | |
|
| @cdimauro
If AROS is source code compatible and written in C, then Assembly is not necessary. 68000 assembly is not necessary to write programs on AmigaOS4.1.
Unreasonable love for 68000 CPU  Without any regards for portability 
Don’t get me wrong, its useful to know 680x0 assembler, to be able to update or even better port assembler to C or C++. Last edited by NutsAboutAmiga on 03-Jul-2023 at 12:01 AM. Last edited by NutsAboutAmiga on 02-Jul-2023 at 11:54 PM. Last edited by NutsAboutAmiga on 02-Jul-2023 at 11:49 PM.
_________________ http://lifeofliveforit.blogspot.no/ Facebook::LiveForIt Software for AmigaOS |
|
Status: Offline |
|
|
Karlos
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 2-Jul-2023 23:59:02
| | [ #4 ] |
|
|
 |
Elite Member  |
Joined: 24-Aug-2003 Posts: 4843
From: As-sassin-aaate! As-sassin-aaate! Ooh! We forgot the ammunition! | | |
|
| Assembler is fun. If someone wants to use it for Amiga programming, let them. There's nothing more tiresome than being told what to do for your hobby and the Amiga exists today for no other purpose. _________________ Doing stupid things for fun... |
|
Status: Offline |
|
|
Hammer
 |  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 4:17:15
| | [ #5 ] |
|
|
 |
Elite Member  |
Joined: 9-Mar-2003 Posts: 6161
From: Australia | | |
|
| @cdimauro
Assembly has its place. The faster and the fastest Amiga 68K CPU accelerator add-on is not a 68K micro-architecture CPU design.
A good 68K assembly effort should be focusing on a good 68K compiler that would benefit the whole 68K community. Last edited by Hammer on 03-Jul-2023 at 04:48 AM.
_________________ Amiga 1200 (rev 1D1, KS 3.2, PiStorm32/RPi CM4/Emu68) Amiga 500 (rev 6A, ECS, KS 3.2, PiStorm/RPi 4B/Emu68) Ryzen 9 7950X, DDR5-6000 64 GB RAM, GeForce RTX 4080 16 GB |
|
Status: Offline |
|
|
cdimauro
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 5:00:13
| | [ #6 ] |
|
|
 |
Elite Member  |
Joined: 29-Oct-2012 Posts: 4127
From: Germany | | |
|
| @Karlos
Quote:
I've written my article because I've read this thread!  |
|
Status: Offline |
|
|
cdimauro
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 5:01:19
| | [ #7 ] |
|
|
 |
Elite Member  |
Joined: 29-Oct-2012 Posts: 4127
From: Germany | | |
|
| |
Status: Offline |
|
|
cdimauro
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 5:04:13
| | [ #8 ] |
|
|
 |
Elite Member  |
Joined: 29-Oct-2012 Posts: 4127
From: Germany | | |
|
| @Hammer
Quote:
Hammer wrote: @cdimauro
Assembly has its place. The faster and the fastest Amiga 68K CPU accelerator add-on is not a 68K micro-architecture CPU design.
A good 68K assembly effort should be focusing on a good 68K compiler that would benefit the whole 68K community. |
See above. Nothing against it, because Amigas had very limited resources and usually it was necessary to use assembly to squeeze more from the system.
However this / was limited to the original machines.
Nowadays... with so many resources available (even for an Amiga. Either emulated or via accelerators cards)... I prefer to better spend my time and be much more productive with other languages (specifically, Python).  |
|
Status: Offline |
|
|
michalsc
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 6:49:17
| | [ #9 ] |
|
|
 |
AROS Core Developer  |
Joined: 14-Jun-2005 Posts: 421
From: Germany | | |
|
| @cdimauro
Quote:
I've written my article because I've read this thread! |
Looked briefly at that thread I can only say - some boys stay boys and never grow up. The attitude of some on that thread reminds me myself when I was around 20-24 years old. Beloved in assembler, making fun of all other languages. But then I grew up, I started to value my own free time. Then I gave up and came to conclusion that a programming language is just a tool.
I can love screwdrivers and pretend they are perfect for anything. But if I have to put a nail in a wall I will rather pick a hammer (or stone) than a screwdriver. If I want to paint the wall, I will pick up a brush or anything more suitable than a screwdriver.
Saying that - knowing assembler helps and programming in assembler is a lot of fun. But so is programming in other tools as well. Therefore, today, I just pick the most suitable tool (not the one I mostly prefer) for given task. Being it c,c++,c#,python or bash script if that's enough. |
|
Status: Offline |
|
|
Karlos
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 7:32:49
| | [ #10 ] |
|
|
 |
Elite Member  |
Joined: 24-Aug-2003 Posts: 4843
From: As-sassin-aaate! As-sassin-aaate! Ooh! We forgot the ammunition! | | |
|
| One good outcome of the thread is that there is renewed interest in increasing the performance of the AB3D2 engine :) _________________ Doing stupid things for fun... |
|
Status: Offline |
|
|
olsen
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 8:19:56
| | [ #11 ] |
|
|
 |
Cult Member  |
Joined: 15-Aug-2004 Posts: 774
From: Germany | | |
|
| @cdimauro
Quote:
cdimauro wrote: Assembly abuse seriously damages (mental) health
Too many times assembly programming is deified, often inappropriately.
The questionable statements made by an (Amigan) fanatic provide the cue to address the topic, particularly with regard to a few crucial points.
|
I still remember growing up writing assembly language on the C64, but only as support functions which BASIC code could invoke. This is my "superpower": I'm lazy. The 6502 was just about the sweet spot in terms of how it worked, featuring only six registers. I could work with that pretty well.
But those were the days (around 1984-1985) when you had to resort to low level hardware and CPU access to get anything done which the firmware and its BASIC interpreter didn't even provide useful tools for. If you moved from the C64 to the Amiga you probably did take this philosphy to heart and applied it to a new context.
Compared the C64, the Amiga was intentionally documented well, from the low level hardware (the full Zorro II expansion hardware documentation was later available only in the form Commodore published as the "Commodore Amiga A500-A2000 technical reference manual") to almost the entire operating system (AmigaDOS being the odd one out). If you knew where to look, and could afford to spend the money for the entire printed documentation, you could know everything. And you probably had enough money to do that, too.
For guys like me who first had to learn English before being able to develop software for the Amiga, the situation was dire. In 1986 I was 16 years old and just did not have that kind of money to buy the documentation. This stuff was expensive. And that was before you could afford a 'C' compiler, which was even more expensive than the documentation.
So, what would you likely wind up doing? Do what comes naturally: do the job in assembly language, using photocopied documentation on the MC68000 and the Amiga hardware reference manual. The downside being that you would end up viewing the Amiga as a sort of grand C64. If you went down this path, you would miss out on something truly amazing.
Being lazy, I never fell for that approach. The MC68000 was way more complex than the 6502 and I admit that I'm still struggling with writing and understanding 68k assembly language well. Which is a feature, not a bug. The tools which the 68k assembly language affords you allow you to build essentially the same functional code in at least a dozen different ways, e.g. if you make clever use of the status register and the branch instructions.
Some people are born to enjoy this kind of puzzle-making. I'm not one of them and every time I see 68k assembly language code optimized to the point where you must wonder if you are viewing a piece of art rather than an algorithm I'm not exactly in awe, but awkwardly impressed to which lengths humans will go in order to build gothic cathedrals from grains of sand...Last edited by olsen on 03-Jul-2023 at 08:20 AM.
|
|
Status: Offline |
|
|
NutsAboutAmiga
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 19:44:02
| | [ #12 ] |
|
|
 |
Elite Member  |
Joined: 9-Jun-2004 Posts: 12960
From: Norway | | |
|
| @cdimauro
Quote:
BTW, my point is to use assembly only if it's really needed. |
When is it really needed? (beyond micro optimizing)
I know atomic instructions, but I guess this only useful in multithreaded OS. I know some things like supervisor mode can entered using assembler, but when do really need to? When the OS provides API’s do this on higher level like the Supervisor function in exec library:
result = Supervisor(userFunc)
There is some talk about TAS instruction here:
https://stackoverflow.com/questions/65652643/tas-instruction-68000 (puppydrum64 says it’s not actually working on SEGA Genesis.)
beyond I don’t see the need, languages like Pascal / C / C++ / AmigaE (Portable E) compiles to machine code, so really has be some really special case, copper list or banging hardware does not depend on writing in lower language like assembler, well it has be lanuage define byte/short/int/float/doubles so you manage 16bit alignment, so read from the hardware registers in a proper way.
There lots examples of games written in blitz basic 2, another example of a high-level language that compiles to assembler.
Last edited by NutsAboutAmiga on 03-Jul-2023 at 07:51 PM. Last edited by NutsAboutAmiga on 03-Jul-2023 at 07:49 PM. Last edited by NutsAboutAmiga on 03-Jul-2023 at 07:47 PM.
_________________ http://lifeofliveforit.blogspot.no/ Facebook::LiveForIt Software for AmigaOS |
|
Status: Offline |
|
|
Karlos
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 21:23:42
| | [ #13 ] |
|
|
 |
Elite Member  |
Joined: 24-Aug-2003 Posts: 4843
From: As-sassin-aaate! As-sassin-aaate! Ooh! We forgot the ammunition! | | |
|
| @NutsAboutAmiga
I think I see the root of your confusion. Using assembler is not micro optimising. It's what you do when your best efforts to improve the performance of high level code has hit a wall.
Normally you start by choosing the best algorithm and implementing it in your HLL of choice. Then you discover it's still too slow for what you need, so you do some performance analysis, refactor it a bit, test again, micro optimise, change data structures etc.
If after all that, it's still to slow, you are probably already looking at the output assembly to see why. Sometimes this gives you an insight into changes you can make in the HLL to avoid a bottleneck.
For modern CPUs you area almost always hitting some IO limit before you get to the point of needing assembler but for 68K CPUs this isn't the case. _________________ Doing stupid things for fun... |
|
Status: Offline |
|
|
NutsAboutAmiga
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 22:15:30
| | [ #14 ] |
|
|
 |
Elite Member  |
Joined: 9-Jun-2004 Posts: 12960
From: Norway | | |
|
| @Karlos
I think assemblers’ popularity came out of the “micro optimizing”, it one of few way you can make thing fast, when you had wherry little CPU resources, so the language was automatically the best, disregarding readability (you have to comment everything, else you forget what it does), none standardization of assembler for different CPU architectures, and lack of structure built into the language, over use of shortened instructions names, and use of acronym to describe the instructions functions. Results that end up in CPU flags without coder seeing the assignment (you must remember what it does, as its not obvious from look at code). Coder often using dreaded Jump’s (JMP) (or GOTO as it was called in basic).
That often ended in the dreaded spaghetti code. https://en.wikipedia.org/wiki/Spaghetti_code
beyond that, its also a language that lacks boundary checking (just like C), index loads and stores are the same as pointers.
it’s not beginner friendly, it requires a understanding of logical NOT, OR, AND, XOR, binary number system and the hexadecimal number system, its true many other languages also require the same knowledge. Basic (and many other scripting languages) you can start programming without any prior knowledge of any of that, and you need to understand what byte, word (half word) is and long (word), 680x0 and as they are named in PPC assembler in parentheses.
True that the some technical knowledge is also needed in C programming, (perhaps Pascal is easier, not completely beginner language)
Last edited by NutsAboutAmiga on 03-Jul-2023 at 10:23 PM.
_________________ http://lifeofliveforit.blogspot.no/ Facebook::LiveForIt Software for AmigaOS |
|
Status: Offline |
|
|
Karlos
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 22:51:04
| | [ #15 ] |
|
|
 |
Elite Member  |
Joined: 24-Aug-2003 Posts: 4843
From: As-sassin-aaate! As-sassin-aaate! Ooh! We forgot the ammunition! | | |
|
| @NutsAboutAmiga
It didn't come from that at all. Assembler was popular among Amiga developers in Europe because most of them had graduated from 8 bit machines for which machine code (assembler if you were lucky) was the only realistic choice for implementing games worth playing.
Languages like C weren't well suited to the task because running C, even a tiny version like DICE on a floppy only system was pure agony. People with expanded machines could of course use it.
Then you get into the performance of it. C isn't particularly slow, but all things are relative. Old compilers didn't optimise code particularly well and unless you were careful to make your code word oriented, wouldn't necessarily be particularly well tuned for vanilla 68000 as 32-bit integers would be thrown around for almost everything.
So you had people already used to controlling the hardware directly using assembler because that's what they were used to already. They weren't "beginners" to assembler. Last edited by Karlos on 03-Jul-2023 at 11:54 PM.
_________________ Doing stupid things for fun... |
|
Status: Offline |
|
|
gdimauro
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 3-Jul-2023 23:24:42
| | [ #16 ] |
|
|
 |
New Member |
Joined: 3-Jun-2023 Posts: 4
From: Unknown | | |
|
| Quote:
So you must have used it a lot |
|
Status: Offline |
|
|
cdimauro
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 4-Jul-2023 4:33:41
| | [ #17 ] |
|
|
 |
Elite Member  |
Joined: 29-Oct-2012 Posts: 4127
From: Germany | | |
|
| @michalsc
Quote:
michalsc wrote: @cdimauro
Quote:
I've written my article because I've read this thread! |
Looked briefly at that thread I can only say - some boys stay boys and never grow up. The attitude of some on that thread reminds me myself when I was around 20-24 years old. Beloved in assembler, making fun of all other languages. But then I grew up, I started to value my own free time. Then I gave up and came to conclusion that a programming language is just a tool.
I can love screwdrivers and pretend they are perfect for anything. But if I have to put a nail in a wall I will rather pick a hammer (or stone) than a screwdriver. If I want to paint the wall, I will pick up a brush or anything more suitable than a screwdriver.
Saying that - knowing assembler helps and programming in assembler is a lot of fun. But so is programming in other tools as well. Therefore, today, I just pick the most suitable tool (not the one I mostly prefer) for given task. Being it c,c++,c#,python or bash script if that's enough. |
@olsen
Quote:
olsen wrote: @cdimauro
Quote:
cdimauro wrote: Assembly abuse seriously damages (mental) health
Too many times assembly programming is deified, often inappropriately.
The questionable statements made by an (Amigan) fanatic provide the cue to address the topic, particularly with regard to a few crucial points.
|
I still remember growing up writing assembly language on the C64, but only as support functions which BASIC code could invoke. This is my "superpower": I'm lazy. The 6502 was just about the sweet spot in terms of how it worked, featuring only six registers. I could work with that pretty well.
But those were the days (around 1984-1985) when you had to resort to low level hardware and CPU access to get anything done which the firmware and its BASIC interpreter didn't even provide useful tools for. If you moved from the C64 to the Amiga you probably did take this philosphy to heart and applied it to a new context.
Compared the C64, the Amiga was intentionally documented well, from the low level hardware (the full Zorro II expansion hardware documentation was later available only in the form Commodore published as the "Commodore Amiga A500-A2000 technical reference manual") to almost the entire operating system (AmigaDOS being the odd one out). If you knew where to look, and could afford to spend the money for the entire printed documentation, you could know everything. And you probably had enough money to do that, too.
For guys like me who first had to learn English before being able to develop software for the Amiga, the situation was dire. In 1986 I was 16 years old and just did not have that kind of money to buy the documentation. This stuff was expensive. And that was before you could afford a 'C' compiler, which was even more expensive than the documentation.
So, what would you likely wind up doing? Do what comes naturally: do the job in assembly language, using photocopied documentation on the MC68000 and the Amiga hardware reference manual. The downside being that you would end up viewing the Amiga as a sort of grand C64. If you went down this path, you would miss out on something truly amazing.
Being lazy, I never fell for that approach. The MC68000 was way more complex than the 6502 and I admit that I'm still struggling with writing and understanding 68k assembly language well. Which is a feature, not a bug. The tools which the 68k assembly language affords you allow you to build essentially the same functional code in at least a dozen different ways, e.g. if you make clever use of the status register and the branch instructions.
Some people are born to enjoy this kind of puzzle-making. I'm not one of them and every time I see 68k assembly language code optimized to the point where you must wonder if you are viewing a piece of art rather than an algorithm I'm not exactly in awe, but awkwardly impressed to which lengths humans will go in order to build gothic cathedrals from grains of sand... |
That's more or less that path of many of us.
We started with low-level stuff "to rule the world" (assembly was "kool", we were the best because of using it, etc.) and because that was mostly required by the limited resources of the machines of the time, but then we grew and become mature and... professional, giving the right weight to each tool (language) and choosing the ones that "better fit" the problem that we've to solve.
The only thing which we cannot buy at the market is time: the most valuable resource.
Whereas those guys not only has never grown, but they not even exit from their cave and continue to waste their time.
Their choice, anyway. I look at the past and to what I've done and to me it's only nostalgia, because I can't change anything anymore. Lessons learned. Too late, but learned.
Now I prefer to focus on solving problems: that's what delights me. And if I use assembly or machine language, then it's only because they serve the purpose. |
|
Status: Offline |
|
|
cdimauro
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 4-Jul-2023 4:41:40
| | [ #18 ] |
|
|
 |
Elite Member  |
Joined: 29-Oct-2012 Posts: 4127
From: Germany | | |
|
| @Karlos
Quote:
Karlos wrote: One good outcome of the thread is that there is renewed interest in increasing the performance of the AB3D2 engine :) |
Which you are rewriting... in C. 
@Karlos
Quote:
Karlos wrote: @NutsAboutAmiga
It didn't come from that at all. Assembler was popular among Amiga developers in Europe because most of them had graduated from 8 bit machines for which machine code (assembler if you were lucky) was the only realistic choice for implementing games worth playing.
Languages like C weren't well suited to the task because running C, even a tiny version like DICE on a floppy only system was pure agony. People with expanded machines could of course use it.
Then you get into the performance of it. C isn't particularly slow, but all things are relative. Old compilers didn't optimise code particularly well and unless you were careful to make your code word oriented, wouldn't necessarily be particularly well tuned for vanilla 68000 as 32-bit integers would be thrown around for almost everything.
So you had people already used to controlling the hardware directly using assembler because that's what they were used to already. They weren't "beginners" to assembler. |
This.
BTW Pascal has also the possibility to manipulate memory (it has pointers, and you can cast them if needed). In the past some o.ses were written in Pascal (or one of its dialects), with MacOS being the notable one (AFAIR).
C is very often considered low-level, but IMO it's because of the pervasive use of pointers and because it makes it easy to "play with them".
@gdimauro
Quote:
gdimauro wrote: Quote:
So you must have used it a lot |
Dear son, young people are known to make mistakes due to their age and immaturity.
But then you're supposed to grow, learn from what you've done, and try to avoid the same mistakes.
Let's see when it'll be your turn... |
|
Status: Offline |
|
|
Karlos
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 4-Jul-2023 6:49:42
| | [ #19 ] |
|
|
 |
Elite Member  |
Joined: 24-Aug-2003 Posts: 4843
From: As-sassin-aaate! As-sassin-aaate! Ooh! We forgot the ammunition! | | |
|
| @cdimauro
Quote:
Which you are rewriting... in C. |
Only bits of it. I don't consider it likely that the whole thing will be reimplemented, just the parts that make sense._________________ Doing stupid things for fun... |
|
Status: Offline |
|
|
kamelito
|  |
Re: Assembly abuse seriously damages (mental) health Posted on 4-Jul-2023 15:36:33
| | [ #20 ] |
|
|
 |
Cult Member  |
Joined: 26-Jul-2004 Posts: 836
From: Unknown | | |
|
| For reverse engineering stuff on Amiga assembly is necessary and using it train my brain so it is good for my health. |
|
Status: Offline |
|
|