flat assembler
Message board for the users of flat assembler.

Index > Heap > Does NASM have too much C?

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
Yes, it's pure. I've been manually constructing my stack frame for as long as I've been alive, ebp is a better known friend to me than my parents. But I have made a macro system in NASM, which is a thousand lines long, and I've made PROC and ENDP, LOCAL system to construct stdcall and cdecl procedures and it works well.
Post 27 Jun 2015, 20:07
View user's profile Send private message Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
Let me show you how my macros work, in constructing a procedure. It's all made by myself.

Code:
; Return value:
; bit0: supports x87
; bit1: supports sse
; bit2: supports sse2
; bit3: supports sse3
; bit4: supports sse4.1
; bit5: supports sse4.2
; bit6: supports hyper threading

PROC _check_sse_fpu_htt@0
                __________PROC_HEADER__________
                        calltype stdcall
                        entryalign 4
                        stackalign 0
                __________PROC_HEADER__________
                push ebx
                mov eax,1
                cpuid
                and edx,0x16000001
                mov eax,edx
                shr edx,24
                and eax,1
                and edx,10110b
                or edx,eax
                mov eax,edx
                shl eax,2
                and eax,1000000b
                or edx,eax
                mov eax,ecx
                and eax,1
                shr ecx,18
                and ecx,110b
                or ecx,eax
                shl ecx,3
                or edx,ecx
                mov eax,edx
                pop ebx
                ret
ENDP
    


When I export it, the name is different than you see here. I have made it possible to align both the entry code and the stack in a very simple way in the procedure header. The stack align should only be used if you don't push or pop anything at all in the code. Thats why I most often don't use it.


Last edited by PeExecutable on 27 Jun 2015, 20:51; edited 1 time in total
Post 27 Jun 2015, 20:10
View user's profile Send private message Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
PeExecutable wrote:
Let me show you how my macros work, in constructing a procedure. It's all made by myself.

Code:
PROC _check_sse_fpu_htt@0
                __________PROC_HEADER__________
                        calltype stdcall
                        entryalign 4
                        stackalign 0
                __________PROC_HEADER__________
                push ebx
                mov eax,1
                cpuid
                and edx,0x16000001
                mov eax,edx
                shr edx,24
                and eax,1
                and edx,10110b
                or edx,eax
                mov eax,edx
                shl eax,2
                and eax,1000000b
                or edx,eax
                mov eax,ecx
                and eax,1
                shr ecx,18
                and ecx,110b
                or ecx,eax
                shl ecx,3
                or edx,ecx
                mov eax,edx
                pop ebx
                ret
ENDP
    


When I export it, the name is different than you see here. I have made it possible to align both the entry code and the stack in a very simple way in the procedure header.


This is complete rubbish. It tells me about your inability to configure a stack frame manually. Again, you are using a macro to help you compensate your incompetency in dealing with stack frame. First IF and now this crap?

Why do I have this feeling that you are actually a Master Chef instead of a Master assembly programmer? You are a big joke!
Post 27 Jun 2015, 20:16
View user's profile Send private message Visit poster's website Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
Code:
push ebp
mov ebp, esp

leave
retn x
    


Whats so hard about that? Subtract whatever you want for your locals from esp. I know a heck of a lot more about this than you do, so now I've proven my worth, and your questions have been answered. bye.
Post 27 Jun 2015, 20:19
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
I've moved you two love birds into your own topic.
Post 28 Jun 2015, 01:53
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
revolution wrote:
I've moved you two love birds into your own topic.
Hahaha
Post 28 Jun 2015, 06:48
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
PeExecutable wrote:
Code:
push ebp
mov ebp, esp

leave
retn x
    


Whats so hard about that? Subtract whatever you want for your locals from esp. I know a heck of a lot more about this than you do, so now I've proven my worth, and your questions have been answered. bye.


OMG, did I see a LEAVE instruction? You kidding me? You called yourself an NASM master and you use LEAVE instruction a lot?
Post 28 Jun 2015, 07:15
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
What is wrong with "leave"?
Post 28 Jun 2015, 07:17
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
revolution wrote:
What is wrong with "leave"?
Nothing wrong with LEAVE. Just trolling around.. XD
Post 28 Jun 2015, 07:29
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
revolution wrote:
What is wrong with "leave"?

What's not wrong with "leave"?
Post 29 Jun 2015, 15:48
View user's profile Send private message Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
You have a wrong view of C and assembly. The assembly phase is not critical, never was and never will be. C has its place in the toolbox. You seem to be obsessed with speed (or size) or both, but one thing that you seem to miss here is that optimizations in C is much more productive than in assembly.

