.MODEL directive causing problems

From: Stephan Wolf (stewo68_at_hotmail.com)
Date: 01/20/04


Date: Tue, 20 Jan 2004 18:10:55 +0000 (UTC)

The MS C compiler 1.52 produces an .ASM file (-Fa option), which
causes problems when compiled using MASM 6.13 (also tried MASM 7.10).

We are actually experiencing two different problems:

- The original .ASM file compiles ok but the linker adds relocations
although there is absoluetly no need to. The actual instruction is:

        push OFFSET DGROUP:_Ac

Note that we use the -G3 C compiler option and thus the following gets
inserted in the .ASM file:

        .386p
        .387

- The above problem goes away when we remove the .MODEL SMALL
directive (generated by the C compiler). However, we then see the
following error message:

        error A2075: jump destination too far : by xyz byte(s)

Note that the C compiler marks all jumps "short", e.g.

        je SHORT $L1971

It seems correct that such jumps cannot be lengthened due to the
explicit SHORT attribute. However, MASM *does* lengthen these jumps if
".MODEL SMALL" is specified.

Our program is a 16-bit DOS TSR running on i386 and above. Is there
any undocumented magic that the ".MODEL" directive does?

Any help is greatly appreciated.

Stephan



Relevant Pages

  • .MODEL directive causing problems
    ... causes problems when compiled using MASM 6.13. ... - The original .ASM file compiles ok but the linker adds relocations ... Note that we use the -G3 C compiler option and thus the following gets ... Note that the C compiler marks all jumps "short", ...
    (comp.lang.asm.x86)
  • Re: RosAsm Crashes
    ... >> I am curious as to what is considered a "compiler or assembler ... When I pass my code to MASM, ... Is this a crash? ... program xtest; ...
    (alt.lang.asm)
  • Re: COFF OMF Problem
    ... > unable to get the OBJ Files linked with my ilink32... ... Isn't MASM part of your VC++ package? ... Adapting the assembly portions to the compiler and its ...
    (comp.lang.asm.x86)
  • Re: Rapport from installation of Ubuntu 7.10 on amd64
    ... Microsoft Macro Assembler Reference ... The Microsoft Macro Assembler (MASM) provides you with several advantages over ... ml64.exe is the assembler that accepts x64 assembly language. ... Use MASM or compiler intrinsics. ...
    (alt.lang.asm)
  • Re: assembler worth learning?
    ... PPC MAC but with a windows specific compiler, ... against it but that works between any language, ... NO runtime then you can use MASM libraries but with this much messing ...
    (alt.lang.asm)