flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > suggestion: Allow emit (dbx) with zero-length values

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 01 Apr 2017, 22:47
A small suggestion to allow fasmg dbx 0: x.

Standard data type directives like db, dd, etc. allow zero-length values in form db 0 dup x, so I believe dbx should allow this also for consistency and convenience.

I applied this fix to my copy of fasmg, but I thought it's worth suggesting to include in official release.

For example, I found it handy in instruction set macros, when instead of
Code:
if imm_size = 2
  dw imm_value
else if imm_size = 4
  dd imm_value
end if
    

one can simply do
Code:
emit imm_size: imm_value
    
Post 01 Apr 2017, 22:47
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 02 Apr 2017, 07:48
This parameter is not the length of value, but the size of data unit. You can use zero-length values with DBX just like with any other data directive:
Code:
dbx 4: 0 dup ?  ; same as dd 0 dup ?
dbx 1: ''       ; same as db ''    
Post 02 Apr 2017, 07:48
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


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

Website powered by rwasa.