News:

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

Main Menu

error A2071: initializer magnitude too large for specified size

Started by pgw001, March 25, 2014, 12:01:35 AM

Previous topic - Next topic

jj2007

Quote from: pgw001 on March 25, 2014, 09:49:19 AM
The line no identified (171) points to the - readrec  endp  statement

Now it gets mysterious - there is nothing wrong with that line.
On my PC, the attached source works fine with Masm 6.14, 6.15, 9.0, 10.0 and JWasm.

I added an error check after fopen.

MichaelW

I also cannot find anything wrong anywhere in the source after I commented out the include gwMacros.inc statement. What assembler command line are you using?
Well Microsoft, here's another nice mess you've gotten us into.

GoneFishing

Last night when I was looking through pgw001's posts I noticed that he uses MS VS as IDE.
My last suggestion is to try assembling the code  in pure batch environment i.e. in QEDITOR
Best

jj2007

Using \Masm32\qeditor.exe could help indeed. I used RichMasm without any problems.

There are several logical errors to fix. Inter alia,

1.
LOCAL cloc  :DWORD                          ; current location variable
is never initialised, and therefore will set the file pointer initially to an arbitrary value ->CRASH.
Test it by commenting out the mov cloc, fseek(hFile,cloc,0)

2. hMem is a local, too, and therefore this will fail in an unpredictable way:
    LOCAL hMem  :DWORD                          ; allocated memory handle
...
   cmp hMem, 0                           ; Check if file open
   jne labGO                           ; Jump if so

You should read The LOCAL variables trap carefully.

TWell

broken rdLine: too
- no null checking
- no output buffer size checking

pgw001

Folks, thanks to all for your perseverance

The observation that I use the Visual Studio 2013 IDE and the recommendation I try qeditor.exe proved to be the guiding lights

The code, including the gwmacros.inc file, assembled and linked without errors or warnings using qeditor - I am not sure
what this says about the VS environment albeit I have now copied the code that made up the 'readrec proc' into a different
test harness which subsequently went on to assemble without error under VS.

Again thanks for your contributions and support - should I advise Microsoft?

jj2007

Quote from: pgw001 on March 26, 2014, 01:20:37 AMshould I advise Microsoft?
Honestly, Santa Claus doesn't exist, and Microsoft doesn't take advice from its clients ;-)

Gunther

Quote from: pgw001 on March 26, 2014, 01:20:37 AM
Again thanks for your contributions and support - should I advise Microsoft?

you can try it, but the success will be questionable. So, let it be.

Gunther
You have to know the facts before you can distort them.

raymond

QuotelabCR:                                 ; CR found
   mov[edi],al                           ; store CR char
   inc edi                              ; incr out pointer
   mov al,[esi]
   inc esi
   cmp al,10                           ; check if LF char
   je labLF

labLF:                                 ; LF found
   mov[edi],al                              ; store LF char
   inc edi                                 ; incr out pointer

Although the above piece of code will not throw an error, it could mean trouble if the CR character is not followed by an LF character. Your intention should be to skip storing the character if it is NOT an LF but your
code simply continues to process that code you would want to skip! :icon_eek:
Whenever you assume something, you risk being wrong half the time.
http://www.ray.masmcode.com

MichaelW

Quote from: jj2007 on March 26, 2014, 04:55:19 AM
Honestly, Santa Claus doesn't exist, and Microsoft doesn't take advice from its clients ;-)

They do for the big customers, like the one that requested a Word macro system that can be programmed to silently format your hard drive :biggrin:
Well Microsoft, here's another nice mess you've gotten us into.

Gunther

Michael,

Quote from: MichaelW on March 27, 2014, 08:35:48 AM
They do for the big customers, like the one that requested a Word macro system that can be programmed to silently format your hard drive :biggrin:

but that's the world of the big money, not the normal users world.

Gunther
You have to know the facts before you can distort them.