flat assembler
Message board for the users of flat assembler.

Index > Main > Accessing different datasizes with ease

Author
Thread Post new topic Reply to topic
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
I've ran across a problem lately and insted of whining here I propose an solution to this:
Code:
;You need to have some bytes defined
mydata db 3,1,4,1,5,9,2,6,5 ;etc.

;But the data is something raw and you don't need the bytes separately
;i.e. finding averages or summing up can be done up to 16 bytes at a time
;You need to cast DWORD or QWORD everytime you need to access [mydata]
mov eax,dword[mydata+4]
movq qword[mydata+0],mm5

;This won't do much harm if you have few, but in longer code, this comes
;efficient:
access_data_dword rd 0 ;This is like putting a label, but with a cast
access_data_word rw 0
mydata db 1,2,3,4,5,6,7,8,9,10,11,12 ;etc.
    


Any other suggestions welcome. After testing I just found this to be easy and logical.

_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 18 Jan 2006, 12:45
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
maybe this is what you want:
Code:
label mydata_dq qword
label mydata_dd dword
mydata db 1,2,3,4,...
...
mov al,[mydata]
mov eax,[mydata_dd]
movq mm0,[mydata_dq]    
Post 18 Jan 2006, 13:01
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
Thanks Very Happy
I tried hopelessly:
Code:
mydata_dq qword:
;and...
qword mydata_dq
    


label mylabel cast Wink That's it!
Post 18 Jan 2006, 18:09
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7796
Location: Kraków, Poland
Tomasz Grysztar
The noble TASM's syntax. Wink
Post 18 Jan 2006, 19:01
View user's profile Send private message Visit poster's website Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
since i starting using pushd with fasm and liked the feel i just made alot of macros to skip casting like "movb, movw, movd" etc

_________________
redghost.ca
Post 19 Jan 2006, 05:09
View user's profile Send private message AIM Address MSN Messenger 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.