flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > DO 1,0,1,1 ; Define One bit |
Author |
|
revolution 20 Jan 2010, 02:21
Code: macro defineBitMap [bit] { common local .bit,.byte .bit=1 .byte=0 forward if bit <> 0 .byte=.byte+.bit end if .bit=.bit+.bit if .bit>255 db .byte .byte=0 .bit=1 end if common if .bit>1 db .byte end if } |
|||
20 Jan 2010, 02:21 |
|
edfed 20 Jan 2010, 03:06
it's ok, cool, tanks a lot revolution.
da ,Define A(1) bit or maybe,... bit? bit 0,1,0,0,1,1,0,0 it works with this: Code: da 0,0,1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,1,1,1 dd 111000101010101111000011001100b it generates two identical dwords. |
|||
20 Jan 2010, 03:06 |
|
hopcode 21 Jan 2010, 06:17
cool, but imho should be considered endianess,it is to say, the WYSIWYG factor, that simplify readability, it is to say the packing method db/dw/dd
I have written different of these bit packers. one is here http://board.flatassembler.net/topic.php?t=9905 but not really improved as my new ones, that i cannot find at the moment using reverse instead of forward is more WYSIWYG but not dd/dw packed Code: macro defineBitMap [bit] { common local .bit,.byte .bit=1 .byte=0 reverse if bit <> 0 .byte=.byte+.bit end if .bit=.bit+.bit if .bit>255 db .byte .byte=0 .bit=1 end if common if .bit>1 db .byte end if } |
|||
21 Jan 2010, 06:17 |
|
Borsuc 21 Jan 2010, 21:03
Pretty clever mask-handling revolution, but the name '.bit' is confusing seeing as the parameter is already called 'bit'... maybe '.mask' or '.pos' or '.index' or something would have been more clear at first sight (took me a while to figure it out).
_________________ Previously known as The_Grey_Beast |
|||
21 Jan 2010, 21:03 |
|
edfed 12 Mar 2010, 17:10
it works, and i am happy!
edfed! |
|||
12 Mar 2010, 17:10 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.