flat assembler
Message board for the users of flat assembler.

Index > Main > Declare a bit

Author
Thread Post new topic Reply to topic
MUFOS



Joined: 17 Apr 2016
Posts: 47
MUFOS 18 Apr 2016, 22:00
Hello there, I was wondering how I could declare a bit in FASM.
Post 18 Apr 2016, 22:00
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 18 Apr 2016, 22:47
You can't. But you can declare a byte with "db" or reserve a byte with "rb". See the manual for exact usage.
Post 18 Apr 2016, 22:47
View user's profile Send private message Reply with quote
Trinitek



Joined: 06 Nov 2011
Posts: 257
Trinitek 19 Apr 2016, 01:05
Are you looking to declare a bitfield or just a single bit?
Post 19 Apr 2016, 01:05
View user's profile Send private message Reply with quote
MUFOS



Joined: 17 Apr 2016
Posts: 47
MUFOS 19 Apr 2016, 05:18
Trinitek wrote:
Are you looking to declare a bitfield or just a single bit?

Just a single bit.
Post 19 Apr 2016, 05:18
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 19 Apr 2016, 06:18
Since memory is only byte addressable, a single bit would have to be stored in a byte somewhere. Ergo you have to declare at least a byte. If you have multiple bits, you can use the same byte for at most 8 of them, but you must have a byte.

Or just keep it in a register or flag, but that gets a bit more complicated. If you keep it in a flag, you have to avoid intrusions which change that flag (hard to do). If you keep it in a register, you have to essentially dedicate that register to only holding a bit (or be really careful moving things into and out of the register, assuming those things have a predictable bit pattern that allows this to work), which would probably be a net negative to performance.
Post 19 Apr 2016, 06:18
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.