flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > how to realize this ideas?..

Author
Thread Post new topic Reply to topic
KIRK



Joined: 05 Dec 2007
Posts: 20
Location: Russia
KIRK 05 Dec 2007, 08:47
idea #1:

instead
Code:
section '.idata' import data readable writeable

   library kernel,'KERNEL32.DLL',\
           user,'USER32.DLL'

  import kernel,\
     GetModuleHandle,'GetModuleHandleA',\
     ExitProcess,'ExitProcess'

  import user,\
     DialogBoxParam,'DialogBoxParamA',\
     CheckRadioButton,'CheckRadioButton',\
     GetDlgItemText,'GetDlgItemTextA',\
     IsDlgButtonChecked,'IsDlgButtonChecked',\
     MessageBox,'MessageBoxA',\
     EndDialog,'EndDialog'
    

i wish to write
Code:
section '.idata' import data readable writeable
   kernel32.dll GetModuleHandleA GetModuleHandle,ExitProcess
   user32.dll DialogBoxParamA DialogBoxParam,GetDlgItemTextA GetDlgItemText,IsDlgButtonChecked,MessageBoxA MessageBox,EndDialog
    


syntax:
Code:
section '.idata' import data readable writeable
  any_dll_file_name.dll Function1 [Function1Alias1] [Function1Alias2], Function2 [Function2Alias1] [Function2Alias2]...
  dll 'any dll file name.AndExtention' Function1 [Function1Alias1] [Function1Alias2]..., Function2 [Function2Alias1] [Function2Alias2]...
    



idea #2:

instead
Code:
include 'win32ax.inc'
.code
   start:
   invoke MessageBox,HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK
   invoke ExitProcess,0
.end start
    

i wish to write
Code:
include 'win32ax.inc'
smartcode
.code
   start:
   MessageBox HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK
   ExitProcess 0
.end start
    



idea #3
Code:
;... any code ...
@: ;label 0
;... any code ...
@@: ;label 1
;... any code ...
jmp @b-1 ;jumps to label 0
jmp @b0 ;jumps to label 1
jmp @b ;jumps to label 1 too
jmp @b1 ;jumps to label 2
jmp @f0 ;jumps to label 5
jmp @f ;jumps to label 5 too
jmp @f-1 ;jumps to label 4
jmp @f-2 ;jumps to label 3
;... any code ...
@: ;label 2
;... any code ...
@: ;label 3
;... any code ...
@: ;label 4
;... any code ...
@@: ;label 5
    
Post 05 Dec 2007, 08:47
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 05 Dec 2007, 09:06
simply by coding in a real high level language. Wink i'm joking!

if the problem is the number of word to write, then ctrl+c and ctrl+v will act as you need.

for the problem of @@:
it will be unreadable to have so many crossing @@: and jmp @fx

there is also topic about a macro to make @@: and @@@:
look at this! Arrow
Post 05 Dec 2007, 09:06
View user's profile Send private message Visit poster's website Reply with quote
KIRK



Joined: 05 Dec 2007
Posts: 20
Location: Russia
KIRK 05 Dec 2007, 09:24
edfed wrote:
simply by coding in a real high level language. Wink i'm joking!

if the problem is the number of word to write, then ctrl+c and ctrl+v will act as you need.

for the problem of @@:
it will be unreadable to have so many crossing @@: and jmp @fx

there is also topic about a macro to make @@: and @@@:
look at this! Arrow

problem is not to write, problem is to view big and littered code
about @@ - if you think, you will not get confused
named labels confuse more strongly...
@@@ is far from necessary for me Sad


Last edited by KIRK on 05 Dec 2007, 09:26; edited 1 time in total
Post 05 Dec 2007, 09:24
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 05 Dec 2007, 09:24
1.i'm using this tool and do not ever look at import section.
2.
it seems
Code:
   start: 
   MessageBox HWND_DESKTOP,..    