Let's say you code assembly for 5 years, you build up a quite large library of modules, and say there is a new technology that comes out, perhaps a new cpu feature or even just a new way of doing things. All that the C coder have to do, is to change one tiny little flag, re-compile everything, and the whole C library is optimized for this new feature.

If you were to do the same thing with your assembly library, you would have to go through every single module, optimize it by hand, and it will take almost just as long as it did to code the library. Let's say your library is worth 5 years of development, you would basically have to spend 5 years going through yet another optimization, and C would do the same thing in 30 seconds. Now beat that my man. 30 second (Brand new optimization for your library), 5 years to do the same thing (Brand new optimization in your asm library)

You shouldn't criticise C because it is a good tool to have in your toolbox, and asm isn't even a tool, asm is the toolbox itself, it is the toolbox. C is a tool, assembly is a toolbox.

And I probably don't have to tell you that it won't be long until assembly will not be practical anymore. In case you haven't noticed, what we used to do in critical loops on the cpu, is more and more being transferred to different hardware units.

Take graphics for example, it's not many years ago since we coded shaders directly on the cpu, today, the gpu takes care of shaders, and those long nasty and critical graphic loops that used to be on the cpu, is now effectively eliminated. Soon there will be no need for loops anymore on the cpu. Everything is just commands, sending commands to different units, and not so much loops anymore.

One day in the future, we will only be using the cpu for sending commands to different units. Those things that still needs to be looped will be replaced by special heavy instructions. Just like the new aes instruction set, these new instructions replace heavy intensive cpu work.

Modern computers are already well underway of becoming just a command-center, where it issues commands over the pipeline to other units, and tell them what to do.

Risc instruction architecture will be more and more possible as the die size goes down, and a risc architecture gives the compiler a better chance of optimization, which reduces the need for assembler.

