flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Trojany 01 Jun 2010, 21:31
hi,
1.: depends on which format you want to you produce with your assembly: for example if you want to make PE files linking to the WinAPI, you can use the default include files: Code: include 'win32wx.inc' main: invoke MessageBox, 0, 'Message', 'Caption', 0 invoke ExitProcess, 0 .end main 2.: you could define a local label like ".isAPI" when modifying the import macro. this label could be checked from other macros. for 3. I don't know - although I bet it could be done by preprocessing as well EDIT: This is some example code for what I said about number 2: Code: include 'win32wx.inc' macro myimp library, [name, string] { name#.isAPI = 1 } macro import library, [functions] { common import library, functions myimp library, functions } main: invoke MessageBox, 0, 'Message', 'Caption', 0 invoke ExitProcess, 0 .end main if defined MessageBoxW.isAPI display 'MessageBoxW is API!', 10 else display 'MessageBoxW is not API!', 10 end if if defined main.isAPI display 'main is API!', 10 else display 'main is not API!', 10 end if |
|||
![]() |
|
baldr 02 Jun 2010, 06:00
flat_user wrote: …since FASM isn't a linker… flat_user wrote: 3. Would it be possible to enable parsing 'mov [byte eax],10h' instead of/additional to 'mov byte [eax],10h?
|
|||
![]() |
|
revolution 02 Jun 2010, 06:28
baldr wrote: What will be the purpose of such illogical syntax? ![]() |
|||
![]() |
|
flat_user 02 Jun 2010, 13:37
Actually it's TASM, also read FASM's design principles
I don't think it's illogical as it means 'take a byte from this address' FASM's syntax actually is taken from TASM with the little change that the size modifier is written outside of the brackets. Also FASM is capable of parsing MASM's syntax which is 'mov byte ptr eax,10h', so I guess you'd say it already is a MASM clone? |
|||
![]() |
|
revolution 02 Jun 2010, 13:58
Hmm, let's see.
byte eax ----> al (since al would be the byte truncation of eax) [byte eax] ----> [al] (but we still don't know the size of data to read from address at al) Yep, makes perfect sense to me. Not! ![]() |
|||
![]() |
|
flat_user 02 Jun 2010, 14:24
Kind of childish, but if you're enjoying such a discussion...
Also if you want to cast something (like byte eax == al), better stick to C++ |
|||
![]() |
|
baldr 02 Jun 2010, 16:49
flat_user,
mov byte ptr word 0, 0 and mov byte ptr dword 0, 0 have sense, mov byte ptr byte eax, 0 doesn't. Type qualifier outside square brackets tells the size of operand, inside — size of address. No matter where FASM get this from. If you don't want to troll, show your arguments. |
|||
![]() |
|
LocoDelAssembly 02 Jun 2010, 17:49
Just for reference sake:
Code: format pe gui 4.0 mov byte ptr word 0, 0 mov byte ptr 0, 0 mov byte ptr dword 0, 0 mov byte ptr eax, 0 nop nop nop mov byte [word 0], 0 mov byte [0], 0 mov byte [dword 0], 0 mov byte [eax], 0 Code: .flat:00401000 start: .flat:00401000 mov [byte ptr ds:0], 0 .flat:00401006 mov [large byte ptr ds:0], 0 .flat:0040100D mov [large byte ptr ds:0], 0 .flat:00401014 mov [byte ptr eax], 0 .flat:00401017 nop .flat:00401018 nop .flat:00401019 nop .flat:0040101A mov [byte ptr ds:0], 0 .flat:00401020 mov [large byte ptr ds:0], 0 .flat:00401027 mov [large byte ptr ds:0], 0 .flat:0040102E mov [byte ptr eax], 0 |
|||
![]() |
|
flat_user 02 Jun 2010, 20:15
baldr,
I didn't know FASM would let one specify the size of absolute addresses to adjust the opcode. Hence I wasn't arguing from the same point of view as I thought FASM wouldn't interpret such syntax at all. So I was just asking if one could use macros to enable such syntax as TASM uses it. But as said I didn't know that this syntax is already used for something different in FASM, so that you're pointing out this syntax would interfere with others and thus would be illogical. |
|||
![]() |
|
mindcooler 02 Jun 2010, 22:19
I have seen the MASM address mode syntax, and I find it outright wrong.
|
|||
![]() |
|
baldr 03 Jun 2010, 05:19
flat_user,
OK, I've understood your point. Almost everything about FASM is in the manual: this is explained in 1.2.6 Size settings subchapter. |
|||
![]() |
|
revolution 03 Jun 2010, 07:31
In MASM you specify the address size in a different place, in a segment block I think. And there is no way to then specify the address size at the individual instruction. Thus the data size is the only possible specifier at the instruction level and things like [byte address] became common (and ugly to say the least).
In fasm we can specify both the address and data sizes separately. mov data_size[address_size address],value becomes possible. So things like [byte address] make no sense at all since you can't address memory with a byte sized address. |
|||
![]() |
|
revolution 03 Jun 2010, 07:38
flat_user wrote: FASM's syntax actually is taken from TASM with the little change that the size modifier is written outside of the brackets. flat_user wrote: Also FASM is capable of parsing MASM's syntax which is 'mov byte ptr eax,10h', so I guess you'd say it already is a MASM clone? |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.