flat assembler
Message board for the users of flat assembler.

Index > Main > How to define a 128 bit variable?

Author
Thread Post new topic Reply to topic
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight 02 Oct 2007, 10:30
i was justwondering how to define a 128 bit var. i know 8 bit is db and 32 bit is dd and 80 bit is dt but how do i define 128 bits?
Post 02 Oct 2007, 10:30
View user's profile Send private message Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1 02 Oct 2007, 13:04
do any of following:
Code:
var128bit db 16 dup 0

var128bit dw 8 dup 0

var128bit dd 4 dup 0

var128bit dq 2 dup 0
    

_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 02 Oct 2007, 13:04
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 138
SFeLi 02 Oct 2007, 14:32
Code:
        label   var dqword
        rb      16
    
Post 02 Oct 2007, 14:32
View user's profile Send private message Reply with quote
Xorpd!



Joined: 21 Dec 2006
Posts: 161
Xorpd! 02 Oct 2007, 15:01
Quote:


Code:

label var dqword
rb 16

Good one, but what if you want to write an initial value? This is not just a problem with FASM, but also with Intel's documentation. In 25366721.pdf sometimes a 128-bit quantity is written as subquantities, high subquantity leftmost, i.e. mixed big- and little-endian. Other times it is written as one 128-bit quantity, and other times it is left to the reader to guess which half goes where (as with palignr).

If the user wants to initialize 'var' to two qwords, the low qword would have to come first, backwards compared to what would be the norm in Intel's documentation. It would be neat if there were a way to make this less error-prone for the FASM user.
Post 02 Oct 2007, 15:01
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4324
Location: Now
edfed 02 Oct 2007, 23:49
128 bit is too much
16 bytes
2^128
very hudge
i don't see the utility
simply define a qword and an other just after

the idea of SFeLi is very good
you can build a macro

or asimply ask to tomasz to implement hbyte data type
Post 02 Oct 2007, 23:49
View user's profile Send private message Visit poster's website Reply with quote
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight 03 Oct 2007, 16:46
The reason i asked is because i'm working with very large prime numbers and their multipuls/powers. and was hoping to use 128 but definitions. (without having to spend hours breaking the number into binary.

Tomasz Grysztar could you please implement a data type for this purpose.
maybe a dqword or something?
Post 03 Oct 2007, 16:46
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 503
Location: Czech republic, Slovak republic
Feryno 04 Oct 2007, 08:24
microsoft uses "octaword" (or shortened form "oword") for 128-bit variable
so perhaps feature FASM syntax:
var128bit_initialized do 123456789ABCDEF00FEDCBA987654321h
var128bit_uninitialized do ?
var128bit_uninitialized ro 1
Post 04 Oct 2007, 08:24
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 04 Oct 2007, 15:06
Guys, remember that fasm internally does works with 64-bit integers. By adding such features fasm internals should be improved first (or accept constants only for "do" while in "dq" you can do "label dq 2+4+assembly_time_variable*9/2").
Post 04 Oct 2007, 15:06
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4324
Location: Now
edfed 05 Oct 2007, 20:52
macro or implementation

the manner to build the 128bit value is not important
the goal is to have this value type

i think hbyte is a good name

cause hexa byte
very impressive!!! Wink

like goldorack or demolition man

and then RH and DH
and it cannot be a problem with Dh register because you never write
label dh x
or
dh x

so no syntax error
but a little of confussion for beginners

YEAH
Post 05 Oct 2007, 20:52
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 28 Oct 2007, 01:09
those are usually called "dqword" (native fasm size) or "oword" (my preference).

but as LocoDelAssembly wrote, fasm works only on 64bit constants internally.

Sure, you can build a macro that defines 16bytes by defining multiple bytes/words/dwords or qwords. That's quiet easy if the arguments of the macro are supposed to be in hexadecimal.

if you want the 16bytes to be defined in decimal, than you'll need a macro that does both number base converting and argument parsing, which is not trivial.
Post 28 Oct 2007, 01:09
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.