The speed at which cpu and memory increase in speed and capacity (Moore's law) is much larger than the increase in intensity of the applications which run on it. We are already over-powered today, and that remainding power that we don't utilize will render asm irrelevant.

And also, Microsoft keep adding new layers on top of other layers, and it will be too much work for assembly to keep up with all the layers, we haven't even got fully working include files for the windows 95 platform today for any assembler out there, and windows 95 was deprecated in the year of 2000 (15 years ago)

The way most assembly programmers operate is under the old windows system using the old API, but modern programs should be written for COM, and most don't even know how COM works (Except me of course).

So don't bash C for this, C is designed to operate perfectly under all these difficulties I've outlined here.
Post 29 Jun 2015, 15:52
View user's profile Send private message Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
PeExecutable wrote:
You have a wrong view of C and assembly. The assembly phase is not critical, never was and never will be. C has its place in the toolbox. You seem to be obsessed with speed (or size) or both, but one thing that you seem to miss here is that optimizations in C is much more productive than in assembly.

Let's say you code assembly for 5 years, you build up a quite large library of modules, and say there is a new technology that comes out, perhaps a new cpu feature or even just a new way of doing things. All that the C coder have to do, is to change one tiny little flag, re-compile everything, and the whole C library is optimized for this new feature.

If you were to do the same thing with your assembly library, you would have to go through every single module, optimize it by hand, and it will take almost just as long as it did to code the library. Let's say your library is worth 5 years of development, you would basically have to spend 5 years going through yet another optimization, and C would do the same thing in 30 seconds. Now beat that my man. 30 second (Brand new optimization for your library), 5 years to do the same thing (Brand new optimization in your asm library)

You shouldn't criticise C because it is a good tool to have in your toolbox, and asm isn't even a tool, asm is the toolbox itself, it is the toolbox. C is a tool, assembly is a toolbox.

And I probably don't have to tell you that it won't be long until assembly will not be practical anymore. In case you haven't noticed, what we used to do in critical loops on the cpu, is more and more being transferred to different hardware units.

Take graphics for example, it's not many years ago since we coded shaders directly on the cpu, today, the gpu takes care of shaders, and those long nasty and critical graphic loops that used to be on the cpu, is now effectively eliminated. Soon there will be no need for loops anymore on the cpu. Everything is just commands, sending commands to different units, and not so much loops anymore.

One day in the future, we will only be using the cpu for sending commands to different units. Those things that still needs to be looped will be replaced by special heavy instructions. Just like the new aes instruction set, these new instructions replace heavy intensive cpu work.

Modern computers are already well underway of becoming just a command-center, where it issues commands over the pipeline to other units, and tell them what to do.

Risc instruction architecture will be more and more possible as the die size goes down, and a risc architecture gives the compiler a better chance of optimization, which reduces the need for assembler.

The speed at which cpu and memory increase in speed and capacity (Moore's law) is much larger than the increase in intensity of the applications which run on it. We are already over-powered today, and that remainding power that we don't utilize will render asm irrelevant.

And also, Microsoft keep adding new layers on top of other layers, and it will be too much work for assembly to keep up with all the layers, we haven't even got fully working include files for the windows 95 platform today for any assembler out there, and windows 95 was deprecated in the year of 2000 (15 years ago)

The way most assembly programmers operate is under the old windows system using the old API, but modern programs should be written for COM, and most don't even know how COM works (Except me of course).


All wikipedia stuff. We are not impressed. Copying articles from Wikipedia doesn't make you a master in Assembly Language. Try to come up with your own compiler and apply all of your design philosophy in there without whoring it to C design flaw and then you can call yourself a master. On NASM board, they may call u a master, but in here, you are nothing but a script kiddies. Because on FASM board, you can find LOTS of world class compiler writers and OS developers. For example, our MASTER revolution writes a compiler for ARM processors by using FASM macro language. typedef has something to do with stuxnet virus (he's on FBI most wanted list).

So save yourself the embarrasment when you think you want to teach people about compiler design, philosophy and optimization. Especially not on FASM board.

Don't say I didn't warn you.
Post 29 Jun 2015, 16:28
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
fasmnewbie wrote:
For example, our MASTER revolution writes a compiler for ARM processors by using FASM macro language.
Actually I never claimed to be a master of anything. But fasmarm is written in native x86 code. And fasmarm cannot self compile because there is no ARM port.
Post 29 Jun 2015, 16:46
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
typedef wrote:
What's not wrong with "leave"?
It is only one byte when assembled. And easier to type than equivalent alternatives.
Post 29 Jun 2015, 16:49
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
revolution wrote:
fasmnewbie wrote:
For example, our MASTER revolution writes a compiler for ARM processors by using FASM macro language.
Actually I never claimed to be a master of anything.


A "master" title is not a self-proclaim material. It is given by someone else. On the contrary, our buddy here claimed himself a MASTER assembly programming when he can't accomplish anything without the help of C language, ".if" macros and linkers.
Post 29 Jun 2015, 16:54
View user's profile Send private message Visit poster's website Reply with quote
fasmnewbie



Joined: 01 Mar 2011
Posts: 553
fasmnewbie
revolution wrote:
typedef wrote:
What's not wrong with "leave"?
It is only one byte when assembled. And easier to type than equivalent alternatives.


When you ask "what's wrong", then it's not wrong.

But for our "master" guy there calling himself a master, he should know that "leave" is a microcode with 3 reciprocal throughput if compared to mov rsp,rbp(1/3) and pop rbp(1/3).

I think he's a master of joke.
Post 29 Jun 2015, 16:58
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
revolution wrote:
typedef wrote:
What's not wrong with "leave"?
It is only one byte when assembled. And easier to type than equivalent alternatives.
Either you memorized that or you have the whole instruction set manual engraved in your eyelids.

Either way, it still doesn't take away the fact that you are an asexual reptilian. Very Happy
Post 29 Jun 2015, 17:06
View user's profile Send private message Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
fasmnewbie, I don't doubt the competence of the people who do not open their mouths in this forum. My complaint is this: What has that got with YOU?

I've made an assembler myself btw, I stopped because of the boredom. All that you ever do encoding instructions is to walk in circles, like a duck. It teach you nothing.
Post 29 Jun 2015, 17:44
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
What's the name of your assembler sir?
Post 29 Jun 2015, 17:50
View user's profile Send private message Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
It's far from finished and far from having a name. But I have a very vivid imagination, and I think I could design one of the best assemblers if I put myself to it. I understand people, and what people want in the coding world. That is what is important. But I will never make a new attempt or continue with it. Simply because I don't want to step through the same mistakes as the other people.

The common mistake is that everyone who is into assembler sooner or later gets an idea of creating their own assembler, instead of creating the programs they really want to create and I've decided I want to spend my time creating the "dream" programs I want to create, rather than creating an assembler, which is going to take all the time of your life, neverending.

It's the programs I want to focus on.
Post 29 Jun 2015, 19:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.