flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 13 Oct 2010, 15:52
My thoughts are:
Use ASM for everything. Not for optimisation, but for sanity. The optimisation part is just a free bonus. Well you did ask for my thoughts. Probably not helpful to you though, hehe ![]() |
|||
![]() |
|
DarkAlchemist 13 Oct 2010, 19:39
Not what I was looking for, and while I do agree on principle alone lets not forget how easy it is to do something in C++ over doing the same thing in ASM (especially in a team environment).
Also, I doubt Windows was done in 100% ASM so calling one of their routines is basically intermixing as it is. Now, having been a 6502/6510/68k ASM programmer for 8 years I can attest to the sanity as OOP befuddles me greatly (I still, to this day, have a hard time with pointers etc... because * or -> or *(*x) is meaningless to me in ASM when I can just (xxxx) or XXXX (in X86 the parens are brackets but the same meaning)). So, my question remains. |
|||
![]() |
|
f0dder 14 Oct 2010, 02:35
When to use assembly? Depends. Non-exhaustive list of possible reasons:
1) when you have to: OS bootstraps, or targeting really low-end embedded devices, or utilizing very machine-specific instructions (like hardware virtualization support). 2) if there's a reason to: the bulk of your code might be in a HLL, but you have a really speed-sensitive part (verified through profiling) that seems like a good candidate for an assembly version. 3) if you feel like it: the hobbyist reason. If you really like assembly, don't care whether it's possible to Get The Job Done Faster(TM), and have nobody dictating the rules - go for it. Keep in mind that you don't have to resort to assembly to utilize instruction sets like MMX or SSE, as the major C/C++ compilers support intrinsic functions for these. I personally prefer assembly (using fasm, yasm or nasm is actually more portable than C++ intrinsics, as those aren't standardized between compilers), but intrinsics can be useful while prototyping as you don't have to worry about register allocation. DarkAlchemist wrote:
![]() |
|||
![]() |
|
lemask 14 Oct 2010, 06:21
@revolution: So you use assembly really for everything? Also for some quickie-jobs (i.e. renaming a bunch of files) which could be done faster with a simple script?
|
|||
![]() |
|
revolution 14 Oct 2010, 06:50
lemask wrote: @revolution: So you use assembly really for everything? lemask wrote: Also for some quickie-jobs (i.e. renaming a bunch of files) which could be done faster with a simple script? I don't buy the talk about HLLs being easier to program with. Assembly is just as easy, but perhaps just not as familiar with some people. I'm not saying HLLs should never be used, just that I never need to use them. There are times where portability is desired. As the CPU markets settle and mature we have kind of come to two main CPU architectures, ARM and x86. Now that ARM CPUs are starting to become as powerful as the x86 counterparts, things like Linux benefit greatly from being written in HLL. But since I don't write general purpose OSes then I am not interested in that situation and I don't need portability in that way. Last edited by revolution on 14 Oct 2010, 15:23; edited 1 time in total |
|||
![]() |
|
DarkAlchemist 14 Oct 2010, 07:47
I am not sure strong typing is my problem, per se', but I sure love the flexibility I had doing ASM. I despised C before it became certified and settled on C++ but I feel like I am in a box because I feel more comfortable getting at my data without a huge mangled piece of code. I always griped that I should be able to specify XYZ address and do with it as I please when I please, as I did in ASM, so you might be right but my head is just never going to accept *(*int xyx)->blah type of nonsense. I suppose my downfall was running on systems where code always loaded into the same chunk of memory always so I didn't need (back then there were no macros or other stuff for ASM (those throw me and look like the bastard child of an HLL and ASM)) to find that type of stuff they do in C/C++ land. I tried writing in C/C++ like I did in ASM and it puked. So, all I could do is clinch my fists and shout loudly.
To this day I write logic and it works fine but let it manipulate addresses and I have to run to Google to see how to do it and spend way too much time, each time, trying to get it right. Anyway, and I know this is a foreign concept with today's programmers but I count cycles (harder to do with multicore though) and I count bytes. So, when I whip out the debugger and see all of that horrible prologue and epilogue for each function I honestly think a subtle tick in my face starts to happen and I get a little sick, lol. |
|||
![]() |
|
lemask 14 Oct 2010, 08:02
It too was and still is my ideal to write everything in assembly. But i often fall back to scripting, because that is where i come from.
|
|||
![]() |
|
f0dder 14 Oct 2010, 12:08
DarkAlchemist: if you constantly need to manipulate addresses leading to horrible typecasts, then either you're working against the language rather than with it - if you want to use a language effectively, you have to follow it's idioms. Of course it could be that for whatever you're doing, C++ simply isn't the right language - right tool for the job, and all that.
Personally I don't see how "person->slaveHandler->firstName", which is normal style pointer dereferencing is horrible - and it's shorter than all the temporary loads you need in assembly code. I also find it reads pretty OK - "->" being "points to" ![]() |
|||
![]() |
|
DarkAlchemist 14 Oct 2010, 15:13
* or -> is simple enough and I can live with that but every other way to get at what it is you need is foreign to me and not something my mind accepts (even after a decade of programming in C/C++).
Lets take this for example Code: ((CLASS*)this->GetParent())->ARRAY[byteinarray]; Anyway, this is not about a hate or a love of any language, nor do I wish for this thread to devolve into it, but I only mentioned that for me I much prefer ASM over C/C++ only I can get something done quicker in C/C++ AND others can take the code then run with it easier in a team environment. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.