Link to home
Start Free TrialLog in
Avatar of navut
navut

asked on

How to solve error A2004 ?

Hello all,
I got a problem when compile an asm file to 16-bit .obj. I used compiler ml.exe to do this work. Here is my command line:
ml /DIS_16 /c /W3 /Zi /nologo /Fo Disk16.obj Disk.asm
The error was:
error A2004: symbol type conflict
These error always occurred at lines where had "seg" directives in the 16-bit code section.
My .asm file is automatically created by the thunk compiler from a thunk script, so I think it had no problem. I wondered if the version of my compiler ml.exe caused this error. Please give me other suggestion(s) to solve this problem.
Thanks for your supporting.
Sincerely.
Avatar of BeyondWu
BeyondWu
Flag of United States of America image

could you please post your .asm file, I think this file is small because it's created by the thunk compiler. Also, could you please post your Thunk Script?
Avatar of navut
navut

ASKER

Here is my .asm file, which was generated by thunk compiler. I just copy the 16-bit code section, because it's ok when I compile with /DIS_32 option.

;================================================================
      page      ,132

;Thunk Compiler Version 1.8  May 11 1995 13:16:19
;File Compiled Wed Nov 26 10:21:07 2003

;Command Line: C:\WORKING\PROJECTS\FLATTH~1\THUNKS~1\THUNK.EXE -t thk -o disk.asm diskthnk.thk

      TITLE      $disk.asm

      .386
      OPTION READONLY
      OPTION OLDSTRUCTS

IFNDEF IS_16
IFNDEF IS_32
%out command line error: specify one of -DIS_16, -DIS_32
.err
ENDIF  ;IS_32
ENDIF  ;IS_16

IFDEF IS_32
IFDEF IS_16
%out command line error: you can't specify both -DIS_16 and -DIS_32
.err
ENDIF ;IS_16
;************************* START OF 32-BIT CODE *************************
;(skipped)

      .code
;************************* COMMON PER-MODULE ROUTINES *************************
      .data
;(skipped)
      .code
;************************ START OF THUNK BODIES************************
;(skipped)

ELSE
;************************* START OF 16-BIT CODE *************************

      OPTION SEGMENT:USE16
      .model LARGE,PASCAL

      .code      

externDef CheckInt13Extension:far16
externDef ReadDisk:far16


FT_thkTargetTable label word
      dw      offset CheckInt13Extension
      dw         seg CheckInt13Extension ;-----error A2004 in this line------
      dw      offset ReadDisk
      dw         seg ReadDisk ;-----error A2004 in this line------

      .data

public thk_ThunkData16      ;This symbol must be exported.
thk_ThunkData16      dd      3130534ch      ;Protocol 'LS01'
      dd      09f8h      ;Checksum
      dw      offset FT_thkTargetTable
      dw      seg    FT_thkTargetTable ;-----error A2004 in this line------
      dd      0      ;First-time flag.

      .code

externDef ThunkConnect16:far16

public thk_ThunkConnect16
thk_ThunkConnect16:
      pop      ax
      pop      dx
      push      seg    thk_ThunkData16 ;-----error A2004 in this line------
      push      offset thk_ThunkData16
      push      seg    thk_ThkData32 ;-----error A2004 in this line------
      push      offset thk_ThkData32
      push      cs
      push      dx
      push      ax
      jmp      ThunkConnect16 ;-----error A2004 in this line------
thk_ThkData32 label byte
      db      "thk_ThunkData32",0

ENDIF
END
;================================================================

Here is my thunk script
;================================================================
enablemapdirect3216 = true;

typedef int BOOL;
typedef unsigned char *LPBYTE;
typedef unsigned long DWORD;

BOOL ReadDisk(DWORD Drive, DWORD Cylinder, DWORD Head, DWORD Sector, DWORD NumSectors, LPBYTE Buffer, DWORD RelativeSector, BOOL Flag)
{
      Buffer = inout;
}

BOOL CheckInt13Extension(DWORD Drive)
{
}
;================================================================
ASKER CERTIFIED SOLUTION
Avatar of BeyondWu
BeyondWu
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of navut

ASKER

Dear BeyondWu,
Thank you very much. I found where the problem was. My MASM version 7 -- came with VS.Net -- caused these errors. I downloaded its version 6.15 and compiled it successfully. Again, thanks alot.
Best Regards.
Hi navut,

you are welcome, I'm really glad to can help you.

BRs,
Wu