flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > Put a global block anywhere

Author
Thread Post new topic Reply to topic
zann



Joined: 12 Oct 2006
Posts: 4
I've been using this globals macro for a while.

Its the struct macro copied and simplified since it only has to produce one unnamed instance and doesn't support unions and substructs.

How to use:

Anywhere before the data section, as often as you need, call for example
Code:
globals             
   globalCount dd 0               
   mousePos POINT 12,12
   Flags dd ?                  
   label gcb byte at Flags            ;label here is actually a macro to insert a label 
   ReferenceValues dd  1,2,4,8,16  
   align 8                             ;macro to insert an align statement
   @i Handle,ThreadID=-1           ;define several integers with dq if _longmode equ 1
                                         ;or dd if _longmode equ 0
   @text DefaultFontFace,32,"Times"    ;defines text with du if _unicode equ 1 
                                                    ;db if _unicode equ 0, Number is count, not bytes
   Prefs flags ReadOnly,CaseSensitive     ;Prefs becomes a dword field, Prefs.ReadOnly and 
                                                      ;Prefs.CaseSensitive are constant bit flags.
endg
    


IMPORTANT: in the data section, call write@globals.


Description:
Download
Filename: Globals.inc
Filesize: 7.52 KB
Downloaded: 128 Time(s)

Post 17 Nov 2012, 09:17
View user's profile Send private message Reply with quote
zann



Joined: 12 Oct 2006
Posts: 4
Whoops: I left a @dbug instruction towards the end of the Globals.inc file. This is a macro used to reflect macro code output to the display. Then define:
@dbug fix
and it will do nothing.

Code:
macro _showline [sc]
{forward
  match any,sc \{
     irps sci, \any
      \\{ display \\`\\sci 
         display " " \\}
  \} 
 common
  display 13 
 }

macro @dbug [stuff]
{common 
  _showline stuff
  stuff }
    
Post 17 Nov 2012, 10:22
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
Check FreshLib globals.inc library. IMO, in this moment, this is the most advanced library for work with data definitions.
Post 17 Nov 2012, 11:17
View user's profile Send private message Visit poster's website ICQ Number 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-2019, Tomasz Grysztar.

Powered by rwasa.