The MASM Forum

Projects => Rarely Used Projects => RosAsm => Topic started by: costycnc on November 13, 2014, 08:00:46 AM

Title: Bug Easycode struct problem BITMAPFILEHEADER
Post by: costycnc on November 13, 2014, 08:00:46 AM
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 !





Title: Re: Bug Easycode struct problem BITMAPFILEHEADER
Post by: guga on August 07, 2015, 12:55:11 PM
Hi costycnc

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

It is not for rosasm.
Title: Re: Bug Easycode struct problem BITMAPFILEHEADER
Post by: rsala on August 07, 2015, 04:23:39 PM
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.
Title: Re: Bug Easycode struct problem BITMAPFILEHEADER
Post by: dedndave on August 07, 2015, 07:32:42 PM
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
Title: Re: Bug Easycode struct problem BITMAPFILEHEADER
Post by: TouEnMasm on August 08, 2015, 02:29:11 AM
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