News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

error A2105: Expected: instruction, directive

Started by irnix, January 29, 2014, 01:11:52 AM

Previous topic - Next topic

irnix

I got this error, i am starting to learn masm32 and i am using dosbox to compile masm32 so i got this error and most things i see on here are Chinese :( Funny i am not chinese so i dont understand anything they say.

SO how do i fix this error?

dedndave

you'll have to show us the code
masm should tell you a line number (in parenthesis)
sometimes, it's off by a line or 2, so give us that line, plus and minus 2 extras

irnix

My code looks like this


.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, DwExitCode:DWORD
DumpRegs PROTO

.code
main PROC

     mov eax, 500
     add eax, 600
     sub eax,350
     call DumpRegs


INVOKE ExitProcess,0
Main ENDP
end main




dedndave

you have to include the Irvine libraries...

        INCLUDE     Irvine32.inc
        INCLUDE     Macros.inc
        INCLUDELIB  Kernel32.lib
        INCLUDELIB  User32.lib
        INCLUDELIB  Irvine32.lib

        .CODE

main    PROC

        mov     eax,500
        add     eax,600
        sub     eax,350
        call    DumpRegs
        INVOKE  ExitProcess,0

main    ENDP

        END     main


results:

  EAX=000002EE  EBX=7FFDF000  ECX=0012FFB0  EDX=7C90E514
  ESI=00000000  EDI=0000000A  EBP=0012FFF0  ESP=0012FFC4
  EIP=00401014  EFL=00000216  CF=0  SF=0  ZF=0  OF=0  AF=1  PF=1


you may have to add full paths for the INC and LIB files
Irvine32.inc requires the presence of SmallWin.inc and VirtualKeys.inc

irnix

Um, I am using 8086 assembler and DosBox to compile the program. Not any IDE you think this might work on the same platform?

dedndave

i am not familiar with DosBox
but, if it supports a Flat memory model and 32-bit code, it should work
in your original code, you used
        .MODEL  Flat,StdCall

also, you used ExitProcess, which is a win32 API function and DumpRegs, which is an Irvine32 function
in order to resolve the external symbols, you need at least kernel32.lib and Irvine32.lib, if nothing else

if all else fails, don't use DosBox   :P

irnix

Many thanks, which ide did you use? Pls let me know

dedndave

i don't use an IDE
if i were to use one, it'd probably be RadAsm

i use Notepad and Notepad++ to write and edit
i use a batch file to assemble

irnix

Well seens to me I don't know how to do that.
How I get that RAD asm, is it free or how do I go about it too, also have you heard of gss assembler?

dedndave

i guess you are using Kip Irvine's book ?
if so, he gives details of setting up free versions of VisualStudio to use with his libraries

RadAsm is a program written by one of our members, KetilO
it's an IDE - i don't think it includes an assembler, but may be used with Masm, JwAsm, etc - probably GoAsm, too

http://masm32.com/board/index.php?board=24.0

i use the Masm32 package - download details are in the upper right corner of the forum page
it includes an editor, batch files - everything you need to build ASM programs

irnix

How do I start, I really wonna learn this masm32 / fasm. I will be so happy to learn.

dedndave

it depends on your goals
do you want to use Kip Irvine's libraries ?
the reason i ask is that we get students in here that are required to use that library
they have no choice in the matter   :(

otherwise, i suggest you start with the Masm32 package (link in upper right corned this page)
there are many examples, help files, and tutorials in the package

i have gotten permission from Kip Irvine to make a few modifications to his library,
to make it easier to use with the Masm32 package
i still have a little work to do on it before i post it, though