flat assembler
Message board for the users of flat assembler.
Index
> Main > Integer to string |
Author |
|
revolution 03 Aug 2018, 19:08
Here is a macro to display integer values. You can convert it to embed integer values by changing all display to db and make it a struc instead of macro to allocate the string to a label name.
Code: macro display_decimal value { local leading_zero,digit,divisor,number number=value if number=1 shl 63 display '-9223372036854775808' else if number<0 number=-number display '-' end if leading_zero=0 divisor=1000000000000000000 while divisor>0 digit=number/divisor leading_zero=leading_zero+digit if leading_zero | (divisor=1) display digit+'0' number=number-digit*divisor end if divisor=divisor/10 end while end if } macro display_unsigned value { local number number=value if number<0 number=number-10000000000000000000 if number<0 number=number+1000000000000000000 display '9' else display '1' end if end if display_decimal number } |
|||
03 Aug 2018, 19:08 |
|
Jin X 03 Aug 2018, 19:28
So, there's no special directive...
|
|||
03 Aug 2018, 19:28 |
|
revolution 03 Aug 2018, 19:33
Not in fasm.
|
|||
03 Aug 2018, 19:33 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.