flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > enum directive for fasmg

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 17 Jan 2018, 21:19
Code:
macro ENUM? name
  local enumitems
  enumitems equ
  macro end?.enum?!
    purge ?, end?.enum?
  end macro
  macro ?! line&
    match =end? =enum?, line
      match items, enumitems
        label name
        irp item, items
          .#item := % - 1
        end irp
      end match
      line
    else
      enumitems equ enumitems line
    end match
  end macro
end macro
    


Usage example:

Code:
enum COLORS
  Black, Blue, Green, \
  Aqua, Red,
  Purple,
  Yellow,
  White
end enum

db COLORS.White
    
Post 17 Jan 2018, 21:19
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.