already was relized
with this way we can approach to usage of "goto" instead of "jmp" Wink
Post 05 Dec 2007, 09:24
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 05 Dec 2007, 10:01
KIRK,

Ad. your idea #2:
you could use FASM fix directive to resolve this problem:
Code:
MessageBox fix invoke MessageBox,

ExitProcess fix invoke ExitProcess,

; and so on for all procedures, which you want to use... 
    
Here you have improved code of 'HELLO.ASM' example (I use 'fasminc' environment variable to inform compiler about path to the 'FASM\INCLUDE' directory):
Code:
; example of simplified Win32 programming using complex macro features

include '%fasminc%\win32ax.inc'

MessageBox fix invoke MessageBox,

ExitProcess fix invoke ExitProcess,

.code

  start:
        ;invoke  MessageBox,HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK
        MessageBox  HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK

        ;invoke  ExitProcess,0
        ExitProcess 0

.end start
    
Post 05 Dec 2007, 10:01
View user's profile Send private message Visit poster's website Reply with quote
daluca



Joined: 05 Nov 2005
Posts: 86
daluca 12 Dec 2007, 07:51
I posted some macros that are related to some of your ideas:


http://board.flatassembler.net/topic.php?t=7379
Post 12 Dec 2007, 07:51
View user's profile Send private message Reply with quote
KIRK



Joined: 05 Dec 2007
Posts: 20
Location: Russia
KIRK 13 Dec 2007, 09:46
daluca wrote:
I posted some macros that are related to some of your ideas:


http://board.flatassembler.net/topic.php?t=7379

yes, I see this...
but invoke is better than <>
and nothing is better than invoke

2MHajduk: fixes takes a lot of place
Post 13 Dec 2007, 09:46
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 13 Dec 2007, 10:04
KIRK: both are possibe, but this way wastes too much memory.
Post 13 Dec 2007, 10:04
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
KIRK



Joined: 05 Dec 2007
Posts: 20
Location: Russia
KIRK 13 Dec 2007, 10:10
vid wrote:
KIRK: both are possibe, but this way wastes too much memory.

It happens with macroses, but can you rewrite source code of FASM?
Post 13 Dec 2007, 10:10
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 13 Dec 2007, 10:44
Why rewrite sources? this can be done easier with macros. rewriting FASM sources for this would be really stupid idea

Also, it's better to stick to standard, customizing everything isn't much helpful, especially with such silly differences as space vs. comma, etc.
Post 13 Dec 2007, 10:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
KIRK



Joined: 05 Dec 2007
Posts: 20
Location: Russia
KIRK 13 Dec 2007, 11:58
believe me, these are simple changes, but it very necessary.
and tell, that you can't do it.


Last edited by KIRK on 13 Dec 2007, 12:23; edited 1 time in total
Post 13 Dec 2007, 11:58
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 13 Dec 2007, 12:04
The problem why its an O(n) complexity is that what you have now is invoke and its parameters (n), but what you wish to do is implement all the (n) parameters as invokes so that it seems to relate more to an SQL query than some small assembly-written macro.

if you want to replace "invoke parmX" with "parmX" then its doable with macros, but the other way round you don't have the one and only token to hold on to.

Seems like a problem where you need to dig into some include files and 'match' / 'fix' your way through them...
Post 13 Dec 2007, 12:04
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 13 Dec 2007, 12:32
Quote:
believe me, these are simple changes, but it very necessary.
Nescessary for what? Can you give example where standard way wouldn't be enough?

Quote:
and tell, that you can't do it.

i can, but it is a complete waste of memory, unsystematic, messy, etc...
Post 13 Dec 2007, 12:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
KIRK



Joined: 05 Dec 2007
Posts: 20
Location: Russia
KIRK 13 Dec 2007, 20:48
Possibilities is same, but advantage in convenience of reading and writing code.
I am assured in it, since I know some programming languages and I well understand psychology.
Post 13 Dec 2007, 20:48
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.