News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Bug Easycode struct problem BITMAPFILEHEADER

Started by costycnc, November 13, 2014, 08:00:46 AM

Previous topic - Next topic

costycnc

I see when create a structure first parameter  must be Dword for functioning....
If first parameter is declared word ... this parameter keep 4 octets and write 2 octets
Second parameter is written after 4 octets ... even if the first parameter is declared word

Example:



TEST Struct

Param1 DWord  ?
Param2 DWord  ?

TEST ENDS


Local pertest:TEST

mov pertest.Param1, "AA"
mov pertest.Param2, "BB"

Result of this struct  is : "A","A",0,0,"B","B"  and will be this ... "A","A","B","B"....  right?
Is bug?


Thanks !






guga

Hi costycnc

Not sure, if i understood. Which syntax is this?

It is not for rosasm.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

rsala

Hi costycnc,

That is probably because the alignment. Try this:

TEST Struct 2   <-- This makes the structure to be word aligned

Param1 Word  ?
Param2 Word  ?

TEST ENDS

Regards.
EC coder

dedndave

for one thing, when you enclose text in immediate data, the letters are reversed
for another thing, when you write a DWORD, but specify less than 4 letters, the upper bytes are 0's
    mov     dwValue,'ABCD'   ;writes 'DCBA'
    mov     dwValue,'AB'     ;writes 'BA',0,0, assuming dwValue is a DWORD


the original post is from last year   :biggrin:
it may not have gotten much attention, because we thought it had to do with EasyCode syntax - lol

TouEnMasm

Quote
I see when create a structure first parameter  must be Dword for functioning....
If first parameter is declared word ... this parameter keep 4 octets and write 2 octets
Second parameter is written after 4 octets ... even if the first parameter is declared word

WRONG !
The structure need to be align to work,that all.
Try to modify it is the badest way.
I search a little and give you the answer

Quote
;Include pshpack2.SDK
DEFALIGNMASM TEXTEQU  <WORD>

;ECHO   region Desktop Family
IF  WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

BITMAPFILEHEADER   STRUCT DEFALIGNMASM
   bfType WORD ?
   bfSize DWORD ?
   bfReserved1 WORD ?
   bfReserved2 WORD ?
   bfOffBits DWORD ?
BITMAPFILEHEADER      ENDS
correct syntax
Quote
BITMAPFILEHEADER   STRUCT WORD
   bfType WORD ?
   bfSize DWORD ?
   bfReserved1 WORD ?
   bfReserved2 WORD ?
   bfOffBits DWORD ?
BITMAPFILEHEADER      ENDS

Fa is a musical note to play with CL