| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
64tass: hex to string into source, how?
I i use
number = $1000
.text ^number
result is:
$34, $30, $39, $36
How to do the same but with result
$31, $30, $30, $30? |
|
... 10 posts hidden. Click here to view all posts.... |
| |
Conrad
Registered: Nov 2006 Posts: 849 |
^number only prints the result out in decimal, according to the manual.
As for larger numbers than 32-bit, 64Tass is only available on 32-bit OSs. A 64-bit compiled version would probably work. For now, you'll just have to use two 32-bit variables for bigger hex strings. |
| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
Quoting Conrad^number only prints the result out in decimal, according to the manual.
As for larger numbers than 32-bit, 64Tass is only available on 32-bit OSs. A 64-bit compiled version would probably work. For now, you'll just have to use two 32-bit variables for bigger hex strings.
I'm using a -self compiled- version of 64Tass on OpenSuse 12.1 64bit, but seems that only 32bit numbers can be used...
In makefile
#CFLAGS = -O2 -march=i486 -mcpu=i486 -pipe
#CFLAGS = -Wall -O3 -march=i686 -pipe -fomit-frame-pointer -fno-exceptions
#CFLAGS = -Wall
... |
| |
soci
Registered: Sep 2003 Posts: 480 |
I know that digging up old threads is not nice, but anyway just to close it up properly.
Use string formatting with hexadecimal output in some recent version:
.text "%04x" % (mylabel,)
And as of 1.51 I would not worry about running out of bits in integers on any platform. |
| |
Flavioweb
Registered: Nov 2011 Posts: 463 |
Quote: I know that digging up old threads is not nice, but anyway just to close it up properly.
Use string formatting with hexadecimal output in some recent version:
.text "%04x" % (mylabel,)
And as of 1.51 I would not worry about running out of bits in integers on any platform.
Just in these days i had this problem again using 1.5 (not 1.51!) and i solved using
.TEXT REPR (VALUE)
with
value=1234
.text "%04x" % (value,)
the compiler give a "type mismatch" error, that isn't if i use
.text "%04x" % (1234,)
instead.
Maybe it's fixed in 1.51...
=) |
| |
soci
Registered: Sep 2003 Posts: 480 |
Yes it didn't resolve identifiers in the formatting argument tuple in some versions of 1.50. This was so since tuples could contain identifiers and not just values.
When I noticed it the modifications for 1.51 were ongoing but it was unusable yet. So I worked it around it in my sources with dummy calculations like '(label+0, text.."")'.
Fixing it in 1.50 would have been a sort of a hack, but it's fixed now in 1.51 in a clean way now. |
| |
soci
Registered: Sep 2003 Posts: 480 |
Quote: I know that digging up old threads is not nice, but anyway just to close it up properly.
Use string formatting with hexadecimal output in some recent version:
.text "%04x" % (mylabel,)
And as of 1.51 I would not worry about running out of bits in integers on any platform.
I don't really like to dig up old threads, but anyway it's necessary for historical reasons.
Since then I realized that this percent formatting syntax was not really good idea as it's too easy to confuse with a normal modulo, especially when variables are used.
So it's gone now in r668. Instead formatting is done using a function with variable number of arguments:
.text format("%04x", mylabel)
If for whatever reason the arguments were contained in variable then the conversion looks like this:
.text format("%d: %s", *somelist)
I hope I don't have to update this thread again anytime soon. But one can never know, it's in development after all... |
Previous - 1 | 2 - Next |