flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Macroinstructions > macros with reverse order

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 208
Location: film "CandyMan" directed through Bernard Rose
macros with reverse order
I found on the Internet these macros:

Code:

;global.inc

;------------------------------------------------------------------
; use "iglobal" for inserting initialized global data definitions.
;------------------------------------------------------------------
macro iglobal {
  IGlobals equ IGlobals,
  macro __IGlobalBlock { }

macro iglobal_nested {
  IGlobals equ IGlobals,
  macro __IGlobalBlock \{ }

;-------------------------------------------------------------
; use 'uglobal' for inserting uninitialized global definitions.
; even when you define some data values, these variables
; will be stored as uninitialized data.
;-------------------------------------------------------------
macro uglobal {
  UGlobals equ UGlobals,
  macro __UGlobalBlock { }

macro uglobal_nested {
  UGlobals equ UGlobals,
  macro __UGlobalBlock \{ }

endg fix }              ; Use endg for ending iglobal and uglobal blocks.
endg_nested fix \}

macro IncludeIGlobals{
  macro IGlobals dummy,[n] \{ __IGlobalBlock
     purge __IGlobalBlock  \}
  match IIGlobals \{ I \} }

macro IncludeUGlobals{
  macro UGlobals dummy,[n] \{
    \common
      \local beginsize
      begin = $
      virtual at $
    \forward
      __UGlobalBlock
      purge __UGlobalBlock
    \common
      size = $ - begin
    end virtual
    rb size
  \}
  match UUGlobals \{ U \} }

macro IncludeAllGlobals {
  IncludeIGlobals
  IncludeUGlobals       ;will be zeroed
}

iglobal
endg

uglobal
endg




How to use it:

Code:

include "global.inc"

;block 1
iglobal
db 1
endg

;block 2
iglobal
db 2
endg

;block 3
iglobal
db 3
endg

IncludeAllGlobals



Blocks 1..3 are put in reverse order. I would like to forge macros so that they are in the correct order. How to do it?

_________________
smaller is better
Post 18 Sep 2016, 19:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14673
Location: Origae-6
I haven't examined the code above, but I can suggest an alternative that is more efficient.

https://board.flatassembler.net/topic.php?t=12012

And the specific post that shows both forward and reverse outputs.

https://board.flatassembler.net/topic.php?p=175908#175908
Post 19 Sep 2016, 02:25
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 208
Location: film "CandyMan" directed through Bernard Rose
Your post was of help very much. I am thanking you a lot.

_________________
smaller is better
Post 19 Sep 2016, 10:15
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14673
Location: Origae-6
You're welcome CandyMan. Smile
Post 19 Sep 2016, 10:27
View user's profile Send private message Visit poster's website 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.