flat assembler
Message board for the users of flat assembler.
Index
> Main > What's the calling convention used in fasm source? |
Author |
|
acel 02 Oct 2012, 16:21
There are many procedure calls which accept varies parameters, is there a unified calling convention in fasm source?
|
|||
02 Oct 2012, 16:21 |
|
acel 03 Oct 2012, 04:08
Thanks, uart777. I am reading the fasm source code, so I am wondering that whether there are some calling convention in assembler itself which could increase its readability.
|
|||
03 Oct 2012, 04:08 |
|
JohnFound 03 Oct 2012, 05:37
FASM itself uses register parameter passing to the subroutines.
|
|||
03 Oct 2012, 05:37 |
|
uart777 03 Oct 2012, 06:28
acel: Most readable "calling convention" is this LOL.
Code: f: ; ... ret call f Last edited by uart777 on 17 Nov 2013, 00:51; edited 1 time in total |
|||
03 Oct 2012, 06:28 |
|
revolution 03 Oct 2012, 10:03
Be careful when you mention fastcall because it is a defined standard calling convention that is not followed by fasm internally.
|
|||
03 Oct 2012, 10:03 |
|
acel 03 Oct 2012, 10:45
Thanks for you replies. Sounds like fasm used registers to pass parameters, is fixed set and order of registers been used? Such as eax for the first parameter, and ebx for the second one.
|
|||
03 Oct 2012, 10:45 |
|
Tomasz Grysztar 03 Oct 2012, 10:58
Does there really need to be a order of parameters? It is a concept of many modern languages and perhaps programmers got so used to it that it may sound as a very bizarre concept when one states that parameters don't have to be ordered in any way... Though there are still some languages (like Python) which at least allow to alternatively use "named parameters" syntax, and there too the order doesn't matter.
Back in the DOS days, when most of the API you used were BIOS and DOS interrupts calls, it was nothing strange for an assembly programmer that different kinds of parameters simply had an "usual" place through which they were passed. For example, DOS interrupt usually expected pointer to some data passed through DS:DX, while a file handle would be passed in BX. Close file function requires a file handle, but doesn't need any data? Use only BX to pass the handle. Write string expects buffer with data, but nothing else? Pass pointer to data in DS:DX as usual. The concept of "first" or "second" parameter is not really applicable here. |
|||
03 Oct 2012, 10:58 |
|
shutdownall 03 Oct 2012, 11:05
I don't understand the approach. Every communication regardless between computer or persons (humans) follow a (public or private) convention. If you trained a dog to bring the newspaper, you can not just simply tell him you want the sausage instead when you did not train with him before.
|
|||
03 Oct 2012, 11:05 |
|
revolution 03 Oct 2012, 11:26
acel wrote: Sounds like fasm used registers to pass parameters, is fixed set and order of registers been used? Such as eax for the first parameter, and ebx for the second one. edit: I see Tomasz has already explained that. |
|||
03 Oct 2012, 11:26 |
|
uart777 03 Oct 2012, 22:04
revolution: Quote from Wikipedia: "Conventions entitled fastcall have not been standardized, and have been implemented differently, depending on the compiler vendor. Typically fastcall calling conventions pass one or more arguments in registers which reduces the number of memory accesses required for the call".
Please forgive me for being an innovative thinker. I apologize for being a real programmer who actually makes programs instead of a fool who prides themselves in knowing how but has absolutely nothing to show in their lifetime. |
|||
03 Oct 2012, 22:04 |
|
uart777 04 Oct 2012, 08:42
Sorry
Last edited by uart777 on 04 Oct 2012, 18:37; edited 1 time in total |
|||
04 Oct 2012, 08:42 |
|
revolution 04 Oct 2012, 08:43
uart777 wrote: revolution: Primitive minded fool 10,000+ comments and not one single useful program to show. |
|||
04 Oct 2012, 08:43 |
|
nop 04 Oct 2012, 17:01
revolution wrote: Yep. I'm just posting nonsense constantly. |
|||
04 Oct 2012, 17:01 |
|
MazeGen 04 Oct 2012, 17:43
uart777, nop, you're nobody comparing to revolution's contributions to this board so shut up. revolution should delete your offtopic posts.
|
|||
04 Oct 2012, 17:43 |
|
yoshimitsu 04 Oct 2012, 19:00
Tomasz, so what are your criteria for parameters, like what kind of parameter do you place in which register? I'd like to know more about your coding style because it looks so professional and oldschool
btw. did you ever actually publish an article about coding style? I'd love to read it, hehe |
|||
04 Oct 2012, 19:00 |
|
nop 04 Oct 2012, 19:27
MazeGen wrote: uart777, nop, you're nobody comparing to revolution's contributions to this board so shut up. revolution should delete your offtopic posts. about parameter passing in registers intel have designed the x86 instuction set with some default ideas in mind like ecx for count values ebx for base data pointer eax for general or alu data edx for general data address ebp for base stack pointer esi and edi for index addreses and so on Last edited by nop on 04 Oct 2012, 19:37; edited 1 time in total |
|||
04 Oct 2012, 19:27 |
|
uart777 04 Oct 2012, 19:30
MazeGen: Sorry for being off-topic and offensive but it seems that I get critisized for no reason other than jealousy. revolution claimed that "fastcall" is a defined standard and I merely responded. You let "typedef" get by with murder - he comes here and annoys, disrespects, curses, etc - but I can't defend myself and prove that my position is logical?
Nothing compared to revolution? Behold, the best art/image application ever created in ASM in the history of mankind: http://s1291.photobucket.com/albums/b546/uart777/Programming/?action=view¤t=IMAGEEDITOR_zps10525b1d.jpg 100% pure custom controls/interface using only 386 instructions. Only 23K .EXE. I intended to contribute this source code to help programmers make art programs in ASM. Maybe I shouldn't |
|||
04 Oct 2012, 19:30 |
|
nop 04 Oct 2012, 19:55
uart777 your image editor looks awsome only 23k is amazing i would love to see your source
|
|||
04 Oct 2012, 19:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.