flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Distinguish between 8, 16, and 32 bit registers |
Author |
|
bitRAKE 13 Jul 2021, 04:37
Code: macro type A { if A eqtype al virtual mov A,0 i = 0 while 1 load C byte from $ - i - 1 if C <> 0 break end if i = i + 1 end while end virtual if i = 1 display "8-bit",13,10 else if i = 2 display "16-bit",13,10 else if i = 4 display "32-bit",13,10 end if end if } _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
13 Jul 2021, 04:37 |
|
revolution 13 Jul 2021, 07:59
Perhaps it is more typing, but it is also more explicit, so I think I would be more inclined to use in.
Code: use64 if A in <al,bl,cl,dl,sil,dil,r8b,...> display '8-bit',13,10 else if A in <ax,bx,cx,...> ... end if |
|||
13 Jul 2021, 07:59 |
|
bitRAKE 13 Jul 2021, 12:08
In the 64-bit case it is more correct to use in.
(fasmg no have in, but there are other tricks.) _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
13 Jul 2021, 12:08 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.