FASM4E.EW (Wrapper) Interface for TG's Flat Assembler link library, quick start.
Created by: Hayden McKay - for the public domain

*   you will need a copy of the fasm documentation for info on fasm's syntax and
    and the preprocessor directives, grab a copy from here www.flatassembler.com

*   please read the faq before posting any bugs...

-(package 5137a)----------------------------------------------------------------

    licence.txt   - TG's flat assembler licence agreement
    fasm.dll	- recompiled fasm.dll from the fasmdll.zip source files

    fasm4e.ew     - euphoria wrapper and interface for fasm.dll
    
    fasm.ash.il   - program for porting fasm.ash to euphoria style syntax, wich 
                    can be found in the fasmdll.zip source files. only used for
                    building the 'fasm' & 'fasmerr' tables found in the wrapper

    read.me.txt          - read me!
    .\demos\*.*          - examples

-(routines)---------------------------------------------------------------------

      fasmInline(s)
  s = fasmBinary(x)
  i = fasmDefine(s,s,i)


      fasmDisplay(i)
      fasmVersion( )

-fasm4e.ew-fasmDefine()---------------------------------------------------------

     hnd = fasmDefine(sequence params, sequence syntax, integer return)
      
     example:
                 constant
                 myfmul = fasmDefine({ C_INT,C_DOUBLE },
                        { "fild dword [ss:esp+4]",
                          "fmul qword [ss:esp+8]",
                          "ret 12" },        C_DOUBLE )

                 ? c_func(myfmul,{1,.1})

     example:    
                 constant
                 myproc = fasmDefine({},
                        { "pushad",
                          "popad" ,
                          "ret"   },NULL)

                 c_proc(myproc,{})

     notes:      the application is responsible for popping bytes of the stack

-fasm4e.ew-fasmInline()--------------------------------------------------------

	fasnInline(sequence syntax)

      example:
                 inline({"pushad",
                         "popad"})

      notes:     inline procedures are built and executed on the fly, a near
                 return is automaticly appended onto the callers syntax

-fasm4e.ew-fasmVersion()-------------------------------------------------------

      major.minor = fasmVersion

      example:
                 printf(1,"FASM%d.%d",fasmVersion)

-fasm4e.ew-fasmBinary()--------------------------------------------------------

      binary = fasmBinary(sequence syntax)

      example:
                 constant 
                 ENTER = fasmBinary(
                 {  "push ebp",
                    "mov  ebp,esp" })

                 constant
                 LEAVE = fasmBinary(
                 {  "leave"        })

      example:
                 integer  fn
                 sequence binary

                 fn = open("myfile.asm","r") -- MUST use text mode.
                 binary = fasmBinary(fn)

      notes:     application is responsible for open, close, seeking file etc...

-fasm4e.ew-fasmDisplay()--------------------------------------------------------

      fasmDisplay(integer pipeline)

      example:
                 fasmDisplay(pipeline) -- see footnote
                 junk = fasmBinary({"display 'Hello from the display pipe!'"})

      notes:     sets a handle to use as the display pipe for fasm's 'display'
                 directive, the handle must be a write handle created with the
                 Kernel32.dll CreatePipe(). 

                 in fasm the 'display' directive is similar to the  '?'  symbol
                 used in euphoria, it can be used to display compile time debug
                 messages, variables etc...

-(FAQ fasm4e)-------------------------------------------------------------------

known issues:
-------------
              * fasm4e.ew abort's with "c_proc/c_func: bad routine number (-1)"
                if it cannot locate fasm.dll in the current directory

              * fasm.dll will cause a machine-check exception if the memLength
                constant located in fasm4e.ew is modified to be too small
general faq:
------------
             * modify the memLength in fasm4e.ew if fasm.dll needs more memory,
               try modify the numPasses in fasm4e.ew if code can't be generated

             * the default model is set for 32-bit code don't forget to use the
               'use' directive if you need to otherwise output may be undesired             

tips:
-----        * use the "include 'masm.inc'" directive if you want to use masm's
               syntax instead. masm.inc is distributed with the fasm bundles...
             
             * you can use sprintf to help dynamicly build any assembler syntax

-(developer notes)--------------------------------------------------------------

Todo:
        + change the syntax check message box into a treeview style window that 
          will better show the bad syntax thread path

          any other suggestions welcome

          [root]				   * bad syntax line
             |
             +--[source]-+-[line-?]    * bad syntax thread path
                         +-[line-?]
                              |
                              +-[source]---[line-?]

        + supply a defualt device for fasm compile time display output. printer,
          file, window etc...

        + enhance the internal error message box

-(version)----------------------------------------------------------------------

build(5137a)
-----------_
            + some minor changes/optimizations to global routines
            + some major changes/optimizations to the wrapper's core...

