commit 9843085a344b769ee82cb40f9914cf6fab16aefa Author: Artem3213212 Date: Sat Mar 10 23:33:07 2018 +0300 Initall commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b1ff05 --- /dev/null +++ b/.gitignore @@ -0,0 +1,84 @@ +# Uncomment these types if you want even more clean repository. But be careful. +# Uncomment these types if you want even more clean repository. But be careful. +# It can make harm to an existing project source. Read explanations below. +# +# Resource files are binaries containing manifest, project icon and version info. +# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. +#*.res +# +# Type library file (binary). In old Delphi versions it should be stored. +# Since Delphi 2009 it is produced from .ridl file and can safely be ignored. +#*.tlb +# +# Diagram Portfolio file. Used by the diagram editor up to Delphi 7. +# Uncomment this if you are not using diagrams or use newer Delphi version. +#*.ddp +# +# Visual LiveBindings file. Added in Delphi XE2. +# Uncomment this if you are not using LiveBindings Designer. +#*.vlb +# +# Deployment Manager configuration file for your project. Added in Delphi XE2. +# Uncomment this if it is not mobile development and you do not use remote debug feature. +#*.deployproj +# +# C++ object files produced when C/C++ Output file generation is configured. +# Uncomment this if you are not using external objects (zlib library for example). +#*.obj +# + +# Delphi compiler-generated binaries (safe to delete) +*.exe +*.dll +*.bpl +*.bpi +*.dcp +*.so +*.apk +*.drc +*.map +*.dres +*.rsm +*.tds +*.dcu +*.lib +*.a +*.o +*.ocx +Temp/ +*.tmp + +*.res + +# Delphi autogenerated files (duplicated info) +*.cfg +*.hpp +*Resource.rc + +# Delphi local files (user-specific info) +*.local +*.identcache +*.projdata +*.tvsconfig +*.dsk + +# Delphi history and backups +__history/ +__recovery/ +*.~* + +# Castalia statistics file (since XE7 Castalia is distributed with Delphi) +*.stat + +#FPC +backup/ +*.compiled +*.ppu +*.o +*.or +FPCTests/*.ico +*.ini + +Tests/Win32 +!FasmDll/* +!FasmDll/DEMO/* \ No newline at end of file diff --git a/FPCTests/fpcunitproject1.lpi b/FPCTests/fpcunitproject1.lpi new file mode 100644 index 0000000..752ce22 --- /dev/null +++ b/FPCTests/fpcunitproject1.lpi @@ -0,0 +1,79 @@ + + + + + + + + + + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="3"> + <Item1> + <PackageName Value="fpcunittestrunner"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + <Item3> + <PackageName Value="FCL"/> + </Item3> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="fpcunitproject1.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="testcase1.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="TestCase1"/> + </Unit1> + <Unit2> + <Filename Value="..\Source\Fasm4Delphi.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="..\Source"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/FPCTests/fpcunitproject1.lpr b/FPCTests/fpcunitproject1.lpr new file mode 100644 index 0000000..5322b19 --- /dev/null +++ b/FPCTests/fpcunitproject1.lpr @@ -0,0 +1,13 @@ +program fpcunitproject1; + +{$mode objfpc}{$H+} + +uses + Interfaces, Forms, GuiTestRunner, fpcunittestrunner, TestCase1; + +begin + Application.Initialize; + Application.CreateForm(TGuiTestRunner, TestRunner); + Application.Run; +end. + diff --git a/FPCTests/fpcunitproject1.lps b/FPCTests/fpcunitproject1.lps new file mode 100644 index 0000000..fe6d19e --- /dev/null +++ b/FPCTests/fpcunitproject1.lps @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="10"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="fpcunitproject1.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <CursorPos X="66" Y="6"/> + <UsageCount Value="20"/> + </Unit0> + <Unit1> + <Filename Value="testcase1.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="TestCase1"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="-1"/> + <TopLine Value="21"/> + <CursorPos X="62" Y="41"/> + <UsageCount Value="20"/> + </Unit1> + <Unit2> + <Filename Value="..\Source\Fasm4Delphi.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="-1"/> + <TopLine Value="-1"/> + <CursorPos X="-1" Y="-1"/> + <UsageCount Value="20"/> + </Unit2> + </Units> + <General> + <ActiveWindowIndexAtStart Value="-1"/> + </General> + <JumpHistory HistoryIndex="-1"/> + </ProjectSession> +</CONFIG> diff --git a/FPCTests/testcase1.pas b/FPCTests/testcase1.pas new file mode 100644 index 0000000..fddc963 --- /dev/null +++ b/FPCTests/testcase1.pas @@ -0,0 +1,51 @@ +unit TestCase1; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, fpcunit, testutils, testregistry,Fasm4Delphi; + +type + + TTestCase1= class(TTestCase) + published + procedure TestHookUp; + end; + +implementation + +const + CompliterMemSize=$10000; + +var + CompliterMem:PFASM_STATE; + +procedure TTestCase1.TestHookUp; +begin + if fasm_AssembleFile('..\Tests\Test1.asm',CompliterMem,CompliterMemSize)<>FASM_OK then + Fail('Error in test1:'+sLineBreak+ + 'Condition: '+CompliterMem^.condition.ToString+sLineBreak+ + 'Error Code: '+CompliterMem^.error_code.ToString); + if fasm_Assemble('add eax,0',CompliterMem,CompliterMemSize)<>FASM_OK then + writeln('Error in test2:'+sLineBreak+ + 'Condition: '+CompliterMem^.condition.ToString+sLineBreak+ + 'Error Code: '+CompliterMem^.error_code.ToString); + if fasm_AssembleFile('..\FasmDll\FASM.ASH',CompliterMem,CompliterMemSize)=FASM_OK then + Fail('Error in test3:'+sLineBreak+ + 'FASM is compiling something that it is can not compile at all.'); + if fasm_Assemble('call -100',CompliterMem,CompliterMemSize)<>FASM_OK then + Fail('Error in test4:'+sLineBreak+ + 'Condition: '+CompliterMem^.condition.ToString+sLineBreak+ + 'Error Code: '+CompliterMem^.error_code.ToString); +end; + + + +initialization + LoadFASM('..\FasmDll\FASM.DLL'); + GetMem(CompliterMem,CompliterMemSize); + RegisterTest(TTestCase1); +end. + diff --git a/Fasm4Delphi b/Fasm4Delphi new file mode 160000 index 0000000..9dea543 --- /dev/null +++ b/Fasm4Delphi @@ -0,0 +1 @@ +Subproject commit 9dea543a8c562f79e87c74c300442cb55b9c9019 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0096be8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,8 @@ +MIT License +Copyright (c) 2018 Artem Gavrilov,Vladislav Utkin + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ebe8488 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +Universal Fasm Util with FPC compability. + +Can use Fasm4Delphi as front-end. + +Donate: https://money.yandex.ru/to/410014959153552 \ No newline at end of file diff --git a/Source/FasmOnDelphi.pas b/Source/FasmOnDelphi.pas new file mode 100644 index 0000000..18c0b5d --- /dev/null +++ b/Source/FasmOnDelphi.pas @@ -0,0 +1,276 @@ +unit FasmOnDelphi platform; + +{Delphi Translation&Tests:Artyom Gavrilov,Vlad Untkin. + Donate:https://money.yandex.ru/to/410014959153552} + +interface + +{$Define USEFasm4Delphi} +{$IFNDEF WIN32} + {$UNDEF USEFasm4Delphi} +{$ENDIF} + +{$Define USEIOUtils} +{$IFDEF DCC} + {$IF CompilerVersion<23.0} + {$UNDEF USEIOUtils} + {$ENDIF} +{$ELSE} + {$UNDEF USEIOUtils} +{$ENDIF} + +uses + System.SysUtils, + {$IFDEF USEFasm4Delphi}Fasm4Delphi,{$ENDIF} + {$IFDEF USEIOUtils}System.IOUtils{$ENDIF},Windows; + +{$IFNDEF USEFasm4Delphi} +type + TFasmVersion=packed record + V1,V2:word; + end; + +const + //General errors and conditions + FASM_OK =0;//FASM_STATE points to output + FASM_WORKING =1; + FASM_ERROR =2;//FASM_STATE contains error code + FASM_INVALID_PARAMETER =-1; + FASM_OUT_OF_MEMORY =-2; + FASM_STACK_OVERFLOW =-3; + FASM_SOURCE_NOT_FOUND =-4; + FASM_UNEXPECTED_END_OF_SOURCE =-5; + FASM_CANNOT_GENERATE_CODE =-6; + FASM_FORMAT_LIMITATIONS_EXCEDDED =-7; + FASM_WRITE_FAILED =-8; + FASM_INVALID_DEFINITION =-9; + + //Error codes for FASM_ERROR condition + FASMERR_FILE_NOT_FOUND =-101; + FASMERR_ERROR_READING_FILE =-102; + FASMERR_INVALID_FILE_FORMAT =-103; + FASMERR_INVALID_MACRO_ARGUMENTS =-104; + FASMERR_INCOMPLETE_MACRO =-105; + FASMERR_UNEXPECTED_CHARACTERS =-106; + FASMERR_INVALID_ARGUMENT =-107; + FASMERR_ILLEGAL_INSTRUCTION =-108; + FASMERR_INVALID_OPERAND =-109; + FASMERR_INVALID_OPERAND_SIZE =-110; + FASMERR_OPERAND_SIZE_NOT_SPECIFIED =-111; + FASMERR_OPERAND_SIZES_DO_NOT_MATCH =-112; + FASMERR_INVALID_ADDRESS_SIZE =-113; + FASMERR_ADDRESS_SIZES_DO_NOT_AGREE =-114; + FASMERR_DISALLOWED_COMBINATION_OF_REGISTERS =-115; + FASMERR_LONG_IMMEDIATE_NOT_ENCODABLE =-116; + FASMERR_RELATIVE_JUMP_OUT_OF_RANGE =-117; + FASMERR_INVALID_EXPRESSION =-118; + FASMERR_INVALID_ADDRESS =-119; + FASMERR_INVALID_VALUE =-120; + FASMERR_VALUE_OUT_OF_RANGE =-121; + FASMERR_UNDEFINED_SYMBOL =-122; + FASMERR_INVALID_USE_OF_SYMBOL =-123; + FASMERR_NAME_TOO_LONG =-124; + FASMERR_INVALID_NAME =-125; + FASMERR_RESERVED_WORD_USED_AS_SYMBOL =-126; + FASMERR_SYMBOL_ALREADY_DEFINED =-127; + FASMERR_MISSING_END_QUOTE =-128; + FASMERR_MISSING_END_DIRECTIVE =-129; + FASMERR_UNEXPECTED_INSTRUCTION =-130; + FASMERR_EXTRA_CHARACTERS_ON_LINE =-131; + FASMERR_SECTION_NOT_ALIGNED_ENOUGH =-132; + FASMERR_SETTING_ALREADY_SPECIFIED =-133; + FASMERR_DATA_ALREADY_DEFINED =-134; + FASMERR_TOO_MANY_REPEATS =-135; + FASMERR_SYMBOL_OUT_OF_SCOPE =-136; + FASMERR_USER_ERROR =-140; + FASMERR_ASSERTION_FAILED =-141; +{$ENDIF} + +type + TFasmError=FASMERR_ASSERTION_FAILED ..FASM_ERROR; + TFasmOutPut=record + Error:TFasmError; + OutStr:string; + end; + TFasmOut=record + OutData:Pointer; + sb:integer; + OutPut:TFasmOutPut; + end; + +const + FASMPath='fasm'; + +function FasmVersion:TFasmVersion; +function FasmAssemble(const Source:AnsiString;cbMemorySize:cardinal;nPassesLimit:word=100):TFasmOut; +{function FasmAssembleToFile(const Source,OutFile:AnsiString;cbMemorySize:cardinal;nPassesLimit:word=100):TFasmOutPut; +function FasmAssembleFile(const Source:AnsiString;cbMemorySize:cardinal;nPassesLimit:word=100):TFasmOut; +function FasmAssembleFileToFile(const Source,OutFile:AnsiString;cbMemorySize:cardinal;nPassesLimit:word=100):TFasmOutPut;{} + +procedure OpenFASM(Location:string=FASMPath;AsDll:boolean=false); +procedure SetFasmTemp(Path:string); + +implementation + +var + FasmLocation:string='FASM'; + FasmTemp:string; + IsDll:boolean=false; + +function RunFasm(Command:string):string; +var + StartupInfo:TStartupInfo; + ProcessInformation:TProcessInformation; + OutPut:THandle; + n:DWORD; + Buff:AnsiChar; + SecAtrtrs:TSecurityAttributes; +begin +SecAtrtrs.nLength:=SizeOf(TSecurityAttributes); +SecAtrtrs.lpSecurityDescriptor:=nil; +SecAtrtrs.bInheritHandle:=true; +ZeroMemory(@StartupInfo,SizeOf(StartupInfo)); +StartupInfo.cb:=SizeOf(StartupInfo); +StartupInfo.dwFlags:=STARTF_USESTDHANDLES; +Createpipe(OutPut,StartupInfo.hStdOutput,@SecAtrtrs,0); +if not CreateProcess(nil,PChar('"'+FasmLocation+'" '+Command),nil,nil,true,NORMAL_PRIORITY_CLASS,nil,nil,StartupInfo,ProcessInformation)then + RaiseLastOSError; +WaitForSingleObject(ProcessInformation.hProcess,INFINITE); +Result:=''; +while PeekNamedPipe(OutPut,@Buff,1,nil,@n,nil) do + if n<>0 then + begin + ReadFile(OutPut,Buff,1,n,nil); + Result:=Result+Buff; + end + else + break; +CloseHandle(OutPut); +CloseHandle(StartupInfo.hStdOutput); +CloseHandle(ProcessInformation.hThread); +CloseHandle(ProcessInformation.hProcess); +end; + +function FasmVersion:TFasmVersion; +const + preverstr='version '; +var + s:string; + i:integer; +begin +{$IFDEF USEFasm4Delphi} +if IsDll then + Result:=fasm_GetVersion +else +begin +{$ENDIF} + s:=RunFasm(''); + i:=Pos(preverstr,s)+length(preverstr); + Result.V1:=0; + while s[i]<>'.' do + begin + Result.V1:=Result.V1*10+ord(s[i])-ord('0'); + inc(i); + end; + inc(i); + Result.V2:=0; + while(s[i]>='0')and(s[i]<='9')do + begin + Result.V2:=Result.V2*10+ord(s[i])-ord('0'); + inc(i); + end; +{$IFDEF USEFasm4Delphi} +end; +{$ENDIF} +end; + +function FasmAssemble(const Source:AnsiString;cbMemorySize:cardinal;nPassesLimit:word=100):TFasmOut; +{$IFDEF USEFasm4Delphi} +var + Mem:PFASM_STATE; + hDisp,hOut:THandle; + n:DWORD; + Buff:AnsiChar; + SecAtrtrs:TSecurityAttributes; +{$ENDIF} +begin +{$IFDEF USEFasm4Delphi} +if IsDll then +begin + SecAtrtrs.nLength:=SizeOf(TSecurityAttributes); + SecAtrtrs.lpSecurityDescriptor:=nil; + SecAtrtrs.bInheritHandle:=true; + CreatePipe(hOut,hDisp,@SecAtrtrs,0); + GetMem(Mem,cbMemorySize); + Result.OutPut.Error:=fasm_Assemble(PAnsiChar(Source),Mem,cbMemorySize,nPassesLimit,hDisp); + if Result.OutPut.Error=FASM_OK then + begin + + end; + FreeMem(Mem); + Result.OutPut.OutStr:=''; + while PeekNamedPipe(hOut,@Buff,1,nil,@n,nil) do + if n<>0 then + begin + ReadFile(hOut,Buff,1,n,nil); + Result.OutPut.OutStr:=Result.OutPut.OutStr+Buff; + end + else + break; + CloseHandle(hOut); + CloseHandle(hDisp); +end +else +begin +{$ENDIF} +{$IFDEF USEFasm4Delphi} +end; +{$ENDIF} +end; + +procedure OpenFASM(Location:string=FASMPath;AsDll:boolean=false); +begin +{$IFDEF USEFasm4Delphi} +if IsDll then + FreeFASM; +IsDll:=AsDll; +if AsDll then + LoadFASM(Location); +FasmLocation:=Location; +{$ELSE} +if not AsDll then + FasmLocation:=Location; +{$ENDIF} +end; + +procedure SetFasmTemp(Path:string); +begin +FasmTemp:=Path; +end; + +{$IFDEF FPC}{$IFDEF WINDOWS} +var + Len:Integer; +{$ENDIF}{$ENDIF} +initialization +{$IFDEF FPC} +{$IFDEF WINDOWS} +begin + SetLength(Result,MAX_PATH); + Len:=GetTempPath(MAX_PATH,PChar(FasmTemp)); + if Len<>0 then + begin + Len:=GetLongPathName(PChar(FasmTemp),nil,0); + GetLongPathName(PChar(FasmTemp),PChar(FasmTemp),Len); + SetLength(FasmTemp,Len-1); + end + else + FasmTemp:=''; +end; +{$ELSE} +FasmTemp:='/tmp'; +{$ENDIF} +{$ELSE} +FasmTemp:=TPath.GetTempPath; +{$ENDIF} +end. diff --git a/Tests/Test1.asm b/Tests/Test1.asm new file mode 100644 index 0000000..da321fc --- /dev/null +++ b/Tests/Test1.asm @@ -0,0 +1,2 @@ +a db 0 +cmp [a],0 \ No newline at end of file diff --git a/Tests/Tester.dpr b/Tests/Tester.dpr new file mode 100644 index 0000000..f91a122 --- /dev/null +++ b/Tests/Tester.dpr @@ -0,0 +1,61 @@ +program Tester; + +{$IFNDEF TESTINSIGHT} +{$APPTYPE CONSOLE} +{$ENDIF}{$STRONGLINKTYPES ON} +uses + System.SysUtils, + {$IFDEF TESTINSIGHT} + TestInsight.DUnitX, + {$ENDIF } + DUnitX.Loggers.Console, + DUnitX.Loggers.Xml.NUnit, + DUnitX.TestFramework, + TesterMain in 'TesterMain.pas', + FasmOnDelphi in '..\Source\FasmOnDelphi.pas', + Fasm4Delphi in '..\Fasm4Delphi\Source\Fasm4Delphi.pas'; + +var + runner : ITestRunner; + results : IRunResults; + logger : ITestLogger; + nunitLogger : ITestLogger; +begin +{$IFDEF TESTINSIGHT} + TestInsight.DUnitX.RunRegisteredTests; + exit; +{$ENDIF} + try + //Check command line options, will exit if invalid + TDUnitX.CheckCommandLine; + //Create the test runner + runner := TDUnitX.CreateRunner; + //Tell the runner to use RTTI to find Fixtures + runner.UseRTTI := True; + //tell the runner how we will log things + //Log to the console window + logger := TDUnitXConsoleLogger.Create(true); + runner.AddLogger(logger); + //Generate an NUnit compatible XML File + nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile); + runner.AddLogger(nunitLogger); + runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests; + + //Run tests + results := runner.Execute; + if not results.AllPassed then + System.ExitCode := EXIT_ERRORS; + + {$IFNDEF CI} + //We don't want this happening when running under CI. + if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then + begin + System.Write('Done.. press <Enter> key to quit.'); + System.Readln; + end; + {$ENDIF} + except + on E: Exception do + System.Writeln(E.ClassName, ': ', E.Message); + end; +end. diff --git a/Tests/Tester.dproj b/Tests/Tester.dproj new file mode 100644 index 0000000..1920013 --- /dev/null +++ b/Tests/Tester.dproj @@ -0,0 +1,565 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ProjectGuid>{4DB29771-5426-49E7-B0D8-B77F95D4EDCE}</ProjectGuid> + <ProjectVersion>18.3</ProjectVersion> + <FrameworkType>None</FrameworkType> + <MainSource>Tester.dpr</MainSource> + <Base>True</Base> + <Config Condition="'$(Config)'==''">Debug</Config> + <Platform Condition="'$(Platform)'==''">Win32</Platform> + <TargetedPlatforms>3</TargetedPlatforms> + <AppType>Console</AppType> + </PropertyGroup> + <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''"> + <Base_Android>true</Base_Android> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''"> + <Base_iOSDevice32>true</Base_iOSDevice32> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''"> + <Base_iOSDevice64>true</Base_iOSDevice64> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''"> + <Base_iOSSimulator>true</Base_iOSSimulator> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='OSX32' and '$(Base)'=='true') or '$(Base_OSX32)'!=''"> + <Base_OSX32>true</Base_OSX32> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''"> + <Base_Win32>true</Base_Win32> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''"> + <Base_Win64>true</Base_Win64> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''"> + <Cfg_1>true</Cfg_1> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''"> + <Cfg_1_Win32>true</Cfg_1_Win32> + <CfgParent>Cfg_1</CfgParent> + <Cfg_1>true</Cfg_1> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''"> + <Cfg_2>true</Cfg_2> + <CfgParent>Base</CfgParent> + <Base>true</Base> + </PropertyGroup> + <PropertyGroup Condition="'$(Base)'!=''"> + <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput> + <DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput> + <DCC_E>false</DCC_E> + <DCC_N>false</DCC_N> + <DCC_S>false</DCC_S> + <DCC_F>false</DCC_F> + <DCC_K>false</DCC_K> + <DCC_UsePackage>RESTComponents;emsclientfiredac;FireDACIBDriver;emsclient;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;FireDAC;FireDACSqliteDriver;soaprtl;soapmidas;$(DCC_UsePackage)</DCC_UsePackage> + <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace> + <UsingDelphiRTL>true</UsingDelphiRTL> + <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon> + <Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns> + <DCC_UnitSearchPath>$(DUnitX);$(DCC_UnitSearchPath)</DCC_UnitSearchPath> + <SanitizedProjectName>Tester</SanitizedProjectName> + </PropertyGroup> + <PropertyGroup Condition="'$(Base_Android)'!=''"> + <DCC_UsePackage>DBXSqliteDriver;DBXInterBaseDriver;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;ibmonitor;FMXTee;DbxCommonDriver;ibxpress;xmlrtl;DataSnapNativeClient;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage> + <EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars> + </PropertyGroup> + <PropertyGroup Condition="'$(Base_iOSDevice32)'!=''"> + <DCC_UsePackage>DBXSqliteDriver;DBXInterBaseDriver;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;ibmonitor;FMXTee;DbxCommonDriver;ibxpress;xmlrtl;DataSnapNativeClient;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage> + </PropertyGroup> + <PropertyGroup Condition="'$(Base_iOSDevice64)'!=''"> + <DCC_UsePackage>DBXSqliteDriver;DBXInterBaseDriver;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;ibmonitor;FMXTee;DbxCommonDriver;ibxpress;xmlrtl;DataSnapNativeClient;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage> + </PropertyGroup> + <PropertyGroup Condition="'$(Base_iOSSimulator)'!=''"> + <DCC_UsePackage>DBXSqliteDriver;DBXInterBaseDriver;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;ibmonitor;FMXTee;DbxCommonDriver;ibxpress;xmlrtl;DataSnapNativeClient;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage> + </PropertyGroup> + <PropertyGroup Condition="'$(Base_OSX32)'!=''"> + <DCC_UsePackage>DBXSqliteDriver;DataSnapServerMidas;DBXInterBaseDriver;DataSnapFireDAC;tethering;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;FireDACTDataDriver;FMXTee;DbxCommonDriver;ibxpress;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage> + </PropertyGroup> + <PropertyGroup Condition="'$(Base_Win32)'!=''"> + <DCC_UsePackage>DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;inetdb;RaizeComponentsVcl;FmxTeeUI;emsedge;RaizeComponentsVclDb;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;CodeSiteExpressPkg;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage> + <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace> + <BT_BuildType>Debug</BT_BuildType> + <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys> + <VerInfo_Locale>1033</VerInfo_Locale> + </PropertyGroup> + <PropertyGroup Condition="'$(Base_Win64)'!=''"> + <VerInfo_Locale>1033</VerInfo_Locale> + <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace> + <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys> + <DCC_UsePackage>DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;RaizeComponentsVcl;FmxTeeUI;emsedge;RaizeComponentsVclDb;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage> + </PropertyGroup> + <PropertyGroup Condition="'$(Cfg_1)'!=''"> + <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> + <DCC_DebugDCUs>true</DCC_DebugDCUs> + <DCC_Optimize>false</DCC_Optimize> + <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames> + <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe> + <DCC_RemoteDebug>true</DCC_RemoteDebug> + </PropertyGroup> + <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''"> + <DCC_RemoteDebug>false</DCC_RemoteDebug> + </PropertyGroup> + <PropertyGroup Condition="'$(Cfg_2)'!=''"> + <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> + <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> + <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> + <DCC_DebugInformation>0</DCC_DebugInformation> + </PropertyGroup> + <ItemGroup> + <DelphiCompile Include="$(MainSource)"> + <MainSource>MainSource</MainSource> + </DelphiCompile> + <DCCReference Include="TesterMain.pas"/> + <DCCReference Include="..\Source\FasmOnDelphi.pas"/> + <DCCReference Include="..\Fasm4Delphi\Source\Fasm4Delphi.pas"/> + <BuildConfiguration Include="Release"> + <Key>Cfg_2</Key> + <CfgParent>Base</CfgParent> + </BuildConfiguration> + <BuildConfiguration Include="Base"> + <Key>Base</Key> + </BuildConfiguration> + <BuildConfiguration Include="Debug"> + <Key>Cfg_1</Key> + <CfgParent>Base</CfgParent> + </BuildConfiguration> + </ItemGroup> + <ProjectExtensions> + <Borland.Personality>Delphi.Personality.12</Borland.Personality> + <Borland.ProjectType>Console</Borland.ProjectType> + <BorlandProject> + <Delphi.Personality> + <Source> + <Source Name="MainSource">Tester.dpr</Source> + </Source> + </Delphi.Personality> + <Deployment Version="1"> + <DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule"> + <Platform Name="iOSSimulator"> + <Overwrite>true</Overwrite> + </Platform> + </DeployFile> + <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule"> + <Platform Name="OSX32"> + <Overwrite>true</Overwrite> + </Platform> + </DeployFile> + <DeployFile LocalName="Win32\Debug\Tester.exe" Configuration="Debug" Class="ProjectOutput"> + <Platform Name="Win32"> + <RemoteName>Tester.exe</RemoteName> + <Overwrite>true</Overwrite> + </Platform> + </DeployFile> + <DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule"> + <Platform Name="OSX32"> + <Overwrite>true</Overwrite> + </Platform> + </DeployFile> + <DeployFile LocalName="$(BDS)\Redist\iossim32\libcgunwind.1.0.dylib" Class="DependencyModule"> + <Platform Name="iOSSimulator"> + <Overwrite>true</Overwrite> + </Platform> + </DeployFile> + <DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule"> + <Platform Name="iOSSimulator"> + <Overwrite>true</Overwrite> + </Platform> + </DeployFile> + <DeployClass Name="Android_SplashImage470"> + <Platform Name="Android"> + <RemoteDir>res\drawable-normal</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="DependencyModule"> + <Platform Name="OSX32"> + <Operation>1</Operation> + <Extensions>.dylib</Extensions> + </Platform> + <Platform Name="Win32"> + <Operation>0</Operation> + <Extensions>.dll;.bpl</Extensions> + </Platform> + </DeployClass> + <DeployClass Required="true" Name="DependencyPackage"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + <Extensions>.dylib</Extensions> + </Platform> + <Platform Name="Win32"> + <Operation>0</Operation> + <Extensions>.bpl</Extensions> + </Platform> + <Platform Name="OSX32"> + <Operation>1</Operation> + <Extensions>.dylib</Extensions> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + <Extensions>.dylib</Extensions> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + <Extensions>.dylib</Extensions> + </Platform> + </DeployClass> + <DeployClass Name="iPad_Launch2048"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectiOSDeviceDebug"> + <Platform Name="iOSDevice64"> + <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="AndroidLibnativeMipsFile"> + <Platform Name="Android"> + <RemoteDir>library\lib\mips</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectOSXInfoPList"/> + <DeployClass Name="AndroidGDBServer"> + <Platform Name="Android"> + <RemoteDir>library\lib\armeabi-v7a</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectiOSResource"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectOSXEntitlements"/> + <DeployClass Name="iPhone_Launch640"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_SplashImage960"> + <Platform Name="Android"> + <RemoteDir>res\drawable-xlarge</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_LauncherIcon96"> + <Platform Name="Android"> + <RemoteDir>res\drawable-xhdpi</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_LauncherIcon144"> + <Platform Name="Android"> + <RemoteDir>res\drawable-xxhdpi</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="iPhone_Launch320"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="UWP_DelphiLogo150"> + <Platform Name="Win64"> + <RemoteDir>Assets</RemoteDir> + <Operation>1</Operation> + </Platform> + <Platform Name="Win32"> + <RemoteDir>Assets</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="AndroidSplashImageDef"> + <Platform Name="Android"> + <RemoteDir>res\drawable</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="UWP_DelphiLogo44"> + <Platform Name="Win64"> + <RemoteDir>Assets</RemoteDir> + <Operation>1</Operation> + </Platform> + <Platform Name="Win32"> + <RemoteDir>Assets</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="AndroidLibnativeX86File"> + <Platform Name="Android"> + <RemoteDir>library\lib\x86</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="DebugSymbols"> + <Platform Name="OSX32"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="Win32"> + <Operation>0</Operation> + </Platform> + </DeployClass> + <DeployClass Name="DependencyFramework"> + <Platform Name="OSX32"> + <Operation>1</Operation> + <Extensions>.framework</Extensions> + </Platform> + <Platform Name="Win32"> + <Operation>0</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_SplashImage426"> + <Platform Name="Android"> + <RemoteDir>res\drawable-small</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectiOSEntitlements"/> + <DeployClass Name="AdditionalDebugSymbols"> + <Platform Name="OSX32"> + <Operation>1</Operation> + </Platform> + <Platform Name="Win32"> + <RemoteDir>Contents\MacOS</RemoteDir> + <Operation>0</Operation> + </Platform> + </DeployClass> + <DeployClass Name="AndroidClassesDexFile"> + <Platform Name="Android"> + <RemoteDir>classes</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectiOSInfoPList"/> + <DeployClass Name="iPad_Launch1024"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="AndroidServiceOutput"> + <Platform Name="Android"> + <RemoteDir>library\lib\armeabi-v7a</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_DefaultAppIcon"> + <Platform Name="Android"> + <RemoteDir>res\drawable</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectiOSDeviceResourceRules"/> + <DeployClass Name="ProjectOSXResource"> + <Platform Name="OSX32"> + <RemoteDir>Contents\Resources</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="iPad_Launch768"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="AndroidLibnativeArmeabiFile"> + <Platform Name="Android"> + <RemoteDir>library\lib\armeabi</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Required="true" Name="ProjectOutput"> + <Platform Name="Android"> + <RemoteDir>library\lib\armeabi-v7a</RemoteDir> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="Win32"> + <Operation>0</Operation> + </Platform> + <Platform Name="OSX32"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_SplashImage640"> + <Platform Name="Android"> + <RemoteDir>res\drawable-large</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="File"> + <Platform Name="Android"> + <Operation>0</Operation> + </Platform> + <Platform Name="iOSDevice64"> + <Operation>0</Operation> + </Platform> + <Platform Name="Win32"> + <Operation>0</Operation> + </Platform> + <Platform Name="OSX32"> + <Operation>0</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>0</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>0</Operation> + </Platform> + </DeployClass> + <DeployClass Name="iPhone_Launch640x1136"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="AndroidSplashStyles"> + <Platform Name="Android"> + <RemoteDir>res\values</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_LauncherIcon36"> + <Platform Name="Android"> + <RemoteDir>res\drawable-ldpi</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="iPad_Launch1536"> + <Platform Name="iOSDevice64"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSSimulator"> + <Operation>1</Operation> + </Platform> + <Platform Name="iOSDevice32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_LauncherIcon48"> + <Platform Name="Android"> + <RemoteDir>res\drawable-mdpi</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="Android_LauncherIcon72"> + <Platform Name="Android"> + <RemoteDir>res\drawable-hdpi</RemoteDir> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectAndroidManifest"> + <Platform Name="Android"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <DeployClass Name="ProjectUWPManifest"> + <Platform Name="Win64"> + <Operation>1</Operation> + </Platform> + <Platform Name="Win32"> + <Operation>1</Operation> + </Platform> + </DeployClass> + <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/> + <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/> + <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/> + <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/> + <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/> + <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/> + <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/> + <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/> + </Deployment> + <Platforms> + <Platform value="Android">False</Platform> + <Platform value="iOSDevice32">False</Platform> + <Platform value="iOSDevice64">False</Platform> + <Platform value="iOSSimulator">False</Platform> + <Platform value="OSX32">False</Platform> + <Platform value="Win32">True</Platform> + <Platform value="Win64">True</Platform> + </Platforms> + </BorlandProject> + <ProjectFileVersion>12</ProjectFileVersion> + </ProjectExtensions> + <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/> + <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/> + <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/> +</Project> diff --git a/Tests/TesterMain.pas b/Tests/TesterMain.pas new file mode 100644 index 0000000..7c9bfae --- /dev/null +++ b/Tests/TesterMain.pas @@ -0,0 +1,79 @@ +unit TesterMain; + +interface + +uses + DUnitX.TestFramework,Fasm4Delphi,FasmOnDelphi,SysUtils; + +type + [TestFixture] + TMyTestObject = class(TObject) + public + [Setup] + procedure Setup; + [TearDown] + procedure TearDown; + [Test] + procedure Test1; + [Test] + procedure Test2; + [Test] + procedure Test3; + [Test] + procedure Test4; + end; + +const + CompliterMemSize=$10000; + +var + CompliterMem:PFASM_STATE; + +implementation + +procedure TMyTestObject.Setup; +begin +end; + +procedure TMyTestObject.TearDown; +begin +end; + +procedure TMyTestObject.Test1; +begin +if fasm_AssembleFile('..\..\Test1.ASM',CompliterMem,CompliterMemSize)<>FASM_OK then + raise Exception.Create('Condition: '+CompliterMem^.condition.ToString+sLineBreak+ + 'Error Code: '+CompliterMem^.error_code.ToString+sLineBreak); +end; + +procedure TMyTestObject.Test2; +var + Res:TFasmOut; +begin +Res:=FasmAssemble('add eax,',CompliterMemSize); +raise Exception.Create('Answ: '+Res.OutPut.OutStr+sLineBreak); + //'Error Code:'+CompliterMem^.error_code.ToString+sLineBreak); +if Res.OutPut.Error<>FASM_OK then + raise Exception.Create('Condition: '+CompliterMem^.condition.ToString+sLineBreak+ + 'Error Code: '+CompliterMem^.error_code.ToString+sLineBreak); +end; + +procedure TMyTestObject.Test3; +begin +if fasm_AssembleFile('..\..\..\FasmDll\FASM.ASH',CompliterMem,CompliterMemSize)=FASM_OK then + raise Exception.Create('FASM is compiling something that it is can not compile at all.'); +end; + +procedure TMyTestObject.Test4; +begin +if fasm_Assemble('call -100',CompliterMem,CompliterMemSize)<>FASM_OK then + raise Exception.Create('Condition: '+CompliterMem^.condition.ToString+sLineBreak+ + 'Error Code: '+CompliterMem^.error_code.ToString+sLineBreak); +end; + +initialization + TDUnitX.RegisterTestFixture(TMyTestObject); + OpenFASM('..\..\..\Fasm4Delphi\FasmDll\FASM.DLL',true); + //OpenFASM('..\..\..\fasmw172\FASM.EXE'); + GetMem(CompliterMem,CompliterMemSize); +end. diff --git a/fasmw172/EXAMPLES/BEER/BEER.ASM b/fasmw172/EXAMPLES/BEER/BEER.ASM new file mode 100644 index 0000000..dca23ad --- /dev/null +++ b/fasmw172/EXAMPLES/BEER/BEER.ASM @@ -0,0 +1,46 @@ + +; Beer - example of tiny (one section) Win32 program + +format PE GUI 4.0 + +include 'win32a.inc' + +; no section defined - fasm will automatically create .flat section for both +; code and data, and set entry point at the beginning of this section + + invoke MessageBoxA,0,_message,_caption,MB_ICONQUESTION+MB_YESNO + cmp eax,IDYES + jne exit + + invoke mciSendString,_cmd_open,0,0,0 + invoke mciSendString,_cmd_eject,0,0,0 + invoke mciSendString,_cmd_close,0,0,0 + +exit: + invoke ExitProcess,0 + +_message db 'Do you need additional place for the beer?',0 +_caption db 'Desktop configuration',0 + +_cmd_open db 'open cdaudio',0 +_cmd_eject db 'set cdaudio door open',0 +_cmd_close db 'close cdaudio',0 + +; import data in the same section + +data import + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + winmm,'WINMM.DLL' + + import kernel32,\ + ExitProcess,'ExitProcess' + + import user32,\ + MessageBoxA,'MessageBoxA' + + import winmm,\ + mciSendString,'mciSendStringA' + +end data diff --git a/fasmw172/EXAMPLES/DDRAW/DDRAW.ASM b/fasmw172/EXAMPLES/DDRAW/DDRAW.ASM new file mode 100644 index 0000000..485ea14 --- /dev/null +++ b/fasmw172/EXAMPLES/DDRAW/DDRAW.ASM @@ -0,0 +1,299 @@ + +; DirectDraw programming example + +format PE GUI 4.0 +entry start + +include 'win32a.inc' + +include 'ddraw.inc' + +section '.text' code readable executable + + start: + + invoke GetModuleHandleA,NULL + mov [hinstance],eax + + invoke LoadIconA,NULL,IDI_APPLICATION + mov [wc.hIcon],eax + + invoke LoadCursorA,NULL,IDC_ARROW + mov [wc.hCursor],eax + + mov [wc.style],0 + mov [wc.lpfnWndProc],WindowProc + mov [wc.cbClsExtra],0 + mov [wc.cbWndExtra],0 + mov eax,[hinstance] + mov [wc.hInstance],eax + mov [wc.hbrBackground],0 + mov dword [wc.lpszMenuName],NULL + mov dword [wc.lpszClassName],_class + invoke RegisterClassA,wc + test eax,eax + jz startup_error + + invoke CreateWindowExA,\ + 0,_class,_title,WS_POPUP+WS_VISIBLE,0,0,0,0,NULL,NULL,[hinstance],NULL + test eax,eax + jz startup_error + mov [hwnd],eax + + invoke DirectDrawCreate,NULL,DDraw,NULL + or eax,eax + jnz ddraw_error + + cominvk DDraw,SetCooperativeLevel,\ + [hwnd],DDSCL_EXCLUSIVE+DDSCL_FULLSCREEN + or eax,eax + jnz ddraw_error + + cominvk DDraw,SetDisplayMode,\ + 640,480,8 + or eax,eax + jnz ddraw_error + + mov [ddsd.dwSize],sizeof.DDSURFACEDESC + mov [ddsd.dwFlags],DDSD_CAPS+DDSD_BACKBUFFERCOUNT + mov [ddsd.ddsCaps.dwCaps],DDSCAPS_PRIMARYSURFACE+DDSCAPS_FLIP+DDSCAPS_COMPLEX + mov [ddsd.dwBackBufferCount],1 + cominvk DDraw,CreateSurface,\ + ddsd,DDSPrimary,NULL + or eax,eax + jnz ddraw_error + + mov [ddscaps.dwCaps],DDSCAPS_BACKBUFFER + cominvk DDSPrimary,GetAttachedSurface,\ + ddscaps,DDSBack + or eax,eax + jnz ddraw_error + + mov esi,picture + call load_picture + jc open_error + + mov esi,picture + call load_palette + jc open_error + + invoke GetTickCount + mov [last_tick],eax + + jmp paint + +main_loop: + + invoke PeekMessageA,msg,NULL,0,0,PM_NOREMOVE + or eax,eax + jz no_message + invoke GetMessageA,msg,NULL,0,0 + or eax,eax + jz end_loop + invoke TranslateMessage,msg + invoke DispatchMessageA,msg + + jmp main_loop + + no_message: + cmp [active],0 + je sleep + + cominvk DDSPrimary,IsLost + or eax,eax + jz paint + cmp eax,DDERR_SURFACELOST + jne end_loop + + cominvk DDSPrimary,Restore + +paint: + + mov [rect.top],0 + mov [rect.bottom],480 + mov [rect.left],0 + mov [rect.right],640 + + cominvk DDSBack,BltFast,\ + 0,0,[DDSPicture],rect,DDBLTFAST_SRCCOLORKEY + or eax,eax + jnz paint_done + + movzx eax,[frame] + xor edx,edx + mov ebx,10 + div ebx + + sal eax,6 + add eax,480 + mov [rect.top],eax + add eax,64 + mov [rect.bottom],eax + sal edx,6 + mov [rect.left],edx + add edx,64 + mov [rect.right],edx + + cominvk DDSBack,BltFast,\ + [x],[y],[DDSPicture],rect,DDBLTFAST_SRCCOLORKEY + + cominvk DDSPrimary,SetPalette,[DDPalette] + + cominvk DDSPrimary,Flip,0,0 + + paint_done: + + invoke GetTickCount + mov ebx,eax + sub ebx,[last_tick] + cmp ebx,20 + jb main_loop + add [last_tick],20 + + inc [frame] + cmp [frame],60 + jb main_loop + mov [frame],0 + jmp main_loop + +sleep: + invoke WaitMessage + jmp main_loop + +ddraw_error: + mov eax,_ddraw_error + jmp error +open_error: + mov eax,_open_error + error: + invoke MessageBoxA,[hwnd],eax,_error,MB_OK+MB_ICONERROR + invoke DestroyWindow,[hwnd] + invoke PostQuitMessage,1 + jmp main_loop +startup_error: + invoke MessageBoxA,[hwnd],_startup_error,_error,MB_OK+MB_ICONERROR +end_loop: + invoke ExitProcess,[msg.wParam] + +include 'gif87a.inc' + +proc WindowProc hwnd,wmsg,wparam,lparam + push ebx esi edi + mov eax,[wmsg] + cmp eax,WM_CREATE + je .wmcreate + cmp eax,WM_DESTROY + je .wmdestroy + cmp eax,WM_ACTIVATE + je .wmactivate + cmp eax,WM_SETCURSOR + je .wmsetcursor + cmp eax,WM_MOUSEMOVE + je .wmmousemove + cmp eax,WM_KEYDOWN + je .wmkeydown + .defwindowproc: + invoke DefWindowProcA,[hwnd],[wmsg],[wparam],[lparam] + jmp .finish + .wmcreate: + xor eax,eax + jmp .finish + .wmkeydown: + cmp [wparam],VK_ESCAPE + jne .finish + .wmdestroy: + cominvk DDraw,RestoreDisplayMode + cominvk DDraw,Release + invoke PostQuitMessage,0 + xor eax,eax + jmp .finish + .wmactivate: + mov eax,[wparam] + mov [active],al + jmp .finish + .wmsetcursor: + invoke SetCursor,0 + xor eax,eax + jmp .finish + .wmmousemove: + movsx eax,word [lparam] + mov [x],eax + movsx eax,word [lparam+2] + mov [y],eax + .finish: + pop edi esi ebx + ret +endp + +section '.data' data readable writeable + + _title db 'flat assembler DirectDraw application',0 + _class db 'FDDRAW32',0 + + _error db 'Error',0 + _startup_error db 'Startup failed.',0 + _ddraw_error db 'Direct Draw initialization failed.',0 + _open_error db 'Failed opening data file.',0 + + picture db 'DDRAW.GIF',0 + +section '.bss' readable writeable + + hinstance dd ? + hwnd dd ? + wc WNDCLASS + msg MSG + + ddsd DDSURFACEDESC + ddscaps DDSCAPS + + DDraw DirectDraw + DDSPrimary DirectDrawSurface + DDSBack DirectDrawSurface + + DDSPicture DirectDrawSurface + DDPalette DirectDrawPalette + + bytes_count dd ? + last_tick dd ? + frame db ? + active db ? + LZW_bits db ? + LZW_table rd (0F00h-2)*2 + buffer rb 40000h + rect RECT + x dd ? + y dd ? + +section '.idata' import data readable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL',\ + ddraw,'DDRAW.DLL' + + import kernel,\ + GetModuleHandleA,'GetModuleHandleA',\ + CreateFileA,'CreateFileA',\ + ReadFile,'ReadFile',\ + CloseHandle,'CloseHandle',\ + GetTickCount,'GetTickCount',\ + ExitProcess,'ExitProcess' + + import user,\ + RegisterClassA,'RegisterClassA',\ + CreateWindowExA,'CreateWindowExA',\ + DestroyWindow,'DestroyWindow',\ + DefWindowProcA,'DefWindowProcA',\ + GetMessageA,'GetMessageA',\ + PeekMessageA,'PeekMessageA',\ + TranslateMessage,'TranslateMessage',\ + DispatchMessageA,'DispatchMessageA',\ + LoadCursorA,'LoadCursorA',\ + LoadIconA,'LoadIconA',\ + SetCursor,'SetCursor',\ + MessageBoxA,'MessageBoxA',\ + PostQuitMessage,'PostQuitMessage',\ + WaitMessage,'WaitMessage' + + import ddraw,\ + DirectDrawCreate,'DirectDrawCreate' diff --git a/fasmw172/EXAMPLES/DDRAW/DDRAW.GIF b/fasmw172/EXAMPLES/DDRAW/DDRAW.GIF new file mode 100644 index 0000000..96dea3a Binary files /dev/null and b/fasmw172/EXAMPLES/DDRAW/DDRAW.GIF differ diff --git a/fasmw172/EXAMPLES/DDRAW/DDRAW.INC b/fasmw172/EXAMPLES/DDRAW/DDRAW.INC new file mode 100644 index 0000000..15bc638 --- /dev/null +++ b/fasmw172/EXAMPLES/DDRAW/DDRAW.INC @@ -0,0 +1,424 @@ + +; DirectDraw interface + +interface DirectDraw,\ + QueryInterface,\ + AddRef,\ + Release,\ + Compact,\ + CreateClipper,\ + CreatePalette,\ + CreateSurface,\ + DuplicateSurface,\ + EnumDisplayModes,\ + EnumSurfaces,\ + FlipToGDISurface,\ + GetCaps,\ + GetDisplayMode,\ + GetFourCCCodes,\ + GetGDISurface,\ + GetMonitorFrequency,\ + GetScanLine,\ + GetVerticalBlankStatus,\ + Initialize,\ + RestoreDisplayMode,\ + SetCooperativeLevel,\ + SetDisplayMode,\ + WaitForVerticalBlank,\ + GetAvailableVidMem,\ + GetSurfaceFromDC,\ + RestoreAllSurfaces,\ + TestCooperativeLevel,\ + GetDeviceIdentifier,\ + StartModeTest,\ + EvaluateMode + +interface DirectDrawSurface,\ + QueryInterface,\ + AddRef,\ + Release,\ + AddAttachedSurface,\ + AddOverlayDirtyRect,\ + Blt,\ + BltBatch,\ + BltFast,\ + DeleteAttachedSurface,\ + EnumAttachedSurfaces,\ + EnumOverlayZOrders,\ + Flip,\ + GetAttachedSurface,\ + GetBltStatus,\ + GetCaps,\ + GetClipper,\ + GetColorKey,\ + GetDC,\ + GetFlipStatus,\ + GetOverlayPosition,\ + GetPalette,\ + GetPixelFormat,\ + GetSurfaceDesc,\ + Initialize,\ + IsLost,\ + Lock,\ + ReleaseDC,\ + Restore,\ + SetClipper,\ + SetColorKey,\ + SetOverlayPosition,\ + SetPalette,\ + Unlock,\ + UpdateOverlay,\ + UpdateOverlayDisplay,\ + UpdateOverlayZOrder,\ + GetDDInterface,\ + PageLock,\ + PageUnlock,\ + SetSurfaceDesc,\ + SetPrivateData,\ + GetPrivateData,\ + FreePrivateData,\ + GetUniquenessValue,\ + ChangeUniquenessValue,\ + SetPriority,\ + GetPriority,\ + SetLOD,\ + GetLOD + +interface DirectDrawPalette,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetCaps,\ + GetEntries,\ + Initialize,\ + SetEntries + +interface DirectDrawClipper,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetClipList,\ + GetHWnd,\ + Initialize,\ + IsClipListChanged,\ + SetClipList,\ + SetHWnd + +interface DirectDrawColorControl,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetColorControls,\ + SetColorControls + +interface DirectDrawGammaControl,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetGammaRamp,\ + SetGammaRamp + +struct DDCOLORKEY + dwColorSpaceLowValue dd ? + dwColorSpaceHighValue dd ? +ends + +struct DDPIXELFORMAT + dwSize dd ? + dwFlags dd ? + dwFourCC dd ? + union + dwRGBBitCount dd ? + dwYUVBitCount dd ? + dwZBufferBitDepth dd ? + dwAlphaBitDepth dd ? + dwLuminanceBitCount dd ? + dwBumpBitCount dd ? + ends + union + dwRBitMask dd ? + dwYBitMask dd ? + dwStencilBitDepth dd ? + dwLuminanceBitMask dd ? + dwBumpDuBitMask dd ? + ends + union + dwGBitMask dd ? + dwUBitMask dd ? + dwZBitMask dd ? + dwBumpDvBitMask dd ? + ends + union + dwBBitMask dd ? + dwVBitMask dd ? + dwStencilBitMask dd ? + dwBumpLuminanceBitMask dd ? + ends + union + dwRGBAlphaBitMask dd ? + dwYUVAlphaBitMask dd ? + dwLuminanceAlphaBitMask dd ? + dwRGBZBitMask dd ? + dwYUVZBitMask dd ? + ends +ends + +struct DDSCAPS + dwCaps dd ? +ends + +struct DDSURFACEDESC + dwSize dd ? + dwFlags dd ? + dwHeight dd ? + dwWidth dd ? + union + lPitch dd ? + dwLinearSize dd ? + ends + dwBackBufferCount dd ? + union + dwMipMapCount dd ? + dwZBufferBitDepth dd ? + dwRefreshRate dd ? + ends + dwAlphaBitDepth dd ? + dwReserved dd ? + lpSurface dd ? + ddckCKDestOverlay DDCOLORKEY + ddckCKDestBlt DDCOLORKEY + ddckCKSrcOverlay DDCOLORKEY + ddckCKSrcBlt DDCOLORKEY + ddpfPixelFormat DDPIXELFORMAT + ddsCaps DDSCAPS +ends + +; SetCooperativeLevel flags + +DDSCL_FULLSCREEN = 000000001h +DDSCL_ALLOWREBOOT = 000000002h +DDSCL_NOWINDOWCHANGES = 000000004h +DDSCL_NORMAL = 000000008h +DDSCL_EXCLUSIVE = 000000010h +DDSCL_ALLOWMODEX = 000000040h + +; Blt flags + +DDBLT_ALPHADEST = 000000001h +DDBLT_ALPHADESTCONSTOVERRIDE = 000000002h +DDBLT_ALPHADESTNEG = 000000004h +DDBLT_ALPHADESTSURFACEOVERRIDE = 000000008h +DDBLT_ALPHAEDGEBLEND = 000000010h +DDBLT_ALPHASRC = 000000020h +DDBLT_ALPHASRCCONSTOVERRIDE = 000000040h +DDBLT_ALPHASRCNEG = 000000080h +DDBLT_ALPHASRCSURFACEOVERRIDE = 000000100h +DDBLT_ASYNC = 000000200h +DDBLT_COLORFILL = 000000400h +DDBLT_DDFX = 000000800h +DDBLT_DDROPS = 000001000h +DDBLT_KEYDEST = 000002000h +DDBLT_KEYDESTOVERRIDE = 000004000h +DDBLT_KEYSRC = 000008000h +DDBLT_KEYSRCOVERRIDE = 000010000h +DDBLT_ROP = 000020000h +DDBLT_ROTATIONANGLE = 000040000h +DDBLT_ZBUFFER = 000080000h +DDBLT_ZBUFFERDESTCONSTOVERRIDE = 000100000h +DDBLT_ZBUFFERDESTOVERRIDE = 000200000h +DDBLT_ZBUFFERSRCCONSTOVERRIDE = 000400000h +DDBLT_ZBUFFERSRCOVERRIDE = 000800000h +DDBLT_WAIT = 001000000h +DDBLT_DEPTHFILL = 002000000h + +; BltFast flags + +DDBLTFAST_NOCOLORKEY = 000000000h +DDBLTFAST_SRCCOLORKEY = 000000001h +DDBLTFAST_DESTCOLORKEY = 000000002h +DDBLTFAST_WAIT = 000000010h + +; Flip flags + +DDFLIP_WAIT = 000000001h +DDFLIP_EVEN = 000000002h +DDFLIP_ODD = 000000004h + +; DDSURFACEDESC field flags + +DDSD_CAPS = 000000001h +DDSD_HEIGHT = 000000002h +DDSD_WIDTH = 000000004h +DDSD_PITCH = 000000008h +DDSD_BACKBUFFERCOUNT = 000000020h +DDSD_ZBUFFERBITDEPTH = 000000040h +DDSD_ALPHABITDEPTH = 000000080h +DDSD_LPSURFACE = 000000800h +DDSD_PIXELFORMAT = 000001000h +DDSD_CKDESTOVERLAY = 000002000h +DDSD_CKDESTBLT = 000004000h +DDSD_CKSRCOVERLAY = 000008000h +DDSD_CKSRCBLT = 000010000h +DDSD_MIPMAPCOUNT = 000020000h +DDSD_REFRESHRATE = 000040000h +DDSD_LINEARSIZE = 000080000h +DDSD_ALL = 0000FF9EEh + +; DirectDrawSurface capability flags + +DDSCAPS_RESERVED1 = 000000001h +DDSCAPS_ALPHA = 000000002h +DDSCAPS_BACKBUFFER = 000000004h +DDSCAPS_COMPLEX = 000000008h +DDSCAPS_FLIP = 000000010h +DDSCAPS_FRONTBUFFER = 000000020h +DDSCAPS_OFFSCREENPLAIN = 000000040h +DDSCAPS_OVERLAY = 000000080h +DDSCAPS_PALETTE = 000000100h +DDSCAPS_PRIMARYSURFACE = 000000200h +DDSCAPS_PRIMARYSURFACELEFT = 000000400h +DDSCAPS_SYSTEMMEMORY = 000000800h +DDSCAPS_TEXTURE = 000001000h +DDSCAPS_3DDEVICE = 000002000h +DDSCAPS_VIDEOMEMORY = 000004000h +DDSCAPS_VISIBLE = 000008000h +DDSCAPS_WRITEONLY = 000010000h +DDSCAPS_ZBUFFER = 000020000h +DDSCAPS_OWNDC = 000040000h +DDSCAPS_LIVEVIDEO = 000080000h +DDSCAPS_HWCODEC = 000100000h +DDSCAPS_MODEX = 000200000h +DDSCAPS_MIPMAP = 000400000h +DDSCAPS_RESERVED2 = 000800000h +DDSCAPS_ALLOCONLOAD = 004000000h +DDSCAPS_VIDEOPORT = 008000000h +DDSCAPS_LOCALVIDMEM = 010000000h +DDSCAPS_NONLOCALVIDMEM = 020000000h +DDSCAPS_STANDARDVGAMODE = 040000000h +DDSCAPS_OPTIMIZED = 080000000h + +; DirectDrawSurface lock flags + +DDLOCK_SURFACEMEMORYPTR = 000000000h +DDLOCK_WAIT = 000000001h +DDLOCK_EVENT = 000000002h +DDLOCK_READONLY = 000000010h +DDLOCK_WRITEONLY = 000000020h +DDLOCK_NOSYSLOCK = 000000800h + +; DirectDrawPalette capabilities + +DDPCAPS_4BIT = 000000001h +DDPCAPS_8BITENTRIES = 000000002h +DDPCAPS_8BIT = 000000004h +DDPCAPS_INITIALIZE = 000000008h +DDPCAPS_PRIMARYSURFACE = 000000010h +DDPCAPS_PRIMARYSURFACELEFT = 000000020h +DDPCAPS_ALLOW256 = 000000040h +DDPCAPS_VSYNC = 000000080h +DDPCAPS_1BIT = 000000100h +DDPCAPS_2BIT = 000000200h + +; DirectDraw errors + +DDERR_ALREADYINITIALIZED = 088760000h+5 +DDERR_CANNOTATTACHSURFACE = 088760000h+10 +DDERR_CANNOTDETACHSURFACE = 088760000h+20 +DDERR_CURRENTLYNOTAVAIL = 088760000h+40 +DDERR_EXCEPTION = 088760000h+55 +DDERR_HEIGHTALIGN = 088760000h+90 +DDERR_INCOMPATIBLEPRIMARY = 088760000h+95 +DDERR_INVALIDCAPS = 088760000h+100 +DDERR_INVALIDCLIPLIST = 088760000h+110 +DDERR_INVALIDMODE = 088760000h+120 +DDERR_INVALIDOBJECT = 088760000h+130 +DDERR_INVALIDPIXELFORMAT = 088760000h+145 +DDERR_INVALIDRECT = 088760000h+150 +DDERR_LOCKEDSURFACES = 088760000h+160 +DDERR_NO3D = 088760000h+170 +DDERR_NOALPHAHW = 088760000h+180 +DDERR_NOCLIPLIST = 088760000h+205 +DDERR_NOCOLORCONVHW = 088760000h+210 +DDERR_NOCOOPERATIVELEVELSET = 088760000h+212 +DDERR_NOCOLORKEY = 088760000h+215 +DDERR_NOCOLORKEYHW = 088760000h+220 +DDERR_NODIRECTDRAWSUPPORT = 088760000h+222 +DDERR_NOEXCLUSIVEMODE = 088760000h+225 +DDERR_NOFLIPHW = 088760000h+230 +DDERR_NOGDI = 088760000h+240 +DDERR_NOMIRRORHW = 088760000h+250 +DDERR_NOTFOUND = 088760000h+255 +DDERR_NOOVERLAYHW = 088760000h+260 +DDERR_NORASTEROPHW = 088760000h+280 +DDERR_NOROTATIONHW = 088760000h+290 +DDERR_NOSTRETCHHW = 088760000h+310 +DDERR_NOT4BITCOLOR = 088760000h+316 +DDERR_NOT4BITCOLORINDEX = 088760000h+317 +DDERR_NOT8BITCOLOR = 088760000h+320 +DDERR_NOTEXTUREHW = 088760000h+330 +DDERR_NOVSYNCHW = 088760000h+335 +DDERR_NOZBUFFERHW = 088760000h+340 +DDERR_NOZOVERLAYHW = 088760000h+350 +DDERR_OUTOFCAPS = 088760000h+360 +DDERR_OUTOFVIDEOMEMORY = 088760000h+380 +DDERR_OVERLAYCANTCLIP = 088760000h+382 +DDERR_OVERLAYCOLORKEYONLYONEACTI = 088760000h+384 +DDERR_PALETTEBUSY = 088760000h+387 +DDERR_COLORKEYNOTSET = 088760000h+400 +DDERR_SURFACEALREADYATTACHED = 088760000h+410 +DDERR_SURFACEALREADYDEPENDENT = 088760000h+420 +DDERR_SURFACEBUSY = 088760000h+430 +DDERR_CANTLOCKSURFACE = 088760000h+435 +DDERR_SURFACEISOBSCURED = 088760000h+440 +DDERR_SURFACELOST = 088760000h+450 +DDERR_SURFACENOTATTACHED = 088760000h+460 +DDERR_TOOBIGHEIGHT = 088760000h+470 +DDERR_TOOBIGSIZE = 088760000h+480 +DDERR_TOOBIGWIDTH = 088760000h+490 +DDERR_UNSUPPORTEDFORMAT = 088760000h+510 +DDERR_UNSUPPORTEDMASK = 088760000h+520 +DDERR_VERTICALBLANKINPROGRESS = 088760000h+537 +DDERR_WASSTILLDRAWING = 088760000h+540 +DDERR_XALIGN = 088760000h+560 +DDERR_INVALIDDIRECTDRAWGUID = 088760000h+561 +DDERR_DIRECTDRAWALREADYCREATED = 088760000h+562 +DDERR_NODIRECTDRAWHW = 088760000h+563 +DDERR_PRIMARYSURFACEALREADYEXIST = 088760000h+564 +DDERR_NOEMULATION = 088760000h+565 +DDERR_REGIONTOOSMALL = 088760000h+566 +DDERR_CLIPPERISUSINGHWND = 088760000h+567 +DDERR_NOCLIPPERATTACHED = 088760000h+568 +DDERR_NOHWND = 088760000h+569 +DDERR_HWNDSUBCLASSED = 088760000h+570 +DDERR_HWNDALREADYSET = 088760000h+571 +DDERR_NOPALETTEATTACHED = 088760000h+572 +DDERR_NOPALETTEHW = 088760000h+573 +DDERR_BLTFASTCANTCLIP = 088760000h+574 +DDERR_NOBLTHW = 088760000h+575 +DDERR_NODDROPSHW = 088760000h+576 +DDERR_OVERLAYNOTVISIBLE = 088760000h+577 +DDERR_NOOVERLAYDEST = 088760000h+578 +DDERR_INVALIDPOSITION = 088760000h+579 +DDERR_NOTAOVERLAYSURFACE = 088760000h+580 +DDERR_EXCLUSIVEMODEALREADYSET = 088760000h+581 +DDERR_NOTFLIPPABLE = 088760000h+582 +DDERR_CANTDUPLICATE = 088760000h+583 +DDERR_NOTLOCKED = 088760000h+584 +DDERR_CANTCREATEDC = 088760000h+585 +DDERR_NODC = 088760000h+586 +DDERR_WRONGMODE = 088760000h+587 +DDERR_IMPLICITLYCREATED = 088760000h+588 +DDERR_NOTPALETTIZED = 088760000h+589 +DDERR_UNSUPPORTEDMODE = 088760000h+590 +DDERR_NOMIPMAPHW = 088760000h+591 +DDERR_INVALIDSURFACETYPE = 088760000h+592 +DDERR_NOOPTIMIZEHW = 088760000h+600 +DDERR_NOTLOADED = 088760000h+601 +DDERR_DCALREADYCREATED = 088760000h+620 +DDERR_NONONLOCALVIDMEM = 088760000h+630 +DDERR_CANTPAGELOCK = 088760000h+640 +DDERR_CANTPAGEUNLOCK = 088760000h+660 +DDERR_NOTPAGELOCKED = 088760000h+680 +DDERR_MOREDATA = 088760000h+690 +DDERR_VIDEONOTACTIVE = 088760000h+695 +DDERR_DEVICEDOESNTOWNSURFACE = 088760000h+699 diff --git a/fasmw172/EXAMPLES/DDRAW/GIF87A.INC b/fasmw172/EXAMPLES/DDRAW/GIF87A.INC new file mode 100644 index 0000000..2180b9b --- /dev/null +++ b/fasmw172/EXAMPLES/DDRAW/GIF87A.INC @@ -0,0 +1,194 @@ + +virtual at buffer + GIFHEADER: + .ID dd ? + .ver dw ? + .width dw ? + .height dw ? + .bits db ? + .background db ? + .reserved db ? + .length = $ - GIFHEADER +end virtual + +load_picture: + + invoke CreateFileA,esi,GENERIC_READ,0,0,OPEN_EXISTING,0,0 + mov edi,eax + invoke ReadFile,edi,GIFHEADER,40000h,bytes_count,0 + invoke CloseHandle,edi + + cmp [GIFHEADER.ID],'GIF8' + jne picture_error + cmp [GIFHEADER.ver],'7a' + jne picture_error + + mov al,[GIFHEADER.bits] + and al,10000111b + cmp al,10000111b + jne picture_error + + add [bytes_count],buffer + + mov esi,buffer+GIFHEADER.length+256*3 + mov edi,esi + + xor eax,eax + find_image: + cmp esi,[bytes_count] + jae picture_error + lodsb + cmp al,',' + je image_found + cmp al,'!' + jne picture_error + inc esi + skip_application_data: + lodsb + add esi,eax + or al,al + jnz skip_application_data + jmp find_image + image_found: + add esi,4 + xor eax,eax + lodsw + mov ebx,eax + lodsw + inc esi + cmp byte [esi],8 + jne picture_error + inc esi + + mov [ddsd.dwSize],sizeof.DDSURFACEDESC + mov [ddsd.dwFlags],DDSD_CAPS+DDSD_WIDTH+DDSD_HEIGHT+DDSD_CKSRCBLT + mov [ddsd.ddsCaps.dwCaps],DDSCAPS_OFFSCREENPLAIN+DDSCAPS_SYSTEMMEMORY + mov [ddsd.dwWidth],ebx + mov [ddsd.dwHeight],eax + movzx eax,[GIFHEADER.background] + mov [ddsd.ddckCKSrcBlt.dwColorSpaceLowValue],eax + mov [ddsd.ddckCKSrcBlt.dwColorSpaceHighValue],eax + cominvk DDraw,CreateSurface,\ + ddsd,DDSPicture,0 + or eax,eax + jnz picture_error + cominvk DDSPicture,Lock,\ + 0,ddsd,DDLOCK_WAIT,0 + + mov edi,esi + mov edx,esi + mov ebx,buffer + add ebx,[bytes_count] + link_streams: + cmp esi,[bytes_count] + jae picture_error + lodsb + movzx ecx,al + rep movsb + or al,al + jnz link_streams + + mov edi,[ddsd.lpSurface] + mov ebx,edx + mov [LZW_bits],0 + LZW_clear: + xor edx,edx + LZW_decompress_loop: + mov ch,9 + cmp edx,(100h-2)*8 + jbe LZW_read_bits + mov ch,10 + cmp edx,(300h-2)*8 + jbe LZW_read_bits + mov ch,11 + cmp edx,(700h-2)*8 + jbe LZW_read_bits + mov ch,12 + LZW_read_bits: + mov cl,[LZW_bits] + mov eax,[ebx] + shr eax,cl + xchg cl,ch + mov esi,1 + shl esi,cl + dec esi + and eax,esi + add cl,ch + LZW_read_bits_count: + cmp cl,8 + jbe LZW_read_bits_ok + sub cl,8 + inc ebx + jmp LZW_read_bits_count + LZW_read_bits_ok: + mov [LZW_bits],cl + cmp eax,100h + jb LZW_single_byte + je LZW_clear + sub eax,102h + jc LZW_end + shl eax,3 + cmp eax,edx + ja picture_error + mov ecx,[LZW_table+eax] + mov esi,[LZW_table+eax+4] + mov [LZW_table+edx+4],edi + rep movsb + mov eax,[LZW_table+eax] + inc eax + mov [LZW_table+edx],eax + jmp LZW_decompress_next + LZW_single_byte: + mov [LZW_table+edx],2 + mov [LZW_table+edx+4],edi + stosb + LZW_decompress_next: + add edx,8 + jmp LZW_decompress_loop + LZW_end: + + cominvk DDSPicture,Unlock,0 + + mov eax,[DDSPicture] + clc + ret + + picture_error: + stc + ret + +load_palette: + + invoke CreateFileA,esi,GENERIC_READ,0,0,OPEN_EXISTING,0,0 + mov edi,eax + invoke ReadFile,edi,buffer,GIFHEADER.length+256*3,bytes_count,0 + cmp [bytes_count],GIFHEADER.length+256*3 + jne picture_error + invoke CloseHandle,edi + + cmp [GIFHEADER.ID],'GIF8' + jne picture_error + cmp [GIFHEADER.ver],'7a' + jne picture_error + mov al,[GIFHEADER.bits] + and al,111b + cmp al,111b + jne picture_error + + mov esi,buffer+GIFHEADER.length + mov edi,buffer+400h + mov ecx,256 + convert_palette: + movsw + movsb + xor al,al + stosb + loop convert_palette + + cominvk DDraw,CreatePalette,\ + DDPCAPS_8BIT+DDPCAPS_ALLOW256,buffer+400h,DDPalette,0 + or eax,eax + jnz picture_error + + clc + ret diff --git a/fasmw172/EXAMPLES/DIALOG/DIALOG.ASM b/fasmw172/EXAMPLES/DIALOG/DIALOG.ASM new file mode 100644 index 0000000..b7c8199 --- /dev/null +++ b/fasmw172/EXAMPLES/DIALOG/DIALOG.ASM @@ -0,0 +1,130 @@ + +; DialogBox example + +format PE GUI 4.0 +entry start + +include 'win32a.inc' + +ID_CAPTION = 101 +ID_MESSAGE = 102 +ID_ICONERROR = 201 +ID_ICONINFORMATION = 202 +ID_ICONQUESTION = 203 +ID_ICONWARNING = 204 +ID_TOPMOST = 301 + +section '.text' code readable executable + + start: + + invoke GetModuleHandle,0 + invoke DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0 + or eax,eax + jz exit + invoke MessageBox,HWND_DESKTOP,message,caption,[flags] + exit: + invoke ExitProcess,0 + +proc DialogProc hwnddlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .wminitdialog + cmp [msg],WM_COMMAND + je .wmcommand + cmp [msg],WM_CLOSE + je .wmclose + xor eax,eax + jmp .finish + .wminitdialog: + invoke CheckRadioButton,[hwnddlg],ID_ICONERROR,ID_ICONWARNING,ID_ICONINFORMATION + jmp .processed + .wmcommand: + cmp [wparam],BN_CLICKED shl 16 + IDCANCEL + je .wmclose + cmp [wparam],BN_CLICKED shl 16 + IDOK + jne .processed + invoke GetDlgItemText,[hwnddlg],ID_CAPTION,caption,40h + invoke GetDlgItemText,[hwnddlg],ID_MESSAGE,message,100h + mov [flags],MB_OK + invoke IsDlgButtonChecked,[hwnddlg],ID_ICONERROR + cmp eax,BST_CHECKED + jne .iconerror_ok + or [flags],MB_ICONERROR + .iconerror_ok: + invoke IsDlgButtonChecked,[hwnddlg],ID_ICONINFORMATION + cmp eax,BST_CHECKED + jne .iconinformation_ok + or [flags],MB_ICONINFORMATION + .iconinformation_ok: + invoke IsDlgButtonChecked,[hwnddlg],ID_ICONQUESTION + cmp eax,BST_CHECKED + jne .iconquestion_ok + or [flags],MB_ICONQUESTION + .iconquestion_ok: + invoke IsDlgButtonChecked,[hwnddlg],ID_ICONWARNING + cmp eax,BST_CHECKED + jne .iconwarning_ok + or [flags],MB_ICONWARNING + .iconwarning_ok: + invoke IsDlgButtonChecked,[hwnddlg],ID_TOPMOST + cmp eax,BST_CHECKED + jne .topmost_ok + or [flags],MB_TOPMOST + .topmost_ok: + invoke EndDialog,[hwnddlg],1 + jmp .processed + .wmclose: + invoke EndDialog,[hwnddlg],0 + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +section '.bss' readable writeable + + flags dd ? + caption rb 40h + message rb 100h + +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL' + + import kernel,\ + GetModuleHandle,'GetModuleHandleA',\ + ExitProcess,'ExitProcess' + + import user,\ + DialogBoxParam,'DialogBoxParamA',\ + CheckRadioButton,'CheckRadioButton',\ + GetDlgItemText,'GetDlgItemTextA',\ + IsDlgButtonChecked,'IsDlgButtonChecked',\ + MessageBox,'MessageBoxA',\ + EndDialog,'EndDialog' + +section '.rsrc' resource data readable + + directory RT_DIALOG,dialogs + + resource dialogs,\ + 37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration + + dialog demonstration,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC','&Caption:',-1,10,10,70,8,WS_VISIBLE + dialogitem 'EDIT','',ID_CAPTION,10,20,170,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP + dialogitem 'STATIC','&Message:',-1,10,40,70,8,WS_VISIBLE + dialogitem 'EDIT','',ID_MESSAGE,10,50,170,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL + dialogitem 'BUTTON','&Icon',-1,10,70,80,70,WS_VISIBLE+BS_GROUPBOX + dialogitem 'BUTTON','&Error',ID_ICONERROR,20,82,60,13,WS_VISIBLE+BS_AUTORADIOBUTTON+WS_TABSTOP+WS_GROUP + dialogitem 'BUTTON','I&nformation',ID_ICONINFORMATION,20,95,60,13,WS_VISIBLE+BS_AUTORADIOBUTTON + dialogitem 'BUTTON','&Question',ID_ICONQUESTION,20,108,60,13,WS_VISIBLE+BS_AUTORADIOBUTTON + dialogitem 'BUTTON','&Warning',ID_ICONWARNING,20,121,60,13,WS_VISIBLE+BS_AUTORADIOBUTTON + dialogitem 'BUTTON','&Style',-1,100,70,80,70,WS_VISIBLE+BS_GROUPBOX + dialogitem 'BUTTON','&Top most',ID_TOPMOST,110,82,60,13,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','OK',IDOK,85,150,45,15,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'BUTTON','C&ancel',IDCANCEL,135,150,45,15,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog diff --git a/fasmw172/EXAMPLES/DLL/ERRORMSG.ASM b/fasmw172/EXAMPLES/DLL/ERRORMSG.ASM new file mode 100644 index 0000000..cdaec8e --- /dev/null +++ b/fasmw172/EXAMPLES/DLL/ERRORMSG.ASM @@ -0,0 +1,55 @@ + +; DLL creation example + +format PE GUI 4.0 DLL +entry DllEntryPoint + +include 'win32a.inc' + +section '.text' code readable executable + +proc DllEntryPoint hinstDLL,fdwReason,lpvReserved + mov eax,TRUE + ret +endp + +; VOID ShowErrorMessage(HWND hWnd,DWORD dwError); + +proc ShowErrorMessage hWnd,dwError + local lpBuffer:DWORD + lea eax,[lpBuffer] + invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0 + invoke MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK + invoke LocalFree,[lpBuffer] + ret +endp + +; VOID ShowLastError(HWND hWnd); + +proc ShowLastError hWnd + invoke GetLastError + stdcall ShowErrorMessage,[hWnd],eax + ret +endp + +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL' + + import kernel,\ + GetLastError,'GetLastError',\ + SetLastError,'SetLastError',\ + FormatMessage,'FormatMessageA',\ + LocalFree,'LocalFree' + + import user,\ + MessageBox,'MessageBoxA' + +section '.edata' export data readable + + export 'ERRORMSG.DLL',\ + ShowErrorMessage,'ShowErrorMessage',\ + ShowLastError,'ShowLastError' + +section '.reloc' fixups data readable discardable diff --git a/fasmw172/EXAMPLES/DLL/LASTERR.ASM b/fasmw172/EXAMPLES/DLL/LASTERR.ASM new file mode 100644 index 0000000..5ada46c --- /dev/null +++ b/fasmw172/EXAMPLES/DLL/LASTERR.ASM @@ -0,0 +1,24 @@ + +format PE GUI 4.0 +entry start + +include 'win32a.inc' + +section '.text' code readable executable + + start: + invoke SetLastError,0 + invoke ShowLastError,HWND_DESKTOP + invoke ExitProcess,0 + +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + errormsg,'ERRORMSG.DLL' + + import kernel,\ + SetLastError,'SetLastError',\ + ExitProcess,'ExitProcess' + + import errormsg,\ + ShowLastError,'ShowLastError' diff --git a/fasmw172/EXAMPLES/HELLO/HELLO.ASM b/fasmw172/EXAMPLES/HELLO/HELLO.ASM new file mode 100644 index 0000000..8d51683 --- /dev/null +++ b/fasmw172/EXAMPLES/HELLO/HELLO.ASM @@ -0,0 +1,12 @@ + +; example of simplified Windows programming using complex macro features + +include 'win32ax.inc' ; you can simply switch between win32ax, win32wx, win64ax and win64wx here + +.code + + start: + invoke MessageBox,HWND_DESKTOP,"Hi! I'm the example program!",invoke GetCommandLine,MB_OK + invoke ExitProcess,0 + +.end start diff --git a/fasmw172/EXAMPLES/MINIPAD/MINIPAD.ASM b/fasmw172/EXAMPLES/MINIPAD/MINIPAD.ASM new file mode 100644 index 0000000..72a89d4 --- /dev/null +++ b/fasmw172/EXAMPLES/MINIPAD/MINIPAD.ASM @@ -0,0 +1,206 @@ + +; Simple text editor - fasm example program + +format PE GUI 4.0 +entry start + +include 'win32a.inc' + +IDR_ICON = 17 +IDR_MENU = 37 + +IDM_NEW = 101 +IDM_EXIT = 102 +IDM_ABOUT = 901 + +section '.text' code readable executable + + start: + + invoke GetModuleHandle,0 + mov [wc.hInstance],eax + + invoke LoadIcon,eax,IDR_ICON + mov [wc.hIcon],eax + invoke LoadCursor,0,IDC_ARROW + mov [wc.hCursor],eax + invoke RegisterClass,wc + test eax,eax + jz error + + invoke LoadMenu,[wc.hInstance],IDR_MENU + invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_OVERLAPPEDWINDOW,144,128,256,256,NULL,eax,[wc.hInstance],NULL + test eax,eax + jz error + + msg_loop: + invoke GetMessage,msg,NULL,0,0 + cmp eax,1 + jb end_loop + jne msg_loop + invoke TranslateMessage,msg + invoke DispatchMessage,msg + jmp msg_loop + + error: + invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK + + end_loop: + invoke ExitProcess,[msg.wParam] + +proc WindowProc hwnd,wmsg,wparam,lparam + push ebx esi edi + mov eax,[wmsg] + cmp eax,WM_CREATE + je .wmcreate + cmp eax,WM_SIZE + je .wmsize + cmp eax,WM_SETFOCUS + je .wmsetfocus + cmp eax,WM_COMMAND + je .wmcommand + cmp eax,WM_DESTROY + je .wmdestroy + .defwndproc: + invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] + jmp .finish + .wmcreate: + invoke GetClientRect,[hwnd],client + invoke CreateWindowEx,WS_EX_CLIENTEDGE,_edit,0,WS_VISIBLE+WS_CHILD+WS_HSCROLL+WS_VSCROLL+ES_AUTOHSCROLL+ES_AUTOVSCROLL+ES_MULTILINE,[client.left],[client.top],[client.right],[client.bottom],[hwnd],0,[wc.hInstance],NULL + or eax,eax + jz .failed + mov [edithwnd],eax + invoke CreateFont,16,0,0,0,0,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_RASTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH+FF_DONTCARE,NULL + or eax,eax + jz .failed + mov [editfont],eax + invoke SendMessage,[edithwnd],WM_SETFONT,eax,FALSE + xor eax,eax + jmp .finish + .failed: + or eax,-1 + jmp .finish + .wmsize: + invoke GetClientRect,[hwnd],client + invoke MoveWindow,[edithwnd],[client.left],[client.top],[client.right],[client.bottom],TRUE + xor eax,eax + jmp .finish + .wmsetfocus: + invoke SetFocus,[edithwnd] + xor eax,eax + jmp .finish + .wmcommand: + mov eax,[wparam] + and eax,0FFFFh + cmp eax,IDM_NEW + je .new + cmp eax,IDM_ABOUT + je .about + cmp eax,IDM_EXIT + je .wmdestroy + jmp .defwndproc + .new: + invoke SendMessage,[edithwnd],WM_SETTEXT,0,0 + jmp .finish + .about: + invoke MessageBox,[hwnd],_about_text,_about_title,MB_OK + jmp .finish + .wmdestroy: + invoke DeleteObject,[editfont] + invoke PostQuitMessage,0 + xor eax,eax + .finish: + pop edi esi ebx + ret +endp + +section '.data' data readable writeable + + _title TCHAR 'MiniPad',0 + _about_title TCHAR 'About MiniPad',0 + _about_text TCHAR 'This is Win32 example program created with flat assembler.',0 + _error TCHAR 'Startup failed.',0 + + _class TCHAR 'MINIPAD32',0 + _edit TCHAR 'EDIT',0 + + wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class + + edithwnd dd ? + editfont dd ? + + msg MSG + client RECT + +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL',\ + gdi,'GDI32.DLL' + + import kernel,\ + GetModuleHandle,'GetModuleHandleA',\ + ExitProcess,'ExitProcess' + + import user,\ + RegisterClass,'RegisterClassA',\ + CreateWindowEx,'CreateWindowExA',\ + DefWindowProc,'DefWindowProcA',\ + SetWindowLong,'SetWindowLongA',\ + RedrawWindow,'RedrawWindow',\ + GetMessage,'GetMessageA',\ + TranslateMessage,'TranslateMessage',\ + DispatchMessage,'DispatchMessageA',\ + SendMessage,'SendMessageA',\ + LoadCursor,'LoadCursorA',\ + LoadIcon,'LoadIconA',\ + LoadMenu,'LoadMenuA',\ + GetClientRect,'GetClientRect',\ + MoveWindow,'MoveWindow',\ + SetFocus,'SetFocus',\ + MessageBox,'MessageBoxA',\ + PostQuitMessage,'PostQuitMessage' + + import gdi,\ + CreateFont,'CreateFontA',\ + DeleteObject,'DeleteObject' + +section '.rsrc' resource data readable + + ; resource directory + + directory RT_MENU,menus,\ + RT_ICON,icons,\ + RT_GROUP_ICON,group_icons,\ + RT_VERSION,versions + + ; resource subdirectories + + resource menus,\ + IDR_MENU,LANG_ENGLISH+SUBLANG_DEFAULT,main_menu + + resource icons,\ + 1,LANG_NEUTRAL,icon_data + + resource group_icons,\ + IDR_ICON,LANG_NEUTRAL,main_icon + + resource versions,\ + 1,LANG_NEUTRAL,version + + menu main_menu + menuitem '&File',0,MFR_POPUP + menuitem '&New',IDM_NEW + menuseparator + menuitem 'E&xit',IDM_EXIT,MFR_END + menuitem '&Help',0,MFR_POPUP + MFR_END + menuitem '&About...',IDM_ABOUT,MFR_END + + icon main_icon,icon_data,'minipad.ico' + + versioninfo version,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,\ + 'FileDescription','MiniPad - example program',\ + 'LegalCopyright','No rights reserved.',\ + 'FileVersion','1.0',\ + 'ProductVersion','1.0',\ + 'OriginalFilename','MINIPAD.EXE' diff --git a/fasmw172/EXAMPLES/MINIPAD/MINIPAD.ICO b/fasmw172/EXAMPLES/MINIPAD/MINIPAD.ICO new file mode 100644 index 0000000..ef8e482 Binary files /dev/null and b/fasmw172/EXAMPLES/MINIPAD/MINIPAD.ICO differ diff --git a/fasmw172/EXAMPLES/MSCOFF/MSCOFF.ASM b/fasmw172/EXAMPLES/MSCOFF/MSCOFF.ASM new file mode 100644 index 0000000..b7810fb --- /dev/null +++ b/fasmw172/EXAMPLES/MSCOFF/MSCOFF.ASM @@ -0,0 +1,23 @@ + +; example of making Win32 COFF object file + +format MS COFF + +extrn '__imp__MessageBoxA@16' as MessageBox:dword + +section '.text' code readable executable + + public _demo + + _demo: + push 0 + push _caption + push _message + push 0 + call [MessageBox] + ret + +section '.data' data readable writeable + + _caption db 'Win32 assembly',0 + _message db 'Coffee time!',0 diff --git a/fasmw172/EXAMPLES/MSCOFF/MSCOFF.OBJ b/fasmw172/EXAMPLES/MSCOFF/MSCOFF.OBJ new file mode 100644 index 0000000..1a75e59 Binary files /dev/null and b/fasmw172/EXAMPLES/MSCOFF/MSCOFF.OBJ differ diff --git a/fasmw172/EXAMPLES/OPENGL/OPENGL.ASM b/fasmw172/EXAMPLES/OPENGL/OPENGL.ASM new file mode 100644 index 0000000..0f9f298 --- /dev/null +++ b/fasmw172/EXAMPLES/OPENGL/OPENGL.ASM @@ -0,0 +1,614 @@ + +; OpenGL programming example + +format PE GUI 4.0 +entry start + +include 'win32a.inc' + +include 'opengl.inc' + +section '.text' code readable executable + + start: + + invoke GetModuleHandle,0 + mov [wc.hInstance],eax + invoke LoadIcon,0,IDI_APPLICATION + mov [wc.hIcon],eax + invoke LoadCursor,0,IDC_ARROW + mov [wc.hCursor],eax + invoke RegisterClass,wc + invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS,16,16,432,432,NULL,NULL,[wc.hInstance],NULL + mov [hwnd],eax + + msg_loop: + invoke GetMessage,msg,NULL,0,0 + or eax,eax + jz end_loop + invoke TranslateMessage,msg + invoke DispatchMessage,msg + jmp msg_loop + + end_loop: + invoke ExitProcess,[msg.wParam] + +proc WindowProc hwnd,wmsg,wparam,lparam + push ebx esi edi + cmp [wmsg],WM_CREATE + je .wmcreate + cmp [wmsg],WM_SIZE + je .wmsize + cmp [wmsg],WM_PAINT + je .wmpaint + cmp [wmsg],WM_KEYDOWN + je .wmkeydown + cmp [wmsg],WM_DESTROY + je .wmdestroy + .defwndproc: + invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] + jmp .finish + .wmcreate: + invoke GetDC,[hwnd] + mov [hdc],eax + mov edi,pfd + mov ecx,sizeof.PIXELFORMATDESCRIPTOR shr 2 + xor eax,eax + rep stosd + mov [pfd.nSize],sizeof.PIXELFORMATDESCRIPTOR + mov [pfd.nVersion],1 + mov [pfd.dwFlags],PFD_SUPPORT_OPENGL+PFD_DOUBLEBUFFER+PFD_DRAW_TO_WINDOW + mov [pfd.iLayerType],PFD_MAIN_PLANE + mov [pfd.iPixelType],PFD_TYPE_RGBA + mov [pfd.cColorBits],16 + mov [pfd.cDepthBits],16 + mov [pfd.cAccumBits],0 + mov [pfd.cStencilBits],0 + invoke ChoosePixelFormat,[hdc],pfd + invoke SetPixelFormat,[hdc],eax,pfd + invoke wglCreateContext,[hdc] + mov [hrc],eax + invoke wglMakeCurrent,[hdc],[hrc] + invoke GetClientRect,[hwnd],rc + invoke glViewport,0,0,[rc.right],[rc.bottom] + invoke GetTickCount + mov [clock],eax + xor eax,eax + jmp .finish + .wmsize: + invoke GetClientRect,[hwnd],rc + invoke glViewport,0,0,[rc.right],[rc.bottom] + xor eax,eax + jmp .finish + .wmpaint: + invoke GetTickCount + sub eax,[clock] + cmp eax,10 + jb .animation_ok + add [clock],eax + invoke glRotatef,[theta],0.0,0.0,1.0 + .animation_ok: + invoke glClear,GL_COLOR_BUFFER_BIT + invoke glBegin,GL_QUADS + invoke glColor3f,1.0,0.1,0.1 + invoke glVertex3f,-0.6,-0.6,0.0 + invoke glColor3f,0.1,0.1,0.1 + invoke glVertex3f,0.6,-0.6,0.0 + invoke glColor3f,0.1,0.1,1.0 + invoke glVertex3f,0.6,0.6,0.0 + invoke glColor3f,1.0,0.1,1.0 + invoke glVertex3f,-0.6,0.6,0.0 + invoke glEnd + invoke SwapBuffers,[hdc] + xor eax,eax + jmp .finish + .wmkeydown: + cmp [wparam],VK_ESCAPE + jne .defwndproc + .wmdestroy: + invoke wglMakeCurrent,0,0 + invoke wglDeleteContext,[hrc] + invoke ReleaseDC,[hwnd],[hdc] + invoke PostQuitMessage,0 + xor eax,eax + .finish: + pop edi esi ebx + ret +endp + +section '.data' data readable writeable + + _title db 'OpenGL example',0 + _class db 'FASMOPENGL32',0 + + theta GLfloat 0.6 + + wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,NULL,NULL,_class + + hwnd dd ? + hdc dd ? + hrc dd ? + + msg MSG + rc RECT + pfd PIXELFORMATDESCRIPTOR + + clock dd ? + +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL',\ + gdi,'GDI32.DLL',\ + opengl,'OPENGL32.DLL',\ + glu,'GLU32.DLL' + + import kernel,\ + GetModuleHandle,'GetModuleHandleA',\ + GetTickCount,'GetTickCount',\ + ExitProcess,'ExitProcess' + + import user,\ + RegisterClass,'RegisterClassA',\ + CreateWindowEx,'CreateWindowExA',\ + DefWindowProc,'DefWindowProcA',\ + GetMessage,'GetMessageA',\ + TranslateMessage,'TranslateMessage',\ + DispatchMessage,'DispatchMessageA',\ + LoadCursor,'LoadCursorA',\ + LoadIcon,'LoadIconA',\ + GetClientRect,'GetClientRect',\ + GetDC,'GetDC',\ + ReleaseDC,'ReleaseDC',\ + PostQuitMessage,'PostQuitMessage' + + import gdi,\ + ChoosePixelFormat,'ChoosePixelFormat',\ + SetPixelFormat,'SetPixelFormat',\ + SwapBuffers,'SwapBuffers' + + import opengl,\ + glAccum,'glAccum',\ + glAlphaFunc,'glAlphaFunc',\ + glAreTexturesResident,'glAreTexturesResident',\ + glArrayElement,'glArrayElement',\ + glBegin,'glBegin',\ + glBindTexture,'glBindTexture',\ + glBitmap,'glBitmap',\ + glBlendFunc,'glBlendFunc',\ + glCallList,'glCallList',\ + glCallLists,'glCallLists',\ + glClear,'glClear',\ + glClearAccum,'glClearAccum',\ + glClearColor,'glClearColor',\ + glClearDepth,'glClearDepth',\ + glClearIndex,'glClearIndex',\ + glClearStencil,'glClearStencil',\ + glClipPlane,'glClipPlane',\ + glColor3b,'glColor3b',\ + glColor3bv,'glColor3bv',\ + glColor3d,'glColor3d',\ + glColor3dv,'glColor3dv',\ + glColor3f,'glColor3f',\ + glColor3fv,'glColor3fv',\ + glColor3i,'glColor3i',\ + glColor3iv,'glColor3iv',\ + glColor3s,'glColor3s',\ + glColor3sv,'glColor3sv',\ + glColor3ub,'glColor3ub',\ + glColor3ubv,'glColor3ubv',\ + glColor3ui,'glColor3ui',\ + glColor3uiv,'glColor3uiv',\ + glColor3us,'glColor3us',\ + glColor3usv,'glColor3usv',\ + glColor4b,'glColor4b',\ + glColor4bv,'glColor4bv',\ + glColor4d,'glColor4d',\ + glColor4dv,'glColor4dv',\ + glColor4f,'glColor4f',\ + glColor4fv,'glColor4fv',\ + glColor4i,'glColor4i',\ + glColor4iv,'glColor4iv',\ + glColor4s,'glColor4s',\ + glColor4sv,'glColor4sv',\ + glColor4ub,'glColor4ub',\ + glColor4ubv,'glColor4ubv',\ + glColor4ui,'glColor4ui',\ + glColor4uiv,'glColor4uiv',\ + glColor4us,'glColor4us',\ + glColor4usv,'glColor4usv',\ + glColorMask,'glColorMask',\ + glColorMaterial,'glColorMaterial',\ + glColorPointer,'glColorPointer',\ + glCopyPixels,'glCopyPixels',\ + glCopyTexImage1D,'glCopyTexImage1D',\ + glCopyTexImage2D,'glCopyTexImage2D',\ + glCopyTexSubImage1D,'glCopyTexSubImage1D',\ + glCopyTexSubImage2D,'glCopyTexSubImage2D',\ + glCullFace,'glCullFace',\ + glDeleteLists,'glDeleteLists',\ + glDeleteTextures,'glDeleteTextures',\ + glDepthFunc,'glDepthFunc',\ + glDepthMask,'glDepthMask',\ + glDepthRange,'glDepthRange',\ + glDisable,'glDisable',\ + glDisableClientState,'glDisableClientState',\ + glDrawArrays,'glDrawArrays',\ + glDrawBuffer,'glDrawBuffer',\ + glDrawElements,'glDrawElements',\ + glDrawPixels,'glDrawPixels',\ + glEdgeFlag,'glEdgeFlag',\ + glEdgeFlagPointer,'glEdgeFlagPointer',\ + glEdgeFlagv,'glEdgeFlagv',\ + glEnable,'glEnable',\ + glEnableClientState,'glEnableClientState',\ + glEnd,'glEnd',\ + glEndList,'glEndList',\ + glEvalCoord1d,'glEvalCoord1d',\ + glEvalCoord1dv,'glEvalCoord1dv',\ + glEvalCoord1f,'glEvalCoord1f',\ + glEvalCoord1fv,'glEvalCoord1fv',\ + glEvalCoord2d,'glEvalCoord2d',\ + glEvalCoord2dv,'glEvalCoord2dv',\ + glEvalCoord2f,'glEvalCoord2f',\ + glEvalCoord2fv,'glEvalCoord2fv',\ + glEvalMesh1,'glEvalMesh1',\ + glEvalMesh2,'glEvalMesh2',\ + glEvalPoint1,'glEvalPoint1',\ + glEvalPoint2,'glEvalPoint2',\ + glFeedbackBuffer,'glFeedbackBuffer',\ + glFinish,'glFinish',\ + glFlush,'glFlush',\ + glFogf,'glFogf',\ + glFogfv,'glFogfv',\ + glFogi,'glFogi',\ + glFogiv,'glFogiv',\ + glFrontFace,'glFrontFace',\ + glFrustum,'glFrustum',\ + glGenLists,'glGenLists',\ + glGenTextures,'glGenTextures',\ + glGetBooleanv,'glGetBooleanv',\ + glGetClipPlane,'glGetClipPlane',\ + glGetDoublev,'glGetDoublev',\ + glGetError,'glGetError',\ + glGetFloatv,'glGetFloatv',\ + glGetIntegerv,'glGetIntegerv',\ + glGetLightfv,'glGetLightfv',\ + glGetLightiv,'glGetLightiv',\ + glGetMapdv,'glGetMapdv',\ + glGetMapfv,'glGetMapfv',\ + glGetMapiv,'glGetMapiv',\ + glGetMaterialfv,'glGetMaterialfv',\ + glGetMaterialiv,'glGetMaterialiv',\ + glGetPixelMapfv,'glGetPixelMapfv',\ + glGetPixelMapuiv,'glGetPixelMapuiv',\ + glGetPixelMapusv,'glGetPixelMapusv',\ + glGetPointerv,'glGetPointerv',\ + glGetPolygonStipple,'glGetPolygonStipple',\ + glGetString,'glGetString',\ + glGetTexEnvfv,'glGetTexEnvfv',\ + glGetTexEnviv,'glGetTexEnviv',\ + glGetTexGendv,'glGetTexGendv',\ + glGetTexGenfv,'glGetTexGenfv',\ + glGetTexGeniv,'glGetTexGeniv',\ + glGetTexImage,'glGetTexImage',\ + glGetTexLevelParameterfv,'glGetTexLevelParameterfv',\ + glGetTexLevelParameteriv,'glGetTexLevelParameteriv',\ + glGetTexParameterfv,'glGetTexParameterfv',\ + glGetTexParameteriv,'glGetTexParameteriv',\ + glHint,'glHint',\ + glIndexMask,'glIndexMask',\ + glIndexPointer,'glIndexPointer',\ + glIndexd,'glIndexd',\ + glIndexdv,'glIndexdv',\ + glIndexf,'glIndexf',\ + glIndexfv,'glIndexfv',\ + glIndexi,'glIndexi',\ + glIndexiv,'glIndexiv',\ + glIndexs,'glIndexs',\ + glIndexsv,'glIndexsv',\ + glIndexub,'glIndexub',\ + glIndexubv,'glIndexubv',\ + glInitNames,'glInitNames',\ + glInterleavedArrays,'glInterleavedArrays',\ + glIsEnabled,'glIsEnabled',\ + glIsList,'glIsList',\ + glIsTexture,'glIsTexture',\ + glLightModelf,'glLightModelf',\ + glLightModelfv,'glLightModelfv',\ + glLightModeli,'glLightModeli',\ + glLightModeliv,'glLightModeliv',\ + glLightf,'glLightf',\ + glLightfv,'glLightfv',\ + glLighti,'glLighti',\ + glLightiv,'glLightiv',\ + glLineStipple,'glLineStipple',\ + glLineWidth,'glLineWidth',\ + glListBase,'glListBase',\ + glLoadIdentity,'glLoadIdentity',\ + glLoadMatrixd,'glLoadMatrixd',\ + glLoadMatrixf,'glLoadMatrixf',\ + glLoadName,'glLoadName',\ + glLogicOp,'glLogicOp',\ + glMap1d,'glMap1d',\ + glMap1f,'glMap1f',\ + glMap2d,'glMap2d',\ + glMap2f,'glMap2f',\ + glMapGrid1d,'glMapGrid1d',\ + glMapGrid1f,'glMapGrid1f',\ + glMapGrid2d,'glMapGrid2d',\ + glMapGrid2f,'glMapGrid2f',\ + glMaterialf,'glMaterialf',\ + glMaterialfv,'glMaterialfv',\ + glMateriali,'glMateriali',\ + glMaterialiv,'glMaterialiv',\ + glMatrixMode,'glMatrixMode',\ + glMultMatrixd,'glMultMatrixd',\ + glMultMatrixf,'glMultMatrixf',\ + glNewList,'glNewList',\ + glNormal3b,'glNormal3b',\ + glNormal3bv,'glNormal3bv',\ + glNormal3d,'glNormal3d',\ + glNormal3dv,'glNormal3dv',\ + glNormal3f,'glNormal3f',\ + glNormal3fv,'glNormal3fv',\ + glNormal3i,'glNormal3i',\ + glNormal3iv,'glNormal3iv',\ + glNormal3s,'glNormal3s',\ + glNormal3sv,'glNormal3sv',\ + glNormalPointer,'glNormalPointer',\ + glOrtho,'glOrtho',\ + glPassThrough,'glPassThrough',\ + glPixelMapfv,'glPixelMapfv',\ + glPixelMapuiv,'glPixelMapuiv',\ + glPixelMapusv,'glPixelMapusv',\ + glPixelStoref,'glPixelStoref',\ + glPixelStorei,'glPixelStorei',\ + glPixelTransferf,'glPixelTransferf',\ + glPixelTransferi,'glPixelTransferi',\ + glPixelZoom,'glPixelZoom',\ + glPointSize,'glPointSize',\ + glPolygonMode,'glPolygonMode',\ + glPolygonOffset,'glPolygonOffset',\ + glPolygonStipple,'glPolygonStipple',\ + glPopAttrib,'glPopAttrib',\ + glPopClientAttrib,'glPopClientAttrib',\ + glPopMatrix,'glPopMatrix',\ + glPopName,'glPopName',\ + glPrioritizeTextures,'glPrioritizeTextures',\ + glPushAttrib,'glPushAttrib',\ + glPushClientAttrib,'glPushClientAttrib',\ + glPushMatrix,'glPushMatrix',\ + glPushName,'glPushName',\ + glRasterPos2d,'glRasterPos2d',\ + glRasterPos2dv,'glRasterPos2dv',\ + glRasterPos2f,'glRasterPos2f',\ + glRasterPos2fv,'glRasterPos2fv',\ + glRasterPos2i,'glRasterPos2i',\ + glRasterPos2iv,'glRasterPos2iv',\ + glRasterPos2s,'glRasterPos2s',\ + glRasterPos2sv,'glRasterPos2sv',\ + glRasterPos3d,'glRasterPos3d',\ + glRasterPos3dv,'glRasterPos3dv',\ + glRasterPos3f,'glRasterPos3f',\ + glRasterPos3fv,'glRasterPos3fv',\ + glRasterPos3i,'glRasterPos3i',\ + glRasterPos3iv,'glRasterPos3iv',\ + glRasterPos3s,'glRasterPos3s',\ + glRasterPos3sv,'glRasterPos3sv',\ + glRasterPos4d,'glRasterPos4d',\ + glRasterPos4dv,'glRasterPos4dv',\ + glRasterPos4f,'glRasterPos4f',\ + glRasterPos4fv,'glRasterPos4fv',\ + glRasterPos4i,'glRasterPos4i',\ + glRasterPos4iv,'glRasterPos4iv',\ + glRasterPos4s,'glRasterPos4s',\ + glRasterPos4sv,'glRasterPos4sv',\ + glReadBuffer,'glReadBuffer',\ + glReadPixels,'glReadPixels',\ + glRectd,'glRectd',\ + glRectdv,'glRectdv',\ + glRectf,'glRectf',\ + glRectfv,'glRectfv',\ + glRecti,'glRecti',\ + glRectiv,'glRectiv',\ + glRects,'glRects',\ + glRectsv,'glRectsv',\ + glRenderMode,'glRenderMode',\ + glRotated,'glRotated',\ + glRotatef,'glRotatef',\ + glScaled,'glScaled',\ + glScalef,'glScalef',\ + glScissor,'glScissor',\ + glSelectBuffer,'glSelectBuffer',\ + glShadeModel,'glShadeModel',\ + glStencilFunc,'glStencilFunc',\ + glStencilMask,'glStencilMask',\ + glStencilOp,'glStencilOp',\ + glTexCoord1d,'glTexCoord1d',\ + glTexCoord1dv,'glTexCoord1dv',\ + glTexCoord1f,'glTexCoord1f',\ + glTexCoord1fv,'glTexCoord1fv',\ + glTexCoord1i,'glTexCoord1i',\ + glTexCoord1iv,'glTexCoord1iv',\ + glTexCoord1s,'glTexCoord1s',\ + glTexCoord1sv,'glTexCoord1sv',\ + glTexCoord2d,'glTexCoord2d',\ + glTexCoord2dv,'glTexCoord2dv',\ + glTexCoord2f,'glTexCoord2f',\ + glTexCoord2fv,'glTexCoord2fv',\ + glTexCoord2i,'glTexCoord2i',\ + glTexCoord2iv,'glTexCoord2iv',\ + glTexCoord2s,'glTexCoord2s',\ + glTexCoord2sv,'glTexCoord2sv',\ + glTexCoord3d,'glTexCoord3d',\ + glTexCoord3dv,'glTexCoord3dv',\ + glTexCoord3f,'glTexCoord3f',\ + glTexCoord3fv,'glTexCoord3fv',\ + glTexCoord3i,'glTexCoord3i',\ + glTexCoord3iv,'glTexCoord3iv',\ + glTexCoord3s,'glTexCoord3s',\ + glTexCoord3sv,'glTexCoord3sv',\ + glTexCoord4d,'glTexCoord4d',\ + glTexCoord4dv,'glTexCoord4dv',\ + glTexCoord4f,'glTexCoord4f',\ + glTexCoord4fv,'glTexCoord4fv',\ + glTexCoord4i,'glTexCoord4i',\ + glTexCoord4iv,'glTexCoord4iv',\ + glTexCoord4s,'glTexCoord4s',\ + glTexCoord4sv,'glTexCoord4sv',\ + glTexCoordPointer,'glTexCoordPointer',\ + glTexEnvf,'glTexEnvf',\ + glTexEnvfv,'glTexEnvfv',\ + glTexEnvi,'glTexEnvi',\ + glTexEnviv,'glTexEnviv',\ + glTexGend,'glTexGend',\ + glTexGendv,'glTexGendv',\ + glTexGenf,'glTexGenf',\ + glTexGenfv,'glTexGenfv',\ + glTexGeni,'glTexGeni',\ + glTexGeniv,'glTexGeniv',\ + glTexImage1D,'glTexImage1D',\ + glTexImage2D,'glTexImage2D',\ + glTexParameterf,'glTexParameterf',\ + glTexParameterfv,'glTexParameterfv',\ + glTexParameteri,'glTexParameteri',\ + glTexParameteriv,'glTexParameteriv',\ + glTexSubImage1D,'glTexSubImage1D',\ + glTexSubImage2D,'glTexSubImage2D',\ + glTranslated,'glTranslated',\ + glTranslatef,'glTranslatef',\ + glVertex2d,'glVertex2d',\ + glVertex2dv,'glVertex2dv',\ + glVertex2f,'glVertex2f',\ + glVertex2fv,'glVertex2fv',\ + glVertex2i,'glVertex2i',\ + glVertex2iv,'glVertex2iv',\ + glVertex2s,'glVertex2s',\ + glVertex2sv,'glVertex2sv',\ + glVertex3d,'glVertex3d',\ + glVertex3dv,'glVertex3dv',\ + glVertex3f,'glVertex3f',\ + glVertex3fv,'glVertex3fv',\ + glVertex3i,'glVertex3i',\ + glVertex3iv,'glVertex3iv',\ + glVertex3s,'glVertex3s',\ + glVertex3sv,'glVertex3sv',\ + glVertex4d,'glVertex4d',\ + glVertex4dv,'glVertex4dv',\ + glVertex4f,'glVertex4f',\ + glVertex4fv,'glVertex4fv',\ + glVertex4i,'glVertex4i',\ + glVertex4iv,'glVertex4iv',\ + glVertex4s,'glVertex4s',\ + glVertex4sv,'glVertex4sv',\ + glVertexPointer,'glVertexPointer',\ + glViewport,'glViewport',\ + wglGetProcAddress,'wglGetProcAddress',\ + wglCopyContext,'wglCopyContext',\ + wglCreateContext,'wglCreateContext',\ + wglCreateLayerContext,'wglCreateLayerContext',\ + wglDeleteContext,'wglDeleteContext',\ + wglDescribeLayerPlane,'wglDescribeLayerPlane',\ + wglGetCurrentContext,'wglGetCurrentContext',\ + wglGetCurrentDC,'wglGetCurrentDC',\ + wglGetLayerPaletteEntries,'wglGetLayerPaletteEntries',\ + wglMakeCurrent,'wglMakeCurrent',\ + wglRealizeLayerPalette,'wglRealizeLayerPalette',\ + wglSetLayerPaletteEntries,'wglSetLayerPaletteEntries',\ + wglShareLists,'wglShareLists',\ + wglSwapLayerBuffers,'wglSwapLayerBuffers',\ + wglSwapMultipleBuffers,'wglSwapMultipleBuffers',\ + wglUseFontBitmapsA,'wglUseFontBitmapsA',\ + wglUseFontOutlinesA,'wglUseFontOutlinesA',\ + wglUseFontBitmapsW,'wglUseFontBitmapsW',\ + wglUseFontOutlinesW,'wglUseFontOutlinesW',\ + glDrawRangeElements,'glDrawRangeElements',\ + glTexImage3D,'glTexImage3D',\ + glBlendColor,'glBlendColor',\ + glBlendEquation,'glBlendEquation',\ + glColorSubTable,'glColorSubTable',\ + glCopyColorSubTable,'glCopyColorSubTable',\ + glColorTable,'glColorTable',\ + glCopyColorTable,'glCopyColorTable',\ + glColorTableParameteriv,'glColorTableParameteriv',\ + glColorTableParameterfv,'glColorTableParameterfv',\ + glGetColorTable,'glGetColorTable',\ + glGetColorTableParameteriv,'glGetColorTableParameteriv',\ + glGetColorTableParameterfv,'glGetColorTableParameterfv',\ + glConvolutionFilter1D,'glConvolutionFilter1D',\ + glConvolutionFilter2D,'glConvolutionFilter2D',\ + glCopyConvolutionFilter1D,'glCopyConvolutionFilter1D',\ + glCopyConvolutionFilter2D,'glCopyConvolutionFilter2D',\ + glGetConvolutionFilter,'glGetConvolutionFilter',\ + glSeparableFilter2D,'glSeparableFilter2D',\ + glGetSeparableFilter,'glGetSeparableFilter',\ + glConvolutionParameteri,'glConvolutionParameteri',\ + glConvolutionParameteriv,'glConvolutionParameteriv',\ + glConvolutionParameterf,'glConvolutionParameterf',\ + glConvolutionParameterfv,'glConvolutionParameterfv',\ + glGetConvolutionParameteriv,'glGetConvolutionParameteriv',\ + glGetConvolutionParameterfv,'glGetConvolutionParameterfv',\ + glHistogram,'glHistogram',\ + glResetHistogram,'glResetHistogram',\ + glGetHistogram,'glGetHistogram',\ + glGetHistogramParameteriv,'glGetHistogramParameteriv',\ + glGetHistogramParameterfv,'glGetHistogramParameterfv',\ + glMinmax,'glMinmax',\ + glResetMinmax,'glResetMinmax',\ + glGetMinmax,'glGetMinmax',\ + glGetMinmaxParameteriv,'glGetMinmaxParameteriv',\ + glGetMinmaxParameterfv,'glGetMinmaxParameterfv' + + import glu,\ + gluBeginCurve,'gluBeginCurve',\ + gluBeginPolygon,'gluBeginPolygon',\ + gluBeginSurface,'gluBeginSurface',\ + gluBeginTrim,'gluBeginTrim',\ + gluBuild1DMipmaps,'gluBuild1DMipmaps',\ + gluBuild2DMipmaps,'gluBuild2DMipmaps',\ + gluCylinder,'gluCylinder',\ + gluDeleteNurbsRenderer,'gluDeleteNurbsRenderer',\ + gluDeleteQuadric,'gluDeleteQuadric',\ + gluDeleteTess,'gluDeleteTess',\ + gluDisk,'gluDisk',\ + gluEndCurve,'gluEndCurve',\ + gluEndPolygon,'gluEndPolygon',\ + gluEndSurface,'gluEndSurface',\ + gluEndTrim,'gluEndTrim',\ + gluErrorString,'gluErrorString',\ + gluGetNurbsProperty,'gluGetNurbsProperty',\ + gluGetString,'gluGetString',\ + gluGetTessProperty,'gluGetTessProperty',\ + gluLoadSamplingMatrices,'gluLoadSamplingMatrices',\ + gluLookAt,'gluLookAt',\ + gluNewNurbsRenderer,'gluNewNurbsRenderer',\ + gluNewQuadric,'gluNewQuadric',\ + gluNewTess,'gluNewTess',\ + gluNextContour,'gluNextContour',\ + gluNurbsCallback,'gluNurbsCallback',\ + gluNurbsCurve,'gluNurbsCurve',\ + gluNurbsProperty,'gluNurbsProperty',\ + gluNurbsSurface,'gluNurbsSurface',\ + gluOrtho2D,'gluOrtho2D',\ + gluPartialDisk,'gluPartialDisk',\ + gluPerspective,'gluPerspective',\ + gluPickMatrix,'gluPickMatrix',\ + gluProject,'gluProject',\ + gluPwlCurve,'gluPwlCurve',\ + gluQuadricCallback,'gluQuadricCallback',\ + gluQuadricDrawStyle,'gluQuadricDrawStyle',\ + gluQuadricNormals,'gluQuadricNormals',\ + gluQuadricOrientation,'gluQuadricOrientation',\ + gluQuadricTexture,'gluQuadricTexture',\ + gluScaleImage,'gluScaleImage',\ + gluSphere,'gluSphere',\ + gluTessBeginContour,'gluTessBeginContour',\ + gluTessBeginPolygon,'gluTessBeginPolygon',\ + gluTessCallback,'gluTessCallback',\ + gluTessEndContour,'gluTessEndContour',\ + gluTessEndPolygon,'gluTessEndPolygon',\ + gluTessNormal,'gluTessNormal',\ + gluTessProperty,'gluTessProperty',\ + gluTessVertex,'gluTessVertex',\ + gluUnProject,'gluUnProject' diff --git a/fasmw172/EXAMPLES/OPENGL/OPENGL.INC b/fasmw172/EXAMPLES/OPENGL/OPENGL.INC new file mode 100644 index 0000000..05c6d08 --- /dev/null +++ b/fasmw172/EXAMPLES/OPENGL/OPENGL.INC @@ -0,0 +1,2337 @@ + +; GL types + +GLenum fix dd +GLboolean fix db +GLbitfield fix dd +GLbyte fix db +GLshort fix dw +GLint fix dd +GLsizei fix dd +GLubyte fix db +GLushort fix dw +GLuint fix dd +GLfloat fix dd +GLclampf fix dd +GLdouble fix dq +GLclampd fix dq + +; GL errors + +GL_NO_ERROR = 0 +GL_INVALID_ENUM = $0500 +GL_INVALID_VALUE = $0501 +GL_INVALID_OPERATION = $0502 +GL_STACK_OVERFLOW = $0503 +GL_STACK_UNDERFLOW = $0504 +GL_OUT_OF_MEMORY = $0505 + +; Attribute bits + +GL_CURRENT_BIT = $00000001 +GL_POINT_BIT = $00000002 +GL_LINE_BIT = $00000004 +GL_POLYGON_BIT = $00000008 +GL_POLYGON_STIPPLE_BIT = $00000010 +GL_PIXEL_MODE_BIT = $00000020 +GL_LIGHTING_BIT = $00000040 +GL_FOG_BIT = $00000080 +GL_DEPTH_BUFFER_BIT = $00000100 +GL_ACCUM_BUFFER_BIT = $00000200 +GL_STENCIL_BUFFER_BIT = $00000400 +GL_VIEWPORT_BIT = $00000800 +GL_TRANSFORM_BIT = $00001000 +GL_ENABLE_BIT = $00002000 +GL_COLOR_BUFFER_BIT = $00004000 +GL_HINT_BIT = $00008000 +GL_EVAL_BIT = $00010000 +GL_LIST_BIT = $00020000 +GL_TEXTURE_BIT = $00040000 +GL_SCISSOR_BIT = $00080000 +GL_ALL_ATTRIB_BITS = $000FFFFF + +; Client attribute bits + +GL_CLIENT_PIXEL_STORE_BIT = $00000001 +GL_CLIENT_VERTEX_ARRAY_BIT = $00000002 +GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF + +; Boolean values + +GL_FALSE = 0 +GL_TRUE = 1 + +; Primitives + +GL_POINTS = $0000 +GL_LINES = $0001 +GL_LINE_LOOP = $0002 +GL_LINE_STRIP = $0003 +GL_TRIANGLES = $0004 +GL_TRIANGLE_STRIP = $0005 +GL_TRIANGLE_FAN = $0006 +GL_QUADS = $0007 +GL_QUAD_STRIP = $0008 +GL_POLYGON = $0009 + +; Blending + +GL_ZERO = 0 +GL_ONE = 1 +GL_SRC_COLOR = $0300 +GL_ONE_MINUS_SRC_COLOR = $0301 +GL_SRC_ALPHA = $0302 +GL_ONE_MINUS_SRC_ALPHA = $0303 +GL_DST_ALPHA = $0304 +GL_ONE_MINUS_DST_ALPHA = $0305 +GL_DST_COLOR = $0306 +GL_ONE_MINUS_DST_COLOR = $0307 +GL_SRC_ALPHA_SATURATE = $0308 +GL_BLEND_DST = $0BE0 +GL_BLEND_SRC = $0BE1 +GL_BLEND = $0BE2 + +; Blending (GL 1.2 ARB imaging) + +GL_BLEND_COLOR = $8005 +GL_CONSTANT_COLOR = $8001 +GL_ONE_MINUS_CONSTANT_COLOR = $8002 +GL_CONSTANT_ALPHA = $8003 +GL_ONE_MINUS_CONSTANT_ALPHA = $8004 +GL_FUNC_ADD = $8006 +GL_MIN = $8007 +GL_MAX = $8008 +GL_FUNC_SUBTRACT = $800A +GL_FUNC_REVERSE_SUBTRACT = $800B + +; Color table (GL 1.2 ARB imaging) + +GL_COLOR_TABLE = $80D0 +GL_POST_CONVOLUTION_COLOR_TABLE = $80D1 +GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2 +GL_PROXY_COLOR_TABLE = $80D3 +GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4 +GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5 +GL_COLOR_TABLE_SCALE = $80D6 +GL_COLOR_TABLE_BIAS = $80D7 +GL_COLOR_TABLE_FORMAT = $80D8 +GL_COLOR_TABLE_WIDTH = $80D9 +GL_COLOR_TABLE_RED_SIZE = $80DA +GL_COLOR_TABLE_GREEN_SIZE = $80DB +GL_COLOR_TABLE_BLUE_SIZE = $80DC +GL_COLOR_TABLE_ALPHA_SIZE = $80DD +GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE +GL_COLOR_TABLE_INTENSITY_SIZE = $80DF + +; Convolutions (GL 1.2 ARB imaging) + +GL_CONVOLUTION_1D = $8010 +GL_CONVOLUTION_2D = $8011 +GL_SEPARABLE_2D = $8012 +GL_CONVOLUTION_BORDER_MODE = $8013 +GL_CONVOLUTION_FILTER_SCALE = $8014 +GL_CONVOLUTION_FILTER_BIAS = $8015 +GL_REDUCE = $8016 +GL_CONVOLUTION_FORMAT = $8017 +GL_CONVOLUTION_WIDTH = $8018 +GL_CONVOLUTION_HEIGHT = $8019 +GL_MAX_CONVOLUTION_WIDTH = $801A +GL_MAX_CONVOLUTION_HEIGHT = $801B +GL_POST_CONVOLUTION_RED_SCALE = $801C +GL_POST_CONVOLUTION_GREEN_SCALE = $801D +GL_POST_CONVOLUTION_BLUE_SCALE = $801E +GL_POST_CONVOLUTION_ALPHA_SCALE = $801F +GL_POST_CONVOLUTION_RED_BIAS = $8020 +GL_POST_CONVOLUTION_GREEN_BIAS = $8021 +GL_POST_CONVOLUTION_BLUE_BIAS = $8022 +GL_POST_CONVOLUTION_ALPHA_BIAS = $8023 + +; Histogram (GL 1.2 ARB imaging) + +GL_HISTOGRAM = $8024 +GL_PROXY_HISTOGRAM = $8025 +GL_HISTOGRAM_WIDTH = $8026 +GL_HISTOGRAM_FORMAT = $8027 +GL_HISTOGRAM_RED_SIZE = $8028 +GL_HISTOGRAM_GREEN_SIZE = $8029 +GL_HISTOGRAM_BLUE_SIZE = $802A +GL_HISTOGRAM_ALPHA_SIZE = $802B +GL_HISTOGRAM_LUMINANCE_SIZE = $802C +GL_HISTOGRAM_SINK = $802D +GL_MINMAX = $802E +GL_MINMAX_FORMAT = $802F +GL_MINMAX_SINK = $8030 + +; Buffers + +GL_NONE = 0 +GL_FRONT_LEFT = $0400 +GL_FRONT_RIGHT = $0401 +GL_BACK_LEFT = $0402 +GL_BACK_RIGHT = $0403 +GL_FRONT = $0404 +GL_BACK = $0405 +GL_LEFT = $0406 +GL_RIGHT = $0407 +GL_FRONT_AND_BACK = $0408 +GL_AUX0 = $0409 +GL_AUX1 = $040A +GL_AUX2 = $040B +GL_AUX3 = $040C +GL_AUX_BUFFERS = $0C00 +GL_DRAW_BUFFER = $0C01 +GL_READ_BUFFER = $0C02 +GL_DOUBLEBUFFER = $0C32 +GL_STEREO = $0C33 + +; Depth buffer + +GL_DEPTH_RANGE = $0B70 +GL_DEPTH_TEST = $0B71 +GL_DEPTH_WRITEMASK = $0B72 +GL_DEPTH_CLEAR_VALUE = $0B73 +GL_DEPTH_FUNC = $0B74 +GL_NEVER = $0200 +GL_LESS = $0201 +GL_EQUAL = $0202 +GL_LEQUAL = $0203 +GL_GREATER = $0204 +GL_NOTEQUAL = $0205 +GL_GEQUAL = $0206 +GL_ALWAYS = $0207 + +; Accumulation buffer + +GL_ACCUM = $0100 +GL_LOAD = $0101 +GL_RETURN = $0102 +GL_MULT = $0103 +GL_ADD = $0104 +GL_ACCUM_CLEAR_VALUE = $0B80 + +; Feedback buffer + +GL_FEEDBACK_BUFFER_POINTER = $0DF0 +GL_FEEDBACK_BUFFER_SIZE = $0DF1 +GL_FEEDBACK_BUFFER_TYPE = $0DF2 + +; Feedback types + +GL_2D = $0600 +GL_3D = $0601 +GL_3D_COLOR = $0602 +GL_3D_COLOR_TEXTURE = $0603 +GL_4D_COLOR_TEXTURE = $0604 + +; Feedback tokens + +GL_PASS_THROUGH_TOKEN = $0700 +GL_POINT_TOKEN = $0701 +GL_LINE_TOKEN = $0702 +GL_POLYGON_TOKEN = $0703 +GL_BITMAP_TOKEN = $0704 +GL_DRAW_PIXEL_TOKEN = $0705 +GL_COPY_PIXEL_TOKEN = $0706 +GL_LINE_RESET_TOKEN = $0707 + +; Fog + +GL_EXP = $0800 +GL_EXP2 = $0801 +GL_FOG = $0B60 +GL_FOG_INDEX = $0B61 +GL_FOG_DENSITY = $0B62 +GL_FOG_START = $0B63 +GL_FOG_END = $0B64 +GL_FOG_MODE = $0B65 +GL_FOG_COLOR = $0B66 + +; Pixel mode, transfer + +GL_PIXEL_MAP_I_TO_I = $0C70 +GL_PIXEL_MAP_S_TO_S = $0C71 +GL_PIXEL_MAP_I_TO_R = $0C72 +GL_PIXEL_MAP_I_TO_G = $0C73 +GL_PIXEL_MAP_I_TO_B = $0C74 +GL_PIXEL_MAP_I_TO_A = $0C75 +GL_PIXEL_MAP_R_TO_R = $0C76 +GL_PIXEL_MAP_G_TO_G = $0C77 +GL_PIXEL_MAP_B_TO_B = $0C78 +GL_PIXEL_MAP_A_TO_A = $0C79 + +; Vertex arrays + +GL_VERTEX_ARRAY_POINTER = $808E +GL_NORMAL_ARRAY_POINTER = $808F +GL_COLOR_ARRAY_POINTER = $8090 +GL_INDEX_ARRAY_POINTER = $8091 +GL_TEXTURE_COORD_ARRAY_POINTER = $8092 +GL_EDGE_FLAG_ARRAY_POINTER = $8093 + +; Stenciling + +GL_STENCIL_TEST = $0B90 +GL_STENCIL_CLEAR_VALUE = $0B91 +GL_STENCIL_FUNC = $0B92 +GL_STENCIL_VALUE_MASK = $0B93 +GL_STENCIL_FAIL = $0B94 +GL_STENCIL_PASS_DEPTH_FAIL = $0B95 +GL_STENCIL_PASS_DEPTH_PASS = $0B96 +GL_STENCIL_REF = $0B97 +GL_STENCIL_WRITEMASK = $0B98 +GL_KEEP = $1E00 +GL_REPLACE = $1E01 +GL_INCR = $1E02 +GL_DECR = $1E03 + +; Color material + +GL_COLOR_MATERIAL_FACE = $0B55 +GL_COLOR_MATERIAL_PARAMETER = $0B56 +GL_COLOR_MATERIAL = $0B57 + +; Points + +GL_POINT_SMOOTH = $0B10 +GL_POINT_SIZE = $0B11 +GL_POINT_SIZE_RANGE = $0B12 +GL_POINT_SIZE_GRANULARITY = $0B13 + +; Lines + +GL_LINE_SMOOTH = $0B20 +GL_LINE_WIDTH = $0B21 +GL_LINE_WIDTH_RANGE = $0B22 +GL_LINE_WIDTH_GRANULARITY = $0B23 +GL_LINE_STIPPLE = $0B24 +GL_LINE_STIPPLE_PATTERN = $0B25 +GL_LINE_STIPPLE_REPEAT = $0B26 + +; Polygons + +GL_POLYGON_MODE = $0B40 +GL_POLYGON_SMOOTH = $0B41 +GL_POLYGON_STIPPLE = $0B42 +GL_EDGE_FLAG = $0B43 +GL_CULL_FACE = $0B44 +GL_CULL_FACE_MODE = $0B45 +GL_FRONT_FACE = $0B46 +GL_CW = $0900 +GL_CCW = $0901 +GL_POINT = $1B00 +GL_LINE = $1B01 +GL_FILL = $1B02 + +; Display lists + +GL_LIST_MODE = $0B30 +GL_LIST_BASE = $0B32 +GL_LIST_INDEX = $0B33 +GL_COMPILE = $1300 +GL_COMPILE_AND_EXECUTE = $1301 + +; Lighting + +GL_LIGHTING = $0B50 +GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51 +GL_LIGHT_MODEL_TWO_SIDE = $0B52 +GL_LIGHT_MODEL_AMBIENT = $0B53 +GL_LIGHT_MODEL_COLOR_CONTROL = $81F8 +GL_SHADE_MODEL = $0B54 +GL_NORMALIZE = $0BA1 +GL_AMBIENT = $1200 +GL_DIFFUSE = $1201 +GL_SPECULAR = $1202 +GL_POSITION = $1203 +GL_SPOT_DIRECTION = $1204 +GL_SPOT_EXPONENT = $1205 +GL_SPOT_CUTOFF = $1206 +GL_CONSTANT_ATTENUATION = $1207 +GL_LINEAR_ATTENUATION = $1208 +GL_QUADRATIC_ATTENUATION = $1209 +GL_EMISSION = $1600 +GL_SHININESS = $1601 +GL_AMBIENT_AND_DIFFUSE = $1602 +GL_COLOR_INDEXES = $1603 +GL_FLAT = $1D00 +GL_SMOOTH = $1D01 +GL_LIGHT0 = $4000 +GL_LIGHT1 = $4001 +GL_LIGHT2 = $4002 +GL_LIGHT3 = $4003 +GL_LIGHT4 = $4004 +GL_LIGHT5 = $4005 +GL_LIGHT6 = $4006 +GL_LIGHT7 = $4007 + +; Matrix modes + +GL_MATRIX_MODE = $0BA0 +GL_MODELVIEW = $1700 +GL_PROJECTION = $1701 +GL_TEXTURE = $1702 + +; Gets + +GL_CURRENT_COLOR = $0B00 +GL_CURRENT_INDEX = $0B01 +GL_CURRENT_NORMAL = $0B02 +GL_CURRENT_TEXTURE_COORDS = $0B03 +GL_CURRENT_RASTER_COLOR = $0B04 +GL_CURRENT_RASTER_INDEX = $0B05 +GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06 +GL_CURRENT_RASTER_POSITION = $0B07 +GL_CURRENT_RASTER_POSITION_VALID = $0B08 +GL_CURRENT_RASTER_DISTANCE = $0B09 +GL_MAX_LIST_NESTING = $0B31 +GL_VIEWPORT = $0BA2 +GL_MODELVIEW_STACK_DEPTH = $0BA3 +GL_PROJECTION_STACK_DEPTH = $0BA4 +GL_TEXTURE_STACK_DEPTH = $0BA5 +GL_MODELVIEW_MATRIX = $0BA6 +GL_PROJECTION_MATRIX = $0BA7 +GL_TEXTURE_MATRIX = $0BA8 +GL_ATTRIB_STACK_DEPTH = $0BB0 +GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1 +GL_SINGLE_COLOR = $81F9 +GL_SEPARATE_SPECULAR_COLOR = $81FA + +; Alpha testing + +GL_ALPHA_TEST = $0BC0 +GL_ALPHA_TEST_FUNC = $0BC1 +GL_ALPHA_TEST_REF = $0BC2 + +GL_LOGIC_OP_MODE = $0BF0 +GL_INDEX_LOGIC_OP = $0BF1 +GL_LOGIC_OP = $0BF1 +GL_COLOR_LOGIC_OP = $0BF2 +GL_SCISSOR_BOX = $0C10 +GL_SCISSOR_TEST = $0C11 +GL_INDEX_CLEAR_VALUE = $0C20 +GL_INDEX_WRITEMASK = $0C21 +GL_COLOR_CLEAR_VALUE = $0C22 +GL_COLOR_WRITEMASK = $0C23 +GL_INDEX_MODE = $0C30 +GL_RGBA_MODE = $0C31 +GL_RENDER_MODE = $0C40 +GL_PERSPECTIVE_CORRECTION_HINT = $0C50 +GL_POINT_SMOOTH_HINT = $0C51 +GL_LINE_SMOOTH_HINT = $0C52 +GL_POLYGON_SMOOTH_HINT = $0C53 +GL_FOG_HINT = $0C54 +GL_TEXTURE_GEN_S = $0C60 +GL_TEXTURE_GEN_T = $0C61 +GL_TEXTURE_GEN_R = $0C62 +GL_TEXTURE_GEN_Q = $0C63 +GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0 +GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1 +GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2 +GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3 +GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4 +GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5 +GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6 +GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7 +GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8 +GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9 +GL_UNPACK_SWAP_BYTES = $0CF0 +GL_UNPACK_LSB_FIRST = $0CF1 +GL_UNPACK_ROW_LENGTH = $0CF2 +GL_UNPACK_SKIP_ROWS = $0CF3 +GL_UNPACK_SKIP_PIXELS = $0CF4 +GL_UNPACK_ALIGNMENT = $0CF5 +GL_PACK_SWAP_BYTES = $0D00 +GL_PACK_LSB_FIRST = $0D01 +GL_PACK_ROW_LENGTH = $0D02 +GL_PACK_SKIP_ROWS = $0D03 +GL_PACK_SKIP_PIXELS = $0D04 +GL_PACK_ALIGNMENT = $0D05 +GL_PACK_SKIP_IMAGES = $806B +GL_PACK_IMAGE_HEIGHT = $806C +GL_UNPACK_SKIP_IMAGES = $806D +GL_UNPACK_IMAGE_HEIGHT = $806E +GL_MAP_COLOR = $0D10 +GL_MAP_STENCIL = $0D11 +GL_INDEX_SHIFT = $0D12 +GL_INDEX_OFFSET = $0D13 +GL_RED_SCALE = $0D14 +GL_RED_BIAS = $0D15 +GL_ZOOM_X = $0D16 +GL_ZOOM_Y = $0D17 +GL_GREEN_SCALE = $0D18 +GL_GREEN_BIAS = $0D19 +GL_BLUE_SCALE = $0D1A +GL_BLUE_BIAS = $0D1B +GL_ALPHA_SCALE = $0D1C +GL_ALPHA_BIAS = $0D1D +GL_DEPTH_SCALE = $0D1E +GL_DEPTH_BIAS = $0D1F +GL_MAX_EVAL_ORDER = $0D30 +GL_MAX_LIGHTS = $0D31 +GL_MAX_CLIP_PLANES = $0D32 +GL_MAX_TEXTURE_SIZE = $0D33 +GL_MAX_3D_TEXTURE_SIZE = $8073 +GL_MAX_PIXEL_MAP_TABLE = $0D34 +GL_MAX_ATTRIB_STACK_DEPTH = $0D35 +GL_MAX_MODELVIEW_STACK_DEPTH = $0D36 +GL_MAX_NAME_STACK_DEPTH = $0D37 +GL_MAX_PROJECTION_STACK_DEPTH = $0D38 +GL_MAX_TEXTURE_STACK_DEPTH = $0D39 +GL_MAX_VIEWPORT_DIMS = $0D3A +GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B +GL_MAX_ELEMENTS_VERTICES = $80E8 +GL_MAX_ELEMENTS_INDICES = $80E9 +GL_RESCALE_NORMAL = $803A +GL_SUBPIXEL_BITS = $0D50 +GL_INDEX_BITS = $0D51 +GL_RED_BITS = $0D52 +GL_GREEN_BITS = $0D53 +GL_BLUE_BITS = $0D54 +GL_ALPHA_BITS = $0D55 +GL_DEPTH_BITS = $0D56 +GL_STENCIL_BITS = $0D57 +GL_ACCUM_RED_BITS = $0D58 +GL_ACCUM_GREEN_BITS = $0D59 +GL_ACCUM_BLUE_BITS = $0D5A +GL_ACCUM_ALPHA_BITS = $0D5B +GL_NAME_STACK_DEPTH = $0D70 +GL_AUTO_NORMAL = $0D80 +GL_MAP1_COLOR_4 = $0D90 +GL_MAP1_INDEX = $0D91 +GL_MAP1_NORMAL = $0D92 +GL_MAP1_TEXTURE_COORD_1 = $0D93 +GL_MAP1_TEXTURE_COORD_2 = $0D94 +GL_MAP1_TEXTURE_COORD_3 = $0D95 +GL_MAP1_TEXTURE_COORD_4 = $0D96 +GL_MAP1_VERTEX_3 = $0D97 +GL_MAP1_VERTEX_4 = $0D98 +GL_MAP2_COLOR_4 = $0DB0 +GL_MAP2_INDEX = $0DB1 +GL_MAP2_NORMAL = $0DB2 +GL_MAP2_TEXTURE_COORD_1 = $0DB3 +GL_MAP2_TEXTURE_COORD_2 = $0DB4 +GL_MAP2_TEXTURE_COORD_3 = $0DB5 +GL_MAP2_TEXTURE_COORD_4 = $0DB6 +GL_MAP2_VERTEX_3 = $0DB7 +GL_MAP2_VERTEX_4 = $0DB8 +GL_MAP1_GRID_DOMAIN = $0DD0 +GL_MAP1_GRID_SEGMENTS = $0DD1 +GL_MAP2_GRID_DOMAIN = $0DD2 +GL_MAP2_GRID_SEGMENTS = $0DD3 +GL_TEXTURE_1D = $0DE0 +GL_TEXTURE_2D = $0DE1 +GL_TEXTURE_3D = $806F +GL_SELECTION_BUFFER_POINTER = $0DF3 +GL_SELECTION_BUFFER_SIZE = $0DF4 +GL_POLYGON_OFFSET_UNITS = $2A00 +GL_POLYGON_OFFSET_POINT = $2A01 +GL_POLYGON_OFFSET_LINE = $2A02 +GL_POLYGON_OFFSET_FILL = $8037 +GL_POLYGON_OFFSET_FACTOR = $8038 +GL_TEXTURE_BINDING_1D = $8068 +GL_TEXTURE_BINDING_2D = $8069 +GL_VERTEX_ARRAY = $8074 +GL_NORMAL_ARRAY = $8075 +GL_COLOR_ARRAY = $8076 +GL_INDEX_ARRAY = $8077 +GL_TEXTURE_COORD_ARRAY = $8078 +GL_EDGE_FLAG_ARRAY = $8079 +GL_VERTEX_ARRAY_SIZE = $807A +GL_VERTEX_ARRAY_TYPE = $807B +GL_VERTEX_ARRAY_STRIDE = $807C +GL_NORMAL_ARRAY_TYPE = $807E +GL_NORMAL_ARRAY_STRIDE = $807F +GL_COLOR_ARRAY_SIZE = $8081 +GL_COLOR_ARRAY_TYPE = $8082 +GL_COLOR_ARRAY_STRIDE = $8083 +GL_INDEX_ARRAY_TYPE = $8085 +GL_INDEX_ARRAY_STRIDE = $8086 +GL_TEXTURE_COORD_ARRAY_SIZE = $8088 +GL_TEXTURE_COORD_ARRAY_TYPE = $8089 +GL_TEXTURE_COORD_ARRAY_STRIDE = $808A +GL_EDGE_FLAG_ARRAY_STRIDE = $808C +GL_COLOR_MATRIX = $80B1 +GL_COLOR_MATRIX_STACK_DEPTH = $80B2 +GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3 +GL_POST_COLOR_MATRIX_RED_SCALE = $80B4 +GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5 +GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6 +GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7 +GL_POST_COLOR_MATRIX_RED_BIAS = $80B8 +GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9 +GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA +GL_POST_COLOR_MATRIX_ALPHA_BIAS = $80BB + +; Evaluators + +GL_COEFF = $0A00 +GL_ORDER = $0A01 +GL_DOMAIN = $0A02 + +; Texture mapping + +GL_TEXTURE_WIDTH = $1000 +GL_TEXTURE_HEIGHT = $1001 +GL_TEXTURE_INTERNAL_FORMAT = $1003 +GL_TEXTURE_COMPONENTS = $1003 +GL_TEXTURE_BORDER_COLOR = $1004 +GL_TEXTURE_BORDER = $1005 +GL_TEXTURE_RED_SIZE = $805C +GL_TEXTURE_GREEN_SIZE = $805D +GL_TEXTURE_BLUE_SIZE = $805E +GL_TEXTURE_ALPHA_SIZE = $805F +GL_TEXTURE_LUMINANCE_SIZE = $8060 +GL_TEXTURE_INTENSITY_SIZE = $8061 +GL_TEXTURE_PRIORITY = $8066 +GL_TEXTURE_RESIDENT = $8067 +GL_BGR = $80E0 +GL_BGRA = $80E1 +GL_S = $2000 +GL_T = $2001 +GL_R = $2002 +GL_Q = $2003 +GL_MODULATE = $2100 +GL_DECAL = $2101 +GL_TEXTURE_ENV_MODE = $2200 +GL_TEXTURE_ENV_COLOR = $2201 +GL_TEXTURE_ENV = $2300 +GL_EYE_LINEAR = $2400 +GL_OBJECT_LINEAR = $2401 +GL_SPHERE_MAP = $2402 +GL_TEXTURE_GEN_MODE = $2500 +GL_OBJECT_PLANE = $2501 +GL_EYE_PLANE = $2502 +GL_NEAREST = $2600 +GL_LINEAR = $2601 +GL_NEAREST_MIPMAP_NEAREST = $2700 +GL_LINEAR_MIPMAP_NEAREST = $2701 +GL_NEAREST_MIPMAP_LINEAR = $2702 +GL_LINEAR_MIPMAP_LINEAR = $2703 +GL_TEXTURE_MAG_FILTER = $2800 +GL_TEXTURE_MIN_FILTER = $2801 +GL_TEXTURE_WRAP_R = $8072 +GL_TEXTURE_WRAP_S = $2802 +GL_TEXTURE_WRAP_T = $2803 +GL_CLAMP_TO_EDGE = $812F +GL_TEXTURE_MIN_LOD = $813A +GL_TEXTURE_MAX_LOD = $813B +GL_TEXTURE_BASE_LEVEL = $813C +GL_TEXTURE_MAX_LEVEL = $813D +GL_TEXTURE_DEPTH = $8071 +GL_PROXY_TEXTURE_1D = $8063 +GL_PROXY_TEXTURE_2D = $8064 +GL_PROXY_TEXTURE_3D = $8070 +GL_CLAMP = $2900 +GL_REPEAT = $2901 + +; Hints + +GL_DONT_CARE = $1100 +GL_FASTEST = $1101 +GL_NICEST = $1102 + +; Data types + +GL_BYTE = $1400 +GL_UNSIGNED_BYTE = $1401 +GL_SHORT = $1402 +GL_UNSIGNED_SHORT = $1403 +GL_INT = $1404 +GL_UNSIGNED_INT = $1405 +GL_FLOAT = $1406 +GL_2_BYTES = $1407 +GL_3_BYTES = $1408 +GL_4_BYTES = $1409 +GL_DOUBLE = $140A +GL_DOUBLE_EXT = $140A + +; Logic operations + +GL_CLEAR = $1500 +GL_AND = $1501 +GL_AND_REVERSE = $1502 +GL_COPY = $1503 +GL_AND_INVERTED = $1504 +GL_NOOP = $1505 +GL_XOR = $1506 +GL_OR = $1507 +GL_NOR = $1508 +GL_EQUIV = $1509 +GL_INVERT = $150A +GL_OR_REVERSE = $150B +GL_COPY_INVERTED = $150C +GL_OR_INVERTED = $150D +GL_NAND = $150E +GL_SET = $150F + +; PixelCopyType + +GL_COLOR = $1800 +GL_DEPTH = $1801 +GL_STENCIL = $1802 + +; Pixel formats + +GL_COLOR_INDEX = $1900 +GL_STENCIL_INDEX = $1901 +GL_DEPTH_COMPONENT = $1902 +GL_RED = $1903 +GL_GREEN = $1904 +GL_BLUE = $1905 +GL_ALPHA = $1906 +GL_RGB = $1907 +GL_RGBA = $1908 +GL_LUMINANCE = $1909 +GL_LUMINANCE_ALPHA = $190A + +; Pixel type + +GL_BITMAP = $1A00 + +; Rendering modes + +GL_RENDER = $1C00 +GL_FEEDBACK = $1C01 +GL_SELECT = $1C02 + +; Implementation strings + +GL_VENDOR = $1F00 +GL_RENDERER = $1F01 +GL_VERSION = $1F02 +GL_EXTENSIONS = $1F03 + +; Pixel formats + +GL_R3_G3_B2 = $2A10 +GL_ALPHA4 = $803B +GL_ALPHA8 = $803C +GL_ALPHA12 = $803D +GL_ALPHA16 = $803E +GL_LUMINANCE4 = $803F +GL_LUMINANCE8 = $8040 +GL_LUMINANCE12 = $8041 +GL_LUMINANCE16 = $8042 +GL_LUMINANCE4_ALPHA4 = $8043 +GL_LUMINANCE6_ALPHA2 = $8044 +GL_LUMINANCE8_ALPHA8 = $8045 +GL_LUMINANCE12_ALPHA4 = $8046 +GL_LUMINANCE12_ALPHA12 = $8047 +GL_LUMINANCE16_ALPHA16 = $8048 +GL_INTENSITY = $8049 +GL_INTENSITY4 = $804A +GL_INTENSITY8 = $804B +GL_INTENSITY12 = $804C +GL_INTENSITY16 = $804D +GL_RGB4 = $804F +GL_RGB5 = $8050 +GL_RGB8 = $8051 +GL_RGB10 = $8052 +GL_RGB12 = $8053 +GL_RGB16 = $8054 +GL_RGBA2 = $8055 +GL_RGBA4 = $8056 +GL_RGB5_A1 = $8057 +GL_RGBA8 = $8058 +GL_RGB10_A2 = $8059 +GL_RGBA12 = $805A +GL_RGBA16 = $805B +UNSIGNED_BYTE_3_3_2 = $8032 +UNSIGNED_BYTE_2_3_3_REV = $8362 +UNSIGNED_SHORT_5_6_5 = $8363 +UNSIGNED_SHORT_5_6_5_REV = $8364 +UNSIGNED_SHORT_4_4_4_4 = $8033 +UNSIGNED_SHORT_4_4_4_4_REV = $8365 +UNSIGNED_SHORT_5_5_5_1 = $8034 +UNSIGNED_SHORT_1_5_5_5_REV = $8366 +UNSIGNED_INT_8_8_8_8 = $8035 +UNSIGNED_INT_8_8_8_8_REV = $8367 +UNSIGNED_INT_10_10_10_2 = $8036 +UNSIGNED_INT_2_10_10_10_REV = $8368 + +; Interleaved arrays formats + +GL_V2F = $2A20 +GL_V3F = $2A21 +GL_C4UB_V2F = $2A22 +GL_C4UB_V3F = $2A23 +GL_C3F_V3F = $2A24 +GL_N3F_V3F = $2A25 +GL_C4F_N3F_V3F = $2A26 +GL_T2F_V3F = $2A27 +GL_T4F_V4F = $2A28 +GL_T2F_C4UB_V3F = $2A29 +GL_T2F_C3F_V3F = $2A2A +GL_T2F_N3F_V3F = $2A2B +GL_T2F_C4F_N3F_V3F = $2A2C +GL_T4F_C4F_N3F_V4F = $2A2D + +; Clip planes + +GL_CLIP_PLANE0 = $3000 +GL_CLIP_PLANE1 = $3001 +GL_CLIP_PLANE2 = $3002 +GL_CLIP_PLANE3 = $3003 +GL_CLIP_PLANE4 = $3004 +GL_CLIP_PLANE5 = $3005 + +; Miscellaneous + +GL_DITHER = $0BD0 + +; EXT_abgr + +GL_ABGR_EXT = $8000 + +; EXT_packed_pixels + +GL_UNSIGNED_BYTE_3_3_2_EXT = $8032 +GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033 +GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034 +GL_UNSIGNED_INT_8_8_8_8_EXT = $8035 +GL_UNSIGNED_INT_10_10_10_2_EXT = $8036 + +; EXT_vertex_array + +GL_VERTEX_ARRAY_EXT = $8074 +GL_NORMAL_ARRAY_EXT = $8075 +GL_COLOR_ARRAY_EXT = $8076 +GL_INDEX_ARRAY_EXT = $8077 +GL_TEXTURE_COORD_ARRAY_EXT = $8078 +GL_EDGE_FLAG_ARRAY_EXT = $8079 +GL_VERTEX_ARRAY_SIZE_EXT = $807A +GL_VERTEX_ARRAY_TYPE_EXT = $807B +GL_VERTEX_ARRAY_STRIDE_EXT = $807C +GL_VERTEX_ARRAY_COUNT_EXT = $807D +GL_NORMAL_ARRAY_TYPE_EXT = $807E +GL_NORMAL_ARRAY_STRIDE_EXT = $807F +GL_NORMAL_ARRAY_COUNT_EXT = $8080 +GL_COLOR_ARRAY_SIZE_EXT = $8081 +GL_COLOR_ARRAY_TYPE_EXT = $8082 +GL_COLOR_ARRAY_STRIDE_EXT = $8083 +GL_COLOR_ARRAY_COUNT_EXT = $8084 +GL_INDEX_ARRAY_TYPE_EXT = $8085 +GL_INDEX_ARRAY_STRIDE_EXT = $8086 +GL_INDEX_ARRAY_COUNT_EXT = $8087 +GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088 +GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089 +GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A +GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B +GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C +GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D +GL_VERTEX_ARRAY_POINTER_EXT = $808E +GL_NORMAL_ARRAY_POINTER_EXT = $808F +GL_COLOR_ARRAY_POINTER_EXT = $8090 +GL_INDEX_ARRAY_POINTER_EXT = $8091 +GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092 +GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093 + +; EXT_color_table + +GL_TABLE_TOO_LARGE_EXT = $8031 +GL_COLOR_TABLE_EXT = $80D0 +GL_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D1 +GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D2 +GL_PROXY_COLOR_TABLE_EXT = $80D3 +GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D4 +GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D5 +GL_COLOR_TABLE_SCALE_EXT = $80D6 +GL_COLOR_TABLE_BIAS_EXT = $80D7 +GL_COLOR_TABLE_FORMAT_EXT = $80D8 +GL_COLOR_TABLE_WIDTH_EXT = $80D9 +GL_COLOR_TABLE_RED_SIZE_EXT = $80DA +GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB +GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC +GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD +GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE +GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF + +; EXT_bgra + +GL_BGR_EXT = $80E0 +GL_BGRA_EXT = $80E1 + +; EXT_paletted_texture + +GL_COLOR_INDEX1_EXT = $80E2 +GL_COLOR_INDEX2_EXT = $80E3 +GL_COLOR_INDEX4_EXT = $80E4 +GL_COLOR_INDEX8_EXT = $80E5 +GL_COLOR_INDEX12_EXT = $80E6 +GL_COLOR_INDEX16_EXT = $80E7 + +; EXT_blend_color + +GL_CONSTANT_COLOR_EXT = $8001 +GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002 +GL_CONSTANT_ALPHA_EXT = $8003 +GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004 +GL_BLEND_COLOR_EXT = $8005 + +; EXT_blend_minmax + +GL_FUNC_ADD_EXT = $8006 +GL_MIN_EXT = $8007 +GL_MAX_EXT = $8008 +GL_BLEND_EQUATION_EXT = $8009 + +; EXT_blend_subtract + +GL_FUNC_SUBTRACT_EXT = $800A +GL_FUNC_REVERSE_SUBTRACT_EXT = $800B + +; EXT_convolution + +GL_CONVOLUTION_1D_EXT = $8010 +GL_CONVOLUTION_2D_EXT = $8011 +GL_SEPARABLE_2D_EXT = $8012 +GL_CONVOLUTION_BORDER_MODE_EXT = $8013 +GL_CONVOLUTION_FILTER_SCALE_EXT = $8014 +GL_CONVOLUTION_FILTER_BIAS_EXT = $8015 +GL_REDUCE_EXT = $8016 +GL_CONVOLUTION_FORMAT_EXT = $8017 +GL_CONVOLUTION_WIDTH_EXT = $8018 +GL_CONVOLUTION_HEIGHT_EXT = $8019 +GL_MAX_CONVOLUTION_WIDTH_EXT = $801A +GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B +GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C +GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D +GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E +GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F +GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020 +GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021 +GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022 +GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023 + +; EXT_histogram + +GL_HISTOGRAM_EXT = $8024 +GL_PROXY_HISTOGRAM_EXT = $8025 +GL_HISTOGRAM_WIDTH_EXT = $8026 +GL_HISTOGRAM_FORMAT_EXT = $8027 +GL_HISTOGRAM_RED_SIZE_EXT = $8028 +GL_HISTOGRAM_GREEN_SIZE_EXT = $8029 +GL_HISTOGRAM_BLUE_SIZE_EXT = $802A +GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B +GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C +GL_HISTOGRAM_SINK_EXT = $802D +GL_MINMAX_EXT = $802E +GL_MINMAX_FORMAT_EXT = $802F +GL_MINMAX_SINK_EXT = $8030 + +; EXT_polygon_offset + +GL_POLYGON_OFFSET_EXT = $8037 +GL_POLYGON_OFFSET_FACTOR_EXT = $8038 +GL_POLYGON_OFFSET_BIAS_EXT = $8039 + +; EXT_texture + +GL_ALPHA4_EXT = $803B +GL_ALPHA8_EXT = $803C +GL_ALPHA12_EXT = $803D +GL_ALPHA16_EXT = $803E +GL_LUMINANCE4_EXT = $803F +GL_LUMINANCE8_EXT = $8040 +GL_LUMINANCE12_EXT = $8041 +GL_LUMINANCE16_EXT = $8042 +GL_LUMINANCE4_ALPHA4_EXT = $8043 +GL_LUMINANCE6_ALPHA2_EXT = $8044 +GL_LUMINANCE8_ALPHA8_EXT = $8045 +GL_LUMINANCE12_ALPHA4_EXT = $8046 +GL_LUMINANCE12_ALPHA12_EXT = $8047 +GL_LUMINANCE16_ALPHA16_EXT = $8048 +GL_INTENSITY_EXT = $8049 +GL_INTENSITY4_EXT = $804A +GL_INTENSITY8_EXT = $804B +GL_INTENSITY12_EXT = $804C +GL_INTENSITY16_EXT = $804D +GL_RGB2_EXT = $804E +GL_RGB4_EXT = $804F +GL_RGB5_EXT = $8050 +GL_RGB8_EXT = $8051 +GL_RGB10_EXT = $8052 +GL_RGB12_EXT = $8053 +GL_RGB16_EXT = $8054 +GL_RGBA2_EXT = $8055 +GL_RGBA4_EXT = $8056 +GL_RGB5_A1_EXT = $8057 +GL_RGBA8_EXT = $8058 +GL_RGB10_A2_EXT = $8059 +GL_RGBA12_EXT = $805A +GL_RGBA16_EXT = $805B +GL_TEXTURE_RED_SIZE_EXT = $805C +GL_TEXTURE_GREEN_SIZE_EXT = $805D +GL_TEXTURE_BLUE_SIZE_EXT = $805E +GL_TEXTURE_ALPHA_SIZE_EXT = $805F +GL_TEXTURE_LUMINANCE_SIZE_EXT = $8060 +GL_TEXTURE_INTENSITY_SIZE_EXT = $8061 +GL_REPLACE_EXT = $8062 +GL_PROXY_TEXTURE_1D_EXT = $8063 +GL_PROXY_TEXTURE_2D_EXT = $8064 +GL_TEXTURE_TOO_LARGE_EXT = $8065 + +; EXT_texture_object + +GL_TEXTURE_PRIORITY_EXT = $8066 +GL_TEXTURE_RESIDENT_EXT = $8067 +GL_TEXTURE_1D_BINDING_EXT = $8068 +GL_TEXTURE_2D_BINDING_EXT = $8069 +GL_TEXTURE_3D_BINDING_EXT = $806A + +; EXT_texture3D + +GL_PACK_SKIP_IMAGES_EXT = $806B +GL_PACK_IMAGE_HEIGHT_EXT = $806C +GL_UNPACK_SKIP_IMAGES_EXT = $806D +GL_UNPACK_IMAGE_HEIGHT_EXT = $806E +GL_TEXTURE_3D_EXT = $806F +GL_PROXY_TEXTURE_3D_EXT = $8070 +GL_TEXTURE_DEPTH_EXT = $8071 +GL_TEXTURE_WRAP_R_EXT = $8072 +GL_MAX_3D_TEXTURE_SIZE_EXT = $8073 + +; SGI_color_matrix + +GL_COLOR_MATRIX_SGI = $80B1 +GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2 +GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3 +GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4 +GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5 +GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6 +GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7 +GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8 +GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9 +GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA +GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB + +; SGI_texture_color_table + +GL_TEXTURE_COLOR_TABLE_SGI = $80BC +GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD +GL_TEXTURE_COLOR_TABLE_BIAS_SGI = $80BE +GL_TEXTURE_COLOR_TABLE_SCALE_SGI = $80BF + +; SGI_color_table + +GL_COLOR_TABLE_SGI = $80D0 +GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1 +GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2 +GL_PROXY_COLOR_TABLE_SGI = $80D3 +GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4 +GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5 +GL_COLOR_TABLE_SCALE_SGI = $80D6 +GL_COLOR_TABLE_BIAS_SGI = $80D7 +GL_COLOR_TABLE_FORMAT_SGI = $80D8 +GL_COLOR_TABLE_WIDTH_SGI = $80D9 +GL_COLOR_TABLE_RED_SIZE_SGI = $80DA +GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB +GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC +GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD +GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE +GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF + +; EXT_cmyka + +GL_CMYK_EXT = $800C +GL_CMYKA_EXT = $800D +GL_PACK_CMYK_HINT_EXT = $800E +GL_UNPACK_CMYK_HINT_EXT = $800F + +; EXT_rescale_normal + +GL_RESCALE_NORMAL_EXT = $803A + +; EXT_clip_volume_hint + +GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0 + +; EXT_cull_vertex + +GL_CULL_VERTEX_EXT = $81AA +GL_CULL_VERTEX_EYE_POSITION_EXT = $81AB +GL_CULL_VERTEX_OBJECT_POSITION_EXT = $81AC + +; EXT_index_array_formats + +GL_IUI_V2F_EXT = $81AD +GL_IUI_V3F_EXT = $81AE +GL_IUI_N3F_V2F_EXT = $81AF +GL_IUI_N3F_V3F_EXT = $81B0 +GL_T2F_IUI_V2F_EXT = $81B1 +GL_T2F_IUI_V3F_EXT = $81B2 +GL_T2F_IUI_N3F_V2F_EXT = $81B3 +GL_T2F_IUI_N3F_V3F_EXT = $81B4 + +; EXT_index_func + +GL_INDEX_TEST_EXT = $81B5 +GL_INDEX_TEST_FUNC_EXT = $81B6 +GL_INDEX_TEST_REF_EXT = $81B7 + +; EXT_index_material + +GL_INDEX_MATERIAL_EXT = $81B8 +GL_INDEX_MATERIAL_PARAMETER_EXT = $81B9 +GL_INDEX_MATERIAL_FACE_EXT = $81BA + +; EXT_shared_texture_palette + +GL_SHARED_TEXTURE_PALETTE_EXT = $81FB + +; EXT_nurbs_tessellator + +GLU_NURBS_MODE_EXT = 100160 +GLU_NURBS_TESSELLATOR_EXT = 100161 +GLU_NURBS_RENDERER_EXT = 100162 +GLU_NURBS_BEGIN_EXT = 100164 +GLU_NURBS_VERTEX_EXT = 100165 +GLU_NURBS_NORMAL_EXT = 100166 +GLU_NURBS_COLOR_EXT = 100167 +GLU_NURBS_TEX_COORD_EXT = 100168 +GLU_NURBS_END_EXT = 100169 +GLU_NURBS_BEGIN_DATA_EXT = 100170 +GLU_NURBS_VERTEX_DATA_EXT = 100171 +GLU_NURBS_NORMAL_DATA_EXT = 100172 +GLU_NURBS_COLOR_DATA_EXT = 100173 +GLU_NURBS_TEX_COORD_DATA_EXT = 100174 +GLU_NURBS_END_DATA_EXT = 100175 + +; EXT_object_space_tess + +GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208 +GLU_OBJECT_PATH_LENGTH_EXT = 100209 + +; EXT_point_parameters + +GL_POINT_SIZE_MIN_EXT = $8126 +GL_POINT_SIZE_MAX_EXT = $8127 +GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128 +GL_DISTANCE_ATTENUATION_EXT = $8129 + +; EXT_compiled_vertex_array + +GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8 +GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9 + +; ARB_multitexture + +GL_ACTIVE_TEXTURE_ARB = $84E0 +GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1 +GL_MAX_TEXTURE_UNITS_ARB = $84E2 +GL_TEXTURE0_ARB = $84C0 +GL_TEXTURE1_ARB = $84C1 +GL_TEXTURE2_ARB = $84C2 +GL_TEXTURE3_ARB = $84C3 +GL_TEXTURE4_ARB = $84C4 +GL_TEXTURE5_ARB = $84C5 +GL_TEXTURE6_ARB = $84C6 +GL_TEXTURE7_ARB = $84C7 +GL_TEXTURE8_ARB = $84C8 +GL_TEXTURE9_ARB = $84C9 +GL_TEXTURE10_ARB = $84CA +GL_TEXTURE11_ARB = $84CB +GL_TEXTURE12_ARB = $84CC +GL_TEXTURE13_ARB = $84CD +GL_TEXTURE14_ARB = $84CE +GL_TEXTURE15_ARB = $84CF +GL_TEXTURE16_ARB = $84D0 +GL_TEXTURE17_ARB = $84D1 +GL_TEXTURE18_ARB = $84D2 +GL_TEXTURE19_ARB = $84D3 +GL_TEXTURE20_ARB = $84D4 +GL_TEXTURE21_ARB = $84D5 +GL_TEXTURE22_ARB = $84D6 +GL_TEXTURE23_ARB = $84D7 +GL_TEXTURE24_ARB = $84D8 +GL_TEXTURE25_ARB = $84D9 +GL_TEXTURE26_ARB = $84DA +GL_TEXTURE27_ARB = $84DB +GL_TEXTURE28_ARB = $84DC +GL_TEXTURE29_ARB = $84DD +GL_TEXTURE30_ARB = $84DE +GL_TEXTURE31_ARB = $84DF + +; EXT_stencil_wrap + +GL_INCR_WRAP_EXT = $8507 +GL_DECR_WRAP_EXT = $8508 + +; NV_texgen_reflection + +GL_NORMAL_MAP_NV = $8511 +GL_REFLECTION_MAP_NV = $8512 + +; EXT_texture_env_combine + +GL_COMBINE_EXT = $8570 +GL_COMBINE_RGB_EXT = $8571 +GL_COMBINE_ALPHA_EXT = $8572 +GL_RGB_SCALE_EXT = $8573 +GL_ADD_SIGNED_EXT = $8574 +GL_INTERPOLATE_EXT = $8575 +GL_CONSTANT_EXT = $8576 +GL_PRIMARY_COLOR_EXT = $8577 +GL_PREVIOUS_EXT = $8578 +GL_SOURCE0_RGB_EXT = $8580 +GL_SOURCE1_RGB_EXT = $8581 +GL_SOURCE2_RGB_EXT = $8582 +GL_SOURCE0_ALPHA_EXT = $8588 +GL_SOURCE1_ALPHA_EXT = $8589 +GL_SOURCE2_ALPHA_EXT = $858A +GL_OPERAND0_RGB_EXT = $8590 +GL_OPERAND1_RGB_EXT = $8591 +GL_OPERAND2_RGB_EXT = $8592 +GL_OPERAND0_ALPHA_EXT = $8598 +GL_OPERAND1_ALPHA_EXT = $8599 +GL_OPERAND2_ALPHA_EXT = $859A + +; NV_texture_env_combine4 + +GL_COMBINE4_NV = $8503 +GL_SOURCE3_RGB_NV = $8583 +GL_SOURCE3_ALPHA_NV = $858B +GL_OPERAND3_RGB_NV = $8593 +GL_OPERAND3_ALPHA_NV = $859B + +GL_BLEND_EQUATION = $8009 +GL_TABLE_TOO_LARGE = $8031 +GL_UNSIGNED_BYTE_3_3_2 = $8032 +GL_UNSIGNED_SHORT_4_4_4_4 = $8033 +GL_UNSIGNED_SHORT_5_5_5_1 = $8034 +GL_UNSIGNED_INT_8_8_8_8 = $8035 +GL_UNSIGNED_INT_10_10_10_2 = $8036 +GL_UNSIGNED_BYTE_2_3_3_REV = $8362 +GL_UNSIGNED_SHORT_5_6_5 = $8363 +GL_UNSIGNED_SHORT_5_6_5_REV = $8364 +GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365 +GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366 +GL_UNSIGNED_INT_8_8_8_8_REV = $8367 +GL_UNSIGNED_INT_2_10_10_10_REV = $8368 + +; GL_ARB_transpose_matrix + +GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3 +GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4 +GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5 +GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6 + +; GL_ARB_multisample + +GL_MULTISAMPLE_ARB = $809D +GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E +GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F +GL_SAMPLE_COVERAGE_ARB = $80A0 +GL_SAMPLE_BUFFERS_ARB = $80A8 +GL_SAMPLES_ARB = $80A9 +GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA +GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB +GL_MULTISAMPLE_BIT_ARB = $20000000 + +; GL_ARB_texture_cube_map + +GL_NORMAL_MAP_ARB = $8511 +GL_REFLECTION_MAP_ARB = $8512 +GL_TEXTURE_CUBE_MAP_ARB = $8513 +GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514 +GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515 +GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516 +GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517 +GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518 +GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519 +GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A +GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B +GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C + +; GL_ARB_texture_compression + +GL_COMPRESSED_ALPHA_ARB = $84E9 +GL_COMPRESSED_LUMINANCE_ARB = $84EA +GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB +GL_COMPRESSED_INTENSITY_ARB = $84EC +GL_COMPRESSED_RGB_ARB = $84ED +GL_COMPRESSED_RGBA_ARB = $84EE +GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF +GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0 +GL_TEXTURE_COMPRESSED_ARB = $86A1 +GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2 +GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3 + +; GL_ARB_vertex_blend + +GL_MAX_VERTEX_UNITS_ARB = $86A4 +GL_ACTIVE_VERTEX_UNITS_ARB = $86A5 +GL_WEIGHT_SUM_UNITY_ARB = $86A6 +GL_VERTEX_BLEND_ARB = $86A7 +GL_CURRENT_WEIGHT_ARB = $86A8 +GL_WEIGHT_ARRAY_TYPE_ARB = $86A9 +GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA +GL_WEIGHT_ARRAY_SIZE_ARB = $86AB +GL_WEIGHT_ARRAY_POINTER_ARB = $86AC +GL_WEIGHT_ARRAY_ARB = $86AD +GL_MODELVIEW0_ARB = $1700 +GL_MODELVIEW1_ARB = $850A +GL_MODELVIEW2_ARB = $8722 +GL_MODELVIEW3_ARB = $8723 +GL_MODELVIEW4_ARB = $8724 +GL_MODELVIEW5_ARB = $8725 +GL_MODELVIEW6_ARB = $8726 +GL_MODELVIEW7_ARB = $8727 +GL_MODELVIEW8_ARB = $8728 +GL_MODELVIEW9_ARB = $8729 +GL_MODELVIEW10_ARB = $872A +GL_MODELVIEW11_ARB = $872B +GL_MODELVIEW12_ARB = $872C +GL_MODELVIEW13_ARB = $872D +GL_MODELVIEW14_ARB = $872E +GL_MODELVIEW15_ARB = $872F +GL_MODELVIEW16_ARB = $8730 +GL_MODELVIEW17_ARB = $8731 +GL_MODELVIEW18_ARB = $8732 +GL_MODELVIEW19_ARB = $8733 +GL_MODELVIEW20_ARB = $8734 +GL_MODELVIEW21_ARB = $8735 +GL_MODELVIEW22_ARB = $8736 +GL_MODELVIEW23_ARB = $8737 +GL_MODELVIEW24_ARB = $8738 +GL_MODELVIEW25_ARB = $8739 +GL_MODELVIEW26_ARB = $873A +GL_MODELVIEW27_ARB = $873B +GL_MODELVIEW28_ARB = $873C +GL_MODELVIEW29_ARB = $873D +GL_MODELVIEW30_ARB = $873E +GL_MODELVIEW31_ARB = $873F + +; GL_SGIS_texture_filter4 + +GL_FILTER4_SGIS = $8146 +GL_TEXTURE_FILTER4_SIZE_SGIS = $8147 + +; GL_SGIS_pixel_texture + +GL_PIXEL_TEXTURE_SGIS = $8353 +GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354 +GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355 +GL_PIXEL_GROUP_COLOR_SGIS = $8356 + +; GL_SGIX_pixel_texture + +GL_PIXEL_TEX_GEN_SGIX = $8139 +GL_PIXEL_TEX_GEN_MODE_SGIX = $832B + +; GL_SGIS_texture4D + +GL_PACK_SKIP_VOLUMES_SGIS = $8130 +GL_PACK_IMAGE_DEPTH_SGIS = $8131 +GL_UNPACK_SKIP_VOLUMES_SGIS = $8132 +GL_UNPACK_IMAGE_DEPTH_SGIS = $8133 +GL_TEXTURE_4D_SGIS = $8134 +GL_PROXY_TEXTURE_4D_SGIS = $8135 +GL_TEXTURE_4DSIZE_SGIS = $8136 +GL_TEXTURE_WRAP_Q_SGIS = $8137 +GL_MAX_4D_TEXTURE_SIZE_SGIS = $8138 +GL_TEXTURE_4D_BINDING_SGIS = $814F + +; GL_SGIS_detail_texture + +GL_DETAIL_TEXTURE_2D_SGIS = $8095 +GL_DETAIL_TEXTURE_2D_BINDING_SGIS = $8096 +GL_LINEAR_DETAIL_SGIS = $8097 +GL_LINEAR_DETAIL_ALPHA_SGIS = $8098 +GL_LINEAR_DETAIL_COLOR_SGIS = $8099 +GL_DETAIL_TEXTURE_LEVEL_SGIS = $809A +GL_DETAIL_TEXTURE_MODE_SGIS = $809B +GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = $809C + +; GL_SGIS_sharpen_texture + +GL_LINEAR_SHARPEN_SGIS = $80AD +GL_LINEAR_SHARPEN_ALPHA_SGIS = $80AE +GL_LINEAR_SHARPEN_COLOR_SGIS = $80AF +GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = $80B0 + +; GL_SGIS_texture_lod + +GL_TEXTURE_MIN_LOD_SGIS = $813A +GL_TEXTURE_MAX_LOD_SGIS = $813B +GL_TEXTURE_BASE_LEVEL_SGIS = $813C +GL_TEXTURE_MAX_LEVEL_SGIS = $813D + +; GL_SGIS_multisample + +GL_MULTISAMPLE_SGIS = $809D +GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E +GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F +GL_SAMPLE_MASK_SGIS = $80A0 +GL_1PASS_SGIS = $80A1 +GL_2PASS_0_SGIS = $80A2 +GL_2PASS_1_SGIS = $80A3 +GL_4PASS_0_SGIS = $80A4 +GL_4PASS_1_SGIS = $80A5 +GL_4PASS_2_SGIS = $80A6 +GL_4PASS_3_SGIS = $80A7 +GL_SAMPLE_BUFFERS_SGIS = $80A8 +GL_SAMPLES_SGIS = $80A9 +GL_SAMPLE_MASK_VALUE_SGIS = $80AA +GL_SAMPLE_MASK_INVERT_SGIS = $80AB +GL_SAMPLE_PATTERN_SGIS = $80AC + +; GL_SGIS_generate_mipmap + +GL_GENERATE_MIPMAP_SGIS = $8191 +GL_GENERATE_MIPMAP_HINT_SGIS = $8192 + +; GL_SGIX_clipmap + +GL_LINEAR_CLIPMAP_LINEAR_SGIX = $8170 +GL_TEXTURE_CLIPMAP_CENTER_SGIX = $8171 +GL_TEXTURE_CLIPMAP_FRAME_SGIX = $8172 +GL_TEXTURE_CLIPMAP_OFFSET_SGIX = $8173 +GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8174 +GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = $8175 +GL_TEXTURE_CLIPMAP_DEPTH_SGIX = $8176 +GL_MAX_CLIPMAP_DEPTH_SGIX = $8177 +GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8178 +GL_NEAREST_CLIPMAP_NEAREST_SGIX = $844D +GL_NEAREST_CLIPMAP_LINEAR_SGIX = $844E +GL_LINEAR_CLIPMAP_NEAREST_SGIX = $844F + +; GL_SGIX_shadow + +GL_TEXTURE_COMPARE_SGIX = $819A +GL_TEXTURE_COMPARE_OPERATOR_SGIX = $819B +GL_TEXTURE_LEQUAL_R_SGIX = $819C +GL_TEXTURE_GEQUAL_R_SGIX = $819D + +; GL_SGIS_texture_edge_clamp + +GL_CLAMP_TO_EDGE_SGIS = $812F + +; GL_SGIS_texture_border_clamp + +GL_CLAMP_TO_BORDER_SGIS = $812D + +; GL_SGIX_interlace + +GL_INTERLACE_SGIX = $8094 + +; GL_SGIX_pixel_tiles + +GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = $813E +GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = $813F +GL_PIXEL_TILE_WIDTH_SGIX = $8140 +GL_PIXEL_TILE_HEIGHT_SGIX = $8141 +GL_PIXEL_TILE_GRID_WIDTH_SGIX = $8142 +GL_PIXEL_TILE_GRID_HEIGHT_SGIX = $8143 +GL_PIXEL_TILE_GRID_DEPTH_SGIX = $8144 +GL_PIXEL_TILE_CACHE_SIZE_SGIX = $8145 + +; GL_SGIS_texture_select + +GL_DUAL_ALPHA4_SGIS = $8110 +GL_DUAL_ALPHA8_SGIS = $8111 +GL_DUAL_ALPHA12_SGIS = $8112 +GL_DUAL_ALPHA16_SGIS = $8113 +GL_DUAL_LUMINANCE4_SGIS = $8114 +GL_DUAL_LUMINANCE8_SGIS = $8115 +GL_DUAL_LUMINANCE12_SGIS = $8116 +GL_DUAL_LUMINANCE16_SGIS = $8117 +GL_DUAL_INTENSITY4_SGIS = $8118 +GL_DUAL_INTENSITY8_SGIS = $8119 +GL_DUAL_INTENSITY12_SGIS = $811A +GL_DUAL_INTENSITY16_SGIS = $811B +GL_DUAL_LUMINANCE_ALPHA4_SGIS = $811C +GL_DUAL_LUMINANCE_ALPHA8_SGIS = $811D +GL_QUAD_ALPHA4_SGIS = $811E +GL_QUAD_ALPHA8_SGIS = $811F +GL_QUAD_LUMINANCE4_SGIS = $8120 +GL_QUAD_LUMINANCE8_SGIS = $8121 +GL_QUAD_INTENSITY4_SGIS = $8122 +GL_QUAD_INTENSITY8_SGIS = $8123 +GL_DUAL_TEXTURE_SELECT_SGIS = $8124 +GL_QUAD_TEXTURE_SELECT_SGIS = $8125 + +; GL_SGIX_sprite + +GL_SPRITE_SGIX = $8148 +GL_SPRITE_MODE_SGIX = $8149 +GL_SPRITE_AXIS_SGIX = $814A +GL_SPRITE_TRANSLATION_SGIX = $814B +GL_SPRITE_AXIAL_SGIX = $814C +GL_SPRITE_OBJECT_ALIGNED_SGIX = $814D +GL_SPRITE_EYE_ALIGNED_SGIX = $814E + +; GL_SGIX_texture_multi_buffer + +GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = $812E + +; GL_SGIS_point_parameters + +GL_POINT_SIZE_MIN_SGIS = $8126 +GL_POINT_SIZE_MAX_SGIS = $8127 +GL_POINT_FADE_THRESHOLD_SIZE_SGIS = $8128 +GL_DISTANCE_ATTENUATION_SGIS = $8129 + +; GL_SGIX_instruments + +GL_INSTRUMENT_BUFFER_POINTER_SGIX = $8180 +GL_INSTRUMENT_MEASUREMENTS_SGIX = $8181 + +; GL_SGIX_texture_scale_bias + +GL_POST_TEXTURE_FILTER_BIAS_SGIX = $8179 +GL_POST_TEXTURE_FILTER_SCALE_SGIX = $817A +GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = $817B +GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = $817C + +; GL_SGIX_framezoom + +GL_FRAMEZOOM_SGIX = $818B +GL_FRAMEZOOM_FACTOR_SGIX = $818C +GL_MAX_FRAMEZOOM_FACTOR_SGIX = $818D + +; GL_FfdMaskSGIX + +GL_TEXTURE_DEFORMATION_BIT_SGIX = $00000001 +GL_GEOMETRY_DEFORMATION_BIT_SGIX = $00000002 + +; GL_SGIX_polynomial_ffd + +GL_GEOMETRY_DEFORMATION_SGIX = $8194 +GL_TEXTURE_DEFORMATION_SGIX = $8195 +GL_DEFORMATIONS_MASK_SGIX = $8196 +GL_MAX_DEFORMATION_ORDER_SGIX = $8197 + +; GL_SGIX_reference_plane + +GL_REFERENCE_PLANE_SGIX = $817D +GL_REFERENCE_PLANE_EQUATION_SGIX = $817E + +; GL_SGIX_depth_texture + +GL_DEPTH_COMPONENT16_SGIX = $81A5 +GL_DEPTH_COMPONENT24_SGIX = $81A6 +GL_DEPTH_COMPONENT32_SGIX = $81A7 + +; GL_SGIS_fog_function + +GL_FOG_FUNC_SGIS = $812A +GL_FOG_FUNC_POINTS_SGIS = $812B +GL_MAX_FOG_FUNC_POINTS_SGIS = $812C + +; GL_SGIX_fog_offset + +GL_FOG_OFFSET_SGIX = $8198 +GL_FOG_OFFSET_VALUE_SGIX = $8199 + +; GL_HP_image_transform + +GL_IMAGE_SCALE_X_HP = $8155 +GL_IMAGE_SCALE_Y_HP = $8156 +GL_IMAGE_TRANSLATE_X_HP = $8157 +GL_IMAGE_TRANSLATE_Y_HP = $8158 +GL_IMAGE_ROTATE_ANGLE_HP = $8159 +GL_IMAGE_ROTATE_ORIGIN_X_HP = $815A +GL_IMAGE_ROTATE_ORIGIN_Y_HP = $815B +GL_IMAGE_MAG_FILTER_HP = $815C +GL_IMAGE_MIN_FILTER_HP = $815D +GL_IMAGE_CUBIC_WEIGHT_HP = $815E +GL_CUBIC_HP = $815F +GL_AVERAGE_HP = $8160 +GL_IMAGE_TRANSFORM_2D_HP = $8161 +GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8162 +GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8163 + +; GL_HP_convolution_border_modes + +GL_IGNORE_BORDER_HP = $8150 +GL_CONSTANT_BORDER_HP = $8151 +GL_REPLICATE_BORDER_HP = $8153 +GL_CONVOLUTION_BORDER_COLOR_HP = $8154 + +; GL_SGIX_texture_add_env + +GL_TEXTURE_ENV_BIAS_SGIX = $80BE + +; GL_PGI_vertex_hints + +GL_VERTEX_DATA_HINT_PGI = $1A22A +GL_VERTEX_CONSISTENT_HINT_PGI = $1A22B +GL_MATERIAL_SIDE_HINT_PGI = $1A22C +GL_MAX_VERTEX_HINT_PGI = $1A22D +GL_COLOR3_BIT_PGI = $00010000 +GL_COLOR4_BIT_PGI = $00020000 +GL_EDGEFLAG_BIT_PGI = $00040000 +GL_INDEX_BIT_PGI = $00080000 +GL_MAT_AMBIENT_BIT_PGI = $00100000 +GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = $00200000 +GL_MAT_DIFFUSE_BIT_PGI = $00400000 +GL_MAT_EMISSION_BIT_PGI = $00800000 +GL_MAT_COLOR_INDEXES_BIT_PGI = $01000000 +GL_MAT_SHININESS_BIT_PGI = $02000000 +GL_MAT_SPECULAR_BIT_PGI = $04000000 +GL_NORMAL_BIT_PGI = $08000000 +GL_TEXCOORD1_BIT_PGI = $10000000 +GL_TEXCOORD2_BIT_PGI = $20000000 +GL_TEXCOORD3_BIT_PGI = $40000000 +GL_TEXCOORD4_BIT_PGI = $80000000 +GL_VERTEX23_BIT_PGI = $00000004 +GL_VERTEX4_BIT_PGI = $00000008 + +; GL_PGI_misc_hints + +GL_PREFER_DOUBLEBUFFER_HINT_PGI = $1A1F8 +GL_CONSERVE_MEMORY_HINT_PGI = $1A1FD +GL_RECLAIM_MEMORY_HINT_PGI = $1A1FE +GL_NATIVE_GRAPHICS_HANDLE_PGI = $1A202 +GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = $1A203 +GL_NATIVE_GRAPHICS_END_HINT_PGI = $1A204 +GL_ALWAYS_FAST_HINT_PGI = $1A20C +GL_ALWAYS_SOFT_HINT_PGI = $1A20D +GL_ALLOW_DRAW_OBJ_HINT_PGI = $1A20E +GL_ALLOW_DRAW_WIN_HINT_PGI = $1A20F +GL_ALLOW_DRAW_FRG_HINT_PGI = $1A210 +GL_ALLOW_DRAW_MEM_HINT_PGI = $1A211 +GL_STRICT_DEPTHFUNC_HINT_PGI = $1A216 +GL_STRICT_LIGHTING_HINT_PGI = $1A217 +GL_STRICT_SCISSOR_HINT_PGI = $1A218 +GL_FULL_STIPPLE_HINT_PGI = $1A219 +GL_CLIP_NEAR_HINT_PGI = $1A220 +GL_CLIP_FAR_HINT_PGI = $1A221 +GL_WIDE_LINE_HINT_PGI = $1A222 +GL_BACK_NORMALS_HINT_PGI = $1A223 + +; GL_EXT_paletted_texture + +GL_TEXTURE_INDEX_SIZE_EXT = $80ED + +; GL_SGIX_list_priority + +GL_LIST_PRIORITY_SGIX = $8182 + +; GL_SGIX_ir_instrument1 + +GL_IR_INSTRUMENT1_SGIX = $817F + +; GL_SGIX_calligraphic_fragment + +GL_CALLIGRAPHIC_FRAGMENT_SGIX = $8183 + +; GL_SGIX_texture_lod_bias + +GL_TEXTURE_LOD_BIAS_S_SGIX = $818E +GL_TEXTURE_LOD_BIAS_T_SGIX = $818F +GL_TEXTURE_LOD_BIAS_R_SGIX = $8190 + +; GL_SGIX_shadow_ambient + +GL_SHADOW_AMBIENT_SGIX = $80BF + +; GL_SGIX_ycrcb + +GL_YCRCB_422_SGIX = $81BB +GL_YCRCB_444_SGIX = $81BC + +; GL_SGIX_fragment_lighting + +GL_FRAGMENT_LIGHTING_SGIX = $8400 +GL_FRAGMENT_COLOR_MATERIAL_SGIX = $8401 +GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = $8402 +GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = $8403 +GL_MAX_FRAGMENT_LIGHTS_SGIX = $8404 +GL_MAX_ACTIVE_LIGHTS_SGIX = $8405 +GL_CURRENT_RASTER_NORMAL_SGIX = $8406 +GL_LIGHT_ENV_MODE_SGIX = $8407 +GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = $8408 +GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = $8409 +GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = $840A +GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = $840B +GL_FRAGMENT_LIGHT0_SGIX = $840C +GL_FRAGMENT_LIGHT1_SGIX = $840D +GL_FRAGMENT_LIGHT2_SGIX = $840E +GL_FRAGMENT_LIGHT3_SGIX = $840F +GL_FRAGMENT_LIGHT4_SGIX = $8410 +GL_FRAGMENT_LIGHT5_SGIX = $8411 +GL_FRAGMENT_LIGHT6_SGIX = $8412 +GL_FRAGMENT_LIGHT7_SGIX = $8413 + +; GL_IBM_rasterpos_clip + +GL_RASTER_POSITION_UNCLIPPED_IBM = $19262 + +; GL_HP_texture_lighting + +GL_TEXTURE_LIGHTING_MODE_HP = $8167 +GL_TEXTURE_POST_SPECULAR_HP = $8168 +GL_TEXTURE_PRE_SPECULAR_HP = $8169 + +; GL_EXT_draw_range_elements + +GL_MAX_ELEMENTS_VERTICES_EXT = $80E8 +GL_MAX_ELEMENTS_INDICES_EXT = $80E9 + +; GL_WIN_phong_shading + +GL_PHONG_WIN = $80EA +GL_PHONG_HINT_WIN = $80EB + +; GL_WIN_specular_fog + +GL_FOG_SPECULAR_TEXTURE_WIN = $80EC + +; GL_EXT_light_texture + +GL_FRAGMENT_MATERIAL_EXT = $8349 +GL_FRAGMENT_NORMAL_EXT = $834A +GL_FRAGMENT_COLOR_EXT = $834C +GL_ATTENUATION_EXT = $834D +GL_SHADOW_ATTENUATION_EXT = $834E +GL_TEXTURE_APPLICATION_MODE_EXT = $834F +GL_TEXTURE_LIGHT_EXT = $8350 +GL_TEXTURE_MATERIAL_FACE_EXT = $8351 +GL_TEXTURE_MATERIAL_PARAMETER_EXT = $8352 + +; GL_SGIX_blend_alpha_minmax + +GL_ALPHA_MIN_SGIX = $8320 +GL_ALPHA_MAX_SGIX = $8321 + +; GL_SGIX_async + +GL_ASYNC_MARKER_SGIX = $8329 + +; GL_SGIX_async_pixel + +GL_ASYNC_TEX_IMAGE_SGIX = $835C +GL_ASYNC_DRAW_PIXELS_SGIX = $835D +GL_ASYNC_READ_PIXELS_SGIX = $835E +GL_MAX_ASYNC_TEX_IMAGE_SGIX = $835F +GL_MAX_ASYNC_DRAW_PIXELS_SGIX = $8360 +GL_MAX_ASYNC_READ_PIXELS_SGIX = $8361 + +; GL_SGIX_async_histogram + +GL_ASYNC_HISTOGRAM_SGIX = $832C +GL_MAX_ASYNC_HISTOGRAM_SGIX = $832D + +; GL_INTEL_parallel_arrays + +GL_PARALLEL_ARRAYS_INTEL = $83F4 +GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = $83F5 +GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = $83F6 +GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = $83F7 +GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = $83F8 + +; GL_HP_occlusion_test + +GL_OCCLUSION_TEST_HP = $8165 +GL_OCCLUSION_TEST_RESULT_HP = $8166 + +; GL_EXT_pixel_transform + +GL_PIXEL_TRANSFORM_2D_EXT = $8330 +GL_PIXEL_MAG_FILTER_EXT = $8331 +GL_PIXEL_MIN_FILTER_EXT = $8332 +GL_PIXEL_CUBIC_WEIGHT_EXT = $8333 +GL_CUBIC_EXT = $8334 +GL_AVERAGE_EXT = $8335 +GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8336 +GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8337 +GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = $8338 + +; GL_EXT_separate_specular_color + +GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8 +GL_SINGLE_COLOR_EXT = $81F9 +GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA + +; GL_EXT_secondary_color + +GL_COLOR_SUM_EXT = $8458 +GL_CURRENT_SECONDARY_COLOR_EXT = $8459 +GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A +GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B +GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C +GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D +GL_SECONDARY_COLOR_ARRAY_EXT = $845E + +; GL_EXT_texture_perturb_normal + +GL_PERTURB_EXT = $85AE +GL_TEXTURE_NORMAL_EXT = $85AF + +; GL_EXT_fog_coord + +GL_FOG_COORDINATE_SOURCE_EXT = $8450 +GL_FOG_COORDINATE_EXT = $8451 +GL_FRAGMENT_DEPTH_EXT = $8452 +GL_CURRENT_FOG_COORDINATE_EXT = $8453 +GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454 +GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455 +GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456 +GL_FOG_COORDINATE_ARRAY_EXT = $8457 + +; GL_REND_screen_coordinates + +GL_SCREEN_COORDINATES_REND = $8490 +GL_INVERTED_SCREEN_W_REND = $8491 + +; GL_EXT_coordinate_frame + +GL_TANGENT_ARRAY_EXT = $8439 +GL_BINORMAL_ARRAY_EXT = $843A +GL_CURRENT_TANGENT_EXT = $843B +GL_CURRENT_BINORMAL_EXT = $843C +GL_TANGENT_ARRAY_TYPE_EXT = $843E +GL_TANGENT_ARRAY_STRIDE_EXT = $843F +GL_BINORMAL_ARRAY_TYPE_EXT = $8440 +GL_BINORMAL_ARRAY_STRIDE_EXT = $8441 +GL_TANGENT_ARRAY_POINTER_EXT = $8442 +GL_BINORMAL_ARRAY_POINTER_EXT = $8443 +GL_MAP1_TANGENT_EXT = $8444 +GL_MAP2_TANGENT_EXT = $8445 +GL_MAP1_BINORMAL_EXT = $8446 +GL_MAP2_BINORMAL_EXT = $8447 + +; GL_EXT_texture_env_combine + +GL_SOURCE3_RGB_EXT = $8583 +GL_SOURCE4_RGB_EXT = $8584 +GL_SOURCE5_RGB_EXT = $8585 +GL_SOURCE6_RGB_EXT = $8586 +GL_SOURCE7_RGB_EXT = $8587 +GL_SOURCE3_ALPHA_EXT = $858B +GL_SOURCE4_ALPHA_EXT = $858C +GL_SOURCE5_ALPHA_EXT = $858D +GL_SOURCE6_ALPHA_EXT = $858E +GL_SOURCE7_ALPHA_EXT = $858F +GL_OPERAND3_RGB_EXT = $8593 +GL_OPERAND4_RGB_EXT = $8594 +GL_OPERAND5_RGB_EXT = $8595 +GL_OPERAND6_RGB_EXT = $8596 +GL_OPERAND7_RGB_EXT = $8597 +GL_OPERAND3_ALPHA_EXT = $859B +GL_OPERAND4_ALPHA_EXT = $859C +GL_OPERAND5_ALPHA_EXT = $859D +GL_OPERAND6_ALPHA_EXT = $859E +GL_OPERAND7_ALPHA_EXT = $859F + +; GL_APPLE_specular_vector + +GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = $85B0 + +; GL_APPLE_transform_hint + +GL_TRANSFORM_HINT_APPLE = $85B1 + +; GL_SGIX_fog_scale + +GL_FOG_SCALE_SGIX = $81FC +GL_FOG_SCALE_VALUE_SGIX = $81FD + +; GL_SUNX_constant_data + +GL_UNPACK_CONSTANT_DATA_SUNX = $81D5 +GL_TEXTURE_CONSTANT_DATA_SUNX = $81D6 + +; GL_SUN_global_alpha + +GL_GLOBAL_ALPHA_SUN = $81D9 +GL_GLOBAL_ALPHA_FACTOR_SUN = $81DA + +; GL_SUN_triangle_list + +GL_RESTART_SUN = $01 +GL_REPLACE_MIDDLE_SUN = $02 +GL_REPLACE_OLDEST_SUN = $03 +GL_TRIANGLE_LIST_SUN = $81D7 +GL_REPLACEMENT_CODE_SUN = $81D8 +GL_REPLACEMENT_CODE_ARRAY_SUN = $85C0 +GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = $85C1 +GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = $85C2 +GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = $85C3 +GL_R1UI_V3F_SUN = $85C4 +GL_R1UI_C4UB_V3F_SUN = $85C5 +GL_R1UI_C3F_V3F_SUN = $85C6 +GL_R1UI_N3F_V3F_SUN = $85C7 +GL_R1UI_C4F_N3F_V3F_SUN = $85C8 +GL_R1UI_T2F_V3F_SUN = $85C9 +GL_R1UI_T2F_N3F_V3F_SUN = $85CA +GL_R1UI_T2F_C4F_N3F_V3F_SUN = $85CB + +; GL_EXT_blend_func_separate + +GL_BLEND_DST_RGB_EXT = $80C8 +GL_BLEND_SRC_RGB_EXT = $80C9 +GL_BLEND_DST_ALPHA_EXT = $80CA +GL_BLEND_SRC_ALPHA_EXT = $80CB + +; GL_INGR_color_clamp + +GL_RED_MIN_CLAMP_INGR = $8560 +GL_GREEN_MIN_CLAMP_INGR = $8561 +GL_BLUE_MIN_CLAMP_INGR = $8562 +GL_ALPHA_MIN_CLAMP_INGR = $8563 +GL_RED_MAX_CLAMP_INGR = $8564 +GL_GREEN_MAX_CLAMP_INGR = $8565 +GL_BLUE_MAX_CLAMP_INGR = $8566 +GL_ALPHA_MAX_CLAMP_INGR = $8567 + +; GL_INGR_interlace_read + +GL_INTERLACE_READ_INGR = $8568 + +; GL_EXT_422_pixels + +GL_422_EXT = $80CC +GL_422_REV_EXT = $80CD +GL_422_AVERAGE_EXT = $80CE +GL_422_REV_AVERAGE_EXT = $80CF + +; GL_EXT_texture_cube_map + +GL_NORMAL_MAP_EXT = $8511 +GL_REFLECTION_MAP_EXT = $8512 +GL_TEXTURE_CUBE_MAP_EXT = $8513 +GL_TEXTURE_BINDING_CUBE_MAP_EXT = $8514 +GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = $8515 +GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = $8516 +GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = $8517 +GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = $8518 +GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = $8519 +GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = $851A +GL_PROXY_TEXTURE_CUBE_MAP_EXT = $851B +GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = $851C + +; GL_SUN_convolution_border_modes + +GL_WRAP_BORDER_SUN = $81D4 + +; GL_EXT_texture_lod_bias + +GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD +GL_TEXTURE_FILTER_CONTROL_EXT = $8500 +GL_TEXTURE_LOD_BIAS_EXT = $8501 + +; GL_EXT_texture_filter_anisotropic + +GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE +GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF + +; GL_EXT_vertex_weighting + +GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH +GL_MODELVIEW1_STACK_DEPTH_EXT = $8502 +GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX +GL_MODELVIEW_MATRIX1_EXT = $8506 +GL_VERTEX_WEIGHTING_EXT = $8509 +GL_MODELVIEW0_EXT = GL_MODELVIEW +GL_MODELVIEW1_EXT = $850A +GL_CURRENT_VERTEX_WEIGHT_EXT = $850B +GL_VERTEX_WEIGHT_ARRAY_EXT = $850C +GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D +GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E +GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F +GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510 + +; GL_NV_light_max_exponent + +GL_MAX_SHININESS_NV = $8504 +GL_MAX_SPOT_EXPONENT_NV = $8505 + +; GL_NV_vertex_array_range + +GL_VERTEX_ARRAY_RANGE_NV = $851D +GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E +GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F +GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520 +GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521 + +; GL_NV_register_combiners + +GL_REGISTER_COMBINERS_NV = $8522 +GL_VARIABLE_A_NV = $8523 +GL_VARIABLE_B_NV = $8524 +GL_VARIABLE_C_NV = $8525 +GL_VARIABLE_D_NV = $8526 +GL_VARIABLE_E_NV = $8527 +GL_VARIABLE_F_NV = $8528 +GL_VARIABLE_G_NV = $8529 +GL_CONSTANT_COLOR0_NV = $852A +GL_CONSTANT_COLOR1_NV = $852B +GL_PRIMARY_COLOR_NV = $852C +GL_SECONDARY_COLOR_NV = $852D +GL_SPARE0_NV = $852E +GL_SPARE1_NV = $852F +GL_DISCARD_NV = $8530 +GL_E_TIMES_F_NV = $8531 +GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532 +GL_UNSIGNED_IDENTITY_NV = $8536 +GL_UNSIGNED_INVERT_NV = $8537 +GL_EXPAND_NORMAL_NV = $8538 +GL_EXPAND_NEGATE_NV = $8539 +GL_HALF_BIAS_NORMAL_NV = $853A +GL_HALF_BIAS_NEGATE_NV = $853B +GL_SIGNED_IDENTITY_NV = $853C +GL_SIGNED_NEGATE_NV = $853D +GL_SCALE_BY_TWO_NV = $853E +GL_SCALE_BY_FOUR_NV = $853F +GL_SCALE_BY_ONE_HALF_NV = $8540 +GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541 +GL_COMBINER_INPUT_NV = $8542 +GL_COMBINER_MAPPING_NV = $8543 +GL_COMBINER_COMPONENT_USAGE_NV = $8544 +GL_COMBINER_AB_DOT_PRODUCT_NV = $8545 +GL_COMBINER_CD_DOT_PRODUCT_NV = $8546 +GL_COMBINER_MUX_SUM_NV = $8547 +GL_COMBINER_SCALE_NV = $8548 +GL_COMBINER_BIAS_NV = $8549 +GL_COMBINER_AB_OUTPUT_NV = $854A +GL_COMBINER_CD_OUTPUT_NV = $854B +GL_COMBINER_SUM_OUTPUT_NV = $854C +GL_MAX_GENERAL_COMBINERS_NV = $854D +GL_NUM_GENERAL_COMBINERS_NV = $854E +GL_COLOR_SUM_CLAMP_NV = $854F +GL_COMBINER0_NV = $8550 +GL_COMBINER1_NV = $8551 +GL_COMBINER2_NV = $8552 +GL_COMBINER3_NV = $8553 +GL_COMBINER4_NV = $8554 +GL_COMBINER5_NV = $8555 +GL_COMBINER6_NV = $8556 +GL_COMBINER7_NV = $8557 + +; GL_NV_fog_distance + +GL_FOG_DISTANCE_MODE_NV = $855A +GL_EYE_RADIAL_NV = $855B +GL_EYE_PLANE_ABSOLUTE_NV = $855C + +; GL_NV_texgen_emboss + +GL_EMBOSS_LIGHT_NV = $855D +GL_EMBOSS_CONSTANT_NV = $855E +GL_EMBOSS_MAP_NV = $855F + +; GL_EXT_texture_compression_s3tc + +GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0 +GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1 +GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2 +GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3 + +; GL_IBM_cull_vertex + +GL_CULL_VERTEX_IBM = 103050 + +; GL_IBM_vertex_array_lists + +GL_VERTEX_ARRAY_LIST_IBM = 103070 +GL_NORMAL_ARRAY_LIST_IBM = 103071 +GL_COLOR_ARRAY_LIST_IBM = 103072 +GL_INDEX_ARRAY_LIST_IBM = 103073 +GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074 +GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075 +GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076 +GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077 +GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080 +GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081 +GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082 +GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083 +GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084 +GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085 +GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086 +GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087 + +; GL_SGIX_subsample + +GL_PACK_SUBSAMPLE_RATE_SGIX = $85A0 +GL_UNPACK_SUBSAMPLE_RATE_SGIX = $85A1 +GL_PIXEL_SUBSAMPLE_4444_SGIX = $85A2 +GL_PIXEL_SUBSAMPLE_2424_SGIX = $85A3 +GL_PIXEL_SUBSAMPLE_4242_SGIX = $85A4 + +; GL_SGIX_ycrcba + +GL_YCRCB_SGIX = $8318 +GL_YCRCBA_SGIX = $8319 + +; GL_SGI_depth_pass_instrument + +GL_DEPTH_PASS_INSTRUMENT_SGIX = $8310 +GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = $8311 +GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = $8312 + +; GL_3DFX_texture_compression_FXT1 + +GL_COMPRESSED_RGB_FXT1_3DFX = $86B0 +GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1 + +; GL_3DFX_multisample + +GL_MULTISAMPLE_3DFX = $86B2 +GL_SAMPLE_BUFFERS_3DFX = $86B3 +GL_SAMPLES_3DFX = $86B4 +GL_MULTISAMPLE_BIT_3DFX = $20000000 + +; GL_EXT_multisample + +GL_MULTISAMPLE_EXT = $809D +GL_SAMPLE_ALPHA_TO_MASK_EXT = $809E +GL_SAMPLE_ALPHA_TO_ONE_EXT = $809F +GL_SAMPLE_MASK_EXT = $80A0 +GL_1PASS_EXT = $80A1 +GL_2PASS_0_EXT = $80A2 +GL_2PASS_1_EXT = $80A3 +GL_4PASS_0_EXT = $80A4 +GL_4PASS_1_EXT = $80A5 +GL_4PASS_2_EXT = $80A6 +GL_4PASS_3_EXT = $80A7 +GL_SAMPLE_BUFFERS_EXT = $80A8 +GL_SAMPLES_EXT = $80A9 +GL_SAMPLE_MASK_VALUE_EXT = $80AA +GL_SAMPLE_MASK_INVERT_EXT = $80AB +GL_SAMPLE_PATTERN_EXT = $80AC + +; GL_SGIX_vertex_preclip + +GL_VERTEX_PRECLIP_SGIX = $83EE +GL_VERTEX_PRECLIP_HINT_SGIX = $83EF + +; GL_SGIX_convolution_accuracy + +GL_CONVOLUTION_HINT_SGIX = $8316 + +; GL_SGIX_resample + +GL_PACK_RESAMPLE_SGIX = $842C +GL_UNPACK_RESAMPLE_SGIX = $842D +GL_RESAMPLE_REPLICATE_SGIX = $842E +GL_RESAMPLE_ZERO_FILL_SGIX = $842F +GL_RESAMPLE_DECIMATE_SGIX = $8430 + +; GL_SGIS_point_line_texgen + +GL_EYE_DISTANCE_TO_POINT_SGIS = $81F0 +GL_OBJECT_DISTANCE_TO_POINT_SGIS = $81F1 +GL_EYE_DISTANCE_TO_LINE_SGIS = $81F2 +GL_OBJECT_DISTANCE_TO_LINE_SGIS = $81F3 +GL_EYE_POINT_SGIS = $81F4 +GL_OBJECT_POINT_SGIS = $81F5 +GL_EYE_LINE_SGIS = $81F6 +GL_OBJECT_LINE_SGIS = $81F7 + +; GL_SGIS_texture_color_mask + +GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF + +; GL_NV_vertex_program + +GL_VERTEX_PROGRAM_NV = $8620 +GL_VERTEX_STATE_PROGRAM_NV = $8621 +GL_ATTRIB_ARRAY_SIZE_NV = $8623 +GL_ATTRIB_ARRAY_STRIDE_NV = $8624 +GL_ATTRIB_ARRAY_TYPE_NV = $8625 +GL_CURRENT_ATTRIB_NV = $8626 +GL_PROGRAM_LENGTH_NV = $8627 +GL_PROGRAM_STRING_NV = $8628 +GL_MODELVIEW_PROJECTION_NV = $8629 +GL_IDENTITY_NV = $862A +GL_INVERSE_NV = $862B +GL_TRANSPOSE_NV = $862C +GL_INVERSE_TRANSPOSE_NV = $862D +GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E +GL_MAX_TRACK_MATRICES_NV = $862F +GL_MATRIX0_NV = $8630 +GL_MATRIX1_NV = $8631 +GL_MATRIX2_NV = $8632 +GL_MATRIX3_NV = $8633 +GL_MATRIX4_NV = $8634 +GL_MATRIX5_NV = $8635 +GL_MATRIX6_NV = $8636 +GL_MATRIX7_NV = $8637 +GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640 +GL_CURRENT_MATRIX_NV = $8641 +GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642 +GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643 +GL_PROGRAM_PARAMETER_NV = $8644 +GL_ATTRIB_ARRAY_POINTER_NV = $8645 +GL_PROGRAM_TARGET_NV = $8646 +GL_PROGRAM_RESIDENT_NV = $8647 +GL_TRACK_MATRIX_NV = $8648 +GL_TRACK_MATRIX_TRANSFORM_NV = $8649 +GL_VERTEX_PROGRAM_BINDING_NV = $864A +GL_PROGRAM_ERROR_POSITION_NV = $864B +GL_VERTEX_ATTRIB_ARRAY0_NV = $8650 +GL_VERTEX_ATTRIB_ARRAY1_NV = $8651 +GL_VERTEX_ATTRIB_ARRAY2_NV = $8652 +GL_VERTEX_ATTRIB_ARRAY3_NV = $8653 +GL_VERTEX_ATTRIB_ARRAY4_NV = $8654 +GL_VERTEX_ATTRIB_ARRAY5_NV = $8655 +GL_VERTEX_ATTRIB_ARRAY6_NV = $8656 +GL_VERTEX_ATTRIB_ARRAY7_NV = $8657 +GL_VERTEX_ATTRIB_ARRAY8_NV = $8658 +GL_VERTEX_ATTRIB_ARRAY9_NV = $8659 +GL_VERTEX_ATTRIB_ARRAY10_NV = $865A +GL_VERTEX_ATTRIB_ARRAY11_NV = $865B +GL_VERTEX_ATTRIB_ARRAY12_NV = $865C +GL_VERTEX_ATTRIB_ARRAY13_NV = $865D +GL_VERTEX_ATTRIB_ARRAY14_NV = $865E +GL_VERTEX_ATTRIB_ARRAY15_NV = $865F +GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660 +GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661 +GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662 +GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663 +GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664 +GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665 +GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666 +GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667 +GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668 +GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669 +GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A +GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B +GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C +GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D +GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E +GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F +GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670 +GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671 +GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672 +GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673 +GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674 +GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675 +GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676 +GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677 +GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678 +GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679 +GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A +GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B +GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C +GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D +GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E +GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F + +; GLU errors + +GLU_INVALID_ENUM = 100900 +GLU_INVALID_VALUE = 100901 +GLU_OUT_OF_MEMORY = 100902 +GLU_INCOMPATIBLE_GL_VERSION = 100903 + +; GLU boolean values + +GLU_TRUE = GL_TRUE +GLU_FALSE = GL_FALSE + +; Quadric constants + +GLU_SMOOTH = 100000 +GLU_FLAT = 100001 +GLU_NONE = 100002 +GLU_POINT = 100010 +GLU_LINE = 100011 +GLU_FILL = 100012 +GLU_SILHOUETTE = 100013 +GLU_OUTSIDE = 100020 +GLU_INSIDE = 100021 + +; Tesselation constants + +GLU_TESS_MAX_COORD = 1.0e150 +GLU_TESS_WINDING_RULE = 100140 +GLU_TESS_BOUNDARY_ONLY = 100141 +GLU_TESS_TOLERANCE = 100142 +GLU_TESS_WINDING_ODD = 100130 +GLU_TESS_WINDING_NONZERO = 100131 +GLU_TESS_WINDING_POSITIVE = 100132 +GLU_TESS_WINDING_NEGATIVE = 100133 +GLU_TESS_WINDING_ABS_GEQ_TWO = 100134 +GLU_TESS_BEGIN = 100100 +GLU_TESS_VERTEX = 100101 +GLU_TESS_END = 100102 +GLU_TESS_ERROR = 100103 +GLU_TESS_EDGE_FLAG = 100104 +GLU_TESS_COMBINE = 100105 +GLU_TESS_BEGIN_DATA = 100106 +GLU_TESS_VERTEX_DATA = 100107 +GLU_TESS_END_DATA = 100108 +GLU_TESS_ERROR_DATA = 100109 +GLU_TESS_EDGE_FLAG_DATA = 100110 +GLU_TESS_COMBINE_DATA = 100111 +GLU_TESS_ERROR1 = 100151 +GLU_TESS_ERROR2 = 100152 +GLU_TESS_ERROR3 = 100153 +GLU_TESS_ERROR4 = 100154 +GLU_TESS_ERROR5 = 100155 +GLU_TESS_ERROR6 = 100156 +GLU_TESS_ERROR7 = 100157 +GLU_TESS_ERROR8 = 100158 +GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1 +GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2 +GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3 +GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4 +GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5 +GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6 + +; NURBS constants + +GLU_AUTO_LOAD_MATRIX = 100200 +GLU_CULLING = 100201 +GLU_SAMPLING_TOLERANCE = 100203 +GLU_DISPLAY_MODE = 100204 +GLU_PARAMETRIC_TOLERANCE = 100202 +GLU_SAMPLING_METHOD = 100205 +GLU_U_STEP = 100206 +GLU_V_STEP = 100207 +GLU_PATH_LENGTH = 100215 +GLU_PARAMETRIC_ERROR = 100216 +GLU_DOMAIN_DISTANCE = 100217 +GLU_MAP1_TRIM_2 = 100210 +GLU_MAP1_TRIM_3 = 100211 +GLU_OUTLINE_POLYGON = 100240 +GLU_OUTLINE_PATCH = 100241 +GLU_NURBS_ERROR1 = 100251 +GLU_NURBS_ERROR2 = 100252 +GLU_NURBS_ERROR3 = 100253 +GLU_NURBS_ERROR4 = 100254 +GLU_NURBS_ERROR5 = 100255 +GLU_NURBS_ERROR6 = 100256 +GLU_NURBS_ERROR7 = 100257 +GLU_NURBS_ERROR8 = 100258 +GLU_NURBS_ERROR9 = 100259 +GLU_NURBS_ERROR10 = 100260 +GLU_NURBS_ERROR11 = 100261 +GLU_NURBS_ERROR12 = 100262 +GLU_NURBS_ERROR13 = 100263 +GLU_NURBS_ERROR14 = 100264 +GLU_NURBS_ERROR15 = 100265 +GLU_NURBS_ERROR16 = 100266 +GLU_NURBS_ERROR17 = 100267 +GLU_NURBS_ERROR18 = 100268 +GLU_NURBS_ERROR19 = 100269 +GLU_NURBS_ERROR20 = 100270 +GLU_NURBS_ERROR21 = 100271 +GLU_NURBS_ERROR22 = 100272 +GLU_NURBS_ERROR23 = 100273 +GLU_NURBS_ERROR24 = 100274 +GLU_NURBS_ERROR25 = 100275 +GLU_NURBS_ERROR26 = 100276 +GLU_NURBS_ERROR27 = 100277 +GLU_NURBS_ERROR28 = 100278 +GLU_NURBS_ERROR29 = 100279 +GLU_NURBS_ERROR30 = 100280 +GLU_NURBS_ERROR31 = 100281 +GLU_NURBS_ERROR32 = 100282 +GLU_NURBS_ERROR33 = 100283 +GLU_NURBS_ERROR34 = 100284 +GLU_NURBS_ERROR35 = 100285 +GLU_NURBS_ERROR36 = 100286 +GLU_NURBS_ERROR37 = 100287 + +; Contours types + +GLU_CW = 100120 +GLU_CCW = 100121 +GLU_INTERIOR = 100122 +GLU_EXTERIOR = 100123 +GLU_UNKNOWN = 100124 diff --git a/fasmw172/EXAMPLES/PEDEMO/PEDEMO.ASM b/fasmw172/EXAMPLES/PEDEMO/PEDEMO.ASM new file mode 100644 index 0000000..a9cfcb4 --- /dev/null +++ b/fasmw172/EXAMPLES/PEDEMO/PEDEMO.ASM @@ -0,0 +1,46 @@ + +; Example of making 32-bit PE program as raw code and data + +format PE GUI +entry start + +section '.text' code readable executable + + start: + + push 0 + push _caption + push _message + push 0 + call [MessageBoxA] + + push 0 + call [ExitProcess] + +section '.data' data readable writeable + + _caption db 'Win32 assembly program',0 + _message db 'Hello World!',0 + +section '.idata' import data readable writeable + + dd 0,0,0,RVA kernel_name,RVA kernel_table + dd 0,0,0,RVA user_name,RVA user_table + dd 0,0,0,0,0 + + kernel_table: + ExitProcess dd RVA _ExitProcess + dd 0 + user_table: + MessageBoxA dd RVA _MessageBoxA + dd 0 + + kernel_name db 'KERNEL32.DLL',0 + user_name db 'USER32.DLL',0 + + _ExitProcess dw 0 + db 'ExitProcess',0 + _MessageBoxA dw 0 + db 'MessageBoxA',0 + +section '.reloc' fixups data readable discardable ; needed for Win32s diff --git a/fasmw172/EXAMPLES/TEMPLATE/TEMPLATE.ASM b/fasmw172/EXAMPLES/TEMPLATE/TEMPLATE.ASM new file mode 100644 index 0000000..63de34b --- /dev/null +++ b/fasmw172/EXAMPLES/TEMPLATE/TEMPLATE.ASM @@ -0,0 +1,71 @@ + +; Template for program using standard Win32 headers + +format PE GUI 4.0 +entry start + +include 'win32w.inc' + +section '.text' code readable executable + + start: + + invoke GetModuleHandle,0 + mov [wc.hInstance],eax + invoke LoadIcon,0,IDI_APPLICATION + mov [wc.hIcon],eax + invoke LoadCursor,0,IDC_ARROW + mov [wc.hCursor],eax + invoke RegisterClass,wc + test eax,eax + jz error + + invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,256,192,NULL,NULL,[wc.hInstance],NULL + test eax,eax + jz error + + msg_loop: + invoke GetMessage,msg,NULL,0,0 + cmp eax,1 + jb end_loop + jne msg_loop + invoke TranslateMessage,msg + invoke DispatchMessage,msg + jmp msg_loop + + error: + invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK + + end_loop: + invoke ExitProcess,[msg.wParam] + +proc WindowProc uses ebx esi edi, hwnd,wmsg,wparam,lparam + cmp [wmsg],WM_DESTROY + je .wmdestroy + .defwndproc: + invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] + jmp .finish + .wmdestroy: + invoke PostQuitMessage,0 + xor eax,eax + .finish: + ret +endp + +section '.data' data readable writeable + + _class TCHAR 'FASMWIN32',0 + _title TCHAR 'Win32 program template',0 + _error TCHAR 'Startup failed.',0 + + wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class + + msg MSG + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL' + + include 'api\kernel32.inc' + include 'api\user32.inc' diff --git a/fasmw172/EXAMPLES/USECOM/USECOM.ASM b/fasmw172/EXAMPLES/USECOM/USECOM.ASM new file mode 100644 index 0000000..66d0518 --- /dev/null +++ b/fasmw172/EXAMPLES/USECOM/USECOM.ASM @@ -0,0 +1,142 @@ + +; Component Object Model usage demonstration + +format PE GUI 4.0 +entry start + +include 'win32a.inc' + +struc GUID def + { + match d1-d2-d3-d4-d5, def + \{ + .Data1 dd 0x\#d1 + .Data2 dw 0x\#d2 + .Data3 dw 0x\#d3 + .Data4 db 0x\#d4 shr 8,0x\#d4 and 0FFh + .Data5 db 0x\#d5 shr 40,0x\#d5 shr 32 and 0FFh,0x\#d5 shr 24 and 0FFh,0x\#d5 shr 16 and 0FFh,0x\#d5 shr 8 and 0FFh,0x\#d5 and 0FFh + \} + } + +interface ITaskBarList,\ + QueryInterface,\ + AddRef,\ + Release,\ + HrInit,\ + AddTab,\ + DeleteTab,\ + ActivateTab,\ + SetActiveAlt + +CLSCTX_INPROC_SERVER = 0x1 +CLSCTX_INPROC_HANDLER = 0x2 +CLSCTX_LOCAL_SERVER = 0x4 +CLSCTX_INPROC_SERVER16 = 0x8 +CLSCTX_REMOTE_SERVER = 0x10 +CLSCTX_INPROC_HANDLER16 = 0x20 +CLSCTX_INPROC_SERVERX86 = 0x40 +CLSCTX_INPROC_HANDLERX86 = 0x80 +CLSCTX_ESERVER_HANDLER = 0x100 +CLSCTX_NO_CODE_DOWNLOAD = 0x400 +CLSCTX_NO_CUSTOM_MARSHAL = 0x1000 +CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000 +CLSCTX_NO_FAILURE_LOG = 0x4000 +CLSCTX_DISABLE_AAA = 0x8000 +CLSCTX_ENABLE_AAA = 0x10000 +CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000 + +ID_EXIT = IDCANCEL +ID_SHOW = 100 +ID_HIDE = 101 + +IDD_COMDEMO = 1 + +section '.text' code readable executable + + start: + + invoke CoInitialize,NULL + invoke CoCreateInstance,CLSID_TaskbarList,NULL,CLSCTX_INPROC_SERVER,IID_ITaskbarList,ShellTaskBar + + invoke GetModuleHandle,0 + invoke DialogBoxParam,eax,IDD_COMDEMO,HWND_DESKTOP,COMDemo,0 + + cominvk ShellTaskBar,Release + + invoke ExitProcess,0 + +proc COMDemo hwnd,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .wminitdialog + cmp [msg],WM_COMMAND + je .wmcommand + cmp [msg],WM_CLOSE + je .wmclose + xor eax,eax + jmp .finish + .wminitdialog: + jmp .processed + .wmcommand: + cmp [wparam],BN_CLICKED shl 16 + ID_EXIT + je .wmclose + cmp [wparam],BN_CLICKED shl 16 + ID_SHOW + je .show + cmp [wparam],BN_CLICKED shl 16 + ID_HIDE + jne .processed + .hide: + cominvk ShellTaskBar,HrInit + cominvk ShellTaskBar,DeleteTab,[hwnd] + jmp .processed + .show: + mov ebx,[ShellTaskBar] + comcall ebx,ITaskBarList,HrInit + comcall ebx,ITaskBarList,AddTab,[hwnd] + comcall ebx,ITaskBarList,ActivateTab,[hwnd] + jmp .processed + .wmclose: + invoke EndDialog,[hwnd],0 + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +section '.data' data readable writeable + + CLSID_TaskbarList GUID 56FDF344-FD6D-11D0-958A-006097C9A090 + IID_ITaskbarList GUID 56FDF342-FD6D-11D0-958A-006097C9A090 + + ShellTaskBar ITaskBarList + +section '.idata' import data readable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL',\ + ole,'OLE32.DLL' + + import kernel,\ + GetModuleHandle,'GetModuleHandleA',\ + ExitProcess,'ExitProcess' + + import user,\ + DialogBoxParam,'DialogBoxParamA',\ + EndDialog,'EndDialog' + + import ole,\ + CoInitialize,'CoInitialize',\ + CoCreateInstance,'CoCreateInstance' + +section '.rsrc' resource data readable + + directory RT_DIALOG,dialogs + + resource dialogs,\ + IDD_COMDEMO,LANG_ENGLISH+SUBLANG_DEFAULT,comdemo + + dialog comdemo,'Taskbar item control',70,70,170,24,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'BUTTON','Show',ID_SHOW,4,4,45,15,WS_VISIBLE+WS_TABSTOP + dialogitem 'BUTTON','Hide',ID_HIDE,54,4,45,15,WS_VISIBLE+WS_TABSTOP + dialogitem 'BUTTON','Exit',ID_EXIT,120,4,45,15,WS_VISIBLE+WS_TABSTOP + enddialog diff --git a/fasmw172/EXAMPLES/WIN64/DLL/MSGDEMO.ASM b/fasmw172/EXAMPLES/WIN64/DLL/MSGDEMO.ASM new file mode 100644 index 0000000..aa67073 --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/DLL/MSGDEMO.ASM @@ -0,0 +1,27 @@ +format PE64 console +entry start + +include 'win64a.inc' + +section '.text' code readable executable + +start: + sub rsp,8 + + invoke WriteMessage,message + + invoke ExitProcess,0 + +section '.data' data readable + + message db "Hi! I'm the example program!",0 + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + writemsg,'WRITEMSG.DLL' + + include 'api/kernel32.inc' + + import writemsg,\ + WriteMessage,'WriteMessage' \ No newline at end of file diff --git a/fasmw172/EXAMPLES/WIN64/DLL/WRITEMSG.ASM b/fasmw172/EXAMPLES/WIN64/DLL/WRITEMSG.ASM new file mode 100644 index 0000000..010a7ed --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/DLL/WRITEMSG.ASM @@ -0,0 +1,47 @@ +format PE64 console DLL +entry DllEntryPoint + +include 'win64a.inc' + +section '.text' code readable executable + +proc DllEntryPoint hinstDLL,fdwReason,lpvReserved + mov eax,TRUE + ret +endp + +proc WriteMessage uses rbx rsi rdi, message + mov rdi,rcx ; first parameter passed in RCX + invoke GetStdHandle,STD_OUTPUT_HANDLE + mov rbx,rax + xor al,al + or rcx,-1 + repne scasb + dec rdi + mov r8,-2 + sub r8,rcx + sub rdi,r8 + invoke WriteFile,rbx,rdi,r8,bytes_count,0 + ret +endp + +section '.bss' data readable writeable + + bytes_count dd ? + +section '.edata' export data readable + + export 'WRITEMSG.DLL',\ + WriteMessage,'WriteMessage' + +section '.reloc' fixups data readable discardable + + if $=$$ + dd 0,8 ; if there are no fixups, generate dummy entry + end if + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL' + + include 'api/kernel32.inc' diff --git a/fasmw172/EXAMPLES/WIN64/MANDEL/DDRAW64.INC b/fasmw172/EXAMPLES/WIN64/MANDEL/DDRAW64.INC new file mode 100644 index 0000000..6c8b3af --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/MANDEL/DDRAW64.INC @@ -0,0 +1,425 @@ + +; DirectDraw interface + +interface DirectDraw,\ + QueryInterface,\ + AddRef,\ + Release,\ + Compact,\ + CreateClipper,\ + CreatePalette,\ + CreateSurface,\ + DuplicateSurface,\ + EnumDisplayModes,\ + EnumSurfaces,\ + FlipToGDISurface,\ + GetCaps,\ + GetDisplayMode,\ + GetFourCCCodes,\ + GetGDISurface,\ + GetMonitorFrequency,\ + GetScanLine,\ + GetVerticalBlankStatus,\ + Initialize,\ + RestoreDisplayMode,\ + SetCooperativeLevel,\ + SetDisplayMode,\ + WaitForVerticalBlank,\ + GetAvailableVidMem,\ + GetSurfaceFromDC,\ + RestoreAllSurfaces,\ + TestCooperativeLevel,\ + GetDeviceIdentifier,\ + StartModeTest,\ + EvaluateMode + +interface DirectDrawSurface,\ + QueryInterface,\ + AddRef,\ + Release,\ + AddAttachedSurface,\ + AddOverlayDirtyRect,\ + Blt,\ + BltBatch,\ + BltFast,\ + DeleteAttachedSurface,\ + EnumAttachedSurfaces,\ + EnumOverlayZOrders,\ + Flip,\ + GetAttachedSurface,\ + GetBltStatus,\ + GetCaps,\ + GetClipper,\ + GetColorKey,\ + GetDC,\ + GetFlipStatus,\ + GetOverlayPosition,\ + GetPalette,\ + GetPixelFormat,\ + GetSurfaceDesc,\ + Initialize,\ + IsLost,\ + Lock,\ + ReleaseDC,\ + Restore,\ + SetClipper,\ + SetColorKey,\ + SetOverlayPosition,\ + SetPalette,\ + Unlock,\ + UpdateOverlay,\ + UpdateOverlayDisplay,\ + UpdateOverlayZOrder,\ + GetDDInterface,\ + PageLock,\ + PageUnlock,\ + SetSurfaceDesc,\ + SetPrivateData,\ + GetPrivateData,\ + FreePrivateData,\ + GetUniquenessValue,\ + ChangeUniquenessValue,\ + SetPriority,\ + GetPriority,\ + SetLOD,\ + GetLOD + +interface DirectDrawPalette,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetCaps,\ + GetEntries,\ + Initialize,\ + SetEntries + +interface DirectDrawClipper,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetClipList,\ + GetHWnd,\ + Initialize,\ + IsClipListChanged,\ + SetClipList,\ + SetHWnd + +interface DirectDrawColorControl,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetColorControls,\ + SetColorControls + +interface DirectDrawGammaControl,\ + QueryInterface,\ + AddRef,\ + Release,\ + GetGammaRamp,\ + SetGammaRamp + +struct DDCOLORKEY + dwColorSpaceLowValue dd ? + dwColorSpaceHighValue dd ? +ends + +struct DDPIXELFORMAT + dwSize dd ? + dwFlags dd ? + dwFourCC dd ? + union + dwRGBBitCount dd ? + dwYUVBitCount dd ? + dwZBufferBitDepth dd ? + dwAlphaBitDepth dd ? + dwLuminanceBitCount dd ? + dwBumpBitCount dd ? + ends + union + dwRBitMask dd ? + dwYBitMask dd ? + dwStencilBitDepth dd ? + dwLuminanceBitMask dd ? + dwBumpDuBitMask dd ? + ends + union + dwGBitMask dd ? + dwUBitMask dd ? + dwZBitMask dd ? + dwBumpDvBitMask dd ? + ends + union + dwBBitMask dd ? + dwVBitMask dd ? + dwStencilBitMask dd ? + dwBumpLuminanceBitMask dd ? + ends + union + dwRGBAlphaBitMask dd ? + dwYUVAlphaBitMask dd ? + dwLuminanceAlphaBitMask dd ? + dwRGBZBitMask dd ? + dwYUVZBitMask dd ? + ends +ends + +struct DDSCAPS + dwCaps dd ? +ends + +struct DDSURFACEDESC + dwSize dd ? + dwFlags dd ? + dwHeight dd ? + dwWidth dd ? + union + lPitch dd ? + dwLinearSize dd ? + ends + dwBackBufferCount dd ? + union + dwMipMapCount dd ? + dwZBufferBitDepth dd ? + dwRefreshRate dd ? + ends + dwAlphaBitDepth dd ? + dwReserved dd ?,? + lpSurface dq ? + ddckCKDestOverlay DDCOLORKEY + ddckCKDestBlt DDCOLORKEY + ddckCKSrcOverlay DDCOLORKEY + ddckCKSrcBlt DDCOLORKEY + ddpfPixelFormat DDPIXELFORMAT + ddsCaps DDSCAPS + dd ? +ends + +; SetCooperativeLevel flags + +DDSCL_FULLSCREEN = 000000001h +DDSCL_ALLOWREBOOT = 000000002h +DDSCL_NOWINDOWCHANGES = 000000004h +DDSCL_NORMAL = 000000008h +DDSCL_EXCLUSIVE = 000000010h +DDSCL_ALLOWMODEX = 000000040h + +; Blt flags + +DDBLT_ALPHADEST = 000000001h +DDBLT_ALPHADESTCONSTOVERRIDE = 000000002h +DDBLT_ALPHADESTNEG = 000000004h +DDBLT_ALPHADESTSURFACEOVERRIDE = 000000008h +DDBLT_ALPHAEDGEBLEND = 000000010h +DDBLT_ALPHASRC = 000000020h +DDBLT_ALPHASRCCONSTOVERRIDE = 000000040h +DDBLT_ALPHASRCNEG = 000000080h +DDBLT_ALPHASRCSURFACEOVERRIDE = 000000100h +DDBLT_ASYNC = 000000200h +DDBLT_COLORFILL = 000000400h +DDBLT_DDFX = 000000800h +DDBLT_DDROPS = 000001000h +DDBLT_KEYDEST = 000002000h +DDBLT_KEYDESTOVERRIDE = 000004000h +DDBLT_KEYSRC = 000008000h +DDBLT_KEYSRCOVERRIDE = 000010000h +DDBLT_ROP = 000020000h +DDBLT_ROTATIONANGLE = 000040000h +DDBLT_ZBUFFER = 000080000h +DDBLT_ZBUFFERDESTCONSTOVERRIDE = 000100000h +DDBLT_ZBUFFERDESTOVERRIDE = 000200000h +DDBLT_ZBUFFERSRCCONSTOVERRIDE = 000400000h +DDBLT_ZBUFFERSRCOVERRIDE = 000800000h +DDBLT_WAIT = 001000000h +DDBLT_DEPTHFILL = 002000000h + +; BltFast flags + +DDBLTFAST_NOCOLORKEY = 000000000h +DDBLTFAST_SRCCOLORKEY = 000000001h +DDBLTFAST_DESTCOLORKEY = 000000002h +DDBLTFAST_WAIT = 000000010h + +; Flip flags + +DDFLIP_WAIT = 000000001h +DDFLIP_EVEN = 000000002h +DDFLIP_ODD = 000000004h + +; DDSURFACEDESC field flags + +DDSD_CAPS = 000000001h +DDSD_HEIGHT = 000000002h +DDSD_WIDTH = 000000004h +DDSD_PITCH = 000000008h +DDSD_BACKBUFFERCOUNT = 000000020h +DDSD_ZBUFFERBITDEPTH = 000000040h +DDSD_ALPHABITDEPTH = 000000080h +DDSD_LPSURFACE = 000000800h +DDSD_PIXELFORMAT = 000001000h +DDSD_CKDESTOVERLAY = 000002000h +DDSD_CKDESTBLT = 000004000h +DDSD_CKSRCOVERLAY = 000008000h +DDSD_CKSRCBLT = 000010000h +DDSD_MIPMAPCOUNT = 000020000h +DDSD_REFRESHRATE = 000040000h +DDSD_LINEARSIZE = 000080000h +DDSD_ALL = 0000FF9EEh + +; DirectDrawSurface capability flags + +DDSCAPS_RESERVED1 = 000000001h +DDSCAPS_ALPHA = 000000002h +DDSCAPS_BACKBUFFER = 000000004h +DDSCAPS_COMPLEX = 000000008h +DDSCAPS_FLIP = 000000010h +DDSCAPS_FRONTBUFFER = 000000020h +DDSCAPS_OFFSCREENPLAIN = 000000040h +DDSCAPS_OVERLAY = 000000080h +DDSCAPS_PALETTE = 000000100h +DDSCAPS_PRIMARYSURFACE = 000000200h +DDSCAPS_PRIMARYSURFACELEFT = 000000400h +DDSCAPS_SYSTEMMEMORY = 000000800h +DDSCAPS_TEXTURE = 000001000h +DDSCAPS_3DDEVICE = 000002000h +DDSCAPS_VIDEOMEMORY = 000004000h +DDSCAPS_VISIBLE = 000008000h +DDSCAPS_WRITEONLY = 000010000h +DDSCAPS_ZBUFFER = 000020000h +DDSCAPS_OWNDC = 000040000h +DDSCAPS_LIVEVIDEO = 000080000h +DDSCAPS_HWCODEC = 000100000h +DDSCAPS_MODEX = 000200000h +DDSCAPS_MIPMAP = 000400000h +DDSCAPS_RESERVED2 = 000800000h +DDSCAPS_ALLOCONLOAD = 004000000h +DDSCAPS_VIDEOPORT = 008000000h +DDSCAPS_LOCALVIDMEM = 010000000h +DDSCAPS_NONLOCALVIDMEM = 020000000h +DDSCAPS_STANDARDVGAMODE = 040000000h +DDSCAPS_OPTIMIZED = 080000000h + +; DirectDrawSurface lock flags + +DDLOCK_SURFACEMEMORYPTR = 000000000h +DDLOCK_WAIT = 000000001h +DDLOCK_EVENT = 000000002h +DDLOCK_READONLY = 000000010h +DDLOCK_WRITEONLY = 000000020h +DDLOCK_NOSYSLOCK = 000000800h + +; DirectDrawPalette capabilities + +DDPCAPS_4BIT = 000000001h +DDPCAPS_8BITENTRIES = 000000002h +DDPCAPS_8BIT = 000000004h +DDPCAPS_INITIALIZE = 000000008h +DDPCAPS_PRIMARYSURFACE = 000000010h +DDPCAPS_PRIMARYSURFACELEFT = 000000020h +DDPCAPS_ALLOW256 = 000000040h +DDPCAPS_VSYNC = 000000080h +DDPCAPS_1BIT = 000000100h +DDPCAPS_2BIT = 000000200h + +; DirectDraw errors + +DDERR_ALREADYINITIALIZED = 088760000h+5 +DDERR_CANNOTATTACHSURFACE = 088760000h+10 +DDERR_CANNOTDETACHSURFACE = 088760000h+20 +DDERR_CURRENTLYNOTAVAIL = 088760000h+40 +DDERR_EXCEPTION = 088760000h+55 +DDERR_HEIGHTALIGN = 088760000h+90 +DDERR_INCOMPATIBLEPRIMARY = 088760000h+95 +DDERR_INVALIDCAPS = 088760000h+100 +DDERR_INVALIDCLIPLIST = 088760000h+110 +DDERR_INVALIDMODE = 088760000h+120 +DDERR_INVALIDOBJECT = 088760000h+130 +DDERR_INVALIDPIXELFORMAT = 088760000h+145 +DDERR_INVALIDRECT = 088760000h+150 +DDERR_LOCKEDSURFACES = 088760000h+160 +DDERR_NO3D = 088760000h+170 +DDERR_NOALPHAHW = 088760000h+180 +DDERR_NOCLIPLIST = 088760000h+205 +DDERR_NOCOLORCONVHW = 088760000h+210 +DDERR_NOCOOPERATIVELEVELSET = 088760000h+212 +DDERR_NOCOLORKEY = 088760000h+215 +DDERR_NOCOLORKEYHW = 088760000h+220 +DDERR_NODIRECTDRAWSUPPORT = 088760000h+222 +DDERR_NOEXCLUSIVEMODE = 088760000h+225 +DDERR_NOFLIPHW = 088760000h+230 +DDERR_NOGDI = 088760000h+240 +DDERR_NOMIRRORHW = 088760000h+250 +DDERR_NOTFOUND = 088760000h+255 +DDERR_NOOVERLAYHW = 088760000h+260 +DDERR_NORASTEROPHW = 088760000h+280 +DDERR_NOROTATIONHW = 088760000h+290 +DDERR_NOSTRETCHHW = 088760000h+310 +DDERR_NOT4BITCOLOR = 088760000h+316 +DDERR_NOT4BITCOLORINDEX = 088760000h+317 +DDERR_NOT8BITCOLOR = 088760000h+320 +DDERR_NOTEXTUREHW = 088760000h+330 +DDERR_NOVSYNCHW = 088760000h+335 +DDERR_NOZBUFFERHW = 088760000h+340 +DDERR_NOZOVERLAYHW = 088760000h+350 +DDERR_OUTOFCAPS = 088760000h+360 +DDERR_OUTOFVIDEOMEMORY = 088760000h+380 +DDERR_OVERLAYCANTCLIP = 088760000h+382 +DDERR_OVERLAYCOLORKEYONLYONEACTI = 088760000h+384 +DDERR_PALETTEBUSY = 088760000h+387 +DDERR_COLORKEYNOTSET = 088760000h+400 +DDERR_SURFACEALREADYATTACHED = 088760000h+410 +DDERR_SURFACEALREADYDEPENDENT = 088760000h+420 +DDERR_SURFACEBUSY = 088760000h+430 +DDERR_CANTLOCKSURFACE = 088760000h+435 +DDERR_SURFACEISOBSCURED = 088760000h+440 +DDERR_SURFACELOST = 088760000h+450 +DDERR_SURFACENOTATTACHED = 088760000h+460 +DDERR_TOOBIGHEIGHT = 088760000h+470 +DDERR_TOOBIGSIZE = 088760000h+480 +DDERR_TOOBIGWIDTH = 088760000h+490 +DDERR_UNSUPPORTEDFORMAT = 088760000h+510 +DDERR_UNSUPPORTEDMASK = 088760000h+520 +DDERR_VERTICALBLANKINPROGRESS = 088760000h+537 +DDERR_WASSTILLDRAWING = 088760000h+540 +DDERR_XALIGN = 088760000h+560 +DDERR_INVALIDDIRECTDRAWGUID = 088760000h+561 +DDERR_DIRECTDRAWALREADYCREATED = 088760000h+562 +DDERR_NODIRECTDRAWHW = 088760000h+563 +DDERR_PRIMARYSURFACEALREADYEXIST = 088760000h+564 +DDERR_NOEMULATION = 088760000h+565 +DDERR_REGIONTOOSMALL = 088760000h+566 +DDERR_CLIPPERISUSINGHWND = 088760000h+567 +DDERR_NOCLIPPERATTACHED = 088760000h+568 +DDERR_NOHWND = 088760000h+569 +DDERR_HWNDSUBCLASSED = 088760000h+570 +DDERR_HWNDALREADYSET = 088760000h+571 +DDERR_NOPALETTEATTACHED = 088760000h+572 +DDERR_NOPALETTEHW = 088760000h+573 +DDERR_BLTFASTCANTCLIP = 088760000h+574 +DDERR_NOBLTHW = 088760000h+575 +DDERR_NODDROPSHW = 088760000h+576 +DDERR_OVERLAYNOTVISIBLE = 088760000h+577 +DDERR_NOOVERLAYDEST = 088760000h+578 +DDERR_INVALIDPOSITION = 088760000h+579 +DDERR_NOTAOVERLAYSURFACE = 088760000h+580 +DDERR_EXCLUSIVEMODEALREADYSET = 088760000h+581 +DDERR_NOTFLIPPABLE = 088760000h+582 +DDERR_CANTDUPLICATE = 088760000h+583 +DDERR_NOTLOCKED = 088760000h+584 +DDERR_CANTCREATEDC = 088760000h+585 +DDERR_NODC = 088760000h+586 +DDERR_WRONGMODE = 088760000h+587 +DDERR_IMPLICITLYCREATED = 088760000h+588 +DDERR_NOTPALETTIZED = 088760000h+589 +DDERR_UNSUPPORTEDMODE = 088760000h+590 +DDERR_NOMIPMAPHW = 088760000h+591 +DDERR_INVALIDSURFACETYPE = 088760000h+592 +DDERR_NOOPTIMIZEHW = 088760000h+600 +DDERR_NOTLOADED = 088760000h+601 +DDERR_DCALREADYCREATED = 088760000h+620 +DDERR_NONONLOCALVIDMEM = 088760000h+630 +DDERR_CANTPAGELOCK = 088760000h+640 +DDERR_CANTPAGEUNLOCK = 088760000h+660 +DDERR_NOTPAGELOCKED = 088760000h+680 +DDERR_MOREDATA = 088760000h+690 +DDERR_VIDEONOTACTIVE = 088760000h+695 +DDERR_DEVICEDOESNTOWNSURFACE = 088760000h+699 diff --git a/fasmw172/EXAMPLES/WIN64/MANDEL/MANDEL.ASM b/fasmw172/EXAMPLES/WIN64/MANDEL/MANDEL.ASM new file mode 100644 index 0000000..52ff90d --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/MANDEL/MANDEL.ASM @@ -0,0 +1,304 @@ + +format PE64 GUI 5.0 +entry start + +include 'win64a.inc' +include 'ddraw64.inc' + +section '.text' code readable executable + + start: + + sub rsp,8 + + invoke GetModuleHandle,NULL + mov [hinstance],rax + mov [wc.hInstance],rax + + invoke LoadIcon,NULL,IDI_APPLICATION + mov [wc.hIcon],rax + invoke LoadCursor,NULL,IDC_ARROW + mov [wc.hCursor],rax + invoke RegisterClassEx,wc + test rax,rax + jz startup_error + + invoke CreateWindowEx,\ + 0,_class,_title,WS_POPUP+WS_VISIBLE,0,0,0,0,NULL,NULL,[hinstance],NULL + test rax,rax + jz startup_error + mov [hwnd],rax + + invoke DirectDrawCreate,NULL,DDraw,NULL + test rax,rax + jnz ddraw_error + + cominvk DDraw,SetCooperativeLevel,\ + [hwnd],DDSCL_EXCLUSIVE+DDSCL_FULLSCREEN + test rax,rax + jnz ddraw_error + + cominvk DDraw,SetDisplayMode,\ + 640,480,32 + test rax,rax + jnz ddraw_error + + mov [ddsd.dwSize],sizeof.DDSURFACEDESC + mov [ddsd.dwFlags],DDSD_CAPS+DDSD_BACKBUFFERCOUNT + mov [ddsd.ddsCaps.dwCaps],DDSCAPS_PRIMARYSURFACE+DDSCAPS_FLIP+DDSCAPS_COMPLEX + mov [ddsd.dwBackBufferCount],1 + cominvk DDraw,CreateSurface,\ + ddsd,DDSPrimary,NULL + or eax,eax + jnz ddraw_error + + mov [ddscaps.dwCaps],DDSCAPS_BACKBUFFER + cominvk DDSPrimary,GetAttachedSurface,\ + ddscaps,DDSBack + or eax,eax + jnz ddraw_error + +refresh: + + cominvk DDSPrimary,IsLost + test rax,rax + jz paint + cmp eax,DDERR_SURFACELOST + jne end_loop + cominvk DDSPrimary,Restore + + paint: + mov [ddsd.dwSize],sizeof.DDSURFACEDESC + mov [ddsd.dwFlags],0 + cominvk DDSBack,Lock,NULL,ddsd,DDLOCK_SURFACEMEMORYPTR+DDLOCK_WAIT,NULL + test rax,rax + jnz main_loop + mov rdi,[ddsd.lpSurface] + mov r10d,[ddsd.lPitch] + xor edx,edx + movsd xmm8,[y_top] + screen: + xor ebx,ebx + movsd xmm7,[x_left] + unpcklpd xmm7,xmm8 + row: + mov rcx,255 + xorpd xmm1,xmm1 + iterate: + + movapd xmm3,xmm1 + unpckhpd xmm3,xmm3 + mulsd xmm3,xmm1 + addsd xmm3,xmm3 + + mulpd xmm1,xmm1 + movapd xmm2,xmm1 ; for SSE3-capable processor + unpckhpd xmm2,xmm2 ; these three instructions can be + subsd xmm1,xmm2 ; replaced with HSUBPD XMM1,XMM1 + unpcklpd xmm1,xmm3 + addpd xmm1,xmm7 + + movapd xmm0,xmm1 + mulpd xmm0,xmm0 + movapd xmm2,xmm0 ; for SSE3-capable processor + shufpd xmm2,xmm2,1 ; these three instructions can be + addsd xmm0,xmm2 ; replaced with HADDPD XMM0,XMM0 + sqrtpd xmm0,xmm0 + comisd xmm0,[limit] + ja over + + loop iterate + over: + xor al,al + stosb + mov al,cl + stosb + ror al,3 + stosb + stosb + + movsd xmm0,[x_step] + addpd xmm7,xmm0 + inc ebx + cmp ebx,640 + jb row + sub rdi,640*4 + add rdi,r10 + subsd xmm8,[y_step] + inc edx + cmp edx,480 + jb screen + + mov [refresh_needed],0 + cominvk DDSBack,Unlock,NULL + cominvk DDSPrimary,Flip,0,0 + +main_loop: + + invoke PeekMessage,msg,NULL,0,0,PM_NOREMOVE + or eax,eax + jz no_message + invoke GetMessage,msg,NULL,0,0 + cmp eax,1 + jb end_loop + jne no_message + invoke TranslateMessage,msg + invoke DispatchMessage,msg + + cmp [refresh_needed],0 + jne refresh + + jmp main_loop + + no_message: + invoke WaitMessage + jmp main_loop + +ddraw_error: + invoke wsprintf,buffer,_ddraw_error,rax + invoke MessageBox,[hwnd],buffer,_error,MB_OK+MB_ICONERROR + invoke DestroyWindow,[hwnd] + invoke PostQuitMessage,2 + jmp main_loop + +startup_error: + invoke MessageBox,[hwnd],_startup_error,_error,MB_OK+MB_ICONERROR + invoke ExitProcess,1 + +end_loop: + cominvk DDraw,RestoreDisplayMode + cominvk DDraw,Release + invoke ExitProcess,[msg.wParam] + +proc WindowProc uses rbx rsi rdi, hwnd,wmsg,wparam,lparam + cmp edx,WM_CREATE + je .wmcreate + cmp edx,WM_DESTROY + je .wmdestroy + cmp edx,WM_LBUTTONDOWN + je .wmlbuttondown + cmp edx,WM_RBUTTONDOWN + je .wmrbuttondown + cmp edx,WM_KEYDOWN + je .wmkeydown + cmp edx,WM_ACTIVATE + je .wmactivate + .defwindowproc: + invoke DefWindowProc,rcx,rdx,r8,r9 + jmp .finish + .wmcreate: + xor eax,eax + jmp .finish + .wmactivate: + test r8,r8 + jz .finish + or [refresh_needed],1 + jmp .finish + .wmlbuttondown: + movapd xmm0,[step] + divpd xmm0,[zoom] + movapd xmm1,xmm0 + subpd xmm1,[step] + movapd [step],xmm0 + movzx eax,r9w + cvtsi2sd xmm3,eax + shr r9,16 + movzx eax,r9w + cvtsi2sd xmm4,eax + unpcklpd xmm3,xmm4 + mulpd xmm1,xmm3 + xorpd xmm1,[negate] + addpd xmm1,[origin] + movapd [origin],xmm1 + or [refresh_needed],1 + jmp .finish + .wmrbuttondown: + movapd xmm0,[step] + mulpd xmm0,[zoom] + movapd xmm1,xmm0 + subpd xmm1,[step] + movapd [step],xmm0 + movzx eax,r9w + cvtsi2sd xmm3,eax + shr r9,16 + movzx eax,r9w + cvtsi2sd xmm4,eax + unpcklpd xmm3,xmm4 + mulpd xmm1,xmm3 + xorpd xmm1,[negate] + addpd xmm1,[origin] + movapd [origin],xmm1 + or [refresh_needed],1 + jmp .finish + .wmkeydown: + cmp r8d,VK_ESCAPE + jne .finish + .wmdestroy: + invoke PostQuitMessage,0 + xor eax,eax + .finish: + ret +endp + +section '.data' data readable writeable + + wc WNDCLASSEX sizeof.WNDCLASSEX,0,WindowProc,0,0,NULL,NULL,NULL,NULL,NULL,_class,NULL + + _title db 'flat assembler DirectDraw application',0 + _class db 'FDDRAW64',0 + + _error db 'Error',0 + _startup_error db 'Startup failed',0 + _ddraw_error db 'Direct Draw initialization failed (error code 0x%x).',0 + + align 16 ; SSE data follows + + label origin dqword + x_left dq -2.2 + y_top dq 1.25 + + label step dqword + x_step dq 0.0045 + y_step dq 0.0052 + + label zoom dqword + dq 1.2,1.2 + + label negate dqword + dq 8000000000000000h,0 + + limit dq 2.5 + +tmp db 1 + +section '.bss' readable writeable + + hinstance dq ? + hwnd dq ? + msg MSG + + ddsd DDSURFACEDESC + ddscaps DDSCAPS + + DDraw DirectDraw + DDSPrimary DirectDrawSurface + DDSBack DirectDrawSurface + + rect RECT + + refresh_needed dd ? + + buffer rb 100h + + +section '.idata' import data readable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + ddraw,'DDRAW.DLL' + + include 'api\kernel32.inc' + include 'api\user32.inc' + + import ddraw,\ + DirectDrawCreate,'DirectDrawCreate' diff --git a/fasmw172/EXAMPLES/WIN64/OPENGL/OPENGL.ASM b/fasmw172/EXAMPLES/WIN64/OPENGL/OPENGL.ASM new file mode 100644 index 0000000..4753c96 --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/OPENGL/OPENGL.ASM @@ -0,0 +1,615 @@ + +; OpenGL programming example + +format PE64 GUI 5.0 +entry start + +include 'win64a.inc' + +include '..\..\opengl\opengl.inc' + +section '.text' code readable executable + + start: + sub rsp,8 ; Make stack dqword aligned + + invoke GetModuleHandle,0 + mov [wc.hInstance],rax + invoke LoadIcon,0,IDI_APPLICATION + mov [wc.hIcon],rax + invoke LoadCursor,0,IDC_ARROW + mov [wc.hCursor],rax + invoke RegisterClass,wc + invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS,16,16,432,432,NULL,NULL,[wc.hInstance],NULL + + msg_loop: + invoke GetMessage,addr msg,NULL,0,0 + cmp eax,1 + jb end_loop + jne msg_loop + invoke TranslateMessage,addr msg + invoke DispatchMessage,addr msg + jmp msg_loop + + end_loop: + invoke ExitProcess,[msg.wParam] + +proc WindowProc uses rbx rsi rdi, hwnd,wmsg,wparam,lparam + mov [hwnd],rcx + frame + cmp edx,WM_CREATE + je .wmcreate + cmp edx,WM_SIZE + je .wmsize + cmp edx,WM_PAINT + je .wmpaint + cmp edx,WM_KEYDOWN + je .wmkeydown + cmp edx,WM_DESTROY + je .wmdestroy + .defwndproc: + invoke DefWindowProc,rcx,rdx,r8,r9 + jmp .finish + .wmcreate: + invoke GetDC,rcx + mov [hdc],rax + lea rdi,[pfd] + mov rcx,sizeof.PIXELFORMATDESCRIPTOR shr 3 + xor eax,eax + rep stosq + mov [pfd.nSize],sizeof.PIXELFORMATDESCRIPTOR + mov [pfd.nVersion],1 + mov [pfd.dwFlags],PFD_SUPPORT_OPENGL+PFD_DOUBLEBUFFER+PFD_DRAW_TO_WINDOW + mov [pfd.iLayerType],PFD_MAIN_PLANE + mov [pfd.iPixelType],PFD_TYPE_RGBA + mov [pfd.cColorBits],16 + mov [pfd.cDepthBits],16 + mov [pfd.cAccumBits],0 + mov [pfd.cStencilBits],0 + invoke ChoosePixelFormat,[hdc],addr pfd + invoke SetPixelFormat,[hdc],eax,addr pfd + invoke wglCreateContext,[hdc] + mov [hrc],rax + invoke wglMakeCurrent,[hdc],[hrc] + invoke GetClientRect,[hwnd],addr rc + invoke glViewport,0,0,[rc.right],[rc.bottom] + invoke GetTickCount + mov [clock],eax + xor eax,eax + jmp .finish + .wmsize: + invoke GetClientRect,[hwnd],addr rc + invoke glViewport,0,0,[rc.right],[rc.bottom] + xor eax,eax + jmp .finish + .wmpaint: + invoke GetTickCount + sub eax,[clock] + cmp eax,10 + jb .animation_ok + add [clock],eax + invoke glRotatef,float [theta],float dword 0.0,float dword 0.0,float dword 1.0 + .animation_ok: + invoke glClear,GL_COLOR_BUFFER_BIT + invoke glBegin,GL_QUADS + invoke glColor3f,float dword 1.0,float dword 0.1,float dword 0.1 + invoke glVertex3d,float -0.6,float -0.6,float 0.0 + invoke glColor3f,float dword 0.1,float dword 0.1,float dword 0.1 + invoke glVertex3d,float 0.6,float -0.6,float 0.0 + invoke glColor3f,float dword 0.1,float dword 0.1,float dword 1.0 + invoke glVertex3d,float 0.6,float 0.6,float 0.0 + invoke glColor3f,float dword 1.0,float dword 0.1,float dword 1.0 + invoke glVertex3d,float -0.6,float 0.6,float 0.0 + invoke glEnd + invoke SwapBuffers,[hdc] + xor eax,eax + jmp .finish + .wmkeydown: + cmp r8d,VK_ESCAPE + jne .defwndproc + .wmdestroy: + invoke wglMakeCurrent,0,0 + invoke wglDeleteContext,[hrc] + invoke ReleaseDC,[hwnd],[hdc] + invoke PostQuitMessage,0 + xor eax,eax + .finish: + endf + ret +endp + +section '.data' data readable writeable + + _title db 'OpenGL example',0 + _class db 'FASMOPENGL32',0 + + theta GLfloat 0.6 + + wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,NULL,NULL,_class + + hdc dq ? + hrc dq ? + + msg MSG + rc RECT + pfd PIXELFORMATDESCRIPTOR + + clock dd ? + +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL',\ + gdi,'GDI32.DLL',\ + opengl,'OPENGL32.DLL',\ + glu,'GLU32.DLL' + + import kernel,\ + GetModuleHandle,'GetModuleHandleA',\ + GetTickCount,'GetTickCount',\ + ExitProcess,'ExitProcess' + + import user,\ + RegisterClass,'RegisterClassA',\ + CreateWindowEx,'CreateWindowExA',\ + DefWindowProc,'DefWindowProcA',\ + GetMessage,'GetMessageA',\ + TranslateMessage,'TranslateMessage',\ + DispatchMessage,'DispatchMessageA',\ + LoadCursor,'LoadCursorA',\ + LoadIcon,'LoadIconA',\ + GetClientRect,'GetClientRect',\ + GetDC,'GetDC',\ + ReleaseDC,'ReleaseDC',\ + PostQuitMessage,'PostQuitMessage' + + import gdi,\ + ChoosePixelFormat,'ChoosePixelFormat',\ + SetPixelFormat,'SetPixelFormat',\ + SwapBuffers,'SwapBuffers' + + import opengl,\ + glAccum,'glAccum',\ + glAlphaFunc,'glAlphaFunc',\ + glAreTexturesResident,'glAreTexturesResident',\ + glArrayElement,'glArrayElement',\ + glBegin,'glBegin',\ + glBindTexture,'glBindTexture',\ + glBitmap,'glBitmap',\ + glBlendFunc,'glBlendFunc',\ + glCallList,'glCallList',\ + glCallLists,'glCallLists',\ + glClear,'glClear',\ + glClearAccum,'glClearAccum',\ + glClearColor,'glClearColor',\ + glClearDepth,'glClearDepth',\ + glClearIndex,'glClearIndex',\ + glClearStencil,'glClearStencil',\ + glClipPlane,'glClipPlane',\ + glColor3b,'glColor3b',\ + glColor3bv,'glColor3bv',\ + glColor3d,'glColor3d',\ + glColor3dv,'glColor3dv',\ + glColor3f,'glColor3f',\ + glColor3fv,'glColor3fv',\ + glColor3i,'glColor3i',\ + glColor3iv,'glColor3iv',\ + glColor3s,'glColor3s',\ + glColor3sv,'glColor3sv',\ + glColor3ub,'glColor3ub',\ + glColor3ubv,'glColor3ubv',\ + glColor3ui,'glColor3ui',\ + glColor3uiv,'glColor3uiv',\ + glColor3us,'glColor3us',\ + glColor3usv,'glColor3usv',\ + glColor4b,'glColor4b',\ + glColor4bv,'glColor4bv',\ + glColor4d,'glColor4d',\ + glColor4dv,'glColor4dv',\ + glColor4f,'glColor4f',\ + glColor4fv,'glColor4fv',\ + glColor4i,'glColor4i',\ + glColor4iv,'glColor4iv',\ + glColor4s,'glColor4s',\ + glColor4sv,'glColor4sv',\ + glColor4ub,'glColor4ub',\ + glColor4ubv,'glColor4ubv',\ + glColor4ui,'glColor4ui',\ + glColor4uiv,'glColor4uiv',\ + glColor4us,'glColor4us',\ + glColor4usv,'glColor4usv',\ + glColorMask,'glColorMask',\ + glColorMaterial,'glColorMaterial',\ + glColorPointer,'glColorPointer',\ + glCopyPixels,'glCopyPixels',\ + glCopyTexImage1D,'glCopyTexImage1D',\ + glCopyTexImage2D,'glCopyTexImage2D',\ + glCopyTexSubImage1D,'glCopyTexSubImage1D',\ + glCopyTexSubImage2D,'glCopyTexSubImage2D',\ + glCullFace,'glCullFace',\ + glDeleteLists,'glDeleteLists',\ + glDeleteTextures,'glDeleteTextures',\ + glDepthFunc,'glDepthFunc',\ + glDepthMask,'glDepthMask',\ + glDepthRange,'glDepthRange',\ + glDisable,'glDisable',\ + glDisableClientState,'glDisableClientState',\ + glDrawArrays,'glDrawArrays',\ + glDrawBuffer,'glDrawBuffer',\ + glDrawElements,'glDrawElements',\ + glDrawPixels,'glDrawPixels',\ + glEdgeFlag,'glEdgeFlag',\ + glEdgeFlagPointer,'glEdgeFlagPointer',\ + glEdgeFlagv,'glEdgeFlagv',\ + glEnable,'glEnable',\ + glEnableClientState,'glEnableClientState',\ + glEnd,'glEnd',\ + glEndList,'glEndList',\ + glEvalCoord1d,'glEvalCoord1d',\ + glEvalCoord1dv,'glEvalCoord1dv',\ + glEvalCoord1f,'glEvalCoord1f',\ + glEvalCoord1fv,'glEvalCoord1fv',\ + glEvalCoord2d,'glEvalCoord2d',\ + glEvalCoord2dv,'glEvalCoord2dv',\ + glEvalCoord2f,'glEvalCoord2f',\ + glEvalCoord2fv,'glEvalCoord2fv',\ + glEvalMesh1,'glEvalMesh1',\ + glEvalMesh2,'glEvalMesh2',\ + glEvalPoint1,'glEvalPoint1',\ + glEvalPoint2,'glEvalPoint2',\ + glFeedbackBuffer,'glFeedbackBuffer',\ + glFinish,'glFinish',\ + glFlush,'glFlush',\ + glFogf,'glFogf',\ + glFogfv,'glFogfv',\ + glFogi,'glFogi',\ + glFogiv,'glFogiv',\ + glFrontFace,'glFrontFace',\ + glFrustum,'glFrustum',\ + glGenLists,'glGenLists',\ + glGenTextures,'glGenTextures',\ + glGetBooleanv,'glGetBooleanv',\ + glGetClipPlane,'glGetClipPlane',\ + glGetDoublev,'glGetDoublev',\ + glGetError,'glGetError',\ + glGetFloatv,'glGetFloatv',\ + glGetIntegerv,'glGetIntegerv',\ + glGetLightfv,'glGetLightfv',\ + glGetLightiv,'glGetLightiv',\ + glGetMapdv,'glGetMapdv',\ + glGetMapfv,'glGetMapfv',\ + glGetMapiv,'glGetMapiv',\ + glGetMaterialfv,'glGetMaterialfv',\ + glGetMaterialiv,'glGetMaterialiv',\ + glGetPixelMapfv,'glGetPixelMapfv',\ + glGetPixelMapuiv,'glGetPixelMapuiv',\ + glGetPixelMapusv,'glGetPixelMapusv',\ + glGetPointerv,'glGetPointerv',\ + glGetPolygonStipple,'glGetPolygonStipple',\ + glGetString,'glGetString',\ + glGetTexEnvfv,'glGetTexEnvfv',\ + glGetTexEnviv,'glGetTexEnviv',\ + glGetTexGendv,'glGetTexGendv',\ + glGetTexGenfv,'glGetTexGenfv',\ + glGetTexGeniv,'glGetTexGeniv',\ + glGetTexImage,'glGetTexImage',\ + glGetTexLevelParameterfv,'glGetTexLevelParameterfv',\ + glGetTexLevelParameteriv,'glGetTexLevelParameteriv',\ + glGetTexParameterfv,'glGetTexParameterfv',\ + glGetTexParameteriv,'glGetTexParameteriv',\ + glHint,'glHint',\ + glIndexMask,'glIndexMask',\ + glIndexPointer,'glIndexPointer',\ + glIndexd,'glIndexd',\ + glIndexdv,'glIndexdv',\ + glIndexf,'glIndexf',\ + glIndexfv,'glIndexfv',\ + glIndexi,'glIndexi',\ + glIndexiv,'glIndexiv',\ + glIndexs,'glIndexs',\ + glIndexsv,'glIndexsv',\ + glIndexub,'glIndexub',\ + glIndexubv,'glIndexubv',\ + glInitNames,'glInitNames',\ + glInterleavedArrays,'glInterleavedArrays',\ + glIsEnabled,'glIsEnabled',\ + glIsList,'glIsList',\ + glIsTexture,'glIsTexture',\ + glLightModelf,'glLightModelf',\ + glLightModelfv,'glLightModelfv',\ + glLightModeli,'glLightModeli',\ + glLightModeliv,'glLightModeliv',\ + glLightf,'glLightf',\ + glLightfv,'glLightfv',\ + glLighti,'glLighti',\ + glLightiv,'glLightiv',\ + glLineStipple,'glLineStipple',\ + glLineWidth,'glLineWidth',\ + glListBase,'glListBase',\ + glLoadIdentity,'glLoadIdentity',\ + glLoadMatrixd,'glLoadMatrixd',\ + glLoadMatrixf,'glLoadMatrixf',\ + glLoadName,'glLoadName',\ + glLogicOp,'glLogicOp',\ + glMap1d,'glMap1d',\ + glMap1f,'glMap1f',\ + glMap2d,'glMap2d',\ + glMap2f,'glMap2f',\ + glMapGrid1d,'glMapGrid1d',\ + glMapGrid1f,'glMapGrid1f',\ + glMapGrid2d,'glMapGrid2d',\ + glMapGrid2f,'glMapGrid2f',\ + glMaterialf,'glMaterialf',\ + glMaterialfv,'glMaterialfv',\ + glMateriali,'glMateriali',\ + glMaterialiv,'glMaterialiv',\ + glMatrixMode,'glMatrixMode',\ + glMultMatrixd,'glMultMatrixd',\ + glMultMatrixf,'glMultMatrixf',\ + glNewList,'glNewList',\ + glNormal3b,'glNormal3b',\ + glNormal3bv,'glNormal3bv',\ + glNormal3d,'glNormal3d',\ + glNormal3dv,'glNormal3dv',\ + glNormal3f,'glNormal3f',\ + glNormal3fv,'glNormal3fv',\ + glNormal3i,'glNormal3i',\ + glNormal3iv,'glNormal3iv',\ + glNormal3s,'glNormal3s',\ + glNormal3sv,'glNormal3sv',\ + glNormalPointer,'glNormalPointer',\ + glOrtho,'glOrtho',\ + glPassThrough,'glPassThrough',\ + glPixelMapfv,'glPixelMapfv',\ + glPixelMapuiv,'glPixelMapuiv',\ + glPixelMapusv,'glPixelMapusv',\ + glPixelStoref,'glPixelStoref',\ + glPixelStorei,'glPixelStorei',\ + glPixelTransferf,'glPixelTransferf',\ + glPixelTransferi,'glPixelTransferi',\ + glPixelZoom,'glPixelZoom',\ + glPointSize,'glPointSize',\ + glPolygonMode,'glPolygonMode',\ + glPolygonOffset,'glPolygonOffset',\ + glPolygonStipple,'glPolygonStipple',\ + glPopAttrib,'glPopAttrib',\ + glPopClientAttrib,'glPopClientAttrib',\ + glPopMatrix,'glPopMatrix',\ + glPopName,'glPopName',\ + glPrioritizeTextures,'glPrioritizeTextures',\ + glPushAttrib,'glPushAttrib',\ + glPushClientAttrib,'glPushClientAttrib',\ + glPushMatrix,'glPushMatrix',\ + glPushName,'glPushName',\ + glRasterPos2d,'glRasterPos2d',\ + glRasterPos2dv,'glRasterPos2dv',\ + glRasterPos2f,'glRasterPos2f',\ + glRasterPos2fv,'glRasterPos2fv',\ + glRasterPos2i,'glRasterPos2i',\ + glRasterPos2iv,'glRasterPos2iv',\ + glRasterPos2s,'glRasterPos2s',\ + glRasterPos2sv,'glRasterPos2sv',\ + glRasterPos3d,'glRasterPos3d',\ + glRasterPos3dv,'glRasterPos3dv',\ + glRasterPos3f,'glRasterPos3f',\ + glRasterPos3fv,'glRasterPos3fv',\ + glRasterPos3i,'glRasterPos3i',\ + glRasterPos3iv,'glRasterPos3iv',\ + glRasterPos3s,'glRasterPos3s',\ + glRasterPos3sv,'glRasterPos3sv',\ + glRasterPos4d,'glRasterPos4d',\ + glRasterPos4dv,'glRasterPos4dv',\ + glRasterPos4f,'glRasterPos4f',\ + glRasterPos4fv,'glRasterPos4fv',\ + glRasterPos4i,'glRasterPos4i',\ + glRasterPos4iv,'glRasterPos4iv',\ + glRasterPos4s,'glRasterPos4s',\ + glRasterPos4sv,'glRasterPos4sv',\ + glReadBuffer,'glReadBuffer',\ + glReadPixels,'glReadPixels',\ + glRectd,'glRectd',\ + glRectdv,'glRectdv',\ + glRectf,'glRectf',\ + glRectfv,'glRectfv',\ + glRecti,'glRecti',\ + glRectiv,'glRectiv',\ + glRects,'glRects',\ + glRectsv,'glRectsv',\ + glRenderMode,'glRenderMode',\ + glRotated,'glRotated',\ + glRotatef,'glRotatef',\ + glScaled,'glScaled',\ + glScalef,'glScalef',\ + glScissor,'glScissor',\ + glSelectBuffer,'glSelectBuffer',\ + glShadeModel,'glShadeModel',\ + glStencilFunc,'glStencilFunc',\ + glStencilMask,'glStencilMask',\ + glStencilOp,'glStencilOp',\ + glTexCoord1d,'glTexCoord1d',\ + glTexCoord1dv,'glTexCoord1dv',\ + glTexCoord1f,'glTexCoord1f',\ + glTexCoord1fv,'glTexCoord1fv',\ + glTexCoord1i,'glTexCoord1i',\ + glTexCoord1iv,'glTexCoord1iv',\ + glTexCoord1s,'glTexCoord1s',\ + glTexCoord1sv,'glTexCoord1sv',\ + glTexCoord2d,'glTexCoord2d',\ + glTexCoord2dv,'glTexCoord2dv',\ + glTexCoord2f,'glTexCoord2f',\ + glTexCoord2fv,'glTexCoord2fv',\ + glTexCoord2i,'glTexCoord2i',\ + glTexCoord2iv,'glTexCoord2iv',\ + glTexCoord2s,'glTexCoord2s',\ + glTexCoord2sv,'glTexCoord2sv',\ + glTexCoord3d,'glTexCoord3d',\ + glTexCoord3dv,'glTexCoord3dv',\ + glTexCoord3f,'glTexCoord3f',\ + glTexCoord3fv,'glTexCoord3fv',\ + glTexCoord3i,'glTexCoord3i',\ + glTexCoord3iv,'glTexCoord3iv',\ + glTexCoord3s,'glTexCoord3s',\ + glTexCoord3sv,'glTexCoord3sv',\ + glTexCoord4d,'glTexCoord4d',\ + glTexCoord4dv,'glTexCoord4dv',\ + glTexCoord4f,'glTexCoord4f',\ + glTexCoord4fv,'glTexCoord4fv',\ + glTexCoord4i,'glTexCoord4i',\ + glTexCoord4iv,'glTexCoord4iv',\ + glTexCoord4s,'glTexCoord4s',\ + glTexCoord4sv,'glTexCoord4sv',\ + glTexCoordPointer,'glTexCoordPointer',\ + glTexEnvf,'glTexEnvf',\ + glTexEnvfv,'glTexEnvfv',\ + glTexEnvi,'glTexEnvi',\ + glTexEnviv,'glTexEnviv',\ + glTexGend,'glTexGend',\ + glTexGendv,'glTexGendv',\ + glTexGenf,'glTexGenf',\ + glTexGenfv,'glTexGenfv',\ + glTexGeni,'glTexGeni',\ + glTexGeniv,'glTexGeniv',\ + glTexImage1D,'glTexImage1D',\ + glTexImage2D,'glTexImage2D',\ + glTexParameterf,'glTexParameterf',\ + glTexParameterfv,'glTexParameterfv',\ + glTexParameteri,'glTexParameteri',\ + glTexParameteriv,'glTexParameteriv',\ + glTexSubImage1D,'glTexSubImage1D',\ + glTexSubImage2D,'glTexSubImage2D',\ + glTranslated,'glTranslated',\ + glTranslatef,'glTranslatef',\ + glVertex2d,'glVertex2d',\ + glVertex2dv,'glVertex2dv',\ + glVertex2f,'glVertex2f',\ + glVertex2fv,'glVertex2fv',\ + glVertex2i,'glVertex2i',\ + glVertex2iv,'glVertex2iv',\ + glVertex2s,'glVertex2s',\ + glVertex2sv,'glVertex2sv',\ + glVertex3d,'glVertex3d',\ + glVertex3dv,'glVertex3dv',\ + glVertex3f,'glVertex3f',\ + glVertex3fv,'glVertex3fv',\ + glVertex3i,'glVertex3i',\ + glVertex3iv,'glVertex3iv',\ + glVertex3s,'glVertex3s',\ + glVertex3sv,'glVertex3sv',\ + glVertex4d,'glVertex4d',\ + glVertex4dv,'glVertex4dv',\ + glVertex4f,'glVertex4f',\ + glVertex4fv,'glVertex4fv',\ + glVertex4i,'glVertex4i',\ + glVertex4iv,'glVertex4iv',\ + glVertex4s,'glVertex4s',\ + glVertex4sv,'glVertex4sv',\ + glVertexPointer,'glVertexPointer',\ + glViewport,'glViewport',\ + wglGetProcAddress,'wglGetProcAddress',\ + wglCopyContext,'wglCopyContext',\ + wglCreateContext,'wglCreateContext',\ + wglCreateLayerContext,'wglCreateLayerContext',\ + wglDeleteContext,'wglDeleteContext',\ + wglDescribeLayerPlane,'wglDescribeLayerPlane',\ + wglGetCurrentContext,'wglGetCurrentContext',\ + wglGetCurrentDC,'wglGetCurrentDC',\ + wglGetLayerPaletteEntries,'wglGetLayerPaletteEntries',\ + wglMakeCurrent,'wglMakeCurrent',\ + wglRealizeLayerPalette,'wglRealizeLayerPalette',\ + wglSetLayerPaletteEntries,'wglSetLayerPaletteEntries',\ + wglShareLists,'wglShareLists',\ + wglSwapLayerBuffers,'wglSwapLayerBuffers',\ + wglSwapMultipleBuffers,'wglSwapMultipleBuffers',\ + wglUseFontBitmapsA,'wglUseFontBitmapsA',\ + wglUseFontOutlinesA,'wglUseFontOutlinesA',\ + wglUseFontBitmapsW,'wglUseFontBitmapsW',\ + wglUseFontOutlinesW,'wglUseFontOutlinesW',\ + glDrawRangeElements,'glDrawRangeElements',\ + glTexImage3D,'glTexImage3D',\ + glBlendColor,'glBlendColor',\ + glBlendEquation,'glBlendEquation',\ + glColorSubTable,'glColorSubTable',\ + glCopyColorSubTable,'glCopyColorSubTable',\ + glColorTable,'glColorTable',\ + glCopyColorTable,'glCopyColorTable',\ + glColorTableParameteriv,'glColorTableParameteriv',\ + glColorTableParameterfv,'glColorTableParameterfv',\ + glGetColorTable,'glGetColorTable',\ + glGetColorTableParameteriv,'glGetColorTableParameteriv',\ + glGetColorTableParameterfv,'glGetColorTableParameterfv',\ + glConvolutionFilter1D,'glConvolutionFilter1D',\ + glConvolutionFilter2D,'glConvolutionFilter2D',\ + glCopyConvolutionFilter1D,'glCopyConvolutionFilter1D',\ + glCopyConvolutionFilter2D,'glCopyConvolutionFilter2D',\ + glGetConvolutionFilter,'glGetConvolutionFilter',\ + glSeparableFilter2D,'glSeparableFilter2D',\ + glGetSeparableFilter,'glGetSeparableFilter',\ + glConvolutionParameteri,'glConvolutionParameteri',\ + glConvolutionParameteriv,'glConvolutionParameteriv',\ + glConvolutionParameterf,'glConvolutionParameterf',\ + glConvolutionParameterfv,'glConvolutionParameterfv',\ + glGetConvolutionParameteriv,'glGetConvolutionParameteriv',\ + glGetConvolutionParameterfv,'glGetConvolutionParameterfv',\ + glHistogram,'glHistogram',\ + glResetHistogram,'glResetHistogram',\ + glGetHistogram,'glGetHistogram',\ + glGetHistogramParameteriv,'glGetHistogramParameteriv',\ + glGetHistogramParameterfv,'glGetHistogramParameterfv',\ + glMinmax,'glMinmax',\ + glResetMinmax,'glResetMinmax',\ + glGetMinmax,'glGetMinmax',\ + glGetMinmaxParameteriv,'glGetMinmaxParameteriv',\ + glGetMinmaxParameterfv,'glGetMinmaxParameterfv' + + import glu,\ + gluBeginCurve,'gluBeginCurve',\ + gluBeginPolygon,'gluBeginPolygon',\ + gluBeginSurface,'gluBeginSurface',\ + gluBeginTrim,'gluBeginTrim',\ + gluBuild1DMipmaps,'gluBuild1DMipmaps',\ + gluBuild2DMipmaps,'gluBuild2DMipmaps',\ + gluCylinder,'gluCylinder',\ + gluDeleteNurbsRenderer,'gluDeleteNurbsRenderer',\ + gluDeleteQuadric,'gluDeleteQuadric',\ + gluDeleteTess,'gluDeleteTess',\ + gluDisk,'gluDisk',\ + gluEndCurve,'gluEndCurve',\ + gluEndPolygon,'gluEndPolygon',\ + gluEndSurface,'gluEndSurface',\ + gluEndTrim,'gluEndTrim',\ + gluErrorString,'gluErrorString',\ + gluGetNurbsProperty,'gluGetNurbsProperty',\ + gluGetString,'gluGetString',\ + gluGetTessProperty,'gluGetTessProperty',\ + gluLoadSamplingMatrices,'gluLoadSamplingMatrices',\ + gluLookAt,'gluLookAt',\ + gluNewNurbsRenderer,'gluNewNurbsRenderer',\ + gluNewQuadric,'gluNewQuadric',\ + gluNewTess,'gluNewTess',\ + gluNextContour,'gluNextContour',\ + gluNurbsCallback,'gluNurbsCallback',\ + gluNurbsCurve,'gluNurbsCurve',\ + gluNurbsProperty,'gluNurbsProperty',\ + gluNurbsSurface,'gluNurbsSurface',\ + gluOrtho2D,'gluOrtho2D',\ + gluPartialDisk,'gluPartialDisk',\ + gluPerspective,'gluPerspective',\ + gluPickMatrix,'gluPickMatrix',\ + gluProject,'gluProject',\ + gluPwlCurve,'gluPwlCurve',\ + gluQuadricCallback,'gluQuadricCallback',\ + gluQuadricDrawStyle,'gluQuadricDrawStyle',\ + gluQuadricNormals,'gluQuadricNormals',\ + gluQuadricOrientation,'gluQuadricOrientation',\ + gluQuadricTexture,'gluQuadricTexture',\ + gluScaleImage,'gluScaleImage',\ + gluSphere,'gluSphere',\ + gluTessBeginContour,'gluTessBeginContour',\ + gluTessBeginPolygon,'gluTessBeginPolygon',\ + gluTessCallback,'gluTessCallback',\ + gluTessEndContour,'gluTessEndContour',\ + gluTessEndPolygon,'gluTessEndPolygon',\ + gluTessNormal,'gluTessNormal',\ + gluTessProperty,'gluTessProperty',\ + gluTessVertex,'gluTessVertex',\ + gluUnProject,'gluUnProject' diff --git a/fasmw172/EXAMPLES/WIN64/PE64DEMO/PE64DEMO.ASM b/fasmw172/EXAMPLES/WIN64/PE64DEMO/PE64DEMO.ASM new file mode 100644 index 0000000..c0b9558 --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/PE64DEMO/PE64DEMO.ASM @@ -0,0 +1,45 @@ + +; Example of 64-bit PE program + +format PE64 GUI +entry start + +section '.text' code readable executable + + start: + sub rsp,8*5 ; reserve stack for API use and make stack dqword aligned + + mov r9d,0 + lea r8,[_caption] + lea rdx,[_message] + mov rcx,0 + call [MessageBoxA] + + mov ecx,eax + call [ExitProcess] + +section '.data' data readable writeable + + _caption db 'Win64 assembly program',0 + _message db 'Hello World!',0 + +section '.idata' import data readable writeable + + dd 0,0,0,RVA kernel_name,RVA kernel_table + dd 0,0,0,RVA user_name,RVA user_table + dd 0,0,0,0,0 + + kernel_table: + ExitProcess dq RVA _ExitProcess + dq 0 + user_table: + MessageBoxA dq RVA _MessageBoxA + dq 0 + + kernel_name db 'KERNEL32.DLL',0 + user_name db 'USER32.DLL',0 + + _ExitProcess dw 0 + db 'ExitProcess',0 + _MessageBoxA dw 0 + db 'MessageBoxA',0 diff --git a/fasmw172/EXAMPLES/WIN64/TEMPLATE/TEMPLATE.ASM b/fasmw172/EXAMPLES/WIN64/TEMPLATE/TEMPLATE.ASM new file mode 100644 index 0000000..f67bd7e --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/TEMPLATE/TEMPLATE.ASM @@ -0,0 +1,82 @@ + +format PE64 GUI 5.0 +entry start + +include 'win64a.inc' + +section '.text' code readable executable + + start: + sub rsp,8 ; Make stack dqword aligned + + invoke GetModuleHandle,0 + mov [wc.hInstance],rax + invoke LoadIcon,0,IDI_APPLICATION + mov [wc.hIcon],rax + mov [wc.hIconSm],rax + invoke LoadCursor,0,IDC_ARROW + mov [wc.hCursor],rax + invoke RegisterClassEx,wc + test rax,rax + jz error + + invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,256,192,NULL,NULL,[wc.hInstance],NULL + test rax,rax + jz error + + msg_loop: + invoke GetMessage,msg,NULL,0,0 + cmp eax,1 + jb end_loop + jne msg_loop + invoke TranslateMessage,msg + invoke DispatchMessage,msg + jmp msg_loop + + error: + invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK + + end_loop: + invoke ExitProcess,[msg.wParam] + +proc WindowProc uses rbx rsi rdi, hwnd,wmsg,wparam,lparam + +; Note that first four parameters are passed in registers, +; while names given in the declaration of procedure refer to the stack +; space reserved for them - you may store them there to be later accessible +; if the contents of registers gets destroyed. This may look like: +; mov [hwnd],rcx +; mov [wmsg],edx +; mov [wparam],r8 +; mov [lparam],r9 + + cmp edx,WM_DESTROY + je .wmdestroy + .defwndproc: + invoke DefWindowProc,rcx,rdx,r8,r9 + jmp .finish + .wmdestroy: + invoke PostQuitMessage,0 + xor eax,eax + .finish: + ret + +endp + +section '.data' data readable writeable + + _title TCHAR 'Win64 program template',0 + _class TCHAR 'FASMWIN64',0 + _error TCHAR 'Startup failed.',0 + + wc WNDCLASSEX sizeof.WNDCLASSEX,0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class,NULL + + msg MSG + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL' + + include 'api\kernel32.inc' + include 'api\user32.inc' diff --git a/fasmw172/EXAMPLES/WIN64/USECOM/USECOM.ASM b/fasmw172/EXAMPLES/WIN64/USECOM/USECOM.ASM new file mode 100644 index 0000000..d55687a --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/USECOM/USECOM.ASM @@ -0,0 +1,142 @@ + +; Component Object Model usage demonstration + +format PE64 GUI 5.0 +entry start + +include 'win64a.inc' + +struc GUID def + { + match d1-d2-d3-d4-d5, def + \{ + .Data1 dd 0x\#d1 + .Data2 dw 0x\#d2 + .Data3 dw 0x\#d3 + .Data4 db 0x\#d4 shr 8,0x\#d4 and 0FFh + .Data5 db 0x\#d5 shr 40,0x\#d5 shr 32 and 0FFh,0x\#d5 shr 24 and 0FFh,0x\#d5 shr 16 and 0FFh,0x\#d5 shr 8 and 0FFh,0x\#d5 and 0FFh + \} + } + +interface ITaskBarList,\ + QueryInterface,\ + AddRef,\ + Release,\ + HrInit,\ + AddTab,\ + DeleteTab,\ + ActivateTab,\ + SetActiveAlt + +CLSCTX_INPROC_SERVER = 0x1 +CLSCTX_INPROC_HANDLER = 0x2 +CLSCTX_LOCAL_SERVER = 0x4 +CLSCTX_INPROC_SERVER16 = 0x8 +CLSCTX_REMOTE_SERVER = 0x10 +CLSCTX_INPROC_HANDLER16 = 0x20 +CLSCTX_INPROC_SERVERX86 = 0x40 +CLSCTX_INPROC_HANDLERX86 = 0x80 +CLSCTX_ESERVER_HANDLER = 0x100 +CLSCTX_NO_CODE_DOWNLOAD = 0x400 +CLSCTX_NO_CUSTOM_MARSHAL = 0x1000 +CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000 +CLSCTX_NO_FAILURE_LOG = 0x4000 +CLSCTX_DISABLE_AAA = 0x8000 +CLSCTX_ENABLE_AAA = 0x10000 +CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000 + +ID_EXIT = IDCANCEL +ID_SHOW = 100 +ID_HIDE = 101 + +IDD_COMDEMO = 1 + +section '.text' code readable executable + + start: + sub rsp,8 ; Make stack dqword aligned + + invoke CoInitialize,NULL + invoke CoCreateInstance,CLSID_TaskbarList,NULL,CLSCTX_INPROC_SERVER,IID_ITaskbarList,ShellTaskBar + + invoke GetModuleHandle,0 + invoke DialogBoxParam,rax,IDD_COMDEMO,HWND_DESKTOP,COMDemo,0 + + cominvk ShellTaskBar,Release + + invoke ExitProcess,0 + +proc COMDemo uses rbx, hwnd,msg,wparam,lparam + mov [hwnd],rcx + cmp edx,WM_INITDIALOG + je .wminitdialog + cmp edx,WM_COMMAND + je .wmcommand + cmp edx,WM_CLOSE + je .wmclose + xor eax,eax + jmp .finish + .wminitdialog: + jmp .processed + .wmcommand: + cmp r8,BN_CLICKED shl 16 + ID_EXIT + je .wmclose + cmp r8,BN_CLICKED shl 16 + ID_SHOW + je .show + cmp r8,BN_CLICKED shl 16 + ID_HIDE + jne .processed + .hide: + cominvk ShellTaskBar,HrInit + cominvk ShellTaskBar,DeleteTab,[hwnd] + jmp .processed + .show: + mov rbx,[ShellTaskBar] + comcall rbx,ITaskBarList,HrInit + comcall rbx,ITaskBarList,AddTab,[hwnd] + comcall rbx,ITaskBarList,ActivateTab,[hwnd] + jmp .processed + .wmclose: + invoke EndDialog,[hwnd],0 + .processed: + mov eax,1 + .finish: + ret +endp + +section '.data' data readable writeable + + CLSID_TaskbarList GUID 56FDF344-FD6D-11D0-958A-006097C9A090 + IID_ITaskbarList GUID 56FDF342-FD6D-11D0-958A-006097C9A090 + + ShellTaskBar ITaskBarList + +section '.idata' import data readable + + library kernel,'KERNEL32.DLL',\ + user,'USER32.DLL',\ + ole,'OLE32.DLL' + + import kernel,\ + GetModuleHandle,'GetModuleHandleA',\ + ExitProcess,'ExitProcess' + + import user,\ + DialogBoxParam,'DialogBoxParamA',\ + EndDialog,'EndDialog' + + import ole,\ + CoInitialize,'CoInitialize',\ + CoCreateInstance,'CoCreateInstance' + +section '.rsrc' resource data readable + + directory RT_DIALOG,dialogs + + resource dialogs,\ + IDD_COMDEMO,LANG_ENGLISH+SUBLANG_DEFAULT,comdemo + + dialog comdemo,'Taskbar item control',70,70,170,24,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'BUTTON','Show',ID_SHOW,4,4,45,15,WS_VISIBLE+WS_TABSTOP + dialogitem 'BUTTON','Hide',ID_HIDE,54,4,45,15,WS_VISIBLE+WS_TABSTOP + dialogitem 'BUTTON','Exit',ID_EXIT,120,4,45,15,WS_VISIBLE+WS_TABSTOP + enddialog diff --git a/fasmw172/EXAMPLES/WIN64/WIN64AVX/WIN64AVX.ASM b/fasmw172/EXAMPLES/WIN64/WIN64AVX/WIN64AVX.ASM new file mode 100644 index 0000000..a6f9dda --- /dev/null +++ b/fasmw172/EXAMPLES/WIN64/WIN64AVX/WIN64AVX.ASM @@ -0,0 +1,98 @@ + +format PE64 NX GUI 6.0 +entry start + +include 'win64a.inc' + +section '.data' data readable writeable + + _title db 'AVX playground',0 + _error db 'AVX instructions are not supported.',0 + + x dq 3.14159265389 + + vector_output: + rept 16 i:0 + { + db 'ymm',`i,': %f,%f,%f,%f',13,10 + } + db 0 + + buffer db 1000h dup ? + +section '.text' code readable executable + + start: + + mov eax,1 + cpuid + and ecx,18000000h + cmp ecx,18000000h + jne no_AVX + xor ecx,ecx + xgetbv + and eax,110b + cmp eax,110b + jne no_AVX + + vbroadcastsd ymm0, [x] + vsqrtpd ymm1, ymm0 + + vsubpd ymm2, ymm0, ymm1 + vsubpd ymm3, ymm1, ymm2 + + vaddpd xmm4, xmm2, xmm3 + vaddpd ymm5, ymm4, ymm0 + + vperm2f128 ymm6, ymm4, ymm5, 03h + vshufpd ymm7, ymm6, ymm5, 10010011b + + vroundpd ymm8, ymm7, 0011b + vroundpd ymm9, ymm7, 0 + + sub rsp,418h + + rept 16 i:0 + { + vmovups [rsp+10h+i*32],ymm#i + } + + mov r8,[rsp+10h] + mov r9,[rsp+18h] + lea rdx,[vector_output] + lea rcx,[buffer] + call [sprintf] + + xor ecx,ecx + lea rdx,[buffer] + lea r8,[_title] + xor r9d,r9d + call [MessageBoxA] + + xor ecx,ecx + call [ExitProcess] + + no_AVX: + + sub rsp,28h + + xor ecx,ecx + lea rdx,[_error] + lea r8,[_title] + mov r9d,10h + call [MessageBoxA] + + mov ecx,1 + call [ExitProcess] + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + msvcrt,'MSVCRT.DLL' + + include 'api\kernel32.inc' + include 'api\user32.inc' + + import msvcrt,\ + sprintf,'sprintf' diff --git a/fasmw172/FASM.PDF b/fasmw172/FASM.PDF new file mode 100644 index 0000000..e2a2f92 Binary files /dev/null and b/fasmw172/FASM.PDF differ diff --git a/fasmw172/INCLUDE/API/ADVAPI32.INC b/fasmw172/INCLUDE/API/ADVAPI32.INC new file mode 100644 index 0000000..0a97a2c --- /dev/null +++ b/fasmw172/INCLUDE/API/ADVAPI32.INC @@ -0,0 +1,535 @@ + +; ADVAPI32 API calls + +import advapi32,\ + AbortSystemShutdownA,'AbortSystemShutdownA',\ + AbortSystemShutdownW,'AbortSystemShutdownW',\ + AccessCheck,'AccessCheck',\ + AccessCheckAndAuditAlarmA,'AccessCheckAndAuditAlarmA',\ + AccessCheckAndAuditAlarmW,'AccessCheckAndAuditAlarmW',\ + AccessCheckByType,'AccessCheckByType',\ + AccessCheckByTypeAndAuditAlarmA,'AccessCheckByTypeAndAuditAlarmA',\ + AccessCheckByTypeAndAuditAlarmW,'AccessCheckByTypeAndAuditAlarmW',\ + AccessCheckByTypeResultList,'AccessCheckByTypeResultList',\ + AccessCheckByTypeResultListAndAuditAlarmA,'AccessCheckByTypeResultListAndAuditAlarmA',\ + AccessCheckByTypeResultListAndAuditAlarmW,'AccessCheckByTypeResultListAndAuditAlarmW',\ + AddAccessAllowedAce,'AddAccessAllowedAce',\ + AddAccessAllowedAceEx,'AddAccessAllowedAceEx',\ + AddAccessAllowedObjectAce,'AddAccessAllowedObjectAce',\ + AddAccessDeniedAce,'AddAccessDeniedAce',\ + AddAccessDeniedAceEx,'AddAccessDeniedAceEx',\ + AddAccessDeniedObjectAce,'AddAccessDeniedObjectAce',\ + AddAce,'AddAce',\ + AddAuditAccessAce,'AddAuditAccessAce',\ + AddAuditAccessAceEx,'AddAuditAccessAceEx',\ + AddAuditAccessObjectAce,'AddAuditAccessObjectAce',\ + AdjustTokenGroups,'AdjustTokenGroups',\ + AdjustTokenPrivileges,'AdjustTokenPrivileges',\ + AllocateAndInitializeSid,'AllocateAndInitializeSid',\ + AllocateLocallyUniqueId,'AllocateLocallyUniqueId',\ + AreAllAccessesGranted,'AreAllAccessesGranted',\ + AreAnyAccessesGranted,'AreAnyAccessesGranted',\ + BackupEventLogA,'BackupEventLogA',\ + BackupEventLogW,'BackupEventLogW',\ + BuildExplicitAccessWithNameA,'BuildExplicitAccessWithNameA',\ + BuildExplicitAccessWithNameW,'BuildExplicitAccessWithNameW',\ + BuildImpersonateExplicitAccessWithNameA,'BuildImpersonateExplicitAccessWithNameA',\ + BuildImpersonateExplicitAccessWithNameW,'BuildImpersonateExplicitAccessWithNameW',\ + BuildImpersonateTrusteeA,'BuildImpersonateTrusteeA',\ + BuildImpersonateTrusteeW,'BuildImpersonateTrusteeW',\ + BuildSecurityDescriptorA,'BuildSecurityDescriptorA',\ + BuildSecurityDescriptorW,'BuildSecurityDescriptorW',\ + BuildTrusteeWithNameA,'BuildTrusteeWithNameA',\ + BuildTrusteeWithNameW,'BuildTrusteeWithNameW',\ + BuildTrusteeWithSidA,'BuildTrusteeWithSidA',\ + BuildTrusteeWithSidW,'BuildTrusteeWithSidW',\ + CancelOverlappedAccess,'CancelOverlappedAccess',\ + ChangeServiceConfig2A,'ChangeServiceConfig2A',\ + ChangeServiceConfig2W,'ChangeServiceConfig2W',\ + ChangeServiceConfigA,'ChangeServiceConfigA',\ + ChangeServiceConfigW,'ChangeServiceConfigW',\ + ClearEventLogA,'ClearEventLogA',\ + ClearEventLogW,'ClearEventLogW',\ + CloseEventLog,'CloseEventLog',\ + CloseRaw,'CloseRaw',\ + CloseServiceHandle,'CloseServiceHandle',\ + ControlService,'ControlService',\ + ConvertAccessToSecurityDescriptorA,'ConvertAccessToSecurityDescriptorA',\ + ConvertAccessToSecurityDescriptorW,'ConvertAccessToSecurityDescriptorW',\ + ConvertSecurityDescriptorToAccessA,'ConvertSecurityDescriptorToAccessA',\ + ConvertSecurityDescriptorToAccessW,'ConvertSecurityDescriptorToAccessW',\ + ConvertSecurityDescriptorToAccessNamedA,'ConvertSecurityDescriptorToAccessNamedA',\ + ConvertSecurityDescriptorToAccessNamedW,'ConvertSecurityDescriptorToAccessNamedW',\ + ConvertToAutoInheritPrivateObjectSecurity,'ConvertToAutoInheritPrivateObjectSecurity',\ + CopySid,'CopySid',\ + CreatePrivateObjectSecurity,'CreatePrivateObjectSecurity',\ + CreatePrivateObjectSecurityEx,'CreatePrivateObjectSecurityEx',\ + CreateProcessAsUserA,'CreateProcessAsUserA',\ + CreateProcessAsUserW,'CreateProcessAsUserW',\ + CreateRestrictedToken,'CreateRestrictedToken',\ + CreateServiceA,'CreateServiceA',\ + CreateServiceW,'CreateServiceW',\ + CryptAcquireContextA,'CryptAcquireContextA',\ + CryptAcquireContextW,'CryptAcquireContextW',\ + CryptContextAddRef,'CryptContextAddRef',\ + CryptCreateHash,'CryptCreateHash',\ + CryptDecrypt,'CryptDecrypt',\ + CryptDeriveKey,'CryptDeriveKey',\ + CryptDestroyHash,'CryptDestroyHash',\ + CryptDestroyKey,'CryptDestroyKey',\ + CryptDuplicateHash,'CryptDuplicateHash',\ + CryptDuplicateKey,'CryptDuplicateKey',\ + CryptEncrypt,'CryptEncrypt',\ + CryptEnumProviderTypesA,'CryptEnumProviderTypesA',\ + CryptEnumProviderTypesW,'CryptEnumProviderTypesW',\ + CryptEnumProvidersA,'CryptEnumProvidersA',\ + CryptEnumProvidersW,'CryptEnumProvidersW',\ + CryptExportKey,'CryptExportKey',\ + CryptGenKey,'CryptGenKey',\ + CryptGenRandom,'CryptGenRandom',\ + CryptGetDefaultProviderA,'CryptGetDefaultProviderA',\ + CryptGetDefaultProviderW,'CryptGetDefaultProviderW',\ + CryptGetHashParam,'CryptGetHashParam',\ + CryptGetKeyParam,'CryptGetKeyParam',\ + CryptGetProvParam,'CryptGetProvParam',\ + CryptGetUserKey,'CryptGetUserKey',\ + CryptHashData,'CryptHashData',\ + CryptHashSessionKey,'CryptHashSessionKey',\ + CryptImportKey,'CryptImportKey',\ + CryptReleaseContext,'CryptReleaseContext',\ + CryptSetHashParam,'CryptSetHashParam',\ + CryptSetKeyParam,'CryptSetKeyParam',\ + CryptSetProvParam,'CryptSetProvParam',\ + CryptSetProviderA,'CryptSetProviderA',\ + CryptSetProviderW,'CryptSetProviderW',\ + CryptSetProviderExA,'CryptSetProviderExA',\ + CryptSetProviderExW,'CryptSetProviderExW',\ + CryptSignHashA,'CryptSignHashA',\ + CryptSignHashW,'CryptSignHashW',\ + CryptVerifySignatureA,'CryptVerifySignatureA',\ + CryptVerifySignatureW,'CryptVerifySignatureW',\ + DecryptFileA,'DecryptFileA',\ + DecryptFileW,'DecryptFileW',\ + DeleteAce,'DeleteAce',\ + DeleteService,'DeleteService',\ + DeregisterEventSource,'DeregisterEventSource',\ + DestroyPrivateObjectSecurity,'DestroyPrivateObjectSecurity',\ + DuplicateToken,'DuplicateToken',\ + DuplicateTokenEx,'DuplicateTokenEx',\ + ElfBackupEventLogFileA,'ElfBackupEventLogFileA',\ + ElfBackupEventLogFileW,'ElfBackupEventLogFileW',\ + ElfChangeNotify,'ElfChangeNotify',\ + ElfClearEventLogFileA,'ElfClearEventLogFileA',\ + ElfClearEventLogFileW,'ElfClearEventLogFileW',\ + ElfCloseEventLog,'ElfCloseEventLog',\ + ElfDeregisterEventSource,'ElfDeregisterEventSource',\ + ElfNumberOfRecords,'ElfNumberOfRecords',\ + ElfOldestRecord,'ElfOldestRecord',\ + ElfOpenBackupEventLogA,'ElfOpenBackupEventLogA',\ + ElfOpenBackupEventLogW,'ElfOpenBackupEventLogW',\ + ElfOpenEventLogA,'ElfOpenEventLogA',\ + ElfOpenEventLogW,'ElfOpenEventLogW',\ + ElfReadEventLogA,'ElfReadEventLogA',\ + ElfReadEventLogW,'ElfReadEventLogW',\ + ElfRegisterEventSourceA,'ElfRegisterEventSourceA',\ + ElfRegisterEventSourceW,'ElfRegisterEventSourceW',\ + ElfReportEventA,'ElfReportEventA',\ + ElfReportEventW,'ElfReportEventW',\ + EncryptFileA,'EncryptFileA',\ + EncryptFileW,'EncryptFileW',\ + EnumDependentServicesA,'EnumDependentServicesA',\ + EnumDependentServicesW,'EnumDependentServicesW',\ + EnumServicesStatusA,'EnumServicesStatusA',\ + EnumServicesStatusW,'EnumServicesStatusW',\ + EqualPrefixSid,'EqualPrefixSid',\ + EqualSid,'EqualSid',\ + FindFirstFreeAce,'FindFirstFreeAce',\ + FreeSid,'FreeSid',\ + GetAccessPermissionsForObjectA,'GetAccessPermissionsForObjectA',\ + GetAccessPermissionsForObjectW,'GetAccessPermissionsForObjectW',\ + GetAce,'GetAce',\ + GetAclInformation,'GetAclInformation',\ + GetAuditedPermissionsFromAclA,'GetAuditedPermissionsFromAclA',\ + GetAuditedPermissionsFromAclW,'GetAuditedPermissionsFromAclW',\ + GetCurrentHwProfileA,'GetCurrentHwProfileA',\ + GetCurrentHwProfileW,'GetCurrentHwProfileW',\ + GetEffectiveRightsFromAclA,'GetEffectiveRightsFromAclA',\ + GetEffectiveRightsFromAclW,'GetEffectiveRightsFromAclW',\ + GetExplicitEntriesFromAclA,'GetExplicitEntriesFromAclA',\ + GetExplicitEntriesFromAclW,'GetExplicitEntriesFromAclW',\ + GetFileSecurityA,'GetFileSecurityA',\ + GetFileSecurityW,'GetFileSecurityW',\ + GetKernelObjectSecurity,'GetKernelObjectSecurity',\ + GetLengthSid,'GetLengthSid',\ + GetMultipleTrusteeA,'GetMultipleTrusteeA',\ + GetMultipleTrusteeW,'GetMultipleTrusteeW',\ + GetMultipleTrusteeOperationA,'GetMultipleTrusteeOperationA',\ + GetMultipleTrusteeOperationW,'GetMultipleTrusteeOperationW',\ + GetNamedSecurityInfoA,'GetNamedSecurityInfoA',\ + GetNamedSecurityInfoW,'GetNamedSecurityInfoW',\ + GetNamedSecurityInfoExA,'GetNamedSecurityInfoExA',\ + GetNamedSecurityInfoExW,'GetNamedSecurityInfoExW',\ + GetNumberOfEventLogRecords,'GetNumberOfEventLogRecords',\ + GetOldestEventLogRecord,'GetOldestEventLogRecord',\ + GetOverlappedAccessResults,'GetOverlappedAccessResults',\ + GetPrivateObjectSecurity,'GetPrivateObjectSecurity',\ + GetSecurityDescriptorControl,'GetSecurityDescriptorControl',\ + GetSecurityDescriptorDacl,'GetSecurityDescriptorDacl',\ + GetSecurityDescriptorGroup,'GetSecurityDescriptorGroup',\ + GetSecurityDescriptorLength,'GetSecurityDescriptorLength',\ + GetSecurityDescriptorOwner,'GetSecurityDescriptorOwner',\ + GetSecurityDescriptorSacl,'GetSecurityDescriptorSacl',\ + GetSecurityInfo,'GetSecurityInfo',\ + GetSecurityInfoExA,'GetSecurityInfoExA',\ + GetSecurityInfoExW,'GetSecurityInfoExW',\ + GetServiceDisplayNameA,'GetServiceDisplayNameA',\ + GetServiceDisplayNameW,'GetServiceDisplayNameW',\ + GetServiceKeyNameA,'GetServiceKeyNameA',\ + GetServiceKeyNameW,'GetServiceKeyNameW',\ + GetSidLengthRequiredA,'GetSidLengthRequiredA',\ + GetSidLengthRequiredW,'GetSidLengthRequiredW',\ + GetSidSubAuthority,'GetSidSubAuthority',\ + GetSidSubAuthorityCount,'GetSidSubAuthorityCount',\ + GetTokenInformation,'GetTokenInformation',\ + GetTrusteeNameA,'GetTrusteeNameA',\ + GetTrusteeNameW,'GetTrusteeNameW',\ + GetTrusteeTypeA,'GetTrusteeTypeA',\ + GetTrusteeTypeW,'GetTrusteeTypeW',\ + GetUserNameA,'GetUserNameA',\ + GetUserNameW,'GetUserNameW',\ + I_ScSetServiceBitsA,'I_ScSetServiceBitsA',\ + I_ScSetServiceBitsW,'I_ScSetServiceBitsW',\ + ImpersonateLoggedOnUser,'ImpersonateLoggedOnUser',\ + ImpersonateNamedPipeClient,'ImpersonateNamedPipeClient',\ + ImpersonateSelf,'ImpersonateSelf',\ + InitializeAcl,'InitializeAcl',\ + InitializeSecurityDescriptor,'InitializeSecurityDescriptor',\ + InitializeSid,'InitializeSid',\ + InitiateSystemShutdownA,'InitiateSystemShutdownA',\ + InitiateSystemShutdownW,'InitiateSystemShutdownW',\ + IsTextUnicode,'IsTextUnicode',\ + IsTokenRestricted,'IsTokenRestricted',\ + IsValidAcl,'IsValidAcl',\ + IsValidSecurityDescriptor,'IsValidSecurityDescriptor',\ + IsValidSid,'IsValidSid',\ + LockServiceDatabase,'LockServiceDatabase',\ + LogonUserA,'LogonUserA',\ + LogonUserW,'LogonUserW',\ + LookupAccountNameA,'LookupAccountNameA',\ + LookupAccountNameW,'LookupAccountNameW',\ + LookupAccountSidA,'LookupAccountSidA',\ + LookupAccountSidW,'LookupAccountSidW',\ + LookupPrivilegeDisplayNameA,'LookupPrivilegeDisplayNameA',\ + LookupPrivilegeDisplayNameW,'LookupPrivilegeDisplayNameW',\ + LookupPrivilegeNameA,'LookupPrivilegeNameA',\ + LookupPrivilegeNameW,'LookupPrivilegeNameW',\ + LookupPrivilegeValueA,'LookupPrivilegeValueA',\ + LookupPrivilegeValueW,'LookupPrivilegeValueW',\ + LookupSecurityDescriptorPartsA,'LookupSecurityDescriptorPartsA',\ + LookupSecurityDescriptorPartsW,'LookupSecurityDescriptorPartsW',\ + LsaAddAccountRights,'LsaAddAccountRights',\ + LsaAddPrivilegesToAccount,'LsaAddPrivilegesToAccount',\ + LsaClearAuditLog,'LsaClearAuditLog',\ + LsaClose,'LsaClose',\ + LsaCreateAccount,'LsaCreateAccount',\ + LsaCreateSecret,'LsaCreateSecret',\ + LsaCreateTrustedDomain,'LsaCreateTrustedDomain',\ + LsaCreateTrustedDomainEx,'LsaCreateTrustedDomainEx',\ + LsaDelete,'LsaDelete',\ + LsaDeleteTrustedDomain,'LsaDeleteTrustedDomain',\ + LsaEnumerateAccountRights,'LsaEnumerateAccountRights',\ + LsaEnumerateAccounts,'LsaEnumerateAccounts',\ + LsaEnumerateAccountsWithUserRight,'LsaEnumerateAccountsWithUserRight',\ + LsaEnumeratePrivileges,'LsaEnumeratePrivileges',\ + LsaEnumeratePrivilegesOfAccount,'LsaEnumeratePrivilegesOfAccount',\ + LsaEnumerateTrustedDomains,'LsaEnumerateTrustedDomains',\ + LsaEnumerateTrustedDomainsEx,'LsaEnumerateTrustedDomainsEx',\ + LsaFreeMemory,'LsaFreeMemory',\ + LsaGetQuotasForAccount,'LsaGetQuotasForAccount',\ + LsaGetSystemAccessAccount,'LsaGetSystemAccessAccount',\ + LsaGetUserName,'LsaGetUserName',\ + LsaICLookupNames,'LsaICLookupNames',\ + LsaICLookupSids,'LsaICLookupSids',\ + LsaIGetTrustedDomainAuthInfoBlobs,'LsaIGetTrustedDomainAuthInfoBlobs',\ + LsaISetTrustedDomainAuthInfoBlobs,'LsaISetTrustedDomainAuthInfoBlobs',\ + LsaLookupNames,'LsaLookupNames',\ + LsaLookupPrivilegeDisplayName,'LsaLookupPrivilegeDisplayName',\ + LsaLookupPrivilegeName,'LsaLookupPrivilegeName',\ + LsaLookupPrivilegeValue,'LsaLookupPrivilegeValue',\ + LsaLookupSids,'LsaLookupSids',\ + LsaNtStatusToWinError,'LsaNtStatusToWinError',\ + LsaOpenAccount,'LsaOpenAccount',\ + LsaOpenPolicy,'LsaOpenPolicy',\ + LsaOpenSecret,'LsaOpenSecret',\ + LsaOpenTrustedDomain,'LsaOpenTrustedDomain',\ + LsaQueryDomainInformationPolicy,'LsaQueryDomainInformationPolicy',\ + LsaQueryInfoTrustedDomain,'LsaQueryInfoTrustedDomain',\ + LsaQueryInformationPolicy,'LsaQueryInformationPolicy',\ + LsaQueryLocalInformationPolicy,'LsaQueryLocalInformationPolicy',\ + LsaQuerySecret,'LsaQuerySecret',\ + LsaQuerySecurityObject,'LsaQuerySecurityObject',\ + LsaQueryTrustedDomainInfo,'LsaQueryTrustedDomainInfo',\ + LsaQueryTrustedDomainInfoByName,'LsaQueryTrustedDomainInfoByName',\ + LsaRemoveAccountRights,'LsaRemoveAccountRights',\ + LsaRemovePrivilegesFromAccount,'LsaRemovePrivilegesFromAccount',\ + LsaRetrievePrivateData,'LsaRetrievePrivateData',\ + LsaSetDomainInformationPolicy,'LsaSetDomainInformationPolicy',\ + LsaSetInformationPolicy,'LsaSetInformationPolicy',\ + LsaSetInformationTrustedDomain,'LsaSetInformationTrustedDomain',\ + LsaSetLocalInformationPolicy,'LsaSetLocalInformationPolicy',\ + LsaSetQuotasForAccount,'LsaSetQuotasForAccount',\ + LsaSetSecret,'LsaSetSecret',\ + LsaSetSecurityObject,'LsaSetSecurityObject',\ + LsaSetSystemAccessAccount,'LsaSetSystemAccessAccount',\ + LsaSetTrustedDomainInfoByName,'LsaSetTrustedDomainInfoByName',\ + LsaSetTrustedDomainInformation,'LsaSetTrustedDomainInformation',\ + LsaStorePrivateData,'LsaStorePrivateData',\ + MakeAbsoluteSD,'MakeAbsoluteSD',\ + MakeSelfRelativeSD,'MakeSelfRelativeSD',\ + MapGenericMask,'MapGenericMask',\ + NotifyBootConfigStatus,'NotifyBootConfigStatus',\ + NotifyChangeEventLog,'NotifyChangeEventLog',\ + ObjectCloseAuditAlarmA,'ObjectCloseAuditAlarmA',\ + ObjectCloseAuditAlarmW,'ObjectCloseAuditAlarmW',\ + ObjectDeleteAuditAlarmA,'ObjectDeleteAuditAlarmA',\ + ObjectDeleteAuditAlarmW,'ObjectDeleteAuditAlarmW',\ + ObjectOpenAuditAlarmA,'ObjectOpenAuditAlarmA',\ + ObjectOpenAuditAlarmW,'ObjectOpenAuditAlarmW',\ + ObjectPrivilegeAuditAlarmA,'ObjectPrivilegeAuditAlarmA',\ + ObjectPrivilegeAuditAlarmW,'ObjectPrivilegeAuditAlarmW',\ + OpenBackupEventLogA,'OpenBackupEventLogA',\ + OpenBackupEventLogW,'OpenBackupEventLogW',\ + OpenEventLogA,'OpenEventLogA',\ + OpenEventLogW,'OpenEventLogW',\ + OpenProcessToken,'OpenProcessToken',\ + OpenRawA,'OpenRawA',\ + OpenRawW,'OpenRawW',\ + OpenSCManagerA,'OpenSCManagerA',\ + OpenSCManagerW,'OpenSCManagerW',\ + OpenServiceA,'OpenServiceA',\ + OpenServiceW,'OpenServiceW',\ + OpenThreadToken,'OpenThreadToken',\ + PrivilegeCheck,'PrivilegeCheck',\ + PrivilegedServiceAuditAlarmA,'PrivilegedServiceAuditAlarmA',\ + PrivilegedServiceAuditAlarmW,'PrivilegedServiceAuditAlarmW',\ + QueryRecoveryAgentsA,'QueryRecoveryAgentsA',\ + QueryRecoveryAgentsW,'QueryRecoveryAgentsW',\ + QueryServiceConfig2A,'QueryServiceConfig2A',\ + QueryServiceConfig2W,'QueryServiceConfig2W',\ + QueryServiceConfigA,'QueryServiceConfigA',\ + QueryServiceConfigW,'QueryServiceConfigW',\ + QueryServiceLockStatusA,'QueryServiceLockStatusA',\ + QueryServiceLockStatusW,'QueryServiceLockStatusW',\ + QueryServiceObjectSecurity,'QueryServiceObjectSecurity',\ + QueryServiceStatus,'QueryServiceStatus',\ + QueryWindows31FilesMigration,'QueryWindows31FilesMigration',\ + ReadEventLogA,'ReadEventLogA',\ + ReadEventLogW,'ReadEventLogW',\ + ReadRaw,'ReadRaw',\ + RegCloseKey,'RegCloseKey',\ + RegConnectRegistryA,'RegConnectRegistryA',\ + RegConnectRegistryW,'RegConnectRegistryW',\ + RegCreateKeyA,'RegCreateKeyA',\ + RegCreateKeyW,'RegCreateKeyW',\ + RegCreateKeyExA,'RegCreateKeyExA',\ + RegCreateKeyExW,'RegCreateKeyExW',\ + RegDeleteKeyA,'RegDeleteKeyA',\ + RegDeleteKeyW,'RegDeleteKeyW',\ + RegDeleteValueA,'RegDeleteValueA',\ + RegDeleteValueW,'RegDeleteValueW',\ + RegEnumKeyA,'RegEnumKeyA',\ + RegEnumKeyW,'RegEnumKeyW',\ + RegEnumKeyExA,'RegEnumKeyExA',\ + RegEnumKeyExW,'RegEnumKeyExW',\ + RegEnumValueA,'RegEnumValueA',\ + RegEnumValueW,'RegEnumValueW',\ + RegFlushKey,'RegFlushKey',\ + RegGetKeySecurity,'RegGetKeySecurity',\ + RegLoadKeyA,'RegLoadKeyA',\ + RegLoadKeyW,'RegLoadKeyW',\ + RegNotifyChangeKeyValue,'RegNotifyChangeKeyValue',\ + RegOpenKeyA,'RegOpenKeyA',\ + RegOpenKeyW,'RegOpenKeyW',\ + RegOpenKeyExA,'RegOpenKeyExA',\ + RegOpenKeyExW,'RegOpenKeyExW',\ + RegOverridePredefKey,'RegOverridePredefKey',\ + RegQueryInfoKeyA,'RegQueryInfoKeyA',\ + RegQueryInfoKeyW,'RegQueryInfoKeyW',\ + RegQueryMultipleValuesA,'RegQueryMultipleValuesA',\ + RegQueryMultipleValuesW,'RegQueryMultipleValuesW',\ + RegQueryValueA,'RegQueryValueA',\ + RegQueryValueW,'RegQueryValueW',\ + RegQueryValueExA,'RegQueryValueExA',\ + RegQueryValueExW,'RegQueryValueExW',\ + RegReplaceKeyA,'RegReplaceKeyA',\ + RegReplaceKeyW,'RegReplaceKeyW',\ + RegRestoreKeyA,'RegRestoreKeyA',\ + RegRestoreKeyW,'RegRestoreKeyW',\ + RegSaveKeyA,'RegSaveKeyA',\ + RegSaveKeyW,'RegSaveKeyW',\ + RegSetKeySecurity,'RegSetKeySecurity',\ + RegSetValueA,'RegSetValueA',\ + RegSetValueW,'RegSetValueW',\ + RegSetValueExA,'RegSetValueExA',\ + RegSetValueExW,'RegSetValueExW',\ + RegUnLoadKeyA,'RegUnLoadKeyA',\ + RegUnLoadKeyW,'RegUnLoadKeyW',\ + RegisterEventSourceA,'RegisterEventSourceA',\ + RegisterEventSourceW,'RegisterEventSourceW',\ + RegisterServiceCtrlHandlerA,'RegisterServiceCtrlHandlerA',\ + RegisterServiceCtrlHandlerW,'RegisterServiceCtrlHandlerW',\ + ReportEventA,'ReportEventA',\ + ReportEventW,'ReportEventW',\ + RevertToSelf,'RevertToSelf',\ + SetAclInformation,'SetAclInformation',\ + SetEntriesInAccessListA,'SetEntriesInAccessListA',\ + SetEntriesInAccessListW,'SetEntriesInAccessListW',\ + SetEntriesInAclA,'SetEntriesInAclA',\ + SetEntriesInAclW,'SetEntriesInAclW',\ + SetEntriesInAuditListA,'SetEntriesInAuditListA',\ + SetEntriesInAuditListW,'SetEntriesInAuditListW',\ + SetFileSecurityA,'SetFileSecurityA',\ + SetFileSecurityW,'SetFileSecurityW',\ + SetKernelObjectSecurity,'SetKernelObjectSecurity',\ + SetNamedSecurityInfoA,'SetNamedSecurityInfoA',\ + SetNamedSecurityInfoW,'SetNamedSecurityInfoW',\ + SetNamedSecurityInfoExA,'SetNamedSecurityInfoExA',\ + SetNamedSecurityInfoExW,'SetNamedSecurityInfoExW',\ + SetPrivateObjectSecurity,'SetPrivateObjectSecurity',\ + SetPrivateObjectSecurityEx,'SetPrivateObjectSecurityEx',\ + SetSecurityDescriptorControl,'SetSecurityDescriptorControl',\ + SetSecurityDescriptorDacl,'SetSecurityDescriptorDacl',\ + SetSecurityDescriptorGroup,'SetSecurityDescriptorGroup',\ + SetSecurityDescriptorOwner,'SetSecurityDescriptorOwner',\ + SetSecurityDescriptorSacl,'SetSecurityDescriptorSacl',\ + SetSecurityInfo,'SetSecurityInfo',\ + SetSecurityInfoExA,'SetSecurityInfoExA',\ + SetSecurityInfoExW,'SetSecurityInfoExW',\ + SetServiceBits,'SetServiceBits',\ + SetServiceObjectSecurity,'SetServiceObjectSecurity',\ + SetServiceStatus,'SetServiceStatus',\ + SetThreadToken,'SetThreadToken',\ + SetTokenInformation,'SetTokenInformation',\ + StartServiceA,'StartServiceA',\ + StartServiceW,'StartServiceW',\ + StartServiceCtrlDispatcherA,'StartServiceCtrlDispatcherA',\ + StartServiceCtrlDispatcherW,'StartServiceCtrlDispatcherW',\ + SynchronizeWindows31FilesAndWindowsNTRegistry,'SynchronizeWindows31FilesAndWindowsNTRegistry',\ + TrusteeAccessToObjectA,'TrusteeAccessToObjectA',\ + TrusteeAccessToObjectW,'TrusteeAccessToObjectW',\ + UnlockServiceDatabase,'UnlockServiceDatabase',\ + WriteRaw,'WriteRaw' + +api AbortSystemShutdown,\ + AccessCheckAndAuditAlarm,\ + AccessCheckByTypeAndAuditAlarm,\ + AccessCheckByTypeResultListAndAuditAlarm,\ + BackupEventLog,\ + BuildExplicitAccessWithName,\ + BuildImpersonateExplicitAccessWithName,\ + BuildImpersonateTrustee,\ + BuildSecurityDescriptor,\ + BuildTrusteeWithName,\ + BuildTrusteeWithSid,\ + ChangeServiceConfig2,\ + ChangeServiceConfig,\ + ClearEventLog,\ + ConvertAccessToSecurityDescriptor,\ + ConvertSecurityDescriptorToAccess,\ + ConvertSecurityDescriptorToAccessNamed,\ + CreateProcessAsUser,\ + CreateService,\ + CryptAcquireContext,\ + CryptEnumProviderTypes,\ + CryptEnumProviders,\ + CryptGetDefaultProvider,\ + CryptSetProvider,\ + CryptSetProviderEx,\ + CryptSignHash,\ + CryptVerifySignature,\ + DecryptFile,\ + ElfBackupEventLogFile,\ + ElfClearEventLogFile,\ + ElfOpenBackupEventLog,\ + ElfOpenEventLog,\ + ElfReadEventLog,\ + ElfRegisterEventSource,\ + ElfReportEvent,\ + EncryptFile,\ + EnumDependentServices,\ + EnumServicesStatus,\ + GetAccessPermissionsForObject,\ + GetAuditedPermissionsFromAcl,\ + GetCurrentHwProfile,\ + GetEffectiveRightsFromAcl,\ + GetExplicitEntriesFromAcl,\ + GetFileSecurity,\ + GetMultipleTrustee,\ + GetMultipleTrusteeOperation,\ + GetNamedSecurityInfo,\ + GetNamedSecurityInfoEx,\ + GetSecurityInfoEx,\ + GetServiceDisplayName,\ + GetServiceKeyName,\ + GetSidLengthRequired,\ + GetTrusteeName,\ + GetTrusteeType,\ + GetUserName,\ + I_ScSetServiceBits,\ + InitiateSystemShutdown,\ + LogonUser,\ + LookupAccountName,\ + LookupAccountSid,\ + LookupPrivilegeDisplayName,\ + LookupPrivilegeName,\ + LookupPrivilegeValue,\ + LookupSecurityDescriptorParts,\ + ObjectCloseAuditAlarm,\ + ObjectDeleteAuditAlarm,\ + ObjectOpenAuditAlarm,\ + ObjectPrivilegeAuditAlarm,\ + OpenBackupEventLog,\ + OpenEventLog,\ + OpenRaw,\ + OpenSCManager,\ + OpenService,\ + PrivilegedServiceAuditAlarm,\ + QueryRecoveryAgents,\ + QueryServiceConfig2,\ + QueryServiceConfig,\ + QueryServiceLockStatus,\ + ReadEventLog,\ + RegConnectRegistry,\ + RegCreateKey,\ + RegCreateKeyEx,\ + RegDeleteKey,\ + RegDeleteValue,\ + RegEnumKey,\ + RegEnumKeyEx,\ + RegEnumValue,\ + RegLoadKey,\ + RegOpenKey,\ + RegOpenKeyEx,\ + RegQueryInfoKey,\ + RegQueryMultipleValues,\ + RegQueryValue,\ + RegQueryValueEx,\ + RegReplaceKey,\ + RegRestoreKey,\ + RegSaveKey,\ + RegSetValue,\ + RegSetValueEx,\ + RegUnLoadKey,\ + RegisterEventSource,\ + RegisterServiceCtrlHandler,\ + ReportEvent,\ + SetEntriesInAccessList,\ + SetEntriesInAcl,\ + SetEntriesInAuditList,\ + SetFileSecurity,\ + SetNamedSecurityInfo,\ + SetNamedSecurityInfoEx,\ + SetSecurityInfoEx,\ + StartService,\ + StartServiceCtrlDispatcher,\ + TrusteeAccessToObject diff --git a/fasmw172/INCLUDE/API/COMCTL32.INC b/fasmw172/INCLUDE/API/COMCTL32.INC new file mode 100644 index 0000000..dc28c61 --- /dev/null +++ b/fasmw172/INCLUDE/API/COMCTL32.INC @@ -0,0 +1,81 @@ + +; COMCTL32 API calls + +import comctl32,\ + CreateMappedBitmap,'CreateMappedBitmap',\ + CreatePropertySheetPageA,'CreatePropertySheetPageA',\ + CreatePropertySheetPageW,'CreatePropertySheetPageW',\ + CreateStatusWindowA,'CreateStatusWindowA',\ + CreateStatusWindowW,'CreateStatusWindowW',\ + CreateToolbar,'CreateToolbar',\ + CreateToolbarEx,'CreateToolbarEx',\ + CreateUpDownControl,'CreateUpDownControl',\ + DestroyPropertySheetPage,'DestroyPropertySheetPage',\ + DrawInsert,'DrawInsert',\ + DrawStatusTextA,'DrawStatusTextA',\ + DrawStatusTextW,'DrawStatusTextW',\ + FlatSB_EnableScrollBar,'FlatSB_EnableScrollBar',\ + FlatSB_GetScrollInfo,'FlatSB_GetScrollInfo',\ + FlatSB_GetScrollPos,'FlatSB_GetScrollPos',\ + FlatSB_GetScrollProp,'FlatSB_GetScrollProp',\ + FlatSB_GetScrollRange,'FlatSB_GetScrollRange',\ + FlatSB_SetScrollInfo,'FlatSB_SetScrollInfo',\ + FlatSB_SetScrollPos,'FlatSB_SetScrollPos',\ + FlatSB_SetScrollProp,'FlatSB_SetScrollProp',\ + FlatSB_SetScrollRange,'FlatSB_SetScrollRange',\ + FlatSB_ShowScrollBar,'FlatSB_ShowScrollBar',\ + GetEffectiveClientRect,'GetEffectiveClientRect',\ + ImageList_Add,'ImageList_Add',\ + ImageList_AddIcon,'ImageList_AddIcon',\ + ImageList_AddMasked,'ImageList_AddMasked',\ + ImageList_BeginDrag,'ImageList_BeginDrag',\ + ImageList_Copy,'ImageList_Copy',\ + ImageList_Create,'ImageList_Create',\ + ImageList_Destroy,'ImageList_Destroy',\ + ImageList_DragEnter,'ImageList_DragEnter',\ + ImageList_DragLeave,'ImageList_DragLeave',\ + ImageList_DragMove,'ImageList_DragMove',\ + ImageList_DragShowNolock,'ImageList_DragShowNolock',\ + ImageList_Draw,'ImageList_Draw',\ + ImageList_DrawEx,'ImageList_DrawEx',\ + ImageList_DrawIndirect,'ImageList_DrawIndirect',\ + ImageList_Duplicate,'ImageList_Duplicate',\ + ImageList_EndDrag,'ImageList_EndDrag',\ + ImageList_GetBkColor,'ImageList_GetBkColor',\ + ImageList_GetDragImage,'ImageList_GetDragImage',\ + ImageList_GetIcon,'ImageList_GetIcon',\ + ImageList_GetIconSize,'ImageList_GetIconSize',\ + ImageList_GetImageCount,'ImageList_GetImageCount',\ + ImageList_GetImageInfo,'ImageList_GetImageInfo',\ + ImageList_GetImageRect,'ImageList_GetImageRect',\ + ImageList_LoadImageA,'ImageList_LoadImageA',\ + ImageList_LoadImageW,'ImageList_LoadImageW',\ + ImageList_Merge,'ImageList_Merge',\ + ImageList_Read,'ImageList_Read',\ + ImageList_Remove,'ImageList_Remove',\ + ImageList_Replace,'ImageList_Replace',\ + ImageList_ReplaceIcon,'ImageList_ReplaceIcon',\ + ImageList_SetBkColor,'ImageList_SetBkColor',\ + ImageList_SetDragCursorImage,'ImageList_SetDragCursorImage',\ + ImageList_SetFilter,'ImageList_SetFilter',\ + ImageList_SetIconSize,'ImageList_SetIconSize',\ + ImageList_SetImageCount,'ImageList_SetImageCount',\ + ImageList_SetOverlayImage,'ImageList_SetOverlayImage',\ + ImageList_Write,'ImageList_Write',\ + InitCommonControls,'InitCommonControls',\ + InitCommonControlsEx,'InitCommonControlsEx',\ + InitializeFlatSB,'InitializeFlatSB',\ + LBItemFromPt,'LBItemFromPt',\ + MakeDragList,'MakeDragList',\ + MenuHelp,'MenuHelp',\ + PropertySheetA,'PropertySheetA',\ + PropertySheetW,'PropertySheetW',\ + ShowHideMenuCtl,'ShowHideMenuCtl',\ + UninitializeFlatSB,'UninitializeFlatSB',\ + _TrackMouseEvent,'_TrackMouseEvent' + +api CreatePropertySheetPage,\ + CreateStatusWindow,\ + DrawStatusText,\ + ImageList_LoadImage,\ + PropertySheet diff --git a/fasmw172/INCLUDE/API/COMDLG32.INC b/fasmw172/INCLUDE/API/COMDLG32.INC new file mode 100644 index 0000000..9347fbc --- /dev/null +++ b/fasmw172/INCLUDE/API/COMDLG32.INC @@ -0,0 +1,38 @@ + +; COMDLG32 API calls + +import comdlg32,\ + ChooseColorA,'ChooseColorA',\ + ChooseColorW,'ChooseColorW',\ + ChooseFontA,'ChooseFontA',\ + ChooseFontW,'ChooseFontW',\ + CommDlgExtendedError,'CommDlgExtendedError',\ + FindTextA,'FindTextA',\ + FindTextW,'FindTextW',\ + FormatCharDlgProc,'FormatCharDlgProc',\ + GetFileTitleA,'GetFileTitleA',\ + GetFileTitleW,'GetFileTitleW',\ + GetOpenFileNameA,'GetOpenFileNameA',\ + GetOpenFileNameW,'GetOpenFileNameW',\ + GetSaveFileNameA,'GetSaveFileNameA',\ + GetSaveFileNameW,'GetSaveFileNameW',\ + LoadAlterBitmap,'LoadAlterBitmap',\ + PageSetupDlgA,'PageSetupDlgA',\ + PageSetupDlgW,'PageSetupDlgW',\ + PrintDlgA,'PrintDlgA',\ + PrintDlgW,'PrintDlgW',\ + ReplaceTextA,'ReplaceTextA',\ + ReplaceTextW,'ReplaceTextW',\ + WantArrows,'WantArrows',\ + dwLBSubclass,'dwLBSubclass',\ + dwOKSubclass,'dwOKSubclass' + +api ChooseColor,\ + ChooseFont,\ + FindText,\ + GetFileTitle,\ + GetOpenFileName,\ + GetSaveFileName,\ + PageSetupDlg,\ + PrintDlg,\ + ReplaceText diff --git a/fasmw172/INCLUDE/API/GDI32.INC b/fasmw172/INCLUDE/API/GDI32.INC new file mode 100644 index 0000000..4cec631 --- /dev/null +++ b/fasmw172/INCLUDE/API/GDI32.INC @@ -0,0 +1,419 @@ + +; GDI32 API calls + +import gdi32,\ + AbortDoc,'AbortDoc',\ + AbortPath,'AbortPath',\ + AddFontMemResourceEx,'AddFontMemResourceEx',\ + AddFontResourceA,'AddFontResourceA',\ + AddFontResourceW,'AddFontResourceW',\ + AddFontResourceExA,'AddFontResourceExA',\ + AddFontResourceExW,'AddFontResourceExW',\ + AngleArc,'AngleArc',\ + AnimatePalette,'AnimatePalette',\ + Arc,'Arc',\ + ArcTo,'ArcTo',\ + BeginPath,'BeginPath',\ + BitBlt,'BitBlt',\ + CancelDC,'CancelDC',\ + CheckColorsInGamut,'CheckColorsInGamut',\ + ChoosePixelFormat,'ChoosePixelFormat',\ + Chord,'Chord',\ + CloseEnhMetaFile,'CloseEnhMetaFile',\ + CloseFigure,'CloseFigure',\ + CloseMetaFile,'CloseMetaFile',\ + ColorCorrectPalette,'ColorCorrectPalette',\ + ColorMatchToTarget,'ColorMatchToTarget',\ + CombineRgn,'CombineRgn',\ + CombineTransform,'CombineTransform',\ + CopyEnhMetaFileA,'CopyEnhMetaFileA',\ + CopyEnhMetaFileW,'CopyEnhMetaFileW',\ + CopyMetaFileA,'CopyMetaFileA',\ + CopyMetaFileW,'CopyMetaFileW',\ + CreateBitmap,'CreateBitmap',\ + CreateBitmapIndirect,'CreateBitmapIndirect',\ + CreateBrushIndirect,'CreateBrushIndirect',\ + CreateColorSpaceA,'CreateColorSpaceA',\ + CreateColorSpaceW,'CreateColorSpaceW',\ + CreateCompatibleBitmap,'CreateCompatibleBitmap',\ + CreateCompatibleDC,'CreateCompatibleDC',\ + CreateDCA,'CreateDCA',\ + CreateDCW,'CreateDCW',\ + CreateDIBPatternBrush,'CreateDIBPatternBrush',\ + CreateDIBPatternBrushPt,'CreateDIBPatternBrushPt',\ + CreateDIBSection,'CreateDIBSection',\ + CreateDIBitmap,'CreateDIBitmap',\ + CreateDiscardableBitmap,'CreateDiscardableBitmap',\ + CreateEllipticRgn,'CreateEllipticRgn',\ + CreateEllipticRgnIndirect,'CreateEllipticRgnIndirect',\ + CreateEnhMetaFileA,'CreateEnhMetaFileA',\ + CreateEnhMetaFileW,'CreateEnhMetaFileW',\ + CreateFontA,'CreateFontA',\ + CreateFontW,'CreateFontW',\ + CreateFontIndirectA,'CreateFontIndirectA',\ + CreateFontIndirectW,'CreateFontIndirectW',\ + CreateFontIndirectExA,'CreateFontIndirectExA',\ + CreateFontIndirectExW,'CreateFontIndirectExW',\ + CreateHalftonePalette,'CreateHalftonePalette',\ + CreateHatchBrush,'CreateHatchBrush',\ + CreateICA,'CreateICA',\ + CreateICW,'CreateICW',\ + CreateMetaFileA,'CreateMetaFileA',\ + CreateMetaFileW,'CreateMetaFileW',\ + CreatePalette,'CreatePalette',\ + CreatePatternBrush,'CreatePatternBrush',\ + CreatePen,'CreatePen',\ + CreatePenIndirect,'CreatePenIndirect',\ + CreatePolyPolygonRgn,'CreatePolyPolygonRgn',\ + CreatePolygonRgn,'CreatePolygonRgn',\ + CreateRectRgn,'CreateRectRgn',\ + CreateRectRgnIndirect,'CreateRectRgnIndirect',\ + CreateRoundRectRgn,'CreateRoundRectRgn',\ + CreateScalableFontResourceA,'CreateScalableFontResourceA',\ + CreateScalableFontResourceW,'CreateScalableFontResourceW',\ + CreateSolidBrush,'CreateSolidBrush',\ + DPtoLP,'DPtoLP',\ + DeleteColorSpace,'DeleteColorSpace',\ + DeleteDC,'DeleteDC',\ + DeleteEnhMetaFile,'DeleteEnhMetaFile',\ + DeleteMetaFile,'DeleteMetaFile',\ + DeleteObject,'DeleteObject',\ + DescribePixelFormat,'DescribePixelFormat',\ + DeviceCapabilitiesExA,'DeviceCapabilitiesExA',\ + DeviceCapabilitiesExW,'DeviceCapabilitiesExW',\ + DrawEscape,'DrawEscape',\ + Ellipse,'Ellipse',\ + EnableEUDC,'EnableEUDC',\ + EndDoc,'EndDoc',\ + EndPage,'EndPage',\ + EndPath,'EndPath',\ + EnumEnhMetaFile,'EnumEnhMetaFile',\ + EnumFontFamiliesA,'EnumFontFamiliesA',\ + EnumFontFamiliesW,'EnumFontFamiliesW',\ + EnumFontFamiliesExA,'EnumFontFamiliesExA',\ + EnumFontFamiliesExW,'EnumFontFamiliesExW',\ + EnumFontsA,'EnumFontsA',\ + EnumFontsW,'EnumFontsW',\ + EnumICMProfilesA,'EnumICMProfilesA',\ + EnumICMProfilesW,'EnumICMProfilesW',\ + EnumMetaFile,'EnumMetaFile',\ + EnumObjects,'EnumObjects',\ + EqualRgn,'EqualRgn',\ + Escape,'Escape',\ + ExcludeClipRect,'ExcludeClipRect',\ + ExtCreatePen,'ExtCreatePen',\ + ExtCreateRegion,'ExtCreateRegion',\ + ExtEscape,'ExtEscape',\ + ExtFloodFill,'ExtFloodFill',\ + ExtSelectClipRgn,'ExtSelectClipRgn',\ + ExtTextOutA,'ExtTextOutA',\ + ExtTextOutW,'ExtTextOutW',\ + FillPath,'FillPath',\ + FillRgn,'FillRgn',\ + FixBrushOrgEx,'FixBrushOrgEx',\ + FlattenPath,'FlattenPath',\ + FloodFill,'FloodFill',\ + FrameRgn,'FrameRgn',\ + GdiComment,'GdiComment',\ + GdiDeleteSpoolFileHandle,'GdiDeleteSpoolFileHandle',\ + GdiEndDocEMF,'GdiEndDocEMF',\ + GdiEndPageEMF,'GdiEndPageEMF',\ + GdiFlush,'GdiFlush',\ + GdiGetBatchLimit,'GdiGetBatchLimit',\ + GdiGetDC,'GdiGetDC',\ + GdiGetDevmodeForPage,'GdiGetDevmodeForPage',\ + GdiGetPageCount,'GdiGetPageCount',\ + GdiGetPageHandle,'GdiGetPageHandle',\ + GdiGetSpoolFileHandle,'GdiGetSpoolFileHandle',\ + GdiPlayDCScript,'GdiPlayDCScript',\ + GdiPlayEMF,'GdiPlayEMF',\ + GdiPlayJournal,'GdiPlayJournal',\ + GdiPlayPageEMF,'GdiPlayPageEMF',\ + GdiPlayPrivatePageEMF,'GdiPlayPrivatePageEMF',\ + GdiPlayScript,'GdiPlayScript',\ + GdiResetDCEMF,'GdiResetDCEMF',\ + GdiSetBatchLimit,'GdiSetBatchLimit',\ + GdiStartDocEMF,'GdiStartDocEMF',\ + GdiStartPageEMF,'GdiStartPageEMF',\ + GetArcDirection,'GetArcDirection',\ + GetAspectRatioFilterEx,'GetAspectRatioFilterEx',\ + GetBitmapBits,'GetBitmapBits',\ + GetBitmapDimensionEx,'GetBitmapDimensionEx',\ + GetBkColor,'GetBkColor',\ + GetBkMode,'GetBkMode',\ + GetBoundsRect,'GetBoundsRect',\ + GetBrushOrgEx,'GetBrushOrgEx',\ + GetCharABCWidthsA,'GetCharABCWidthsA',\ + GetCharABCWidthsW,'GetCharABCWidthsW',\ + GetCharABCWidthsFloatA,'GetCharABCWidthsFloatA',\ + GetCharABCWidthsFloatW,'GetCharABCWidthsFloatW',\ + GetCharABCWidthsI,'GetCharABCWidthsI',\ + GetCharWidth32A,'GetCharWidth32A',\ + GetCharWidth32W,'GetCharWidth32W',\ + GetCharWidthA,'GetCharWidthA',\ + GetCharWidthW,'GetCharWidthW',\ + GetCharWidthFloatA,'GetCharWidthFloatA',\ + GetCharWidthFloatW,'GetCharWidthFloatW',\ + GetCharWidthI,'GetCharWidthI',\ + GetCharacterPlacementA,'GetCharacterPlacementA',\ + GetCharacterPlacementW,'GetCharacterPlacementW',\ + GetClipBox,'GetClipBox',\ + GetClipRgn,'GetClipRgn',\ + GetColorAdjustment,'GetColorAdjustment',\ + GetColorSpace,'GetColorSpace',\ + GetCurrentObject,'GetCurrentObject',\ + GetCurrentPositionEx,'GetCurrentPositionEx',\ + GetDCBrushColor,'GetDCBrushColor',\ + GetDCOrgEx,'GetDCOrgEx',\ + GetDCPenColor,'GetDCPenColor',\ + GetDIBColorTable,'GetDIBColorTable',\ + GetDIBits,'GetDIBits',\ + GetDeviceCaps,'GetDeviceCaps',\ + GetDeviceGammaRamp,'GetDeviceGammaRamp',\ + GetEnhMetaFileA,'GetEnhMetaFileA',\ + GetEnhMetaFileW,'GetEnhMetaFileW',\ + GetEnhMetaFileBits,'GetEnhMetaFileBits',\ + GetEnhMetaFileDescriptionA,'GetEnhMetaFileDescriptionA',\ + GetEnhMetaFileDescriptionW,'GetEnhMetaFileDescriptionW',\ + GetEnhMetaFileHeader,'GetEnhMetaFileHeader',\ + GetEnhMetaFilePaletteEntries,'GetEnhMetaFilePaletteEntries',\ + GetEnhMetaFilePixelFormat,'GetEnhMetaFilePixelFormat',\ + GetFontAssocStatus,'GetFontAssocStatus',\ + GetFontData,'GetFontData',\ + GetFontLanguageInfo,'GetFontLanguageInfo',\ + GetFontUnicodeRanges,'GetFontUnicodeRanges',\ + GetGlyphIndicesA,'GetGlyphIndicesA',\ + GetGlyphIndicesW,'GetGlyphIndicesW',\ + GetGlyphOutlineA,'GetGlyphOutlineA',\ + GetGlyphOutlineW,'GetGlyphOutlineW',\ + GetGraphicsMode,'GetGraphicsMode',\ + GetICMProfileA,'GetICMProfileA',\ + GetICMProfileW,'GetICMProfileW',\ + GetKerningPairsA,'GetKerningPairsA',\ + GetKerningPairsW,'GetKerningPairsW',\ + GetLogColorSpaceA,'GetLogColorSpaceA',\ + GetLogColorSpaceW,'GetLogColorSpaceW',\ + GetMapMode,'GetMapMode',\ + GetMetaFileA,'GetMetaFileA',\ + GetMetaFileW,'GetMetaFileW',\ + GetMetaFileBitsEx,'GetMetaFileBitsEx',\ + GetMetaRgn,'GetMetaRgn',\ + GetMiterLimit,'GetMiterLimit',\ + GetNearestColor,'GetNearestColor',\ + GetNearestPaletteIndex,'GetNearestPaletteIndex',\ + GetObjectA,'GetObjectA',\ + GetObjectW,'GetObjectW',\ + GetObjectType,'GetObjectType',\ + GetOutlineTextMetricsA,'GetOutlineTextMetricsA',\ + GetOutlineTextMetricsW,'GetOutlineTextMetricsW',\ + GetPaletteEntries,'GetPaletteEntries',\ + GetPath,'GetPath',\ + GetPixel,'GetPixel',\ + GetPixelFormat,'GetPixelFormat',\ + GetPolyFillMode,'GetPolyFillMode',\ + GetROP2,'GetROP2',\ + GetRandomRgn,'GetRandomRgn',\ + GetRasterizerCaps,'GetRasterizerCaps',\ + GetRegionData,'GetRegionData',\ + GetRelAbs,'GetRelAbs',\ + GetRgnBox,'GetRgnBox',\ + GetStockObject,'GetStockObject',\ + GetStretchBltMode,'GetStretchBltMode',\ + GetSystemPaletteEntries,'GetSystemPaletteEntries',\ + GetSystemPaletteUse,'GetSystemPaletteUse',\ + GetTextAlign,'GetTextAlign',\ + GetTextCharacterExtra,'GetTextCharacterExtra',\ + GetTextCharset,'GetTextCharset',\ + GetTextCharsetInfo,'GetTextCharsetInfo',\ + GetTextColor,'GetTextColor',\ + GetTextExtentExPointA,'GetTextExtentExPointA',\ + GetTextExtentExPointW,'GetTextExtentExPointW',\ + GetTextExtentExPointI,'GetTextExtentExPointI',\ + GetTextExtentPoint32A,'GetTextExtentPoint32A',\ + GetTextExtentPoint32W,'GetTextExtentPoint32W',\ + GetTextExtentPointA,'GetTextExtentPointA',\ + GetTextExtentPointW,'GetTextExtentPointW',\ + GetTextExtentPointI,'GetTextExtentPointI',\ + GetTextFaceA,'GetTextFaceA',\ + GetTextFaceW,'GetTextFaceW',\ + GetTextMetricsA,'GetTextMetricsA',\ + GetTextMetricsW,'GetTextMetricsW',\ + GetViewportExtEx,'GetViewportExtEx',\ + GetViewportOrgEx,'GetViewportOrgEx',\ + GetWinMetaFileBits,'GetWinMetaFileBits',\ + GetWindowExtEx,'GetWindowExtEx',\ + GetWindowOrgEx,'GetWindowOrgEx',\ + GetWorldTransform,'GetWorldTransform',\ + IntersectClipRect,'IntersectClipRect',\ + InvertRgn,'InvertRgn',\ + LPtoDP,'LPtoDP',\ + LineDDA,'LineDDA',\ + LineDDW,'LineDDW',\ + LineTo,'LineTo',\ + MaskBlt,'MaskBlt',\ + ModifyWorldTransform,'ModifyWorldTransform',\ + MoveToEx,'MoveToEx',\ + OffsetClipRgn,'OffsetClipRgn',\ + OffsetRgn,'OffsetRgn',\ + OffsetViewportOrgEx,'OffsetViewportOrgEx',\ + OffsetWindowOrgEx,'OffsetWindowOrgEx',\ + PaintRgn,'PaintRgn',\ + PatBlt,'PatBlt',\ + PathToRegion,'PathToRegion',\ + Pie,'Pie',\ + PlayEnhMetaFile,'PlayEnhMetaFile',\ + PlayEnhMetaFileRecord,'PlayEnhMetaFileRecord',\ + PlayMetaFile,'PlayMetaFile',\ + PlayMetaFileRecord,'PlayMetaFileRecord',\ + PlgBlt,'PlgBlt',\ + PolyBezier,'PolyBezier',\ + PolyBezierTo,'PolyBezierTo',\ + PolyDraw,'PolyDraw',\ + PolyPatBlt,'PolyPatBlt',\ + PolyPolygon,'PolyPolygon',\ + PolyPolyline,'PolyPolyline',\ + PolyTextOutA,'PolyTextOutA',\ + PolyTextOutW,'PolyTextOutW',\ + Polygon,'Polygon',\ + Polyline,'Polyline',\ + PolylineTo,'PolylineTo',\ + PtInRegion,'PtInRegion',\ + PtVisible,'PtVisible',\ + RealizePalette,'RealizePalette',\ + RectInRegion,'RectInRegion',\ + RectVisible,'RectVisible',\ + Rectangle,'Rectangle',\ + RemoveFontMemResourceEx,'RemoveFontMemResourceEx',\ + RemoveFontResourceA,'RemoveFontResourceA',\ + RemoveFontResourceW,'RemoveFontResourceW',\ + RemoveFontResourceExA,'RemoveFontResourceExA',\ + RemoveFontResourceExW,'RemoveFontResourceExW',\ + ResetDCA,'ResetDCA',\ + ResetDCW,'ResetDCW',\ + ResizePalette,'ResizePalette',\ + RestoreDC,'RestoreDC',\ + RoundRect,'RoundRect',\ + SaveDC,'SaveDC',\ + ScaleViewportExtEx,'ScaleViewportExtEx',\ + ScaleWindowExtEx,'ScaleWindowExtEx',\ + SelectBrushLocal,'SelectBrushLocal',\ + SelectClipPath,'SelectClipPath',\ + SelectClipRgn,'SelectClipRgn',\ + SelectFontLocal,'SelectFontLocal',\ + SelectObject,'SelectObject',\ + SelectPalette,'SelectPalette',\ + SetAbortProc,'SetAbortProc',\ + SetArcDirection,'SetArcDirection',\ + SetBitmapBits,'SetBitmapBits',\ + SetBitmapDimensionEx,'SetBitmapDimensionEx',\ + SetBkColor,'SetBkColor',\ + SetBkMode,'SetBkMode',\ + SetBoundsRect,'SetBoundsRect',\ + SetBrushOrgEx,'SetBrushOrgEx',\ + SetColorAdjustment,'SetColorAdjustment',\ + SetColorSpace,'SetColorSpace',\ + SetDCBrushColor,'SetDCBrushColor',\ + SetDCPenColor,'SetDCPenColor',\ + SetDIBColorTable,'SetDIBColorTable',\ + SetDIBits,'SetDIBits',\ + SetDIBitsToDevice,'SetDIBitsToDevice',\ + SetDeviceGammaRamp,'SetDeviceGammaRamp',\ + SetEnhMetaFileBits,'SetEnhMetaFileBits',\ + SetFontEnumeration,'SetFontEnumeration',\ + SetGraphicsMode,'SetGraphicsMode',\ + SetICMMode,'SetICMMode',\ + SetICMProfileA,'SetICMProfileA',\ + SetICMProfileW,'SetICMProfileW',\ + SetMagicColors,'SetMagicColors',\ + SetMapMode,'SetMapMode',\ + SetMapperFlags,'SetMapperFlags',\ + SetMetaFileBitsEx,'SetMetaFileBitsEx',\ + SetMetaRgn,'SetMetaRgn',\ + SetMiterLimit,'SetMiterLimit',\ + SetPaletteEntries,'SetPaletteEntries',\ + SetPixel,'SetPixel',\ + SetPixelFormat,'SetPixelFormat',\ + SetPixelV,'SetPixelV',\ + SetPolyFillMode,'SetPolyFillMode',\ + SetROP2,'SetROP2',\ + SetRectRgn,'SetRectRgn',\ + SetRelAbs,'SetRelAbs',\ + SetStretchBltMode,'SetStretchBltMode',\ + SetSystemPaletteUse,'SetSystemPaletteUse',\ + SetTextAlign,'SetTextAlign',\ + SetTextCharacterExtra,'SetTextCharacterExtra',\ + SetTextColor,'SetTextColor',\ + SetTextJustification,'SetTextJustification',\ + SetViewportExtEx,'SetViewportExtEx',\ + SetViewportOrgEx,'SetViewportOrgEx',\ + SetWinMetaFileBits,'SetWinMetaFileBits',\ + SetWindowExtEx,'SetWindowExtEx',\ + SetWindowOrgEx,'SetWindowOrgEx',\ + SetWorldTransform,'SetWorldTransform',\ + StartDocA,'StartDocA',\ + StartDocW,'StartDocW',\ + StartPage,'StartPage',\ + StretchBlt,'StretchBlt',\ + StretchDIBits,'StretchDIBits',\ + StrokeAndFillPath,'StrokeAndFillPath',\ + StrokePath,'StrokePath',\ + SwapBuffers,'SwapBuffers',\ + TextOutA,'TextOutA',\ + TextOutW,'TextOutW',\ + TranslateCharsetInfo,'TranslateCharsetInfo',\ + UnrealizeObject,'UnrealizeObject',\ + UpdateColors,'UpdateColors',\ + UpdateICMRegKeyA,'UpdateICMRegKeyA',\ + UpdateICMRegKeyW,'UpdateICMRegKeyW',\ + WidenPath,'WidenPath',\ + gdiPlaySpoolStream,'gdiPlaySpoolStream' + +api AddFontResource,\ + AddFontResourceEx,\ + CopyEnhMetaFile,\ + CopyMetaFile,\ + CreateColorSpace,\ + CreateDC,\ + CreateEnhMetaFile,\ + CreateFont,\ + CreateFontIndirect,\ + CreateFontIndirectEx,\ + CreateIC,\ + CreateMetaFile,\ + CreateScalableFontResource,\ + DeviceCapabilitiesEx,\ + EnumFontFamilies,\ + EnumFontFamiliesEx,\ + EnumFonts,\ + EnumICMProfiles,\ + ExtTextOut,\ + GetCharABCWidths,\ + GetCharABCWidthsFloat,\ + GetCharWidth32,\ + GetCharWidth,\ + GetCharWidthFloat,\ + GetCharacterPlacement,\ + GetEnhMetaFile,\ + GetEnhMetaFileDescription,\ + GetGlyphIndices,\ + GetGlyphOutline,\ + GetICMProfile,\ + GetKerningPairs,\ + GetLogColorSpace,\ + GetMetaFile,\ + GetObject,\ + GetOutlineTextMetrics,\ + GetTextExtentExPoint,\ + GetTextExtentPoint32,\ + GetTextExtentPoint,\ + GetTextFace,\ + GetTextMetrics,\ + LineDD,\ + PolyTextOut,\ + RemoveFontResource,\ + RemoveFontResourceEx,\ + ResetDC,\ + SetICMProfile,\ + StartDoc,\ + TextOut,\ + UpdateICMRegKey diff --git a/fasmw172/INCLUDE/API/KERNEL32.INC b/fasmw172/INCLUDE/API/KERNEL32.INC new file mode 100644 index 0000000..6bdd057 --- /dev/null +++ b/fasmw172/INCLUDE/API/KERNEL32.INC @@ -0,0 +1,879 @@ + +; KERNEL32 API calls + +import kernel32,\ + AddAtomA,'AddAtomA',\ + AddAtomW,'AddAtomW',\ + AddConsoleAliasA,'AddConsoleAliasA',\ + AddConsoleAliasW,'AddConsoleAliasW',\ + AllocConsole,'AllocConsole',\ + AreFileApisANSI,'AreFileApisANSI',\ + AssignProcessToJobObject,'AssignProcessToJobObject',\ + BackupRead,'BackupRead',\ + BackupSeek,'BackupSeek',\ + BackupWrite,'BackupWrite',\ + BaseAttachCompleteThunk,'BaseAttachCompleteThunk',\ + Beep,'Beep',\ + BeginUpdateResourceA,'BeginUpdateResourceA',\ + BeginUpdateResourceW,'BeginUpdateResourceW',\ + BuildCommDCBA,'BuildCommDCBA',\ + BuildCommDCBW,'BuildCommDCBW',\ + BuildCommDCBAndTimeoutsA,'BuildCommDCBAndTimeoutsA',\ + BuildCommDCBAndTimeoutsW,'BuildCommDCBAndTimeoutsW',\ + CallNamedPipeA,'CallNamedPipeA',\ + CallNamedPipeW,'CallNamedPipeW',\ + CancelIo,'CancelIo',\ + CancelWaitableTimer,'CancelWaitableTimer',\ + ClearCommBreak,'ClearCommBreak',\ + ClearCommError,'ClearCommError',\ + CloseConsoleHandle,'CloseConsoleHandle',\ + CloseHandle,'CloseHandle',\ + CloseProfileUserMapping,'CloseProfileUserMapping',\ + CmdBatNotification,'CmdBatNotification',\ + CommConfigDialogA,'CommConfigDialogA',\ + CommConfigDialogW,'CommConfigDialogW',\ + CompareFileTime,'CompareFileTime',\ + CompareStringA,'CompareStringA',\ + CompareStringW,'CompareStringW',\ + ConnectNamedPipe,'ConnectNamedPipe',\ + ConsoleMenuControl,'ConsoleMenuControl',\ + ContinueDebugEvent,'ContinueDebugEvent',\ + ConvertDefaultLocale,'ConvertDefaultLocale',\ + ConvertThreadToFiber,'ConvertThreadToFiber',\ + CopyFileA,'CopyFileA',\ + CopyFileW,'CopyFileW',\ + CopyFileExA,'CopyFileExA',\ + CopyFileExW,'CopyFileExW',\ + CreateConsoleScreenBuffer,'CreateConsoleScreenBuffer',\ + CreateDirectoryA,'CreateDirectoryA',\ + CreateDirectoryW,'CreateDirectoryW',\ + CreateDirectoryExA,'CreateDirectoryExA',\ + CreateDirectoryExW,'CreateDirectoryExW',\ + CreateEventA,'CreateEventA',\ + CreateEventW,'CreateEventW',\ + CreateFiber,'CreateFiber',\ + CreateFileA,'CreateFileA',\ + CreateFileW,'CreateFileW',\ + CreateFileMappingA,'CreateFileMappingA',\ + CreateFileMappingW,'CreateFileMappingW',\ + CreateHardLinkA,'CreateHardLinkA',\ + CreateHardLinkW,'CreateHardLinkW',\ + CreateIoCompletionPort,'CreateIoCompletionPort',\ + CreateJobObjectA,'CreateJobObjectA',\ + CreateJobObjectW,'CreateJobObjectW',\ + CreateMailslotA,'CreateMailslotA',\ + CreateMailslotW,'CreateMailslotW',\ + CreateMutexA,'CreateMutexA',\ + CreateMutexW,'CreateMutexW',\ + CreateNamedPipeA,'CreateNamedPipeA',\ + CreateNamedPipeW,'CreateNamedPipeW',\ + CreatePipe,'CreatePipe',\ + CreateProcessA,'CreateProcessA',\ + CreateProcessW,'CreateProcessW',\ + CreateRemoteThread,'CreateRemoteThread',\ + CreateSemaphoreA,'CreateSemaphoreA',\ + CreateSemaphoreW,'CreateSemaphoreW',\ + CreateTapePartition,'CreateTapePartition',\ + CreateThread,'CreateThread',\ + CreateToolhelp32Snapshot,'CreateToolhelp32Snapshot',\ + CreateVirtualBuffer,'CreateVirtualBuffer',\ + CreateWaitableTimerA,'CreateWaitableTimerA',\ + CreateWaitableTimerW,'CreateWaitableTimerW',\ + DebugActiveProcess,'DebugActiveProcess',\ + DebugBreak,'DebugBreak',\ + DefineDosDeviceA,'DefineDosDeviceA',\ + DefineDosDeviceW,'DefineDosDeviceW',\ + DeleteAtom,'DeleteAtom',\ + DeleteCriticalSection,'DeleteCriticalSection',\ + DeleteFiber,'DeleteFiber',\ + DeleteFileA,'DeleteFileA',\ + DeleteFileW,'DeleteFileW',\ + DeviceIoControl,'DeviceIoControl',\ + DisableThreadLibraryCalls,'DisableThreadLibraryCalls',\ + DisconnectNamedPipe,'DisconnectNamedPipe',\ + DosDateTimeToFileTime,'DosDateTimeToFileTime',\ + DuplicateConsoleHandle,'DuplicateConsoleHandle',\ + DuplicateHandle,'DuplicateHandle',\ + EndUpdateResourceA,'EndUpdateResourceA',\ + EndUpdateResourceW,'EndUpdateResourceW',\ + EnterCriticalSection,'EnterCriticalSection',\ + EnumCalendarInfoA,'EnumCalendarInfoA',\ + EnumCalendarInfoW,'EnumCalendarInfoW',\ + EnumCalendarInfoExA,'EnumCalendarInfoExA',\ + EnumCalendarInfoExW,'EnumCalendarInfoExW',\ + EnumDateFormatsA,'EnumDateFormatsA',\ + EnumDateFormatsW,'EnumDateFormatsW',\ + EnumDateFormatsExA,'EnumDateFormatsExA',\ + EnumDateFormatsExW,'EnumDateFormatsExW',\ + EnumResourceLanguagesA,'EnumResourceLanguagesA',\ + EnumResourceLanguagesW,'EnumResourceLanguagesW',\ + EnumResourceNamesA,'EnumResourceNamesA',\ + EnumResourceNamesW,'EnumResourceNamesW',\ + EnumResourceTypesA,'EnumResourceTypesA',\ + EnumResourceTypesW,'EnumResourceTypesW',\ + EnumSystemCodePagesA,'EnumSystemCodePagesA',\ + EnumSystemCodePagesW,'EnumSystemCodePagesW',\ + EnumSystemLocalesA,'EnumSystemLocalesA',\ + EnumSystemLocalesW,'EnumSystemLocalesW',\ + EnumTimeFormatsA,'EnumTimeFormatsA',\ + EnumTimeFormatsW,'EnumTimeFormatsW',\ + EraseTape,'EraseTape',\ + EscapeCommFunction,'EscapeCommFunction',\ + ExitProcess,'ExitProcess',\ + ExitThread,'ExitThread',\ + ExitVDM,'ExitVDM',\ + ExpandEnvironmentStringsA,'ExpandEnvironmentStringsA',\ + ExpandEnvironmentStringsW,'ExpandEnvironmentStringsW',\ + ExpungeConsoleCommandHistoryA,'ExpungeConsoleCommandHistoryA',\ + ExpungeConsoleCommandHistoryW,'ExpungeConsoleCommandHistoryW',\ + ExtendVirtualBuffer,'ExtendVirtualBuffer',\ + FatalAppExitA,'FatalAppExitA',\ + FatalAppExitW,'FatalAppExitW',\ + FatalExit,'FatalExit',\ + FileTimeToDosDateTime,'FileTimeToDosDateTime',\ + FileTimeToLocalFileTime,'FileTimeToLocalFileTime',\ + FileTimeToSystemTime,'FileTimeToSystemTime',\ + FillConsoleOutputAttribute,'FillConsoleOutputAttribute',\ + FillConsoleOutputCharacterA,'FillConsoleOutputCharacterA',\ + FillConsoleOutputCharacterW,'FillConsoleOutputCharacterW',\ + FindAtomA,'FindAtomA',\ + FindAtomW,'FindAtomW',\ + FindClose,'FindClose',\ + FindCloseChangeNotification,'FindCloseChangeNotification',\ + FindFirstChangeNotificationA,'FindFirstChangeNotificationA',\ + FindFirstChangeNotificationW,'FindFirstChangeNotificationW',\ + FindFirstFileA,'FindFirstFileA',\ + FindFirstFileW,'FindFirstFileW',\ + FindFirstFileExA,'FindFirstFileExA',\ + FindFirstFileExW,'FindFirstFileExW',\ + FindNextChangeNotification,'FindNextChangeNotification',\ + FindNextFileA,'FindNextFileA',\ + FindNextFileW,'FindNextFileW',\ + FindResourceA,'FindResourceA',\ + FindResourceW,'FindResourceW',\ + FindResourceExA,'FindResourceExA',\ + FindResourceExW,'FindResourceExW',\ + FlushConsoleInputBuffer,'FlushConsoleInputBuffer',\ + FlushFileBuffers,'FlushFileBuffers',\ + FlushInstructionCache,'FlushInstructionCache',\ + FlushViewOfFile,'FlushViewOfFile',\ + FoldStringA,'FoldStringA',\ + FoldStringW,'FoldStringW',\ + FormatMessageA,'FormatMessageA',\ + FormatMessageW,'FormatMessageW',\ + FreeConsole,'FreeConsole',\ + FreeEnvironmentStringsA,'FreeEnvironmentStringsA',\ + FreeEnvironmentStringsW,'FreeEnvironmentStringsW',\ + FreeLibrary,'FreeLibrary',\ + FreeLibraryAndExitThread,'FreeLibraryAndExitThread',\ + FreeResource,'FreeResource',\ + FreeVirtualBuffer,'FreeVirtualBuffer',\ + GenerateConsoleCtrlEvent,'GenerateConsoleCtrlEvent',\ + GetACP,'GetACP',\ + GetAtomNameA,'GetAtomNameA',\ + GetAtomNameW,'GetAtomNameW',\ + GetBinaryTypeA,'GetBinaryTypeA',\ + GetBinaryTypeW,'GetBinaryTypeW',\ + GetCPInfo,'GetCPInfo',\ + GetCPInfoExA,'GetCPInfoExA',\ + GetCPInfoExW,'GetCPInfoExW',\ + GetCommConfig,'GetCommConfig',\ + GetCommMask,'GetCommMask',\ + GetCommModemStatus,'GetCommModemStatus',\ + GetCommProperties,'GetCommProperties',\ + GetCommState,'GetCommState',\ + GetCommTimeouts,'GetCommTimeouts',\ + GetCommandLineA,'GetCommandLineA',\ + GetCommandLineW,'GetCommandLineW',\ + GetCompressedFileSizeA,'GetCompressedFileSizeA',\ + GetCompressedFileSizeW,'GetCompressedFileSizeW',\ + GetComputerNameA,'GetComputerNameA',\ + GetComputerNameW,'GetComputerNameW',\ + GetConsoleAliasA,'GetConsoleAliasA',\ + GetConsoleAliasW,'GetConsoleAliasW',\ + GetConsoleAliasExesA,'GetConsoleAliasExesA',\ + GetConsoleAliasExesW,'GetConsoleAliasExesW',\ + GetConsoleAliasExesLengthA,'GetConsoleAliasExesLengthA',\ + GetConsoleAliasExesLengthW,'GetConsoleAliasExesLengthW',\ + GetConsoleAliasesA,'GetConsoleAliasesA',\ + GetConsoleAliasesW,'GetConsoleAliasesW',\ + GetConsoleAliasesLengthA,'GetConsoleAliasesLengthA',\ + GetConsoleAliasesLengthW,'GetConsoleAliasesLengthW',\ + GetConsoleCP,'GetConsoleCP',\ + GetConsoleCommandHistoryA,'GetConsoleCommandHistoryA',\ + GetConsoleCommandHistoryW,'GetConsoleCommandHistoryW',\ + GetConsoleCommandHistoryLengthA,'GetConsoleCommandHistoryLengthA',\ + GetConsoleCommandHistoryLengthW,'GetConsoleCommandHistoryLengthW',\ + GetConsoleCursorInfo,'GetConsoleCursorInfo',\ + GetConsoleDisplayMode,'GetConsoleDisplayMode',\ + GetConsoleFontInfo,'GetConsoleFontInfo',\ + GetConsoleFontSize,'GetConsoleFontSize',\ + GetConsoleHardwareState,'GetConsoleHardwareState',\ + GetConsoleInputExeNameA,'GetConsoleInputExeNameA',\ + GetConsoleInputExeNameW,'GetConsoleInputExeNameW',\ + GetConsoleInputWaitHandle,'GetConsoleInputWaitHandle',\ + GetConsoleKeyboardLayoutNameA,'GetConsoleKeyboardLayoutNameA',\ + GetConsoleKeyboardLayoutNameW,'GetConsoleKeyboardLayoutNameW',\ + GetConsoleMode,'GetConsoleMode',\ + GetConsoleOutputCP,'GetConsoleOutputCP',\ + GetConsoleScreenBufferInfo,'GetConsoleScreenBufferInfo',\ + GetConsoleTitleA,'GetConsoleTitleA',\ + GetConsoleTitleW,'GetConsoleTitleW',\ + GetConsoleWindow,'GetConsoleWindow',\ + GetCurrencyFormatA,'GetCurrencyFormatA',\ + GetCurrencyFormatW,'GetCurrencyFormatW',\ + GetCurrentConsoleFont,'GetCurrentConsoleFont',\ + GetCurrentDirectoryA,'GetCurrentDirectoryA',\ + GetCurrentDirectoryW,'GetCurrentDirectoryW',\ + GetCurrentProcess,'GetCurrentProcess',\ + GetCurrentProcessId,'GetCurrentProcessId',\ + GetCurrentThread,'GetCurrentThread',\ + GetCurrentThreadId,'GetCurrentThreadId',\ + GetDateFormatA,'GetDateFormatA',\ + GetDateFormatW,'GetDateFormatW',\ + GetDefaultCommConfigA,'GetDefaultCommConfigA',\ + GetDefaultCommConfigW,'GetDefaultCommConfigW',\ + GetDevicePowerState,'GetDevicePowerState',\ + GetDiskFreeSpaceA,'GetDiskFreeSpaceA',\ + GetDiskFreeSpaceW,'GetDiskFreeSpaceW',\ + GetDiskFreeSpaceExA,'GetDiskFreeSpaceExA',\ + GetDiskFreeSpaceExW,'GetDiskFreeSpaceExW',\ + GetDriveTypeA,'GetDriveTypeA',\ + GetDriveTypeW,'GetDriveTypeW',\ + GetEnvironmentStringsA,'GetEnvironmentStringsA',\ + GetEnvironmentStringsW,'GetEnvironmentStringsW',\ + GetEnvironmentVariableA,'GetEnvironmentVariableA',\ + GetEnvironmentVariableW,'GetEnvironmentVariableW',\ + GetExitCodeProcess,'GetExitCodeProcess',\ + GetExitCodeThread,'GetExitCodeThread',\ + GetFileAttributesA,'GetFileAttributesA',\ + GetFileAttributesW,'GetFileAttributesW',\ + GetFileAttributesExA,'GetFileAttributesExA',\ + GetFileAttributesExW,'GetFileAttributesExW',\ + GetFileInformationByHandle,'GetFileInformationByHandle',\ + GetFileSize,'GetFileSize',\ + GetFileTime,'GetFileTime',\ + GetFileType,'GetFileType',\ + GetFullPathNameA,'GetFullPathNameA',\ + GetFullPathNameW,'GetFullPathNameW',\ + GetHandleInformation,'GetHandleInformation',\ + GetLargestConsoleWindowSize,'GetLargestConsoleWindowSize',\ + GetLastError,'GetLastError',\ + GetLocalTime,'GetLocalTime',\ + GetLocaleInfoA,'GetLocaleInfoA',\ + GetLocaleInfoW,'GetLocaleInfoW',\ + GetLogicalDriveStringsA,'GetLogicalDriveStringsA',\ + GetLogicalDriveStringsW,'GetLogicalDriveStringsW',\ + GetLogicalDrives,'GetLogicalDrives',\ + GetLongPathNameA,'GetLongPathNameA',\ + GetLongPathNameW,'GetLongPathNameW',\ + GetMailslotInfo,'GetMailslotInfo',\ + GetModuleFileNameA,'GetModuleFileNameA',\ + GetModuleFileNameW,'GetModuleFileNameW',\ + GetModuleHandleA,'GetModuleHandleA',\ + GetModuleHandleW,'GetModuleHandleW',\ + GetNamedPipeHandleStateA,'GetNamedPipeHandleStateA',\ + GetNamedPipeHandleStateW,'GetNamedPipeHandleStateW',\ + GetNamedPipeInfo,'GetNamedPipeInfo',\ + GetNextVDMCommand,'GetNextVDMCommand',\ + GetNumberFormatA,'GetNumberFormatA',\ + GetNumberFormatW,'GetNumberFormatW',\ + GetNumberOfConsoleFonts,'GetNumberOfConsoleFonts',\ + GetNumberOfConsoleInputEvents,'GetNumberOfConsoleInputEvents',\ + GetNumberOfConsoleMouseButtons,'GetNumberOfConsoleMouseButtons',\ + GetOEMCP,'GetOEMCP',\ + GetOverlappedResult,'GetOverlappedResult',\ + GetPriorityClass,'GetPriorityClass',\ + GetPrivateProfileIntA,'GetPrivateProfileIntA',\ + GetPrivateProfileIntW,'GetPrivateProfileIntW',\ + GetPrivateProfileSectionA,'GetPrivateProfileSectionA',\ + GetPrivateProfileSectionW,'GetPrivateProfileSectionW',\ + GetPrivateProfileSectionNamesA,'GetPrivateProfileSectionNamesA',\ + GetPrivateProfileSectionNamesW,'GetPrivateProfileSectionNamesW',\ + GetPrivateProfileStringA,'GetPrivateProfileStringA',\ + GetPrivateProfileStringW,'GetPrivateProfileStringW',\ + GetPrivateProfileStructA,'GetPrivateProfileStructA',\ + GetPrivateProfileStructW,'GetPrivateProfileStructW',\ + GetProcAddress,'GetProcAddress',\ + GetProcessAffinityMask,'GetProcessAffinityMask',\ + GetProcessHeap,'GetProcessHeap',\ + GetProcessHeaps,'GetProcessHeaps',\ + GetProcessPriorityBoost,'GetProcessPriorityBoost',\ + GetProcessShutdownParameters,'GetProcessShutdownParameters',\ + GetProcessTimes,'GetProcessTimes',\ + GetProcessVersion,'GetProcessVersion',\ + GetProcessWorkingSetSize,'GetProcessWorkingSetSize',\ + GetProfileIntA,'GetProfileIntA',\ + GetProfileIntW,'GetProfileIntW',\ + GetProfileSectionA,'GetProfileSectionA',\ + GetProfileSectionW,'GetProfileSectionW',\ + GetProfileStringA,'GetProfileStringA',\ + GetProfileStringW,'GetProfileStringW',\ + GetQueuedCompletionStatus,'GetQueuedCompletionStatus',\ + GetShortPathNameA,'GetShortPathNameA',\ + GetShortPathNameW,'GetShortPathNameW',\ + GetStartupInfoA,'GetStartupInfoA',\ + GetStartupInfoW,'GetStartupInfoW',\ + GetStdHandle,'GetStdHandle',\ + GetStringTypeA,'GetStringTypeA',\ + GetStringTypeW,'GetStringTypeW',\ + GetStringTypeExA,'GetStringTypeExA',\ + GetStringTypeExW,'GetStringTypeExW',\ + GetSystemDefaultLCID,'GetSystemDefaultLCID',\ + GetSystemDefaultLangID,'GetSystemDefaultLangID',\ + GetSystemDirectoryA,'GetSystemDirectoryA',\ + GetSystemDirectoryW,'GetSystemDirectoryW',\ + GetSystemInfo,'GetSystemInfo',\ + GetSystemPowerStatus,'GetSystemPowerStatus',\ + GetSystemTime,'GetSystemTime',\ + GetSystemTimeAdjustment,'GetSystemTimeAdjustment',\ + GetSystemTimeAsFileTime,'GetSystemTimeAsFileTime',\ + GetTapeParameters,'GetTapeParameters',\ + GetTapePosition,'GetTapePosition',\ + GetTapeStatus,'GetTapeStatus',\ + GetTempFileNameA,'GetTempFileNameA',\ + GetTempFileNameW,'GetTempFileNameW',\ + GetTempPathA,'GetTempPathA',\ + GetTempPathW,'GetTempPathW',\ + GetThreadContext,'GetThreadContext',\ + GetThreadLocale,'GetThreadLocale',\ + GetThreadPriority,'GetThreadPriority',\ + GetThreadPriorityBoost,'GetThreadPriorityBoost',\ + GetThreadSelectorEntry,'GetThreadSelectorEntry',\ + GetThreadTimes,'GetThreadTimes',\ + GetTickCount,'GetTickCount',\ + GetTimeFormatA,'GetTimeFormatA',\ + GetTimeFormatW,'GetTimeFormatW',\ + GetTimeZoneInformation,'GetTimeZoneInformation',\ + GetUserDefaultLCID,'GetUserDefaultLCID',\ + GetUserDefaultLangID,'GetUserDefaultLangID',\ + GetVDMCurrentDirectories,'GetVDMCurrentDirectories',\ + GetVersion,'GetVersion',\ + GetVersionExA,'GetVersionExA',\ + GetVersionExW,'GetVersionExW',\ + GetVolumeInformationA,'GetVolumeInformationA',\ + GetVolumeInformationW,'GetVolumeInformationW',\ + GetWindowsDirectoryA,'GetWindowsDirectoryA',\ + GetWindowsDirectoryW,'GetWindowsDirectoryW',\ + GlobalAddAtomA,'GlobalAddAtomA',\ + GlobalAddAtomW,'GlobalAddAtomW',\ + GlobalAlloc,'GlobalAlloc',\ + GlobalCompact,'GlobalCompact',\ + GlobalDeleteAtom,'GlobalDeleteAtom',\ + GlobalFindAtomA,'GlobalFindAtomA',\ + GlobalFindAtomW,'GlobalFindAtomW',\ + GlobalFix,'GlobalFix',\ + GlobalFlags,'GlobalFlags',\ + GlobalFree,'GlobalFree',\ + GlobalGetAtomNameA,'GlobalGetAtomNameA',\ + GlobalGetAtomNameW,'GlobalGetAtomNameW',\ + GlobalHandle,'GlobalHandle',\ + GlobalLock,'GlobalLock',\ + GlobalMemoryStatus,'GlobalMemoryStatus',\ + GlobalMemoryStatusVlm,'GlobalMemoryStatusVlm',\ + GlobalReAlloc,'GlobalReAlloc',\ + GlobalSize,'GlobalSize',\ + GlobalUnWire,'GlobalUnWire',\ + GlobalUnfix,'GlobalUnfix',\ + GlobalUnlock,'GlobalUnlock',\ + GlobalWire,'GlobalWire',\ + Heap32First,'Heap32First',\ + Heap32ListFirst,'Heap32ListFirst',\ + Heap32ListNext,'Heap32ListNext',\ + Heap32Next,'Heap32Next',\ + HeapAlloc,'HeapAlloc',\ + HeapCompact,'HeapCompact',\ + HeapCreate,'HeapCreate',\ + HeapDestroy,'HeapDestroy',\ + HeapExtend,'HeapExtend',\ + HeapFree,'HeapFree',\ + HeapLock,'HeapLock',\ + HeapReAlloc,'HeapReAlloc',\ + HeapSize,'HeapSize',\ + HeapSummary,'HeapSummary',\ + HeapUnlock,'HeapUnlock',\ + HeapUsage,'HeapUsage',\ + HeapValidate,'HeapValidate',\ + HeapWalk,'HeapWalk',\ + InitAtomTable,'InitAtomTable',\ + InitializeCriticalSection,'InitializeCriticalSection',\ + InitializeCriticalSectionAndSpinCount,'InitializeCriticalSectionAndSpinCount',\ + InterlockedCompareExchange,'InterlockedCompareExchange',\ + InterlockedDecrement,'InterlockedDecrement',\ + InterlockedExchange,'InterlockedExchange',\ + InterlockedExchangeAdd,'InterlockedExchangeAdd',\ + InterlockedIncrement,'InterlockedIncrement',\ + InvalidateConsoleDIBits,'InvalidateConsoleDIBits',\ + IsBadCodePtr,'IsBadCodePtr',\ + IsBadHugeReadPtr,'IsBadHugeReadPtr',\ + IsBadHugeWritePtr,'IsBadHugeWritePtr',\ + IsBadReadPtr,'IsBadReadPtr',\ + IsBadStringPtrA,'IsBadStringPtrA',\ + IsBadStringPtrW,'IsBadStringPtrW',\ + IsBadWritePtr,'IsBadWritePtr',\ + IsDBCSLeadByte,'IsDBCSLeadByte',\ + IsDBCSLeadByteEx,'IsDBCSLeadByteEx',\ + IsDebuggerPresent,'IsDebuggerPresent',\ + IsProcessorFeaturePresent,'IsProcessorFeaturePresent',\ + IsValidCodePage,'IsValidCodePage',\ + IsValidLocale,'IsValidLocale',\ + LCMapStringA,'LCMapStringA',\ + LCMapStringW,'LCMapStringW',\ + LeaveCriticalSection,'LeaveCriticalSection',\ + LoadLibraryA,'LoadLibraryA',\ + LoadLibraryW,'LoadLibraryW',\ + LoadLibraryExA,'LoadLibraryExA',\ + LoadLibraryExW,'LoadLibraryExW',\ + LoadModule,'LoadModule',\ + LoadResource,'LoadResource',\ + LocalAlloc,'LocalAlloc',\ + LocalCompact,'LocalCompact',\ + LocalFileTimeToFileTime,'LocalFileTimeToFileTime',\ + LocalFlags,'LocalFlags',\ + LocalFree,'LocalFree',\ + LocalHandle,'LocalHandle',\ + LocalLock,'LocalLock',\ + LocalReAlloc,'LocalReAlloc',\ + LocalShrink,'LocalShrink',\ + LocalSize,'LocalSize',\ + LocalUnlock,'LocalUnlock',\ + LockFile,'LockFile',\ + LockFileEx,'LockFileEx',\ + LockResource,'LockResource',\ + MapViewOfFile,'MapViewOfFile',\ + MapViewOfFileEx,'MapViewOfFileEx',\ + MapViewOfFileVlm,'MapViewOfFileVlm',\ + Module32First,'Module32First',\ + Module32Next,'Module32Next',\ + MoveFileA,'MoveFileA',\ + MoveFileW,'MoveFileW',\ + MoveFileExA,'MoveFileExA',\ + MoveFileExW,'MoveFileExW',\ + MoveFileWithProgressA,'MoveFileWithProgressA',\ + MoveFileWithProgressW,'MoveFileWithProgressW',\ + MulDiv,'MulDiv',\ + MultiByteToWideChar,'MultiByteToWideChar',\ + OpenEventA,'OpenEventA',\ + OpenEventW,'OpenEventW',\ + OpenFile,'OpenFile',\ + OpenFileMappingA,'OpenFileMappingA',\ + OpenFileMappingW,'OpenFileMappingW',\ + OpenJobObjectA,'OpenJobObjectA',\ + OpenJobObjectW,'OpenJobObjectW',\ + OpenMutexA,'OpenMutexA',\ + OpenMutexW,'OpenMutexW',\ + OpenProcess,'OpenProcess',\ + OpenProfileUserMapping,'OpenProfileUserMapping',\ + OpenSemaphoreA,'OpenSemaphoreA',\ + OpenSemaphoreW,'OpenSemaphoreW',\ + OpenWaitableTimerA,'OpenWaitableTimerA',\ + OpenWaitableTimerW,'OpenWaitableTimerW',\ + OutputDebugStringA,'OutputDebugStringA',\ + OutputDebugStringW,'OutputDebugStringW',\ + PeekConsoleInputA,'PeekConsoleInputA',\ + PeekConsoleInputW,'PeekConsoleInputW',\ + PeekNamedPipe,'PeekNamedPipe',\ + PostQueuedCompletionStatus,'PostQueuedCompletionStatus',\ + PrepareTape,'PrepareTape',\ + Process32First,'Process32First',\ + Process32Next,'Process32Next',\ + PulseEvent,'PulseEvent',\ + PurgeComm,'PurgeComm',\ + QueryDosDeviceA,'QueryDosDeviceA',\ + QueryDosDeviceW,'QueryDosDeviceW',\ + QueryInformationJobObject,'QueryInformationJobObject',\ + QueryPerformanceCounter,'QueryPerformanceCounter',\ + QueryPerformanceFrequency,'QueryPerformanceFrequency',\ + QueryWin31IniFilesMappedToRegistry,'QueryWin31IniFilesMappedToRegistry',\ + QueueUserAPC,'QueueUserAPC',\ + RaiseException,'RaiseException',\ + ReadConsoleA,'ReadConsoleA',\ + ReadConsoleW,'ReadConsoleW',\ + ReadConsoleInputA,'ReadConsoleInputA',\ + ReadConsoleInputW,'ReadConsoleInputW',\ + ReadConsoleInputExA,'ReadConsoleInputExA',\ + ReadConsoleInputExW,'ReadConsoleInputExW',\ + ReadConsoleOutputA,'ReadConsoleOutputA',\ + ReadConsoleOutputW,'ReadConsoleOutputW',\ + ReadConsoleOutputAttribute,'ReadConsoleOutputAttribute',\ + ReadConsoleOutputCharacterA,'ReadConsoleOutputCharacterA',\ + ReadConsoleOutputCharacterW,'ReadConsoleOutputCharacterW',\ + ReadFile,'ReadFile',\ + ReadFileEx,'ReadFileEx',\ + ReadFileScatter,'ReadFileScatter',\ + ReadFileVlm,'ReadFileVlm',\ + ReadProcessMemory,'ReadProcessMemory',\ + ReadProcessMemoryVlm,'ReadProcessMemoryVlm',\ + RegisterConsoleVDM,'RegisterConsoleVDM',\ + RegisterWaitForInputIdle,'RegisterWaitForInputIdle',\ + RegisterWowBaseHandlers,'RegisterWowBaseHandlers',\ + RegisterWowExec,'RegisterWowExec',\ + ReleaseMutex,'ReleaseMutex',\ + ReleaseSemaphore,'ReleaseSemaphore',\ + RemoveDirectoryA,'RemoveDirectoryA',\ + RemoveDirectoryW,'RemoveDirectoryW',\ + RequestWakeupLatency,'RequestWakeupLatency',\ + ResetEvent,'ResetEvent',\ + ResumeThread,'ResumeThread',\ + RtlFillMemory,'RtlFillMemory',\ + RtlMoveMemory,'RtlMoveMemory',\ + RtlUnwind,'RtlUnwind',\ + RtlZeroMemory,'RtlZeroMemory',\ + ScrollConsoleScreenBufferA,'ScrollConsoleScreenBufferA',\ + ScrollConsoleScreenBufferW,'ScrollConsoleScreenBufferW',\ + SearchPathA,'SearchPathA',\ + SearchPathW,'SearchPathW',\ + SetCommBreak,'SetCommBreak',\ + SetCommConfig,'SetCommConfig',\ + SetCommMask,'SetCommMask',\ + SetCommState,'SetCommState',\ + SetCommTimeouts,'SetCommTimeouts',\ + SetComputerNameA,'SetComputerNameA',\ + SetComputerNameW,'SetComputerNameW',\ + SetConsoleActiveScreenBuffer,'SetConsoleActiveScreenBuffer',\ + SetConsoleCP,'SetConsoleCP',\ + SetConsoleCommandHistoryMode,'SetConsoleCommandHistoryMode',\ + SetConsoleCtrlHandler,'SetConsoleCtrlHandler',\ + SetConsoleCursor,'SetConsoleCursor',\ + SetConsoleCursorInfo,'SetConsoleCursorInfo',\ + SetConsoleCursorPosition,'SetConsoleCursorPosition',\ + SetConsoleDisplayMode,'SetConsoleDisplayMode',\ + SetConsoleFont,'SetConsoleFont',\ + SetConsoleHardwareState,'SetConsoleHardwareState',\ + SetConsoleIcon,'SetConsoleIcon',\ + SetConsoleInputExeNameA,'SetConsoleInputExeNameA',\ + SetConsoleInputExeNameW,'SetConsoleInputExeNameW',\ + SetConsoleKeyShortcuts,'SetConsoleKeyShortcuts',\ + SetConsoleMaximumWindowSize,'SetConsoleMaximumWindowSize',\ + SetConsoleMenuClose,'SetConsoleMenuClose',\ + SetConsoleMode,'SetConsoleMode',\ + SetConsoleNumberOfCommandsA,'SetConsoleNumberOfCommandsA',\ + SetConsoleNumberOfCommandsW,'SetConsoleNumberOfCommandsW',\ + SetConsoleOutputCP,'SetConsoleOutputCP',\ + SetConsolePalette,'SetConsolePalette',\ + SetConsoleScreenBufferSize,'SetConsoleScreenBufferSize',\ + SetConsoleTextAttribute,'SetConsoleTextAttribute',\ + SetConsoleTitleA,'SetConsoleTitleA',\ + SetConsoleTitleW,'SetConsoleTitleW',\ + SetConsoleWindowInfo,'SetConsoleWindowInfo',\ + SetCriticalSectionSpinCount,'SetCriticalSectionSpinCount',\ + SetCurrentDirectoryA,'SetCurrentDirectoryA',\ + SetCurrentDirectoryW,'SetCurrentDirectoryW',\ + SetDefaultCommConfigA,'SetDefaultCommConfigA',\ + SetDefaultCommConfigW,'SetDefaultCommConfigW',\ + SetEndOfFile,'SetEndOfFile',\ + SetEnvironmentVariableA,'SetEnvironmentVariableA',\ + SetEnvironmentVariableW,'SetEnvironmentVariableW',\ + SetErrorMode,'SetErrorMode',\ + SetEvent,'SetEvent',\ + SetFileApisToANSI,'SetFileApisToANSI',\ + SetFileApisToOEM,'SetFileApisToOEM',\ + SetFileAttributesA,'SetFileAttributesA',\ + SetFileAttributesW,'SetFileAttributesW',\ + SetFilePointer,'SetFilePointer',\ + SetFileTime,'SetFileTime',\ + SetHandleCount,'SetHandleCount',\ + SetHandleInformation,'SetHandleInformation',\ + SetInformationJobObject,'SetInformationJobObject',\ + SetLastConsoleEventActive,'SetLastConsoleEventActive',\ + SetLastError,'SetLastError',\ + SetLocalTime,'SetLocalTime',\ + SetLocaleInfoA,'SetLocaleInfoA',\ + SetLocaleInfoW,'SetLocaleInfoW',\ + SetMailslotInfo,'SetMailslotInfo',\ + SetNamedPipeHandleState,'SetNamedPipeHandleState',\ + SetPriorityClass,'SetPriorityClass',\ + SetProcessAffinityMask,'SetProcessAffinityMask',\ + SetProcessPriorityBoost,'SetProcessPriorityBoost',\ + SetProcessShutdownParameters,'SetProcessShutdownParameters',\ + SetProcessWorkingSetSize,'SetProcessWorkingSetSize',\ + SetStdHandle,'SetStdHandle',\ + SetSystemPowerState,'SetSystemPowerState',\ + SetSystemTime,'SetSystemTime',\ + SetSystemTimeAdjustment,'SetSystemTimeAdjustment',\ + SetTapeParameters,'SetTapeParameters',\ + SetTapePosition,'SetTapePosition',\ + SetThreadAffinityMask,'SetThreadAffinityMask',\ + SetThreadContext,'SetThreadContext',\ + SetThreadExecutionState,'SetThreadExecutionState',\ + SetThreadIdealProcessor,'SetThreadIdealProcessor',\ + SetThreadLocale,'SetThreadLocale',\ + SetThreadPriority,'SetThreadPriority',\ + SetThreadPriorityBoost,'SetThreadPriorityBoost',\ + SetTimeZoneInformation,'SetTimeZoneInformation',\ + SetUnhandledExceptionFilter,'SetUnhandledExceptionFilter',\ + SetVDMCurrentDirectories,'SetVDMCurrentDirectories',\ + SetVolumeLabelA,'SetVolumeLabelA',\ + SetVolumeLabelW,'SetVolumeLabelW',\ + SetWaitableTimer,'SetWaitableTimer',\ + SetupComm,'SetupComm',\ + ShowConsoleCursor,'ShowConsoleCursor',\ + SignalObjectAndWait,'SignalObjectAndWait',\ + SizeofResource,'SizeofResource',\ + Sleep,'Sleep',\ + SleepEx,'SleepEx',\ + SuspendThread,'SuspendThread',\ + SwitchToFiber,'SwitchToFiber',\ + SwitchToThread,'SwitchToThread',\ + SystemTimeToFileTime,'SystemTimeToFileTime',\ + SystemTimeToTzSpecificLocalTime,'SystemTimeToTzSpecificLocalTime',\ + TerminateJobObject,'TerminateJobObject',\ + TerminateProcess,'TerminateProcess',\ + TerminateThread,'TerminateThread',\ + Thread32First,'Thread32First',\ + Thread32Next,'Thread32Next',\ + TlsAlloc,'TlsAlloc',\ + TlsFree,'TlsFree',\ + TlsGetValue,'TlsGetValue',\ + TlsSetValue,'TlsSetValue',\ + Toolhelp32ReadProcessMemory,'Toolhelp32ReadProcessMemory',\ + TransactNamedPipe,'TransactNamedPipe',\ + TransmitCommChar,'TransmitCommChar',\ + TrimVirtualBuffer,'TrimVirtualBuffer',\ + TryEnterCriticalSection,'TryEnterCriticalSection',\ + UnhandledExceptionFilter,'UnhandledExceptionFilter',\ + UnlockFile,'UnlockFile',\ + UnlockFileEx,'UnlockFileEx',\ + UnmapViewOfFile,'UnmapViewOfFile',\ + UnmapViewOfFileVlm,'UnmapViewOfFileVlm',\ + UpdateResourceA,'UpdateResourceA',\ + UpdateResourceW,'UpdateResourceW',\ + VDMConsoleOperation,'VDMConsoleOperation',\ + VDMOperationStarted,'VDMOperationStarted',\ + VerLanguageNameA,'VerLanguageNameA',\ + VerLanguageNameW,'VerLanguageNameW',\ + VerifyConsoleIoHandle,'VerifyConsoleIoHandle',\ + VirtualAlloc,'VirtualAlloc',\ + VirtualAllocEx,'VirtualAllocEx',\ + VirtualAllocVlm,'VirtualAllocVlm',\ + VirtualBufferExceptionHandler,'VirtualBufferExceptionHandler',\ + VirtualFree,'VirtualFree',\ + VirtualFreeEx,'VirtualFreeEx',\ + VirtualFreeVlm,'VirtualFreeVlm',\ + VirtualLock,'VirtualLock',\ + VirtualProtect,'VirtualProtect',\ + VirtualProtectEx,'VirtualProtectEx',\ + VirtualProtectVlm,'VirtualProtectVlm',\ + VirtualQuery,'VirtualQuery',\ + VirtualQueryEx,'VirtualQueryEx',\ + VirtualQueryVlm,'VirtualQueryVlm',\ + VirtualUnlock,'VirtualUnlock',\ + WaitCommEvent,'WaitCommEvent',\ + WaitForDebugEvent,'WaitForDebugEvent',\ + WaitForMultipleObjects,'WaitForMultipleObjects',\ + WaitForMultipleObjectsEx,'WaitForMultipleObjectsEx',\ + WaitForSingleObject,'WaitForSingleObject',\ + WaitForSingleObjectEx,'WaitForSingleObjectEx',\ + WaitNamedPipeA,'WaitNamedPipeA',\ + WaitNamedPipeW,'WaitNamedPipeW',\ + WideCharToMultiByte,'WideCharToMultiByte',\ + WinExec,'WinExec',\ + WriteConsoleA,'WriteConsoleA',\ + WriteConsoleW,'WriteConsoleW',\ + WriteConsoleInputA,'WriteConsoleInputA',\ + WriteConsoleInputW,'WriteConsoleInputW',\ + WriteConsoleInputVDMA,'WriteConsoleInputVDMA',\ + WriteConsoleInputVDMW,'WriteConsoleInputVDMW',\ + WriteConsoleOutputA,'WriteConsoleOutputA',\ + WriteConsoleOutputW,'WriteConsoleOutputW',\ + WriteConsoleOutputAttribute,'WriteConsoleOutputAttribute',\ + WriteConsoleOutputCharacterA,'WriteConsoleOutputCharacterA',\ + WriteConsoleOutputCharacterW,'WriteConsoleOutputCharacterW',\ + WriteFile,'WriteFile',\ + WriteFileEx,'WriteFileEx',\ + WriteFileGather,'WriteFileGather',\ + WriteFileVlm,'WriteFileVlm',\ + WritePrivateProfileSectionA,'WritePrivateProfileSectionA',\ + WritePrivateProfileSectionW,'WritePrivateProfileSectionW',\ + WritePrivateProfileStringA,'WritePrivateProfileStringA',\ + WritePrivateProfileStringW,'WritePrivateProfileStringW',\ + WritePrivateProfileStructA,'WritePrivateProfileStructA',\ + WritePrivateProfileStructW,'WritePrivateProfileStructW',\ + WriteProcessMemory,'WriteProcessMemory',\ + WriteProcessMemoryVlm,'WriteProcessMemoryVlm',\ + WriteProfileSectionA,'WriteProfileSectionA',\ + WriteProfileSectionW,'WriteProfileSectionW',\ + WriteProfileStringA,'WriteProfileStringA',\ + WriteProfileStringW,'WriteProfileStringW',\ + WriteTapemark,'WriteTapemark',\ + _hread,'_hread',\ + _hwrite,'_hwrite',\ + _lclose,'_lclose',\ + _lcreat,'_lcreat',\ + _llseek,'_llseek',\ + _lopen,'_lopen',\ + _lread,'_lread',\ + _lwrite,'_lwrite',\ + lstrcatA,'lstrcatA',\ + lstrcatW,'lstrcatW',\ + lstrcmpA,'lstrcmpA',\ + lstrcmpW,'lstrcmpW',\ + lstrcmpiA,'lstrcmpiA',\ + lstrcmpiW,'lstrcmpiW',\ + lstrcpyA,'lstrcpyA',\ + lstrcpyW,'lstrcpyW',\ + lstrcpynA,'lstrcpynA',\ + lstrcpynW,'lstrcpynW',\ + lstrlenA,'lstrlenA',\ + lstrlenW,'lstrlenW' + +api AddAtom,\ + AddConsoleAlias,\ + BeginUpdateResource,\ + BuildCommDCB,\ + BuildCommDCBAndTimeouts,\ + CallNamedPipe,\ + CommConfigDialog,\ + CompareString,\ + CopyFile,\ + CopyFileEx,\ + CreateDirectory,\ + CreateDirectoryEx,\ + CreateEvent,\ + CreateFile,\ + CreateFileMapping,\ + CreateHardLink,\ + CreateJobObject,\ + CreateMailslot,\ + CreateMutex,\ + CreateNamedPipe,\ + CreateProcess,\ + CreateSemaphore,\ + CreateWaitableTimer,\ + DefineDosDevice,\ + DeleteFile,\ + EndUpdateResource,\ + EnumCalendarInfo,\ + EnumCalendarInfoEx,\ + EnumDateFormats,\ + EnumDateFormatsEx,\ + EnumResourceLanguages,\ + EnumResourceNames,\ + EnumResourceTypes,\ + EnumSystemCodePages,\ + EnumSystemLocales,\ + EnumTimeFormats,\ + ExpandEnvironmentStrings,\ + ExpungeConsoleCommandHistory,\ + FatalAppExit,\ + FillConsoleOutputCharacter,\ + FindAtom,\ + FindFirstChangeNotification,\ + FindFirstFile,\ + FindFirstFileEx,\ + FindNextFile,\ + FindResource,\ + FindResourceEx,\ + FoldString,\ + FormatMessage,\ + FreeEnvironmentStrings,\ + GetAtomName,\ + GetBinaryType,\ + GetCPInfoEx,\ + GetCommandLine,\ + GetCompressedFileSize,\ + GetComputerName,\ + GetConsoleAlias,\ + GetConsoleAliasExes,\ + GetConsoleAliasExesLength,\ + GetConsoleAliases,\ + GetConsoleAliasesLength,\ + GetConsoleCommandHistory,\ + GetConsoleCommandHistoryLength,\ + GetConsoleInputExeName,\ + GetConsoleKeyboardLayoutName,\ + GetConsoleTitle,\ + GetCurrencyFormat,\ + GetCurrentDirectory,\ + GetDateFormat,\ + GetDefaultCommConfig,\ + GetDiskFreeSpace,\ + GetDiskFreeSpaceEx,\ + GetDriveType,\ + GetEnvironmentStrings,\ + GetEnvironmentVariable,\ + GetFileAttributes,\ + GetFileAttributesEx,\ + GetFullPathName,\ + GetLocaleInfo,\ + GetLogicalDriveStrings,\ + GetLongPathName,\ + GetModuleFileName,\ + GetModuleHandle,\ + GetNamedPipeHandleState,\ + GetNumberFormat,\ + GetPrivateProfileInt,\ + GetPrivateProfileSection,\ + GetPrivateProfileSectionNames,\ + GetPrivateProfileString,\ + GetPrivateProfileStruct,\ + GetProfileInt,\ + GetProfileSection,\ + GetProfileString,\ + GetShortPathName,\ + GetStartupInfo,\ + GetStringType,\ + GetStringTypeEx,\ + GetSystemDirectory,\ + GetTempFileName,\ + GetTempPath,\ + GetTimeFormat,\ + GetVersionEx,\ + GetVolumeInformation,\ + GetWindowsDirectory,\ + GlobalAddAtom,\ + GlobalFindAtom,\ + GlobalGetAtomName,\ + IsBadStringPtr,\ + LCMapString,\ + LoadLibrary,\ + LoadLibraryEx,\ + MoveFile,\ + MoveFileEx,\ + MoveFileWithProgress,\ + OpenEvent,\ + OpenFileMapping,\ + OpenJobObject,\ + OpenMutex,\ + OpenSemaphore,\ + OpenWaitableTimer,\ + OutputDebugString,\ + PeekConsoleInput,\ + QueryDosDevice,\ + ReadConsole,\ + ReadConsoleInput,\ + ReadConsoleInputEx,\ + ReadConsoleOutput,\ + ReadConsoleOutputCharacter,\ + RemoveDirectory,\ + ScrollConsoleScreenBuffer,\ + SearchPath,\ + SetComputerName,\ + SetConsoleInputExeName,\ + SetConsoleNumberOfCommands,\ + SetConsoleTitle,\ + SetCurrentDirectory,\ + SetDefaultCommConfig,\ + SetEnvironmentVariable,\ + SetFileAttributes,\ + SetLocaleInfo,\ + SetVolumeLabel,\ + UpdateResource,\ + VerLanguageName,\ + WaitNamedPipe,\ + WriteConsole,\ + WriteConsoleInput,\ + WriteConsoleInputVDM,\ + WriteConsoleOutput,\ + WriteConsoleOutputCharacter,\ + WritePrivateProfileSection,\ + WritePrivateProfileString,\ + WritePrivateProfileStruct,\ + WriteProfileSection,\ + WriteProfileString,\ + lstrcat,\ + lstrcmp,\ + lstrcmpi,\ + lstrcpy,\ + lstrcpyn,\ + lstrlen diff --git a/fasmw172/INCLUDE/API/SHELL32.INC b/fasmw172/INCLUDE/API/SHELL32.INC new file mode 100644 index 0000000..1ca3a14 --- /dev/null +++ b/fasmw172/INCLUDE/API/SHELL32.INC @@ -0,0 +1,167 @@ + +; SHELL32 API calls + +import shell32,\ + CheckEscapesA,'CheckEscapesA',\ + CheckEscapesW,'CheckEscapesW',\ + DoEnvironmentSubstA,'DoEnvironmentSubstA',\ + DoEnvironmentSubstW,'DoEnvironmentSubstW',\ + DragAcceptFiles,'DragAcceptFiles',\ + DragFinish,'DragFinish',\ + DragQueryFileA,'DragQueryFileA',\ + DragQueryFileW,'DragQueryFileW',\ + DragQueryPoint,'DragQueryPoint',\ + DuplicateIcon,'DuplicateIcon',\ + ExtractAssociatedIconA,'ExtractAssociatedIconA',\ + ExtractAssociatedIconW,'ExtractAssociatedIconW',\ + ExtractAssociatedIconExA,'ExtractAssociatedIconExA',\ + ExtractAssociatedIconExW,'ExtractAssociatedIconExW',\ + ExtractIconA,'ExtractIconA',\ + ExtractIconW,'ExtractIconW',\ + ExtractIconExA,'ExtractIconExA',\ + ExtractIconExW,'ExtractIconExW',\ + ExtractIconResInfoA,'ExtractIconResInfoA',\ + ExtractIconResInfoW,'ExtractIconResInfoW',\ + FindExeDlgProc,'FindExeDlgProc',\ + FindExecutableA,'FindExecutableA',\ + FindExecutableW,'FindExecutableW',\ + FreeIconList,'FreeIconList',\ + InternalExtractIconListA,'InternalExtractIconListA',\ + InternalExtractIconListW,'InternalExtractIconListW',\ + RealShellExecuteA,'RealShellExecuteA',\ + RealShellExecuteW,'RealShellExecuteW',\ + RealShellExecuteExA,'RealShellExecuteExA',\ + RealShellExecuteExW,'RealShellExecuteExW',\ + RegenerateUserEnvironment,'RegenerateUserEnvironment',\ + SHAddToRecentDocs,'SHAddToRecentDocs',\ + SHAppBarMessage,'SHAppBarMessage',\ + SHBrowseForFolderA,'SHBrowseForFolderA',\ + SHBrowseForFolderW,'SHBrowseForFolderW',\ + SHChangeNotify,'SHChangeNotify',\ + SHEmptyRecycleBinA,'SHEmptyRecycleBinA',\ + SHEmptyRecycleBinW,'SHEmptyRecycleBinW',\ + SHFileOperationA,'SHFileOperationA',\ + SHFileOperationW,'SHFileOperationW',\ + SHFormatDrive,'SHFormatDrive',\ + SHFreeNameMappings,'SHFreeNameMappings',\ + SHGetDataFromIDListA,'SHGetDataFromIDListA',\ + SHGetDataFromIDListW,'SHGetDataFromIDListW',\ + SHGetDesktopFolder,'SHGetDesktopFolder',\ + SHGetDiskFreeSpaceA,'SHGetDiskFreeSpaceA',\ + SHGetDiskFreeSpaceW,'SHGetDiskFreeSpaceW',\ + SHGetFileInfoA,'SHGetFileInfoA',\ + SHGetFileInfoW,'SHGetFileInfoW',\ + SHGetInstanceExplorer,'SHGetInstanceExplorer',\ + SHGetMalloc,'SHGetMalloc',\ + SHGetNewLinkInfo,'SHGetNewLinkInfo',\ + SHGetPathFromIDListA,'SHGetPathFromIDListA',\ + SHGetPathFromIDListW,'SHGetPathFromIDListW',\ + SHGetSettings,'SHGetSettings',\ + SHGetSpecialFolderLocation,'SHGetSpecialFolderLocation',\ + SHGetSpecialFolderPathA,'SHGetSpecialFolderPathA',\ + SHGetSpecialFolderPathW,'SHGetSpecialFolderPathW',\ + SHInvokePrinterCommandA,'SHInvokePrinterCommandA',\ + SHInvokePrinterCommandW,'SHInvokePrinterCommandW',\ + SHLoadInProc,'SHLoadInProc',\ + SHQueryRecycleBinA,'SHQueryRecycleBinA',\ + SHQueryRecycleBinW,'SHQueryRecycleBinW',\ + SHUpdateRecycleBinIcon,'SHUpdateRecycleBinIcon',\ + SheChangeDirA,'SheChangeDirA',\ + SheChangeDirW,'SheChangeDirW',\ + SheChangeDirExA,'SheChangeDirExA',\ + SheChangeDirExW,'SheChangeDirExW',\ + SheFullPathA,'SheFullPathA',\ + SheFullPathW,'SheFullPathW',\ + SheGetCurDrive,'SheGetCurDrive',\ + SheGetDirA,'SheGetDirA',\ + SheGetDirW,'SheGetDirW',\ + SheRemoveQuotesA,'SheRemoveQuotesA',\ + SheRemoveQuotesW,'SheRemoveQuotesW',\ + SheSetCurDrive,'SheSetCurDrive',\ + SheShortenPathA,'SheShortenPathA',\ + SheShortenPathW,'SheShortenPathW',\ + ShellAboutA,'ShellAboutA',\ + ShellAboutW,'ShellAboutW',\ + ShellExecuteA,'ShellExecuteA',\ + ShellExecuteW,'ShellExecuteW',\ + ShellExecuteExA,'ShellExecuteExA',\ + ShellExecuteExW,'ShellExecuteExW',\ + ShellHookProc,'ShellHookProc',\ + Shell_NotifyIconA,'Shell_NotifyIconA',\ + Shell_NotifyIconW,'Shell_NotifyIconW',\ + StrChrA,'StrChrA',\ + StrChrW,'StrChrW',\ + StrChrIA,'StrChrIA',\ + StrChrIW,'StrChrIW',\ + StrCmpNA,'StrCmpNA',\ + StrCmpNW,'StrCmpNW',\ + StrCmpNIA,'StrCmpNIA',\ + StrCmpNIW,'StrCmpNIW',\ + StrCpyNA,'StrCpyNA',\ + StrCpyNW,'StrCpyNW',\ + StrNCmpA,'StrNCmpA',\ + StrNCmpW,'StrNCmpW',\ + StrNCmpIA,'StrNCmpIA',\ + StrNCmpIW,'StrNCmpIW',\ + StrNCpyA,'StrNCpyA',\ + StrNCpyW,'StrNCpyW',\ + StrRChrA,'StrRChrA',\ + StrRChrW,'StrRChrW',\ + StrRChrIA,'StrRChrIA',\ + StrRChrIW,'StrRChrIW',\ + StrRStrA,'StrRStrA',\ + StrRStrW,'StrRStrW',\ + StrRStrIA,'StrRStrIA',\ + StrRStrIW,'StrRStrIW',\ + StrStrA,'StrStrA',\ + StrStrW,'StrStrW',\ + StrStrIA,'StrStrIA',\ + StrStrIW,'StrStrIW',\ + WOWShellExecute,'WOWShellExecute' + +api CheckEscapes,\ + DoEnvironmentSubst,\ + DragQueryFile,\ + ExtractAssociatedIcon,\ + ExtractAssociatedIconEx,\ + ExtractIcon,\ + ExtractIconEx,\ + ExtractIconResInfo,\ + FindExecutable,\ + InternalExtractIconList,\ + RealShellExecute,\ + RealShellExecuteEx,\ + SHBrowseForFolder,\ + SHEmptyRecycleBin,\ + SHFileOperation,\ + SHGetDataFromIDList,\ + SHGetDiskFreeSpace,\ + SHGetFileInfo,\ + SHGetPathFromIDList,\ + SHGetSpecialFolderPath,\ + SHInvokePrinterCommand,\ + SHQueryRecycleBin,\ + SheChangeDir,\ + SheChangeDirEx,\ + SheFullPath,\ + SheGetDir,\ + SheRemoveQuotes,\ + SheShortenPath,\ + ShellAbout,\ + ShellExecute,\ + ShellExecuteEx,\ + Shell_NotifyIcon,\ + StrChr,\ + StrChrI,\ + StrCmpN,\ + StrCmpNI,\ + StrCpyN,\ + StrNCmp,\ + StrNCmpI,\ + StrNCpy,\ + StrRChr,\ + StrRChrI,\ + StrRStr,\ + StrRStrI,\ + StrStr,\ + StrStrI diff --git a/fasmw172/INCLUDE/API/USER32.INC b/fasmw172/INCLUDE/API/USER32.INC new file mode 100644 index 0000000..bffafa3 --- /dev/null +++ b/fasmw172/INCLUDE/API/USER32.INC @@ -0,0 +1,756 @@ + +; USER32 API calls + +import user32,\ + ActivateKeyboardLayout,'ActivateKeyboardLayout',\ + AdjustWindowRect,'AdjustWindowRect',\ + AdjustWindowRectEx,'AdjustWindowRectEx',\ + AnimateWindow,'AnimateWindow',\ + AnyPopup,'AnyPopup',\ + AppendMenuA,'AppendMenuA',\ + AppendMenuW,'AppendMenuW',\ + ArrangeIconicWindows,'ArrangeIconicWindows',\ + AttachThreadInput,'AttachThreadInput',\ + BeginDeferWindowPos,'BeginDeferWindowPos',\ + BeginPaint,'BeginPaint',\ + BlockInput,'BlockInput',\ + BringWindowToTop,'BringWindowToTop',\ + BroadcastSystemMessageA,'BroadcastSystemMessageA',\ + BroadcastSystemMessageW,'BroadcastSystemMessageW',\ + CallMsgFilterA,'CallMsgFilterA',\ + CallMsgFilterW,'CallMsgFilterW',\ + CallNextHookEx,'CallNextHookEx',\ + CallWindowProcA,'CallWindowProcA',\ + CallWindowProcW,'CallWindowProcW',\ + CascadeChildWindows,'CascadeChildWindows',\ + CascadeWindows,'CascadeWindows',\ + ChangeClipboardChain,'ChangeClipboardChain',\ + ChangeDisplaySettingsA,'ChangeDisplaySettingsA',\ + ChangeDisplaySettingsW,'ChangeDisplaySettingsW',\ + ChangeDisplaySettingsExA,'ChangeDisplaySettingsExA',\ + ChangeDisplaySettingsExW,'ChangeDisplaySettingsExW',\ + ChangeMenuA,'ChangeMenuA',\ + ChangeMenuW,'ChangeMenuW',\ + CharLowerA,'CharLowerA',\ + CharLowerW,'CharLowerW',\ + CharLowerBuffA,'CharLowerBuffA',\ + CharLowerBuffW,'CharLowerBuffW',\ + CharNextA,'CharNextA',\ + CharNextW,'CharNextW',\ + CharNextExA,'CharNextExA',\ + CharNextExW,'CharNextExW',\ + CharPrevA,'CharPrevA',\ + CharPrevW,'CharPrevW',\ + CharPrevExA,'CharPrevExA',\ + CharPrevExW,'CharPrevExW',\ + CharToOemA,'CharToOemA',\ + CharToOemW,'CharToOemW',\ + CharToOemBuffA,'CharToOemBuffA',\ + CharToOemBuffW,'CharToOemBuffW',\ + CharUpperA,'CharUpperA',\ + CharUpperW,'CharUpperW',\ + CharUpperBuffA,'CharUpperBuffA',\ + CharUpperBuffW,'CharUpperBuffW',\ + CheckDlgButton,'CheckDlgButton',\ + CheckMenuItem,'CheckMenuItem',\ + CheckMenuRadioItem,'CheckMenuRadioItem',\ + CheckRadioButton,'CheckRadioButton',\ + ChildWindowFromPoint,'ChildWindowFromPoint',\ + ChildWindowFromPointEx,'ChildWindowFromPointEx',\ + ClientToScreen,'ClientToScreen',\ + ClipCursor,'ClipCursor',\ + CloseClipboard,'CloseClipboard',\ + CloseDesktop,'CloseDesktop',\ + CloseWindow,'CloseWindow',\ + CloseWindowStation,'CloseWindowStation',\ + CopyAcceleratorTableA,'CopyAcceleratorTableA',\ + CopyAcceleratorTableW,'CopyAcceleratorTableW',\ + CopyIcon,'CopyIcon',\ + CopyImage,'CopyImage',\ + CopyRect,'CopyRect',\ + CountClipboardFormats,'CountClipboardFormats',\ + CreateAcceleratorTableA,'CreateAcceleratorTableA',\ + CreateAcceleratorTableW,'CreateAcceleratorTableW',\ + CreateCaret,'CreateCaret',\ + CreateCursor,'CreateCursor',\ + CreateDesktopA,'CreateDesktopA',\ + CreateDesktopW,'CreateDesktopW',\ + CreateDialogIndirectParamA,'CreateDialogIndirectParamA',\ + CreateDialogIndirectParamW,'CreateDialogIndirectParamW',\ + CreateDialogParamA,'CreateDialogParamA',\ + CreateDialogParamW,'CreateDialogParamW',\ + CreateIcon,'CreateIcon',\ + CreateIconFromResource,'CreateIconFromResource',\ + CreateIconFromResourceEx,'CreateIconFromResourceEx',\ + CreateIconIndirect,'CreateIconIndirect',\ + CreateMDIWindowA,'CreateMDIWindowA',\ + CreateMDIWindowW,'CreateMDIWindowW',\ + CreateMenu,'CreateMenu',\ + CreatePopupMenu,'CreatePopupMenu',\ + CreateWindowExA,'CreateWindowExA',\ + CreateWindowExW,'CreateWindowExW',\ + CreateWindowStationA,'CreateWindowStationA',\ + CreateWindowStationW,'CreateWindowStationW',\ + DdeAbandonTransaction,'DdeAbandonTransaction',\ + DdeAccessData,'DdeAccessData',\ + DdeAddData,'DdeAddData',\ + DdeClientTransaction,'DdeClientTransaction',\ + DdeCmpStringHandles,'DdeCmpStringHandles',\ + DdeConnect,'DdeConnect',\ + DdeConnectList,'DdeConnectList',\ + DdeCreateDataHandle,'DdeCreateDataHandle',\ + DdeCreateStringHandleA,'DdeCreateStringHandleA',\ + DdeCreateStringHandleW,'DdeCreateStringHandleW',\ + DdeDisconnect,'DdeDisconnect',\ + DdeDisconnectList,'DdeDisconnectList',\ + DdeEnableCallback,'DdeEnableCallback',\ + DdeFreeDataHandle,'DdeFreeDataHandle',\ + DdeFreeStringHandle,'DdeFreeStringHandle',\ + DdeGetData,'DdeGetData',\ + DdeGetLastError,'DdeGetLastError',\ + DdeGetQualityOfService,'DdeGetQualityOfService',\ + DdeImpersonateClient,'DdeImpersonateClient',\ + DdeInitializeA,'DdeInitializeA',\ + DdeInitializeW,'DdeInitializeW',\ + DdeKeepStringHandle,'DdeKeepStringHandle',\ + DdeNameService,'DdeNameService',\ + DdePostAdvise,'DdePostAdvise',\ + DdeQueryConvInfo,'DdeQueryConvInfo',\ + DdeQueryNextServer,'DdeQueryNextServer',\ + DdeQueryStringA,'DdeQueryStringA',\ + DdeQueryStringW,'DdeQueryStringW',\ + DdeReconnect,'DdeReconnect',\ + DdeSetQualityOfService,'DdeSetQualityOfService',\ + DdeSetUserHandle,'DdeSetUserHandle',\ + DdeUnaccessData,'DdeUnaccessData',\ + DdeUninitialize,'DdeUninitialize',\ + DefDlgProcA,'DefDlgProcA',\ + DefDlgProcW,'DefDlgProcW',\ + DefFrameProcA,'DefFrameProcA',\ + DefFrameProcW,'DefFrameProcW',\ + DefMDIChildProcA,'DefMDIChildProcA',\ + DefMDIChildProcW,'DefMDIChildProcW',\ + DefWindowProcA,'DefWindowProcA',\ + DefWindowProcW,'DefWindowProcW',\ + DeferWindowPos,'DeferWindowPos',\ + DeleteMenu,'DeleteMenu',\ + DestroyAcceleratorTable,'DestroyAcceleratorTable',\ + DestroyCaret,'DestroyCaret',\ + DestroyCursor,'DestroyCursor',\ + DestroyIcon,'DestroyIcon',\ + DestroyMenu,'DestroyMenu',\ + DestroyWindow,'DestroyWindow',\ + DialogBoxIndirectParamA,'DialogBoxIndirectParamA',\ + DialogBoxIndirectParamW,'DialogBoxIndirectParamW',\ + DialogBoxParamA,'DialogBoxParamA',\ + DialogBoxParamW,'DialogBoxParamW',\ + DispatchMessageA,'DispatchMessageA',\ + DispatchMessageW,'DispatchMessageW',\ + DlgDirListA,'DlgDirListA',\ + DlgDirListW,'DlgDirListW',\ + DlgDirListComboBoxA,'DlgDirListComboBoxA',\ + DlgDirListComboBoxW,'DlgDirListComboBoxW',\ + DlgDirSelectComboBoxExA,'DlgDirSelectComboBoxExA',\ + DlgDirSelectComboBoxExW,'DlgDirSelectComboBoxExW',\ + DlgDirSelectExA,'DlgDirSelectExA',\ + DlgDirSelectExW,'DlgDirSelectExW',\ + DragDetect,'DragDetect',\ + DragObject,'DragObject',\ + DrawAnimatedRects,'DrawAnimatedRects',\ + DrawCaption,'DrawCaption',\ + DrawEdge,'DrawEdge',\ + DrawFocusRect,'DrawFocusRect',\ + DrawFrame,'DrawFrame',\ + DrawFrameControl,'DrawFrameControl',\ + DrawIcon,'DrawIcon',\ + DrawIconEx,'DrawIconEx',\ + DrawMenuBar,'DrawMenuBar',\ + DrawStateA,'DrawStateA',\ + DrawStateW,'DrawStateW',\ + DrawTextA,'DrawTextA',\ + DrawTextW,'DrawTextW',\ + DrawTextExA,'DrawTextExA',\ + DrawTextExW,'DrawTextExW',\ + EditWndProc,'EditWndProc',\ + EmptyClipboard,'EmptyClipboard',\ + EnableMenuItem,'EnableMenuItem',\ + EnableScrollBar,'EnableScrollBar',\ + EnableWindow,'EnableWindow',\ + EndDeferWindowPos,'EndDeferWindowPos',\ + EndDialog,'EndDialog',\ + EndMenu,'EndMenu',\ + EndPaint,'EndPaint',\ + EnumChildWindows,'EnumChildWindows',\ + EnumClipboardFormats,'EnumClipboardFormats',\ + EnumDesktopWindows,'EnumDesktopWindows',\ + EnumDesktopsA,'EnumDesktopsA',\ + EnumDesktopsW,'EnumDesktopsW',\ + EnumDisplayMonitors,'EnumDisplayMonitors',\ + EnumDisplaySettingsA,'EnumDisplaySettingsA',\ + EnumDisplaySettingsW,'EnumDisplaySettingsW',\ + EnumDisplaySettingsExA,'EnumDisplaySettingsExA',\ + EnumDisplaySettingsExW,'EnumDisplaySettingsExW',\ + EnumPropsA,'EnumPropsA',\ + EnumPropsW,'EnumPropsW',\ + EnumPropsExA,'EnumPropsExA',\ + EnumPropsExW,'EnumPropsExW',\ + EnumThreadWindows,'EnumThreadWindows',\ + EnumWindowStationsA,'EnumWindowStationsA',\ + EnumWindowStationsW,'EnumWindowStationsW',\ + EnumWindows,'EnumWindows',\ + EqualRect,'EqualRect',\ + ExcludeUpdateRgn,'ExcludeUpdateRgn',\ + ExitWindowsEx,'ExitWindowsEx',\ + FillRect,'FillRect',\ + FindWindowA,'FindWindowA',\ + FindWindowW,'FindWindowW',\ + FindWindowExA,'FindWindowExA',\ + FindWindowExW,'FindWindowExW',\ + FlashWindow,'FlashWindow',\ + FrameRect,'FrameRect',\ + FreeDDElParam,'FreeDDElParam',\ + GetActiveWindow,'GetActiveWindow',\ + GetAltTabInfoA,'GetAltTabInfoA',\ + GetAltTabInfoW,'GetAltTabInfoW',\ + GetAncestor,'GetAncestor',\ + GetAsyncKeyState,'GetAsyncKeyState',\ + GetCapture,'GetCapture',\ + GetCaretBlinkTime,'GetCaretBlinkTime',\ + GetCaretPos,'GetCaretPos',\ + GetClassInfoA,'GetClassInfoA',\ + GetClassInfoW,'GetClassInfoW',\ + GetClassInfoExA,'GetClassInfoExA',\ + GetClassInfoExW,'GetClassInfoExW',\ + GetClassLongA,'GetClassLongA',\ + GetClassLongW,'GetClassLongW',\ + GetClassNameA,'GetClassNameA',\ + GetClassNameW,'GetClassNameW',\ + GetClassWord,'GetClassWord',\ + GetClientRect,'GetClientRect',\ + GetClipCursor,'GetClipCursor',\ + GetClipboardData,'GetClipboardData',\ + GetClipboardFormatNameA,'GetClipboardFormatNameA',\ + GetClipboardFormatNameW,'GetClipboardFormatNameW',\ + GetClipboardSequenceNumberA,'GetClipboardSequenceNumberA',\ + GetClipboardSequenceNumberW,'GetClipboardSequenceNumberW',\ + GetClipboardViewer,'GetClipboardViewer',\ + GetComboBoxInfo,'GetComboBoxInfo',\ + GetCursor,'GetCursor',\ + GetCursorInfo,'GetCursorInfo',\ + GetCursorPos,'GetCursorPos',\ + GetDC,'GetDC',\ + GetDCEx,'GetDCEx',\ + GetDesktopWindow,'GetDesktopWindow',\ + GetDialogBaseUnits,'GetDialogBaseUnits',\ + GetDlgCtrlID,'GetDlgCtrlID',\ + GetDlgItem,'GetDlgItem',\ + GetDlgItemInt,'GetDlgItemInt',\ + GetDlgItemTextA,'GetDlgItemTextA',\ + GetDlgItemTextW,'GetDlgItemTextW',\ + GetDoubleClickTime,'GetDoubleClickTime',\ + GetFocus,'GetFocus',\ + GetForegroundWindow,'GetForegroundWindow',\ + GetGUIThreadInfo,'GetGUIThreadInfo',\ + GetGuiResources,'GetGuiResources',\ + GetIconInfo,'GetIconInfo',\ + GetInputDesktop,'GetInputDesktop',\ + GetInputState,'GetInputState',\ + GetKBCodePage,'GetKBCodePage',\ + GetKeyNameTextA,'GetKeyNameTextA',\ + GetKeyNameTextW,'GetKeyNameTextW',\ + GetKeyState,'GetKeyState',\ + GetKeyboardLayout,'GetKeyboardLayout',\ + GetKeyboardLayoutList,'GetKeyboardLayoutList',\ + GetKeyboardLayoutNameA,'GetKeyboardLayoutNameA',\ + GetKeyboardLayoutNameW,'GetKeyboardLayoutNameW',\ + GetKeyboardState,'GetKeyboardState',\ + GetKeyboardType,'GetKeyboardType',\ + GetLastActivePopup,'GetLastActivePopup',\ + GetLastInputInfo,'GetLastInputInfo',\ + GetLayeredWindowAttributes,'GetLayeredWindowAttributes',\ + GetListBoxInfo,'GetListBoxInfo',\ + GetMenu,'GetMenu',\ + GetMenuBarInfo,'GetMenuBarInfo',\ + GetMenuCheckMarkDimensions,'GetMenuCheckMarkDimensions',\ + GetMenuContextHelpId,'GetMenuContextHelpId',\ + GetMenuDefaultItem,'GetMenuDefaultItem',\ + GetMenuInfo,'GetMenuInfo',\ + GetMenuItemCount,'GetMenuItemCount',\ + GetMenuItemID,'GetMenuItemID',\ + GetMenuItemInfoA,'GetMenuItemInfoA',\ + GetMenuItemInfoW,'GetMenuItemInfoW',\ + GetMenuItemRect,'GetMenuItemRect',\ + GetMenuState,'GetMenuState',\ + GetMenuStringA,'GetMenuStringA',\ + GetMenuStringW,'GetMenuStringW',\ + GetMessageA,'GetMessageA',\ + GetMessageW,'GetMessageW',\ + GetMessageExtraInfo,'GetMessageExtraInfo',\ + GetMessagePos,'GetMessagePos',\ + GetMessageTime,'GetMessageTime',\ + GetMonitorInfoA,'GetMonitorInfoA',\ + GetMonitorInfoW,'GetMonitorInfoW',\ + GetMouseMovePoints,'GetMouseMovePoints',\ + GetNextDlgGroupItem,'GetNextDlgGroupItem',\ + GetNextDlgTabItem,'GetNextDlgTabItem',\ + GetOpenClipboardWindow,'GetOpenClipboardWindow',\ + GetParent,'GetParent',\ + GetPriorityClipboardFormat,'GetPriorityClipboardFormat',\ + GetProcessWindowStation,'GetProcessWindowStation',\ + GetPropA,'GetPropA',\ + GetPropW,'GetPropW',\ + GetQueueStatus,'GetQueueStatus',\ + GetScrollBarInfo,'GetScrollBarInfo',\ + GetScrollInfo,'GetScrollInfo',\ + GetScrollPos,'GetScrollPos',\ + GetScrollRange,'GetScrollRange',\ + GetShellWindow,'GetShellWindow',\ + GetSubMenu,'GetSubMenu',\ + GetSysColor,'GetSysColor',\ + GetSysColorBrush,'GetSysColorBrush',\ + GetSystemMenu,'GetSystemMenu',\ + GetSystemMetrics,'GetSystemMetrics',\ + GetTabbedTextExtentA,'GetTabbedTextExtentA',\ + GetTabbedTextExtentW,'GetTabbedTextExtentW',\ + GetThreadDesktop,'GetThreadDesktop',\ + GetTitleBarInfo,'GetTitleBarInfo',\ + GetTopWindow,'GetTopWindow',\ + GetUpdateRect,'GetUpdateRect',\ + GetUpdateRgn,'GetUpdateRgn',\ + GetUserObjectInformationA,'GetUserObjectInformationA',\ + GetUserObjectInformationW,'GetUserObjectInformationW',\ + GetUserObjectSecurity,'GetUserObjectSecurity',\ + GetWindow,'GetWindow',\ + GetWindowContextHelpId,'GetWindowContextHelpId',\ + GetWindowDC,'GetWindowDC',\ + GetWindowInfo,'GetWindowInfo',\ + GetWindowLongA,'GetWindowLongA',\ + GetWindowLongW,'GetWindowLongW',\ + GetWindowLongPtrA,'GetWindowLongPtrA',\ + GetWindowLongPtrW,'GetWindowLongPtrW',\ + GetWindowModuleFileNameA,'GetWindowModuleFileNameA',\ + GetWindowModuleFileNameW,'GetWindowModuleFileNameW',\ + GetWindowPlacement,'GetWindowPlacement',\ + GetWindowRect,'GetWindowRect',\ + GetWindowRgn,'GetWindowRgn',\ + GetWindowTextA,'GetWindowTextA',\ + GetWindowTextW,'GetWindowTextW',\ + GetWindowTextLengthA,'GetWindowTextLengthA',\ + GetWindowTextLengthW,'GetWindowTextLengthW',\ + GetWindowThreadProcessId,'GetWindowThreadProcessId',\ + GetWindowWord,'GetWindowWord',\ + GrayStringA,'GrayStringA',\ + GrayStringW,'GrayStringW',\ + HideCaret,'HideCaret',\ + HiliteMenuItem,'HiliteMenuItem',\ + IMPGetIMEA,'IMPGetIMEA',\ + IMPGetIMEW,'IMPGetIMEW',\ + IMPQueryIMEA,'IMPQueryIMEA',\ + IMPQueryIMEW,'IMPQueryIMEW',\ + IMPSetIMEA,'IMPSetIMEA',\ + IMPSetIMEW,'IMPSetIMEW',\ + ImpersonateDdeClientWindow,'ImpersonateDdeClientWindow',\ + InSendMessage,'InSendMessage',\ + InSendMessageEx,'InSendMessageEx',\ + InflateRect,'InflateRect',\ + InsertMenuA,'InsertMenuA',\ + InsertMenuW,'InsertMenuW',\ + InsertMenuItemA,'InsertMenuItemA',\ + InsertMenuItemW,'InsertMenuItemW',\ + IntersectRect,'IntersectRect',\ + InvalidateRect,'InvalidateRect',\ + InvalidateRgn,'InvalidateRgn',\ + InvertRect,'InvertRect',\ + IsCharAlphaA,'IsCharAlphaA',\ + IsCharAlphaW,'IsCharAlphaW',\ + IsCharAlphaNumericA,'IsCharAlphaNumericA',\ + IsCharAlphaNumericW,'IsCharAlphaNumericW',\ + IsCharLowerA,'IsCharLowerA',\ + IsCharLowerW,'IsCharLowerW',\ + IsCharUpperA,'IsCharUpperA',\ + IsCharUpperW,'IsCharUpperW',\ + IsChild,'IsChild',\ + IsClipboardFormatAvailable,'IsClipboardFormatAvailable',\ + IsDialogMessageA,'IsDialogMessageA',\ + IsDialogMessageW,'IsDialogMessageW',\ + IsDlgButtonChecked,'IsDlgButtonChecked',\ + IsIconic,'IsIconic',\ + IsMenu,'IsMenu',\ + IsRectEmpty,'IsRectEmpty',\ + IsWindow,'IsWindow',\ + IsWindowEnabled,'IsWindowEnabled',\ + IsWindowUnicode,'IsWindowUnicode',\ + IsWindowVisible,'IsWindowVisible',\ + IsZoomed,'IsZoomed',\ + KillSystemTimer,'KillSystemTimer',\ + KillTimer,'KillTimer',\ + LoadAcceleratorsA,'LoadAcceleratorsA',\ + LoadAcceleratorsW,'LoadAcceleratorsW',\ + LoadBitmapA,'LoadBitmapA',\ + LoadBitmapW,'LoadBitmapW',\ + LoadCursorA,'LoadCursorA',\ + LoadCursorW,'LoadCursorW',\ + LoadCursorFromFileA,'LoadCursorFromFileA',\ + LoadCursorFromFileW,'LoadCursorFromFileW',\ + LoadIconA,'LoadIconA',\ + LoadIconW,'LoadIconW',\ + LoadImageA,'LoadImageA',\ + LoadImageW,'LoadImageW',\ + LoadKeyboardLayoutA,'LoadKeyboardLayoutA',\ + LoadKeyboardLayoutW,'LoadKeyboardLayoutW',\ + LoadMenuA,'LoadMenuA',\ + LoadMenuW,'LoadMenuW',\ + LoadMenuIndirectA,'LoadMenuIndirectA',\ + LoadMenuIndirectW,'LoadMenuIndirectW',\ + LoadStringA,'LoadStringA',\ + LoadStringW,'LoadStringW',\ + LockWindowUpdate,'LockWindowUpdate',\ + LockWorkStation,'LockWorkStation',\ + LookupIconIdFromDirectory,'LookupIconIdFromDirectory',\ + LookupIconIdFromDirectoryEx,'LookupIconIdFromDirectoryEx',\ + MapDialogRect,'MapDialogRect',\ + MapVirtualKeyA,'MapVirtualKeyA',\ + MapVirtualKeyW,'MapVirtualKeyW',\ + MapVirtualKeyExA,'MapVirtualKeyExA',\ + MapVirtualKeyExW,'MapVirtualKeyExW',\ + MapWindowPoints,'MapWindowPoints',\ + MenuItemFromPoint,'MenuItemFromPoint',\ + MessageBeep,'MessageBeep',\ + MessageBoxA,'MessageBoxA',\ + MessageBoxW,'MessageBoxW',\ + MessageBoxExA,'MessageBoxExA',\ + MessageBoxExW,'MessageBoxExW',\ + MessageBoxIndirectA,'MessageBoxIndirectA',\ + MessageBoxIndirectW,'MessageBoxIndirectW',\ + ModifyMenuA,'ModifyMenuA',\ + ModifyMenuW,'ModifyMenuW',\ + MonitorFromPoint,'MonitorFromPoint',\ + MonitorFromRect,'MonitorFromRect',\ + MonitorFromWindow,'MonitorFromWindow',\ + MoveWindow,'MoveWindow',\ + MsgWaitForMultipleObjects,'MsgWaitForMultipleObjects',\ + MsgWaitForMultipleObjectsEx,'MsgWaitForMultipleObjectsEx',\ + NotifyWinEvent,'NotifyWinEvent',\ + OemKeyScan,'OemKeyScan',\ + OemToCharA,'OemToCharA',\ + OemToCharW,'OemToCharW',\ + OemToCharBuffA,'OemToCharBuffA',\ + OemToCharBuffW,'OemToCharBuffW',\ + OffsetRect,'OffsetRect',\ + OpenClipboard,'OpenClipboard',\ + OpenDesktopA,'OpenDesktopA',\ + OpenDesktopW,'OpenDesktopW',\ + OpenIcon,'OpenIcon',\ + OpenInputDesktop,'OpenInputDesktop',\ + OpenWindowStationA,'OpenWindowStationA',\ + OpenWindowStationW,'OpenWindowStationW',\ + PackDDElParam,'PackDDElParam',\ + PaintDesktop,'PaintDesktop',\ + PeekMessageA,'PeekMessageA',\ + PeekMessageW,'PeekMessageW',\ + PostMessageA,'PostMessageA',\ + PostMessageW,'PostMessageW',\ + PostQuitMessage,'PostQuitMessage',\ + PostThreadMessageA,'PostThreadMessageA',\ + PostThreadMessageW,'PostThreadMessageW',\ + PtInRect,'PtInRect',\ + RealChildWindowFromPoint,'RealChildWindowFromPoint',\ + RealGetWindowClassA,'RealGetWindowClassA',\ + RealGetWindowClassW,'RealGetWindowClassW',\ + RedrawWindow,'RedrawWindow',\ + RegisterClassA,'RegisterClassA',\ + RegisterClassW,'RegisterClassW',\ + RegisterClassExA,'RegisterClassExA',\ + RegisterClassExW,'RegisterClassExW',\ + RegisterClipboardFormatA,'RegisterClipboardFormatA',\ + RegisterClipboardFormatW,'RegisterClipboardFormatW',\ + RegisterDeviceNotificationA,'RegisterDeviceNotificationA',\ + RegisterDeviceNotificationW,'RegisterDeviceNotificationW',\ + RegisterHotKey,'RegisterHotKey',\ + RegisterWindowMessageA,'RegisterWindowMessageA',\ + RegisterWindowMessageW,'RegisterWindowMessageW',\ + ReleaseCapture,'ReleaseCapture',\ + ReleaseDC,'ReleaseDC',\ + RemoveMenu,'RemoveMenu',\ + RemovePropA,'RemovePropA',\ + RemovePropW,'RemovePropW',\ + ReplyMessage,'ReplyMessage',\ + ReuseDDElParam,'ReuseDDElParam',\ + ScreenToClient,'ScreenToClient',\ + ScrollChildren,'ScrollChildren',\ + ScrollDC,'ScrollDC',\ + ScrollWindow,'ScrollWindow',\ + ScrollWindowEx,'ScrollWindowEx',\ + SendDlgItemMessageA,'SendDlgItemMessageA',\ + SendDlgItemMessageW,'SendDlgItemMessageW',\ + SendIMEMessageExA,'SendIMEMessageExA',\ + SendIMEMessageExW,'SendIMEMessageExW',\ + SendInput,'SendInput',\ + SendMessageA,'SendMessageA',\ + SendMessageW,'SendMessageW',\ + SendMessageCallbackA,'SendMessageCallbackA',\ + SendMessageCallbackW,'SendMessageCallbackW',\ + SendMessageTimeoutA,'SendMessageTimeoutA',\ + SendMessageTimeoutW,'SendMessageTimeoutW',\ + SendNotifyMessageA,'SendNotifyMessageA',\ + SendNotifyMessageW,'SendNotifyMessageW',\ + SetActiveWindow,'SetActiveWindow',\ + SetCapture,'SetCapture',\ + SetCaretBlinkTime,'SetCaretBlinkTime',\ + SetCaretPos,'SetCaretPos',\ + SetClassLongA,'SetClassLongA',\ + SetClassLongW,'SetClassLongW',\ + SetClassWord,'SetClassWord',\ + SetClipboardData,'SetClipboardData',\ + SetClipboardViewer,'SetClipboardViewer',\ + SetCursor,'SetCursor',\ + SetCursorPos,'SetCursorPos',\ + SetDebugErrorLevel,'SetDebugErrorLevel',\ + SetDeskWallpaper,'SetDeskWallpaper',\ + SetDlgItemInt,'SetDlgItemInt',\ + SetDlgItemTextA,'SetDlgItemTextA',\ + SetDlgItemTextW,'SetDlgItemTextW',\ + SetDoubleClickTime,'SetDoubleClickTime',\ + SetFocus,'SetFocus',\ + SetForegroundWindow,'SetForegroundWindow',\ + SetKeyboardState,'SetKeyboardState',\ + SetLastErrorEx,'SetLastErrorEx',\ + SetLayeredWindowAttributes,'SetLayeredWindowAttributes',\ + SetMenu,'SetMenu',\ + SetMenuContextHelpId,'SetMenuContextHelpId',\ + SetMenuDefaultItem,'SetMenuDefaultItem',\ + SetMenuInfo,'SetMenuInfo',\ + SetMenuItemBitmaps,'SetMenuItemBitmaps',\ + SetMenuItemInfoA,'SetMenuItemInfoA',\ + SetMenuItemInfoW,'SetMenuItemInfoW',\ + SetMessageExtraInfo,'SetMessageExtraInfo',\ + SetMessageQueue,'SetMessageQueue',\ + SetParent,'SetParent',\ + SetProcessWindowStation,'SetProcessWindowStation',\ + SetPropA,'SetPropA',\ + SetPropW,'SetPropW',\ + SetRect,'SetRect',\ + SetRectEmpty,'SetRectEmpty',\ + SetScrollInfo,'SetScrollInfo',\ + SetScrollPos,'SetScrollPos',\ + SetScrollRange,'SetScrollRange',\ + SetShellWindow,'SetShellWindow',\ + SetSysColors,'SetSysColors',\ + SetSystemCursor,'SetSystemCursor',\ + SetSystemMenu,'SetSystemMenu',\ + SetSystemTimer,'SetSystemTimer',\ + SetThreadDesktop,'SetThreadDesktop',\ + SetTimer,'SetTimer',\ + SetUserObjectInformationA,'SetUserObjectInformationA',\ + SetUserObjectInformationW,'SetUserObjectInformationW',\ + SetUserObjectSecurity,'SetUserObjectSecurity',\ + SetWinEventHook,'SetWinEventHook',\ + SetWindowContextHelpId,'SetWindowContextHelpId',\ + SetWindowLongA,'SetWindowLongA',\ + SetWindowLongW,'SetWindowLongW',\ + SetWindowPlacement,'SetWindowPlacement',\ + SetWindowPos,'SetWindowPos',\ + SetWindowRgn,'SetWindowRgn',\ + SetWindowTextA,'SetWindowTextA',\ + SetWindowTextW,'SetWindowTextW',\ + SetWindowWord,'SetWindowWord',\ + SetWindowsHookA,'SetWindowsHookA',\ + SetWindowsHookW,'SetWindowsHookW',\ + SetWindowsHookExA,'SetWindowsHookExA',\ + SetWindowsHookExW,'SetWindowsHookExW',\ + ShowCaret,'ShowCaret',\ + ShowCursor,'ShowCursor',\ + ShowOwnedPopups,'ShowOwnedPopups',\ + ShowScrollBar,'ShowScrollBar',\ + ShowWindow,'ShowWindow',\ + ShowWindowAsync,'ShowWindowAsync',\ + SubtractRect,'SubtractRect',\ + SwapMouseButton,'SwapMouseButton',\ + SwitchDesktop,'SwitchDesktop',\ + SystemParametersInfoA,'SystemParametersInfoA',\ + SystemParametersInfoW,'SystemParametersInfoW',\ + TabbedTextOutA,'TabbedTextOutA',\ + TabbedTextOutW,'TabbedTextOutW',\ + TileChildWindows,'TileChildWindows',\ + TileWindows,'TileWindows',\ + ToAscii,'ToAscii',\ + ToAsciiEx,'ToAsciiEx',\ + ToUnicode,'ToUnicode',\ + ToUnicodeEx,'ToUnicodeEx',\ + TrackMouseEvent,'TrackMouseEvent',\ + TrackPopupMenu,'TrackPopupMenu',\ + TrackPopupMenuEx,'TrackPopupMenuEx',\ + TranslateAcceleratorA,'TranslateAcceleratorA',\ + TranslateAcceleratorW,'TranslateAcceleratorW',\ + TranslateMDISysAccel,'TranslateMDISysAccel',\ + TranslateMessage,'TranslateMessage',\ + UnhookWinEvent,'UnhookWinEvent',\ + UnhookWindowsHook,'UnhookWindowsHook',\ + UnhookWindowsHookEx,'UnhookWindowsHookEx',\ + UnionRect,'UnionRect',\ + UnloadKeyboardLayout,'UnloadKeyboardLayout',\ + UnpackDDElParam,'UnpackDDElParam',\ + UnregisterClassA,'UnregisterClassA',\ + UnregisterClassW,'UnregisterClassW',\ + UnregisterDeviceNotification,'UnregisterDeviceNotification',\ + UnregisterHotKey,'UnregisterHotKey',\ + UpdateWindow,'UpdateWindow',\ + UserHandleGrantAccess,'UserHandleGrantAccess',\ + ValidateRect,'ValidateRect',\ + ValidateRgn,'ValidateRgn',\ + VkKeyScanA,'VkKeyScanA',\ + VkKeyScanW,'VkKeyScanW',\ + VkKeyScanExA,'VkKeyScanExA',\ + VkKeyScanExW,'VkKeyScanExW',\ + WINNLSEnableIME,'WINNLSEnableIME',\ + WINNLSGetEnableStatus,'WINNLSGetEnableStatus',\ + WINNLSGetIMEHotkey,'WINNLSGetIMEHotkey',\ + WaitForInputIdle,'WaitForInputIdle',\ + WaitMessage,'WaitMessage',\ + WinHelpA,'WinHelpA',\ + WinHelpW,'WinHelpW',\ + WindowFromDC,'WindowFromDC',\ + WindowFromPoint,'WindowFromPoint',\ + keybd_event,'keybd_event',\ + mouse_event,'mouse_event',\ + wsprintfA,'wsprintfA',\ + wsprintfW,'wsprintfW',\ + wvsprintfA,'wvsprintfA',\ + wvsprintfW,'wvsprintfW' + +api AppendMenu,\ + BroadcastSystemMessage,\ + CallMsgFilter,\ + CallWindowProc,\ + ChangeDisplaySettings,\ + ChangeDisplaySettingsEx,\ + ChangeMenu,\ + CharLower,\ + CharLowerBuff,\ + CharNext,\ + CharNextEx,\ + CharPrev,\ + CharPrevEx,\ + CharToOem,\ + CharToOemBuff,\ + CharUpper,\ + CharUpperBuff,\ + CopyAcceleratorTable,\ + CreateAcceleratorTable,\ + CreateDesktop,\ + CreateDialogIndirectParam,\ + CreateDialogParam,\ + CreateMDIWindow,\ + CreateWindowEx,\ + CreateWindowStation,\ + DdeCreateStringHandle,\ + DdeInitialize,\ + DdeQueryString,\ + DefDlgProc,\ + DefFrameProc,\ + DefMDIChildProc,\ + DefWindowProc,\ + DialogBoxIndirectParam,\ + DialogBoxParam,\ + DispatchMessage,\ + DlgDirList,\ + DlgDirListComboBox,\ + DlgDirSelectComboBoxEx,\ + DlgDirSelectEx,\ + DrawState,\ + DrawText,\ + DrawTextEx,\ + EnumDesktops,\ + EnumDisplaySettings,\ + EnumDisplaySettingsEx,\ + EnumProps,\ + EnumPropsEx,\ + EnumWindowStations,\ + FindWindow,\ + FindWindowEx,\ + GetAltTabInfo,\ + GetClassInfo,\ + GetClassInfoEx,\ + GetClassLong,\ + GetClassName,\ + GetClipboardFormatName,\ + GetClipboardSequenceNumber,\ + GetDlgItemText,\ + GetKeyNameText,\ + GetKeyboardLayoutName,\ + GetMenuItemInfo,\ + GetMenuString,\ + GetMessage,\ + GetMonitorInfo,\ + GetProp,\ + GetTabbedTextExtent,\ + GetUserObjectInformation,\ + GetWindowLong,\ + GetWindowModuleFileName,\ + GetWindowText,\ + GetWindowTextLength,\ + GrayString,\ + IMPGetIME,\ + IMPQueryIME,\ + IMPSetIME,\ + InsertMenu,\ + InsertMenuItem,\ + IsCharAlpha,\ + IsCharAlphaNumeric,\ + IsCharLower,\ + IsCharUpper,\ + IsDialogMessage,\ + LoadAccelerators,\ + LoadBitmap,\ + LoadCursor,\ + LoadCursorFromFile,\ + LoadIcon,\ + LoadImage,\ + LoadKeyboardLayout,\ + LoadMenu,\ + LoadMenuIndirect,\ + LoadString,\ + MapVirtualKey,\ + MapVirtualKeyEx,\ + MessageBox,\ + MessageBoxEx,\ + MessageBoxIndirect,\ + ModifyMenu,\ + OemToChar,\ + OemToCharBuff,\ + OpenDesktop,\ + OpenWindowStation,\ + PeekMessage,\ + PostMessage,\ + PostThreadMessage,\ + RealGetWindowClass,\ + RegisterClass,\ + RegisterClassEx,\ + RegisterClipboardFormat,\ + RegisterDeviceNotification,\ + RegisterWindowMessage,\ + RemoveProp,\ + SendDlgItemMessage,\ + SendIMEMessageEx,\ + SendMessage,\ + SendMessageCallback,\ + SendMessageTimeout,\ + SendNotifyMessage,\ + SetClassLong,\ + SetDlgItemText,\ + SetMenuItemInfo,\ + SetProp,\ + SetUserObjectInformation,\ + SetWindowLong,\ + SetWindowText,\ + SetWindowsHook,\ + SetWindowsHookEx,\ + SystemParametersInfo,\ + TabbedTextOut,\ + TranslateAccelerator,\ + UnregisterClass,\ + VkKeyScan,\ + VkKeyScanEx,\ + WinHelp,\ + wsprintf,\ + wvsprintf diff --git a/fasmw172/INCLUDE/API/WSOCK32.INC b/fasmw172/INCLUDE/API/WSOCK32.INC new file mode 100644 index 0000000..8b8edb6 --- /dev/null +++ b/fasmw172/INCLUDE/API/WSOCK32.INC @@ -0,0 +1,85 @@ + +; WSOCK32 API calls + +import wsock32,\ + AcceptEx,'AcceptEx',\ + EnumProtocolsA,'EnumProtocolsA',\ + EnumProtocolsW,'EnumProtocolsW',\ + GetAcceptExSockaddrs,'GetAcceptExSockaddrs',\ + GetAddressByNameA,'GetAddressByNameA',\ + GetAddressByNameW,'GetAddressByNameW',\ + GetNameByTypeA,'GetNameByTypeA',\ + GetNameByTypeW,'GetNameByTypeW',\ + GetServiceA,'GetServiceA',\ + GetServiceW,'GetServiceW',\ + GetTypeByNameA,'GetTypeByNameA',\ + GetTypeByNameW,'GetTypeByNameW',\ + MigrateWinsockConfiguration,'MigrateWinsockConfiguration',\ + NPLoadNameSpaces,'NPLoadNameSpaces',\ + SetServiceA,'SetServiceA',\ + SetServiceW,'SetServiceW',\ + TransmitFile,'TransmitFile',\ + WEP,'WEP',\ + WSAAsyncGetHostByAddr,'WSAAsyncGetHostByAddr',\ + WSAAsyncGetHostByName,'WSAAsyncGetHostByName',\ + WSAAsyncGetProtoByName,'WSAAsyncGetProtoByName',\ + WSAAsyncGetProtoByNumber,'WSAAsyncGetProtoByNumber',\ + WSAAsyncGetServByName,'WSAAsyncGetServByName',\ + WSAAsyncGetServByPort,'WSAAsyncGetServByPort',\ + WSAAsyncSelect,'WSAAsyncSelect',\ + WSACancelAsyncRequest,'WSACancelAsyncRequest',\ + WSACancelBlockingCall,'WSACancelBlockingCall',\ + WSACleanup,'WSACleanup',\ + WSAGetLastError,'WSAGetLastError',\ + WSAIsBlocking,'WSAIsBlocking',\ + WSARecvEx,'WSARecvEx',\ + WSASetBlockingHook,'WSASetBlockingHook',\ + WSASetLastError,'WSASetLastError',\ + WSAStartup,'WSAStartup',\ + WSAUnhookBlockingHook,'WSAUnhookBlockingHook',\ + __WSAFDIsSet,'__WSAFDIsSet',\ + accept,'accept',\ + bind,'bind',\ + closesocket,'closesocket',\ + connect,'connect',\ + dn_expand,'dn_expand',\ + gethostbyaddr,'gethostbyaddr',\ + gethostbyname,'gethostbyname',\ + gethostname,'gethostname',\ + getnetbyname,'getnetbyname',\ + getpeername,'getpeername',\ + getprotobyname,'getprotobyname',\ + getprotobynumber,'getprotobynumber',\ + getservbyname,'getservbyname',\ + getservbyport,'getservbyport',\ + getsockname,'getsockname',\ + getsockopt,'getsockopt',\ + htonl,'htonl',\ + htons,'htons',\ + inet_addr,'inet_addr',\ + inet_network,'inet_network',\ + inet_ntoa,'inet_ntoa',\ + ioctlsocket,'ioctlsocket',\ + listen,'listen',\ + ntohl,'ntohl',\ + ntohs,'ntohs',\ + rcmd,'rcmd',\ + recv,'recv',\ + recvfrom,'recvfrom',\ + rexec,'rexec',\ + rresvport,'rresvport',\ + s_perror,'s_perror',\ + select,'select',\ + send,'send',\ + sendto,'sendto',\ + sethostname,'sethostname',\ + setsockopt,'setsockopt',\ + shutdown,'shutdown',\ + socket,'socket' + +api EnumProtocols,\ + GetAddressByName,\ + GetNameByType,\ + GetService,\ + GetTypeByName,\ + SetService diff --git a/fasmw172/INCLUDE/ENCODING/UTF8.INC b/fasmw172/INCLUDE/ENCODING/UTF8.INC new file mode 100644 index 0000000..83383ff --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/UTF8.INC @@ -0,0 +1,77 @@ + +; UTF-8 + +macro du [arg] + { local current,..input,char + if arg eqtype '' + virtual at 0 + ..input:: + db arg + count = $ + end virtual + current = 0 + while current < count + load char byte from ..input:current + wide = char + current = current + 1 + if char > 0C0h + if char < 0E0h + wide = char and 11111b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + current = current + 1 + else if char < 0F0h + wide = char and 1111b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + current = current + 2 + else if char < 0F8h + wide = char and 111b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+2 + wide = wide shl 6 + (char and 111111b) + current = current + 3 + else if char < 0FCh + wide = char and 11b + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+2 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+3 + wide = wide shl 6 + (char and 111111b) + current = current + 4 + else + wide = char and 1 + load char byte from ..input:current + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+1 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+2 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+3 + wide = wide shl 6 + (char and 111111b) + load char byte from ..input:current+4 + wide = wide shl 6 + (char and 111111b) + current = current + 5 + end if + end if + if wide < 10000h + dw wide + else + dw 0D7C0h + wide shr 10,0DC00h or (wide and 3FFh) + end if + end while + else + dw arg + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1250.INC b/fasmw172/INCLUDE/ENCODING/WIN1250.INC new file mode 100644 index 0000000..afd2b6d --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1250.INC @@ -0,0 +1,36 @@ + +; Windows 1250 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,?,201Eh,2026h,2020h,2021h,?,2030h,160h,2039h,15Ah,164h,17Dh,179h + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,161h,203Ah,15Bh,165h,17Eh,17Ah + dw 0A0h,2C7h,2D8h,141h,0A4h,104h,0A6h,0A7h,0A8h,0A9h,15Eh,0ABh,0ACh,0ADh,0AEh,17Bh + dw 0B0h,0B1h,2DBh,142h,0B4h,0B5h,0B6h,0B7h,0B8h,105h,15Fh,0BBh,13Dh,2DDh,13Eh,17Ch + dw 154h,0C1h,0C2h,102h,0C4h,139h,106h,0C7h,10Ch,0C9h,118h,0CBh,11Ah,0CDh,0CEh,10Eh + dw 110h,143h,147h,0D3h,0D4h,150h,0D6h,0D7h,158h,16Eh,0DAh,170h,0DCh,0DDh,162h,0DFh + dw 155h,0E1h,0E2h,103h,0E4h,13Ah,107h,0E7h,10Dh,0E9h,119h,0EBh,11Bh,0EDh,0EEh,10Fh + dw 111h,144h,148h,0F3h,0F4h,151h,0F6h,0F7h,159h,16Fh,0FAh,171h,0FCh,0FDh,163h,2D9h +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1251.INC b/fasmw172/INCLUDE/ENCODING/WIN1251.INC new file mode 100644 index 0000000..ce6766a --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1251.INC @@ -0,0 +1,33 @@ + +; Windows 1251 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 401h,403h,201Ah,453h,201Eh,2026h,2020h,2021h,20ACh,2030h,409h,2039h,40Ah,40Ch,40Bh,40Fh + dw 452h,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,459h,203Ah,45Ah,45Ch,45Bh,45Fh + dw 0A0h,40Eh,45Eh,408h,0A4h,490h,0A6h,0A7h,401h,0A9h,404h,0ABh,0ACh,0ADh,0AEh,407h + dw 0B0h,0B1h,406h,456h,491h,0B5h,0B6h,0B7h,451h,2116h,454h,0BBh,458h,405h,455h,457h + times 40h dw 410h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1252.INC b/fasmw172/INCLUDE/ENCODING/WIN1252.INC new file mode 100644 index 0000000..09227f9 --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1252.INC @@ -0,0 +1,31 @@ + +; Windows 1252 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,160h,2039h,152h,?,17D,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,161h,203Ah,153h,?,17Eh,178h + times 60h dw 0A0h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1253.INC b/fasmw172/INCLUDE/ENCODING/WIN1253.INC new file mode 100644 index 0000000..8ae3c37 --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1253.INC @@ -0,0 +1,33 @@ + +; Windows 1253 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,?,2030h,?,2039h,?,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,?,203Ah,?,?,?,? + dw 0A0h,385h,386h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,?,0ABh,0ACh,0ADh,0AEh,2015h + dw 0B0h,0B1h,0B2h,0B3h,384h,0B5h,0B6h,0B7h,288h,389h,38Ah,0BBh,38Ch,0BDh,38Eh,38Fh + times 40h dw 390h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1254.INC b/fasmw172/INCLUDE/ENCODING/WIN1254.INC new file mode 100644 index 0000000..f4fd06c --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1254.INC @@ -0,0 +1,34 @@ + +; Windows 1254 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,160h,2039h,152h,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,161h,203Ah,153h,?,?,178h + times 30h dw 0A0h+%-1 + dw 11Eh,0D1h,0D2h,0D3h,0D4h,0D5h,0D6h,0D7h,0D8h,0D9h,0DAh,0DBh,0DCh,130h,15Eh,0DFh + times 10h dw 0E0h+%-1 + dw 11Fh,0F1h,0F2h,0F3h,0F4h,0F5h,0F6h,0F7h,0F8h,0F9h,0FAh,0FBh,0FCh,131h,15Fh,0FFh +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1255.INC b/fasmw172/INCLUDE/ENCODING/WIN1255.INC new file mode 100644 index 0000000..16bcdcd --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1255.INC @@ -0,0 +1,36 @@ + +; Windows 1255 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,?,2039h,?,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,?,203Ah,?,?,?,? + dw 0A0h,0A1h,0A2h,0A3h,20AAh,0A5h,0A6h,0A7h,0A8h,0A9h,0D7h,0ABh,0ACh,0ADh,0AEh,0AFh + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0F7h,0BBh,0BCh,0BDh,0BEh,0BFh + dw 5B0h,5B1h,5B2h,5B3h,5B4h,5B5h,5B6h,5B7h,5B8h,5B9h,?,5BBh,5BCh,5BDh,5BEh,5BFh + dw 5C0h,5C1h,5C2h,5C3h,5F0h,5F1h,5F2h,5F3h,5F4h,?,?,?,?,?,?,? + dw 5D0h,5D1h,5D2h,5D3h,5D4h,5D5h,5D6h,5D7h,5D8h,5D9h,5DAh,5DBh,5DCh,5DDh,5DEh,5DFh + dw 5E0h,5E1h,5E2h,5E3h,5E4h,5E5h,5E6h,5E7h,5E8h,5E9h,5EAh,?,?,200Eh,200Fh,? +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1256.INC b/fasmw172/INCLUDE/ENCODING/WIN1256.INC new file mode 100644 index 0000000..57d1738 --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1256.INC @@ -0,0 +1,36 @@ + +; Windows 1256 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,67Eh,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,679h,2039h,152h,686h,698h,688h + dw 6AFh,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,6A9h,2122h,691h,203Ah,153h,200Ch,200Dh,6BAh + dw 0A0h,60Ch,0A2h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,6BEh,0ABh,0ACh,0ADh,0AEh,0AFh + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0BAh,0BBh,0BCh,0BDh,0BEh,0BFh + dw 6C1h,621h,622h,623h,624h,625h,626h,627h,628h,629h,62Ah,62Bh,62Ch,62Dh,62Eh,62Fh + dw 630h,631h,632h,633h,634h,635h,636h,0D7h,637h,638h,639h,63Ah,640h,641h,642h,643h + dw 0E0h,644h,0E2h,645h,646h,647h,648h,0E7h,0E8h,0E9h,0EAh,0EBh,649h,64Ah,0EEh,0EFh + dw 64Bh,64Ch,64Dh,64Eh,0F4h,64Fh,650h,0F7h,651h,0F9h,652h,0FBh,0FCh,200Eh,200Fh,6D2h +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1257.INC b/fasmw172/INCLUDE/ENCODING/WIN1257.INC new file mode 100644 index 0000000..c1bc4f9 --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1257.INC @@ -0,0 +1,36 @@ + +; Windows 1257 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,?,201Eh,2026h,2020h,2021h,?,2030h,?,2039h,?,0A8h,2C7h,0B8h + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,?,203Ah,?,0AFh,2DBh,? + dw 0A0h,?,0A2h,0A3h,0A4h,?,0A6h,0A7h,0D8h,0A9h,156h,0ABh,0ACh,0ADh,0AEh,0C6h + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0F8h,0B9h,157h,0BBh,0BCh,0BDh,0BEh,0E6h + dw 104h,12Eh,100h,106h,0C4h,0C5h,118h,112h,10Ch,0C9h,179h,116h,122h,136h,12Ah,13Bh + dw 160h,143h,145h,0D3h,14Ch,0D5h,0D6h,0D7h,172h,141h,15Ah,16Ah,0DCh,17Bh,17Dh,0DFh + dw 105h,12Fh,101h,107h,0E4h,0E5h,119h,113h,10Dh,0E9h,17Ah,117h,123h,137h,12Bh,13Ch + dw 161h,144h,146h,0F3h,14Dh,0F5h,0F6h,0F7h,173h,142h,15Bh,16Bh,0FCh,17Ch,17Eh,2D9h +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN1258.INC b/fasmw172/INCLUDE/ENCODING/WIN1258.INC new file mode 100644 index 0000000..c9fdb30 --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN1258.INC @@ -0,0 +1,36 @@ + +; Windows 1258 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,?,2039h,152h,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,?,203Ah,153h,?,?,178h + dw 0A0h,0A1h,0A2h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,0AAh,0ABh,0ACh,0ADh,0AEh,0AFh + dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0BAh,0BBh,0BCh,0BDh,0BEh,0BFh + dw 0C0h,0C1h,0C2h,102h,0C4h,0C5h,0C6h,0C7h,0C8h,0C9h,0CAh,0CBh,300h,0CDh,0CEh,0CFh + dw 110h,0D1h,309h,0D3h,0D4h,1A0h,0D6h,0D7h,0D8h,0D9h,0DAh,0DBh,0DCh,1AFh,303h,0DFh + dw 0E0h,0E1h,0E2h,103h,0E4h,0E5h,0E6h,0E7h,0E8h,0E9h,0EAh,0EBh,301h,0EDh,0EEh,0EFh + dw 111h,0F1h,323h,0F3h,0F4h,1A1h,0F6h,0F7h,0F8h,0F9h,0FAh,0FBh,0FCh,1B0h,20ABh,0FFh +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/ENCODING/WIN874.INC b/fasmw172/INCLUDE/ENCODING/WIN874.INC new file mode 100644 index 0000000..a6c5845 --- /dev/null +++ b/fasmw172/INCLUDE/ENCODING/WIN874.INC @@ -0,0 +1,31 @@ + +; Windows 874 + +rept 1 { local ..encoding + __encoding equ ..encoding } + +virtual at 0 + __encoding:: + times 80h dw %-1 + dw 20ACh,?,?,?,?,2026h,?,?,?,?,?,?,?,?,?,? + dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,?,?,?,?,?,?,? + times 60h dw 0E00h+%-1 +end virtual + +macro du [arg] + { local offset,char + offset = $-$$ + du arg + if arg eqtype '' + repeat ($-offset-$$)/2 + load char byte from $$+offset+(%-1)*2 + if char > 7Fh + load char word from __encoding:char*2 + store word char at $$+offset+(%-1)*2 + end if + end repeat + end if } + +struc du [args] + { common label . word + du args } diff --git a/fasmw172/INCLUDE/EQUATES/COMCTL32.INC b/fasmw172/INCLUDE/EQUATES/COMCTL32.INC new file mode 100644 index 0000000..6e5deb4 --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/COMCTL32.INC @@ -0,0 +1,1869 @@ + +; COMCTL32.DLL structures and constants + +struct PROPSHEETPAGE + dwSize dd ? + dwFlags dd ? + hInstance dd ? + pszTemplate dd ? + pszIcon dd ? + pszTitle dd ? + pfnDlgProc dd ? + lParam dd ? + pfnCallback dd ? + pcRefParent dd ? +ends + +struct PROPSHEETHEADER + dwSize dd ? + dwFlags dd ? + hwndParent dd ? + hInstance dd ? + pszIcon dd ? + pszCaption dd ? + nPages dd ? + pStartPage dd ? + ppsp dd ? + pfnCallback dd ? +ends + +struct IMAGEINFO + hbmImage dd ? + hbmMask dd ? + Unused1 dd ? + Unused2 dd ? + rcImage RECT +ends + +struct HD_ITEM + mask dd ? + cxy dd ? + pszText dd ? + hbm dd ? + cchTextMax dd ? + fmt dd ? + lParam dd ? +ends + +struct HD_LAYOUT + prc dd ? + pwpos dd ? +ends + +struct HD_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct HD_NOTIFY + hdr NMHDR + iItem dd ? + iButton dd ? + pitem dd ? +ends + +struct TBBUTTON + iBitmap dd ? + idCommand dd ? + fsState db ? + fsStyle db ? + dw ? + dwData dd ? + iString dd ? +ends + +struct COLORMAP + from dd ? + to dd ? +ends + +struct TBADDBITMAP + hInst dd ? + nID dd ? +ends + +struct TBSAVEPARAMS + hkr dd ? + pszSubKey dd ? + pszValueName dd ? +ends + +struct TBREPLACEBITMAP + hInstOld dd ? + nIDOld dd ? + hInstNew dd ? + nIDNew dd ? + nButtons dd ? +ends + +struct NMTOOLBAR + hdr NMHDR + iItem dd ? + tbButton TBBUTTON + cchText dd ? + pszText dd ? +ends + +struct REBARINFO + cbSize dd ? + fMask dd ? + himl dd ? +ends + +struct REBARBANDINFO + cbSize dd ? + fMask dd ? + fStyle dd ? + clrFore dd ? + clrBack dd ? + lpText dd ? + cch dd ? + iImage dd ? + hwndChild dd ? + cxMinChild dd ? + cyMinChild dd ? + cx dd ? + hbmBack dd ? + wID dd ? +ends + +struct TOOLINFO + cbSize dd ? + uFlags dd ? + hwnd dd ? + uId dd ? + rect RECT + hInst dd ? + lpszText dd ? +ends + +struct TTHITTESTINFO + hwnd dd ? + pt POINT + ti TOOLINFO +ends + +struct TOOLTIPTEXT + hdr NMHDR + lpszText dd ? + szText db 80 dup (?) + hinst dd ? + uFlags dd ? +ends + +struct UDACCEL + nSec dd ? + nInc dd ? +ends + +struct NM_UPDOWN + hdr NMHDR + iPos dd ? + iDelta dd ? +ends + +struct LV_ITEM + mask dd ? + iItem dd ? + iSubItem dd ? + state dd ? + stateMask dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? + lParam dd ? + iIndent dd ? +ends + +struct LV_FINDINFO + flags dd ? + psz dd ? + lParam dd ? + pt POINT + vkDirection dd ? +ends + +struct LV_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct LV_COLUMN + mask dd ? + fmt dd ? + cx dd ? + pszText dd ? + cchTextMax dd ? + iSubItem dd ? +ends + +struct NM_LISTVIEW + hdr NMHDR + iItem dd ? + iSubItem dd ? + uNewState dd ? + uOldState dd ? + uChanged dd ? + ptAction POINT + lParam dd ? +ends + +struct NM_CACHEHINT + hdr NMHDR + iFrom dd ? + iTo dd ? +ends + +struct NM_FINDITEM + hdr NMHDR + iStart dd ? + lvfi LV_FINDINFO +ends + +struct LV_DISPINFO + hdr NMHDR + item LV_ITEM +ends + +struct LV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TV_ITEM + mask dd ? + hItem dd ? + state dd ? + stateMask dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? + iSelectedImage dd ? + cChildren dd ? + lParam dd ? +ends + +struct TV_INSERTSTRUCT + hParent dd ? + hInsertAfter dd ? + item TV_ITEM +ends + +struct TV_HITTESTINFO + pt POINT + flags dd ? + hItem dd ? +ends + +struct TV_SORTCB + hParent dd ? + lpfnCompare dd ? + lParam dd ? +ends + +struct NM_TREEVIEW + hdr NMHDR + action dd ? + itemOld TV_ITEM + itemNew TV_ITEM + ptDrag POINT +ends + +struct TV_DISPINFO + hdr NMHDR + item TV_ITEM +ends + +struct TV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TC_ITEMHEADER + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? +ends + +struct TC_ITEM + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ? + pszText dd ? + cchTextMax dd ? + iImage dd ? + lParam dd ? +ends + +struct TC_HITTESTINFO + pt POINT + flags dd ? +ends + +struct TC_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct MC_HITTESTINFO + cbSize dd ? + pt POINT + uHit dd ? + st SYSTEMTIME +ends + +struct NM_SELCHANGE + nmhdr NMHDR + stSelStart SYSTEMTIME + stSelEnd SYSTEMTIME +ends + +struct NM_DAYSTATE + nmhdr NMHDR + stStart SYSTEMTIME + cDayState dd ? + prgDayState dd ? +ends + +struct NM_DATETIMECHANGE + nmhdr NMHDR + dwFlags dd ? + st SYSTEMTIME +ends + +struct NM_DATETIMESTRING + nmhdr NMHDR + pszUserString dd ? + st SYSTEMTIME + dwFlags dd ? +ends + +struct NM_DATETIMEWMKEYDOWN + nmhdr NMHDR + nVirtKey dd ? + pszFormat dd ? + st SYSTEMTIME +ends + +struct NM_DATETIMEFORMAT + nmhdr NMHDR + pszFormat dd ? + st SYSTEMTIME + pszDisplay dd ? + szDisplay db 64 dup (?) +ends + +struct NM_DATETIMEFORMATQUERY + nmhdr NMHDR + pszFormat dd ? + szMax SIZE +ends + +struct INITCOMMONCONTROLSEX + dwSize dd ? + dwICC dd ? +ends + +; Common control window classes + +HOTKEY_CLASS equ 'msctls_hotkey32' +PROGRESS_CLASS equ 'msctls_progress32' +STATUS_CLASS equ 'msctls_statusbar32' +TRACKBAR_CLASS equ 'msctls_trackbar32' +UPDOWN_CLASS equ 'msctls_updown32' +TOOLTIPS_CLASS equ 'tooltips_class32' +ANIMATE_CLASS equ 'SysAnimate32' +HEADER_CLASS equ 'SysHeader32' +LISTVIEW_CLASS equ 'SysListView32' +TREEVIEW_CLASS equ 'SysTreeView32' +TABCONTROL_CLASS equ 'SysTabControl32' +MONTHCAL_CLASS equ 'SysMonthCal32' +DATETIMEPICK_CLASS equ 'SysDateTimePick32' +TOOLBAR_CLASS equ 'ToolbarWindow32' +REBAR_CLASS equ 'ReBarWindow32' + +; Ranges for control message IDs + +LVM_FIRST = 1000h +TV_FIRST = 1100h +HDM_FIRST = 1200h +TCM_FIRST = 1300h +MCM_FIRST = 1000h +DTM_FIRST = 1000h +CCM_FIRST = 2000h + +; Ranges for control notification IDs + +NM_FIRST = 0 +LVN_FIRST = -100 +PSN_FIRST = -200 +HDN_FIRST = -300 +TVN_FIRST = -400 +TTN_FIRST = -520 +TCN_FIRST = -550 +CDN_FIRST = -601 +TBN_FIRST = -700 +UDN_FIRST = -721 +MCN_FIRST = -750 +DTN_FIRST = -760 +CBEN_FIRST = -800 +RBN_FIRST = -831 + +; Generic notifications + +NM_OUTOFMEMORY = NM_FIRST - 1 +NM_CLICK = NM_FIRST - 2 +NM_DBLCLK = NM_FIRST - 3 +NM_RETURN = NM_FIRST - 4 +NM_RCLICK = NM_FIRST - 5 +NM_RDBLCLK = NM_FIRST - 6 +NM_SETFOCUS = NM_FIRST - 7 +NM_KILLFOCUS = NM_FIRST - 8 +NM_CUSTOMDRAW = NM_FIRST - 12 + +; Common control styles + +CCS_TOP = 01h +CCS_NOMOVEY = 02h +CCS_BOTTOM = 03h +CCS_NORESIZE = 04h +CCS_NOPARENTALIGN = 08h +CCS_ADJUSTABLE = 20h +CCS_NODIVIDER = 40h +CCS_VERT = 80h +CCS_LEFT = CCS_VERT or CCS_TOP +CCS_RIGHT = CCS_VERT or CCS_BOTTOM +CCS_NOMOVEX = CCS_VERT or CCS_NOMOVEY + +; Owner-drawn control types + +ODT_HEADER = 100 +ODT_TAB = 101 +ODT_LISTVIEW = 102 + +; InitCommonControlsEx classes + +ICC_ANIMATE_CLASS = 0080h +ICC_BAR_CLASSES = 0004h +ICC_COOL_CLASSES = 0400h +ICC_DATE_CLASSES = 0100h +ICC_HOTKEY_CLASS = 0040h +ICC_INTERNET_CLASSES = 0800h +ICC_LISTVIEW_CLASSES = 0001h +ICC_PAGESCROLLER_CLASS = 1000h +ICC_PROGRESS_CLASS = 0020h +ICC_TAB_CLASSES = 0008h +ICC_TREEVIEW_CLASSES = 0002h +ICC_UPDOWN_CLASS = 0010h +ICC_USEREX_CLASSES = 0200h +ICC_WIN95_CLASSES = 00FFh + +; Shared messages + +CCM_SETCOLORSCHEME = CCM_FIRST + 2 +CCM_GETCOLORSCHEME = CCM_FIRST + 3 +CCM_GETDROPTARGET = CCM_FIRST + 4 +CCM_SETUNICODEFORMAT = CCM_FIRST + 5 +CCM_GETUNICODEFORMAT = CCM_FIRST + 6 + +; Property sheet page flags + +PSP_DEFAULT = 0000h +PSP_DLGINDIRECT = 0001h +PSP_USEHICON = 0002h +PSP_USEICONID = 0004h +PSP_USETITLE = 0008h +PSP_HASHELP = 0020h +PSP_USEREFPARENT = 0040h +PSP_USECALLBACK = 0080h + +; Property sheet page actions + +PSPCB_RELEASE = 1 +PSPCB_CREATE = 2 + +; Property sheet header flags + +PSH_DEFAULT = 0000h +PSH_PROPTITLE = 0001h +PSH_USEHICON = 0002h +PSH_USEICONID = 0004h +PSH_PROPSHEETPAGE = 0008h +PSH_MULTILINETABS = 0010h +PSH_WIZARD = 0020h +PSH_USEPSTARTPAGE = 0040h +PSH_NOAPPLYNOW = 0080h +PSH_USECALLBACK = 0100h +PSH_HASHELP = 0200h +PSH_MODELESS = 0400h + +; Property sheet actions + +PSCB_INITIALIZED = 1 + +; Property sheet notifications + +PSN_SETACTIVE = PSN_FIRST - 0 +PSN_KILLACTIVE = PSN_FIRST - 1 +PSN_APPLY = PSN_FIRST - 2 +PSN_RESET = PSN_FIRST - 3 +PSN_HELP = PSN_FIRST - 5 +PSN_WIZBACK = PSN_FIRST - 6 +PSN_WIZNEXT = PSN_FIRST - 7 +PSN_WIZFINISH = PSN_FIRST - 8 +PSN_QUERYCANCEL = PSN_FIRST - 9 + +; Property sheet return values + +PSNRET_NOERROR = 0 +PSNRET_INVALID = 1 +PSNRET_INVALID_NOCHANGEPAGE = 2 + +; Property sheet messages + +PSM_SETCURSEL = WM_USER + 101 +PSM_REMOVEPAGE = WM_USER + 102 +PSM_ADDPAGE = WM_USER + 103 +PSM_CHANGED = WM_USER + 104 +PSM_RESTARTWINDOWS = WM_USER + 105 +PSM_REBOOTSYSTEM = WM_USER + 106 +PSM_CANCELTOCLOSE = WM_USER + 107 +PSM_QUERYSIBLINGS = WM_USER + 108 +PSM_UNCHANGED = WM_USER + 109 +PSM_APPLY = WM_USER + 110 +PSM_SETTITLE = WM_USER + 111 +PSM_SETTITLEW = WM_USER + 120 +PSM_SETWIZBUTTONS = WM_USER + 112 +PSM_PRESSBUTTON = WM_USER + 113 +PSM_SETCURSELID = WM_USER + 114 +PSM_SETFINISHTEXT = WM_USER + 115 +PSM_SETFINISHTEXTW = WM_USER + 121 +PSM_GETTABCONTROL = WM_USER + 116 +PSM_ISDIALOGMESSAGE = WM_USER + 117 + +; Property sheet buttons + +PSBTN_BACK = 0 +PSBTN_NEXT = 1 +PSBTN_FINISH = 2 +PSBTN_OK = 3 +PSBTN_APPLYNOW = 4 +PSBTN_CANCEL = 5 +PSBTN_HELP = 6 +PSWIZB_BACK = 1 +PSWIZB_NEXT = 2 +PSWIZB_FINISH = 4 +PSWIZB_DISABLEDFINISH = 8 +ID_PSRESTARTWINDOWS = 2 +ID_PSREBOOTSYSTEM = ID_PSRESTARTWINDOWS or 1 + +; Property sheet sizes + +PROP_SM_CXDLG = 212 +PROP_SM_CYDLG = 188 +PROP_MED_CXDLG = 227 +PROP_MED_CYDLG = 215 +PROP_LG_CXDLG = 252 +PROP_LG_CYDLG = 218 +WIZ_CXDLG = 276 +WIZ_CYDLG = 140 +WIZ_CXBMP = 80 +WIZ_BODYX = 92 +WIZ_BODYCX = 184 + +; Image list types + +ILC_MASK = 001h +ILC_COLOR = 0FEh +ILC_COLORDDB = 0FEh +ILC_COLOR4 = 004h +ILC_COLOR8 = 008h +ILC_COLOR16 = 010h +ILC_COLOR24 = 018h +ILC_COLOR32 = 020h +ILC_PALETTE = 800h + +; Image list color values + +CLR_NONE = 0FFFFFFFFh +CLR_DEFAULT = 0FF000000h +CLR_HILIGHT = CLR_DEFAULT + +; Image list drawing styles + +ILD_NORMAL = 0000h +ILD_TRANSPARENT = 0001h +ILD_MASK = 0010h +ILD_IMAGE = 0020h +ILD_BLEND25 = 0002h +ILD_BLEND50 = 0004h +ILD_OVERLAYMASK = 0F00h +ILD_SELECTED = ILD_BLEND50 +ILD_FOCUS = ILD_BLEND25 +ILD_BLEND = ILD_BLEND50 + +; Header control styles + +HDS_HORZ = 00h +HDS_BUTTONS = 02h +HDS_HOTTRACK = 04h +HDS_HIDDEN = 08h +HDS_DRAGDROP = 40h +HDS_FULLDRAG = 80h + +; Header control structure flags + +HDI_WIDTH = 01h +HDI_HEIGHT = HDI_WIDTH +HDI_TEXT = 02h +HDI_FORMAT = 04h +HDI_LPARAM = 08h +HDI_BITMAP = 10h + +; Header control flags + +HDF_LEFT = 0000h +HDF_RIGHT = 0001h +HDF_CENTER = 0002h +HDF_JUSTIFYMASK = 0003h +HDF_RTLREADING = 0004h +HDF_BITMAP = 2000h +HDF_STRING = 4000h +HDF_OWNERDRAW = 8000h + +; Header control messages + +HDM_GETITEMCOUNT = HDM_FIRST + 0 +HDM_INSERTITEMA = HDM_FIRST + 1 +HDM_DELETEITEM = HDM_FIRST + 2 +HDM_GETITEMA = HDM_FIRST + 3 +HDM_SETITEMA = HDM_FIRST + 4 +HDM_LAYOUT = HDM_FIRST + 5 +HDM_HITTEST = HDM_FIRST + 6 +HDM_INSERTITEMW = HDM_FIRST + 10 +HDM_GETITEMW = HDM_FIRST + 11 +HDM_SETITEMW = HDM_FIRST + 12 +HDM_INSERTITEM = HDM_INSERTITEMA +HDM_GETITEM = HDM_GETITEMA +HDM_SETITEM = HDM_SETITEMA + +; Hit test result flags + +HHT_NOWHERE = 001h +HHT_ONHEADER = 002h +HHT_ONDIVIDER = 004h +HHT_ONDIVOPEN = 008h +HHT_ABOVE = 100h +HHT_BELOW = 200h +HHT_TORIGHT = 400h +HHT_TOLEFT = 800h + +; Header control notifications + +HDN_ITEMCHANGINGA = HDN_FIRST - 0 +HDN_ITEMCHANGEDA = HDN_FIRST - 1 +HDN_ITEMCLICKA = HDN_FIRST - 2 +HDN_ITEMDBLCLICKA = HDN_FIRST - 3 +HDN_DIVIDERDBLCLICKA = HDN_FIRST - 5 +HDN_BEGINTRACKA = HDN_FIRST - 6 +HDN_ENDTRACKA = HDN_FIRST - 7 +HDN_TRACKA = HDN_FIRST - 8 +HDN_ITEMCHANGINGW = HDN_FIRST - 20 +HDN_ITEMCHANGEDW = HDN_FIRST - 21 +HDN_ITEMCLICKW = HDN_FIRST - 22 +HDN_ITEMDBLCLICKW = HDN_FIRST - 23 +HDN_DIVIDERDBLCLICKW = HDN_FIRST - 25 +HDN_BEGINTRACKW = HDN_FIRST - 26 +HDN_ENDTRACKW = HDN_FIRST - 27 +HDN_TRACKW = HDN_FIRST - 28 +HDN_ITEMCHANGING = HDN_ITEMCHANGINGA +HDN_ITEMCHANGED = HDN_ITEMCHANGEDA +HDN_ITEMCLICK = HDN_ITEMCLICKA +HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKA +HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKA +HDN_BEGINTRACK = HDN_BEGINTRACKA +HDN_ENDTRACK = HDN_ENDTRACKA +HDN_TRACK = HDN_TRACKA + +; Toolbar bitmap flags + +CMB_MASKED = 2 + +; Toolbar button states + +TBSTATE_CHECKED = 01h +TBSTATE_PRESSED = 02h +TBSTATE_ENABLED = 04h +TBSTATE_HIDDEN = 08h +TBSTATE_INDETERMINATE = 10h +TBSTATE_WRAP = 20h +TBSTATE_ELLIPSES = 40h + +; Toolbar button styles + +TBSTYLE_BUTTON = 0000h +TBSTYLE_SEP = 0001h +TBSTYLE_CHECK = 0002h +TBSTYLE_GROUP = 0004h +TBSTYLE_CHECKGROUP = TBSTYLE_GROUP or TBSTYLE_CHECK +TBSTYLE_DROPDOWN = 0008h +TBSTYLE_TOOLTIPS = 0100h +TBSTYLE_WRAPABLE = 0200h +TBSTYLE_ALTDRAG = 0400h +TBSTYLE_FLAT = 0800h +TBSTYLE_LIST = 1000h +TBSTYLE_CUSTOMERASE = 2000h +TBSTYLE_TRANSPARENT = 8000h + +; Toolbar button extended styles + +TBSTYLE_EX_DRAWDDARROWS = 0001h + +; Toolbar messages + +TB_ENABLEBUTTON = WM_USER + 1 +TB_CHECKBUTTON = WM_USER + 2 +TB_PRESSBUTTON = WM_USER + 3 +TB_HIDEBUTTON = WM_USER + 4 +TB_INDETERMINATE = WM_USER + 5 +TB_ISBUTTONENABLED = WM_USER + 9 +TB_ISBUTTONCHECKED = WM_USER + 10 +TB_ISBUTTONPRESSED = WM_USER + 11 +TB_ISBUTTONHIDDEN = WM_USER + 12 +TB_ISBUTTONINDETERMINATE = WM_USER + 13 +TB_SETSTATE = WM_USER + 17 +TB_GETSTATE = WM_USER + 18 +TB_ADDBITMAP = WM_USER + 19 +TB_ADDBUTTONS = WM_USER + 20 +TB_INSERTBUTTON = WM_USER + 21 +TB_DELETEBUTTON = WM_USER + 22 +TB_GETBUTTON = WM_USER + 23 +TB_BUTTONCOUNT = WM_USER + 24 +TB_COMMANDTOINDEX = WM_USER + 25 +TB_SAVERESTOREA = WM_USER + 26 +TB_ADDSTRINGA = WM_USER + 28 +TB_CUSTOMIZE = WM_USER + 27 +TB_GETITEMRECT = WM_USER + 29 +TB_BUTTONSTRUCTSIZE = WM_USER + 30 +TB_SETBUTTONSIZE = WM_USER + 31 +TB_SETBITMAPSIZE = WM_USER + 32 +TB_AUTOSIZE = WM_USER + 33 +TB_GETTOOLTIPS = WM_USER + 35 +TB_SETTOOLTIPS = WM_USER + 36 +TB_SETPARENT = WM_USER + 37 +TB_SETROWS = WM_USER + 39 +TB_GETROWS = WM_USER + 40 +TB_GETBITMAPFLAGS = WM_USER + 41 +TB_SETCMDID = WM_USER + 42 +TB_CHANGEBITMAP = WM_USER + 43 +TB_GETBITMAP = WM_USER + 44 +TB_GETBUTTONTEXTA = WM_USER + 45 +TB_REPLACEBITMAP = WM_USER + 46 +TB_SETINDENT = WM_USER + 47 +TB_SETIMAGELIST = WM_USER + 48 +TB_GETIMAGELIST = WM_USER + 49 +TB_LOADIMAGES = WM_USER + 50 +TB_GETRECT = WM_USER + 51 +TB_SETHOTIMAGELIST = WM_USER + 52 +TB_GETHOTIMAGELIST = WM_USER + 53 +TB_SETDISABLEDIMAGELIST = WM_USER + 54 +TB_GETDISABLEDIMAGELIST = WM_USER + 55 +TB_SETSTYLE = WM_USER + 56 +TB_GETSTYLE = WM_USER + 57 +TB_GETBUTTONSIZE = WM_USER + 58 +TB_SETBUTTONWIDTH = WM_USER + 59 +TB_SETMAXTEXTROWS = WM_USER + 60 +TB_GETTEXTROWS = WM_USER + 61 +TB_GETBUTTONTEXTW = WM_USER + 75 +TB_SAVERESTOREW = WM_USER + 76 +TB_ADDSTRINGW = WM_USER + 77 +TB_SETEXTENDEDSTYLE = WM_USER + 84 +TB_GETEXTENDEDSTYLE = WM_USER + 85 +TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA +TB_SAVERESTORE = TB_SAVERESTOREA +TB_ADDSTRING = TB_ADDSTRINGA + +; System-defined button bitmaps + +HINST_COMMCTRL = -1 +IDB_STD_SMALL_COLOR = 0 +IDB_STD_LARGE_COLOR = 1 +IDB_VIEW_SMALL_COLOR = 4 +IDB_VIEW_LARGE_COLOR = 5 +IDB_HIST_SMALL_COLOR = 8 +IDB_HIST_LARGE_COLOR = 9 + +; Icon indexes for standard bitmap + +STD_CUT = 0 +STD_COPY = 1 +STD_PASTE = 2 +STD_UNDO = 3 +STD_REDOW = 4 +STD_DELETE = 5 +STD_FILENEW = 6 +STD_FILEOPEN = 7 +STD_FILESAVE = 8 +STD_PRINTPRE = 9 +STD_PROPERTIES = 10 +STD_HELP = 11 +STD_FIND = 12 +STD_REPLACE = 13 +STD_PRINT = 14 + +; Icon indexes for standard view bitmap + +VIEW_LARGEICONS = 0 +VIEW_SMALLICONS = 1 +VIEW_LIST = 2 +VIEW_DETAILS = 3 +VIEW_SORTNAME = 4 +VIEW_SORTSIZE = 5 +VIEW_SORTDATE = 6 +VIEW_SORTTYPE = 7 +VIEW_PARENTFOLDER = 8 +VIEW_NETCONNECT = 9 +VIEW_NETDISCONNECT = 10 +VIEW_NEWFOLDER = 11 + +; Icon indexes for history bitmap + +HIST_BACK = 0 +HIST_FORWARD = 1 +HIST_FAVORITES = 2 +HIST_ADDTOFAVORITES = 3 +HIST_VIEWTREE = 4 + +; Toolbar bitmap flags + +TBBF_LARGE = 1 + +; Toolbar notifications + +TBN_GETBUTTONINFOA = TBN_FIRST - 0 +TBN_BEGINDRAG = TBN_FIRST - 1 +TBN_ENDDRAG = TBN_FIRST - 2 +TBN_BEGINADJUST = TBN_FIRST - 3 +TBN_ENDADJUST = TBN_FIRST - 4 +TBN_RESET = TBN_FIRST - 5 +TBN_QUERYINSERT = TBN_FIRST - 6 +TBN_QUERYDELETE = TBN_FIRST - 7 +TBN_TOOLBARCHANGE = TBN_FIRST - 8 +TBN_CUSTHELP = TBN_FIRST - 9 +TBN_DROPDOWN = TBN_FIRST - 10 +TBN_CLOSEUP = TBN_FIRST - 11 +TBN_GETBUTTONINFOW = TBN_FIRST - 20 +TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA + +; ReBar styles + +RBS_TOOLTIPS = 100h +RBS_VARHEIGHT = 200h +RBS_BANDBORDERS = 400h +RBS_FIXEDORDER = 800h +RBS_REGISTERDROP = 1000h +RBS_AUTOSIZE = 2000h +RBS_VERTICALGRIPPER = 4000h +RBS_DBLCLKTOGGLE = 8000h + +; ReBar band info structure flags + +RBBIM_STYLE = 001h +RBBIM_COLORS = 002h +RBBIM_TEXT = 004h +RBBIM_IMAGE = 008h +RBBIM_CHILD = 010h +RBBIM_CHILDSIZE = 020h +RBBIM_SIZE = 040h +RBBIM_BACKGROUND = 080h +RBBIM_ID = 100h +RBBIM_IDEALSIZE = 200h +RBBIM_LPARAM = 400h +RBBIM_HEADERSIZE = 800h + +; ReBar band styles + +RBBS_BREAK = 001h +RBBS_FIXEDSIZE = 002h +RBBS_CHILDEDGE = 004h +RBBS_HIDDEN = 008h +RBBS_NOVERT = 010h +RBBS_FIXEDBMP = 020h +RBBS_VARIABLEHEIGHT = 040h +RBBS_GRIPPERALWAYS = 080h +RBBS_NOGRIPPER = 100h + +; ReBar messages + +RB_INSERTBANDA = WM_USER + 1 +RB_DELETEBAND = WM_USER + 2 +RB_GETBARINFO = WM_USER + 3 +RB_SETBARINFO = WM_USER + 4 +RB_GETBANDINFO = WM_USER + 5 +RB_SETBANDINFOA = WM_USER + 6 +RB_SETPARENT = WM_USER + 7 +RB_INSERTBANDW = WM_USER + 10 +RB_SETBANDINFOW = WM_USER + 11 +RB_GETBANDCOUNT = WM_USER + 12 +RB_GETROWCOUNT = WM_USER + 13 +RB_GETROWHEIGHT = WM_USER + 14 +RB_IDTOINDEX = WM_USER + 16 +RB_GETTOOLTIPS = WM_USER + 17 +RB_SETTOOLTIPS = WM_USER + 18 +RB_SETBKCOLOR = WM_USER + 19 +RB_GETBKCOLOR = WM_USER + 20 +RB_SETTEXTCOLOR = WM_USER + 21 +RB_GETTEXTCOLOR = WM_USER + 22 +RB_SIZETORECT = WM_USER + 23 +RB_BEGINDRAG = WM_USER + 24 +RB_ENDDRAG = WM_USER + 25 +RB_DRAGMOVE = WM_USER + 26 +RB_GETBARHEIGHT = WM_USER + 27 +RB_GETBANDINFOW = WM_USER + 28 +RB_GETBANDINFOA = WM_USER + 29 +RB_MINIMIZEBAND = WM_USER + 30 +RB_MAXIMIZEBAND = WM_USER + 31 +RB_GETDROPTARGET = CCM_GETDROPTARGET +RB_GETBANDBORDERS = WM_USER + 34 +RB_SHOWBAND = WM_USER + 35 +RB_SETPALETTE = WM_USER + 37 +RB_GETPALETTE = WM_USER + 38 +RB_MOVEBAND = WM_USER + 39 +RB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT +RB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT +RB_INSERTBAND = RB_INSERTBANDA +RB_SETBANDINFO = RB_SETBANDINFOA + +; ReBar notifications + +RBN_HEIGHTCHANGE = RBN_FIRST - 0 +RBN_GETOBJECT = RBN_FIRST - 1 +RBN_LAYOUTCHANGED = RBN_FIRST - 2 +RBN_AUTOSIZE = RBN_FIRST - 3 +RBN_BEGINDRAG = RBN_FIRST - 4 +RBN_ENDDRAG = RBN_FIRST - 5 +RBN_DELETINGBAND = RBN_FIRST - 6 +RBN_DELETEDBAND = RBN_FIRST - 7 +RBN_CHILDSIZE = RBN_FIRST - 8 + +; Tooltip styles + +TTS_ALWAYSTIP = 1 +TTS_NOPREFIX = 2 + +; Tooltip flags + +TTF_IDISHWND = 01h +TTF_CENTERTIP = 02h +TTF_RTLREADING = 04h +TTF_SUBCLASS = 10h + +; Tooltip durations + +TTDT_AUTOMATIC = 0 +TTDT_RESHOW = 1 +TTDT_AUTOPOP = 2 +TTDT_INITIAL = 3 + +; Tooltip messages + +TTM_ACTIVATE = WM_USER + 1 +TTM_SETDELAYTIME = WM_USER + 3 +TTM_ADDTOOLA = WM_USER + 4 +TTM_DELTOOLA = WM_USER + 5 +TTM_NEWTOOLRECTA = WM_USER + 6 +TTM_RELAYEVENT = WM_USER + 7 +TTM_GETTOOLINFOA = WM_USER + 8 +TTM_SETTOOLINFOA = WM_USER + 9 +TTM_HITTESTA = WM_USER + 10 +TTM_GETTEXTA = WM_USER + 11 +TTM_UPDATETIPTEXTA = WM_USER + 12 +TTM_GETTOOLCOUNT = WM_USER + 13 +TTM_ENUMTOOLSA = WM_USER + 14 +TTM_GETCURRENTTOOLA = WM_USER + 15 +TTM_WINDOWFROMPOINT = WM_USER + 16 +TTM_ADDTOOLW = WM_USER + 50 +TTM_DELTOOLW = WM_USER + 51 +TTM_NEWTOOLRECTW = WM_USER + 52 +TTM_GETTOOLINFOW = WM_USER + 53 +TTM_SETTOOLINFOW = WM_USER + 54 +TTM_HITTESTW = WM_USER + 55 +TTM_GETTEXTW = WM_USER + 56 +TTM_UPDATETIPTEXTW = WM_USER + 57 +TTM_ENUMTOOLSW = WM_USER + 58 +TTM_GETCURRENTTOOLW = WM_USER + 59 +TTM_ADDTOOL = TTM_ADDTOOLA +TTM_DELTOOL = TTM_DELTOOLA +TTM_NEWTOOLRECT = TTM_NEWTOOLRECTA +TTM_GETTOOLINFO = TTM_GETTOOLINFOA +TTM_SETTOOLINFO = TTM_SETTOOLINFOA +TTM_HITTEST = TTM_HITTESTA +TTM_GETTEXT = TTM_GETTEXTA +TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA +TTM_ENUMTOOLS = TTM_ENUMTOOLSA +TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLA + +; Tooltip notifications + +TTN_NEEDTEXTA = TTN_FIRST - 0 +TTN_SHOW = TTN_FIRST - 1 +TTN_POP = TTN_FIRST - 2 +TTN_NEEDTEXTW = TTN_FIRST - 10 +TTN_NEEDTEXT = TTN_NEEDTEXTA + +; Status bar styles + +SBARS_SIZEGRIP = 100h + +; Status bar messages + +SB_SETTEXTA = WM_USER + 1 +SB_GETTEXTA = WM_USER + 2 +SB_GETTEXTLENGTHA = WM_USER + 3 +SB_SETPARTS = WM_USER + 4 +SB_GETPARTS = WM_USER + 6 +SB_GETBORDERS = WM_USER + 7 +SB_SETMINHEIGHT = WM_USER + 8 +SB_SIMPLE = WM_USER + 9 +SB_GETRECT = WM_USER + 10 +SB_SETTEXTW = WM_USER + 11 +SB_GETTEXTW = WM_USER + 13 +SB_GETTEXTLENGTHW = WM_USER + 12 +SB_SETTEXT = SB_SETTEXTA +SB_GETTEXT = SB_GETTEXTA +SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA + +; Status bar drawing types + +SBT_OWNERDRAW = 1000h +SBT_NOBORDERS = 0100h +SBT_POPOUT = 0200h +SBT_RTLREADING = 0400h + +; Trackbar styles + +TBS_AUTOTICKS = 01h +TBS_VERT = 02h +TBS_HORZ = 00h +TBS_TOP = 04h +TBS_BOTTOM = 00h +TBS_LEFT = 04h +TBS_RIGHT = 00h +TBS_BOTH = 08h +TBS_NOTICKS = 10h +TBS_ENABLESELRANGE = 20h +TBS_FIXEDLENGTH = 40h +TBS_NOTHUMB = 80h + +; Trackbar messages + +TBM_GETPOS = WM_USER + 0 +TBM_GETRANGEMIN = WM_USER + 1 +TBM_GETRANGEMAX = WM_USER + 2 +TBM_GETTIC = WM_USER + 3 +TBM_SETTIC = WM_USER + 4 +TBM_SETPOS = WM_USER + 5 +TBM_SETRANGE = WM_USER + 6 +TBM_SETRANGEMIN = WM_USER + 7 +TBM_SETRANGEMAX = WM_USER + 8 +TBM_CLEARTICS = WM_USER + 9 +TBM_SETSEL = WM_USER + 10 +TBM_SETSELSTART = WM_USER + 11 +TBM_SETSELEND = WM_USER + 12 +TBM_GETPTICS = WM_USER + 14 +TBM_GETTICPOS = WM_USER + 15 +TBM_GETNUMTICS = WM_USER + 16 +TBM_GETSELSTART = WM_USER + 17 +TBM_GETSELEND = WM_USER + 18 +TBM_CLEARSEL = WM_USER + 19 +TBM_SETTICFREQ = WM_USER + 20 +TBM_SETPAGESIZE = WM_USER + 21 +TBM_GETPAGESIZE = WM_USER + 22 +TBM_SETLINESIZE = WM_USER + 23 +TBM_GETLINESIZE = WM_USER + 24 +TBM_GETTHUMBRECT = WM_USER + 25 +TBM_GETCHANNELRECT = WM_USER + 26 +TBM_SETTHUMBLENGTH = WM_USER + 27 +TBM_GETTHUMBLENGTH = WM_USER + 28 + +; Trackbar notifications + +TB_LINEUP = 0 +TB_LINEDOWN = 1 +TB_PAGEUP = 2 +TB_PAGEDOWN = 3 +TB_THUMBPOSITION = 4 +TB_THUMBTRACK = 5 +TB_TOP = 6 +TB_BOTTOM = 7 +TB_ENDTRACK = 8 + +; Up-down control styles + +UDS_WRAP = 01h +UDS_SETBUDDYINT = 02h +UDS_ALIGNRIGHT = 04h +UDS_ALIGNLEFT = 08h +UDS_AUTOBUDDY = 10h +UDS_ARROWKEYS = 20h +UDS_HORZ = 40h +UDS_NOTHOUSANDS = 80h + +; Up-down control messages + +UDM_SETRANGE = WM_USER + 101 +UDM_GETRANGE = WM_USER + 102 +UDM_SETPOS = WM_USER + 103 +UDM_GETPOS = WM_USER + 104 +UDM_SETBUDDY = WM_USER + 105 +UDM_GETBUDDY = WM_USER + 106 +UDM_SETACCEL = WM_USER + 107 +UDM_GETACCEL = WM_USER + 108 +UDM_SETBASE = WM_USER + 109 +UDM_GETBASE = WM_USER + 110 + +; Up-down control notifications + +UDN_DELTAPOS = UDN_FIRST - 1 + +; Progress bar messages + +PBM_SETRANGE = WM_USER + 1 +PBM_SETPOS = WM_USER + 2 +PBM_DELTAPOS = WM_USER + 3 +PBM_SETSTEP = WM_USER + 4 +PBM_STEPIT = WM_USER + 5 +PBM_SETRANGE32 = WM_USER + 6 +PBM_GETRANGE = WM_USER + 7 +PBM_GETPOS = WM_USER + 8 + +; Hot-key control messages + +HKM_SETHOTKEY = WM_USER + 1 +HKM_GETHOTKEY = WM_USER + 2 +HKM_SETRULES = WM_USER + 3 + +; Hot key flags + +HOTKEYF_SHIFT = 1 +HOTKEYF_CONTROL = 2 +HOTKEYF_ALT = 4 +HOTKEYF_EXT = 8 + +; Key combination flags + +HKCOMB_NONE = 01h +HKCOMB_S = 02h +HKCOMB_C = 04h +HKCOMB_A = 08h +HKCOMB_SC = 10h +HKCOMB_SA = 20h +HKCOMB_CA = 40h +HKCOMB_SCA = 80h + +; List view styles + +LVS_ICON = 0000h +LVS_REPORT = 0001h +LVS_SMALLICON = 0002h +LVS_LIST = 0003h +LVS_TYPEMASK = 0003h +LVS_SINGLESEL = 0004h +LVS_SHOWSELALWAYS = 0008h +LVS_SORTASCENDING = 0010h +LVS_SORTDESCENDING = 0020h +LVS_SHAREIMAGELISTS = 0040h +LVS_NOLABELWRAP = 0080h +LVS_AUTOARRANGE = 0100h +LVS_EDITLABELS = 0200h +LVS_OWNERDATA = 1000h +LVS_NOSCROLL = 2000h +LVS_ALIGNTOP = 0000h +LVS_ALIGNLEFT = 0800h +LVS_OWNERDRAWFIXED = 0400h +LVS_NOCOLUMNHEADER = 4000h +LVS_NOSORTHEADER = 8000h + +; List view extended styles + +LVS_EX_GRIDLINES = 0001h +LVS_EX_SUBITEMIMAGES = 0002h +LVS_EX_CHECKBOXES = 0004h +LVS_EX_TRACKSELECT = 0008h +LVS_EX_HEADERDRAGDROP = 0010h +LVS_EX_FULLROWSELECT = 0020h +LVS_EX_ONECLICKACTIVATE = 0040h +LVS_EX_TWOCLICKACTIVATE = 0080h +LVS_EX_FLATSB = 0100h +LVS_EX_REGIONAL = 0200h +LVS_EX_INFOTIP = 0400h +LVS_EX_UNDERLINEHOT = 0800h +LVS_EX_UNDERLINECOLD = 1000h +LVS_EX_MULTIWORKAREAS = 2000h +LVS_EX_LABELTIP = 4000h + +; List view messages + +LVM_GETBKCOLOR = LVM_FIRST + 0 +LVM_SETBKCOLOR = LVM_FIRST + 1 +LVM_GETIMAGELIST = LVM_FIRST + 2 +LVM_SETIMAGELIST = LVM_FIRST + 3 +LVM_GETITEMCOUNT = LVM_FIRST + 4 +LVM_GETITEMA = LVM_FIRST + 5 +LVM_SETITEMA = LVM_FIRST + 6 +LVM_INSERTITEMA = LVM_FIRST + 7 +LVM_DELETEITEM = LVM_FIRST + 8 +LVM_DELETEALLITEMS = LVM_FIRST + 9 +LVM_GETCALLBACKMASK = LVM_FIRST + 10 +LVM_SETCALLBACKMASK = LVM_FIRST + 11 +LVM_GETNEXTITEM = LVM_FIRST + 12 +LVM_FINDITEMA = LVM_FIRST + 13 +LVM_GETITEMRECT = LVM_FIRST + 14 +LVM_SETITEMPOSITION = LVM_FIRST + 15 +LVM_GETITEMPOSITION = LVM_FIRST + 16 +LVM_GETSTRINGWIDTHA = LVM_FIRST + 17 +LVM_HITTEST = LVM_FIRST + 18 +LVM_ENSUREVISIBLE = LVM_FIRST + 19 +LVM_SCROLL = LVM_FIRST + 20 +LVM_REDRAWITEMS = LVM_FIRST + 21 +LVM_ARRANGE = LVM_FIRST + 22 +LVM_EDITLABELA = LVM_FIRST + 23 +LVM_GETEDITCONTROL = LVM_FIRST + 24 +LVM_GETCOLUMNA = LVM_FIRST + 25 +LVM_SETCOLUMNA = LVM_FIRST + 26 +LVM_INSERTCOLUMNA = LVM_FIRST + 27 +LVM_DELETECOLUMN = LVM_FIRST + 28 +LVM_GETCOLUMNWIDTH = LVM_FIRST + 29 +LVM_SETCOLUMNWIDTH = LVM_FIRST + 30 +LVM_CREATEDRAGIMAGE = LVM_FIRST + 33 +LVM_GETVIEWRECT = LVM_FIRST + 34 +LVM_GETTEXTCOLOR = LVM_FIRST + 35 +LVM_SETTEXTCOLOR = LVM_FIRST + 36 +LVM_GETTEXTBKCOLOR = LVM_FIRST + 37 +LVM_SETTEXTBKCOLOR = LVM_FIRST + 38 +LVM_GETTOPINDEX = LVM_FIRST + 39 +LVM_GETCOUNTPERPAGE = LVM_FIRST + 40 +LVM_GETORIGIN = LVM_FIRST + 41 +LVM_UPDATE = LVM_FIRST + 42 +LVM_SETITEMSTATE = LVM_FIRST + 43 +LVM_GETITEMSTATE = LVM_FIRST + 44 +LVM_GETITEMTEXTA = LVM_FIRST + 45 +LVM_SETITEMTEXTA = LVM_FIRST + 46 +LVM_SETITEMCOUNT = LVM_FIRST + 47 +LVM_SORTITEMS = LVM_FIRST + 48 +LVM_SETITEMPOSITION32 = LVM_FIRST + 49 +LVM_GETSELECTEDCOUNT = LVM_FIRST + 50 +LVM_GETITEMSPACING = LVM_FIRST + 51 +LVM_GETISEARCHSTRINGA = LVM_FIRST + 52 +LVM_SETICONSPACING = LVM_FIRST + 53 +LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54 +LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55 +LVM_GETSUBITEMRECT = LVM_FIRST + 56 +LVM_SUBITEMHITTEST = LVM_FIRST + 57 +LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58 +LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59 +LVM_SETHOTITEM = LVM_FIRST + 60 +LVM_GETHOTITEM = LVM_FIRST + 61 +LVM_SETHOTCURSOR = LVM_FIRST + 62 +LVM_GETHOTCURSOR = LVM_FIRST + 63 +LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64 +LVM_SETWORKAREA = LVM_FIRST + 65 +LVM_GETITEMW = LVM_FIRST + 75 +LVM_SETITEMW = LVM_FIRST + 76 +LVM_INSERTITEMW = LVM_FIRST + 77 +LVM_FINDITEMW = LVM_FIRST + 83 +LVM_GETSTRINGWIDTHW = LVM_FIRST + 87 +LVM_GETCOLUMNW = LVM_FIRST + 95 +LVM_SETCOLUMNW = LVM_FIRST + 96 +LVM_INSERTCOLUMNW = LVM_FIRST + 97 +LVM_GETITEMTEXTW = LVM_FIRST + 115 +LVM_SETITEMTEXTW = LVM_FIRST + 116 +LVM_GETISEARCHSTRINGW = LVM_FIRST + 117 +LVM_EDITLABELW = LVM_FIRST + 118 +LVM_GETITEM = LVM_GETITEMA +LVM_SETITEM = LVM_SETITEMA +LVM_INSERTITEM = LVM_INSERTITEMA +LVM_FINDITEM = LVM_FINDITEMA +LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHA +LVM_GETCOLUMN = LVM_GETCOLUMNA +LVM_SETCOLUMN = LVM_SETCOLUMNA +LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA +LVM_GETITEMTEXT = LVM_GETITEMTEXTA +LVM_SETITEMTEXT = LVM_SETITEMTEXTA +LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGA +LVM_EDITLABEL = LVM_EDITLABELA + +; List view image list types + +LVSIL_NORMAL = 0 +LVSIL_SMALL = 1 +LVSIL_STATE = 2 + +; LVM_SETITEMCOUNT flags + +LVSICF_NOINVALIDATEALL = 1 +LVSICF_NOSCROLL = 2 + +; List view item structure flags + +LVIF_TEXT = 0001h +LVIF_IMAGE = 0002h +LVIF_PARAM = 0004h +LVIF_STATE = 0008h +LVIF_INDENT = 0010h +LVIF_NORECOMPUTE = 0800h +LVIF_DI_SETITEM = 1000h + +; List view item states + +LVIS_FOCUSED = 00001h +LVIS_SELECTED = 00002h +LVIS_CUT = 00004h +LVIS_DROPHILITED = 00008h +LVIS_ACTIVATING = 0020h +LVIS_OVERLAYMASK = 00F00h +LVIS_STATEIMAGEMASK = 0F000h + +; List view callback item values + +LPSTR_TEXTCALLBACK = -1 +I_IMAGECALLBACK = -1 +I_CHILDRENCALLBACK = -1 + +; List view next item relations + +LVNI_ALL = 000h +LVNI_FOCUSED = 001h +LVNI_SELECTED = 002h +LVNI_CUT = 004h +LVNI_DROPHILITED = 008h +LVNI_ABOVE = 100h +LVNI_BELOW = 200h +LVNI_TOLEFT = 400h +LVNI_TORIGHT = 800h + +; List view search types + +LVFI_PARAM = 01h +LVFI_STRING = 02h +LVFI_PARTIAL = 08h +LVFI_WRAP = 20h +LVFI_NEARESTXY = 40h + +; List view item rectangle types + +LVIR_BOUNDS = 0 +LVIR_ICON = 1 +LVIR_LABEL = 2 +LVIR_SELECTBOUNDS = 3 + +; List view hit test flags + +LVHT_NOWHERE = 01h +LVHT_ONITEMICON = 02h +LVHT_ONITEMLABEL = 04h +LVHT_ONITEMSTATEICON= 08h +LVHT_ONITEM = LVHT_ONITEMICON or LVHT_ONITEMLABEL or LVHT_ONITEMSTATEICON +LVHT_ABOVE = 08h +LVHT_BELOW = 10h +LVHT_TORIGHT = 20h +LVHT_TOLEFT = 40h + +; List view alignment values + +LVA_DEFAULT = 000h +LVA_ALIGNLEFT = 001h +LVA_ALIGNTOP = 002h +LVA_ALIGNRIGHT = 003h +LVA_ALIGNBOTTOM = 004h +LVA_SNAPTOGRID = 005h +LVA_SORTASCENDING = 100h +LVA_SORTDESCENDING = 200h + +; List view column structure flags + +LVCF_FMT = 1 +LVCF_WIDTH = 2 +LVCF_TEXT = 4 +LVCF_SUBITEM = 8 + +; List view column alignment values + +LVCFMT_LEFT = 0 +LVCFMT_RIGHT = 1 +LVCFMT_CENTER = 2 +LVCFMT_JUSTIFYMASK = 3 + +; List view column width values + +LVSCW_AUTOSIZE = -1 +LVSCW_AUTOSIZE_USEHEADER = -2 + +; List view notifications + +LVN_ITEMCHANGING = LVN_FIRST - 0 +LVN_ITEMCHANGED = LVN_FIRST - 1 +LVN_INSERTITEM = LVN_FIRST - 2 +LVN_DELETEITEM = LVN_FIRST - 3 +LVN_DELETEALLITEMS = LVN_FIRST - 4 +LVN_BEGINLABELEDITA = LVN_FIRST - 5 +LVN_ENDLABELEDITA = LVN_FIRST - 6 +LVN_COLUMNCLICK = LVN_FIRST - 8 +LVN_BEGINDRAG = LVN_FIRST - 9 +LVN_BEGINRDRAG = LVN_FIRST - 11 +LVN_ODCACHEHINT = LVN_FIRST - 13 +LVN_GETDISPINFOA = LVN_FIRST - 50 +LVN_SETDISPINFOA = LVN_FIRST - 51 +LVN_ODFINDITEMA = LVN_FIRST - 52 +LVN_KEYDOWN = LVN_FIRST - 55 +LVN_BEGINLABELEDITW = LVN_FIRST - 75 +LVN_ENDLABELEDITW = LVN_FIRST - 76 +LVN_GETDISPINFOW = LVN_FIRST - 77 +LVN_SETDISPINFOW = LVN_FIRST - 78 +LVN_ODFINDITEMW = LVN_FIRST - 79 +LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA +LVN_ENDLABELEDIT = LVN_ENDLABELEDITA +LVN_GETDISPINFO = LVN_GETDISPINFOA +LVN_SETDISPINFO = LVN_SETDISPINFOA +LVN_ODFINDITEM = LVN_ODFINDITEMA + +; Tree view styles + +TVS_HASBUTTONS = 0001h +TVS_HASLINES = 0002h +TVS_LINESATROOT = 0004h +TVS_EDITLABELS = 0008h +TVS_DISABLEDRAGDROP = 0010h +TVS_SHOWSELALWAYS = 0020h +TVS_RTLREADING = 0040h +TVS_NOTOOLTIPS = 0080h +TVS_CHECKBOXES = 0100h +TVS_TRACKSELECT = 0200h +TVS_SINGLEEXPAND = 0400h +TVS_INFOTIP = 0800h +TVS_FULLROWSELECT = 1000h +TVS_NOSCROLL = 2000h +TVS_NONEVENHEIGHT = 4000h + +; Tree view item structure flags + +TVIF_TEXT = 0001h +TVIF_IMAGE = 0002h +TVIF_PARAM = 0004h +TVIF_STATE = 0008h +TVIF_HANDLE = 0010h +TVIF_SELECTEDIMAGE = 0020h +TVIF_CHILDREN = 0040h +TVIF_DI_SETITEM = 1000h + +; Tree view item states + +TVIS_FOCUSED = 00001h +TVIS_SELECTED = 00002h +TVIS_CUT = 00004h +TVIS_DROPHILITED = 00008h +TVIS_BOLD = 00010h +TVIS_EXPANDED = 00020h +TVIS_EXPANDEDONCE = 00040h +TVIS_EXPANDPARTIAL = 00080h +TVIS_OVERLAYMASK = 00F00h +TVIS_STATEIMAGEMASK = 0F000h +TVIS_USERMASK = 0F000h + +; Tree view predefined item values + +TVI_ROOT = 0FFFF0000h +TVI_FIRST = 0FFFF0001h +TVI_LAST = 0FFFF0002h +TVI_SORT = 0FFFF0003h + +; Tree view messages + +TVM_INSERTITEMA = TV_FIRST + 0 +TVM_DELETEITEM = TV_FIRST + 1 +TVM_EXPAND = TV_FIRST + 2 +TVM_GETITEMRECT = TV_FIRST + 4 +TVM_GETCOUNT = TV_FIRST + 5 +TVM_GETINDENT = TV_FIRST + 6 +TVM_SETINDENT = TV_FIRST + 7 +TVM_GETIMAGELIST = TV_FIRST + 8 +TVM_SETIMAGELIST = TV_FIRST + 9 +TVM_GETNEXTITEM = TV_FIRST + 10 +TVM_SELECTITEM = TV_FIRST + 11 +TVM_GETITEMA = TV_FIRST + 12 +TVM_SETITEMA = TV_FIRST + 13 +TVM_EDITLABELA = TV_FIRST + 14 +TVM_GETEDITCONTROL = TV_FIRST + 15 +TVM_GETVISIBLECOUNT = TV_FIRST + 16 +TVM_HITTEST = TV_FIRST + 17 +TVM_CREATEDRAGIMAGE = TV_FIRST + 18 +TVM_SORTCHILDREN = TV_FIRST + 19 +TVM_ENSUREVISIBLE = TV_FIRST + 20 +TVM_SORTCHILDRENCB = TV_FIRST + 21 +TVM_ENDEDITLABELNOW = TV_FIRST + 22 +TVM_GETISEARCHSTRINGA = TV_FIRST + 23 +TVM_INSERTITEMW = TV_FIRST + 50 +TVM_GETITEMW = TV_FIRST + 62 +TVM_SETITEMW = TV_FIRST + 63 +TVM_GETISEARCHSTRINGW = TV_FIRST + 64 +TVM_EDITLABELW = TV_FIRST + 65 +TVM_INSERTITEM = TVM_INSERTITEMA +TVM_GETITEM = TVM_GETITEMA +TVM_SETITEM = TVM_SETITEMA +TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGA +TVM_EDITLABEL = TVM_EDITLABELA + +; Tree view action flags + +TVE_COLLAPSE = 0001h +TVE_EXPAND = 0002h +TVE_TOGGLE = 0003h +TVE_EXPANDPARTIAL = 4000h +TVE_COLLAPSERESET = 8000h + +; Tree view image list types + +TVSIL_NORMAL = 0 +TVSIL_STATE = 2 + +; Tree view next item types + +TVGN_ROOT = 0 +TVGN_NEXT = 1 +TVGN_PREVIOUS = 2 +TVGN_PARENT = 3 +TVGN_CHILD = 4 +TVGN_FIRSTVISIBLE = 5 +TVGN_NEXTVISIBLE = 6 +TVGN_PREVIOUSVISIBLE = 7 +TVGN_DROPHILITE = 8 +TVGN_CARET = 9 + +; Tree view hit test flags + +TVHT_NOWHERE = 001h +TVHT_ONITEMICON = 002h +TVHT_ONITEMLABEL = 004h +TVHT_ONITEMINDENT = 008h +TVHT_ONITEMBUTTON = 010h +TVHT_ONITEMRIGHT = 020h +TVHT_ONITEMSTATEICON = 040h +TVHT_ONITEM = TVHT_ONITEMICON or TVHT_ONITEMLABEL or TVHT_ONITEMSTATEICON +TVHT_ABOVE = 100h +TVHT_BELOW = 200h +TVHT_TORIGHT = 400h +TVHT_TOLEFT = 800h + +; Tree view notifications + +TVN_SELCHANGINGA = TVN_FIRST - 1 +TVN_SELCHANGEDA = TVN_FIRST - 2 +TVN_GETDISPINFOA = TVN_FIRST - 3 +TVN_SETDISPINFOA = TVN_FIRST - 4 +TVN_ITEMEXPANDINGA = TVN_FIRST - 5 +TVN_ITEMEXPANDEDA = TVN_FIRST - 6 +TVN_BEGINDRAGA = TVN_FIRST - 7 +TVN_BEGINRDRAGA = TVN_FIRST - 8 +TVN_DELETEITEMA = TVN_FIRST - 9 +TVN_BEGINLABELEDITA = TVN_FIRST - 10 +TVN_ENDLABELEDITA = TVN_FIRST - 11 +TVN_KEYDOWN = TVN_FIRST - 12 +TVN_SELCHANGINGW = TVN_FIRST - 50 +TVN_SELCHANGEDW = TVN_FIRST - 51 +TVN_GETDISPINFOW = TVN_FIRST - 52 +TVN_SETDISPINFOW = TVN_FIRST - 53 +TVN_ITEMEXPANDINGW = TVN_FIRST - 54 +TVN_ITEMEXPANDEDW = TVN_FIRST - 55 +TVN_BEGINDRAGW = TVN_FIRST - 56 +TVN_BEGINRDRAGW = TVN_FIRST - 57 +TVN_DELETEITEMW = TVN_FIRST - 58 +TVN_BEGINLABELEDITW = TVN_FIRST - 59 +TVN_ENDLABELEDITW = TVN_FIRST - 60 +TVN_SELCHANGING = TVN_SELCHANGINGA +TVN_SELCHANGED = TVN_SELCHANGEDA +TVN_GETDISPINFO = TVN_GETDISPINFOA +TVN_SETDISPINFO = TVN_SETDISPINFOA +TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGA +TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDA +TVN_BEGINDRAG = TVN_BEGINDRAGA +TVN_BEGINRDRAG = TVN_BEGINRDRAGA +TVN_DELETEITEM = TVN_DELETEITEMA +TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITA +TVN_ENDLABELEDIT = TVN_ENDLABELEDITA + +; Tree view action flags + +TVC_UNKNOWN = 0 +TVC_BYMOUSE = 1 +TVC_BYKEYBOARD = 2 + +; Tab control styles + +TCS_SCROLLOPPOSITE = 0001h +TCS_BOTTOM = 0002h +TCS_RIGHT = 0002h +TCS_FORCEICONLEFT = 0010h +TCS_FORCELABELLEFT = 0020h +TCS_HOTTRACK = 0040h +TCS_VERTICAL = 0080h +TCS_TABS = 0000h +TCS_BUTTONS = 0100h +TCS_SINGLELINE = 0000h +TCS_MULTILINE = 0200h +TCS_RIGHTJUSTIFY = 0000h +TCS_FIXEDWIDTH = 0400h +TCS_RAGGEDRIGHT = 0800h +TCS_FOCUSONBUTTONDOWN = 1000h +TCS_OWNERDRAWFIXED = 2000h +TCS_TOOLTIPS = 4000h +TCS_FOCUSNEVER = 8000h + +; Tab control messages + +TCM_GETIMAGELIST = TCM_FIRST + 2 +TCM_SETIMAGELIST = TCM_FIRST + 3 +TCM_GETITEMCOUNT = TCM_FIRST + 4 +TCM_GETITEMA = TCM_FIRST + 5 +TCM_SETITEMA = TCM_FIRST + 6 +TCM_INSERTITEMA = TCM_FIRST + 7 +TCM_DELETEITEM = TCM_FIRST + 8 +TCM_DELETEALLITEMS = TCM_FIRST + 9 +TCM_GETITEMRECT = TCM_FIRST + 10 +TCM_GETCURSEL = TCM_FIRST + 11 +TCM_SETCURSEL = TCM_FIRST + 12 +TCM_HITTEST = TCM_FIRST + 13 +TCM_SETITEMEXTRA = TCM_FIRST + 14 +TCM_ADJUSTRECT = TCM_FIRST + 40 +TCM_SETITEMSIZE = TCM_FIRST + 41 +TCM_REMOVEIMAGE = TCM_FIRST + 42 +TCM_SETPADDING = TCM_FIRST + 43 +TCM_GETROWCOUNT = TCM_FIRST + 44 +TCM_GETTOOLTIPS = TCM_FIRST + 45 +TCM_SETTOOLTIPS = TCM_FIRST + 46 +TCM_GETCURFOCUS = TCM_FIRST + 47 +TCM_SETCURFOCUS = TCM_FIRST + 48 +TCM_GETITEMW = TCM_FIRST + 60 +TCM_SETITEMW = TCM_FIRST + 61 +TCM_INSERTITEMW = TCM_FIRST + 62 +TCM_GETITEM = TCM_GETITEMA +TCM_SETITEM = TCM_SETITEMA +TCM_INSERTITEM = TCM_INSERTITEMA + +; Tab control item structure flags + +TCIF_TEXT = 1 +TCIF_IMAGE = 2 +TCIF_RTLREADING = 4 +TCIF_PARAM = 8 + +; Tab control hit test flags + +TCHT_NOWHERE = 1 +TCHT_ONITEMICON = 2 +TCHT_ONITEMLABEL = 4 +TCHT_ONITEM = TCHT_ONITEMICON or TCHT_ONITEMLABEL + +; Tab control notifications + +TCN_KEYDOWN = TCN_FIRST - 0 +TCN_SELCHANGE = TCN_FIRST - 1 +TCN_SELCHANGING = TCN_FIRST - 2 + +; Animation control styles + +ACS_CENTER = 1 +ACS_TRANSPARENT = 2 +ACS_AUTOPLAY = 4 +ACS_TIMER = 8 + +; Animation control messages + +ACM_OPENA = WM_USER + 100 +ACM_PLAY = WM_USER + 101 +ACM_STOP = WM_USER + 102 +ACM_OPENW = WM_USER + 103 +ACM_OPEN = ACM_OPENA + +; Animation control notifications + +ACN_START = 1 +ACN_STOP = 2 + +; Month calendar styles + +MCS_DAYSTATE = 1 +MCS_MULTISELECT = 2 +MCS_WEEKNUMBERS = 4 +MCS_NOTODAY_PRE_IE4 = 8 +MCS_NOTODAYCIRCLE = 8 +MCS_NOTODAY = 16 + +; Month calendar messages + +MCM_GETCURSEL = MCM_FIRST + 1 +MCM_SETCURSEL = MCM_FIRST + 2 +MCM_GETMAXSELCOUNT = MCM_FIRST + 3 +MCM_SETMAXSELCOUNT = MCM_FIRST + 4 +MCM_GETSELRANGE = MCM_FIRST + 5 +MCM_SETSELRANGE = MCM_FIRST + 6 +MCM_GETMONTHRANGE = MCM_FIRST + 7 +MCM_SETDAYSTATE = MCM_FIRST + 8 +MCM_GETMINREQRECT = MCM_FIRST + 9 +MCM_SETCOLOR = MCM_FIRST + 10 +MCM_GETCOLOR = MCM_FIRST + 11 +MCM_SETTODAY = MCM_FIRST + 12 +MCM_GETTODAY = MCM_FIRST + 13 +MCM_HITTEST = MCM_FIRST + 14 +MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15 +MCM_GETFIRSTDAYOFWEEK = MCM_FIRST + 16 +MCM_GETRANGE = MCM_FIRST + 17 +MCM_SETRANGE = MCM_FIRST + 18 +MCM_GETMONTHDELTA = MCM_FIRST + 19 +MCM_SETMONTHDELTA = MCM_FIRST + 20 + +; Month calendar hit test flags + +MCHT_TITLE = 0010000h +MCHT_CALENDAR = 0020000h +MCHT_TODAYLINK = 0030000h +MCHT_NEXT = 1000000h +MCHT_PREV = 2000000h +MCHT_NOWHERE = 0000000h +MCHT_TITLEBK = MCHT_TITLE +MCHT_TITLEMONTH = MCHT_TITLE or 1 +MCHT_TITLEYEAR = MCHT_TITLE or 2 +MCHT_TITLEBTNNEXT = MCHT_TITLE or MCHT_NEXT or 3 +MCHT_TITLEBTNPREV = MCHT_TITLE or MCHT_PREV or 3 +MCHT_CALENDARBK = MCHT_CALENDAR +MCHT_CALENDARDATE = MCHT_CALENDAR or 1 +MCHT_CALENDARDATENEXT = MCHT_CALENDARDATE or MCHT_NEXT +MCHT_CALENDARDATEPREV = MCHT_CALENDARDATE or MCHT_PREV +MCHT_CALENDARDAY = MCHT_CALENDAR or 2 +MCHT_CALENDARWEEKNUM = MCHT_CALENDAR or 3 + +; Month calendar color codes + +MCSC_BACKGROUND = 0 +MCSC_TEXT = 1 +MCSC_TITLEBK = 2 +MCSC_TITLETEXT = 3 +MCSC_MONTHBK = 4 +MCSC_TRAILINGTEXT = 5 + +; Month calendar notifications + +MCN_SELCHANGE = MCN_FIRST + 1 +MCN_GETDAYSTATE = MCN_FIRST + 3 +MCN_SELECT = MCN_FIRST + 4 + +; Date-time pick control messages + +DTM_GETSYSTEMTIME = DTM_FIRST + 1 +DTM_SETSYSTEMTIME = DTM_FIRST + 2 +DTM_GETRANGE = DTM_FIRST + 3 +DTM_SETRANGE = DTM_FIRST + 4 +DTM_SETFORMATA = DTM_FIRST + 5 +DTM_SETMCCOLOR = DTM_FIRST + 6 +DTM_GETMCCOLOR = DTM_FIRST + 7 +DTM_GETMONTHCAL = DTM_FIRST + 8 +DTM_SETMCFONT = DTM_FIRST + 9 +DTM_GETMCFONT = DTM_FIRST + 10 +DTM_SETFORMATW = DTM_FIRST + 50 +DTM_SETFORMAT = DTM_SETFORMATA + +; Date-time pick control styles + +DTS_UPDOWN = 01h +DTS_SHOWNONE = 02h +DTS_SHORTDATEFORMAT = 00h +DTS_LONGDATEFORMAT = 04h +DTS_TIMEFORMAT = 09h +DTS_APPCANPARSE = 10h +DTS_RIGHTALIGN = 20h + +; Date-time pick control notifications + +DTN_DATETIMECHANGE = DTN_FIRST + 1 +DTN_USERSTRINGA = DTN_FIRST + 2 +DTN_WMKEYDOWNA = DTN_FIRST + 3 +DTN_FORMATA = DTN_FIRST + 4 +DTN_FORMATQUERYA = DTN_FIRST + 5 +DTN_DROPDOWN = DTN_FIRST + 6 +DTN_CLOSEUP = DTN_FIRST + 7 +DTN_USERSTRINGW = DTN_FIRST + 15 +DTN_WMKEYDOWNW = DTN_FIRST + 16 +DTN_FORMATW = DTN_FIRST + 17 +DTN_FORMATQUERYW = DTN_FIRST + 18 +DTN_USERSTRING = DTN_USERSTRINGA +DTN_WMKEYDOWN = DTN_WMKEYDOWNA +DTN_FORMAT = DTN_FORMATA +DTN_FORMATQUERY = DTN_FORMATQUERYA + +; ImageList_LoadImage types + +IMAGE_BITMAP = 0 +IMAGE_ICON = 1 +IMAGE_CURSOR = 2 +IMAGE_ENHMETAFILE = 3 + +; ImageList_LoadImage flags + +LR_DEFAULTCOLOR = 0000h +LR_MONOCHROME = 0001h +LR_COLOR = 0002h +LR_COPYRETURNORG = 0004h +LR_COPYDELETEORG = 0008h +LR_LOADFROMFILE = 0010h +LR_LOADTRANSPARENT = 0020h +LR_DEFAULTSIZE = 0040h +LR_VGACOLOR = 0080h +LR_LOADMAP3DCOLORS = 1000h +LR_CREATEDIBSECTION = 2000h +LR_COPYFROMRESOURCE = 4000h +LR_SHARED = 8000h + +; IP control messages + +IPM_CLEARADDRESS = WM_USER + 100 +IPM_SETADDRESS = WM_USER + 101 +IPM_GETADDRESS = WM_USER + 102 +IPM_SETRANGE = WM_USER + 103 +IPM_SETFOCUS = WM_USER + 104 +IPM_ISBLANK = WM_USER + 105 + +; Custom Draw flags + +CDRF_DODEFAULT = 0 +CDRF_NEWFONT = 2 +CDRF_SKIPDEFAULT = 4 +CDRF_NOTIFYPOSTPAINT = 10h +CDRF_NOTIFYITEMDRAW = 20h +CDRF_NOTIFYSUBITEMDRAW = 20h +CDRF_NOTIFYPOSTERASE = 40h +CDDS_PREPAINT = 1 +CDDS_POSTPAINT = 2 +CDDS_PREERASE = 3 +CDDS_POSTERASE = 4 +CDDS_ITEM = 10000h +CDDS_ITEMPREPAINT = CDDS_ITEM or CDDS_PREPAINT +CDDS_ITEMPOSTPAINT = CDDS_ITEM or CDDS_POSTPAINT +CDDS_ITEMPREERASE = CDDS_ITEM or CDDS_PREERASE +CDDS_ITEMPOSTERASE = CDDS_ITEM or CDDS_POSTERASE +CDDS_SUBITEM = 20000h +CDIS_SELECTED = 1 +CDIS_GRAYED = 2 +CDIS_DISABLED = 4 +CDIS_CHECKED = 8 +CDIS_FOCUS = 10h +CDIS_DEFAULT = 20h +CDIS_HOT = 40h +CDIS_MARKED = 80h +CDIS_INDETERMINATE = 100h diff --git a/fasmw172/INCLUDE/EQUATES/COMCTL64.INC b/fasmw172/INCLUDE/EQUATES/COMCTL64.INC new file mode 100644 index 0000000..cd6648f --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/COMCTL64.INC @@ -0,0 +1,1871 @@ + +; COMCTL32.DLL structures and constants + +struct PROPSHEETPAGE + dwSize dd ? + dwFlags dd ? + hInstance dq ? + pszTemplate dq ? + pszIcon dq ? + pszTitle dq ? + pfnDlgProc dq ? + lParam dd ?,? + pfnCallback dq ? + pcRefParent dq ? +ends + +struct PROPSHEETHEADER + dwSize dd ? + dwFlags dd ? + hwndParent dq ? + hInstance dq ? + pszIcon dq ? + pszCaption dq ? + nPages dd ?,? + pStartPage dq ? + ppsp dq ? + pfnCallback dq ? +ends + +struct IMAGEINFO + hbmImage dq ? + hbmMask dq ? + Unused1 dd ? + Unused2 dd ? + rcImage RECT +ends + +struct HD_ITEM + mask dd ? + cxy dd ? + pszText dq ? + hbm dq ? + cchTextMax dd ? + fmt dd ? + lParam dd ? +ends + +struct HD_LAYOUT + prc dq ? + pwpos dq ? +ends + +struct HD_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct HD_NOTIFY + hdr NMHDR + iItem dd ? + iButton dd ? + pitem dq ? +ends + +struct TBBUTTON + iBitmap dd ? + idCommand dd ? + fsState db ? + fsStyle db ?,6 dup ? + dwData dq ? + iString dq ? +ends + +struct COLORMAP + from dd ? + to dd ? +ends + +struct TBADDBITMAP + hInst dq ? + nID dd ?,? +ends + +struct TBSAVEPARAMS + hkr dq ? + pszSubKey dq ? + pszValueName dq ? +ends + +struct TBREPLACEBITMAP + hInstOld dq ? + nIDOld dq ? + hInstNew dq ? + nIDNew dq ? + nButtons dq ? +ends + +struct NMTOOLBAR + hdr NMHDR + iItem dd ? + tbButton TBBUTTON + cchText dd ? + pszText dq ? +ends + +struct REBARINFO + cbSize dd ? + fMask dd ? + himl dq ? +ends + +struct REBARBANDINFO + cbSize dd ? + fMask dd ? + fStyle dd ? + clrFore dd ? + clrBack dd ?,? + lpText dq ? + cch dd ? + iImage dd ? + hwndChild dd ? + cxMinChild dd ? + cyMinChild dd ? + cx dd ? + hbmBack dq ? + wID dd ? +ends + +struct TOOLINFO + cbSize dd ? + uFlags dd ? + hwnd dq ? + uId dq ? + rect RECT + hInst dq ? + lpszText dq ? + lParam dq ? + lpReserved dq ? +ends + +struct TTHITTESTINFO + hwnd dq ? + pt POINT + ti TOOLINFO +ends + +struct TOOLTIPTEXT + hdr NMHDR + lpszText dq ? + szText db 80 dup (?) + hinst dq ? + uFlags dd ? +ends + +struct UDACCEL + nSec dd ? + nInc dd ? +ends + +struct NM_UPDOWN + hdr NMHDR + iPos dd ? + iDelta dd ? +ends + +struct LV_ITEM + mask dd ? + iItem dd ? + iSubItem dd ? + state dd ? + stateMask dd ?,? + pszText dq ? + cchTextMax dd ? + iImage dd ? + lParam dd ? + iIndent dd ? +ends + +struct LV_FINDINFO + flags dd ?,? + psz dq ? + lParam dq ? + pt POINT + vkDirection dd ? +ends + +struct LV_HITTESTINFO + pt POINT + flags dd ? + iItem dd ? +ends + +struct LV_COLUMN + mask dd ? + fmt dd ? + cx dd ?,? + pszText dq ? + cchTextMax dd ? + iSubItem dd ? +ends + +struct NM_LISTVIEW + hdr NMHDR + iItem dd ? + iSubItem dd ? + uNewState dd ? + uOldState dd ? + uChanged dd ? + ptAction POINT + dd ? + lParam dq ? +ends + +struct NM_CACHEHINT + hdr NMHDR + iFrom dd ? + iTo dd ? +ends + +struct NM_FINDITEM + hdr NMHDR + iStart dd ? + lvfi LV_FINDINFO +ends + +struct LV_DISPINFO + hdr NMHDR + item LV_ITEM +ends + +struct LV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TV_ITEM + mask dd ?,? + hItem dq ? + state dd ? + stateMask dd ? + pszText dq ? + cchTextMax dd ? + iImage dd ? + iSelectedImage dd ? + cChildren dd ? + lParam dd ? +ends + +struct TV_INSERTSTRUCT + hParent dq ? + hInsertAfter dq ? + item TV_ITEM +ends + +struct TV_HITTESTINFO + pt POINT + flags dd ?,? + hItem dq ? +ends + +struct TV_SORTCB + hParent dq ? + lpfnCompare dq ? + lParam dq ? +ends + +struct NM_TREEVIEW + hdr NMHDR + action dd ? + itemOld TV_ITEM + itemNew TV_ITEM + ptDrag POINT +ends + +struct TV_DISPINFO + hdr NMHDR + item TV_ITEM +ends + +struct TV_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct TC_ITEMHEADER + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ?,? + pszText dq ? + cchTextMax dd ? + iImage dd ? +ends + +struct TC_ITEM + mask dd ? + lpReserved1 dd ? + lpReserved2 dd ?,? + pszText dq ? + cchTextMax dd ? + iImage dd ? + lParam dd ? +ends + +struct TC_HITTESTINFO + pt POINT + flags dd ? +ends + +struct TC_KEYDOWN + hdr NMHDR + wVKey dw ? + flags dd ? +ends + +struct MC_HITTESTINFO + cbSize dd ? + pt POINT + uHit dd ? + st SYSTEMTIME +ends + +struct NM_SELCHANGE + nmhdr NMHDR + stSelStart SYSTEMTIME + stSelEnd SYSTEMTIME +ends + +struct NM_DAYSTATE + nmhdr NMHDR + stStart SYSTEMTIME + cDayState dd ? + prgDayState dd ? +ends + +struct NM_DATETIMECHANGE + nmhdr NMHDR + dwFlags dd ? + st SYSTEMTIME +ends + +struct NM_DATETIMESTRING + nmhdr NMHDR + pszUserString dq ? + st SYSTEMTIME + dwFlags dd ? +ends + +struct NM_DATETIMEWMKEYDOWN + nmhdr NMHDR + nVirtKey dd ?,? + pszFormat dq ? + st SYSTEMTIME +ends + +struct NM_DATETIMEFORMAT + nmhdr NMHDR + pszFormat dq ? + st SYSTEMTIME + pszDisplay dq ? + szDisplay db 64 dup (?) +ends + +struct NM_DATETIMEFORMATQUERY + nmhdr NMHDR + pszFormat dq ? + szMax SIZE +ends + +struct INITCOMMONCONTROLSEX + dwSize dd ? + dwICC dd ? +ends + +; Common control window classes + +HOTKEY_CLASS equ 'msctls_hotkey32' +PROGRESS_CLASS equ 'msctls_progress32' +STATUS_CLASS equ 'msctls_statusbar32' +TRACKBAR_CLASS equ 'msctls_trackbar32' +UPDOWN_CLASS equ 'msctls_updown32' +TOOLTIPS_CLASS equ 'tooltips_class32' +ANIMATE_CLASS equ 'SysAnimate32' +HEADER_CLASS equ 'SysHeader32' +LISTVIEW_CLASS equ 'SysListView32' +TREEVIEW_CLASS equ 'SysTreeView32' +TABCONTROL_CLASS equ 'SysTabControl32' +MONTHCAL_CLASS equ 'SysMonthCal32' +DATETIMEPICK_CLASS equ 'SysDateTimePick32' +TOOLBAR_CLASS equ 'ToolbarWindow32' +REBAR_CLASS equ 'ReBarWindow32' + +; Ranges for control message IDs + +LVM_FIRST = 1000h +TV_FIRST = 1100h +HDM_FIRST = 1200h +TCM_FIRST = 1300h +MCM_FIRST = 1000h +DTM_FIRST = 1000h +CCM_FIRST = 2000h + +; Ranges for control notification IDs + +NM_FIRST = 0 +LVN_FIRST = -100 +PSN_FIRST = -200 +HDN_FIRST = -300 +TVN_FIRST = -400 +TTN_FIRST = -520 +TCN_FIRST = -550 +CDN_FIRST = -601 +TBN_FIRST = -700 +UDN_FIRST = -721 +MCN_FIRST = -750 +DTN_FIRST = -760 +CBEN_FIRST = -800 +RBN_FIRST = -831 + +; Generic notifications + +NM_OUTOFMEMORY = NM_FIRST - 1 +NM_CLICK = NM_FIRST - 2 +NM_DBLCLK = NM_FIRST - 3 +NM_RETURN = NM_FIRST - 4 +NM_RCLICK = NM_FIRST - 5 +NM_RDBLCLK = NM_FIRST - 6 +NM_SETFOCUS = NM_FIRST - 7 +NM_KILLFOCUS = NM_FIRST - 8 +NM_CUSTOMDRAW = NM_FIRST - 12 + +; Common control styles + +CCS_TOP = 01h +CCS_NOMOVEY = 02h +CCS_BOTTOM = 03h +CCS_NORESIZE = 04h +CCS_NOPARENTALIGN = 08h +CCS_ADJUSTABLE = 20h +CCS_NODIVIDER = 40h +CCS_VERT = 80h +CCS_LEFT = CCS_VERT or CCS_TOP +CCS_RIGHT = CCS_VERT or CCS_BOTTOM +CCS_NOMOVEX = CCS_VERT or CCS_NOMOVEY + +; Owner-drawn control types + +ODT_HEADER = 100 +ODT_TAB = 101 +ODT_LISTVIEW = 102 + +; InitCommonControlsEx classes + +ICC_ANIMATE_CLASS = 0080h +ICC_BAR_CLASSES = 0004h +ICC_COOL_CLASSES = 0400h +ICC_DATE_CLASSES = 0100h +ICC_HOTKEY_CLASS = 0040h +ICC_INTERNET_CLASSES = 0800h +ICC_LISTVIEW_CLASSES = 0001h +ICC_PAGESCROLLER_CLASS = 1000h +ICC_PROGRESS_CLASS = 0020h +ICC_TAB_CLASSES = 0008h +ICC_TREEVIEW_CLASSES = 0002h +ICC_UPDOWN_CLASS = 0010h +ICC_USEREX_CLASSES = 0200h +ICC_WIN95_CLASSES = 00FFh + +; Shared messages + +CCM_SETCOLORSCHEME = CCM_FIRST + 2 +CCM_GETCOLORSCHEME = CCM_FIRST + 3 +CCM_GETDROPTARGET = CCM_FIRST + 4 +CCM_SETUNICODEFORMAT = CCM_FIRST + 5 +CCM_GETUNICODEFORMAT = CCM_FIRST + 6 + +; Property sheet page flags + +PSP_DEFAULT = 0000h +PSP_DLGINDIRECT = 0001h +PSP_USEHICON = 0002h +PSP_USEICONID = 0004h +PSP_USETITLE = 0008h +PSP_HASHELP = 0020h +PSP_USEREFPARENT = 0040h +PSP_USECALLBACK = 0080h + +; Property sheet page actions + +PSPCB_RELEASE = 1 +PSPCB_CREATE = 2 + +; Property sheet header flags + +PSH_DEFAULT = 0000h +PSH_PROPTITLE = 0001h +PSH_USEHICON = 0002h +PSH_USEICONID = 0004h +PSH_PROPSHEETPAGE = 0008h +PSH_MULTILINETABS = 0010h +PSH_WIZARD = 0020h +PSH_USEPSTARTPAGE = 0040h +PSH_NOAPPLYNOW = 0080h +PSH_USECALLBACK = 0100h +PSH_HASHELP = 0200h +PSH_MODELESS = 0400h + +; Property sheet actions + +PSCB_INITIALIZED = 1 + +; Property sheet notifications + +PSN_SETACTIVE = PSN_FIRST - 0 +PSN_KILLACTIVE = PSN_FIRST - 1 +PSN_APPLY = PSN_FIRST - 2 +PSN_RESET = PSN_FIRST - 3 +PSN_HELP = PSN_FIRST - 5 +PSN_WIZBACK = PSN_FIRST - 6 +PSN_WIZNEXT = PSN_FIRST - 7 +PSN_WIZFINISH = PSN_FIRST - 8 +PSN_QUERYCANCEL = PSN_FIRST - 9 + +; Property sheet return values + +PSNRET_NOERROR = 0 +PSNRET_INVALID = 1 +PSNRET_INVALID_NOCHANGEPAGE = 2 + +; Property sheet messages + +PSM_SETCURSEL = WM_USER + 101 +PSM_REMOVEPAGE = WM_USER + 102 +PSM_ADDPAGE = WM_USER + 103 +PSM_CHANGED = WM_USER + 104 +PSM_RESTARTWINDOWS = WM_USER + 105 +PSM_REBOOTSYSTEM = WM_USER + 106 +PSM_CANCELTOCLOSE = WM_USER + 107 +PSM_QUERYSIBLINGS = WM_USER + 108 +PSM_UNCHANGED = WM_USER + 109 +PSM_APPLY = WM_USER + 110 +PSM_SETTITLE = WM_USER + 111 +PSM_SETTITLEW = WM_USER + 120 +PSM_SETWIZBUTTONS = WM_USER + 112 +PSM_PRESSBUTTON = WM_USER + 113 +PSM_SETCURSELID = WM_USER + 114 +PSM_SETFINISHTEXT = WM_USER + 115 +PSM_SETFINISHTEXTW = WM_USER + 121 +PSM_GETTABCONTROL = WM_USER + 116 +PSM_ISDIALOGMESSAGE = WM_USER + 117 + +; Property sheet buttons + +PSBTN_BACK = 0 +PSBTN_NEXT = 1 +PSBTN_FINISH = 2 +PSBTN_OK = 3 +PSBTN_APPLYNOW = 4 +PSBTN_CANCEL = 5 +PSBTN_HELP = 6 +PSWIZB_BACK = 1 +PSWIZB_NEXT = 2 +PSWIZB_FINISH = 4 +PSWIZB_DISABLEDFINISH = 8 +ID_PSRESTARTWINDOWS = 2 +ID_PSREBOOTSYSTEM = ID_PSRESTARTWINDOWS or 1 + +; Property sheet sizes + +PROP_SM_CXDLG = 212 +PROP_SM_CYDLG = 188 +PROP_MED_CXDLG = 227 +PROP_MED_CYDLG = 215 +PROP_LG_CXDLG = 252 +PROP_LG_CYDLG = 218 +WIZ_CXDLG = 276 +WIZ_CYDLG = 140 +WIZ_CXBMP = 80 +WIZ_BODYX = 92 +WIZ_BODYCX = 184 + +; Image list types + +ILC_MASK = 001h +ILC_COLOR = 0FEh +ILC_COLORDDB = 0FEh +ILC_COLOR4 = 004h +ILC_COLOR8 = 008h +ILC_COLOR16 = 010h +ILC_COLOR24 = 018h +ILC_COLOR32 = 020h +ILC_PALETTE = 800h + +; Image list color values + +CLR_NONE = 0FFFFFFFFh +CLR_DEFAULT = 0FF000000h +CLR_HILIGHT = CLR_DEFAULT + +; Image list drawing styles + +ILD_NORMAL = 0000h +ILD_TRANSPARENT = 0001h +ILD_MASK = 0010h +ILD_IMAGE = 0020h +ILD_BLEND25 = 0002h +ILD_BLEND50 = 0004h +ILD_OVERLAYMASK = 0F00h +ILD_SELECTED = ILD_BLEND50 +ILD_FOCUS = ILD_BLEND25 +ILD_BLEND = ILD_BLEND50 + +; Header control styles + +HDS_HORZ = 00h +HDS_BUTTONS = 02h +HDS_HOTTRACK = 04h +HDS_HIDDEN = 08h +HDS_DRAGDROP = 40h +HDS_FULLDRAG = 80h + +; Header control structure flags + +HDI_WIDTH = 01h +HDI_HEIGHT = HDI_WIDTH +HDI_TEXT = 02h +HDI_FORMAT = 04h +HDI_LPARAM = 08h +HDI_BITMAP = 10h + +; Header control flags + +HDF_LEFT = 0000h +HDF_RIGHT = 0001h +HDF_CENTER = 0002h +HDF_JUSTIFYMASK = 0003h +HDF_RTLREADING = 0004h +HDF_BITMAP = 2000h +HDF_STRING = 4000h +HDF_OWNERDRAW = 8000h + +; Header control messages + +HDM_GETITEMCOUNT = HDM_FIRST + 0 +HDM_INSERTITEMA = HDM_FIRST + 1 +HDM_DELETEITEM = HDM_FIRST + 2 +HDM_GETITEMA = HDM_FIRST + 3 +HDM_SETITEMA = HDM_FIRST + 4 +HDM_LAYOUT = HDM_FIRST + 5 +HDM_HITTEST = HDM_FIRST + 6 +HDM_INSERTITEMW = HDM_FIRST + 10 +HDM_GETITEMW = HDM_FIRST + 11 +HDM_SETITEMW = HDM_FIRST + 12 +HDM_INSERTITEM = HDM_INSERTITEMA +HDM_GETITEM = HDM_GETITEMA +HDM_SETITEM = HDM_SETITEMA + +; Hit test result flags + +HHT_NOWHERE = 001h +HHT_ONHEADER = 002h +HHT_ONDIVIDER = 004h +HHT_ONDIVOPEN = 008h +HHT_ABOVE = 100h +HHT_BELOW = 200h +HHT_TORIGHT = 400h +HHT_TOLEFT = 800h + +; Header control notifications + +HDN_ITEMCHANGINGA = HDN_FIRST - 0 +HDN_ITEMCHANGEDA = HDN_FIRST - 1 +HDN_ITEMCLICKA = HDN_FIRST - 2 +HDN_ITEMDBLCLICKA = HDN_FIRST - 3 +HDN_DIVIDERDBLCLICKA = HDN_FIRST - 5 +HDN_BEGINTRACKA = HDN_FIRST - 6 +HDN_ENDTRACKA = HDN_FIRST - 7 +HDN_TRACKA = HDN_FIRST - 8 +HDN_ITEMCHANGINGW = HDN_FIRST - 20 +HDN_ITEMCHANGEDW = HDN_FIRST - 21 +HDN_ITEMCLICKW = HDN_FIRST - 22 +HDN_ITEMDBLCLICKW = HDN_FIRST - 23 +HDN_DIVIDERDBLCLICKW = HDN_FIRST - 25 +HDN_BEGINTRACKW = HDN_FIRST - 26 +HDN_ENDTRACKW = HDN_FIRST - 27 +HDN_TRACKW = HDN_FIRST - 28 +HDN_ITEMCHANGING = HDN_ITEMCHANGINGA +HDN_ITEMCHANGED = HDN_ITEMCHANGEDA +HDN_ITEMCLICK = HDN_ITEMCLICKA +HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKA +HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKA +HDN_BEGINTRACK = HDN_BEGINTRACKA +HDN_ENDTRACK = HDN_ENDTRACKA +HDN_TRACK = HDN_TRACKA + +; Toolbar bitmap flags + +CMB_MASKED = 2 + +; Toolbar button states + +TBSTATE_CHECKED = 01h +TBSTATE_PRESSED = 02h +TBSTATE_ENABLED = 04h +TBSTATE_HIDDEN = 08h +TBSTATE_INDETERMINATE = 10h +TBSTATE_WRAP = 20h +TBSTATE_ELLIPSES = 40h + +; Toolbar button styles + +TBSTYLE_BUTTON = 0000h +TBSTYLE_SEP = 0001h +TBSTYLE_CHECK = 0002h +TBSTYLE_GROUP = 0004h +TBSTYLE_CHECKGROUP = TBSTYLE_GROUP or TBSTYLE_CHECK +TBSTYLE_DROPDOWN = 0008h +TBSTYLE_TOOLTIPS = 0100h +TBSTYLE_WRAPABLE = 0200h +TBSTYLE_ALTDRAG = 0400h +TBSTYLE_FLAT = 0800h +TBSTYLE_LIST = 1000h +TBSTYLE_CUSTOMERASE = 2000h +TBSTYLE_TRANSPARENT = 8000h + +; Toolbar button extended styles + +TBSTYLE_EX_DRAWDDARROWS = 0001h + +; Toolbar messages + +TB_ENABLEBUTTON = WM_USER + 1 +TB_CHECKBUTTON = WM_USER + 2 +TB_PRESSBUTTON = WM_USER + 3 +TB_HIDEBUTTON = WM_USER + 4 +TB_INDETERMINATE = WM_USER + 5 +TB_ISBUTTONENABLED = WM_USER + 9 +TB_ISBUTTONCHECKED = WM_USER + 10 +TB_ISBUTTONPRESSED = WM_USER + 11 +TB_ISBUTTONHIDDEN = WM_USER + 12 +TB_ISBUTTONINDETERMINATE = WM_USER + 13 +TB_SETSTATE = WM_USER + 17 +TB_GETSTATE = WM_USER + 18 +TB_ADDBITMAP = WM_USER + 19 +TB_ADDBUTTONS = WM_USER + 20 +TB_INSERTBUTTON = WM_USER + 21 +TB_DELETEBUTTON = WM_USER + 22 +TB_GETBUTTON = WM_USER + 23 +TB_BUTTONCOUNT = WM_USER + 24 +TB_COMMANDTOINDEX = WM_USER + 25 +TB_SAVERESTOREA = WM_USER + 26 +TB_ADDSTRINGA = WM_USER + 28 +TB_CUSTOMIZE = WM_USER + 27 +TB_GETITEMRECT = WM_USER + 29 +TB_BUTTONSTRUCTSIZE = WM_USER + 30 +TB_SETBUTTONSIZE = WM_USER + 31 +TB_SETBITMAPSIZE = WM_USER + 32 +TB_AUTOSIZE = WM_USER + 33 +TB_GETTOOLTIPS = WM_USER + 35 +TB_SETTOOLTIPS = WM_USER + 36 +TB_SETPARENT = WM_USER + 37 +TB_SETROWS = WM_USER + 39 +TB_GETROWS = WM_USER + 40 +TB_GETBITMAPFLAGS = WM_USER + 41 +TB_SETCMDID = WM_USER + 42 +TB_CHANGEBITMAP = WM_USER + 43 +TB_GETBITMAP = WM_USER + 44 +TB_GETBUTTONTEXTA = WM_USER + 45 +TB_REPLACEBITMAP = WM_USER + 46 +TB_SETINDENT = WM_USER + 47 +TB_SETIMAGELIST = WM_USER + 48 +TB_GETIMAGELIST = WM_USER + 49 +TB_LOADIMAGES = WM_USER + 50 +TB_GETRECT = WM_USER + 51 +TB_SETHOTIMAGELIST = WM_USER + 52 +TB_GETHOTIMAGELIST = WM_USER + 53 +TB_SETDISABLEDIMAGELIST = WM_USER + 54 +TB_GETDISABLEDIMAGELIST = WM_USER + 55 +TB_SETSTYLE = WM_USER + 56 +TB_GETSTYLE = WM_USER + 57 +TB_GETBUTTONSIZE = WM_USER + 58 +TB_SETBUTTONWIDTH = WM_USER + 59 +TB_SETMAXTEXTROWS = WM_USER + 60 +TB_GETTEXTROWS = WM_USER + 61 +TB_GETBUTTONTEXTW = WM_USER + 75 +TB_SAVERESTOREW = WM_USER + 76 +TB_ADDSTRINGW = WM_USER + 77 +TB_SETEXTENDEDSTYLE = WM_USER + 84 +TB_GETEXTENDEDSTYLE = WM_USER + 85 +TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA +TB_SAVERESTORE = TB_SAVERESTOREA +TB_ADDSTRING = TB_ADDSTRINGA + +; System-defined button bitmaps + +HINST_COMMCTRL = -1 +IDB_STD_SMALL_COLOR = 0 +IDB_STD_LARGE_COLOR = 1 +IDB_VIEW_SMALL_COLOR = 4 +IDB_VIEW_LARGE_COLOR = 5 +IDB_HIST_SMALL_COLOR = 8 +IDB_HIST_LARGE_COLOR = 9 + +; Icon indexes for standard bitmap + +STD_CUT = 0 +STD_COPY = 1 +STD_PASTE = 2 +STD_UNDO = 3 +STD_REDOW = 4 +STD_DELETE = 5 +STD_FILENEW = 6 +STD_FILEOPEN = 7 +STD_FILESAVE = 8 +STD_PRINTPRE = 9 +STD_PROPERTIES = 10 +STD_HELP = 11 +STD_FIND = 12 +STD_REPLACE = 13 +STD_PRINT = 14 + +; Icon indexes for standard view bitmap + +VIEW_LARGEICONS = 0 +VIEW_SMALLICONS = 1 +VIEW_LIST = 2 +VIEW_DETAILS = 3 +VIEW_SORTNAME = 4 +VIEW_SORTSIZE = 5 +VIEW_SORTDATE = 6 +VIEW_SORTTYPE = 7 +VIEW_PARENTFOLDER = 8 +VIEW_NETCONNECT = 9 +VIEW_NETDISCONNECT = 10 +VIEW_NEWFOLDER = 11 + +; Icon indexes for history bitmap + +HIST_BACK = 0 +HIST_FORWARD = 1 +HIST_FAVORITES = 2 +HIST_ADDTOFAVORITES = 3 +HIST_VIEWTREE = 4 + +; Toolbar bitmap flags + +TBBF_LARGE = 1 + +; Toolbar notifications + +TBN_GETBUTTONINFOA = TBN_FIRST - 0 +TBN_BEGINDRAG = TBN_FIRST - 1 +TBN_ENDDRAG = TBN_FIRST - 2 +TBN_BEGINADJUST = TBN_FIRST - 3 +TBN_ENDADJUST = TBN_FIRST - 4 +TBN_RESET = TBN_FIRST - 5 +TBN_QUERYINSERT = TBN_FIRST - 6 +TBN_QUERYDELETE = TBN_FIRST - 7 +TBN_TOOLBARCHANGE = TBN_FIRST - 8 +TBN_CUSTHELP = TBN_FIRST - 9 +TBN_DROPDOWN = TBN_FIRST - 10 +TBN_CLOSEUP = TBN_FIRST - 11 +TBN_GETBUTTONINFOW = TBN_FIRST - 20 +TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA + +; ReBar styles + +RBS_TOOLTIPS = 100h +RBS_VARHEIGHT = 200h +RBS_BANDBORDERS = 400h +RBS_FIXEDORDER = 800h +RBS_REGISTERDROP = 1000h +RBS_AUTOSIZE = 2000h +RBS_VERTICALGRIPPER = 4000h +RBS_DBLCLKTOGGLE = 8000h + +; ReBar band info structure flags + +RBBIM_STYLE = 001h +RBBIM_COLORS = 002h +RBBIM_TEXT = 004h +RBBIM_IMAGE = 008h +RBBIM_CHILD = 010h +RBBIM_CHILDSIZE = 020h +RBBIM_SIZE = 040h +RBBIM_BACKGROUND = 080h +RBBIM_ID = 100h +RBBIM_IDEALSIZE = 200h +RBBIM_LPARAM = 400h +RBBIM_HEADERSIZE = 800h + +; ReBar band styles + +RBBS_BREAK = 001h +RBBS_FIXEDSIZE = 002h +RBBS_CHILDEDGE = 004h +RBBS_HIDDEN = 008h +RBBS_NOVERT = 010h +RBBS_FIXEDBMP = 020h +RBBS_VARIABLEHEIGHT = 040h +RBBS_GRIPPERALWAYS = 080h +RBBS_NOGRIPPER = 100h + +; ReBar messages + +RB_INSERTBANDA = WM_USER + 1 +RB_DELETEBAND = WM_USER + 2 +RB_GETBARINFO = WM_USER + 3 +RB_SETBARINFO = WM_USER + 4 +RB_GETBANDINFO = WM_USER + 5 +RB_SETBANDINFOA = WM_USER + 6 +RB_SETPARENT = WM_USER + 7 +RB_INSERTBANDW = WM_USER + 10 +RB_SETBANDINFOW = WM_USER + 11 +RB_GETBANDCOUNT = WM_USER + 12 +RB_GETROWCOUNT = WM_USER + 13 +RB_GETROWHEIGHT = WM_USER + 14 +RB_IDTOINDEX = WM_USER + 16 +RB_GETTOOLTIPS = WM_USER + 17 +RB_SETTOOLTIPS = WM_USER + 18 +RB_SETBKCOLOR = WM_USER + 19 +RB_GETBKCOLOR = WM_USER + 20 +RB_SETTEXTCOLOR = WM_USER + 21 +RB_GETTEXTCOLOR = WM_USER + 22 +RB_SIZETORECT = WM_USER + 23 +RB_BEGINDRAG = WM_USER + 24 +RB_ENDDRAG = WM_USER + 25 +RB_DRAGMOVE = WM_USER + 26 +RB_GETBARHEIGHT = WM_USER + 27 +RB_GETBANDINFOW = WM_USER + 28 +RB_GETBANDINFOA = WM_USER + 29 +RB_MINIMIZEBAND = WM_USER + 30 +RB_MAXIMIZEBAND = WM_USER + 31 +RB_GETDROPTARGET = CCM_GETDROPTARGET +RB_GETBANDBORDERS = WM_USER + 34 +RB_SHOWBAND = WM_USER + 35 +RB_SETPALETTE = WM_USER + 37 +RB_GETPALETTE = WM_USER + 38 +RB_MOVEBAND = WM_USER + 39 +RB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT +RB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT +RB_INSERTBAND = RB_INSERTBANDA +RB_SETBANDINFO = RB_SETBANDINFOA + +; ReBar notifications + +RBN_HEIGHTCHANGE = RBN_FIRST - 0 +RBN_GETOBJECT = RBN_FIRST - 1 +RBN_LAYOUTCHANGED = RBN_FIRST - 2 +RBN_AUTOSIZE = RBN_FIRST - 3 +RBN_BEGINDRAG = RBN_FIRST - 4 +RBN_ENDDRAG = RBN_FIRST - 5 +RBN_DELETINGBAND = RBN_FIRST - 6 +RBN_DELETEDBAND = RBN_FIRST - 7 +RBN_CHILDSIZE = RBN_FIRST - 8 + +; Tooltip styles + +TTS_ALWAYSTIP = 1 +TTS_NOPREFIX = 2 + +; Tooltip flags + +TTF_IDISHWND = 01h +TTF_CENTERTIP = 02h +TTF_RTLREADING = 04h +TTF_SUBCLASS = 10h + +; Tooltip durations + +TTDT_AUTOMATIC = 0 +TTDT_RESHOW = 1 +TTDT_AUTOPOP = 2 +TTDT_INITIAL = 3 + +; Tooltip messages + +TTM_ACTIVATE = WM_USER + 1 +TTM_SETDELAYTIME = WM_USER + 3 +TTM_ADDTOOLA = WM_USER + 4 +TTM_DELTOOLA = WM_USER + 5 +TTM_NEWTOOLRECTA = WM_USER + 6 +TTM_RELAYEVENT = WM_USER + 7 +TTM_GETTOOLINFOA = WM_USER + 8 +TTM_SETTOOLINFOA = WM_USER + 9 +TTM_HITTESTA = WM_USER + 10 +TTM_GETTEXTA = WM_USER + 11 +TTM_UPDATETIPTEXTA = WM_USER + 12 +TTM_GETTOOLCOUNT = WM_USER + 13 +TTM_ENUMTOOLSA = WM_USER + 14 +TTM_GETCURRENTTOOLA = WM_USER + 15 +TTM_WINDOWFROMPOINT = WM_USER + 16 +TTM_ADDTOOLW = WM_USER + 50 +TTM_DELTOOLW = WM_USER + 51 +TTM_NEWTOOLRECTW = WM_USER + 52 +TTM_GETTOOLINFOW = WM_USER + 53 +TTM_SETTOOLINFOW = WM_USER + 54 +TTM_HITTESTW = WM_USER + 55 +TTM_GETTEXTW = WM_USER + 56 +TTM_UPDATETIPTEXTW = WM_USER + 57 +TTM_ENUMTOOLSW = WM_USER + 58 +TTM_GETCURRENTTOOLW = WM_USER + 59 +TTM_ADDTOOL = TTM_ADDTOOLA +TTM_DELTOOL = TTM_DELTOOLA +TTM_NEWTOOLRECT = TTM_NEWTOOLRECTA +TTM_GETTOOLINFO = TTM_GETTOOLINFOA +TTM_SETTOOLINFO = TTM_SETTOOLINFOA +TTM_HITTEST = TTM_HITTESTA +TTM_GETTEXT = TTM_GETTEXTA +TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA +TTM_ENUMTOOLS = TTM_ENUMTOOLSA +TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLA + +; Tooltip notifications + +TTN_NEEDTEXTA = TTN_FIRST - 0 +TTN_SHOW = TTN_FIRST - 1 +TTN_POP = TTN_FIRST - 2 +TTN_NEEDTEXTW = TTN_FIRST - 10 +TTN_NEEDTEXT = TTN_NEEDTEXTA + +; Status bar styles + +SBARS_SIZEGRIP = 100h + +; Status bar messages + +SB_SETTEXTA = WM_USER + 1 +SB_GETTEXTA = WM_USER + 2 +SB_GETTEXTLENGTHA = WM_USER + 3 +SB_SETPARTS = WM_USER + 4 +SB_GETPARTS = WM_USER + 6 +SB_GETBORDERS = WM_USER + 7 +SB_SETMINHEIGHT = WM_USER + 8 +SB_SIMPLE = WM_USER + 9 +SB_GETRECT = WM_USER + 10 +SB_SETTEXTW = WM_USER + 11 +SB_GETTEXTW = WM_USER + 13 +SB_GETTEXTLENGTHW = WM_USER + 12 +SB_SETTEXT = SB_SETTEXTA +SB_GETTEXT = SB_GETTEXTA +SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA + +; Status bar drawing types + +SBT_OWNERDRAW = 1000h +SBT_NOBORDERS = 0100h +SBT_POPOUT = 0200h +SBT_RTLREADING = 0400h + +; Trackbar styles + +TBS_AUTOTICKS = 01h +TBS_VERT = 02h +TBS_HORZ = 00h +TBS_TOP = 04h +TBS_BOTTOM = 00h +TBS_LEFT = 04h +TBS_RIGHT = 00h +TBS_BOTH = 08h +TBS_NOTICKS = 10h +TBS_ENABLESELRANGE = 20h +TBS_FIXEDLENGTH = 40h +TBS_NOTHUMB = 80h + +; Trackbar messages + +TBM_GETPOS = WM_USER + 0 +TBM_GETRANGEMIN = WM_USER + 1 +TBM_GETRANGEMAX = WM_USER + 2 +TBM_GETTIC = WM_USER + 3 +TBM_SETTIC = WM_USER + 4 +TBM_SETPOS = WM_USER + 5 +TBM_SETRANGE = WM_USER + 6 +TBM_SETRANGEMIN = WM_USER + 7 +TBM_SETRANGEMAX = WM_USER + 8 +TBM_CLEARTICS = WM_USER + 9 +TBM_SETSEL = WM_USER + 10 +TBM_SETSELSTART = WM_USER + 11 +TBM_SETSELEND = WM_USER + 12 +TBM_GETPTICS = WM_USER + 14 +TBM_GETTICPOS = WM_USER + 15 +TBM_GETNUMTICS = WM_USER + 16 +TBM_GETSELSTART = WM_USER + 17 +TBM_GETSELEND = WM_USER + 18 +TBM_CLEARSEL = WM_USER + 19 +TBM_SETTICFREQ = WM_USER + 20 +TBM_SETPAGESIZE = WM_USER + 21 +TBM_GETPAGESIZE = WM_USER + 22 +TBM_SETLINESIZE = WM_USER + 23 +TBM_GETLINESIZE = WM_USER + 24 +TBM_GETTHUMBRECT = WM_USER + 25 +TBM_GETCHANNELRECT = WM_USER + 26 +TBM_SETTHUMBLENGTH = WM_USER + 27 +TBM_GETTHUMBLENGTH = WM_USER + 28 + +; Trackbar notifications + +TB_LINEUP = 0 +TB_LINEDOWN = 1 +TB_PAGEUP = 2 +TB_PAGEDOWN = 3 +TB_THUMBPOSITION = 4 +TB_THUMBTRACK = 5 +TB_TOP = 6 +TB_BOTTOM = 7 +TB_ENDTRACK = 8 + +; Up-down control styles + +UDS_WRAP = 01h +UDS_SETBUDDYINT = 02h +UDS_ALIGNRIGHT = 04h +UDS_ALIGNLEFT = 08h +UDS_AUTOBUDDY = 10h +UDS_ARROWKEYS = 20h +UDS_HORZ = 40h +UDS_NOTHOUSANDS = 80h + +; Up-down control messages + +UDM_SETRANGE = WM_USER + 101 +UDM_GETRANGE = WM_USER + 102 +UDM_SETPOS = WM_USER + 103 +UDM_GETPOS = WM_USER + 104 +UDM_SETBUDDY = WM_USER + 105 +UDM_GETBUDDY = WM_USER + 106 +UDM_SETACCEL = WM_USER + 107 +UDM_GETACCEL = WM_USER + 108 +UDM_SETBASE = WM_USER + 109 +UDM_GETBASE = WM_USER + 110 + +; Up-down control notifications + +UDN_DELTAPOS = UDN_FIRST - 1 + +; Progress bar messages + +PBM_SETRANGE = WM_USER + 1 +PBM_SETPOS = WM_USER + 2 +PBM_DELTAPOS = WM_USER + 3 +PBM_SETSTEP = WM_USER + 4 +PBM_STEPIT = WM_USER + 5 +PBM_SETRANGE32 = WM_USER + 6 +PBM_GETRANGE = WM_USER + 7 +PBM_GETPOS = WM_USER + 8 + +; Hot-key control messages + +HKM_SETHOTKEY = WM_USER + 1 +HKM_GETHOTKEY = WM_USER + 2 +HKM_SETRULES = WM_USER + 3 + +; Hot key flags + +HOTKEYF_SHIFT = 1 +HOTKEYF_CONTROL = 2 +HOTKEYF_ALT = 4 +HOTKEYF_EXT = 8 + +; Key combination flags + +HKCOMB_NONE = 01h +HKCOMB_S = 02h +HKCOMB_C = 04h +HKCOMB_A = 08h +HKCOMB_SC = 10h +HKCOMB_SA = 20h +HKCOMB_CA = 40h +HKCOMB_SCA = 80h + +; List view styles + +LVS_ICON = 0000h +LVS_REPORT = 0001h +LVS_SMALLICON = 0002h +LVS_LIST = 0003h +LVS_TYPEMASK = 0003h +LVS_SINGLESEL = 0004h +LVS_SHOWSELALWAYS = 0008h +LVS_SORTASCENDING = 0010h +LVS_SORTDESCENDING = 0020h +LVS_SHAREIMAGELISTS = 0040h +LVS_NOLABELWRAP = 0080h +LVS_AUTOARRANGE = 0100h +LVS_EDITLABELS = 0200h +LVS_OWNERDATA = 1000h +LVS_NOSCROLL = 2000h +LVS_ALIGNTOP = 0000h +LVS_ALIGNLEFT = 0800h +LVS_OWNERDRAWFIXED = 0400h +LVS_NOCOLUMNHEADER = 4000h +LVS_NOSORTHEADER = 8000h + +; List view extended styles + +LVS_EX_GRIDLINES = 0001h +LVS_EX_SUBITEMIMAGES = 0002h +LVS_EX_CHECKBOXES = 0004h +LVS_EX_TRACKSELECT = 0008h +LVS_EX_HEADERDRAGDROP = 0010h +LVS_EX_FULLROWSELECT = 0020h +LVS_EX_ONECLICKACTIVATE = 0040h +LVS_EX_TWOCLICKACTIVATE = 0080h +LVS_EX_FLATSB = 0100h +LVS_EX_REGIONAL = 0200h +LVS_EX_INFOTIP = 0400h +LVS_EX_UNDERLINEHOT = 0800h +LVS_EX_UNDERLINECOLD = 1000h +LVS_EX_MULTIWORKAREAS = 2000h +LVS_EX_LABELTIP = 4000h + +; List view messages + +LVM_GETBKCOLOR = LVM_FIRST + 0 +LVM_SETBKCOLOR = LVM_FIRST + 1 +LVM_GETIMAGELIST = LVM_FIRST + 2 +LVM_SETIMAGELIST = LVM_FIRST + 3 +LVM_GETITEMCOUNT = LVM_FIRST + 4 +LVM_GETITEMA = LVM_FIRST + 5 +LVM_SETITEMA = LVM_FIRST + 6 +LVM_INSERTITEMA = LVM_FIRST + 7 +LVM_DELETEITEM = LVM_FIRST + 8 +LVM_DELETEALLITEMS = LVM_FIRST + 9 +LVM_GETCALLBACKMASK = LVM_FIRST + 10 +LVM_SETCALLBACKMASK = LVM_FIRST + 11 +LVM_GETNEXTITEM = LVM_FIRST + 12 +LVM_FINDITEMA = LVM_FIRST + 13 +LVM_GETITEMRECT = LVM_FIRST + 14 +LVM_SETITEMPOSITION = LVM_FIRST + 15 +LVM_GETITEMPOSITION = LVM_FIRST + 16 +LVM_GETSTRINGWIDTHA = LVM_FIRST + 17 +LVM_HITTEST = LVM_FIRST + 18 +LVM_ENSUREVISIBLE = LVM_FIRST + 19 +LVM_SCROLL = LVM_FIRST + 20 +LVM_REDRAWITEMS = LVM_FIRST + 21 +LVM_ARRANGE = LVM_FIRST + 22 +LVM_EDITLABELA = LVM_FIRST + 23 +LVM_GETEDITCONTROL = LVM_FIRST + 24 +LVM_GETCOLUMNA = LVM_FIRST + 25 +LVM_SETCOLUMNA = LVM_FIRST + 26 +LVM_INSERTCOLUMNA = LVM_FIRST + 27 +LVM_DELETECOLUMN = LVM_FIRST + 28 +LVM_GETCOLUMNWIDTH = LVM_FIRST + 29 +LVM_SETCOLUMNWIDTH = LVM_FIRST + 30 +LVM_CREATEDRAGIMAGE = LVM_FIRST + 33 +LVM_GETVIEWRECT = LVM_FIRST + 34 +LVM_GETTEXTCOLOR = LVM_FIRST + 35 +LVM_SETTEXTCOLOR = LVM_FIRST + 36 +LVM_GETTEXTBKCOLOR = LVM_FIRST + 37 +LVM_SETTEXTBKCOLOR = LVM_FIRST + 38 +LVM_GETTOPINDEX = LVM_FIRST + 39 +LVM_GETCOUNTPERPAGE = LVM_FIRST + 40 +LVM_GETORIGIN = LVM_FIRST + 41 +LVM_UPDATE = LVM_FIRST + 42 +LVM_SETITEMSTATE = LVM_FIRST + 43 +LVM_GETITEMSTATE = LVM_FIRST + 44 +LVM_GETITEMTEXTA = LVM_FIRST + 45 +LVM_SETITEMTEXTA = LVM_FIRST + 46 +LVM_SETITEMCOUNT = LVM_FIRST + 47 +LVM_SORTITEMS = LVM_FIRST + 48 +LVM_SETITEMPOSITION32 = LVM_FIRST + 49 +LVM_GETSELECTEDCOUNT = LVM_FIRST + 50 +LVM_GETITEMSPACING = LVM_FIRST + 51 +LVM_GETISEARCHSTRINGA = LVM_FIRST + 52 +LVM_SETICONSPACING = LVM_FIRST + 53 +LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54 +LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55 +LVM_GETSUBITEMRECT = LVM_FIRST + 56 +LVM_SUBITEMHITTEST = LVM_FIRST + 57 +LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58 +LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59 +LVM_SETHOTITEM = LVM_FIRST + 60 +LVM_GETHOTITEM = LVM_FIRST + 61 +LVM_SETHOTCURSOR = LVM_FIRST + 62 +LVM_GETHOTCURSOR = LVM_FIRST + 63 +LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64 +LVM_SETWORKAREA = LVM_FIRST + 65 +LVM_GETITEMW = LVM_FIRST + 75 +LVM_SETITEMW = LVM_FIRST + 76 +LVM_INSERTITEMW = LVM_FIRST + 77 +LVM_FINDITEMW = LVM_FIRST + 83 +LVM_GETSTRINGWIDTHW = LVM_FIRST + 87 +LVM_GETCOLUMNW = LVM_FIRST + 95 +LVM_SETCOLUMNW = LVM_FIRST + 96 +LVM_INSERTCOLUMNW = LVM_FIRST + 97 +LVM_GETITEMTEXTW = LVM_FIRST + 115 +LVM_SETITEMTEXTW = LVM_FIRST + 116 +LVM_GETISEARCHSTRINGW = LVM_FIRST + 117 +LVM_EDITLABELW = LVM_FIRST + 118 +LVM_GETITEM = LVM_GETITEMA +LVM_SETITEM = LVM_SETITEMA +LVM_INSERTITEM = LVM_INSERTITEMA +LVM_FINDITEM = LVM_FINDITEMA +LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHA +LVM_GETCOLUMN = LVM_GETCOLUMNA +LVM_SETCOLUMN = LVM_SETCOLUMNA +LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA +LVM_GETITEMTEXT = LVM_GETITEMTEXTA +LVM_SETITEMTEXT = LVM_SETITEMTEXTA +LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGA +LVM_EDITLABEL = LVM_EDITLABELA + +; List view image list types + +LVSIL_NORMAL = 0 +LVSIL_SMALL = 1 +LVSIL_STATE = 2 + +; LVM_SETITEMCOUNT flags + +LVSICF_NOINVALIDATEALL = 1 +LVSICF_NOSCROLL = 2 + +; List view item structure flags + +LVIF_TEXT = 0001h +LVIF_IMAGE = 0002h +LVIF_PARAM = 0004h +LVIF_STATE = 0008h +LVIF_INDENT = 0010h +LVIF_NORECOMPUTE = 0800h +LVIF_DI_SETITEM = 1000h + +; List view item states + +LVIS_FOCUSED = 00001h +LVIS_SELECTED = 00002h +LVIS_CUT = 00004h +LVIS_DROPHILITED = 00008h +LVIS_ACTIVATING = 0020h +LVIS_OVERLAYMASK = 00F00h +LVIS_STATEIMAGEMASK = 0F000h + +; List view callback item values + +LPSTR_TEXTCALLBACK = -1 +I_IMAGECALLBACK = -1 +I_CHILDRENCALLBACK = -1 + +; List view next item relations + +LVNI_ALL = 000h +LVNI_FOCUSED = 001h +LVNI_SELECTED = 002h +LVNI_CUT = 004h +LVNI_DROPHILITED = 008h +LVNI_ABOVE = 100h +LVNI_BELOW = 200h +LVNI_TOLEFT = 400h +LVNI_TORIGHT = 800h + +; List view search types + +LVFI_PARAM = 01h +LVFI_STRING = 02h +LVFI_PARTIAL = 08h +LVFI_WRAP = 20h +LVFI_NEARESTXY = 40h + +; List view item rectangle types + +LVIR_BOUNDS = 0 +LVIR_ICON = 1 +LVIR_LABEL = 2 +LVIR_SELECTBOUNDS = 3 + +; List view hit test flags + +LVHT_NOWHERE = 01h +LVHT_ONITEMICON = 02h +LVHT_ONITEMLABEL = 04h +LVHT_ONITEMSTATEICON= 08h +LVHT_ONITEM = LVHT_ONITEMICON or LVHT_ONITEMLABEL or LVHT_ONITEMSTATEICON +LVHT_ABOVE = 08h +LVHT_BELOW = 10h +LVHT_TORIGHT = 20h +LVHT_TOLEFT = 40h + +; List view alignment values + +LVA_DEFAULT = 000h +LVA_ALIGNLEFT = 001h +LVA_ALIGNTOP = 002h +LVA_ALIGNRIGHT = 003h +LVA_ALIGNBOTTOM = 004h +LVA_SNAPTOGRID = 005h +LVA_SORTASCENDING = 100h +LVA_SORTDESCENDING = 200h + +; List view column structure flags + +LVCF_FMT = 1 +LVCF_WIDTH = 2 +LVCF_TEXT = 4 +LVCF_SUBITEM = 8 + +; List view column alignment values + +LVCFMT_LEFT = 0 +LVCFMT_RIGHT = 1 +LVCFMT_CENTER = 2 +LVCFMT_JUSTIFYMASK = 3 + +; List view column width values + +LVSCW_AUTOSIZE = -1 +LVSCW_AUTOSIZE_USEHEADER = -2 + +; List view notifications + +LVN_ITEMCHANGING = LVN_FIRST - 0 +LVN_ITEMCHANGED = LVN_FIRST - 1 +LVN_INSERTITEM = LVN_FIRST - 2 +LVN_DELETEITEM = LVN_FIRST - 3 +LVN_DELETEALLITEMS = LVN_FIRST - 4 +LVN_BEGINLABELEDITA = LVN_FIRST - 5 +LVN_ENDLABELEDITA = LVN_FIRST - 6 +LVN_COLUMNCLICK = LVN_FIRST - 8 +LVN_BEGINDRAG = LVN_FIRST - 9 +LVN_BEGINRDRAG = LVN_FIRST - 11 +LVN_ODCACHEHINT = LVN_FIRST - 13 +LVN_GETDISPINFOA = LVN_FIRST - 50 +LVN_SETDISPINFOA = LVN_FIRST - 51 +LVN_ODFINDITEMA = LVN_FIRST - 52 +LVN_KEYDOWN = LVN_FIRST - 55 +LVN_BEGINLABELEDITW = LVN_FIRST - 75 +LVN_ENDLABELEDITW = LVN_FIRST - 76 +LVN_GETDISPINFOW = LVN_FIRST - 77 +LVN_SETDISPINFOW = LVN_FIRST - 78 +LVN_ODFINDITEMW = LVN_FIRST - 79 +LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA +LVN_ENDLABELEDIT = LVN_ENDLABELEDITA +LVN_GETDISPINFO = LVN_GETDISPINFOA +LVN_SETDISPINFO = LVN_SETDISPINFOA +LVN_ODFINDITEM = LVN_ODFINDITEMA + +; Tree view styles + +TVS_HASBUTTONS = 0001h +TVS_HASLINES = 0002h +TVS_LINESATROOT = 0004h +TVS_EDITLABELS = 0008h +TVS_DISABLEDRAGDROP = 0010h +TVS_SHOWSELALWAYS = 0020h +TVS_RTLREADING = 0040h +TVS_NOTOOLTIPS = 0080h +TVS_CHECKBOXES = 0100h +TVS_TRACKSELECT = 0200h +TVS_SINGLEEXPAND = 0400h +TVS_INFOTIP = 0800h +TVS_FULLROWSELECT = 1000h +TVS_NOSCROLL = 2000h +TVS_NONEVENHEIGHT = 4000h + +; Tree view item structure flags + +TVIF_TEXT = 0001h +TVIF_IMAGE = 0002h +TVIF_PARAM = 0004h +TVIF_STATE = 0008h +TVIF_HANDLE = 0010h +TVIF_SELECTEDIMAGE = 0020h +TVIF_CHILDREN = 0040h +TVIF_DI_SETITEM = 1000h + +; Tree view item states + +TVIS_FOCUSED = 00001h +TVIS_SELECTED = 00002h +TVIS_CUT = 00004h +TVIS_DROPHILITED = 00008h +TVIS_BOLD = 00010h +TVIS_EXPANDED = 00020h +TVIS_EXPANDEDONCE = 00040h +TVIS_EXPANDPARTIAL = 00080h +TVIS_OVERLAYMASK = 00F00h +TVIS_STATEIMAGEMASK = 0F000h +TVIS_USERMASK = 0F000h + +; Tree view predefined item values + +TVI_ROOT = 0FFFF0000h +TVI_FIRST = 0FFFF0001h +TVI_LAST = 0FFFF0002h +TVI_SORT = 0FFFF0003h + +; Tree view messages + +TVM_INSERTITEMA = TV_FIRST + 0 +TVM_DELETEITEM = TV_FIRST + 1 +TVM_EXPAND = TV_FIRST + 2 +TVM_GETITEMRECT = TV_FIRST + 4 +TVM_GETCOUNT = TV_FIRST + 5 +TVM_GETINDENT = TV_FIRST + 6 +TVM_SETINDENT = TV_FIRST + 7 +TVM_GETIMAGELIST = TV_FIRST + 8 +TVM_SETIMAGELIST = TV_FIRST + 9 +TVM_GETNEXTITEM = TV_FIRST + 10 +TVM_SELECTITEM = TV_FIRST + 11 +TVM_GETITEMA = TV_FIRST + 12 +TVM_SETITEMA = TV_FIRST + 13 +TVM_EDITLABELA = TV_FIRST + 14 +TVM_GETEDITCONTROL = TV_FIRST + 15 +TVM_GETVISIBLECOUNT = TV_FIRST + 16 +TVM_HITTEST = TV_FIRST + 17 +TVM_CREATEDRAGIMAGE = TV_FIRST + 18 +TVM_SORTCHILDREN = TV_FIRST + 19 +TVM_ENSUREVISIBLE = TV_FIRST + 20 +TVM_SORTCHILDRENCB = TV_FIRST + 21 +TVM_ENDEDITLABELNOW = TV_FIRST + 22 +TVM_GETISEARCHSTRINGA = TV_FIRST + 23 +TVM_INSERTITEMW = TV_FIRST + 50 +TVM_GETITEMW = TV_FIRST + 62 +TVM_SETITEMW = TV_FIRST + 63 +TVM_GETISEARCHSTRINGW = TV_FIRST + 64 +TVM_EDITLABELW = TV_FIRST + 65 +TVM_INSERTITEM = TVM_INSERTITEMA +TVM_GETITEM = TVM_GETITEMA +TVM_SETITEM = TVM_SETITEMA +TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGA +TVM_EDITLABEL = TVM_EDITLABELA + +; Tree view action flags + +TVE_COLLAPSE = 0001h +TVE_EXPAND = 0002h +TVE_TOGGLE = 0003h +TVE_EXPANDPARTIAL = 4000h +TVE_COLLAPSERESET = 8000h + +; Tree view image list types + +TVSIL_NORMAL = 0 +TVSIL_STATE = 2 + +; Tree view next item types + +TVGN_ROOT = 0 +TVGN_NEXT = 1 +TVGN_PREVIOUS = 2 +TVGN_PARENT = 3 +TVGN_CHILD = 4 +TVGN_FIRSTVISIBLE = 5 +TVGN_NEXTVISIBLE = 6 +TVGN_PREVIOUSVISIBLE = 7 +TVGN_DROPHILITE = 8 +TVGN_CARET = 9 + +; Tree view hit test flags + +TVHT_NOWHERE = 001h +TVHT_ONITEMICON = 002h +TVHT_ONITEMLABEL = 004h +TVHT_ONITEMINDENT = 008h +TVHT_ONITEMBUTTON = 010h +TVHT_ONITEMRIGHT = 020h +TVHT_ONITEMSTATEICON = 040h +TVHT_ONITEM = TVHT_ONITEMICON or TVHT_ONITEMLABEL or TVHT_ONITEMSTATEICON +TVHT_ABOVE = 100h +TVHT_BELOW = 200h +TVHT_TORIGHT = 400h +TVHT_TOLEFT = 800h + +; Tree view notifications + +TVN_SELCHANGINGA = TVN_FIRST - 1 +TVN_SELCHANGEDA = TVN_FIRST - 2 +TVN_GETDISPINFOA = TVN_FIRST - 3 +TVN_SETDISPINFOA = TVN_FIRST - 4 +TVN_ITEMEXPANDINGA = TVN_FIRST - 5 +TVN_ITEMEXPANDEDA = TVN_FIRST - 6 +TVN_BEGINDRAGA = TVN_FIRST - 7 +TVN_BEGINRDRAGA = TVN_FIRST - 8 +TVN_DELETEITEMA = TVN_FIRST - 9 +TVN_BEGINLABELEDITA = TVN_FIRST - 10 +TVN_ENDLABELEDITA = TVN_FIRST - 11 +TVN_KEYDOWN = TVN_FIRST - 12 +TVN_SELCHANGINGW = TVN_FIRST - 50 +TVN_SELCHANGEDW = TVN_FIRST - 51 +TVN_GETDISPINFOW = TVN_FIRST - 52 +TVN_SETDISPINFOW = TVN_FIRST - 53 +TVN_ITEMEXPANDINGW = TVN_FIRST - 54 +TVN_ITEMEXPANDEDW = TVN_FIRST - 55 +TVN_BEGINDRAGW = TVN_FIRST - 56 +TVN_BEGINRDRAGW = TVN_FIRST - 57 +TVN_DELETEITEMW = TVN_FIRST - 58 +TVN_BEGINLABELEDITW = TVN_FIRST - 59 +TVN_ENDLABELEDITW = TVN_FIRST - 60 +TVN_SELCHANGING = TVN_SELCHANGINGA +TVN_SELCHANGED = TVN_SELCHANGEDA +TVN_GETDISPINFO = TVN_GETDISPINFOA +TVN_SETDISPINFO = TVN_SETDISPINFOA +TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGA +TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDA +TVN_BEGINDRAG = TVN_BEGINDRAGA +TVN_BEGINRDRAG = TVN_BEGINRDRAGA +TVN_DELETEITEM = TVN_DELETEITEMA +TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITA +TVN_ENDLABELEDIT = TVN_ENDLABELEDITA + +; Tree view action flags + +TVC_UNKNOWN = 0 +TVC_BYMOUSE = 1 +TVC_BYKEYBOARD = 2 + +; Tab control styles + +TCS_SCROLLOPPOSITE = 0001h +TCS_BOTTOM = 0002h +TCS_RIGHT = 0002h +TCS_FORCEICONLEFT = 0010h +TCS_FORCELABELLEFT = 0020h +TCS_HOTTRACK = 0040h +TCS_VERTICAL = 0080h +TCS_TABS = 0000h +TCS_BUTTONS = 0100h +TCS_SINGLELINE = 0000h +TCS_MULTILINE = 0200h +TCS_RIGHTJUSTIFY = 0000h +TCS_FIXEDWIDTH = 0400h +TCS_RAGGEDRIGHT = 0800h +TCS_FOCUSONBUTTONDOWN = 1000h +TCS_OWNERDRAWFIXED = 2000h +TCS_TOOLTIPS = 4000h +TCS_FOCUSNEVER = 8000h + +; Tab control messages + +TCM_GETIMAGELIST = TCM_FIRST + 2 +TCM_SETIMAGELIST = TCM_FIRST + 3 +TCM_GETITEMCOUNT = TCM_FIRST + 4 +TCM_GETITEMA = TCM_FIRST + 5 +TCM_SETITEMA = TCM_FIRST + 6 +TCM_INSERTITEMA = TCM_FIRST + 7 +TCM_DELETEITEM = TCM_FIRST + 8 +TCM_DELETEALLITEMS = TCM_FIRST + 9 +TCM_GETITEMRECT = TCM_FIRST + 10 +TCM_GETCURSEL = TCM_FIRST + 11 +TCM_SETCURSEL = TCM_FIRST + 12 +TCM_HITTEST = TCM_FIRST + 13 +TCM_SETITEMEXTRA = TCM_FIRST + 14 +TCM_ADJUSTRECT = TCM_FIRST + 40 +TCM_SETITEMSIZE = TCM_FIRST + 41 +TCM_REMOVEIMAGE = TCM_FIRST + 42 +TCM_SETPADDING = TCM_FIRST + 43 +TCM_GETROWCOUNT = TCM_FIRST + 44 +TCM_GETTOOLTIPS = TCM_FIRST + 45 +TCM_SETTOOLTIPS = TCM_FIRST + 46 +TCM_GETCURFOCUS = TCM_FIRST + 47 +TCM_SETCURFOCUS = TCM_FIRST + 48 +TCM_GETITEMW = TCM_FIRST + 60 +TCM_SETITEMW = TCM_FIRST + 61 +TCM_INSERTITEMW = TCM_FIRST + 62 +TCM_GETITEM = TCM_GETITEMA +TCM_SETITEM = TCM_SETITEMA +TCM_INSERTITEM = TCM_INSERTITEMA + +; Tab control item structure flags + +TCIF_TEXT = 1 +TCIF_IMAGE = 2 +TCIF_RTLREADING = 4 +TCIF_PARAM = 8 + +; Tab control hit test flags + +TCHT_NOWHERE = 1 +TCHT_ONITEMICON = 2 +TCHT_ONITEMLABEL = 4 +TCHT_ONITEM = TCHT_ONITEMICON or TCHT_ONITEMLABEL + +; Tab control notifications + +TCN_KEYDOWN = TCN_FIRST - 0 +TCN_SELCHANGE = TCN_FIRST - 1 +TCN_SELCHANGING = TCN_FIRST - 2 + +; Animation control styles + +ACS_CENTER = 1 +ACS_TRANSPARENT = 2 +ACS_AUTOPLAY = 4 +ACS_TIMER = 8 + +; Animation control messages + +ACM_OPENA = WM_USER + 100 +ACM_PLAY = WM_USER + 101 +ACM_STOP = WM_USER + 102 +ACM_OPENW = WM_USER + 103 +ACM_OPEN = ACM_OPENA + +; Animation control notifications + +ACN_START = 1 +ACN_STOP = 2 + +; Month calendar styles + +MCS_DAYSTATE = 1 +MCS_MULTISELECT = 2 +MCS_WEEKNUMBERS = 4 +MCS_NOTODAY_PRE_IE4 = 8 +MCS_NOTODAYCIRCLE = 8 +MCS_NOTODAY = 16 + +; Month calendar messages + +MCM_GETCURSEL = MCM_FIRST + 1 +MCM_SETCURSEL = MCM_FIRST + 2 +MCM_GETMAXSELCOUNT = MCM_FIRST + 3 +MCM_SETMAXSELCOUNT = MCM_FIRST + 4 +MCM_GETSELRANGE = MCM_FIRST + 5 +MCM_SETSELRANGE = MCM_FIRST + 6 +MCM_GETMONTHRANGE = MCM_FIRST + 7 +MCM_SETDAYSTATE = MCM_FIRST + 8 +MCM_GETMINREQRECT = MCM_FIRST + 9 +MCM_SETCOLOR = MCM_FIRST + 10 +MCM_GETCOLOR = MCM_FIRST + 11 +MCM_SETTODAY = MCM_FIRST + 12 +MCM_GETTODAY = MCM_FIRST + 13 +MCM_HITTEST = MCM_FIRST + 14 +MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15 +MCM_GETFIRSTDAYOFWEEK = MCM_FIRST + 16 +MCM_GETRANGE = MCM_FIRST + 17 +MCM_SETRANGE = MCM_FIRST + 18 +MCM_GETMONTHDELTA = MCM_FIRST + 19 +MCM_SETMONTHDELTA = MCM_FIRST + 20 + +; Month calendar hit test flags + +MCHT_TITLE = 0010000h +MCHT_CALENDAR = 0020000h +MCHT_TODAYLINK = 0030000h +MCHT_NEXT = 1000000h +MCHT_PREV = 2000000h +MCHT_NOWHERE = 0000000h +MCHT_TITLEBK = MCHT_TITLE +MCHT_TITLEMONTH = MCHT_TITLE or 1 +MCHT_TITLEYEAR = MCHT_TITLE or 2 +MCHT_TITLEBTNNEXT = MCHT_TITLE or MCHT_NEXT or 3 +MCHT_TITLEBTNPREV = MCHT_TITLE or MCHT_PREV or 3 +MCHT_CALENDARBK = MCHT_CALENDAR +MCHT_CALENDARDATE = MCHT_CALENDAR or 1 +MCHT_CALENDARDATENEXT = MCHT_CALENDARDATE or MCHT_NEXT +MCHT_CALENDARDATEPREV = MCHT_CALENDARDATE or MCHT_PREV +MCHT_CALENDARDAY = MCHT_CALENDAR or 2 +MCHT_CALENDARWEEKNUM = MCHT_CALENDAR or 3 + +; Month calendar color codes + +MCSC_BACKGROUND = 0 +MCSC_TEXT = 1 +MCSC_TITLEBK = 2 +MCSC_TITLETEXT = 3 +MCSC_MONTHBK = 4 +MCSC_TRAILINGTEXT = 5 + +; Month calendar notifications + +MCN_SELCHANGE = MCN_FIRST + 1 +MCN_GETDAYSTATE = MCN_FIRST + 3 +MCN_SELECT = MCN_FIRST + 4 + +; Date-time pick control messages + +DTM_GETSYSTEMTIME = DTM_FIRST + 1 +DTM_SETSYSTEMTIME = DTM_FIRST + 2 +DTM_GETRANGE = DTM_FIRST + 3 +DTM_SETRANGE = DTM_FIRST + 4 +DTM_SETFORMATA = DTM_FIRST + 5 +DTM_SETMCCOLOR = DTM_FIRST + 6 +DTM_GETMCCOLOR = DTM_FIRST + 7 +DTM_GETMONTHCAL = DTM_FIRST + 8 +DTM_SETMCFONT = DTM_FIRST + 9 +DTM_GETMCFONT = DTM_FIRST + 10 +DTM_SETFORMATW = DTM_FIRST + 50 +DTM_SETFORMAT = DTM_SETFORMATA + +; Date-time pick control styles + +DTS_UPDOWN = 01h +DTS_SHOWNONE = 02h +DTS_SHORTDATEFORMAT = 00h +DTS_LONGDATEFORMAT = 04h +DTS_TIMEFORMAT = 09h +DTS_APPCANPARSE = 10h +DTS_RIGHTALIGN = 20h + +; Date-time pick control notifications + +DTN_DATETIMECHANGE = DTN_FIRST + 1 +DTN_USERSTRINGA = DTN_FIRST + 2 +DTN_WMKEYDOWNA = DTN_FIRST + 3 +DTN_FORMATA = DTN_FIRST + 4 +DTN_FORMATQUERYA = DTN_FIRST + 5 +DTN_DROPDOWN = DTN_FIRST + 6 +DTN_CLOSEUP = DTN_FIRST + 7 +DTN_USERSTRINGW = DTN_FIRST + 15 +DTN_WMKEYDOWNW = DTN_FIRST + 16 +DTN_FORMATW = DTN_FIRST + 17 +DTN_FORMATQUERYW = DTN_FIRST + 18 +DTN_USERSTRING = DTN_USERSTRINGA +DTN_WMKEYDOWN = DTN_WMKEYDOWNA +DTN_FORMAT = DTN_FORMATA +DTN_FORMATQUERY = DTN_FORMATQUERYA + +; ImageList_LoadImage types + +IMAGE_BITMAP = 0 +IMAGE_ICON = 1 +IMAGE_CURSOR = 2 +IMAGE_ENHMETAFILE = 3 + +; ImageList_LoadImage flags + +LR_DEFAULTCOLOR = 0000h +LR_MONOCHROME = 0001h +LR_COLOR = 0002h +LR_COPYRETURNORG = 0004h +LR_COPYDELETEORG = 0008h +LR_LOADFROMFILE = 0010h +LR_LOADTRANSPARENT = 0020h +LR_DEFAULTSIZE = 0040h +LR_VGACOLOR = 0080h +LR_LOADMAP3DCOLORS = 1000h +LR_CREATEDIBSECTION = 2000h +LR_COPYFROMRESOURCE = 4000h +LR_SHARED = 8000h + +; IP control messages + +IPM_CLEARADDRESS = WM_USER + 100 +IPM_SETADDRESS = WM_USER + 101 +IPM_GETADDRESS = WM_USER + 102 +IPM_SETRANGE = WM_USER + 103 +IPM_SETFOCUS = WM_USER + 104 +IPM_ISBLANK = WM_USER + 105 + +; Custom Draw flags + +CDRF_DODEFAULT = 0 +CDRF_NEWFONT = 2 +CDRF_SKIPDEFAULT = 4 +CDRF_NOTIFYPOSTPAINT = 10h +CDRF_NOTIFYITEMDRAW = 20h +CDRF_NOTIFYSUBITEMDRAW = 20h +CDRF_NOTIFYPOSTERASE = 40h +CDDS_PREPAINT = 1 +CDDS_POSTPAINT = 2 +CDDS_PREERASE = 3 +CDDS_POSTERASE = 4 +CDDS_ITEM = 10000h +CDDS_ITEMPREPAINT = CDDS_ITEM or CDDS_PREPAINT +CDDS_ITEMPOSTPAINT = CDDS_ITEM or CDDS_POSTPAINT +CDDS_ITEMPREERASE = CDDS_ITEM or CDDS_PREERASE +CDDS_ITEMPOSTERASE = CDDS_ITEM or CDDS_POSTERASE +CDDS_SUBITEM = 20000h +CDIS_SELECTED = 1 +CDIS_GRAYED = 2 +CDIS_DISABLED = 4 +CDIS_CHECKED = 8 +CDIS_FOCUS = 10h +CDIS_DEFAULT = 20h +CDIS_HOT = 40h +CDIS_MARKED = 80h +CDIS_INDETERMINATE = 100h diff --git a/fasmw172/INCLUDE/EQUATES/COMDLG32.INC b/fasmw172/INCLUDE/EQUATES/COMDLG32.INC new file mode 100644 index 0000000..4b27efc --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/COMDLG32.INC @@ -0,0 +1,333 @@ + +; COMDLG32.DLL structures and constants + +struct OPENFILENAME + lStructSize dd ? + hwndOwner dd ? + hInstance dd ? + lpstrFilter dd ? + lpstrCustomFilter dd ? + nMaxCustFilter dd ? + nFilterIndex dd ? + lpstrFile dd ? + nMaxFile dd ? + lpstrFileTitle dd ? + nMaxFileTitle dd ? + lpstrInitialDir dd ? + lpstrTitle dd ? + Flags dd ? + nFileOffset dw ? + nFileExtension dw ? + lpstrDefExt dd ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? +ends + +struct CHOOSECOLOR + lStructSize dd ? + hwndOwner dd ? + hInstance dd ? + rgbResult dd ? + lpCustColors dd ? + Flags dd ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? +ends + +struct FINDREPLACE + lStructSize dd ? + hwndOwner dd ? + hInstance dd ? + Flags dd ? + lpstrFindWhat dd ? + lpstrReplaceWith dd ? + wFindWhatLen dw ? + wReplaceWithLen dw ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? +ends + +struct CHOOSEFONT + lStructSize dd ? + hwndOwner dd ? + hDC dd ? + lpLogFont dd ? + iPointSize dd ? + Flags dd ? + rgbColors dd ? + lCustData dd ? + lpfnHook dd ? + lpTemplateName dd ? + hInstance dd ? + lpszStyle dd ? + nFontType dw ? + wReserved dw ? + nSizeMin dd ? + nSizeMax dd ? +ends + +struct PRINTDLG + lStructSize dd ? + hwndOwner dd ? + hDevMode dd ? + hDevNames dd ? + hDC dd ? + Flags dd ? + nFromPage dw ? + nToPage dw ? + nMinPage dw ? + nMaxPage dw ? + nCopies dw ? + hInstance dd ? + lCustData dd ? + lpfnPrintHook dd ? + lpfnSetupHook dd ? + lpPrintTemplateName dd ? + lpSetupTemplateName dd ? + hPrintTemplate dd ? + hSetupTemplate dd ? +ends + +struct DEVNAMES + wDriverOffset dw ? + wDeviceOffset dw ? + wOutputOffset dw ? + wDefault dw ? +ends + +struct PAGESETUPDLG + lStructSize dd ? + hwndOwner dd ? + hDevMode dd ? + hDevNames dd ? + Flags dd ? + ptPaperSize POINT + rtMinMargin RECT + rtMargin RECT + hInstance dd ? + lCustData dd ? + lpfnPageSetupHook dd ? + lpfnPagePaintHook dd ? + lpPageSetupTemplateName dd ? + hPageSetupTemplate dd ? +ends + +; OPENFILENAME flags + +OFN_READONLY = 000001h +OFN_OVERWRITEPROMPT = 000002h +OFN_HIDEREADONLY = 000004h +OFN_NOCHANGEDIR = 000008h +OFN_SHOWHELP = 000010h +OFN_ENABLEHOOK = 000020h +OFN_ENABLETEMPLATE = 000040h +OFN_ENABLETEMPLATEHANDLE = 000080h +OFN_NOVALIDATE = 000100h +OFN_ALLOWMULTISELECT = 000200h +OFN_EXTENSIONDIFFERENT = 000400h +OFN_PATHMUSTEXIST = 000800h +OFN_FILEMUSTEXIST = 001000h +OFN_CREATEPROMPT = 002000h +OFN_SHAREAWARE = 004000h +OFN_NOREADONLYRETURN = 008000h +OFN_NOTESTFILECREATE = 010000h +OFN_NONETWORKBUTTON = 020000h +OFN_NOLONGNAMES = 040000h +OFN_EXPLORER = 080000h +OFN_NODEREFERENCELINKS = 100000h +OFN_LONGNAMES = 200000h + +; Common dialog notifications + +CDN_FIRST = -601 +CDN_LAST = -699 +CDN_INITDONE = CDN_FIRST - 0 +CDN_SELCHANGE = CDN_FIRST - 1 +CDN_FOLDERCHANGE = CDN_FIRST - 2 +CDN_SHAREVIOLATION = CDN_FIRST - 3 +CDN_HELP = CDN_FIRST - 4 +CDN_FILEOK = CDN_FIRST - 5 +CDN_TYPECHANGE = CDN_FIRST - 6 + +; Common dialog messages + +CDM_FIRST = WM_USER + 100 +CDM_LAST = WM_USER + 200 +CDM_GETSPEC = CDM_FIRST + 0 +CDM_GETFILEPATH = CDM_FIRST + 1 +CDM_GETFOLDERPATH = CDM_FIRST + 2 +CDM_GETFOLDERIDLIST = CDM_FIRST + 3 +CDM_SETCONTROLTEXT = CDM_FIRST + 4 +CDM_HIDECONTROL = CDM_FIRST + 5 +CDM_SETDEFEXT = CDM_FIRST + 6 + +; CHOOSECOLOR flags + +CC_RGBINIT = 001h +CC_FULLOPEN = 002h +CC_PREVENTFULLOPEN = 004h +CC_SHOWHELP = 008h +CC_ENABLEHOOK = 010h +CC_ENABLETEMPLATE = 020h +CC_ENABLETEMPLATEHANDLE = 040h +CC_SOLIDCOLOR = 080h +CC_ANYCOLOR = 100h + +; FINDREPLACE flags + +FR_DOWN = 00001h +FR_WHOLEWORD = 00002h +FR_MATCHCASE = 00004h +FR_FINDNEXT = 00008h +FR_REPLACE = 00010h +FR_REPLACEALL = 00020h +FR_DIALOGTERM = 00040h +FR_SHOWHELP = 00080h +FR_ENABLEHOOK = 00100h +FR_ENABLETEMPLATE = 00200h +FR_NOUPDOWN = 00400h +FR_NOMATCHCASE = 00800h +FR_NOWHOLEWORD = 01000h +FR_ENABLETEMPLATEHANDLE = 02000h +FR_HIDEUPDOWN = 04000h +FR_HIDEMATCHCASE = 08000h +FR_HIDEWHOLEWORD = 10000h + +; CHOOSEFONT flags + +CF_SCREENFONTS = 0000001h +CF_PRINTERFONTS = 0000002h +CF_BOTH = CF_SCREENFONTS or CF_PRINTERFONTS +CF_SHOWHELP = 0000004h +CF_ENABLEHOOK = 0000008h +CF_ENABLETEMPLATE = 0000010h +CF_ENABLETEMPLATEHANDLE = 0000020h +CF_INITTOLOGFONTSTRUCT = 0000040h +CF_USESTYLE = 0000080h +CF_EFFECTS = 0000100h +CF_APPLY = 0000200h +CF_ANSIONLY = 0000400h +CF_SCRIPTSONLY = CF_ANSIONLY +CF_NOVECTORFONTS = 0000800h +CF_NOOEMFONTS = CF_NOVECTORFONTS +CF_NOSIMULATIONS = 0001000h +CF_LIMITSIZE = 0002000h +CF_FIXEDPITCHONLY = 0004000h +CF_WYSIWYG = 0008000h +CF_FORCEFONTEXIST = 0010000h +CF_SCALABLEONLY = 0020000h +CF_TTONLY = 0040000h +CF_NOFACESEL = 0080000h +CF_NOSTYLESEL = 0100000h +CF_NOSIZESEL = 0200000h +CF_SELECTSCRIPT = 0400000h +CF_NOSCRIPTSEL = 0800000h +CF_NOVERTFONTS = 1000000h + +; ChooseFont messages + +WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1 +WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101 +WM_CHOOSEFONT_SETFLAGS = WM_USER + 102 + +; PRINTDLG flags + +PD_ALLPAGES = 000000h +PD_SELECTION = 000001h +PD_PAGENUMS = 000002h +PD_NOSELECTION = 000004h +PD_NOPAGENUMS = 000008h +PD_COLLATE = 000010h +PD_PRINTTOFILE = 000020h +PD_PRINTSETUP = 000040h +PD_NOWARNING = 000080h +PD_RETURNDC = 000100h +PD_RETURNIC = 000200h +PD_RETURNDEFAULT = 000400h +PD_SHOWHELP = 000800h +PD_ENABLEPRINTHOOK = 001000h +PD_ENABLESETUPHOOK = 002000h +PD_ENABLEPRINTTEMPLATE = 004000h +PD_ENABLESETUPTEMPLATE = 008000h +PD_ENABLEPRINTTEMPLATEHANDLE = 010000h +PD_ENABLESETUPTEMPLATEHANDLE = 020000h +PD_USEDEVMODECOPIES = 040000h +PD_USEDEVMODECOPIESANDCOLLATE = 040000h +PD_DISABLEPRINTTOFILE = 080000h +PD_HIDEPRINTTOFILE = 100000h +PD_NONETWORKBUTTON = 200000h + +; PAGESETUPDLG flags + +PSD_DEFAULTMINMARGINS = 000000h +PSD_INWININIINTLMEASURE = 000000h +PSD_MINMARGINS = 000001h +PSD_MARGINS = 000002h +PSD_INTHOUSANDTHSOFINCHES = 000004h +PSD_INHUNDREDTHSOFMILLIMETERS = 000008h +PSD_DISABLEMARGINS = 000010h +PSD_DISABLEPRINTER = 000020h +PSD_NOWARNING = 000080h +PSD_DISABLEORIENTATION = 000100h +PSD_RETURNDEFAULT = 000400h +PSD_DISABLEPAPER = 000200h +PSD_SHOWHELP = 000800h +PSD_ENABLEPAGESETUPHOOK = 002000h +PSD_ENABLEPAGESETUPTEMPLATE = 008000h +PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 020000h +PSD_ENABLEPAGEPAINTHOOK = 040000h +PSD_DISABLEPAGEPAINTING = 080000h +PSD_NONETWORKBUTTON = 200000h + +; PageSetupDlg messages + +WM_PSD_PAGESETUPDLG = WM_USER +WM_PSD_FULLPAGERECT = WM_USER + 1 +WM_PSD_MINMARGINRECT = WM_USER + 2 +WM_PSD_MARGINRECT = WM_USER + 3 +WM_PSD_GREEKTEXTRECT = WM_USER + 4 +WM_PSD_ENVSTAMPRECT = WM_USER + 5 +WM_PSD_YAFULLPAGERECT = WM_USER + 6 + +; Common dialog error codes + +CDERR_DIALOGFAILURE = 0FFFFh +CDERR_GENERALCODES = 00000h +CDERR_STRUCTSIZE = 00001h +CDERR_INITIALIZATION = 00002h +CDERR_NOTEMPLATE = 00003h +CDERR_NOHINSTANCE = 00004h +CDERR_LOADSTRFAILURE = 00005h +CDERR_FINDRESFAILURE = 00006h +CDERR_LOADRESFAILURE = 00007h +CDERR_LOCKRESFAILURE = 00008h +CDERR_MEMALLOCFAILURE = 00009h +CDERR_MEMLOCKFAILURE = 0000Ah +CDERR_NOHOOK = 0000Bh +CDERR_REGISTERMSGFAIL = 0000Ch +PDERR_PRINTERCODES = 01000h +PDERR_SETUPFAILURE = 01001h +PDERR_PARSEFAILURE = 01002h +PDERR_RETDEFFAILURE = 01003h +PDERR_LOADDRVFAILURE = 01004h +PDERR_GETDEVMODEFAIL = 01005h +PDERR_INITFAILURE = 01006h +PDERR_NODEVICES = 01007h +PDERR_NODEFAULTPRN = 01008h +PDERR_DNDMMISMATCH = 01009h +PDERR_CREATEICFAILURE = 0100Ah +PDERR_PRINTERNOTFOUND = 0100Bh +PDERR_DEFAULTDIFFERENT = 0100Ch +CFERR_CHOOSEFONTCODES = 02000h +CFERR_NOFONTS = 02001h +CFERR_MAXLESSTHANMIN = 02002h +FNERR_FILENAMECODES = 03000h +FNERR_SUBCLASSFAILURE = 03001h +FNERR_INVALIDFILENAME = 03002h +FNERR_BUFFERTOOSMALL = 03003h +FRERR_FINDREPLACECODES = 04000h +FRERR_BUFFERLENGTHZERO = 04001h +CCERR_CHOOSECOLORCODES = 05000h diff --git a/fasmw172/INCLUDE/EQUATES/COMDLG64.INC b/fasmw172/INCLUDE/EQUATES/COMDLG64.INC new file mode 100644 index 0000000..e9fcd54 --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/COMDLG64.INC @@ -0,0 +1,334 @@ + +; COMDLG32.DLL structures and constants + +struct OPENFILENAME + lStructSize dd ?,? + hwndOwner dq ? + hInstance dq ? + lpstrFilter dq ? + lpstrCustomFilter dq ? + nMaxCustFilter dd ? + nFilterIndex dd ? + lpstrFile dq ? + nMaxFile dd ?,? + lpstrFileTitle dq ? + nMaxFileTitle dd ?,? + lpstrInitialDir dq ? + lpstrTitle dq ? + Flags dd ? + nFileOffset dw ? + nFileExtension dw ? + lpstrDefExt dq ? + lCustData dd ?,? + lpfnHook dq ? + lpTemplateName dq ? +ends + +struct CHOOSECOLOR + lStructSize dd ?,? + hwndOwner dq ? + hInstance dq ? + rgbResult dd ?,? + lpCustColors dq ? + Flags dd ? + lCustData dd ?,? + lpfnHook dq ? + lpTemplateName dq ? +ends + +struct FINDREPLACE + lStructSize dd ?,? + hwndOwner dq ? + hInstance dq ? + Flags dd ?,? + lpstrFindWhat dq ? + lpstrReplaceWith dq ? + wFindWhatLen dw ? + wReplaceWithLen dw ? + lCustData dd ? + lpfnHook dq ? + lpTemplateName dq ? +ends + +struct CHOOSEFONT + lStructSize dd ?,? + hwndOwner dq ? + hDC dq ? + lpLogFont dq ? + iPointSize dd ? + Flags dd ? + rgbColors dd ? + lCustData dd ? + lpfnHook dq ? + lpTemplateName dq ? + hInstance dq ? + lpszStyle dq ? + nFontType dw ? + wReserved dw ? + nSizeMin dd ? + nSizeMax dd ? +ends + +struct PRINTDLG + lStructSize dd ?,? + hwndOwner dq ? + hDevMode dq ? + hDevNames dq ? + hDC dq ? + Flags dd ? + nFromPage dw ? + nToPage dw ? + nMinPage dw ? + nMaxPage dw ? + nCopies dw ?,? + hInstance dq ? + lCustData dd ? + lpfnPrintHook dq ? + lpfnSetupHook dq ? + lpPrintTemplateName dq ? + lpSetupTemplateName dq ? + hPrintTemplate dq ? + hSetupTemplate dq ? +ends + +struct DEVNAMES + wDriverOffset dw ? + wDeviceOffset dw ? + wOutputOffset dw ? + wDefault dw ? +ends + +struct PAGESETUPDLG + lStructSize dd ?,? + hwndOwner dq ? + hDevMode dq ? + hDevNames dq ? + Flags dd ? + ptPaperSize POINT + rtMinMargin RECT + rtMargin RECT + dd ? + hInstance dq ? + lCustData dd ?,? + lpfnPageSetupHook dq ? + lpfnPagePaintHook dq ? + lpPageSetupTemplateName dq ? + hPageSetupTemplate dq ? +ends + +; OPENFILENAME flags + +OFN_READONLY = 000001h +OFN_OVERWRITEPROMPT = 000002h +OFN_HIDEREADONLY = 000004h +OFN_NOCHANGEDIR = 000008h +OFN_SHOWHELP = 000010h +OFN_ENABLEHOOK = 000020h +OFN_ENABLETEMPLATE = 000040h +OFN_ENABLETEMPLATEHANDLE = 000080h +OFN_NOVALIDATE = 000100h +OFN_ALLOWMULTISELECT = 000200h +OFN_EXTENSIONDIFFERENT = 000400h +OFN_PATHMUSTEXIST = 000800h +OFN_FILEMUSTEXIST = 001000h +OFN_CREATEPROMPT = 002000h +OFN_SHAREAWARE = 004000h +OFN_NOREADONLYRETURN = 008000h +OFN_NOTESTFILECREATE = 010000h +OFN_NONETWORKBUTTON = 020000h +OFN_NOLONGNAMES = 040000h +OFN_EXPLORER = 080000h +OFN_NODEREFERENCELINKS = 100000h +OFN_LONGNAMES = 200000h + +; Common dialog notifications + +CDN_FIRST = -601 +CDN_LAST = -699 +CDN_INITDONE = CDN_FIRST - 0 +CDN_SELCHANGE = CDN_FIRST - 1 +CDN_FOLDERCHANGE = CDN_FIRST - 2 +CDN_SHAREVIOLATION = CDN_FIRST - 3 +CDN_HELP = CDN_FIRST - 4 +CDN_FILEOK = CDN_FIRST - 5 +CDN_TYPECHANGE = CDN_FIRST - 6 + +; Common dialog messages + +CDM_FIRST = WM_USER + 100 +CDM_LAST = WM_USER + 200 +CDM_GETSPEC = CDM_FIRST + 0 +CDM_GETFILEPATH = CDM_FIRST + 1 +CDM_GETFOLDERPATH = CDM_FIRST + 2 +CDM_GETFOLDERIDLIST = CDM_FIRST + 3 +CDM_SETCONTROLTEXT = CDM_FIRST + 4 +CDM_HIDECONTROL = CDM_FIRST + 5 +CDM_SETDEFEXT = CDM_FIRST + 6 + +; CHOOSECOLOR flags + +CC_RGBINIT = 001h +CC_FULLOPEN = 002h +CC_PREVENTFULLOPEN = 004h +CC_SHOWHELP = 008h +CC_ENABLEHOOK = 010h +CC_ENABLETEMPLATE = 020h +CC_ENABLETEMPLATEHANDLE = 040h +CC_SOLIDCOLOR = 080h +CC_ANYCOLOR = 100h + +; FINDREPLACE flags + +FR_DOWN = 00001h +FR_WHOLEWORD = 00002h +FR_MATCHCASE = 00004h +FR_FINDNEXT = 00008h +FR_REPLACE = 00010h +FR_REPLACEALL = 00020h +FR_DIALOGTERM = 00040h +FR_SHOWHELP = 00080h +FR_ENABLEHOOK = 00100h +FR_ENABLETEMPLATE = 00200h +FR_NOUPDOWN = 00400h +FR_NOMATCHCASE = 00800h +FR_NOWHOLEWORD = 01000h +FR_ENABLETEMPLATEHANDLE = 02000h +FR_HIDEUPDOWN = 04000h +FR_HIDEMATCHCASE = 08000h +FR_HIDEWHOLEWORD = 10000h + +; CHOOSEFONT flags + +CF_SCREENFONTS = 0000001h +CF_PRINTERFONTS = 0000002h +CF_BOTH = CF_SCREENFONTS or CF_PRINTERFONTS +CF_SHOWHELP = 0000004h +CF_ENABLEHOOK = 0000008h +CF_ENABLETEMPLATE = 0000010h +CF_ENABLETEMPLATEHANDLE = 0000020h +CF_INITTOLOGFONTSTRUCT = 0000040h +CF_USESTYLE = 0000080h +CF_EFFECTS = 0000100h +CF_APPLY = 0000200h +CF_ANSIONLY = 0000400h +CF_SCRIPTSONLY = CF_ANSIONLY +CF_NOVECTORFONTS = 0000800h +CF_NOOEMFONTS = CF_NOVECTORFONTS +CF_NOSIMULATIONS = 0001000h +CF_LIMITSIZE = 0002000h +CF_FIXEDPITCHONLY = 0004000h +CF_WYSIWYG = 0008000h +CF_FORCEFONTEXIST = 0010000h +CF_SCALABLEONLY = 0020000h +CF_TTONLY = 0040000h +CF_NOFACESEL = 0080000h +CF_NOSTYLESEL = 0100000h +CF_NOSIZESEL = 0200000h +CF_SELECTSCRIPT = 0400000h +CF_NOSCRIPTSEL = 0800000h +CF_NOVERTFONTS = 1000000h + +; ChooseFont messages + +WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1 +WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101 +WM_CHOOSEFONT_SETFLAGS = WM_USER + 102 + +; PRINTDLG flags + +PD_ALLPAGES = 000000h +PD_SELECTION = 000001h +PD_PAGENUMS = 000002h +PD_NOSELECTION = 000004h +PD_NOPAGENUMS = 000008h +PD_COLLATE = 000010h +PD_PRINTTOFILE = 000020h +PD_PRINTSETUP = 000040h +PD_NOWARNING = 000080h +PD_RETURNDC = 000100h +PD_RETURNIC = 000200h +PD_RETURNDEFAULT = 000400h +PD_SHOWHELP = 000800h +PD_ENABLEPRINTHOOK = 001000h +PD_ENABLESETUPHOOK = 002000h +PD_ENABLEPRINTTEMPLATE = 004000h +PD_ENABLESETUPTEMPLATE = 008000h +PD_ENABLEPRINTTEMPLATEHANDLE = 010000h +PD_ENABLESETUPTEMPLATEHANDLE = 020000h +PD_USEDEVMODECOPIES = 040000h +PD_USEDEVMODECOPIESANDCOLLATE = 040000h +PD_DISABLEPRINTTOFILE = 080000h +PD_HIDEPRINTTOFILE = 100000h +PD_NONETWORKBUTTON = 200000h + +; PAGESETUPDLG flags + +PSD_DEFAULTMINMARGINS = 000000h +PSD_INWININIINTLMEASURE = 000000h +PSD_MINMARGINS = 000001h +PSD_MARGINS = 000002h +PSD_INTHOUSANDTHSOFINCHES = 000004h +PSD_INHUNDREDTHSOFMILLIMETERS = 000008h +PSD_DISABLEMARGINS = 000010h +PSD_DISABLEPRINTER = 000020h +PSD_NOWARNING = 000080h +PSD_DISABLEORIENTATION = 000100h +PSD_RETURNDEFAULT = 000400h +PSD_DISABLEPAPER = 000200h +PSD_SHOWHELP = 000800h +PSD_ENABLEPAGESETUPHOOK = 002000h +PSD_ENABLEPAGESETUPTEMPLATE = 008000h +PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 020000h +PSD_ENABLEPAGEPAINTHOOK = 040000h +PSD_DISABLEPAGEPAINTING = 080000h +PSD_NONETWORKBUTTON = 200000h + +; PageSetupDlg messages + +WM_PSD_PAGESETUPDLG = WM_USER +WM_PSD_FULLPAGERECT = WM_USER + 1 +WM_PSD_MINMARGINRECT = WM_USER + 2 +WM_PSD_MARGINRECT = WM_USER + 3 +WM_PSD_GREEKTEXTRECT = WM_USER + 4 +WM_PSD_ENVSTAMPRECT = WM_USER + 5 +WM_PSD_YAFULLPAGERECT = WM_USER + 6 + +; Common dialog error codes + +CDERR_DIALOGFAILURE = 0FFFFh +CDERR_GENERALCODES = 00000h +CDERR_STRUCTSIZE = 00001h +CDERR_INITIALIZATION = 00002h +CDERR_NOTEMPLATE = 00003h +CDERR_NOHINSTANCE = 00004h +CDERR_LOADSTRFAILURE = 00005h +CDERR_FINDRESFAILURE = 00006h +CDERR_LOADRESFAILURE = 00007h +CDERR_LOCKRESFAILURE = 00008h +CDERR_MEMALLOCFAILURE = 00009h +CDERR_MEMLOCKFAILURE = 0000Ah +CDERR_NOHOOK = 0000Bh +CDERR_REGISTERMSGFAIL = 0000Ch +PDERR_PRINTERCODES = 01000h +PDERR_SETUPFAILURE = 01001h +PDERR_PARSEFAILURE = 01002h +PDERR_RETDEFFAILURE = 01003h +PDERR_LOADDRVFAILURE = 01004h +PDERR_GETDEVMODEFAIL = 01005h +PDERR_INITFAILURE = 01006h +PDERR_NODEVICES = 01007h +PDERR_NODEFAULTPRN = 01008h +PDERR_DNDMMISMATCH = 01009h +PDERR_CREATEICFAILURE = 0100Ah +PDERR_PRINTERNOTFOUND = 0100Bh +PDERR_DEFAULTDIFFERENT = 0100Ch +CFERR_CHOOSEFONTCODES = 02000h +CFERR_NOFONTS = 02001h +CFERR_MAXLESSTHANMIN = 02002h +FNERR_FILENAMECODES = 03000h +FNERR_SUBCLASSFAILURE = 03001h +FNERR_INVALIDFILENAME = 03002h +FNERR_BUFFERTOOSMALL = 03003h +FRERR_FINDREPLACECODES = 04000h +FRERR_BUFFERLENGTHZERO = 04001h +CCERR_CHOOSECOLORCODES = 05000h diff --git a/fasmw172/INCLUDE/EQUATES/GDI32.INC b/fasmw172/INCLUDE/EQUATES/GDI32.INC new file mode 100644 index 0000000..77d556f --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/GDI32.INC @@ -0,0 +1,480 @@ + +; GDI32.DLL structures and constants + +struct SIZE + cx dd ? + cy dd ? +ends + +struct BITMAP + bmType dd ? + bmWidth dd ? + bmHeight dd ? + bmWidthBytes dd ? + bmPlanes dw ? + bmBitsPixel dw ? + bmBits dd ? +ends + +struct BITMAPCOREHEADER + bcSize dd ? + bcWidth dw ? + bcHeight dw ? + bcPlanes dw ? + bcBitCount dw ? +ends + +struct BITMAPINFOHEADER + biSize dd ? + biWidth dd ? + biHeight dd ? + biPlanes dw ? + biBitCount dw ? + biCompression dd ? + biSizeImage dd ? + biXPelsPerMeter dd ? + biYPelsPerMeter dd ? + biClrUsed dd ? + biClrImportant dd ? +ends + +struct BITMAPFILEHEADER + bfType dw ? + bfSize dd ? + bfReserved1 dw ? + bfReserved2 dw ? + bfOffBits dd ? +ends + +struct TEXTMETRIC + tmHeight dd ? + tmAscent dd ? + tmDescent dd ? + tmInternalLeading dd ? + tmExternalLeading dd ? + tmAveCharWidth dd ? + tmMaxCharWidth dd ? + tmWeight dd ? + tmOverhang dd ? + tmDigitizedAspectX dd ? + tmDigitizedAspectY dd ? + tmFirstChar TCHAR ? + tmLastChar TCHAR ? + tmDefaultChar TCHAR ? + tmBreakChar TCHAR ? + tmItalic db ? + tmUnderlined db ? + tmStruckOut db ? + tmPitchAndFamily db ? + tmCharSet db ? +ends + +struct LOGBRUSH + lbStyle dd ? + lbColor dd ? + lbHatch dd ? +ends + +struct LOGPEN + lopnStyle dd ? + lopnWidth POINT + lopnColor dd ? +ends + +struct EXTLOGPEN + elpPenStyle dd ? + elpWidth dd ? + elpBrushStyle dd ? + elpColor dd ? + elpHatch dd ? + elpNumEntries dd ? + elpStyleEntry dd ? +ends + +struct LOGFONT + lfHeight dd ? + lfWidth dd ? + lfEscapement dd ? + lfOrientation dd ? + lfWeight dd ? + lfItalic db ? + lfUnderline db ? + lfStrikeOut db ? + lfCharSet db ? + lfOutPrecision db ? + lfClipPrecision db ? + lfQuality db ? + lfPitchAndFamily db ? + lfFaceName TCHAR 32 dup (?) +ends + +struct ENUMLOGFONT + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) +ends + +struct ENUMLOGFONTEX + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) + elfScript TCHAR 32 dup (?) +ends + +struct PIXELFORMATDESCRIPTOR + nSize dw ? + nVersion dw ? + dwFlags dd ? + iPixelType db ? + cColorBits db ? + cRedBits db ? + cRedShift db ? + cGreenBits db ? + cGreenShift db ? + cBlueBits db ? + cBlueShift db ? + cAlphaBits db ? + cAlphaShift db ? + cAccumBits db ? + cAccumRedBits db ? + cAccumGreenBits db ? + cAccumBlueBits db ? + cAccumAlphaBits db ? + cDepthBits db ? + cStencilBits db ? + cAuxBuffers db ? + iLayerType db ? + bReserved db ? + dwLayerMask dd ? + dwVisibleMask dd ? + dwDamageMask dd ? +ends + +struct TRIVERTEX + x dd ? + y dd ? + Red dw ? + Green dw ? + Blue dw ? + Alpha dw ? +ends + +; General constants + +GDI_ERROR = 0FFFFFFFFh +HGDI_ERROR = 0FFFFFFFFh + +; Binary raster operations + +R2_BLACK = 1 +R2_NOTMERGEPEN = 2 +R2_MASKNOTPEN = 3 +R2_NOTCOPYPEN = 4 +R2_MASKPENNOT = 5 +R2_NOT = 6 +R2_XORPEN = 7 +R2_NOTMASKPEN = 8 +R2_MASKPEN = 9 +R2_NOTXORPEN = 10 +R2_NOP = 11 +R2_MERGENOTPEN = 12 +R2_COPYPEN = 13 +R2_MERGEPENNOT = 14 +R2_MERGEPEN = 15 +R2_WHITE = 16 + +; Raster operations + +SRCCOPY = 00CC0020h +SRCPAINT = 00EE0086h +SRCAND = 008800C6h +SRCINVERT = 00660046h +SRCERASE = 00440328h +NOTSRCCOPY = 00330008h +NOTSRCERASE = 001100A6h +MERGECOPY = 00C000CAh +MERGEPAINT = 00BB0226h +PATCOPY = 00F00021h +PATPAINT = 00FB0A09h +PATINVERT = 005A0049h +DSTINVERT = 00550009h +BLACKNESS = 00000042h +WHITENESS = 00FF0062h + +; Region flags + +ERROR = 0 +NULLREGION = 1 +SIMPLEREGION = 2 +COMPLEXREGION = 3 + +; CombineRgn styles + +RGN_AND = 1 +RGN_OR = 2 +RGN_XOR = 3 +RGN_DIFF = 4 +RGN_COPY = 5 + +; StretchBlt modes + +BLACKONWHITE = 1 +WHITEONBLACK = 2 +COLORONCOLOR = 3 +HALFTONE = 4 +STRETCH_ANDSCANS = BLACKONWHITE +STRETCH_ORSCANS = WHITEONBLACK +STRETCH_DELETESCANS = COLORONCOLOR +STRETCH_HALFTONE = HALFTONE + +; PolyFill modes + +ALTERNATE = 1 +WINDING = 2 + +; Background modes + +TRANSPARENT = 1 +OPAQUE = 2 + +; Point types + +PT_CLOSEFIGURE = 1 +PT_LINETO = 2 +PT_BEZIERTO = 4 +PT_MOVETO = 6 + +; Mapping modes + +MM_TEXT = 1 +MM_LOMETRIC = 2 +MM_HIMETRIC = 3 +MM_LOENGLISH = 4 +MM_HIENGLISH = 5 +MM_TWIPS = 6 +MM_ISOTROPIC = 7 +MM_ANISOTROPIC = 8 + +; Coordinate modes + +ABSOLUTE = 1 +RELATIVE = 2 + +; Stock logical objects + +WHITE_BRUSH = 0 +LTGRAY_BRUSH = 1 +GRAY_BRUSH = 2 +DKGRAY_BRUSH = 3 +BLACK_BRUSH = 4 +NULL_BRUSH = 5 +HOLLOW_BRUSH = NULL_BRUSH +WHITE_PEN = 6 +BLACK_PEN = 7 +NULL_PEN = 8 +OEM_FIXED_FONT = 10 +ANSI_FIXED_FONT = 11 +ANSI_VAR_FONT = 12 +SYSTEM_FONT = 13 +DEVICE_DEFAULT_FONT = 14 +DEFAULT_PALETTE = 15 +SYSTEM_FIXED_FONT = 16 +DEFAULT_GUI_FONT = 17 + +; Brush styles + +BS_SOLID = 0 +BS_NULL = 1 +BS_HOLLOW = BS_NULL +BS_HATCHED = 2 +BS_PATTERN = 3 +BS_INDEXED = 4 +BS_DIBPATTERN = 5 +BS_DIBPATTERNPT = 6 +BS_PATTERN8X8 = 7 +BS_DIBPATTERN8X8 = 8 +BS_MONOPATTERN = 9 + +; Hatch styles + +HS_HORIZONTAL = 0 +HS_VERTICAL = 1 +HS_FDIAGONAL = 2 +HS_BDIAGONAL = 3 +HS_CROSS = 4 +HS_DIAGCROSS = 5 + +; Pen styles + +PS_SOLID = 0 +PS_DASH = 1 +PS_DOT = 2 +PS_DASHDOT = 3 +PS_DASHDOTDOT = 4 +PS_NULL = 5 +PS_INSIDEFRAME = 6 +PS_USERSTYLE = 7 +PS_ALTERNATE = 8 +PS_ENDCAP_ROUND = 0 +PS_ENDCAP_SQUARE = 100h +PS_ENDCAP_FLAT = 200h +PS_JOIN_ROUND = 0 +PS_JOIN_BEVEL = 1000h +PS_JOIN_MITER = 2000h +PS_COSMETIC = 0 +PS_GEOMETRIC = 010000h + +; Arc directions + +AD_COUNTERCLOCKWISE = 1 +AD_CLOCKWISE = 2 + +; Text alignment options + +TA_NOUPDATECP = 0 +TA_UPDATECP = 1 +TA_LEFT = 0 +TA_RIGHT = 2 +TA_CENTER = 6 +TA_TOP = 0 +TA_BOTTOM = 8 +TA_BASELINE = 24 +TA_RTLREADING = 100h +VTA_BASELINE = TA_BASELINE +VTA_LEFT = TA_BOTTOM +VTA_RIGHT = TA_TOP +VTA_CENTER = TA_CENTER +VTA_BOTTOM = TA_RIGHT +VTA_TOP = TA_LEFT + +; ExtTextOut options + +ETO_OPAQUE = 0002h +ETO_CLIPPED = 0004h +ETO_GLYPH_INDEX = 0010h +ETO_RTLREADING = 0080h +ETO_IGNORELANGUAGE = 1000h + +; Bitmap compression types + +BI_RGB = 0 +BI_RLE8 = 1 +BI_RLE4 = 2 +BI_BITFIELDS = 3 + +; tmPitchAndFamily flags + +TMPF_FIXED_PITCH = 1 +TMPF_VECTOR = 2 +TMPF_TRUETYPE = 4 +TMPF_DEVICE = 8 + +; Font output precision values + +OUT_DEFAULT_PRECIS = 0 +OUT_STRING_PRECIS = 1 +OUT_CHARACTER_PRECIS = 2 +OUT_STROKE_PRECIS = 3 +OUT_TT_PRECIS = 4 +OUT_DEVICE_PRECIS = 5 +OUT_RASTER_PRECIS = 6 +OUT_TT_ONLY_PRECIS = 7 +OUT_OUTLINE_PRECIS = 8 +OUT_SCREEN_OUTLINE_PRECIS = 9 + +; Font clipping precision values + +CLIP_DEFAULT_PRECIS = 0 +CLIP_CHARACTER_PRECIS = 1 +CLIP_STROKE_PRECIS = 2 +CLIP_LH_ANGLES = 10h +CLIP_TT_ALWAYS = 20h +CLIP_EMBEDDED = 80h + +; Font output quality values + +DEFAULT_QUALITY = 0 +DRAFT_QUALITY = 1 +PROOF_QUALITY = 2 +NONANTIALIASED_QUALITY = 3 +ANTIALIASED_QUALITY = 4 + +; Font pitch values + +DEFAULT_PITCH = 0 +FIXED_PITCH = 1 +VARIABLE_PITCH = 2 +MONO_FONT = 8 + +; Font families + +FF_DONTCARE = 00h +FF_ROMAN = 10h +FF_SWISS = 20h +FF_MODERN = 30h +FF_SCRIPT = 40h +FF_DECORATIVE = 50h + +; Font weights + +FW_DONTCARE = 0 +FW_THIN = 100 +FW_EXTRALIGHT = 200 +FW_LIGHT = 300 +FW_NORMAL = 400 +FW_MEDIUM = 500 +FW_SEMIBOLD = 600 +FW_BOLD = 700 +FW_EXTRABOLD = 800 +FW_HEAVY = 900 +FW_ULTRALIGHT = FW_EXTRALIGHT +FW_REGULAR = FW_NORMAL +FW_DEMIBOLD = FW_SEMIBOLD +FW_ULTRABOLD = FW_EXTRABOLD +FW_BLACK = FW_HEAVY + +; Character set values + +ANSI_CHARSET = 0 +DEFAULT_CHARSET = 1 +SYMBOL_CHARSET = 2 +SHIFTJIS_CHARSET = 128 +HANGEUL_CHARSET = 129 +GB2312_CHARSET = 134 +CHINESEBIG5_CHARSET = 136 +OEM_CHARSET = 255 +JOHAB_CHARSET = 130 +HEBREW_CHARSET = 177 +ARABIC_CHARSET = 178 +GREEK_CHARSET = 161 +TURKISH_CHARSET = 162 +VIETNAMESE_CHARSET = 163 +THAI_CHARSET = 222 +EASTEUROPE_CHARSET = 238 +RUSSIAN_CHARSET = 204 +MAC_CHARSET = 77 +BALTIC_CHARSET = 186 + +; Pixel format constants + +PFD_TYPE_RGBA = 0 +PFD_TYPE_COLORINDEX = 1 +PFD_MAIN_PLANE = 0 +PFD_OVERLAY_PLANE = 1 +PFD_UNDERLAY_PLANE = -1 +PFD_DOUBLEBUFFER = 1 +PFD_STEREO = 2 +PFD_DRAW_TO_WINDOW = 4 +PFD_DRAW_TO_BITMAP = 8 +PFD_SUPPORT_GDI = 10h +PFD_SUPPORT_OPENGL = 20h +PFD_GENERIC_FORMAT = 40h +PFD_NEED_PALETTE = 80h +PFD_NEED_SYSTEM_PALETTE = 100h +PFD_SWAP_EXCHANGE = 200h +PFD_SWAP_COPY = 400h +PFD_SWAP_LAYER_BUFFERS = 800h +PFD_GENERIC_ACCELERATED = 1000h +PFD_DEPTH_DONTCARE = 20000000h +PFD_DOUBLEBUFFER_DONTCARE = 40000000h +PFD_STEREO_DONTCARE = 80000000h diff --git a/fasmw172/INCLUDE/EQUATES/GDI64.INC b/fasmw172/INCLUDE/EQUATES/GDI64.INC new file mode 100644 index 0000000..c611284 --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/GDI64.INC @@ -0,0 +1,480 @@ + +; GDI32.DLL structures and constants + +struct SIZE + cx dd ? + cy dd ? +ends + +struct BITMAP + bmType dd ? + bmWidth dd ? + bmHeight dd ? + bmWidthBytes dd ? + bmPlanes dw ? + bmBitsPixel dw ?,?,? + bmBits dq ? +ends + +struct BITMAPCOREHEADER + bcSize dd ? + bcWidth dw ? + bcHeight dw ? + bcPlanes dw ? + bcBitCount dw ? +ends + +struct BITMAPINFOHEADER + biSize dd ? + biWidth dd ? + biHeight dd ? + biPlanes dw ? + biBitCount dw ? + biCompression dd ? + biSizeImage dd ? + biXPelsPerMeter dd ? + biYPelsPerMeter dd ? + biClrUsed dd ? + biClrImportant dd ? +ends + +struct BITMAPFILEHEADER + bfType dw ? + bfSize dd ? + bfReserved1 dw ? + bfReserved2 dw ? + bfOffBits dd ? +ends + +struct TEXTMETRIC + tmHeight dd ? + tmAscent dd ? + tmDescent dd ? + tmInternalLeading dd ? + tmExternalLeading dd ? + tmAveCharWidth dd ? + tmMaxCharWidth dd ? + tmWeight dd ? + tmOverhang dd ? + tmDigitizedAspectX dd ? + tmDigitizedAspectY dd ? + tmFirstChar TCHAR ? + tmLastChar TCHAR ? + tmDefaultChar TCHAR ? + tmBreakChar TCHAR ? + tmItalic db ? + tmUnderlined db ? + tmStruckOut db ? + tmPitchAndFamily db ? + tmCharSet db ? +ends + +struct LOGBRUSH + lbStyle dd ? + lbColor dd ? + lbHatch dd ? +ends + +struct LOGPEN + lopnStyle dd ? + lopnWidth POINT + lopnColor dd ? +ends + +struct EXTLOGPEN + elpPenStyle dd ? + elpWidth dd ? + elpBrushStyle dd ? + elpColor dd ? + elpHatch dd ? + elpNumEntries dd ? + elpStyleEntry dd ? +ends + +struct LOGFONT + lfHeight dd ? + lfWidth dd ? + lfEscapement dd ? + lfOrientation dd ? + lfWeight dd ? + lfItalic db ? + lfUnderline db ? + lfStrikeOut db ? + lfCharSet db ? + lfOutPrecision db ? + lfClipPrecision db ? + lfQuality db ? + lfPitchAndFamily db ? + lfFaceName TCHAR 32 dup (?) +ends + +struct ENUMLOGFONT + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) +ends + +struct ENUMLOGFONTEX + elfLogFont LOGFONT + elfFullName TCHAR 64 dup (?) + elfStyle TCHAR 32 dup (?) + elfScript TCHAR 32 dup (?) +ends + +struct PIXELFORMATDESCRIPTOR + nSize dw ? + nVersion dw ? + dwFlags dd ? + iPixelType db ? + cColorBits db ? + cRedBits db ? + cRedShift db ? + cGreenBits db ? + cGreenShift db ? + cBlueBits db ? + cBlueShift db ? + cAlphaBits db ? + cAlphaShift db ? + cAccumBits db ? + cAccumRedBits db ? + cAccumGreenBits db ? + cAccumBlueBits db ? + cAccumAlphaBits db ? + cDepthBits db ? + cStencilBits db ? + cAuxBuffers db ? + iLayerType db ? + bReserved db ? + dwLayerMask dd ? + dwVisibleMask dd ? + dwDamageMask dd ? +ends + +struct TRIVERTEX + x dd ? + y dd ? + Red dw ? + Green dw ? + Blue dw ? + Alpha dw ? +ends + +; General constants + +GDI_ERROR = 0FFFFFFFFh +HGDI_ERROR = 0FFFFFFFFh + +; Binary raster operations + +R2_BLACK = 1 +R2_NOTMERGEPEN = 2 +R2_MASKNOTPEN = 3 +R2_NOTCOPYPEN = 4 +R2_MASKPENNOT = 5 +R2_NOT = 6 +R2_XORPEN = 7 +R2_NOTMASKPEN = 8 +R2_MASKPEN = 9 +R2_NOTXORPEN = 10 +R2_NOP = 11 +R2_MERGENOTPEN = 12 +R2_COPYPEN = 13 +R2_MERGEPENNOT = 14 +R2_MERGEPEN = 15 +R2_WHITE = 16 + +; Raster operations + +SRCCOPY = 00CC0020h +SRCPAINT = 00EE0086h +SRCAND = 008800C6h +SRCINVERT = 00660046h +SRCERASE = 00440328h +NOTSRCCOPY = 00330008h +NOTSRCERASE = 001100A6h +MERGECOPY = 00C000CAh +MERGEPAINT = 00BB0226h +PATCOPY = 00F00021h +PATPAINT = 00FB0A09h +PATINVERT = 005A0049h +DSTINVERT = 00550009h +BLACKNESS = 00000042h +WHITENESS = 00FF0062h + +; Region flags + +ERROR = 0 +NULLREGION = 1 +SIMPLEREGION = 2 +COMPLEXREGION = 3 + +; CombineRgn styles + +RGN_AND = 1 +RGN_OR = 2 +RGN_XOR = 3 +RGN_DIFF = 4 +RGN_COPY = 5 + +; StretchBlt modes + +BLACKONWHITE = 1 +WHITEONBLACK = 2 +COLORONCOLOR = 3 +HALFTONE = 4 +STRETCH_ANDSCANS = BLACKONWHITE +STRETCH_ORSCANS = WHITEONBLACK +STRETCH_DELETESCANS = COLORONCOLOR +STRETCH_HALFTONE = HALFTONE + +; PolyFill modes + +ALTERNATE = 1 +WINDING = 2 + +; Background modes + +TRANSPARENT = 1 +OPAQUE = 2 + +; Point types + +PT_CLOSEFIGURE = 1 +PT_LINETO = 2 +PT_BEZIERTO = 4 +PT_MOVETO = 6 + +; Mapping modes + +MM_TEXT = 1 +MM_LOMETRIC = 2 +MM_HIMETRIC = 3 +MM_LOENGLISH = 4 +MM_HIENGLISH = 5 +MM_TWIPS = 6 +MM_ISOTROPIC = 7 +MM_ANISOTROPIC = 8 + +; Coordinate modes + +ABSOLUTE = 1 +RELATIVE = 2 + +; Stock logical objects + +WHITE_BRUSH = 0 +LTGRAY_BRUSH = 1 +GRAY_BRUSH = 2 +DKGRAY_BRUSH = 3 +BLACK_BRUSH = 4 +NULL_BRUSH = 5 +HOLLOW_BRUSH = NULL_BRUSH +WHITE_PEN = 6 +BLACK_PEN = 7 +NULL_PEN = 8 +OEM_FIXED_FONT = 10 +ANSI_FIXED_FONT = 11 +ANSI_VAR_FONT = 12 +SYSTEM_FONT = 13 +DEVICE_DEFAULT_FONT = 14 +DEFAULT_PALETTE = 15 +SYSTEM_FIXED_FONT = 16 +DEFAULT_GUI_FONT = 17 + +; Brush styles + +BS_SOLID = 0 +BS_NULL = 1 +BS_HOLLOW = BS_NULL +BS_HATCHED = 2 +BS_PATTERN = 3 +BS_INDEXED = 4 +BS_DIBPATTERN = 5 +BS_DIBPATTERNPT = 6 +BS_PATTERN8X8 = 7 +BS_DIBPATTERN8X8 = 8 +BS_MONOPATTERN = 9 + +; Hatch styles + +HS_HORIZONTAL = 0 +HS_VERTICAL = 1 +HS_FDIAGONAL = 2 +HS_BDIAGONAL = 3 +HS_CROSS = 4 +HS_DIAGCROSS = 5 + +; Pen styles + +PS_SOLID = 0 +PS_DASH = 1 +PS_DOT = 2 +PS_DASHDOT = 3 +PS_DASHDOTDOT = 4 +PS_NULL = 5 +PS_INSIDEFRAME = 6 +PS_USERSTYLE = 7 +PS_ALTERNATE = 8 +PS_ENDCAP_ROUND = 0 +PS_ENDCAP_SQUARE = 100h +PS_ENDCAP_FLAT = 200h +PS_JOIN_ROUND = 0 +PS_JOIN_BEVEL = 1000h +PS_JOIN_MITER = 2000h +PS_COSMETIC = 0 +PS_GEOMETRIC = 010000h + +; Arc directions + +AD_COUNTERCLOCKWISE = 1 +AD_CLOCKWISE = 2 + +; Text alignment options + +TA_NOUPDATECP = 0 +TA_UPDATECP = 1 +TA_LEFT = 0 +TA_RIGHT = 2 +TA_CENTER = 6 +TA_TOP = 0 +TA_BOTTOM = 8 +TA_BASELINE = 24 +TA_RTLREADING = 100h +VTA_BASELINE = TA_BASELINE +VTA_LEFT = TA_BOTTOM +VTA_RIGHT = TA_TOP +VTA_CENTER = TA_CENTER +VTA_BOTTOM = TA_RIGHT +VTA_TOP = TA_LEFT + +; ExtTextOut options + +ETO_OPAQUE = 0002h +ETO_CLIPPED = 0004h +ETO_GLYPH_INDEX = 0010h +ETO_RTLREADING = 0080h +ETO_IGNORELANGUAGE = 1000h + +; Bitmap compression types + +BI_RGB = 0 +BI_RLE8 = 1 +BI_RLE4 = 2 +BI_BITFIELDS = 3 + +; tmPitchAndFamily flags + +TMPF_FIXED_PITCH = 1 +TMPF_VECTOR = 2 +TMPF_TRUETYPE = 4 +TMPF_DEVICE = 8 + +; Font output precision values + +OUT_DEFAULT_PRECIS = 0 +OUT_STRING_PRECIS = 1 +OUT_CHARACTER_PRECIS = 2 +OUT_STROKE_PRECIS = 3 +OUT_TT_PRECIS = 4 +OUT_DEVICE_PRECIS = 5 +OUT_RASTER_PRECIS = 6 +OUT_TT_ONLY_PRECIS = 7 +OUT_OUTLINE_PRECIS = 8 +OUT_SCREEN_OUTLINE_PRECIS = 9 + +; Font clipping precision values + +CLIP_DEFAULT_PRECIS = 0 +CLIP_CHARACTER_PRECIS = 1 +CLIP_STROKE_PRECIS = 2 +CLIP_LH_ANGLES = 10h +CLIP_TT_ALWAYS = 20h +CLIP_EMBEDDED = 80h + +; Font output quality values + +DEFAULT_QUALITY = 0 +DRAFT_QUALITY = 1 +PROOF_QUALITY = 2 +NONANTIALIASED_QUALITY = 3 +ANTIALIASED_QUALITY = 4 + +; Font pitch values + +DEFAULT_PITCH = 0 +FIXED_PITCH = 1 +VARIABLE_PITCH = 2 +MONO_FONT = 8 + +; Font families + +FF_DONTCARE = 00h +FF_ROMAN = 10h +FF_SWISS = 20h +FF_MODERN = 30h +FF_SCRIPT = 40h +FF_DECORATIVE = 50h + +; Font weights + +FW_DONTCARE = 0 +FW_THIN = 100 +FW_EXTRALIGHT = 200 +FW_LIGHT = 300 +FW_NORMAL = 400 +FW_MEDIUM = 500 +FW_SEMIBOLD = 600 +FW_BOLD = 700 +FW_EXTRABOLD = 800 +FW_HEAVY = 900 +FW_ULTRALIGHT = FW_EXTRALIGHT +FW_REGULAR = FW_NORMAL +FW_DEMIBOLD = FW_SEMIBOLD +FW_ULTRABOLD = FW_EXTRABOLD +FW_BLACK = FW_HEAVY + +; Character set values + +ANSI_CHARSET = 0 +DEFAULT_CHARSET = 1 +SYMBOL_CHARSET = 2 +SHIFTJIS_CHARSET = 128 +HANGEUL_CHARSET = 129 +GB2312_CHARSET = 134 +CHINESEBIG5_CHARSET = 136 +OEM_CHARSET = 255 +JOHAB_CHARSET = 130 +HEBREW_CHARSET = 177 +ARABIC_CHARSET = 178 +GREEK_CHARSET = 161 +TURKISH_CHARSET = 162 +VIETNAMESE_CHARSET = 163 +THAI_CHARSET = 222 +EASTEUROPE_CHARSET = 238 +RUSSIAN_CHARSET = 204 +MAC_CHARSET = 77 +BALTIC_CHARSET = 186 + +; Pixel format constants + +PFD_TYPE_RGBA = 0 +PFD_TYPE_COLORINDEX = 1 +PFD_MAIN_PLANE = 0 +PFD_OVERLAY_PLANE = 1 +PFD_UNDERLAY_PLANE = -1 +PFD_DOUBLEBUFFER = 1 +PFD_STEREO = 2 +PFD_DRAW_TO_WINDOW = 4 +PFD_DRAW_TO_BITMAP = 8 +PFD_SUPPORT_GDI = 10h +PFD_SUPPORT_OPENGL = 20h +PFD_GENERIC_FORMAT = 40h +PFD_NEED_PALETTE = 80h +PFD_NEED_SYSTEM_PALETTE = 100h +PFD_SWAP_EXCHANGE = 200h +PFD_SWAP_COPY = 400h +PFD_SWAP_LAYER_BUFFERS = 800h +PFD_GENERIC_ACCELERATED = 1000h +PFD_DEPTH_DONTCARE = 20000000h +PFD_DOUBLEBUFFER_DONTCARE = 40000000h +PFD_STEREO_DONTCARE = 80000000h diff --git a/fasmw172/INCLUDE/EQUATES/KERNEL32.INC b/fasmw172/INCLUDE/EQUATES/KERNEL32.INC new file mode 100644 index 0000000..40b3569 --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/KERNEL32.INC @@ -0,0 +1,812 @@ + +; KERNEL32.DLL structures and constants + +struct SYSTEM_INFO + wProcessorArchitecture dw ? + wReserved dw ? + dwPageSize dd ? + lpMinimumApplicationAddress dd ? + lpMaximumApplicationAddress dd ? + dwActiveProcessorMask dd ? + dwNumberOfProcessors dd ? + dwProcessorType dd ? + dwAllocationGranularity dd ? + wProcessorLevel dw ? + wProcessorRevision dw ? +ends + +struct OSVERSIONINFO + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion TCHAR 128 dup (?) +ends + +struct OSVERSIONINFOA + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion db 128 dup (?) +ends + +struct OSVERSIONINFOW + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion du 128 dup (?) +ends + +struct MEMORYSTATUS + dwLength dd ? + dwMemoryLoad dd ? + dwTotalPhys dd ? + dwAvailPhys dd ? + dwTotalPageFile dd ? + dwAvailPageFile dd ? + dwTotalVirtual dd ? + dwAvailVirtual dd ? +ends + +struct STARTUPINFO + cb dd ? + lpReserved dd ? + lpDesktop dd ? + lpTitle dd ? + dwX dd ? + dwY dd ? + dwXSize dd ? + dwYSize dd ? + dwXCountChars dd ? + dwYCountChars dd ? + dwFillAttribute dd ? + dwFlags dd ? + wShowWindow dw ? + cbReserved2 dw ? + lpReserved2 dd ? + hStdInput dd ? + hStdOutput dd ? + hStdError dd ? +ends + +struct PROCESS_INFORMATION + hProcess dd ? + hThread dd ? + dwProcessId dd ? + dwThreadId dd ? +ends + +struct FILETIME + dwLowDateTime dd ? + dwHighDateTime dd ? +ends + +struct SYSTEMTIME + wYear dw ? + wMonth dw ? + wDayOfWeek dw ? + wDay dw ? + wHour dw ? + wMinute dw ? + wSecond dw ? + wMilliseconds dw ? +ends + +struct BY_HANDLE_FILE_INFORMATION + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + dwVolumeSerialNumber dd ? + nFileSizeHigh dd ? + nFileSizeLow dd ? + nNumberOfLinks dd ? + nFileIndexHigh dd ? + nFileIndexLow dd ? +ends + +struct WIN32_FIND_DATA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName TCHAR MAX_PATH dup (?) + cAlternateFileName TCHAR 14 dup (?) +ends + +struct WIN32_FIND_DATAA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName db MAX_PATH dup (?) + cAlternateFileName db 14 dup (?) +ends + +struct WIN32_FIND_DATAW + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName du MAX_PATH dup (?) + cAlternateFileName du 14 dup (?) +ends + +; General constants + +NULL = 0 +TRUE = 1 +FALSE = 0 + +; Maximum path length in characters + +MAX_PATH = 260 + +; Access rights + +DELETE_RIGHT = 00010000h +READ_CONTROL = 00020000h +WRITE_DAC = 00040000h +WRITE_OWNER = 00080000h +SYNCHRONIZE = 00100000h +STANDARD_RIGHTS_READ = READ_CONTROL +STANDARD_RIGHTS_WRITE = READ_CONTROL +STANDARD_RIGHTS_EXECUTE = READ_CONTROL +STANDARD_RIGHTS_REQUIRED = 000F0000h +STANDARD_RIGHTS_ALL = 001F0000h +SPECIFIC_RIGHTS_ALL = 0000FFFFh +ACCESS_SYSTEM_SECURITY = 01000000h +MAXIMUM_ALLOWED = 02000000h +GENERIC_READ = 80000000h +GENERIC_WRITE = 40000000h +GENERIC_EXECUTE = 20000000h +GENERIC_ALL = 10000000h +PROCESS_TERMINATE = 00000001h +PROCESS_CREATE_THREAD = 00000002h +PROCESS_VM_OPERATION = 00000008h +PROCESS_VM_READ = 00000010h +PROCESS_VM_WRITE = 00000020h +PROCESS_DUP_HANDLE = 00000040h +PROCESS_CREATE_PROCESS = 00000080h +PROCESS_SET_QUOTA = 00000100h +PROCESS_SET_INFORMATION = 00000200h +PROCESS_QUERY_INFORMATION = 00000400h +PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh +FILE_SHARE_READ = 00000001h +FILE_SHARE_WRITE = 00000002h +FILE_SHARE_DELETE = 00000004h + +; CreateFile actions + +CREATE_NEW = 1 +CREATE_ALWAYS = 2 +OPEN_EXISTING = 3 +OPEN_ALWAYS = 4 +TRUNCATE_EXISTING = 5 + +; OpenFile modes + +OF_READ = 0000h +OF_WRITE = 0001h +OF_READWRITE = 0002h +OF_SHARE_COMPAT = 0000h +OF_SHARE_EXCLUSIVE = 0010h +OF_SHARE_DENY_WRITE = 0020h +OF_SHARE_DENY_READ = 0030h +OF_SHARE_DENY_NONE = 0040h +OF_PARSE = 0100h +OF_DELETE = 0200h +OF_VERIFY = 0400h +OF_CANCEL = 0800h +OF_CREATE = 1000h +OF_PROMPT = 2000h +OF_EXIST = 4000h +OF_REOPEN = 8000h + +; SetFilePointer methods + +FILE_BEGIN = 0 +FILE_CURRENT = 1 +FILE_END = 2 + +; File attributes + +FILE_ATTRIBUTE_READONLY = 001h +FILE_ATTRIBUTE_HIDDEN = 002h +FILE_ATTRIBUTE_SYSTEM = 004h +FILE_ATTRIBUTE_DIRECTORY = 010h +FILE_ATTRIBUTE_ARCHIVE = 020h +FILE_ATTRIBUTE_NORMAL = 080h +FILE_ATTRIBUTE_TEMPORARY = 100h +FILE_ATTRIBUTE_COMPRESSED = 800h + +; File flags + +FILE_FLAG_WRITE_THROUGH = 80000000h +FILE_FLAG_OVERLAPPED = 40000000h +FILE_FLAG_NO_BUFFERING = 20000000h +FILE_FLAG_RANDOM_ACCESS = 10000000h +FILE_FLAG_SEQUENTIAL_SCAN = 08000000h +FILE_FLAG_DELETE_ON_CLOSE = 04000000h +FILE_FLAG_BACKUP_SEMANTICS = 02000000h +FILE_FLAG_POSIX_SEMANTICS = 01000000h + +; Notify filters + +FILE_NOTIFY_CHANGE_FILE_NAME = 001h +FILE_NOTIFY_CHANGE_DIR_NAME = 002h +FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h +FILE_NOTIFY_CHANGE_SIZE = 008h +FILE_NOTIFY_CHANGE_LAST_WRITE = 010h +FILE_NOTIFY_CHANGE_SECURITY = 100h + +; File types + +FILE_TYPE_UNKNOWN = 0 +FILE_TYPE_DISK = 1 +FILE_TYPE_CHAR = 2 +FILE_TYPE_PIPE = 3 +FILE_TYPE_REMOTE = 8000h + +; LockFileEx flags + +LOCKFILE_FAIL_IMMEDIATELY = 1 +LOCKFILE_EXCLUSIVE_LOCK = 2 + +; MoveFileEx flags + +MOVEFILE_REPLACE_EXISTING = 1 +MOVEFILE_COPY_ALLOWED = 2 +MOVEFILE_DELAY_UNTIL_REBOOT = 4 +MOVEFILE_WRITE_THROUGH = 8 + +; FindFirstFileEx flags + +FIND_FIRST_EX_CASE_SENSITIVE = 1 + +; Device handles + +INVALID_HANDLE_VALUE = -1 +STD_INPUT_HANDLE = -10 +STD_OUTPUT_HANDLE = -11 +STD_ERROR_HANDLE = -12 + +; DuplicateHandle options + +DUPLICATE_CLOSE_SOURCE = 1 +DUPLICATE_SAME_ACCESS = 2 + +; File mapping acccess rights + +SECTION_QUERY = 01h +SECTION_MAP_WRITE = 02h +SECTION_MAP_READ = 04h +SECTION_MAP_EXECUTE = 08h +SECTION_EXTEND_SIZE = 10h +SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE +FILE_MAP_COPY = SECTION_QUERY +FILE_MAP_WRITE = SECTION_MAP_WRITE +FILE_MAP_READ = SECTION_MAP_READ +FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS + +; File system flags + +FILE_CASE_SENSITIVE_SEARCH = 0001h +FILE_CASE_PRESERVED_NAMES = 0002h +FILE_UNICODE_ON_DISK = 0004h +FILE_PERSISTENT_ACLS = 0008h +FILE_FILE_COMPRESSION = 0010h +FILE_VOLUME_IS_COMPRESSED = 8000h +FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES +FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH +FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK +FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS + +; Drive types + +DRIVE_UNKNOWN = 0 +DRIVE_NO_ROOT_DIR = 1 +DRIVE_REMOVABLE = 2 +DRIVE_FIXED = 3 +DRIVE_REMOTE = 4 +DRIVE_CDROM = 5 +DRIVE_RAMDISK = 6 + +; Pipe modes + +PIPE_ACCESS_INBOUND = 1 +PIPE_ACCESS_OUTBOUND = 2 +PIPE_ACCESS_DUPLEX = 3 +PIPE_CLIENT_END = 0 +PIPE_SERVER_END = 1 +PIPE_WAIT = 0 +PIPE_NOWAIT = 1 +PIPE_READMODE_BYTE = 0 +PIPE_READMODE_MESSAGE = 2 +PIPE_TYPE_BYTE = 0 +PIPE_TYPE_MESSAGE = 4 +PIPE_UNLIMITED_INSTANCES = 255 + +; Global memory flags + +GMEM_FIXED = 0000h +GMEM_MOVEABLE = 0002h +GMEM_NOCOMPACT = 0010h +GMEM_NODISCARD = 0020h +GMEM_ZEROINIT = 0040h +GMEM_MODIFY = 0080h +GMEM_DISCARDABLE = 0100h +GMEM_NOT_BANKED = 1000h +GMEM_SHARE = 2000h +GMEM_DDESHARE = 2000h +GMEM_NOTIFY = 4000h +GMEM_LOWER = GMEM_NOT_BANKED +GMEM_VALID_FLAGS = 7F72h +GMEM_INVALID_HANDLE = 8000h +GMEM_DISCARDED = 4000h +GMEM_LOCKCOUNT = 0FFh +GHND = GMEM_MOVEABLE + GMEM_ZEROINIT +GPTR = GMEM_FIXED + GMEM_ZEROINIT + +; Local memory flags + +LMEM_FIXED = 0000h +LMEM_MOVEABLE = 0002h +LMEM_NOCOMPACT = 0010h +LMEM_NODISCARD = 0020h +LMEM_ZEROINIT = 0040h +LMEM_MODIFY = 0080h +LMEM_DISCARDABLE = 0F00h +LMEM_VALID_FLAGS = 0F72h +LMEM_INVALID_HANDLE = 8000h +LHND = LMEM_MOVEABLE + LMEM_ZEROINIT +LPTR = LMEM_FIXED + LMEM_ZEROINIT +LMEM_DISCARDED = 4000h +LMEM_LOCKCOUNT = 00FFh + +; Page access flags + +PAGE_NOACCESS = 001h +PAGE_READONLY = 002h +PAGE_READWRITE = 004h +PAGE_WRITECOPY = 008h +PAGE_EXECUTE = 010h +PAGE_EXECUTE_READ = 020h +PAGE_EXECUTE_READWRITE = 040h +PAGE_EXECUTE_WRITECOPY = 080h +PAGE_GUARD = 100h +PAGE_NOCACHE = 200h + +; Memory allocation flags + +MEM_COMMIT = 001000h +MEM_RESERVE = 002000h +MEM_DECOMMIT = 004000h +MEM_RELEASE = 008000h +MEM_FREE = 010000h +MEM_PRIVATE = 020000h +MEM_MAPPED = 040000h +MEM_RESET = 080000h +MEM_TOP_DOWN = 100000h + +; Heap allocation flags + +HEAP_NO_SERIALIZE = 1 +HEAP_GENERATE_EXCEPTIONS = 4 +HEAP_ZERO_MEMORY = 8 + +; Platform identifiers + +VER_PLATFORM_WIN32s = 0 +VER_PLATFORM_WIN32_WINDOWS = 1 +VER_PLATFORM_WIN32_NT = 2 + +; GetBinaryType return values + +SCS_32BIT_BINARY = 0 +SCS_DOS_BINARY = 1 +SCS_WOW_BINARY = 2 +SCS_PIF_BINARY = 3 +SCS_POSIX_BINARY = 4 +SCS_OS216_BINARY = 5 + +; CreateProcess flags + +DEBUG_PROCESS = 001h +DEBUG_ONLY_THIS_PROCESS = 002h +CREATE_SUSPENDED = 004h +DETACHED_PROCESS = 008h +CREATE_NEW_CONSOLE = 010h +NORMAL_PRIORITY_CLASS = 020h +IDLE_PRIORITY_CLASS = 040h +HIGH_PRIORITY_CLASS = 080h +REALTIME_PRIORITY_CLASS = 100h +CREATE_NEW_PROCESS_GROUP = 200h +CREATE_SEPARATE_WOW_VDM = 800h + +; Thread priority values + +THREAD_BASE_PRIORITY_MIN = -2 +THREAD_BASE_PRIORITY_MAX = 2 +THREAD_BASE_PRIORITY_LOWRT = 15 +THREAD_BASE_PRIORITY_IDLE = -15 +THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN +THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1 +THREAD_PRIORITY_NORMAL = 0 +THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX +THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1 +THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh +THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT +THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE + +; Startup flags + +STARTF_USESHOWWINDOW = 001h +STARTF_USESIZE = 002h +STARTF_USEPOSITION = 004h +STARTF_USECOUNTCHARS = 008h +STARTF_USEFILLATTRIBUTE = 010h +STARTF_RUNFULLSCREEN = 020h +STARTF_FORCEONFEEDBACK = 040h +STARTF_FORCEOFFFEEDBACK = 080h +STARTF_USESTDHANDLES = 100h + +; Shutdown flags + +SHUTDOWN_NORETRY = 1h + +; LoadLibraryEx flags + +DONT_RESOLVE_DLL_REFERENCES = 1 +LOAD_LIBRARY_AS_DATAFILE = 2 +LOAD_WITH_ALTERED_SEARCH_PATH = 8 + +; DLL entry-point calls + +DLL_PROCESS_DETACH = 0 +DLL_PROCESS_ATTACH = 1 +DLL_THREAD_ATTACH = 2 +DLL_THREAD_DETACH = 3 + +; Status codes + +STATUS_WAIT_0 = 000000000h +STATUS_ABANDONED_WAIT_0 = 000000080h +STATUS_USER_APC = 0000000C0h +STATUS_TIMEOUT = 000000102h +STATUS_PENDING = 000000103h +STATUS_DATATYPE_MISALIGNMENT = 080000002h +STATUS_BREAKPOINT = 080000003h +STATUS_SINGLE_STEP = 080000004h +STATUS_ACCESS_VIOLATION = 0C0000005h +STATUS_IN_PAGE_ERROR = 0C0000006h +STATUS_NO_MEMORY = 0C0000017h +STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh +STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h +STATUS_INVALID_DISPOSITION = 0C0000026h +STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch +STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh +STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh +STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh +STATUS_FLOAT_INVALID_OPERATION = 0C0000090h +STATUS_FLOAT_OVERFLOW = 0C0000091h +STATUS_FLOAT_STACK_CHECK = 0C0000092h +STATUS_FLOAT_UNDERFLOW = 0C0000093h +STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h +STATUS_INTEGER_OVERFLOW = 0C0000095h +STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h +STATUS_STACK_OVERFLOW = 0C00000FDh +STATUS_CONTROL_C_EXIT = 0C000013Ah +WAIT_FAILED = -1 +WAIT_OBJECT_0 = STATUS_WAIT_0 +WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 +WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 +WAIT_TIMEOUT = STATUS_TIMEOUT +WAIT_IO_COMPLETION = STATUS_USER_APC +STILL_ACTIVE = STATUS_PENDING + +; Exception codes + +EXCEPTION_CONTINUABLE = 0 +EXCEPTION_NONCONTINUABLE = 1 +EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION +EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT +EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT +EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP +EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED +EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND +EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO +EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT +EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION +EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW +EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK +EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW +EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO +EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW +EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION +EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION +EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR + +; Registry options + +REG_OPTION_RESERVED = 0 +REG_OPTION_NON_VOLATILE = 0 +REG_OPTION_VOLATILE = 1 +REG_OPTION_CREATE_LINK = 2 +REG_OPTION_BACKUP_RESTORE = 4 +REG_CREATED_NEW_KEY = 1 +REG_OPENED_EXISTING_KEY = 2 +REG_WHOLE_HIVE_VOLATILE = 1 +REG_REFRESH_HIVE = 2 +REG_NOTIFY_CHANGE_NAME = 1 +REG_NOTIFY_CHANGE_ATTRIBUTES = 2 +REG_NOTIFY_CHANGE_LAST_SET = 4 +REG_NOTIFY_CHANGE_SECURITY = 8 +REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY +REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE +REG_NONE = 0 +REG_SZ = 1 +REG_EXPAND_SZ = 2 +REG_BINARY = 3 +REG_DWORD = 4 +REG_DWORD_LITTLE_ENDIAN = 4 +REG_DWORD_BIG_ENDIAN = 5 +REG_LINK = 6 +REG_MULTI_SZ = 7 +REG_RESOURCE_LIST = 8 +REG_FULL_RESOURCE_DESCRIPTOR = 9 +REG_RESOURCE_REQUIREMENTS_LIST = 10 + +; Registry access modes + +KEY_QUERY_VALUE = 1 +KEY_SET_VALUE = 2 +KEY_CREATE_SUB_KEY = 4 +KEY_ENUMERATE_SUB_KEYS = 8 +KEY_NOTIFY = 10h +KEY_CREATE_LINK = 20h +KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE +KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE +KEY_EXECUTE = KEY_READ +KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE + +; Predefined registry keys + +HKEY_CLASSES_ROOT = 80000000h +HKEY_CURRENT_USER = 80000001h +HKEY_LOCAL_MACHINE = 80000002h +HKEY_USERS = 80000003h +HKEY_PERFORMANCE_DATA = 80000004h +HKEY_CURRENT_CONFIG = 80000005h +HKEY_DYN_DATA = 80000006h + +; FormatMessage flags + +FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h +FORMAT_MESSAGE_IGNORE_INSERTS = 0200h +FORMAT_MESSAGE_FROM_STRING = 0400h +FORMAT_MESSAGE_FROM_HMODULE = 0800h +FORMAT_MESSAGE_FROM_SYSTEM = 1000h +FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h +FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh + +; Language identifiers + +LANG_NEUTRAL = 00h +LANG_BULGARIAN = 02h +LANG_CHINESE = 04h +LANG_CROATIAN = 1Ah +LANG_CZECH = 05h +LANG_DANISH = 06h +LANG_DUTCH = 13h +LANG_ENGLISH = 09h +LANG_FINNISH = 0Bh +LANG_FRENCH = 0Ch +LANG_GERMAN = 07h +LANG_GREEK = 08h +LANG_HUNGARIAN = 0Eh +LANG_ICELANDIC = 0Fh +LANG_ITALIAN = 10h +LANG_JAPANESE = 11h +LANG_KOREAN = 12h +LANG_NORWEGIAN = 14h +LANG_POLISH = 15h +LANG_PORTUGUESE = 16h +LANG_ROMANIAN = 18h +LANG_RUSSIAN = 19h +LANG_SLOVAK = 1Bh +LANG_SLOVENIAN = 24h +LANG_SPANISH = 0Ah +LANG_SWEDISH = 1Dh +LANG_THAI = 1Eh +LANG_TURKISH = 1Fh + +; Sublanguage identifiers + +SUBLANG_NEUTRAL = 00h shl 10 +SUBLANG_DEFAULT = 01h shl 10 +SUBLANG_SYS_DEFAULT = 02h shl 10 +SUBLANG_CHINESE_TRADITIONAL = 01h shl 10 +SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10 +SUBLANG_CHINESE_HONGKONG = 03h shl 10 +SUBLANG_CHINESE_SINGAPORE = 04h shl 10 +SUBLANG_DUTCH = 01h shl 10 +SUBLANG_DUTCH_BELGIAN = 02h shl 10 +SUBLANG_ENGLISH_US = 01h shl 10 +SUBLANG_ENGLISH_UK = 02h shl 10 +SUBLANG_ENGLISH_AUS = 03h shl 10 +SUBLANG_ENGLISH_CAN = 04h shl 10 +SUBLANG_ENGLISH_NZ = 05h shl 10 +SUBLANG_ENGLISH_EIRE = 06h shl 10 +SUBLANG_FRENCH = 01h shl 10 +SUBLANG_FRENCH_BELGIAN = 02h shl 10 +SUBLANG_FRENCH_CANADIAN = 03h shl 10 +SUBLANG_FRENCH_SWISS = 04h shl 10 +SUBLANG_GERMAN = 01h shl 10 +SUBLANG_GERMAN_SWISS = 02h shl 10 +SUBLANG_GERMAN_AUSTRIAN = 03h shl 10 +SUBLANG_ITALIAN = 01h shl 10 +SUBLANG_ITALIAN_SWISS = 02h shl 10 +SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10 +SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10 +SUBLANG_PORTUGUESE = 02h shl 10 +SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10 +SUBLANG_SPANISH = 01h shl 10 +SUBLANG_SPANISH_MEXICAN = 02h shl 10 +SUBLANG_SPANISH_MODERN = 03h shl 10 + +; Sorting identifiers + +SORT_DEFAULT = 0 shl 16 +SORT_JAPANESE_XJIS = 0 shl 16 +SORT_JAPANESE_UNICODE = 1 shl 16 +SORT_CHINESE_BIG5 = 0 shl 16 +SORT_CHINESE_PRCP = 0 shl 16 +SORT_CHINESE_UNICODE = 1 shl 16 +SORT_CHINESE_PRC = 2 shl 16 +SORT_CHINESE_BOPOMOFO = 3 shl 16 +SORT_KOREAN_KSC = 0 shl 16 +SORT_KOREAN_UNICODE = 1 shl 16 +SORT_GERMAN_PHONE_BOOK = 1 shl 16 +SORT_HUNGARIAN_DEFAULT = 0 shl 16 +SORT_HUNGARIAN_TECHNICAL = 1 shl 16 + +; Code pages + +CP_ACP = 0 ; default to ANSI code page +CP_OEMCP = 1 ; default to OEM code page +CP_MACCP = 2 ; default to MAC code page +CP_THREAD_ACP = 3 ; current thread's ANSI code page +CP_SYMBOL = 42 ; SYMBOL translations +CP_UTF7 = 65000 ; UTF-7 translation +CP_UTF8 = 65001 ; UTF-8 translation + +; Resource types + +RT_CURSOR = 1 +RT_BITMAP = 2 +RT_ICON = 3 +RT_MENU = 4 +RT_DIALOG = 5 +RT_STRING = 6 +RT_FONTDIR = 7 +RT_FONT = 8 +RT_ACCELERATOR = 9 +RT_RCDATA = 10 +RT_MESSAGETABLE = 11 +RT_GROUP_CURSOR = 12 +RT_GROUP_ICON = 14 +RT_VERSION = 16 +RT_DLGINCLUDE = 17 +RT_PLUGPLAY = 19 +RT_VXD = 20 +RT_ANICURSOR = 21 +RT_ANIICON = 22 +RT_HTML = 23 +RT_MANIFEST = 24 + +; Clipboard formats + +CF_TEXT = 001h +CF_BITMAP = 002h +CF_METAFILEPICT = 003h +CF_SYLK = 004h +CF_DIF = 005h +CF_TIFF = 006h +CF_OEMTEXT = 007h +CF_DIB = 008h +CF_PALETTE = 009h +CF_PENDATA = 00Ah +CF_RIFF = 00Bh +CF_WAVE = 00Ch +CF_UNICODETEXT = 00Dh +CF_ENHMETAFILE = 00Eh +CF_HDROP = 00Fh +CF_LOCALE = 010h +CF_OWNERDISPLAY = 080h +CF_DSPTEXT = 081h +CF_DSPBITMAP = 082h +CF_DSPMETAFILEPICT = 083h +CF_DSPENHMETAFILE = 08Eh +CF_PRIVATEFIRST = 200h +CF_PRIVATELAST = 2FFh +CF_GDIOBJFIRST = 300h +CF_GDIOBJLAST = 3FFh + +; OS types for version info + +VOS_UNKNOWN = 00000000h +VOS_DOS = 00010000h +VOS_OS216 = 00020000h +VOS_OS232 = 00030000h +VOS_NT = 00040000h +VOS__BASE = 00000000h +VOS__WINDOWS16 = 00000001h +VOS__PM16 = 00000002h +VOS__PM32 = 00000003h +VOS__WINDOWS32 = 00000004h +VOS_DOS_WINDOWS16 = 00010001h +VOS_DOS_WINDOWS32 = 00010004h +VOS_OS216_PM16 = 00020002h +VOS_OS232_PM32 = 00030003h +VOS_NT_WINDOWS32 = 00040004h + +; File types for version info + +VFT_UNKNOWN = 00000000h +VFT_APP = 00000001h +VFT_DLL = 00000002h +VFT_DRV = 00000003h +VFT_FONT = 00000004h +VFT_VXD = 00000005h +VFT_STATIC_LIB = 00000007h + +; File subtypes for version info + +VFT2_UNKNOWN = 00000000h +VFT2_DRV_PRINTER = 00000001h +VFT2_DRV_KEYBOARD = 00000002h +VFT2_DRV_LANGUAGE = 00000003h +VFT2_DRV_DISPLAY = 00000004h +VFT2_DRV_MOUSE = 00000005h +VFT2_DRV_NETWORK = 00000006h +VFT2_DRV_SYSTEM = 00000007h +VFT2_DRV_INSTALLABLE = 00000008h +VFT2_DRV_SOUND = 00000009h +VFT2_DRV_COMM = 0000000Ah +VFT2_DRV_INPUTMETHOD = 0000000Bh +VFT2_DRV_VERSIONED_PRINTER = 0000000Ch +VFT2_FONT_RASTER = 00000001h +VFT2_FONT_VECTOR = 00000002h +VFT2_FONT_TRUETYPE = 00000003h + +; Console control signals + +CTRL_C_EVENT = 0 +CTRL_BREAK_EVENT = 1 +CTRL_CLOSE_EVENT = 2 +CTRL_LOGOFF_EVENT = 5 +CTRL_SHUTDOWN_EVENT = 6 + +; Standard file handles + +STD_INPUT_HANDLE = 0FFFFFFF6h +STD_OUTPUT_HANDLE = 0FFFFFFF5h +STD_ERROR_HANDLE = 0FFFFFFF4h diff --git a/fasmw172/INCLUDE/EQUATES/KERNEL64.INC b/fasmw172/INCLUDE/EQUATES/KERNEL64.INC new file mode 100644 index 0000000..a0e228b --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/KERNEL64.INC @@ -0,0 +1,806 @@ + +; KERNEL32.DLL structures and constants + +struct SYSTEM_INFO + wProcessorArchitecture dw ? + wReserved dw ? + dwPageSize dd ? + lpMinimumApplicationAddress dq ? + lpMaximumApplicationAddress dq ? + dwActiveProcessorMask dq ? + dwNumberOfProcessors dd ? + dwProcessorType dd ? + dwAllocationGranularity dd ? + wProcessorLevel dw ? + wProcessorRevision dw ? +ends + +struct OSVERSIONINFO + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion TCHAR 128 dup (?) +ends + +struct OSVERSIONINFOA + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion db 128 dup (?) +ends + +struct OSVERSIONINFOW + dwOSVersionInfoSize dd ? + dwMajorVersion dd ? + dwMinorVersion dd ? + dwBuildNumber dd ? + dwPlatformId dd ? + szCSDVersion du 128 dup (?) +ends + +struct MEMORYSTATUS + dwLength dd ? + dwMemoryLoad dd ? + dwTotalPhys dq ? + dwAvailPhys dq ? + dwTotalPageFile dq ? + dwAvailPageFile dq ? + dwTotalVirtual dq ? + dwAvailVirtual dq ? +ends + +struct STARTUPINFO + cb dd ?,? + lpReserved dq ? + lpDesktop dq ? + lpTitle dq ? + dwX dd ? + dwY dd ? + dwXSize dd ? + dwYSize dd ? + dwXCountChars dd ? + dwYCountChars dd ? + dwFillAttribute dd ? + dwFlags dd ? + wShowWindow dw ? + cbReserved2 dw ?,?,? + lpReserved2 dq ? + hStdInput dq ? + hStdOutput dq ? + hStdError dq ? +ends + +struct PROCESS_INFORMATION + hProcess dq ? + hThread dq ? + dwProcessId dd ? + dwThreadId dd ? +ends + +struct FILETIME + dwLowDateTime dd ? + dwHighDateTime dd ? +ends + +struct SYSTEMTIME + wYear dw ? + wMonth dw ? + wDayOfWeek dw ? + wDay dw ? + wHour dw ? + wMinute dw ? + wSecond dw ? + wMilliseconds dw ? +ends + +struct BY_HANDLE_FILE_INFORMATION + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + dwVolumeSerialNumber dd ? + nFileSizeHigh dd ? + nFileSizeLow dd ? + nNumberOfLinks dd ? + nFileIndexHigh dd ? + nFileIndexLow dd ? +ends + +struct WIN32_FIND_DATA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName TCHAR MAX_PATH dup (?) + cAlternateFileName TCHAR 14 dup (?) +ends + +struct WIN32_FIND_DATAA + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName db MAX_PATH dup (?) + cAlternateFileName db 14 dup (?) +ends + +struct WIN32_FIND_DATAW + dwFileAttributes dd ? + ftCreationTime FILETIME + ftLastAccessTime FILETIME + ftLastWriteTime FILETIME + nFileSizeHigh dd ? + nFileSizeLow dd ? + dwReserved0 dd ? + dwReserved1 dd ? + cFileName du MAX_PATH dup (?) + cAlternateFileName du 14 dup (?) +ends + +; General constants + +NULL = 0 +TRUE = 1 +FALSE = 0 + +; Maximum path length in characters + +MAX_PATH = 260 + +; Access rights + +DELETE_RIGHT = 00010000h +READ_CONTROL = 00020000h +WRITE_DAC = 00040000h +WRITE_OWNER = 00080000h +SYNCHRONIZE = 00100000h +STANDARD_RIGHTS_READ = READ_CONTROL +STANDARD_RIGHTS_WRITE = READ_CONTROL +STANDARD_RIGHTS_EXECUTE = READ_CONTROL +STANDARD_RIGHTS_REQUIRED = 000F0000h +STANDARD_RIGHTS_ALL = 001F0000h +SPECIFIC_RIGHTS_ALL = 0000FFFFh +ACCESS_SYSTEM_SECURITY = 01000000h +MAXIMUM_ALLOWED = 02000000h +GENERIC_READ = 80000000h +GENERIC_WRITE = 40000000h +GENERIC_EXECUTE = 20000000h +GENERIC_ALL = 10000000h +PROCESS_TERMINATE = 00000001h +PROCESS_CREATE_THREAD = 00000002h +PROCESS_VM_OPERATION = 00000008h +PROCESS_VM_READ = 00000010h +PROCESS_VM_WRITE = 00000020h +PROCESS_DUP_HANDLE = 00000040h +PROCESS_CREATE_PROCESS = 00000080h +PROCESS_SET_QUOTA = 00000100h +PROCESS_SET_INFORMATION = 00000200h +PROCESS_QUERY_INFORMATION = 00000400h +PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh +FILE_SHARE_READ = 00000001h +FILE_SHARE_WRITE = 00000002h +FILE_SHARE_DELETE = 00000004h + +; CreateFile actions + +CREATE_NEW = 1 +CREATE_ALWAYS = 2 +OPEN_EXISTING = 3 +OPEN_ALWAYS = 4 +TRUNCATE_EXISTING = 5 + +; OpenFile modes + +OF_READ = 0000h +OF_WRITE = 0001h +OF_READWRITE = 0002h +OF_SHARE_COMPAT = 0000h +OF_SHARE_EXCLUSIVE = 0010h +OF_SHARE_DENY_WRITE = 0020h +OF_SHARE_DENY_READ = 0030h +OF_SHARE_DENY_NONE = 0040h +OF_PARSE = 0100h +OF_DELETE = 0200h +OF_VERIFY = 0400h +OF_CANCEL = 0800h +OF_CREATE = 1000h +OF_PROMPT = 2000h +OF_EXIST = 4000h +OF_REOPEN = 8000h + +; SetFilePointer methods + +FILE_BEGIN = 0 +FILE_CURRENT = 1 +FILE_END = 2 + +; File attributes + +FILE_ATTRIBUTE_READONLY = 001h +FILE_ATTRIBUTE_HIDDEN = 002h +FILE_ATTRIBUTE_SYSTEM = 004h +FILE_ATTRIBUTE_DIRECTORY = 010h +FILE_ATTRIBUTE_ARCHIVE = 020h +FILE_ATTRIBUTE_NORMAL = 080h +FILE_ATTRIBUTE_TEMPORARY = 100h +FILE_ATTRIBUTE_COMPRESSED = 800h + +; File flags + +FILE_FLAG_WRITE_THROUGH = 80000000h +FILE_FLAG_OVERLAPPED = 40000000h +FILE_FLAG_NO_BUFFERING = 20000000h +FILE_FLAG_RANDOM_ACCESS = 10000000h +FILE_FLAG_SEQUENTIAL_SCAN = 08000000h +FILE_FLAG_DELETE_ON_CLOSE = 04000000h +FILE_FLAG_BACKUP_SEMANTICS = 02000000h +FILE_FLAG_POSIX_SEMANTICS = 01000000h + +; Notify filters + +FILE_NOTIFY_CHANGE_FILE_NAME = 001h +FILE_NOTIFY_CHANGE_DIR_NAME = 002h +FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h +FILE_NOTIFY_CHANGE_SIZE = 008h +FILE_NOTIFY_CHANGE_LAST_WRITE = 010h +FILE_NOTIFY_CHANGE_SECURITY = 100h + +; File types + +FILE_TYPE_UNKNOWN = 0 +FILE_TYPE_DISK = 1 +FILE_TYPE_CHAR = 2 +FILE_TYPE_PIPE = 3 +FILE_TYPE_REMOTE = 8000h + +; LockFileEx flags + +LOCKFILE_FAIL_IMMEDIATELY = 1 +LOCKFILE_EXCLUSIVE_LOCK = 2 + +; MoveFileEx flags + +MOVEFILE_REPLACE_EXISTING = 1 +MOVEFILE_COPY_ALLOWED = 2 +MOVEFILE_DELAY_UNTIL_REBOOT = 4 +MOVEFILE_WRITE_THROUGH = 8 + +; FindFirstFileEx flags + +FIND_FIRST_EX_CASE_SENSITIVE = 1 + +; Device handles + +INVALID_HANDLE_VALUE = -1 +STD_INPUT_HANDLE = -10 +STD_OUTPUT_HANDLE = -11 +STD_ERROR_HANDLE = -12 + +; DuplicateHandle options + +DUPLICATE_CLOSE_SOURCE = 1 +DUPLICATE_SAME_ACCESS = 2 + +; File mapping acccess rights + +SECTION_QUERY = 01h +SECTION_MAP_WRITE = 02h +SECTION_MAP_READ = 04h +SECTION_MAP_EXECUTE = 08h +SECTION_EXTEND_SIZE = 10h +SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE +FILE_MAP_COPY = SECTION_QUERY +FILE_MAP_WRITE = SECTION_MAP_WRITE +FILE_MAP_READ = SECTION_MAP_READ +FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS + +; File system flags + +FILE_CASE_SENSITIVE_SEARCH = 0001h +FILE_CASE_PRESERVED_NAMES = 0002h +FILE_UNICODE_ON_DISK = 0004h +FILE_PERSISTENT_ACLS = 0008h +FILE_FILE_COMPRESSION = 0010h +FILE_VOLUME_IS_COMPRESSED = 8000h +FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES +FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH +FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK +FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS + +; Drive types + +DRIVE_UNKNOWN = 0 +DRIVE_NO_ROOT_DIR = 1 +DRIVE_REMOVABLE = 2 +DRIVE_FIXED = 3 +DRIVE_REMOTE = 4 +DRIVE_CDROM = 5 +DRIVE_RAMDISK = 6 + +; Pipe modes + +PIPE_ACCESS_INBOUND = 1 +PIPE_ACCESS_OUTBOUND = 2 +PIPE_ACCESS_DUPLEX = 3 +PIPE_CLIENT_END = 0 +PIPE_SERVER_END = 1 +PIPE_WAIT = 0 +PIPE_NOWAIT = 1 +PIPE_READMODE_BYTE = 0 +PIPE_READMODE_MESSAGE = 2 +PIPE_TYPE_BYTE = 0 +PIPE_TYPE_MESSAGE = 4 +PIPE_UNLIMITED_INSTANCES = 255 + +; Global memory flags + +GMEM_FIXED = 0000h +GMEM_MOVEABLE = 0002h +GMEM_NOCOMPACT = 0010h +GMEM_NODISCARD = 0020h +GMEM_ZEROINIT = 0040h +GMEM_MODIFY = 0080h +GMEM_DISCARDABLE = 0100h +GMEM_NOT_BANKED = 1000h +GMEM_SHARE = 2000h +GMEM_DDESHARE = 2000h +GMEM_NOTIFY = 4000h +GMEM_LOWER = GMEM_NOT_BANKED +GMEM_VALID_FLAGS = 7F72h +GMEM_INVALID_HANDLE = 8000h +GMEM_DISCARDED = 4000h +GMEM_LOCKCOUNT = 0FFh +GHND = GMEM_MOVEABLE + GMEM_ZEROINIT +GPTR = GMEM_FIXED + GMEM_ZEROINIT + +; Local memory flags + +LMEM_FIXED = 0000h +LMEM_MOVEABLE = 0002h +LMEM_NOCOMPACT = 0010h +LMEM_NODISCARD = 0020h +LMEM_ZEROINIT = 0040h +LMEM_MODIFY = 0080h +LMEM_DISCARDABLE = 0F00h +LMEM_VALID_FLAGS = 0F72h +LMEM_INVALID_HANDLE = 8000h +LHND = LMEM_MOVEABLE + LMEM_ZEROINIT +LPTR = LMEM_FIXED + LMEM_ZEROINIT +LMEM_DISCARDED = 4000h +LMEM_LOCKCOUNT = 00FFh + +; Page access flags + +PAGE_NOACCESS = 001h +PAGE_READONLY = 002h +PAGE_READWRITE = 004h +PAGE_WRITECOPY = 008h +PAGE_EXECUTE = 010h +PAGE_EXECUTE_READ = 020h +PAGE_EXECUTE_READWRITE = 040h +PAGE_EXECUTE_WRITECOPY = 080h +PAGE_GUARD = 100h +PAGE_NOCACHE = 200h + +; Memory allocation flags + +MEM_COMMIT = 001000h +MEM_RESERVE = 002000h +MEM_DECOMMIT = 004000h +MEM_RELEASE = 008000h +MEM_FREE = 010000h +MEM_PRIVATE = 020000h +MEM_MAPPED = 040000h +MEM_RESET = 080000h +MEM_TOP_DOWN = 100000h + +; Heap allocation flags + +HEAP_NO_SERIALIZE = 1 +HEAP_GENERATE_EXCEPTIONS = 4 +HEAP_ZERO_MEMORY = 8 + +; Platform identifiers + +VER_PLATFORM_WIN32s = 0 +VER_PLATFORM_WIN32_WINDOWS = 1 +VER_PLATFORM_WIN32_NT = 2 + +; GetBinaryType return values + +SCS_32BIT_BINARY = 0 +SCS_DOS_BINARY = 1 +SCS_WOW_BINARY = 2 +SCS_PIF_BINARY = 3 +SCS_POSIX_BINARY = 4 +SCS_OS216_BINARY = 5 + +; CreateProcess flags + +DEBUG_PROCESS = 001h +DEBUG_ONLY_THIS_PROCESS = 002h +CREATE_SUSPENDED = 004h +DETACHED_PROCESS = 008h +CREATE_NEW_CONSOLE = 010h +NORMAL_PRIORITY_CLASS = 020h +IDLE_PRIORITY_CLASS = 040h +HIGH_PRIORITY_CLASS = 080h +REALTIME_PRIORITY_CLASS = 100h +CREATE_NEW_PROCESS_GROUP = 200h +CREATE_SEPARATE_WOW_VDM = 800h + +; Thread priority values + +THREAD_BASE_PRIORITY_MIN = -2 +THREAD_BASE_PRIORITY_MAX = 2 +THREAD_BASE_PRIORITY_LOWRT = 15 +THREAD_BASE_PRIORITY_IDLE = -15 +THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN +THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1 +THREAD_PRIORITY_NORMAL = 0 +THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX +THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1 +THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh +THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT +THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE + +; Startup flags + +STARTF_USESHOWWINDOW = 001h +STARTF_USESIZE = 002h +STARTF_USEPOSITION = 004h +STARTF_USECOUNTCHARS = 008h +STARTF_USEFILLATTRIBUTE = 010h +STARTF_RUNFULLSCREEN = 020h +STARTF_FORCEONFEEDBACK = 040h +STARTF_FORCEOFFFEEDBACK = 080h +STARTF_USESTDHANDLES = 100h + +; Shutdown flags + +SHUTDOWN_NORETRY = 1h + +; LoadLibraryEx flags + +DONT_RESOLVE_DLL_REFERENCES = 1 +LOAD_LIBRARY_AS_DATAFILE = 2 +LOAD_WITH_ALTERED_SEARCH_PATH = 8 + +; DLL entry-point calls + +DLL_PROCESS_DETACH = 0 +DLL_PROCESS_ATTACH = 1 +DLL_THREAD_ATTACH = 2 +DLL_THREAD_DETACH = 3 + +; Status codes + +STATUS_WAIT_0 = 000000000h +STATUS_ABANDONED_WAIT_0 = 000000080h +STATUS_USER_APC = 0000000C0h +STATUS_TIMEOUT = 000000102h +STATUS_PENDING = 000000103h +STATUS_DATATYPE_MISALIGNMENT = 080000002h +STATUS_BREAKPOINT = 080000003h +STATUS_SINGLE_STEP = 080000004h +STATUS_ACCESS_VIOLATION = 0C0000005h +STATUS_IN_PAGE_ERROR = 0C0000006h +STATUS_NO_MEMORY = 0C0000017h +STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh +STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h +STATUS_INVALID_DISPOSITION = 0C0000026h +STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch +STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh +STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh +STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh +STATUS_FLOAT_INVALID_OPERATION = 0C0000090h +STATUS_FLOAT_OVERFLOW = 0C0000091h +STATUS_FLOAT_STACK_CHECK = 0C0000092h +STATUS_FLOAT_UNDERFLOW = 0C0000093h +STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h +STATUS_INTEGER_OVERFLOW = 0C0000095h +STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h +STATUS_STACK_OVERFLOW = 0C00000FDh +STATUS_CONTROL_C_EXIT = 0C000013Ah +WAIT_FAILED = -1 +WAIT_OBJECT_0 = STATUS_WAIT_0 +WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 +WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 +WAIT_TIMEOUT = STATUS_TIMEOUT +WAIT_IO_COMPLETION = STATUS_USER_APC +STILL_ACTIVE = STATUS_PENDING + +; Exception codes + +EXCEPTION_CONTINUABLE = 0 +EXCEPTION_NONCONTINUABLE = 1 +EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION +EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT +EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT +EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP +EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED +EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND +EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO +EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT +EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION +EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW +EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK +EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW +EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO +EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW +EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION +EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION +EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR + +; Registry options + +REG_OPTION_RESERVED = 0 +REG_OPTION_NON_VOLATILE = 0 +REG_OPTION_VOLATILE = 1 +REG_OPTION_CREATE_LINK = 2 +REG_OPTION_BACKUP_RESTORE = 4 +REG_CREATED_NEW_KEY = 1 +REG_OPENED_EXISTING_KEY = 2 +REG_WHOLE_HIVE_VOLATILE = 1 +REG_REFRESH_HIVE = 2 +REG_NOTIFY_CHANGE_NAME = 1 +REG_NOTIFY_CHANGE_ATTRIBUTES = 2 +REG_NOTIFY_CHANGE_LAST_SET = 4 +REG_NOTIFY_CHANGE_SECURITY = 8 +REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY +REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE +REG_NONE = 0 +REG_SZ = 1 +REG_EXPAND_SZ = 2 +REG_BINARY = 3 +REG_DWORD = 4 +REG_DWORD_LITTLE_ENDIAN = 4 +REG_DWORD_BIG_ENDIAN = 5 +REG_LINK = 6 +REG_MULTI_SZ = 7 +REG_RESOURCE_LIST = 8 +REG_FULL_RESOURCE_DESCRIPTOR = 9 +REG_RESOURCE_REQUIREMENTS_LIST = 10 + +; Registry access modes + +KEY_QUERY_VALUE = 1 +KEY_SET_VALUE = 2 +KEY_CREATE_SUB_KEY = 4 +KEY_ENUMERATE_SUB_KEYS = 8 +KEY_NOTIFY = 10h +KEY_CREATE_LINK = 20h +KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE +KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE +KEY_EXECUTE = KEY_READ +KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE + +; Predefined registry keys + +HKEY_CLASSES_ROOT = 80000000h +HKEY_CURRENT_USER = 80000001h +HKEY_LOCAL_MACHINE = 80000002h +HKEY_USERS = 80000003h +HKEY_PERFORMANCE_DATA = 80000004h +HKEY_CURRENT_CONFIG = 80000005h +HKEY_DYN_DATA = 80000006h + +; FormatMessage flags + +FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h +FORMAT_MESSAGE_IGNORE_INSERTS = 0200h +FORMAT_MESSAGE_FROM_STRING = 0400h +FORMAT_MESSAGE_FROM_HMODULE = 0800h +FORMAT_MESSAGE_FROM_SYSTEM = 1000h +FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h +FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh + +; Language identifiers + +LANG_NEUTRAL = 00h +LANG_BULGARIAN = 02h +LANG_CHINESE = 04h +LANG_CROATIAN = 1Ah +LANG_CZECH = 05h +LANG_DANISH = 06h +LANG_DUTCH = 13h +LANG_ENGLISH = 09h +LANG_FINNISH = 0Bh +LANG_FRENCH = 0Ch +LANG_GERMAN = 07h +LANG_GREEK = 08h +LANG_HUNGARIAN = 0Eh +LANG_ICELANDIC = 0Fh +LANG_ITALIAN = 10h +LANG_JAPANESE = 11h +LANG_KOREAN = 12h +LANG_NORWEGIAN = 14h +LANG_POLISH = 15h +LANG_PORTUGUESE = 16h +LANG_ROMANIAN = 18h +LANG_RUSSIAN = 19h +LANG_SLOVAK = 1Bh +LANG_SLOVENIAN = 24h +LANG_SPANISH = 0Ah +LANG_SWEDISH = 1Dh +LANG_THAI = 1Eh +LANG_TURKISH = 1Fh + +; Sublanguage identifiers + +SUBLANG_NEUTRAL = 00h shl 10 +SUBLANG_DEFAULT = 01h shl 10 +SUBLANG_SYS_DEFAULT = 02h shl 10 +SUBLANG_CHINESE_TRADITIONAL = 01h shl 10 +SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10 +SUBLANG_CHINESE_HONGKONG = 03h shl 10 +SUBLANG_CHINESE_SINGAPORE = 04h shl 10 +SUBLANG_DUTCH = 01h shl 10 +SUBLANG_DUTCH_BELGIAN = 02h shl 10 +SUBLANG_ENGLISH_US = 01h shl 10 +SUBLANG_ENGLISH_UK = 02h shl 10 +SUBLANG_ENGLISH_AUS = 03h shl 10 +SUBLANG_ENGLISH_CAN = 04h shl 10 +SUBLANG_ENGLISH_NZ = 05h shl 10 +SUBLANG_ENGLISH_EIRE = 06h shl 10 +SUBLANG_FRENCH = 01h shl 10 +SUBLANG_FRENCH_BELGIAN = 02h shl 10 +SUBLANG_FRENCH_CANADIAN = 03h shl 10 +SUBLANG_FRENCH_SWISS = 04h shl 10 +SUBLANG_GERMAN = 01h shl 10 +SUBLANG_GERMAN_SWISS = 02h shl 10 +SUBLANG_GERMAN_AUSTRIAN = 03h shl 10 +SUBLANG_ITALIAN = 01h shl 10 +SUBLANG_ITALIAN_SWISS = 02h shl 10 +SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10 +SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10 +SUBLANG_PORTUGUESE = 02h shl 10 +SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10 +SUBLANG_SPANISH = 01h shl 10 +SUBLANG_SPANISH_MEXICAN = 02h shl 10 +SUBLANG_SPANISH_MODERN = 03h shl 10 + +; Sorting identifiers + +SORT_DEFAULT = 0 shl 16 +SORT_JAPANESE_XJIS = 0 shl 16 +SORT_JAPANESE_UNICODE = 1 shl 16 +SORT_CHINESE_BIG5 = 0 shl 16 +SORT_CHINESE_PRCP = 0 shl 16 +SORT_CHINESE_UNICODE = 1 shl 16 +SORT_CHINESE_PRC = 2 shl 16 +SORT_CHINESE_BOPOMOFO = 3 shl 16 +SORT_KOREAN_KSC = 0 shl 16 +SORT_KOREAN_UNICODE = 1 shl 16 +SORT_GERMAN_PHONE_BOOK = 1 shl 16 +SORT_HUNGARIAN_DEFAULT = 0 shl 16 +SORT_HUNGARIAN_TECHNICAL = 1 shl 16 + +; Code pages + +CP_ACP = 0 ; default to ANSI code page +CP_OEMCP = 1 ; default to OEM code page +CP_MACCP = 2 ; default to MAC code page +CP_THREAD_ACP = 3 ; current thread's ANSI code page +CP_SYMBOL = 42 ; SYMBOL translations +CP_UTF7 = 65000 ; UTF-7 translation +CP_UTF8 = 65001 ; UTF-8 translation + +; Resource types + +RT_CURSOR = 1 +RT_BITMAP = 2 +RT_ICON = 3 +RT_MENU = 4 +RT_DIALOG = 5 +RT_STRING = 6 +RT_FONTDIR = 7 +RT_FONT = 8 +RT_ACCELERATOR = 9 +RT_RCDATA = 10 +RT_MESSAGETABLE = 11 +RT_GROUP_CURSOR = 12 +RT_GROUP_ICON = 14 +RT_VERSION = 16 +RT_DLGINCLUDE = 17 +RT_PLUGPLAY = 19 +RT_VXD = 20 +RT_ANICURSOR = 21 +RT_ANIICON = 22 +RT_HTML = 23 +RT_MANIFEST = 24 + +; Clipboard formats + +CF_TEXT = 001h +CF_BITMAP = 002h +CF_METAFILEPICT = 003h +CF_SYLK = 004h +CF_DIF = 005h +CF_TIFF = 006h +CF_OEMTEXT = 007h +CF_DIB = 008h +CF_PALETTE = 009h +CF_PENDATA = 00Ah +CF_RIFF = 00Bh +CF_WAVE = 00Ch +CF_UNICODETEXT = 00Dh +CF_ENHMETAFILE = 00Eh +CF_HDROP = 00Fh +CF_LOCALE = 010h +CF_OWNERDISPLAY = 080h +CF_DSPTEXT = 081h +CF_DSPBITMAP = 082h +CF_DSPMETAFILEPICT = 083h +CF_DSPENHMETAFILE = 08Eh +CF_PRIVATEFIRST = 200h +CF_PRIVATELAST = 2FFh +CF_GDIOBJFIRST = 300h +CF_GDIOBJLAST = 3FFh + +; OS types for version info + +VOS_UNKNOWN = 00000000h +VOS_DOS = 00010000h +VOS_OS216 = 00020000h +VOS_OS232 = 00030000h +VOS_NT = 00040000h +VOS__BASE = 00000000h +VOS__WINDOWS16 = 00000001h +VOS__PM16 = 00000002h +VOS__PM32 = 00000003h +VOS__WINDOWS32 = 00000004h +VOS_DOS_WINDOWS16 = 00010001h +VOS_DOS_WINDOWS32 = 00010004h +VOS_OS216_PM16 = 00020002h +VOS_OS232_PM32 = 00030003h +VOS_NT_WINDOWS32 = 00040004h + +; File types for version info + +VFT_UNKNOWN = 00000000h +VFT_APP = 00000001h +VFT_DLL = 00000002h +VFT_DRV = 00000003h +VFT_FONT = 00000004h +VFT_VXD = 00000005h +VFT_STATIC_LIB = 00000007h + +; File subtypes for version info + +VFT2_UNKNOWN = 00000000h +VFT2_DRV_PRINTER = 00000001h +VFT2_DRV_KEYBOARD = 00000002h +VFT2_DRV_LANGUAGE = 00000003h +VFT2_DRV_DISPLAY = 00000004h +VFT2_DRV_MOUSE = 00000005h +VFT2_DRV_NETWORK = 00000006h +VFT2_DRV_SYSTEM = 00000007h +VFT2_DRV_INSTALLABLE = 00000008h +VFT2_DRV_SOUND = 00000009h +VFT2_DRV_COMM = 0000000Ah +VFT2_DRV_INPUTMETHOD = 0000000Bh +VFT2_DRV_VERSIONED_PRINTER = 0000000Ch +VFT2_FONT_RASTER = 00000001h +VFT2_FONT_VECTOR = 00000002h +VFT2_FONT_TRUETYPE = 00000003h + +; Console control signals + +CTRL_C_EVENT = 0 +CTRL_BREAK_EVENT = 1 +CTRL_CLOSE_EVENT = 2 +CTRL_LOGOFF_EVENT = 5 +CTRL_SHUTDOWN_EVENT = 6 diff --git a/fasmw172/INCLUDE/EQUATES/SHELL32.INC b/fasmw172/INCLUDE/EQUATES/SHELL32.INC new file mode 100644 index 0000000..aa2b0ad --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/SHELL32.INC @@ -0,0 +1,128 @@ + +; SHELL32.DLL structures and constants + +struct NOTIFYICONDATA + cbSize dd ? + hWnd dd ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ? + hIcon dd ? + szTip TCHAR 64 dup (?) +ends + +struct NOTIFYICONDATAA + cbSize dd ? + hWnd dd ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ? + hIcon dd ? + szTip db 64 dup (?) +ends + +struct NOTIFYICONDATAW + cbSize dd ? + hWnd dd ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ? + hIcon dd ? + szTip du 64 dup (?) +ends + +struct BROWSEINFO + hwndOwner dd ? + pidlRoot dd ? + pszDisplayName dd ? + lpszTitle dd ? + ulFlags dd ? + lpfn dd ? + lParam dd ? + iImage dd ? +ends + +; Taskbar icon messages + +NIM_ADD = 0 +NIM_MODIFY = 1 +NIM_DELETE = 2 +NIM_SETFOCUS = 3 +NIM_SETVERSION = 4 + +; Taskbar icon flags + +NIF_MESSAGE = 01h +NIF_ICON = 02h +NIF_TIP = 04h +NIF_STATE = 08h +NIF_INFO = 10h +NIF_GUID = 20h + +; Constant Special Item ID List + +CSIDL_DESKTOP = 0x0000 +CSIDL_INTERNET = 0x0001 +CSIDL_PROGRAMS = 0x0002 +CSIDL_CONTROLS = 0x0003 +CSIDL_PRINTERS = 0x0004 +CSIDL_PERSONAL = 0x0005 +CSIDL_FAVORITES = 0x0006 +CSIDL_STARTUP = 0x0007 +CSIDL_RECENT = 0x0008 +CSIDL_SENDTO = 0x0009 +CSIDL_BITBUCKET = 0x000A +CSIDL_STARTMENU = 0x000B +CSIDL_MYDOCUMENTS = 0x000C +CSIDL_MYMUSIC = 0x000D +CSIDL_MYVIDEO = 0x000E +CSIDL_DESKTOPDIRECTORY = 0x0010 +CSIDL_DRIVES = 0x0011 +CSIDL_NETWORK = 0x0012 +CSIDL_NETHOOD = 0x0013 +CSIDL_FONTS = 0x0014 +CSIDL_TEMPLATES = 0x0015 +CSIDL_COMMON_STARTMENU = 0x0016 +CSIDL_COMMON_PROGRAMS = 0x0017 +CSIDL_COMMON_STARTUP = 0x0018 +CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019 +CSIDL_APPDATA = 0x001A +CSIDL_PRINTHOOD = 0x001B +CSIDL_LOCAL_APPDATA = 0x001C +CSIDL_ALTSTARTUP = 0x001D +CSIDL_COMMON_ALTSTARTUP = 0x001E +CSIDL_COMMON_FAVORITES = 0x001F +CSIDL_INTERNET_CACHE = 0x0020 +CSIDL_COOKIES = 0x0021 +CSIDL_HISTORY = 0x0022 +CSIDL_COMMON_APPDATA = 0x0023 +CSIDL_WINDOWS = 0x0024 +CSIDL_SYSTEM = 0x0025 +CSIDL_PROGRAM_FILES = 0x0026 +CSIDL_MYPICTURES = 0x0027 +CSIDL_PROFILE = 0x0028 +CSIDL_SYSTEMX86 = 0x0029 +CSIDL_PROGRAM_FILESX86 = 0x002A +CSIDL_PROGRAM_FILES_COMMON = 0x002B +CSIDL_PROGRAM_FILES_COMMONX86 = 0x002C +CSIDL_COMMON_TEMPLATES = 0x002D +CSIDL_COMMON_DOCUMENTS = 0x002E +CSIDL_COMMON_ADMINTOOLS = 0x002F +CSIDL_ADMINTOOLS = 0x0030 +CSIDL_CONNECTIONS = 0x0031 +CSIDL_COMMON_MUSIC = 0x0035 +CSIDL_COMMON_PICTURES = 0x0036 +CSIDL_COMMON_VIDEO = 0x0037 +CSIDL_RESOURCES = 0x0038 +CSIDL_RESOURCES_LOCALIZED = 0x0039 +CSIDL_COMMON_OEM_LINKS = 0x003A +CSIDL_CDBURN_AREA = 0x003B +CSIDL_COMPUTERSNEARME = 0x003D +CSIDL_PROFILES = 0x003E +CSIDL_FOLDER_MASK = 0x00FF +CSIDL_FLAG_PER_USER_INIT = 0x0800 +CSIDL_FLAG_NO_ALIAS = 0x1000 +CSIDL_FLAG_DONT_VERIFY = 0x4000 +CSIDL_FLAG_CREATE = 0x8000 +CSIDL_FLAG_MASK = 0xFF00 + \ No newline at end of file diff --git a/fasmw172/INCLUDE/EQUATES/SHELL64.INC b/fasmw172/INCLUDE/EQUATES/SHELL64.INC new file mode 100644 index 0000000..79d47fb --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/SHELL64.INC @@ -0,0 +1,127 @@ + +; SHELL32.DLL structures and constants + +struct NOTIFYICONDATA + cbSize dd ?,? + hWnd dq ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ?,? + hIcon dq ? + szTip TCHAR 64 dup (?) +ends + +struct NOTIFYICONDATAA + cbSize dd ?,? + hWnd dq ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ?,? + hIcon dq ? + szTip db 64 dup (?) +ends + +struct NOTIFYICONDATAW + cbSize dd ?,? + hWnd dq ? + uID dd ? + uFlags dd ? + uCallbackMessage dd ?,? + hIcon dq ? + szTip du 64 dup (?) +ends + +struct BROWSEINFO + hwndOwner dq ? + pidlRoot dq ? + pszDisplayName dq ? + lpszTitle dq ? + ulFlags dd ?,? + lpfn dq ? + lParam dq ? + iImage dq ? +ends + +; Taskbar icon messages + +NIM_ADD = 0 +NIM_MODIFY = 1 +NIM_DELETE = 2 +NIM_SETFOCUS = 3 +NIM_SETVERSION = 4 + +; Taskbar icon flags + +NIF_MESSAGE = 01h +NIF_ICON = 02h +NIF_TIP = 04h +NIF_STATE = 08h +NIF_INFO = 10h +NIF_GUID = 20h + +; Constant Special Item ID List + +CSIDL_DESKTOP = 0x0000 +CSIDL_INTERNET = 0x0001 +CSIDL_PROGRAMS = 0x0002 +CSIDL_CONTROLS = 0x0003 +CSIDL_PRINTERS = 0x0004 +CSIDL_PERSONAL = 0x0005 +CSIDL_FAVORITES = 0x0006 +CSIDL_STARTUP = 0x0007 +CSIDL_RECENT = 0x0008 +CSIDL_SENDTO = 0x0009 +CSIDL_BITBUCKET = 0x000A +CSIDL_STARTMENU = 0x000B +CSIDL_MYDOCUMENTS = 0x000C +CSIDL_MYMUSIC = 0x000D +CSIDL_MYVIDEO = 0x000E +CSIDL_DESKTOPDIRECTORY = 0x0010 +CSIDL_DRIVES = 0x0011 +CSIDL_NETWORK = 0x0012 +CSIDL_NETHOOD = 0x0013 +CSIDL_FONTS = 0x0014 +CSIDL_TEMPLATES = 0x0015 +CSIDL_COMMON_STARTMENU = 0x0016 +CSIDL_COMMON_PROGRAMS = 0x0017 +CSIDL_COMMON_STARTUP = 0x0018 +CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019 +CSIDL_APPDATA = 0x001A +CSIDL_PRINTHOOD = 0x001B +CSIDL_LOCAL_APPDATA = 0x001C +CSIDL_ALTSTARTUP = 0x001D +CSIDL_COMMON_ALTSTARTUP = 0x001E +CSIDL_COMMON_FAVORITES = 0x001F +CSIDL_INTERNET_CACHE = 0x0020 +CSIDL_COOKIES = 0x0021 +CSIDL_HISTORY = 0x0022 +CSIDL_COMMON_APPDATA = 0x0023 +CSIDL_WINDOWS = 0x0024 +CSIDL_SYSTEM = 0x0025 +CSIDL_PROGRAM_FILES = 0x0026 +CSIDL_MYPICTURES = 0x0027 +CSIDL_PROFILE = 0x0028 +CSIDL_SYSTEMX86 = 0x0029 +CSIDL_PROGRAM_FILESX86 = 0x002A +CSIDL_PROGRAM_FILES_COMMON = 0x002B +CSIDL_PROGRAM_FILES_COMMONX86 = 0x002C +CSIDL_COMMON_TEMPLATES = 0x002D +CSIDL_COMMON_DOCUMENTS = 0x002E +CSIDL_COMMON_ADMINTOOLS = 0x002F +CSIDL_ADMINTOOLS = 0x0030 +CSIDL_CONNECTIONS = 0x0031 +CSIDL_COMMON_MUSIC = 0x0035 +CSIDL_COMMON_PICTURES = 0x0036 +CSIDL_COMMON_VIDEO = 0x0037 +CSIDL_RESOURCES = 0x0038 +CSIDL_RESOURCES_LOCALIZED = 0x0039 +CSIDL_COMMON_OEM_LINKS = 0x003A +CSIDL_CDBURN_AREA = 0x003B +CSIDL_COMPUTERSNEARME = 0x003D +CSIDL_PROFILES = 0x003E +CSIDL_FOLDER_MASK = 0x00FF +CSIDL_FLAG_PER_USER_INIT = 0x0800 +CSIDL_FLAG_NO_ALIAS = 0x1000 +CSIDL_FLAG_DONT_VERIFY = 0x4000 +CSIDL_FLAG_CREATE = 0x8000 +CSIDL_FLAG_MASK = 0xFF00 diff --git a/fasmw172/INCLUDE/EQUATES/USER32.INC b/fasmw172/INCLUDE/EQUATES/USER32.INC new file mode 100644 index 0000000..b30caf1 --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/USER32.INC @@ -0,0 +1,1933 @@ + +; USER32.DLL structures and constants + +struct POINT + x dd ? + y dd ? +ends + +struct POINTS + x dw ? + y dw ? +ends + +struct RECT + left dd ? + top dd ? + right dd ? + bottom dd ? +ends + +struct WNDCLASS + style dd ? + lpfnWndProc dd ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dd ? + hIcon dd ? + hCursor dd ? + hbrBackground dd ? + lpszMenuName dd ? + lpszClassName dd ? +ends + +struct WNDCLASSEX + cbSize dd ? + style dd ? + lpfnWndProc dd ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dd ? + hIcon dd ? + hCursor dd ? + hbrBackground dd ? + lpszMenuName dd ? + lpszClassName dd ? + hIconSm dd ? +ends + +struct CREATESTRUCT + lpCreateParams dd ? + hInstance dd ? + hMenu dd ? + hwndParent dd ? + cy dd ? + cx dd ? + y dd ? + x dd ? + style dd ? + lpszName dd ? + lpszClass dd ? + dwExStyle dd ? +ends + +struct CLIENTCREATESTRUCT + hWindowMenu dd ? + idFirstChild dd ? +ends + +struct MDICREATESTRUCT + szClass dd ? + szTitle dd ? + hOwner dd ? + x dd ? + y dd ? + cx dd ? + cy dd ? + style dd ? + lParam dd ? +ends + +struct SCROLLINFO + cbSize dd ? + fMask dd ? + nMin dd ? + nMax dd ? + nPage dd ? + nPos dd ? + nTrackPos dd ? +ends + +struct MSG + hwnd dd ? + message dd ? + wParam dd ? + lParam dd ? + time dd ? + pt POINT +ends + +struct MINMAXINFO + ptReserved POINT + ptMaxSize POINT + ptMaxPosition POINT + ptMinTrackSize POINT + ptMaxTrackSize POINT +ends + +struct WINDOWPLACEMENT + length dd ? + flags dd ? + showCmd dd ? + ptMinPosition POINT + ptMaxPosition POINT + rcNormalPosition RECT +ends + +struct WINDOWPOS + hwnd dd ? + hwndInsertAfter dd ? + x dd ? + y dd ? + cx dd ? + cy dd ? + flags dd ? +ends + +struct NMHDR + hwndFrom dd ? + idFrom dd ? + code dd ? +ends + +struct COPYDATASTRUCT + dwData dd ? + cbData dd ? + lpData dd ? +ends + +struct ACCEL + fVirt dw ? + key dw ? + cmd dw ? +ends + +struct PAINTSTRUCT + hdc dd ? + fErase dd ? + rcPaint RECT + fRestore dd ? + fIncUpdate dd ? + rgbReserved db 32 dup (?) +ends + +struct DRAWTEXTPARAMS + cbSize dd ? + iTabLength dd ? + iLeftMargin dd ? + iRightMargin dd ? + uiLengthDrawn dd ? +ends + +struct DRAWITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemAction dd ? + itemState dd ? + hwndItem dd ? + hDC dd ? + rcItem RECT + itemData dd ? +ends + +struct MENUITEMINFO + cbSize dd ? + fMask dd ? + fType dd ? + fState dd ? + wID dd ? + hSubMenu dd ? + hbmpChecked dd ? + hbmpUnchecked dd ? + dwItemData dd ? + dwTypeData dd ? + cch dd ? +ends + +struct MEASUREITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemWidth dd ? + itemHeight dd ? + itemData dd ? +ends + +struct MSGBOXPARAMS + cbSize dd ? + hwndOwner dd ? + hInstance dd ? + lpszText dd ? + lpszCaption dd ? + dwStyle dd ? + lpszIcon dd ? + dwContextHelpId dd ? + lpfnMsgBoxCallback dd ? + dwLanguageId dd ? +ends + +struct GESTURECONFIG + dwID dd ? + dwWant dd ? + dwBlock dd ? +ends + +struct GESTUREINFO + cbSize dd ? + dwFlags dd ? + dwID dd ? + hwndTarget dd ? + ptsLocation POINTS + dwInstanceID dd ? + dwSequenceID dd ?,? + ullArguments dq ? + cbExtraArgs dd ?,? +ends + +; MessageBox type flags + +MB_OK = 000000h +MB_OKCANCEL = 000001h +MB_ABORTRETRYIGNORE = 000002h +MB_YESNOCANCEL = 000003h +MB_YESNO = 000004h +MB_RETRYCANCEL = 000005h +MB_ICONHAND = 000010h +MB_ICONQUESTION = 000020h +MB_ICONEXCLAMATION = 000030h +MB_ICONASTERISK = 000040h +MB_USERICON = 000080h +MB_ICONWARNING = MB_ICONEXCLAMATION +MB_ICONERROR = MB_ICONHAND +MB_ICONINFORMATION = MB_ICONASTERISK +MB_ICONSTOP = MB_ICONHAND +MB_DEFBUTTON1 = 000000h +MB_DEFBUTTON2 = 000100h +MB_DEFBUTTON3 = 000200h +MB_DEFBUTTON4 = 000300h +MB_APPLMODAL = 000000h +MB_SYSTEMMODAL = 001000h +MB_TASKMODAL = 002000h +MB_HELP = 004000h +MB_NOFOCUS = 008000h +MB_SETFOREGROUND = 010000h +MB_DEFAULT_DESKTOP_ONLY = 020000h +MB_TOPMOST = 040000h +MB_RIGHT = 080000h +MB_RTLREADING = 100000h +MB_SERVICE_NOTIFICATION = 200000h + +; Conventional dialog box and message box command IDs + +IDOK = 1 +IDCANCEL = 2 +IDABORT = 3 +IDRETRY = 4 +IDIGNORE = 5 +IDYES = 6 +IDNO = 7 +IDCLOSE = 8 +IDHELP = 9 + +; Class styles + +CS_VREDRAW = 00001h +CS_HREDRAW = 00002h +CS_KEYCVTWINDOW = 00004h +CS_DBLCLKS = 00008h +CS_OWNDC = 00020h +CS_CLASSDC = 00040h +CS_PARENTDC = 00080h +CS_NOKEYCVT = 00100h +CS_SAVEBITS = 00800h +CS_NOCLOSE = 00200h +CS_BYTEALIGNCLIENT = 01000h +CS_BYTEALIGNWINDOW = 02000h +CS_PUBLICCLASS = 04000h +CS_GLOBALCLASS = CS_PUBLICCLASS +CS_IME = 10000h + +; Windows styles + +WS_OVERLAPPED = 000000000h +WS_ICONICPOPUP = 0C0000000h +WS_POPUP = 080000000h +WS_CHILD = 040000000h +WS_MINIMIZE = 020000000h +WS_VISIBLE = 010000000h +WS_DISABLED = 008000000h +WS_CLIPSIBLINGS = 004000000h +WS_CLIPCHILDREN = 002000000h +WS_MAXIMIZE = 001000000h +WS_CAPTION = 000C00000h +WS_BORDER = 000800000h +WS_DLGFRAME = 000400000h +WS_VSCROLL = 000200000h +WS_HSCROLL = 000100000h +WS_SYSMENU = 000080000h +WS_THICKFRAME = 000040000h +WS_HREDRAW = 000020000h +WS_VREDRAW = 000010000h +WS_GROUP = 000020000h +WS_TABSTOP = 000010000h +WS_MINIMIZEBOX = 000020000h +WS_MAXIMIZEBOX = 000010000h + +; Common Window Styles + +WS_OVERLAPPEDWINDOW = WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX +WS_POPUPWINDOW = WS_POPUP or WS_BORDER or WS_SYSMENU +WS_CHILDWINDOW = WS_CHILD +WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW +WS_TILED = WS_OVERLAPPED +WS_ICONIC = WS_MINIMIZE +WS_SIZEBOX = WS_THICKFRAME + +; Extended Window Styles + +WS_EX_DLGMODALFRAME = 00001h +WS_EX_DRAGOBJECT = 00002h +WS_EX_NOPARENTNOTIFY = 00004h +WS_EX_TOPMOST = 00008h +WS_EX_ACCEPTFILES = 00010h +WS_EX_TRANSPARENT = 00020h +WS_EX_MDICHILD = 00040h +WS_EX_TOOLWINDOW = 00080h +WS_EX_WINDOWEDGE = 00100h +WS_EX_CLIENTEDGE = 00200h +WS_EX_CONTEXTHELP = 00400h +WS_EX_RIGHT = 01000h +WS_EX_LEFT = 00000h +WS_EX_RTLREADING = 02000h +WS_EX_LTRREADING = 00000h +WS_EX_LEFTSCROLLBAR = 04000h +WS_EX_RIGHTSCROLLBAR = 00000h +WS_EX_CONTROLPARENT = 10000h +WS_EX_STATICEDGE = 20000h +WS_EX_APPWINDOW = 40000h +WS_EX_LAYERED = 80000h +WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE +WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST + +; MDI client style bits + +MDIS_ALLCHILDSTYLES = 1 + +; Special CreateWindow position value + +CW_USEDEFAULT = 80000000h + +; Predefined window handle + +HWND_DESKTOP = 0 + +; ShowWindow commands + +SW_HIDE = 0 +SW_SHOWNORMAL = 1 +SW_NORMAL = 1 +SW_SHOWMINIMIZED = 2 +SW_SHOWMAXIMIZED = 3 +SW_MAXIMIZE = 3 +SW_SHOWNOACTIVATE = 4 +SW_SHOW = 5 +SW_MINIMIZE = 6 +SW_SHOWMINNOACTIVE = 7 +SW_SHOWNA = 8 +SW_RESTORE = 9 +SW_SHOWDEFAULT = 10 + +; SetWindowPos flags + +SWP_NOSIZE = 0001h +SWP_NOMOVE = 0002h +SWP_NOZORDER = 0004h +SWP_NOREDRAW = 0008h +SWP_NOACTIVATE = 0010h +SWP_DRAWFRAME = 0020h +SWP_SHOWWINDOW = 0040h +SWP_HIDEWINDOW = 0080h +SWP_NOCOPYBITS = 0100h +SWP_NOREPOSITION = 0200h +SWP_DEFERERASE = 2000h +SWP_ASYNCWINDOWPOS = 4000h + +; SetWindowPos special handle values + +HWND_TOP = 0 +HWND_BOTTOM = 1 +HWND_TOPMOST = -1 +HWND_NOTOPMOST = -2 + +; GetWindow flags + +GW_HWNDFIRST = 0 +GW_HWNDLAST = 1 +GW_HWNDNEXT = 2 +GW_HWNDPREV = 3 +GW_OWNER = 4 +GW_CHILD = 5 + +; RedrawWindow flags + +RDW_INVALIDATE = 0001h +RDW_INTERNALPAINT = 0002h +RDW_ERASE = 0004h +RDW_VALIDATE = 0008h +RDW_NOINTERNALPAINT = 0010h +RDW_NOERASE = 0020h +RDW_NOCHILDREN = 0040h +RDW_ALLCHILDREN = 0080h +RDW_UPDATENOW = 0100h +RDW_ERASENOW = 0200h +RDW_FRAME = 0400h +RDW_NOFRAME = 0800h + +; PeekMessage Options + +PM_NOREMOVE = 0000h +PM_REMOVE = 0001h +PM_NOYIELD = 0002h + +; Window state messages + +WM_STATE = 0000h +WM_NULL = 0000h +WM_CREATE = 0001h +WM_DESTROY = 0002h +WM_MOVE = 0003h +WM_SIZE = 0005h +WM_ACTIVATE = 0006h +WM_SETFOCUS = 0007h +WM_KILLFOCUS = 0008h +WM_ENABLE = 000Ah +WM_SETREDRAW = 000Bh +WM_SETTEXT = 000Ch +WM_GETTEXT = 000Dh +WM_GETTEXTLENGTH = 000Eh +WM_PAINT = 000Fh +WM_CLOSE = 0010h +WM_QUERYENDSESSION = 0011h +WM_QUIT = 0012h +WM_QUERYOPEN = 0013h +WM_ERASEBKGND = 0014h +WM_SYSCOLORCHANGE = 0015h +WM_ENDSESSION = 0016h +WM_SYSTEMERROR = 0017h +WM_SHOWWINDOW = 0018h +WM_CTLCOLOR = 0019h +WM_WININICHANGE = 001Ah +WM_DEVMODECHANGE = 001Bh +WM_ACTIVATEAPP = 001Ch +WM_FONTCHANGE = 001Dh +WM_TIMECHANGE = 001Eh +WM_CANCELMODE = 001Fh +WM_SETCURSOR = 0020h +WM_MOUSEACTIVATE = 0021h +WM_CHILDACTIVATE = 0022h +WM_QUEUESYNC = 0023h +WM_GETMINMAXINFO = 0024h +WM_PAINTICON = 0026h +WM_ICONERASEBKGND = 0027h +WM_NEXTDLGCTL = 0028h +WM_SPOOLERSTATUS = 002Ah +WM_DRAWITEM = 002Bh +WM_MEASUREITEM = 002Ch +WM_DELETEITEM = 002Dh +WM_VKEYTOITEM = 002Eh +WM_CHARTOITEM = 002Fh +WM_SETFONT = 0030h +WM_GETFONT = 0031h +WM_SETHOTKEY = 0032h +WM_QUERYDRAGICON = 0037h +WM_COMPAREITEM = 0039h +WM_COMPACTING = 0041h +WM_COMMNOTIFY = 0044h +WM_WINDOWPOSCHANGING = 0046h +WM_WINDOWPOSCHANGED = 0047h +WM_POWER = 0048h +WM_COPYDATA = 004Ah +WM_CANCELJOURNAL = 004Bh +WM_NOTIFY = 004Eh +WM_INPUTLANGCHANGEREQUEST = 0050h +WM_INPUTLANGCHANGE = 0051h +WM_TCARD = 0052h +WM_HELP = 0053h +WM_USERCHANGED = 0054h +WM_NOTIFYFORMAT = 0055h +WM_CONTEXTMENU = 007Bh +WM_STYLECHANGING = 007Ch +WM_STYLECHANGED = 007Dh +WM_DISPLAYCHANGE = 007Eh +WM_GETICON = 007Fh +WM_SETICON = 0080h +WM_NCCREATE = 0081h +WM_NCDESTROY = 0082h +WM_NCCALCSIZE = 0083h +WM_NCHITTEST = 0084h +WM_NCPAINT = 0085h +WM_NCACTIVATE = 0086h +WM_GETDLGCODE = 0087h +WM_NCMOUSEMOVE = 00A0h +WM_NCLBUTTONDOWN = 00A1h +WM_NCLBUTTONUP = 00A2h +WM_NCLBUTTONDBLCLK = 00A3h +WM_NCRBUTTONDOWN = 00A4h +WM_NCRBUTTONUP = 00A5h +WM_NCRBUTTONDBLCLK = 00A6h +WM_NCMBUTTONDOWN = 00A7h +WM_NCMBUTTONUP = 00A8h +WM_NCMBUTTONDBLCLK = 00A9h +WM_KEYFIRST = 0100h +WM_KEYDOWN = 0100h +WM_KEYUP = 0101h +WM_CHAR = 0102h +WM_DEADCHAR = 0103h +WM_SYSKEYDOWN = 0104h +WM_SYSKEYUP = 0105h +WM_SYSCHAR = 0106h +WM_SYSDEADCHAR = 0107h +WM_KEYLAST = 0108h +WM_INITDIALOG = 0110h +WM_COMMAND = 0111h +WM_SYSCOMMAND = 0112h +WM_TIMER = 0113h +WM_HSCROLL = 0114h +WM_VSCROLL = 0115h +WM_INITMENU = 0116h +WM_INITMENUPOPUP = 0117h +WM_GESTURE = 0119h +WM_GESTURENOTIFY = 011Ah +WM_MENUSELECT = 011Fh +WM_MENUCHAR = 0120h +WM_ENTERIDLE = 0121h +WM_MENURBUTTONUP = 0122h +WM_MENUDRAG = 0123h +WM_MENUGETOBJECT = 0124h +WM_UNINITMENUPOPUP = 0125h +WM_MENUCOMMAND = 0126h +WM_CTLCOLORMSGBOX = 0132h +WM_CTLCOLOREDIT = 0133h +WM_CTLCOLORLISTBOX = 0134h +WM_CTLCOLORBTN = 0135h +WM_CTLCOLORDLG = 0136h +WM_CTLCOLORSCROLLBAR = 0137h +WM_CTLCOLORSTATIC = 0138h +WM_MOUSEFIRST = 0200h +WM_MOUSEMOVE = 0200h +WM_LBUTTONDOWN = 0201h +WM_LBUTTONUP = 0202h +WM_LBUTTONDBLCLK = 0203h +WM_RBUTTONDOWN = 0204h +WM_RBUTTONUP = 0205h +WM_RBUTTONDBLCLK = 0206h +WM_MBUTTONDOWN = 0207h +WM_MBUTTONUP = 0208h +WM_MBUTTONDBLCLK = 0209h +WM_MOUSEWHEEL = 020Ah +WM_MOUSELAST = 020Ah +WM_PARENTNOTIFY = 0210h +WM_ENTERMENULOOP = 0211h +WM_EXITMENULOOP = 0212h +WM_NEXTMENU = 0213h +WM_SIZING = 0214h +WM_CAPTURECHANGED = 0215h +WM_MOVING = 0216h +WM_POWERBROADCAST = 0218h +WM_DEVICECHANGE = 0219h +WM_MDICREATE = 0220h +WM_MDIDESTROY = 0221h +WM_MDIACTIVATE = 0222h +WM_MDIRESTORE = 0223h +WM_MDINEXT = 0224h +WM_MDIMAXIMIZE = 0225h +WM_MDITILE = 0226h +WM_MDICASCADE = 0227h +WM_MDIICONARRANGE = 0228h +WM_MDIGETACTIVE = 0229h +WM_MDISETMENU = 0230h +WM_ENTERSIZEMOVE = 0231h +WM_EXITSIZEMOVE = 0232h +WM_DROPFILES = 0233h +WM_MDIREFRESHMENU = 0234h +WM_IME_SETCONTEXT = 0281h +WM_IME_NOTIFY = 0282h +WM_IME_CONTROL = 0283h +WM_IME_COMPOSITIONFULL = 0284h +WM_IME_SELECT = 0285h +WM_IME_CHAR = 0286h +WM_IME_KEYDOWN = 0290h +WM_IME_KEYUP = 0291h +WM_MOUSEHOVER = 02A1h +WM_MOUSELEAVE = 02A3h +WM_CUT = 0300h +WM_COPY = 0301h +WM_PASTE = 0302h +WM_CLEAR = 0303h +WM_UNDO = 0304h +WM_RENDERFORMAT = 0305h +WM_RENDERALLFORMATS = 0306h +WM_DESTROYCLIPBOARD = 0307h +WM_DRAWCLIPBOARD = 0308h +WM_PAINTCLIPBOARD = 0309h +WM_VSCROLLCLIPBOARD = 030Ah +WM_SIZECLIPBOARD = 030Bh +WM_ASKCBFORMATNAME = 030Ch +WM_CHANGECBCHAIN = 030Dh +WM_HSCROLLCLIPBOARD = 030Eh +WM_QUERYNEWPALETTE = 030Fh +WM_PALETTEISCHANGING = 0310h +WM_PALETTECHANGED = 0311h +WM_HOTKEY = 0312h +WM_PRINT = 0317h +WM_PRINTCLIENT = 0318h +WM_HANDHELDFIRST = 0358h +WM_HANDHELDLAST = 035Fh +WM_AFXFIRST = 0360h +WM_AFXLAST = 037Fh +WM_PENWINFIRST = 0380h +WM_PENWINLAST = 038Fh +WM_COALESCE_FIRST = 0390h +WM_COALESCE_LAST = 039Fh +WM_USER = 0400h + +; WM_SIZE commands + +SIZE_RESTORED = 0 +SIZE_MINIMIZED = 1 +SIZE_MAXIMIZED = 2 +SIZE_MAXSHOW = 3 +SIZE_MAXHIDE = 4 + +; WM_ACTIVATE states + +WA_INACTIVE = 0 +WA_ACTIVE = 1 +WA_CLICKACTIVE = 2 + +; WM_SHOWWINDOW identifiers + +SW_PARENTCLOSING = 1 +SW_OTHERZOOM = 2 +SW_PARENTOPENING = 3 +SW_OTHERUNZOOM = 4 + +; WM_MOUSEACTIVATE return codes + +MA_ACTIVATE = 1 +MA_ACTIVATEANDEAT = 2 +MA_NOACTIVATE = 3 +MA_NOACTIVATEANDEAT = 4 + +; WM_MDITILE flags + +MDITILE_VERTICAL = 0 +MDITILE_HORIZONTAL = 1 +MDITILE_SKIPDISABLED = 2 + +; WM_NOTIFY codes + +NM_OUTOFMEMORY = -1 +NM_CLICK = -2 +NM_DBLCLICK = -3 +NM_RETURN = -4 +NM_RCLICK = -5 +NM_RDBLCLK = -6 +NM_SETFOCUS = -7 +NM_KILLFOCUS = -8 + +; WM_SETICON types + +ICON_SMALL = 0 +ICON_BIG = 1 + +; WM_HOTKEY commands + +HOTKEYF_SHIFT = 01h +HOTKEYF_CONTROL = 02h +HOTKEYF_ALT = 04h +HOTKEYF_EXT = 08h + +; Keystroke flags + +KF_EXTENDED = 0100h +KF_DLGMODE = 0800h +KF_MENUMODE = 1000h +KF_ALTDOWN = 2000h +KF_REPEAT = 4000h +KF_UP = 8000h + +; Key state masks for mouse messages + +MK_LBUTTON = 01h +MK_RBUTTON = 02h +MK_SHIFT = 04h +MK_CONTROL = 08h +MK_MBUTTON = 10h + +; WM_SIZING codes + +WMSZ_LEFT = 1 +WMSZ_RIGHT = 2 +WMSZ_TOP = 3 +WMSZ_TOPLEFT = 4 +WMSZ_TOPRIGHT = 5 +WMSZ_BOTTOM = 6 +WMSZ_BOTTOMLEFT = 7 +WMSZ_BOTTOMRIGHT = 8 + +; WM_HOTKEY modifiers + +MOD_ALT = 1 +MOD_CONTROL = 2 +MOD_SHIFT = 4 +MOD_WIN = 8 + +; WM_PRINT flags + +PRF_CHECKVISIBLE = 01h +PRF_NONCLIENT = 02h +PRF_CLIENT = 04h +PRF_ERASEBKGND = 08h +PRF_CHILDREN = 10h +PRF_OWNED = 20h + +; Virtual key codes + +VK_LBUTTON = 001h +VK_CANCEL = 003h +VK_RBUTTON = 002h +VK_MBUTTON = 004h +VK_BACK = 008h +VK_TAB = 009h +VK_CLEAR = 00Ch +VK_RETURN = 00Dh +VK_SHIFT = 010h +VK_CONTROL = 011h +VK_MENU = 012h +VK_PAUSE = 013h +VK_CAPITAL = 014h +VK_ESCAPE = 01Bh +VK_SPACE = 020h +VK_PRIOR = 021h +VK_PGUP = 021h +VK_PGDN = 022h +VK_NEXT = 022h +VK_END = 023h +VK_HOME = 024h +VK_LEFT = 025h +VK_UP = 026h +VK_RIGHT = 027h +VK_DOWN = 028h +VK_SELECT = 029h +VK_PRINT = 02Ah +VK_EXECUTE = 02Bh +VK_SNAPSHOT = 02Ch +VK_INSERT = 02Dh +VK_DELETE = 02Eh +VK_HELP = 02Fh +VK_LWIN = 05Bh +VK_RWIN = 05Ch +VK_APPS = 05Dh +VK_NUMPAD0 = 060h +VK_NUMPAD1 = 061h +VK_NUMPAD2 = 062h +VK_NUMPAD3 = 063h +VK_NUMPAD4 = 064h +VK_NUMPAD5 = 065h +VK_NUMPAD6 = 066h +VK_NUMPAD7 = 067h +VK_NUMPAD8 = 068h +VK_NUMPAD9 = 069h +VK_MULTIPLY = 06Ah +VK_ADD = 06Bh +VK_SEPARATOR = 06Ch +VK_SUBTRACT = 06Dh +VK_DECIMAL = 06Eh +VK_DIVIDE = 06Fh +VK_F1 = 070h +VK_F2 = 071h +VK_F3 = 072h +VK_F4 = 073h +VK_F5 = 074h +VK_F6 = 075h +VK_F7 = 076h +VK_F8 = 077h +VK_F9 = 078h +VK_F10 = 079h +VK_F11 = 07Ah +VK_F12 = 07Bh +VK_F13 = 07Ch +VK_F14 = 07Dh +VK_F15 = 07Eh +VK_F16 = 07Fh +VK_F17 = 080h +VK_F18 = 081h +VK_F19 = 082h +VK_F20 = 083h +VK_F21 = 084h +VK_F22 = 085h +VK_F23 = 086h +VK_F24 = 087h +VK_NUMLOCK = 090h +VK_SCROLL = 091h +VK_LSHIFT = 0A0h +VK_RSHIFT = 0A1h +VK_LCONTROL = 0A2h +VK_RCONTROL = 0A3h +VK_LMENU = 0A4h +VK_RMENU = 0A5h +VK_ATTN = 0F6h +VK_CRSEL = 0F7h +VK_EXSEL = 0F8h +VK_EREOF = 0F9h +VK_PLAY = 0FAh +VK_ZOOM = 0FBh +VK_NONAME = 0FCh +VK_PA1 = 0FDh +VK_OEM_CLEAR = 0FEh + +; Accelerator flags + +FVIRTKEY = 01h +FNOINVERT = 02h +FSHIFT = 04h +FCONTROL = 08h +FALT = 10h + +; GetClassLong offsets + +GCL_MENUNAME = -8 +GCL_HBRBACKGROUND = -10 +GCL_HCURSOR = -12 +GCL_HICON = -14 +GCL_HMODULE = -16 +GCL_CBWNDEXTRA = -18 +GCL_CBCLSEXTRA = -20 +GCL_WNDPROC = -24 +GCL_STYLE = -26 +GCW_ATOM = -32 +GCL_HICONSM = -34 + +; WNDCLASS parameters + +DLGWINDOWEXTRA = 30 + +; GetWindowLong offsets + +GWL_WNDPROC = -4 +GWL_HINSTANCE = -6 +GWL_HWNDPARENT = -8 +GWL_STYLE = -16 +GWL_EXSTYLE = -20 +GWL_USERDATA = -21 +GWL_ID = -12 +DWL_MSGRESULT = 0 +DWL_DLGPROC = 4 +DWL_USER = 8 + +; GetSystemMetrics codes + +SM_CXSCREEN = 0 +SM_CYSCREEN = 1 +SM_CXVSCROLL = 2 +SM_CYHSCROLL = 3 +SM_CYCAPTION = 4 +SM_CXBORDER = 5 +SM_CYBORDER = 6 +SM_CXDLGFRAME = 7 +SM_CYDLGFRAME = 8 +SM_CYVTHUMB = 9 +SM_CXHTHUMB = 10 +SM_CXICON = 11 +SM_CYICON = 12 +SM_CXCURSOR = 13 +SM_CYCURSOR = 14 +SM_CYMENU = 15 +SM_CXFULLSCREEN = 16 +SM_CYFULLSCREEN = 17 +SM_CYKANJIWINDOW = 18 +SM_MOUSEPRESENT = 19 +SM_CYVSCROLL = 20 +SM_CXHSCROLL = 21 +SM_DEBUG = 22 +SM_SWAPBUTTON = 23 +SM_RESERVED1 = 24 +SM_RESERVED2 = 25 +SM_RESERVED3 = 26 +SM_RESERVED4 = 27 +SM_CXMIN = 28 +SM_CYMIN = 29 +SM_CXSIZE = 30 +SM_CYSIZE = 31 +SM_CXFRAME = 32 +SM_CYFRAME = 33 +SM_CXMINTRACK = 34 +SM_CYMINTRACK = 35 +SM_CXDOUBLECLK = 36 +SM_CYDOUBLECLK = 37 +SM_CXICONSPACING = 38 +SM_CYICONSPACING = 39 +SM_MENUDROPALIGNMENT = 40 +SM_PENWINDOWS = 41 +SM_DBCSENABLED = 42 +SM_CMOUSEBUTTONS = 43 +SM_CXFIXEDFRAME = SM_CXDLGFRAME +SM_CYFIXEDFRAME = SM_CYDLGFRAME +SM_CXSIZEFRAME = SM_CXFRAME +SM_CYSIZEFRAME = SM_CYFRAME +SM_SECURE = 44 +SM_CXEDGE = 45 +SM_CYEDGE = 46 +SM_CXMINSPACING = 47 +SM_CYMINSPACING = 48 +SM_CXSMICON = 49 +SM_CYSMICON = 50 +SM_CYSMCAPTION = 51 +SM_CXSMSIZE = 52 +SM_CYSMSIZE = 53 +SM_CXMENUSIZE = 54 +SM_CYMENUSIZE = 55 +SM_ARRANGE = 56 +SM_CXMINIMIZED = 57 +SM_CYMINIMIZED = 58 +SM_CXMAXTRACK = 59 +SM_CYMAXTRACK = 60 +SM_CXMAXIMIZED = 61 +SM_CYMAXIMIZED = 62 +SM_NETWORK = 63 +SM_CLEANBOOT = 67 +SM_CXDRAG = 68 +SM_CYDRAG = 69 +SM_SHOWSOUNDS = 70 +SM_CXMENUCHECK = 71 +SM_CYMENUCHECK = 72 +SM_SLOWMACHINE = 73 +SM_MIDEASTENABLED = 74 +SM_MOUSEWHEELPRESENT = 75 +SM_CMETRICS = 76 + +; Predefined cursor identifiers + +IDC_ARROW = 32512 +IDC_IBEAM = 32513 +IDC_WAIT = 32514 +IDC_CROSS = 32515 +IDC_UPARROW = 32516 +IDC_SIZE = 32640 +IDC_ICON = 32641 +IDC_SIZENWSE = 32642 +IDC_SIZENESW = 32643 +IDC_SIZEWE = 32644 +IDC_SIZENS = 32645 +IDC_NO = 32648 +IDC_HAND = 32649 +IDC_APPSTARTING = 32650 +IDC_HELP = 32651 + +; Predefined icon identifiers + +IDI_APPLICATION = 32512 +IDI_HAND = 32513 +IDI_QUESTION = 32514 +IDI_EXCLAMATION = 32515 +IDI_ASTERISK = 32516 +IDI_WINLOGO = 32517 + +; System colors + +COLOR_SCROLLBAR = 0 +COLOR_BACKGROUND = 1 +COLOR_ACTIVECAPTION = 2 +COLOR_INACTIVECAPTION = 3 +COLOR_MENU = 4 +COLOR_WINDOW = 5 +COLOR_WINDOWFRAME = 6 +COLOR_MENUTEXT = 7 +COLOR_WINDOWTEXT = 8 +COLOR_CAPTIONTEXT = 9 +COLOR_ACTIVEBORDER = 10 +COLOR_INACTIVEBORDER = 11 +COLOR_APPWORKSPACE = 12 +COLOR_HIGHLIGHT = 13 +COLOR_HIGHLIGHTTEXT = 14 +COLOR_BTNFACE = 15 +COLOR_BTNSHADOW = 16 +COLOR_GRAYTEXT = 17 +COLOR_BTNTEXT = 18 +COLOR_INACTIVECAPTIONTEXT = 19 +COLOR_BTNHIGHLIGHT = 20 +COLOR_3DDKSHADOW = 21 +COLOR_3DLIGHT = 22 +COLOR_INFOTEXT = 23 +COLOR_INFOBK = 24 +COLOR_HOTLIGHT = 26 +COLOR_GRADIENTACTIVECAPTION = 27 +COLOR_GRADIENTINACTIVECAPTION = 28 + +; Button messages + +BM_GETCHECK = 00F0h +BM_SETCHECK = 00F1h +BM_GETSTATE = 00F2h +BM_SETSTATE = 00F3h +BM_SETSTYLE = 00F4h +BM_CLICK = 00F5h +BM_GETIMAGE = 00F6h +BM_SETIMAGE = 00F7h + +; Button notifications + +BN_CLICKED = 0 +BN_PAINT = 1 +BN_HILITE = 2 +BN_UNHILITE = 3 +BN_DISABLE = 4 +BN_DOUBLECLICKED = 5 +BN_SETFOCUS = 6 +BN_KILLFOCUS = 7 +BN_PUSHED = BN_HILITE +BN_UNPUSHED = BN_UNHILITE +BN_DBLCLK = BN_DOUBLECLICKED + +; Button styles + +BS_PUSHBUTTON = 0000h +BS_DEFPUSHBUTTON = 0001h +BS_CHECKBOX = 0002h +BS_AUTOCHECKBOX = 0003h +BS_RADIOBUTTON = 0004h +BS_3STATE = 0005h +BS_AUTO3STATE = 0006h +BS_GROUPBOX = 0007h +BS_USERBUTTON = 0008h +BS_AUTORADIOBUTTON = 0009h +BS_OWNERDRAW = 000Bh +BS_TEXT = 0000h +BS_LEFTTEXT = 0020h +BS_RIGHTBUTTON = BS_LEFTTEXT +BS_ICON = 0040h +BS_BITMAP = 0080h +BS_LEFT = 0100h +BS_RIGHT = 0200h +BS_CENTER = 0300h +BS_TOP = 0400h +BS_BOTTOM = 0800h +BS_VCENTER = 0C00h +BS_PUSHLIKE = 1000h +BS_MULTILINE = 2000h +BS_NOTIFY = 4000h +BS_FLAT = 8000h + +; Button states + +BST_UNCHECKED = 0 +BST_CHECKED = 1 +BST_INDETERMINATE = 2 +BST_PUSHED = 4 +BST_FOCUS = 8 + +; List box messages + +LB_ADDSTRING = 0180h +LB_INSERTSTRING = 0181h +LB_DELETESTRING = 0182h +LB_SELITEMRANGEEX = 0183h +LB_RESETCONTENT = 0184h +LB_SETSEL = 0185h +LB_SETCURSEL = 0186h +LB_GETSEL = 0187h +LB_GETCURSEL = 0188h +LB_GETTEXT = 0189h +LB_GETTEXTLEN = 018Ah +LB_GETCOUNT = 018Bh +LB_SELECTSTRING = 018Ch +LB_DIR = 018Dh +LB_GETTOPINDEX = 018Eh +LB_FINDSTRING = 018Fh +LB_GETSELCOUNT = 0190h +LB_GETSELITEMS = 0191h +LB_SETTABSTOPS = 0192h +LB_GETHORIZONTALEXTENT = 0193h +LB_SETHORIZONTALEXTENT = 0194h +LB_SETCOLUMNWIDTH = 0195h +LB_ADDFILE = 0196h +LB_SETTOPINDEX = 0197h +LB_GETITEMRECT = 0198h +LB_GETITEMDATA = 0199h +LB_SETITEMDATA = 019Ah +LB_SELITEMRANGE = 019Bh +LB_SETANCHORINDEX = 019Ch +LB_GETANCHORINDEX = 019Dh +LB_SETCARETINDEX = 019Eh +LB_GETCARETINDEX = 019Fh +LB_SETITEMHEIGHT = 01A0h +LB_GETITEMHEIGHT = 01A1h +LB_FINDSTRINGEXACT = 01A2h +LB_SETLOCALE = 01A5h +LB_GETLOCALE = 01A6h +LB_SETCOUNT = 01A7h +LB_INITSTORAGE = 01A8h +LB_ITEMFROMPOINT = 01A9h + +; List box notifications + +LBN_ERRSPACE = -2 +LBN_SELCHANGE = 1 +LBN_DBLCLK = 2 +LBN_SELCANCEL = 3 +LBN_SETFOCUS = 4 +LBN_KILLFOCUS = 5 + +; List box styles + +LBS_NOTIFY = 0001h +LBS_SORT = 0002h +LBS_NOREDRAW = 0004h +LBS_MULTIPLESEL = 0008h +LBS_OWNERDRAWFIXED = 0010h +LBS_OWNERDRAWVARIABLE = 0020h +LBS_HASSTRINGS = 0040h +LBS_USETABSTOPS = 0080h +LBS_NOINTEGRALHEIGHT = 0100h +LBS_MULTICOLUMN = 0200h +LBS_WANTKEYBOARDINPUT = 0400h +LBS_EXTENDEDSEL = 0800h +LBS_DISABLENOSCROLL = 1000h +LBS_NODATA = 2000h +LBS_NOSEL = 4000h +LBS_STANDARD = LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER + +; List box return values + +LB_OKAY = 0 +LB_ERR = -1 +LB_ERRSPACE = -2 + +; Combo box messages + +CB_GETEDITSEL = 0140h +CB_LIMITTEXT = 0141h +CB_SETEDITSEL = 0142h +CB_ADDSTRING = 0143h +CB_DELETESTRING = 0144h +CB_DIR = 0145h +CB_GETCOUNT = 0146h +CB_GETCURSEL = 0147h +CB_GETLBTEXT = 0148h +CB_GETLBTEXTLEN = 0149h +CB_INSERTSTRING = 014Ah +CB_RESETCONTENT = 014Bh +CB_FINDSTRING = 014Ch +CB_SELECTSTRING = 014Dh +CB_SETCURSEL = 014Eh +CB_SHOWDROPDOWN = 014Fh +CB_GETITEMDATA = 0150h +CB_SETITEMDATA = 0151h +CB_GETDROPPEDCONTROLRECT = 0152h +CB_SETITEMHEIGHT = 0153h +CB_GETITEMHEIGHT = 0154h +CB_SETEXTENDEDUI = 0155h +CB_GETEXTENDEDUI = 0156h +CB_GETDROPPEDSTATE = 0157h +CB_FINDSTRINGEXACT = 0158h +CB_SETLOCALE = 0159h +CB_GETLOCALE = 015Ah +CB_GETTOPINDEX = 015Bh +CB_SETTOPINDEX = 015Ch +CB_GETHORIZONTALEXTENT = 015Dh +CB_SETHORIZONTALEXTENT = 015Eh +CB_GETDROPPEDWIDTH = 015Fh +CB_SETDROPPEDWIDTH = 0160h +CB_INITSTORAGE = 0161h + +; Combo box notifications + +CBN_ERRSPACE = -1 +CBN_SELCHANGE = 1 +CBN_DBLCLK = 2 +CBN_SETFOCUS = 3 +CBN_KILLFOCUS = 4 +CBN_EDITCHANGE = 5 +CBN_EDITUPDATE = 6 +CBN_DROPDOWN = 7 +CBN_CLOSEUP = 8 +CBN_SELENDOK = 9 +CBN_SELENDCANCEL = 10 + +; Combo box styles + +CBS_SIMPLE = 0001h +CBS_DROPDOWN = 0002h +CBS_DROPDOWNLIST = 0003h +CBS_OWNERDRAWFIXED = 0010h +CBS_OWNERDRAWVARIABLE = 0020h +CBS_AUTOHSCROLL = 0040h +CBS_OEMCONVERT = 0080h +CBS_SORT = 0100h +CBS_HASSTRINGS = 0200h +CBS_NOINTEGRALHEIGHT = 0400h +CBS_DISABLENOSCROLL = 0800h +CBS_UPPERCASE = 2000h +CBS_LOWERCASE = 4000h + +; Combo box return values + +CB_OKAY = 0 +CB_ERR = -1 +CB_ERRSPACE = -2 + +; Edit control messages + +EM_GETSEL = 00B0h +EM_SETSEL = 00B1h +EM_GETRECT = 00B2h +EM_SETRECT = 00B3h +EM_SETRECTNP = 00B4h +EM_SCROLL = 00B5h +EM_LINESCROLL = 00B6h +EM_SCROLLCARET = 00B7h +EM_GETMODIFY = 00B8h +EM_SETMODIFY = 00B9h +EM_GETLINECOUNT = 00BAh +EM_LINEINDEX = 00BBh +EM_SETHANDLE = 00BCh +EM_GETHANDLE = 00BDh +EM_GETTHUMB = 00BEh +EM_LINELENGTH = 00C1h +EM_REPLACESEL = 00C2h +EM_GETLINE = 00C4h +EM_LIMITTEXT = 00C5h +EM_CANUNDO = 00C6h +EM_UNDO = 00C7h +EM_FMTLINES = 00C8h +EM_LINEFROMCHAR = 00C9h +EM_SETTABSTOPS = 00CBh +EM_SETPASSWORDCHAR = 00CCh +EM_EMPTYUNDOBUFFER = 00CDh +EM_GETFIRSTVISIBLELINE = 00CEh +EM_SETREADONLY = 00CFh +EM_SETWORDBREAKPROC = 00D0h +EM_GETWORDBREAKPROC = 00D1h +EM_GETPASSWORDCHAR = 00D2h +EM_SETMARGINS = 00D3h +EM_GETMARGINS = 00D4h +EM_SETLIMITTEXT = EM_LIMITTEXT +EM_GETLIMITTEXT = 00D5h +EM_POSFROMCHAR = 00D6h +EM_CHARFROMPOS = 00D7h + +; Edit control EM_SETMARGIN parameters + +EC_LEFTMARGIN = 1 +EC_RIGHTMARGIN = 2 +EC_USEFONTINFO = 0FFFFh + +; Edit control notifications + +EN_SETFOCUS = 0100h +EN_KILLFOCUS = 0200h +EN_CHANGE = 0300h +EN_UPDATE = 0400h +EN_ERRSPACE = 0500h +EN_MAXTEXT = 0501h +EN_HSCROLL = 0601h +EN_VSCROLL = 0602h + +; Edit control styles + +ES_LEFT = 0000h +ES_CENTER = 0001h +ES_RIGHT = 0002h +ES_MULTILINE = 0004h +ES_UPPERCASE = 0008h +ES_LOWERCASE = 0010h +ES_PASSWORD = 0020h +ES_AUTOVSCROLL = 0040h +ES_AUTOHSCROLL = 0080h +ES_NOHIDESEL = 0100h +ES_OEMCONVERT = 0400h +ES_READONLY = 0800h +ES_WANTRETURN = 1000h +ES_NUMBER = 2000h + +; Static window messages + +STM_SETICON = 0170h +STM_GETICON = 0171h +STM_SETIMAGE = 0172h +STM_GETIMAGE = 0173h + +; Static window notifications + +STN_CLICKED = 0 +STN_DBLCLK = 1 +STN_ENABLE = 2 +STN_DISABLE = 3 + +; Static window styles + +SS_LEFT = 0000h +SS_CENTER = 0001h +SS_RIGHT = 0002h +SS_ICON = 0003h +SS_BLACKRECT = 0004h +SS_GRAYRECT = 0005h +SS_WHITERECT = 0006h +SS_BLACKFRAME = 0007h +SS_GRAYFRAME = 0008h +SS_WHITEFRAME = 0009h +SS_USERITEM = 000Ah +SS_SIMPLE = 000Bh +SS_LEFTNOWORDWRAP = 000Ch +SS_BITMAP = 000Eh +SS_OWNERDRAW = 000Dh +SS_ENHMETAFILE = 000Fh +SS_ETCHEDHORZ = 0010h +SS_ETCHEDVERT = 0011h +SS_ETCHEDFRAME = 0012h +SS_TYPEMASK = 001Fh +SS_NOPREFIX = 0080h +SS_NOTIFY = 0100h +SS_CENTERIMAGE = 0200h +SS_RIGHTJUST = 0400h +SS_REALSIZEIMAGE = 0800h +SS_SUNKEN = 1000h + +; Scroll bar constants + +SB_HORZ = 0 +SB_VERT = 1 +SB_CTL = 2 +SB_BOTH = 3 + +; Scroll bar messages + +SBM_SETPOS = 00E0h +SBM_GETPOS = 00E1h +SBM_SETRANGE = 00E2h +SBM_SETRANGEREDRAW = 00E6h +SBM_GETRANGE = 00E3h +SBM_ENABLE_ARROWS = 00E4h +SBM_SETSCROLLINFO = 00E9h +SBM_GETSCROLLINFO = 00EAh + +; Scroll bar commands + +SB_LINEUP = 0 +SB_LINELEFT = 0 +SB_LINEDOWN = 1 +SB_LINERIGHT = 1 +SB_PAGEUP = 2 +SB_PAGELEFT = 2 +SB_PAGEDOWN = 3 +SB_PAGERIGHT = 3 +SB_THUMBPOSITION = 4 +SB_THUMBTRACK = 5 +SB_TOP = 6 +SB_LEFT = 6 +SB_BOTTOM = 7 +SB_RIGHT = 7 +SB_ENDSCROLL = 8 + +; Scroll bar styles + +SBS_HORZ = 0000h +SBS_VERT = 0001h +SBS_TOPALIGN = 0002h +SBS_LEFTALIGN = 0002h +SBS_BOTTOMALIGN = 0004h +SBS_RIGHTALIGN = 0004h +SBS_SIZEBOXTOPLEFTALIGN = 0002h +SBS_SIZEBOXBOTTOMRIGHTALIGN = 0004h +SBS_SIZEBOX = 0008h +SBS_SIZEGRIP = 0010h + +; Scroll bar info flags + +SIF_RANGE = 0001h +SIF_PAGE = 0002h +SIF_POS = 0004h +SIF_DISABLENOSCROLL = 0008h +SIF_TRACKPOS = 0010h +SIF_ALL = SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS + +; Dialog styles + +DS_ABSALIGN = 0001h +DS_SYSMODAL = 0002h +DS_3DLOOK = 0004h +DS_FIXEDSYS = 0008h +DS_NOFAILCREATE = 0010h +DS_LOCALEDIT = 0020h +DS_SETFONT = 0040h +DS_MODALFRAME = 0080h +DS_NOIDLEMSG = 0100h +DS_SETFOREGROUND = 0200h +DS_CONTROL = 0400h +DS_CENTER = 0800h +DS_CENTERMOUSE = 1000h +DS_CONTEXTHELP = 2000h + +; Dialog codes + +DLGC_WANTARROWS = 0001h +DLGC_WANTTAB = 0002h +DLGC_WANTALLKEYS = 0004h +DLGC_WANTMESSAGE = 0004h +DLGC_HASSETSEL = 0008h +DLGC_DEFPUSHBUTTON = 0010h +DLGC_UNDEFPUSHBUTTON = 0020h +DLGC_RADIOBUTTON = 0040h +DLGC_WANTCHARS = 0080h +DLGC_STATIC = 0100h +DLGC_BUTTON = 2000h + +; Menu flags + +MF_INSERT = 0000h +MF_CHANGE = 0080h +MF_APPEND = 0100h +MF_DELETE = 0200h +MF_REMOVE = 1000h +MF_BYCOMMAND = 0000h +MF_BYPOSITION = 0400h +MF_SEPARATOR = 0800h +MF_UNCHECKED = 0000h +MF_ENABLED = 0000h +MF_GRAYED = 0001h +MF_DISABLED = 0002h +MF_CHECKED = 0008h +MF_USECHECKBITMAPS = 0200h +MF_STRING = 0000h +MF_BITMAP = 0004h +MF_OWNERDRAW = 0100h +MF_POPUP = 0010h +MF_MENUBARBREAK = 0020h +MF_MENUBREAK = 0040h +MF_UNHILITE = 0000h +MF_HILITE = 0080h +MF_DEFAULT = 1000h +MF_SYSMENU = 2000h +MF_HELP = 4000h +MF_RIGHTJUSTIFY = 4000h +MF_MOUSESELECT = 8000h +MF_END = 0080h +MFT_STRING = MF_STRING +MFT_BITMAP = MF_BITMAP +MFT_MENUBARBREAK = MF_MENUBARBREAK +MFT_MENUBREAK = MF_MENUBREAK +MFT_OWNERDRAW = MF_OWNERDRAW +MFT_RADIOCHECK = 0200h +MFT_SEPARATOR = MF_SEPARATOR +MFT_RIGHTORDER = 2000h +MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY +MFS_GRAYED = 0003h +MFS_DISABLED = MFS_GRAYED +MFS_CHECKED = MF_CHECKED +MFS_HILITE = MF_HILITE +MFS_ENABLED = MF_ENABLED +MFS_UNCHECKED = MF_UNCHECKED +MFS_UNHILITE = MF_UNHILITE +MFS_DEFAULT = MF_DEFAULT +MFR_POPUP = 0001h +MFR_END = MF_END + +; System menu command values + +SC_SIZE = 61440 +SC_MOVE = 61456 +SC_MINIMIZE = 61472 +SC_MAXIMIZE = 61488 +SC_NEXTWINDOW = 61504 +SC_PREVWINDOW = 61520 +SC_CLOSE = 61536 +SC_VSCROLL = 61552 +SC_HSCROLL = 61568 +SC_MOUSEMENU = 61584 +SC_KEYMENU = 61696 +SC_ARRANGE = 61712 +SC_RESTORE = 61728 +SC_TASKLIST = 61744 +SC_SCREENSAVE = 61760 +SC_HOTKEY = 61776 +SC_DEFAULT = 61792 +SC_MONITORPOWER = 61808 +SC_CONTEXTHELP = 61824 +SC_SEPARATOR = 61455 + +; Border types + +BDR_RAISEDOUTER = 01h +BDR_SUNKENOUTER = 02h +BDR_RAISEDINNER = 04h +BDR_SUNKENINNER = 08h +BDR_OUTER = 03h +BDR_INNER = 0Ch +BDR_RAISED = 05h +BDR_SUNKEN = 0Ah +EDGE_RAISED = BDR_RAISEDOUTER or BDR_RAISEDINNER +EDGE_SUNKEN = BDR_SUNKENOUTER or BDR_SUNKENINNER +EDGE_ETCHED = BDR_SUNKENOUTER or BDR_RAISEDINNER +EDGE_BUMP = BDR_RAISEDOUTER or BDR_SUNKENINNER + +; Border flags + +BF_LEFT = 0001h +BF_TOP = 0002h +BF_RIGHT = 0004h +BF_BOTTOM = 0008h +BF_TOPLEFT = BF_TOP or BF_LEFT +BF_TOPRIGHT = BF_TOP or BF_RIGHT +BF_BOTTOMLEFT = BF_BOTTOM or BF_LEFT +BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT +BF_RECT = BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM +BF_DIAGONAL = 0010h +BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL or BF_TOP or BF_RIGHT +BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL or BF_TOP or BF_LEFT +BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL or BF_BOTTOM or BF_LEFT +BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT +BF_MIDDLE = 0800h +BF_SOFT = 1000h +BF_ADJUST = 2000h +BF_FLAT = 4000h +BF_MONO = 8000h + +; Frame control types + +DFC_CAPTION = 1 +DFC_MENU = 2 +DFC_SCROLL = 3 +DFC_BUTTON = 4 +DFC_POPUPMENU = 5 + +; Frame control states + +DFCS_CAPTIONCLOSE = 0000h +DFCS_CAPTIONMIN = 0001h +DFCS_CAPTIONMAX = 0002h +DFCS_CAPTIONRESTORE = 0003h +DFCS_CAPTIONHELP = 0004h +DFCS_MENUARROW = 0000h +DFCS_MENUCHECK = 0001h +DFCS_MENUBULLET = 0002h +DFCS_MENUARROWRIGHT = 0004h +DFCS_SCROLLUP = 0000h +DFCS_SCROLLDOWN = 0001h +DFCS_SCROLLLEFT = 0002h +DFCS_SCROLLRIGHT = 0003h +DFCS_SCROLLCOMBOBOX = 0005h +DFCS_SCROLLSIZEGRIP = 0008h +DFCS_SCROLLSIZEGRIPRIGHT = 0010h +DFCS_BUTTONCHECK = 0000h +DFCS_BUTTONRADIOIMAGE = 0001h +DFCS_BUTTONRADIOMASK = 0002h +DFCS_BUTTONRADIO = 0004h +DFCS_BUTTON3STATE = 0008h +DFCS_BUTTONPUSH = 0010h +DFCS_INACTIVE = 0100h +DFCS_PUSHED = 0200h +DFCS_CHECKED = 0400h +DFCS_TRANSPARENT = 0800h +DFCS_HOT = 1000h +DFCS_ADJUSTRECT = 2000h +DFCS_FLAT = 4000h +DFCS_MONO = 8000h + +; DrawCaption flags + +DC_ACTIVE = 01h +DC_SMALLCAP = 02h +DC_ICON = 04h +DC_TEXT = 08h +DC_INBUTTON = 10h + +; DrawIconEx options + +DI_MASK = 1 +DI_IMAGE = 2 +DI_NORMAL = 3 +DI_COMPAT = 4 +DI_DEFAULTSIZE = 8 + +; DrawText parameters + +DT_TOP = 00000h +DT_LEFT = 00000h +DT_CENTER = 00001h +DT_RIGHT = 00002h +DT_VCENTER = 00004h +DT_BOTTOM = 00008h +DT_WORDBREAK = 00010h +DT_SINGLELINE = 00020h +DT_EXPANDTABS = 00040h +DT_TABSTOP = 00080h +DT_NOCLIP = 00100h +DT_EXTERNALLEADING = 00200h +DT_CALCRECT = 00400h +DT_NOPREFIX = 00800h +DT_INTERNAL = 01000h +DT_EDITCONTROL = 02000h +DT_PATH_ELLIPSIS = 04000h +DT_END_ELLIPSIS = 08000h +DT_MODIFYSTRING = 10000h +DT_RTLREADING = 20000h +DT_WORD_ELLIPSIS = 40000h + +; GetDCEx flags + +DCX_WINDOW = 000001h +DCX_CACHE = 000002h +DCX_NORESETATTRS = 000004h +DCX_CLIPCHILDREN = 000008h +DCX_CLIPSIBLINGS = 000010h +DCX_PARENTCLIP = 000020h +DCX_EXCLUDERGN = 000040h +DCX_INTERSECTRGN = 000080h +DCX_EXCLUDEUPDATE = 000100h +DCX_INTERSECTUPDATE = 000200h +DCX_LOCKWINDOWUPDATE = 000400h +DCX_VALIDATE = 200000h + +; SetWindowsHook codes + +WH_MSGFILTER = -1 +WH_JOURNALRECORD = 0 +WH_JOURNALPLAYBACK = 1 +WH_KEYBOARD = 2 +WH_GETMESSAGE = 3 +WH_CALLWNDPROC = 4 +WH_CBT = 5 +WH_SYSMSGFILTER = 6 +WH_MOUSE = 7 +WH_HARDWARE = 8 +WH_DEBUG = 9 +WH_SHELL = 10 +WH_FOREGROUNDIDLE = 11 +WH_CALLWNDPROCRET = 12 +WH_KEYBOARD_LL = 13 +WH_MOUSE_LL = 14 + +; Hook codes + +HC_ACTION = 0 +HC_GETNEXT = 1 +HC_SKIP = 2 +HC_NOREMOVE = 3 +HC_SYSMODALON = 4 +HC_SYSMODALOFF = 5 + +; CBT hook codes + +HCBT_MOVESIZE = 0 +HCBT_MINMAX = 1 +HCBT_QS = 2 +HCBT_CREATEWND = 3 +HCBT_DESTROYWND = 4 +HCBT_ACTIVATE = 5 +HCBT_CLICKSKIPPED = 6 +HCBT_KEYSKIPPED = 7 +HCBT_SYSCOMMAND = 8 +HCBT_SETFOCUS = 9 + +; ExitWindowsEx flags + +EWX_LOGOFF = 0 +EWX_SHUTDOWN = 1 +EWX_REBOOT = 2 +EWX_FORCE = 4 +EWX_POWEROFF = 8 + +; WinHelp commands + +HELP_CONTEXT = 001h +HELP_QUIT = 002h +HELP_INDEX = 003h +HELP_CONTENTS = 003h +HELP_HELPONHELP = 004h +HELP_SETINDEX = 005h +HELP_SETCONTENTS = 005h +HELP_CONTEXTPOPUP = 008h +HELP_FORCEFILE = 009h +HELP_CONTEXTMENU = 00Ah +HELP_FINDER = 00Bh +HELP_WM_HELP = 00Ch +HELP_SETPOPUP_POS = 00Dh +HELP_KEY = 101h +HELP_COMMAND = 102h +HELP_PARTIALKEY = 105h +HELP_MULTIKEY = 201h +HELP_SETWINPOS = 203h + +; keybd_event flags + +KEYEVENTF_EXTENDEDKEY = 1h +KEYEVENTF_KEYUP = 2h + +; mouse_event flags + +MOUSEEVENTF_MOVE = 0001h +MOUSEEVENTF_LEFTDOWN = 0002h +MOUSEEVENTF_LEFTUP = 0004h +MOUSEEVENTF_RIGHTDOWN = 0008h +MOUSEEVENTF_RIGHTUP = 0010h +MOUSEEVENTF_MIDDLEDOWN = 0020h +MOUSEEVENTF_MIDDLEUP = 0040h +MOUSEEVENTF_WHEEL = 0800h +MOUSEEVENTF_ABSOLUTE = 8000h + +; TrackPopupMenu flags + +TPM_LEFTBUTTON = 0000h +TPM_RIGHTBUTTON = 0002h +TPM_LEFTALIGN = 0000h +TPM_CENTERALIGN = 0004h +TPM_RIGHTALIGN = 0008h +TPM_TOPALIGN = 0000h +TPM_VCENTERALIGN = 0010h +TPM_BOTTOMALIGN = 0020h +TPM_HORIZONTAL = 0000h +TPM_VERTICAL = 0040h +TPM_NONOTIFY = 0080h +TPM_RETURNCMD = 0100h +TPM_RECURSE = 0001h +TPM_HORPOSANIMATION = 0400h +TPM_HORNEGANIMATION = 0800h +TPM_VERPOSANIMATION = 1000h +TPM_VERNEGANIMATION = 2000h +TPM_NOANIMATION = 4000h +TPM_LAYOUTRTL = 8000h + +; Menu item info mask values + +MIIM_STATE = 001h +MIIM_ID = 002h +MIIM_SUBMENU = 004h +MIIM_CHECKMARKS = 008h +MIIM_TYPE = 010h +MIIM_DATA = 020h +MIIM_STRING = 040h +MIIM_BITMAP = 080h +MIIM_FTYPE = 100h + +; DRAWITEMSTRUCT control types + +ODT_MENU = 1 +ODT_LISTBOX = 2 +ODT_COMBOBOX = 3 +ODT_BUTTON = 4 +ODT_STATIC = 5 + +; DRAWITEMSTRUCT actions + +ODA_DRAWENTIRE = 1 +ODA_SELECT = 2 +ODA_FOCUS = 4 + +; DRAWITEMSTRUCT states + +ODS_SELECTED = 0001h +ODS_GRAYED = 0002h +ODS_DISABLED = 0004h +ODS_CHECKED = 0008h +ODS_FOCUS = 0010h +ODS_DEFAULT = 0020h +ODS_COMBOBOXEDIT = 1000h +ODS_HOTLIGHT = 0040h +ODS_INACTIVE = 0080h + +; WINDOWPLACEMENT flags + +WPF_SETMINPOSITION = 1 +WPF_RESTORETOMAXIMIZED = 2 + +; Layered window attributes + +LWA_COLORKEY = 1 +LWA_ALPHA = 2 + +; UpdateLayeredWindow flags + +ULW_COLORKEY = 1 +ULW_ALPHA = 2 +ULW_OPAQUE = 4 + +; SystemParametersInfo parameters + +SPI_GETACCESSTIMEOUT = 60 +SPI_GETANIMATION = 72 +SPI_GETBEEP = 1 +SPI_GETBORDER = 5 +SPI_GETDEFAULTINPUTLANG = 89 +SPI_GETDRAGFULLWINDOWS = 38 +SPI_GETFASTTASKSWITCH = 35 +SPI_GETFILTERKEYS = 50 +SPI_GETFONTSMOOTHING = 74 +SPI_GETGRIDGRANULARITY = 18 +SPI_GETHIGHCONTRAST = 66 +SPI_GETICONMETRICS = 45 +SPI_GETICONTITLELOGFONT = 31 +SPI_GETICONTITLEWRAP = 25 +SPI_GETKEYBOARDDELAY = 22 +SPI_GETKEYBOARDPREF = 68 +SPI_GETKEYBOARDSPEED = 10 +SPI_GETLOWPOWERACTIVE = 83 +SPI_GETLOWPOWERTIMEOUT = 79 +SPI_GETMENUDROPALIGNMENT = 27 +SPI_GETMINIMIZEDMETRICS = 43 +SPI_GETMOUSE = 3 +SPI_GETMOUSEKEYS = 54 +SPI_GETMOUSETRAILS = 94 +SPI_GETNONCLIENTMETRICS = 41 +SPI_GETPOWEROFFACTIVE = 84 +SPI_GETPOWEROFFTIMEOUT = 80 +SPI_GETSCREENREADER = 70 +SPI_GETSCREENSAVEACTIVE = 16 +SPI_GETSCREENSAVETIMEOUT = 14 +SPI_GETSERIALKEYS = 62 +SPI_GETSHOWSOUNDS = 56 +SPI_GETSOUNDSENTRY = 64 +SPI_GETSTICKYKEYS = 58 +SPI_GETTOGGLEKEYS = 52 +SPI_GETWINDOWSEXTENSION = 92 +SPI_GETWORKAREA = 48 +SPI_ICONHORIZONTALSPACING = 13 +SPI_ICONVERTICALSPACING = 24 +SPI_LANGDRIVER = 12 +SPI_SCREENSAVERRUNNING = 97 +SPI_SETACCESSTIMEOUT = 61 +SPI_SETANIMATION = 73 +SPI_SETBEEP = 2 +SPI_SETBORDER = 6 +SPI_SETDEFAULTINPUTLANG = 90 +SPI_SETDESKPATTERN = 21 +SPI_SETDESKWALLPAPER = 20 +SPI_SETDOUBLECLICKTIME = 32 +SPI_SETDOUBLECLKHEIGHT = 30 +SPI_SETDOUBLECLKWIDTH = 29 +SPI_SETDRAGFULLWINDOWS = 37 +SPI_SETDRAGHEIGHT = 77 +SPI_SETDRAGWIDTH = 76 +SPI_SETFASTTASKSWITCH = 36 +SPI_SETFILTERKEYS = 51 +SPI_SETFONTSMOOTHING = 75 +SPI_SETGRIDGRANULARITY = 19 +SPI_SETHANDHELD = 78 +SPI_SETHIGHCONTRAST = 67 +SPI_SETICONMETRICS = 46 +SPI_SETICONTITLELOGFONT = 34 +SPI_SETICONTITLEWRAP = 26 +SPI_SETKEYBOARDDELAY = 23 +SPI_SETKEYBOARDPREF = 69 +SPI_SETKEYBOARDSPEED = 11 +SPI_SETLANGTOGGLE = 91 +SPI_SETLOWPOWERACTIVE = 85 +SPI_SETLOWPOWERTIMEOUT = 81 +SPI_SETMENUDROPALIGNMENT = 28 +SPI_SETMINIMIZEDMETRICS = 44 +SPI_SETMOUSE = 4 +SPI_SETMOUSEBUTTONSWAP = 33 +SPI_SETMOUSEKEYS = 55 +SPI_SETMOUSETRAILS = 93 +SPI_SETNONCLIENTMETRICS = 42 +SPI_SETPENWINDOWS = 49 +SPI_SETPOWEROFFACTIVE = 86 +SPI_SETPOWEROFFTIMEOUT = 82 +SPI_SETSCREENREADER = 71 +SPI_SETSCREENSAVEACTIVE = 17 +SPI_SETSCREENSAVERRUNNING = 97 +SPI_SETSCREENSAVETIMEOUT = 15 +SPI_SETSERIALKEYS = 63 +SPI_SETSHOWSOUNDS = 57 +SPI_SETSOUNDSENTRY = 65 +SPI_SETSTICKYKEYS = 59 +SPI_SETTOGGLEKEYS = 53 +SPI_SETWORKAREA = 47 + +; SystemParametersInfo flags + +SPIF_UPDATEINIFILE = 1 +SPIF_SENDWININICHANGE = 2 + +; Gesture Information Flags + +GF_BEGIN = 1 +GF_INERTIA = 2 +GF_END = 4 + +; Gesture IDs + +GID_BEGIN = 1 +GID_END = 2 +GID_ZOOM = 3 +GID_PAN = 4 +GID_ROTATE = 5 +GID_TWOFINGERTAP = 6 +GID_PRESSANDTAP = 7 +GID_ROLLOVER = GID_PRESSANDTAP + +; Zoom Gesture Confiration Flags + +GC_ZOOM = 0x00000001 + +; Pan Gesture Configuration Flags + +GC_PAN = 0x00000001 +GC_PAN_WITH_SINGLE_FINGER_VERTICALLY = 0x00000002 +GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY = 0x00000004 +GC_PAN_WITH_GUTTER = 0x00000008 +GC_PAN_WITH_INERTIA = 0x00000010 + +; Rotate Gesture Configuration Flags + +GC_ROTATE = 0x00000001 + +; Two finger tap configuration flags + +GC_TWOFINGERTAP = 0x00000001 + +; Press and tap Configuration Flags + +GC_PRESSANDTAP = 0x00000001 +GC_ROLLOVER = GC_PRESSANDTAP diff --git a/fasmw172/INCLUDE/EQUATES/USER64.INC b/fasmw172/INCLUDE/EQUATES/USER64.INC new file mode 100644 index 0000000..67a09d1 --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/USER64.INC @@ -0,0 +1,1935 @@ + +; USER32.DLL structures and constants + +struct POINT + x dd ? + y dd ? +ends + +struct POINTS + x dw ? + y dw ? +ends + +struct RECT + left dd ? + top dd ? + right dd ? + bottom dd ? +ends + +struct WNDCLASS + style dd ?,? + lpfnWndProc dq ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dq ? + hIcon dq ? + hCursor dq ? + hbrBackground dq ? + lpszMenuName dq ? + lpszClassName dq ? +ends + +struct WNDCLASSEX + cbSize dd ? + style dd ? + lpfnWndProc dq ? + cbClsExtra dd ? + cbWndExtra dd ? + hInstance dq ? + hIcon dq ? + hCursor dq ? + hbrBackground dq ? + lpszMenuName dq ? + lpszClassName dq ? + hIconSm dq ? +ends + +struct CREATESTRUCT + lpCreateParams dq ? + hInstance dq ? + hMenu dq ? + hwndParent dq ? + cy dd ? + cx dd ? + y dd ? + x dd ? + style dd ?,? + lpszName dq ? + lpszClass dq ? + dwExStyle dd ?,? +ends + +struct CLIENTCREATESTRUCT + hWindowMenu dq ? + idFirstChild dd ? +ends + +struct MDICREATESTRUCT + szClass dq ? + szTitle dq ? + hOwner dq ? + x dd ? + y dd ? + cx dd ? + cy dd ? + style dd ? + lParam dd ? +ends + +struct SCROLLINFO + cbSize dd ? + fMask dd ? + nMin dd ? + nMax dd ? + nPage dd ? + nPos dd ? + nTrackPos dd ? +ends + +struct MSG + hwnd dq ? + message dd ?,? + wParam dq ? + lParam dq ? + time dd ? + pt POINT + dd ? +ends + +struct MINMAXINFO + ptReserved POINT + ptMaxSize POINT + ptMaxPosition POINT + ptMinTrackSize POINT + ptMaxTrackSize POINT +ends + +struct WINDOWPLACEMENT + length dd ? + flags dd ? + showCmd dd ? + ptMinPosition POINT + ptMaxPosition POINT + rcNormalPosition RECT +ends + +struct WINDOWPOS + hwnd dq ? + hwndInsertAfter dq ? + x dd ? + y dd ? + cx dd ? + cy dd ? + flags dd ? +ends + +struct NMHDR + hwndFrom dq ? + idFrom dq ? + code dd ?,? +ends + +struct COPYDATASTRUCT + dwData dq ? + cbData dd ? + lpData dq ? +ends + +struct ACCEL + fVirt dw ? + key dw ? + cmd dw ? +ends + +struct PAINTSTRUCT + hdc dq ? + fErase dd ? + rcPaint RECT + fRestore dd ? + fIncUpdate dd ? + rgbReserved db 36 dup (?) +ends + +struct DRAWTEXTPARAMS + cbSize dd ? + iTabLength dd ? + iLeftMargin dd ? + iRightMargin dd ? + uiLengthDrawn dd ?,? +ends + +struct DRAWITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemAction dd ? + itemState dd ?,? + hwndItem dq ? + hDC dq ? + rcItem RECT + itemData dd ?,? +ends + +struct MENUITEMINFO + cbSize dd ? + fMask dd ? + fType dd ? + fState dd ? + wID dd ?,? + hSubMenu dq ? + hbmpChecked dq ? + hbmpUnchecked dq ? + dwItemData dq ? + dwTypeData dq ? + cch dd ?,? + hbmpItem dq ? +ends + +struct MEASUREITEMSTRUCT + CtlType dd ? + CtlID dd ? + itemID dd ? + itemWidth dd ? + itemHeight dd ? + itemData dq ? +ends + +struct MSGBOXPARAMS + cbSize dd ?,? + hwndOwner dq ? + hInstance dq ? + lpszText dd ? + lpszCaption dd ? + dwStyle dd ?,? + lpszIcon dq ? + dwContextHelpId dd ?,? + lpfnMsgBoxCallback dq ? + dwLanguageId dd ?,? +ends + +struct GESTURECONFIG + dwID dd ? + dwWant dd ? + dwBlock dd ? +ends + +struct GESTUREINFO + cbSize dd ? + dwFlags dd ? + dwID dd ? + hwndTarget dd ? + ptsLocation POINTS + dwInstanceID dd ? + dwSequenceID dd ?,? + ullArguments dq ? + cbExtraArgs dd ?,? +ends + +; MessageBox type flags + +MB_OK = 000000h +MB_OKCANCEL = 000001h +MB_ABORTRETRYIGNORE = 000002h +MB_YESNOCANCEL = 000003h +MB_YESNO = 000004h +MB_RETRYCANCEL = 000005h +MB_ICONHAND = 000010h +MB_ICONQUESTION = 000020h +MB_ICONEXCLAMATION = 000030h +MB_ICONASTERISK = 000040h +MB_USERICON = 000080h +MB_ICONWARNING = MB_ICONEXCLAMATION +MB_ICONERROR = MB_ICONHAND +MB_ICONINFORMATION = MB_ICONASTERISK +MB_ICONSTOP = MB_ICONHAND +MB_DEFBUTTON1 = 000000h +MB_DEFBUTTON2 = 000100h +MB_DEFBUTTON3 = 000200h +MB_DEFBUTTON4 = 000300h +MB_APPLMODAL = 000000h +MB_SYSTEMMODAL = 001000h +MB_TASKMODAL = 002000h +MB_HELP = 004000h +MB_NOFOCUS = 008000h +MB_SETFOREGROUND = 010000h +MB_DEFAULT_DESKTOP_ONLY = 020000h +MB_TOPMOST = 040000h +MB_RIGHT = 080000h +MB_RTLREADING = 100000h +MB_SERVICE_NOTIFICATION = 200000h + +; Conventional dialog box and message box command IDs + +IDOK = 1 +IDCANCEL = 2 +IDABORT = 3 +IDRETRY = 4 +IDIGNORE = 5 +IDYES = 6 +IDNO = 7 +IDCLOSE = 8 +IDHELP = 9 + +; Class styles + +CS_VREDRAW = 00001h +CS_HREDRAW = 00002h +CS_KEYCVTWINDOW = 00004h +CS_DBLCLKS = 00008h +CS_OWNDC = 00020h +CS_CLASSDC = 00040h +CS_PARENTDC = 00080h +CS_NOKEYCVT = 00100h +CS_SAVEBITS = 00800h +CS_NOCLOSE = 00200h +CS_BYTEALIGNCLIENT = 01000h +CS_BYTEALIGNWINDOW = 02000h +CS_PUBLICCLASS = 04000h +CS_GLOBALCLASS = CS_PUBLICCLASS +CS_IME = 10000h + +; Windows styles + +WS_OVERLAPPED = 000000000h +WS_ICONICPOPUP = 0C0000000h +WS_POPUP = 080000000h +WS_CHILD = 040000000h +WS_MINIMIZE = 020000000h +WS_VISIBLE = 010000000h +WS_DISABLED = 008000000h +WS_CLIPSIBLINGS = 004000000h +WS_CLIPCHILDREN = 002000000h +WS_MAXIMIZE = 001000000h +WS_CAPTION = 000C00000h +WS_BORDER = 000800000h +WS_DLGFRAME = 000400000h +WS_VSCROLL = 000200000h +WS_HSCROLL = 000100000h +WS_SYSMENU = 000080000h +WS_THICKFRAME = 000040000h +WS_HREDRAW = 000020000h +WS_VREDRAW = 000010000h +WS_GROUP = 000020000h +WS_TABSTOP = 000010000h +WS_MINIMIZEBOX = 000020000h +WS_MAXIMIZEBOX = 000010000h + +; Common Window Styles + +WS_OVERLAPPEDWINDOW = WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX +WS_POPUPWINDOW = WS_POPUP or WS_BORDER or WS_SYSMENU +WS_CHILDWINDOW = WS_CHILD +WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW +WS_TILED = WS_OVERLAPPED +WS_ICONIC = WS_MINIMIZE +WS_SIZEBOX = WS_THICKFRAME + +; Extended Window Styles + +WS_EX_DLGMODALFRAME = 00001h +WS_EX_DRAGOBJECT = 00002h +WS_EX_NOPARENTNOTIFY = 00004h +WS_EX_TOPMOST = 00008h +WS_EX_ACCEPTFILES = 00010h +WS_EX_TRANSPARENT = 00020h +WS_EX_MDICHILD = 00040h +WS_EX_TOOLWINDOW = 00080h +WS_EX_WINDOWEDGE = 00100h +WS_EX_CLIENTEDGE = 00200h +WS_EX_CONTEXTHELP = 00400h +WS_EX_RIGHT = 01000h +WS_EX_LEFT = 00000h +WS_EX_RTLREADING = 02000h +WS_EX_LTRREADING = 00000h +WS_EX_LEFTSCROLLBAR = 04000h +WS_EX_RIGHTSCROLLBAR = 00000h +WS_EX_CONTROLPARENT = 10000h +WS_EX_STATICEDGE = 20000h +WS_EX_APPWINDOW = 40000h +WS_EX_LAYERED = 80000h +WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE +WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST + +; MDI client style bits + +MDIS_ALLCHILDSTYLES = 1 + +; Special CreateWindow position value + +CW_USEDEFAULT = 80000000h + +; Predefined window handle + +HWND_DESKTOP = 0 + +; ShowWindow commands + +SW_HIDE = 0 +SW_SHOWNORMAL = 1 +SW_NORMAL = 1 +SW_SHOWMINIMIZED = 2 +SW_SHOWMAXIMIZED = 3 +SW_MAXIMIZE = 3 +SW_SHOWNOACTIVATE = 4 +SW_SHOW = 5 +SW_MINIMIZE = 6 +SW_SHOWMINNOACTIVE = 7 +SW_SHOWNA = 8 +SW_RESTORE = 9 +SW_SHOWDEFAULT = 10 + +; SetWindowPos flags + +SWP_NOSIZE = 0001h +SWP_NOMOVE = 0002h +SWP_NOZORDER = 0004h +SWP_NOREDRAW = 0008h +SWP_NOACTIVATE = 0010h +SWP_DRAWFRAME = 0020h +SWP_SHOWWINDOW = 0040h +SWP_HIDEWINDOW = 0080h +SWP_NOCOPYBITS = 0100h +SWP_NOREPOSITION = 0200h +SWP_DEFERERASE = 2000h +SWP_ASYNCWINDOWPOS = 4000h + +; SetWindowPos special handle values + +HWND_TOP = 0 +HWND_BOTTOM = 1 +HWND_TOPMOST = -1 +HWND_NOTOPMOST = -2 + +; GetWindow flags + +GW_HWNDFIRST = 0 +GW_HWNDLAST = 1 +GW_HWNDNEXT = 2 +GW_HWNDPREV = 3 +GW_OWNER = 4 +GW_CHILD = 5 + +; RedrawWindow flags + +RDW_INVALIDATE = 0001h +RDW_INTERNALPAINT = 0002h +RDW_ERASE = 0004h +RDW_VALIDATE = 0008h +RDW_NOINTERNALPAINT = 0010h +RDW_NOERASE = 0020h +RDW_NOCHILDREN = 0040h +RDW_ALLCHILDREN = 0080h +RDW_UPDATENOW = 0100h +RDW_ERASENOW = 0200h +RDW_FRAME = 0400h +RDW_NOFRAME = 0800h + +; PeekMessage Options + +PM_NOREMOVE = 0000h +PM_REMOVE = 0001h +PM_NOYIELD = 0002h + +; Window state messages + +WM_STATE = 0000h +WM_NULL = 0000h +WM_CREATE = 0001h +WM_DESTROY = 0002h +WM_MOVE = 0003h +WM_SIZE = 0005h +WM_ACTIVATE = 0006h +WM_SETFOCUS = 0007h +WM_KILLFOCUS = 0008h +WM_ENABLE = 000Ah +WM_SETREDRAW = 000Bh +WM_SETTEXT = 000Ch +WM_GETTEXT = 000Dh +WM_GETTEXTLENGTH = 000Eh +WM_PAINT = 000Fh +WM_CLOSE = 0010h +WM_QUERYENDSESSION = 0011h +WM_QUIT = 0012h +WM_QUERYOPEN = 0013h +WM_ERASEBKGND = 0014h +WM_SYSCOLORCHANGE = 0015h +WM_ENDSESSION = 0016h +WM_SYSTEMERROR = 0017h +WM_SHOWWINDOW = 0018h +WM_CTLCOLOR = 0019h +WM_WININICHANGE = 001Ah +WM_DEVMODECHANGE = 001Bh +WM_ACTIVATEAPP = 001Ch +WM_FONTCHANGE = 001Dh +WM_TIMECHANGE = 001Eh +WM_CANCELMODE = 001Fh +WM_SETCURSOR = 0020h +WM_MOUSEACTIVATE = 0021h +WM_CHILDACTIVATE = 0022h +WM_QUEUESYNC = 0023h +WM_GETMINMAXINFO = 0024h +WM_PAINTICON = 0026h +WM_ICONERASEBKGND = 0027h +WM_NEXTDLGCTL = 0028h +WM_SPOOLERSTATUS = 002Ah +WM_DRAWITEM = 002Bh +WM_MEASUREITEM = 002Ch +WM_DELETEITEM = 002Dh +WM_VKEYTOITEM = 002Eh +WM_CHARTOITEM = 002Fh +WM_SETFONT = 0030h +WM_GETFONT = 0031h +WM_SETHOTKEY = 0032h +WM_QUERYDRAGICON = 0037h +WM_COMPAREITEM = 0039h +WM_COMPACTING = 0041h +WM_COMMNOTIFY = 0044h +WM_WINDOWPOSCHANGING = 0046h +WM_WINDOWPOSCHANGED = 0047h +WM_POWER = 0048h +WM_COPYDATA = 004Ah +WM_CANCELJOURNAL = 004Bh +WM_NOTIFY = 004Eh +WM_INPUTLANGCHANGEREQUEST = 0050h +WM_INPUTLANGCHANGE = 0051h +WM_TCARD = 0052h +WM_HELP = 0053h +WM_USERCHANGED = 0054h +WM_NOTIFYFORMAT = 0055h +WM_CONTEXTMENU = 007Bh +WM_STYLECHANGING = 007Ch +WM_STYLECHANGED = 007Dh +WM_DISPLAYCHANGE = 007Eh +WM_GETICON = 007Fh +WM_SETICON = 0080h +WM_NCCREATE = 0081h +WM_NCDESTROY = 0082h +WM_NCCALCSIZE = 0083h +WM_NCHITTEST = 0084h +WM_NCPAINT = 0085h +WM_NCACTIVATE = 0086h +WM_GETDLGCODE = 0087h +WM_NCMOUSEMOVE = 00A0h +WM_NCLBUTTONDOWN = 00A1h +WM_NCLBUTTONUP = 00A2h +WM_NCLBUTTONDBLCLK = 00A3h +WM_NCRBUTTONDOWN = 00A4h +WM_NCRBUTTONUP = 00A5h +WM_NCRBUTTONDBLCLK = 00A6h +WM_NCMBUTTONDOWN = 00A7h +WM_NCMBUTTONUP = 00A8h +WM_NCMBUTTONDBLCLK = 00A9h +WM_KEYFIRST = 0100h +WM_KEYDOWN = 0100h +WM_KEYUP = 0101h +WM_CHAR = 0102h +WM_DEADCHAR = 0103h +WM_SYSKEYDOWN = 0104h +WM_SYSKEYUP = 0105h +WM_SYSCHAR = 0106h +WM_SYSDEADCHAR = 0107h +WM_KEYLAST = 0108h +WM_INITDIALOG = 0110h +WM_COMMAND = 0111h +WM_SYSCOMMAND = 0112h +WM_TIMER = 0113h +WM_HSCROLL = 0114h +WM_VSCROLL = 0115h +WM_INITMENU = 0116h +WM_INITMENUPOPUP = 0117h +WM_GESTURE = 0119h +WM_GESTURENOTIFY = 011Ah +WM_MENUSELECT = 011Fh +WM_MENUCHAR = 0120h +WM_ENTERIDLE = 0121h +WM_MENURBUTTONUP = 0122h +WM_MENUDRAG = 0123h +WM_MENUGETOBJECT = 0124h +WM_UNINITMENUPOPUP = 0125h +WM_MENUCOMMAND = 0126h +WM_CTLCOLORMSGBOX = 0132h +WM_CTLCOLOREDIT = 0133h +WM_CTLCOLORLISTBOX = 0134h +WM_CTLCOLORBTN = 0135h +WM_CTLCOLORDLG = 0136h +WM_CTLCOLORSCROLLBAR = 0137h +WM_CTLCOLORSTATIC = 0138h +WM_MOUSEFIRST = 0200h +WM_MOUSEMOVE = 0200h +WM_LBUTTONDOWN = 0201h +WM_LBUTTONUP = 0202h +WM_LBUTTONDBLCLK = 0203h +WM_RBUTTONDOWN = 0204h +WM_RBUTTONUP = 0205h +WM_RBUTTONDBLCLK = 0206h +WM_MBUTTONDOWN = 0207h +WM_MBUTTONUP = 0208h +WM_MBUTTONDBLCLK = 0209h +WM_MOUSEWHEEL = 020Ah +WM_MOUSELAST = 020Ah +WM_PARENTNOTIFY = 0210h +WM_ENTERMENULOOP = 0211h +WM_EXITMENULOOP = 0212h +WM_NEXTMENU = 0213h +WM_SIZING = 0214h +WM_CAPTURECHANGED = 0215h +WM_MOVING = 0216h +WM_POWERBROADCAST = 0218h +WM_DEVICECHANGE = 0219h +WM_MDICREATE = 0220h +WM_MDIDESTROY = 0221h +WM_MDIACTIVATE = 0222h +WM_MDIRESTORE = 0223h +WM_MDINEXT = 0224h +WM_MDIMAXIMIZE = 0225h +WM_MDITILE = 0226h +WM_MDICASCADE = 0227h +WM_MDIICONARRANGE = 0228h +WM_MDIGETACTIVE = 0229h +WM_MDISETMENU = 0230h +WM_ENTERSIZEMOVE = 0231h +WM_EXITSIZEMOVE = 0232h +WM_DROPFILES = 0233h +WM_MDIREFRESHMENU = 0234h +WM_IME_SETCONTEXT = 0281h +WM_IME_NOTIFY = 0282h +WM_IME_CONTROL = 0283h +WM_IME_COMPOSITIONFULL = 0284h +WM_IME_SELECT = 0285h +WM_IME_CHAR = 0286h +WM_IME_KEYDOWN = 0290h +WM_IME_KEYUP = 0291h +WM_MOUSEHOVER = 02A1h +WM_MOUSELEAVE = 02A3h +WM_CUT = 0300h +WM_COPY = 0301h +WM_PASTE = 0302h +WM_CLEAR = 0303h +WM_UNDO = 0304h +WM_RENDERFORMAT = 0305h +WM_RENDERALLFORMATS = 0306h +WM_DESTROYCLIPBOARD = 0307h +WM_DRAWCLIPBOARD = 0308h +WM_PAINTCLIPBOARD = 0309h +WM_VSCROLLCLIPBOARD = 030Ah +WM_SIZECLIPBOARD = 030Bh +WM_ASKCBFORMATNAME = 030Ch +WM_CHANGECBCHAIN = 030Dh +WM_HSCROLLCLIPBOARD = 030Eh +WM_QUERYNEWPALETTE = 030Fh +WM_PALETTEISCHANGING = 0310h +WM_PALETTECHANGED = 0311h +WM_HOTKEY = 0312h +WM_PRINT = 0317h +WM_PRINTCLIENT = 0318h +WM_HANDHELDFIRST = 0358h +WM_HANDHELDLAST = 035Fh +WM_AFXFIRST = 0360h +WM_AFXLAST = 037Fh +WM_PENWINFIRST = 0380h +WM_PENWINLAST = 038Fh +WM_COALESCE_FIRST = 0390h +WM_COALESCE_LAST = 039Fh +WM_USER = 0400h + +; WM_SIZE commands + +SIZE_RESTORED = 0 +SIZE_MINIMIZED = 1 +SIZE_MAXIMIZED = 2 +SIZE_MAXSHOW = 3 +SIZE_MAXHIDE = 4 + +; WM_ACTIVATE states + +WA_INACTIVE = 0 +WA_ACTIVE = 1 +WA_CLICKACTIVE = 2 + +; WM_SHOWWINDOW identifiers + +SW_PARENTCLOSING = 1 +SW_OTHERZOOM = 2 +SW_PARENTOPENING = 3 +SW_OTHERUNZOOM = 4 + +; WM_MOUSEACTIVATE return codes + +MA_ACTIVATE = 1 +MA_ACTIVATEANDEAT = 2 +MA_NOACTIVATE = 3 +MA_NOACTIVATEANDEAT = 4 + +; WM_MDITILE flags + +MDITILE_VERTICAL = 0 +MDITILE_HORIZONTAL = 1 +MDITILE_SKIPDISABLED = 2 + +; WM_NOTIFY codes + +NM_OUTOFMEMORY = -1 +NM_CLICK = -2 +NM_DBLCLICK = -3 +NM_RETURN = -4 +NM_RCLICK = -5 +NM_RDBLCLK = -6 +NM_SETFOCUS = -7 +NM_KILLFOCUS = -8 + +; WM_SETICON types + +ICON_SMALL = 0 +ICON_BIG = 1 + +; WM_HOTKEY commands + +HOTKEYF_SHIFT = 01h +HOTKEYF_CONTROL = 02h +HOTKEYF_ALT = 04h +HOTKEYF_EXT = 08h + +; Keystroke flags + +KF_EXTENDED = 0100h +KF_DLGMODE = 0800h +KF_MENUMODE = 1000h +KF_ALTDOWN = 2000h +KF_REPEAT = 4000h +KF_UP = 8000h + +; Key state masks for mouse messages + +MK_LBUTTON = 01h +MK_RBUTTON = 02h +MK_SHIFT = 04h +MK_CONTROL = 08h +MK_MBUTTON = 10h + +; WM_SIZING codes + +WMSZ_LEFT = 1 +WMSZ_RIGHT = 2 +WMSZ_TOP = 3 +WMSZ_TOPLEFT = 4 +WMSZ_TOPRIGHT = 5 +WMSZ_BOTTOM = 6 +WMSZ_BOTTOMLEFT = 7 +WMSZ_BOTTOMRIGHT = 8 + +; WM_HOTKEY modifiers + +MOD_ALT = 1 +MOD_CONTROL = 2 +MOD_SHIFT = 4 +MOD_WIN = 8 + +; WM_PRINT flags + +PRF_CHECKVISIBLE = 01h +PRF_NONCLIENT = 02h +PRF_CLIENT = 04h +PRF_ERASEBKGND = 08h +PRF_CHILDREN = 10h +PRF_OWNED = 20h + +; Virtual key codes + +VK_LBUTTON = 001h +VK_CANCEL = 003h +VK_RBUTTON = 002h +VK_MBUTTON = 004h +VK_BACK = 008h +VK_TAB = 009h +VK_CLEAR = 00Ch +VK_RETURN = 00Dh +VK_SHIFT = 010h +VK_CONTROL = 011h +VK_MENU = 012h +VK_PAUSE = 013h +VK_CAPITAL = 014h +VK_ESCAPE = 01Bh +VK_SPACE = 020h +VK_PRIOR = 021h +VK_PGUP = 021h +VK_PGDN = 022h +VK_NEXT = 022h +VK_END = 023h +VK_HOME = 024h +VK_LEFT = 025h +VK_UP = 026h +VK_RIGHT = 027h +VK_DOWN = 028h +VK_SELECT = 029h +VK_PRINT = 02Ah +VK_EXECUTE = 02Bh +VK_SNAPSHOT = 02Ch +VK_INSERT = 02Dh +VK_DELETE = 02Eh +VK_HELP = 02Fh +VK_LWIN = 05Bh +VK_RWIN = 05Ch +VK_APPS = 05Dh +VK_NUMPAD0 = 060h +VK_NUMPAD1 = 061h +VK_NUMPAD2 = 062h +VK_NUMPAD3 = 063h +VK_NUMPAD4 = 064h +VK_NUMPAD5 = 065h +VK_NUMPAD6 = 066h +VK_NUMPAD7 = 067h +VK_NUMPAD8 = 068h +VK_NUMPAD9 = 069h +VK_MULTIPLY = 06Ah +VK_ADD = 06Bh +VK_SEPARATOR = 06Ch +VK_SUBTRACT = 06Dh +VK_DECIMAL = 06Eh +VK_DIVIDE = 06Fh +VK_F1 = 070h +VK_F2 = 071h +VK_F3 = 072h +VK_F4 = 073h +VK_F5 = 074h +VK_F6 = 075h +VK_F7 = 076h +VK_F8 = 077h +VK_F9 = 078h +VK_F10 = 079h +VK_F11 = 07Ah +VK_F12 = 07Bh +VK_F13 = 07Ch +VK_F14 = 07Dh +VK_F15 = 07Eh +VK_F16 = 07Fh +VK_F17 = 080h +VK_F18 = 081h +VK_F19 = 082h +VK_F20 = 083h +VK_F21 = 084h +VK_F22 = 085h +VK_F23 = 086h +VK_F24 = 087h +VK_NUMLOCK = 090h +VK_SCROLL = 091h +VK_LSHIFT = 0A0h +VK_RSHIFT = 0A1h +VK_LCONTROL = 0A2h +VK_RCONTROL = 0A3h +VK_LMENU = 0A4h +VK_RMENU = 0A5h +VK_ATTN = 0F6h +VK_CRSEL = 0F7h +VK_EXSEL = 0F8h +VK_EREOF = 0F9h +VK_PLAY = 0FAh +VK_ZOOM = 0FBh +VK_NONAME = 0FCh +VK_PA1 = 0FDh +VK_OEM_CLEAR = 0FEh + +; Accelerator flags + +FVIRTKEY = 01h +FNOINVERT = 02h +FSHIFT = 04h +FCONTROL = 08h +FALT = 10h + +; GetClassLong offsets + +GCL_MENUNAME = -8 +GCL_HBRBACKGROUND = -10 +GCL_HCURSOR = -12 +GCL_HICON = -14 +GCL_HMODULE = -16 +GCL_CBWNDEXTRA = -18 +GCL_CBCLSEXTRA = -20 +GCL_WNDPROC = -24 +GCL_STYLE = -26 +GCW_ATOM = -32 +GCL_HICONSM = -34 + +; WNDCLASS parameters + +DLGWINDOWEXTRA = 30 + +; GetWindowLong offsets + +GWLP_WNDPROC = -4 +GWLP_HINSTANCE = -6 +GWLP_HWNDPARENT = -8 +GWLP_ID = -12 +GWLP_STYLE = -16 +GWLP_EXSTYLE = -20 +GWLP_USERDATA = -21 +DWLP_MSGRESULT = 0 +DWLP_DLGPROC = 8 +DWLP_USER = 16 + +; GetSystemMetrics codes + +SM_CXSCREEN = 0 +SM_CYSCREEN = 1 +SM_CXVSCROLL = 2 +SM_CYHSCROLL = 3 +SM_CYCAPTION = 4 +SM_CXBORDER = 5 +SM_CYBORDER = 6 +SM_CXDLGFRAME = 7 +SM_CYDLGFRAME = 8 +SM_CYVTHUMB = 9 +SM_CXHTHUMB = 10 +SM_CXICON = 11 +SM_CYICON = 12 +SM_CXCURSOR = 13 +SM_CYCURSOR = 14 +SM_CYMENU = 15 +SM_CXFULLSCREEN = 16 +SM_CYFULLSCREEN = 17 +SM_CYKANJIWINDOW = 18 +SM_MOUSEPRESENT = 19 +SM_CYVSCROLL = 20 +SM_CXHSCROLL = 21 +SM_DEBUG = 22 +SM_SWAPBUTTON = 23 +SM_RESERVED1 = 24 +SM_RESERVED2 = 25 +SM_RESERVED3 = 26 +SM_RESERVED4 = 27 +SM_CXMIN = 28 +SM_CYMIN = 29 +SM_CXSIZE = 30 +SM_CYSIZE = 31 +SM_CXFRAME = 32 +SM_CYFRAME = 33 +SM_CXMINTRACK = 34 +SM_CYMINTRACK = 35 +SM_CXDOUBLECLK = 36 +SM_CYDOUBLECLK = 37 +SM_CXICONSPACING = 38 +SM_CYICONSPACING = 39 +SM_MENUDROPALIGNMENT = 40 +SM_PENWINDOWS = 41 +SM_DBCSENABLED = 42 +SM_CMOUSEBUTTONS = 43 +SM_CXFIXEDFRAME = SM_CXDLGFRAME +SM_CYFIXEDFRAME = SM_CYDLGFRAME +SM_CXSIZEFRAME = SM_CXFRAME +SM_CYSIZEFRAME = SM_CYFRAME +SM_SECURE = 44 +SM_CXEDGE = 45 +SM_CYEDGE = 46 +SM_CXMINSPACING = 47 +SM_CYMINSPACING = 48 +SM_CXSMICON = 49 +SM_CYSMICON = 50 +SM_CYSMCAPTION = 51 +SM_CXSMSIZE = 52 +SM_CYSMSIZE = 53 +SM_CXMENUSIZE = 54 +SM_CYMENUSIZE = 55 +SM_ARRANGE = 56 +SM_CXMINIMIZED = 57 +SM_CYMINIMIZED = 58 +SM_CXMAXTRACK = 59 +SM_CYMAXTRACK = 60 +SM_CXMAXIMIZED = 61 +SM_CYMAXIMIZED = 62 +SM_NETWORK = 63 +SM_CLEANBOOT = 67 +SM_CXDRAG = 68 +SM_CYDRAG = 69 +SM_SHOWSOUNDS = 70 +SM_CXMENUCHECK = 71 +SM_CYMENUCHECK = 72 +SM_SLOWMACHINE = 73 +SM_MIDEASTENABLED = 74 +SM_MOUSEWHEELPRESENT = 75 +SM_CMETRICS = 76 + +; Predefined cursor identifiers + +IDC_ARROW = 32512 +IDC_IBEAM = 32513 +IDC_WAIT = 32514 +IDC_CROSS = 32515 +IDC_UPARROW = 32516 +IDC_SIZE = 32640 +IDC_ICON = 32641 +IDC_SIZENWSE = 32642 +IDC_SIZENESW = 32643 +IDC_SIZEWE = 32644 +IDC_SIZENS = 32645 +IDC_NO = 32648 +IDC_HAND = 32649 +IDC_APPSTARTING = 32650 +IDC_HELP = 32651 + +; Predefined icon identifiers + +IDI_APPLICATION = 32512 +IDI_HAND = 32513 +IDI_QUESTION = 32514 +IDI_EXCLAMATION = 32515 +IDI_ASTERISK = 32516 +IDI_WINLOGO = 32517 + +; System colors + +COLOR_SCROLLBAR = 0 +COLOR_BACKGROUND = 1 +COLOR_ACTIVECAPTION = 2 +COLOR_INACTIVECAPTION = 3 +COLOR_MENU = 4 +COLOR_WINDOW = 5 +COLOR_WINDOWFRAME = 6 +COLOR_MENUTEXT = 7 +COLOR_WINDOWTEXT = 8 +COLOR_CAPTIONTEXT = 9 +COLOR_ACTIVEBORDER = 10 +COLOR_INACTIVEBORDER = 11 +COLOR_APPWORKSPACE = 12 +COLOR_HIGHLIGHT = 13 +COLOR_HIGHLIGHTTEXT = 14 +COLOR_BTNFACE = 15 +COLOR_BTNSHADOW = 16 +COLOR_GRAYTEXT = 17 +COLOR_BTNTEXT = 18 +COLOR_INACTIVECAPTIONTEXT = 19 +COLOR_BTNHIGHLIGHT = 20 +COLOR_3DDKSHADOW = 21 +COLOR_3DLIGHT = 22 +COLOR_INFOTEXT = 23 +COLOR_INFOBK = 24 +COLOR_HOTLIGHT = 26 +COLOR_GRADIENTACTIVECAPTION = 27 +COLOR_GRADIENTINACTIVECAPTION = 28 + +; Button messages + +BM_GETCHECK = 00F0h +BM_SETCHECK = 00F1h +BM_GETSTATE = 00F2h +BM_SETSTATE = 00F3h +BM_SETSTYLE = 00F4h +BM_CLICK = 00F5h +BM_GETIMAGE = 00F6h +BM_SETIMAGE = 00F7h + +; Button notifications + +BN_CLICKED = 0 +BN_PAINT = 1 +BN_HILITE = 2 +BN_UNHILITE = 3 +BN_DISABLE = 4 +BN_DOUBLECLICKED = 5 +BN_SETFOCUS = 6 +BN_KILLFOCUS = 7 +BN_PUSHED = BN_HILITE +BN_UNPUSHED = BN_UNHILITE +BN_DBLCLK = BN_DOUBLECLICKED + +; Button styles + +BS_PUSHBUTTON = 0000h +BS_DEFPUSHBUTTON = 0001h +BS_CHECKBOX = 0002h +BS_AUTOCHECKBOX = 0003h +BS_RADIOBUTTON = 0004h +BS_3STATE = 0005h +BS_AUTO3STATE = 0006h +BS_GROUPBOX = 0007h +BS_USERBUTTON = 0008h +BS_AUTORADIOBUTTON = 0009h +BS_OWNERDRAW = 000Bh +BS_TEXT = 0000h +BS_LEFTTEXT = 0020h +BS_RIGHTBUTTON = BS_LEFTTEXT +BS_ICON = 0040h +BS_BITMAP = 0080h +BS_LEFT = 0100h +BS_RIGHT = 0200h +BS_CENTER = 0300h +BS_TOP = 0400h +BS_BOTTOM = 0800h +BS_VCENTER = 0C00h +BS_PUSHLIKE = 1000h +BS_MULTILINE = 2000h +BS_NOTIFY = 4000h +BS_FLAT = 8000h + +; Button states + +BST_UNCHECKED = 0 +BST_CHECKED = 1 +BST_INDETERMINATE = 2 +BST_PUSHED = 4 +BST_FOCUS = 8 + +; List box messages + +LB_ADDSTRING = 0180h +LB_INSERTSTRING = 0181h +LB_DELETESTRING = 0182h +LB_SELITEMRANGEEX = 0183h +LB_RESETCONTENT = 0184h +LB_SETSEL = 0185h +LB_SETCURSEL = 0186h +LB_GETSEL = 0187h +LB_GETCURSEL = 0188h +LB_GETTEXT = 0189h +LB_GETTEXTLEN = 018Ah +LB_GETCOUNT = 018Bh +LB_SELECTSTRING = 018Ch +LB_DIR = 018Dh +LB_GETTOPINDEX = 018Eh +LB_FINDSTRING = 018Fh +LB_GETSELCOUNT = 0190h +LB_GETSELITEMS = 0191h +LB_SETTABSTOPS = 0192h +LB_GETHORIZONTALEXTENT = 0193h +LB_SETHORIZONTALEXTENT = 0194h +LB_SETCOLUMNWIDTH = 0195h +LB_ADDFILE = 0196h +LB_SETTOPINDEX = 0197h +LB_GETITEMRECT = 0198h +LB_GETITEMDATA = 0199h +LB_SETITEMDATA = 019Ah +LB_SELITEMRANGE = 019Bh +LB_SETANCHORINDEX = 019Ch +LB_GETANCHORINDEX = 019Dh +LB_SETCARETINDEX = 019Eh +LB_GETCARETINDEX = 019Fh +LB_SETITEMHEIGHT = 01A0h +LB_GETITEMHEIGHT = 01A1h +LB_FINDSTRINGEXACT = 01A2h +LB_SETLOCALE = 01A5h +LB_GETLOCALE = 01A6h +LB_SETCOUNT = 01A7h +LB_INITSTORAGE = 01A8h +LB_ITEMFROMPOINT = 01A9h + +; List box notifications + +LBN_ERRSPACE = -2 +LBN_SELCHANGE = 1 +LBN_DBLCLK = 2 +LBN_SELCANCEL = 3 +LBN_SETFOCUS = 4 +LBN_KILLFOCUS = 5 + +; List box styles + +LBS_NOTIFY = 0001h +LBS_SORT = 0002h +LBS_NOREDRAW = 0004h +LBS_MULTIPLESEL = 0008h +LBS_OWNERDRAWFIXED = 0010h +LBS_OWNERDRAWVARIABLE = 0020h +LBS_HASSTRINGS = 0040h +LBS_USETABSTOPS = 0080h +LBS_NOINTEGRALHEIGHT = 0100h +LBS_MULTICOLUMN = 0200h +LBS_WANTKEYBOARDINPUT = 0400h +LBS_EXTENDEDSEL = 0800h +LBS_DISABLENOSCROLL = 1000h +LBS_NODATA = 2000h +LBS_NOSEL = 4000h +LBS_STANDARD = LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER + +; List box return values + +LB_OKAY = 0 +LB_ERR = -1 +LB_ERRSPACE = -2 + +; Combo box messages + +CB_GETEDITSEL = 0140h +CB_LIMITTEXT = 0141h +CB_SETEDITSEL = 0142h +CB_ADDSTRING = 0143h +CB_DELETESTRING = 0144h +CB_DIR = 0145h +CB_GETCOUNT = 0146h +CB_GETCURSEL = 0147h +CB_GETLBTEXT = 0148h +CB_GETLBTEXTLEN = 0149h +CB_INSERTSTRING = 014Ah +CB_RESETCONTENT = 014Bh +CB_FINDSTRING = 014Ch +CB_SELECTSTRING = 014Dh +CB_SETCURSEL = 014Eh +CB_SHOWDROPDOWN = 014Fh +CB_GETITEMDATA = 0150h +CB_SETITEMDATA = 0151h +CB_GETDROPPEDCONTROLRECT = 0152h +CB_SETITEMHEIGHT = 0153h +CB_GETITEMHEIGHT = 0154h +CB_SETEXTENDEDUI = 0155h +CB_GETEXTENDEDUI = 0156h +CB_GETDROPPEDSTATE = 0157h +CB_FINDSTRINGEXACT = 0158h +CB_SETLOCALE = 0159h +CB_GETLOCALE = 015Ah +CB_GETTOPINDEX = 015Bh +CB_SETTOPINDEX = 015Ch +CB_GETHORIZONTALEXTENT = 015Dh +CB_SETHORIZONTALEXTENT = 015Eh +CB_GETDROPPEDWIDTH = 015Fh +CB_SETDROPPEDWIDTH = 0160h +CB_INITSTORAGE = 0161h + +; Combo box notifications + +CBN_ERRSPACE = -1 +CBN_SELCHANGE = 1 +CBN_DBLCLK = 2 +CBN_SETFOCUS = 3 +CBN_KILLFOCUS = 4 +CBN_EDITCHANGE = 5 +CBN_EDITUPDATE = 6 +CBN_DROPDOWN = 7 +CBN_CLOSEUP = 8 +CBN_SELENDOK = 9 +CBN_SELENDCANCEL = 10 + +; Combo box styles + +CBS_SIMPLE = 0001h +CBS_DROPDOWN = 0002h +CBS_DROPDOWNLIST = 0003h +CBS_OWNERDRAWFIXED = 0010h +CBS_OWNERDRAWVARIABLE = 0020h +CBS_AUTOHSCROLL = 0040h +CBS_OEMCONVERT = 0080h +CBS_SORT = 0100h +CBS_HASSTRINGS = 0200h +CBS_NOINTEGRALHEIGHT = 0400h +CBS_DISABLENOSCROLL = 0800h +CBS_UPPERCASE = 2000h +CBS_LOWERCASE = 4000h + +; Combo box return values + +CB_OKAY = 0 +CB_ERR = -1 +CB_ERRSPACE = -2 + +; Edit control messages + +EM_GETSEL = 00B0h +EM_SETSEL = 00B1h +EM_GETRECT = 00B2h +EM_SETRECT = 00B3h +EM_SETRECTNP = 00B4h +EM_SCROLL = 00B5h +EM_LINESCROLL = 00B6h +EM_SCROLLCARET = 00B7h +EM_GETMODIFY = 00B8h +EM_SETMODIFY = 00B9h +EM_GETLINECOUNT = 00BAh +EM_LINEINDEX = 00BBh +EM_SETHANDLE = 00BCh +EM_GETHANDLE = 00BDh +EM_GETTHUMB = 00BEh +EM_LINELENGTH = 00C1h +EM_REPLACESEL = 00C2h +EM_GETLINE = 00C4h +EM_LIMITTEXT = 00C5h +EM_CANUNDO = 00C6h +EM_UNDO = 00C7h +EM_FMTLINES = 00C8h +EM_LINEFROMCHAR = 00C9h +EM_SETTABSTOPS = 00CBh +EM_SETPASSWORDCHAR = 00CCh +EM_EMPTYUNDOBUFFER = 00CDh +EM_GETFIRSTVISIBLELINE = 00CEh +EM_SETREADONLY = 00CFh +EM_SETWORDBREAKPROC = 00D0h +EM_GETWORDBREAKPROC = 00D1h +EM_GETPASSWORDCHAR = 00D2h +EM_SETMARGINS = 00D3h +EM_GETMARGINS = 00D4h +EM_SETLIMITTEXT = EM_LIMITTEXT +EM_GETLIMITTEXT = 00D5h +EM_POSFROMCHAR = 00D6h +EM_CHARFROMPOS = 00D7h + +; Edit control EM_SETMARGIN parameters + +EC_LEFTMARGIN = 1 +EC_RIGHTMARGIN = 2 +EC_USEFONTINFO = 0FFFFh + +; Edit control notifications + +EN_SETFOCUS = 0100h +EN_KILLFOCUS = 0200h +EN_CHANGE = 0300h +EN_UPDATE = 0400h +EN_ERRSPACE = 0500h +EN_MAXTEXT = 0501h +EN_HSCROLL = 0601h +EN_VSCROLL = 0602h + +; Edit control styles + +ES_LEFT = 0000h +ES_CENTER = 0001h +ES_RIGHT = 0002h +ES_MULTILINE = 0004h +ES_UPPERCASE = 0008h +ES_LOWERCASE = 0010h +ES_PASSWORD = 0020h +ES_AUTOVSCROLL = 0040h +ES_AUTOHSCROLL = 0080h +ES_NOHIDESEL = 0100h +ES_OEMCONVERT = 0400h +ES_READONLY = 0800h +ES_WANTRETURN = 1000h +ES_NUMBER = 2000h + +; Static window messages + +STM_SETICON = 0170h +STM_GETICON = 0171h +STM_SETIMAGE = 0172h +STM_GETIMAGE = 0173h + +; Static window notifications + +STN_CLICKED = 0 +STN_DBLCLK = 1 +STN_ENABLE = 2 +STN_DISABLE = 3 + +; Static window styles + +SS_LEFT = 0000h +SS_CENTER = 0001h +SS_RIGHT = 0002h +SS_ICON = 0003h +SS_BLACKRECT = 0004h +SS_GRAYRECT = 0005h +SS_WHITERECT = 0006h +SS_BLACKFRAME = 0007h +SS_GRAYFRAME = 0008h +SS_WHITEFRAME = 0009h +SS_USERITEM = 000Ah +SS_SIMPLE = 000Bh +SS_LEFTNOWORDWRAP = 000Ch +SS_BITMAP = 000Eh +SS_OWNERDRAW = 000Dh +SS_ENHMETAFILE = 000Fh +SS_ETCHEDHORZ = 0010h +SS_ETCHEDVERT = 0011h +SS_ETCHEDFRAME = 0012h +SS_TYPEMASK = 001Fh +SS_NOPREFIX = 0080h +SS_NOTIFY = 0100h +SS_CENTERIMAGE = 0200h +SS_RIGHTJUST = 0400h +SS_REALSIZEIMAGE = 0800h +SS_SUNKEN = 1000h + +; Scroll bar constants + +SB_HORZ = 0 +SB_VERT = 1 +SB_CTL = 2 +SB_BOTH = 3 + +; Scroll bar messages + +SBM_SETPOS = 00E0h +SBM_GETPOS = 00E1h +SBM_SETRANGE = 00E2h +SBM_SETRANGEREDRAW = 00E6h +SBM_GETRANGE = 00E3h +SBM_ENABLE_ARROWS = 00E4h +SBM_SETSCROLLINFO = 00E9h +SBM_GETSCROLLINFO = 00EAh + +; Scroll bar commands + +SB_LINEUP = 0 +SB_LINELEFT = 0 +SB_LINEDOWN = 1 +SB_LINERIGHT = 1 +SB_PAGEUP = 2 +SB_PAGELEFT = 2 +SB_PAGEDOWN = 3 +SB_PAGERIGHT = 3 +SB_THUMBPOSITION = 4 +SB_THUMBTRACK = 5 +SB_TOP = 6 +SB_LEFT = 6 +SB_BOTTOM = 7 +SB_RIGHT = 7 +SB_ENDSCROLL = 8 + +; Scroll bar styles + +SBS_HORZ = 0000h +SBS_VERT = 0001h +SBS_TOPALIGN = 0002h +SBS_LEFTALIGN = 0002h +SBS_BOTTOMALIGN = 0004h +SBS_RIGHTALIGN = 0004h +SBS_SIZEBOXTOPLEFTALIGN = 0002h +SBS_SIZEBOXBOTTOMRIGHTALIGN = 0004h +SBS_SIZEBOX = 0008h +SBS_SIZEGRIP = 0010h + +; Scroll bar info flags + +SIF_RANGE = 0001h +SIF_PAGE = 0002h +SIF_POS = 0004h +SIF_DISABLENOSCROLL = 0008h +SIF_TRACKPOS = 0010h +SIF_ALL = SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS + +; Dialog styles + +DS_ABSALIGN = 0001h +DS_SYSMODAL = 0002h +DS_3DLOOK = 0004h +DS_FIXEDSYS = 0008h +DS_NOFAILCREATE = 0010h +DS_LOCALEDIT = 0020h +DS_SETFONT = 0040h +DS_MODALFRAME = 0080h +DS_NOIDLEMSG = 0100h +DS_SETFOREGROUND = 0200h +DS_CONTROL = 0400h +DS_CENTER = 0800h +DS_CENTERMOUSE = 1000h +DS_CONTEXTHELP = 2000h + +; Dialog codes + +DLGC_WANTARROWS = 0001h +DLGC_WANTTAB = 0002h +DLGC_WANTALLKEYS = 0004h +DLGC_WANTMESSAGE = 0004h +DLGC_HASSETSEL = 0008h +DLGC_DEFPUSHBUTTON = 0010h +DLGC_UNDEFPUSHBUTTON = 0020h +DLGC_RADIOBUTTON = 0040h +DLGC_WANTCHARS = 0080h +DLGC_STATIC = 0100h +DLGC_BUTTON = 2000h + +; Menu flags + +MF_INSERT = 0000h +MF_CHANGE = 0080h +MF_APPEND = 0100h +MF_DELETE = 0200h +MF_REMOVE = 1000h +MF_BYCOMMAND = 0000h +MF_BYPOSITION = 0400h +MF_SEPARATOR = 0800h +MF_UNCHECKED = 0000h +MF_ENABLED = 0000h +MF_GRAYED = 0001h +MF_DISABLED = 0002h +MF_CHECKED = 0008h +MF_USECHECKBITMAPS = 0200h +MF_STRING = 0000h +MF_BITMAP = 0004h +MF_OWNERDRAW = 0100h +MF_POPUP = 0010h +MF_MENUBARBREAK = 0020h +MF_MENUBREAK = 0040h +MF_UNHILITE = 0000h +MF_HILITE = 0080h +MF_DEFAULT = 1000h +MF_SYSMENU = 2000h +MF_HELP = 4000h +MF_RIGHTJUSTIFY = 4000h +MF_MOUSESELECT = 8000h +MF_END = 0080h +MFT_STRING = MF_STRING +MFT_BITMAP = MF_BITMAP +MFT_MENUBARBREAK = MF_MENUBARBREAK +MFT_MENUBREAK = MF_MENUBREAK +MFT_OWNERDRAW = MF_OWNERDRAW +MFT_RADIOCHECK = 0200h +MFT_SEPARATOR = MF_SEPARATOR +MFT_RIGHTORDER = 2000h +MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY +MFS_GRAYED = 0003h +MFS_DISABLED = MFS_GRAYED +MFS_CHECKED = MF_CHECKED +MFS_HILITE = MF_HILITE +MFS_ENABLED = MF_ENABLED +MFS_UNCHECKED = MF_UNCHECKED +MFS_UNHILITE = MF_UNHILITE +MFS_DEFAULT = MF_DEFAULT +MFR_POPUP = 0001h +MFR_END = MF_END + +; System menu command values + +SC_SIZE = 61440 +SC_MOVE = 61456 +SC_MINIMIZE = 61472 +SC_MAXIMIZE = 61488 +SC_NEXTWINDOW = 61504 +SC_PREVWINDOW = 61520 +SC_CLOSE = 61536 +SC_VSCROLL = 61552 +SC_HSCROLL = 61568 +SC_MOUSEMENU = 61584 +SC_KEYMENU = 61696 +SC_ARRANGE = 61712 +SC_RESTORE = 61728 +SC_TASKLIST = 61744 +SC_SCREENSAVE = 61760 +SC_HOTKEY = 61776 +SC_DEFAULT = 61792 +SC_MONITORPOWER = 61808 +SC_CONTEXTHELP = 61824 +SC_SEPARATOR = 61455 + +; Border types + +BDR_RAISEDOUTER = 01h +BDR_SUNKENOUTER = 02h +BDR_RAISEDINNER = 04h +BDR_SUNKENINNER = 08h +BDR_OUTER = 03h +BDR_INNER = 0Ch +BDR_RAISED = 05h +BDR_SUNKEN = 0Ah +EDGE_RAISED = BDR_RAISEDOUTER or BDR_RAISEDINNER +EDGE_SUNKEN = BDR_SUNKENOUTER or BDR_SUNKENINNER +EDGE_ETCHED = BDR_SUNKENOUTER or BDR_RAISEDINNER +EDGE_BUMP = BDR_RAISEDOUTER or BDR_SUNKENINNER + +; Border flags + +BF_LEFT = 0001h +BF_TOP = 0002h +BF_RIGHT = 0004h +BF_BOTTOM = 0008h +BF_TOPLEFT = BF_TOP or BF_LEFT +BF_TOPRIGHT = BF_TOP or BF_RIGHT +BF_BOTTOMLEFT = BF_BOTTOM or BF_LEFT +BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT +BF_RECT = BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM +BF_DIAGONAL = 0010h +BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL or BF_TOP or BF_RIGHT +BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL or BF_TOP or BF_LEFT +BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL or BF_BOTTOM or BF_LEFT +BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT +BF_MIDDLE = 0800h +BF_SOFT = 1000h +BF_ADJUST = 2000h +BF_FLAT = 4000h +BF_MONO = 8000h + +; Frame control types + +DFC_CAPTION = 1 +DFC_MENU = 2 +DFC_SCROLL = 3 +DFC_BUTTON = 4 +DFC_POPUPMENU = 5 + +; Frame control states + +DFCS_CAPTIONCLOSE = 0000h +DFCS_CAPTIONMIN = 0001h +DFCS_CAPTIONMAX = 0002h +DFCS_CAPTIONRESTORE = 0003h +DFCS_CAPTIONHELP = 0004h +DFCS_MENUARROW = 0000h +DFCS_MENUCHECK = 0001h +DFCS_MENUBULLET = 0002h +DFCS_MENUARROWRIGHT = 0004h +DFCS_SCROLLUP = 0000h +DFCS_SCROLLDOWN = 0001h +DFCS_SCROLLLEFT = 0002h +DFCS_SCROLLRIGHT = 0003h +DFCS_SCROLLCOMBOBOX = 0005h +DFCS_SCROLLSIZEGRIP = 0008h +DFCS_SCROLLSIZEGRIPRIGHT = 0010h +DFCS_BUTTONCHECK = 0000h +DFCS_BUTTONRADIOIMAGE = 0001h +DFCS_BUTTONRADIOMASK = 0002h +DFCS_BUTTONRADIO = 0004h +DFCS_BUTTON3STATE = 0008h +DFCS_BUTTONPUSH = 0010h +DFCS_INACTIVE = 0100h +DFCS_PUSHED = 0200h +DFCS_CHECKED = 0400h +DFCS_TRANSPARENT = 0800h +DFCS_HOT = 1000h +DFCS_ADJUSTRECT = 2000h +DFCS_FLAT = 4000h +DFCS_MONO = 8000h + +; DrawCaption flags + +DC_ACTIVE = 01h +DC_SMALLCAP = 02h +DC_ICON = 04h +DC_TEXT = 08h +DC_INBUTTON = 10h + +; DrawIconEx options + +DI_MASK = 1 +DI_IMAGE = 2 +DI_NORMAL = 3 +DI_COMPAT = 4 +DI_DEFAULTSIZE = 8 + +; DrawText parameters + +DT_TOP = 00000h +DT_LEFT = 00000h +DT_CENTER = 00001h +DT_RIGHT = 00002h +DT_VCENTER = 00004h +DT_BOTTOM = 00008h +DT_WORDBREAK = 00010h +DT_SINGLELINE = 00020h +DT_EXPANDTABS = 00040h +DT_TABSTOP = 00080h +DT_NOCLIP = 00100h +DT_EXTERNALLEADING = 00200h +DT_CALCRECT = 00400h +DT_NOPREFIX = 00800h +DT_INTERNAL = 01000h +DT_EDITCONTROL = 02000h +DT_PATH_ELLIPSIS = 04000h +DT_END_ELLIPSIS = 08000h +DT_MODIFYSTRING = 10000h +DT_RTLREADING = 20000h +DT_WORD_ELLIPSIS = 40000h + +; GetDCEx flags + +DCX_WINDOW = 000001h +DCX_CACHE = 000002h +DCX_NORESETATTRS = 000004h +DCX_CLIPCHILDREN = 000008h +DCX_CLIPSIBLINGS = 000010h +DCX_PARENTCLIP = 000020h +DCX_EXCLUDERGN = 000040h +DCX_INTERSECTRGN = 000080h +DCX_EXCLUDEUPDATE = 000100h +DCX_INTERSECTUPDATE = 000200h +DCX_LOCKWINDOWUPDATE = 000400h +DCX_VALIDATE = 200000h + +; SetWindowsHook codes + +WH_MSGFILTER = -1 +WH_JOURNALRECORD = 0 +WH_JOURNALPLAYBACK = 1 +WH_KEYBOARD = 2 +WH_GETMESSAGE = 3 +WH_CALLWNDPROC = 4 +WH_CBT = 5 +WH_SYSMSGFILTER = 6 +WH_MOUSE = 7 +WH_HARDWARE = 8 +WH_DEBUG = 9 +WH_SHELL = 10 +WH_FOREGROUNDIDLE = 11 +WH_CALLWNDPROCRET = 12 +WH_KEYBOARD_LL = 13 +WH_MOUSE_LL = 14 + +; Hook codes + +HC_ACTION = 0 +HC_GETNEXT = 1 +HC_SKIP = 2 +HC_NOREMOVE = 3 +HC_SYSMODALON = 4 +HC_SYSMODALOFF = 5 + +; CBT hook codes + +HCBT_MOVESIZE = 0 +HCBT_MINMAX = 1 +HCBT_QS = 2 +HCBT_CREATEWND = 3 +HCBT_DESTROYWND = 4 +HCBT_ACTIVATE = 5 +HCBT_CLICKSKIPPED = 6 +HCBT_KEYSKIPPED = 7 +HCBT_SYSCOMMAND = 8 +HCBT_SETFOCUS = 9 + +; ExitWindowsEx flags + +EWX_LOGOFF = 0 +EWX_SHUTDOWN = 1 +EWX_REBOOT = 2 +EWX_FORCE = 4 +EWX_POWEROFF = 8 + +; WinHelp commands + +HELP_CONTEXT = 001h +HELP_QUIT = 002h +HELP_INDEX = 003h +HELP_CONTENTS = 003h +HELP_HELPONHELP = 004h +HELP_SETINDEX = 005h +HELP_SETCONTENTS = 005h +HELP_CONTEXTPOPUP = 008h +HELP_FORCEFILE = 009h +HELP_CONTEXTMENU = 00Ah +HELP_FINDER = 00Bh +HELP_WM_HELP = 00Ch +HELP_SETPOPUP_POS = 00Dh +HELP_KEY = 101h +HELP_COMMAND = 102h +HELP_PARTIALKEY = 105h +HELP_MULTIKEY = 201h +HELP_SETWINPOS = 203h + +; keybd_event flags + +KEYEVENTF_EXTENDEDKEY = 1h +KEYEVENTF_KEYUP = 2h + +; mouse_event flags + +MOUSEEVENTF_MOVE = 0001h +MOUSEEVENTF_LEFTDOWN = 0002h +MOUSEEVENTF_LEFTUP = 0004h +MOUSEEVENTF_RIGHTDOWN = 0008h +MOUSEEVENTF_RIGHTUP = 0010h +MOUSEEVENTF_MIDDLEDOWN = 0020h +MOUSEEVENTF_MIDDLEUP = 0040h +MOUSEEVENTF_WHEEL = 0800h +MOUSEEVENTF_ABSOLUTE = 8000h + +; TrackPopupMenu flags + +TPM_LEFTBUTTON = 0000h +TPM_RIGHTBUTTON = 0002h +TPM_LEFTALIGN = 0000h +TPM_CENTERALIGN = 0004h +TPM_RIGHTALIGN = 0008h +TPM_TOPALIGN = 0000h +TPM_VCENTERALIGN = 0010h +TPM_BOTTOMALIGN = 0020h +TPM_HORIZONTAL = 0000h +TPM_VERTICAL = 0040h +TPM_NONOTIFY = 0080h +TPM_RETURNCMD = 0100h +TPM_RECURSE = 0001h +TPM_HORPOSANIMATION = 0400h +TPM_HORNEGANIMATION = 0800h +TPM_VERPOSANIMATION = 1000h +TPM_VERNEGANIMATION = 2000h +TPM_NOANIMATION = 4000h +TPM_LAYOUTRTL = 8000h + +; Menu item info mask values + +MIIM_STATE = 001h +MIIM_ID = 002h +MIIM_SUBMENU = 004h +MIIM_CHECKMARKS = 008h +MIIM_TYPE = 010h +MIIM_DATA = 020h +MIIM_STRING = 040h +MIIM_BITMAP = 080h +MIIM_FTYPE = 100h + +; DRAWITEMSTRUCT control types + +ODT_MENU = 1 +ODT_LISTBOX = 2 +ODT_COMBOBOX = 3 +ODT_BUTTON = 4 +ODT_STATIC = 5 + +; DRAWITEMSTRUCT actions + +ODA_DRAWENTIRE = 1 +ODA_SELECT = 2 +ODA_FOCUS = 4 + +; DRAWITEMSTRUCT states + +ODS_SELECTED = 0001h +ODS_GRAYED = 0002h +ODS_DISABLED = 0004h +ODS_CHECKED = 0008h +ODS_FOCUS = 0010h +ODS_DEFAULT = 0020h +ODS_COMBOBOXEDIT = 1000h +ODS_HOTLIGHT = 0040h +ODS_INACTIVE = 0080h + +; WINDOWPLACEMENT flags + +WPF_SETMINPOSITION = 1 +WPF_RESTORETOMAXIMIZED = 2 + +; Layered window attributes + +LWA_COLORKEY = 1 +LWA_ALPHA = 2 + +; UpdateLayeredWindow flags + +ULW_COLORKEY = 1 +ULW_ALPHA = 2 +ULW_OPAQUE = 4 + +; SystemParametersInfo parameters + +SPI_GETACCESSTIMEOUT = 60 +SPI_GETANIMATION = 72 +SPI_GETBEEP = 1 +SPI_GETBORDER = 5 +SPI_GETDEFAULTINPUTLANG = 89 +SPI_GETDRAGFULLWINDOWS = 38 +SPI_GETFASTTASKSWITCH = 35 +SPI_GETFILTERKEYS = 50 +SPI_GETFONTSMOOTHING = 74 +SPI_GETGRIDGRANULARITY = 18 +SPI_GETHIGHCONTRAST = 66 +SPI_GETICONMETRICS = 45 +SPI_GETICONTITLELOGFONT = 31 +SPI_GETICONTITLEWRAP = 25 +SPI_GETKEYBOARDDELAY = 22 +SPI_GETKEYBOARDPREF = 68 +SPI_GETKEYBOARDSPEED = 10 +SPI_GETLOWPOWERACTIVE = 83 +SPI_GETLOWPOWERTIMEOUT = 79 +SPI_GETMENUDROPALIGNMENT = 27 +SPI_GETMINIMIZEDMETRICS = 43 +SPI_GETMOUSE = 3 +SPI_GETMOUSEKEYS = 54 +SPI_GETMOUSETRAILS = 94 +SPI_GETNONCLIENTMETRICS = 41 +SPI_GETPOWEROFFACTIVE = 84 +SPI_GETPOWEROFFTIMEOUT = 80 +SPI_GETSCREENREADER = 70 +SPI_GETSCREENSAVEACTIVE = 16 +SPI_GETSCREENSAVETIMEOUT = 14 +SPI_GETSERIALKEYS = 62 +SPI_GETSHOWSOUNDS = 56 +SPI_GETSOUNDSENTRY = 64 +SPI_GETSTICKYKEYS = 58 +SPI_GETTOGGLEKEYS = 52 +SPI_GETWINDOWSEXTENSION = 92 +SPI_GETWORKAREA = 48 +SPI_ICONHORIZONTALSPACING = 13 +SPI_ICONVERTICALSPACING = 24 +SPI_LANGDRIVER = 12 +SPI_SCREENSAVERRUNNING = 97 +SPI_SETACCESSTIMEOUT = 61 +SPI_SETANIMATION = 73 +SPI_SETBEEP = 2 +SPI_SETBORDER = 6 +SPI_SETDEFAULTINPUTLANG = 90 +SPI_SETDESKPATTERN = 21 +SPI_SETDESKWALLPAPER = 20 +SPI_SETDOUBLECLICKTIME = 32 +SPI_SETDOUBLECLKHEIGHT = 30 +SPI_SETDOUBLECLKWIDTH = 29 +SPI_SETDRAGFULLWINDOWS = 37 +SPI_SETDRAGHEIGHT = 77 +SPI_SETDRAGWIDTH = 76 +SPI_SETFASTTASKSWITCH = 36 +SPI_SETFILTERKEYS = 51 +SPI_SETFONTSMOOTHING = 75 +SPI_SETGRIDGRANULARITY = 19 +SPI_SETHANDHELD = 78 +SPI_SETHIGHCONTRAST = 67 +SPI_SETICONMETRICS = 46 +SPI_SETICONTITLELOGFONT = 34 +SPI_SETICONTITLEWRAP = 26 +SPI_SETKEYBOARDDELAY = 23 +SPI_SETKEYBOARDPREF = 69 +SPI_SETKEYBOARDSPEED = 11 +SPI_SETLANGTOGGLE = 91 +SPI_SETLOWPOWERACTIVE = 85 +SPI_SETLOWPOWERTIMEOUT = 81 +SPI_SETMENUDROPALIGNMENT = 28 +SPI_SETMINIMIZEDMETRICS = 44 +SPI_SETMOUSE = 4 +SPI_SETMOUSEBUTTONSWAP = 33 +SPI_SETMOUSEKEYS = 55 +SPI_SETMOUSETRAILS = 93 +SPI_SETNONCLIENTMETRICS = 42 +SPI_SETPENWINDOWS = 49 +SPI_SETPOWEROFFACTIVE = 86 +SPI_SETPOWEROFFTIMEOUT = 82 +SPI_SETSCREENREADER = 71 +SPI_SETSCREENSAVEACTIVE = 17 +SPI_SETSCREENSAVERRUNNING = 97 +SPI_SETSCREENSAVETIMEOUT = 15 +SPI_SETSERIALKEYS = 63 +SPI_SETSHOWSOUNDS = 57 +SPI_SETSOUNDSENTRY = 65 +SPI_SETSTICKYKEYS = 59 +SPI_SETTOGGLEKEYS = 53 +SPI_SETWORKAREA = 47 + +; SystemParametersInfo flags + +SPIF_UPDATEINIFILE = 1 +SPIF_SENDWININICHANGE = 2 + +; Gesture Information Flags + +GF_BEGIN = 1 +GF_INERTIA = 2 +GF_END = 4 + +; Gesture IDs + +GID_BEGIN = 1 +GID_END = 2 +GID_ZOOM = 3 +GID_PAN = 4 +GID_ROTATE = 5 +GID_TWOFINGERTAP = 6 +GID_PRESSANDTAP = 7 +GID_ROLLOVER = GID_PRESSANDTAP + +; Zoom Gesture Confiration Flags + +GC_ZOOM = 0x00000001 + +; Pan Gesture Configuration Flags + +GC_PAN = 0x00000001 +GC_PAN_WITH_SINGLE_FINGER_VERTICALLY = 0x00000002 +GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY = 0x00000004 +GC_PAN_WITH_GUTTER = 0x00000008 +GC_PAN_WITH_INERTIA = 0x00000010 + +; Rotate Gesture Configuration Flags + +GC_ROTATE = 0x00000001 + +; Two finger tap configuration flags + +GC_TWOFINGERTAP = 0x00000001 + +; Press and tap Configuration Flags + +GC_PRESSANDTAP = 0x00000001 +GC_ROLLOVER = GC_PRESSANDTAP diff --git a/fasmw172/INCLUDE/EQUATES/WSOCK32.INC b/fasmw172/INCLUDE/EQUATES/WSOCK32.INC new file mode 100644 index 0000000..4b16b8e --- /dev/null +++ b/fasmw172/INCLUDE/EQUATES/WSOCK32.INC @@ -0,0 +1,124 @@ + +; WSOCK32.DLL structures and constants + +struct WSADATA + wVersion dw ? + wHighVersion dw ? + szDescription db 256+1 dup (?) + szSystemStatus db 128+1 dup (?) + iMaxSockets dw ? + iMaxUdpDg dw ? + _padding_ db 2 dup (?) + lpVendorInfo dd ? +ends + +struct hostent + h_name dd ? + h_aliases dd ? + h_addrtype dw ? + h_length dw ? + h_addr_list dd ? +ends + +struct sockaddr_in + sin_family dw ? + sin_port dw ? + sin_addr dd ? + sin_zero db 8 dup (?) +ends + +struct sockaddr + sa_family dw ? + sa_data db 14 dup (?) +ends + +; Socket types + +SOCK_STREAM = 1 +SOCK_DGRAM = 2 +SOCK_RAW = 3 +SOCK_RDM = 4 +SOCK_SEQPACKET = 5 + +; Address formats + +AF_UNSPEC = 0 +AF_UNIX = 1 +AF_INET = 2 +AF_IMPLINK = 3 +AF_PUP = 4 +AF_CHAOS = 5 +AF_NS = 6 +AF_IPX = 6 +AF_ISO = 7 +AF_OSI = AF_ISO +AF_ECMA = 8 +AF_DATAKIT = 9 +AF_CCITT = 10 +AF_SNA = 11 +AF_DECnet = 12 +AF_DLI = 13 +AF_LAT = 14 +AF_HYLINK = 15 +AF_APPLETALK = 16 +AF_NETBIOS = 17 + +; Protocol formats + +PF_UNSPEC = 0 +PF_UNIX = 1 +PF_INET = 2 +PF_IMPLINK = 3 +PF_PUP = 4 +PF_CHAOS = 5 +PF_NS = 6 +PF_IPX = 6 +PF_ISO = 7 +PF_OSI = PF_ISO +PF_ECMA = 8 +PF_DATAKIT = 9 +PF_CCITT = 10 +PF_SNA = 11 +PF_DECnet = 12 +PF_DLI = 13 +PF_LAT = 14 +PF_HYLINK = 15 +PF_APPLETALK = 16 +PF_NETBIOS = 17 + +; IP Ports + +IPPORT_ECHO = 7 +IPPORT_DISCARD = 9 +IPPORT_SYSTAT = 11 +IPPORT_DAYTIME = 13 +IPPORT_NETSTAT = 15 +IPPORT_FTP = 21 +IPPORT_TELNET = 23 +IPPORT_SMTP = 25 +IPPORT_TIMESERVER = 37 +IPPORT_NAMESERVER = 42 +IPPORT_WHOIS = 43 +IPPORT_MTP = 57 +IPPORT_TFTP = 69 +IPPORT_RJE = 77 +IPPORT_FINGER = 79 +IPPORT_TTYLINK = 87 +IPPORT_SUPDUP = 95 +IPPORT_EXECSERVER = 512 +IPPORT_LOGINSERVER = 513 +IPPORT_CMDSERVER = 514 +IPPORT_EFSSERVER = 520 +IPPORT_BIFFUDP = 512 +IPPORT_WHOSERVER = 513 +IPPORT_ROUTESERVER = 520 +IPPORT_RESERVED = 1024 + +; Notifications + +FD_READ = 01h +FD_WRITE = 02h +FD_OOB = 04h +FD_ACCEPT = 08h +FD_CONNECT = 10h +FD_CLOSE = 20h diff --git a/fasmw172/INCLUDE/MACRO/COM32.INC b/fasmw172/INCLUDE/MACRO/COM32.INC new file mode 100644 index 0000000..55a26c6 --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/COM32.INC @@ -0,0 +1,53 @@ + +; Macroinstructions for interfacing the COM (Component Object Model) classes + +macro cominvk object,proc,[arg] + { common + if ~ arg eq + reverse + pushd arg + common + end if + assert defined object#.com.object ; must be a COM object + mov eax,[object] + push eax + mov eax,[eax] + call [eax+object#.#proc] } + +macro comcall handle,interface,proc,[arg] + { common + if ~ arg eq + reverse + pushd arg + common + end if + assert defined interface#.com.interface ; must be a COM interface + if handle eqtype eax | handle eqtype 0 + push handle + local ..handle + label ..handle at handle + mov eax,[..handle] + else + mov eax,handle + push eax + mov eax,[eax] + end if + call [eax+interface#.#proc] } + +macro interface name,[proc] + { common + struc name \{ + match , @struct \\{ define field@struct .,name, \\} + match no, @struct \\{ . dd ? + virtual at 0 + forward + .#proc dd ? + common + .\#\\.com.object = name#.com.interface + end virtual \\} \} + virtual at 0 + forward + name#.#proc dd ? + common + name#.com.interface = $ shr 2 + end virtual } diff --git a/fasmw172/INCLUDE/MACRO/COM64.INC b/fasmw172/INCLUDE/MACRO/COM64.INC new file mode 100644 index 0000000..35ca4af --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/COM64.INC @@ -0,0 +1,39 @@ + +; Macroinstructions for interfacing the COM (Component Object Model) classes + +macro cominvk object,proc,[arg] + { common + assert defined object#.com.object ; must be a COM object + macro call dummy + \{ mov rax,[rcx] + call [rax+object#.#proc] \} + fastcall ,[object],arg + purge call } + +macro comcall handle,interface,proc,[arg] + { common + assert defined interface#.com.interface ; must be a COM interface + macro call dummy + \{ mov rax,[rcx] + call [rax+interface#.#proc] \} + fastcall ,handle,arg + purge call } + +macro interface name,[proc] + { common + struc name \{ + match , @struct \\{ define field@struct .,name, \\} + match no, @struct \\{ . dq ? + virtual at 0 + forward + .#proc dq ? + common + .\#\\.com.object = name#.com.interface + end virtual \\} \} + virtual at 0 + forward + name#.#proc dq ? + common + name#.com.interface = $ shr 3 + end virtual } + diff --git a/fasmw172/INCLUDE/MACRO/EXPORT.INC b/fasmw172/INCLUDE/MACRO/EXPORT.INC new file mode 100644 index 0000000..c0fa1c1 --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/EXPORT.INC @@ -0,0 +1,66 @@ + +; Macroinstruction for making export section + +macro export dllname,[label,string] + { common + local module,addresses,names,ordinal,count + count = 0 + forward + count = count+1 + common + dd 0,0,0,RVA module,1 + dd count,count,RVA addresses,RVA names,RVA ordinal + addresses: + forward + dd RVA label + common + names: + forward + local name + dd RVA name + common + ordinal: count = 0 + forward + dw count + count = count+1 + common + module db dllname,0 + forward + name db string,0 + common + local x,y,z,str1,str2,v1,v2 + x = count shr 1 + while x > 0 + y = x + while y < count + z = y + while z-x >= 0 + load v1 dword from names+z*4 + str1=($-RVA $)+v1 + load v2 dword from names+(z-x)*4 + str2=($-RVA $)+v2 + while v1 > 0 + load v1 from str1+%-1 + load v2 from str2+%-1 + if v1 <> v2 + break + end if + end while + if v1<v2 + load v1 dword from names+z*4 + load v2 dword from names+(z-x)*4 + store dword v1 at names+(z-x)*4 + store dword v2 at names+z*4 + load v1 word from ordinal+z*2 + load v2 word from ordinal+(z-x)*2 + store word v1 at ordinal+(z-x)*2 + store word v2 at ordinal+z*2 + else + break + end if + z = z-x + end while + y = y+1 + end while + x = x shr 1 + end while } diff --git a/fasmw172/INCLUDE/MACRO/IF.INC b/fasmw172/INCLUDE/MACRO/IF.INC new file mode 100644 index 0000000..b410a9b --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/IF.INC @@ -0,0 +1,507 @@ + +; Macroinstructions for HLL-style conditional operations + +macro .if [arg] +{ + common + __IF equ + local ..endif + __ENDIF equ ..endif + local ..else + __ELSE equ ..else + JNCOND __ELSE,arg +} + +macro .else +{ + jmp __ENDIF + __ELSE: + restore __IF + __IF equ , +} + +macro .elseif [arg] +{ + common + jmp __ENDIF + __ELSE: + restore __ELSE + local ..else + __ELSE equ ..else + JNCOND __ELSE,arg +} + +macro .endif +{ + if __IF eq + __ELSE: + end if + __ENDIF: + restore __ELSE + restore __ENDIF + restore __IF +} + +macro .while [arg] +{ + common + local ..while + __WHILE equ ..while + local ..endw + __ENDW equ ..endw + __WHILE: + JNCOND __ENDW,arg +} + +macro .endw +{ + jmp __WHILE + __ENDW: + restore __ENDW + restore __WHILE +} + +macro .repeat +{ + local ..repeat + __REPEAT equ ..repeat + __REPEAT: +} + +macro .until [arg] +{ + common + JNCOND __REPEAT,arg + restore __REPEAT +} + +jnne equ je +jnna equ ja +jnnb equ jb +jnng equ jg +jnnl equ jl +jnnae equ jae +jnnbe equ jbe +jnnge equ jge +jnnle equ jle + +macro JNCOND label,v1,c,v2 +{ + match any,c + \{ + cmp v1,v2 + jn\#c label + \} + match ,c + \{ + PARSECOND parsed@cond,v1 + match cond,parsed@cond \\{ JNCONDEXPR label,cond \\} + \} +} + +gt equ > +lt equ < + +macro PARSECOND parsed,cond +{ + define parsed + define neg@cond + define status@cond + define nest@cond + irps symb,cond + \{ + define symb@cond symb + match >,symb + \\{ + define symb@cond gt + \\} + match <,symb + \\{ + define symb@cond lt + \\} + current@cond equ status@cond + match ,current@cond + \\{ + match ~,symb + \\\{ + neg@cond equ neg@cond ~ + match ~~,neg@cond + \\\\{ + define neg@cond + \\\\} + define symb@cond + \\\} + match (,symb + \\\{ + parsed equ parsed neg@cond,< + define nest@cond + + define symb@cond + define neg@cond + \\\} + match any,symb@cond + \\\{ + parsed equ parsed neg@cond,symb@cond + define status@cond + + \\\} + \\} + match status,current@cond + \\{ + match &,symb + \\\{ + parsed equ parsed,&, + define status@cond + define symb@cond + define neg@cond + \\\} + match |,symb + \\\{ + parsed equ parsed,|, + define status@cond + define symb@cond + define neg@cond + \\\} + match (,symb + \\\{ + define nest@cond ( + \\\} + match ),symb + \\\{ + match +,nest@cond + \\\\{ + parsed equ parsed> + define symb@cond + \\\\} + restore nest@cond + \\\} + match any,symb@cond + \\\{ + parsed equ parsed symb@cond + \\\} + \\} + \} +} + +macro define_JNCONDEXPR +{ + macro JNCONDEXPR elabel,[mod,cond,op] + \{ + \common + \local ..t,..f + define t@cond ..t + define f@cond ..f + \forward + match ,op + \\{ + match ,mod \\\{ JNCONDEL elabel,<cond> \\\} + match ~,mod \\\{ JCONDEL elabel,<cond> \\\} + \\} + match &:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JNCONDEL flabel,<cond> \\\} + match ~,mod \\\{ JCONDEL flabel,<cond> \\\} + tlabel: + \\local ..tnew + restore t@cond + define t@cond ..tnew + \\} + match |:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JCONDEL tlabel,<cond> \\\} + match ~,mod \\\{ JNCONDEL tlabel,<cond> \\\} + flabel: + \\local ..fnew + restore f@cond + define f@cond ..fnew + \\} + \common + label f@cond at elabel + t@cond: + restore t@cond + restore f@cond + \} +} + +macro define_JCONDEXPR +{ + macro JCONDEXPR elabel,[mod,cond,op] + \{ + \common + \local ..t,..f + define t@cond ..t + define f@cond ..f + \forward + match ,op + \\{ + match ,mod \\\{ JCONDEL elabel,<cond> \\\} + match ~,mod \\\{ JNCONDEL elabel,<cond> \\\} + \\} + match |:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JCONDEL flabel,<cond> \\\} + match ~,mod \\\{ JNCONDEL flabel,<cond> \\\} + tlabel: + \\local ..tnew + restore t@cond + define t@cond ..tnew + \\} + match &:flabel:tlabel, op:f@cond:t@cond + \\{ + match ,mod \\\{ JNCONDEL tlabel,<cond> \\\} + match ~,mod \\\{ JCONDEL tlabel,<cond> \\\} + flabel: + \\local ..fnew + restore f@cond + define f@cond ..fnew + \\} + \common + label f@cond at elabel + t@cond: + restore t@cond + restore f@cond + \} +} + +macro define_JNCONDEL +{ + macro JNCONDEL label,cond + \{ + \local COND + match car=,cdr,:cond + \\{ + define_JNCONDEXPR + define_JCONDEXPR + define_JCONDEL + define_JNCONDEL + JNCONDEXPR label,cond + purge JNCONDEXPR,JCONDEXPR,JCONDEL,JNCONDEL + define COND + \\} + match c,cond ; replace gt and lt + \\{ + match =COND =signed v1>==v2, COND c + \\\{ + cmp v1,v2 + jl label + define COND + \\\} + match =COND =signed v1<==v2, COND c + \\\{ + cmp v1,v2 + jg label + define COND + \\\} + match =COND v1>==v2, COND c + \\\{ + cmp v1,v2 + jb label + define COND + \\\} + match =COND v1<==v2, COND c + \\\{ + cmp v1,v2 + ja label + define COND + \\\} + match =COND v1==v2, COND c + \\\{ + cmp v1,v2 + jne label + define COND + \\\} + match =COND v1<>v2, COND c + \\\{ + cmp v1,v2 + je label + define COND + \\\} + match =COND =signed v1>v2, COND c + \\\{ + cmp v1,v2 + jle label + define COND + \\\} + match =COND =signed v1<v2, COND c + \\\{ + cmp v1,v2 + jge label + define COND + \\\} + match =COND v1>v2, COND c + \\\{ + cmp v1,v2 + jbe label + define COND + \\\} + match =COND v1<v2, COND c + \\\{ + cmp v1,v2 + jae label + define COND + \\\} + match =COND =ZERO?, COND c + \\\{ + jnz label + define COND + \\\} + match =COND =CARRY?, COND c + \\\{ + jnc label + define COND + \\\} + match =COND =OVERFLOW?, COND c + \\\{ + jno label + define COND + \\\} + match =COND =SIGN?, COND c + \\\{ + jns label + define COND + \\\} + match =COND =PARITY?, COND c + \\\{ + jnp label + define COND + \\\} + match =COND v, COND c + \\\{ + if v eqtype 0 + if ~ v + jmp label + end if + else if v eqtype eax + test v,v + jz label + else + cmp v,0 + je label + end if + \\\} + \\} + \} +} + +macro define_JCONDEL +{ + macro JCONDEL label,cond + \{ + \local COND + match car=,cdr,:cond + \\{ + define_JNCONDEXPR + define_JCONDEXPR + define_JCONDEL + define_JNCONDEL + JCONDEXPR label,cond + purge JNCONDEXPR,JCONDEXPR,JCONDEL,JNCONDEL + define COND + \\} + match c,cond ; replace gt and lt + \\{ + match =COND =signed v1>==v2, COND c + \\\{ + cmp v1,v2 + jge label + define COND + \\\} + match =COND =signed v1<==v2, COND c + \\\{ + cmp v1,v2 + jle label + define COND + \\\} + match =COND v1>==v2, COND c + \\\{ + cmp v1,v2 + jae label + define COND + \\\} + match =COND v1<==v2, COND c + \\\{ + cmp v1,v2 + jbe label + define COND + \\\} + match =COND v1==v2, COND c + \\\{ + cmp v1,v2 + je label + define COND + \\\} + match =COND v1<>v2, COND c + \\\{ + cmp v1,v2 + jne label + define COND + \\\} + match =COND =signed v1>v2, COND c + \\\{ + cmp v1,v2 + jg label + define COND + \\\} + match =COND =signed v1<v2, COND c + \\\{ + cmp v1,v2 + jl label + define COND + \\\} + match =COND v1>v2, COND c + \\\{ + cmp v1,v2 + ja label + define COND + \\\} + match =COND v1<v2, COND c + \\\{ + cmp v1,v2 + jb label + define COND + \\\} + match =COND =ZERO?, COND c + \\\{ + jz label + define COND + \\\} + match =COND =CARRY?, COND c + \\\{ + jc label + define COND + \\\} + match =COND =OVERFLOW?, COND c + \\\{ + jo label + define COND + \\\} + match =COND =SIGN?, COND c + \\\{ + js label + define COND + \\\} + match =COND =PARITY?, COND c + \\\{ + jp label + define COND + \\\} + match =COND v, COND c + \\\{ + if v eqtype 0 + if v + jmp label + end if + else if v eqtype eax + test v,v + jnz label + else + cmp v,0 + jne label + end if + \\\} + \\} + \} +} + +define_JNCONDEXPR +define_JCONDEXPR +define_JNCONDEL +define_JCONDEL diff --git a/fasmw172/INCLUDE/MACRO/IMPORT32.INC b/fasmw172/INCLUDE/MACRO/IMPORT32.INC new file mode 100644 index 0000000..71f65e5 --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/IMPORT32.INC @@ -0,0 +1,68 @@ + +; Macroinstructions for making import section + +macro library [name,string] + { common + import.data: + forward + local _label + if defined name#.redundant + if ~ name#.redundant + dd RVA name#.lookup,0,0,RVA _label,RVA name#.address + end if + end if + name#.referred = 1 + common + dd 0,0,0,0,0 + forward + if defined name#.redundant + if ~ name#.redundant + _label db string,0 + rb RVA $ and 1 + end if + end if } + +macro import name,[label,string] + { common + rb (- rva $) and 3 + if defined name#.referred + name#.lookup: + forward + if used label + if string eqtype '' + local _label + dd RVA _label + else + dd 80000000h + string + end if + end if + common + if $ > name#.lookup + name#.redundant = 0 + dd 0 + else + name#.redundant = 1 + end if + name#.address: + forward + if used label + if string eqtype '' + label dd RVA _label + else + label dd 80000000h + string + end if + end if + common + if ~ name#.redundant + dd 0 + end if + forward + if used label & string eqtype '' + _label dw 0 + db string,0 + rb RVA $ and 1 + end if + common + end if } + +macro api [name] {} diff --git a/fasmw172/INCLUDE/MACRO/IMPORT64.INC b/fasmw172/INCLUDE/MACRO/IMPORT64.INC new file mode 100644 index 0000000..b03da5b --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/IMPORT64.INC @@ -0,0 +1,68 @@ + +; Macroinstructions for making import section (64-bit) + +macro library [name,string] + { common + import.data: + forward + local _label + if defined name#.redundant + if ~ name#.redundant + dd RVA name#.lookup,0,0,RVA _label,RVA name#.address + end if + end if + name#.referred = 1 + common + dd 0,0,0,0,0 + forward + if defined name#.redundant + if ~ name#.redundant + _label db string,0 + rb RVA $ and 1 + end if + end if } + +macro import name,[label,string] + { common + rb (- rva $) and 7 + if defined name#.referred + name#.lookup: + forward + if used label + if string eqtype '' + local _label + dq RVA _label + else + dq 8000000000000000h + string + end if + end if + common + if $ > name#.lookup + name#.redundant = 0 + dq 0 + else + name#.redundant = 1 + end if + name#.address: + forward + if used label + if string eqtype '' + label dq RVA _label + else + label dq 8000000000000000h + string + end if + end if + common + if ~ name#.redundant + dq 0 + end if + forward + if used label & string eqtype '' + _label dw 0 + db string,0 + rb RVA $ and 1 + end if + common + end if } + +macro api [name] {} diff --git a/fasmw172/INCLUDE/MACRO/MASM.INC b/fasmw172/INCLUDE/MACRO/MASM.INC new file mode 100644 index 0000000..b6ffe9a --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/MASM.INC @@ -0,0 +1,66 @@ + +; Simulate MASM's syntax + +struc struct + { struct . + name@struct equ . } + +struc ends + { match =.,name@struct \{ ends \} } + +struc proc [params] + { common define@proc .,<params> + name@proc equ . } + +struc endp + { match =.,name@proc \{ endp \} } + +macro option setting + { match =prologue:macro, setting \{ prologue@proc equ macro \} + match =epilogue:macro, setting \{ epilogue@proc equ macro \} } + +macro none procname,flag,parmbytes,localbytes,reglist { } + +macro assume params + { + local expr + define expr params + match reg:struct, expr + \{ + match assumed, reg\#@assumed \\{ irp name, assumed \\\{ restore name \\\} \\} + macro label . \\{ local def + define def . + match =reg =at label, def \\\{ define def \\\} + match name at,def \\\{ def@assumed reg,name,label at + define def \\\} + match name,def \\\{ def@assumed reg,.,: \\\} \\} + struc db [val] \\{ \common def@assumed reg,.,<db val> \\} + struc dw [val] \\{ \common def@assumed reg,.,<dw val> \\} + struc dp [val] \\{ \common def@assumed reg,.,<dp val> \\} + struc dd [val] \\{ \common def@assumed reg,.,<dd val> \\} + struc dt [val] \\{ \common def@assumed reg,.,<dt val> \\} + struc dq [val] \\{ \common def@assumed reg,.,<dq val> \\} + struc rb cnt \\{ def@assumed reg,.,rb cnt \\} + struc rw cnt \\{ def@assumed reg,.,rw cnt \\} + struc rp cnt \\{ def@assumed reg,.,rp cnt \\} + struc rd cnt \\{ def@assumed reg,.,rd cnt \\} + struc rt cnt \\{ def@assumed reg,.,rt cnt \\} + struc rq cnt \\{ def@assumed reg,.,rq cnt \\} + reg\#@assumed equ + virtual at reg + reg struct + end virtual + purge label + restruc db,dw,dp,dd,dt,dq + restruc rb,rw,rp,rd,rt,rq \} } + +macro def@assumed reg,name,def + { match vars, reg#@assumed \{ reg#@assumed equ reg#@assumed, \} + reg#@assumed equ reg#@assumed name + local ..label + name equ ..label + ..label def } + +struc label type { label . type } + +struc none { label . } diff --git a/fasmw172/INCLUDE/MACRO/PROC32.INC b/fasmw172/INCLUDE/MACRO/PROC32.INC new file mode 100644 index 0000000..f936d98 --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/PROC32.INC @@ -0,0 +1,301 @@ + +; Macroinstructions for defining and calling procedures + +macro stdcall proc,[arg] ; directly call STDCALL procedure + { common + if ~ arg eq + reverse + pushd arg + common + end if + call proc } + +macro invoke proc,[arg] ; indirectly call STDCALL procedure + { common + if ~ arg eq + reverse + pushd arg + common + end if + call [proc] } + +macro ccall proc,[arg] ; directly call CDECL procedure + { common + size@ccall = 0 + if ~ arg eq + reverse + pushd arg + size@ccall = size@ccall+4 + common + end if + call proc + if size@ccall + add esp,size@ccall + end if } + +macro cinvoke proc,[arg] ; indirectly call CDECL procedure + { common + size@ccall = 0 + if ~ arg eq + reverse + pushd arg + size@ccall = size@ccall+4 + common + end if + call [proc] + if size@ccall + add esp,size@ccall + end if } + +macro proc [args] ; define procedure + { common + match name params, args> + \{ define@proc name,<params \} } + +prologue@proc equ prologuedef + +macro prologuedef procname,flag,parmbytes,localbytes,reglist + { local loc + loc = (localbytes+3) and (not 3) + parmbase@proc equ ebp+8 + localbase@proc equ ebp-loc + if parmbytes | localbytes + push ebp + mov ebp,esp + if localbytes + sub esp,loc + end if + end if + irps reg, reglist \{ push reg \} } + +epilogue@proc equ epiloguedef + +macro epiloguedef procname,flag,parmbytes,localbytes,reglist + { irps reg, reglist \{ reverse pop reg \} + if parmbytes | localbytes + leave + end if + if flag and 10000b + retn + else + retn parmbytes + end if } + +close@proc equ + +macro define@proc name,statement + { local params,flag,regs,parmbytes,localbytes,current + if used name + name: + match =stdcall args, statement \{ params equ args + flag = 11b \} + match =stdcall, statement \{ params equ + flag = 11b \} + match =c args, statement \{ params equ args + flag = 10001b \} + match =c, statement \{ params equ + flag = 10001b \} + match =params, params \{ params equ statement + flag = 0 \} + match =uses reglist=,args, params \{ regs equ reglist + params equ args \} + match =regs =uses reglist, regs params \{ regs equ reglist + params equ \} + match =regs, regs \{ regs equ \} + match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \} + virtual at parmbase@proc + match =,args, params \{ defargs@proc args \} + match =args@proc args, args@proc params \{ defargs@proc args \} + parmbytes = $-(parmbase@proc) + end virtual + name # % = parmbytes/4 + all@vars equ + current = 0 + macro locals + \{ virtual at localbase@proc+current + macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\} + struc db [val] \\{ \common deflocal@proc .,db,val \\} + struc du [val] \\{ \common deflocal@proc .,du,val \\} + struc dw [val] \\{ \common deflocal@proc .,dw,val \\} + struc dp [val] \\{ \common deflocal@proc .,dp,val \\} + struc dd [val] \\{ \common deflocal@proc .,dd,val \\} + struc dt [val] \\{ \common deflocal@proc .,dt,val \\} + struc dq [val] \\{ \common deflocal@proc .,dq,val \\} + struc rb cnt \\{ deflocal@proc .,rb cnt, \\} + struc rw cnt \\{ deflocal@proc .,rw cnt, \\} + struc rp cnt \\{ deflocal@proc .,rp cnt, \\} + struc rd cnt \\{ deflocal@proc .,rd cnt, \\} + struc rt cnt \\{ deflocal@proc .,rt cnt, \\} + struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \} + macro endl + \{ purge label + restruc db,du,dw,dp,dd,dt,dq + restruc rb,rw,rp,rd,rt,rq + current = $-(localbase@proc) + end virtual \} + macro ret operand + \{ match any, operand \\{ retn operand \\} + match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} + macro finish@proc + \{ localbytes = current + match close:reglist, close@proc:<regs> \\{ close name,flag,parmbytes,localbytes,reglist \\} + end if \} } + +macro defargs@proc [arg] + { common + if ~ arg eq + forward + local ..arg,current@arg + match argname:type, arg + \{ current@arg equ argname + label ..arg type + argname equ ..arg + if qqword eq type + dd ?,?,?,?,?,?,?,? + else if dqword eq type + dd ?,?,?,? + else if tbyte eq type + dd ?,?,? + else if qword eq type | pword eq type + dd ?,? + else + dd ? + end if \} + match =current@arg,current@arg + \{ current@arg equ arg + arg equ ..arg + ..arg dd ? \} + common + args@proc equ current@arg + forward + restore current@arg + common + end if } + +macro deflocal@proc name,def,[val] { name def val } + +macro deflocal@proc name,def,[val] + { common + match vars, all@vars \{ all@vars equ all@vars, \} + all@vars equ all@vars name + forward + local ..var,..tmp + ..var def val + match =?, val \{ ..tmp equ \} + match any =?, val \{ ..tmp equ \} + match any (=?), val \{ ..tmp equ \} + match =label, def \{ ..tmp equ \} + match tmp : value, ..tmp : val + \{ tmp: end virtual + initlocal@proc ..var,def value + virtual at tmp\} + common + match first rest, ..var, \{ name equ first \} } + +struc label type { label . type } + +macro initlocal@proc name,def + { virtual at name + def + size@initlocal = $ - name + end virtual + position@initlocal = 0 + while size@initlocal > position@initlocal + virtual at name + def + if size@initlocal - position@initlocal < 2 + current@initlocal = 1 + load byte@initlocal byte from name+position@initlocal + else if size@initlocal - position@initlocal < 4 + current@initlocal = 2 + load word@initlocal word from name+position@initlocal + else + current@initlocal = 4 + load dword@initlocal dword from name+position@initlocal + end if + end virtual + if current@initlocal = 1 + mov byte [name+position@initlocal],byte@initlocal + else if current@initlocal = 2 + mov word [name+position@initlocal],word@initlocal + else + mov dword [name+position@initlocal],dword@initlocal + end if + position@initlocal = position@initlocal + current@initlocal + end while } + +macro endp + { purge ret,locals,endl + finish@proc + purge finish@proc + restore regs@proc + match all,args@proc \{ restore all \} + restore args@proc + match all,all@vars \{ restore all \} } + +macro local [var] + { common + locals + forward done@local equ + match varname[count]:vartype, var + \{ match =BYTE, vartype \\{ varname rb count + restore done@local \\} + match =WORD, vartype \\{ varname rw count + restore done@local \\} + match =DWORD, vartype \\{ varname rd count + restore done@local \\} + match =PWORD, vartype \\{ varname rp count + restore done@local \\} + match =QWORD, vartype \\{ varname rq count + restore done@local \\} + match =TBYTE, vartype \\{ varname rt count + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + rq count*2 + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + rq count*4 + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + rq count*2 + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + rq count*4 + restore done@local \\} + match , done@local \\{ virtual + varname vartype + end virtual + rb count*sizeof.\#vartype + restore done@local \\} \} + match :varname:vartype, done@local:var + \{ match =BYTE, vartype \\{ varname db ? + restore done@local \\} + match =WORD, vartype \\{ varname dw ? + restore done@local \\} + match =DWORD, vartype \\{ varname dd ? + restore done@local \\} + match =PWORD, vartype \\{ varname dp ? + restore done@local \\} + match =QWORD, vartype \\{ varname dq ? + restore done@local \\} + match =TBYTE, vartype \\{ varname dt ? + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + dq ?,? + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + dq ?,?,?,? + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + dq ?,? + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + dq ?,?,?,? + restore done@local \\} + match , done@local \\{ varname vartype + restore done@local \\} \} + match ,done@local + \{ var + restore done@local \} + common + endl } diff --git a/fasmw172/INCLUDE/MACRO/PROC64.INC b/fasmw172/INCLUDE/MACRO/PROC64.INC new file mode 100644 index 0000000..68b78ed --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/PROC64.INC @@ -0,0 +1,618 @@ + +; Macroinstructions for defining and calling procedures (x64 version) + +macro invoke proc,[arg] + { common fastcall [proc],arg } + +macro fastcall proc,[arg] + { common local stackspace,argscount,counter + if argscount < 4 + stackspace = 4*8 + else if argscount and 1 + stackspace = (argscount+1)*8 + else + stackspace = argscount*8 + end if + counter = 0 + if stackspace + if defined current@frame + if current@frame<stackspace + current@frame = stackspace + end if + else + if stackspace + sub rsp,stackspace + end if + end if + end if + forward + counter = counter + 1 + define type@param + define definition@param arg + match =float value,definition@param + \{ define definition@param value + define type@param float \} + match =addr value,definition@param + \{ define definition@param value + define type@param addr \} + match any=,any,definition@param + \{ \local ..string,..continue + jmp ..continue + align sizeof.TCHAR + ..string TCHAR definition@param,0 + ..continue: + define definition@param ..string + define type@param addr \} + match any,definition@param + \{ match \`any,any + \\{ \\local ..string,..continue + jmp ..continue + align sizeof.TCHAR + ..string TCHAR definition@param,0 + ..continue: + define definition@param ..string + define type@param addr \\} \} + match param,definition@param + \{ local opcode,origin + size@param = 0 + if param eqtype 0 | param eqtype 0f | type@param eq addr + size@param = 8 + else if param eqtype byte 0 | param eqtype byte 0f + match prefix value,definition@param + \\{ if prefix eq qword + size@param = 8 + else if prefix eq dword + size@param = 4 + else if prefix eq word + size@param = 2 + else if prefix eq byte + size@param = 1 + end if \\} + else if ~ param in <xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15> + virtual + origin = $ + inc param + load opcode byte from origin + if opcode = 67h | opcode = 41h + load opcode byte from origin+1 + end if + if opcode and 0F8h = 48h + size@param = 8 + else if opcode = 66h + size@param = 2 + else if opcode = 0FFh + size@param = 4 + else + size@param = 1 + end if + end virtual + end if + if counter = 1 + if type@param eq float + if ~ param eq xmm0 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm0,eax + else + movd xmm0,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm0,rax + else + movq xmm0,param + end if + end if + end if + if vararg@fastcall & ~ param eq rcx + movq rcx,xmm0 + end if + else if type@param eq addr + if ~ param eq rcx + lea rcx,[param] + end if + else if size@param = 8 + if ~ param eq rcx + mov rcx,param + end if + else if size@param = 4 + if ~ param eq ecx + mov ecx,param + end if + else if size@param = 2 + if ~ param eq cx + mov cx,param + end if + else if size@param = 1 + if ~ param eq cl + mov cl,param + end if + end if + else if counter = 2 + if type@param eq float + if ~ param eq xmm1 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm1,eax + else + movd xmm1,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm1,rax + else + movq xmm1,param + end if + end if + end if + if vararg@fastcall & ~ param eq rdx + movq rdx,xmm1 + end if + else if type@param eq addr + if ~ param eq rdx + lea rdx,[param] + end if + else if size@param = 8 + if ~ param eq rdx + mov rdx,param + end if + else if size@param = 4 + if ~ param eq edx + mov edx,param + end if + else if size@param = 2 + if ~ param eq dx + mov dx,param + end if + else if size@param = 1 + if ~ param eq dl + mov dl,param + end if + end if + else if counter = 3 + if type@param eq float + if ~ param eq xmm2 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm2,eax + else + movd xmm2,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm2,rax + else + movq xmm2,param + end if + end if + end if + if vararg@fastcall & ~ param eq r8 + movq r8,xmm2 + end if + else if type@param eq addr + if ~ param eq r8 + lea r8,[param] + end if + else if size@param = 8 + if ~ param eq r8 + mov r8,param + end if + else if size@param = 4 + if ~ param eq r8d + mov r8d,param + end if + else if size@param = 2 + if ~ param eq r8w + mov r8w,param + end if + else if size@param = 1 + if ~ param eq r8b + mov r8b,param + end if + end if + else if counter = 4 + if type@param eq float + if ~ param eq xmm3 + if size@param = 4 + if param eqtype byte 0 | param eqtype byte 0f + mov eax,param + movd xmm3,eax + else + movd xmm3,param + end if + else + if param eqtype 0 | param eqtype 0f | param eqtype byte 0 | param eqtype byte 0f + mov rax,param + movq xmm3,rax + else + movq xmm3,param + end if + end if + end if + if vararg@fastcall & ~ param eq r9 + movq r9,xmm3 + end if + else if type@param eq addr + if ~ param eq r9 + lea r9,[param] + end if + else if size@param = 8 + if ~ param eq r9 + mov r9,param + end if + else if size@param = 4 + if ~ param eq r9d + mov r9d,param + end if + else if size@param = 2 + if ~ param eq r9w + mov r9w,param + end if + else if size@param = 1 + if ~ param eq r9b + mov r9b,param + end if + end if + else + if type@param eq addr + lea rax,[param] + mov [rsp+(counter-1)*8],rax + else if param eqtype [0] | param eqtype byte [0] + if size@param = 8 + mov rax,param + mov [rsp+(counter-1)*8],rax + else if size@param = 4 + mov eax,param + mov [rsp+(counter-1)*8],eax + else if size@param = 2 + mov ax,param + mov [rsp+(counter-1)*8],ax + else + mov al,param + mov [rsp+(counter-1)*8],al + end if + else if size@param = 8 + virtual + origin = $ + mov rax,param + load opcode byte from origin+1 + end virtual + if opcode = 0B8h + mov rax,param + mov [rsp+(counter-1)*8],rax + else + mov qword [rsp+(counter-1)*8],param + end if + else if param in <xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15> + movq [rsp+(counter-1)*8],param + else + mov [rsp+(counter-1)*8],param + end if + end if \} + common + argscount = counter + call proc + if stackspace & ~defined current@frame + add rsp,stackspace + end if } + +macro proc [args] + { common + match name params, args> + \{ define@proc name,<params \} } + +prologue@proc equ prologuedef + +macro prologuedef procname,flag,parmbytes,localbytes,reglist + { local loc,fill,counter + loc = (localbytes+15) and (not 15) + parmbase@proc equ rbp+16 + localbase@proc equ rbp-loc + push rbp + mov rbp,rsp + if loc+fill + sub rsp,loc+fill + end if + counter = 0 + irps reg, reglist \{ push reg + counter = counter+1 \} + fill = 8*(counter and 1) } + +epilogue@proc equ epiloguedef + +macro epiloguedef procname,flag,parmbytes,localbytes,reglist + { irps reg, reglist \{ reverse pop reg \} + leave + retn } + +close@proc equ + +macro define@proc name,statement + { local params,flag,regs,parmbytes,localbytes,current + if used name + name: + match =stdcall args, statement \{ params equ args + flag = 11b \} + match =stdcall, statement \{ params equ + flag = 11b \} + match =c args, statement \{ params equ args + flag = 10001b \} + match =c, statement \{ params equ + flag = 10001b \} + match =params, params \{ params equ statement + flag = 10000b \} + match =uses reglist=,args, params \{ regs equ reglist + params equ args \} + match =regs =uses reglist, regs params \{ regs equ reglist + params equ \} + match =regs, regs \{ regs equ \} + match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \} + virtual at parmbase@proc + match =,args, params \{ defargs@proc args \} + match =args@proc args, args@proc params \{ defargs@proc args \} + parmbytes = $-(parmbase@proc) + end virtual + name # % = parmbytes/8 + all@vars equ + current = 0 + macro locals + \{ virtual at localbase@proc+current + macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\} + struc db [val] \\{ \common deflocal@proc .,db,val \\} + struc du [val] \\{ \common deflocal@proc .,du,val \\} + struc dw [val] \\{ \common deflocal@proc .,dw,val \\} + struc dp [val] \\{ \common deflocal@proc .,dp,val \\} + struc dd [val] \\{ \common deflocal@proc .,dd,val \\} + struc dt [val] \\{ \common deflocal@proc .,dt,val \\} + struc dq [val] \\{ \common deflocal@proc .,dq,val \\} + struc rb cnt \\{ deflocal@proc .,rb cnt, \\} + struc rw cnt \\{ deflocal@proc .,rw cnt, \\} + struc rp cnt \\{ deflocal@proc .,rp cnt, \\} + struc rd cnt \\{ deflocal@proc .,rd cnt, \\} + struc rt cnt \\{ deflocal@proc .,rt cnt, \\} + struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \} + macro endl + \{ purge label + restruc db,du,dw,dp,dd,dt,dq + restruc rb,rw,rp,rd,rt,rq + current = $-(localbase@proc) + end virtual \} + macro ret operand + \{ match any, operand \\{ retn operand \\} + match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} + macro finish@proc + \{ localbytes = current + match close:reglist, close@proc:<regs> \\{ close name,flag,parmbytes,localbytes,reglist \\} + end if \} } + +macro defargs@proc [arg] + { common + if ~ arg eq + forward + local ..arg,current@arg + match argname:type, arg + \{ current@arg equ argname + label ..arg type + argname equ ..arg + if qqword eq type + dq ?,?,?,? + else if dqword eq type + dq ?,? + else if tbyte eq type + dq ?,? + else + dq ? + end if \} + match =current@arg,current@arg + \{ current@arg equ arg + arg equ ..arg + ..arg dq ? \} + common + args@proc equ current@arg + forward + restore current@arg + common + end if } + +macro deflocal@proc name,def,[val] { name def val } + +macro deflocal@proc name,def,[val] + { common + match vars, all@vars \{ all@vars equ all@vars, \} + all@vars equ all@vars name + forward + local ..var,..tmp + ..var def val + match =?, val \{ ..tmp equ \} + match any =?, val \{ ..tmp equ \} + match any (=?), val \{ ..tmp equ \} + match =label, def \{ ..tmp equ \} + match tmp : value, ..tmp : val + \{ tmp: end virtual + initlocal@proc ..var,def value + virtual at tmp\} + common + match first rest, ..var, \{ name equ first \} } + +struc label type { label . type } + +macro initlocal@proc name,def + { virtual at name + def + size@initlocal = $ - name + end virtual + position@initlocal = 0 + while size@initlocal > position@initlocal + virtual at name + def + if size@initlocal - position@initlocal < 2 + current@initlocal = 1 + load byte@initlocal byte from name+position@initlocal + else if size@initlocal - position@initlocal < 4 + current@initlocal = 2 + load word@initlocal word from name+position@initlocal + else if size@initlocal - position@initlocal < 8 + current@initlocal = 4 + load dword@initlocal dword from name+position@initlocal + else + load qword@initlocal qword from name+position@initlocal + if ( qword@initlocal > 0 & qword@initlocal < 80000000h ) | ( qword@initlocal < 0 & qword@initlocal >= -80000000h ) + current@initlocal = 8 + else + current@initlocal = 4 + dword@initlocal = qword@initlocal and 0FFFFFFFFh + end if + end if + end virtual + if current@initlocal = 1 + mov byte [name+position@initlocal],byte@initlocal + else if current@initlocal = 2 + mov word [name+position@initlocal],word@initlocal + else if current@initlocal = 4 + mov dword [name+position@initlocal],dword@initlocal + else + mov qword [name+position@initlocal],qword@initlocal + end if + position@initlocal = position@initlocal + current@initlocal + end while } + +macro endp + { purge ret,locals,endl + finish@proc + purge finish@proc + restore regs@proc + match all,args@proc \{ restore all \} + restore args@proc + match all,all@vars \{ restore all \} } + +macro local [var] + { common + locals + forward done@local equ + match varname[count]:vartype, var + \{ match =BYTE, vartype \\{ varname rb count + restore done@local \\} + match =WORD, vartype \\{ varname rw count + restore done@local \\} + match =DWORD, vartype \\{ varname rd count + restore done@local \\} + match =PWORD, vartype \\{ varname rp count + restore done@local \\} + match =QWORD, vartype \\{ varname rq count + restore done@local \\} + match =TBYTE, vartype \\{ varname rt count + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + rq count*2 + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + rq count*4 + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + rq count*2 + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + rq count*4 + restore done@local \\} + match , done@local \\{ virtual + varname vartype + end virtual + rb count*sizeof.\#vartype + restore done@local \\} \} + match :varname:vartype, done@local:var + \{ match =BYTE, vartype \\{ varname db ? + restore done@local \\} + match =WORD, vartype \\{ varname dw ? + restore done@local \\} + match =DWORD, vartype \\{ varname dd ? + restore done@local \\} + match =PWORD, vartype \\{ varname dp ? + restore done@local \\} + match =QWORD, vartype \\{ varname dq ? + restore done@local \\} + match =TBYTE, vartype \\{ varname dt ? + restore done@local \\} + match =DQWORD, vartype \\{ label varname dqword + dq ?,? + restore done@local \\} + match =QQWORD, vartype \\{ label varname qqword + dq ?,?,?,? + restore done@local \\} + match =XWORD, vartype \\{ label varname xword + dq ?,? + restore done@local \\} + match =YWORD, vartype \\{ label varname yword + dq ?,?,?,? + restore done@local \\} + match , done@local \\{ varname vartype + restore done@local \\} \} + match ,done@local + \{ var + restore done@local \} + common + endl } + +macro frame + { local size,current + if size + sub rsp,size + end if + current = 0 + current@frame equ current + size@frame equ size } + +macro endf + { size@frame = current@frame + if size@frame + add rsp,size@frame + end if + restore size@frame,current@frame } + +macro static_rsp_prologue procname,flag,parmbytes,localbytes,reglist + { local counter,loc,frame,current + counter = 0 + irps reg, reglist \{ push reg + counter = counter+1 \} + loc = (localbytes+7) and (not 7) + if frame & (counter+loc shr 3+1) and 1 + loc = loc + 8 + end if + framebytes@proc equ frame+loc + if framebytes@proc + sub rsp,framebytes@proc + end if + localbase@proc equ rsp+frame + regsbase@proc equ rsp+frame+loc + parmbase@proc equ rsp+frame+loc+counter*8+8 + current = 0 + current@frame equ current + size@frame equ frame } + +macro static_rsp_epilogue procname,flag,parmbytes,localbytes,reglist + { if framebytes@proc + add rsp,framebytes@proc + end if + irps reg, reglist \{ reverse pop reg \} + retn } + +macro static_rsp_close procname,flag,parmbytes,localbytes,reglist + { size@frame = current@frame + restore size@frame,current@frame } + +stdcall fix fastcall + +macro cinvoke proc,[arg] + { common ccall [proc],arg } + +macro ccall proc,[arg] + { common vararg@fastcall = 1 + fastcall proc,arg + vararg@fastcall = 0 } + +vararg@fastcall = 0 \ No newline at end of file diff --git a/fasmw172/INCLUDE/MACRO/RESOURCE.INC b/fasmw172/INCLUDE/MACRO/RESOURCE.INC new file mode 100644 index 0000000..920754b --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/RESOURCE.INC @@ -0,0 +1,334 @@ + +; Macroinstructions for making resource section + +macro directory [type,label] + { common + local max,count + count = 0 + max = 0 + forward + count = count + 1 + if type > max + max = type + end if + common + root@resource dd 0,%t,0,count shl 16 + repeat max + forward + if % = type + dd type,80000000h+label-root@resource + end if + common + end repeat } + +macro resource dir,[id,lang,label] + { common + dir: + local min,max,count,current + forward + min = id + max = id + common + count = 0 + forward + count = count + 1 + if id < min + min = id + else if id > max + max = id + end if + common + dd 0,%t,0,count shl 16 + repeat max-min+1 + current = $ + forward + if min+%-1 = id + if current = $ + dd id,80000000h+label#.directory-root@resource + end if + end if + common + end repeat + repeat max-min+1 + current = $ + forward + if min+%-1 = id + if current = $ + label#.directory dd 0,%t,0,10000h,lang,label-root@resource + count = 1 + else + dd lang,label-root@resource + count = count + 1 + end if + end if + label#.resid = id + common + local x,y,z,v1,v2 + if count > 1 + store word count at current+0Eh + x = count shr 1 + while x > 0 + y = x + while y < count + z = y + while z-x >= 0 + load v1 dword from current+10h+z*8 + load v2 dword from current+10h+(z-x)*8 + if v1<v2 + store dword v1 at current+10h+(z-x)*8 + store dword v2 at current+10h+z*8 + load v1 dword from current+10h+z*8+4 + load v2 dword from current+10h+(z-x)*8+4 + store dword v1 at current+10h+(z-x)*8+4 + store dword v2 at current+10h+z*8+4 + else + break + end if + z = z-x + end while + y = y+1 + end while + x = x shr 1 + end while + end if + end repeat } + +macro bitmap label,bitmap_file + { local data,size + label dd RVA data,size,0,0 + data file bitmap_file:0Eh + size = $ - data + align 4 } + +macro icon group,[label,icon_file] + { common local count + count = 0 + forward local data,size,position + label dd RVA data,size,0,0 + virtual at 0 + file icon_file:6,16 + load size dword from 8 + load position dword from 12 + end virtual + data file icon_file:position,size + count = count+1 + common local header + align 4 + group dd RVA header,6+count*14,0,0 + header dw 0,1,count + forward + file icon_file:6,12 + dw label#.resid + common + align 4 } + +macro cursor group,[label,cursor_file] + { common local count + count = 0 + forward local data,width,height,size,position + label dd RVA data,size+4,0,0 + virtual at 0 + file cursor_file:6,16 + load width byte from 0 + load height byte from 1 + load size dword from 8 + load position dword from 12 + end virtual + data file cursor_file:10,4 + file cursor_file:position,size + count = count+1 + common local header + align 4 + group dd RVA header,6+count*14,0,0 + header dw 0,2,count + forward + dw width,height,1,0 + dd size+4 + dw label#.resid + common + align 4 } + +macro menu label + { local data,size + label dd RVA data,size,0,0 + data dw 1,4,0,0 + menu_size equ size = $ - data + menu_level = 1 } + +macro menuitem string,id,resinfo,status,type + { dd MFT_STRING or type+0,status+0,id + dw resinfo+0 + du string,0 + align 4 + if ~ resinfo eq + if resinfo and MFR_END + menu_level = menu_level - 1 + end if + if resinfo and MFR_POPUP + menu_level = menu_level + 1 + dd 0 + end if + end if + if menu_level = 0 + menu_size + end if } + +macro menuseparator resinfo + { dd MFT_SEPARATOR,0,0 + dw resinfo+0,0 + if ~ resinfo eq + if resinfo and MFR_END + menu_level = menu_level - 1 + end if + end if + if menu_level = 0 + menu_size + end if } + +macro dialog label,title,x,y,cx,cy,style,exstyle,menu,fontname,fontsize + { local data,size,items + label dd RVA data,size,0,0 + data dd style or DS_SETFONT,exstyle +0 + dw items,x,y,cx,cy + if menu+0 <> 0 + dw 0FFFFh + end if + du menu+0,0,title,0 + if fontname eq + du 8,'MS Sans Serif',0 + else + du fontsize+0,fontname,0 + end if + align 4 + dialog_size equ size = $ - data + dialog_items equ items = dialog_items_counter + dialog_items_counter = 0 } + +macro dialogitem class,title,id,x,y,cx,cy,style,exstyle + { dd style or WS_CHILD,exstyle +0 + dw x,y,cx,cy,id + if class eq 'BUTTON' + dw 0FFFFh,80h + else if class eq 'EDIT' + dw 0FFFFh,81h + else if class eq 'STATIC' + dw 0FFFFh,82h + else if class eq 'LISTBOX' + dw 0FFFFh,83h + else if class eq 'SCROLLBAR' + dw 0FFFFh,84h + else if class eq 'COMBOBOX' + dw 0FFFFh,85h + else + du class,0 + end if + if title eqtype 0 + dw 0FFFFh,title + else + du title,0 + end if + dw 0 + align 4 + dialog_items_counter = dialog_items_counter + 1 } + +macro enddialog + { dialog_items + dialog_size } + +macro accelerator label,[fvirt,key,cmd] + { common + local data,size + label dd RVA data,size,0,0 + data: + accel_count = 0 + forward + accel_count = accel_count + 1 + common + size = accel_count * 8 + forward + accel_count = accel_count - 1 + if accel_count = 0 + dw fvirt or 80h,key + else + dw fvirt,key + end if + dd cmd } + +macro versioninfo label,fileos,filetype,filesubtype,lang,cp,[name,value] + { common + local data,size,vivalue,visize + label dd RVA data,size,0,0 + data dw size,visize,0 + du 'VS_VERSION_INFO',0,0 + vivalue dd 0FEEF04BDh,00010000h + local version,count,shift,char,filever,productver + filever = 0 + productver = 0 + forward + if name eq 'FileVersion' | name eq 'ProductVersion' + virtual at 0 + db value + count = $ + version = 0 + shift = 16 + repeat count + load char from %-1 + if char='.' + if shift mod 32 + shift = shift-16 + else + shift = shift+32+16 + end if + else + version = (version and not (0FFFFh shl shift)) or ((version shr shift and 0FFFFh)*10+char-'0') shl shift + end if + end repeat + end virtual + if name eq 'FileVersion' + filever = version + else if name eq 'ProductVersion' + productver = version + end if + end if + common + dq filever,productver + dd 0,0,fileos,filetype+0,filesubtype+0,0,0 + visize = $ - vivalue + local sfi_data,sfi_size + sfi_data dd sfi_size + du 1,'StringFileInfo',0 + local str_data,str_size + str_data dd str_size + du 1,'040904E4',0 + forward + local vs_data,vs_size,value_data,value_size + align 4 + vs_data dw vs_size,value_size/2 + du 1,name,0 + align 4 + value_data du value,0 + value_size = $ - value_data + vs_size = $ - vs_data + common + align 4 + str_size = $ - str_data + sfi_size = $ - sfi_data + local vfi_data,vfi_size,var_data,var_size + vfi_data dd vfi_size + du 1,'VarFileInfo',0,0 + var_data dw var_size,4 + du 0,'Translation',0,0 + dw lang,cp+0 + var_size = $ - var_data + vfi_size = $ - vfi_data + size = $ - data } + +macro resdata label +{ local data,size + label dd RVA data,size,0,0 + data = $ + ressize equ size = $ - data } + +macro endres +{ ressize + align 4 } diff --git a/fasmw172/INCLUDE/MACRO/STRUCT.INC b/fasmw172/INCLUDE/MACRO/STRUCT.INC new file mode 100644 index 0000000..0db41d9 --- /dev/null +++ b/fasmw172/INCLUDE/MACRO/STRUCT.INC @@ -0,0 +1,221 @@ + +; Macroinstructions for defining data structures + +macro struct name + { virtual at 0 + define @struct + field@struct equ name + match child parent, name \{ restore field@struct + field@struct equ child,fields@\#parent \} + sub@struct equ + struc db [val] \{ \common define field@struct .,db,<val> \} + struc dw [val] \{ \common define field@struct .,dw,<val> \} + struc du [val] \{ \common define field@struct .,du,<val> \} + struc dd [val] \{ \common define field@struct .,dd,<val> \} + struc dp [val] \{ \common define field@struct .,dp,<val> \} + struc dq [val] \{ \common define field@struct .,dq,<val> \} + struc dt [val] \{ \common define field@struct .,dt,<val> \} + struc rb count \{ define field@struct .,db,count dup (?) \} + struc rw count \{ define field@struct .,dw,count dup (?) \} + struc rd count \{ define field@struct .,dd,count dup (?) \} + struc rp count \{ define field@struct .,dp,count dup (?) \} + struc rq count \{ define field@struct .,dq,count dup (?) \} + struc rt count \{ define field@struct .,dt,count dup (?) \} + macro db [val] \{ \common \local anonymous + define field@struct anonymous,db,<val> \} + macro dw [val] \{ \common \local anonymous + define field@struct anonymous,dw,<val> \} + macro du [val] \{ \common \local anonymous + define field@struct anonymous,du,<val> \} + macro dd [val] \{ \common \local anonymous + define field@struct anonymous,dd,<val> \} + macro dp [val] \{ \common \local anonymous + define field@struct anonymous,dp,<val> \} + macro dq [val] \{ \common \local anonymous + define field@struct anonymous,dq,<val> \} + macro dt [val] \{ \common \local anonymous + define field@struct anonymous,dt,<val> \} + macro rb count \{ \local anonymous + define field@struct anonymous,db,count dup (?) \} + macro rw count \{ \local anonymous + define field@struct anonymous,dw,count dup (?) \} + macro rd count \{ \local anonymous + define field@struct anonymous,dd,count dup (?) \} + macro rp count \{ \local anonymous + define field@struct anonymous,dp,count dup (?) \} + macro rq count \{ \local anonymous + define field@struct anonymous,dq,count dup (?) \} + macro rt count \{ \local anonymous + define field@struct anonymous,dt,count dup (?) \} + macro union \{ field@struct equ ,union,< + sub@struct equ union \} + macro struct \{ field@struct equ ,substruct,< + sub@struct equ substruct \} } + +macro ends + { match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt + restruc rb,rw,rd,rp,rq,rt + purge db,dw,du,dd,dp,dq,dt + purge rb,rw,rd,rp,rq,rt + purge union,struct + irpv fields,field@struct \\{ restore field@struct + \\common define fields@struct fields \\} + match name tail,fields@struct, \\{ if $ + display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah + err + end if \\} + match name=,fields,fields@struct \\{ restore @struct + make@struct name,fields + define fields@\\#name fields \\} + end virtual \} + match any, sub@struct \{ tmp@struct equ field@struct + restore field@struct + field@struct equ tmp@struct> \} + restore sub@struct } + +macro make@struct name,[field,type,def] + { common + local define + define equ name + forward + local sub + match , field \{ make@substruct type,name,sub def + define equ define,.,sub, \} + match any, field \{ define equ define,.#field,type,<def> \} + common + match fields, define \{ define@struct fields \} } + +macro define@struct name,[field,type,def] + { common + virtual + db `name + load initial@struct byte from 0 + if initial@struct = '.' + display 'Error: name of structure should not begin with a dot.',0Dh,0Ah + err + end if + end virtual + local list + list equ + forward + if ~ field eq . + name#field type def + sizeof.#name#field = $ - name#field + else + label name#.#type + rb sizeof.#type + end if + local value + match any, list \{ list equ list, \} + list equ list <value> + common + sizeof.#name = $ + restruc name + match values, list \{ + struc name value \\{ \\local \\..base + match , @struct \\\{ define field@struct .,name,<values> \\\} + match no, @struct \\\{ label \\..base + forward + match , value \\\\{ field type def \\\\} + match any, value \\\\{ field type value + if ~ field eq . + rb sizeof.#name#field - ($-field) + end if \\\\} + common label . at \\..base \\\} + \\} + macro name value \\{ + match , @struct \\\{ \\\local anonymous + define field@struct anonymous,name,<values> \\\} + match no, @struct \\\{ + forward + match , value \\\\{ type def \\\\} + match any, value \\\\{ \\\\local ..field + ..field = $ + type value + if ~ field eq . + rb sizeof.#name#field - ($-..field) + end if \\\\} + common \\\} \\} \} } + +macro enable@substruct + { macro make@substruct substruct,parent,name,[field,type,def] + \{ \common + \local define + define equ parent,name + \forward + \local sub + match , field \\{ match any, type \\\{ enable@substruct + make@substruct type,parent,sub def + purge make@substruct + define equ define,.,sub, \\\} \\} + match any, field \\{ define equ define,.\#field,type,<def> \\} + \common + match fields, define \\{ define@\#substruct fields \\} \} } + +enable@substruct + +macro define@union parent,name,[field,type,def] + { common + virtual at parent#.#name + forward + if ~ field eq . + virtual at parent#.#name + parent#field type def + sizeof.#parent#field = $ - parent#field + end virtual + if sizeof.#parent#field > $ - parent#.#name + rb sizeof.#parent#field - ($ - parent#.#name) + end if + else + virtual at parent#.#name + label parent#.#type + type def + end virtual + label name#.#type at parent#.#name + if sizeof.#type > $ - parent#.#name + rb sizeof.#type - ($ - parent#.#name) + end if + end if + common + sizeof.#name = $ - parent#.#name + end virtual + struc name [value] \{ \common + label .\#name + last@union equ + forward + match any, last@union \\{ virtual at .\#name + field type def + end virtual \\} + match , last@union \\{ match , value \\\{ field type def \\\} + match any, value \\\{ field type value \\\} \\} + last@union equ field + common rb sizeof.#name - ($ - .\#name) \} + macro name [value] \{ \common \local ..anonymous + ..anonymous name value \} } + +macro define@substruct parent,name,[field,type,def] + { common + virtual at parent#.#name + forward + local value + if ~ field eq . + parent#field type def + sizeof.#parent#field = $ - parent#field + else + label parent#.#type + rb sizeof.#type + end if + common + sizeof.#name = $ - parent#.#name + end virtual + struc name value \{ + label .\#name + forward + match , value \\{ field type def \\} + match any, value \\{ field type value + if ~ field eq . + rb sizeof.#parent#field - ($-field) + end if \\} + common \} + macro name value \{ \local ..anonymous + ..anonymous name \} } diff --git a/fasmw172/INCLUDE/PCOUNT/ADVAPI32.INC b/fasmw172/INCLUDE/PCOUNT/ADVAPI32.INC new file mode 100644 index 0000000..311655e --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/ADVAPI32.INC @@ -0,0 +1,340 @@ + +; ADVAPI32 API calls parameters' count + +AbortSystemShutdown% = 1 +AccessCheck% = 8 +AccessCheckAndAuditAlarm% = 11 +AccessCheckByType% = 11 +AccessCheckByTypeAndAuditAlarm% = 16 +AccessCheckByTypeResultList% = 11 +AccessCheckByTypeResultListAndAuditAlarm% = 16 +AddAccessAllowedAce% = 4 +AddAccessAllowedAceEx% = 5 +AddAccessAllowedObjectAce% = 7 +AddAccessDeniedAce% = 4 +AddAccessDeniedAceEx% = 5 +AddAccessDeniedObjectAce% = 7 +AddAce% = 5 +AddAuditAccessAce% = 6 +AddAuditAccessAceEx% = 7 +AddAuditAccessObjectAce% = 9 +AdjustTokenGroups% = 6 +AdjustTokenPrivileges% = 6 +AllocateAndInitializeSid% = 11 +AllocateLocallyUniqueId% = 1 +AreAllAccessesGranted% = 2 +AreAnyAccessesGranted% = 2 +BackupEventLog% = 2 +BuildExplicitAccessWithName% = 5 +BuildImpersonateExplicitAccessWithName% = 6 +BuildImpersonateTrustee% = 2 +BuildSecurityDescriptor% = 9 +BuildTrusteeWithName% = 2 +BuildTrusteeWithSid% = 2 +CancelOverlappedAccess% = 1 +ChangeServiceConfig2% = 3 +ChangeServiceConfig% = 11 +ClearEventLog% = 2 +CloseEventLog% = 1 +CloseRaw% = 1 +CloseServiceHandle% = 1 +ControlService% = 3 +ConvertAccessToSecurityDescriptor% = 5 +ConvertSecurityDescriptorToAccess% = 7 +ConvertSecurityDescriptorToAccessNamed% = 7 +ConvertToAutoInheritPrivateObjectSecurity% = 6 +CopySid% = 3 +CreatePrivateObjectSecurity% = 6 +CreatePrivateObjectSecurityEx% = 8 +CreateProcessAsUser% = 11 +CreateRestrictedToken% = 9 +CreateService% = 13 +CryptAcquireContext% = 5 +CryptContextAddRef% = 3 +CryptCreateHash% = 5 +CryptDecrypt% = 6 +CryptDeriveKey% = 5 +CryptDestroyHash% = 1 +CryptDestroyKey% = 1 +CryptDuplicateHash% = 4 +CryptDuplicateKey% = 4 +CryptEncrypt% = 7 +CryptEnumProviderTypes% = 6 +CryptEnumProviders% = 6 +CryptExportKey% = 6 +CryptGenKey% = 4 +CryptGenRandom% = 3 +CryptGetDefaultProvider% = 5 +CryptGetHashParam% = 5 +CryptGetKeyParam% = 5 +CryptGetProvParam% = 5 +CryptGetUserKey% = 3 +CryptHashData% = 4 +CryptHashSessionKey% = 3 +CryptImportKey% = 6 +CryptReleaseContext% = 2 +CryptSetHashParam% = 4 +CryptSetKeyParam% = 4 +CryptSetProvParam% = 4 +CryptSetProvider% = 2 +CryptSetProviderEx% = 4 +CryptSignHash% = 6 +CryptVerifySignature% = 6 +DecryptFile% = 2 +DeleteAce% = 2 +DeleteService% = 1 +DeregisterEventSource% = 1 +DestroyPrivateObjectSecurity% = 1 +DuplicateToken% = 3 +DuplicateTokenEx% = 6 +ElfBackupEventLogFile% = 2 +ElfChangeNotify% = 2 +ElfClearEventLogFile% = 2 +ElfCloseEventLog% = 1 +ElfDeregisterEventSource% = 1 +ElfNumberOfRecords% = 2 +ElfOldestRecord% = 2 +ElfOpenBackupEventLog% = 3 +ElfOpenEventLog% = 3 +ElfReadEventLog% = 7 +ElfRegisterEventSource% = 3 +ElfReportEvent% = 12 +EncryptFile% = 1 +EnumDependentServices% = 6 +EnumServicesStatus% = 8 +EqualPrefixSid% = 2 +EqualSid% = 2 +FindFirstFreeAce% = 2 +FreeSid% = 1 +GetAccessPermissionsForObject% = 9 +GetAce% = 3 +GetAclInformation% = 4 +GetAuditedPermissionsFromAcl% = 4 +GetCurrentHwProfile% = 1 +GetEffectiveRightsFromAcl% = 3 +GetExplicitEntriesFromAcl% = 3 +GetFileSecurity% = 5 +GetKernelObjectSecurity% = 5 +GetLengthSid% = 1 +GetMultipleTrustee% = 1 +GetMultipleTrusteeOperation% = 1 +GetNamedSecurityInfo% = 8 +GetNamedSecurityInfoEx% = 9 +GetNumberOfEventLogRecords% = 2 +GetOldestEventLogRecord% = 2 +GetOverlappedAccessResults% = 4 +GetPrivateObjectSecurity% = 5 +GetSecurityDescriptorControl% = 3 +GetSecurityDescriptorDacl% = 4 +GetSecurityDescriptorGroup% = 3 +GetSecurityDescriptorLength% = 1 +GetSecurityDescriptorOwner% = 3 +GetSecurityDescriptorSacl% = 4 +GetSecurityInfo% = 8 +GetSecurityInfoEx% = 9 +GetServiceDisplayName% = 4 +GetServiceKeyName% = 4 +GetSidLengthRequired% = 1 +GetSidSubAuthority% = 2 +GetSidSubAuthorityCount% = 1 +GetTokenInformation% = 5 +GetTrusteeName% = 1 +GetTrusteeType% = 1 +GetUserName% = 2 +I_ScSetServiceBits% = 5 +ImpersonateLoggedOnUser% = 1 +ImpersonateNamedPipeClient% = 1 +ImpersonateSelf% = 1 +InitializeAcl% = 3 +InitializeSecurityDescriptor% = 2 +InitializeSid% = 3 +InitiateSystemShutdown% = 5 +IsTextUnicode% = 3 +IsTokenRestricted% = 1 +IsValidAcl% = 1 +IsValidSecurityDescriptor% = 1 +IsValidSid% = 1 +LockServiceDatabase% = 1 +LogonUser% = 6 +LookupAccountName% = 7 +LookupAccountSid% = 7 +LookupPrivilegeDisplayName% = 5 +LookupPrivilegeName% = 4 +LookupPrivilegeValue% = 3 +LookupSecurityDescriptorParts% = 7 +LsaAddAccountRights% = 4 +LsaAddPrivilegesToAccount% = 2 +LsaClearAuditLog% = 1 +LsaClose% = 1 +LsaCreateAccount% = 4 +LsaCreateSecret% = 4 +LsaCreateTrustedDomain% = 4 +LsaCreateTrustedDomainEx% = 5 +LsaDelete% = 1 +LsaDeleteTrustedDomain% = 2 +LsaEnumerateAccountRights% = 4 +LsaEnumerateAccounts% = 5 +LsaEnumerateAccountsWithUserRight% = 4 +LsaEnumeratePrivileges% = 5 +LsaEnumeratePrivilegesOfAccount% = 2 +LsaEnumerateTrustedDomains% = 5 +LsaEnumerateTrustedDomainsEx% = 6 +LsaFreeMemory% = 1 +LsaGetQuotasForAccount% = 2 +LsaGetSystemAccessAccount% = 2 +LsaGetUserName% = 2 +LsaICLookupNames% = 7 +LsaICLookupSids% = 7 +LsaIGetTrustedDomainAuthInfoBlobs% = 4 +LsaISetTrustedDomainAuthInfoBlobs% = 4 +LsaLookupNames% = 5 +LsaLookupPrivilegeDisplayName% = 4 +LsaLookupPrivilegeName% = 3 +LsaLookupPrivilegeValue% = 3 +LsaLookupSids% = 5 +LsaNtStatusToWinError% = 1 +LsaOpenAccount% = 4 +LsaOpenPolicy% = 4 +LsaOpenSecret% = 4 +LsaOpenTrustedDomain% = 4 +LsaQueryDomainInformationPolicy% = 3 +LsaQueryInfoTrustedDomain% = 3 +LsaQueryInformationPolicy% = 3 +LsaQueryLocalInformationPolicy% = 3 +LsaQuerySecret% = 5 +LsaQuerySecurityObject% = 3 +LsaQueryTrustedDomainInfo% = 4 +LsaQueryTrustedDomainInfoByName% = 4 +LsaRemoveAccountRights% = 5 +LsaRemovePrivilegesFromAccount% = 3 +LsaRetrievePrivateData% = 3 +LsaSetDomainInformationPolicy% = 3 +LsaSetInformationPolicy% = 3 +LsaSetInformationTrustedDomain% = 3 +LsaSetLocalInformationPolicy% = 3 +LsaSetQuotasForAccount% = 2 +LsaSetSecret% = 3 +LsaSetSecurityObject% = 3 +LsaSetSystemAccessAccount% = 2 +LsaSetTrustedDomainInfoByName% = 4 +LsaSetTrustedDomainInformation% = 4 +LsaStorePrivateData% = 3 +MakeAbsoluteSD% = 11 +MakeSelfRelativeSD% = 3 +MapGenericMask% = 2 +NotifyBootConfigStatus% = 1 +NotifyChangeEventLog% = 2 +ObjectCloseAuditAlarm% = 3 +ObjectDeleteAuditAlarm% = 3 +ObjectOpenAuditAlarm% = 12 +ObjectPrivilegeAuditAlarm% = 6 +OpenBackupEventLog% = 2 +OpenEventLog% = 2 +OpenProcessToken% = 3 +OpenRaw% = 3 +OpenSCManager% = 3 +OpenService% = 3 +OpenThreadToken% = 4 +PrivilegeCheck% = 3 +PrivilegedServiceAuditAlarm% = 5 +QueryRecoveryAgents% = 3 +QueryServiceConfig2% = 5 +QueryServiceConfig% = 4 +QueryServiceLockStatus% = 4 +QueryServiceObjectSecurity% = 5 +QueryServiceStatus% = 2 +QueryWindows31FilesMigration% = 1 +ReadEventLog% = 7 +ReadRaw% = 3 +RegCloseKey% = 1 +RegConnectRegistry% = 3 +RegCreateKey% = 3 +RegCreateKeyEx% = 9 +RegDeleteKey% = 2 +RegDeleteValue% = 2 +RegEnumKey% = 4 +RegEnumKeyEx% = 8 +RegEnumValue% = 8 +RegFlushKey% = 1 +RegGetKeySecurity% = 4 +RegLoadKey% = 3 +RegNotifyChangeKeyValue% = 5 +RegOpenKey% = 3 +RegOpenKeyEx% = 5 +RegOverridePredefKey% = 2 +RegQueryInfoKey% = 12 +RegQueryMultipleValues% = 5 +RegQueryValue% = 4 +RegQueryValueEx% = 6 +RegReplaceKey% = 4 +RegRestoreKey% = 3 +RegSaveKey% = 3 +RegSetKeySecurity% = 3 +RegSetValue% = 5 +RegSetValueEx% = 6 +RegUnLoadKey% = 2 +RegisterEventSource% = 2 +RegisterServiceCtrlHandler% = 2 +ReportEvent% = 9 +RevertToSelf% = 0 +SetAclInformation% = 4 +SetEntriesInAccessList% = 6 +SetEntriesInAcl% = 4 +SetEntriesInAuditList% = 6 +SetFileSecurity% = 3 +SetKernelObjectSecurity% = 3 +SetNamedSecurityInfo% = 7 +SetNamedSecurityInfoEx% = 9 +SetPrivateObjectSecurity% = 5 +SetPrivateObjectSecurityEx% = 6 +SetSecurityDescriptorControl% = 3 +SetSecurityDescriptorDacl% = 4 +SetSecurityDescriptorGroup% = 3 +SetSecurityDescriptorOwner% = 3 +SetSecurityDescriptorSacl% = 4 +SetSecurityInfo% = 7 +SetSecurityInfoEx% = 9 +SetServiceBits% = 4 +SetServiceObjectSecurity% = 3 +SetServiceStatus% = 2 +SetThreadToken% = 2 +SetTokenInformation% = 4 +StartService% = 3 +StartServiceCtrlDispatcher% = 1 +SynchronizeWindows31FilesAndWindowsNTRegistry% = 4 +SystemFunction001% = 3 +SystemFunction002% = 3 +SystemFunction003% = 2 +SystemFunction004% = 3 +SystemFunction005% = 3 +SystemFunction006% = 2 +SystemFunction007% = 2 +SystemFunction008% = 3 +SystemFunction009% = 3 +SystemFunction010% = 3 +SystemFunction011% = 3 +SystemFunction012% = 3 +SystemFunction013% = 3 +SystemFunction014% = 3 +SystemFunction015% = 3 +SystemFunction016% = 3 +SystemFunction017% = 3 +SystemFunction018% = 3 +SystemFunction019% = 3 +SystemFunction020% = 3 +SystemFunction021% = 3 +SystemFunction022% = 3 +SystemFunction023% = 3 +SystemFunction024% = 3 +SystemFunction025% = 3 +SystemFunction026% = 3 +SystemFunction027% = 3 +SystemFunction028% = 2 +SystemFunction029% = 2 +SystemFunction030% = 2 +SystemFunction031% = 2 +SystemFunction032% = 2 +SystemFunction033% = 2 +TrusteeAccessToObject% = 6 +UnlockServiceDatabase% = 1 +WriteRaw% = 3 diff --git a/fasmw172/INCLUDE/PCOUNT/COMCTL32.INC b/fasmw172/INCLUDE/PCOUNT/COMCTL32.INC new file mode 100644 index 0000000..adf4032 --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/COMCTL32.INC @@ -0,0 +1,69 @@ + +; COMCTL32 API calls parameters' count + +CreateMappedBitmap% = 5 +CreatePropertySheetPage% = 1 +CreateStatusWindow% = 4 +CreateToolbar% = 8 +CreateToolbarEx% = 13 +CreateUpDownControl% = 12 +DestroyPropertySheetPage% = 1 +DrawInsert% = 3 +DrawStatusText% = 4 +FlatSB_EnableScrollBar% = 3 +FlatSB_GetScrollInfo% = 3 +FlatSB_GetScrollPos% = 2 +FlatSB_GetScrollProp% = 3 +FlatSB_GetScrollRange% = 4 +FlatSB_SetScrollInfo% = 4 +FlatSB_SetScrollPos% = 4 +FlatSB_SetScrollProp% = 4 +FlatSB_SetScrollRange% = 5 +FlatSB_ShowScrollBar% = 3 +GetEffectiveClientRect% = 3 +ImageList_Add% = 3 +ImageList_AddIcon% = 2 +ImageList_AddMasked% = 3 +ImageList_BeginDrag% = 4 +ImageList_Copy% = 5 +ImageList_Create% = 5 +ImageList_Destroy% = 1 +ImageList_DragEnter% = 3 +ImageList_DragLeave% = 1 +ImageList_DragMove% = 2 +ImageList_DragShowNolock% = 1 +ImageList_Draw% = 6 +ImageList_DrawEx% = 10 +ImageList_DrawIndirect% = 1 +ImageList_Duplicate% = 1 +ImageList_EndDrag% = 0 +ImageList_GetBkColor% = 1 +ImageList_GetDragImage% = 2 +ImageList_GetIcon% = 3 +ImageList_GetIconSize% = 3 +ImageList_GetImageCount% = 1 +ImageList_GetImageInfo% = 3 +ImageList_GetImageRect% = 3 +ImageList_LoadImage% = 7 +ImageList_Merge% = 6 +ImageList_Read% = 1 +ImageList_Remove% = 2 +ImageList_Replace% = 4 +ImageList_ReplaceIcon% = 3 +ImageList_SetBkColor% = 2 +ImageList_SetDragCursorImage% = 4 +ImageList_SetFilter% = 3 +ImageList_SetIconSize% = 3 +ImageList_SetImageCount% = 2 +ImageList_SetOverlayImage% = 3 +ImageList_Write% = 2 +InitCommonControls% = 0 +InitCommonControlsEx% = 1 +InitializeFlatSB% = 1 +LBItemFromPt% = 4 +MakeDragList% = 1 +MenuHelp% = 7 +PropertySheet% = 1 +ShowHideMenuCtl% = 3 +UninitializeFlatSB% = 1 +_TrackMouseEvent% = 1 diff --git a/fasmw172/INCLUDE/PCOUNT/COMDLG32.INC b/fasmw172/INCLUDE/PCOUNT/COMDLG32.INC new file mode 100644 index 0000000..3417a8c --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/COMDLG32.INC @@ -0,0 +1,18 @@ + +; COMDLG32 API calls parameters' count + +ChooseColor% = 1 +ChooseFont% = 1 +CommDlgExtendedError% = 0 +FindText% = 1 +FormatCharDlgProc% = 4 +GetFileTitle% = 3 +GetOpenFileName% = 1 +GetSaveFileName% = 1 +LoadAlterBitmap% = 3 +PageSetupDlg% = 1 +PrintDlg% = 1 +ReplaceText% = 1 +WantArrows% = 4 +dwLBSubclass% = 4 +dwOKSubclass% = 4 diff --git a/fasmw172/INCLUDE/PCOUNT/GDI32.INC b/fasmw172/INCLUDE/PCOUNT/GDI32.INC new file mode 100644 index 0000000..6d5c76b --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/GDI32.INC @@ -0,0 +1,319 @@ + +; GDI32 API calls parameters' count + +AbortDoc% = 1 +AbortPath% = 1 +AddFontMemResourceEx% = 4 +AddFontResource% = 1 +AddFontResourceEx% = 3 +AngleArc% = 6 +AnimatePalette% = 4 +Arc% = 9 +ArcTo% = 9 +BeginPath% = 1 +BitBlt% = 9 +CancelDC% = 1 +CheckColorsInGamut% = 4 +ChoosePixelFormat% = 2 +Chord% = 9 +CloseEnhMetaFile% = 1 +CloseFigure% = 1 +CloseMetaFile% = 1 +ColorCorrectPalette% = 4 +ColorMatchToTarget% = 3 +CombineRgn% = 4 +CombineTransform% = 3 +CopyEnhMetaFile% = 2 +CopyMetaFile% = 2 +CreateBitmap% = 5 +CreateBitmapIndirect% = 1 +CreateBrushIndirect% = 1 +CreateColorSpace% = 1 +CreateCompatibleBitmap% = 3 +CreateCompatibleDC% = 1 +CreateDC% = 4 +CreateDIBPatternBrush% = 2 +CreateDIBPatternBrushPt% = 2 +CreateDIBSection% = 6 +CreateDIBitmap% = 6 +CreateDiscardableBitmap% = 3 +CreateEllipticRgn% = 4 +CreateEllipticRgnIndirect% = 1 +CreateEnhMetaFile% = 4 +CreateFont% = 14 +CreateFontIndirect% = 1 +CreateFontIndirectEx% = 1 +CreateHalftonePalette% = 1 +CreateHatchBrush% = 2 +CreateIC% = 4 +CreateMetaFile% = 1 +CreatePalette% = 1 +CreatePatternBrush% = 1 +CreatePen% = 3 +CreatePenIndirect% = 1 +CreatePolyPolygonRgn% = 4 +CreatePolygonRgn% = 3 +CreateRectRgn% = 4 +CreateRectRgnIndirect% = 1 +CreateRoundRectRgn% = 6 +CreateScalableFontResource% = 4 +CreateSolidBrush% = 1 +DPtoLP% = 3 +DeleteColorSpace% = 1 +DeleteDC% = 1 +DeleteEnhMetaFile% = 1 +DeleteMetaFile% = 1 +DeleteObject% = 1 +DescribePixelFormat% = 4 +DeviceCapabilitiesEx% = 6 +DrawEscape% = 4 +Ellipse% = 5 +EnableEUDC% = 1 +EndDoc% = 1 +EndPage% = 1 +EndPath% = 1 +EnumEnhMetaFile% = 5 +EnumFontFamilies% = 4 +EnumFontFamiliesEx% = 5 +EnumFonts% = 4 +EnumICMProfiles% = 3 +EnumMetaFile% = 4 +EnumObjects% = 4 +EqualRgn% = 2 +Escape% = 5 +ExcludeClipRect% = 5 +ExtCreatePen% = 5 +ExtCreateRegion% = 3 +ExtEscape% = 6 +ExtFloodFill% = 5 +ExtSelectClipRgn% = 3 +ExtTextOut% = 8 +FillPath% = 1 +FillRgn% = 3 +FixBrushOrgEx% = 4 +FlattenPath% = 1 +FloodFill% = 4 +FrameRgn% = 5 +GdiComment% = 3 +GdiDeleteSpoolFileHandle% = 1 +GdiEndDocEMF% = 1 +GdiEndPageEMF% = 2 +GdiFlush% = 0 +GdiGetBatchLimit% = 0 +GdiGetDC% = 1 +GdiGetDevmodeForPage% = 4 +GdiGetPageCount% = 1 +GdiGetPageHandle% = 3 +GdiGetSpoolFileHandle% = 3 +GdiPlayDCScript% = 6 +GdiPlayEMF% = 5 +GdiPlayJournal% = 5 +GdiPlayPageEMF% = 4 +GdiPlayPrivatePageEMF% = 3 +GdiPlayScript% = 7 +GdiResetDCEMF% = 2 +GdiSetBatchLimit% = 1 +GdiStartDocEMF% = 2 +GdiStartPageEMF% = 1 +GetArcDirection% = 1 +GetAspectRatioFilterEx% = 2 +GetBitmapBits% = 3 +GetBitmapDimensionEx% = 2 +GetBkColor% = 1 +GetBkMode% = 1 +GetBoundsRect% = 3 +GetBrushOrgEx% = 2 +GetCharABCWidths% = 4 +GetCharABCWidthsFloat% = 4 +GetCharABCWidthsI% = 5 +GetCharWidth32% = 4 +GetCharWidth% = 4 +GetCharWidthFloat% = 4 +GetCharWidthI% = 5 +GetCharacterPlacement% = 6 +GetClipBox% = 2 +GetClipRgn% = 2 +GetColorAdjustment% = 2 +GetColorSpace% = 1 +GetCurrentObject% = 2 +GetCurrentPositionEx% = 2 +GetDCBrushColor% = 1 +GetDCOrgEx% = 2 +GetDCPenColor% = 1 +GetDIBColorTable% = 4 +GetDIBits% = 7 +GetDeviceCaps% = 2 +GetDeviceGammaRamp% = 2 +GetEnhMetaFile% = 1 +GetEnhMetaFileBits% = 3 +GetEnhMetaFileDescription% = 3 +GetEnhMetaFileHeader% = 3 +GetEnhMetaFilePaletteEntries% = 3 +GetEnhMetaFilePixelFormat% = 3 +GetFontAssocStatus% = 1 +GetFontData% = 5 +GetFontLanguageInfo% = 1 +GetFontUnicodeRanges% = 2 +GetGlyphIndices% = 5 +GetGlyphOutline% = 7 +GetGraphicsMode% = 1 +GetICMProfile% = 3 +GetKerningPairs% = 3 +GetLogColorSpace% = 3 +GetMapMode% = 1 +GetMetaFile% = 1 +GetMetaFileBitsEx% = 3 +GetMetaRgn% = 2 +GetMiterLimit% = 2 +GetNearestColor% = 2 +GetNearestPaletteIndex% = 2 +GetObject% = 3 +GetObjectType% = 1 +GetOutlineTextMetrics% = 3 +GetPaletteEntries% = 4 +GetPath% = 4 +GetPixel% = 3 +GetPixelFormat% = 1 +GetPolyFillMode% = 1 +GetROP2% = 1 +GetRandomRgn% = 3 +GetRasterizerCaps% = 2 +GetRegionData% = 3 +GetRelAbs% = 2 +GetRgnBox% = 2 +GetStockObject% = 1 +GetStretchBltMode% = 1 +GetSystemPaletteEntries% = 4 +GetSystemPaletteUse% = 1 +GetTextAlign% = 1 +GetTextCharacterExtra% = 1 +GetTextCharset% = 1 +GetTextCharsetInfo% = 3 +GetTextColor% = 1 +GetTextExtentExPoint% = 7 +GetTextExtentExPointI% = 7 +GetTextExtentPoint32% = 4 +GetTextExtentPoint% = 4 +GetTextExtentPointI% = 4 +GetTextFace% = 3 +GetTextMetrics% = 2 +GetViewportExtEx% = 2 +GetViewportOrgEx% = 2 +GetWinMetaFileBits% = 5 +GetWindowExtEx% = 2 +GetWindowOrgEx% = 2 +GetWorldTransform% = 2 +IntersectClipRect% = 5 +InvertRgn% = 2 +LPtoDP% = 3 +LineDD% = 6 +LineTo% = 3 +MaskBlt% = 12 +ModifyWorldTransform% = 3 +MoveToEx% = 4 +OffsetClipRgn% = 3 +OffsetRgn% = 3 +OffsetViewportOrgEx% = 4 +OffsetWindowOrgEx% = 4 +PaintRgn% = 2 +PatBlt% = 6 +PathToRegion% = 1 +Pie% = 9 +PlayEnhMetaFile% = 3 +PlayEnhMetaFileRecord% = 4 +PlayMetaFile% = 2 +PlayMetaFileRecord% = 4 +PlgBlt% = 10 +PolyBezier% = 3 +PolyBezierTo% = 3 +PolyDraw% = 4 +PolyPatBlt% = 5 +PolyPolygon% = 4 +PolyPolyline% = 4 +PolyTextOut% = 3 +Polygon% = 3 +Polyline% = 3 +PolylineTo% = 3 +PtInRegion% = 3 +PtVisible% = 3 +RealizePalette% = 1 +RectInRegion% = 2 +RectVisible% = 2 +Rectangle% = 5 +RemoveFontMemResourceEx% = 1 +RemoveFontResource% = 1 +RemoveFontResourceEx% = 3 +ResetDC% = 2 +ResizePalette% = 2 +RestoreDC% = 2 +RoundRect% = 7 +SaveDC% = 1 +ScaleViewportExtEx% = 6 +ScaleWindowExtEx% = 6 +SelectBrushLocal% = 2 +SelectClipPath% = 2 +SelectClipRgn% = 2 +SelectFontLocal% = 2 +SelectObject% = 2 +SelectPalette% = 3 +SetAbortProc% = 2 +SetArcDirection% = 2 +SetBitmapBits% = 3 +SetBitmapDimensionEx% = 4 +SetBkColor% = 2 +SetBkMode% = 2 +SetBoundsRect% = 3 +SetBrushOrgEx% = 4 +SetColorAdjustment% = 2 +SetColorSpace% = 2 +SetDCBrushColor% = 2 +SetDCPenColor% = 2 +SetDIBColorTable% = 4 +SetDIBits% = 7 +SetDIBitsToDevice% = 12 +SetDeviceGammaRamp% = 2 +SetEnhMetaFileBits% = 2 +SetFontEnumeration% = 1 +SetGraphicsMode% = 2 +SetICMMode% = 2 +SetICMProfile% = 2 +SetMagicColors% = 3 +SetMapMode% = 2 +SetMapperFlags% = 2 +SetMetaFileBitsEx% = 2 +SetMetaRgn% = 1 +SetMiterLimit% = 3 +SetPaletteEntries% = 4 +SetPixel% = 4 +SetPixelFormat% = 3 +SetPixelV% = 4 +SetPolyFillMode% = 2 +SetROP2% = 2 +SetRectRgn% = 5 +SetRelAbs% = 2 +SetStretchBltMode% = 2 +SetSystemPaletteUse% = 2 +SetTextAlign% = 2 +SetTextCharacterExtra% = 2 +SetTextColor% = 2 +SetTextJustification% = 3 +SetViewportExtEx% = 4 +SetViewportOrgEx% = 4 +SetWinMetaFileBits% = 4 +SetWindowExtEx% = 4 +SetWindowOrgEx% = 4 +SetWorldTransform% = 2 +StartDoc% = 2 +StartPage% = 1 +StretchBlt% = 11 +StretchDIBits% = 13 +StrokeAndFillPath% = 1 +StrokePath% = 1 +SwapBuffers% = 1 +TextOut% = 5 +TranslateCharsetInfo% = 3 +UnrealizeObject% = 1 +UpdateColors% = 1 +UpdateICMRegKey% = 4 +WidenPath% = 1 +gdiPlaySpoolStream% = 6 diff --git a/fasmw172/INCLUDE/PCOUNT/KERNEL32.INC b/fasmw172/INCLUDE/PCOUNT/KERNEL32.INC new file mode 100644 index 0000000..e7fec6f --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/KERNEL32.INC @@ -0,0 +1,557 @@ + +; KERNEL32 API calls parameters' count + +AddAtom% = 1 +AddConsoleAlias% = 3 +AllocConsole% = 0 +AreFileApisANSI% = 0 +AssignProcessToJobObject% = 2 +BackupRead% = 7 +BackupSeek% = 6 +BackupWrite% = 7 +BaseAttachCompleteThunk% = 0 +Beep% = 2 +BeginUpdateResource% = 2 +BuildCommDCB% = 2 +BuildCommDCBAndTimeouts% = 3 +CallNamedPipe% = 7 +CancelIo% = 1 +CancelWaitableTimer% = 1 +ClearCommBreak% = 1 +ClearCommError% = 3 +CloseConsoleHandle% = 1 +CloseHandle% = 1 +CloseProfileUserMapping% = 0 +CmdBatNotification% = 1 +CommConfigDialog% = 3 +CompareFileTime% = 2 +CompareString% = 6 +ConnectNamedPipe% = 2 +ConsoleMenuControl% = 3 +ContinueDebugEvent% = 3 +ConvertDefaultLocale% = 1 +ConvertThreadToFiber% = 1 +CopyFile% = 3 +CopyFileEx% = 6 +CreateConsoleScreenBuffer% = 5 +CreateDirectory% = 2 +CreateDirectoryEx% = 3 +CreateEvent% = 4 +CreateFiber% = 3 +CreateFile% = 7 +CreateFileMapping% = 6 +CreateHardLink% = 3 +CreateIoCompletionPort% = 4 +CreateJobObject% = 2 +CreateMailslot% = 4 +CreateMutex% = 3 +CreateNamedPipe% = 8 +CreatePipe% = 4 +CreateProcess% = 10 +CreateRemoteThread% = 7 +CreateSemaphore% = 4 +CreateTapePartition% = 4 +CreateThread% = 6 +CreateToolhelp32Snapshot% = 2 +CreateVirtualBuffer% = 3 +CreateWaitableTimer% = 3 +DebugActiveProcess% = 1 +DebugBreak% = 0 +DefineDosDevice% = 3 +DeleteAtom% = 1 +DeleteCriticalSection% = 1 +DeleteFiber% = 1 +DeleteFile% = 1 +DeviceIoControl% = 8 +DisableThreadLibraryCalls% = 1 +DisconnectNamedPipe% = 1 +DosDateTimeToFileTime% = 3 +DuplicateConsoleHandle% = 4 +DuplicateHandle% = 7 +EndUpdateResource% = 2 +EnterCriticalSection% = 1 +EnumCalendarInfo% = 4 +EnumCalendarInfoEx% = 4 +EnumDateFormats% = 3 +EnumDateFormatsEx% = 3 +EnumResourceLanguages% = 5 +EnumResourceNames% = 4 +EnumResourceTypes% = 3 +EnumSystemCodePages% = 2 +EnumSystemLocales% = 2 +EnumTimeFormats% = 3 +EraseTape% = 3 +EscapeCommFunction% = 2 +ExitProcess% = 1 +ExitThread% = 1 +ExitVDM% = 2 +ExpandEnvironmentStrings% = 3 +ExpungeConsoleCommandHistory% = 1 +ExtendVirtualBuffer% = 2 +FatalAppExit% = 2 +FatalExit% = 1 +FileTimeToDosDateTime% = 3 +FileTimeToLocalFileTime% = 2 +FileTimeToSystemTime% = 2 +FillConsoleOutputAttribute% = 5 +FillConsoleOutputCharacter% = 5 +FindAtom% = 1 +FindClose% = 1 +FindCloseChangeNotification% = 1 +FindFirstChangeNotification% = 3 +FindFirstFile% = 2 +FindFirstFileEx% = 6 +FindNextChangeNotification% = 1 +FindNextFile% = 2 +FindResource% = 3 +FindResourceEx% = 4 +FlushConsoleInputBuffer% = 1 +FlushFileBuffers% = 1 +FlushInstructionCache% = 3 +FlushViewOfFile% = 2 +FoldString% = 5 +FormatMessage% = 7 +FreeConsole% = 0 +FreeEnvironmentStrings% = 1 +FreeLibrary% = 1 +FreeLibraryAndExitThread% = 2 +FreeResource% = 1 +FreeVirtualBuffer% = 1 +GenerateConsoleCtrlEvent% = 2 +GetACP% = 0 +GetAtomName% = 3 +GetBinaryType% = 2 +GetCPInfo% = 2 +GetCPInfoEx% = 3 +GetCommConfig% = 3 +GetCommMask% = 2 +GetCommModemStatus% = 2 +GetCommProperties% = 2 +GetCommState% = 2 +GetCommTimeouts% = 2 +GetCommandLine% = 0 +GetCompressedFileSize% = 2 +GetComputerName% = 2 +GetConsoleAlias% = 4 +GetConsoleAliasExes% = 2 +GetConsoleAliasExesLength% = 0 +GetConsoleAliases% = 3 +GetConsoleAliasesLength% = 1 +GetConsoleCP% = 0 +GetConsoleCommandHistory% = 3 +GetConsoleCommandHistoryLength% = 1 +GetConsoleCursorInfo% = 2 +GetConsoleDisplayMode% = 1 +GetConsoleFontInfo% = 4 +GetConsoleFontSize% = 2 +GetConsoleHardwareState% = 3 +GetConsoleInputExeName% = 2 +GetConsoleInputWaitHandle% = 0 +GetConsoleKeyboardLayoutName% = 1 +GetConsoleMode% = 2 +GetConsoleOutputCP% = 0 +GetConsoleScreenBufferInfo% = 2 +GetConsoleTitle% = 2 +GetConsoleWindow% = 0 +GetCurrencyFormat% = 6 +GetCurrentConsoleFont% = 3 +GetCurrentDirectory% = 2 +GetCurrentProcess% = 0 +GetCurrentProcessId% = 0 +GetCurrentThread% = 0 +GetCurrentThreadId% = 0 +GetDateFormat% = 6 +GetDefaultCommConfig% = 3 +GetDevicePowerState% = 1 +GetDiskFreeSpace% = 5 +GetDiskFreeSpaceEx% = 4 +GetDriveType% = 1 +GetEnvironmentStrings% = 0 +GetEnvironmentVariable% = 3 +GetExitCodeProcess% = 2 +GetExitCodeThread% = 2 +GetFileAttributes% = 1 +GetFileAttributesEx% = 3 +GetFileInformationByHandle% = 2 +GetFileSize% = 2 +GetFileTime% = 4 +GetFileType% = 1 +GetFullPathName% = 4 +GetHandleInformation% = 2 +GetLargestConsoleWindowSize% = 1 +GetLastError% = 0 +GetLocalTime% = 1 +GetLocaleInfo% = 4 +GetLogicalDriveStrings% = 2 +GetLogicalDrives% = 0 +GetLongPathName% = 3 +GetMailslotInfo% = 5 +GetModuleFileName% = 3 +GetModuleHandle% = 1 +GetNamedPipeHandleState% = 7 +GetNamedPipeInfo% = 5 +GetNextVDMCommand% = 1 +GetNumberFormat% = 6 +GetNumberOfConsoleFonts% = 0 +GetNumberOfConsoleInputEvents% = 2 +GetNumberOfConsoleMouseButtons% = 1 +GetOEMCP% = 0 +GetOverlappedResult% = 4 +GetPriorityClass% = 1 +GetPrivateProfileInt% = 4 +GetPrivateProfileSection% = 4 +GetPrivateProfileSectionNames% = 3 +GetPrivateProfileString% = 6 +GetPrivateProfileStruct% = 5 +GetProcAddress% = 2 +GetProcessAffinityMask% = 3 +GetProcessHeap% = 0 +GetProcessHeaps% = 2 +GetProcessPriorityBoost% = 2 +GetProcessShutdownParameters% = 2 +GetProcessTimes% = 5 +GetProcessVersion% = 1 +GetProcessWorkingSetSize% = 3 +GetProfileInt% = 3 +GetProfileSection% = 3 +GetProfileString% = 5 +GetQueuedCompletionStatus% = 5 +GetShortPathName% = 3 +GetStartupInfo% = 1 +GetStdHandle% = 1 +GetStringType% = 5 +GetStringTypeEx% = 5 +GetSystemDefaultLCID% = 0 +GetSystemDefaultLangID% = 0 +GetSystemDirectory% = 2 +GetSystemInfo% = 1 +GetSystemPowerStatus% = 1 +GetSystemTime% = 1 +GetSystemTimeAdjustment% = 3 +GetSystemTimeAsFileTime% = 1 +GetTapeParameters% = 4 +GetTapePosition% = 5 +GetTapeStatus% = 1 +GetTempFileName% = 4 +GetTempPath% = 2 +GetThreadContext% = 2 +GetThreadLocale% = 0 +GetThreadPriority% = 1 +GetThreadPriorityBoost% = 2 +GetThreadSelectorEntry% = 3 +GetThreadTimes% = 5 +GetTickCount% = 0 +GetTimeFormat% = 6 +GetTimeZoneInformation% = 1 +GetUserDefaultLCID% = 0 +GetUserDefaultLangID% = 0 +GetVDMCurrentDirectories% = 2 +GetVersion% = 0 +GetVersionEx% = 1 +GetVolumeInformation% = 8 +GetWindowsDirectory% = 2 +GlobalAddAtom% = 1 +GlobalAlloc% = 2 +GlobalCompact% = 1 +GlobalDeleteAtom% = 1 +GlobalFindAtom% = 1 +GlobalFix% = 1 +GlobalFlags% = 1 +GlobalFree% = 1 +GlobalGetAtomName% = 3 +GlobalHandle% = 1 +GlobalLock% = 1 +GlobalMemoryStatus% = 1 +GlobalMemoryStatusVlm% = 1 +GlobalReAlloc% = 3 +GlobalSize% = 1 +GlobalUnWire% = 1 +GlobalUnfix% = 1 +GlobalUnlock% = 1 +GlobalWire% = 1 +Heap32First% = 3 +Heap32ListFirst% = 2 +Heap32ListNext% = 2 +Heap32Next% = 1 +HeapAlloc% = 3 +HeapCompact% = 2 +HeapCreate% = 3 +HeapDestroy% = 1 +HeapExtend% = 4 +HeapFree% = 3 +HeapLock% = 1 +HeapReAlloc% = 4 +HeapSize% = 3 +HeapSummary% = 3 +HeapUnlock% = 1 +HeapUsage% = 5 +HeapValidate% = 3 +HeapWalk% = 2 +InitAtomTable% = 1 +InitializeCriticalSection% = 1 +InitializeCriticalSectionAndSpinCount% = 2 +InterlockedCompareExchange% = 3 +InterlockedDecrement% = 1 +InterlockedExchange% = 2 +InterlockedExchangeAdd% = 2 +InterlockedIncrement% = 1 +InvalidateConsoleDIBits% = 2 +IsBadCodePtr% = 1 +IsBadHugeReadPtr% = 2 +IsBadHugeWritePtr% = 2 +IsBadReadPtr% = 2 +IsBadStringPtr% = 2 +IsBadWritePtr% = 2 +IsDBCSLeadByte% = 1 +IsDBCSLeadByteEx% = 2 +IsDebuggerPresent% = 0 +IsProcessorFeaturePresent% = 1 +IsValidCodePage% = 1 +IsValidLocale% = 2 +LCMapString% = 6 +LeaveCriticalSection% = 1 +LoadLibrary% = 1 +LoadLibraryEx% = 3 +LoadModule% = 2 +LoadResource% = 2 +LocalAlloc% = 2 +LocalCompact% = 1 +LocalFileTimeToFileTime% = 2 +LocalFlags% = 1 +LocalFree% = 1 +LocalHandle% = 1 +LocalLock% = 1 +LocalReAlloc% = 3 +LocalShrink% = 2 +LocalSize% = 1 +LocalUnlock% = 1 +LockFile% = 5 +LockFileEx% = 6 +LockResource% = 1 +MapViewOfFile% = 5 +MapViewOfFileEx% = 6 +MapViewOfFileVlm% = 7 +Module32First% = 2 +Module32Next% = 2 +MoveFile% = 2 +MoveFileEx% = 3 +MoveFileWithProgress% = 5 +MulDiv% = 3 +MultiByteToWideChar% = 6 +OpenEvent% = 3 +OpenFile% = 3 +OpenFileMapping% = 3 +OpenJobObject% = 3 +OpenMutex% = 3 +OpenProcess% = 3 +OpenProfileUserMapping% = 0 +OpenSemaphore% = 3 +OpenWaitableTimer% = 3 +OutputDebugString% = 1 +PeekConsoleInput% = 4 +PeekNamedPipe% = 6 +PostQueuedCompletionStatus% = 4 +PrepareTape% = 3 +Process32First% = 2 +Process32Next% = 2 +PulseEvent% = 1 +PurgeComm% = 2 +QueryDosDevice% = 3 +QueryInformationJobObject% = 5 +QueryPerformanceCounter% = 1 +QueryPerformanceFrequency% = 1 +QueryWin31IniFilesMappedToRegistry% = 4 +QueueUserAPC% = 3 +RaiseException% = 4 +ReadConsole% = 5 +ReadConsoleInput% = 4 +ReadConsoleInputEx% = 5 +ReadConsoleOutput% = 5 +ReadConsoleOutputAttribute% = 5 +ReadConsoleOutputCharacter% = 5 +ReadFile% = 5 +ReadFileEx% = 5 +ReadFileScatter% = 5 +ReadFileVlm% = 5 +ReadProcessMemory% = 5 +ReadProcessMemoryVlm% = 5 +RegisterConsoleVDM% = 11 +RegisterWaitForInputIdle% = 1 +RegisterWowBaseHandlers% = 1 +RegisterWowExec% = 1 +ReleaseMutex% = 1 +ReleaseSemaphore% = 3 +RemoveDirectory% = 1 +RequestWakeupLatency% = 1 +ResetEvent% = 1 +ResumeThread% = 1 +RtlFillMemory% = 3 +RtlMoveMemory% = 3 +RtlUnwind% = 4 +RtlZeroMemory% = 2 +ScrollConsoleScreenBuffer% = 5 +SearchPath% = 6 +SetCommBreak% = 1 +SetCommConfig% = 3 +SetCommMask% = 2 +SetCommState% = 2 +SetCommTimeouts% = 2 +SetComputerName% = 1 +SetConsoleActiveScreenBuffer% = 1 +SetConsoleCP% = 1 +SetConsoleCommandHistoryMode% = 1 +SetConsoleCtrlHandler% = 2 +SetConsoleCursor% = 2 +SetConsoleCursorInfo% = 2 +SetConsoleCursorPosition% = 2 +SetConsoleDisplayMode% = 3 +SetConsoleFont% = 2 +SetConsoleHardwareState% = 3 +SetConsoleIcon% = 1 +SetConsoleInputExeName% = 1 +SetConsoleKeyShortcuts% = 4 +SetConsoleMaximumWindowSize% = 2 +SetConsoleMenuClose% = 1 +SetConsoleMode% = 2 +SetConsoleNumberOfCommands% = 2 +SetConsoleOutputCP% = 1 +SetConsolePalette% = 3 +SetConsoleScreenBufferSize% = 2 +SetConsoleTextAttribute% = 2 +SetConsoleTitle% = 1 +SetConsoleWindowInfo% = 3 +SetCriticalSectionSpinCount% = 2 +SetCurrentDirectory% = 1 +SetDefaultCommConfig% = 3 +SetEndOfFile% = 1 +SetEnvironmentVariable% = 2 +SetErrorMode% = 1 +SetEvent% = 1 +SetFileApisToANSI% = 0 +SetFileApisToOEM% = 0 +SetFileAttributes% = 2 +SetFilePointer% = 4 +SetFileTime% = 4 +SetHandleCount% = 1 +SetHandleInformation% = 3 +SetInformationJobObject% = 4 +SetLastConsoleEventActive% = 0 +SetLastError% = 1 +SetLocalTime% = 1 +SetLocaleInfo% = 3 +SetMailslotInfo% = 2 +SetNamedPipeHandleState% = 4 +SetPriorityClass% = 2 +SetProcessAffinityMask% = 2 +SetProcessPriorityBoost% = 2 +SetProcessShutdownParameters% = 2 +SetProcessWorkingSetSize% = 3 +SetStdHandle% = 2 +SetSystemPowerState% = 2 +SetSystemTime% = 1 +SetSystemTimeAdjustment% = 2 +SetTapeParameters% = 3 +SetTapePosition% = 6 +SetThreadAffinityMask% = 2 +SetThreadContext% = 2 +SetThreadExecutionState% = 1 +SetThreadIdealProcessor% = 2 +SetThreadLocale% = 1 +SetThreadPriority% = 2 +SetThreadPriorityBoost% = 2 +SetTimeZoneInformation% = 1 +SetUnhandledExceptionFilter% = 1 +SetVDMCurrentDirectories% = 2 +SetVolumeLabel% = 2 +SetWaitableTimer% = 6 +SetupComm% = 3 +ShowConsoleCursor% = 2 +SignalObjectAndWait% = 4 +SizeofResource% = 2 +Sleep% = 1 +SleepEx% = 2 +SuspendThread% = 1 +SwitchToFiber% = 1 +SwitchToThread% = 0 +SystemTimeToFileTime% = 2 +SystemTimeToTzSpecificLocalTime% = 3 +TerminateJobObject% = 2 +TerminateProcess% = 2 +TerminateThread% = 2 +Thread32First% = 2 +Thread32Next% = 2 +TlsAlloc% = 0 +TlsFree% = 1 +TlsGetValue% = 1 +TlsSetValue% = 2 +Toolhelp32ReadProcessMemory% = 5 +TransactNamedPipe% = 7 +TransmitCommChar% = 2 +TrimVirtualBuffer% = 1 +TryEnterCriticalSection% = 1 +UnhandledExceptionFilter% = 1 +UnlockFile% = 5 +UnlockFileEx% = 5 +UnmapViewOfFile% = 1 +UnmapViewOfFileVlm% = 1 +UpdateResource% = 6 +VDMConsoleOperation% = 2 +VDMOperationStarted% = 1 +VerLanguageName% = 3 +VerifyConsoleIoHandle% = 1 +VirtualAlloc% = 4 +VirtualAllocEx% = 5 +VirtualAllocVlm% = 6 +VirtualBufferExceptionHandler% = 3 +VirtualFree% = 3 +VirtualFreeEx% = 4 +VirtualFreeVlm% = 5 +VirtualLock% = 2 +VirtualProtect% = 4 +VirtualProtectEx% = 5 +VirtualProtectVlm% = 6 +VirtualQuery% = 3 +VirtualQueryEx% = 4 +VirtualQueryVlm% = 4 +VirtualUnlock% = 2 +WaitCommEvent% = 3 +WaitForDebugEvent% = 2 +WaitForMultipleObjects% = 4 +WaitForMultipleObjectsEx% = 5 +WaitForSingleObject% = 2 +WaitForSingleObjectEx% = 3 +WaitNamedPipe% = 2 +WideCharToMultiByte% = 8 +WinExec% = 2 +WriteConsole% = 5 +WriteConsoleInput% = 4 +WriteConsoleInputVDM% = 4 +WriteConsoleOutput% = 5 +WriteConsoleOutputAttribute% = 5 +WriteConsoleOutputCharacter% = 5 +WriteFile% = 5 +WriteFileEx% = 5 +WriteFileGather% = 5 +WriteFileVlm% = 5 +WritePrivateProfileSection% = 3 +WritePrivateProfileString% = 4 +WritePrivateProfileStruct% = 5 +WriteProcessMemory% = 5 +WriteProcessMemoryVlm% = 5 +WriteProfileSection% = 2 +WriteProfileString% = 3 +WriteTapemark% = 4 +_hread% = 3 +_hwrite% = 3 +_lclose% = 1 +_lcreat% = 2 +_llseek% = 3 +_lopen% = 2 +_lread% = 3 +_lwrite% = 3 +lstrcat% = 2 +lstrcmp% = 2 +lstrcmpi% = 2 +lstrcpy% = 2 +lstrcpyn% = 3 +lstrlen% = 1 diff --git a/fasmw172/INCLUDE/PCOUNT/SHELL32.INC b/fasmw172/INCLUDE/PCOUNT/SHELL32.INC new file mode 100644 index 0000000..1d0528d --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/SHELL32.INC @@ -0,0 +1,73 @@ + +; SHELL32 API calls parameters' count + +CheckEscapes% = 2 +DoEnvironmentSubst% = 2 +DragAcceptFiles% = 2 +DragFinish% = 1 +DragQueryFile% = 4 +DragQueryPoint% = 2 +DuplicateIcon% = 2 +ExtractAssociatedIcon% = 3 +ExtractAssociatedIconEx% = 4 +ExtractIcon% = 3 +ExtractIconEx% = 5 +ExtractIconResInfo% = 5 +FindExeDlgProc% = 4 +FindExecutable% = 3 +FreeIconList% = 2 +InternalExtractIconList% = 3 +RealShellExecute% = 10 +RealShellExecuteEx% = 11 +RegenerateUserEnvironment% = 2 +SHAddToRecentDocs% = 2 +SHAppBarMessage% = 2 +SHBrowseForFolder% = 1 +SHChangeNotify% = 4 +SHEmptyRecycleBin% = 3 +SHFileOperation% = 1 +SHFormatDrive% = 4 +SHFreeNameMappings% = 1 +SHGetDataFromIDList% = 5 +SHGetDesktopFolder% = 1 +SHGetDiskFreeSpace% = 4 +SHGetFileInfo% = 5 +SHGetInstanceExplorer% = 1 +SHGetMalloc% = 1 +SHGetNewLinkInfo% = 5 +SHGetPathFromIDList% = 2 +SHGetSettings% = 2 +SHGetSpecialFolderLocation% = 3 +SHGetSpecialFolderPath% = 4 +SHInvokePrinterCommand% = 5 +SHLoadInProc% = 1 +SHQueryRecycleBin% = 2 +SHUpdateRecycleBinIcon% = 0 +SheChangeDir% = 1 +SheChangeDirEx% = 1 +SheFullPath% = 3 +SheGetCurDrive% = 0 +SheGetDir% = 2 +SheRemoveQuotes% = 1 +SheSetCurDrive% = 1 +SheShortenPath% = 2 +ShellAbout% = 4 +ShellExecute% = 6 +ShellExecuteEx% = 1 +ShellHookProc% = 3 +Shell_NotifyIcon% = 2 +StrChr% = 2 +StrChrI% = 2 +StrCmpN% = 3 +StrCmpNI% = 3 +StrCpyN% = 3 +StrNCmp% = 3 +StrNCmpI% = 3 +StrNCpy% = 3 +StrRChr% = 3 +StrRChrI% = 3 +StrRStr% = 3 +StrRStrI% = 3 +StrStr% = 2 +StrStrI% = 2 +WOWShellExecute% = 7 diff --git a/fasmw172/INCLUDE/PCOUNT/USER32.INC b/fasmw172/INCLUDE/PCOUNT/USER32.INC new file mode 100644 index 0000000..fc4ce05 --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/USER32.INC @@ -0,0 +1,477 @@ + +; USER32 API calls parameters' count + +ActivateKeyboardLayout% = 2 +AdjustWindowRect% = 3 +AdjustWindowRectEx% = 4 +AnimateWindow% = 3 +AnyPopup% = 0 +AppendMenu% = 4 +ArrangeIconicWindows% = 1 +AttachThreadInput% = 3 +BeginDeferWindowPos% = 1 +BeginPaint% = 2 +BlockInput% = 1 +BringWindowToTop% = 1 +BroadcastSystemMessage% = 5 +CallMsgFilter% = 2 +CallNextHookEx% = 4 +CallWindowProc% = 5 +CascadeChildWindows% = 2 +CascadeWindows% = 5 +ChangeClipboardChain% = 2 +ChangeDisplaySettings% = 2 +ChangeDisplaySettingsEx% = 5 +ChangeMenu% = 5 +CharLower% = 1 +CharLowerBuff% = 2 +CharNext% = 1 +CharNextEx% = 3 +CharPrev% = 2 +CharPrevEx% = 4 +CharToOem% = 2 +CharToOemBuff% = 3 +CharUpper% = 1 +CharUpperBuff% = 2 +CheckDlgButton% = 3 +CheckMenuItem% = 3 +CheckMenuRadioItem% = 5 +CheckRadioButton% = 4 +ChildWindowFromPoint% = 3 +ChildWindowFromPointEx% = 4 +ClientToScreen% = 2 +ClipCursor% = 1 +CloseClipboard% = 0 +CloseDesktop% = 1 +CloseWindow% = 1 +CloseWindowStation% = 1 +CopyAcceleratorTable% = 3 +CopyIcon% = 1 +CopyImage% = 5 +CopyRect% = 2 +CountClipboardFormats% = 0 +CreateAcceleratorTable% = 2 +CreateCaret% = 4 +CreateCursor% = 7 +CreateDesktop% = 6 +CreateDialogIndirectParam% = 5 +CreateDialogParam% = 5 +CreateIcon% = 7 +CreateIconFromResource% = 4 +CreateIconFromResourceEx% = 7 +CreateIconIndirect% = 1 +CreateMDIWindow% = 10 +CreateMenu% = 0 +CreatePopupMenu% = 0 +CreateWindowEx% = 12 +CreateWindowStation% = 4 +DdeAbandonTransaction% = 3 +DdeAccessData% = 2 +DdeAddData% = 4 +DdeClientTransaction% = 8 +DdeCmpStringHandles% = 2 +DdeConnect% = 4 +DdeConnectList% = 5 +DdeCreateDataHandle% = 7 +DdeCreateStringHandle% = 3 +DdeDisconnect% = 1 +DdeDisconnectList% = 1 +DdeEnableCallback% = 3 +DdeFreeDataHandle% = 1 +DdeFreeStringHandle% = 2 +DdeGetData% = 4 +DdeGetLastError% = 1 +DdeGetQualityOfService% = 3 +DdeImpersonateClient% = 1 +DdeInitialize% = 4 +DdeKeepStringHandle% = 2 +DdeNameService% = 4 +DdePostAdvise% = 3 +DdeQueryConvInfo% = 3 +DdeQueryNextServer% = 2 +DdeQueryString% = 5 +DdeReconnect% = 1 +DdeSetQualityOfService% = 3 +DdeSetUserHandle% = 3 +DdeUnaccessData% = 1 +DdeUninitialize% = 1 +DefDlgProc% = 4 +DefFrameProc% = 5 +DefMDIChildProc% = 4 +DefWindowProc% = 4 +DeferWindowPos% = 8 +DeleteMenu% = 3 +DestroyAcceleratorTable% = 1 +DestroyCaret% = 0 +DestroyCursor% = 1 +DestroyIcon% = 1 +DestroyMenu% = 1 +DestroyWindow% = 1 +DialogBoxIndirectParam% = 5 +DialogBoxParam% = 5 +DispatchMessage% = 1 +DlgDirList% = 5 +DlgDirListComboBox% = 5 +DlgDirSelectComboBoxEx% = 4 +DlgDirSelectEx% = 4 +DragDetect% = 3 +DragObject% = 5 +DrawAnimatedRects% = 4 +DrawCaption% = 4 +DrawEdge% = 4 +DrawFocusRect% = 2 +DrawFrame% = 4 +DrawFrameControl% = 4 +DrawIcon% = 4 +DrawIconEx% = 9 +DrawMenuBar% = 1 +DrawState% = 10 +DrawText% = 5 +DrawTextEx% = 6 +EditWndProc% = 4 +EmptyClipboard% = 0 +EnableMenuItem% = 3 +EnableScrollBar% = 3 +EnableWindow% = 2 +EndDeferWindowPos% = 1 +EndDialog% = 2 +EndMenu% = 0 +EndPaint% = 2 +EnumChildWindows% = 3 +EnumClipboardFormats% = 1 +EnumDesktopWindows% = 3 +EnumDesktops% = 3 +EnumDisplayMonitors% = 4 +EnumDisplaySettings% = 3 +EnumDisplaySettingsEx% = 4 +EnumProps% = 2 +EnumPropsEx% = 3 +EnumThreadWindows% = 3 +EnumWindowStations% = 2 +EnumWindows% = 2 +EqualRect% = 2 +ExcludeUpdateRgn% = 2 +ExitWindowsEx% = 2 +FillRect% = 3 +FindWindow% = 2 +FindWindowEx% = 4 +FlashWindow% = 2 +FrameRect% = 3 +FreeDDElParam% = 2 +GetActiveWindow% = 0 +GetAltTabInfo% = 5 +GetAncestor% = 2 +GetAsyncKeyState% = 1 +GetCapture% = 0 +GetCaretBlinkTime% = 0 +GetCaretPos% = 1 +GetClassInfo% = 3 +GetClassInfoEx% = 3 +GetClassLong% = 2 +GetClassName% = 3 +GetClassWord% = 2 +GetClientRect% = 2 +GetClipCursor% = 1 +GetClipboardData% = 1 +GetClipboardFormatName% = 3 +GetClipboardSequenceNumber% = 0 +GetClipboardViewer% = 0 +GetComboBoxInfo% = 2 +GetCursor% = 0 +GetCursorInfo% = 1 +GetCursorPos% = 1 +GetDC% = 1 +GetDCEx% = 3 +GetDesktopWindow% = 0 +GetDialogBaseUnits% = 0 +GetDlgCtrlID% = 1 +GetDlgItem% = 2 +GetDlgItemInt% = 4 +GetDlgItemText% = 4 +GetDoubleClickTime% = 0 +GetFocus% = 0 +GetForegroundWindow% = 0 +GetGUIThreadInfo% = 2 +GetGuiResources% = 2 +GetIconInfo% = 2 +GetInputDesktop% = 0 +GetInputState% = 0 +GetKBCodePage% = 0 +GetKeyNameText% = 3 +GetKeyState% = 1 +GetKeyboardLayout% = 1 +GetKeyboardLayoutList% = 2 +GetKeyboardLayoutName% = 1 +GetKeyboardState% = 1 +GetKeyboardType% = 1 +GetLastActivePopup% = 1 +GetLastInputInfo% = 1 +GetListBoxInfo% = 1 +GetMenu% = 1 +GetMenuBarInfo% = 4 +GetMenuCheckMarkDimensions% = 0 +GetMenuContextHelpId% = 1 +GetMenuDefaultItem% = 3 +GetMenuInfo% = 2 +GetMenuItemCount% = 1 +GetMenuItemID% = 2 +GetMenuItemInfo% = 4 +GetMenuItemRect% = 4 +GetMenuState% = 3 +GetMenuString% = 5 +GetMessage% = 4 +GetMessageExtraInfo% = 0 +GetMessagePos% = 0 +GetMessageTime% = 0 +GetMonitorInfo% = 2 +GetMouseMovePoints% = 5 +GetNextDlgGroupItem% = 3 +GetNextDlgTabItem% = 3 +GetOpenClipboardWindow% = 0 +GetParent% = 1 +GetPriorityClipboardFormat% = 2 +GetProcessWindowStation% = 0 +GetProp% = 2 +GetQueueStatus% = 1 +GetScrollBarInfo% = 3 +GetScrollInfo% = 3 +GetScrollPos% = 2 +GetScrollRange% = 4 +GetShellWindow% = 0 +GetSubMenu% = 2 +GetSysColor% = 1 +GetSysColorBrush% = 1 +GetSystemMenu% = 2 +GetSystemMetrics% = 1 +GetTabbedTextExtent% = 5 +GetThreadDesktop% = 1 +GetTitleBarInfo% = 2 +GetTopWindow% = 1 +GetUpdateRect% = 3 +GetUpdateRgn% = 3 +GetUserObjectInformation% = 5 +GetUserObjectSecurity% = 5 +GetWindow% = 2 +GetWindowContextHelpId% = 1 +GetWindowDC% = 1 +GetWindowInfo% = 2 +GetWindowLong% = 2 +GetWindowModuleFileName% = 3 +GetWindowPlacement% = 2 +GetWindowRect% = 2 +GetWindowRgn% = 2 +GetWindowText% = 3 +GetWindowTextLength% = 1 +GetWindowThreadProcessId% = 2 +GetWindowWord% = 2 +GrayString% = 9 +HideCaret% = 1 +HiliteMenuItem% = 4 +IMPGetIME% = 2 +IMPQueryIME% = 1 +IMPSetIME% = 2 +ImpersonateDdeClientWindow% = 2 +InSendMessage% = 0 +InSendMessageEx% = 1 +InflateRect% = 3 +InsertMenu% = 5 +InsertMenuItem% = 4 +IntersectRect% = 3 +InvalidateRect% = 3 +InvalidateRgn% = 3 +InvertRect% = 2 +IsCharAlpha% = 1 +IsCharAlphaNumeric% = 1 +IsCharLower% = 1 +IsCharUpper% = 1 +IsChild% = 2 +IsClipboardFormatAvailable% = 1 +IsDialogMessage% = 2 +IsDlgButtonChecked% = 2 +IsIconic% = 1 +IsMenu% = 1 +IsRectEmpty% = 1 +IsWindow% = 1 +IsWindowEnabled% = 1 +IsWindowUnicode% = 1 +IsWindowVisible% = 1 +IsZoomed% = 1 +KillSystemTimer% = 2 +KillTimer% = 2 +LoadAccelerators% = 2 +LoadBitmap% = 2 +LoadCursor% = 2 +LoadCursorFromFile% = 1 +LoadIcon% = 2 +LoadImage% = 6 +LoadKeyboardLayout% = 2 +LoadMenu% = 2 +LoadMenuIndirect% = 1 +LoadString% = 4 +LockWindowUpdate% = 1 +LockWorkStation% = 0 +LookupIconIdFromDirectory% = 2 +LookupIconIdFromDirectoryEx% = 5 +MapDialogRect% = 2 +MapVirtualKey% = 2 +MapVirtualKeyEx% = 3 +MapWindowPoints% = 4 +MenuItemFromPoint% = 4 +MessageBeep% = 1 +MessageBox% = 4 +MessageBoxEx% = 5 +MessageBoxIndirect% = 1 +ModifyMenu% = 5 +MonitorFromPoint% = 3 +MonitorFromRect% = 2 +MonitorFromWindow% = 2 +MoveWindow% = 6 +MsgWaitForMultipleObjects% = 5 +MsgWaitForMultipleObjectsEx% = 5 +NotifyWinEvent% = 4 +OemKeyScan% = 1 +OemToChar% = 2 +OemToCharBuff% = 3 +OffsetRect% = 3 +OpenClipboard% = 1 +OpenDesktop% = 4 +OpenIcon% = 1 +OpenInputDesktop% = 3 +OpenWindowStation% = 3 +PackDDElParam% = 3 +PaintDesktop% = 1 +PeekMessage% = 5 +PostMessage% = 4 +PostQuitMessage% = 1 +PostThreadMessage% = 4 +PtInRect% = 3 +RealChildWindowFromPoint% = 3 +RealGetWindowClass% = 3 +RedrawWindow% = 4 +RegisterClass% = 1 +RegisterClassEx% = 1 +RegisterClipboardFormat% = 1 +RegisterDeviceNotification% = 3 +RegisterHotKey% = 4 +RegisterWindowMessage% = 1 +ReleaseCapture% = 0 +ReleaseDC% = 2 +RemoveMenu% = 3 +RemoveProp% = 2 +ReplyMessage% = 1 +ReuseDDElParam% = 5 +ScreenToClient% = 2 +ScrollChildren% = 3 +ScrollDC% = 7 +ScrollWindow% = 5 +ScrollWindowEx% = 8 +SendDlgItemMessage% = 5 +SendIMEMessageEx% = 2 +SendInput% = 3 +SendMessage% = 4 +SendMessageCallback% = 6 +SendMessageTimeout% = 7 +SendNotifyMessage% = 4 +SetActiveWindow% = 1 +SetCapture% = 1 +SetCaretBlinkTime% = 1 +SetCaretPos% = 2 +SetClassLong% = 3 +SetClassWord% = 3 +SetClipboardData% = 2 +SetClipboardViewer% = 1 +SetCursor% = 1 +SetCursorPos% = 2 +SetDebugErrorLevel% = 1 +SetDeskWallpaper% = 1 +SetDlgItemInt% = 4 +SetDlgItemText% = 3 +SetDoubleClickTime% = 1 +SetFocus% = 1 +SetForegroundWindow% = 1 +SetKeyboardState% = 1 +SetLastErrorEx% = 2 +SetMenu% = 2 +SetMenuContextHelpId% = 2 +SetMenuDefaultItem% = 3 +SetMenuInfo% = 2 +SetMenuItemBitmaps% = 5 +SetMenuItemInfo% = 4 +SetMessageExtraInfo% = 1 +SetMessageQueue% = 1 +SetParent% = 2 +SetProcessWindowStation% = 1 +SetProp% = 3 +SetRect% = 5 +SetRectEmpty% = 1 +SetScrollInfo% = 4 +SetScrollPos% = 4 +SetScrollRange% = 5 +SetShellWindow% = 1 +SetSysColors% = 3 +SetSystemCursor% = 2 +SetSystemMenu% = 2 +SetSystemTimer% = 4 +SetThreadDesktop% = 1 +SetTimer% = 4 +SetUserObjectInformation% = 4 +SetUserObjectSecurity% = 3 +SetWinEventHook% = 7 +SetWindowContextHelpId% = 2 +SetWindowLong% = 3 +SetWindowPlacement% = 2 +SetWindowPos% = 7 +SetWindowRgn% = 3 +SetWindowText% = 2 +SetWindowWord% = 3 +SetWindowsHook% = 2 +SetWindowsHookEx% = 4 +ShowCaret% = 1 +ShowCursor% = 1 +ShowOwnedPopups% = 2 +ShowScrollBar% = 3 +ShowWindow% = 2 +ShowWindowAsync% = 2 +SubtractRect% = 3 +SwapMouseButton% = 1 +SwitchDesktop% = 1 +SystemParametersInfo% = 4 +TabbedTextOut% = 8 +TileChildWindows% = 2 +TileWindows% = 5 +ToAscii% = 5 +ToAsciiEx% = 6 +ToUnicode% = 6 +ToUnicodeEx% = 7 +TrackMouseEvent% = 1 +TrackPopupMenu% = 7 +TrackPopupMenuEx% = 6 +TranslateAccelerator% = 3 +TranslateMDISysAccel% = 2 +TranslateMessage% = 1 +UnhookWinEvent% = 1 +UnhookWindowsHook% = 2 +UnhookWindowsHookEx% = 1 +UnionRect% = 3 +UnloadKeyboardLayout% = 1 +UnpackDDElParam% = 4 +UnregisterClass% = 2 +UnregisterDeviceNotification% = 1 +UnregisterHotKey% = 2 +UpdateWindow% = 1 +UserHandleGrantAccess% = 2 +ValidateRect% = 2 +ValidateRgn% = 2 +VkKeyScan% = 1 +VkKeyScanEx% = 2 +WINNLSEnableIME% = 2 +WINNLSGetEnableStatus% = 1 +WINNLSGetIMEHotkey% = 1 +WaitForInputIdle% = 2 +WaitMessage% = 0 +WinHelp% = 4 +WindowFromDC% = 1 +WindowFromPoint% = 2 +keybd_event% = 4 +mouse_event% = 5 +wvsprintf% = 3 diff --git a/fasmw172/INCLUDE/PCOUNT/WSOCK32.INC b/fasmw172/INCLUDE/PCOUNT/WSOCK32.INC new file mode 100644 index 0000000..ea401d3 --- /dev/null +++ b/fasmw172/INCLUDE/PCOUNT/WSOCK32.INC @@ -0,0 +1,70 @@ + +; WSOCK32 API calls parameters' count + +AcceptEx% = 8 +EnumProtocols% = 3 +GetAcceptExSockaddrs% = 8 +GetAddressByName% = 10 +GetNameByType% = 3 +GetService% = 7 +GetTypeByName% = 2 +MigrateWinsockConfiguration% = 3 +NPLoadNameSpaces% = 3 +SetService% = 6 +TransmitFile% = 7 +WEP% = 0 +WSAAsyncGetHostByAddr% = 7 +WSAAsyncGetHostByName% = 5 +WSAAsyncGetProtoByName% = 5 +WSAAsyncGetProtoByNumber% = 5 +WSAAsyncGetServByName% = 6 +WSAAsyncGetServByPort% = 6 +WSACancelAsyncRequest% = 4 +WSACancelBlockingCall% = 0 +WSACleanup% = 0 +WSAGetLastError% = 0 +WSAIsBlocking% = 0 +WSARecvEx% = 4 +WSASetBlockingHook% = 1 +WSASetLastError% = 1 +WSAStartup% = 2 +WSAUnhookBlockingHook% = 0 +__WSAFDIsSet% = 2 +accept% = 3 +bind% = 3 +closesocket% = 1 +connect% = 3 +dn_expand% = 5 +gethostbyaddr% = 3 +gethostbyname% = 1 +gethostname% = 2 +getnetbyname% = 1 +getpeername% = 3 +getprotobyname% = 1 +getprotobynumber% = 1 +getservbyname% = 2 +getservbyport% = 2 +getsockname% = 3 +getsockopt% = 5 +htonl% = 1 +htons% = 1 +inet_addr% = 1 +inet_network% = 1 +inet_ntoa% = 1 +ioctlsocket% = 3 +listen% = 2 +ntohl% = 1 +ntohs% = 1 +rcmd% = 6 +recv% = 4 +recvfrom% = 6 +rexec% = 6 +rresvport% = 1 +s_perror% = 2 +select% = 5 +send% = 4 +sendto% = 6 +sethostname% = 2 +setsockopt% = 5 +shutdown% = 2 +socket% = 3 diff --git a/fasmw172/INCLUDE/WIN32A.INC b/fasmw172/INCLUDE/WIN32A.INC new file mode 100644 index 0000000..f3520de --- /dev/null +++ b/fasmw172/INCLUDE/WIN32A.INC @@ -0,0 +1,25 @@ + +; Win32 programming headers (ASCII) + +include 'macro/struct.inc' +include 'macro/proc32.inc' +include 'macro/com32.inc' +include 'macro/import32.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . db val \} + match , val \{ . db ? \} } +sizeof.TCHAR = 1 + +include 'equates/kernel32.inc' +include 'equates/user32.inc' +include 'equates/gdi32.inc' +include 'equates/comctl32.inc' +include 'equates/comdlg32.inc' +include 'equates/shell32.inc' +include 'equates/wsock32.inc' + +macro api [name] { if used name + label name dword at name#A + end if } diff --git a/fasmw172/INCLUDE/WIN32AX.INC b/fasmw172/INCLUDE/WIN32AX.INC new file mode 100644 index 0000000..2d24315 --- /dev/null +++ b/fasmw172/INCLUDE/WIN32AX.INC @@ -0,0 +1,172 @@ + +; Extended Win32 programming headers (ASCII) + +include 'win32a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd <value> + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \reverse pushd <arg> + \common call [proc] \} + macro stdcall proc,[arg] + \{ \reverse pushd <arg> + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + call ..continue + db value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + call ..continue + db value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/fasmw172/INCLUDE/WIN32AXP.INC b/fasmw172/INCLUDE/WIN32AXP.INC new file mode 100644 index 0000000..13c6a9e --- /dev/null +++ b/fasmw172/INCLUDE/WIN32AXP.INC @@ -0,0 +1,199 @@ + +; Extended Win32 programming headers with parameters count checking (ASCII) + +include 'win32a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd <value> + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd <arg> + \common call [proc] \} + macro stdcall proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd <arg> + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + call ..continue + db value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + call ..continue + db value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/fasmw172/INCLUDE/WIN32W.INC b/fasmw172/INCLUDE/WIN32W.INC new file mode 100644 index 0000000..99e8679 --- /dev/null +++ b/fasmw172/INCLUDE/WIN32W.INC @@ -0,0 +1,25 @@ + +; Win32 programming headers (WideChar) + +include 'macro/struct.inc' +include 'macro/proc32.inc' +include 'macro/com32.inc' +include 'macro/import32.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . du val \} + match , val \{ . du ? \} } +sizeof.TCHAR = 2 + +include 'equates/kernel32.inc' +include 'equates/user32.inc' +include 'equates/gdi32.inc' +include 'equates/comctl32.inc' +include 'equates/comdlg32.inc' +include 'equates/shell32.inc' +include 'equates/wsock32.inc' + +macro api [name] { if used name + label name dword at name#W + end if } diff --git a/fasmw172/INCLUDE/WIN32WX.INC b/fasmw172/INCLUDE/WIN32WX.INC new file mode 100644 index 0000000..4f7e50e --- /dev/null +++ b/fasmw172/INCLUDE/WIN32WX.INC @@ -0,0 +1,174 @@ + +; Extended Win32 programming headers (WideChar) + +include 'win32w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd <value> + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \reverse pushd <arg> + \common call [proc] \} + macro stdcall proc,[arg] + \{ \reverse pushd <arg> + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/fasmw172/INCLUDE/WIN32WXP.INC b/fasmw172/INCLUDE/WIN32WXP.INC new file mode 100644 index 0000000..177fb80 --- /dev/null +++ b/fasmw172/INCLUDE/WIN32WXP.INC @@ -0,0 +1,201 @@ + +; Extended Win32 programming headers with parameters count checking (WideChar) + +include 'win32w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro pushd value + \{ match ,value \\{ + pushx equ \\} + match =pushx =invoke proc,pushx value \\{ + allow_nesting + invoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =stdcall proc,pushx value \\{ + allow_nesting + stdcall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =cinvoke proc,pushx value \\{ + allow_nesting + cinvoke proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx =ccall proc,pushx value \\{ + allow_nesting + ccall proc + purge pushd,invoke,stdcall,cinvoke,ccall + push eax + pushx equ \\} + match =pushx,pushx \\{ + pushd <value> + pushx equ \\} + restore pushx \} + macro invoke proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd <arg> + \common call [proc] \} + macro stdcall proc,[arg] + \{ \common count@stdcall = 0 + if ~ arg eq + \forward count@stdcall = count@stdcall+1 + match =double value, arg \\{ count@stdcall = count@stdcall+1 \\} + \common end if + if proc eqtype 0 & defined proc \# % & count@stdcall <> proc \# % + display "Error: invalid count of parameters for ",\`proc,".",0Dh,0Ah + assert 0 + end if + \reverse pushd <arg> + \common call proc \} + macro cinvoke proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call [proc] + if size + add esp,size + end if \} + macro ccall proc,[arg] + \{ \common \local size + size = 0 + if ~ arg eq + \reverse pushd <arg> + size = size+4 + match =double any,arg \\{ size = size+4 \\} + \common end if + call proc + if size + add esp,size + end if \} } + +macro pushd value +{ match first=,more, value \{ \local ..continue + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + pushd equ \} + match pushd =addr var,pushd value \{ \local ..opcode,..address + if +var relativeto 0 | +var relativeto $ + push var + else + lea edx,[var] + push edx + end if + pushd equ \} + match pushd =double [var],pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double =ptr var,pushd value \{ + push dword [var+4] + push dword [var] + pushd equ \} + match pushd =double num,pushd value \{ \local ..high,..low + virtual at 0 + dq num + load ..low dword from 0 + load ..high dword from 4 + end virtual + push ..high + push ..low + pushd equ \} + match pushd,pushd \{ \local ..continue + if value eqtype '' + times 1 - (rva $ and 1) nop + call ..continue + du value,0 + ..continue: + else + push value + end if + pushd equ \} + restore pushd } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { section '.text' code readable executable } + +macro .end label +{ + entry label + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + xchg eax,eax + detected_16bit = $-1 +end virtual + +if detected_16bit + format PE GUI 4.0 +end if diff --git a/fasmw172/INCLUDE/WIN64A.INC b/fasmw172/INCLUDE/WIN64A.INC new file mode 100644 index 0000000..51da7fc --- /dev/null +++ b/fasmw172/INCLUDE/WIN64A.INC @@ -0,0 +1,25 @@ + +; Win64 programming headers (ASCII) + +include 'macro/struct.inc' +include 'macro/proc64.inc' +include 'macro/com64.inc' +include 'macro/import64.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . db val \} + match , val \{ . db ? \} } +sizeof.TCHAR = 1 + +include 'equates/kernel64.inc' +include 'equates/user64.inc' +include 'equates/gdi64.inc' +include 'equates/comctl64.inc' +include 'equates/comdlg64.inc' +include 'equates/shell64.inc' + +macro api [name] { if used name + label name qword at name#A + end if } + diff --git a/fasmw172/INCLUDE/WIN64AX.INC b/fasmw172/INCLUDE/WIN64AX.INC new file mode 100644 index 0000000..cbc21a5 --- /dev/null +++ b/fasmw172/INCLUDE/WIN64AX.INC @@ -0,0 +1,205 @@ + +; Extended Win64 programming headers (ASCII) + +include 'win64a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + list equ list <param> + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc \\} + match ,outer_frame \\{ endf \\} \} } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/fasmw172/INCLUDE/WIN64AXP.INC b/fasmw172/INCLUDE/WIN64AXP.INC new file mode 100644 index 0000000..caa3e2b --- /dev/null +++ b/fasmw172/INCLUDE/WIN64AXP.INC @@ -0,0 +1,221 @@ + +; Extended Win64 programming headers with parameters count checking (ASCII) + +include 'win64a.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + match any,param \\{ list equ list <param> \\} + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc + define counter 0 \\} + match ,outer_frame \\{ endf \\} + proc@paramcheck equ proc + match [name],proc \\{ define proc@paramcheck name \\} + match name,proc@paramcheck \\{ if name eqtype 0 & defined name \\# % & counter <> name \\# % + display "Error: invalid count of parameters for ",\\`name,".",0Dh,0Ah + assert 0 + end if \\} \} } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/fasmw172/INCLUDE/WIN64W.INC b/fasmw172/INCLUDE/WIN64W.INC new file mode 100644 index 0000000..5f444b6 --- /dev/null +++ b/fasmw172/INCLUDE/WIN64W.INC @@ -0,0 +1,24 @@ + +; Win64 programming headers (WideChar) + +include 'macro/struct.inc' +include 'macro/proc64.inc' +include 'macro/com64.inc' +include 'macro/import64.inc' +include 'macro/export.inc' +include 'macro/resource.inc' + +struc TCHAR [val] { common match any, val \{ . du val \} + match , val \{ . du ? \} } +sizeof.TCHAR = 2 + +include 'equates/kernel64.inc' +include 'equates/user64.inc' +include 'equates/gdi64.inc' +include 'equates/comctl64.inc' +include 'equates/comdlg64.inc' +include 'equates/shell64.inc' + +macro api [name] { if used name + label name qword at name#W + end if } \ No newline at end of file diff --git a/fasmw172/INCLUDE/WIN64WX.INC b/fasmw172/INCLUDE/WIN64WX.INC new file mode 100644 index 0000000..0aaeb31 --- /dev/null +++ b/fasmw172/INCLUDE/WIN64WX.INC @@ -0,0 +1,204 @@ + +; Extended Win64 programming headers (WideChar) + +include 'win64w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + list equ list <param> + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc \\} + match ,outer_frame \\{ endf \\} \} } + +allow_nesting + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/fasmw172/INCLUDE/WIN64WXP.INC b/fasmw172/INCLUDE/WIN64WXP.INC new file mode 100644 index 0000000..144caae --- /dev/null +++ b/fasmw172/INCLUDE/WIN64WXP.INC @@ -0,0 +1,221 @@ + +; Extended Win64 programming headers with parameters count checking (WideChar) + +include 'win64w.inc' + +include 'macro/if.inc' + +macro allow_nesting +{ macro invoke proc,[arg] + \{ \common fastcall [proc],arg \} + macro fastcall proc,[arg] + \{ \common \local list,counter,flags,outer_frame,nested_frame,..close_nest + match =current@frame,current@frame \\{ + frame + define outer_frame \\} + define counter + define list + flags = 0 + \forward \local param,nested,isfloat,..next + match any,counter \\{ list equ list, \\} + counter equ counter+1 + define param arg + define nested + isfloat = 0 + match =invoke statement,param \\{ + nested equ param + define param \\} + match =fastcall statement,param \\{ + nested equ param + define param \\} + match =float =invoke statement,param \\{ + define nested invoke statement + define param + isfloat = 1 \\} + match =float =fastcall statement,param \\{ + define nested fastcall statement + define param + isfloat = 1 \\} + match statement,nested \\{ + match =nested_frame,nested_frame \\\{ + frame + define nested_frame \\\} + allow_nesting + statement + purge invoke_fastcall + if counter > 4 + if isfloat + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (counter-1) + if isfloat + flags = flags or 1 shl (4+counter-1) + end if + if ..close_nest > ..next + if float + movq [rsp+size@frame+(counter-1)*8],xmm0 + else + mov [rsp+size@frame+(counter-1)*8],rax + end if + else + flags = flags or 1 shl (8+counter-1) + end if + end if + ..next: \\} + match any,param \\{ list equ list <param> \\} + \common ..close_nest: + match ,nested_frame \\{ endf \\} + if flags and 1 + if flags and 1 shl 4 + if ~ flags and 1 shl 8 + movq xmm0,[rsp] + end if + else + if flags and 1 shl 8 + mov rcx,rax + else + mov rcx,[rsp] + end if + end if + end if + if flags and 1 shl 1 + if flags and 1 shl (4+1) + if flags and 1 shl (8+1) + movq xmm1,xmm0 + else + movq xmm1,[rsp+8] + end if + else + if flags and 1 shl (8+1) + mov rdx,rax + else + mov rdx,[rsp+8] + end if + end if + end if + if flags and 1 shl 2 + if flags and 1 shl (4+2) + if flags and 1 shl (8+2) + movq xmm2,xmm0 + else + movq xmm2,[rsp+2*8] + end if + else + if flags and 1 shl (8+2) + mov r8,rax + else + mov r8,[rsp+2*8] + end if + end if + end if + if flags and 1 shl 3 + if flags and 1 shl (4+3) + if flags and 1 shl (8+3) + movq xmm3,xmm0 + else + movq xmm3,[rsp+3*8] + end if + else + if flags and 1 shl (8+3) + mov r9,rax + else + mov r9,[rsp+3*8] + end if + end if + end if + match args,list \\{ fastcall proc,args \\} + match ,list \\{ fastcall proc + define counter 0 \\} + match ,outer_frame \\{ endf \\} + proc@paramcheck equ proc + match [name],proc \\{ define proc@paramcheck name \\} + match name,proc@paramcheck \\{ if name eqtype 0 & defined name \\# % & counter <> name \\# % + display "Error: invalid count of parameters for ",\\`name,".",0Dh,0Ah + assert 0 + end if \\} \} } + +allow_nesting + +include 'pcount/kernel32.inc' +include 'pcount/user32.inc' +include 'pcount/gdi32.inc' +include 'pcount/advapi32.inc' +include 'pcount/comctl32.inc' +include 'pcount/comdlg32.inc' +include 'pcount/shell32.inc' +include 'pcount/wsock32.inc' + +macro import lib,[functions] +{ common macro import_#lib \{ import lib,functions \} } + +macro api [functions] +{ common macro all_api \{ all_api + api functions \} } +macro all_api {} + +include 'api/kernel32.inc' +include 'api/user32.inc' +include 'api/gdi32.inc' +include 'api/advapi32.inc' +include 'api/comctl32.inc' +include 'api/comdlg32.inc' +include 'api/shell32.inc' +include 'api/wsock32.inc' + +purge import,api + +macro .data { section '.data' data readable writeable } + +macro .code { + section '.text' code readable executable + entry $ + sub rsp,8 + local main,code + entry equ main + if main <> code + jmp main + end if + code: } + +macro .end value +{ + label entry at value + + section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL',\ + user32,'USER32.DLL',\ + gdi32,'GDI32.DLL',\ + advapi32,'ADVAPI32.DLL',\ + comctl32,'COMCTL32.DLL',\ + comdlg32,'COMDLG32.DLL',\ + shell32,'SHELL32.DLL',\ + wsock32,'WSOCK32.DLL' + + import_kernel32 + import_user32 + import_gdi32 + import_advapi32 + import_comctl32 + import_comdlg32 + import_shell32 + import_wsock32 + + all_api +} + +virtual at 0 + inc ax + if $=1 + detected_16bit = 1 + else + detected_16bit = 0 + end if +end virtual + +if detected_16bit + format PE64 GUI 5.0 +end if diff --git a/fasmw172/LICENSE.TXT b/fasmw172/LICENSE.TXT new file mode 100644 index 0000000..2b2fc7b --- /dev/null +++ b/fasmw172/LICENSE.TXT @@ -0,0 +1,37 @@ + +flat assembler version 1.72 +Copyright (c) 1999-2017, Tomasz Grysztar. +All rights reserved. + +This program is free for commercial and non-commercial use as long as +the following conditions are adhered to. + +Copyright remains Tomasz Grysztar, and as such any Copyright notices +in the code are not to be removed. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The licence and distribution terms for any publically available +version or derivative of this code cannot be changed. i.e. this code +cannot simply be copied and put under another distribution licence +(including the GNU Public Licence). diff --git a/fasmw172/SOURCE/ASSEMBLE.INC b/fasmw172/SOURCE/ASSEMBLE.INC new file mode 100644 index 0000000..8b028ff --- /dev/null +++ b/fasmw172/SOURCE/ASSEMBLE.INC @@ -0,0 +1,2038 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +assembler: + xor eax,eax + mov [stub_size],eax + mov [current_pass],ax + mov [resolver_flags],eax + mov [number_of_sections],eax + mov [actual_fixups_size],eax + assembler_loop: + mov eax,[labels_list] + mov [tagged_blocks],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [structures_buffer],eax + mov esi,[source_start] + mov edi,[code_start] + xor eax,eax + mov dword [adjustment],eax + mov dword [adjustment+4],eax + mov [addressing_space],eax + mov [error_line],eax + mov [counter],eax + mov [format_flags],eax + mov [number_of_relocations],eax + mov [undefined_data_end],eax + mov [file_extension],eax + mov [next_pass_needed],al + mov [output_format],al + mov [adjustment_sign],al + mov [evex_mode],al + mov [code_type],16 + call init_addressing_space + pass_loop: + call assemble_line + jnc pass_loop + mov eax,[additional_memory_end] + cmp eax,[structures_buffer] + je pass_done + sub eax,18h + mov eax,[eax+4] + mov [current_line],eax + jmp missing_end_directive + pass_done: + call close_pass + mov eax,[labels_list] + check_symbols: + cmp eax,[memory_end] + jae symbols_checked + test byte [eax+8],8 + jz symbol_defined_ok + mov cx,[current_pass] + cmp cx,[eax+18] + jne symbol_defined_ok + test byte [eax+8],1 + jz symbol_defined_ok + sub cx,[eax+16] + cmp cx,1 + jne symbol_defined_ok + and byte [eax+8],not 1 + or [next_pass_needed],-1 + symbol_defined_ok: + test byte [eax+8],10h + jz use_prediction_ok + mov cx,[current_pass] + and byte [eax+8],not 10h + test byte [eax+8],20h + jnz check_use_prediction + cmp cx,[eax+18] + jne use_prediction_ok + test byte [eax+8],8 + jz use_prediction_ok + jmp use_misprediction + check_use_prediction: + test byte [eax+8],8 + jz use_misprediction + cmp cx,[eax+18] + je use_prediction_ok + use_misprediction: + or [next_pass_needed],-1 + use_prediction_ok: + test byte [eax+8],40h + jz check_next_symbol + and byte [eax+8],not 40h + test byte [eax+8],4 + jnz define_misprediction + mov cx,[current_pass] + test byte [eax+8],80h + jnz check_define_prediction + cmp cx,[eax+16] + jne check_next_symbol + test byte [eax+8],1 + jz check_next_symbol + jmp define_misprediction + check_define_prediction: + test byte [eax+8],1 + jz define_misprediction + cmp cx,[eax+16] + je check_next_symbol + define_misprediction: + or [next_pass_needed],-1 + check_next_symbol: + add eax,LABEL_STRUCTURE_SIZE + jmp check_symbols + symbols_checked: + cmp [next_pass_needed],0 + jne next_pass + mov eax,[error_line] + or eax,eax + jz assemble_ok + mov [current_line],eax + cmp [error],undefined_symbol + jne error_confirmed + mov eax,[error_info] + or eax,eax + jz error_confirmed + test byte [eax+8],1 + jnz next_pass + error_confirmed: + call error_handler + error_handler: + mov eax,[error] + sub eax,error_handler + add [esp],eax + ret + next_pass: + inc [current_pass] + mov ax,[current_pass] + cmp ax,[passes_limit] + je code_cannot_be_generated + jmp assembler_loop + assemble_ok: + ret + +create_addressing_space: + mov ebx,[addressing_space] + test ebx,ebx + jz init_addressing_space + test byte [ebx+0Ah],1 + jnz illegal_instruction + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + init_addressing_space: + mov ebx,[tagged_blocks] + mov dword [ebx-4],10h + mov dword [ebx-8],20h + sub ebx,8+20h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [addressing_space],ebx + xor eax,eax + mov [ebx],edi + mov [ebx+4],eax + mov [ebx+8],eax + mov [ebx+10h],eax + mov [ebx+14h],eax + mov [ebx+18h],edi + mov [ebx+1Ch],eax + ret + +assemble_line: + mov eax,[tagged_blocks] + sub eax,100h + cmp edi,eax + ja out_of_memory + lods byte [esi] + cmp al,1 + je assemble_instruction + jb source_end + cmp al,3 + jb define_label + je define_constant + cmp al,4 + je label_addressing_space + cmp al,0Fh + je new_line + cmp al,13h + je code_type_setting + cmp al,10h + jne illegal_instruction + lods byte [esi] + jmp segment_prefix + code_type_setting: + lods byte [esi] + mov [code_type],al + jmp instruction_assembled + new_line: + lods dword [esi] + mov [current_line],eax + and [prefix_flags],0 + cmp [symbols_file],0 + je continue_line + cmp [next_pass_needed],0 + jne continue_line + mov ebx,[tagged_blocks] + mov dword [ebx-4],1 + mov dword [ebx-8],14h + sub ebx,8+14h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [ebx],eax + mov [ebx+4],edi + mov eax,[addressing_space] + mov [ebx+8],eax + mov al,[code_type] + mov [ebx+10h],al + continue_line: + cmp byte [esi],0Fh + je line_assembled + jmp assemble_line + define_label: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov ebx,eax + lods byte [esi] + mov [label_size],al + call make_label + jmp continue_line + make_label: + mov eax,edi + xor edx,edx + xor cl,cl + mov ebp,[addressing_space] + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + jp label_value_ok + call recoverable_overflow + label_value_ok: + mov [address_sign],cl + test byte [ds:ebp+0Ah],1 + jnz make_virtual_label + or byte [ebx+9],1 + xchg eax,[ebx] + xchg edx,[ebx+4] + mov ch,[ebx+9] + shr ch,1 + and ch,1 + neg ch + sub eax,[ebx] + sbb edx,[ebx+4] + sbb ch,cl + mov dword [adjustment],eax + mov dword [adjustment+4],edx + mov [adjustment_sign],ch + or al,ch + or eax,edx + setnz ah + jmp finish_label + make_virtual_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + finish_label: + mov ebp,[addressing_space] + mov ch,[ds:ebp+9] + mov cl,[label_size] + mov edx,[ds:ebp+14h] + mov ebp,[ds:ebp+10h] + finish_label_symbol: + mov al,[address_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + cmp ebp,[ebx+12] + mov [ebx+12],ebp + setne al + or ah,al + or ch,ch + jz label_symbol_ok + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + label_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + and byte [ebx+8],not 2 + test byte [ebx+8],1 + jz new_label + cmp cx,[ebx+16] + je symbol_already_defined + btr dword [ebx+8],10 + jc requalified_label + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz label_made + test byte [ebx+8],8 + jz label_made + mov cx,[current_pass] + cmp cx,[ebx+18] + jne label_made + requalified_label: + or [next_pass_needed],-1 + label_made: + ret + new_label: + or byte [ebx+8],1 + ret + define_constant: + lods dword [esi] + inc esi + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + push eax + or [operand_flags],1 + call get_value + pop ebx + xor cl,cl + mov ch,[value_type] + cmp ch,3 + je invalid_use_of_symbol + make_constant: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov al,[value_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + xor edx,edx + cmp edx,[ebx+12] + mov [ebx+12],edx + setne al + or ah,al + or ch,ch + jz constant_symbol_ok + mov edx,[symbol_identifier] + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + constant_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + test byte [ebx+8],1 + jz new_constant + cmp cx,[ebx+16] + jne redeclare_constant + test byte [ebx+8],2 + jz symbol_already_defined + or byte [ebx+8],4 + and byte [ebx+9],not 4 + jmp instruction_assembled + redeclare_constant: + btr dword [ebx+8],10 + jc requalified_constant + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz instruction_assembled + test byte [ebx+8],4 + jnz instruction_assembled + test byte [ebx+8],8 + jz instruction_assembled + mov cx,[current_pass] + cmp cx,[ebx+18] + jne instruction_assembled + requalified_constant: + or [next_pass_needed],-1 + jmp instruction_assembled + new_constant: + or byte [ebx+8],1+2 + jmp instruction_assembled + label_addressing_space: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov cx,[current_pass] + test byte [eax+8],1 + jz make_addressing_space_label + cmp cx,[eax+16] + je symbol_already_defined + test byte [eax+9],4 + jnz make_addressing_space_label + or [next_pass_needed],-1 + make_addressing_space_label: + mov dx,[eax+8] + and dx,not (2 or 100h) + or dx,1 or 4 or 400h + mov [eax+8],dx + mov [eax+16],cx + mov edx,[current_line] + mov [eax+28],edx + mov ebx,[addressing_space] + mov [eax],ebx + or byte [ebx+0Ah],2 + jmp continue_line + assemble_instruction: +; mov [operand_size],0 +; mov [operand_flags],0 +; mov [operand_prefix],0 +; mov [rex_prefix],0 + and dword [operand_size],0 +; mov [opcode_prefix],0 +; mov [vex_required],0 +; mov [vex_register],0 +; mov [immediate_size],0 + and dword [opcode_prefix],0 + call instruction_handler + instruction_handler: + movzx ebx,word [esi] + mov al,[esi+2] + add esi,3 + add [esp],ebx + ret + instruction_assembled: + test [prefix_flags],not 1 + jnz illegal_instruction + mov al,[esi] + cmp al,0Fh + je line_assembled + or al,al + jnz extra_characters_on_line + line_assembled: + clc + ret + source_end: + dec esi + stc + ret + +org_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + mov cl,[value_type] + test cl,1 + jnz invalid_use_of_symbol + push eax + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + test byte [ebx+0Ah],1 + jnz in_virtual + call init_addressing_space + jmp org_space_ok + in_virtual: + call close_virtual_addressing_space + call init_addressing_space + or byte [ebx+0Ah],1 + org_space_ok: + pop eax + mov [ebx+9],cl + mov cl,[value_sign] + sub [ebx],eax + sbb [ebx+4],edx + sbb byte [ebx+8],cl + jp org_value_ok + call recoverable_overflow + org_value_ok: + mov edx,[symbol_identifier] + mov [ebx+14h],edx + cmp [output_format],1 + ja instruction_assembled + cmp edi,[code_start] + jne instruction_assembled + cmp eax,100h + jne instruction_assembled + bts [format_flags],0 + jmp instruction_assembled +label_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + mov [label_size],0 + lods byte [esi] + cmp al,':' + je get_label_size + dec esi + cmp al,11h + jne label_size_ok + get_label_size: + lods word [esi] + cmp al,11h + jne invalid_argument + mov [label_size],ah + label_size_ok: + cmp byte [esi],80h + je get_free_label_value + call make_label + jmp instruction_assembled + get_free_label_value: + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + push ebx ecx + or byte [ebx+8],4 + cmp byte [esi],'.' + je invalid_value + call get_address_value + or bh,bh + setnz ch + xchg ch,cl + mov bp,cx + shl ebp,16 + xchg bl,bh + mov bp,bx + pop ecx ebx + and byte [ebx+8],not 4 + mov ch,[value_type] + test ch,1 + jnz invalid_use_of_symbol + make_free_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov edx,[address_symbol] + mov cl,[label_size] + call finish_label_symbol + jmp instruction_assembled +load_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + push eax + mov al,1 + cmp byte [esi],11h + jne load_size_ok + lods byte [esi] + lods byte [esi] + load_size_ok: + cmp al,8 + ja invalid_value + mov [operand_size],al + and dword [value],0 + and dword [value+4],0 + lods byte [esi] + cmp al,82h + jne invalid_argument + call get_data_point + jc value_loaded + push esi edi + mov esi,ebx + mov edi,value + rep movs byte [edi],[esi] + pop edi esi + value_loaded: + mov [value_sign],0 + mov eax,dword [value] + mov edx,dword [value+4] + pop ebx + xor cx,cx + jmp make_constant + get_data_point: + mov ebx,[addressing_space] + mov ecx,edi + sub ecx,[ebx+18h] + mov [ebx+1Ch],ecx + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],11h + jne get_data_address + cmp word [esi+1+4],'):' + jne get_data_address + inc esi + lods dword [esi] + add esi,2 + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp eax,0Fh + jbe reserved_word_used_as_symbol + mov edx,undefined_symbol + test byte [eax+8],1 + jz addressing_space_unavailable + mov edx,symbol_out_of_scope + mov cx,[eax+16] + cmp cx,[current_pass] + jne addressing_space_unavailable + test byte [eax+9],4 + jz invalid_use_of_symbol + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + or byte [ebx+8],8 + cmp [symbols_file],0 + je get_addressing_space + cmp [next_pass_needed],0 + jne get_addressing_space + call store_label_reference + get_addressing_space: + mov ebx,[ebx] + get_data_address: + push ebx + cmp byte [esi],'.' + je invalid_value + or [operand_flags],1 + call get_address_value + pop ebp + call calculate_relative_offset + cmp [next_pass_needed],0 + jne data_address_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + data_address_type_ok: + mov ebx,edi + xor ecx,ecx + add ebx,eax + adc edx,ecx + mov eax,ebx + sub eax,[ds:ebp+18h] + sbb edx,ecx + jnz bad_data_address + mov cl,[operand_size] + add eax,ecx + cmp eax,[ds:ebp+1Ch] + ja bad_data_address + clc + ret + addressing_space_unavailable: + cmp [error_line],0 + jne get_data_address + push [current_line] + pop [error_line] + mov [error],edx + mov [error_info],eax + jmp get_data_address + bad_data_address: + call recoverable_overflow + stc + ret +store_directive: + cmp byte [esi],11h + je sized_store + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_byte_value + xor edx,edx + movzx eax,al + mov [operand_size],1 + jmp store_value_ok + sized_store: + or [operand_flags],1 + call get_value + store_value_ok: + cmp [value_type],0 + jne invalid_use_of_symbol + mov dword [value],eax + mov dword [value+4],edx + lods byte [esi] + cmp al,80h + jne invalid_argument + call get_data_point + jc instruction_assembled + push esi edi + mov esi,value + mov edi,ebx + rep movs byte [edi],[esi] + mov eax,edi + pop edi esi + cmp ebx,[undefined_data_end] + jae instruction_assembled + cmp eax,[undefined_data_start] + jbe instruction_assembled + mov [undefined_data_start],eax + jmp instruction_assembled + +display_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],0 + jne display_byte + inc esi + lods dword [esi] + mov ecx,eax + push edi + mov edi,[tagged_blocks] + sub edi,8 + sub edi,eax + cmp edi,[esp] + jbe out_of_memory + mov [tagged_blocks],edi + rep movs byte [edi],[esi] + stos dword [edi] + xor eax,eax + stos dword [edi] + pop edi + inc esi + jmp display_next + display_byte: + call get_byte_value + push edi + mov edi,[tagged_blocks] + sub edi,8+1 + mov [tagged_blocks],edi + stos byte [edi] + mov eax,1 + stos dword [edi] + dec eax + stos dword [edi] + pop edi + display_next: + cmp edi,[tagged_blocks] + ja out_of_memory + lods byte [esi] + cmp al,',' + je display_directive + dec esi + jmp instruction_assembled +show_display_buffer: + mov eax,[tagged_blocks] + or eax,eax + jz display_done + mov esi,[labels_list] + cmp esi,eax + je display_done + display_messages: + sub esi,8 + mov eax,[esi+4] + mov ecx,[esi] + sub esi,ecx + test eax,eax + jnz skip_block + push esi + call display_block + pop esi + skip_block: + cmp esi,[tagged_blocks] + jne display_messages + display_done: + ret + +times_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_times + cmp byte [esi],':' + jne times_argument_ok + inc esi + times_argument_ok: + push [counter] + push [counter_limit] + mov [counter_limit],eax + mov [counter],1 + times_loop: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push esi + or [prefix_flags],1 + call continue_line + mov eax,[counter_limit] + cmp [counter],eax + je times_done + inc [counter] + pop esi + jmp times_loop + times_done: + pop eax + pop [counter_limit] + pop [counter] + jmp instruction_assembled + zero_times: + call skip_symbol + jnc zero_times + jmp instruction_assembled + +virtual_directive: + lods byte [esi] + cmp al,80h + jne virtual_at_current + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_address_value + mov ebp,[address_symbol] + or bh,bh + setnz ch + jmp set_virtual + virtual_at_current: + dec esi + mov ebp,[addressing_space] + mov al,[ds:ebp+9] + mov [value_type],al + mov eax,edi + xor edx,edx + xor cl,cl + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + mov [address_sign],cl + mov bx,[ds:ebp+10h] + mov cx,[ds:ebp+10h+2] + xchg bh,bl + xchg ch,cl + mov ebp,[ds:ebp+14h] + set_virtual: + xchg bl,bh + xchg cl,ch + shl ecx,16 + mov cx,bx + push ecx eax + call allocate_structure_data + mov word [ebx],virtual_directive-instruction_handler + mov ecx,[addressing_space] + mov [ebx+12],ecx + mov [ebx+8],edi + mov ecx,[current_line] + mov [ebx+4],ecx + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + call init_addressing_space + or byte [ebx+0Ah],1 + pop eax + mov cl,[address_sign] + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + mov [ebx],eax + mov [ebx+4],edx + mov [ebx+8],cl + pop dword [ebx+10h] + mov [ebx+14h],ebp + mov al,[value_type] + test al,1 + jnz invalid_use_of_symbol + mov [ebx+9],al + jmp instruction_assembled + allocate_structure_data: + mov ebx,[structures_buffer] + sub ebx,18h + cmp ebx,[free_additional_memory] + jb out_of_memory + mov [structures_buffer],ebx + ret + find_structure_data: + mov ebx,[structures_buffer] + scan_structures: + cmp ebx,[additional_memory_end] + je no_such_structure + cmp ax,[ebx] + je structure_data_found + add ebx,18h + jmp scan_structures + structure_data_found: + ret + no_such_structure: + stc + ret + end_virtual: + call find_structure_data + jc unexpected_instruction + push ebx + call close_virtual_addressing_space + pop ebx + mov eax,[ebx+12] + mov [addressing_space],eax + mov edi,[ebx+8] + remove_structure_data: + push esi edi + mov ecx,ebx + sub ecx,[structures_buffer] + shr ecx,2 + lea esi,[ebx-4] + lea edi,[esi+18h] + std + rep movs dword [edi],[esi] + cld + add [structures_buffer],18h + pop edi esi + ret + close_virtual_addressing_space: + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + test byte [ebx+0Ah],2 + jz addressing_space_closed + push esi edi ecx edx + mov ecx,eax + mov eax,[tagged_blocks] + mov dword [eax-4],11h + mov dword [eax-8],ecx + sub eax,8 + sub eax,ecx + mov [tagged_blocks],eax + lea edi,[eax+ecx-1] + xchg eax,[ebx+18h] + lea esi,[eax+ecx-1] + mov eax,edi + sub eax,esi + std + shr ecx,1 + jnc virtual_byte_ok + movs byte [edi],[esi] + virtual_byte_ok: + dec esi + dec edi + shr ecx,1 + jnc virtual_word_ok + movs word [edi],[esi] + virtual_word_ok: + sub esi,2 + sub edi,2 + rep movs dword [edi],[esi] + cld + xor edx,edx + add [ebx],eax + adc dword [ebx+4],edx + adc byte [ebx+8],dl + pop edx ecx edi esi + addressing_space_closed: + ret +repeat_directive: + test [prefix_flags],1 + jnz unexpected_instruction + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_repeat + call allocate_structure_data + mov word [ebx],repeat_directive-instruction_handler + xchg eax,[counter_limit] + mov [ebx+10h],eax + mov eax,1 + xchg eax,[counter] + mov [ebx+14h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + end_repeat: + test [prefix_flags],1 + jnz unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[counter_limit] + inc [counter] + cmp [counter],eax + jbe continue_repeating + stop_repeat: + mov eax,[ebx+10h] + mov [counter_limit],eax + mov eax,[ebx+14h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + continue_repeating: + mov esi,[ebx+8] + jmp instruction_assembled + zero_repeat: + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_repeat + jmp instruction_assembled + find_end_repeat: + call find_structure_end + cmp ax,repeat_directive-instruction_handler + jne unexpected_instruction + ret +while_directive: + test [prefix_flags],1 + jnz unexpected_instruction + call allocate_structure_data + mov word [ebx],while_directive-instruction_handler + mov eax,1 + xchg eax,[counter] + mov [ebx+10h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + do_while: + push ebx + call calculate_logical_expression + or al,al + jnz while_true + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + stop_while: + call find_end_while + pop ebx + mov eax,[ebx+10h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + while_true: + pop ebx + jmp instruction_assembled + end_while: + test [prefix_flags],1 + jnz unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[ebx+4] + mov [current_line],eax + inc [counter] + jz too_many_repeats + mov esi,[ebx+8] + jmp do_while + find_end_while: + call find_structure_end + cmp ax,while_directive-instruction_handler + jne unexpected_instruction + ret +if_directive: + test [prefix_flags],1 + jnz unexpected_instruction + call calculate_logical_expression + mov dl,al + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or dl,dl + jnz if_true + call find_else + jc instruction_assembled + mov al,[esi] + cmp al,1 + jne else_true + cmp word [esi+1],if_directive-instruction_handler + jne else_true + add esi,4 + jmp if_directive + if_true: + xor al,al + make_if_structure: + call allocate_structure_data + mov word [ebx],if_directive-instruction_handler + mov byte [ebx+2],al + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + else_true: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or al,-1 + jmp make_if_structure + else_directive: + test [prefix_flags],1 + jnz unexpected_instruction + mov ax,if_directive-instruction_handler + call find_structure_data + jc unexpected_instruction + cmp byte [ebx+2],0 + jne unexpected_instruction + found_else: + mov al,[esi] + cmp al,1 + jne skip_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_else + add esi,4 + call find_else + jnc found_else + call remove_structure_data + jmp instruction_assembled + skip_else: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_if + call remove_structure_data + jmp instruction_assembled + end_if: + test [prefix_flags],1 + jnz unexpected_instruction + call find_structure_data + jc unexpected_instruction + call remove_structure_data + jmp instruction_assembled + find_else: + call find_structure_end + cmp ax,else_directive-instruction_handler + je else_found + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + stc + ret + else_found: + clc + ret + find_end_if: + call find_structure_end + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + ret + find_structure_end: + push [error_line] + mov eax,[current_line] + mov [error_line],eax + find_end_directive: + call skip_symbol + jnc find_end_directive + lods byte [esi] + cmp al,0Fh + jne no_end_directive + lods dword [esi] + mov [current_line],eax + skip_labels: + cmp byte [esi],2 + jne labels_ok + add esi,6 + jmp skip_labels + labels_ok: + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + cmp ax,prefix_instruction-instruction_handler + je find_end_directive + add esi,4 + cmp ax,repeat_directive-instruction_handler + je skip_repeat + cmp ax,while_directive-instruction_handler + je skip_while + cmp ax,if_directive-instruction_handler + je skip_if + cmp ax,else_directive-instruction_handler + je structure_end + cmp ax,end_directive-instruction_handler + jne find_end_directive + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + add esi,4 + cmp ax,repeat_directive-instruction_handler + je structure_end + cmp ax,while_directive-instruction_handler + je structure_end + cmp ax,if_directive-instruction_handler + jne find_end_directive + structure_end: + pop [error_line] + ret + no_end_directive: + mov eax,[error_line] + mov [current_line],eax + jmp missing_end_directive + skip_repeat: + call find_end_repeat + jmp find_end_directive + skip_while: + call find_end_while + jmp find_end_directive + skip_if: + call skip_if_block + jmp find_end_directive + skip_if_block: + call find_else + jc if_block_skipped + cmp byte [esi],1 + jne skip_after_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_after_else + add esi,4 + jmp skip_if_block + skip_after_else: + call find_end_if + if_block_skipped: + ret +end_directive: + lods byte [esi] + cmp al,1 + jne invalid_argument + lods word [esi] + inc esi + cmp ax,virtual_directive-instruction_handler + je end_virtual + cmp ax,repeat_directive-instruction_handler + je end_repeat + cmp ax,while_directive-instruction_handler + je end_while + cmp ax,if_directive-instruction_handler + je end_if + cmp ax,data_directive-instruction_handler + je end_data + jmp invalid_argument +break_directive: + mov ebx,[structures_buffer] + mov al,[esi] + or al,al + jz find_breakable_structure + cmp al,0Fh + jne extra_characters_on_line + find_breakable_structure: + cmp ebx,[additional_memory_end] + je unexpected_instruction + mov ax,[ebx] + cmp ax,repeat_directive-instruction_handler + je break_repeat + cmp ax,while_directive-instruction_handler + je break_while + cmp ax,if_directive-instruction_handler + je break_if + add ebx,18h + jmp find_breakable_structure + break_if: + push [current_line] + mov eax,[ebx+4] + mov [current_line],eax + call remove_structure_data + call skip_if_block + pop [current_line] + mov ebx,[structures_buffer] + jmp find_breakable_structure + break_repeat: + push ebx + call find_end_repeat + pop ebx + jmp stop_repeat + break_while: + push ebx + jmp stop_while + +define_data: + cmp edi,[tagged_blocks] + jae out_of_memory + cmp byte [esi],'(' + jne simple_data_value + mov ebx,esi + inc esi + call skip_expression + xchg esi,ebx + cmp byte [ebx],81h + jne simple_data_value + inc esi + call get_count_value + inc esi + or eax,eax + jz duplicate_zero_times + cmp byte [esi],91h + jne duplicate_single_data_value + inc esi + duplicate_data: + push eax esi + duplicated_values: + cmp edi,[tagged_blocks] + jae out_of_memory + clc + call near dword [esp+8] + lods byte [esi] + cmp al,',' + je duplicated_values + cmp al,92h + jne invalid_argument + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_data + duplicate_single_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + push eax esi + clc + call near dword [esp+8] + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_single_data_value + duplicate_zero_times: + cmp byte [esi],91h + jne skip_single_data_value + inc esi + skip_data_value: + call skip_symbol + jc invalid_argument + cmp byte [esi],92h + jne skip_data_value + inc esi + jmp data_defined + skip_single_data_value: + call skip_symbol + jmp data_defined + simple_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + clc + call near dword [esp] + data_defined: + lods byte [esi] + cmp al,',' + je define_data + dec esi + stc + ret +data_bytes: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_byte + cmp al,'?' + jne invalid_argument + mov eax,edi + mov byte [edi],0 + inc edi + jmp undefined_data + get_byte: + cmp byte [esi],0 + je get_string + call get_byte_value + stos byte [edi] + ret + get_string: + inc esi + lods dword [esi] + mov ecx,eax + lea eax,[edi+ecx] + cmp eax,[tagged_blocks] + ja out_of_memory + rep movs byte [edi],[esi] + inc esi + ret + undefined_data: + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jz mark_undefined_data + ret + mark_undefined_data: + cmp eax,[undefined_data_end] + je undefined_data_ok + mov [undefined_data_start],eax + undefined_data_ok: + mov [undefined_data_end],edi + ret +data_unicode: + or [base_code],-1 + jmp define_words +data_words: + mov [base_code],0 + define_words: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_word + cmp al,'?' + jne invalid_argument + mov eax,edi + and word [edi],0 + scas word [edi] + jmp undefined_data + ret + get_word: + cmp [base_code],0 + je word_data_value + cmp byte [esi],0 + je word_string + word_data_value: + call get_word_value + call mark_relocation + stos word [edi] + ret + word_string: + inc esi + lods dword [esi] + mov ecx,eax + jecxz word_string_ok + lea eax,[edi+ecx*2] + cmp eax,[tagged_blocks] + ja out_of_memory + xor ah,ah + copy_word_string: + lods byte [esi] + stos word [edi] + loop copy_word_string + word_string_ok: + inc esi + ret +data_dwords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_dword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_dword: + push esi + call get_dword_value + pop ebx + cmp byte [esi],':' + je complex_dword + call mark_relocation + stos dword [edi] + ret + complex_dword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_word_value + call mark_relocation + stos word [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_pwords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_pword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_pword: + push esi + call get_pword_value + pop ebx + cmp byte [esi],':' + je complex_pword + call mark_relocation + stos dword [edi] + mov ax,dx + stos word [edi] + ret + complex_pword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_dword_value + call mark_relocation + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_qwords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_qword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_qword: + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + ret +data_twords: + call define_data + jc instruction_assembled + lods byte [esi] + cmp al,'(' + je get_tword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_tword: + cmp byte [esi],'.' + jne complex_tword + inc esi + cmp word [esi+8],8000h + je fp_zero_tword + mov eax,[esi] + stos dword [edi] + mov eax,[esi+4] + stos dword [edi] + mov ax,[esi+8] + add ax,3FFFh + jo value_out_of_range + cmp ax,7FFFh + jge value_out_of_range + cmp ax,0 + jg tword_exp_ok + mov cx,ax + neg cx + inc cx + cmp cx,64 + jae value_out_of_range + cmp cx,32 + ja large_shift + mov eax,[esi] + mov edx,[esi+4] + mov ebx,edx + shr edx,cl + shrd eax,ebx,cl + jmp tword_mantissa_shift_done + large_shift: + sub cx,32 + xor edx,edx + mov eax,[esi+4] + shr eax,cl + tword_mantissa_shift_done: + jnc store_shifted_mantissa + add eax,1 + adc edx,0 + store_shifted_mantissa: + mov [edi-8],eax + mov [edi-4],edx + xor ax,ax + test edx,1 shl 31 + jz tword_exp_ok + inc ax + tword_exp_ok: + mov bl,[esi+11] + shl bx,15 + or ax,bx + stos word [edi] + add esi,13 + ret + fp_zero_tword: + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,[esi+11] + shl ax,15 + stos word [edi] + add esi,13 + ret + complex_tword: + call get_word_value + push eax + cmp byte [esi],':' + jne invalid_operand + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_file: + lods word [esi] + cmp ax,'(' + jne invalid_argument + add esi,4 + call open_binary_file + mov eax,[esi-4] + lea esi,[esi+eax+1] + mov al,2 + xor edx,edx + call lseek + push eax + xor edx,edx + cmp byte [esi],':' + jne position_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + sub [esp],edx + jc value_out_of_range + position_ok: + cmp byte [esi],',' + jne size_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx edx + call get_count_value + pop edx ebx + cmp eax,[esp] + ja value_out_of_range + mov [esp],eax + size_ok: + xor al,al + call lseek + pop ecx + mov edx,edi + add edi,ecx + jc out_of_memory + cmp edi,[tagged_blocks] + ja out_of_memory + call read + jc error_reading_file + call close + lods byte [esi] + cmp al,',' + je data_file + dec esi + jmp instruction_assembled + open_binary_file: + push esi + push edi + mov eax,[current_line] + find_current_source_path: + mov esi,[eax] + test byte [eax+7],80h + jz get_current_path + mov eax,[eax+8] + jmp find_current_source_path + get_current_path: + lodsb + stosb + or al,al + jnz get_current_path + cut_current_path: + cmp edi,[esp] + je current_path_ok + cmp byte [edi-1],'\' + je current_path_ok + cmp byte [edi-1],'/' + je current_path_ok + dec edi + jmp cut_current_path + current_path_ok: + mov esi,[esp+4] + call expand_path + pop edx + mov esi,edx + call open + jnc file_opened + mov edx,[include_paths] + search_in_include_paths: + push edx esi + mov edi,esi + mov esi,[esp+4] + call get_include_directory + mov [esp+4],esi + mov esi,[esp+8] + call expand_path + pop edx + mov esi,edx + call open + pop edx + jnc file_opened + cmp byte [edx],0 + jne search_in_include_paths + mov edi,esi + mov esi,[esp] + push edi + call expand_path + pop edx + mov esi,edx + call open + jc file_not_found + file_opened: + mov edi,esi + pop esi + ret +reserve_bytes: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_bytes + add edi,ecx + jmp reserved_data + zero_bytes: + xor eax,eax + shr ecx,1 + jnc bytes_stosb_ok + stos byte [edi] + bytes_stosb_ok: + shr ecx,1 + jnc bytes_stosw_ok + stos word [edi] + bytes_stosw_ok: + rep stos dword [edi] + reserved_data: + pop eax + call undefined_data + jmp instruction_assembled +reserve_words: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data + zero_words: + xor eax,eax + shr ecx,1 + jnc words_stosw_ok + stos word [edi] + words_stosw_ok: + rep stos dword [edi] + jmp reserved_data +reserve_dwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data + zero_dwords: + xor eax,eax + rep stos dword [edi] + jmp reserved_data +reserve_pwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +reserve_qwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data +reserve_twords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,2 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +align_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,eax + dec edx + test eax,edx + jnz invalid_align_value + or eax,eax + jz invalid_align_value + cmp eax,1 + je instruction_assembled + mov ecx,edi + mov ebp,[addressing_space] + sub ecx,[ds:ebp] + cmp dword [ds:ebp+10h],0 + jne section_not_aligned_enough + cmp byte [ds:ebp+9],0 + je make_alignment + cmp [output_format],3 + je pe_alignment + mov ebx,[ds:ebp+14h] + cmp byte [ebx],0 + jne section_not_aligned_enough + cmp eax,[ebx+10h] + jbe make_alignment + jmp section_not_aligned_enough + pe_alignment: + cmp eax,1000h + ja section_not_aligned_enough + make_alignment: + dec eax + and ecx,eax + jz instruction_assembled + neg ecx + add ecx,eax + inc ecx + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je nops + add edi,ecx + jmp reserved_data + invalid_align_value: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + jmp instruction_assembled + nops: + mov eax,90909090h + shr ecx,1 + jnc nops_stosb_ok + stos byte [edi] + nops_stosb_ok: + shr ecx,1 + jnc nops_stosw_ok + stos word [edi] + nops_stosw_ok: + rep stos dword [edi] + jmp reserved_data +err_directive: + mov al,[esi] + cmp al,0Fh + je invoked_error + or al,al + jz invoked_error + jmp extra_characters_on_line +assert_directive: + call calculate_logical_expression + or al,al + jnz instruction_assembled + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],assertion_failed + jmp instruction_assembled diff --git a/fasmw172/SOURCE/AVX.INC b/fasmw172/SOURCE/AVX.INC new file mode 100644 index 0000000..9bd1f1a --- /dev/null +++ b/fasmw172/SOURCE/AVX.INC @@ -0,0 +1,3370 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +avx_single_source_pd_instruction_er_evex: + or [vex_required],8 +avx_single_source_pd_instruction_er: + or [operand_flags],2+4+8 + jmp avx_pd_instruction +avx_single_source_pd_instruction_sae_evex: + or [vex_required],8 + or [operand_flags],2+4 + jmp avx_pd_instruction +avx_pd_instruction_imm8: + mov [immediate_size],1 + jmp avx_pd_instruction +avx_pd_instruction_er: + or [operand_flags],8 +avx_pd_instruction_sae: + or [operand_flags],4 +avx_pd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h + mov cx,0800h + jmp avx_instruction_with_broadcast +avx_pd_instruction_38_evex: + or [vex_required],8 + mov [supplemental_code],al + mov al,38h + jmp avx_pd_instruction +avx_cvtps2dq_instruction: + mov [opcode_prefix],66h + jmp avx_single_source_ps_instruction_er +avx_cvtudq2ps_instruction: + mov [opcode_prefix],0F2h +avx_single_source_ps_instruction_er_evex: + or [vex_required],8 +avx_single_source_ps_instruction_er: + or [operand_flags],2+4+8 + jmp avx_ps_instruction +avx_single_source_ps_instruction_noevex: + or [operand_flags],2 + or [vex_required],2 + jmp avx_ps_instruction +avx_ps_instruction_imm8: + mov [immediate_size],1 + jmp avx_ps_instruction +avx_ps_instruction_er: + or [operand_flags],8 +avx_ps_instruction_sae: + or [operand_flags],4 +avx_ps_instruction: + mov cx,0400h + jmp avx_instruction_with_broadcast +avx_ps_instruction_66_38_evex: + or [vex_required],8 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_ps_instruction +avx_sd_instruction_er: + or [operand_flags],8 +avx_sd_instruction_sae: + or [operand_flags],4 +avx_sd_instruction: + mov [opcode_prefix],0F2h + or [rex_prefix],80h + mov cl,8 + jmp avx_instruction +avx_ss_instruction_er: + or [operand_flags],8 +avx_ss_instruction_sae: + or [operand_flags],4 +avx_ss_instruction: + mov [opcode_prefix],0F3h + mov cl,4 + jmp avx_instruction +avx_ss_instruction_noevex: + or [vex_required],2 + jmp avx_ss_instruction +avx_single_source_q_instruction_38_evex: + or [operand_flags],2 +avx_q_instruction_38_evex: + or [vex_required],8 +avx_q_instruction_38: + mov [supplemental_code],al + mov al,38h + jmp avx_q_instruction +avx_q_instruction_38_w1_evex: + or [vex_required],8 +avx_q_instruction_38_w1: + or [rex_prefix],8 + jmp avx_q_instruction_38 +avx_q_instruction_3a_imm8_evex: + mov [immediate_size],1 + or [vex_required],8 + mov [supplemental_code],al + mov al,3Ah + jmp avx_q_instruction +avx_q_instruction_evex: + or [vex_required],8 +avx_q_instruction: + or [rex_prefix],80h + mov ch,8 + jmp avx_pi_instruction +avx_single_source_d_instruction_38_evex: + or [vex_required],8 +avx_single_source_d_instruction_38: + or [operand_flags],2 + jmp avx_d_instruction_38 +avx_d_instruction_38_evex: + or [vex_required],8 +avx_d_instruction_38: + mov [supplemental_code],al + mov al,38h + jmp avx_d_instruction +avx_d_instruction_3a_imm8_evex: + mov [immediate_size],1 + or [vex_required],8 + mov [supplemental_code],al + mov al,3Ah + jmp avx_d_instruction +avx_single_source_d_instruction_imm8: + or [operand_flags],2 + mov [immediate_size],1 + jmp avx_d_instruction +avx_d_instruction_evex: + or [vex_required],8 +avx_d_instruction: + mov ch,4 + jmp avx_pi_instruction +avx_single_source_bw_instruction_38: + or [operand_flags],2 +avx_bw_instruction_38: + mov [supplemental_code],al + mov al,38h +avx_bw_instruction: + xor ch,ch + avx_pi_instruction: + mov [opcode_prefix],66h + xor cl,cl + jmp avx_instruction_with_broadcast +avx_bw_instruction_38_w1_evex: + or [rex_prefix],8 +avx_bw_instruction_38_evex: + or [vex_required],8 + jmp avx_bw_instruction_38 +avx_pd_instruction_noevex: + xor cl,cl + or [vex_required],2 + mov [opcode_prefix],66h + jmp avx_instruction +avx_ps_instruction_noevex: + or [vex_required],2 + mov [opcode_prefix],0F2h + xor cl,cl + jmp avx_instruction +avx_instruction: + xor ch,ch + avx_instruction_with_broadcast: + mov [mmx_size],cl + mov [broadcast_size],ch + mov [base_code],0Fh + mov [extended_code],al + avx_xop_common: + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + avx_reg: + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + call take_avx512_mask + avx_vex_reg: + test [operand_flags],2 + jnz avx_vex_reg_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + avx_vex_reg_ok: + mov al,[mmx_size] + or al,al + jz avx_regs_size_ok + mov ah,[operand_size] + or ah,ah + jz avx_regs_size_ok + cmp al,ah + je avx_regs_size_ok + ja invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_regs_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + avx_regs_rm: + call take_avx_rm + jc avx_regs_reg + mov al,[immediate_size] + cmp al,1 + je mmx_imm8 + jb instruction_ready + cmp al,-4 + je sse_cmp_mem_ok + cmp byte [esi],',' + jne invalid_operand + inc esi + call take_avx_register + shl al,4 + jc invalid_operand + or byte [value],al + test al,80h + jz avx_regs_mem_reg_store + cmp [code_type],64 + jne invalid_operand + avx_regs_mem_reg_store: + call take_imm4_if_needed + call store_instruction_with_imm8 + jmp instruction_assembled + avx_regs_reg: + mov bl,al + call take_avx512_rounding + mov al,[immediate_size] + cmp al,1 + je mmx_nomem_imm8 + jb nomem_instruction_ready + cmp al,-4 + je sse_cmp_nomem_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,bl + shl al,4 + jc invalid_operand + or byte [value],al + test al,80h + jz avx_regs_reg_ + cmp [code_type],64 + jne invalid_operand + avx_regs_reg_: + call take_avx_rm + jc avx_regs_reg_reg + cmp [immediate_size],-2 + jg invalid_operand + or [rex_prefix],8 + call take_imm4_if_needed + call store_instruction_with_imm8 + jmp instruction_assembled + avx_regs_reg_reg: + shl al,4 + jc invalid_operand + and byte [value],1111b + or byte [value],al + call take_imm4_if_needed + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + take_avx_rm: + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,'[' + je take_avx_mem + cmp al,10h + jne invalid_operand + mov [operand_size],cl + lods byte [esi] + call convert_avx_register + or cl,cl + jnz avx_reg_ok + or cl,[mmx_size] + jz avx_reg_ok + cmp ah,cl + je avx_reg_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_reg_ok: + stc + ret + take_avx_mem: + push ecx + call get_address + cmp byte [esi],'{' + jne avx_mem_ok + inc esi + lods byte [esi] + cmp al,1Fh + jne invalid_operand + mov al,[esi] + shr al,4 + cmp al,1 + jne invalid_operand + mov al,[mmx_size] + or al,al + jnz avx_mem_broadcast_check + mov eax,[esp] + or al,al + jnz avx_mem_broadcast_check + mov al,[broadcast_size] + mov [mmx_size],al + mov ah,cl + lods byte [esi] + and al,1111b + mov cl,al + mov al,[broadcast_size] + shl al,cl + mov [esp],al + mov cl,ah + jmp avx_mem_broadcast_ok + avx_mem_broadcast_check: + bsf eax,eax + xchg al,[broadcast_size] + mov [mmx_size],al + bsf eax,eax + jz invalid_operand + mov ah,[broadcast_size] + sub ah,al + lods byte [esi] + and al,1111b + cmp al,ah + jne invalid_operand_size + avx_mem_broadcast_ok: + or [vex_required],40h + lods byte [esi] + cmp al,'}' + jne invalid_operand + avx_mem_ok: + pop eax + or al,al + jz avx_mem_size_deciding + xchg al,[operand_size] + cmp [mmx_size],0 + jne avx_mem_size_enforced + or al,al + jz avx_mem_size_ok + cmp al,[operand_size] + jne operand_sizes_do_not_match + avx_mem_size_ok: + clc + ret + avx_mem_size_deciding: + mov al,[operand_size] + cmp [mmx_size],0 + jne avx_mem_size_enforced + cmp al,16 + je avx_mem_size_ok + cmp al,32 + je avx_mem_size_ok + cmp al,64 + je avx_mem_size_ok + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + avx_mem_size_enforced: + or al,al + jz avx_mem_size_ok + cmp al,[mmx_size] + je avx_mem_size_ok + jmp invalid_operand_size + take_imm4_if_needed: + cmp [immediate_size],-3 + jne imm4_ok + push ebx ecx edx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,'(' + jne invalid_operand + call get_byte_value + test al,11110000b + jnz value_out_of_range + or byte [value],al + pop edx ecx ebx + imm4_ok: + ret + take_avx512_mask: + cmp byte [esi],'{' + jne avx512_masking_ok + test [operand_flags],10h + jnz invalid_operand + inc esi + lods byte [esi] + cmp al,14h + jne invalid_operand + lods byte [esi] + mov ah,al + shr ah,4 + cmp ah,5 + jne invalid_operand + or al,al + jz invalid_operand + and al,111b + mov [mask_register],al + or [vex_required],20h + lods byte [esi] + cmp al,'}' + jne invalid_operand + cmp byte [esi],'{' + jne avx512_masking_ok + test [operand_flags],20h + jnz invalid_operand + inc esi + lods byte [esi] + cmp al,1Fh + jne invalid_operand + lods byte [esi] + or al,al + jnz invalid_operand + or [mask_register],80h + lods byte [esi] + cmp al,'}' + jne invalid_operand + avx512_masking_ok: + retn + take_avx512_rounding: + test [operand_flags],4+8 + jz avx512_rounding_done + cmp [mmx_size],0 + jne avx512_rounding_allowed + cmp [operand_size],64 + jne avx512_rounding_done + avx512_rounding_allowed: + cmp byte [esi],',' + jne avx512_rounding_done + cmp byte [esi+1],'{' + jne avx512_rounding_done + add esi,2 + mov [rounding_mode],0 + or [vex_required],40h+80h + test [operand_flags],8 + jz take_sae + lods byte [esi] + cmp al,1Fh + jne invalid_operand + lods byte [esi] + mov ah,al + shr ah,4 + cmp ah,2 + jne invalid_operand + and al,11b + mov [rounding_mode],al + lods byte [esi] + cmp al,'-' + jne invalid_operand + take_sae: + lods byte [esi] + cmp al,1Fh + jne invalid_operand + lods byte [esi] + cmp al,30h + jne invalid_operand + lods byte [esi] + cmp al,'}' + jne invalid_operand + avx512_rounding_done: + retn + +avx_movdqu_instruction: + mov ah,0F3h + jmp avx_movdq_instruction +avx_movdqa_instruction: + mov ah,66h + avx_movdq_instruction: + mov [opcode_prefix],ah + or [vex_required],2 + jmp avx_movps_instruction +avx512_movdqu16_instruction: + or [rex_prefix],8 +avx512_movdqu8_instruction: + mov ah,0F2h + jmp avx_movdq_instruction_evex +avx512_movdqu64_instruction: + or [rex_prefix],8 +avx512_movdqu32_instruction: + mov ah,0F3h + jmp avx_movdq_instruction_evex +avx512_movdqa64_instruction: + or [rex_prefix],8 +avx512_movdqa32_instruction: + mov ah,66h + avx_movdq_instruction_evex: + mov [opcode_prefix],ah + or [vex_required],8 + jmp avx_movps_instruction +avx_movpd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h +avx_movps_instruction: + or [operand_flags],2 + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + xor al,al + mov [mmx_size],al + mov [broadcast_size],al + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_reg + inc [extended_code] + test [extended_code],1 + jnz avx_mem + add [extended_code],-1+10h + avx_mem: + cmp al,'[' + jne invalid_operand + call get_address + or [operand_flags],20h + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + jmp instruction_ready +avx_movntpd_instruction: + or [rex_prefix],80h +avx_movntdq_instruction: + mov [opcode_prefix],66h +avx_movntps_instruction: + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + or [operand_flags],10h + mov [mmx_size],0 + lods byte [esi] + call get_size_operator + jmp avx_mem +avx_compress_q_instruction: + or [rex_prefix],8 +avx_compress_d_instruction: + or [vex_required],8 + mov [mmx_size],0 + call setup_66_0f_38 + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_mem + lods byte [esi] + call convert_avx_register + mov bl,al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + jmp nomem_instruction_ready +avx_lddqu_instruction: + mov ah,0F2h + or [vex_required],2 + avx_load_instruction: + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],0 + or [vex_required],1 + call take_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready +avx_movntdqa_instruction: + mov [supplemental_code],al + mov al,38h + mov ah,66h + jmp avx_load_instruction +avx_movq_instruction: + or [rex_prefix],8 + mov [mmx_size],8 + jmp avx_mov_instruction +avx_movd_instruction: + mov [mmx_size],4 + avx_mov_instruction: + or [vex_required],1 + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],7Eh + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_movd_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + not al + and [operand_size],al + jnz invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + cmp [mmx_size],8 + jne instruction_ready + and [rex_prefix],not 8 + or [rex_prefix],80h + mov [extended_code],0D6h + jmp instruction_ready + avx_movd_reg: + lods byte [esi] + cmp al,0C0h + jae avx_movd_xmmreg + call convert_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [operand_size],0 + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + avx_movd_reg_ready: + test [rex_prefix],8 + jz nomem_instruction_ready + cmp [code_type],64 + jne illegal_instruction + jmp nomem_instruction_ready + avx_movd_xmmreg: + sub [extended_code],10h + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_movd_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + cmp al,8 + jne avx_movd_xmmreg_mem_ready + call avx_movq_xmmreg_xmmreg_opcode + avx_movd_xmmreg_mem_ready: + not al + test [operand_size],al + jnz invalid_operand_size + jmp instruction_ready + avx_movd_xmmreg_reg: + lods byte [esi] + cmp al,0C0h + jae avx_movq_xmmreg_xmmreg + call convert_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + jmp avx_movd_reg_ready + avx_movq_xmmreg_xmmreg: + cmp [mmx_size],8 + jne invalid_operand + call avx_movq_xmmreg_xmmreg_opcode + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready + avx_movq_xmmreg_xmmreg_opcode: + and [rex_prefix],not 8 + or [rex_prefix],80h + add [extended_code],10h + mov [opcode_prefix],0F3h + ret +avx_movddup_instruction: + or [vex_required],1 + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],al + or [rex_prefix],80h + xor al,al + mov [mmx_size],al + mov [broadcast_size],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + cmp ah,16 + ja avx_movddup_size_ok + mov [mmx_size],8 + avx_movddup_size_ok: + call take_avx512_mask + jmp avx_vex_reg_ok +avx_movlpd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h +avx_movlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],8 + mov [broadcast_size],0 + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_movlps_mem + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + cmp [operand_size],16 + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_rm + jc invalid_operand + jmp instruction_ready + avx_movlps_mem: + cmp al,'[' + jne invalid_operand + call get_address + avx_movlps_mem_: + mov al,[operand_size] + or al,al + jz avx_movlps_mem_size_ok + cmp al,[mmx_size] + jne invalid_operand_size + mov [operand_size],0 + avx_movlps_mem_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + inc [extended_code] + jmp instruction_ready +avx_movhlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready +avx_movsd_instruction: + mov al,0F2h + mov cl,8 + or [rex_prefix],80h + jmp avx_movs_instruction +avx_movss_instruction: + mov al,0F3h + mov cl,4 + avx_movs_instruction: + mov [opcode_prefix],al + mov [mmx_size],cl + or [vex_required],1 + mov [base_code],0Fh + mov [extended_code],10h + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_movs_mem + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + call take_avx512_mask + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_movs_reg_mem + mov [operand_size],cl + lods byte [esi] + call convert_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + cmp bl,8 + jb nomem_instruction_ready + inc [extended_code] + xchg bl,[postbyte_register] + jmp nomem_instruction_ready + avx_movs_reg_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz avx_movs_reg_mem_ok + cmp al,[mmx_size] + jne invalid_operand_size + avx_movs_reg_mem_ok: + jmp instruction_ready + avx_movs_mem: + cmp al,'[' + jne invalid_operand + call get_address + or [operand_flags],20h + call take_avx512_mask + jmp avx_movlps_mem_ + +avx_comiss_instruction: + or [operand_flags],2+4+10h + mov cl,4 + jmp avx_instruction +avx_comisd_instruction: + or [operand_flags],2+4+10h + mov [opcode_prefix],66h + or [rex_prefix],80h + mov cl,8 + jmp avx_instruction +avx_movshdup_instruction: + or [operand_flags],2 + mov [opcode_prefix],0F3h + xor cl,cl + jmp avx_instruction +avx_cvtqq2pd_instruction: + mov [opcode_prefix],0F3h + or [vex_required],8 + or [operand_flags],2+4+8 + or [rex_prefix],8 + mov cx,0800h + jmp avx_instruction_with_broadcast +avx_pshuf_w_instruction: + mov [opcode_prefix],al + or [operand_flags],2 + mov [immediate_size],1 + mov al,70h + xor cl,cl + jmp avx_instruction +avx_single_source_128bit_instruction_38_noevex: + or [operand_flags],2 +avx_128bit_instruction_38_noevex: + mov cl,16 + jmp avx_instruction_38_noevex +avx_single_source_instruction_38_noevex: + or [operand_flags],2 + jmp avx_pi_instruction_38_noevex +avx_pi_instruction_38_noevex: + xor cl,cl + avx_instruction_38_noevex: + or [vex_required],2 + avx_instruction_38: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_instruction +avx_ss_instruction_3a_imm8_noevex: + mov cl,4 + jmp avx_instruction_3a_imm8_noevex +avx_sd_instruction_3a_imm8_noevex: + mov cl,8 + jmp avx_instruction_3a_imm8_noevex +avx_single_source_128bit_instruction_3a_imm8_noevex: + or [operand_flags],2 +avx_128bit_instruction_3a_imm8_noevex: + mov cl,16 + jmp avx_instruction_3a_imm8_noevex +avx_triple_source_instruction_3a_noevex: + xor cl,cl + mov [immediate_size],-1 + mov byte [value],0 + jmp avx_instruction_3a_noevex +avx_single_source_instruction_3a_imm8_noevex: + or [operand_flags],2 +avx_pi_instruction_3a_imm8_noevex: + xor cl,cl + avx_instruction_3a_imm8_noevex: + mov [immediate_size],1 + avx_instruction_3a_noevex: + or [vex_required],2 + avx_instruction_3a: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + jmp avx_instruction +avx_pi_instruction_3a_imm8: + xor cl,cl + mov [immediate_size],1 + jmp avx_instruction_3a +avx_pclmulqdq_instruction: + mov byte [value],al + mov [immediate_size],-4 + or [vex_required],2 + mov cl,16 + mov al,44h + jmp avx_instruction_3a + +avx512_single_source_pd_instruction_sae_imm8: + or [operand_flags],2 +avx512_pd_instruction_sae_imm8: + or [rex_prefix],8 + mov cx,0800h + jmp avx512_instruction_sae_imm8 +avx512_single_source_ps_instruction_sae_imm8: + or [operand_flags],2 +avx512_ps_instruction_sae_imm8: + mov cx,0400h + jmp avx512_instruction_sae_imm8 +avx512_sd_instruction_sae_imm8: + or [rex_prefix],8 + mov cx,0008h + jmp avx512_instruction_sae_imm8 +avx512_ss_instruction_sae_imm8: + mov cx,0004h + avx512_instruction_sae_imm8: + or [operand_flags],4 + avx512_instruction_imm8: + or [vex_required],8 + mov [opcode_prefix],66h + mov [immediate_size],1 + mov [supplemental_code],al + mov al,3Ah + jmp avx_instruction_with_broadcast +avx512_pd_instruction_er: + or [operand_flags],4+8 + jmp avx512_pd_instruction +avx512_single_source_pd_instruction_sae: + or [operand_flags],4 +avx512_single_source_pd_instruction: + or [operand_flags],2 +avx512_pd_instruction: + or [rex_prefix],8 + mov cx,0800h + jmp avx512_instruction +avx512_ps_instruction_er: + or [operand_flags],4+8 + jmp avx512_ps_instruction +avx512_single_source_ps_instruction_sae: + or [operand_flags],4 +avx512_single_source_ps_instruction: + or [operand_flags],2 +avx512_ps_instruction: + mov cx,0400h + jmp avx512_instruction +avx512_sd_instruction_er: + or [operand_flags],8 +avx512_sd_instruction_sae: + or [operand_flags],4 +avx512_sd_instruction: + or [rex_prefix],8 + mov cx,0008h + jmp avx512_instruction +avx512_ss_instruction_er: + or [operand_flags],8 +avx512_ss_instruction_sae: + or [operand_flags],4 +avx512_ss_instruction: + mov cx,0004h + avx512_instruction: + or [vex_required],8 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_instruction_with_broadcast +avx512_exp2pd_instruction: + or [rex_prefix],8 + or [operand_flags],2+4 + mov cx,0840h + jmp avx512_instruction +avx512_exp2ps_instruction: + or [operand_flags],2+4 + mov cx,0440h + jmp avx512_instruction + +fma_instruction_pd: + or [rex_prefix],8 + mov cx,0800h + jmp fma_instruction +fma_instruction_ps: + mov cx,0400h + jmp fma_instruction +fma_instruction_sd: + or [rex_prefix],8 + mov cx,0008h + jmp fma_instruction +fma_instruction_ss: + mov cx,0004h + fma_instruction: + or [operand_flags],4+8 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp avx_instruction_with_broadcast + +fma4_instruction_p: + xor cl,cl + jmp fma4_instruction +fma4_instruction_sd: + mov cl,8 + jmp fma4_instruction +fma4_instruction_ss: + mov cl,4 + fma4_instruction: + mov [immediate_size],-2 + mov byte [value],0 + jmp avx_instruction_3a_noevex + +avx_cmp_pd_instruction: + mov [opcode_prefix],66h + or [rex_prefix],80h + mov cx,0800h + jmp avx_cmp_instruction +avx_cmp_ps_instruction: + mov cx,0400h + jmp avx_cmp_instruction +avx_cmp_sd_instruction: + mov [opcode_prefix],0F2h + or [rex_prefix],80h + mov cx,0008h + jmp avx_cmp_instruction +avx_cmp_ss_instruction: + mov [opcode_prefix],0F3h + mov cx,0004h + avx_cmp_instruction: + mov byte [value],al + mov [immediate_size],-4 + or [operand_flags],4+20h + mov al,0C2h + jmp avx_cmp_common +avx_cmpeqq_instruction: + or [rex_prefix],80h + mov ch,8 + mov [supplemental_code],al + mov al,38h + jmp avx_cmp_pi_instruction +avx_cmpeqd_instruction: + mov ch,4 + jmp avx_cmp_pi_instruction +avx_cmpeqb_instruction: + xor ch,ch + jmp avx_cmp_pi_instruction +avx512_cmp_uq_instruction: + or [rex_prefix],8 + mov ch,8 + mov ah,1Eh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_ud_instruction: + mov ch,4 + mov ah,1Eh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_q_instruction: + or [rex_prefix],8 + mov ch,8 + mov ah,1Fh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_d_instruction: + mov ch,4 + mov ah,1Fh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_uw_instruction: + or [rex_prefix],8 +avx512_cmp_ub_instruction: + xor ch,ch + mov ah,3Eh + jmp avx_cmp_pi_instruction_evex +avx512_cmp_w_instruction: + or [rex_prefix],8 +avx512_cmp_b_instruction: + xor ch,ch + mov ah,3Fh + avx_cmp_pi_instruction_evex: + mov byte [value],al + mov [immediate_size],-4 + mov [supplemental_code],ah + mov al,3Ah + or [vex_required],8 + avx_cmp_pi_instruction: + xor cl,cl + or [operand_flags],20h + mov [opcode_prefix],66h + avx_cmp_common: + mov [mmx_size],cl + mov [broadcast_size],ch + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,14h + je avx_maskreg + cmp al,10h + jne invalid_operand + or [vex_required],2 + jmp avx_reg + avx_maskreg: + cmp [operand_size],0 + jne invalid_operand_size + or [vex_required],8 + lods byte [esi] + call convert_mask_register + mov [postbyte_register],al + call take_avx512_mask + jmp avx_vex_reg +avx512_fpclasspd_instruction: + or [rex_prefix],8 + mov cx,0800h + jmp avx_fpclass_instruction +avx512_fpclassps_instruction: + mov cx,0400h + jmp avx_fpclass_instruction +avx512_fpclasssd_instruction: + or [rex_prefix],8 + mov cx,0008h + jmp avx_fpclass_instruction +avx512_fpclassss_instruction: + mov cx,0004h + avx_fpclass_instruction: + mov [broadcast_size],ch + mov [mmx_size],cl + or [operand_flags],2 + call setup_66_0f_3a + mov [immediate_size],1 + lods byte [esi] + cmp al,14h + je avx_maskreg + jmp invalid_operand +avx512_ptestnmd_instruction: + mov ch,4 + jmp avx512_ptestnm_instruction +avx512_ptestnmq_instruction: + or [rex_prefix],8 + mov ch,8 + jmp avx512_ptestnm_instruction +avx512_ptestnmw_instruction: + or [rex_prefix],8 +avx512_ptestnmb_instruction: + xor ch,ch + avx512_ptestnm_instruction: + mov ah,0F3h + jmp avx512_ptest_instruction +avx512_ptestmd_instruction: + mov ch,4 + jmp avx512_ptestm_instruction +avx512_ptestmq_instruction: + or [rex_prefix],8 + mov ch,8 + jmp avx512_ptestm_instruction +avx512_ptestmw_instruction: + or [rex_prefix],8 +avx512_ptestmb_instruction: + xor ch,ch + avx512_ptestm_instruction: + mov ah,66h + avx512_ptest_instruction: + xor cl,cl + mov [opcode_prefix],ah + mov [supplemental_code],al + mov al,38h + or [vex_required],8 + jmp avx_cmp_common + +mask_shift_instruction_q: + or [rex_prefix],8 +mask_shift_instruction_d: + or [operand_flags],2 + or [immediate_size],1 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + jmp mask_instruction +mask_instruction_single_source_b: + mov [opcode_prefix],66h + jmp mask_instruction_single_source_w +mask_instruction_single_source_d: + mov [opcode_prefix],66h +mask_instruction_single_source_q: + or [rex_prefix],8 +mask_instruction_single_source_w: + or [operand_flags],2 + jmp mask_instruction +mask_instruction_b: + mov [opcode_prefix],66h + jmp mask_instruction_w +mask_instruction_d: + mov [opcode_prefix],66h +mask_instruction_q: + or [rex_prefix],8 +mask_instruction_w: + mov [operand_size],32 +mask_instruction: + or [vex_required],1 + mov [base_code],0Fh + mov [extended_code],al + call take_mask_register + mov [postbyte_register],al + test [operand_flags],2 + jnz mask_instruction_nds_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov [vex_register],al + mask_instruction_nds_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov bl,al + cmp [immediate_size],0 + jne mmx_nomem_imm8 + jmp nomem_instruction_ready +take_mask_register: + lods byte [esi] + cmp al,14h + jne invalid_operand + lods byte [esi] +convert_mask_register: + mov ah,al + shr ah,4 + cmp ah,5 + jne invalid_operand + and al,1111b + ret +kmov_instruction: + mov [mmx_size],al + or [vex_required],1 + mov [base_code],0Fh + mov [extended_code],90h + lods byte [esi] + cmp al,14h + je kmov_maskreg + cmp al,10h + je kmov_reg + call get_size_operator + inc [extended_code] + cmp al,'[' + jne invalid_argument + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov [postbyte_register],al + kmov_with_mem: + mov ah,[mmx_size] + mov al,[operand_size] + or al,al + jz kmov_mem_size_ok + cmp al,ah + jne invalid_operand_size + kmov_mem_size_ok: + call setup_kmov_prefix + jmp instruction_ready + setup_kmov_prefix: + cmp ah,4 + jb kmov_w_ok + or [rex_prefix],8 + kmov_w_ok: + test ah,1 or 4 + jz kmov_prefix_ok + mov [opcode_prefix],66h + kmov_prefix_ok: + ret + kmov_maskreg: + lods byte [esi] + call convert_mask_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,14h + je kmov_maskreg_maskreg + cmp al,10h + je kmov_maskreg_reg + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + jmp kmov_with_mem + kmov_maskreg_maskreg: + lods byte [esi] + call convert_mask_register + mov bl,al + mov ah,[mmx_size] + call setup_kmov_prefix + jmp nomem_instruction_ready + kmov_maskreg_reg: + add [extended_code],2 + lods byte [esi] + call convert_register + kmov_with_reg: + mov bl,al + mov al,[mmx_size] + mov ah,4 + cmp al,ah + jbe kmov_reg_size_check + mov ah,al + kmov_reg_size_check: + cmp ah,[operand_size] + jne invalid_operand_size + cmp al,8 + je kmov_f2_w1 + cmp al,2 + ja kmov_f2 + je nomem_instruction_ready + mov [opcode_prefix],66h + jmp nomem_instruction_ready + kmov_f2_w1: + or [rex_prefix],8 + cmp [code_type],64 + jne illegal_instruction + kmov_f2: + mov [opcode_prefix],0F2h + jmp nomem_instruction_ready + kmov_reg: + add [extended_code],3 + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + jmp kmov_with_reg +avx512_pmov_m2_instruction_w1: + or [rex_prefix],8 +avx512_pmov_m2_instruction: + or [vex_required],8 + call setup_f3_0f_38 + call take_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_mask_register + mov bl,al + jmp nomem_instruction_ready +avx512_pmov_2m_instruction_w1: + or [rex_prefix],8 +avx512_pmov_2m_instruction: + or [vex_required],8 + call setup_f3_0f_38 + call take_mask_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready + setup_f3_0f_38: + mov [extended_code],38h + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],0F3h + ret + +vzeroall_instruction: + mov [operand_size],32 +vzeroupper_instruction: + mov [base_code],0Fh + mov [extended_code],al + and [displacement_compression],0 + call store_vex_instruction_code + jmp instruction_assembled +vldmxcsr_instruction: + or [vex_required],2 + jmp fxsave_instruction + +avx_perm2f128_instruction: + or [vex_required],2 + xor ch,ch + avx_instruction_imm8_without_128bit: + mov [immediate_size],1 + mov ah,3Ah + jmp avx_instruction_without_128bit +avx512_shuf_q_instruction: + or [rex_prefix],8 + or [vex_required],8 + mov ch,8 + jmp avx_instruction_imm8_without_128bit +avx512_shuf_d_instruction: + or [vex_required],8 + mov ch,4 + jmp avx_instruction_imm8_without_128bit +avx_permd_instruction: + mov ah,38h + mov ch,4 + avx_instruction_without_128bit: + xor cl,cl + call setup_avx_66_supplemental + call take_avx_register + cmp ah,32 + jb invalid_operand_size + mov [postbyte_register],al + call take_avx512_mask + jmp avx_vex_reg + setup_avx_66_supplemental: + mov [opcode_prefix],66h + mov [broadcast_size],ch + mov [mmx_size],cl + mov [base_code],0Fh + mov [extended_code],ah + mov [supplemental_code],al + or [vex_required],1 + ret +avx_permq_instruction: + or [rex_prefix],8 + mov ch,8 + jmp avx_permil_instruction +avx_permilpd_instruction: + or [rex_prefix],80h + mov ch,8 + jmp avx_permil_instruction +avx_permilps_instruction: + mov ch,4 + avx_permil_instruction: + or [operand_flags],2 + xor cl,cl + mov ah,3Ah + call setup_avx_66_supplemental + call take_avx_register + cmp [supplemental_code],4 + jae avx_permil_size_ok + cmp ah,32 + jb invalid_operand_size + avx_permil_size_ok: + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_rm + jnc mmx_imm8 + mov bl,al + cmp byte [esi],',' + jne invalid_operand + mov al,[esi+1] + cmp al,11h + jne avx_permil_rm_or_imm8 + mov al,[esi+3] + avx_permil_rm_or_imm8: + cmp al,'(' + je mmx_nomem_imm8 + mov [vex_register],bl + inc esi + mov [extended_code],38h + mov al,[supplemental_code] + cmp al,4 + jb avx_permq_rm + add [supplemental_code],8 + jmp avx_regs_rm + avx_permq_rm: + or [vex_required],8 + shl al,5 + neg al + add al,36h + mov [supplemental_code],al + jmp avx_regs_rm +vpermil_2pd_instruction: + mov [immediate_size],-2 + mov byte [value],al + mov al,49h + jmp vpermil2_instruction_setup +vpermil_2ps_instruction: + mov [immediate_size],-2 + mov byte [value],al + mov al,48h + jmp vpermil2_instruction_setup +vpermil2_instruction: + mov [immediate_size],-3 + mov byte [value],0 + vpermil2_instruction_setup: + or [vex_required],2 + mov [base_code],0Fh + mov [supplemental_code],al + mov al,3Ah + xor cl,cl + jmp avx_instruction + +avx_shift_q_instruction_evex: + or [vex_required],8 +avx_shift_q_instruction: + or [rex_prefix],80h + mov cl,8 + jmp avx_shift_instruction +avx_shift_d_instruction: + mov cl,4 + jmp avx_shift_instruction +avx_shift_bw_instruction: + xor cl,cl + avx_shift_instruction: + mov [broadcast_size],cl + mov [mmx_size],0 + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_shift_reg_mem + mov [operand_size],cl + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + push esi + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_shift_reg_reg_reg + pop esi + cmp al,'[' + je avx_shift_reg_reg_mem + xchg cl,[operand_size] + test cl,not 1 + jnz invalid_operand_size + dec esi + call convert_avx_shift_opcode + mov bl,al + jmp mmx_nomem_imm8 + convert_avx_shift_opcode: + mov al,[extended_code] + mov ah,al + and ah,1111b + add ah,70h + mov [extended_code],ah + shr al,4 + sub al,0Ch + shl al,1 + xchg al,[postbyte_register] + xchg al,[vex_register] + ret + avx_shift_reg_reg_reg: + pop eax + lods byte [esi] + call convert_xmm_register + xchg cl,[operand_size] + mov bl,al + jmp nomem_instruction_ready + avx_shift_reg_reg_mem: + mov [mmx_size],16 + push ecx + lods byte [esi] + call get_size_operator + call get_address + pop eax + xchg al,[operand_size] + test al,al + jz instruction_ready + cmp al,16 + jne invalid_operand_size + jmp instruction_ready + avx_shift_reg_mem: + or [vex_required],8 + call take_avx_mem + call convert_avx_shift_opcode + jmp mmx_imm8 +avx_shift_dq_instruction: + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],73h + or [vex_required],1 + mov [mmx_size],0 + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_shift_dq_reg_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + mov bl,al + jmp mmx_nomem_imm8 + avx_shift_dq_reg_mem: + or [vex_required],8 + call get_address + jmp mmx_imm8 +avx512_rotate_q_instruction: + mov cl,8 + or [rex_prefix],cl + jmp avx512_rotate_instruction +avx512_rotate_d_instruction: + mov cl,4 + avx512_rotate_instruction: + mov [broadcast_size],cl + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],72h + or [vex_required],8 + mov [mmx_size],0 + mov [immediate_size],1 + call take_avx_register + mov [vex_register],al + call take_avx512_mask + jmp avx_vex_reg_ok + +avx_pmovsxbq_instruction: + mov cl,2 + jmp avx_pmovsx_instruction +avx_pmovsxbd_instruction: + mov cl,4 + jmp avx_pmovsx_instruction +avx_pmovsxbw_instruction: + mov cl,8 + avx_pmovsx_instruction: + mov [mmx_size],cl + or [vex_required],1 + call setup_66_0f_38 + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + bsf ecx,eax + sub cl,4 + shl [mmx_size],cl + push eax + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_pmovsx_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + xchg al,[operand_size] + or al,al + jz instruction_ready + cmp al,[mmx_size] + jne invalid_operand_size + jmp instruction_ready + avx_pmovsx_reg_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + cmp ah,[mmx_size] + je avx_pmovsx_xmmreg_reg_size_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_pmovsx_xmmreg_reg_size_ok: + pop eax + mov [operand_size],al + jmp nomem_instruction_ready +avx512_pmovqb_instruction: + mov cl,2 + jmp avx512_pmov_instruction +avx512_pmovdb_instruction: + mov cl,4 + jmp avx512_pmov_instruction +avx512_pmovwb_instruction: + mov cl,8 + avx512_pmov_instruction: + mov [mmx_size],cl + or [vex_required],8 + mov [extended_code],38h + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],0F3h + lods byte [esi] + call get_size_operator + cmp al,10h + je avx512_pmov_reg + cmp al,'[' + jne invalid_operand + call get_address + or [operand_flags],20h + call avx512_pmov_common + or al,al + jz instruction_ready + cmp al,[mmx_size] + jne invalid_operand_size + jmp instruction_ready + avx512_pmov_common: + call take_avx512_mask + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + mov al,ah + mov ah,cl + bsf ecx,eax + sub cl,4 + shl [mmx_size],cl + mov cl,ah + pop eax + ret + avx512_pmov_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + call avx512_pmov_common + cmp al,[mmx_size] + je nomem_instruction_ready + jb invalid_operand_size + cmp al,16 + jne invalid_operand_size + jmp nomem_instruction_ready + +avx_broadcast_128_instruction_noevex: + or [vex_required],2 + mov cl,10h + jmp avx_broadcast_instruction +avx512_broadcast_32x2_instruction: + mov cl,08h + jmp avx_broadcast_instruction_evex +avx512_broadcast_32x4_instruction: + mov cl,10h + jmp avx_broadcast_instruction_evex +avx512_broadcast_32x8_instruction: + mov cl,20h + jmp avx_broadcast_instruction_evex +avx512_broadcast_64x2_instruction: + mov cl,10h + jmp avx_broadcast_instruction_w1_evex +avx512_broadcast_64x4_instruction: + mov cl,20h + avx_broadcast_instruction_w1_evex: + or [rex_prefix],8 + avx_broadcast_instruction_evex: + or [vex_required],8 + jmp avx_broadcast_instruction +avx_broadcastss_instruction: + mov cl,4 + jmp avx_broadcast_instruction +avx_broadcastsd_instruction: + or [rex_prefix],80h + mov cl,8 + jmp avx_broadcast_instruction +avx_pbroadcastb_instruction: + mov cl,1 + jmp avx_broadcast_pi_instruction +avx_pbroadcastw_instruction: + mov cl,2 + jmp avx_broadcast_pi_instruction +avx_pbroadcastd_instruction: + mov cl,4 + jmp avx_broadcast_pi_instruction +avx_pbroadcastq_instruction: + mov cl,8 + or [rex_prefix],80h + avx_broadcast_pi_instruction: + or [operand_flags],40h + avx_broadcast_instruction: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + mov [mmx_size],cl + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + cmp ah,[mmx_size] + je invalid_operand_size + test [operand_flags],40h + jnz avx_broadcast_destination_size_ok + cmp [mmx_size],4 + je avx_broadcast_destination_size_ok + cmp [supplemental_code],59h + je avx_broadcast_destination_size_ok + cmp ah,16 + je invalid_operand_size + avx_broadcast_destination_size_ok: + xor ah,ah + xchg ah,[operand_size] + push eax + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_broadcast_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + xchg ah,[operand_size] + mov [postbyte_register],al + mov al,[broadcast_size] + mov al,[mmx_size] + cmp al,ah + je instruction_ready + or al,al + jz instruction_ready + or ah,ah + jz instruction_ready + jmp invalid_operand_size + avx_broadcast_reg_reg: + lods byte [esi] + test [operand_flags],40h + jz avx_broadcast_reg_avx_reg + cmp al,60h + jb avx_broadcast_reg_general_reg + cmp al,80h + jb avx_broadcast_reg_avx_reg + cmp al,0C0h + jb avx_broadcast_reg_general_reg + avx_broadcast_reg_avx_reg: + call convert_avx_register + mov bl,al + mov al,[mmx_size] + or al,al + jz avx_broadcast_reg_avx_reg_size_ok + cmp ah,16 + jne invalid_operand_size + cmp al,ah + jae invalid_operand + avx_broadcast_reg_avx_reg_size_ok: + pop eax + xchg ah,[operand_size] + mov [postbyte_register],al + test [vex_required],2 + jnz invalid_operand + jmp nomem_instruction_ready + avx_broadcast_reg_general_reg: + call convert_register + mov bl,al + mov al,[mmx_size] + or al,al + jz avx_broadcast_reg_general_reg_size_ok + cmp al,ah + je avx_broadcast_reg_general_reg_size_ok + ja invalid_operand_size + cmp ah,4 + jne invalid_operand_size + avx_broadcast_reg_general_reg_size_ok: + cmp al,4 + jb avx_broadcast_reg_general_reg_ready + cmp al,8 + mov al,3 + jne avx_broadcast_reg_general_reg_ready + or [rex_prefix],8 + avx_broadcast_reg_general_reg_ready: + add al,7Ah-1 + mov [supplemental_code],al + or [vex_required],8 + pop eax + xchg ah,[operand_size] + mov [postbyte_register],al + jmp nomem_instruction_ready + +avx512_extract_64x4_instruction: + or [rex_prefix],8 +avx512_extract_32x8_instruction: + or [vex_required],8 + mov cl,32 + jmp avx_extractf_instruction +avx512_extract_64x2_instruction: + or [rex_prefix],8 +avx512_extract_32x4_instruction: + or [vex_required],8 + mov cl,16 + jmp avx_extractf_instruction +avx_extractf128_instruction: + or [vex_required],2 + mov cl,16 + avx_extractf_instruction: + mov [mmx_size],cl + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_extractf_reg + cmp al,'[' + jne invalid_operand + call get_address + xor al,al + xchg al,[operand_size] + or al,al + jz avx_extractf_mem_size_ok + cmp al,[mmx_size] + jne invalid_operand_size + avx_extractf_mem_size_ok: + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + cmp ah,[mmx_size] + jbe invalid_operand_size + mov [postbyte_register],al + jmp mmx_imm8 + avx_extractf_reg: + lods byte [esi] + call convert_avx_register + cmp ah,[mmx_size] + jne invalid_operand_size + push eax + call take_avx512_mask + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + cmp ah,[mmx_size] + jbe invalid_operand_size + mov [postbyte_register],al + pop ebx + jmp mmx_nomem_imm8 +avx512_insert_64x4_instruction: + or [rex_prefix],8 +avx512_insert_32x8_instruction: + or [vex_required],8 + mov cl,32 + jmp avx_insertf_instruction +avx512_insert_64x2_instruction: + or [rex_prefix],8 +avx512_insert_32x4_instruction: + or [vex_required],8 + mov cl,16 + jmp avx_insertf_instruction +avx_insertf128_instruction: + or [vex_required],2 + mov cl,16 + avx_insertf_instruction: + mov [mmx_size],cl + mov [broadcast_size],0 + call setup_66_0f_3a + call take_avx_register + cmp ah,[mmx_size] + jbe invalid_operand + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + mov al,[mmx_size] + xchg al,[operand_size] + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_insertf_reg_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov [operand_size],al + jmp mmx_imm8 + avx_insertf_reg_reg_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + pop eax + mov [operand_size],al + jmp mmx_nomem_imm8 +avx_extract_b_instruction: + mov cl,1 + jmp avx_extract_instruction +avx_extract_w_instruction: + mov cl,2 + jmp avx_extract_instruction +avx_extract_q_instruction: + or [rex_prefix],8 + mov cl,8 + jmp avx_extract_instruction +avx_extract_d_instruction: + mov cl,4 + avx_extract_instruction: + mov [mmx_size],cl + call setup_66_0f_3a + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + je avx_extractps_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + not al + and [operand_size],al + jnz invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + jmp mmx_imm8 + avx_extractps_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,[mmx_size] + cmp ah,al + jb invalid_operand_size + cmp ah,4 + je avx_extractps_reg_size_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + cmp al,4 + jae avx_extractps_reg_size_ok + or [rex_prefix],8 + avx_extractps_reg_size_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + cmp [supplemental_code],15h + jne mmx_nomem_imm8 + mov [extended_code],0C5h + xchg bl,[postbyte_register] + jmp mmx_nomem_imm8 +avx_insertps_instruction: + mov [immediate_size],1 + or [operand_flags],10h + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + mov cl,4 + jmp avx_instruction +avx_pinsrb_instruction: + mov cl,1 + jmp avx_pinsr_instruction_3a +avx_pinsrw_instruction: + mov cl,2 + jmp avx_pinsr_instruction +avx_pinsrd_instruction: + mov cl,4 + jmp avx_pinsr_instruction_3a +avx_pinsrq_instruction: + cmp [code_type],64 + jne illegal_instruction + mov cl,8 + or [rex_prefix],8 + avx_pinsr_instruction_3a: + mov [supplemental_code],al + mov al,3Ah + avx_pinsr_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],cl + or [vex_required],1 + call take_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + jmp pinsr_xmmreg + +avx_cvtudq2pd_instruction: + or [vex_required],8 +avx_cvtdq2pd_instruction: + mov [opcode_prefix],0F3h + mov cl,4 + jmp avx_cvt_d_instruction +avx_cvtps2qq_instruction: + or [operand_flags],8 +avx_cvttps2qq_instruction: + or [operand_flags],4 + or [vex_required],8 + mov [opcode_prefix],66h + mov cl,4 + jmp avx_cvt_d_instruction +avx_cvtps2pd_instruction: + or [operand_flags],4 + mov cl,4 + avx_cvt_d_instruction: + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + mov [broadcast_size],cl + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor ecx,ecx + xchg cl,[operand_size] + mov al,cl + shr al,1 + mov [mmx_size],al + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_cvt_d_reg_mem + cmp al,10h + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call convert_avx_register + cmp ah,[mmx_size] + je avx_cvt_d_reg_reg_size_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_cvt_d_reg_reg_size_ok: + mov bl,al + mov [operand_size],cl + call take_avx512_rounding + jmp nomem_instruction_ready + avx_cvt_d_reg_mem: + call take_avx_mem + jmp instruction_ready +avx_cvtpd2dq_instruction: + or [operand_flags],4+8 + mov [opcode_prefix],0F2h + jmp avx_cvt_q_instruction +avx_cvtuqq2ps_instruction: + mov [opcode_prefix],0F2h +avx_cvtpd2udq_instruction: + or [operand_flags],8 +avx_cvttpd2udq_instruction: + or [operand_flags],4 + or [vex_required],8 + jmp avx_cvt_q_instruction +avx_cvtpd2ps_instruction: + or [operand_flags],8 +avx_cvttpd2dq_instruction: + or [operand_flags],4 + mov [opcode_prefix],66h + avx_cvt_q_instruction: + mov [broadcast_size],8 + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + or [rex_prefix],80h + call take_avx_register + mov [postbyte_register],al + push eax + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + mov [operand_size],al + mov [mmx_size],al + call take_avx_rm + jnc avx_cvt_q_reg_mem + mov bl,al + pop eax + call avx_cvt_q_check_size + call take_avx512_rounding + jmp nomem_instruction_ready + avx_cvt_q_reg_mem: + pop eax + call avx_cvt_q_check_size + jmp instruction_ready + avx_cvt_q_check_size: + mov al,[operand_size] + or al,al + jz avx_cvt_q_size_not_specified + cmp al,64 + ja invalid_operand_size + shr al,1 + cmp al,ah + je avx_cvt_q_size_ok + ja invalid_operand_size + cmp ah,16 + jne invalid_operand_size + avx_cvt_q_size_ok: + ret + avx_cvt_q_size_not_specified: + cmp ah,64 shr 1 + jne recoverable_unknown_size + mov [operand_size],64 + ret +avx_cvttps2udq_instruction: + or [vex_required],8 + or [operand_flags],2+4 + mov cx,0400h + jmp avx_instruction_with_broadcast +avx_cvttps2dq_instruction: + mov [opcode_prefix],0F3h + or [operand_flags],2+4 + mov cx,0400h + jmp avx_instruction_with_broadcast +avx_cvtph2ps_instruction: + mov [opcode_prefix],66h + mov [supplemental_code],al + or [operand_flags],4 + mov al,38h + xor cl,cl + jmp avx_cvt_d_instruction +avx_cvtps2ph_instruction: + call setup_66_0f_3a + or [vex_required],1 + or [operand_flags],4 + lods byte [esi] + call get_size_operator + cmp al,10h + je vcvtps2ph_reg + cmp al,'[' + jne invalid_operand + call get_address + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + shl [operand_size],1 + call take_avx_register + mov [postbyte_register],al + shr ah,1 + mov [mmx_size],ah + jmp mmx_imm8 + vcvtps2ph_reg: + lods byte [esi] + call convert_avx_register + mov bl,al + call take_avx512_mask + xor cl,cl + xchg cl,[operand_size] + shl cl,1 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + or cl,cl + jz vcvtps2ph_reg_size_ok + cmp cl,ah + je vcvtps2ph_reg_size_ok + jb invalid_operand_size + cmp ah,16 + jne invalid_operand_size + vcvtps2ph_reg_size_ok: + call take_avx512_rounding + jmp mmx_nomem_imm8 + +avx_cvtsd2usi_instruction: + or [operand_flags],8 +avx_cvttsd2usi_instruction: + or [vex_required],8 + jmp avx_cvttsd2si_instruction +avx_cvtsd2si_instruction: + or [operand_flags],8 +avx_cvttsd2si_instruction: + mov ah,0F2h + mov cl,8 + jmp avx_cvt_2si_instruction +avx_cvtss2usi_instruction: + or [operand_flags],8 +avx_cvttss2usi_instruction: + or [vex_required],8 + jmp avx_cvttss2si_instruction +avx_cvtss2si_instruction: + or [operand_flags],8 +avx_cvttss2si_instruction: + mov ah,0F3h + mov cl,4 + avx_cvt_2si_instruction: + or [operand_flags],2+4 + mov [mmx_size],cl + mov [broadcast_size],0 + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov [operand_size],0 + cmp ah,4 + je avx_cvt_2si_reg + cmp ah,8 + jne invalid_operand_size + call operand_64bit + avx_cvt_2si_reg: + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_rm + jnc instruction_ready + mov bl,al + call take_avx512_rounding + jmp nomem_instruction_ready +avx_cvtusi2sd_instruction: + or [vex_required],8 +avx_cvtsi2sd_instruction: + mov ah,0F2h + mov cl,8 + jmp avx_cvtsi_instruction +avx_cvtusi2ss_instruction: + or [vex_required],8 +avx_cvtsi2ss_instruction: + mov ah,0F3h + mov cl,4 + avx_cvtsi_instruction: + or [operand_flags],2+4+8 + mov [mmx_size],cl + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + or [vex_required],1 + call take_avx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'[' + je avx_cvtsi_reg_reg_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + cmp ah,4 + je avx_cvtsi_reg_reg_reg32 + cmp ah,8 + jne invalid_operand_size + call operand_64bit + avx_cvtsi_rounding: + call take_avx512_rounding + jmp nomem_instruction_ready + avx_cvtsi_reg_reg_reg32: + cmp [mmx_size],8 + jne avx_cvtsi_rounding + jmp nomem_instruction_ready + avx_cvtsi_reg_reg_mem: + call get_address + mov al,[operand_size] + mov [mmx_size],al + or al,al + jz single_mem_nosize + cmp al,4 + je instruction_ready + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp instruction_ready + +avx_maskmov_w1_instruction: + or [rex_prefix],8 +avx_maskmov_instruction: + call setup_66_0f_38 + mov [mmx_size],0 + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne avx_maskmov_mem + lods byte [esi] + call convert_avx_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + avx_maskmov_mem: + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov [postbyte_register],al + add [supplemental_code],2 + jmp instruction_ready +avx_movmskpd_instruction: + mov [opcode_prefix],66h +avx_movmskps_instruction: + mov [base_code],0Fh + mov [extended_code],50h + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,4 + je avx_movmskps_reg_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + avx_movmskps_reg_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready +avx_maskmovdqu_instruction: + or [vex_required],2 + jmp maskmovdqu_instruction +avx_pmovmskb_instruction: + or [vex_required],2 + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + je avx_pmovmskb_reg_size_ok + cmp [code_type],64 + jne invalid_operand_size + cmp ah,8 + jnz invalid_operand_size + avx_pmovmskb_reg_size_ok: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_avx_register + mov bl,al + jmp nomem_instruction_ready + +gather_pd_instruction: + or [rex_prefix],8 +gather_ps_instruction: + call setup_66_0f_38 + or [vex_required],4 + or [operand_flags],20h + call take_avx_register + mov [postbyte_register],al + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor cl,cl + xchg cl,[operand_size] + push ecx + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + pop eax + xchg al,[operand_size] + gather_mem_size_check: + mov ah,4 + test [rex_prefix],8 + jz gather_elements_size_ok + add ah,ah + gather_elements_size_ok: + mov [mmx_size],ah + test al,al + jz gather_mem_size_ok + cmp al,ah + jne invalid_operand_size + gather_mem_size_ok: + cmp byte [esi],',' + je gather_reg_mem_reg + test [vex_required],20h + jz invalid_operand + mov ah,[operand_size] + mov al,80h + jmp gather_arguments_ok + gather_reg_mem_reg: + or [vex_required],2 + inc esi + call take_avx_register + gather_arguments_ok: + mov [vex_register],al + cmp al,[postbyte_register] + je disallowed_combination_of_registers + mov al,bl + and al,11111b + cmp al,[postbyte_register] + je disallowed_combination_of_registers + cmp al,[vex_register] + je disallowed_combination_of_registers + mov al,bl + shr al,5 + cmp al,0Ch shr 1 + je gather_vr128 + mov ah,32 + cmp al,6 shr 1 + jne gather_regular + add ah,ah + gather_regular: + mov al,[rex_prefix] + shr al,3 + xor al,[supplemental_code] + test al,1 + jz gather_uniform + test [supplemental_code],1 + jz gather_double + mov al,ah + xchg al,[operand_size] + add al,al + cmp al,ah + jne invalid_operand_size + jmp instruction_ready + gather_double: + add ah,ah + gather_uniform: + cmp ah,[operand_size] + jne invalid_operand_size + jmp instruction_ready + gather_vr128: + cmp ah,16 + je instruction_ready + cmp ah,32 + jne invalid_operand_size + test [supplemental_code],1 + jnz invalid_operand_size + test [rex_prefix],8 + jz invalid_operand_size + jmp instruction_ready +scatter_pd_instruction: + or [rex_prefix],8 +scatter_ps_instruction: + call setup_66_0f_38 + or [vex_required],4+8 + or [operand_flags],20h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + call take_avx512_mask + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + push eax + call take_avx_register + mov [postbyte_register],al + pop eax + jmp gather_mem_size_check +gatherpf_qpd_instruction: + mov ah,0C7h + jmp gatherpf_pd_instruction +gatherpf_dpd_instruction: + mov ah,0C6h + gatherpf_pd_instruction: + or [rex_prefix],8 + mov cl,8 + jmp gatherpf_instruction +gatherpf_qps_instruction: + mov ah,0C7h + jmp gatherpf_ps_instruction +gatherpf_dps_instruction: + mov ah,0C6h + gatherpf_ps_instruction: + mov cl,4 + gatherpf_instruction: + mov [mmx_size],cl + mov [postbyte_register],al + mov al,ah + call setup_66_0f_38 + or [vex_required],4+8 + or [operand_flags],20h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + call take_avx512_mask + mov ah,[mmx_size] + mov al,[operand_size] + or al,al + jz gatherpf_mem_size_ok + cmp al,ah + jne invalid_operand_size + gatherpf_mem_size_ok: + mov [operand_size],64 + mov al,6 shr 1 + cmp ah,4 + je gatherpf_check_vsib + cmp [supplemental_code],0C6h + jne gatherpf_check_vsib + mov al,0Eh shr 1 + gatherpf_check_vsib: + mov ah,bl + shr ah,5 + cmp al,ah + jne invalid_operand + jmp instruction_ready + +bmi_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F3h + mov [postbyte_register],al + bmi_reg: + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je bmi_reg_reg + cmp al,'[' + jne invalid_argument + call get_address + call operand_32or64 + jmp instruction_ready + bmi_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + call operand_32or64 + jmp nomem_instruction_ready + operand_32or64: + mov al,[operand_size] + cmp al,4 + je operand_32or64_ok + cmp al,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + or [rex_prefix],8 + operand_32or64_ok: + ret +pdep_instruction: + mov [opcode_prefix],0F2h + jmp andn_instruction +pext_instruction: + mov [opcode_prefix],0F3h +andn_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + or [vex_required],2 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + jmp bmi_reg +sarx_instruction: + mov [opcode_prefix],0F3h + jmp bzhi_instruction +shrx_instruction: + mov [opcode_prefix],0F2h + jmp bzhi_instruction +shlx_instruction: + mov [opcode_prefix],66h +bzhi_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + or [vex_required],2 + call get_reg_mem + jc bzhi_reg_reg + call get_vex_source_register + jc invalid_operand + call operand_32or64 + jmp instruction_ready + bzhi_reg_reg: + call get_vex_source_register + jc invalid_operand + call operand_32or64 + jmp nomem_instruction_ready + get_vex_source_register: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne no_vex_source_register + lods byte [esi] + call convert_register + mov [vex_register],al + clc + ret + no_vex_source_register: + stc + ret +bextr_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + or [vex_required],2 + call get_reg_mem + jc bextr_reg_reg + call get_vex_source_register + jc bextr_reg_mem_imm32 + call operand_32or64 + jmp instruction_ready + bextr_reg_reg: + call get_vex_source_register + jc bextr_reg_reg_imm32 + call operand_32or64 + jmp nomem_instruction_ready + setup_bextr_imm_opcode: + mov [xop_opcode_map],0Ah + mov [base_code],10h + call operand_32or64 + ret + bextr_reg_mem_imm32: + call get_imm32 + call setup_bextr_imm_opcode + jmp store_instruction_with_imm32 + bextr_reg_reg_imm32: + call get_imm32 + call setup_bextr_imm_opcode + store_nomem_instruction_with_imm32: + call store_nomem_instruction + mov eax,dword [value] + call mark_relocation + stos dword [edi] + jmp instruction_assembled + get_imm32: + cmp al,'(' + jne invalid_operand + push edx ebx ecx + call get_dword_value + mov dword [value],eax + pop ecx ebx edx + ret +rorx_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],al + or [vex_required],2 + call get_reg_mem + jc rorx_reg_reg + call operand_32or64 + jmp mmx_imm8 + rorx_reg_reg: + call operand_32or64 + jmp mmx_nomem_imm8 + +tbm_instruction: + mov [xop_opcode_map],9 + mov ah,al + shr ah,4 + and al,111b + mov [base_code],ah + mov [postbyte_register],al + jmp bmi_reg + +llwpcb_instruction: + or [vex_required],2 + mov [xop_opcode_map],9 + mov [base_code],12h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + call operand_32or64 + jmp nomem_instruction_ready +lwpins_instruction: + or [vex_required],2 + mov [xop_opcode_map],0Ah + mov [base_code],12h + mov [vex_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + cmp al,10h + je lwpins_reg_reg + cmp al,'[' + jne invalid_argument + push ecx + call get_address + pop eax + xchg al,[operand_size] + test al,al + jz lwpins_reg_mem_size_ok + cmp al,4 + jne invalid_operand_size + lwpins_reg_mem_size_ok: + call prepare_lwpins + jmp store_instruction_with_imm32 + lwpins_reg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov [operand_size],cl + mov bl,al + call prepare_lwpins + jmp store_nomem_instruction_with_imm32 + prepare_lwpins: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_imm32 + call operand_32or64 + mov al,[vex_register] + xchg al,[postbyte_register] + mov [vex_register],al + ret + +xop_single_source_sd_instruction: + or [operand_flags],2 + mov [mmx_size],8 + jmp xop_instruction_9 +xop_single_source_ss_instruction: + or [operand_flags],2 + mov [mmx_size],4 + jmp xop_instruction_9 +xop_single_source_instruction: + or [operand_flags],2 + mov [mmx_size],0 + xop_instruction_9: + mov [base_code],al + mov [xop_opcode_map],9 + jmp avx_xop_common +xop_single_source_128bit_instruction: + or [operand_flags],2 + mov [mmx_size],16 + jmp xop_instruction_9 +xop_triple_source_128bit_instruction: + mov [immediate_size],-1 + mov byte [value],0 + mov [mmx_size],16 + jmp xop_instruction_8 +xop_128bit_instruction: + mov [immediate_size],-2 + mov byte [value],0 + mov [mmx_size],16 + xop_instruction_8: + mov [base_code],al + mov [xop_opcode_map],8 + jmp avx_xop_common +xop_pcom_b_instruction: + mov ah,0CCh + jmp xop_pcom_instruction +xop_pcom_d_instruction: + mov ah,0CEh + jmp xop_pcom_instruction +xop_pcom_q_instruction: + mov ah,0CFh + jmp xop_pcom_instruction +xop_pcom_w_instruction: + mov ah,0CDh + jmp xop_pcom_instruction +xop_pcom_ub_instruction: + mov ah,0ECh + jmp xop_pcom_instruction +xop_pcom_ud_instruction: + mov ah,0EEh + jmp xop_pcom_instruction +xop_pcom_uq_instruction: + mov ah,0EFh + jmp xop_pcom_instruction +xop_pcom_uw_instruction: + mov ah,0EDh + xop_pcom_instruction: + mov byte [value],al + mov [immediate_size],-4 + mov [mmx_size],16 + mov [base_code],ah + mov [xop_opcode_map],8 + jmp avx_xop_common +vpcmov_instruction: + or [vex_required],2 + mov [immediate_size],-2 + mov byte [value],0 + mov [mmx_size],0 + mov [base_code],al + mov [xop_opcode_map],8 + jmp avx_xop_common +xop_shift_instruction: + mov [base_code],al + or [vex_required],2 + mov [xop_opcode_map],9 + call take_avx_register + cmp ah,16 + jne invalid_operand + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je xop_shift_reg_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [vex_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + push esi + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + pop esi + xchg cl,[operand_size] + cmp al,'[' + je xop_shift_reg_reg_mem + cmp al,10h + jne xop_shift_reg_reg_imm + call take_avx_register + mov bl,al + xchg bl,[vex_register] + jmp nomem_instruction_ready + xop_shift_reg_reg_mem: + or [rex_prefix],8 + lods byte [esi] + call get_size_operator + call get_address + jmp instruction_ready + xop_shift_reg_reg_imm: + xor bl,bl + xchg bl,[vex_register] + cmp [base_code],94h + jae invalid_operand + add [base_code],30h + mov [xop_opcode_map],8 + dec esi + jmp mmx_nomem_imm8 + xop_shift_reg_mem: + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + push esi + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + call get_size_operator + pop esi + xchg cl,[operand_size] + cmp al,10h + jne xop_shift_reg_mem_imm + call take_avx_register + mov [vex_register],al + jmp instruction_ready + xop_shift_reg_mem_imm: + cmp [base_code],94h + jae invalid_operand + add [base_code],30h + mov [xop_opcode_map],8 + dec esi + jmp mmx_imm8 + +set_evex_mode: + mov [evex_mode],al + jmp instruction_assembled + +take_avx_register: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] +convert_avx_register: + mov ah,al + and al,1Fh + and ah,0E0h + sub ah,60h + jb invalid_operand + jz avx512_register_size + sub ah,60h + jb invalid_operand + jnz avx_register_size_ok + mov ah,16 + jmp avx_register_size_ok + avx512_register_size: + mov ah,64 + avx_register_size_ok: + cmp al,8 + jb match_register_size + cmp [code_type],64 + jne invalid_operand + jmp match_register_size +store_vex_instruction_code: + test [rex_prefix],10h + jnz invalid_operand + test [vex_required],0F8h + jnz store_evex_instruction_code + test [vex_register],10000b + jnz store_evex_instruction_code + cmp [operand_size],64 + je store_evex_instruction_code + mov al,[base_code] + cmp al,0Fh + jne store_xop_instruction_code + test [vex_required],2 + jnz prepare_vex + cmp [evex_mode],0 + je prepare_vex + cmp [displacement_compression],1 + jne prepare_vex + cmp edx,80h + jb prepare_vex + cmp edx,-80h + jae prepare_vex + mov al,bl + or al,bh + shr al,4 + cmp al,2 + je prepare_vex + call compress_displacement + cmp [displacement_compression],2 + ja prepare_evex + jb prepare_vex + dec [displacement_compression] + mov edx,[uncompressed_displacement] + prepare_vex: + mov ah,[extended_code] + cmp ah,38h + je store_vex_0f38_instruction_code + cmp ah,3Ah + je store_vex_0f3a_instruction_code + test [rex_prefix],1011b + jnz store_vex_0f_instruction_code + mov [edi+2],ah + mov byte [edi],0C5h + mov al,[vex_register] + not al + shl al,3 + mov ah,[rex_prefix] + shl ah,5 + and ah,80h + xor al,ah + call get_vex_lpp_bits + mov [edi+1],al + call check_vex + add edi,3 + ret + get_vex_lpp_bits: + cmp [operand_size],32 + jne get_vex_pp_bits + or al,100b + get_vex_pp_bits: + mov ah,[opcode_prefix] + cmp ah,66h + je vex_66 + cmp ah,0F3h + je vex_f3 + cmp ah,0F2h + je vex_f2 + test ah,ah + jnz disallowed_combination_of_registers + ret + vex_f2: + or al,11b + ret + vex_f3: + or al,10b + ret + vex_66: + or al,1 + ret + store_vex_0f38_instruction_code: + mov al,11100010b + mov ah,[supplemental_code] + jmp make_c4_vex + store_vex_0f3a_instruction_code: + mov al,11100011b + mov ah,[supplemental_code] + jmp make_c4_vex + store_vex_0f_instruction_code: + mov al,11100001b + make_c4_vex: + mov [edi+3],ah + mov byte [edi],0C4h + mov ah,[rex_prefix] + shl ah,5 + xor al,ah + mov [edi+1],al + call check_vex + mov al,[vex_register] + xor al,1111b + shl al,3 + mov ah,[rex_prefix] + shl ah,4 + and ah,80h + or al,ah + call get_vex_lpp_bits + mov [edi+2],al + add edi,4 + ret + check_vex: + cmp [code_type],64 + je vex_ok + not al + test al,11000000b + jnz invalid_operand + test [rex_prefix],40h + jnz invalid_operand + vex_ok: + ret +store_xop_instruction_code: + mov [edi+3],al + mov byte [edi],8Fh + mov al,[xop_opcode_map] + mov ah,[rex_prefix] + test ah,40h + jz xop_ok + cmp [code_type],64 + jne invalid_operand + xop_ok: + not ah + shl ah,5 + xor al,ah + mov [edi+1],al + mov al,[vex_register] + xor al,1111b + shl al,3 + mov ah,[rex_prefix] + shl ah,4 + and ah,80h + or al,ah + call get_vex_lpp_bits + mov [edi+2],al + add edi,4 + ret +store_evex_instruction_code: + test [vex_required],2 + jnz invalid_operand + cmp [base_code],0Fh + jne invalid_operand + cmp [displacement_compression],1 + jne prepare_evex + call compress_displacement + prepare_evex: + mov ah,[extended_code] + cmp ah,38h + je store_evex_0f38_instruction_code + cmp ah,3Ah + je store_evex_0f3a_instruction_code + mov al,11110001b + make_evex: + mov [edi+4],ah + mov byte [edi],62h + mov ah,[rex_prefix] + shl ah,5 + xor al,ah + mov ah,[vex_required] + and ah,10h + xor al,ah + mov [edi+1],al + call check_vex + mov al,[vex_register] + not al + and al,1111b + shl al,3 + mov ah,[rex_prefix] + shl ah,4 + or ah,[rex_prefix] + and ah,80h + or al,ah + or al,100b + call get_vex_pp_bits + mov [edi+2],al + mov al,[vex_register] + not al + shr al,1 + and al,1000b + test [vex_required],80h + jne evex_rounding + mov ah,[operand_size] + cmp ah,16 + jbe evex_l_ok + or al,ah + jmp evex_l_ok + evex_rounding: + mov ah,[rounding_mode] + shl ah,5 + or al,ah + evex_l_ok: + test [vex_required],20h + jz evex_zaaa_ok + or al,[mask_register] + evex_zaaa_ok: + test [vex_required],40h + jz evex_b_ok + or al,10h + evex_b_ok: + mov [edi+3],al + add edi,5 + ret + store_evex_0f38_instruction_code: + mov al,11110010b + mov ah,[supplemental_code] + jmp make_evex + store_evex_0f3a_instruction_code: + mov al,11110011b + mov ah,[supplemental_code] + jmp make_evex +compress_displacement: + mov ebp,ecx + mov [uncompressed_displacement],edx + or edx,edx + jz displacement_compressed + xor ecx,ecx + mov cl,[mmx_size] + test cl,cl + jnz calculate_displacement_scale + mov cl,[operand_size] + calculate_displacement_scale: + bsf ecx,ecx + jz displacement_compression_ok + xor eax,eax + shrd eax,edx,cl + jnz displacement_not_compressed + sar edx,cl + cmp edx,80h + jb displacement_compressed + cmp edx,-80h + jnb displacement_compressed + shl edx,cl + displacement_not_compressed: + inc [displacement_compression] + jmp displacement_compression_ok + displacement_compressed: + add [displacement_compression],2 + displacement_compression_ok: + mov ecx,ebp + ret diff --git a/fasmw172/SOURCE/DOS/DPMI.INC b/fasmw172/SOURCE/DOS/DPMI.INC new file mode 100644 index 0000000..73d1f1b --- /dev/null +++ b/fasmw172/SOURCE/DOS/DPMI.INC @@ -0,0 +1,108 @@ + +; flat assembler interface for DOS +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +init_dpmi_memory: + mov ax,500h ; get free memory information + mov edi,[buffer_address] + int 31h + mov ebx,[edi] + allocate_dpmi_memory: + mov edx,[memory_setting] + shl edx,10 + jz dpmi_memory_size_ok + cmp ebx,edx + jbe dpmi_memory_size_ok + mov ebx,edx + dpmi_memory_size_ok: + mov [memory_end],ebx + mov ecx,ebx + shr ebx,16 + mov ax,501h + int 31h + jnc dpmi_memory_ok + mov ebx,[memory_end] + shr ebx,1 + cmp ebx,4000h + jb out_of_memory + jmp allocate_dpmi_memory + dpmi_memory_ok: + shl ebx,16 + mov bx,cx + sub ebx,[program_base] + jc out_of_memory + mov [memory_start],ebx + add [memory_end],ebx + mov ax,100h ; get free conventional memory size + mov bx,-1 + int 31h + movzx ecx,bx + shl ecx,4 + jecxz no_conventional_memory + mov ax,100h ; allocate all conventional memory + int 31h + movzx edi,ax + shl edi,4 + sub edi,[program_base] + jc no_conventional_memory + mov [additional_memory],edi + mov [additional_memory_end],edi + add [additional_memory_end],ecx + mov eax,[memory_end] + sub eax,[memory_start] + shr eax,2 + cmp eax,ecx + ja no_conventional_memory + ret + no_conventional_memory: + mov eax,[memory_end] + mov ebx,[memory_start] + sub eax,ebx + shr eax,2 + mov [additional_memory],ebx + add ebx,eax + mov [additional_memory_end],ebx + mov [memory_start],ebx + ret + +dpmi_dos_int: + mov [real_mode_segment],main + simulate_real_mode: + push 0 ; SS:SP (DPMI will allocate stack) + push 0 ; CS:IP (ignored) + push 0 + push [real_mode_segment] ; DS + push [real_mode_segment] ; ES + stc + pushfw + push eax + push ecx + push edx + push ebx + push 0 + push ebp + push esi + push edi + mov ax,300h + mov bx,21h + xor cx,cx + mov edi,esp + push es ss + pop es + int 31h + pop es + mov edi,[esp] + mov esi,[esp+4] + mov ebp,[esp+8] + mov ebx,[esp+10h] + mov edx,[esp+14h] + mov ecx,[esp+18h] + mov ah,[esp+20h] + add esp,32h + sahf + mov eax,[esp-32h+1Ch] + ret +dpmi_dos_int_with_buffer: + mov [real_mode_segment],buffer + jmp simulate_real_mode diff --git a/fasmw172/SOURCE/DOS/FASM.ASM b/fasmw172/SOURCE/DOS/FASM.ASM new file mode 100644 index 0000000..ff1c741 --- /dev/null +++ b/fasmw172/SOURCE/DOS/FASM.ASM @@ -0,0 +1,435 @@ + +; flat assembler interface for DOS +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + + format MZ + heap 0 + stack 8000h + entry main:start + +include 'modes.inc' + +segment main use16 + +start: + + mov ax,ds + mov dx,[2Ch] + push cs cs + pop ds es + mov [psp_segment],ax + mov [environment_segment],dx + + mov dx,_logo + mov ah,9 + int 21h + + cld + + call go32 + use32 + + call get_params + jc information + + call init_memory + + mov esi,_memory_prefix + call display_string + mov eax,[memory_end] + sub eax,[memory_start] + add eax,[additional_memory_end] + sub eax,[additional_memory] + shr eax,10 + call display_number + mov esi,_memory_suffix + call display_string + + xor ah,ah + int 1Ah + mov ax,cx + shl eax,16 + mov ax,dx + mov [start_time],eax + + cmp [mode],dpmi + je compile + jmp main+(first_segment shr 4):first_gate-first_segment + +compile: + and [preprocessing_done],0 + call preprocessor + or [preprocessing_done],-1 + call parser + call assembler + call formatter + +finish: + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + xor ah,ah + int 1Ah + mov ax,cx + shl eax,16 + mov ax,dx + sub eax,[start_time] + mov ebx,100 + mul ebx + mov ebx,182 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov ah,2 + mov dl,'.' + int 21h + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + jmp exit_program + +information: + mov esi,_usage + call display_string + mov al,1 + jmp exit_program + +get_params: + mov [input_file],0 + mov [output_file],0 + mov [symbols_file],0 + mov [memory_setting],0 + mov [passes_limit],100 + mov [definitions_pointer],predefinitions + push ds + mov ds,[psp_segment] + mov esi,81h + mov edi,params + find_param: + lodsb + cmp al,20h + je find_param + cmp al,'-' + je option_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [es:input_file],0 + jne get_output_file + mov [es:input_file],edi + jmp process_param + get_output_file: + cmp [es:output_file],0 + jne bad_params + mov [es:output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + option_param: + lodsb + cmp al,'m' + je memory_option + cmp al,'M' + je memory_option + cmp al,'p' + je passes_option + cmp al,'P' + je passes_option + cmp al,'d' + je definition_option + cmp al,'D' + je definition_option + cmp al,'s' + je symbols_option + cmp al,'S' + je symbols_option + invalid_option: + pop ds + stc + ret + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc bad_params_value + cmp al,9 + ja bad_params_value + imul edx,10 + jo bad_params_value + add edx,eax + jc bad_params_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + bad_params_value: + stc + ret + memory_option: + lodsb + cmp al,20h + je memory_option + cmp al,0Dh + je invalid_option + or al,al + jz invalid_option + dec esi + call get_option_value + jc invalid_option + or edx,edx + jz invalid_option + cmp edx,1 shl (32-10) + jae invalid_option + mov [es:memory_setting],edx + jmp find_param + passes_option: + lodsb + cmp al,20h + je passes_option + cmp al,0Dh + je invalid_option + or al,al + jz invalid_option + dec esi + call get_option_value + jc bad_params + or edx,edx + jz invalid_option + cmp edx,10000h + ja invalid_option + mov [es:passes_limit],dx + jmp find_param + definition_option: + lodsb + cmp al,20h + je definition_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + push edi + mov edi,[es:definitions_pointer] + call convert_definition_option + mov [es:definitions_pointer],edi + pop edi + jc invalid_option + jmp find_param + symbols_option: + mov [es:symbols_file],edi + find_symbols_file_name: + lodsb + cmp al,20h + jne process_param + jmp find_symbols_file_name + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + xor al,al + stosb + pop ds + cmp [input_file],0 + je no_input_file + mov eax,[definitions_pointer] + mov byte [eax],0 + mov [initial_definitions],predefinitions + clc + ret + bad_params: + pop ds + no_input_file: + stc + ret + convert_definition_option: + mov ecx,edi + xor al,al + stosb + copy_definition_name: + lodsb + cmp al,'=' + je copy_definition_value + cmp al,20h + je bad_definition_option + cmp al,0Dh + je bad_definition_option + or al,al + jz bad_definition_option + stosb + inc byte [es:ecx] + jnz copy_definition_name + bad_definition_option: + stc + ret + copy_definition_value: + lodsb + cmp al,20h + je definition_value_end + cmp al,0Dh + je definition_value_end + or al,al + jz definition_value_end + cmp al,'\' + jne definition_value_character + cmp byte [esi],20h + jne definition_value_character + lodsb + definition_value_character: + stosb + jmp copy_definition_value + definition_value_end: + dec esi + xor al,al + stosb + clc + ret + +include '..\version.inc' + +_logo db 'flat assembler version ',VERSION_STRING,24h +_copyright db 'Copyright (c) 1999-2017, Tomasz Grysztar',0Dh,0Ah,0 + +_usage db 0Dh,0Ah + db 'usage: fasm <source> [output]',0Dh,0Ah + db 'optional settings:',0Dh,0Ah + db ' -m <limit> set the limit in kilobytes for the available memory',0Dh,0Ah + db ' -p <limit> set the maximum allowed number of passes',0Dh,0Ah + db ' -d <name>=<value> define symbolic variable',0Dh,0Ah + db ' -s <file> dump symbolic information for debugging',0Dh,0Ah + db 0 +_memory_prefix db ' (',0 +_memory_suffix db ' kilobytes memory)',0Dh,0Ah,0 +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',0Dh,0Ah,0 + +error_prefix db 'error: ',0 +error_suffix db '.' +cr_lf db 0Dh,0Ah,0 +line_number_start db ' [',0 +line_data_start db ':',0Dh,0Ah,0 +preprocessed_instruction_prefix db 'processed: ',0 + +include 'dpmi.inc' + +align 16 +first_segment: + +include '..\preproce.inc' +include '..\parser.inc' +include '..\exprpars.inc' + +align 16 +second_segment: + +include '..\exprcalc.inc' +include '..\errors.inc' +include '..\symbdump.inc' + +include 'system.inc' + +first_gate: + and [preprocessing_done],0 + call preprocessor + or [preprocessing_done],-1 + call parser + jmp main+(second_segment shr 4):second_gate-second_segment +first_segment_top = $ - first_segment + +include '..\assemble.inc' +include '..\formats.inc' +include '..\x86_64.inc' +include '..\avx.inc' + +second_gate: + call assembler + call formatter + jmp main:finish + +second_segment_top = $ - second_segment + +if first_segment_top>=10000h | second_segment_top>=10000h + if UNREAL_ENABLED>0 + UNREAL_ENABLED = -1 + else + UNREAL_ENABLED = 0 + end if +else + if UNREAL_ENABLED<0 + UNREAL_ENABLED = -1 + else + UNREAL_ENABLED = 1 + end if +end if + +include '..\tables.inc' +include '..\messages.inc' + +align 4 + +include '..\variable.inc' + +memory_setting dd ? +start_time dd ? +definitions_pointer dd ? +params rb 100h +predefinitions rb 100h + +mode dw ? +real_mode_segment dw ? +displayed_count dd ? +last_displayed rb 2 +preprocessing_done db ? + +segment buffer + +rb 1000h diff --git a/fasmw172/SOURCE/DOS/MODES.INC b/fasmw172/SOURCE/DOS/MODES.INC new file mode 100644 index 0000000..5617ba0 --- /dev/null +++ b/fasmw172/SOURCE/DOS/MODES.INC @@ -0,0 +1,539 @@ + +; flat assembler interface for DOS +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +segment modes use16 + +real32: + mov ax,7202h + push ax + popf + pushf + pop bx + cmp ax,bx + je processor_ok + call init_error + db 'required 80386 or better',24h + processor_ok: + mov eax,ds + shl eax,4 + mov [program_base],eax + mov eax,buffer + shl eax,4 + sub eax,[program_base] + mov [buffer_address],eax + +if UNREAL_ENABLED>0 + + smsw ax + test al,1 + jnz dpmi + mov eax,cs ; calculate linear address of GDT + shl eax,4 + or dword [cs:real32_GDT+10],eax + or dword [cs:real16_GDT+10],eax + add [cs:real32_GDT_address],eax + add [cs:real16_GDT_address],eax + cli + lgdt [cs:real32_GDTR] + mov eax,cr0 + or al,1 + mov cr0,eax + jmp 1 shl 3:test_pm32 + no_rm32: + sti + jmp dpmi + test_pm32: + use32 + mov eax,cr0 + and al,not 1 + mov cr0,eax + mov ebx,0FFFFh + jmp modes:test_rm32 + test_rm32: + inc ebx + jz short no_rm32 + lgdt [cs:real16_GDTR] + mov eax,cr0 + or al,1 + mov cr0,eax + jmp 1 shl 3:test_pm16 + test_pm16: + use16 + mov eax,cr0 + and al,not 1 + mov cr0,eax + jmp modes:test_rm16 + test_rm16: + sti + mov bx,(400h+(100h*interrupt.size)) shr 4 + mov ah,48h + int 21h + jc not_enough_memory + push ds es + mov es,ax + push cs + pop ds + movzx eax,ax + shl eax,4 + mov [real32_IDT_base],eax + mov dx,100h + xor bx,bx + mov di,400h + init_interrupts: + mov si,interrupt + mov [si+interrupt.vector],bx + mov word [es:bx],di + mov word [es:bx+2],es + mov cx,interrupt.size + rep movsb + add bx,4 + dec dx + jnz init_interrupts + pop es ds + call modes:switch_real32 + use32 + mov [mode],real32 + retfw + use16 + +switch_real32: + pushfw + push eax + push word ds + push word es + push word fs + push word gs + cli + mov eax,ss + mov cr3,eax + lgdt [cs:real32_GDTR] + mov eax,cr0 ; switch to protected mode + or al,1 + mov cr0,eax + jmp 1 shl 3:pm32_start + pm32_start: + use32 + mov ax,2 shl 3 ; load 32-bit data descriptor + mov ds,ax ; to all data segment registers + mov es,ax + mov fs,ax + mov gs,ax + mov ss,ax + mov eax,cr0 ; switch back to real mode + and al,not 1 + mov cr0,eax + jmp modes:pm32_end + pm32_end: + mov eax,cr3 + mov ss,ax + lidt [cs:real32_IDTR] + pop word gs + pop word fs + pop word es + pop word ds + pop eax + popfw + retfw + +switch_real16: + pushfw + push eax + cli + lgdt [cs:real16_GDTR] + mov eax,cr0 ; switch to protected mode + or al,1 + mov cr0,eax + jmp 1 shl 3:pm16_start + pm16_start: + use16 + mov eax,cr0 ; switch back to real mode + and al,not 1 + mov cr0,eax + jmp modes:pm16_end + pm16_end: + lidt [cs:real16_IDTR] + pop eax + popfw + retfd + use32 + +interrupt: + call modes:switch_real16 + use16 + movzx esp,sp + push word [esp+4] + push cs + call .real16 + pushfw + pop word [esp+4] + call modes:switch_real32 + use32 + iretw + .real16: + use16 + push eax + push ds + xor ax,ax + mov ds,ax + mov eax,[word 0] + label .vector word at $-2-interrupt + pop ds + xchg eax,[esp] + retfw + .size = $-interrupt + +label real32_GDTR pword +real32_GDT_limit dw 3*8-1 ; limit of GDT +real32_GDT_address dd real32_GDT ; linear address of GDT +real32_GDT rw 4 ; null descriptor + dw 0FFFFh,0,9A00h,0CFh ; 32-bit code descriptor + dw 0FFFFh,0,9200h,08Fh ; 4 GB data descriptor +label real16_GDTR pword +real16_GDT_limit dw 2*8-1 ; limit of GDT +real16_GDT_address dd real16_GDT ; linear address of GDT +real16_GDT rw 4 ; null descriptor + dw 0FFFFh,0,9A00h,0 ; 16-bit code descriptor + +label real32_IDTR pword +real32_IDT_limit dw 3FFh +real32_IDT_base dd ? +label real16_IDTR pword +real16_IDT_limit dw 3FFh +real16_IDT_base dd 0 + +end if + +dpmi: + mov ax,1687h + int 2Fh + or ax,ax ; DPMI installed? + jnz no_dpmi + test bl,1 ; 32-bit programs supported? + jz no_dpmi + mov word [cs:mode_switch],di + mov word [cs:mode_switch+2],es + mov bx,si ; allocate memory for DPMI data + mov ah,48h + int 21h + jc not_enough_memory + mov ds,[environment_segment] + mov es,ax + mov ax,1 + call far [cs:mode_switch] ; switch to protected mode + jc no_dpmi + mov cx,1 + xor ax,ax + int 31h ; allocate descriptor for code + mov si,ax + xor ax,ax + int 31h ; allocate descriptor for data + mov di,ax + mov dx,cs + lar cx,dx + shr cx,8 + or cx,0C000h + mov bx,si + mov ax,9 + int 31h ; set code descriptor access rights + mov dx,ds + lar cx,dx + shr cx,8 + or cx,0C000h + mov bx,di + int 31h ; set data descriptor access rights + mov ecx,main + shl ecx,4 + mov dx,cx + shr ecx,16 + mov ax,7 + int 31h ; set data descriptor base address + movzx ecx,word [esp+2] + shl ecx,4 + mov dx,cx + shr ecx,16 + mov bx,si + int 31h ; set code descriptor base address + mov cx,0FFFFh + mov dx,0FFFFh + mov ax,8 ; set segment limit to 4 GB + int 31h + mov bx,di + int 31h + mov ax,ds + mov ds,di + mov [psp_segment],es + mov [environment_segment],ax + mov es,di + mov [mode],dpmi + pop ebx + movzx ebx,bx + push esi + push ebx + retfd + +init_error: + push cs + pop ds + mov dx,init_error_prefix + mov ah,9 + int 21h + pop dx + int 21h + mov dx,init_error_suffix + int 21h + mov ax,04CFFh + int 21h + +init_error_prefix db 0Dh,0Ah,'error: ',24h +init_error_suffix db '.',0Dh,0Ah,24h + +mode_switch dd ? + + not_enough_memory: + call init_error + db 'not enough conventional memory',24h + +if UNREAL_ENABLED>0 + + no_dpmi: + smsw ax + test al,1 + jz no_real32 + call init_error + db 'system is in protected mode without 32-bit DPMI services',24h + no_real32: + call init_error + db 'processor is not able to enter 32-bit real mode',24h + +else + + no_dpmi: + call init_error + db 'no 32-bit DPMI services are available',24h + +end if + +use32 + +if UNREAL_ENABLED>0 + +init_real32_memory: + mov ax,4300h ; check for XMS + int 2Fh + cmp al,80h ; XMS present? + je xms_init + mov ax,0E801h ; check for large free extended memory + int 15h + jnc large_raw_memory + mov ah,88h ; how much extended memory free? + int 15h + or ax,ax + jz no_extended_memory + movzx eax,ax ; convert AX kilobytes to pointer + shl eax,10 + jmp use_raw_memory + large_raw_memory: + movzx ecx,cx + shl ecx,10 + movzx edx,dx + shl edx,16 + mov eax,ecx + add eax,edx + use_raw_memory: + add eax,100000h + sub eax,[program_base] + mov [memory_end],eax + push ds + push 0 ; DS := 0 + pop ds + call enable_a20 ; enable A20 + call test_a20 ; is A20 enabled? + jz a20_ok + pop ds + jmp no_extended_memory + a20_ok: + lds bx,dword [4*19h] + mov eax,100000h ; initial free extended memory base + cmp dword [bx+12h],'VDIS' ; VDISK memory allocation? + jne short no_vdisk ; if present, get base of free memory + mov eax,dword [bx+2Ch] ; get first free extended memory byte + add eax,0Fh ; align on paragraph + and eax,0FFFFF0h ; address is only 24bit + no_vdisk: + push 0FFFFh ; DS := FFFFh for ext mem addressing + pop ds + cmp dword [13h],'VDIS' ; VDISK memory allocation? + jne short vdisk_ok ; if present, get base of free memory + movzx ebx,word [2Eh] ; get first free kilobyte + shl ebx,10 + cmp eax,ebx ; pick larger of 2 addresses + ja short vdisk_ok + mov eax,ebx + vdisk_ok: + pop ds + sub eax,[program_base] + mov [memory_start],eax + mov edx,[memory_setting] + shl edx,10 + jz extended_memory_ok + mov eax,[memory_end] + sub eax,[memory_start] + sub eax,edx + jbe extended_memory_ok + sub [memory_end],eax + jmp extended_memory_ok +enable_a20: + call test_a20 ; is A20 already enabled? + jz a20_enabled ; if yes, done + in al,92h ; PS/2 A20 enable + or al,2 + out 92h,al + call test_a20 ; is A20 enabled? + jz a20_enabled ; if yes, done + call kb_wait ; AT A20 enable + jnz a20_enabled + mov al,0D1h + out 64h,al + call kb_wait + jnz a20_enabled + mov al,0DFh + out 60h,al + call kb_wait + a20_enabled: + retn + kb_wait: ; wait for safe to write to 8042 + xor cx,cx + .loop: + in al,64h ; read 8042 status + test al,2 ; buffer full? + loopnz .loop ; if yes, loop + retn + test_a20: ; test for enabled A20 + mov al,[0] ; get byte from 0:0 + mov ah,al ; preserve old byte + not al ; modify byte + xchg al,[100000h] ; put modified byte to 0FFFFh:10h + cmp ah,[0] ; set zero if byte at 0:0 not modified + mov [100000h],al ; restore byte at 0FFFFh:10h + retn ; return, zero if A20 enabled +xms_init: + push es + mov ax,4310h ; get XMS driver address + int 2Fh + mov word [cs:xms_proc],bx ; store XMS driver address + mov word [cs:xms_proc+2],es + pop es + mov ah,3 ; enable A20 + call call_xms + cmp ax,1 ; error enabling A20? + jne no_extended_memory + mov ah,88h ; get free extended memory size (XMS 3.0) + xor bl,bl + call call_xms + or bl,bl + jz xms_large_init + mov ah,8 ; get free extended memory size + xor bl,bl + call call_xms + or bl,bl + jnz no_extended_memory + mov dx,ax + movzx eax,ax + shl eax,10 + mov [memory_end],eax + mov ah,9 ; allocate largest memory block + xms_allocate: + mov ecx,[memory_setting] + shl ecx,10 + jz xms_size_ok + cmp ecx,[memory_end] + jae xms_size_ok + mov [memory_end],ecx + mov edx,[memory_setting] + xms_size_ok: + call call_xms + mov [cs:xms_handle],dx + cmp ax,1 + jne no_extended_memory + mov ah,0Ch ; lock extended memory block + call call_xms + cmp ax,1 + jne no_extended_memory + shl edx,16 + mov dx,bx + sub edx,[program_base] + mov [memory_start],edx ; store memory block address + add [memory_end],edx + jmp extended_memory_ok + xms_large_init: + mov edx,eax + shl eax,10 + mov [memory_end],eax + mov ah,89h ; allocate largest memory block (XMS 3.0) + jmp xms_allocate + call_xms: + call modes:switch_real16 + use16 + call far dword [cs:xms_proc] + call modes:switch_real32 + use32 + retn +no_extended_memory: + xor eax,eax + mov [memory_start],eax +extended_memory_ok: + mov ah,48h ; get free conventional memory size + mov bx,-1 + int 21h + movzx ecx,bx + shl ecx,4 + mov ah,48h ; allocate all conventional memory + int 21h + movzx edi,ax + shl edi,4 + sub edi,[program_base] + mov [additional_memory],edi + mov [additional_memory_end],edi + add [additional_memory_end],ecx + cmp [memory_start],0 + je only_conventional_memory + mov eax,[memory_end] + sub eax,[memory_start] + shr eax,2 + cmp eax,ecx + jbe real32_memory_ok + mov eax,[memory_end] + mov ebx,[memory_start] + sub eax,ebx + shr eax,2 + mov [additional_memory],ebx + add ebx,eax + mov [additional_memory_end],ebx + mov [memory_start],ebx + real32_memory_ok: + retf + only_conventional_memory: + shr ecx,2 ; use part of conventional memory + add edi,ecx ; as a substitute for extended memory + mov [memory_start],edi + xchg [additional_memory_end],edi + mov [memory_end],edi + retf + +free_real32_memory: + cmp [cs:xms_handle],0 + je no_xms + mov ah,0Dh ; unlock extended memory block + mov dx,[cs:xms_handle] + call call_xms + mov ah,0Ah ; free extended memory block + call call_xms + no_xms: + retf + +xms_proc dd ? ; XMS driver pointer +xms_handle dw ? ; handle of XMS memory block + +end if diff --git a/fasmw172/SOURCE/DOS/SYSTEM.INC b/fasmw172/SOURCE/DOS/SYSTEM.INC new file mode 100644 index 0000000..fe616a3 --- /dev/null +++ b/fasmw172/SOURCE/DOS/SYSTEM.INC @@ -0,0 +1,600 @@ + +; flat assembler interface for DOS +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +go32: + use16 + call modes:real32 + use32 + retw + +program_base dd ? +buffer_address dd ? +psp_segment dw ? +environment_segment dw ? + +if UNREAL_ENABLED>0 + +init_memory: + mov [stack_limit],0 + cmp [mode],dpmi + je init_dpmi_memory + call modes:init_real32_memory + ret +dos_int: + cmp [mode],dpmi + je dpmi_dos_int + stc + int 21h + ret +dos_int_with_buffer: + cmp [mode],dpmi + je dpmi_dos_int_with_buffer + push ds buffer + pop ds + stc + int 21h + pop ds + ret +exit_program: + cmp [mode],dpmi + je exit_state_ok + push eax + call modes:free_real32_memory + pop eax + exit_state_ok: + mov ah,4Ch + int 21h + +else + +init_memory: + mov [stack_limit],0 + jmp init_dpmi_memory +dos_int: + jmp dpmi_dos_int +dos_int_with_buffer: + jmp dpmi_dos_int_with_buffer +exit_program: + mov ah,4Ch + int 21h + +end if + +get_environment_variable: + mov ebx,esi + push ds + mov ds,[environment_segment] + xor esi,esi + compare_variable_names: + mov edx,ebx + compare_character: + lodsb + mov ah,[es:edx] + inc edx + cmp al,'=' + je end_of_variable_name + or ah,ah + jz next_variable + sub ah,al + jz compare_character + cmp ah,20h + jne next_variable + cmp al,41h + jb next_variable + cmp al,5Ah + jna compare_character + next_variable: + lodsb + or al,al + jnz next_variable + cmp byte [esi],0 + jne compare_variable_names + pop ds + ret + end_of_variable_name: + or ah,ah + jnz next_variable + copy_variable_value: + lodsb + cmp edi,[es:memory_end] + jae out_of_memory + stosb + or al,al + jnz copy_variable_value + dec edi + pop ds + ret + +open: + push esi edi + call adapt_path + mov ax,716Ch + mov bx,100000b + mov dx,1 + xor cx,cx + xor si,si + call dos_int_with_buffer + jnc open_done + cmp ax,7100h + je old_open + stc + jmp open_done + old_open: + mov ax,3D00h + xor dx,dx + call dos_int_with_buffer + open_done: + mov bx,ax + pop edi esi + ret + adapt_path: + mov esi,edx + mov edi,[buffer_address] + copy_path: + lodsb + cmp al,'/' + jne path_char_ok + mov al,'\' + path_char_ok: + stosb + or al,al + jnz copy_path + ret +create: + push esi edi + call adapt_path + mov ax,716Ch + mov bx,100001b + mov dx,10010b + xor cx,cx + xor si,si + xor di,di + call dos_int_with_buffer + jnc create_done + cmp ax,7100h + je old_create + stc + jmp create_done + old_create: + mov ah,3Ch + xor cx,cx + xor dx,dx + call dos_int_with_buffer + create_done: + mov bx,ax + pop edi esi + ret +write: + push edx esi edi ebp + mov ebp,ecx + mov esi,edx + .loop: + mov ecx,1000h + sub ebp,1000h + jnc .write + add ebp,1000h + mov ecx,ebp + xor ebp,ebp + .write: + push ecx + mov edi,[buffer_address] + shr ecx,2 + rep movsd + mov ecx,[esp] + and ecx,11b + rep movsb + pop ecx + mov ah,40h + xor dx,dx + call dos_int_with_buffer + or ebp,ebp + jnz .loop + pop ebp edi esi edx + ret +read: + push edx esi edi ebp + mov ebp,ecx + mov edi,edx + .loop: + mov ecx,1000h + sub ebp,1000h + jnc .read + add ebp,1000h + mov ecx,ebp + xor ebp,ebp + .read: + push ecx + mov ah,3Fh + xor dx,dx + call dos_int_with_buffer + cmp ax,cx + jne .eof + mov esi,[buffer_address] + mov ecx,[esp] + shr ecx,2 + rep movsd + pop ecx + and ecx,11b + rep movsb + or ebp,ebp + jnz .loop + .exit: + pop ebp edi esi edx + ret + .eof: + pop ecx + stc + jmp .exit +close: + mov ah,3Eh + int 21h + ret +lseek: + mov ah,42h + mov ecx,edx + shr ecx,16 + int 21h + pushf + shl edx,16 + popf + mov dx,ax + mov eax,edx + ret + +display_string: + lods byte [esi] + or al,al + jz string_end + mov dl,al + mov ah,2 + int 21h + jmp display_string + string_end: + ret +display_number: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + push edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + mov ah,2 + int 21h + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz display_loop + pop ebx + ret + +display_user_messages: + mov [displayed_count],0 + call show_display_buffer + cmp [displayed_count],1 + jb line_break_ok + je make_line_break + mov ax,word [last_displayed] + cmp ax,0A0Dh + je line_break_ok + cmp ax,0D0Ah + je line_break_ok + make_line_break: + mov ah,2 + mov dl,0Dh + int 21h + mov dl,0Ah + int 21h + line_break_ok: + ret +display_block: + add [displayed_count],ecx + cmp ecx,1 + ja take_last_two_characters + jb display_character + mov al,[last_displayed+1] + mov ah,[esi] + mov word [last_displayed],ax + jmp display_character + take_last_two_characters: + mov ax,[esi+ecx-2] + mov word [last_displayed],ax + display_character: + lods byte [esi] + mov dl,al + mov ah,2 + int 21h + loopd display_character + ret + +fatal_error: + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,0FFh + jmp exit_program +assembler_error: + call display_user_messages + mov ebx,[current_line] + test ebx,ebx + jz display_error_message + pushd 0 + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + mov ah,2 + int 21h + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + mov ah,2 + int 21h + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + mov ah,2 + int 21h + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + jz line_data_displayed + mov [counter],eax + xor al,al + call lseek + mov esi,[additional_memory] + read_line_data: + mov ecx,100h + cmp ecx,[counter] + jbe bytes_count_ok + mov ecx,[counter] + bytes_count_ok: + sub [counter],ecx + lea eax,[esi+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + push ecx + mov edx,esi + call read + pop ecx + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + cmp [counter],0 + ja read_line_data + display_line_data: + call close + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + line_data_displayed: + mov esi,cr_lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + cmp [preprocessing_done],0 + je display_error_message + mov esi,preprocessed_instruction_prefix + call display_string + mov esi,[current_line] + add esi,16 + mov edi,[additional_memory] + xor dl,dl + convert_instruction: + lodsb + cmp al,1Ah + je copy_symbol + cmp al,22h + je copy_symbol + cmp al,3Bh + je instruction_converted + stosb + or al,al + jz instruction_converted + xor dl,dl + jmp convert_instruction + copy_symbol: + or dl,dl + jz space_ok + mov byte [edi],20h + inc edi + space_ok: + cmp al,22h + je quoted + lodsb + movzx ecx,al + rep movsb + or dl,-1 + jmp convert_instruction + quoted: + mov al,27h + stosb + lodsd + mov ecx,eax + jecxz quoted_copied + copy_quoted: + lodsb + stosb + cmp al,27h + jne quote_ok + stosb + quote_ok: + loop copy_quoted + quoted_copied: + mov al,27h + stosb + or dl,-1 + jmp convert_instruction + instruction_converted: + xor al,al + stosb + mov esi,[additional_memory] + call display_string + mov esi,cr_lf + call display_string + display_error_message: + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,2 + jmp exit_program + +make_timestamp: + mov ah,2Ah + int 21h + push dx cx + movzx ecx,cx + mov eax,ecx + sub eax,1970 + mov ebx,365 + mul ebx + mov ebp,eax + mov eax,ecx + sub eax,1969 + shr eax,2 + add ebp,eax + mov eax,ecx + sub eax,1901 + mov ebx,100 + div ebx + sub ebp,eax + mov eax,ecx + xor edx,edx + sub eax,1601 + mov ebx,400 + div ebx + add ebp,eax + movzx ecx,byte [esp+3] + mov eax,ecx + dec eax + mov ebx,30 + mul ebx + add ebp,eax + cmp ecx,8 + jbe months_correction + mov eax,ecx + sub eax,7 + shr eax,1 + add ebp,eax + mov ecx,8 + months_correction: + mov eax,ecx + shr eax,1 + add ebp,eax + cmp ecx,2 + pop cx + jbe day_correction_ok + sub ebp,2 + test ecx,11b + jnz day_correction_ok + xor edx,edx + mov eax,ecx + mov ebx,100 + div ebx + or edx,edx + jnz day_correction + mov eax,ecx + mov ebx,400 + div ebx + or edx,edx + jnz day_correction_ok + day_correction: + inc ebp + day_correction_ok: + pop dx + movzx eax,dl + dec eax + add eax,ebp + mov ebx,24 + mul ebx + push eax + mov ah,2Ch + int 21h + pop eax + push dx + movzx ebx,ch + add eax,ebx + mov ebx,60 + mul ebx + movzx ebx,cl + add eax,ebx + mov ebx,60 + mul ebx + pop bx + movzx ebx,bh + add eax,ebx + adc edx,0 + ret diff --git a/fasmw172/SOURCE/ERRORS.INC b/fasmw172/SOURCE/ERRORS.INC new file mode 100644 index 0000000..8b2170b --- /dev/null +++ b/fasmw172/SOURCE/ERRORS.INC @@ -0,0 +1,194 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +out_of_memory: + push _out_of_memory + jmp fatal_error +stack_overflow: + push _stack_overflow + jmp fatal_error +main_file_not_found: + push _main_file_not_found + jmp fatal_error +write_failed: + push _write_failed + jmp fatal_error + +unexpected_end_of_file: + push _unexpected_end_of_file + jmp general_error +code_cannot_be_generated: + push _code_cannot_be_generated + jmp general_error +format_limitations_exceeded: + push _format_limitations_exceeded + jmp general_error +invalid_definition: + push _invalid_definition + general_error: + cmp [symbols_file],0 + je fatal_error + call dump_preprocessed_source + jmp fatal_error + +file_not_found: + push _file_not_found + jmp error_with_source +error_reading_file: + push _error_reading_file + jmp error_with_source +invalid_file_format: + push _invalid_file_format + jmp error_with_source +invalid_macro_arguments: + push _invalid_macro_arguments + jmp error_with_source +incomplete_macro: + push _incomplete_macro + jmp error_with_source +unexpected_characters: + push _unexpected_characters + jmp error_with_source +invalid_argument: + push _invalid_argument + jmp error_with_source +illegal_instruction: + push _illegal_instruction + jmp error_with_source +invalid_operand: + push _invalid_operand + jmp error_with_source +invalid_operand_size: + push _invalid_operand_size + jmp error_with_source +operand_size_not_specified: + push _operand_size_not_specified + jmp error_with_source +operand_sizes_do_not_match: + push _operand_sizes_do_not_match + jmp error_with_source +invalid_address_size: + push _invalid_address_size + jmp error_with_source +address_sizes_do_not_agree: + push _address_sizes_do_not_agree + jmp error_with_source +disallowed_combination_of_registers: + push _disallowed_combination_of_registers + jmp error_with_source +long_immediate_not_encodable: + push _long_immediate_not_encodable + jmp error_with_source +relative_jump_out_of_range: + push _relative_jump_out_of_range + jmp error_with_source +invalid_expression: + push _invalid_expression + jmp error_with_source +invalid_address: + push _invalid_address + jmp error_with_source +invalid_value: + push _invalid_value + jmp error_with_source +value_out_of_range: + push _value_out_of_range + jmp error_with_source +undefined_symbol: + mov edi,message + mov esi,_undefined_symbol + call copy_asciiz + push message + cmp [error_info],0 + je error_with_source + mov esi,[error_info] + mov esi,[esi+24] + or esi,esi + jz error_with_source + mov byte [edi-1],20h + call write_quoted_symbol_name + jmp error_with_source + copy_asciiz: + lods byte [esi] + stos byte [edi] + test al,al + jnz copy_asciiz + ret + write_quoted_symbol_name: + mov al,27h + stosb + movzx ecx,byte [esi-1] + rep movs byte [edi],[esi] + mov ax,27h + stosw + ret +symbol_out_of_scope: + mov edi,message + mov esi,_symbol_out_of_scope_1 + call copy_asciiz + cmp [error_info],0 + je finish_symbol_out_of_scope_message + mov esi,[error_info] + mov esi,[esi+24] + or esi,esi + jz finish_symbol_out_of_scope_message + mov byte [edi-1],20h + call write_quoted_symbol_name + finish_symbol_out_of_scope_message: + mov byte [edi-1],20h + mov esi,_symbol_out_of_scope_2 + call copy_asciiz + push message + jmp error_with_source +invalid_use_of_symbol: + push _invalid_use_of_symbol + jmp error_with_source +name_too_long: + push _name_too_long + jmp error_with_source +invalid_name: + push _invalid_name + jmp error_with_source +reserved_word_used_as_symbol: + push _reserved_word_used_as_symbol + jmp error_with_source +symbol_already_defined: + push _symbol_already_defined + jmp error_with_source +missing_end_quote: + push _missing_end_quote + jmp error_with_source +missing_end_directive: + push _missing_end_directive + jmp error_with_source +unexpected_instruction: + push _unexpected_instruction + jmp error_with_source +extra_characters_on_line: + push _extra_characters_on_line + jmp error_with_source +section_not_aligned_enough: + push _section_not_aligned_enough + jmp error_with_source +setting_already_specified: + push _setting_already_specified + jmp error_with_source +data_already_defined: + push _data_already_defined + jmp error_with_source +too_many_repeats: + push _too_many_repeats + jmp error_with_source +assertion_failed: + push _assertion_failed + jmp error_with_source +invoked_error: + push _invoked_error + error_with_source: + cmp [symbols_file],0 + je assembler_error + call dump_preprocessed_source + call restore_preprocessed_source + jmp assembler_error diff --git a/fasmw172/SOURCE/EXPRCALC.INC b/fasmw172/SOURCE/EXPRCALC.INC new file mode 100644 index 0000000..b5418e8 --- /dev/null +++ b/fasmw172/SOURCE/EXPRCALC.INC @@ -0,0 +1,2227 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +calculate_expression: + mov [current_offset],edi + mov [value_undefined],0 + cmp byte [esi],0 + je get_string_value + cmp byte [esi],'.' + je convert_fp + calculation_loop: + mov eax,[tagged_blocks] + sub eax,0Ch + cmp eax,edi + jbe out_of_memory + lods byte [esi] + cmp al,1 + je get_byte_number + cmp al,2 + je get_word_number + cmp al,4 + je get_dword_number + cmp al,8 + je get_qword_number + cmp al,0Fh + je value_out_of_range + cmp al,10h + je get_register + cmp al,11h + je get_label + cmp al,')' + je expression_calculated + cmp al,']' + je expression_calculated + cmp al,'!' + je invalid_expression + sub edi,14h + mov ebx,edi + sub ebx,14h + cmp al,0F0h + je calculate_rva + cmp al,0F1h + je calculate_plt + cmp al,0D0h + je calculate_not + cmp al,0E0h + je calculate_bsf + cmp al,0E1h + je calculate_bsr + cmp al,083h + je calculate_neg + mov dx,[ebx+8] + or dx,[edi+8] + cmp al,80h + je calculate_add + cmp al,81h + je calculate_sub + mov ah,[ebx+12] + or ah,[edi+12] + jz absolute_values_calculation + call recoverable_misuse + absolute_values_calculation: + cmp al,90h + je calculate_mul + cmp al,91h + je calculate_div + or dx,dx + jnz invalid_expression + cmp al,0A0h + je calculate_mod + cmp al,0B0h + je calculate_and + cmp al,0B1h + je calculate_or + cmp al,0B2h + je calculate_xor + cmp al,0C0h + je calculate_shl + cmp al,0C1h + je calculate_shr + jmp invalid_expression + expression_calculated: + sub edi,14h + cmp [value_undefined],0 + je expression_value_ok + xor eax,eax + mov [edi],eax + mov [edi+4],eax + mov [edi+12],eax + expression_value_ok: + ret + get_byte_number: + xor eax,eax + lods byte [esi] + stos dword [edi] + xor al,al + stos dword [edi] + got_number: + and word [edi-8+8],0 + and word [edi-8+12],0 + and dword [edi-8+16],0 + add edi,0Ch + jmp calculation_loop + get_word_number: + xor eax,eax + lods word [esi] + stos dword [edi] + xor ax,ax + stos dword [edi] + jmp got_number + get_dword_number: + movs dword [edi],[esi] + xor eax,eax + stos dword [edi] + jmp got_number + get_qword_number: + movs dword [edi],[esi] + movs dword [edi],[esi] + jmp got_number + get_register: + mov byte [edi+9],0 + and word [edi+12],0 + lods byte [esi] + mov [edi+8],al + mov byte [edi+10],1 + xor eax,eax + mov [edi+16],eax + stos dword [edi] + stos dword [edi] + add edi,0Ch + jmp calculation_loop + get_label: + xor eax,eax + mov [edi+8],eax + mov [edi+12],eax + mov [edi+20],eax + lods dword [esi] + cmp eax,0Fh + jb predefined_label + je reserved_word_used_as_symbol + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + mov cl,[ebx+9] + shr cl,1 + and cl,1 + neg cl + or byte [ebx+8],8 + test byte [ebx+8],1 + jz label_undefined + cmp ax,[ebx+16] + je unadjusted_label + test byte [ebx+8],4 + jnz label_out_of_scope + test byte [ebx+9],1 + jz unadjusted_label + mov eax,[ebx] + sub eax,dword [adjustment] + stos dword [edi] + mov eax,[ebx+4] + sbb eax,dword [adjustment+4] + stos dword [edi] + sbb cl,[adjustment_sign] + mov [edi-8+13],cl + mov eax,dword [adjustment] + or al,[adjustment_sign] + or eax,dword [adjustment+4] + jz got_label + or [next_pass_needed],-1 + jmp got_label + unadjusted_label: + mov eax,[ebx] + stos dword [edi] + mov eax,[ebx+4] + stos dword [edi] + mov [edi-8+13],cl + got_label: + test byte [ebx+9],4 + jnz invalid_use_of_symbol + cmp [symbols_file],0 + je label_reference_ok + cmp [next_pass_needed],0 + jne label_reference_ok + call store_label_reference + label_reference_ok: + mov al,[ebx+11] + mov [edi-8+12],al + mov eax,[ebx+12] + mov [edi-8+8],eax + cmp al,ah + jne labeled_registers_ok + shr eax,16 + add al,ah + jo labeled_registers_ok + xor ah,ah + mov [edi-8+10],ax + mov [edi-8+9],ah + labeled_registers_ok: + mov eax,[ebx+20] + mov [edi-8+16],eax + add edi,0Ch + mov al,[ebx+10] + or al,al + jz calculation_loop + test [operand_flags],1 + jnz calculation_loop + check_size: + xchg [operand_size],al + or al,al + jz calculation_loop + cmp al,[operand_size] + jne operand_sizes_do_not_match + jmp calculation_loop + current_offset_label: + mov eax,[current_offset] + make_current_offset_label: + xor edx,edx + xor ch,ch + mov ebp,[addressing_space] + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb ch,[ds:ebp+8] + jp current_offset_label_ok + call recoverable_overflow + current_offset_label_ok: + stos dword [edi] + mov eax,edx + stos dword [edi] + mov eax,[ds:ebp+10h] + stos dword [edi] + mov cl,[ds:ebp+9] + mov [edi-12+12],cx + mov eax,[ds:ebp+14h] + mov [edi-12+16],eax + add edi,8 + jmp calculation_loop + org_origin_label: + mov eax,[addressing_space] + mov eax,[eax+18h] + jmp make_current_offset_label + counter_label: + mov eax,[counter] + make_dword_label_value: + stos dword [edi] + xor eax,eax + stos dword [edi] + add edi,0Ch + jmp calculation_loop + timestamp_label: + call make_timestamp + make_qword_label_value: + stos dword [edi] + mov eax,edx + stos dword [edi] + add edi,0Ch + jmp calculation_loop + predefined_label: + or eax,eax + jz current_offset_label + cmp eax,1 + je counter_label + cmp eax,2 + je timestamp_label + cmp eax,3 + je org_origin_label + mov edx,invalid_value + jmp error_undefined + label_out_of_scope: + mov edx,symbol_out_of_scope + jmp error_undefined + label_undefined: + mov edx,undefined_symbol + error_undefined: + cmp [current_pass],1 + ja undefined_value + force_next_pass: + or [next_pass_needed],-1 + undefined_value: + or [value_undefined],-1 + and word [edi+12],0 + xor eax,eax + stos dword [edi] + stos dword [edi] + add edi,0Ch + cmp [error_line],0 + jne calculation_loop + mov eax,[current_line] + mov [error_line],eax + mov [error],edx + mov [error_info],ebx + jmp calculation_loop + calculate_add: + xor ah,ah + mov ah,[ebx+12] + mov al,[edi+12] + or al,al + jz add_values + or ah,ah + jz add_relocatable + add ah,al + jnz invalid_add + mov ecx,[edi+16] + cmp ecx,[ebx+16] + je add_values + invalid_add: + call recoverable_misuse + jmp add_values + add_relocatable: + mov ah,al + mov ecx,[edi+16] + mov [ebx+16],ecx + add_values: + mov [ebx+12],ah + mov eax,[edi] + add [ebx],eax + mov eax,[edi+4] + adc [ebx+4],eax + mov al,[edi+13] + adc [ebx+13],al + jp add_sign_ok + call recoverable_overflow + add_sign_ok: + or dx,dx + jz calculation_loop + push esi + mov esi,ebx + mov cl,[edi+10] + mov al,[edi+8] + call add_register + mov cl,[edi+11] + mov al,[edi+9] + call add_register + pop esi + jmp calculation_loop + add_register: + or al,al + jz add_register_done + add_register_start: + cmp [esi+8],al + jne add_in_second_slot + add [esi+10],cl + jo value_out_of_range + jnz add_register_done + mov byte [esi+8],0 + ret + add_in_second_slot: + cmp [esi+9],al + jne create_in_first_slot + add [esi+11],cl + jo value_out_of_range + jnz add_register_done + mov byte [esi+9],0 + ret + create_in_first_slot: + cmp byte [esi+8],0 + jne create_in_second_slot + mov [esi+8],al + mov [esi+10],cl + ret + create_in_second_slot: + cmp byte [esi+9],0 + jne invalid_expression + mov [esi+9],al + mov [esi+11],cl + add_register_done: + ret + out_of_range: + jmp calculation_loop + calculate_sub: + xor ah,ah + mov ah,[ebx+12] + mov al,[edi+12] + or al,al + jz sub_values + or ah,ah + jz negate_relocatable + cmp al,ah + jne invalid_sub + xor ah,ah + mov ecx,[edi+16] + cmp ecx,[ebx+16] + je sub_values + invalid_sub: + call recoverable_misuse + jmp sub_values + negate_relocatable: + neg al + mov ah,al + mov ecx,[edi+16] + mov [ebx+16],ecx + sub_values: + mov [ebx+12],ah + mov eax,[edi] + sub [ebx],eax + mov eax,[edi+4] + sbb [ebx+4],eax + mov al,[edi+13] + sbb [ebx+13],al + jp sub_sign_ok + cmp [error_line],0 + jne sub_sign_ok + call recoverable_overflow + sub_sign_ok: + or dx,dx + jz calculation_loop + push esi + mov esi,ebx + mov cl,[edi+10] + mov al,[edi+8] + call sub_register + mov cl,[edi+11] + mov al,[edi+9] + call sub_register + pop esi + jmp calculation_loop + sub_register: + or al,al + jz add_register_done + neg cl + jo value_out_of_range + jmp add_register_start + calculate_mul: + or dx,dx + jz mul_start + cmp word [ebx+8],0 + jne mul_start + xor ecx,ecx + swap_values: + mov eax,[ebx+ecx] + xchg eax,[edi+ecx] + mov [ebx+ecx],eax + add ecx,4 + cmp ecx,16 + jb swap_values + mul_start: + push esi edx + mov esi,ebx + xor bl,bl + cmp byte [esi+13],0 + je mul_first_sign_ok + xor bl,-1 + mov eax,[esi] + mov edx,[esi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [esi],eax + mov [esi+4],edx + or eax,edx + jz mul_overflow + mul_first_sign_ok: + cmp byte [edi+13],0 + je mul_second_sign_ok + xor bl,-1 + cmp byte [esi+8],0 + je mul_first_register_sign_ok + neg byte [esi+10] + jo invalid_expression + mul_first_register_sign_ok: + cmp byte [esi+9],0 + je mul_second_register_sign_ok + neg byte [esi+11] + jo invalid_expression + mul_second_register_sign_ok: + mov eax,[edi] + mov edx,[edi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [edi],eax + mov [edi+4],edx + or eax,edx + jz mul_overflow + mul_second_sign_ok: + cmp dword [esi+4],0 + jz mul_numbers + cmp dword [edi+4],0 + jz mul_numbers + jnz mul_overflow + mul_numbers: + mov eax,[esi+4] + mul dword [edi] + or edx,edx + jnz mul_overflow + mov ecx,eax + mov eax,[esi] + mul dword [edi+4] + or edx,edx + jnz mul_overflow + add ecx,eax + jc mul_overflow + mov eax,[esi] + mul dword [edi] + add edx,ecx + jc mul_overflow + mov [esi],eax + mov [esi+4],edx + or bl,bl + jz mul_ok + not eax + not edx + add eax,1 + adc edx,0 + mov [esi],eax + mov [esi+4],edx + or eax,edx + jnz mul_ok + not bl + mul_ok: + mov [esi+13],bl + pop edx + or dx,dx + jz mul_calculated + cmp word [edi+8],0 + jne invalid_value + cmp byte [esi+8],0 + je mul_first_register_ok + call get_byte_scale + imul byte [esi+10] + mov dl,ah + cbw + cmp ah,dl + jne value_out_of_range + mov [esi+10],al + or al,al + jnz mul_first_register_ok + mov [esi+8],al + mul_first_register_ok: + cmp byte [esi+9],0 + je mul_calculated + call get_byte_scale + imul byte [esi+11] + mov dl,ah + cbw + cmp ah,dl + jne value_out_of_range + mov [esi+11],al + or al,al + jnz mul_calculated + mov [esi+9],al + mul_calculated: + pop esi + jmp calculation_loop + mul_overflow: + pop edx esi + call recoverable_overflow + jmp calculation_loop + get_byte_scale: + mov al,[edi] + cbw + cwde + cdq + cmp edx,[edi+4] + jne value_out_of_range + cmp eax,[edi] + jne value_out_of_range + ret + calculate_div: + push esi edx + mov esi,ebx + call div_64 + pop edx + or dx,dx + jz div_calculated + cmp byte [esi+8],0 + je div_first_register_ok + call get_byte_scale + or al,al + jz value_out_of_range + mov al,[esi+10] + cbw + idiv byte [edi] + or ah,ah + jnz invalid_use_of_symbol + mov [esi+10],al + div_first_register_ok: + cmp byte [esi+9],0 + je div_calculated + call get_byte_scale + or al,al + jz value_out_of_range + mov al,[esi+11] + cbw + idiv byte [edi] + or ah,ah + jnz invalid_use_of_symbol + mov [esi+11],al + div_calculated: + pop esi + jmp calculation_loop + calculate_mod: + push esi + mov esi,ebx + call div_64 + mov [esi],eax + mov [esi+4],edx + mov [esi+13],bh + pop esi + jmp calculation_loop + calculate_and: + mov eax,[edi] + mov edx,[edi+4] + mov cl,[edi+13] + and [ebx],eax + and [ebx+4],edx + and [ebx+13],cl + jmp calculation_loop + calculate_or: + mov eax,[edi] + mov edx,[edi+4] + mov cl,[edi+13] + or [ebx],eax + or [ebx+4],edx + or [ebx+13],cl + jmp calculation_loop + calculate_xor: + mov eax,[edi] + mov edx,[edi+4] + mov cl,[edi+13] + xor [ebx],eax + xor [ebx+4],edx + xor [ebx+13],cl + jmp calculation_loop + shr_negative: + mov byte [edi+13],0 + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + jc shl_over + calculate_shl: + cmp byte [edi+13],0 + jne shl_negative + mov edx,[ebx+4] + mov eax,[ebx] + cmp dword [edi+4],0 + jne shl_over + movsx ecx,byte [ebx+13] + xchg ecx,[edi] + cmp ecx,64 + je shl_max + ja shl_over + cmp ecx,32 + jae shl_high + shld [edi],edx,cl + shld edx,eax,cl + shl eax,cl + mov [ebx],eax + mov [ebx+4],edx + jmp shl_done + shl_over: + cmp byte [ebx+13],0 + jne shl_overflow + shl_max: + movsx ecx,byte [ebx+13] + cmp eax,ecx + jne shl_overflow + cmp edx,ecx + jne shl_overflow + xor eax,eax + mov [ebx],eax + mov [ebx+4],eax + jmp calculation_loop + shl_high: + sub cl,32 + shld [edi],edx,cl + shld edx,eax,cl + shl eax,cl + mov [ebx+4],eax + and dword [ebx],0 + cmp edx,[edi] + jne shl_overflow + shl_done: + movsx eax,byte [ebx+13] + cmp eax,[edi] + je calculation_loop + shl_overflow: + call recoverable_overflow + jmp calculation_loop + shl_negative: + mov byte [edi+13],0 + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + jnc calculate_shr + dec dword [edi+4] + calculate_shr: + cmp byte [edi+13],0 + jne shr_negative + mov edx,[ebx+4] + mov eax,[ebx] + cmp dword [edi+4],0 + jne shr_over + mov ecx,[edi] + cmp ecx,64 + jae shr_over + push esi + movsx esi,byte [ebx+13] + cmp ecx,32 + jae shr_high + shrd eax,edx,cl + shrd edx,esi,cl + mov [ebx],eax + mov [ebx+4],edx + pop esi + jmp calculation_loop + shr_high: + sub cl,32 + shrd edx,esi,cl + mov [ebx],edx + mov [ebx+4],esi + pop esi + jmp calculation_loop + shr_over: + movsx eax,byte [ebx+13] + mov dword [ebx],eax + mov dword [ebx+4],eax + jmp calculation_loop + calculate_not: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je not_ok + call recoverable_misuse + not_ok: + not dword [edi] + not dword [edi+4] + not byte [edi+13] + add edi,14h + jmp calculation_loop + calculate_bsf: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je bsf_ok + call recoverable_misuse + bsf_ok: + xor ecx,ecx + bsf eax,[edi] + jnz finish_bs + mov ecx,32 + bsf eax,[edi+4] + jnz finish_bs + cmp byte [edi+13],0 + jne finish_bs + bs_overflow: + call recoverable_overflow + add edi,14h + jmp calculation_loop + calculate_bsr: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je bsr_ok + call recoverable_misuse + bsr_ok: + cmp byte [edi+13],0 + jne bs_overflow + mov ecx,32 + bsr eax,[edi+4] + jnz finish_bs + xor ecx,ecx + bsr eax,[edi] + jz bs_overflow + finish_bs: + add eax,ecx + xor edx,edx + mov [edi],eax + mov [edi+4],edx + mov [edi+13],dl + add edi,14h + jmp calculation_loop + calculate_neg: + cmp byte [edi+8],0 + je neg_first_register_ok + neg byte [edi+10] + jo invalid_expression + neg_first_register_ok: + cmp byte [edi+9],0 + je neg_second_register_ok + neg byte [edi+11] + jo invalid_expression + neg_second_register_ok: + neg byte [edi+12] + xor eax,eax + xor edx,edx + xor cl,cl + xchg eax,[edi] + xchg edx,[edi+4] + xchg cl,[edi+13] + sub [edi],eax + sbb [edi+4],edx + sbb [edi+13],cl + jp neg_sign_ok + call recoverable_overflow + neg_sign_ok: + add edi,14h + jmp calculation_loop + calculate_rva: + cmp word [edi+8],0 + jne invalid_expression + mov al,[output_format] + cmp al,5 + je calculate_gotoff + cmp al,4 + je calculate_coff_rva + cmp al,3 + jne invalid_expression + test [format_flags],8 + jnz pe64_rva + mov al,2 + bt [resolver_flags],0 + jc rva_type_ok + xor al,al + rva_type_ok: + cmp byte [edi+12],al + je rva_ok + call recoverable_misuse + rva_ok: + mov byte [edi+12],0 + mov eax,[code_start] + mov eax,[eax+34h] + xor edx,edx + finish_rva: + sub [edi],eax + sbb [edi+4],edx + sbb byte [edi+13],0 + jp rva_finished + call recoverable_overflow + rva_finished: + add edi,14h + jmp calculation_loop + pe64_rva: + mov al,4 + bt [resolver_flags],0 + jc pe64_rva_type_ok + xor al,al + pe64_rva_type_ok: + cmp byte [edi+12],al + je pe64_rva_ok + call recoverable_misuse + pe64_rva_ok: + mov byte [edi+12],0 + mov eax,[code_start] + mov edx,[eax+34h] + mov eax,[eax+30h] + jmp finish_rva + calculate_gotoff: + test [format_flags],8+1 + jnz invalid_expression + calculate_coff_rva: + mov dl,5 + cmp byte [edi+12],2 + je change_value_type + incorrect_change_of_value_type: + call recoverable_misuse + change_value_type: + mov byte [edi+12],dl + add edi,14h + jmp calculation_loop + calculate_plt: + cmp word [edi+8],0 + jne invalid_expression + cmp [output_format],5 + jne invalid_expression + test [format_flags],1 + jnz invalid_expression + mov dl,6 + mov dh,2 + test [format_flags],8 + jz check_value_for_plt + mov dh,4 + check_value_for_plt: + mov eax,[edi] + or eax,[edi+4] + jnz incorrect_change_of_value_type + cmp byte [edi+12],dh + jne incorrect_change_of_value_type + mov eax,[edi+16] + cmp byte [eax],80h + jne incorrect_change_of_value_type + jmp change_value_type + div_64: + xor ebx,ebx + cmp dword [edi],0 + jne divider_ok + cmp dword [edi+4],0 + jne divider_ok + cmp [next_pass_needed],0 + je value_out_of_range + jmp div_done + divider_ok: + cmp byte [esi+13],0 + je div_first_sign_ok + mov eax,[esi] + mov edx,[esi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [esi],eax + mov [esi+4],edx + or eax,edx + jz value_out_of_range + xor bx,-1 + div_first_sign_ok: + cmp byte [edi+13],0 + je div_second_sign_ok + mov eax,[edi] + mov edx,[edi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [edi],eax + mov [edi+4],edx + or eax,edx + jz value_out_of_range + xor bl,-1 + div_second_sign_ok: + cmp dword [edi+4],0 + jne div_high + mov ecx,[edi] + mov eax,[esi+4] + xor edx,edx + div ecx + mov [esi+4],eax + mov eax,[esi] + div ecx + mov [esi],eax + mov eax,edx + xor edx,edx + jmp div_done + div_high: + push ebx + mov eax,[esi+4] + xor edx,edx + div dword [edi+4] + mov ebx,[esi] + mov [esi],eax + and dword [esi+4],0 + mov ecx,edx + mul dword [edi] + div_high_loop: + cmp ecx,edx + ja div_high_done + jb div_high_large_correction + cmp ebx,eax + jae div_high_done + div_high_correction: + dec dword [esi] + sub eax,[edi] + sbb edx,[edi+4] + jnc div_high_loop + div_high_done: + sub ebx,eax + sbb ecx,edx + mov edx,ecx + mov eax,ebx + pop ebx + jmp div_done + div_high_large_correction: + push eax edx + mov eax,edx + sub eax,ecx + xor edx,edx + div dword [edi+4] + shr eax,1 + jz div_high_small_correction + sub [esi],eax + push eax + mul dword [edi+4] + sub dword [esp+4],eax + pop eax + mul dword [edi] + sub dword [esp+4],eax + sbb dword [esp],edx + pop edx eax + jmp div_high_loop + div_high_small_correction: + pop edx eax + jmp div_high_correction + div_done: + or bh,bh + jz remainder_ok + not eax + not edx + add eax,1 + adc edx,0 + mov ecx,eax + or ecx,edx + jnz remainder_ok + not bh + remainder_ok: + or bl,bl + jz div_ok + not dword [esi] + not dword [esi+4] + add dword [esi],1 + adc dword [esi+4],0 + mov ecx,[esi] + or ecx,[esi+4] + jnz div_ok + not bl + div_ok: + mov [esi+13],bl + ret + store_label_reference: + mov eax,[tagged_blocks] + mov dword [eax-4],2 + mov dword [eax-8],4 + sub eax,8+4 + cmp eax,edi + jbe out_of_memory + mov [tagged_blocks],eax + mov [eax],ebx + ret + convert_fp: + inc esi + and word [edi+8],0 + and word [edi+12],0 + mov al,[value_size] + cmp al,2 + je convert_fp_word + cmp al,4 + je convert_fp_dword + test al,not 8 + jz convert_fp_qword + call recoverable_misuse + convert_fp_qword: + xor eax,eax + xor edx,edx + cmp word [esi+8],8000h + je fp_qword_store + mov bx,[esi+8] + mov eax,[esi] + mov edx,[esi+4] + add eax,eax + adc edx,edx + mov ecx,edx + shr edx,12 + shrd eax,ecx,12 + jnc fp_qword_ok + add eax,1 + adc edx,0 + bt edx,20 + jnc fp_qword_ok + and edx,1 shl 20 - 1 + inc bx + shr edx,1 + rcr eax,1 + fp_qword_ok: + add bx,3FFh + cmp bx,7FFh + jge value_out_of_range + cmp bx,0 + jg fp_qword_exp_ok + or edx,1 shl 20 + mov cx,bx + neg cx + inc cx + cmp cx,52+1 + ja value_out_of_range + cmp cx,32 + jb fp_qword_small_shift + sub cx,32 + mov eax,edx + xor edx,edx + shr eax,cl + jmp fp_qword_shift_done + fp_qword_small_shift: + mov ebx,edx + shr edx,cl + shrd eax,ebx,cl + fp_qword_shift_done: + mov bx,0 + jnc fp_qword_exp_ok + add eax,1 + adc edx,0 + test edx,1 shl 20 + jz fp_qword_exp_ok + and edx,1 shl 20 - 1 + inc bx + fp_qword_exp_ok: + shl ebx,20 + or edx,ebx + jnz fp_qword_store + or eax,eax + jz value_out_of_range + fp_qword_store: + mov bl,[esi+11] + shl ebx,31 + or edx,ebx + mov [edi],eax + mov [edi+4],edx + add esi,13 + ret + convert_fp_word: + xor eax,eax + cmp word [esi+8],8000h + je fp_word_store + mov bx,[esi+8] + mov ax,[esi+6] + shl ax,1 + shr ax,6 + jnc fp_word_ok + inc ax + bt ax,10 + jnc fp_word_ok + and ax,1 shl 10 - 1 + inc bx + shr ax,1 + fp_word_ok: + add bx,0Fh + cmp bx,01Fh + jge value_out_of_range + cmp bx,0 + jg fp_word_exp_ok + or ax,1 shl 10 + mov cx,bx + neg cx + inc cx + cmp cx,10+1 + ja value_out_of_range + xor bx,bx + shr ax,cl + jnc fp_word_exp_ok + inc ax + test ax,1 shl 10 + jz fp_word_exp_ok + and ax,1 shl 10 - 1 + inc bx + fp_word_exp_ok: + shl bx,10 + or ax,bx + jz value_out_of_range + fp_word_store: + mov bl,[esi+11] + shl bx,15 + or ax,bx + mov [edi],eax + xor eax,eax + mov [edi+4],eax + add esi,13 + ret + convert_fp_dword: + xor eax,eax + cmp word [esi+8],8000h + je fp_dword_store + mov bx,[esi+8] + mov eax,[esi+4] + shl eax,1 + shr eax,9 + jnc fp_dword_ok + inc eax + bt eax,23 + jnc fp_dword_ok + and eax,1 shl 23 - 1 + inc bx + shr eax,1 + fp_dword_ok: + add bx,7Fh + cmp bx,0FFh + jge value_out_of_range + cmp bx,0 + jg fp_dword_exp_ok + or eax,1 shl 23 + mov cx,bx + neg cx + inc cx + cmp cx,23+1 + ja value_out_of_range + xor bx,bx + shr eax,cl + jnc fp_dword_exp_ok + inc eax + test eax,1 shl 23 + jz fp_dword_exp_ok + and eax,1 shl 23 - 1 + inc bx + fp_dword_exp_ok: + shl ebx,23 + or eax,ebx + jz value_out_of_range + fp_dword_store: + mov bl,[esi+11] + shl ebx,31 + or eax,ebx + mov [edi],eax + xor eax,eax + mov [edi+4],eax + add esi,13 + ret + get_string_value: + inc esi + lods dword [esi] + mov ecx,eax + cmp ecx,8 + ja value_out_of_range + mov edx,edi + xor eax,eax + stos dword [edi] + stos dword [edi] + mov edi,edx + rep movs byte [edi],[esi] + mov edi,edx + inc esi + and word [edi+8],0 + and word [edi+12],0 + ret + +get_byte_value: + mov [value_size],1 + or [operand_flags],1 + call calculate_value + or al,al + jz check_byte_value + call recoverable_misuse + check_byte_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je byte_positive + cmp edx,-1 + jne range_exceeded + cmp eax,-100h + jb range_exceeded + ret + byte_positive: + test edx,edx + jnz range_exceeded + cmp eax,100h + jae range_exceeded + return_byte_value: + ret + range_exceeded: + xor eax,eax + xor edx,edx + recoverable_overflow: + cmp [error_line],0 + jne ignore_overflow + push [current_line] + pop [error_line] + mov [error],value_out_of_range + or [value_undefined],-1 + ignore_overflow: + ret + recoverable_misuse: + cmp [error_line],0 + jne ignore_misuse + push [current_line] + pop [error_line] + mov [error],invalid_use_of_symbol + ignore_misuse: + ret +get_word_value: + mov [value_size],2 + or [operand_flags],1 + call calculate_value + cmp al,2 + jb check_word_value + call recoverable_misuse + check_word_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je word_positive + cmp edx,-1 + jne range_exceeded + cmp eax,-10000h + jb range_exceeded + ret + word_positive: + test edx,edx + jnz range_exceeded + cmp eax,10000h + jae range_exceeded + ret +get_dword_value: + mov [value_size],4 + or [operand_flags],1 + call calculate_value + cmp al,4 + jne check_dword_value + mov [value_type],2 + mov eax,[edi] + cdq + cmp edx,[edi+4] + jne range_exceeded + mov ecx,edx + shr ecx,31 + cmp cl,[value_sign] + jne range_exceeded + ret + check_dword_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je dword_positive + cmp edx,-1 + jne range_exceeded + ret + dword_positive: + test edx,edx + jne range_exceeded + ret +get_pword_value: + mov [value_size],6 + or [operand_flags],1 + call calculate_value + cmp al,4 + jne check_pword_value + call recoverable_misuse + check_pword_value: + mov eax,[edi] + mov edx,[edi+4] + cmp byte [edi+13],0 + je pword_positive + cmp edx,-10000h + jb range_exceeded + ret + pword_positive: + cmp edx,10000h + jae range_exceeded + ret +get_qword_value: + mov [value_size],8 + or [operand_flags],1 + call calculate_value + check_qword_value: + mov eax,[edi] + mov edx,[edi+4] + ret +get_count_value: + mov [value_size],8 + or [operand_flags],1 + call calculate_expression + cmp word [edi+8],0 + jne invalid_value + mov [value_sign],0 + mov al,[edi+12] + or al,al + jz check_count_value + call recoverable_misuse + check_count_value: + cmp byte [edi+13],0 + jne invalid_count_value + mov eax,[edi] + mov edx,[edi+4] + or edx,edx + jnz invalid_count_value + ret + invalid_count_value: + cmp [error_line],0 + jne zero_count + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + zero_count: + xor eax,eax + ret +get_value: + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_value + mov al,[operand_size] + cmp al,1 + je value_byte + cmp al,2 + je value_word + cmp al,4 + je value_dword + cmp al,6 + je value_pword + cmp al,8 + je value_qword + or al,al + jnz invalid_value + mov [value_size],al + call calculate_value + mov eax,[edi] + mov edx,[edi+4] + ret + calculate_value: + call calculate_expression + cmp word [edi+8],0 + jne invalid_value + mov eax,[edi+16] + mov [symbol_identifier],eax + mov al,[edi+13] + mov [value_sign],al + mov al,[edi+12] + mov [value_type],al + ret + value_qword: + call get_qword_value + truncated_value: + mov [value_sign],0 + ret + value_pword: + call get_pword_value + movzx edx,dx + jmp truncated_value + value_dword: + call get_dword_value + xor edx,edx + jmp truncated_value + value_word: + call get_word_value + xor edx,edx + movzx eax,ax + jmp truncated_value + value_byte: + call get_byte_value + xor edx,edx + movzx eax,al + jmp truncated_value +get_address_word_value: + mov [address_size],2 + mov [value_size],2 + mov [free_address_range],0 + jmp calculate_address +get_address_dword_value: + mov [address_size],4 + mov [value_size],4 + mov [free_address_range],0 + jmp calculate_address +get_address_qword_value: + mov [address_size],8 + mov [value_size],8 + mov [free_address_range],0 + jmp calculate_address +get_address_value: + mov [address_size],0 + mov [value_size],8 + or [free_address_range],-1 + calculate_address: + cmp byte [esi],'.' + je invalid_address + call calculate_expression + mov eax,[edi+16] + mov [address_symbol],eax + mov al,[edi+13] + mov [address_sign],al + mov al,[edi+12] + mov [value_type],al + cmp al,0 + je address_size_ok + jg get_address_symbol_size + neg al + get_address_symbol_size: + cmp al,6 + je special_address_type_32bit + cmp al,5 + je special_address_type_32bit + ja invalid_address_type + test al,1 + jnz invalid_address_type + shl al,5 + jmp address_symbol_ok + invalid_address_type: + call recoverable_misuse + special_address_type_32bit: + mov al,40h + address_symbol_ok: + mov ah,[address_size] + or [address_size],al + shr al,4 + or ah,ah + jz address_size_ok + cmp al,ah + je address_size_ok + cmp ax,0408h + je address_sizes_mixed + cmp ax,0804h + jne address_sizes_do_not_agree + address_sizes_mixed: + cmp [value_type],4 + jne address_sizes_mixed_type_ok + mov [value_type],2 + address_sizes_mixed_type_ok: + mov eax,[edi] + cdq + cmp edx,[edi+4] + je address_size_ok + cmp [error_line],0 + jne address_size_ok + call recoverable_overflow + address_size_ok: + xor ebx,ebx + xor ecx,ecx + mov cl,[value_type] + shl ecx,16 + mov ch,[address_size] + cmp word [edi+8],0 + je check_immediate_address + mov al,[edi+8] + mov dl,[edi+10] + call get_address_register + mov al,[edi+9] + mov dl,[edi+11] + call get_address_register + mov ax,bx + shr ah,4 + shr al,4 + or bh,bh + jz check_address_registers + or bl,bl + jz check_address_registers + cmp al,ah + jne check_vsib + check_address_registers: + or al,ah + cmp al,0Ch + jae check_vsib + cmp al,6 + je check_vsib + cmp al,7 + je check_vsib + mov ah,[address_size] + and ah,0Fh + jz address_registers_sizes_ok + cmp al,ah + jne invalid_address + address_registers_sizes_ok: + cmp al,4 + je sib_allowed + cmp al,8 + je sib_allowed + cmp al,9 + je check_ip_relative_address + cmp cl,1 + ja invalid_address + cmp [free_address_range],0 + jne check_qword_value + jmp check_word_value + address_sizes_do_not_match: + cmp al,0Fh + jne invalid_address + mov al,bh + and al,0Fh + cmp al,ah + jne invalid_address + check_ip_relative_address: + or bl,bl + jnz invalid_address + cmp bh,98h + je check_rip_relative_address + cmp bh,94h + jne invalid_address + cmp [free_address_range],0 + je check_dword_value + mov eax,[edi] + mov edx,[edi+4] + ret + check_rip_relative_address: + mov eax,[edi] + cdq + cmp edx,[edi+4] + jne range_exceeded + cmp dl,[edi+13] + jne range_exceeded + ret + get_address_register: + or al,al + jz address_register_ok + cmp dl,1 + jne scaled_register + or bh,bh + jnz scaled_register + mov bh,al + address_register_ok: + ret + scaled_register: + or bl,bl + jnz invalid_address + mov bl,al + mov cl,dl + jmp address_register_ok + sib_allowed: + or bh,bh + jnz check_index_with_base + cmp cl,3 + je special_index_scale + cmp cl,5 + je special_index_scale + cmp cl,9 + je special_index_scale + cmp cl,2 + jne check_index_scale + cmp bl,45h + jne special_index_scale + cmp [code_type],64 + je special_index_scale + cmp [segment_register],4 + jne special_index_scale + cmp [value_type],0 + jne check_index_scale + mov al,[edi] + cbw + cwde + cmp eax,[edi] + jne check_index_scale + cdq + cmp edx,[edi+4] + jne check_immediate_address + special_index_scale: + mov bh,bl + dec cl + check_immediate_address: + cmp [free_address_range],0 + jne check_qword_value + mov al,[address_size] + and al,0Fh + cmp al,2 + je check_word_value + cmp al,4 + je check_dword_value + cmp al,8 + je check_qword_value + or al,al + jnz invalid_value + cmp [code_type],64 + jne check_dword_value + jmp check_qword_value + check_index_with_base: + cmp cl,1 + jne check_index_scale + cmp bl,44h + je swap_base_with_index + cmp bl,84h + je swap_base_with_index + cmp [code_type],64 + je check_for_rbp_base + cmp bl,45h + jne check_for_ebp_base + cmp [segment_register],3 + je swap_base_with_index + jmp check_immediate_address + check_for_ebp_base: + cmp bh,45h + jne check_immediate_address + cmp [segment_register],4 + jne check_immediate_address + swap_base_with_index: + xchg bl,bh + jmp check_immediate_address + check_for_rbp_base: + cmp bh,45h + je swap_base_with_index + cmp bh,85h + je swap_base_with_index + jmp check_immediate_address + check_index_scale: + test cl,not 1111b + jnz invalid_address + mov al,cl + dec al + and al,cl + jz check_immediate_address + jmp invalid_address + check_vsib: + xor ah,ah + check_vsib_base: + test bh,bh + jz check_vsib_index + mov al,bh + shr al,4 + cmp al,4 + je check_vsib_base_size + cmp [code_type],64 + jne swap_vsib_registers + cmp al,8 + jne swap_vsib_registers + check_vsib_base_size: + mov ah,[address_size] + and ah,0Fh + jz check_vsib_index + cmp al,ah + jne invalid_address + check_vsib_index: + mov al,bl + and al,0E0h + cmp al,0C0h + jae check_index_scale + cmp al,60h + je check_index_scale + jmp invalid_address + swap_vsib_registers: + xor ah,-1 + jz invalid_address + cmp cl,1 + ja invalid_address + xchg bl,bh + mov cl,1 + jmp check_vsib_base + +calculate_relative_offset: + cmp [value_undefined],0 + jne relative_offset_ok + test bh,bh + setne ch + cmp bx,[ds:ebp+10h] + je origin_registers_ok + xchg bh,bl + xchg ch,cl + cmp bx,[ds:ebp+10h] + jne invalid_value + origin_registers_ok: + cmp cx,[ds:ebp+10h+2] + jne invalid_value + mov bl,[address_sign] + add eax,[ds:ebp] + adc edx,[ds:ebp+4] + adc bl,[ds:ebp+8] + sub eax,edi + sbb edx,0 + sbb bl,0 + mov [value_sign],bl + mov bl,[value_type] + mov ecx,[address_symbol] + mov [symbol_identifier],ecx + test bl,1 + jnz relative_offset_unallowed + cmp bl,6 + je plt_relative_offset + mov bh,[ds:ebp+9] + cmp bl,bh + je set_relative_offset_type + cmp bx,0402h + je set_relative_offset_type + relative_offset_unallowed: + call recoverable_misuse + set_relative_offset_type: + cmp [value_type],0 + je relative_offset_ok + mov [value_type],0 + cmp ecx,[ds:ebp+14h] + je relative_offset_ok + mov [value_type],3 + relative_offset_ok: + ret + plt_relative_offset: + mov [value_type],7 + cmp byte [ds:ebp+9],2 + je relative_offset_ok + cmp byte [ds:ebp+9],4 + jne recoverable_misuse + ret + +calculate_logical_expression: + xor al,al + calculate_embedded_logical_expression: + mov [logical_value_wrapping],al + call get_logical_value + logical_loop: + cmp byte [esi],'|' + je logical_or + cmp byte [esi],'&' + je logical_and + ret + logical_or: + inc esi + or al,al + jnz logical_value_already_determined + push eax + call get_logical_value + pop ebx + or al,bl + jmp logical_loop + logical_and: + inc esi + or al,al + jz logical_value_already_determined + push eax + call get_logical_value + pop ebx + and al,bl + jmp logical_loop + logical_value_already_determined: + push eax + call skip_logical_value + jc invalid_expression + pop eax + jmp logical_loop + get_value_for_comparison: + mov [value_size],8 + or [operand_flags],1 + lods byte [esi] + call calculate_expression + cmp byte [edi+8],0 + jne first_register_size_ok + mov byte [edi+10],0 + first_register_size_ok: + cmp byte [edi+9],0 + jne second_register_size_ok + mov byte [edi+11],0 + second_register_size_ok: + mov eax,[edi+16] + mov [symbol_identifier],eax + mov al,[edi+13] + mov [value_sign],al + mov bl,[edi+12] + mov eax,[edi] + mov edx,[edi+4] + mov ecx,[edi+8] + ret + get_logical_value: + xor al,al + check_for_negation: + cmp byte [esi],'~' + jne negation_ok + inc esi + xor al,-1 + jmp check_for_negation + negation_ok: + push eax + mov al,[esi] + cmp al,91h + je logical_expression + cmp al,0FFh + je invalid_expression + cmp al,88h + je check_for_defined + cmp al,89h + je check_for_used + cmp al,'0' + je given_false + cmp al,'1' + je given_true + cmp al,'(' + jne invalid_value + call get_value_for_comparison + mov bh,[value_sign] + push eax edx [symbol_identifier] ebx ecx + mov al,[esi] + or al,al + jz logical_number + cmp al,0Fh + je logical_number + cmp al,92h + je logical_number + cmp al,'&' + je logical_number + cmp al,'|' + je logical_number + inc esi + mov [compare_type],al + cmp byte [esi],'(' + jne invalid_value + call get_value_for_comparison + cmp bl,[esp+4] + jne values_not_relative + or bl,bl + jz check_values_registers + mov ebx,[symbol_identifier] + cmp ebx,[esp+8] + jne values_not_relative + check_values_registers: + cmp ecx,[esp] + je values_relative + ror ecx,16 + xchg ch,cl + ror ecx,16 + xchg ch,cl + cmp ecx,[esp] + je values_relative + values_not_relative: + cmp [compare_type],0F8h + jne invalid_comparison + add esp,12+8 + jmp return_false + invalid_comparison: + call recoverable_misuse + values_relative: + pop ebx + shl ebx,16 + mov bx,[esp] + add esp,8 + pop ecx ebp + cmp [compare_type],'=' + je check_equal + cmp [compare_type],0F1h + je check_not_equal + cmp [compare_type],0F8h + je return_true + test ebx,0FFFF0000h + jz check_less_or_greater + call recoverable_misuse + check_less_or_greater: + cmp [compare_type],'>' + je check_greater + cmp [compare_type],'<' + je check_less + cmp [compare_type],0F2h + je check_not_less + cmp [compare_type],0F3h + je check_not_greater + jmp invalid_expression + check_equal: + cmp bh,[value_sign] + jne return_false + cmp eax,ebp + jne return_false + cmp edx,ecx + jne return_false + jmp return_true + check_greater: + cmp bh,[value_sign] + jg return_true + jl return_false + cmp edx,ecx + jb return_true + ja return_false + cmp eax,ebp + jb return_true + jae return_false + check_less: + cmp bh,[value_sign] + jg return_false + jl return_true + cmp edx,ecx + jb return_false + ja return_true + cmp eax,ebp + jbe return_false + ja return_true + check_not_less: + cmp bh,[value_sign] + jg return_true + jl return_false + cmp edx,ecx + jb return_true + ja return_false + cmp eax,ebp + jbe return_true + ja return_false + check_not_greater: + cmp bh,[value_sign] + jg return_false + jl return_true + cmp edx,ecx + jb return_false + ja return_true + cmp eax,ebp + jb return_false + jae return_true + check_not_equal: + cmp bh,[value_sign] + jne return_true + cmp eax,ebp + jne return_true + cmp edx,ecx + jne return_true + jmp return_false + logical_number: + pop ecx ebx eax edx eax + or bl,bl + jnz invalid_logical_number + or cx,cx + jz logical_number_ok + invalid_logical_number: + call recoverable_misuse + logical_number_ok: + test bh,bh + jnz return_true + or eax,edx + jnz return_true + jmp return_false + check_for_defined: + or bl,-1 + lods word [esi] + cmp ah,'(' + jne invalid_expression + check_expression: + lods byte [esi] + or al,al + jz defined_string + cmp al,'.' + je defined_fp_value + cmp al,')' + je expression_checked + cmp al,'!' + je invalid_expression + cmp al,0Fh + je check_expression + cmp al,10h + je defined_register + cmp al,11h + je check_if_symbol_defined + cmp al,80h + jae check_expression + movzx eax,al + add esi,eax + jmp check_expression + defined_register: + inc esi + jmp check_expression + defined_fp_value: + add esi,12+1 + jmp expression_checked + defined_string: + lods dword [esi] + add esi,eax + inc esi + jmp expression_checked + check_if_symbol_defined: + lods dword [esi] + cmp eax,-1 + je invalid_expression + cmp eax,0Fh + jb check_expression + je reserved_word_used_as_symbol + test byte [eax+8],4 + jnz no_prediction + test byte [eax+8],1 + jz symbol_predicted_undefined + mov cx,[current_pass] + sub cx,[eax+16] + jz check_expression + cmp cx,1 + ja symbol_predicted_undefined + or byte [eax+8],40h+80h + jmp check_expression + no_prediction: + test byte [eax+8],1 + jz symbol_undefined + mov cx,[current_pass] + sub cx,[eax+16] + jz check_expression + jmp symbol_undefined + symbol_predicted_undefined: + or byte [eax+8],40h + and byte [eax+8],not 80h + symbol_undefined: + xor bl,bl + jmp check_expression + expression_checked: + mov al,bl + jmp logical_value_ok + check_for_used: + lods word [esi] + cmp ah,2 + jne invalid_expression + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + test byte [eax+8],8 + jz not_used + mov cx,[current_pass] + sub cx,[eax+18] + jz return_true + cmp cx,1 + ja not_used + or byte [eax+8],10h+20h + jmp return_true + not_used: + or byte [eax+8],10h + and byte [eax+8],not 20h + jmp return_false + given_false: + inc esi + return_false: + xor al,al + jmp logical_value_ok + given_true: + inc esi + return_true: + or al,-1 + jmp logical_value_ok + logical_expression: + lods byte [esi] + mov dl,[logical_value_wrapping] + push edx + call calculate_embedded_logical_expression + pop edx + mov [logical_value_wrapping],dl + push eax + lods byte [esi] + cmp al,92h + jne invalid_expression + pop eax + logical_value_ok: + pop ebx + xor al,bl + ret + +skip_symbol: + lods byte [esi] + or al,al + jz nothing_to_skip + cmp al,0Fh + je nothing_to_skip + cmp al,1 + je skip_instruction + cmp al,2 + je skip_label + cmp al,3 + je skip_label + cmp al,4 + je skip_special_label + cmp al,20h + jb skip_assembler_symbol + cmp al,'(' + je skip_expression + cmp al,'[' + je skip_address + skip_done: + clc + ret + skip_label: + add esi,2 + skip_instruction: + add esi,2 + skip_assembler_symbol: + inc esi + jmp skip_done + skip_special_label: + add esi,4 + jmp skip_done + skip_address: + mov al,[esi] + and al,11110000b + cmp al,60h + jb skip_expression + cmp al,70h + ja skip_expression + inc esi + jmp skip_address + skip_expression: + lods byte [esi] + or al,al + jz skip_string + cmp al,'.' + je skip_fp_value + cmp al,')' + je skip_done + cmp al,']' + je skip_done + cmp al,'!' + je skip_expression + cmp al,0Fh + je skip_expression + cmp al,10h + je skip_register + cmp al,11h + je skip_label_value + cmp al,80h + jae skip_expression + movzx eax,al + add esi,eax + jmp skip_expression + skip_label_value: + add esi,3 + skip_register: + inc esi + jmp skip_expression + skip_fp_value: + add esi,12 + jmp skip_done + skip_string: + lods dword [esi] + add esi,eax + inc esi + jmp skip_done + nothing_to_skip: + dec esi + stc + ret + +expand_path: + lods byte [esi] + cmp al,'%' + je environment_variable + stos byte [edi] + or al,al + jnz expand_path + cmp edi,[memory_end] + ja out_of_memory + ret + environment_variable: + mov ebx,esi + find_variable_end: + lods byte [esi] + or al,al + jz not_environment_variable + cmp al,'%' + jne find_variable_end + mov byte [esi-1],0 + push esi + mov esi,ebx + call get_environment_variable + pop esi + mov byte [esi-1],'%' + jmp expand_path + not_environment_variable: + mov al,'%' + stos byte [edi] + mov esi,ebx + jmp expand_path +get_include_directory: + lods byte [esi] + cmp al,';' + je include_directory_ok + stos byte [edi] + or al,al + jnz get_include_directory + dec esi + dec edi + include_directory_ok: + cmp byte [edi-1],'/' + je path_separator_ok + cmp byte [edi-1],'\' + je path_separator_ok + mov al,'/' + stos byte [edi] + path_separator_ok: + ret diff --git a/fasmw172/SOURCE/EXPRPARS.INC b/fasmw172/SOURCE/EXPRPARS.INC new file mode 100644 index 0000000..6d65ab9 --- /dev/null +++ b/fasmw172/SOURCE/EXPRPARS.INC @@ -0,0 +1,1280 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +convert_expression: + push ebp + call get_fp_value + jnc fp_expression + mov [current_offset],esp + expression_loop: + push edi + mov edi,single_operand_operators + call get_operator + pop edi + or al,al + jz expression_element + cmp al,82h + je expression_loop + push eax + jmp expression_loop + expression_element: + mov al,[esi] + cmp al,1Ah + je expression_number + cmp al,22h + je expression_number + cmp al,'(' + je expression_number + mov al,'!' + stos byte [edi] + jmp expression_operator + expression_number: + call convert_number + expression_operator: + push edi + mov edi,operators + call get_operator + pop edi + or al,al + jz expression_end + operators_loop: + cmp esp,[current_offset] + je push_operator + mov bl,al + and bl,0F0h + mov bh,byte [esp] + and bh,0F0h + cmp bl,bh + ja push_operator + pop ebx + mov byte [edi],bl + inc edi + jmp operators_loop + push_operator: + push eax + jmp expression_loop + expression_end: + cmp esp,[current_offset] + je expression_converted + pop eax + stos byte [edi] + jmp expression_end + expression_converted: + pop ebp + ret + fp_expression: + mov al,'.' + stos byte [edi] + mov eax,[fp_value] + stos dword [edi] + mov eax,[fp_value+4] + stos dword [edi] + mov eax,[fp_value+8] + stos dword [edi] + pop ebp + ret + +convert_number: + lea eax,[edi+20h] + mov edx,[memory_end] + cmp [source_start],0 + je check_memory_for_number + mov edx,[labels_list] + check_memory_for_number: + cmp eax,edx + jae out_of_memory + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + cmp byte [esi],'(' + je expression_value + inc edi + call get_number + jc symbol_value + or ebp,ebp + jz valid_number + mov byte [edi-1],0Fh + ret + valid_number: + cmp dword [edi+4],0 + jne qword_number + cmp word [edi+2],0 + jne dword_number + cmp byte [edi+1],0 + jne word_number + byte_number: + mov byte [edi-1],1 + inc edi + ret + qword_number: + mov byte [edi-1],8 + add edi,8 + ret + dword_number: + mov byte [edi-1],4 + scas dword [edi] + ret + word_number: + mov byte [edi-1],2 + scas word [edi] + ret + expression_value: + inc esi + push [current_offset] + call convert_expression + pop [current_offset] + lods byte [esi] + cmp al,')' + je subexpression_closed + dec esi + mov al,'!' + stosb + subexpression_closed: + ret + symbol_value: + cmp [source_start],0 + je preprocessor_value + push edi esi + lods word [esi] + cmp al,1Ah + jne no_address_register + movzx ecx,ah + call get_symbol + jc no_address_register + cmp al,10h + jne no_address_register + mov al,ah + shr ah,4 + cmp ah,4 + je register_value + and ah,not 1 + cmp ah,8 + je register_value + cmp ah,0Ch + jae register_value + cmp ah,6 + je register_value + cmp al,23h + je register_value + cmp al,25h + je register_value + cmp al,26h + je register_value + cmp al,27h + je register_value + no_address_register: + pop esi + mov edi,directive_operators + call get_operator + pop edi + or al,al + jnz broken_value + lods byte [esi] + cmp al,1Ah + jne invalid_value + lods byte [esi] + movzx ecx,al + call get_label_id + store_label_value: + mov byte [edi-1],11h + stos dword [edi] + ret + broken_value: + mov eax,0Fh + jmp store_label_value + register_value: + pop edx edi + mov byte [edi-1],10h + stos byte [edi] + ret + preprocessor_value: + dec edi + cmp [hash_tree],0 + je invalid_value + lods byte [esi] + cmp al,1Ah + jne invalid_value + lods byte [esi] + mov cl,al + mov ch,10b + call get_preprocessor_symbol + jc invalid_value + push esi + mov esi,[edx+8] + push [current_offset] + call convert_expression + pop [current_offset] + pop esi + ret + +get_number: + xor ebp,ebp + lods byte [esi] + cmp al,22h + je get_text_number + cmp al,1Ah + jne not_number + lods byte [esi] + movzx ecx,al + mov [number_start],esi + mov al,[esi] + cmp al,'$' + je number_begin + sub al,30h + cmp al,9 + ja invalid_number + number_begin: + mov ebx,esi + add esi,ecx + push esi + dec esi + mov dword [edi],0 + mov dword [edi+4],0 + cmp byte [ebx],'$' + je pascal_hex_number + cmp word [ebx],'0x' + je get_hex_number + mov al,[esi] + dec esi + cmp al,'h' + je get_hex_number + cmp al,'b' + je get_bin_number + cmp al,'d' + je get_dec_number + cmp al,'o' + je get_oct_number + cmp al,'q' + je get_oct_number + cmp al,'H' + je get_hex_number + cmp al,'B' + je get_bin_number + cmp al,'D' + je get_dec_number + cmp al,'O' + je get_oct_number + cmp al,'Q' + je get_oct_number + inc esi + get_dec_number: + mov ebx,esi + mov esi,[number_start] + get_dec_digit: + cmp esi,ebx + ja number_ok + cmp byte [esi],27h + je next_dec_digit + cmp byte [esi],'_' + je next_dec_digit + xor edx,edx + mov eax,[edi] + shld edx,eax,2 + shl eax,2 + add eax,[edi] + adc edx,0 + add eax,eax + adc edx,edx + mov [edi],eax + mov eax,[edi+4] + add eax,eax + jc dec_out_of_range + add eax,eax + jc dec_out_of_range + add eax,[edi+4] + jc dec_out_of_range + add eax,eax + jc dec_out_of_range + add eax,edx + jc dec_out_of_range + mov [edi+4],eax + movzx eax,byte [esi] + sub al,30h + jc bad_number + cmp al,9 + ja bad_number + add [edi],eax + adc dword [edi+4],0 + jc dec_out_of_range + next_dec_digit: + inc esi + jmp get_dec_digit + dec_out_of_range: + cmp esi,ebx + ja dec_out_of_range_finished + lods byte [esi] + cmp al,27h + je bad_number + cmp al,'_' + je bad_number + sub al,30h + jc bad_number + cmp al,9 + ja bad_number + jmp dec_out_of_range + dec_out_of_range_finished: + or ebp,-1 + jmp number_ok + bad_number: + pop eax + invalid_number: + mov esi,[number_start] + dec esi + not_number: + dec esi + stc + ret + get_bin_number: + xor bl,bl + get_bin_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + cmp al,27h + je bin_digit_skip + cmp al,'_' + je bin_digit_skip + sub al,30h + cmp al,1 + ja bad_number + xor edx,edx + mov cl,bl + dec esi + cmp bl,64 + je bin_out_of_range + inc bl + cmp cl,32 + jae bin_digit_high + shl eax,cl + or dword [edi],eax + jmp get_bin_digit + bin_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_bin_digit + bin_out_of_range: + or al,al + jz get_bin_digit + or ebp,-1 + jmp get_bin_digit + bin_digit_skip: + dec esi + jmp get_bin_digit + pascal_hex_number: + cmp cl,1 + je bad_number + get_hex_number: + xor bl,bl + get_hex_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + cmp al,27h + je hex_digit_skip + cmp al,'_' + je hex_digit_skip + cmp al,'x' + je hex_number_ok + cmp al,'$' + je pascal_hex_ok + sub al,30h + cmp al,9 + jbe hex_digit_ok + sub al,7 + cmp al,15 + jbe hex_letter_digit_ok + sub al,20h + cmp al,15 + ja bad_number + hex_letter_digit_ok: + cmp al,10 + jb bad_number + hex_digit_ok: + xor edx,edx + mov cl,bl + dec esi + cmp bl,64 + je hex_out_of_range + add bl,4 + cmp cl,32 + jae hex_digit_high + shl eax,cl + or dword [edi],eax + jmp get_hex_digit + hex_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_hex_digit + hex_out_of_range: + or al,al + jz get_hex_digit + or ebp,-1 + jmp get_hex_digit + hex_digit_skip: + dec esi + jmp get_hex_digit + get_oct_number: + xor bl,bl + get_oct_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + cmp al,27h + je oct_digit_skip + cmp al,'_' + je oct_digit_skip + sub al,30h + cmp al,7 + ja bad_number + oct_digit_ok: + xor edx,edx + mov cl,bl + dec esi + cmp bl,63 + ja oct_out_of_range + jne oct_range_ok + cmp al,1 + ja oct_out_of_range + oct_range_ok: + add bl,3 + cmp cl,30 + je oct_digit_wrap + ja oct_digit_high + shl eax,cl + or dword [edi],eax + jmp get_oct_digit + oct_digit_wrap: + shl eax,cl + adc dword [edi+4],0 + or dword [edi],eax + jmp get_oct_digit + oct_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_oct_digit + oct_digit_skip: + dec esi + jmp get_oct_digit + oct_out_of_range: + or al,al + jz get_oct_digit + or ebp,-1 + jmp get_oct_digit + hex_number_ok: + dec esi + pascal_hex_ok: + cmp esi,[number_start] + jne bad_number + number_ok: + pop esi + number_done: + clc + ret + get_text_number: + lods dword [esi] + mov edx,eax + xor bl,bl + mov dword [edi],0 + mov dword [edi+4],0 + get_text_character: + sub edx,1 + jc number_done + movzx eax,byte [esi] + inc esi + mov cl,bl + cmp bl,64 + je text_out_of_range + add bl,8 + cmp cl,32 + jae text_character_high + shl eax,cl + or dword [edi],eax + jmp get_text_character + text_character_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_text_character + text_out_of_range: + or ebp,-1 + jmp get_text_character + +get_fp_value: + push edi esi + lods byte [esi] + cmp al,1Ah + je fp_value_start + cmp al,'-' + je fp_sign_ok + cmp al,'+' + jne not_fp_value + fp_sign_ok: + lods byte [esi] + cmp al,1Ah + jne not_fp_value + fp_value_start: + lods byte [esi] + movzx ecx,al + cmp cl,1 + jbe not_fp_value + lea edx,[esi+1] + xor ah,ah + check_fp_value: + lods byte [esi] + cmp al,'.' + je fp_character_dot + cmp al,'E' + je fp_character_exp + cmp al,'e' + je fp_character_exp + cmp al,'F' + je fp_last_character + cmp al,'f' + je fp_last_character + digit_expected: + cmp al,'0' + jb not_fp_value + cmp al,'9' + ja not_fp_value + jmp fp_character_ok + fp_character_dot: + cmp esi,edx + je not_fp_value + or ah,ah + jnz not_fp_value + or ah,1 + lods byte [esi] + loop digit_expected + not_fp_value: + pop esi edi + stc + ret + fp_last_character: + cmp cl,1 + jne not_fp_value + or ah,4 + jmp fp_character_ok + fp_character_exp: + cmp esi,edx + je not_fp_value + cmp ah,1 + ja not_fp_value + or ah,2 + cmp ecx,1 + jne fp_character_ok + cmp byte [esi],'+' + je fp_exp_sign + cmp byte [esi],'-' + jne fp_character_ok + fp_exp_sign: + inc esi + cmp byte [esi],1Ah + jne not_fp_value + inc esi + lods byte [esi] + movzx ecx,al + inc ecx + fp_character_ok: + dec ecx + jnz check_fp_value + or ah,ah + jz not_fp_value + pop esi + lods byte [esi] + mov [fp_sign],0 + cmp al,1Ah + je fp_get + inc esi + cmp al,'+' + je fp_get + mov [fp_sign],1 + fp_get: + lods byte [esi] + movzx ecx,al + xor edx,edx + mov edi,fp_value + mov [edi],edx + mov [edi+4],edx + mov [edi+12],edx + call fp_optimize + mov [fp_format],0 + mov al,[esi] + fp_before_dot: + lods byte [esi] + cmp al,'.' + je fp_dot + cmp al,'E' + je fp_exponent + cmp al,'e' + je fp_exponent + cmp al,'F' + je fp_done + cmp al,'f' + je fp_done + sub al,30h + mov edi,fp_value+16 + xor edx,edx + mov dword [edi+12],edx + mov dword [edi],edx + mov dword [edi+4],edx + mov [edi+7],al + mov dl,7 + mov dword [edi+8],edx + call fp_optimize + mov edi,fp_value + push ecx + mov ecx,10 + call fp_mul + pop ecx + mov ebx,fp_value+16 + call fp_add + loop fp_before_dot + fp_dot: + mov edi,fp_value+16 + xor edx,edx + mov [edi],edx + mov [edi+4],edx + mov byte [edi+7],80h + mov [edi+8],edx + mov dword [edi+12],edx + dec ecx + jz fp_done + fp_after_dot: + lods byte [esi] + cmp al,'E' + je fp_exponent + cmp al,'e' + je fp_exponent + cmp al,'F' + je fp_done + cmp al,'f' + je fp_done + inc [fp_format] + cmp [fp_format],80h + jne fp_counter_ok + mov [fp_format],7Fh + fp_counter_ok: + dec esi + mov edi,fp_value+16 + push ecx + mov ecx,10 + call fp_div + push dword [edi] + push dword [edi+4] + push dword [edi+8] + push dword [edi+12] + lods byte [esi] + sub al,30h + movzx ecx,al + call fp_mul + mov ebx,edi + mov edi,fp_value + call fp_add + mov edi,fp_value+16 + pop dword [edi+12] + pop dword [edi+8] + pop dword [edi+4] + pop dword [edi] + pop ecx + dec ecx + jnz fp_after_dot + jmp fp_done + fp_exponent: + or [fp_format],80h + xor edx,edx + xor ebp,ebp + dec ecx + jnz get_exponent + cmp byte [esi],'+' + je fp_exponent_sign + cmp byte [esi],'-' + jne fp_done + not ebp + fp_exponent_sign: + add esi,2 + lods byte [esi] + movzx ecx,al + get_exponent: + movzx eax,byte [esi] + inc esi + sub al,30h + cmp al,10 + jae exponent_ok + imul edx,10 + cmp edx,8000h + jae value_out_of_range + add edx,eax + loop get_exponent + exponent_ok: + mov edi,fp_value + or edx,edx + jz fp_done + mov ecx,edx + or ebp,ebp + jnz fp_negative_power + fp_power: + push ecx + mov ecx,10 + call fp_mul + pop ecx + loop fp_power + jmp fp_done + fp_negative_power: + push ecx + mov ecx,10 + call fp_div + pop ecx + loop fp_negative_power + fp_done: + mov edi,fp_value + mov al,[fp_format] + mov [edi+10],al + mov al,[fp_sign] + mov [edi+11],al + test byte [edi+15],80h + jz fp_ok + add dword [edi],1 + adc dword [edi+4],0 + jnc fp_ok + mov eax,[edi+4] + shrd [edi],eax,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc word [edi+8] + fp_ok: + pop edi + clc + ret + fp_mul: + or ecx,ecx + jz fp_zero + mov eax,[edi+12] + mul ecx + mov [edi+12],eax + mov ebx,edx + mov eax,[edi] + mul ecx + add eax,ebx + adc edx,0 + mov [edi],eax + mov ebx,edx + mov eax,[edi+4] + mul ecx + add eax,ebx + adc edx,0 + mov [edi+4],eax + .loop: + or edx,edx + jz .done + mov eax,[edi] + shrd [edi+12],eax,1 + mov eax,[edi+4] + shrd [edi],eax,1 + shrd eax,edx,1 + mov [edi+4],eax + shr edx,1 + inc dword [edi+8] + cmp dword [edi+8],8000h + jge value_out_of_range + jmp .loop + .done: + ret + fp_div: + mov eax,[edi+4] + xor edx,edx + div ecx + mov [edi+4],eax + mov eax,[edi] + div ecx + mov [edi],eax + mov eax,[edi+12] + div ecx + mov [edi+12],eax + mov ebx,eax + or ebx,[edi] + or ebx,[edi+4] + jz fp_zero + .loop: + test byte [edi+7],80h + jnz .exp_ok + mov eax,[edi] + shld [edi+4],eax,1 + mov eax,[edi+12] + shld [edi],eax,1 + add eax,eax + mov [edi+12],eax + dec dword [edi+8] + add edx,edx + jmp .loop + .exp_ok: + mov eax,edx + xor edx,edx + div ecx + add [edi+12],eax + adc dword [edi],0 + adc dword [edi+4],0 + jnc .done + mov eax,[edi+4] + mov ebx,[edi] + shrd [edi],eax,1 + shrd [edi+12],ebx,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc dword [edi+8] + .done: + ret + fp_add: + cmp dword [ebx+8],8000h + je .done + cmp dword [edi+8],8000h + je .copy + mov eax,[ebx+8] + cmp eax,[edi+8] + jge .exp_ok + mov eax,[edi+8] + .exp_ok: + call .change_exp + xchg ebx,edi + call .change_exp + xchg ebx,edi + mov edx,[ebx+12] + mov eax,[ebx] + mov ebx,[ebx+4] + add [edi+12],edx + adc [edi],eax + adc [edi+4],ebx + jnc .done + mov eax,[edi] + shrd [edi+12],eax,1 + mov eax,[edi+4] + shrd [edi],eax,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc dword [edi+8] + .done: + ret + .copy: + mov eax,[ebx] + mov [edi],eax + mov eax,[ebx+4] + mov [edi+4],eax + mov eax,[ebx+8] + mov [edi+8],eax + mov eax,[ebx+12] + mov [edi+12],eax + ret + .change_exp: + push ecx + mov ecx,eax + sub ecx,[ebx+8] + mov edx,[ebx+4] + jecxz .exp_done + .exp_loop: + mov ebp,[ebx] + shrd [ebx+12],ebp,1 + shrd [ebx],edx,1 + shr edx,1 + inc dword [ebx+8] + loop .exp_loop + .exp_done: + mov [ebx+4],edx + pop ecx + ret + fp_optimize: + mov eax,[edi] + mov ebp,[edi+4] + or ebp,[edi] + or ebp,[edi+12] + jz fp_zero + .loop: + test byte [edi+7],80h + jnz .done + shld [edi+4],eax,1 + mov ebp,[edi+12] + shld eax,ebp,1 + mov [edi],eax + shl dword [edi+12],1 + dec dword [edi+8] + jmp .loop + .done: + ret + fp_zero: + mov dword [edi+8],8000h + ret + +preevaluate_logical_expression: + xor al,al + preevaluate_embedded_logical_expression: + mov [logical_value_wrapping],al + push edi + call preevaluate_logical_value + preevaluation_loop: + cmp al,0FFh + je invalid_logical_expression + mov dl,[esi] + inc esi + cmp dl,'|' + je preevaluate_or + cmp dl,'&' + je preevaluate_and + cmp dl,92h + je preevaluation_done + or dl,dl + jnz invalid_logical_expression + preevaluation_done: + pop edx + dec esi + ret + preevaluate_or: + cmp al,'1' + je quick_true + cmp al,'0' + je leave_only_following + push edi + mov al,dl + stos byte [edi] + call preevaluate_logical_value + pop ebx + cmp al,'0' + je leave_only_preceding + cmp al,'1' + jne preevaluation_loop + stos byte [edi] + xor al,al + jmp preevaluation_loop + preevaluate_and: + cmp al,'0' + je quick_false + cmp al,'1' + je leave_only_following + push edi + mov al,dl + stos byte [edi] + call preevaluate_logical_value + pop ebx + cmp al,'1' + je leave_only_preceding + cmp al,'0' + jne preevaluation_loop + stos byte [edi] + xor al,al + jmp preevaluation_loop + leave_only_following: + mov edi,[esp] + call preevaluate_logical_value + jmp preevaluation_loop + leave_only_preceding: + mov edi,ebx + xor al,al + jmp preevaluation_loop + quick_true: + call skip_logical_value + jc invalid_logical_expression + mov edi,[esp] + mov al,'1' + jmp preevaluation_loop + quick_false: + call skip_logical_value + jc invalid_logical_expression + mov edi,[esp] + mov al,'0' + jmp preevaluation_loop + invalid_logical_expression: + pop edi + mov esi,edi + mov al,0FFh + stos byte [edi] + ret + skip_logical_value: + cmp byte [esi],'~' + jne negation_skipped + inc esi + jmp skip_logical_value + negation_skipped: + mov al,[esi] + cmp al,91h + jne skip_simple_logical_value + inc esi + xchg al,[logical_value_wrapping] + push eax + skip_logical_expression: + call skip_logical_value + lods byte [esi] + or al,al + jz wrongly_structured_logical_expression + cmp al,0Fh + je wrongly_structured_logical_expression + cmp al,'|' + je skip_logical_expression + cmp al,'&' + je skip_logical_expression + cmp al,92h + jne wrongly_structured_logical_expression + pop eax + mov [logical_value_wrapping],al + logical_value_skipped: + clc + ret + wrongly_structured_logical_expression: + pop eax + stc + ret + skip_simple_logical_value: + mov [logical_value_parentheses],0 + find_simple_logical_value_end: + mov al,[esi] + or al,al + jz logical_value_skipped + cmp al,0Fh + je logical_value_skipped + cmp al,'|' + je logical_value_skipped + cmp al,'&' + je logical_value_skipped + cmp al,91h + je skip_logical_value_internal_parenthesis + cmp al,92h + jne skip_logical_value_symbol + sub [logical_value_parentheses],1 + jnc skip_logical_value_symbol + cmp [logical_value_wrapping],91h + jne skip_logical_value_symbol + jmp logical_value_skipped + skip_logical_value_internal_parenthesis: + inc [logical_value_parentheses] + skip_logical_value_symbol: + call skip_symbol + jmp find_simple_logical_value_end + preevaluate_logical_value: + mov ebp,edi + preevaluate_negation: + cmp byte [esi],'~' + jne preevaluate_negation_ok + movs byte [edi],[esi] + jmp preevaluate_negation + preevaluate_negation_ok: + mov ebx,esi + cmp byte [esi],91h + jne preevaluate_simple_logical_value + lods byte [esi] + stos byte [edi] + push ebp + mov dl,[logical_value_wrapping] + push edx + call preevaluate_embedded_logical_expression + pop edx + mov [logical_value_wrapping],dl + pop ebp + cmp al,0FFh + je invalid_logical_value + cmp byte [esi],92h + jne invalid_logical_value + or al,al + jnz preevaluated_expression_value + movs byte [edi],[esi] + ret + preevaluated_expression_value: + inc esi + lea edx,[edi-1] + sub edx,ebp + test edx,1 + jz expression_negation_ok + xor al,1 + expression_negation_ok: + mov edi,ebp + ret + invalid_logical_value: + mov edi,ebp + mov al,0FFh + ret + preevaluate_simple_logical_value: + xor edx,edx + mov [logical_value_parentheses],edx + find_logical_value_boundaries: + mov al,[esi] + or al,al + jz logical_value_boundaries_found + cmp al,91h + je logical_value_internal_parentheses + cmp al,92h + je logical_value_boundaries_parenthesis_close + cmp al,'|' + je logical_value_boundaries_found + cmp al,'&' + je logical_value_boundaries_found + or edx,edx + jnz next_symbol_in_logical_value + cmp al,0F0h + je preevaluable_logical_operator + cmp al,0F7h + je preevaluable_logical_operator + cmp al,0F6h + jne next_symbol_in_logical_value + preevaluable_logical_operator: + mov edx,esi + next_symbol_in_logical_value: + call skip_symbol + jmp find_logical_value_boundaries + logical_value_internal_parentheses: + inc [logical_value_parentheses] + jmp next_symbol_in_logical_value + logical_value_boundaries_parenthesis_close: + sub [logical_value_parentheses],1 + jnc next_symbol_in_logical_value + cmp [logical_value_wrapping],91h + jne next_symbol_in_logical_value + logical_value_boundaries_found: + or edx,edx + jz non_preevaluable_logical_value + mov al,[edx] + cmp al,0F0h + je compare_symbols + cmp al,0F7h + je compare_symbol_types + cmp al,0F6h + je scan_symbols_list + non_preevaluable_logical_value: + mov ecx,esi + mov esi,ebx + sub ecx,esi + jz invalid_logical_value + cmp esi,edi + je leave_logical_value_intact + rep movs byte [edi],[esi] + xor al,al + ret + leave_logical_value_intact: + add edi,ecx + add esi,ecx + xor al,al + ret + compare_symbols: + lea ecx,[esi-1] + sub ecx,edx + mov eax,edx + sub eax,ebx + cmp ecx,eax + jne preevaluated_false + push esi edi + mov esi,ebx + lea edi,[edx+1] + repe cmps byte [esi],[edi] + pop edi esi + je preevaluated_true + preevaluated_false: + mov eax,edi + sub eax,ebp + test eax,1 + jnz store_true + store_false: + mov edi,ebp + mov al,'0' + ret + preevaluated_true: + mov eax,edi + sub eax,ebp + test eax,1 + jnz store_false + store_true: + mov edi,ebp + mov al,'1' + ret + compare_symbol_types: + push esi + lea esi,[edx+1] + type_comparison: + cmp esi,[esp] + je types_compared + mov al,[esi] + cmp al,[ebx] + jne different_type + cmp al,'(' + jne equal_type + mov al,[esi+1] + mov ah,[ebx+1] + cmp al,ah + je equal_type + or al,al + jz different_type + or ah,ah + jz different_type + cmp al,'.' + je different_type + cmp ah,'.' + je different_type + equal_type: + call skip_symbol + xchg esi,ebx + call skip_symbol + xchg esi,ebx + jmp type_comparison + types_compared: + pop esi + cmp byte [ebx],0F7h + jne preevaluated_false + jmp preevaluated_true + different_type: + pop esi + jmp preevaluated_false + scan_symbols_list: + push edi esi + lea esi,[edx+1] + sub edx,ebx + lods byte [esi] + cmp al,'<' + jne invalid_symbols_list + get_next_from_list: + mov edi,esi + get_from_list: + cmp byte [esi],',' + je compare_in_list + cmp byte [esi],'>' + je compare_in_list + cmp esi,[esp] + jae invalid_symbols_list + call skip_symbol + jmp get_from_list + compare_in_list: + mov ecx,esi + sub ecx,edi + cmp ecx,edx + jne not_equal_length_in_list + mov esi,ebx + repe cmps byte [esi],[edi] + mov esi,edi + jne not_equal_in_list + skip_rest_of_list: + cmp byte [esi],'>' + je check_list_end + cmp esi,[esp] + jae invalid_symbols_list + call skip_symbol + jmp skip_rest_of_list + check_list_end: + inc esi + cmp esi,[esp] + jne invalid_symbols_list + pop esi edi + jmp preevaluated_true + not_equal_in_list: + add esi,ecx + not_equal_length_in_list: + lods byte [esi] + cmp al,',' + je get_next_from_list + cmp esi,[esp] + jne invalid_symbols_list + pop esi edi + jmp preevaluated_false + invalid_symbols_list: + pop esi edi + jmp invalid_logical_value diff --git a/fasmw172/SOURCE/FORMATS.INC b/fasmw172/SOURCE/FORMATS.INC new file mode 100644 index 0000000..e92f80f --- /dev/null +++ b/fasmw172/SOURCE/FORMATS.INC @@ -0,0 +1,4155 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +formatter: + mov [current_offset],edi + cmp [output_file],0 + jne output_path_ok + mov esi,[input_file] + mov edi,[free_additional_memory] + copy_output_path: + lods byte [esi] + cmp edi,[structures_buffer] + jae out_of_memory + stos byte [edi] + or al,al + jnz copy_output_path + dec edi + mov eax,edi + find_extension: + dec eax + cmp eax,[free_additional_memory] + jb extension_found + cmp byte [eax],'\' + je extension_found + cmp byte [eax],'/' + je extension_found + cmp byte [eax],'.' + jne find_extension + mov edi,eax + extension_found: + lea eax,[edi+9] + cmp eax,[structures_buffer] + jae out_of_memory + cmp [file_extension],0 + jne extension_specified + mov al,[output_format] + cmp al,2 + je exe_extension + jb bin_extension + cmp al,4 + je obj_extension + cmp al,5 + je o_extension + cmp al,3 + jne no_extension + cmp [subsystem],1 + je sys_extension + cmp [subsystem],10 + jae efi_extension + bt [format_flags],8 + jnc exe_extension + mov eax,'.dll' + jmp make_extension + sys_extension: + mov eax,'.sys' + jmp make_extension + efi_extension: + mov eax,'.efi' + jmp make_extension + bin_extension: + mov eax,'.bin' + bt [format_flags],0 + jnc make_extension + mov eax,'.com' + jmp make_extension + obj_extension: + mov eax,'.obj' + jmp make_extension + o_extension: + mov eax,'.o' + bt [format_flags],0 + jnc make_extension + no_extension: + xor eax,eax + jmp make_extension + exe_extension: + mov eax,'.exe' + make_extension: + xchg eax,[edi] + scas dword [edi] + mov byte [edi],0 + scas byte [edi] + mov esi,edi + stos dword [edi] + sub edi,9 + xor eax,eax + mov ebx,characters + adapt_case: + mov al,[esi] + or al,al + jz adapt_next + xlat byte [ebx] + cmp al,[esi] + je adapt_ok + sub byte [edi],20h + adapt_ok: + inc esi + adapt_next: + inc edi + cmp byte [edi],0 + jne adapt_case + jmp extension_ok + extension_specified: + mov al,'.' + stos byte [edi] + mov esi,[file_extension] + copy_extension: + lods byte [esi] + stos byte [edi] + test al,al + jnz copy_extension + dec edi + extension_ok: + mov esi,edi + lea ecx,[esi+1] + sub ecx,[free_additional_memory] + mov edi,[structures_buffer] + dec edi + std + rep movs byte [edi],[esi] + cld + inc edi + mov [structures_buffer],edi + mov [output_file],edi + output_path_ok: + cmp [symbols_file],0 + je labels_table_ok + mov ecx,[memory_end] + sub ecx,[labels_list] + mov edi,[tagged_blocks] + sub edi,8 + mov [edi],ecx + or dword [edi+4],-1 + sub edi,ecx + cmp edi,[current_offset] + jbe out_of_memory + mov [tagged_blocks],edi + mov esi,[memory_end] + copy_labels: + sub esi,32 + cmp esi,[labels_list] + jb labels_table_ok + mov ecx,32 shr 2 + rep movs dword [edi],[esi] + sub esi,32 + jmp copy_labels + labels_table_ok: + mov edi,[current_offset] + cmp [output_format],4 + je coff_formatter + cmp [output_format],5 + jne common_formatter + bt [format_flags],0 + jnc elf_formatter + common_formatter: + mov eax,edi + sub eax,[code_start] + mov [real_code_size],eax + cmp edi,[undefined_data_end] + jne calculate_code_size + mov edi,[undefined_data_start] + calculate_code_size: + mov [current_offset],edi + sub edi,[code_start] + mov [code_size],edi + and [written_size],0 + mov edx,[output_file] + call create + jc write_failed + cmp [output_format],3 + jne stub_written + mov edx,[code_start] + mov ecx,[stub_size] + sub edx,ecx + add [written_size],ecx + call write + stub_written: + cmp [output_format],2 + jne write_output + call write_mz_header + write_output: + call write_code + output_written: + call close + cmp [symbols_file],0 + jne dump_symbols + ret + write_code: + mov eax,[written_size] + mov [headers_size],eax + mov edx,[code_start] + mov ecx,[code_size] + add [written_size],ecx + lea eax,[edx+ecx] + call write + jc write_failed + ret +format_directive: + cmp edi,[code_start] + jne unexpected_instruction + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jnz unexpected_instruction + cmp [output_format],0 + jne unexpected_instruction + lods byte [esi] + cmp al,1Ch + je format_prefix + cmp al,18h + jne invalid_argument + lods byte [esi] + select_format: + mov dl,al + shr al,4 + mov [output_format],al + and edx,0Fh + or [format_flags],edx + cmp al,2 + je format_mz + cmp al,3 + je format_pe + cmp al,4 + je format_coff + cmp al,5 + je format_elf + format_defined: + cmp byte [esi],86h + jne instruction_assembled + cmp word [esi+1],'(' + jne invalid_argument + mov eax,[esi+3] + add esi,3+4 + mov [file_extension],esi + lea esi,[esi+eax+1] + jmp instruction_assembled + format_prefix: + lods byte [esi] + mov ah,al + lods byte [esi] + cmp al,18h + jne invalid_argument + lods byte [esi] + mov edx,eax + shr dl,4 + shr dh,4 + cmp dl,dh + jne invalid_argument + or al,ah + jmp select_format +entry_directive: + bts [format_flags],10h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_entry + cmp al,3 + je pe_entry + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc elf_entry + jmp illegal_instruction +stack_directive: + bts [format_flags],11h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_stack + cmp al,3 + je pe_stack + jmp illegal_instruction +heap_directive: + bts [format_flags],12h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_heap + cmp al,3 + je pe_heap + jmp illegal_instruction +segment_directive: + mov al,[output_format] + cmp al,2 + je mz_segment + cmp al,5 + je elf_segment + jmp illegal_instruction +section_directive: + mov al,[output_format] + cmp al,3 + je pe_section + cmp al,4 + je coff_section + cmp al,5 + je elf_section + jmp illegal_instruction +public_directive: + mov al,[output_format] + cmp al,4 + je public_allowed + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc illegal_instruction + public_allowed: + mov [base_code],0C0h + lods byte [esi] + cmp al,2 + je public_label + cmp al,1Dh + jne invalid_argument + lods byte [esi] + and al,7 + add [base_code],al + lods byte [esi] + cmp al,2 + jne invalid_argument + public_label: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov dx,[current_pass] + mov [eax+18],dx + or byte [eax+8],8 + cmp [symbols_file],0 + je public_reference_ok + cmp [next_pass_needed],0 + jne public_reference_ok + mov ebx,eax + call store_label_reference + mov eax,ebx + public_reference_ok: + mov ebx,[free_additional_memory] + lea edx,[ebx+10h] + cmp edx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],edx + mov [ebx+8],eax + mov eax,[current_line] + mov [ebx+0Ch],eax + lods byte [esi] + cmp al,86h + jne invalid_argument + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + lods dword [esi] + lea esi,[esi+eax+1] + mov al,[base_code] + mov [ebx],al + jmp instruction_assembled +extrn_directive: + mov al,[output_format] + cmp al,4 + je extrn_allowed + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc illegal_instruction + extrn_allowed: + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov ebx,esi + lods dword [esi] + lea esi,[esi+eax+1] + mov edx,[free_additional_memory] + lea eax,[edx+0Ch] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov byte [edx],80h + mov [edx+4],ebx + lods byte [esi] + cmp al,86h + jne invalid_argument + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + xor ah,ah + lods byte [esi] + cmp al,':' + je get_extrn_size + dec esi + cmp al,11h + jne extrn_size_ok + get_extrn_size: + lods word [esi] + cmp al,11h + jne invalid_argument + extrn_size_ok: + mov [address_symbol],edx + mov [label_size],ah + movzx ecx,ah + mov [edx+8],ecx + xor eax,eax + xor edx,edx + xor ebp,ebp + mov [address_sign],0 + mov ch,2 + test [format_flags],8 + jz make_free_label + mov ch,4 + jmp make_free_label +mark_relocation: + cmp [value_type],0 + je relocation_ok + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jnz relocation_ok + cmp [output_format],2 + je mark_mz_relocation + cmp [output_format],3 + je mark_pe_relocation + cmp [output_format],4 + je mark_coff_relocation + cmp [output_format],5 + je mark_elf_relocation + relocation_ok: + ret +close_pass: + mov al,[output_format] + cmp al,3 + je close_pe + cmp al,4 + je close_coff + cmp al,5 + je close_elf + ret + +format_mz: + mov edx,[additional_memory] + push edi + mov edi,edx + mov ecx,1Ch shr 2 + xor eax,eax + rep stos dword [edi] + mov [free_additional_memory],edi + pop edi + mov word [edx+0Ch],0FFFFh + mov word [edx+10h],1000h + mov [code_type],16 + jmp format_defined +mark_mz_relocation: + push eax ebx + inc word [number_of_relocations] + jz format_limitations_exceeded + mov ebx,[free_additional_memory] + mov eax,edi + sub eax,[code_start] + mov [ebx],ax + shr eax,16 + shl ax,12 + mov [ebx+2],ax + cmp word [ebx],0FFFFh + jne mz_relocation_ok + inc word [ebx+2] + sub word [ebx],10h + mz_relocation_ok: + add ebx,4 + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + pop ebx eax + ret +mz_segment: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + mov eax,edi + sub eax,[code_start] + mov ecx,0Fh + add eax,0Fh + and eax,1111b + sub ecx,eax + mov edx,edi + xor eax,eax + rep stos byte [edi] + mov eax,edx + call undefined_data + push ebx + call create_addressing_space + pop ebx + mov eax,edi + sub eax,[code_start] + shr eax,4 + cmp eax,10000h + jae value_out_of_range + mov edx,eax + mov al,16 + cmp byte [esi],13h + jne segment_type_ok + inc esi + lods byte [esi] + segment_type_ok: + mov [code_type],al + mov eax,edx + mov ch,1 + mov [address_sign],0 + xor edx,edx + xor ebp,ebp + mov [label_size],0 + mov [address_symbol],edx + jmp make_free_label +mz_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],1 + je initial_cs_ok + call recoverable_invalid_address + initial_cs_ok: + mov edx,[additional_memory] + mov [edx+16h],ax + lods byte [esi] + cmp al,':' + jne invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + ja invalid_address + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+14h],ax + jmp instruction_assembled + recoverable_invalid_address: + cmp [error_line],0 + jne ignore_invalid_address + push [current_line] + pop [error_line] + mov [error],invalid_address + ignore_invalid_address: + ret +mz_stack: + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp byte [esi],':' + je stack_pointer + cmp ax,10h + jb invalid_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+10h],ax + jmp instruction_assembled + stack_pointer: + cmp [value_type],1 + je initial_ss_ok + call recoverable_invalid_address + initial_ss_ok: + mov edx,[additional_memory] + mov [edx+0Eh],ax + lods byte [esi] + cmp al,':' + jne invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+10h],ax + bts [format_flags],4 + jmp instruction_assembled +mz_heap: + cmp [output_format],2 + jne illegal_instruction + lods byte [esi] + call get_size_operator + cmp ah,1 + je invalid_value + cmp ah,2 + ja invalid_value + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+0Ch],ax + jmp instruction_assembled +write_mz_header: + mov edx,[additional_memory] + bt [format_flags],4 + jc mz_stack_ok + mov eax,[real_code_size] + dec eax + shr eax,4 + inc eax + mov [edx+0Eh],ax + shl eax,4 + movzx ecx,word [edx+10h] + add eax,ecx + mov [real_code_size],eax + mz_stack_ok: + mov edi,[free_additional_memory] + mov eax,[number_of_relocations] + shl eax,2 + add eax,1Ch + sub edi,eax + xchg edi,[free_additional_memory] + mov ecx,0Fh + add eax,0Fh + and eax,1111b + sub ecx,eax + xor al,al + rep stos byte [edi] + sub edi,[free_additional_memory] + mov ecx,edi + shr edi,4 + mov word [edx],'MZ' ; signature + mov [edx+8],di ; header size in paragraphs + mov eax,[number_of_relocations] + mov [edx+6],ax ; number of relocation entries + mov eax,[code_size] + add eax,ecx + mov esi,eax + shr esi,9 + and eax,1FFh + inc si + or ax,ax + jnz mz_size_ok + dec si + mz_size_ok: + mov [edx+2],ax ; number of bytes in last page + mov [edx+4],si ; number of pages + mov eax,[real_code_size] + dec eax + shr eax,4 + inc eax + mov esi,[code_size] + dec esi + shr esi,4 + inc esi + sub eax,esi + mov [edx+0Ah],ax ; minimum memory in addition to code + add [edx+0Ch],ax ; maximum memory in addition to code + salc + mov ah,al + or [edx+0Ch],ax + mov word [edx+18h],1Ch ; offset of relocation table + add [written_size],ecx + call write + jc write_failed + ret + +make_stub: + mov [stub_file],edx + or edx,edx + jnz stub_from_file + push esi + mov edx,edi + xor eax,eax + mov ecx,20h + rep stos dword [edi] + mov eax,40h+default_stub_end-default_stub + mov cx,100h+default_stub_end-default_stub + mov word [edx],'MZ' + mov byte [edx+4],1 + mov word [edx+2],ax + mov byte [edx+8],4 + mov byte [edx+0Ah],10h + mov word [edx+0Ch],0FFFFh + mov word [edx+10h],cx + mov word [edx+3Ch],ax + mov byte [edx+18h],40h + lea edi,[edx+40h] + mov esi,default_stub + mov ecx,default_stub_end-default_stub + rep movs byte [edi],[esi] + pop esi + jmp stub_ok + default_stub: + use16 + push cs + pop ds + mov dx,stub_message-default_stub + mov ah,9 + int 21h + mov ax,4C01h + int 21h + stub_message db 'This program cannot be run in DOS mode.',0Dh,0Ah,24h + rq 1 + default_stub_end: + use32 + stub_from_file: + push esi + mov esi,edx + call open_binary_file + mov edx,edi + mov ecx,1Ch + mov esi,edx + call read + jc binary_stub + cmp word [esi],'MZ' + jne binary_stub + add edi,1Ch + movzx ecx,word [esi+6] + add ecx,11b + and ecx,not 11b + add ecx,(40h-1Ch) shr 2 + lea eax,[edi+ecx*4] + cmp edi,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov edx,40h + xchg dx,[esi+18h] + xor al,al + call lseek + movzx ecx,word [esi+6] + shl ecx,2 + lea edx,[esi+40h] + call read + mov edx,edi + sub edx,esi + shr edx,4 + xchg dx,[esi+8] + shl edx,4 + xor al,al + call lseek + movzx ecx,word [esi+4] + dec ecx + shl ecx,9 + movzx edx,word [esi+2] + test edx,edx + jnz stub_header_size_ok + mov dx,200h + stub_header_size_ok: + add ecx,edx + mov edx,edi + sub ecx,eax + je read_stub_code + jb stub_code_ok + push ecx + dec ecx + shr ecx,3 + inc ecx + shl ecx,1 + lea eax,[edi+ecx*4] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + pop ecx + read_stub_code: + call read + stub_code_ok: + call close + mov edx,edi + sub edx,esi + mov ax,dx + and ax,1FFh + mov [esi+2],ax + dec edx + shr edx,9 + inc edx + mov [esi+4],dx + mov eax,edi + sub eax,esi + mov [esi+3Ch],eax + pop esi + stub_ok: + ret + binary_stub: + mov esi,edi + mov ecx,40h shr 2 + xor eax,eax + rep stos dword [edi] + mov al,2 + xor edx,edx + call lseek + push eax + xor al,al + xor edx,edx + call lseek + mov ecx,[esp] + add ecx,40h+111b + and ecx,not 111b + mov ax,cx + and ax,1FFh + mov [esi+2],ax + lea eax,[ecx+1FFh] + shr eax,9 + mov [esi+4],ax + mov [esi+3Ch],ecx + sub ecx,40h + mov eax,10000h + sub eax,ecx + jbe binary_heap_ok + shr eax,4 + mov [esi+0Ah],ax + binary_heap_ok: + mov word [esi],'MZ' + mov byte [esi+8],4 + mov ax,0FFFFh + mov [esi+0Ch],ax + dec ax + mov [esi+10h],ax + sub ax,0Eh + mov [esi+0Eh],ax + mov [esi+16h],ax + mov word [esi+14h],100h + mov byte [esi+18h],40h + mov eax,[tagged_blocks] + sub eax,ecx + cmp edi,eax + jae out_of_memory + mov edx,edi + shr ecx,2 + xor eax,eax + rep stos dword [edi] + pop ecx + call read + call close + pop esi + ret + +format_pe: + xor edx,edx + mov [machine],14Ch + mov [subsystem],3 + mov [subsystem_version],3 + 10 shl 16 + mov [image_base],400000h + and [image_base_high],0 + test [format_flags],8 + jz pe_settings + mov [machine],8664h + mov [subsystem_version],5 + 0 shl 16 + pe_settings: + cmp byte [esi],84h + je get_stub_name + cmp byte [esi],80h + je get_pe_base + cmp byte [esi],1Bh + jne pe_settings_ok + lods byte [esi] + lods byte [esi] + test al,80h+40h + jz subsystem_setting + cmp al,80h + je dll_flag + cmp al,81h + je wdm_flag + cmp al,82h + je large_flag + cmp al,83h + je nx_flag + jmp pe_settings + dll_flag: + bts [format_flags],8 + jc setting_already_specified + jmp pe_settings + wdm_flag: + bts [format_flags],9 + jc setting_already_specified + jmp pe_settings + large_flag: + bts [format_flags],11 + jc setting_already_specified + test [format_flags],8 + jnz invalid_argument + jmp pe_settings + nx_flag: + bts [format_flags],12 + jc setting_already_specified + jmp pe_settings + subsystem_setting: + bts [format_flags],7 + jc setting_already_specified + and ax,3Fh + mov [subsystem],ax + cmp ax,10 + jb subsystem_type_ok + or [format_flags],4 + subsystem_type_ok: + cmp byte [esi],'(' + jne pe_settings + inc esi + cmp byte [esi],'.' + jne invalid_value + inc esi + push edx + cmp byte [esi+11],0 + jne invalid_value + cmp byte [esi+10],2 + ja invalid_value + mov dx,[esi+8] + cmp dx,8000h + je zero_version + mov eax,[esi+4] + cmp dx,7 + jg invalid_value + mov cx,7 + sub cx,dx + mov eax,[esi+4] + shr eax,cl + mov ebx,eax + shr ebx,24 + cmp bl,100 + jae invalid_value + and eax,0FFFFFFh + mov ecx,100 + mul ecx + shrd eax,edx,24 + jnc version_value_ok + inc eax + version_value_ok: + shl eax,16 + mov ax,bx + jmp subsystem_version_ok + zero_version: + xor eax,eax + subsystem_version_ok: + pop edx + add esi,13 + mov [subsystem_version],eax + jmp pe_settings + get_pe_base: + bts [format_flags],10 + jc setting_already_specified + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx edi + add edi,[stub_size] + test [format_flags],4 + jnz get_peplus_base + call get_dword_value + mov [image_base],eax + jmp pe_base_ok + get_peplus_base: + call get_qword_value + mov [image_base],eax + mov [image_base_high],edx + pe_base_ok: + pop edi edx + cmp [value_type],0 + jne invalid_use_of_symbol + cmp byte [esi],84h + jne pe_settings_ok + get_stub_name: + lods byte [esi] + lods word [esi] + cmp ax,'(' + jne invalid_argument + lods dword [esi] + mov edx,esi + add esi,eax + inc esi + pe_settings_ok: + mov ebp,[stub_size] + or ebp,ebp + jz make_pe_stub + cmp edx,[stub_file] + je pe_stub_ok + sub edi,[stub_size] + mov [code_start],edi + make_pe_stub: + call make_stub + mov eax,edi + sub eax,[code_start] + mov [stub_size],eax + mov [code_start],edi + mov ebp,eax + pe_stub_ok: + mov edx,edi + mov ecx,18h+0E0h + test [format_flags],4 + jz zero_pe_header + add ecx,10h + zero_pe_header: + add ebp,ecx + shr ecx,2 + xor eax,eax + rep stos dword [edi] + mov word [edx],'PE' ; signature + mov ax,[machine] + mov word [edx+4],ax + mov byte [edx+38h+1],10h ; section alignment + mov byte [edx+3Ch+1],2 ; file alignment + mov byte [edx+40h],1 ; OS version + mov eax,[subsystem_version] + mov [edx+48h],eax + mov ax,[subsystem] + mov [edx+5Ch],ax + cmp ax,1 + jne pe_alignment_ok + mov eax,20h + mov dword [edx+38h],eax + mov dword [edx+3Ch],eax + pe_alignment_ok: + mov word [edx+1Ah],VERSION_MAJOR + VERSION_MINOR shl 8 + test [format_flags],4 + jnz init_peplus_specific + mov byte [edx+14h],0E0h ; size of optional header + mov dword [edx+16h],10B010Fh; flags and magic value + mov eax,[image_base] + mov [edx+34h],eax + mov byte [edx+60h+1],10h ; stack reserve + mov byte [edx+64h+1],10h ; stack commit + mov byte [edx+68h+2],1 ; heap reserve + mov byte [edx+74h],16 ; number of directories + jmp pe_header_ok + init_peplus_specific: + mov byte [edx+14h],0F0h ; size of optional header + mov dword [edx+16h],20B002Fh; flags and magic value + mov eax,[image_base] + mov [edx+30h],eax + mov eax,[image_base_high] + mov [edx+34h],eax + mov byte [edx+60h+1],10h ; stack reserve + mov byte [edx+68h+1],10h ; stack commit + mov byte [edx+70h+2],1 ; heap reserve + mov byte [edx+84h],16 ; number of directories + pe_header_ok: + bsf ecx,[edx+3Ch] + imul ebx,[number_of_sections],28h + or ebx,ebx + jnz reserve_space_for_section_headers + mov ebx,28h + reserve_space_for_section_headers: + add ebx,ebp + dec ebx + shr ebx,cl + inc ebx + shl ebx,cl + sub ebx,ebp + mov ecx,ebx + mov eax,[tagged_blocks] + sub eax,ecx + cmp edi,eax + jae out_of_memory + shr ecx,2 + xor eax,eax + rep stos dword [edi] + mov eax,edi + sub eax,[code_start] + add eax,[stub_size] + mov [edx+54h],eax ; size of headers + mov ecx,[edx+38h] + dec ecx + add eax,ecx + not ecx + and eax,ecx + bt [format_flags],8 + jc pe_entry_init_ok + mov [edx+28h],eax ; entry point rva + pe_entry_init_ok: + and [number_of_sections],0 + movzx ebx,word [edx+14h] + lea ebx,[edx+18h+ebx] + mov [current_section],ebx + mov dword [ebx],'.fla' + mov dword [ebx+4],'t' + mov [ebx+14h],edi + mov [ebx+0Ch],eax + mov dword [ebx+24h],0E0000060h + xor ecx,ecx + xor bl,bl + not eax + not ecx + not bl + add eax,1 + adc ecx,0 + adc bl,0 + add eax,edi + adc ecx,0 + adc bl,0 + test [format_flags],4 + jnz peplus_org + sub eax,[edx+34h] + sbb ecx,0 + sbb bl,0 + jmp pe_org_ok + peplus_org: + sub eax,[edx+30h] + sbb ecx,[edx+34h] + sbb bl,0 + pe_org_ok: + test [format_flags],8 + jnz pe64_code + mov bh,2 + mov [code_type],32 + jmp pe_code_type_ok + pe64_code: + mov bh,4 + mov [code_type],64 + pe_code_type_ok: + bt [resolver_flags],0 + jc pe_labels_type_ok + xor bh,bh + pe_labels_type_ok: + push eax ebx + call init_addressing_space + mov ebp,ebx + pop ebx eax + mov [ds:ebp],eax + mov [ds:ebp+4],ecx + mov [ds:ebp+8],bx + mov [ds:ebp+18h],edi + bt [format_flags],8 + jnc dll_flag_ok + or byte [edx+16h+1],20h + dll_flag_ok: + bt [format_flags],9 + jnc wdm_flag_ok + or byte [edx+5Eh+1],20h + wdm_flag_ok: + bt [format_flags],11 + jnc large_flag_ok + or byte [edx+16h],20h + large_flag_ok: + bt [format_flags],12 + jnc nx_ok + or byte [edx+5Eh+1],1 + nx_ok: + jmp format_defined +pe_section: + call close_pe_section + push eax ebx + call create_addressing_space + mov ebp,ebx + pop ebx eax + bts [format_flags],5 + lea ecx,[ebx+28h] + add edx,[edx+54h] + sub edx,[stub_size] + cmp ecx,edx + jbe new_section + lea ebx,[edx-28h] + or [next_pass_needed],-1 + push edi + mov edi,ebx + mov ecx,28h shr 4 + xor eax,eax + rep stos dword [edi] + pop edi + new_section: + mov [ebx+0Ch],eax + lods word [esi] + cmp ax,'(' + jne invalid_argument + lea edx,[esi+4] + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + cmp ecx,8 + ja name_too_long + xor eax,eax + mov [ebx],eax + mov [ebx+4],eax + push esi edi + mov edi,ebx + mov esi,edx + rep movs byte [edi],[esi] + pop edi esi + and dword [ebx+24h],0 + mov [ebx+14h],edi + mov edx,[code_start] + mov eax,edi + xor ecx,ecx + sub eax,[ebx+0Ch] + sbb ecx,0 + sbb byte [ds:ebp+8],0 + mov byte [ds:ebp+9],2 + mov [code_type],32 + test [format_flags],8 + jz pe_section_code_type_ok + mov byte [ds:ebp+9],4 + mov [code_type],64 + pe_section_code_type_ok: + test [format_flags],4 + jnz peplus_section_org + sub eax,[edx+34h] + sbb ecx,0 + sbb byte [ds:ebp+8],0 + bt [resolver_flags],0 + jc pe_section_org_ok + mov byte [ds:ebp+9],0 + jmp pe_section_org_ok + peplus_section_org: + sub eax,[edx+30h] + sbb ecx,[edx+34h] + sbb byte [ds:ebp+8],0 + bt [resolver_flags],0 + jc pe_section_org_ok + mov byte [ds:ebp+9],0 + pe_section_org_ok: + mov [ds:ebp],eax + mov [ds:ebp+4],ecx + mov [ds:ebp+18h],edi + get_section_flags: + lods byte [esi] + cmp al,1Ah + je set_directory + cmp al,19h + je section_flag + dec esi + jmp instruction_assembled + set_directory: + movzx eax,byte [esi] + inc esi + mov ecx,ebx + test [format_flags],4 + jnz peplus_directory + xchg ecx,[edx+78h+eax*8] + mov dword [edx+78h+eax*8+4],-1 + jmp pe_directory_set + peplus_directory: + xchg ecx,[edx+88h+eax*8] + mov dword [edx+88h+eax*8+4],-1 + pe_directory_set: + or ecx,ecx + jnz data_already_defined + push ebx edx + call generate_pe_data + pop edx ebx + jmp get_section_flags + section_flag: + lods byte [esi] + cmp al,9 + je invalid_argument + cmp al,11 + je invalid_argument + mov cl,al + mov eax,1 + shl eax,cl + test dword [ebx+24h],eax + jnz setting_already_specified + or dword [ebx+24h],eax + jmp get_section_flags + close_pe_section: + mov ebx,[current_section] + mov edx,[code_start] + mov eax,edi + sub eax,[ebx+14h] + jnz finish_section + bt [format_flags],5 + jc finish_section + mov eax,[ebx+0Ch] + ret + finish_section: + mov [ebx+8],eax + cmp edi,[undefined_data_end] + jne align_section + cmp dword [edx+38h],1000h + jb align_section + mov edi,[undefined_data_start] + align_section: + and [undefined_data_end],0 + mov ebp,edi + sub ebp,[ebx+14h] + mov ecx,[edx+3Ch] + dec ecx + lea eax,[ebp+ecx] + not ecx + and eax,ecx + mov [ebx+10h],eax + sub eax,ebp + mov ecx,eax + xor al,al + rep stos byte [edi] + mov eax,[code_start] + sub eax,[stub_size] + sub [ebx+14h],eax + mov ecx,[ebx+10h] + test byte [ebx+24h],20h + jz pe_code_sum_ok + add [edx+1Ch],ecx + cmp dword [edx+2Ch],0 + jne pe_code_sum_ok + mov eax,[ebx+0Ch] + mov [edx+2Ch],eax + pe_code_sum_ok: + test byte [ebx+24h],40h + jz pe_data_sum_ok + add [edx+20h],ecx + test [format_flags],4 + jnz pe_data_sum_ok + cmp dword [edx+30h],0 + jne pe_data_sum_ok + mov eax,[ebx+0Ch] + mov [edx+30h],eax + pe_data_sum_ok: + mov eax,[ebx+8] + or eax,eax + jz udata_ok + cmp dword [ebx+10h],0 + jne udata_ok + or byte [ebx+24h],80h + add [edx+24h],ecx + udata_ok: + mov ecx,[edx+38h] + dec ecx + add eax,ecx + not ecx + and eax,ecx + add eax,[ebx+0Ch] + add ebx,28h + mov [current_section],ebx + inc word [number_of_sections] + jz format_limitations_exceeded + ret +data_directive: + cmp [output_format],3 + jne illegal_instruction + lods byte [esi] + cmp al,1Ah + je predefined_data_type + cmp al,'(' + jne invalid_argument + call get_byte_value + cmp al,16 + jb data_type_ok + jmp invalid_value + predefined_data_type: + movzx eax,byte [esi] + inc esi + data_type_ok: + mov ebx,[current_section] + mov ecx,edi + sub ecx,[ebx+14h] + add ecx,[ebx+0Ch] + mov edx,[code_start] + test [format_flags],4 + jnz peplus_data + xchg ecx,[edx+78h+eax*8] + jmp init_pe_data + peplus_data: + xchg ecx,[edx+88h+eax*8] + init_pe_data: + or ecx,ecx + jnz data_already_defined + call allocate_structure_data + mov word [ebx],data_directive-instruction_handler + mov [ebx+2],al + mov edx,[current_line] + mov [ebx+4],edx + call generate_pe_data + jmp instruction_assembled + end_data: + cmp [output_format],3 + jne illegal_instruction + call find_structure_data + jc unexpected_instruction + movzx eax,byte [ebx+2] + mov edx,[current_section] + mov ecx,edi + sub ecx,[edx+14h] + add ecx,[edx+0Ch] + mov edx,[code_start] + test [format_flags],4 + jnz end_peplus_data + sub ecx,[edx+78h+eax*8] + mov [edx+78h+eax*8+4],ecx + jmp remove_structure_data + end_peplus_data: + sub ecx,[edx+88h+eax*8] + mov [edx+88h+eax*8+4],ecx + jmp remove_structure_data +pe_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz pe64_entry + call get_dword_value + mov bl,2 + bt [resolver_flags],0 + jc check_pe_entry_label_type + xor bl,bl + check_pe_entry_label_type: + cmp [value_type],bl + je pe_entry_ok + call recoverable_invalid_address + pe_entry_ok: + cdq + test [format_flags],4 + jnz pe64_entry_type_ok + mov edx,[code_start] + sub eax,[edx+34h] + mov [edx+28h],eax + jmp instruction_assembled + pe64_entry: + call get_qword_value + mov bl,4 + bt [resolver_flags],0 + jc check_pe64_entry_label_type + xor bl,bl + check_pe64_entry_label_type: + cmp [value_type],bl + je pe64_entry_type_ok + call recoverable_invalid_address + pe64_entry_type_ok: + mov ecx,[code_start] + sub eax,[ecx+30h] + sbb edx,[ecx+34h] + jz pe64_entry_range_ok + call recoverable_overflow + pe64_entry_range_ok: + mov [ecx+28h],eax + jmp instruction_assembled +pe_stack: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],4 + jnz peplus_stack + call get_count_value + mov edx,[code_start] + mov [edx+60h],eax + cmp byte [esi],',' + jne default_stack_commit + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,[code_start] + mov [edx+64h],eax + cmp eax,[edx+60h] + ja value_out_of_range + jmp instruction_assembled + default_stack_commit: + mov dword [edx+64h],1000h + mov eax,[edx+60h] + cmp eax,1000h + ja instruction_assembled + mov dword [edx+64h],eax + jmp instruction_assembled + peplus_stack: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+60h],eax + mov [ecx+64h],edx + cmp byte [esi],',' + jne default_peplus_stack_commit + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+68h],eax + mov [ecx+6Ch],edx + cmp edx,[ecx+64h] + ja value_out_of_range + jb instruction_assembled + cmp eax,[ecx+60h] + ja value_out_of_range + jmp instruction_assembled + default_peplus_stack_commit: + mov dword [ecx+68h],1000h + cmp dword [ecx+64h],0 + jne instruction_assembled + mov eax,[ecx+60h] + cmp eax,1000h + ja instruction_assembled + mov dword [ecx+68h],eax + jmp instruction_assembled +pe_heap: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],4 + jnz peplus_heap + call get_count_value + mov edx,[code_start] + mov [edx+68h],eax + cmp byte [esi],',' + jne instruction_assembled + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,[code_start] + mov [edx+6Ch],eax + cmp eax,[edx+68h] + ja value_out_of_range + jmp instruction_assembled + peplus_heap: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+70h],eax + mov [ecx+74h],edx + cmp byte [esi],',' + jne instruction_assembled + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+78h],eax + mov [ecx+7Ch],edx + cmp edx,[ecx+74h] + ja value_out_of_range + jb instruction_assembled + cmp eax,[ecx+70h] + ja value_out_of_range + jmp instruction_assembled +mark_pe_relocation: + push eax ebx + test [format_flags],4 + jz check_standard_pe_relocation_type + cmp [value_type],4 + je pe_relocation_type_ok + check_standard_pe_relocation_type: + cmp [value_type],2 + je pe_relocation_type_ok + call recoverable_misuse + pe_relocation_type_ok: + mov ebx,[current_section] + mov eax,edi + sub eax,[ebx+14h] + add eax,[ebx+0Ch] + mov ebx,[free_additional_memory] + inc [number_of_relocations] + add ebx,5 + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + mov [ebx-5],eax + cmp [value_type],2 + je fixup_32bit + mov byte [ebx-1],0Ah + jmp fixup_ok + fixup_32bit: + mov byte [ebx-1],3 + fixup_ok: + pop ebx eax + ret +generate_pe_data: + cmp al,2 + je make_pe_resource + cmp al,5 + je make_pe_fixups + ret +make_pe_fixups: + mov edx,[code_start] + and byte [edx+16h],not 1 + or byte [edx+5Eh],40h + bts [resolver_flags],0 + jc fixups_ready + or [next_pass_needed],-1 + fixups_ready: + and [last_fixup_base],0 + call make_fixups + xchg eax,[actual_fixups_size] + sub eax,[actual_fixups_size] + ja reserve_forward_fixups + xor eax,eax + reserve_forward_fixups: + mov [reserved_fixups],edi + add edi,eax + mov [reserved_fixups_size],eax + ret + make_fixups: + push esi + xor ecx,ecx + xchg ecx,[number_of_relocations] + mov esi,[free_additional_memory] + lea eax,[ecx*5] + sub esi,eax + mov [free_additional_memory],esi + mov edx,[last_fixup_base] + mov ebx,[last_fixup_header] + mov ebp,edi + jecxz fixups_done + make_fixup: + cmp [esi],edx + jb store_fixup + mov eax,edi + sub eax,ebp + test eax,11b + jz fixups_block + xor ax,ax + stos word [edi] + add dword [ebx],2 + fixups_block: + mov eax,edx + add edx,1000h + cmp [esi],edx + jae fixups_block + stos dword [edi] + mov ebx,edi + mov eax,8 + stos dword [edi] + store_fixup: + add dword [ebx],2 + mov ah,[esi+1] + and ah,0Fh + mov al,[esi+4] + shl al,4 + or ah,al + mov al,[esi] + stos word [edi] + add esi,5 + loop make_fixup + fixups_done: + mov [last_fixup_base],edx + mov [last_fixup_header],ebx + pop esi + mov eax,edi + sub eax,ebp + ret +make_pe_resource: + cmp byte [esi],82h + jne resource_done + inc esi + lods word [esi] + cmp ax,'(' + jne invalid_argument + lods dword [esi] + mov edx,esi + lea esi,[esi+eax+1] + cmp [next_pass_needed],0 + je resource_from_file + cmp [current_pass],0 + jne reserve_space_for_resource + and [resource_size],0 + reserve_space_for_resource: + add edi,[resource_size] + cmp edi,[tagged_blocks] + ja out_of_memory + jmp resource_done + resource_from_file: + push esi + mov esi,edx + call open_binary_file + push ebx + mov esi,[free_additional_memory] + lea eax,[esi+20h] + cmp eax,[structures_buffer] + ja out_of_memory + mov edx,esi + mov ecx,20h + call read + jc invalid_file_format + xor eax,eax + cmp [esi],eax + jne invalid_file_format + mov ax,0FFFFh + cmp [esi+8],eax + jne invalid_file_format + cmp [esi+12],eax + jne invalid_file_format + mov eax,20h + cmp [esi+4],eax + jne invalid_file_format + read_resource_headers: + test eax,11b + jz resource_file_alignment_ok + mov edx,4 + and eax,11b + sub edx,eax + mov al,1 + call lseek + jc resource_headers_ok + resource_file_alignment_ok: + mov [esi],eax + lea edx,[esi+12] + mov ecx,8 + call read + jc resource_headers_ok + mov ecx,[esi+16] + add [esi],ecx + lea edx,[esi+20] + sub ecx,8 + mov [esi+16],ecx + lea eax,[edx+ecx] + cmp eax,[structures_buffer] + ja out_of_memory + call read + jc invalid_file_format + mov edx,[esi] + add edx,[esi+12] + mov eax,[esi+16] + lea ecx,[esi+20] + lea esi,[ecx+eax] + add ecx,2 + cmp word [ecx-2],0FFFFh + je resource_header_type_ok + check_resource_header_type: + cmp ecx,esi + jae invalid_file_format + cmp word [ecx],0 + je resource_header_type_ok + add ecx,2 + jmp check_resource_header_type + resource_header_type_ok: + add ecx,2 + cmp word [ecx],0FFFFh + je resource_header_name_ok + check_resource_header_name: + cmp ecx,esi + jae invalid_file_format + cmp word [ecx],0 + je resource_header_name_ok + add ecx,2 + jmp check_resource_header_name + resource_header_name_ok: + xor al,al + call lseek + jnc read_resource_headers + resource_headers_ok: + cmp esi,[free_additional_memory] + je invalid_file_format + xor eax,eax + mov [esi],eax + mov [resource_data],edi + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + xor ebx,ebx + make_type_name_directory: + mov esi,[free_additional_memory] + xor edx,edx + find_type_name: + cmp dword [esi],0 + je type_name_ok + add esi,20 + cmp word [esi],0FFFFh + je check_next_type_name + or ebx,ebx + jz check_this_type_name + xor ecx,ecx + compare_with_previous_type_name: + mov ax,[esi+ecx] + cmp ax,[ebx+ecx] + ja check_this_type_name + jb check_next_type_name + add ecx,2 + mov ax,[esi+ecx] + or ax,[ebx+ecx] + jnz compare_with_previous_type_name + jmp check_next_type_name + check_this_type_name: + or edx,edx + jz type_name_found + xor ecx,ecx + compare_with_current_type_name: + mov ax,[esi+ecx] + cmp ax,[edx+ecx] + ja check_next_type_name + jb type_name_found + add ecx,2 + mov ax,[esi+ecx] + or ax,[edx+ecx] + jnz compare_with_current_type_name + jmp same_type_name + type_name_found: + mov edx,esi + same_type_name: + mov [esi-16],edi + check_next_type_name: + mov eax,[esi-4] + add esi,eax + jmp find_type_name + type_name_ok: + or edx,edx + jz type_name_directory_done + mov ebx,edx + make_type_name_entry: + mov eax,[resource_data] + inc word [eax+12] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_type_name_directory + type_name_directory_done: + mov ebx,-1 + make_type_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_type_id: + cmp dword [esi],0 + je type_id_ok + add esi,20 + cmp word [esi],0FFFFh + jne check_next_type_id + movzx eax,word [esi+2] + cmp eax,ebx + jle check_next_type_id + cmp eax,edx + jg check_next_type_id + mov edx,eax + mov [esi-16],edi + check_next_type_id: + mov eax,[esi-4] + add esi,eax + jmp find_type_id + type_id_ok: + cmp edx,10000h + je type_id_directory_done + mov ebx,edx + make_type_id_entry: + mov eax,[resource_data] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_type_id_directory + type_id_directory_done: + mov esi,[resource_data] + add esi,10h + mov ecx,[esi-4] + or cx,cx + jz resource_directories_ok + make_resource_directories: + push ecx + push edi + mov edx,edi + sub edx,[resource_data] + bts edx,31 + mov [esi+4],edx + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + mov ebp,esi + xor ebx,ebx + make_resource_name_directory: + mov esi,[free_additional_memory] + xor edx,edx + find_resource_name: + cmp dword [esi],0 + je resource_name_ok + push esi + cmp [esi+4],ebp + jne check_next_resource_name + add esi,20 + call skip_resource_name + cmp word [esi],0FFFFh + je check_next_resource_name + or ebx,ebx + jz check_this_resource_name + xor ecx,ecx + compare_with_previous_resource_name: + mov ax,[esi+ecx] + cmp ax,[ebx+ecx] + ja check_this_resource_name + jb check_next_resource_name + add ecx,2 + mov ax,[esi+ecx] + or ax,[ebx+ecx] + jnz compare_with_previous_resource_name + jmp check_next_resource_name + skip_resource_name: + cmp word [esi],0FFFFh + jne skip_unicode_string + add esi,4 + ret + skip_unicode_string: + add esi,2 + cmp word [esi-2],0 + jne skip_unicode_string + ret + check_this_resource_name: + or edx,edx + jz resource_name_found + xor ecx,ecx + compare_with_current_resource_name: + mov ax,[esi+ecx] + cmp ax,[edx+ecx] + ja check_next_resource_name + jb resource_name_found + add ecx,2 + mov ax,[esi+ecx] + or ax,[edx+ecx] + jnz compare_with_current_resource_name + jmp same_resource_name + resource_name_found: + mov edx,esi + same_resource_name: + mov eax,[esp] + mov [eax+8],edi + check_next_resource_name: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_resource_name + resource_name_ok: + or edx,edx + jz resource_name_directory_done + mov ebx,edx + make_resource_name_entry: + mov eax,[esp] + inc word [eax+12] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_resource_name_directory + resource_name_directory_done: + mov ebx,-1 + make_resource_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_resource_id: + cmp dword [esi],0 + je resource_id_ok + push esi + cmp [esi+4],ebp + jne check_next_resource_id + add esi,20 + call skip_resource_name + cmp word [esi],0FFFFh + jne check_next_resource_id + movzx eax,word [esi+2] + cmp eax,ebx + jle check_next_resource_id + cmp eax,edx + jg check_next_resource_id + mov edx,eax + mov eax,[esp] + mov [eax+8],edi + check_next_resource_id: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_resource_id + resource_id_ok: + cmp edx,10000h + je resource_id_directory_done + mov ebx,edx + make_resource_id_entry: + mov eax,[esp] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_resource_id_directory + resource_id_directory_done: + pop eax + mov esi,ebp + pop ecx + add esi,8 + dec cx + jnz make_resource_directories + resource_directories_ok: + shr ecx,16 + jnz make_resource_directories + mov esi,[resource_data] + add esi,10h + movzx eax,word [esi-4] + movzx edx,word [esi-2] + add eax,edx + lea esi,[esi+eax*8] + push edi ; address of language directories + update_resource_directories: + cmp esi,[esp] + je resource_directories_updated + add esi,10h + mov ecx,[esi-4] + or cx,cx + jz language_directories_ok + make_language_directories: + push ecx + push edi + mov edx,edi + sub edx,[resource_data] + bts edx,31 + mov [esi+4],edx + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + mov ebp,esi + mov ebx,-1 + make_language_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_language_id: + cmp dword [esi],0 + je language_id_ok + push esi + cmp [esi+8],ebp + jne check_next_language_id + add esi,20 + mov eax,esi + call skip_resource_name + call skip_resource_name + neg eax + add eax,esi + and eax,11b + add esi,eax + get_language_id: + movzx eax,word [esi+6] + cmp eax,ebx + jle check_next_language_id + cmp eax,edx + jge check_next_language_id + mov edx,eax + mov eax,[esp] + mov dword [value],eax + check_next_language_id: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_language_id + language_id_ok: + cmp edx,10000h + je language_id_directory_done + mov ebx,edx + make_language_id_entry: + mov eax,[esp] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,ebx + stos dword [edi] + mov eax,dword [value] + stos dword [edi] + jmp make_language_id_directory + language_id_directory_done: + pop eax + mov esi,ebp + pop ecx + add esi,8 + dec cx + jnz make_language_directories + language_directories_ok: + shr ecx,16 + jnz make_language_directories + jmp update_resource_directories + resource_directories_updated: + mov esi,[resource_data] + push edi + make_name_strings: + add esi,10h + movzx eax,word [esi-2] + movzx ecx,word [esi-4] + add eax,ecx + lea eax,[esi+eax*8] + push eax + or ecx,ecx + jz string_entries_processed + process_string_entries: + push ecx + mov edx,edi + sub edx,[resource_data] + bts edx,31 + xchg [esi],edx + mov ebx,edi + xor ax,ax + stos word [edi] + copy_string_data: + lea eax,[edi+2] + cmp eax,[tagged_blocks] + jae out_of_memory + mov ax,[edx] + or ax,ax + jz string_data_copied + stos word [edi] + inc word [ebx] + add edx,2 + jmp copy_string_data + string_data_copied: + add esi,8 + pop ecx + loop process_string_entries + string_entries_processed: + pop esi + cmp esi,[esp] + jb make_name_strings + mov eax,edi + sub eax,[resource_data] + test al,11b + jz resource_strings_alignment_ok + xor ax,ax + stos word [edi] + resource_strings_alignment_ok: + pop edx + pop ebx ; address of language directories + mov ebp,edi + update_language_directories: + add ebx,10h + movzx eax,word [ebx-2] + movzx ecx,word [ebx-4] + add ecx,eax + make_data_records: + push ecx + mov esi,edi + sub esi,[resource_data] + xchg esi,[ebx+4] + lea eax,[edi+16] + cmp eax,[tagged_blocks] + jae out_of_memory + mov eax,esi + stos dword [edi] + mov eax,[esi+12] + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + pop ecx + add ebx,8 + loop make_data_records + cmp ebx,edx + jb update_language_directories + pop ebx ; file handle + mov esi,ebp + mov ebp,edi + update_data_records: + push ebp + mov ecx,edi + mov eax,[current_section] + sub ecx,[eax+14h] + add ecx,[eax+0Ch] + xchg ecx,[esi] + mov edx,[ecx] + xor al,al + call lseek + mov edx,edi + mov ecx,[esi+4] + add edi,ecx + cmp edi,[tagged_blocks] + ja out_of_memory + call read + mov eax,edi + sub eax,[resource_data] + and eax,11b + jz resource_data_alignment_ok + mov ecx,4 + sub ecx,eax + xor al,al + rep stos byte [edi] + resource_data_alignment_ok: + pop ebp + add esi,16 + cmp esi,ebp + jb update_data_records + pop esi + call close + mov eax,edi + sub eax,[resource_data] + mov [resource_size],eax + resource_done: + ret +close_pe: + call close_pe_section + mov edx,[code_start] + mov [edx+50h],eax + call make_timestamp + mov edx,[code_start] + mov [edx+8],eax + mov eax,[number_of_sections] + mov [edx+6],ax + imul eax,28h + movzx ecx,word [edx+14h] + lea eax,[eax+18h+ecx] + add eax,[stub_size] + mov ecx,[edx+3Ch] + dec ecx + add eax,ecx + not ecx + and eax,ecx + cmp eax,[edx+54h] + je pe_sections_ok + or [next_pass_needed],-1 + pe_sections_ok: + xor ecx,ecx + add edx,78h + test [format_flags],4 + jz process_directories + add edx,10h + process_directories: + mov eax,[edx+ecx*8] + or eax,eax + jz directory_ok + cmp dword [edx+ecx*8+4],-1 + jne directory_ok + section_data: + mov ebx,[edx+ecx*8] + mov eax,[ebx+0Ch] + mov [edx+ecx*8],eax ; directory rva + mov eax,[ebx+8] + mov [edx+ecx*8+4],eax ; directory size + directory_ok: + inc cl + cmp cl,10h + jb process_directories + cmp dword [edx+5*8],0 + jne finish_pe_relocations + mov eax,[number_of_relocations] + shl eax,2 + sub [free_additional_memory],eax + btr [resolver_flags],0 + jnc pe_relocations_ok + or [next_pass_needed],-1 + jmp pe_relocations_ok + finish_pe_relocations: + push edi + mov edi,[reserved_fixups] + call make_fixups + pop edi + add [actual_fixups_size],eax + cmp eax,[reserved_fixups_size] + je pe_relocations_ok + or [next_pass_needed],-1 + pe_relocations_ok: + mov ebx,[code_start] + sub ebx,[stub_size] + mov ecx,edi + sub ecx,ebx + mov ebp,ecx + shr ecx,1 + xor eax,eax + cdq + calculate_checksum: + mov dx,[ebx] + add eax,edx + mov dx,ax + shr eax,16 + add eax,edx + add ebx,2 + loop calculate_checksum + add eax,ebp + mov ebx,[code_start] + mov [ebx+58h],eax + ret + +format_coff: + mov eax,[additional_memory] + mov [symbols_stream],eax + mov ebx,eax + add eax,20h + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [ebx],al + mov [ebx+4],eax + mov [ebx+8],edi + mov al,4 + mov [ebx+10h],eax + mov al,60h + bt [format_flags],0 + jnc flat_section_flags_ok + or eax,0E0000000h + flat_section_flags_ok: + mov dword [ebx+14h],eax + mov [current_section],ebx + xor eax,eax + mov [number_of_sections],eax + mov edx,ebx + call init_addressing_space + mov [ebx+14h],edx + mov byte [ebx+9],2 + mov [code_type],32 + test [format_flags],8 + jz format_defined + mov byte [ebx+9],4 + mov [code_type],64 + jmp format_defined +coff_section: + call close_coff_section + mov ebx,[free_additional_memory] + lea eax,[ebx+20h] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov [current_section],ebx + inc [number_of_sections] + xor eax,eax + mov [ebx],al + mov [ebx+8],edi + mov [ebx+10h],eax + mov [ebx+14h],eax + mov edx,ebx + call create_addressing_space + xchg edx,ebx + mov [edx+14h],ebx + mov byte [edx+9],2 + test [format_flags],8 + jz coff_labels_type_ok + mov byte [edx+9],4 + coff_labels_type_ok: + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + cmp ecx,8 + ja name_too_long + coff_section_flags: + cmp byte [esi],8Ch + je coff_section_alignment + cmp byte [esi],19h + jne coff_section_settings_ok + inc esi + lods byte [esi] + bt [format_flags],0 + jc coff_section_flag_ok + cmp al,7 + ja invalid_argument + coff_section_flag_ok: + mov cl,al + mov eax,1 + shl eax,cl + test dword [ebx+14h],eax + jnz setting_already_specified + or dword [ebx+14h],eax + jmp coff_section_flags + coff_section_alignment: + bt [format_flags],0 + jnc invalid_argument + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + dec edx + test eax,edx + jnz invalid_value + or eax,eax + jz invalid_value + cmp eax,2000h + ja invalid_value + bsf edx,eax + inc edx + shl edx,20 + or [ebx+14h],edx + xchg [ebx+10h],eax + or eax,eax + jnz setting_already_specified + jmp coff_section_flags + coff_section_settings_ok: + cmp dword [ebx+10h],0 + jne instruction_assembled + mov dword [ebx+10h],4 + bt [format_flags],0 + jnc instruction_assembled + or dword [ebx+14h],300000h + jmp instruction_assembled + close_coff_section: + mov ebx,[current_section] + mov eax,edi + mov edx,[ebx+8] + sub eax,edx + mov [ebx+0Ch],eax + xor eax,eax + xchg [undefined_data_end],eax + cmp eax,edi + jne coff_section_ok + cmp edx,[undefined_data_start] + jne coff_section_ok + mov edi,edx + or byte [ebx+14h],80h + coff_section_ok: + ret +mark_coff_relocation: + cmp [value_type],3 + je coff_relocation_relative + push ebx eax + test [format_flags],8 + jnz coff_64bit_relocation + mov al,6 + cmp [value_type],2 + je coff_relocation + cmp [value_type],5 + jne invalid_use_of_symbol + inc al + jmp coff_relocation + coff_64bit_relocation: + mov al,1 + cmp [value_type],4 + je coff_relocation + mov al,2 + cmp [value_type],2 + je coff_relocation + cmp [value_type],5 + jne invalid_use_of_symbol + inc al + jmp coff_relocation + coff_relocation_relative: + push ebx + bt [format_flags],0 + jnc relative_ok + mov ebx,[current_section] + mov ebx,[ebx+8] + sub ebx,edi + sub eax,ebx + add eax,4 + relative_ok: + mov ebx,[addressing_space] + push eax + mov al,20 + test [format_flags],8 + jnz relative_coff_64bit_relocation + cmp byte [ebx+9],2 + jne invalid_use_of_symbol + jmp coff_relocation + relative_coff_64bit_relocation: + mov al,4 + cmp byte [ebx+9],4 + jne invalid_use_of_symbol + coff_relocation: + mov ebx,[free_additional_memory] + add ebx,0Ch + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + mov byte [ebx-0Ch],al + mov eax,[current_section] + mov eax,[eax+8] + neg eax + add eax,edi + mov [ebx-0Ch+4],eax + mov eax,[symbol_identifier] + mov [ebx-0Ch+8],eax + pop eax ebx + ret +close_coff: + call close_coff_section + cmp [next_pass_needed],0 + je coff_closed + mov eax,[symbols_stream] + mov [free_additional_memory],eax + coff_closed: + ret +coff_formatter: + sub edi,[code_start] + mov [code_size],edi + call prepare_default_section + mov edi,[free_additional_memory] + mov ebx,edi + mov ecx,28h shr 2 + imul ecx,[number_of_sections] + add ecx,14h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[structures_buffer] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov word [ebx],14Ch + test [format_flags],8 + jz coff_magic_ok + mov word [ebx],8664h + coff_magic_ok: + mov word [ebx+12h],104h + bt [format_flags],0 + jnc coff_flags_ok + or byte [ebx+12h],80h + coff_flags_ok: + push ebx + call make_timestamp + pop ebx + mov [ebx+4],eax + mov eax,[number_of_sections] + mov [ebx+2],ax + mov esi,[symbols_stream] + xor eax,eax + xor ecx,ecx + enumerate_symbols: + cmp esi,[free_additional_memory] + je symbols_enumerated + mov dl,[esi] + or dl,dl + jz enumerate_section + cmp dl,0C0h + jae enumerate_public + cmp dl,80h + jae enumerate_extrn + add esi,0Ch + jmp enumerate_symbols + enumerate_section: + mov edx,eax + shl edx,8 + mov [esi],edx + inc eax + inc ecx + mov [esi+1Eh],cx + add esi,20h + jmp enumerate_symbols + enumerate_public: + mov edx,eax + shl edx,8 + mov dl,[esi] + mov [esi],edx + mov edx,[esi+8] + add esi,10h + inc eax + cmp byte [edx+11],0 + je enumerate_symbols + mov edx,[edx+20] + cmp byte [edx],0C0h + jae enumerate_symbols + cmp byte [edx],80h + jb enumerate_symbols + inc eax + jmp enumerate_symbols + enumerate_extrn: + mov edx,eax + shl edx,8 + mov dl,[esi] + mov [esi],edx + add esi,0Ch + inc eax + jmp enumerate_symbols + prepare_default_section: + mov ebx,[symbols_stream] + cmp dword [ebx+0Ch],0 + jne default_section_ok + cmp [number_of_sections],0 + je default_section_ok + mov edx,ebx + find_references_to_default_section: + cmp ebx,[free_additional_memory] + jne check_reference + add [symbols_stream],20h + ret + check_reference: + mov al,[ebx] + or al,al + jz skip_other_section + cmp al,0C0h + jae check_public_reference + cmp al,80h + jae next_reference + cmp edx,[ebx+8] + je default_section_ok + next_reference: + add ebx,0Ch + jmp find_references_to_default_section + check_public_reference: + mov eax,[ebx+8] + add ebx,10h + test byte [eax+8],1 + jz find_references_to_default_section + mov cx,[current_pass] + cmp cx,[eax+16] + jne find_references_to_default_section + cmp edx,[eax+20] + je default_section_ok + jmp find_references_to_default_section + skip_other_section: + add ebx,20h + jmp find_references_to_default_section + default_section_ok: + inc [number_of_sections] + ret + symbols_enumerated: + mov [ebx+0Ch],eax + mov ebp,edi + sub ebp,ebx + push ebp + lea edi,[ebx+14h] + mov esi,[symbols_stream] + find_section: + cmp esi,[free_additional_memory] + je sections_finished + mov al,[esi] + or al,al + jz section_found + add esi,0Ch + cmp al,0C0h + jb find_section + add esi,4 + jmp find_section + section_found: + push esi edi + mov esi,[esi+4] + or esi,esi + jz default_section + mov ecx,[esi] + add esi,4 + rep movs byte [edi],[esi] + jmp section_name_ok + default_section: + mov al,'.' + stos byte [edi] + mov eax,'flat' + stos dword [edi] + section_name_ok: + pop edi esi + mov eax,[esi+0Ch] + mov [edi+10h],eax + mov eax,[esi+14h] + mov [edi+24h],eax + test al,80h + jnz section_ptr_ok + mov eax,[esi+8] + sub eax,[code_start] + add eax,ebp + mov [edi+14h],eax + section_ptr_ok: + mov ebx,[code_start] + mov edx,[code_size] + add ebx,edx + add edx,ebp + xor ecx,ecx + add esi,20h + find_relocations: + cmp esi,[free_additional_memory] + je section_relocations_done + mov al,[esi] + or al,al + jz section_relocations_done + cmp al,80h + jb add_relocation + cmp al,0C0h + jb next_relocation + add esi,10h + jmp find_relocations + add_relocation: + lea eax,[ebx+0Ah] + cmp eax,[tagged_blocks] + ja out_of_memory + mov eax,[esi+4] + mov [ebx],eax + mov eax,[esi+8] + mov eax,[eax] + shr eax,8 + mov [ebx+4],eax + movzx ax,byte [esi] + mov [ebx+8],ax + add ebx,0Ah + inc ecx + next_relocation: + add esi,0Ch + jmp find_relocations + section_relocations_done: + cmp ecx,10000h + jb section_relocations_count_16bit + bt [format_flags],0 + jnc format_limitations_exceeded + mov word [edi+20h],0FFFFh + or dword [edi+24h],1000000h + mov [edi+18h],edx + push esi edi + push ecx + lea esi,[ebx-1] + add ebx,0Ah + lea edi,[ebx-1] + imul ecx,0Ah + std + rep movs byte [edi],[esi] + cld + pop ecx + inc esi + inc ecx + mov [esi],ecx + xor eax,eax + mov [esi+4],eax + mov [esi+8],ax + pop edi esi + jmp section_relocations_ok + section_relocations_count_16bit: + mov [edi+20h],cx + jcxz section_relocations_ok + mov [edi+18h],edx + section_relocations_ok: + sub ebx,[code_start] + mov [code_size],ebx + add edi,28h + jmp find_section + sections_finished: + mov edx,[free_additional_memory] + mov ebx,[code_size] + add ebp,ebx + mov [edx+8],ebp + add ebx,[code_start] + mov edi,ebx + mov ecx,[edx+0Ch] + imul ecx,12h shr 1 + xor eax,eax + shr ecx,1 + jnc zero_symbols_table + stos word [edi] + zero_symbols_table: + rep stos dword [edi] + mov edx,edi + stos dword [edi] + mov esi,[symbols_stream] + make_symbols_table: + cmp esi,[free_additional_memory] + je symbols_table_ok + mov al,[esi] + cmp al,0C0h + jae add_public_symbol + cmp al,80h + jae add_extrn_symbol + or al,al + jz add_section_symbol + add esi,0Ch + jmp make_symbols_table + add_section_symbol: + call store_symbol_name + movzx eax,word [esi+1Eh] + mov [ebx+0Ch],ax + mov byte [ebx+10h],3 + add esi,20h + add ebx,12h + jmp make_symbols_table + add_extrn_symbol: + call store_symbol_name + mov byte [ebx+10h],2 + add esi,0Ch + add ebx,12h + jmp make_symbols_table + add_public_symbol: + call store_symbol_name + mov eax,[esi+0Ch] + mov [current_line],eax + mov eax,[esi+8] + test byte [eax+8],1 + jz undefined_coff_public + mov cx,[current_pass] + cmp cx,[eax+16] + jne undefined_coff_public + mov cl,[eax+11] + or cl,cl + jz public_constant + test [format_flags],8 + jnz check_64bit_public_symbol + cmp cl,2 + je public_symbol_type_ok + jmp invalid_use_of_symbol + undefined_coff_public: + mov [error_info],eax + jmp undefined_symbol + check_64bit_public_symbol: + cmp cl,4 + jne invalid_use_of_symbol + public_symbol_type_ok: + mov ecx,[eax+20] + cmp byte [ecx],80h + je alias_symbol + cmp byte [ecx],0 + jne invalid_use_of_symbol + mov cx,[ecx+1Eh] + mov [ebx+0Ch],cx + public_symbol_section_ok: + movzx ecx,byte [eax+9] + shr cl,1 + and cl,1 + neg ecx + cmp ecx,[eax+4] + jne value_out_of_range + xor ecx,[eax] + js value_out_of_range + mov eax,[eax] + mov [ebx+8],eax + mov al,2 + cmp byte [esi],0C0h + je store_symbol_class + inc al + cmp byte [esi],0C1h + je store_symbol_class + mov al,105 + store_symbol_class: + mov byte [ebx+10h],al + add esi,10h + add ebx,12h + jmp make_symbols_table + alias_symbol: + bt [format_flags],0 + jnc invalid_use_of_symbol + mov ecx,[eax] + or ecx,[eax+4] + jnz invalid_use_of_symbol + mov byte [ebx+10h],69h + mov byte [ebx+11h],1 + add ebx,12h + mov ecx,[eax+20] + mov ecx,[ecx] + shr ecx,8 + mov [ebx],ecx + mov byte [ebx+4],3 + add esi,10h + add ebx,12h + jmp make_symbols_table + public_constant: + mov word [ebx+0Ch],0FFFFh + jmp public_symbol_section_ok + symbols_table_ok: + mov eax,edi + sub eax,edx + mov [edx],eax + sub edi,[code_start] + mov [code_size],edi + and [written_size],0 + mov edx,[output_file] + call create + jc write_failed + mov edx,[free_additional_memory] + pop ecx + add [written_size],ecx + call write + jc write_failed + jmp write_output + store_symbol_name: + push esi + mov esi,[esi+4] + or esi,esi + jz default_name + lods dword [esi] + mov ecx,eax + cmp ecx,8 + ja add_string + push edi + mov edi,ebx + rep movs byte [edi],[esi] + pop edi esi + ret + default_name: + mov dword [ebx],'.fla' + mov dword [ebx+4],'t' + pop esi + ret + add_string: + mov eax,edi + sub eax,edx + mov [ebx+4],eax + inc ecx + rep movs byte [edi],[esi] + pop esi + ret + +format_elf: + test [format_flags],8 + jnz format_elf64 + mov edx,edi + mov ecx,34h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov dword [edx],7Fh + 'ELF' shl 8 + mov al,1 + mov [edx+4],al + mov [edx+5],al + mov [edx+6],al + mov [edx+14h],al + mov byte [edx+12h],3 + mov byte [edx+28h],34h + mov byte [edx+2Eh],28h + mov [code_type],32 + cmp word [esi],1D19h + je format_elf_exe + elf_header_ok: + mov byte [edx+10h],1 + mov eax,[additional_memory] + mov [symbols_stream],eax + mov ebx,eax + add eax,20h + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [current_section],ebx + mov [number_of_sections],eax + mov [ebx],al + mov [ebx+4],eax + mov [ebx+8],edi + mov al,111b + mov [ebx+14h],eax + mov al,4 + mov [ebx+10h],eax + mov edx,ebx + call init_addressing_space + xchg edx,ebx + mov [edx+14h],ebx + mov byte [edx+9],2 + test [format_flags],8 + jz format_defined + mov byte [edx+9],4 + mov byte [ebx+10h],8 + jmp format_defined + format_elf64: + mov edx,edi + mov ecx,40h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[tagged_blocks] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov dword [edx],7Fh + 'ELF' shl 8 + mov al,1 + mov [edx+5],al + mov [edx+6],al + mov [edx+14h],al + mov byte [edx+4],2 + mov byte [edx+12h],62 + mov byte [edx+34h],40h + mov byte [edx+3Ah],40h + mov [code_type],64 + cmp word [esi],1D19h + jne elf_header_ok + jmp format_elf64_exe +elf_section: + bt [format_flags],0 + jc illegal_instruction + call close_coff_section + mov ebx,[free_additional_memory] + lea eax,[ebx+20h] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov [current_section],ebx + inc word [number_of_sections] + jz format_limitations_exceeded + xor eax,eax + mov [ebx],al + mov [ebx+8],edi + mov [ebx+10h],eax + mov al,10b + mov [ebx+14h],eax + mov edx,ebx + call create_addressing_space + xchg edx,ebx + mov [edx+14h],ebx + mov byte [edx+9],2 + test [format_flags],8 + jz elf_labels_type_ok + mov byte [edx+9],4 + elf_labels_type_ok: + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + elf_section_flags: + cmp byte [esi],8Ch + je elf_section_alignment + cmp byte [esi],19h + jne elf_section_settings_ok + inc esi + lods byte [esi] + sub al,28 + xor al,11b + test al,not 10b + jnz invalid_argument + mov cl,al + mov al,1 + shl al,cl + test byte [ebx+14h],al + jnz setting_already_specified + or byte [ebx+14h],al + jmp elf_section_flags + elf_section_alignment: + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + dec edx + test eax,edx + jnz invalid_value + or eax,eax + jz invalid_value + xchg [ebx+10h],eax + or eax,eax + jnz setting_already_specified + jmp elf_section_flags + elf_section_settings_ok: + cmp dword [ebx+10h],0 + jne instruction_assembled + mov dword [ebx+10h],4 + test [format_flags],8 + jz instruction_assembled + mov byte [ebx+10h],8 + jmp instruction_assembled +mark_elf_relocation: + push ebx + mov ebx,[addressing_space] + cmp [value_type],3 + je elf_relocation_relative + cmp [value_type],7 + je elf_relocation_relative + push eax + cmp [value_type],5 + je elf_gotoff_relocation + ja invalid_use_of_symbol + mov al,1 ; R_386_32 / R_AMD64_64 + test [format_flags],8 + jz coff_relocation + cmp [value_type],4 + je coff_relocation + mov al,11 ; R_AMD64_32S + jmp coff_relocation + elf_gotoff_relocation: + test [format_flags],8 + jnz invalid_use_of_symbol + mov al,9 ; R_386_GOTOFF + jmp coff_relocation + elf_relocation_relative: + cmp byte [ebx+9],0 + je invalid_use_of_symbol + mov ebx,[current_section] + mov ebx,[ebx+8] + sub ebx,edi + sub eax,ebx + push eax + mov al,2 ; R_386_PC32 / R_AMD64_PC32 + cmp [value_type],3 + je coff_relocation + mov al,4 ; R_386_PLT32 / R_AMD64_PLT32 + jmp coff_relocation +close_elf: + bt [format_flags],0 + jc close_elf_exe + call close_coff_section + cmp [next_pass_needed],0 + je elf_closed + mov eax,[symbols_stream] + mov [free_additional_memory],eax + elf_closed: + ret +elf_formatter: + mov ecx,edi + sub ecx,[code_start] + neg ecx + and ecx,111b + test [format_flags],8 + jnz align_elf_structures + and ecx,11b + align_elf_structures: + xor al,al + rep stos byte [edi] + push edi + call prepare_default_section + mov esi,[symbols_stream] + mov edi,[free_additional_memory] + xor eax,eax + mov ecx,4 + rep stos dword [edi] + test [format_flags],8 + jz find_first_section + mov ecx,2 + rep stos dword [edi] + find_first_section: + mov al,[esi] + or al,al + jz first_section_found + cmp al,0C0h + jb skip_other_symbol + add esi,4 + skip_other_symbol: + add esi,0Ch + jmp find_first_section + first_section_found: + mov ebx,esi + mov ebp,esi + add esi,20h + xor ecx,ecx + xor edx,edx + find_next_section: + cmp esi,[free_additional_memory] + je make_section_symbol + mov al,[esi] + or al,al + jz make_section_symbol + cmp al,0C0h + jae skip_public + cmp al,80h + jae skip_extrn + or byte [ebx+14h],40h + skip_extrn: + add esi,0Ch + jmp find_next_section + skip_public: + add esi,10h + jmp find_next_section + make_section_symbol: + mov eax,edi + xchg eax,[ebx+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_section_symbol + xor eax,eax + stos dword [edi] + stos dword [edi] + call store_section_index + jmp section_symbol_ok + store_section_index: + inc ecx + mov eax,ecx + shl eax,8 + mov [ebx],eax + inc dx + jz format_limitations_exceeded + mov eax,edx + shl eax,16 + mov al,3 + test byte [ebx+14h],40h + jz section_index_ok + or ah,-1 + inc dx + jz format_limitations_exceeded + section_index_ok: + stos dword [edi] + ret + elf64_section_symbol: + call store_section_index + xor eax,eax + stos dword [edi] + stos dword [edi] + stos dword [edi] + stos dword [edi] + section_symbol_ok: + mov ebx,esi + add esi,20h + cmp ebx,[free_additional_memory] + jne find_next_section + inc dx + jz format_limitations_exceeded + mov [current_section],edx + mov esi,[symbols_stream] + find_other_symbols: + cmp esi,[free_additional_memory] + je elf_symbol_table_ok + mov al,[esi] + or al,al + jz skip_section + cmp al,0C0h + jae make_public_symbol + cmp al,80h + jae make_extrn_symbol + add esi,0Ch + jmp find_other_symbols + skip_section: + add esi,20h + jmp find_other_symbols + make_public_symbol: + mov eax,[esi+0Ch] + mov [current_line],eax + cmp byte [esi],0C0h + jne invalid_argument + mov ebx,[esi+8] + test byte [ebx+8],1 + jz undefined_public + mov ax,[current_pass] + cmp ax,[ebx+16] + jne undefined_public + mov dl,[ebx+11] + or dl,dl + jz public_absolute + mov eax,[ebx+20] + cmp byte [eax],0 + jne invalid_use_of_symbol + mov eax,[eax+4] + test [format_flags],8 + jnz elf64_public + cmp dl,2 + jne invalid_use_of_symbol + mov dx,[eax+0Eh] + jmp section_for_public_ok + undefined_public: + mov [error_info],ebx + jmp undefined_symbol + elf64_public: + cmp dl,4 + jne invalid_use_of_symbol + mov dx,[eax+6] + jmp section_for_public_ok + public_absolute: + mov dx,0FFF1h + section_for_public_ok: + mov eax,[esi+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_public_symbol + movzx eax,byte [ebx+9] + shr al,1 + and al,1 + neg eax + cmp eax,[ebx+4] + jne value_out_of_range + xor eax,[ebx] + js value_out_of_range + mov eax,[ebx] + stos dword [edi] + xor eax,eax + mov al,[ebx+10] + stos dword [edi] + mov eax,edx + shl eax,16 + mov al,10h + cmp byte [ebx+10],0 + je elf_public_function + or al,1 + jmp store_elf_public_info + elf_public_function: + or al,2 + store_elf_public_info: + stos dword [edi] + jmp public_symbol_ok + elf64_public_symbol: + mov eax,edx + shl eax,16 + mov al,10h + cmp byte [ebx+10],0 + je elf64_public_function + or al,1 + jmp store_elf64_public_info + elf64_public_function: + or al,2 + store_elf64_public_info: + stos dword [edi] + mov al,[ebx+9] + shl eax,31-1 + xor eax,[ebx+4] + js value_out_of_range + mov eax,[ebx] + stos dword [edi] + mov eax,[ebx+4] + stos dword [edi] + mov al,[ebx+10] + stos dword [edi] + xor al,al + stos dword [edi] + public_symbol_ok: + inc ecx + mov eax,ecx + shl eax,8 + mov al,0C0h + mov [esi],eax + add esi,10h + jmp find_other_symbols + make_extrn_symbol: + mov eax,[esi+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_extrn_symbol + xor eax,eax + stos dword [edi] + mov eax,[esi+8] + stos dword [edi] + mov eax,10h + stos dword [edi] + jmp extrn_symbol_ok + elf64_extrn_symbol: + mov eax,10h + stos dword [edi] + xor al,al + stos dword [edi] + stos dword [edi] + mov eax,[esi+8] + stos dword [edi] + xor eax,eax + stos dword [edi] + extrn_symbol_ok: + inc ecx + mov eax,ecx + shl eax,8 + mov al,80h + mov [esi],eax + add esi,0Ch + jmp find_other_symbols + elf_symbol_table_ok: + mov edx,edi + mov ebx,[free_additional_memory] + xor al,al + stos byte [edi] + add edi,16 + mov [edx+1],edx + add ebx,10h + test [format_flags],8 + jz make_string_table + add ebx,8 + make_string_table: + cmp ebx,edx + je elf_string_table_ok + test [format_flags],8 + jnz make_elf64_string + cmp byte [ebx+0Dh],0 + je rel_prefix_ok + mov byte [ebx+0Dh],0 + mov eax,'.rel' + stos dword [edi] + rel_prefix_ok: + mov esi,edi + sub esi,edx + xchg esi,[ebx] + add ebx,10h + make_elf_string: + or esi,esi + jz default_string + lods dword [esi] + mov ecx,eax + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + jmp make_string_table + make_elf64_string: + cmp byte [ebx+5],0 + je elf64_rel_prefix_ok + mov byte [ebx+5],0 + mov eax,'.rel' + stos dword [edi] + mov al,'a' + stos byte [edi] + elf64_rel_prefix_ok: + mov esi,edi + sub esi,edx + xchg esi,[ebx] + add ebx,18h + jmp make_elf_string + default_string: + mov eax,'.fla' + stos dword [edi] + mov ax,'t' + stos word [edi] + jmp make_string_table + elf_string_table_ok: + mov [edx+1+8],edi + mov ebx,[code_start] + mov eax,edi + sub eax,[free_additional_memory] + xor ecx,ecx + sub ecx,eax + test [format_flags],8 + jnz finish_elf64_header + and ecx,11b + add eax,ecx + mov [ebx+20h],eax + mov eax,[current_section] + inc ax + jz format_limitations_exceeded + mov [ebx+32h],ax + inc ax + jz format_limitations_exceeded + mov [ebx+30h],ax + jmp elf_header_finished + finish_elf64_header: + and ecx,111b + add eax,ecx + mov [ebx+28h],eax + mov eax,[current_section] + inc ax + jz format_limitations_exceeded + mov [ebx+3Eh],ax + inc ax + jz format_limitations_exceeded + mov [ebx+3Ch],ax + elf_header_finished: + xor eax,eax + add ecx,10*4 + rep stos byte [edi] + test [format_flags],8 + jz elf_null_section_ok + mov ecx,6*4 + rep stos byte [edi] + elf_null_section_ok: + mov esi,ebp + xor ecx,ecx + make_section_entry: + mov ebx,edi + mov eax,[esi+4] + mov eax,[eax] + stos dword [edi] + mov eax,1 + cmp dword [esi+0Ch],0 + je bss_section + test byte [esi+14h],80h + jz section_type_ok + bss_section: + mov al,8 + section_type_ok: + stos dword [edi] + mov eax,[esi+14h] + and al,3Fh + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + mov eax,[esi+8] + mov [image_base],eax + sub eax,[code_start] + call store_elf_machine_word + mov eax,[esi+0Ch] + call store_elf_machine_word + xor eax,eax + stos dword [edi] + stos dword [edi] + mov eax,[esi+10h] + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + inc ecx + add esi,20h + xchg edi,[esp] + mov ebp,edi + convert_relocations: + cmp esi,[free_additional_memory] + je relocations_converted + mov al,[esi] + or al,al + jz relocations_converted + cmp al,80h + jb make_relocation_entry + cmp al,0C0h + jb relocation_entry_ok + add esi,10h + jmp convert_relocations + make_relocation_entry: + test [format_flags],8 + jnz make_elf64_relocation_entry + mov eax,[esi+4] + stos dword [edi] + mov eax,[esi+8] + mov eax,[eax] + mov al,[esi] + stos dword [edi] + jmp relocation_entry_ok + make_elf64_relocation_entry: + mov eax,[esi+4] + stos dword [edi] + xor eax,eax + stos dword [edi] + movzx eax,byte [esi] + stos dword [edi] + mov eax,[esi+8] + mov eax,[eax] + shr eax,8 + stos dword [edi] + xor eax,eax + push edx + mov edx,[esi+4] + add edx,[image_base] + xchg eax,[edx] + stos dword [edi] + cmp byte [esi],1 + je addend_64bit + pop edx + sar eax,31 + stos dword [edi] + jmp relocation_entry_ok + addend_64bit: + xor eax,eax + xchg eax,[edx+4] + stos dword [edi] + pop edx + relocation_entry_ok: + add esi,0Ch + jmp convert_relocations + store_elf_machine_word: + stos dword [edi] + test [format_flags],8 + jz elf_machine_word_ok + and dword [edi],0 + add edi,4 + elf_machine_word_ok: + ret + relocations_converted: + cmp edi,ebp + xchg edi,[esp] + je rel_section_ok + mov eax,[ebx] + sub eax,4 + test [format_flags],8 + jz store_relocations_name_offset + dec eax + store_relocations_name_offset: + stos dword [edi] + test [format_flags],8 + jnz rela_section + mov eax,9 + jmp store_relocations_type + rela_section: + mov eax,4 + store_relocations_type: + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,ebp + sub eax,[code_start] + call store_elf_machine_word + mov eax,[esp] + sub eax,ebp + call store_elf_machine_word + mov eax,[current_section] + stos dword [edi] + mov eax,ecx + stos dword [edi] + inc ecx + test [format_flags],8 + jnz finish_elf64_rela_section + mov eax,4 + stos dword [edi] + mov al,8 + stos dword [edi] + jmp rel_section_ok + finish_elf64_rela_section: + mov eax,8 + stos dword [edi] + xor al,al + stos dword [edi] + mov al,24 + stos dword [edi] + xor al,al + stos dword [edi] + rel_section_ok: + cmp esi,[free_additional_memory] + jne make_section_entry + pop eax + mov ebx,[code_start] + sub eax,ebx + mov [code_size],eax + mov ecx,20h + test [format_flags],8 + jz adjust_elf_section_headers_offset + mov ecx,28h + adjust_elf_section_headers_offset: + add [ebx+ecx],eax + mov eax,1 + stos dword [edi] + mov al,2 + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,[code_size] + call store_elf_machine_word + mov eax,[edx+1] + sub eax,[free_additional_memory] + call store_elf_machine_word + mov eax,[current_section] + inc eax + stos dword [edi] + mov eax,[number_of_sections] + inc eax + stos dword [edi] + test [format_flags],8 + jnz finish_elf64_sym_section + mov eax,4 + stos dword [edi] + mov al,10h + stos dword [edi] + jmp sym_section_ok + finish_elf64_sym_section: + mov eax,8 + stos dword [edi] + xor al,al + stos dword [edi] + mov al,18h + stos dword [edi] + xor al,al + stos dword [edi] + sym_section_ok: + mov al,1+8 + stos dword [edi] + mov al,3 + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,[edx+1] + sub eax,[free_additional_memory] + add eax,[code_size] + call store_elf_machine_word + mov eax,[edx+1+8] + sub eax,[edx+1] + call store_elf_machine_word + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,1 + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + mov eax,'tab' + mov dword [edx+1],'.sym' + mov [edx+1+4],eax + mov dword [edx+1+8],'.str' + mov [edx+1+8+4],eax + mov [resource_data],edx + mov [written_size],0 + mov edx,[output_file] + call create + jc write_failed + call write_code + mov ecx,edi + mov edx,[free_additional_memory] + sub ecx,edx + add [written_size],ecx + call write + jc write_failed + jmp output_written + +format_elf_exe: + add esi,2 + or [format_flags],1 + cmp byte [esi],'(' + jne elf_exe_brand_ok + inc esi + cmp byte [esi],'.' + je invalid_value + push edx + call get_byte_value + cmp [value_type],0 + jne invalid_use_of_symbol + pop edx + mov [edx+7],al + elf_exe_brand_ok: + mov [image_base],8048000h + cmp byte [esi],80h + jne elf_exe_base_ok + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov [image_base],eax + pop edx + elf_exe_base_ok: + mov byte [edx+10h],2 + mov byte [edx+2Ah],20h + mov ebx,edi + mov ecx,20h shr 2 + cmp [current_pass],0 + je init_elf_segments + imul ecx,[number_of_sections] + init_elf_segments: + xor eax,eax + rep stos dword [edi] + and [number_of_sections],0 + mov byte [ebx],1 + mov word [ebx+1Ch],1000h + mov byte [ebx+18h],111b + mov eax,edi + xor ebp,ebp + xor cl,cl + sub eax,[code_start] + sbb ebp,0 + sbb cl,0 + mov [ebx+4],eax + add eax,[image_base] + adc ebp,0 + adc cl,0 + mov [ebx+8],eax + mov [ebx+0Ch],eax + mov [edx+18h],eax + not eax + not ebp + not cl + add eax,1 + adc ebp,0 + adc cl,0 + add eax,edi + adc ebp,0 + adc cl,0 + mov edx,ebp + elf_exe_addressing_setup: + push eax + call init_addressing_space + pop eax + mov [ebx],eax + mov [ebx+4],edx + mov [ebx+8],cl + mov [symbols_stream],edi + jmp format_defined + format_elf64_exe: + add esi,2 + or [format_flags],1 + cmp byte [esi],'(' + jne elf64_exe_brand_ok + inc esi + cmp byte [esi],'.' + je invalid_value + push edx + call get_byte_value + cmp [value_type],0 + jne invalid_use_of_symbol + pop edx + mov [edx+7],al + elf64_exe_brand_ok: + mov [image_base],400000h + and [image_base_high],0 + cmp byte [esi],80h + jne elf64_exe_base_ok + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov [image_base],eax + mov [image_base_high],edx + pop edx + elf64_exe_base_ok: + mov byte [edx+10h],2 + mov byte [edx+36h],38h + mov ebx,edi + mov ecx,38h shr 2 + cmp [current_pass],0 + je init_elf64_segments + imul ecx,[number_of_sections] + init_elf64_segments: + xor eax,eax + rep stos dword [edi] + and [number_of_sections],0 + mov byte [ebx],1 + mov word [ebx+30h],1000h + mov byte [ebx+4],111b + push edx + mov eax,edi + sub eax,[code_start] + mov [ebx+8],eax + xor edx,edx + xor cl,cl + add eax,[image_base] + adc edx,[image_base_high] + adc cl,0 + mov [ebx+10h],eax + mov [ebx+10h+4],edx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + pop ebx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + jmp elf_exe_addressing_setup +elf_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz elf64_entry + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[code_start] + mov [edx+18h],eax + jmp instruction_assembled + elf64_entry: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ebx,[code_start] + mov [ebx+18h],eax + mov [ebx+1Ch],edx + jmp instruction_assembled +elf_segment: + bt [format_flags],0 + jnc illegal_instruction + test [format_flags],8 + jnz elf64_segment + call close_elf_segment + push eax + call create_addressing_space + mov ebp,ebx + mov ebx,[number_of_sections] + shl ebx,5 + add ebx,[code_start] + add ebx,34h + cmp ebx,[symbols_stream] + jb new_elf_segment + mov ebx,[symbols_stream] + sub ebx,20h + push edi + mov edi,ebx + mov ecx,20h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + or [next_pass_needed],-1 + new_elf_segment: + mov byte [ebx],1 + mov word [ebx+1Ch],1000h + elf_segment_flags: + cmp byte [esi],1Eh + je elf_segment_type + cmp byte [esi],19h + jne elf_segment_flags_ok + lods word [esi] + sub ah,28 + jbe invalid_argument + cmp ah,1 + je mark_elf_segment_flag + cmp ah,3 + ja invalid_argument + xor ah,1 + cmp ah,2 + je mark_elf_segment_flag + inc ah + mark_elf_segment_flag: + test [ebx+18h],ah + jnz setting_already_specified + or [ebx+18h],ah + jmp elf_segment_flags + elf_segment_type: + cmp byte [ebx],1 + jne setting_already_specified + lods word [esi] + mov ecx,[number_of_sections] + jecxz elf_segment_type_ok + mov edx,[code_start] + add edx,34h + scan_elf_segment_types: + cmp edx,[symbols_stream] + jae elf_segment_type_ok + cmp [edx],ah + je data_already_defined + add edx,20h + loop scan_elf_segment_types + elf_segment_type_ok: + mov [ebx],ah + mov word [ebx+1Ch],1 + cmp ah,50h + jb elf_segment_flags + or dword [ebx],6474E500h + jmp elf_segment_flags + elf_segment_flags_ok: + mov eax,edi + sub eax,[code_start] + mov [ebx+4],eax + pop edx + and eax,0FFFh + add edx,eax + mov [ebx+8],edx + mov [ebx+0Ch],edx + mov eax,edx + xor edx,edx + xor cl,cl + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + elf_segment_addressing_setup: + mov [ds:ebp],eax + mov [ds:ebp+4],edx + mov [ds:ebp+8],cl + inc [number_of_sections] + jmp instruction_assembled + close_elf_segment: + cmp [number_of_sections],0 + jne finish_elf_segment + cmp edi,[symbols_stream] + jne first_elf_segment_ok + push edi + mov edi,[code_start] + add edi,34h + mov ecx,20h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + mov eax,[image_base] + ret + first_elf_segment_ok: + inc [number_of_sections] + finish_elf_segment: + mov ebx,[number_of_sections] + dec ebx + shl ebx,5 + add ebx,[code_start] + add ebx,34h + mov eax,edi + sub eax,[code_start] + sub eax,[ebx+4] + mov edx,edi + cmp edi,[undefined_data_end] + jne elf_segment_size_ok + mov edi,[undefined_data_start] + elf_segment_size_ok: + mov [ebx+14h],eax + add eax,edi + sub eax,edx + mov [ebx+10h],eax + and [undefined_data_end],0 + mov eax,[ebx+8] + cmp byte [ebx],1 + jne elf_segment_position_ok + add eax,[ebx+14h] + add eax,0FFFh + elf_segment_position_ok: + and eax,not 0FFFh + ret + elf64_segment: + call close_elf64_segment + push eax edx + call create_addressing_space + mov ebp,ebx + mov ebx,[number_of_sections] + imul ebx,38h + add ebx,[code_start] + add ebx,40h + cmp ebx,[symbols_stream] + jb new_elf64_segment + mov ebx,[symbols_stream] + sub ebx,38h + push edi + mov edi,ebx + mov ecx,38h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + or [next_pass_needed],-1 + new_elf64_segment: + mov byte [ebx],1 + mov word [ebx+30h],1000h + elf64_segment_flags: + cmp byte [esi],1Eh + je elf64_segment_type + cmp byte [esi],19h + jne elf64_segment_flags_ok + lods word [esi] + sub ah,28 + jbe invalid_argument + cmp ah,1 + je mark_elf64_segment_flag + cmp ah,3 + ja invalid_argument + xor ah,1 + cmp ah,2 + je mark_elf64_segment_flag + inc ah + mark_elf64_segment_flag: + test [ebx+4],ah + jnz setting_already_specified + or [ebx+4],ah + jmp elf64_segment_flags + elf64_segment_type: + cmp byte [ebx],1 + jne setting_already_specified + lods word [esi] + mov ecx,[number_of_sections] + jecxz elf64_segment_type_ok + mov edx,[code_start] + add edx,40h + scan_elf64_segment_types: + cmp edx,[symbols_stream] + jae elf64_segment_type_ok + cmp [edx],ah + je data_already_defined + add edx,38h + loop scan_elf64_segment_types + elf64_segment_type_ok: + mov [ebx],ah + mov word [ebx+30h],1 + cmp ah,50h + jb elf64_segment_flags + or dword [ebx],6474E500h + jmp elf64_segment_flags + elf64_segment_flags_ok: + mov ecx,edi + sub ecx,[code_start] + mov [ebx+8],ecx + pop edx eax + and ecx,0FFFh + add eax,ecx + adc edx,0 + mov [ebx+10h],eax + mov [ebx+10h+4],edx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + xor cl,cl + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + jmp elf_segment_addressing_setup + close_elf64_segment: + cmp [number_of_sections],0 + jne finish_elf64_segment + cmp edi,[symbols_stream] + jne first_elf64_segment_ok + push edi + mov edi,[code_start] + add edi,40h + mov ecx,38h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + mov eax,[image_base] + mov edx,[image_base_high] + ret + first_elf64_segment_ok: + inc [number_of_sections] + finish_elf64_segment: + mov ebx,[number_of_sections] + dec ebx + imul ebx,38h + add ebx,[code_start] + add ebx,40h + mov eax,edi + sub eax,[code_start] + sub eax,[ebx+8] + mov edx,edi + cmp edi,[undefined_data_end] + jne elf64_segment_size_ok + mov edi,[undefined_data_start] + elf64_segment_size_ok: + mov [ebx+28h],eax + add eax,edi + sub eax,edx + mov [ebx+20h],eax + and [undefined_data_end],0 + mov eax,[ebx+10h] + mov edx,[ebx+10h+4] + cmp byte [ebx],1 + jne elf64_segment_position_ok + add eax,[ebx+28h] + adc edx,0 + add eax,0FFFh + adc edx,0 + elf64_segment_position_ok: + and eax,not 0FFFh + ret +close_elf_exe: + test [format_flags],8 + jnz close_elf64_exe + call close_elf_segment + mov edx,[code_start] + mov eax,[number_of_sections] + mov byte [edx+1Ch],34h + mov [edx+2Ch],ax + shl eax,5 + add eax,edx + add eax,34h + cmp eax,[symbols_stream] + je elf_exe_ok + or [next_pass_needed],-1 + elf_exe_ok: + ret + close_elf64_exe: + call close_elf64_segment + mov edx,[code_start] + mov eax,[number_of_sections] + mov byte [edx+20h],40h + mov [edx+38h],ax + imul eax,38h + add eax,edx + add eax,40h + cmp eax,[symbols_stream] + je elf64_exe_ok + or [next_pass_needed],-1 + elf64_exe_ok: + ret diff --git a/fasmw172/SOURCE/IDE/BLOCKS.INC b/fasmw172/SOURCE/IDE/BLOCKS.INC new file mode 100644 index 0000000..f3b426b --- /dev/null +++ b/fasmw172/SOURCE/IDE/BLOCKS.INC @@ -0,0 +1,533 @@ + +; flat editor core +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. + +insert_block: + test [editor_mode],FEMODE_VERTICALSEL + jz block_to_insert_ok + push esi + or edx,-1 + xor ecx,ecx + count_line_characters: + lodsb + cmp al,9 + je cannot_insert + cmp al,0Dh + je count_next_line + or al,al + jz end_of_line + inc ecx + jmp count_line_characters + end_of_line: + dec esi + jmp check_block_width + count_next_line: + lodsb + cmp al,0Ah + je check_block_width + dec esi + check_block_width: + cmp edx,-1 + je line_to_insert_ok + cmp edx,ecx + je line_to_insert_ok + cannot_insert: + pop esi + stc + retn + line_to_insert_ok: + mov edx,ecx + xor ecx,ecx + cmp byte [esi],0 + jne count_line_characters + pop esi + block_to_insert_ok: + mov eax,[caret_line] + mov ecx,[caret_line_number] + mov edx,[caret_position] + mov [selection_line],eax + mov [selection_line_number],ecx + mov [selection_position],edx + mov ebx,esi + get_line_to_insert: + lodsb + or al,al + jz insert_full_line + cmp al,0Dh + je insert_full_line + cmp al,0Ah + je insert_full_line + cmp al,9 + jne get_line_to_insert + push esi + dec esi + mov ecx,esi + sub ecx,ebx + mov esi,ebx + push ecx + call insert_into_line + pop ecx + add [caret_position],ecx + mov ecx,[caret_position] + and ecx,not 111b + sub ecx,[caret_position] + add ecx,8 + xor esi,esi + push ecx + call insert_into_line + pop ecx + add [caret_position],ecx + pop esi + mov ebx,esi + jmp get_line_to_insert + insert_full_line: + dec esi + push esi + mov ecx,esi + sub ecx,ebx + mov esi,ebx + push ecx + call insert_into_line + pop ecx + add [caret_position],ecx + pop esi + lodsb + or al,al + jz last_line_inserted + cmp al,0Ah + je lf_first + lodsb + cmp al,0Ah + je next_line_to_insert + dec esi + jmp next_line_to_insert + lf_first: + lodsb + cmp al,0Dh + je next_line_to_insert + dec esi + next_line_to_insert: + mov ebx,[selection_position] + test [editor_mode],FEMODE_VERTICALSEL + jnz insert_in_next_line + test [editor_mode],FEMODE_OVERWRITE + jz insert_new_line + push esi + call clear_rest_of_line + pop esi + xor ebx,ebx + insert_in_next_line: + push esi ebx + mov esi,[caret_line] + call check_line_length + pop ebx + call go_to_next_line + pop esi + mov ebx,esi + jmp get_line_to_insert + last_line_inserted: + mov esi,[caret_line] + call check_line_length + clc + retn + insert_new_line: + push esi + push [caret_line] + push [caret_line_number] + xor ebx,ebx + call break_line + pop [caret_line_number] ebx esi + push [caret_line] + mov [caret_line],ebx + go_to_end_of_first_line: + test byte [ebx],1 + jz insert_full_lines + mov ebx,[ebx] + dec ebx + jmp go_to_end_of_first_line + insert_full_lines: + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov [ebx],eax + mov ebx,eax + mov eax,[caret_line] + mov [ebx+4],eax + mov [caret_line],ebx + inc [caret_line_number] + inc [lines_count] + call set_line + jc full_lines_inserted + jmp insert_full_lines + full_lines_inserted: + pop edi + mov eax,[caret_line] + mov [edi+4],eax + mov [ebx],edi + call cut_line_break + mov esi,[caret_line] + call check_line_length + clc + retn + set_line: + mov edi,ebx + add edi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH + mov [caret_position],0 + push ebx + copy_line: + lodsb + or al,al + jz last_line_set + cmp al,0Ah + je copy_lf + cmp al,0Dh + je copy_cr + cmp al,9 + je copy_tab + set_character: + stosb + loop copy_line + extra_segment: + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov edi,eax + or eax,1 + mov [ebx],eax + or ebx,1 + mov [edi+4],ebx + mov ebx,edi + add edi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH + add [caret_position],ecx + jmp copy_line + copy_tab: + mov al,20h + mov edx,SEGMENT_DATA_LENGTH + sub edx,ecx + add edx,[caret_position] + and edx,111b + cmp edx,111b + je set_character + dec esi + jmp set_character + copy_lf: + cmp byte [esi],0Dh + jne copy_new_line + inc esi + jmp copy_new_line + copy_cr: + cmp byte [esi],0Ah + jne copy_new_line + inc esi + copy_new_line: + pop edx + call finish_line + clc + retn + last_line_set: + pop edx + call finish_line + stc + retn + finish_line: + mov eax,SEGMENT_DATA_LENGTH + sub eax,ecx + add eax,[caret_position] + mov [caret_position],eax + mov [edx+8],eax + call register_length + mov al,20h + rep stosb + retn + +delete_block: + test [editor_mode],FEMODE_VERTICALSEL + jnz delete_vertical_block + mov eax,[caret_line_number] + cmp eax,[selection_line_number] + je delete_vertical_block + mov esi,[caret_line] + mov ecx,[caret_line_number] + mov edx,[caret_position] + cmp ecx,[selection_line_number] + jbe position_for_deleting_ok + xchg esi,[selection_line] + xchg ecx,[selection_line_number] + xchg edx,[selection_position] + mov [caret_line],esi + mov [caret_line_number],ecx + mov [caret_position],edx + position_for_deleting_ok: + test [editor_mode],FEMODE_OVERWRITE + jnz clear_block + call get_caret_segment + cmp edx,SEGMENT_DATA_LENGTH + jb first_line_of_block + call attach_empty_segments + first_line_of_block: + mov ecx,[caret_position] + sub ecx,edx + skip_rest_of_first_line: + add ecx,SEGMENT_DATA_LENGTH + mov eax,[esi] + btr eax,0 + jnc end_of_first_line + mov esi,eax + jmp skip_rest_of_first_line + end_of_first_line: + call store_segment_for_undo + mov edi,esi + mov esi,eax + remove_middle_lines: + cmp esi,[selection_line] + je middle_lines_removed + call store_freed_segment_for_undo + mov ebx,[esi] + call cancel_line + mov esi,ebx + btr esi,0 + jnc remove_middle_lines + remove_middle_line_segments: + call store_freed_segment_for_undo + mov esi,[esi] + btr esi,0 + jc remove_middle_line_segments + jmp remove_middle_lines + middle_lines_removed: + call store_segment_for_undo + mov eax,esi + or eax,1 + mov [edi],eax + mov eax,edi + or eax,1 + mov [esi+4],eax + call cancel_line + add ecx,[selection_position] + sub ecx,[caret_position] + call delete_from_line + mov esi,[caret_line] + find_following_line: + mov esi,[esi] + btr esi,0 + jc find_following_line + or esi,esi + jz following_line_ok + call store_segment_for_undo + mov eax,[caret_line] + mov [esi+4],eax + following_line_ok: + mov esi,[caret_line] + call check_line_length + block_deleted: + retn + clear_block: + push [caret_line] [caret_position] + clear_lines: + call clear_rest_of_line + mov [caret_line],esi + mov [caret_position],0 + cmp esi,[selection_line] + jne clear_lines + mov ecx,[selection_position] + call clear_in_line + pop [caret_position] [caret_line] + retn + delete_vertical_block: + push [caret_line] + push [caret_line_number] + mov eax,[caret_position] + cmp eax,[selection_position] + jbe delete_vertical_block_line + xchg eax,[selection_position] + mov [caret_position],eax + delete_vertical_block_line: + mov ecx,[selection_position] + sub ecx,[caret_position] + call delete_from_line + mov esi,[caret_line] + call check_line_length + mov esi,[caret_line] + mov eax,[caret_line_number] + cmp eax,[selection_line_number] + je vertical_block_deleted + ja delete_in_previous_line + delete_in_next_line: + mov esi,[esi] + btr esi,0 + jc delete_in_next_line + mov [caret_line],esi + inc [caret_line_number] + jmp delete_vertical_block_line + delete_in_previous_line: + mov esi,[esi+4] + mov [caret_line],esi + dec [caret_line_number] + jmp delete_vertical_block_line + vertical_block_deleted: + pop [caret_line_number] + pop [caret_line] + mov [selection_line],0 + retn + +get_block_length: + test [editor_mode],FEMODE_VERTICALSEL + jnz get_length_of_vertical_block + mov esi,[caret_line] + mov edx,[caret_position] + mov ebx,[selection_line] + mov ecx,[selection_position] + mov eax,[caret_line_number] + cmp eax,[selection_line_number] + je get_length_of_vertical_block + jb get_length_of_standard_block + xchg esi,ebx + xchg ecx,edx + get_length_of_standard_block: + push ecx + mov ecx,[esi+8] + sub ecx,edx + jae add_length_of_line + xor ecx,ecx + add_length_of_line: + add ecx,2 + add [esp],ecx + skip_standard_block_line: + mov esi,[esi] + btr esi,0 + jc skip_standard_block_line + cmp esi,ebx + je length_of_block_ok + mov ecx,[esi+8] + jmp add_length_of_line + length_of_block_ok: + pop ecx + retn + get_length_of_vertical_block: + mov edx,[caret_line_number] + sub edx,[selection_line_number] + jae vertical_dimension_ok + neg edx + vertical_dimension_ok: + mov eax,[caret_position] + sub eax,[selection_position] + jae horizontal_dimension_ok + neg eax + horizontal_dimension_ok: + mov ecx,eax + add eax,2 + mul edx + add ecx,eax + retn + +copy_block: + test [editor_mode],FEMODE_VERTICALSEL + jnz copy_vertical_block + mov esi,[caret_line] + mov edx,[caret_position] + mov ebx,[selection_line] + mov ecx,[selection_position] + mov eax,[caret_line_number] + cmp eax,[selection_line_number] + je copy_vertical_block + jb copy_standard_block + xchg esi,ebx + xchg ecx,edx + copy_standard_block: + push ecx + push ebx + mov ecx,[esi+8] + sub ecx,edx + jb after_line_end + call copy_from_line + jmp block_line_copied + after_line_end: + mov esi,[esi] + btr esi,0 + jc after_line_end + block_line_copied: + pop ebx + copy_next_line: + mov ax,0A0Dh + stosw + cmp esi,ebx + je copy_from_last_line + push ebx + mov ecx,[esi+8] + xor edx,edx + call copy_from_line + pop ebx + jmp copy_next_line + copy_from_last_line: + pop ecx + xor edx,edx + call copy_from_line + xor al,al + stosb + retn + copy_vertical_block: + mov esi,[caret_line] + mov ebx,[selection_line] + mov edx,[caret_position] + mov ecx,[selection_position] + mov eax,[caret_line_number] + cmp eax,[selection_line_number] + jbe vertical_block_starting_line_ok + xchg esi,ebx + vertical_block_starting_line_ok: + cmp edx,ecx + jbe vertical_block_starting_position_ok + xchg edx,ecx + vertical_block_starting_position_ok: + sub ecx,edx + copy_line_from_vertical_block: + mov eax,ebx + sub eax,esi + push eax ebx ecx edx + call copy_from_line + pop edx ecx ebx eax + or eax,eax + jz vertical_block_copied + mov ax,0A0Dh + stosw + jmp copy_line_from_vertical_block + vertical_block_copied: + xor al,al + stosb + retn + copy_from_line: + mov ebx,ecx + find_copying_origin: + cmp edx,SEGMENT_DATA_LENGTH + jb copy_line_segment + mov esi,[esi] + btr esi,0 + jnc line_data_ended + sub edx,SEGMENT_DATA_LENGTH + jmp find_copying_origin + copy_line_segment: + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + cmp ebx,ecx + jae line_segment_length_ok + mov ecx,ebx + line_segment_length_ok: + sub ebx,ecx + mov eax,[esi] + lea esi,[esi+SEGMENT_HEADER_LENGTH+edx] + rep movsb + mov esi,eax + btr esi,0 + jnc line_data_ended + xor edx,edx + jmp copy_line_segment + line_data_ended: + or ebx,ebx + jz line_copy_done + mov ecx,ebx + mov al,20h + rep stosb + line_copy_done: + retn diff --git a/fasmw172/SOURCE/IDE/EDIT.INC b/fasmw172/SOURCE/IDE/EDIT.INC new file mode 100644 index 0000000..1008f04 --- /dev/null +++ b/fasmw172/SOURCE/IDE/EDIT.INC @@ -0,0 +1,1027 @@ + +; flat editor core +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. + +set_text: + push esi + call reset_editor_memory + pop esi + mov ebx,[first_line] + or esi,esi + jz new_text_ok + set_text_line: + call set_line + jc new_text_ok + call allocate_segment + mov [ebx],eax + jc not_enough_memory + mov ebx,eax + mov eax,[caret_line] + mov [ebx+4],eax + mov [caret_line],ebx + inc [lines_count] + inc [caret_line_number] + jmp set_text_line + new_text_ok: + xor eax,eax + mov dword [ebx],eax + inc eax + mov [caret_line_number],eax + mov eax,[first_line] + mov [caret_line],eax + mov [caret_position],0 + retn + +put_character: + call get_caret_segment + inc [caret_position] + put_here: + cmp edx,SEGMENT_DATA_LENGTH + jae put_after_line_end + call store_segment_for_undo + test [editor_mode],FEMODE_OVERWRITE + jnz overwrite + mov ah,[esi+SEGMENT_HEADER_LENGTH+edx] + shl eax,8 + mov al,ah + insert_in_segment: + lea ebx,[esi+SEGMENT_HEADER_LENGTH+edx] + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + shift_data_right: + xchg al,[ebx] + inc ebx + loop shift_data_right + test byte [esi],1 + jnz shift_next_segment_right + cmp al,20h + je put_ok + add_segment: + push eax + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov edi,eax + or eax,1 + xchg eax,[esi] + stosd + mov eax,esi + or eax,1 + stosd + add edi,SEGMENT_HEADER_LENGTH - 8 + pop eax + stosb + mov ecx,SEGMENT_DATA_LENGTH - 1 + mov al,20h + rep stosb + jmp put_ok + shift_next_segment_right: + mov esi,[esi] + dec esi + call store_segment_for_undo + xor edx,edx + jmp insert_in_segment + put_after_line_end: + push eax + call attach_empty_segments + pop eax + mov [esi+SEGMENT_HEADER_LENGTH+edx],al + mov ah,20h + shl eax,8 + put_ok: + test [editor_style],FES_AUTOBRACKETS + jz insert_done + shr eax,8 + xchg ah,al + call recognize_character + jnc insert_done + cmp ah,'(' + je round + cmp ah,'[' + je square + cmp ah,'{' + je brace + insert_done: + retn + round: + mov al,')' + jmp auto_bracket + square: + mov al,']' + jmp auto_bracket + brace: + mov al,'}' + auto_bracket: + mov edx,[caret_position] + mov esi,[caret_line] + call find_segment + jmp put_here + overwrite: + mov [esi+SEGMENT_HEADER_LENGTH+edx],al + retn + attach_empty_segments: + call store_segment_for_undo + attach_segment: + push edx + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + pop edx + mov ebx,esi + mov esi,eax + mov edi,eax + or eax,1 + xchg eax,[ebx] + stosd + mov eax,ebx + or eax,1 + stosd + add edi,SEGMENT_HEADER_LENGTH - 8 + mov ecx,SEGMENT_DATA_LENGTH shr 2 + mov eax,20202020h + rep stosd + sub edx,SEGMENT_DATA_LENGTH + cmp edx,SEGMENT_DATA_LENGTH + jae attach_segment + retn + recognize_character: + cmp al,20h + jb neutral_character + cmp al,30h + jb separator_character + cmp al,3Ah + jb neutral_character + cmp al,40h + jb separator_character + cmp al,5Bh + jb neutral_character + cmp al,5Fh + jb separator_character + cmp al,7Bh + jb neutral_character + cmp al,7Fh + jb separator_character + neutral_character: + clc + retn + separator_character: + stc + retn + +delete_character: + call get_caret_segment + delete_here: + cmp edx,SEGMENT_DATA_LENGTH + jae delete_done + call store_segment_for_undo + test [editor_mode],FEMODE_OVERWRITE + jnz blank + lea ebx,[esi+SEGMENT_LENGTH] + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + mov al,20h + mov edi,[esi] + test edi,1 + jz shift_data_left + mov al,[edi-1+SEGMENT_HEADER_LENGTH] + shift_data_left: + dec ebx + xchg al,[ebx] + loop shift_data_left + lea esi,[edi-1] + xor edx,edx + test edi,1 + jnz delete_here + delete_done: + retn + blank: + mov byte [esi+SEGMENT_HEADER_LENGTH+edx],20h + retn + +tabulate: + test [editor_style],FES_SMARTTABS + jz standard_tab + mov esi,[caret_line] + mov esi,[esi+4] + or esi,esi + jz standard_tab + mov edx,[caret_position] + call find_segment + cmp edx,SEGMENT_DATA_LENGTH + jae standard_tab + push 0 + find_space: + lea edi,[esi+SEGMENT_HEADER_LENGTH+edx] + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + mov ebx,ecx + mov al,20h + repne scasb + jne no_space_in_this_segment + sub ebx,ecx + dec ebx + add edx,ebx + add [esp],ebx + call get_indent + pop ecx + or ebx,ebx + jz standard_tab + add ecx,ebx + jmp insert_tab_spaces + no_space_in_this_segment: + pop ecx + mov esi,[esi] + btr esi,0 + jnc standard_tab + add ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + xor edx,edx + push ecx + jmp find_space + standard_tab: + mov ecx,[caret_position] + and ecx,not 111b + sub ecx,[caret_position] + add ecx,8 + insert_tab_spaces: + xor esi,esi + push ecx + call insert_into_line + pop ecx + add [caret_position],ecx + retn + +carriage_return: + xor ebx,ebx + test [editor_style],FES_AUTOINDENT + jz auto_indent_ok + test [editor_mode],FEMODE_OVERWRITE + jnz auto_indent_ok + call get_caret_segment + call get_indent + add [caret_position],ebx + mov esi,[caret_line] + xor edx,edx + call get_indent + auto_indent_ok: + call break_line + retn + get_indent: + xor ebx,ebx + find_indent_origin: + cmp edx,SEGMENT_DATA_LENGTH + jb find_indent + mov esi,[esi] + btr esi,0 + jnc no_indent + sub edx,SEGMENT_DATA_LENGTH + jmp find_indent_origin + find_indent: + lea edi,[esi+SEGMENT_HEADER_LENGTH+edx] + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + add ebx,ecx + mov al,20h + repe scasb + je segment_indent + sub ebx,ecx + dec ebx + retn + segment_indent: + xor edx,edx + mov esi,[esi] + btr esi,0 + jc find_indent + no_indent: + xor ebx,ebx + retn + +break_line: + test [editor_mode],FEMODE_OVERWRITE + jnz go_to_next_line + push ebx + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov edi,eax + mov eax,[caret_line] + mov [edi+4],eax + mov ebx,[esp] + push edi + add edi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH shr 2 + mov eax,20202020h + rep stosd + call get_caret_segment + call store_segment_for_undo + mov edi,[esp] + cmp edx,SEGMENT_DATA_LENGTH + jae empty_new_line + push esi edx + new_line_segment: + cmp ebx,SEGMENT_DATA_LENGTH + jb new_line_segments_ok + push edi ebx + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov esi,eax + lea edi,[esi+SEGMENT_HEADER_LENGTH] + mov ecx,SEGMENT_DATA_LENGTH shr 2 + mov eax,20202020h + rep stosd + pop ebx edi + sub ebx,SEGMENT_DATA_LENGTH + mov eax,esi + or eax,1 + mov [edi],eax + or edi,1 + mov [esi+4],edi + mov edi,esi + jmp new_line_segment + new_line_segments_ok: + pop edx esi + split_data: + cmp ebx,edx + jbe indent_data + push esi edi + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,ebx + lea esi,[esi+SEGMENT_HEADER_LENGTH+edx] + lea edi,[edi+SEGMENT_HEADER_LENGTH+ebx] + add edx,ecx + mov eax,ecx + rep movsb + mov edi,esi + sub edi,eax + mov ecx,eax + mov al,20h + rep stosb + push edx + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + pop edx edi esi + mov ebx,eax + or eax,1 + mov [edi],eax + or edi,1 + mov [ebx+4],edi + mov edi,ebx + xor ebx,ebx + jmp split_data + indent_data: + push edi + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + mov eax,ecx + lea esi,[esi+SEGMENT_HEADER_LENGTH+edx] + lea edi,[edi+SEGMENT_HEADER_LENGTH+ebx] + rep movsb + add ebx,eax + mov edi,esi + sub edi,eax + mov ecx,eax + mov al,20h + rep stosb + pop edi + mov eax,[esp] + xchg eax,[esi-SEGMENT_LENGTH] + btr eax,0 + jnc finish_new_line + shift_splitted_data: + mov esi,eax + or eax,1 + mov [edi],eax + call store_segment_for_undo + mov eax,edi + or eax,1 + mov [esi+4],eax + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,ebx + lea edi,[edi+SEGMENT_HEADER_LENGTH+ebx] + add esi,SEGMENT_HEADER_LENGTH + mov eax,esi + rep movsb + mov edi,eax + mov ecx,ebx + rep movsb + sub edi,ebx + sub edi,SEGMENT_HEADER_LENGTH + mov eax,[edi] + btr eax,0 + jc shift_splitted_data + finish_new_line: + mov esi,edi + call store_segment_for_undo + mov [edi],eax + pop esi + or eax,eax + jz new_line_pointers_ok + xchg esi,eax + call store_segment_for_undo + xchg esi,eax + mov [eax+4],esi + new_line_pointers_ok: + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,ebx + lea edi,[edi+SEGMENT_HEADER_LENGTH+ebx] + mov al,20h + rep stosb + xchg [caret_line],esi + call check_line_length + mov esi,[caret_line] + mov dword [esi+8],0 + call check_line_length + inc [caret_line_number] + inc [lines_count] + pop [caret_position] + retn + empty_new_line: + pop edi + mov eax,[esi] + mov [esi],edi + mov [edi],eax + or eax,eax + jz empty_line_pointers_ok + mov [eax+4],edi + empty_line_pointers_ok: + mov dword [edi+8],0 + mov [caret_line],edi + inc [caret_line_number] + inc [lines_count] + pop [caret_position] + retn + go_to_next_line: + mov [caret_position],ebx + mov esi,[caret_line] + skip_line_segments: + mov eax,[esi] + btr eax,0 + jnc line_segments_skipped + mov esi,eax + jmp skip_line_segments + line_segments_skipped: + or eax,eax + jz no_next_line + mov [caret_line],eax + next_line_ok: + inc [caret_line_number] + retn + no_next_line: + call store_segment_for_undo + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov [esi],eax + mov edi,eax + xchg eax,[caret_line] + mov [edi+4],eax + xor eax,eax + stosd + add edi,4 + stosd + add edi,SEGMENT_HEADER_LENGTH - 12 + mov ecx,SEGMENT_DATA_LENGTH shr 2 + mov eax,20202020h + rep stosd + inc [lines_count] + jmp next_line_ok + +cut_line_break: + test [editor_mode],FEMODE_OVERWRITE + jnz do_nothing + call get_caret_segment + cmp edx,SEGMENT_DATA_LENGTH + jbe segment_for_deleting_ok + call store_segment_for_undo + add_empty_segment: + push edx esi + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + pop ebx edx + mov esi,eax + mov edi,eax + or eax,1 + xchg eax,[ebx] + stosd + mov eax,ebx + or eax,1 + stosd + add edi,SEGMENT_HEADER_LENGTH - 8 + mov ecx,SEGMENT_DATA_LENGTH shr 2 + mov eax,20202020h + rep stosd + sub edx,SEGMENT_DATA_LENGTH + cmp edx,SEGMENT_DATA_LENGTH + ja add_empty_segment + segment_for_deleting_ok: + call store_segment_for_undo + mov edi,esi + mov esi,[esi] + btr esi,0 + jc append_segment + call cancel_line + append_segment: + or esi,esi + jz fill_rest_with_spaces + call store_segment_for_undo + or byte [edi],1 + lea eax,[edi+1] + mov [esi+4],eax + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + mov eax,ecx + add esi,SEGMENT_HEADER_LENGTH + lea edi,[edi+SEGMENT_HEADER_LENGTH+edx] + rep movsb + mov edi,esi + sub edi,eax + mov ecx,edx + rep movsb + sub esi,SEGMENT_LENGTH + mov edi,esi + mov esi,[esi] + btr esi,0 + jc append_segment + fill_rest_with_spaces: + lea edi,[edi+SEGMENT_HEADER_LENGTH+edx] + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + mov al,20h + rep stosb + or esi,esi + jz delete_done + call store_segment_for_undo + mov eax,[caret_line] + mov [esi+4],eax + do_nothing: + retn + +cancel_line: + dec [lines_count] + mov eax,[esi+8] + call unregister_length + cmp esi,[window_line] + jne window_line_ok + mov eax,[caret_line] + mov [window_line],eax + mov eax,[caret_line_number] + mov [window_line_number],eax + window_line_ok: + cmp esi,[first_line] + jne first_line_ok + mov eax,[caret_line] + mov [first_line],eax + first_line_ok: + retn + +insert_into_line: + or ecx,ecx + jz void_insert + push ecx esi + call get_caret_segment + test [editor_mode],FEMODE_OVERWRITE + jnz overwrite_in_line + cmp edx,SEGMENT_DATA_LENGTH + jae attach_after_line_end + mov eax,[esp+4] + push edx + xor edx,edx + mov ecx,SEGMENT_DATA_LENGTH + div ecx + mov ebx,esi + push esi + or edx,edx + jnz find_last_segment_to_shift + call store_segment_for_undo + mov esi,[esi] + btr esi,0 + jnc following_segments_shifted + call store_segment_for_undo + jmp following_segments_shifted + find_last_segment_to_shift: + test byte [ebx],1 + jz shift_following_segments + mov ebx,[ebx] + dec ebx + jmp find_last_segment_to_shift + shift_following_segments: + push edx + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + pop edx + mov edi,eax + mov esi,[ebx] + mov [edi],esi + mov eax,ebx + or eax,1 + mov [edi+4],eax + lea edi,[edi+SEGMENT_HEADER_LENGTH+edx] + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + mov al,20h + rep stosb + sub edi,SEGMENT_LENGTH + carry_to_next_segment: + mov esi,ebx + call store_segment_for_undo + mov eax,edi + or eax,1 + mov [esi],eax + add esi,SEGMENT_LENGTH + sub esi,edx + mov ecx,edx + add edi,SEGMENT_HEADER_LENGTH + rep movsb + cmp ebx,[esp] + je following_segments_shifted + mov edi,ebx + mov ebx,[edi+4] + btr ebx,0 + push edi + add edi,SEGMENT_LENGTH-1 + mov esi,edi + sub esi,edx + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + std + rep movsb + cld + pop edi + jmp carry_to_next_segment + following_segments_shifted: + pop esi edx + insert_more_segments: + mov edi,esi + mov ecx,[esp+4] + make_inserted_segment: + sub ecx,SEGMENT_DATA_LENGTH + jb fill_inserted_segments + push ecx edx + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + pop edx ecx + mov ebx,[edi] + btr ebx,0 + jnc make_attached_segment + or eax,1 + mov [edi],eax + mov [ebx+4],eax + and eax,not 1 + or ebx,1 + mov [eax],ebx + or edi,1 + mov [eax+4],edi + mov edi,eax + jmp make_inserted_segment + make_attached_segment: + or eax,1 + mov [edi],eax + and eax,not 1 + mov [eax],ebx + or edi,1 + mov [eax+4],edi + mov edi,eax + jmp make_inserted_segment + fill_inserted_segments: + mov eax,SEGMENT_DATA_LENGTH + add ecx,eax + sub eax,edx + sub eax,ecx + jbe all_shifts_done + mov ecx,eax + lea edi,[edi+SEGMENT_LENGTH-1] + push esi + lea esi,[esi+SEGMENT_HEADER_LENGTH+ecx-1] + add esi,edx + std + rep movsb + cld + pop esi + all_shifts_done: + mov edi,esi + pop esi ebx + fill_new_segment: + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + cmp ecx,ebx + jbe length_for_inserting_ok + mov ecx,ebx + length_for_inserting_ok: + sub ebx,ecx + push edi + lea edi,[edi+SEGMENT_HEADER_LENGTH+edx] + or esi,esi + jz insert_blank_string + rep movsb + jmp string_inserted + insert_blank_string: + mov al,20h + rep stosb + string_inserted: + pop edi + mov edi,[edi] + and edi,not 1 + xor edx,edx + or ebx,ebx + jnz fill_new_segment + retn + attach_after_line_end: + call attach_empty_segments + mov ebx,esi + pop esi + or esi,esi + jnz attach_string + pop ecx + retn + attach_string: + mov ecx,[esp] + mov eax,SEGMENT_DATA_LENGTH + sub eax,edx + cmp eax,ecx + jae length_to_attach_ok + mov ecx,eax + length_to_attach_ok: + sub [esp],ecx + lea edi,[ebx+SEGMENT_HEADER_LENGTH+edx] + rep movsb + mov ecx,[esp] + jecxz attach_ok + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov edi,eax + or eax,1 + xchg eax,[ebx] + mov [edi],eax + or ebx,1 + mov [edi+4],ebx + mov ebx,edi + xor edx,edx + jmp attach_string + attach_ok: + pop eax + lea ecx,[ebx+SEGMENT_LENGTH] + sub ecx,edi + mov al,20h + rep stosb + void_insert: + retn + overwrite_in_line: + cmp edx,SEGMENT_DATA_LENGTH + jb position_for_overwrite_ok + call attach_empty_segments + position_for_overwrite_ok: + mov edi,esi + pop esi ebx + overwrite_segment: + xchg esi,edi + call store_segment_for_undo + xchg esi,edi + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + cmp ecx,ebx + jbe length_to_overwrite_ok + mov ecx,ebx + length_to_overwrite_ok: + sub ebx,ecx + push edi + lea edi,[edi+SEGMENT_HEADER_LENGTH+edx] + or esi,esi + jz overwrite_with_blank + rep movsb + jmp overwritten_ok + overwrite_with_blank: + mov al,20h + rep stosb + overwritten_ok: + pop edi + or ebx,ebx + jz overwrite_done + push esi + mov esi,[edi] + btr esi,0 + jc overwrite_existing_segment + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov edx,eax + or edx,1 + mov [edi],edx + mov [eax],esi + or edi,1 + mov [eax+4],edi + mov edi,eax + pop esi + xor edx,edx + cmp ebx,SEGMENT_DATA_LENGTH + jae overwrite_segment + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,ebx + lea edi,[edi+SEGMENT_HEADER_LENGTH+ebx] + mov al,20h + rep stosb + sub edi,SEGMENT_LENGTH + jmp overwrite_segment + overwrite_existing_segment: + call store_segment_for_undo + mov edi,esi + xor edx,edx + pop esi + jmp overwrite_segment + overwrite_done: + retn + +delete_from_line: + or ecx,ecx + jz nothing_to_delete + test [editor_mode],FEMODE_OVERWRITE + jnz clear_in_line + push ecx + add [caret_position],ecx + call get_caret_segment + pop ecx + sub [caret_position],ecx + cmp edx,SEGMENT_DATA_LENGTH + jae clear_rest_of_line + push esi edx + call get_caret_segment + call store_segment_for_undo + mov edi,esi + mov ebx,edx + pop edx esi + shift_over_deleted: + mov ecx,SEGMENT_DATA_LENGTH + mov eax,ecx + sub ecx,ebx + sub eax,edx + cmp eax,ecx + jae size_to_shift_ok + mov ecx,eax + size_to_shift_ok: + push esi edi + lea esi,[esi+SEGMENT_HEADER_LENGTH+edx] + lea edi,[edi+SEGMENT_HEADER_LENGTH+ebx] + add edx,ecx + add ebx,ecx + rep movsb + pop edi + cmp ebx,SEGMENT_DATA_LENGTH + je next_destination_segment + pop esi + cmp edx,SEGMENT_DATA_LENGTH + jne shift_over_deleted + mov esi,[esi] + btr esi,0 + jnc cut_line + xor edx,edx + jmp shift_over_deleted + next_destination_segment: + mov esi,[edi] + btr esi,0 + call store_segment_for_undo + mov edi,esi + pop esi + xor ebx,ebx + jmp shift_over_deleted + cut_line: + mov esi,edi + mov edx,ebx + jmp clear_from_here + clear_in_line: + xor esi,esi + jmp insert_into_line + clear_rest_of_line: + call get_caret_segment + cmp edx,SEGMENT_DATA_LENGTH + jae no_line_tail_to_clear + call store_segment_for_undo + clear_from_here: + lea edi,[esi+SEGMENT_HEADER_LENGTH+edx] + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + mov al,20h + rep stosb + mov ebx,esi + mov esi,[ebx] + remove_following_segments: + btr esi,0 + jnc rest_of_line_cleared + call store_freed_segment_for_undo + mov esi,[esi] + jmp remove_following_segments + rest_of_line_cleared: + mov [ebx],esi + nothing_to_delete: + retn + no_line_tail_to_clear: + mov esi,[esi] + retn + +remove_line: + mov esi,[caret_line] + mov esi,[esi] + or esi,esi + jnz cut_extra_segments + mov edi,[caret_line] + add edi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH + mov al,20h + repe scasb + je line_removed + cut_extra_segments: + btr esi,0 + jnc replace_with_next_line + call store_freed_segment_for_undo + mov esi,[esi] + jmp cut_extra_segments + replace_with_next_line: + or esi,esi + jz clear_current_line + call store_segment_for_undo + mov ebx,esi + xchg esi,[caret_line] + mov eax,[esi+4] + mov [ebx+4],eax + call store_freed_segment_for_undo + call cancel_line + mov esi,[esi+4] + or esi,esi + jz line_removed + find_last_segment_of_previous_line: + mov eax,[esi] + btr eax,0 + jnc link_to_new_next_line + mov esi,eax + jmp find_last_segment_of_previous_line + link_to_new_next_line: + call store_segment_for_undo + mov [esi],ebx + line_removed: + mov [caret_position],0 + mov [selection_line],0 + retn + clear_current_line: + mov esi,[caret_line] + call store_segment_for_undo + mov dword [esi],0 + lea edi,[esi+SEGMENT_HEADER_LENGTH] + mov ecx,SEGMENT_DATA_LENGTH + mov al,20h + rep stosb + jmp line_removed + +duplicate_line: + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov esi,[caret_line] + mov edi,eax + mov [edi+4],esi + mov eax,[esi+8] + mov [edi+8],eax + call register_length + push edi + duplicate_segment: + mov ebx,edi + add edi,SEGMENT_HEADER_LENGTH + add esi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH + rep movsb + sub esi,SEGMENT_LENGTH + mov eax,[esi] + btr eax,0 + jnc all_segments_duplicated + mov esi,eax + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov edi,eax + or eax,1 + mov [ebx],eax + or ebx,1 + mov [edi+4],ebx + jmp duplicate_segment + all_segments_duplicated: + inc [lines_count] + call store_segment_for_undo + mov [ebx],eax + pop ebx + mov [esi],ebx + mov esi,eax + or esi,esi + jz duplicate_done + call store_segment_for_undo + mov [esi+4],ebx + duplicate_done: + retn + +finish_edit: + mov esi,[caret_line] + call check_line_length + retn diff --git a/fasmw172/SOURCE/IDE/FASMD/FASMD.ASM b/fasmw172/SOURCE/IDE/FASMD/FASMD.ASM new file mode 100644 index 0000000..384d132 --- /dev/null +++ b/fasmw172/SOURCE/IDE/FASMD/FASMD.ASM @@ -0,0 +1,6731 @@ + +; flat assembler IDE for DOS/DPMI +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + + format MZ + heap 0 + stack stack_segment:stack_top-stack_bottom + entry loader:init + +segment loader use16 + +init: + + mov ax,3301h + xor dl,dl + int 21h + push ds cs + pop ds + mov ax,2524h + mov dx,dos_error_handler + int 21h + pop ds + + mov ax,1A00h + xor bx,bx + int 10h + cmp al,1Ah + jne short no_vga + cmp bl,8 + jne short no_vga + + mov ax,1687h + int 2Fh + or ax,ax ; DPMI installed? + jnz short no_dpmi + test bl,1 ; 32-bit programs supported? + jz short no_dpmi + mov word [cs:mode_switch],di + mov word [cs:mode_switch+2],es + mov bx,si ; allocate memory for DPMI data + mov ah,48h + int 21h + jnc switch_to_protected_mode + init_failed: + call init_error + db 'DPMI initialization failed.',0Dh,0Ah,0 + no_vga: + call init_error + db 'Color VGA adapter is required.',0Dh,0Ah,0 + no_dpmi: + call init_error + db '32-bit DPMI services are not available.',0Dh,0Ah,0 + init_error: + pop si + push cs + pop ds + display_error: + lodsb + test al,al + jz short error_finish + mov dl,al + mov ah,2 + int 21h + jmp short display_error + error_finish: + mov ax,4CFFh + int 21h + dos_error_handler: + mov al,3 + iret + switch_to_protected_mode: + mov es,ax + mov ds,[ds:2Ch] + mov ax,1 + call far [cs:mode_switch] ; switch to protected mode + jc init_failed + mov cx,1 + xor ax,ax + int 31h ; allocate descriptor for code + jc init_failed + mov si,ax + xor ax,ax + int 31h ; allocate descriptor for data + jc init_failed + mov di,ax + mov dx,cs + lar cx,dx + shr cx,8 + or cx,0C000h + mov bx,si + mov ax,9 + int 31h ; set code descriptor access rights + jc init_failed + mov dx,ds + lar cx,dx + shr cx,8 + or cx,0C000h + mov bx,di + int 31h ; set data descriptor access rights + jc init_failed + mov ecx,main + shl ecx,4 + mov dx,cx + shr ecx,16 + mov ax,7 + int 31h ; set data descriptor base address + jc init_failed + mov bx,si + int 31h ; set code descriptor base address + jc init_failed + mov cx,0FFFFh + mov dx,0FFFFh + mov ax,8 ; set segment limit to 4 GB + int 31h + jc init_failed + mov bx,di + int 31h + jc init_failed + mov ax,ds + mov ds,di + mov [main_selector],di + mov [psp_selector],es + mov [environment_selector],ax + cli + mov ss,di + mov esp,stack_top + sti + mov es,di + mov cx,1 + xor ax,ax + int 31h ; allocate descriptor for BIOS data segment + jc init_failed + mov bx,ax + lar cx,[environment_selector] + shr cx,8 + mov ax,9 + int 31h ; set descriptor access rights + jc init_failed + xor cx,cx + mov dx,400h + mov ax,7 + int 31h ; set base address of BIOS data segment + jc init_failed + xor cx,cx + mov dx,0FFh + mov ax,8 + int 31h ; set limit of BIOS data segment + jc init_failed + mov fs,bx + mov [bios_selector],bx + mov cx,1 + xor ax,ax + int 31h ; allocate descriptor for video segment + jc init_failed + mov bx,ax + lar cx,[environment_selector] + shr cx,8 + mov ax,9 + int 31h ; set descriptor access rights + jc init_failed + mov cx,0Bh + mov dx,8000h + mov ax,7 + int 31h ; set base address of video segment + jc init_failed + xor cx,cx + mov dx,4000-1 + mov ax,8 + int 31h ; set limit of video segment + jc init_failed + mov gs,bx + mov [video_selector],bx + push si + push start + retf + + mode_switch dd ? + +segment main use32 + + start: + cld + + call init_video + jc startup_failed + + call init_editor_memory + jc startup_failed + + xor eax,eax + mov [next_instance],eax + mov [previous_instance],eax + mov [file_path],eax + + mov ecx,1000h + mov [line_buffer_size],ecx + call get_memory + or eax,eax + jz startup_failed + mov [line_buffer],eax + mov [line_buffer_handle],ebx + + mov [stack_limit],stack_bottom + + mov edi,upper_case_table + xor al,al + mov ecx,80h + prepare_case_table: + stosb + inc al + loop prepare_case_table + make_extended_case_table: + push eax + mov dl,al + mov ax,6520h + int 21h + mov al,[esp] + jc upper_case_character_ok + mov al,dl + upper_case_character_ok: + stosb + pop eax + inc al + jnz make_extended_case_table + mov esi,upper_case_table+'A' + mov edi,upper_case_table+'a' + mov ecx,26 + rep movsb + xor al,al + mov edi,lower_case_table + prepare_lower_case_table: + stosb + inc al + jnz prepare_lower_case_table + mov esi,lower_case_table+'a' + mov edi,lower_case_table+'A' + mov ecx,26 + rep movsb + mov eax,80h + xor edx,edx + make_lower_case_table: + mov dl,[upper_case_table+eax] + cmp al,dl + je lower_case_character_ok + cmp dl,80h + jb lower_case_character_ok + mov [lower_case_table+edx],al + lower_case_character_ok: + inc al + jnz make_lower_case_table + mov edi,characters + xor al,al + prepare_characters_table: + stosb + inc al + jnz prepare_characters_table + mov esi,characters+'a' + mov edi,characters+'A' + mov ecx,26 + rep movsb + mov edi,characters + mov esi,symbol_characters+1 + movzx ecx,byte [esi-1] + xor eax,eax + convert_table: + lodsb + mov byte [edi+eax],0 + loop convert_table + mov [selected_character],'p' + + call get_low_memory + + push ds + mov ds,[environment_selector] + xor esi,esi + mov edi,ini_path + skip_environment: + lodsb + test al,al + jnz skip_environment + lodsb + test al,al + jnz skip_environment + add esi,2 + copy_program_path: + lodsb + stosb + test al,al + jnz copy_program_path + pop ds + dec edi + mov edx,edi + find_extension_start: + cmp edi,ini_path + je attach_extension + cmp byte [edi-1],'.' + je replace_extension + cmp byte [edi-1],'/' + je attach_extension + dec edi + jmp find_extension_start + attach_extension: + mov edi,edx + mov al,'.' + stosb + replace_extension: + mov ecx,edi + mov eax,'INI' + stosd + + xor eax,eax + mov [ini_data],eax + mov [main_project_file],eax + mov [clipboard],eax + mov [current_operation],al + mov [find_flags],eax + mov [command_flags],al + + call load_configuration + + call update_positions + call switch_to_ide_screen + + mov esi,81h + process_arguments: + push ds + mov ds,[psp_selector] + mov edi,filename_buffer + find_argument: + lodsb + cmp al,20h + je find_argument + cmp al,9 + je find_argument + cmp al,22h + je quoted_argument + dec esi + copy_argument: + lodsb + cmp al,20h + je argument_end + cmp al,9 + je argument_end + cmp al,0Dh + je argument_end + stosb + jmp copy_argument + quoted_argument: + lodsb + cmp al,0Dh + je argument_end + stosb + cmp al,22h + jne quoted_argument + lodsb + cmp al,22h + je quoted_argument + dec edi + argument_end: + dec esi + pop ds + cmp edi,filename_buffer + je main_loop + xor al,al + stosb + push esi + mov edx,filename_buffer + call load_file + pop esi + jmp process_arguments + + main_loop: + + call update_cursor + call update_screen + + xor al,al + xchg [current_operation],al + mov [last_operation],al + mov [was_selection],1 + mov eax,[selection_line] + or eax,eax + jz no_selection + cmp eax,[caret_line] + jne get_command + mov eax,[selection_position] + cmp eax,[caret_position] + jne get_command + no_selection: + mov [was_selection],0 + mov eax,[caret_line] + mov [selection_line],eax + mov eax,[caret_position] + mov [selection_position],eax + mov eax,[caret_line_number] + mov [selection_line_number],eax + get_command: + call wait_for_input + cmp ah,1 + je close_editor + jb character + cmp al,0Eh + je new_editor + cmp ah,94h + je switch_editor + cmp ah,0A5h + je switch_editor + cmp ah,3Ch + je save_current + cmp ah,55h + je save_as + cmp ah,3Eh + je open_file + cmp ah,3Fh + je goto + cmp ah,41h + je search + cmp ah,5Ah + je search_next + cmp ah,64h + je replace + cmp ah,43h + je compile_and_run + cmp ah,66h + je compile + cmp ah,65h + je build_symbols + cmp ah,5Ch + je assign_to_compiler + cmp ah,63h + je calculator + cmp ah,6Ch + je show_user_screen + cmp ah,44h + je options + cmp ah,3Dh + je search_next + test byte [fs:17h],1000b + jz no_alt + cmp ah,2Dh + je close_all + cmp ah,0Eh + je undo + cmp ah,0A3h + je disable_undo + cmp ah,98h + je scroll_up + cmp ah,0A0h + je scroll_down + cmp ah,9Bh + je scroll_left + cmp ah,9Dh + je scroll_right + no_alt: + or al,al + jz no_ascii + cmp al,0E0h + jne ascii + no_ascii: + cmp ah,4Bh + je left_key + cmp ah,4Dh + je right_key + cmp ah,48h + je up_key + cmp ah,50h + je down_key + cmp ah,47h + je home_key + cmp ah,4Fh + je end_key + cmp ah,77h + je screen_home + cmp ah,75h + je screen_end + cmp ah,73h + je word_left + cmp ah,74h + je word_right + cmp ah,8Dh + je word_left + cmp ah,91h + je word_right + cmp ah,49h + je pgup_key + cmp ah,51h + je pgdn_key + cmp ah,84h + je text_home + cmp ah,76h + je text_end + cmp ah,52h + je ins_key + cmp ah,0A2h + je switch_blocks + cmp ah,40h + je f6_key + cmp ah,93h + je block_delete + cmp ah,92h + je block_copy + cmp ah,53h + je del_key + cmp ah,78h + jb get_command + cmp ah,80h + ja get_command + sub ah,77h + movzx ecx,ah + jmp select_editor + ascii: + cmp al,7Fh + je word_back + cmp al,20h + jae character + cmp al,8 + je backspace_key + cmp al,9 + je tab_key + cmp al,0Dh + je enter_key + cmp al,19h + je ctrl_y_key + cmp al,1Ah + je undo + cmp al,18h + je block_cut + cmp al,3 + je block_copy + cmp al,16h + je block_paste + cmp al,0Fh + je open_file + cmp al,13h + je save_current + cmp al,6 + je search + cmp al,7 + je goto + cmp al,1 + je select_all + cmp al,2 + je ascii_table + jmp get_command + character: + test [editor_mode],FEMODE_READONLY + jnz get_command + cmp [was_selection],0 + je no_selection_to_replace + call store_status_for_undo + test [editor_style],FES_SECURESEL + jnz character_undo_ok + push eax + call delete_block + pop eax + call put_character + call finish_edit + mov [selection_line],0 + jmp text_modified + no_selection_to_replace: + mov [current_operation],20h + cmp [last_operation],20h + jne character_undopoint + mov edx,[unmodified_state] + cmp edx,[undo_data] + jne character_undo_ok + or [unmodified_state],-1 + jmp character_undo_ok + character_undopoint: + call store_status_for_undo + character_undo_ok: + call put_character + call finish_edit + mov [selection_line],0 + jmp text_modified + tab_key: + test [editor_mode],FEMODE_READONLY + jnz get_command + call store_status_for_undo + cmp [was_selection],0 + je tab_securesel + test [editor_style],FES_SECURESEL + jnz tab_securesel + call delete_block + tab_securesel: + call tabulate + mov [selection_line],0 + call finish_edit + jmp text_modified + enter_key: + test [editor_mode],FEMODE_READONLY + jnz get_command + call store_status_for_undo + cmp [was_selection],0 + je enter_secureselection_ok + test [editor_style],FES_SECURESEL + jnz enter_secureselection_ok + call delete_block + enter_secureselection_ok: + call carriage_return + mov [selection_line],0 + test [editor_mode],FEMODE_OVERWRITE + jnz text_modified + call finish_edit + jmp text_modified + backspace_key: + test [editor_mode],FEMODE_READONLY + jnz get_command + test byte [fs:17h],100b + jnz replace + cmp [was_selection],0 + je no_selection_to_clear + test [editor_style],FES_SECURESEL + jz block_delete + no_selection_to_clear: + cmp [caret_position],0 + je line_back + mov [current_operation],8 + cmp [last_operation],8 + jne backspace_undopoint + mov edx,[unmodified_state] + cmp edx,[undo_data] + jne undo_back_ok + or [unmodified_state],-1 + jmp undo_back_ok + backspace_undopoint: + call store_status_for_undo + undo_back_ok: + dec [caret_position] + call delete_character + call finish_edit + mov [selection_line],0 + jmp text_modified + line_back: + test [editor_mode],FEMODE_OVERWRITE + jnz get_command + mov esi,[caret_line] + mov esi,[esi+4] + or esi,esi + jz get_command + call store_status_for_undo + mov [caret_line],esi + dec [caret_line_number] + call check_line_length + mov [caret_position],ecx + call cut_line_break + call finish_edit + mov [selection_line],0 + jmp text_modified + word_back: + call store_status_for_undo + push [caret_position] + mov esi,[caret_line] + xor eax,eax + xchg eax,[esi+4] + push eax + call move_to_previous_word + pop eax + mov esi,[caret_line] + mov [esi+4],eax + pop ecx + sub ecx,[caret_position] + call delete_from_line + call finish_edit + jmp text_modified + del_key: + test byte [fs:17h],11b + jnz block_cut + test [editor_mode],FEMODE_READONLY + jnz get_command + cmp [was_selection],0 + je no_selection_on_del + test [editor_style],FES_SECURESEL + jz block_delete + no_selection_on_del: + mov esi,[caret_line] + test [editor_mode],FEMODE_OVERWRITE + jnz delete_char + call check_line_length + cmp ecx,[caret_position] + ja delete_char + cmp dword [esi],0 + je get_command + call store_status_for_undo + call cut_line_break + call finish_edit + mov [selection_line],0 + jmp text_modified + delete_char: + mov [current_operation],0E0h + cmp [last_operation],0E0h + je undo_delete_ok + call store_status_for_undo + undo_delete_ok: + call delete_character + call finish_edit + mov [selection_line],0 + jmp text_modified + ctrl_y_key: + test [editor_mode],FEMODE_READONLY + jnz get_command + call store_status_for_undo + call remove_line + jmp text_modified + f6_key: + test [editor_mode],FEMODE_READONLY + jnz get_command + call store_status_for_undo + call duplicate_line + jmp text_modified + left_key: + cmp [caret_position],0 + jle text_modified + dec [caret_position] + jmp moved_caret + right_key: + mov eax,[caret_position] + cmp eax,[maximum_position] + jae text_modified + inc [caret_position] + jmp moved_caret + up_key: + call move_line_up + jmp moved_caret + down_key: + call move_line_down + jmp moved_caret + home_key: + mov [caret_position],0 + jmp moved_caret + end_key: + call move_to_line_end + jmp moved_caret + screen_home: + mov eax,[window_line] + mov [caret_line],eax + mov eax,[window_line_number] + mov [caret_line_number],eax + jmp moved_caret + screen_end: + mov eax,[window_line_number] + add eax,[window_height] + dec eax + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + jmp moved_caret + pgup_key: + call move_page_up + jmp moved_caret + pgdn_key: + call move_page_down + jmp moved_caret + text_home: + mov eax,[first_line] + mov [caret_line],eax + mov [caret_line_number],1 + jmp moved_caret + text_end: + or eax,-1 + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + jmp moved_caret + word_left: + call move_to_previous_word + jmp moved_caret + word_right: + call get_caret_segment + call move_to_next_word + jmp moved_caret + scroll_left: + cmp [window_position],0 + je main_loop + dec [window_position] + jmp moved_window + scroll_right: + inc [window_position] + jmp moved_window + scroll_up: + mov esi,[window_line] + mov esi,[esi+4] + or esi,esi + jz main_loop + mov [window_line],esi + dec [window_line_number] + jmp moved_window + scroll_down: + mov esi,[window_line] + find_next_window_line: + mov esi,[esi] + btr esi,0 + jc find_next_window_line + or esi,esi + jz main_loop + mov [window_line],esi + inc [window_line_number] + jmp moved_window + ins_key: + and byte [fs:18h],not 80h + test byte [fs:17h],11b + jnz block_paste + switch_mode: + xor [editor_mode],FEMODE_OVERWRITE + jmp main_loop + switch_blocks: + xor [editor_mode],FEMODE_VERTICALSEL + jmp main_loop + block_delete: + test [editor_mode],FEMODE_READONLY + jnz get_command + cmp [was_selection],0 + je get_command + call store_status_for_undo + call delete_block + mov [selection_line],0 + jmp operation_done + block_copy: + cmp [was_selection],0 + je get_command + call copy_to_clipboard + jmp get_command + copy_to_clipboard: + cmp [clipboard],0 + je allocate_clipboard + mov ebx,[clipboard_handle] + call release_memory + allocate_clipboard: + call get_block_length + inc ecx + call get_memory + mov [clipboard],eax + mov [clipboard_handle],ebx + or eax,eax + jz not_enough_memory + mov edi,[clipboard] + call copy_block + retn + block_cut: + cmp [was_selection],0 + je get_command + call copy_to_clipboard + jmp block_delete + block_paste: + test [editor_mode],FEMODE_READONLY + jnz get_command + call store_status_for_undo + cmp [was_selection],0 + je paste_secureselection_ok + test [editor_style],FES_SECURESEL + jnz paste_secureselection_ok + call delete_block + paste_secureselection_ok: + mov esi,[clipboard] + or esi,esi + jz operation_done + call insert_block + jc paste_failed + test [editor_style],FES_SECURESEL + jz no_selection_after_paste + mov eax,[caret_line] + mov ecx,[caret_line_number] + mov edx,[caret_position] + xchg eax,[selection_line] + xchg ecx,[selection_line_number] + xchg edx,[selection_position] + mov [caret_line],eax + mov [caret_line_number],ecx + mov [caret_position],edx + jmp operation_done + no_selection_after_paste: + mov [selection_line],0 + jmp operation_done + paste_failed: + call undo_changes + jmp operation_done + undo: + test [editor_mode],FEMODE_READONLY + jnz get_command + test [editor_mode],FEMODE_NOUNDO + jnz enable_undo + test byte [fs:17h],11b + jnz redo + mov eax,[undo_data] + test eax,eax + jz get_command + call undo_changes + jmp operation_done + redo: + test [editor_mode],FEMODE_READONLY + jnz get_command + mov eax,[redo_data] + test eax,eax + jz get_command + call redo_changes + jmp operation_done + enable_undo: + and [editor_mode],not FEMODE_NOUNDO + jmp main_loop + disable_undo: + call clear_redo_data + call clear_undo_data + or [editor_mode],FEMODE_NOUNDO + jmp operation_done + select_all: + or eax,-1 + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + call check_line_length + mov [caret_position],ecx + mov eax,1 + call find_line + mov [selection_line],esi + mov [selection_line_number],ecx + mov [selection_position],0 + jmp operation_done + ascii_table: + call ascii_table_window + jc main_loop + test al,al + jz main_loop + cmp al,1Ah + je main_loop + jmp character + + moved_caret: + test byte [fs:17h],11b + jnz operation_done + mov [selection_line],0 + jmp operation_done + text_modified: + cmp [was_selection],0 + jne operation_done + mov [selection_line],0 + operation_done: + call update_positions + call let_caret_appear + call update_window + jmp main_loop + moved_window: + call update_positions + cmp [was_selection],0 + jne main_loop + mov [selection_line],0 + jmp main_loop + + new_editor: + call create_editor_instance + jmp main_loop + close_editor: + or [command_flags],8 + jmp closing_loop + close_all: + and [command_flags],not 8 + closing_loop: + mov eax,[undo_data] + cmp eax,[unmodified_state] + je do_close + mov esi,[file_path] + call get_file_title + mov ebx,esi + mov esi,_saving_question + mov eax,2 shl 24 + mov ax,[message_box_colors] + mov [first_button],_yes + mov [second_button],_no + call message_box + cmp eax,1 + jb main_loop + ja do_close + cmp [file_path],0 + jne save_before_closing + call get_saving_path + jc main_loop + save_before_closing: + call save_file + jc main_loop + do_close: + call remove_editor_instance + jc shutdown + test [command_flags],8 + jnz main_loop + call update_cursor + call update_screen + jmp closing_loop + switch_editor: + test byte [fs:17h],11b + jnz previous_editor + mov eax,[next_instance] + or eax,eax + jnz do_switch + mov eax,[previous_instance] + or eax,eax + jz get_command + find_first_editor: + mov ebx,[eax+SEGMENT_HEADER_LENGTH+previous_instance-editor_data] + or ebx,ebx + jz do_switch + mov eax,ebx + jmp find_first_editor + do_switch: + call switch_editor_instance + jmp main_loop + previous_editor: + mov eax,[previous_instance] + or eax,eax + jnz do_switch + mov eax,[next_instance] + or eax,eax + jz get_command + find_last_editor: + mov ebx,[eax+SEGMENT_HEADER_LENGTH+next_instance-editor_data] + or ebx,ebx + jz do_switch + mov eax,ebx + jmp find_last_editor + select_editor: + mov eax,[editor_memory] + mov edx,[previous_instance] + prepare_for_editor_counting: + or edx,edx + jz find_selected_editor + mov eax,edx + mov edx,[edx+SEGMENT_HEADER_LENGTH+previous_instance-editor_data] + jmp prepare_for_editor_counting + find_selected_editor: + dec ecx + jz selected_editor_found + mov eax,[eax+SEGMENT_HEADER_LENGTH+next_instance-editor_data] + or eax,eax + jz get_command + jmp find_selected_editor + selected_editor_found: + cmp eax,[editor_memory] + je get_command + jmp do_switch + show_user_screen: + call switch_to_user_screen + mov ah,10h + int 16h + call switch_to_ide_screen + jmp main_loop + + save_current: + test [editor_mode],FEMODE_READONLY + jnz save_as + cmp [file_path],0 + jne do_save + save_as: + call get_saving_path + jc main_loop + do_save: + call save_file + jmp main_loop + open_file: + mov esi,_open + call file_open_dialog + jc main_loop + call load_file + jmp main_loop + goto: + call goto_dialog + jc main_loop + or edx,edx + jz goto_position_ok + dec edx + mov [caret_position],edx + mov [selection_position],edx + goto_position_ok: + or ecx,ecx + jz goto_line_ok + mov eax,ecx + call find_line + mov [caret_line],esi + mov [selection_line],esi + mov [caret_line_number],ecx + mov [selection_line_number],ecx + goto_line_ok: + call update_positions + call let_caret_appear + call update_window + jmp main_loop + search: + call find_dialog + jc main_loop + call find_first + jc not_found + call show_found_text + jmp main_loop + not_found: + call update_screen + mov edi,buffer+1000h + push edi + call get_search_text + mov edi,buffer + mov esi,_not_found_after + test [search_flags],FEFIND_BACKWARD + jz make_not_found_message + mov esi,_not_found_before + make_not_found_message: + mov ebx,esp + call sprintf + pop eax + call release_search_data + mov esi,buffer + mov ebx,_find + movzx eax,[message_box_colors] + call message_box + jmp main_loop + show_found_text: + mov eax,[caret_position] + xchg eax,[selection_position] + mov [caret_position],eax + call update_positions + call let_caret_appear + call update_window + mov eax,[caret_position] + xchg eax,[selection_position] + mov [caret_position],eax + ret + replace: + call replace_dialog + jc main_loop + mov [replaces_count],0 + push edi + call find_first + jc not_found + call store_status_for_undo + replace_loop: + test [command_flags],1 + jz do_replace + call show_found_text + call let_caret_appear + call update_window + call update_screen + mov ebx,_replace + mov esi,_replace_prompt + mov eax,2 shl 24 + mov ax,[message_box_colors] + mov [first_button],_yes + mov [second_button],_no + or [command_flags],80h + call message_box + and [command_flags],not 80h + cmp eax,1 + jb replacing_finished + ja replace_next + do_replace: + push [caret_line_number] + push [caret_position] + call delete_block + pop edx ecx + cmp ecx,[caret_line_number] + jne simple_replace + cmp edx,[caret_position] + jne simple_replace + mov esi,[esp] + call insert_block + mov esi,[caret_line] + mov ecx,[caret_line_number] + mov edx,[caret_position] + xchg esi,[selection_line] + xchg ecx,[selection_line_number] + xchg edx,[selection_position] + mov [caret_line],esi + mov [caret_line_number],ecx + mov [caret_position],edx + jmp replace_done + simple_replace: + mov esi,[esp] + call insert_block + replace_done: + inc [replaces_count] + replace_next: + call find_next + jnc replace_loop + replacing_finished: + call release_search_data + call let_caret_appear + call update_window + call update_screen + mov edi,buffer + mov esi,_replaces_made + mov ebx,replaces_count + call sprintf + mov esi,buffer + mov ebx,_find + movzx eax,[message_box_colors] + call message_box + jmp main_loop + search_next: + cmp [search_data],0 + je main_loop + call find_next + jc not_found + call show_found_text + jmp main_loop + build_symbols: + and [command_flags],not 2 + or [command_flags],4 + jmp do_compile + compile: + and [command_flags],not (2 or 4) + jmp do_compile + compile_and_run: + and [command_flags],not 4 + or [command_flags],2 + do_compile: + push [editor_memory] + mov eax,[main_project_file] + or eax,eax + jz got_main_file + call switch_editor_instance + got_main_file: + cmp [file_path],0 + jne main_file_path_ok + call update_screen + call get_saving_path + jc main_loop + call update_screen + main_file_path_ok: + mov eax,[editor_memory] + push eax + mov edx,[previous_instance] + test edx,edx + jz save_all_files + mov eax,edx + find_first_to_save: + mov edx,[eax+SEGMENT_HEADER_LENGTH+previous_instance-editor_data] + or edx,edx + jz save_all_files + mov eax,edx + jmp find_first_to_save + save_all_files: + call switch_editor_instance + cmp [file_path],0 + je save_next + mov eax,[undo_data] + cmp eax,[unmodified_state] + je save_next + call save_file + jc main_loop + save_next: + mov eax,[next_instance] + or eax,eax + jnz save_all_files + pop eax + call switch_editor_instance + mov edi,buffer+3000h + mov byte [edi],0 + call get_current_directory + mov esi,[file_path] + mov edi,buffer + mov ebx,edi + copy_directory_path: + lodsb + or al,al + jz directory_path_ok + stosb + cmp al,'\' + jne copy_directory_path + mov ebx,edi + jmp copy_directory_path + directory_path_ok: + mov byte [ebx],0 + mov esi,buffer + call go_to_directory + mov eax,[file_path] + mov [input_file],eax + mov [symbols_file],0 + test [command_flags],4 + jz symbols_file_name_ok + mov edi,buffer+2000h + mov [symbols_file],edi + mov esi,eax + xor ebx,ebx + copy_file_name: + lodsb + stosb + test al,al + jz file_name_copied + cmp al,'.' + jne copy_file_name + mov ebx,edi + jmp copy_file_name + file_name_copied: + test ebx,ebx + jz attach_fas_extension + mov edi,ebx + attach_fas_extension: + dec edi + mov eax,'.fas' + stosd + xor al,al + stosb + symbols_file_name_ok: + pop eax + call switch_editor_instance + mov cx,1000h + mov ah,1 + int 10h + mov esi,_compile + mov cx,0316h + mov ah,[window_colors] + call draw_centered_window + add edi,2 + mov [progress_offset],edi + mov eax,[memory_limit] + test eax,eax + jnz allocate_memory + mov ax,500h + mov edi,buffer + int 31h + mov eax,[edi] + allocate_memory: + mov ecx,eax + mov edx,eax + shr edx,2 + sub eax,edx + mov [memory_end],eax + mov [additional_memory_end],edx + call get_memory + or eax,eax + jnz memory_allocated + mov eax,[additional_memory_end] + shl eax,1 + cmp eax,4000h + jb not_enough_memory + jmp allocate_memory + get_current_directory: + mov ah,19h + int 21h + mov bl,al + mov dl,al + inc dl + xor esi,esi + mov ax,7147h + call dos_int + jnc got_current_directory + cmp ax,7100h + je get_current_directory_short + invalid_current_directory: + stc + ret + get_current_directory_short: + mov ah,47h + call dos_int + jc invalid_current_directory + got_current_directory: + cmp byte [buffer],0 + je drive_prefix + cmp byte [buffer+1],':' + je copy_current_directory + cmp word [buffer],'\\' + je copy_current_directory + drive_prefix: + mov al,bl + add al,'A' + mov ah,':' + stosw + mov al,'\' + stosb + copy_current_directory: + mov esi,buffer + call copy_asciiz + clc + ret + go_to_directory: + cmp esi,buffer + je directory_path_ready + mov edi,buffer + call copy_asciiz + mov esi,buffer + directory_path_ready: + mov ah,0Eh + mov dl,[buffer] + sub dl,'A' + jc current_directory_ok + cmp dl,'Z'-'A' + jbe change_current_drive + sub dl,'a'-'A' + change_current_drive: + int 21h + xor dx,dx + mov ax,713Bh + call dos_int + cmp ax,7100h + jne current_directory_ok + mov ah,3Bh + call dos_int + current_directory_ok: + ret + memory_allocated: + mov [allocated_memory],ebx + mov [memory_start],eax + add eax,[memory_end] + mov [memory_end],eax + mov [additional_memory],eax + add [additional_memory_end],eax + xor eax,eax + mov [initial_definitions],eax + mov [output_file],eax + mov [display_length],eax + mov ax,204h + mov bl,9 + int 31h + mov dword [keyboard_handler],edx + mov word [keyboard_handler+4],cx + mov ax,205h + mov bl,9 + mov cx,cs + mov edx,aborting_handler + int 31h + mov eax,[fs:6Ch] + mov [start_time],eax + call preprocessor + call draw_progress_segment + call parser + call draw_progress_segment + call assembler + call draw_progress_segment + call formatter + call draw_progress_segment + mov ax,205h + mov bl,9 + mov edx,dword [keyboard_handler] + mov cx,word [keyboard_handler+4] + int 31h + test [command_flags],2 + jnz execute + mov esi,buffer+3000h + call go_to_directory + call show_display_buffer + call update_screen + mov edi,buffer + movzx eax,[current_pass] + inc eax + call number_as_text + mov eax,' pas' + stosd + mov eax,'ses,' + stosd + mov al,20h + stosb + mov eax,[fs:6Ch] + sub eax,[start_time] + mov ebx,100 + mul ebx + mov ebx,182 + div ebx + or eax,eax + jz show_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call number_as_text + mov al,'.' + stosb + pop eax + call number_as_text + mov eax,' sec' + stosd + mov eax,'onds' + stosd + mov ax,', ' + stosw + show_bytes_count: + mov eax,[written_size] + call number_as_text + mov eax,' byt' + stosd + mov eax,'es.' + stosd + mov ebx,[allocated_memory] + call release_memory + mov esi,buffer + mov ebx,_compile + movzx eax,[message_box_colors] + mov [first_button],_ok + mov [second_button],_get_display + cmp [display_length],0 + je show_compilation_summary + or eax,2 shl 24 + show_compilation_summary: + call message_box + cmp eax,2 + jb main_loop + cmp [clipboard],0 + je get_display_to_clipboard + mov ebx,[clipboard_handle] + call release_memory + get_display_to_clipboard: + mov ecx,[display_length] + inc ecx + call get_memory + mov [clipboard_handle],ebx + mov [clipboard],eax + or eax,eax + jz not_enough_memory + xor esi,esi + mov edi,eax + mov ecx,[display_length] + push ds + mov ds,[low_memory_selector] + rep movsb + pop ds + xor al,al + stosb + jmp main_loop + execute: + mov edx,[output_file] + call adapt_path + mov ebx,[allocated_memory] + call release_memory + cmp [output_format],3 + ja cannot_execute + call release_low_memory + call switch_to_user_screen + call close_video + mov edi,buffer+200h + lea edx,[edi-buffer] + mov ax,0D00h + stosw + lea esi,[edi-buffer] + xor al,al + stosb + mov al,20h + mov ecx,11 + rep stosb + xor al,al + mov ecx,25 + rep stosb + lea ebx,[edi-buffer] + xor eax,eax + stosw + mov ax,buffer_segment + shl eax,16 + mov ax,dx + stosd + mov ax,si + stosd + stosd + mov ax,4B00h + xor dx,dx + call dos_int + mov esi,buffer+3000h + call go_to_directory + call init_video + jc startup_failed + call switch_to_ide_screen + call get_low_memory + jmp main_loop + cannot_execute: + mov esi,buffer+3000h + call go_to_directory + mov esi,_not_executable + mov ebx,_error + movzx eax,[error_box_colors] + call message_box + jmp main_loop + draw_progress_segment: + mov eax,[progress_offset] + mov ecx,4 + draw_progress_filler: + mov byte [gs:eax],254 + add eax,2 + loop draw_progress_filler + mov [progress_offset],eax + ret + aborting_handler: + push eax + in al,60h + cmp al,1 + jne no_abort + mov dword [esp+4],abort_compiling + mov word [esp+4+4],cs + no_abort: + pop eax + jmp pword [cs:keyboard_handler] + abort_compiling: + cli + mov ax,[cs:main_selector] + mov esp,stack_top + mov ss,ax + mov ds,ax + mov es,ax + mov fs,[bios_selector] + mov gs,[video_selector] + mov ax,205h + mov bl,9 + mov edx,dword [keyboard_handler] + mov cx,word [keyboard_handler+4] + int 31h + sti + discard_keyboard_buffer: + mov ah,11h + int 16h + jz keyboard_buffer_ok + mov ah,10h + int 16h + jmp discard_keyboard_buffer + keyboard_buffer_ok: + mov ebx,[allocated_memory] + call release_memory + mov esi,buffer+3000h + call go_to_directory + jmp main_loop + assign_to_compiler: + mov eax,[editor_memory] + xchg eax,[main_project_file] + cmp eax,[editor_memory] + jne main_loop + mov [main_project_file],0 + jmp main_loop + calculator: + call calculator_window + jmp main_loop + options: + push [editor_style] + call options_dialog + pop eax + jnc main_loop + mov [editor_style],eax + jmp main_loop + + startup_failed: + mov esi,_startup_failed + error_message_loop: + lodsb + or al,al + jz error_message_ok + mov dl,al + mov ah,2 + int 21h + jmp error_message_loop + error_message_ok: + mov ax,4C0Fh + int 21h + + init_video: + call check_video_mode + mov bx,gs + movzx edx,byte [fs:4Ah] + mov [screen_width],edx + shl edx,1 + mov [video_pitch],edx + movzx eax,byte [fs:84h] + inc eax + mov [screen_height],eax + imul edx,eax + push edx + dec edx + shld ecx,edx,16 + mov ax,8 + int 31h + jc video_init_failed + pop ecx + call get_memory + jc video_init_failed + mov [video_storage],eax + mov [video_storage_handle],ebx + clc + ret + video_init_failed: + stc + ret + check_video_mode: + test byte [fs:65h],110b + jnz set_video_mode + cmp byte [fs:4Ah],80 + jb set_video_mode + ret + set_video_mode: + mov ax,3 + int 10h + ret + close_video: + mov ebx,[video_storage_handle] + call release_memory + ret + switch_to_ide_screen: + call check_video_mode + xor esi,esi + mov edi,[video_storage] + mov ecx,[video_pitch] + imul ecx,[screen_height] + rep movs byte [es:edi],[gs:esi] + mov ah,3 + xor bh,bh + int 10h + mov [stored_cursor],cx + mov [stored_cursor_position],dx + mov ah,0Fh + int 10h + mov [stored_page],bh + mov ax,0500h + int 10h + mov al,[fs:65h] + mov [stored_mode],al + mov ax,1003h + xor bx,bx + int 10h + mov eax,[screen_width] + mov [window_width],eax + mov eax,[screen_height] + sub eax,2 + mov [window_height],eax + call update_window + ret + switch_to_user_screen: + push es gs + pop es + mov esi,[video_storage] + xor edi,edi + mov ecx,[video_pitch] + imul ecx,[screen_height] + rep movs byte [es:edi],[ds:esi] + mov ah,1 + mov cx,[stored_cursor] + int 10h + mov ah,2 + xor bh,bh + mov dx,[stored_cursor_position] + int 10h + mov ah,5 + mov al,[stored_page] + int 10h + mov ax,1003h + xor bh,bh + mov bl,[stored_mode] + shr bl,5 + and bl,1 + int 10h + pop es + ret + + create_editor_instance: + call flush_editor_data + mov esi,[editor_memory] + find_last_instance: + mov eax,[esi+SEGMENT_HEADER_LENGTH+next_instance-editor_data] + or eax,eax + jz attach_new_instance + mov esi,eax + jmp find_last_instance + attach_new_instance: + push esi + call init_editor_memory + pop esi + jc not_enough_memory + mov eax,[editor_memory] + xchg eax,[esi+SEGMENT_HEADER_LENGTH+next_instance-editor_data] + mov [next_instance],eax + mov [previous_instance],esi + xor eax,eax + mov [file_path],eax + flush_editor_data: + mov edi,[editor_memory] + test edi,edi + jz flush_ok + add edi,SEGMENT_HEADER_LENGTH + mov esi,editor_data + mov ecx,editor_data_size + rep movsb + flush_ok: + ret + switch_editor_instance: + call flush_editor_data + cmp eax,[editor_memory] + je editor_switch_ok + mov [editor_memory],eax + lea esi,[eax+SEGMENT_HEADER_LENGTH] + mov edi,editor_data + mov ecx,editor_data_size + rep movsb + editor_switch_ok: + call update_positions + ret + remove_editor_instance: + mov eax,[editor_memory] + xor eax,[main_project_file] + jnz main_project_file_ok + mov [main_project_file],eax + main_project_file_ok: + mov esi,[previous_instance] + mov edi,[next_instance] + mov eax,edi + or edi,edi + jz next_instance_links_ok + mov [edi+SEGMENT_HEADER_LENGTH+previous_instance-editor_data],esi + next_instance_links_ok: + or esi,esi + jz previous_instance_links_ok + mov [esi+SEGMENT_HEADER_LENGTH+next_instance-editor_data],edi + mov eax,esi + previous_instance_links_ok: + push eax + call release_editor_memory + mov eax,[file_path] + or eax,eax + jz file_path_released + mov ebx,[file_path_handle] + call release_memory + file_path_released: + pop eax + or eax,eax + jz no_instance_left + call switch_editor_instance + clc + ret + no_instance_left: + stc + ret + + load_file: + push edx [editor_memory] + call get_full_pathname + push esi + call flush_editor_data + mov esi,[esp] + mov edx,[editor_memory] + prepare_to_scan_editors: + mov eax,[edx+SEGMENT_HEADER_LENGTH+previous_instance-editor_data] + or eax,eax + jz scan_editors + mov edx,eax + jmp prepare_to_scan_editors + scan_editors: + mov edi,[edx+SEGMENT_HEADER_LENGTH+file_path-editor_data] + or edi,edi + jz scan_next_editor + xor ecx,ecx + mov ebx,lower_case_table + compare_pathnames: + mov al,[esi+ecx] + xlatb + mov ah,al + mov al,[edi+ecx] + xlatb + cmp al,ah + jne scan_next_editor + or al,ah + jz file_found + inc ecx + jmp compare_pathnames + scan_next_editor: + mov edx,[edx+SEGMENT_HEADER_LENGTH+next_instance-editor_data] + or edx,edx + jnz scan_editors + mov eax,[undo_data] + sub eax,[unmodified_state] + or eax,[file_path] + jz open_in_current_instance + call create_editor_instance + open_in_current_instance: + pop esi + call use_pathname + mov edx,[file_path] + call open + jc load_failed + xor edx,edx + mov al,2 + call lseek + push eax ebx + lea ecx,[eax+1] + call get_memory + or eax,eax + jz not_enough_memory + mov esi,eax + mov edi,ecx + pop ebx + xor edx,edx + xor al,al + call lseek + pop ecx + mov edx,esi + mov byte [edx+ecx],0 + call read + jc load_failed + call close + push edi + call set_text + pop ebx + call release_memory + add esp,8 + ret + file_found: + mov eax,edx + call switch_editor_instance + pop esi + add esp,8 + ret + load_failed: + mov eax,[previous_instance] + or eax,[next_instance] + jnz cancel_instance + cancel_path_only: + xor ebx,ebx + xchg ebx,[file_path] + call release_memory + jmp editor_cancelled + cancel_instance: + mov eax,[editor_memory] + cmp eax,[esp] + je cancel_path_only + call remove_editor_instance + editor_cancelled: + pop eax + call switch_editor_instance + call update_screen + mov edi,buffer + mov esi,_loading_error + mov ebx,esp + call sprintf + pop eax + mov esi,buffer + mov ebx,_error + movzx eax,[error_box_colors] + call message_box + ret + get_full_pathname: + call adapt_path + sub edi,buffer + mov ax,7160h + xor cx,cx + xor si,si + stc + call dos_int + jnc got_full_pathname + mov ah,60h + call dos_int + jc full_pathname_exit + got_full_pathname: + lea esi,[buffer + edi] + cmp word [esi],'\\' + jne full_pathname_ok + cmp dword [esi+3],'.\A.' + jne full_pathname_ok + mov al,[esi+2] + mov ah,':' + add esi,5 + mov [esi],ax + full_pathname_ok: + clc + full_pathname_exit: + ret + use_pathname: + mov edi,[file_path] + or edi,edi + jnz copy_pathname + mov ecx,1000h + push esi + call get_memory + pop esi + or eax,eax + jz not_enough_memory + mov edi,eax + mov [file_path],edi + mov [file_path_handle],ebx + copy_pathname: + lodsb + stosb + or al,al + jnz copy_pathname + ret + save_file: + mov edx,[file_path] + call create + jc file_creation_error + mov [file_handle],ebx + mov esi,[first_line] + mov edi,[line_buffer] + copy_text: + mov ecx,[esi+8] + lea eax,[edi+ecx] + mov edx,[line_buffer_size] + shr edx,1 + sub eax,edx + cmp eax,[line_buffer] + ja flush_to_file + mov ebp,edi + xor edx,edx + push ecx + call copy_from_line + pop ecx + test [editor_style],FES_OPTIMALFILL + jz line_copied + cmp ecx,8 + jb line_copied + push esi edi ecx + mov esi,ebp + mov edi,[line_buffer] + mov eax,[line_buffer_size] + shr eax,1 + add edi,eax + push edi + mov ecx,[esp+4] + xor al,al + rep stosb + mov ecx,[esp+4] + mov edi,[esp] + call syntax_proc + pop ebx ecx edi + mov esi,ebp + mov edi,ebp + sub ebx,esi + xor edx,edx + optimal_fill: + lodsb + cmp al,20h + jne store_character + cmp byte [esi-1+ebx],0 + jne store_character + mov eax,esi + sub eax,ebp + test eax,111b + jz store_tab + inc edx + mov al,20h + stosb + loop optimal_fill + jmp optimal_fill_done + store_tab: + mov al,20h + or edx,edx + jz store_character + sub edi,edx + mov al,9 + store_character: + stosb + xor edx,edx + loop optimal_fill + optimal_fill_done: + pop esi + jmp line_copied + line_copied: + or esi,esi + jz flush_to_file + mov ax,0A0Dh + stosw + jmp copy_text + flush_to_file: + push esi + mov edx,[line_buffer] + mov ecx,edi + sub ecx,edx + mov ebx,[file_handle] + call write + jc file_writing_error + pop esi + mov edi,[line_buffer] + or esi,esi + jnz copy_text + mov ebx,[file_handle] + call close + mov eax,[undo_data] + mov [unmodified_state],eax + clc + ret + file_writing_error: + add esp,4 + file_creation_error: + call update_screen + mov esi,_saving_error + mov ebx,_error + movzx eax,[error_box_colors] + call message_box + stc + ret + get_saving_path: + mov esi,_save_as + call file_open_dialog + jc saving_aborted + push edx + cmp byte [edx+ecx-1],'\' + je save_in_new_directory + call open + pop edx + jc saving_allowed + push edx + call close + call update_screen + mov edi,buffer + mov esi,_overwrite_question + mov ebx,esp + call sprintf + mov esi,buffer + mov ebx,_save_as + mov eax,2 shl 24 + mov ax,[message_box_colors] + mov [first_button],_yes + mov [second_button],_no + call message_box + pop edx + cmp eax,1 + jb saving_aborted + je saving_allowed + call update_screen + jmp get_saving_path + save_in_new_directory: + mov byte [edx+ecx-1],0 + call update_screen + mov edi,buffer + mov esi,_directory_question + mov ebx,esp + call sprintf + mov esi,buffer + mov ebx,_save_as + mov eax,2 shl 24 + mov ax,[message_box_colors] + mov [first_button],_yes + mov [second_button],_no + call message_box + pop esi + cmp eax,1 + jb saving_aborted + jne saving_directory_ok + mov edi,buffer + call copy_asciiz + mov ax,7139h + xor edx,edx + call dos_int + jnc new_directory_created + cmp ax,7100h + jne error_creating_directory + mov ah,39h + call dos_int + jc error_creating_directory + new_directory_created: + mov ax,713Bh + call dos_int + jnc saving_directory_ok + cmp ax,7100h + jne error_creating_directory + mov ah,3Bh + call dos_int + jc error_creating_directory + saving_directory_ok: + call update_screen + jmp get_saving_path + error_creating_directory: + call update_screen + mov esi,_directory_error + mov ebx,_error + movzx eax,[error_box_colors] + call message_box + jmp saving_directory_ok + saving_allowed: + call get_full_pathname + jc invalid_saving_path + call use_pathname + clc + ret + invalid_saving_path: + call update_screen + mov esi,_invalid_path + mov ebx,_error + movzx eax,[error_box_colors] + call message_box + saving_aborted: + stc + ret + + load_configuration: + call load_ini_file + xor eax,eax + mov [memory_limit],eax + mov al,100 + mov [passes_limit],ax + mov ebx,_section_compiler + mov esi,_key_compiler_memory + call get_ini_int + jc memory_setting_ok + cmp eax,1 shl (32-10) + jae memory_setting_ok + shl eax,10 + mov [memory_limit],eax + memory_setting_ok: + mov esi,_key_compiler_passes + call get_ini_int + jc passes_setting_ok + test eax,eax + jz passes_setting_ok + cmp eax,10000h + ja passes_setting_ok + mov [passes_limit],ax + passes_setting_ok: + mov ebx,_section_options + mov esi,_key_options_securesel + call get_ini_int + jc securesel_init_ok + and [editor_style],not FES_SECURESEL + test eax,eax + jz securesel_init_ok + or [editor_style],FES_SECURESEL + securesel_init_ok: + mov esi,_key_options_autobrackets + call get_ini_int + jc autobrackets_init_ok + and [editor_style],not FES_AUTOBRACKETS + test eax,eax + jz autobrackets_init_ok + or [editor_style],FES_AUTOBRACKETS + autobrackets_init_ok: + mov esi,_key_options_autoindent + call get_ini_int + jc autoindent_init_ok + and [editor_style],not FES_AUTOINDENT + test eax,eax + jz autoindent_init_ok + or [editor_style],FES_AUTOINDENT + autoindent_init_ok: + mov esi,_key_options_smarttabs + call get_ini_int + jc smarttabs_init_ok + and [editor_style],not FES_SMARTTABS + test eax,eax + jz smarttabs_init_ok + or [editor_style],FES_SMARTTABS + smarttabs_init_ok: + mov esi,_key_options_optimalfill + call get_ini_int + jc optimalfill_init_ok + and [editor_style],not FES_OPTIMALFILL + test eax,eax + jz optimalfill_init_ok + or [editor_style],FES_OPTIMALFILL + optimalfill_init_ok: + mov ebx,_section_colors + mov esi,_key_color_text + call get_ini_int + jc color_text_init_ok + and al,0Fh + and [text_colors],0F0h + or [text_colors],al + color_text_init_ok: + mov esi,_key_color_background + call get_ini_int + jc color_background_init_ok + and al,0Fh + shl al,4 + and [text_colors],0Fh + or [text_colors],al + color_background_init_ok: + mov esi,_key_color_seltext + call get_ini_int + jc color_seltext_init_ok + and al,0Fh + and [selection_colors],0F0h + or [selection_colors],al + color_seltext_init_ok: + mov esi,_key_color_selbackground + call get_ini_int + jc color_selbackground_init_ok + and al,0Fh + shl al,4 + and [selection_colors],0Fh + or [selection_colors],al + color_selbackground_init_ok: + mov esi,_key_color_symbols + call get_ini_int + jc color_symbols_init_ok + mov [symbol_color],al + color_symbols_init_ok: + mov esi,_key_color_numbers + call get_ini_int + jc color_numbers_init_ok + mov [number_color],al + color_numbers_init_ok: + mov esi,_key_color_strings + call get_ini_int + jc color_strings_init_ok + mov [string_color],al + color_strings_init_ok: + mov esi,_key_color_comments + call get_ini_int + jc color_comments_init_ok + mov [comment_color],al + color_comments_init_ok: + mov esi,_key_color_statustext + call get_ini_int + jc color_statustext_init_ok + and al,0Fh + and [status_colors],0F0h + or [status_colors],al + color_statustext_init_ok: + mov esi,_key_color_statusbackground + call get_ini_int + jc color_statusbackground_init_ok + and al,0Fh + shl al,4 + and [status_colors],0Fh + or [status_colors],al + color_statusbackground_init_ok: + mov esi,_key_color_wintext + call get_ini_int + jc color_wintext_init_ok + and al,0Fh + and [window_colors],0F0h + or [window_colors],al + color_wintext_init_ok: + mov esi,_key_color_winbackground + call get_ini_int + jc color_winbackground_init_ok + and al,0Fh + shl al,4 + and [window_colors],0Fh + or [window_colors],al + color_winbackground_init_ok: + mov esi,_key_color_msgtext + call get_ini_int + jc color_msgtext_init_ok + and al,0Fh + and byte [message_box_colors+1],0F0h + or byte [message_box_colors+1],al + color_msgtext_init_ok: + mov esi,_key_color_msgbackground + call get_ini_int + jc color_msgbackground_init_ok + and al,0Fh + shl al,4 + and byte [message_box_colors+1],0Fh + or byte [message_box_colors+1],al + color_msgbackground_init_ok: + mov esi,_key_color_msgseltext + call get_ini_int + jc color_msgseltext_init_ok + and al,0Fh + and byte [message_box_colors],0F0h + or byte [message_box_colors],al + color_msgseltext_init_ok: + mov esi,_key_color_msgselbackground + call get_ini_int + jc color_msgselbackground_init_ok + and al,0Fh + shl al,4 + and byte [message_box_colors],0Fh + or byte [message_box_colors],al + color_msgselbackground_init_ok: + mov esi,_key_color_errtext + call get_ini_int + jc color_errtext_init_ok + and al,0Fh + and byte [error_box_colors+1],0F0h + or byte [error_box_colors+1],al + color_errtext_init_ok: + mov esi,_key_color_errbackground + call get_ini_int + jc color_errbackground_init_ok + and al,0Fh + shl al,4 + and byte [error_box_colors+1],0Fh + or byte [error_box_colors+1],al + color_errbackground_init_ok: + mov esi,_key_color_errseltext + call get_ini_int + jc color_errseltext_init_ok + and al,0Fh + and byte [error_box_colors],0F0h + or byte [error_box_colors],al + color_errseltext_init_ok: + mov esi,_key_color_errselbackground + call get_ini_int + jc color_errselbackground_init_ok + and al,0Fh + shl al,4 + and byte [error_box_colors],0Fh + or byte [error_box_colors],al + color_errselbackground_init_ok: + mov esi,_key_color_boxtext + call get_ini_int + jc color_boxtext_init_ok + and al,0Fh + and [box_colors],0F0h + or [box_colors],al + color_boxtext_init_ok: + mov esi,_key_color_boxbackground + call get_ini_int + jc color_boxbackground_init_ok + and al,0Fh + shl al,4 + and [box_colors],0Fh + or [box_colors],al + color_boxbackground_init_ok: + mov esi,_key_color_boxseltext + call get_ini_int + jc color_boxseltext_init_ok + and al,0Fh + and byte [box_selection_colors],0F0h + or byte [box_selection_colors],al + color_boxseltext_init_ok: + mov esi,_key_color_boxselbackground + call get_ini_int + jc color_boxselbackground_init_ok + and al,0Fh + shl al,4 + and byte [box_selection_colors],0Fh + or byte [box_selection_colors],al + color_boxselbackground_init_ok: + ret + load_ini_file: + cmp [ini_data],0 + je open_ini_file + mov ebx,[ini_data_handle] + call release_memory + open_ini_file: + mov edx,ini_path + call open + jc no_ini_file + xor edx,edx + mov al,2 + call lseek + push eax + xor edx,edx + xor al,al + call lseek + mov ecx,[esp] + add ecx,800h + push ebx + call get_memory + mov [ini_data],eax + mov [ini_data_handle],ebx + pop ebx ecx + test eax,eax + jz ini_loaded + mov edx,eax + mov byte [edx+ecx],1Ah + mov [ini_data_length],ecx + call read + call close + ret + no_ini_file: + mov ecx,800h + call get_memory + mov [ini_data],eax + test eax,eax + jz ini_loaded + mov byte [eax],1Ah + mov [ini_data_length],0 + ini_loaded: + ret + get_ini_value: + mov edi,esi + mov esi,[ini_data] + test esi,esi + jz ini_value_not_found + call find_ini_block + jc ini_value_not_found + call find_ini_value + ret + ini_value_not_found: + stc + ret + find_ini_block: + lodsb + cmp al,20h + je find_ini_block + cmp al,9 + je find_ini_block + cmp al,'[' + jne look_for_ini_block_in_next_line + find_block_name: + lodsb + cmp al,20h + je find_block_name + cmp al,9 + je find_block_name + dec esi + mov edx,ebx + compare_block_name_char: + lodsb + mov ah,[edx] + inc edx + cmp al,']' + je end_of_block_name + cmp al,20h + je end_of_block_name + cmp al,9 + je end_of_block_name + cmp al,1Ah + je end_of_block_name + cmp al,0Dh + je end_of_block_name + cmp al,0Ah + je end_of_block_name + or ah,ah + jz look_for_ini_block_in_next_line + sub ah,al + jz compare_block_name_char + jns block_name_char_case_insensitive + neg ah + sub al,20h + block_name_char_case_insensitive: + cmp ah,20h + jne look_for_ini_block_in_next_line + cmp al,41h + jb look_for_ini_block_in_next_line + cmp al,5Ah + jna compare_block_name_char + look_for_ini_block_in_next_line: + dec esi + call find_next_ini_line + cmp byte [esi],1Ah + jne find_ini_block + stc + ret + end_of_block_name: + test ah,ah + jnz look_for_ini_block_in_next_line + cmp al,']' + je end_of_block_name_ok + cmp al,20h + je find_block_name_closing_bracket + cmp al,9 + jne look_for_ini_block_in_next_line + find_block_name_closing_bracket: + lodsb + jmp end_of_block_name + end_of_block_name_ok: + call find_next_ini_line + clc + ret + find_next_ini_line: + lodsb + cmp al,0Dh + je line_ending + cmp al,0Ah + je line_ending + cmp al,1Ah + jne find_next_ini_line + dec esi + ret + line_ending: + lodsb + cmp al,0Dh + je line_ending + cmp al,0Ah + je line_ending + dec esi + ret + find_ini_value: + lodsb + cmp al,20h + je find_ini_value + cmp al,9 + je find_ini_value + cmp al,0Dh + je next_ini_value + cmp al,0Ah + je next_ini_value + dec esi + cmp al,1Ah + je no_ini_value_found + cmp al,'[' + je no_ini_value_found + mov edx,edi + compare_value_name_char: + lodsb + mov ah,[edx] + inc edx + cmp al,'=' + je end_of_value_name + cmp al,20h + je end_of_value_name + cmp al,9 + je end_of_value_name + cmp al,1Ah + je end_of_value_name + cmp al,0Dh + je end_of_value_name + cmp al,0Ah + je end_of_value_name + or ah,ah + jz next_ini_value + sub ah,al + jz compare_value_name_char + jns value_name_char_case_insensitive + neg ah + sub al,20h + value_name_char_case_insensitive: + cmp ah,20h + jne next_ini_value + cmp al,41h + jb next_ini_value + cmp al,5Ah + jna compare_value_name_char + next_ini_value: + dec esi + call find_next_ini_line + cmp byte [esi],1Ah + jne find_ini_value + no_ini_value_found: + stc + ret + end_of_value_name: + test ah,ah + jnz next_ini_value + cmp al,'=' + je ini_value_found + cmp al,20h + je find_ini_value_start + cmp al,9 + jne next_ini_value + find_ini_value_start: + lodsb + jmp end_of_value_name + ini_value_found: + xor ecx,ecx + find_value_length: + cmp byte [esi+ecx],0Dh + je value_length_found + cmp byte [esi+ecx],0Ah + je value_length_found + cmp byte [esi+ecx],1Ah + je value_length_found + inc ecx + jmp find_value_length + value_length_found: + clc + ret + get_ini_int: + call get_ini_value + jc no_ini_int + push ebx + call atoi + pop ebx + ret + no_ini_int: + stc + ret + atoi: + lodsb + cmp al,20h + je atoi + cmp al,9 + je atoi + mov bl,al + xor eax,eax + xor edx,edx + cmp bl,'-' + je atoi_digit + cmp bl,'+' + je atoi_digit + dec esi + atoi_digit: + mov dl,[esi] + sub dl,30h + jc atoi_done + cmp dl,9 + ja atoi_done + mov ecx,eax + shl ecx,1 + jc atoi_overflow + shl ecx,1 + jc atoi_overflow + add eax,ecx + shl eax,1 + jc atoi_overflow + js atoi_overflow + add eax,edx + jc atoi_overflow + inc esi + jmp atoi_digit + atoi_overflow: + stc + ret + atoi_done: + cmp bl,'-' + jne atoi_sign_ok + neg eax + atoi_sign_ok: + clc + ret + update_ini_value: + mov ebp,edx + mov esi,[ini_data] + test esi,esi + jz cannot_update_ini + call find_ini_block + jc create_ini_block + call find_ini_value + jc create_ini_value + mov edi,esi + mov esi,ebp + jecxz place_for_ini_value_exhausted + copy_value_to_ini: + lodsb + test al,al + jz shift_rest_of_ini_down + stosb + loop copy_value_to_ini + place_for_ini_value_exhausted: + cmp byte [esi],0 + jne shift_rest_of_ini_up + ret + shift_rest_of_ini_down: + lea esi,[edi+ecx] + neg ecx + xchg ecx,[ini_data_length] + add [ini_data_length],ecx + inc ecx + add ecx,[ini_data] + sub ecx,esi + rep movsb + ret + shift_rest_of_ini_up: + push esi edi + mov edi,esi + xor al,al + or ecx,-1 + repne scasb + neg ecx + sub ecx,2 + mov esi,[ini_data] + add esi,[ini_data_length] + mov edi,esi + add edi,ecx + add [ini_data_length],ecx + mov ebp,ecx + mov ecx,esi + sub ecx,[esp] + inc ecx + std + rep movsb + cld + pop edi esi + mov ecx,ebp + rep movsb + ret + cannot_update_ini: + ret + create_ini_block: + push edi + mov edi,[ini_data] + mov ecx,[ini_data_length] + add edi,ecx + jecxz make_ini_block_header + mov ax,0A0Dh + stosw + make_ini_block_header: + mov al,'[' + stosb + mov esi,ebx + call copy_str + mov al,']' + stosb + mov ax,0A0Dh + stosw + pop esi + append_ini_value: + call copy_str + mov al,'=' + stosb + mov esi,ebp + call copy_str + mov ax,0A0Dh + stosw + mov ecx,edi + sub ecx,[ini_data] + mov [ini_data_length],ecx + mov al,1Ah + stosb + ret + copy_str: + lodsb + test al,al + jz str_copied + stosb + jmp copy_str + str_copied: + ret + create_ini_value: + cmp esi,[ini_data] + je ini_value_placement_ok + dec esi + mov al,[esi] + cmp al,20h + je create_ini_value + cmp al,9 + je create_ini_value + cmp al,0Dh + je create_ini_value + cmp al,0Ah + je create_ini_value + inc esi + find_place_for_ini_value: + mov al,[esi] + lodsb + cmp al,0Ah + je ini_value_placement_ok + cmp al,1Ah + je value_at_end_of_ini + cmp al,0Dh + jne find_place_for_ini_value + cmp byte [esi],0Ah + jne ini_value_placement_ok + inc esi + ini_value_placement_ok: + push edi esi + xor al,al + or ecx,-1 + repne scasb + mov edi,ebp + repne scasb + neg ecx + mov edi,ecx + mov ecx,esi + neg ecx + mov esi,[ini_data] + add esi,[ini_data_length] + add [ini_data_length],edi + add edi,esi + add ecx,esi + inc ecx + std + rep movsb + cld + pop edi esi + call copy_str + mov al,'=' + stosb + mov esi,ebp + call copy_str + mov ax,0A0Dh + stosw + ret + value_at_end_of_ini: + xchg esi,edi + mov ax,0A0Dh + stosw + jmp append_ini_value + + shutdown: + call switch_to_user_screen + call load_ini_file + cmp [ini_data],0 + je exit + mov ebx,_section_options + mov edi,_key_options_securesel + test [editor_style],FES_SECURESEL + setnz al + add al,'0' + mov edx,line_buffer + mov byte [edx+1],0 + mov [edx],al + call update_ini_value + mov edi,_key_options_autobrackets + test [editor_style],FES_AUTOBRACKETS + setnz al + add al,'0' + mov edx,line_buffer + mov [edx],al + call update_ini_value + mov edi,_key_options_autoindent + test [editor_style],FES_AUTOINDENT + setnz al + add al,'0' + mov edx,line_buffer + mov [edx],al + call update_ini_value + mov edi,_key_options_smarttabs + test [editor_style],FES_SMARTTABS + setnz al + add al,'0' + mov edx,line_buffer + mov [edx],al + call update_ini_value + mov edi,_key_options_optimalfill + test [editor_style],FES_OPTIMALFILL + setnz al + add al,'0' + mov edx,line_buffer + mov [edx],al + call update_ini_value + mov edx,ini_path + call create + jc exit + mov edx,[ini_data] + mov ecx,[ini_data_length] + call write + call close + exit: + mov ax,4C00h + int 21h + +; Positioning + + update_positions: + mov eax,[screen_width] + mov [window_width],eax + mov eax,[screen_height] + sub eax,2 + mov [window_height],eax + call update_window + ret + update_cursor: + xor bh,bh + mov edx,[caret_position] + sub edx,[window_position] + jc cursor_out_of_sight + cmp edx,[window_width] + jae cursor_out_of_sight + mov eax,[caret_line_number] + sub eax,[window_line_number] + jc cursor_out_of_sight + cmp eax,[window_height] + jae cursor_out_of_sight + inc al + mov dh,al + mov ah,2 + int 10h + test [editor_mode],FEMODE_OVERWRITE + jnz block_cursor + mov ah,1 + mov cx,0D0Eh + int 10h + ret + block_cursor: + mov ah,1 + mov cx,000Fh + int 10h + ret + cursor_out_of_sight: + mov ah,1 + mov cx,1000h + int 10h + ret + +; Text drawing + + update_screen: + call update_title_bar + mov eax,[peak_line_length] + xor edx,edx + mov ebx,SEGMENT_DATA_LENGTH + div ebx + inc eax + mul ebx + shl eax,1 + mov ecx,eax + cmp [line_buffer],0 + je line_buffer_reallocate + cmp ecx,[line_buffer_size] + jbe line_buffer_ok + mov [line_buffer],0 + push ecx + mov ebx,[line_buffer_handle] + call release_memory + pop ecx + line_buffer_reallocate: + mov [line_buffer_size],ecx + call get_memory + or eax,eax + jz memory_shortage + mov [line_buffer],eax + mov [line_buffer_handle],ebx + line_buffer_ok: + mov esi,[window_line] + mov edx,[window_line_number] + mov eax,[video_pitch] + mov [screen_offset],eax + mov edi,[line_buffer] + prepare_line: + add esi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH + rep movsb + mov esi,[esi-SEGMENT_LENGTH] + btr esi,0 + jc prepare_line + push esi edx + mov ecx,edi + mov esi,[line_buffer] + sub ecx,esi + push ecx + mov al,[text_colors] + and al,0Fh + rep stosb + mov esi,[line_buffer] + mov ecx,[esp] + lea edi,[esi+ecx] + call syntax_proc + line_prepared: + mov edi,screen_row_buffer + mov ecx,[window_width] + mov al,20h + mov ah,[text_colors] + rep stosw + pop ecx + mov esi,[line_buffer] + lea ebx,[esi+ecx] + add esi,[window_position] + add ebx,[window_position] + sub ecx,[window_position] + jbe text_drawing_ok + mov edi,screen_row_buffer + cmp ecx,[window_width] + jbe draw_text + mov ecx,[window_width] + draw_text: + movsb + mov al,[text_colors] + and al,0F0h + or al,[ebx] + stosb + inc ebx + loop draw_text + text_drawing_ok: + mov edi,screen_row_buffer + cmp [selection_line],0 + je selection_marked + mov eax,[selection_line_number] + cmp eax,[caret_line_number] + jne mark_multiline_selection + cmp eax,[esp] + jne selection_marked + mark_simple_selection: + mov eax,[selection_position] + mov ecx,[caret_position] + cmp eax,ecx + jbe simple_selection_boundaries_ok + xchg eax,ecx + simple_selection_boundaries_ok: + sub ecx,[window_position] + jbe selection_marked + sub eax,[window_position] + jae simple_selection_start_ok + xor eax,eax + simple_selection_start_ok: + cmp ecx,[window_width] + jbe simple_selection_length_ok + mov ecx,[window_width] + simple_selection_length_ok: + sub ecx,eax + jbe selection_marked + lea edi,[screen_row_buffer+eax*2] + draw_selection: + inc edi + mov al,[selection_colors] + stosb + loop draw_selection + jmp selection_marked + mark_multiline_selection: + test [editor_mode],FEMODE_VERTICALSEL + jnz mark_vertical_selection + mov eax,[selection_line_number] + mov ebx,[selection_position] + mov edx,[caret_line_number] + mov ebp,[caret_position] + cmp eax,edx + jbe multiline_selection_boundaries_ok + xchg eax,edx + xchg ebx,ebp + multiline_selection_boundaries_ok: + mov edi,screen_row_buffer + mov ecx,[window_width] + cmp eax,[esp] + ja selection_marked + je mark_selection_start + cmp edx,[esp] + ja draw_selection + jb selection_marked + mark_selection_end: + cmp ebp,[window_position] + jbe selection_marked + sub ebp,[window_position] + cmp ecx,ebp + jbe draw_selection + mov ecx,ebp + jmp draw_selection + mark_selection_start: + sub ebx,[window_position] + jbe draw_selection + sub ecx,ebx + jbe selection_marked + lea edi,[edi+ebx*2] + jmp draw_selection + mark_vertical_selection: + mov eax,[selection_line_number] + mov edx,[caret_line_number] + sub eax,[esp] + jz mark_simple_selection + sub edx,[esp] + jz mark_simple_selection + xor eax,edx + js mark_simple_selection + selection_marked: + push es gs + pop es + mov esi,screen_row_buffer + mov edi,[screen_offset] + mov ecx,[window_width] + shr ecx,1 + rep movsd + setc cl + rep movsw + mov eax,[window_width] + shl eax,1 + sub edi,eax + add edi,[video_pitch] + mov [screen_offset],edi + pop es + pop edx esi + inc edx + mov eax,edx + sub eax,[window_line_number] + cmp eax,[window_height] + jae screen_ok + mov edi,[line_buffer] + or esi,esi + jnz prepare_line + push esi edx + push [window_position] + jmp line_prepared + screen_ok: + call update_status_bar + ret + + syntax_proc: + mov ebx,characters + xor edx,edx + scan_syntax: + lodsb + check_character: + cmp al,20h + je syntax_space + cmp al,3Bh + je syntax_comment + mov ah,al + xlatb + or al,al + jz syntax_symbol + or edx,edx + jnz syntax_neutral + cmp ah,27h + je syntax_string + cmp ah,22h + je syntax_string + cmp ah,24h + je syntax_pascal_hex + cmp ah,39h + ja syntax_neutral + cmp ah,30h + jae syntax_number + syntax_neutral: + or edx,-1 + inc edi + loop scan_syntax + jmp syntax_done + syntax_space: + xor edx,edx + inc edi + loop scan_syntax + jmp syntax_done + syntax_symbol: + mov al,[symbol_color] + stosb + xor edx,edx + loop scan_syntax + jmp syntax_done + syntax_pascal_hex: + cmp ecx,1 + je syntax_neutral + mov al,[esi] + mov ah,al + xlatb + or al,al + jz syntax_neutral + cmp ah,24h + jne syntax_number + cmp ecx,2 + je syntax_neutral + mov al,[esi+1] + xlatb + or al,al + jz syntax_neutral + syntax_number: + mov al,[number_color] + stosb + loop number_character + jmp syntax_done + number_character: + lodsb + mov ah,al + xlatb + xchg al,ah + or ah,ah + jz check_character + cmp al,20h + je check_character + cmp al,3Bh + je check_character + mov al,[number_color] + stosb + loop number_character + jmp syntax_done + syntax_string: + mov al,[string_color] + stosb + dec ecx + jz syntax_done + lodsb + cmp al,ah + jne syntax_string + mov al,[string_color] + stosb + dec ecx + jz syntax_done + lodsb + cmp al,ah + je syntax_string + xor edx,edx + jmp check_character + process_comment: + lodsb + cmp al,20h + jne syntax_comment + inc edi + loop process_comment + jmp syntax_done + syntax_comment: + mov al,[comment_color] + stosb + loop process_comment + syntax_done: + ret + +; Status drawing + + update_status_bar: + mov edi,screen_row_buffer + mov al,20h + mov ecx,[screen_width] + rep stosb + mov edi,screen_row_buffer+256 + mov eax,'Row ' + stosd + mov eax,[caret_line_number] + call number_as_text + mov al,'/' + stosb + mov eax,[lines_count] + call number_as_text + mov eax,', Co' + stosd + mov eax,'lumn' + stosd + mov al,' ' + stosb + mov eax,[caret_position] + inc eax + call number_as_text + mov al,'/' + stosb + mov eax,[maximum_position] + inc eax + call number_as_text + mov ecx,edi + mov esi,screen_row_buffer+256 + sub ecx,esi + mov eax,[screen_width] + lea edi,[screen_row_buffer+eax-1] + sub edi,ecx + mov byte [edi-2],0B3h + lea ebx,[edi-11] + rep movsb + mov edi,ebx + sub ebx,2 + test [editor_mode],FEMODE_READONLY + jnz readonly_status + mov eax,[undo_data] + cmp eax,[unmodified_state] + je editor_status_ok + mov eax,'Modi' + stosd + mov eax,'fied' + stosd + jmp editor_status_ok + readonly_status: + dec ebx + dec edi + mov eax,'Read' + stosd + mov al,'-' + stosb + mov eax,'only' + stosd + editor_status_ok: + mov byte [ebx],0B3h + push ebx + mov edi,screen_row_buffer+1 + xor eax,eax + mov edx,[previous_instance] + count_preceding_instances: + inc eax + or edx,edx + jz preceding_instances_count_ok + mov edx,[edx+SEGMENT_HEADER_LENGTH+previous_instance-editor_data] + jmp count_preceding_instances + preceding_instances_count_ok: + push eax + call number_as_text + mov al,'/' + stosb + pop eax + mov edx,[next_instance] + count_following_instances: + or edx,edx + jz following_instances_count_ok + inc eax + mov edx,[edx+SEGMENT_HEADER_LENGTH+next_instance-editor_data] + jmp count_following_instances + following_instances_count_ok: + call number_as_text + inc edi + mov al,'-' + stosb + inc edi + pop ecx + sub ecx,edi + mov esi,[file_path] + call get_file_title + print_file_title: + lodsb + or al,al + jz editor_title_ok + stosb + loop print_file_title + editor_title_ok: + push es gs + pop es + mov edi,[video_pitch] + mov eax,[screen_height] + dec eax + imul edi,eax + mov esi,screen_row_buffer + mov ecx,[screen_width] + mov ah,[status_colors] + draw_status_bar: + lodsb + stosw + loop draw_status_bar + pop es + ret + get_file_title: + or esi,esi + jz untitled + mov ebx,esi + find_file_name: + lodsb + or al,al + jz file_title_ok + cmp al,'\' + jne find_file_name + mov ebx,esi + jmp find_file_name + file_title_ok: + mov esi,ebx + ret + untitled: + mov esi,_untitled + ret + update_title_bar: + mov edi,screen_row_buffer + mov al,20h + mov ecx,[screen_width] + sub ecx,10+1 + rep stosb + mov al,0B3h + stosb + mov esi,_caption + mov edi,screen_row_buffer+1 + draw_caption: + lodsb + or al,al + jz caption_ok + stosb + jmp draw_caption + caption_ok: + mov edx,[main_project_file] + or edx,edx + jz main_file_title_ok + mov al,20h + stosb + mov al,'-' + stosb + mov al,20h + stosb + mov esi,[file_path] + cmp edx,[editor_memory] + je get_main_file_title + mov esi,[edx+SEGMENT_HEADER_LENGTH+file_path-editor_data] + get_main_file_title: + call get_file_title + mov ecx,[screen_width] + add ecx,screen_row_buffer-14 + sub ecx,edi + print_main_file_title: + lodsb + or al,al + jz main_file_title_ok + stosb + loop print_main_file_title + main_file_title_ok: + push es gs + pop es + xor edi,edi + mov esi,screen_row_buffer + mov ecx,[screen_width] + sub ecx,10 + mov ah,[status_colors] + draw_title_bar: + lodsb + stosw + loop draw_title_bar + pop es + call update_clock + ret + update_clock: + mov edi,[screen_width] + mov ecx,10 + sub edi,ecx + shl edi,1 + mov al,[status_colors] + prepare_clock_colors: + mov [gs:edi+(ecx-1)*2+1],al + loop prepare_clock_colors + mov ah,2Ch + int 21h + mov [gs:edi],byte 20h + mov al,ch + aam + add ax,'00' + mov [gs:edi+1*2],ah + mov [gs:edi+2*2],al + mov [gs:edi+3*2],byte ':' + mov al,cl + aam + add ax,'00' + mov [gs:edi+4*2],ah + mov [gs:edi+5*2],al + mov [gs:edi+6*2],byte ':' + mov al,dh + aam + add ax,'00' + mov [gs:edi+7*2],ah + mov [gs:edi+8*2],al + mov [gs:edi+9*2],byte 20h + ret + wait_for_input: + call update_clock + mov ah,11h + int 16h + jz wait_for_input + mov ah,10h + int 16h + test ax,ax + jz wait_for_input + ret + number_as_text: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + number_loop: + div ecx + push edx + cmp ecx,1 + je store_digit + or bl,bl + jnz store_digit + or al,al + jz digit_ok + not bl + store_digit: + add al,'0' + stosb + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz number_loop + pop ebx + ret + sprintf: + lodsb + cmp al,'%' + je format_parameter + stosb + or al,al + jnz sprintf + ret + format_parameter: + lodsb + mov edx,[ebx] + add ebx,4 + cmp al,'s' + je insert_string + cmp al,'d' + je insert_number + or al,al + jnz sprintf + dec esi + jmp sprintf + insert_number: + push esi + mov eax,edx + call number_as_text + pop esi + jmp sprintf + insert_string: + push esi + mov esi,edx + string_insertion_loop: + lodsb + or al,al + jz string_insertion_ok + stosb + jmp string_insertion_loop + string_insertion_ok: + pop esi + jmp sprintf + +; Windows + + message_box: + push eax ebx + xor ebp,ebp + mov edi,buffer+200h + mov dl,[esp+4+3] + or dl,dl + jnz calculate_buttons_width + mov dl,1 + mov [first_button],_ok + calculate_buttons_width: + mov [buttons_width],0 + mov eax,[first_button] + call add_button_width + dec dl + jz buttons_width_ok + add [buttons_width],2 + mov eax,[second_button] + call add_button_width + jmp buttons_width_ok + add_button_width: + push edi + mov edi,eax + xor al,al + or ecx,-1 + repne scasb + neg cl + add cl,6-2 + add [buttons_width],cl + pop edi + ret + buttons_width_ok: + mov al,[buttons_width] + mov [message_width],al + start_message_line: + mov ebx,edi + mov edx,edi + mov ecx,[screen_width] + sub ecx,14 + mov eax,[screen_height] + sub eax,7 + inc ebp + cmp ebp,eax + jae message_prepared + copy_message: + lodsb + stosb + cmp al,20h + jne message_character_ok + mov edx,edi + message_character_ok: + cmp byte [esi],0 + je message_prepared + loop copy_message + cmp edx,ebx + je split_word + lea eax,[edx-1] + mov ecx,[screen_height] + sub ecx,7 + inc ebp + cmp ebp,ecx + je cut_message + mov byte [eax],0Ah + sub eax,ebx + mov ebx,edx + mov ecx,[screen_width] + lea ecx,[ecx-14+ebx] + sub ecx,edi + cmp al,[message_width] + jbe copy_message + mov [message_width],al + jmp copy_message + cut_message: + mov edi,eax + jmp message_prepared + split_word: + mov eax,[screen_width] + sub eax,14 + mov [message_width],al + mov al,0Ah + stosb + jmp start_message_line + message_prepared: + mov eax,edi + sub eax,ebx + cmp al,[message_width] + jbe message_width_ok + mov [message_width],al + message_width_ok: + xor al,al + stosb + mov ecx,ebp + mov ch,cl + add ch,6 + mov cl,[message_width] + add cl,8 + pop esi + mov ah,[esp+1] + call draw_centered_window + mov esi,buffer+200h + add edi,2*2 + draw_message: + xor ecx,ecx + add edi,[video_pitch] + draw_message_row: + lodsb + or al,al + jz message_drawn + cmp al,0Ah + je draw_message + mov byte [gs:edi+ecx*2],al + inc ecx + jmp draw_message_row + message_drawn: + add edi,[video_pitch] + add edi,[video_pitch] + mov cx,1000h + mov ah,1 + int 10h + movzx eax,[message_width] + sub al,[buttons_width] + and al,not 1 + add edi,eax + cmp byte [esp+3],2 + jae two_button_message + pop eax + mov ah,al + mov esi,[first_button] + call draw_button + wait_for_ok: + call wait_for_input + cmp ah,1 + je message_aborted + cmp al,20h + je message_ok + cmp al,0Dh + jne wait_for_ok + message_ok: + mov eax,1 + ret + message_aborted: + xor eax,eax + ret + two_button_message: + pop edx + xor cl,cl + test edx,10000h + jnz two_button_loop + mov cl,-1 + two_button_loop: + push edi + mov al,dl + and al,cl + mov ah,cl + not ah + and ah,dh + or ah,al + mov esi,[first_button] + call draw_button + add edi,2*2 + mov al,dh + and al,cl + mov ah,cl + not ah + and ah,dl + or ah,al + mov esi,[second_button] + call draw_button + push ecx edx + call wait_for_input + pop edx ecx edi + cmp ah,1 + je message_aborted + cmp al,9 + je two_button_switch + cmp ah,0Fh + je two_button_switch + cmp ah,4Bh + je two_button_switch + cmp ah,4Dh + je two_button_switch + cmp ah,48h + je two_button_switch + cmp ah,50h + je two_button_switch + cmp al,0Dh + je button_selected + cmp al,20h + je button_selected + mov ebx,lower_case_table + xlatb + mov ah,al + mov esi,[first_button] + mov al,[esi] + xlatb + cmp al,ah + je message_ok + mov esi,[second_button] + mov al,[esi] + xlatb + cmp al,ah + je message_second_choice + jmp two_button_loop + button_selected: + or cl,cl + jnz message_ok + message_second_choice: + mov eax,2 + ret + two_button_switch: + not cl + jmp two_button_loop + draw_button: + push es gs + pop es + mov al,'[' + stosw + mov al,20h + stosw + stosw + draw_button_label: + lodsb + or al,al + jz button_label_ok + stosw + jmp draw_button_label + button_label_ok: + mov al,20h + stosw + stosw + mov al,']' + stosw + pop es + ret + draw_centered_window: + mov dl,byte [screen_width] + sub dl,cl + shr dl,1 + mov dh,byte [screen_height] + sub dh,ch + shr dh,1 + test [command_flags],80h + jz draw_window + mov ebx,[caret_line_number] + sub ebx,[window_line_number] + add ebx,3 + cmp bl,dh + jbe draw_window + mov al,dh + add al,ch + add al,3 + cmp al,bl + jb draw_window + mov dh,bl + movzx edi,ch + add edi,ebx + add edi,2 + cmp edi,[screen_height] + jb draw_window + sub dh,ch + sub dh,4 + draw_window: + push es gs + pop es + movzx edi,dh + imul edi,[video_pitch] + movzx ebx,dl + shl ebx,1 + add edi,ebx + movzx edx,ch + movzx ecx,cl + sub ecx,4 + sub edx,2 + push ecx edi + mov al,' ' + stos word [edi] + mov al,'É' + stos word [edi] + mov al,'Í' + stos word [edi] + dec ecx + mov al,' ' + stos word [edi] + dec ecx + draw_title: + lods byte [esi] + or al,al + jz title_ok + stos word [edi] + loop draw_title + jmp finish_upper_border + title_ok: + mov al,' ' + stos word [edi] + dec ecx + jz finish_upper_border + mov al,'Í' + rep stos word [edi] + finish_upper_border: + mov al,'»' + stos word [edi] + mov al,' ' + stos word [edi] + pop edi ecx + add edi,[video_pitch] + lea ebp,[edi+2*2] + draw_window_lines: + push ecx edi + mov al,' ' + stos word [edi] + mov al,'º' + stos word [edi] + mov al,' ' + rep stos word [edi] + mov al,'º' + stos word [edi] + mov al,' ' + stos word [edi] + mov byte [es:edi+1],8 + mov byte [es:edi+3],8 + pop edi ecx + add edi,[video_pitch] + dec edx + jnz draw_window_lines + push ecx edi + mov al,' ' + stos word [edi] + mov al,'È' + stos word [edi] + mov al,'Í' + rep stos word [edi] + mov al,'¼' + stos word [edi] + mov al,' ' + stos word [edi] + mov byte [es:edi+1],8 + mov byte [es:edi+3],8 + pop edi ecx + mov eax,[video_pitch] + lea edi,[edi+eax+2*2+1] + mov al,8 + add ecx,4 + finish_bottom_shadow: + stos byte [edi] + inc edi + loop finish_bottom_shadow + mov edi,ebp + mov eax,edi + cdq + idiv [video_pitch] + sar edx,1 + mov dh,al + pop es + ret + create_edit_box: + mov byte [ebx],1 + mov [ebx+1],al + mov [ebx+2],dx + mov [ebx+4],ecx + xor eax,eax + mov [ebx+8],eax + mov [ebx+12],eax + lea edi,[ebx+16] + xor ecx,ecx + or esi,esi + jz edit_box_text_ok + init_edit_box_text: + lodsb + or al,al + jz edit_box_text_ok + stosb + inc ecx + cmp cx,[ebx+6] + jb init_edit_box_text + edit_box_text_ok: + mov [ebx+8],cx + mov [ebx+12],cx + xor al,al + stosb + test byte [ebx+1],1 + jz draw_edit_box + set_edit_box_focus: + push ebx + mov ah,1 + mov cx,0D0Eh + int 10h + pop ebx + jmp draw_edit_box + kill_edit_box_focus: + mov word [ebx+10],0 + push ebx + mov ah,1 + mov cx,1000h + int 10h + pop ebx + draw_edit_box: + test byte [ebx+1],1 + jz edit_box_position_ok + mov ax,[ebx+10] + sub ax,[ebx+12] + jae edit_box_position_correction + movzx ax,byte [ebx+4] + add ax,[ebx+10] + sub ax,2 + sub ax,[ebx+12] + jae edit_box_position_ok + edit_box_position_correction: + sub [ebx+10],ax + edit_box_position_ok: + push es gs + pop es + movzx edi,byte [ebx+3] + imul edi,[video_pitch] + movzx eax,byte [ebx+2] + lea edi,[edi+eax*2] + mov al,20h + cmp word [ebx+10],0 + je edit_box_left_edge_ok + mov al,1Bh + edit_box_left_edge_ok: + mov ah,[box_colors] + stosw + movzx eax,word [ebx+10] + lea esi,[ebx+16+eax] + movzx ebp,byte [ebx+4] + sub ebp,2 + mov edx,[ebx+12] + cmp dx,[ebx+14] + jbe draw_edit_box_before_selection + ror edx,16 + draw_edit_box_before_selection: + movzx ecx,dx + sub cx,[ebx+10] + jbe draw_edit_box_selection + mov ah,[box_colors] + call draw_edit_box_part + draw_edit_box_selection: + mov ax,dx + sub ax,cx + shr edx,16 + mov cx,dx + sub cx,ax + jbe draw_edit_box_after_selection + mov ah,[box_selection_colors] + test byte [ebx+1],1 + jnz edit_box_selection_visible + mov ah,[box_colors] + edit_box_selection_visible: + call draw_edit_box_part + draw_edit_box_after_selection: + mov ah,[box_colors] + mov cx,[ebx+8] + sub cx,dx + jbe draw_edit_box_ending + call draw_edit_box_part + draw_edit_box_ending: + mov ecx,ebp + mov al,20h + rep stosw + movzx edx,word [ebx+8] + lea edx,[ebx+16+edx] + cmp esi,edx + jae edit_box_right_edge_ok + mov al,1Ah + edit_box_right_edge_ok: + stosw + test byte [ebx+1],1 + jz edit_box_cursor_ok + mov dx,[ebx+2] + inc dl + mov ax,[ebx+12] + sub ax,[ebx+10] + add dl,al + mov ah,2 + push ebx + mov bh,0 + int 10h + pop ebx + edit_box_cursor_ok: + pop es + ret + draw_edit_box_part: + or bp,bp + jz edit_box_part_ok + cmp cx,bp + jbe edit_box_part_length_ok + mov cx,bp + edit_box_part_length_ok: + sub bp,cx + draw_edit_box_character: + lodsb + stosw + loopw draw_edit_box_character + edit_box_part_ok: + ret + set_box_focus: + or byte [ebx+1],1 + mov cl,[ebx] + cmp cl,1 + jb set_check_box_focus + je set_edit_box_focus + cmp cl,2 + je draw_list_box + ret + kill_box_focus: + and byte [ebx+1],not 1 + mov cl,[ebx] + cmp cl,1 + je kill_edit_box_focus + cmp cl,2 + je draw_list_box + ret + update_box: + cmp byte [ebx],0 + je update_check_box + ret + process_box_command: + mov cl,[ebx] + cmp cl,1 + jb check_box_command + je edit_box_command + cmp cl,2 + je list_box_command + stc + ret + edit_box_command: + cmp al,0E0h + jne edit_box_ascii_code + cmp ah,4Bh + je edit_box_left_key + cmp ah,4Dh + je edit_box_right_key + cmp ah,47h + je edit_box_home_key + cmp ah,4Fh + je edit_box_end_key + cmp ah,53h + je edit_box_delete + cmp ah,52h + je edit_box_insert + cmp ah,93h + je edit_box_ctrl_delete + cmp ah,92h + je edit_box_ctrl_insert + edit_box_unknown_command: + stc + ret + edit_box_ascii_code: + cmp al,8 + je edit_box_backspace + cmp al,18h + je edit_box_cut_block + cmp al,3 + je edit_box_ctrl_insert + cmp al,16h + je edit_box_paste_block + cmp al,20h + jb edit_box_unknown_command + test byte [ebx+1],100b + jz edit_box_ascii_code_ok + cmp al,30h + jb edit_box_command_done + cmp al,39h + ja edit_box_command_done + edit_box_ascii_code_ok: + mov dx,word [ebx+12] + cmp dx,word [ebx+14] + je edit_box_character + push eax + call edit_box_delete_block + pop eax + edit_box_character: + call edit_box_insert_character + jc edit_box_command_done + jmp edit_box_no_selection + edit_box_delete: + test byte [fs:17h],11b + jnz edit_box_cut_block + mov dx,word [ebx+12] + cmp dx,word [ebx+14] + jne edit_box_ctrl_delete + cmp dx,[ebx+8] + je edit_box_command_done + inc dx + mov [ebx+14],dx + jmp edit_box_ctrl_delete + edit_box_backspace: + mov dx,[ebx+12] + cmp dx,word [ebx+14] + jne edit_box_ctrl_delete + or dx,dx + jz edit_box_command_done + dec word [ebx+12] + mov [ebx+14],dx + edit_box_ctrl_delete: + call edit_box_delete_block + jmp edit_box_no_selection + edit_box_ctrl_insert: + call edit_box_copy_block + jmp edit_box_command_done + edit_box_cut_block: + call edit_box_copy_block + call edit_box_delete_block + jmp edit_box_no_selection + edit_box_insert_character: + test byte [ebx+1],100b + jz edit_box_character_allowed + cmp al,30h + jb edit_box_disallowed_character + cmp al,39h + ja edit_box_disallowed_character + edit_box_character_allowed: + movzx ecx,word [ebx+8] + cmp cx,[ebx+6] + je edit_box_full + lea edi,[ebx+16+ecx] + lea esi,[edi-1] + sub cx,[ebx+12] + std + rep movsb + cld + stosb + inc word [ebx+8] + inc word [ebx+12] + edit_box_disallowed_character: + clc + ret + edit_box_full: + stc + ret + edit_box_delete_block: + movzx eax,word [ebx+12] + lea esi,[ebx+16+eax] + movzx eax,word [ebx+14] + lea edi,[ebx+16+eax] + movzx eax,word [ebx+8] + lea ecx,[ebx+16+eax] + cmp esi,edi + jae edit_box_shift_rest_of_line + xchg esi,edi + edit_box_shift_rest_of_line: + sub ecx,esi + mov eax,edi + rep movsb + mov ecx,esi + sub ecx,edi + sub [ebx+8],cx + sub eax,ebx + sub eax,16 + mov [ebx+12],ax + mov [ebx+14],ax + ret + edit_box_copy_block: + movzx ecx,word [ebx+12] + movzx edx,word [ebx+14] + cmp ecx,edx + je edit_box_block_copied + ja edit_box_block_start_ok + xchg ecx,edx + edit_box_block_start_ok: + sub ecx,edx + lea esi,[ebx+16+edx] + push ebx esi ecx + cmp [clipboard],0 + je edit_box_allocate_clipboard + mov ebx,[clipboard_handle] + call release_memory + edit_box_allocate_clipboard: + mov ecx,[esp] + inc ecx + call get_memory + mov [clipboard],eax + mov [clipboard_handle],ecx + or eax,eax + jz not_enough_memory + mov edi,eax + pop ecx esi ebx + rep movsb + xor al,al + stosb + edit_box_block_copied: + ret + edit_box_insert: + test byte [fs:17h],11b + jz edit_box_command_done + edit_box_paste_block: + call edit_box_delete_block + mov esi,[clipboard] + or esi,esi + jz edit_box_command_done + edit_box_insert_block: + lodsb + or al,al + jz edit_box_no_selection + cmp al,0Dh + je edit_box_no_selection + push esi + call edit_box_insert_character + pop esi + jnc edit_box_insert_block + jmp edit_box_no_selection + edit_box_left_key: + cmp word [ebx+12],0 + je edit_box_no_selection + dec word [ebx+12] + jmp edit_box_moved_cursor + edit_box_right_key: + mov ax,[ebx+8] + cmp [ebx+12],ax + je edit_box_no_selection + inc word [ebx+12] + jmp edit_box_moved_cursor + edit_box_home_key: + mov word [ebx+12],0 + jmp edit_box_moved_cursor + edit_box_end_key: + mov ax,[ebx+8] + mov [ebx+12],ax + jmp edit_box_moved_cursor + edit_box_moved_cursor: + test byte [fs:17h],11b + jnz edit_box_redraw + edit_box_no_selection: + mov ax,[ebx+12] + mov [ebx+14],ax + edit_box_redraw: + call draw_edit_box + edit_box_command_done: + movzx eax,word [ebx+8] + mov byte [ebx+16+eax],0 + clc + ret + create_list_box: + mov byte [ebx],2 + mov [ebx+1],al + mov [ebx+2],dx + mov [ebx+4],ecx + xor eax,eax + mov [ebx+8],eax + mov [ebx+12],esi + draw_list_box: + mov ax,[ebx+8] + sub ax,[ebx+10] + jb list_box_adjust_up + movzx dx,byte [ebx+5] + sub ax,dx + jb list_box_adjustments_ok + inc ax + add [ebx+10],ax + jmp list_box_adjustments_ok + list_box_adjust_up: + add [ebx+10],ax + list_box_adjustments_ok: + movzx edi,byte [ebx+3] + imul edi,[video_pitch] + movzx ecx,byte [ebx+2] + lea edi,[edi+ecx*2] + movzx edx,word [ebx+10] + push es gs + pop es + draw_list_box_row: + mov ah,[box_colors] + movzx ecx,byte [ebx+4] + cmp dx,[ebx+6] + jae draw_empty_list_box_row + mov esi,[ebx+12] + mov esi,[esi+edx*4] + test byte [ebx+1],1 + jz list_box_row_colors_ok + cmp dx,[ebx+8] + jne list_box_row_colors_ok + mov ah,[box_selection_colors] + list_box_row_colors_ok: + sub ecx,2 + mov al,20h + stosw + draw_list_box_item: + lodsb + test al,al + jnz draw_list_box_item_character + dec esi + mov al,20h + draw_list_box_item_character: + stosw + loop draw_list_box_item + mov al,20h + cmp byte [esi],0 + je list_box_item_ending + mov al,1Ah + list_box_item_ending: + stosw + jmp list_box_row_drawn + draw_empty_list_box_row: + mov al,20h + rep stosw + list_box_row_drawn: + inc edx + mov ax,dx + sub ax,[ebx+10] + cmp al,[ebx+5] + jae list_box_drawn + add edi,[video_pitch] + movzx ecx,byte [ebx+4] + shl ecx,1 + sub edi,ecx + jmp draw_list_box_row + list_box_drawn: + pop es + ret + list_box_command: + cmp ah,48h + je list_box_up_key + cmp ah,50h + je list_box_down_key + cmp ah,47h + je list_box_home_key + cmp ah,4Fh + je list_box_end_key + cmp ah,49h + je list_box_pgup_key + cmp ah,51h + je list_box_pgdn_key + stc + ret + list_box_home_key: + xor eax,eax + mov [ebx+8],ax + jmp list_box_redraw + list_box_end_key: + mov ax,[ebx+6] + dec ax + mov [ebx+8],ax + jmp list_box_redraw + list_box_pgup_key: + movzx ax,byte [ebx+5] + sub [ebx+8],ax + jae list_box_redraw + mov word [ebx+8],0 + jmp list_box_redraw + list_box_pgdn_key: + movzx ax,byte [ebx+5] + add [ebx+8],ax + mov ax,[ebx+6] + dec ax + cmp [ebx+8],ax + jbe list_box_redraw + mov [ebx+8],ax + jmp list_box_redraw + list_box_up_key: + mov ax,[ebx+8] + sub ax,1 + jc list_box_command_done + dec word [ebx+8] + jmp list_box_redraw + list_box_down_key: + mov ax,[ebx+8] + inc ax + cmp ax,[ebx+6] + jae list_box_command_done + mov [ebx+8],ax + list_box_redraw: + call draw_list_box + list_box_command_done: + clc + ret + create_check_box: + mov byte [ebx],0 + mov [ebx+1],al + mov [ebx+2],dx + mov [ebx+4],cl + mov [ebx+8],ebp + mov [ebx+12],edi + movzx edx,byte [ebx+3] + imul edx,[video_pitch] + movzx ecx,byte [ebx+2] + lea edx,[edx+ecx*2] + mov al,'[' + test byte [ebx+1],2 + jz draw_check_box_left_bracket + mov al,'(' + draw_check_box_left_bracket: + mov byte [gs:edx],al + add edx,2 + mov al,20h + test byte [ebx+1],2 + jnz set_up_radio_initial_state + test [edi],ebp + jz draw_check_box_initial_state + mov al,'+' + jmp draw_check_box_initial_state + set_up_radio_initial_state: + cmp [edi],ebp + jne draw_check_box_initial_state + mov al,7 + draw_check_box_initial_state: + mov byte [gs:edx],al + add edx,2 + mov al,']' + test byte [ebx+1],2 + jz draw_check_box_right_bracket + mov al,')' + draw_check_box_right_bracket: + mov byte [gs:edx],al + add edx,2*2 + movzx ecx,byte [ebx+4] + draw_check_box_text: + lodsb + or al,al + jz check_box_text_ok + mov [gs:edx],al + add edx,2 + loop draw_check_box_text + check_box_text_ok: + test byte [ebx+1],1 + jnz set_check_box_focus + ret + set_check_box_focus: + push ebx + mov ah,2 + mov dx,[ebx+2] + inc dl + xor bh,bh + int 10h + mov ah,1 + mov cx,0D0Eh + int 10h + pop ebx + ret + check_box_command: + cmp al,20h + je switch_check_box_state + stc + ret + switch_check_box_state: + mov edi,[ebx+12] + mov eax,[ebx+8] + test byte [ebx+1],2 + jnz set_radio_state + xor [edi],eax + call update_check_box + clc + ret + set_radio_state: + mov [edi],eax + call update_check_box + clc + ret + update_check_box: + movzx edx,byte [ebx+3] + imul edx,[video_pitch] + movzx ecx,byte [ebx+2] + lea edx,[edx+(ecx+1)*2] + mov edi,[ebx+12] + mov eax,[ebx+8] + test byte [ebx+1],2 + jnz redraw_radio + test [edi],eax + mov al,20h + jz check_box_state_ok + mov al,'+' + check_box_state_ok: + mov byte [gs:edx],al + ret + redraw_radio: + cmp [edi],eax + mov al,20h + jne radio_state_ok + mov al,7 + radio_state_ok: + mov byte [gs:edx],al + ret + + init_common_dialog: + xor eax,eax + mov [boxes_count],eax + mov [current_box],eax + ret + register_box_in_dialog: + mov eax,[boxes_count] + inc [boxes_count] + mov [boxes+eax*4],ebx + test byte [ebx+1],1 + jz box_registered + mov [current_box],eax + box_registered: + ret + common_dialog_loop: + call wait_for_input + cmp ah,1 + je common_dialog_aborted + cmp al,0Dh + je common_dialog_ok + cmp al,9 + je common_dialog_cycle_boxes + cmp ah,0Fh + je common_dialog_reverse_cycle_boxes + mov edx,[current_box] + mov ebx,[boxes+edx*4] + call process_box_command + jnc common_dialog_command_processed + cmp ah,48h + je common_dialog_previous_box + cmp ah,50h + je common_dialog_next_box + cmp ah,4Bh + je common_dialog_previous_box + cmp ah,4Dh + je common_dialog_next_box + jmp common_dialog_loop + common_dialog_command_processed: + xor edx,edx + update_boxes: + mov ebx,[boxes+edx*4] + push edx + call update_box + pop edx + inc edx + cmp edx,[boxes_count] + jb update_boxes + mov eax,[common_dialog_callback] + test eax,eax + jz common_dialog_loop + call eax + jmp common_dialog_loop + common_dialog_next_box: + mov edx,[current_box] + lea eax,[edx+1] + cmp eax,[boxes_count] + je common_dialog_loop + mov [current_box],eax + jmp common_dialog_switch_box + common_dialog_previous_box: + mov edx,[current_box] + or edx,edx + jz common_dialog_loop + dec [current_box] + jmp common_dialog_switch_box + common_dialog_cycle_boxes: + mov edx,[current_box] + inc [current_box] + mov eax,[current_box] + cmp eax,[boxes_count] + jb common_dialog_switch_box + mov [current_box],0 + jmp common_dialog_switch_box + common_dialog_reverse_cycle_boxes: + mov edx,[current_box] + sub [current_box],1 + jnc common_dialog_switch_box + mov eax,[boxes_count] + add [current_box],eax + common_dialog_switch_box: + mov ebx,[boxes+edx*4] + call kill_box_focus + mov edx,[current_box] + mov ebx,[boxes+edx*4] + call set_box_focus + jmp common_dialog_loop + common_dialog_ok: + clc + ret + common_dialog_aborted: + stc + ret + get_entered_number: + xor edx,edx + get_digit: + lodsb + or al,al + jz entered_number_ok + sub al,30h + movzx eax,al + imul edx,10 + add edx,eax + jmp get_digit + entered_number_ok: + ret + draw_static: + lodsb + or al,al + jz fill_static + mov [gs:edi],al + add edi,2 + loop draw_static + ret + fill_static: + mov byte [gs:edi],20h + add edi,2 + loop fill_static + dec esi + ret + + file_open_dialog: + push esi + mov edi,buffer+3000h + mov byte [edi],0 + call get_current_directory + cmp byte [edi-2],'\' + je browser_startup_path_ok + mov word [edi-1],'\' + browser_startup_path_ok: + xor eax,eax + mov [file_list_buffer_handle],eax + call make_list_of_files + pop esi + mov dx,0308h + mov cl,35h + mov ch,byte [screen_height] + sub ch,7 + mov ah,[window_colors] + call draw_window + push edx + mov eax,[video_pitch] + mov edx,[screen_height] + sub edx,11 + imul edx,eax + lea edx,[edi+edx+8*2] + mov [current_box],edx + lea edi,[edi+eax+2*2] + mov esi,_file + mov ecx,5 + call draw_static + mov ebx,filename_buffer + xor esi,esi + mov ecx,27h + 256 shl 16 + mov edx,[esp] + add dx,0108h + mov al,1 + call create_edit_box + mov ebx,boxes + mov esi,[file_list] + mov ecx,[file_list_buffer_top] + sub ecx,esi + shl ecx,16-2 + mov cl,27h + mov ch,byte [screen_height] + sub ch,15 + pop edx + add dx,0308h + xor al,al + call create_list_box + call draw_browser_path + file_input_loop: + call wait_for_input + cmp ah,1 + je filename_aborted + cmp al,0Dh + je filename_accepted + cmp ah,0Fh + je activate_file_browser + cmp ah,50h + je activate_file_browser + mov ebx,filename_buffer + call process_box_command + jmp file_input_loop + activate_file_browser: + mov ebx,filename_buffer + call kill_box_focus + mov ebx,boxes + call set_box_focus + call update_file_input + file_browser_loop: + call wait_for_input + cmp ah,1 + je filename_aborted + cmp al,0Dh + je filename_accepted + cmp ah,0Fh + je activate_file_input + cmp ah,4Bh + je activate_file_input + cmp al,8 + je go_to_parent_directory + mov ebx,boxes + push dword [ebx+8] + call process_box_command + pop eax + cmp ax,[ebx+8] + je file_browser_loop + call update_file_input + jmp file_browser_loop + go_to_parent_directory: + cmp byte [buffer+3000h+3],0 + je file_browser_loop + mov edi,buffer + mov eax,'..' + stosd + jmp browser_chdir + filename_accepted: + mov edx,filename_buffer+16 + movzx eax,word [edx-16+8] + test eax,eax + jz got_filename + cmp byte [edx+eax-1],'\' + je browser_path_entered + cmp byte [edx+eax-1],':' + jne got_filename + browser_path_entered: + mov esi,edx + mov edi,buffer + copy_path_to_browse: + lodsb + stosb + test al,al + jnz copy_path_to_browse + cmp word [buffer+1],':' + je browser_directory_ok + cmp byte [edi-2],'\' + jne browser_chdir + mov byte [edi-2],0 + browser_chdir: + xor dx,dx + mov ax,713Bh + call dos_int + jnc browser_directory_ok + cmp ax,7100h + jne file_list_selection_ok + mov ah,3Bh + call dos_int + jc file_list_selection_ok + browser_directory_ok: + cmp byte [buffer+1],':' + jne browser_drive_ok + mov dl,[buffer] + sub dl,'A' + cmp dl,'Z'-'A' + jbe browser_change_drive + sub dl,'a'-'A' + browser_change_drive: + mov ah,0Eh + int 21h + browser_drive_ok: + push 0 + cmp dword [buffer],'..' + jne name_to_select_ok + mov edi,buffer+3000h + mov al,'\' + or ecx,-1 + find_last_directory_name: + mov esi,edi + repne scasb + cmp byte [edi],0 + jne find_last_directory_name + lea ecx,[edi-1] + sub ecx,esi + mov edi,buffer+400h + mov [esp],ecx + mov ebx,upper_case_table + get_name_to_select: + lodsb + xlatb + stosb + loop get_name_to_select + name_to_select_ok: + mov edi,buffer+3000h + call get_current_directory + jc browser_drive_invalid + cmp byte [edi-2],'\' + je browser_new_path_ok + mov word [edi-1],'\' + browser_new_path_ok: + call make_list_of_files + call draw_browser_path + mov ebx,filename_buffer + xor eax,eax + mov [ebx+8],eax + mov [ebx+12],eax + mov [ebx+16],al + mov ebx,boxes + mov esi,[file_list] + mov [ebx+12],esi + mov ecx,[file_list_buffer_top] + sub ecx,esi + shr ecx,2 + mov [ebx+6],cx + xor eax,eax + mov [ebx+8],eax + mov eax,esi + pop edx + find_name_to_select: + cmp eax,[file_list_buffer_top] + je file_list_selection_ok + mov esi,[eax] + add esi,2 + mov edi,buffer+400h + mov ecx,edx + repe cmpsb + je select_directory + add eax,4 + jmp find_name_to_select + select_directory: + sub eax,[file_list] + shr eax,2 + mov [ebx+8],ax + file_list_selection_ok: + test byte [filename_buffer+1],1 + jnz activate_file_input + jmp activate_file_browser + browser_drive_invalid: + mov dl,[buffer+3000h] + sub dl,'A' + cmp dl,'Z'-'A' + jbe browser_restore_drive + sub dl,'a'-'A' + browser_restore_drive: + mov ah,0Eh + int 21h + pop eax + jmp file_list_selection_ok + got_filename: + cmp [filename_buffer+16],0 + je file_input_loop + call release_list_of_files + mov edx,filename_buffer+16 + movzx ecx,word [filename_buffer+8] + clc + ret + filename_aborted: + call release_list_of_files + stc + ret + activate_file_input: + mov ebx,boxes + call kill_box_focus + mov ebx,filename_buffer + call set_box_focus + jmp file_input_loop + update_file_input: + mov ebx,boxes + mov esi,[ebx+12] + movzx eax,word [ebx+8] + mov esi,[esi+eax*4] + mov ah,[esi] + add esi,2 + mov edi,filename_buffer+16 + copy_file_item: + lodsb + stosb + test al,al + jnz copy_file_item + cmp ah,[browser_symbols+2] + je file_item_copied + cmp ah,[browser_symbols+3] + je file_item_copied + mov byte [edi-1],'\' + stosb + file_item_copied: + mov ecx,edi + sub ecx,1+filename_buffer+16 + mov ebx,filename_buffer + mov [ebx+8],cx + mov [ebx+12],cx + xor eax,eax + mov [ebx+10],ax + mov [ebx+14],ax + call draw_edit_box + ret + draw_browser_path: + mov edi,[current_box] + mov esi,buffer+3000h + mov ecx,27h + call draw_static + add edi,[video_pitch] + sub edi,27h*2 + mov ecx,27h + call draw_static + ret + make_list_of_files: + cmp [file_list_buffer_handle],0 + je default_buffer_for_file_list + mov edi,[file_list_buffer_top] + mov ecx,[file_list_buffer_size] + sub edi,ecx + jmp init_file_list + default_buffer_for_file_list: + mov edi,buffer+1000h + mov ecx,2000h + init_file_list: + lea ebx,[edi+ecx] + mov [file_list_buffer_top],ebx + mov ah,1Ah + xor edx,edx + call dos_int + mov ah,19h + int 21h + mov dl,al + mov ah,0Eh + int 21h + movzx ecx,al + mov dword [buffer],'A:' + list_drives: + push ecx edi + mov ax,290Ch + xor esi,esi + mov di,10h + call dos_int + pop edi + inc al + jz try_next_drive + cmp byte [buffer],'B' + jne add_drive + test byte [fs:10h],11000000b + jz try_next_drive + add_drive: + sub ebx,4 + mov [ebx],edi + mov esi,buffer + mov ax,2004h + stosw + movsw + movsb + try_next_drive: + inc byte [buffer] + pop ecx + loop list_drives + mov [file_list],ebx + mov [file_list_buffer],edi + cmp byte [buffer+3000h],0 + je file_list_made + mov edi,buffer + mov eax,'*.*' + stosd + mov ax,714Eh + mov cx,31h + xor esi,esi + xor edx,edx + mov di,10h + call dos_int + mov ebx,eax + jnc long_file_names_list + mov ah,4Eh + mov cx,31h + xor edx,edx + call dos_int + jc file_list_made + short_file_names_list: + sub [file_list],4 + mov edx,[file_list] + mov edi,[file_list_buffer] + cmp edi,edx + jae not_enough_memory_for_list + mov [edx],edi + mov esi,buffer+1Eh + test byte [esi-1Eh+15h],10h + jnz short_directory_name + mov ebx,lower_case_table + mov ax,2003h + stosw + jmp copy_short_file_name + short_directory_name: + mov ebx,upper_case_table + cmp word [esi],'..' + je short_parent_directory + cmp byte [esi],'.' + je short_directory_to_hide + mov ax,2002h + stosw + jmp copy_short_file_name + short_parent_directory: + cmp byte [buffer+3000h+3],0 + je short_directory_to_hide + mov ax,2001h + stosw + copy_short_file_name: + lodsb + xlat byte [ebx] + cmp edi,[file_list] + jae not_enough_memory_for_list + stosb + test al,al + jnz copy_short_file_name + short_file_name_copied: + mov [file_list_buffer],edi + mov ah,4Fh + call dos_int + jnc short_file_names_list + jmp file_list_made + short_directory_to_hide: + add [file_list],4 + jmp short_file_name_copied + not_enough_memory_for_long_file_name: + pop ebx + mov ax,71A1h + call dos_int + not_enough_memory_for_list: + cmp [file_list_buffer_handle],0 + jne really_not_enough_memory_for_list + mov ax,500h + mov edi,buffer + int 31h + mov ecx,[edi] + cmp ecx,2000h + jbe really_not_enough_memory_for_list + cmp ecx,100000h + jbe allocate_buffer_for_file_list + mov ecx,100000h + allocate_buffer_for_file_list: + mov [file_list_buffer_size],ecx + call get_memory + or eax,eax + jz really_not_enough_memory_for_list + mov [file_list_buffer_handle],ebx + mov edi,eax + mov ecx,[file_list_buffer_size] + jmp init_file_list + really_not_enough_memory_for_list: + add [file_list],4 + jmp file_list_made + long_file_names_list: + push ebx + sub [file_list],4 + mov edx,[file_list] + mov edi,[file_list_buffer] + cmp edi,edx + jae not_enough_memory_for_long_file_name + mov [edx],edi + mov esi,buffer+10h+2Ch + test byte [esi-2Ch],10h + jnz long_directory_name + mov ax,2003h + stosw + mov ebx,lower_case_table + jmp copy_long_file_name + long_directory_to_hide: + add [file_list],4 + jmp long_file_name_copied + long_directory_name: + mov ebx,upper_case_table + cmp byte [esi],'.' + jne long_directory_show + cmp byte [esi+1],0 + je long_directory_to_hide + cmp word [esi+1],'.' + jne long_directory_show + cmp byte [buffer+3000h+3],0 + je long_directory_to_hide + mov ax,2001h + stosw + jmp copy_long_file_name + long_directory_show: + mov ax,2002h + stosw + copy_long_file_name: + lodsb + xlatb + cmp edi,[file_list] + jae not_enough_memory_for_long_file_name + stosb + test al,al + jnz copy_long_file_name + long_file_name_copied: + mov [file_list_buffer],edi + pop ebx + mov ax,714Fh + xor esi,esi + mov di,10h + call dos_int + jnc long_file_names_list + mov ax,71A1h + call dos_int + file_list_made: + mov edx,[file_list_buffer_top] + sub edx,[file_list] + shr edx,2 + mov ebp,edx + sort_file_list: + shr ebp,1 + jz file_list_sorted + mov ebx,ebp + sorting_iteration: + cmp ebx,edx + jae sort_file_list + mov eax,ebx + place_into_right_blocks: + cmp eax,ebp + jb sort_next_offset + push edx + mov edx,eax + sub eax,ebp + push eax + mov esi,[file_list] + lea eax,[esi+eax*4] + lea edx,[esi+edx*4] + mov esi,[eax] + mov edi,[edx] + mov ecx,257 + repe cmpsb + jbe exchange_ok + mov esi,[eax] + xchg esi,[edx] + mov [eax],esi + exchange_ok: + pop eax edx + jmp place_into_right_blocks + sort_next_offset: + inc ebx + jmp sorting_iteration + file_list_sorted: + mov esi,[file_list] + mov ebx,browser_symbols + make_browser_symbols: + cmp esi,[file_list_buffer_top] + je file_list_done + mov edx,[esi] + mov al,[edx] + dec al + xlatb + mov [edx],al + add esi,4 + jmp make_browser_symbols + file_list_done: + ret + release_list_of_files: + mov ebx,[file_list_buffer_handle] + test ebx,ebx + jz list_of_files_released + call release_memory + list_of_files_released: + ret + goto_dialog: + mov esi,_position + mov dx,080Bh + mov cx,0719h + mov ah,[window_colors] + call draw_window + push edx + push edi + mov eax,[video_pitch] + lea edi,[edi+eax+5*2] + mov esi,_row + mov ecx,4 + call draw_static + pop edi + mov eax,[video_pitch] + lea eax,[eax*3] + lea edi,[edi+eax+2*2] + mov esi,_column + mov ecx,7 + call draw_static + call init_common_dialog + mov edi,buffer+200h + mov esi,edi + mov eax,[caret_line_number] + call number_as_text + xor al,al + stosb + mov dx,[esp] + mov ebx,buffer + mov ecx,9 + 7 shl 16 + add dx,010Ah + mov al,101b + call create_edit_box + call register_box_in_dialog + mov edi,buffer+200h + mov esi,edi + mov eax,[caret_position] + inc eax + call number_as_text + xor al,al + stosb + pop edx + mov ebx,buffer+100h + mov ecx,9 + 7 shl 16 + add dx,030Ah + mov al,100b + call create_edit_box + call register_box_in_dialog + mov [common_dialog_callback],0 + call common_dialog_loop + jc goto_dialog_done + mov esi,buffer+16 + call get_entered_number + mov ecx,edx + mov esi,buffer+100h+16 + call get_entered_number + clc + goto_dialog_done: + ret + find_dialog: + push [find_flags] + mov esi,_find + mov dx,050Dh + mov cx,0A36h + mov ah,[window_colors] + call draw_window + push edx + mov eax,[video_pitch] + lea edi,[edi+eax+2*2] + mov esi,_text_to_find + mov ecx,13 + call draw_static + call init_common_dialog + call get_word_at_caret + mov edi,[line_buffer] + mov esi,[caret_line] + call copy_from_line + xor al,al + stosb + mov dx,[esp] + mov ebx,buffer + mov esi,[line_buffer] + mov ecx,32 + 1000 shl 16 + add dx,0110h + mov al,1 + call create_edit_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+800h + mov esi,_case_sensitive + mov edi,find_flags + mov ebp,FEFIND_CASESENSITIVE + add dx,0310h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+810h + mov esi,_whole_words + mov edi,find_flags + mov ebp,FEFIND_WHOLEWORDS + add dx,0410h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+820h + mov esi,_backward + mov edi,find_flags + mov ebp,FEFIND_BACKWARD + add dx,0510h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + pop edx + mov ebx,buffer+830h + mov esi,_search_in_whole_text + mov edi,find_flags + mov ebp,FEFIND_INWHOLETEXT + add dx,0610h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + mov [common_dialog_callback],0 + call common_dialog_loop + pop eax + jc find_dialog_aborted + mov esi,buffer+16 + mov eax,[find_flags] + clc + ret + find_dialog_aborted: + mov [find_flags],eax + ret + replace_dialog: + push [find_flags] + mov esi,_replace + mov dx,050Dh + mov cx,0D36h + mov ah,[window_colors] + call draw_window + push edx + push edi + mov eax,[video_pitch] + lea edi,[edi+eax+2*2] + mov esi,_text_to_find + mov ecx,13 + call draw_static + pop edi + mov eax,[video_pitch] + imul eax,3 + lea edi,[edi+eax+6*2] + mov esi,_new_text + mov ecx,9 + call draw_static + call init_common_dialog + call get_word_at_caret + mov edi,[line_buffer] + mov esi,[caret_line] + call copy_from_line + xor al,al + stosb + mov dx,[esp] + mov ebx,buffer + mov esi,[line_buffer] + mov ecx,32 + 1000 shl 16 + add dx,0110h + mov al,1 + call create_edit_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+400h + xor esi,esi + mov ecx,32 + 1000 shl 16 + add dx,0310h + xor al,al + call create_edit_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+800h + mov esi,_case_sensitive + mov edi,find_flags + mov ebp,FEFIND_CASESENSITIVE + add dx,0510h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+810h + mov esi,_whole_words + mov edi,find_flags + mov ebp,FEFIND_WHOLEWORDS + add dx,0610h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+820h + mov esi,_backward + mov edi,find_flags + mov ebp,FEFIND_BACKWARD + add dx,0710h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+830h + mov esi,_replace_in_whole_text + mov edi,find_flags + mov ebp,FEFIND_INWHOLETEXT + add dx,0810h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + pop edx + mov ebx,buffer+840h + mov esi,_prompt + mov edi,command_flags + mov ebp,1 + add dx,0910h + mov cl,18h + xor al,al + call create_check_box + call register_box_in_dialog + mov [common_dialog_callback],0 + call common_dialog_loop + pop eax + jc replace_dialog_aborted + mov esi,buffer+16 + mov edi,buffer+400h+16 + mov eax,[find_flags] + clc + ret + replace_dialog_aborted: + mov [find_flags],eax + ret + options_dialog: + mov esi,_options + mov dx,0616h + mov cx,0922h + mov ah,[window_colors] + call draw_window + push edx + call init_common_dialog + mov ebx,buffer + mov esi,_secure_selection + mov edi,editor_style + mov ebp,FES_SECURESEL + add dx,0102h + mov cl,16h + mov al,1 + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+10h + mov esi,_auto_brackets + mov edi,editor_style + mov ebp,FES_AUTOBRACKETS + add dx,0202h + mov cl,16h + xor al,al + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+20h + mov esi,_auto_indent + mov edi,editor_style + mov ebp,FES_AUTOINDENT + add dx,0302h + mov cl,16h + xor al,al + call create_check_box + call register_box_in_dialog + mov dx,[esp] + mov ebx,buffer+30h + mov esi,_smart_tabs + mov edi,editor_style + mov ebp,FES_SMARTTABS + add dx,0402h + mov cl,16h + xor al,al + call create_check_box + call register_box_in_dialog + pop edx + mov ebx,buffer+40h + mov esi,_optimal_fill + mov edi,editor_style + mov ebp,FES_OPTIMALFILL + add dx,0502h + mov cl,16h + xor al,al + call create_check_box + call register_box_in_dialog + mov [common_dialog_callback],0 + jmp common_dialog_loop + ascii_table_window: + mov esi,_ascii_table + mov dx,0616h + mov cx,0C24h + mov ah,[window_colors] + call draw_window + push edx + mov ah,[window_colors] + xor al,al + mov edx,8 + draw_ascii_table: + mov ecx,32 + draw_ascii_row: + mov [gs:edi],ax + add edi,2 + inc al + loop draw_ascii_row + add edi,[video_pitch] + sub edi,32*2 + dec edx + jnz draw_ascii_table + mov ecx,32 + draw_ascii_table_border: + mov byte [gs:edi+(ecx-1)*2],'Ä' + loop draw_ascii_table_border + add edi,[video_pitch] + push edi + mov ah,1 + mov cx,000Fh + int 10h + ascii_table_update: + mov dl,[selected_character] + mov dh,dl + and dl,11111b + shr dh,5 + add dx,word [esp+4] + mov ah,2 + xor bh,bh + int 10h + mov edi,screen_row_buffer+10h + mov eax,'Dec:' + stosd + mov al,20h + stosb + movzx eax,[selected_character] + call number_as_text + mov al,20h + stosb + mov eax,'Hex:' + stosd + mov al,20h + stosb + mov al,[selected_character] + shr al,4 + cmp al,10 + sbb al,69h + das + stosb + mov al,[selected_character] + and al,0Fh + cmp al,10 + sbb al,69h + das + stosb + xor al,al + stosb + sub edi,30+1 + mov esi,edi + mov eax,'Char' + stosd + mov eax,'acte' + stosd + mov eax,'r: ' + stosd + mov ecx,screen_row_buffer+10h + sub ecx,edi + mov al,20h + rep stosb + mov edi,[esp] + add edi,1*2 + mov ecx,30 + call draw_static + mov edi,[esp] + mov al,[selected_character] + mov [gs:edi+12*2],al + ascii_table_loop: + call wait_for_input + or ah,ah + jz pure_ascii_char + cmp ah,48h + je ascii_table_up + cmp ah,50h + je ascii_table_down + cmp ah,4Bh + je ascii_table_left + cmp ah,4Dh + je ascii_table_right + cmp ah,1 + je ascii_table_exit + cmp al,0E0h + je ascii_table_loop + cmp al,13 + je ascii_table_done + cmp al,2 + je ascii_table_done + cmp al,20h + jb ascii_table_loop + pure_ascii_char: + mov [selected_character],al + jmp ascii_table_update + ascii_table_exit: + pop eax eax + stc + ret + ascii_table_done: + pop eax eax + mov al,[selected_character] + clc + ret + ascii_table_up: + cmp [selected_character],20h + jb ascii_table_loop + sub [selected_character],20h + jmp ascii_table_update + ascii_table_down: + cmp [selected_character],0E0h + jae ascii_table_loop + add [selected_character],20h + jmp ascii_table_update + ascii_table_left: + test [selected_character],11111b + jz ascii_table_loop + dec [selected_character] + jmp ascii_table_update + ascii_table_right: + mov al,[selected_character] + inc al + test al,11111b + jz ascii_table_loop + mov [selected_character],al + jmp ascii_table_update + calculator_window: + mov [results_selection],0 + mov esi,_calculator + mov dx,0602h + mov cx,0B4Ch + mov ah,[window_colors] + call draw_window + push edi edx + mov eax,[video_pitch] + lea edi,[edi+eax+2*2] + mov esi,_expression + mov ecx,11 + call draw_static + mov eax,[video_pitch] + lea eax,[eax*3] + mov edi,[esp+4] + lea edi,[edi+eax+2*2] + mov esi,_result + mov ecx,65 + call draw_static + call init_common_dialog + mov ebx,buffer + xor esi,esi + mov ecx,56 + 1000 shl 16 + mov dx,[esp] + add dx,010Eh + mov al,1 + call create_edit_box + call register_box_in_dialog + mov ebx,buffer+2000h + mov esi,_null + mov edi,results_selection + xor ebp,ebp + mov dx,[esp] + add dx,0402h + mov cl,18h + mov al,2 + call create_check_box + call register_box_in_dialog + mov ebx,buffer+2010h + mov esi,_null + mov edi,results_selection + mov ebp,1 + mov dx,[esp] + add dx,0502h + mov cl,18h + mov al,2 + call create_check_box + call register_box_in_dialog + mov ebx,buffer+2020h + mov esi,_null + mov edi,results_selection + mov ebp,2 + mov dx,[esp] + add dx,0602h + mov cl,18h + mov al,2 + call create_check_box + call register_box_in_dialog + mov ebx,buffer+2030h + mov esi,_null + mov edi,results_selection + mov ebp,3 + mov dx,[esp] + add dx,0702h + mov cl,18h + mov al,2 + call create_check_box + call register_box_in_dialog + pop edx edi + mov eax,[video_pitch] + lea edi,[edi+eax*4+6*2] + mov [results_offset],edi + mov [common_dialog_callback],calculate_result + calculator_loop: + call common_dialog_loop + jc close_calculator + mov esi,[results_offset] + mov eax,[results_selection] + imul eax,[video_pitch] + add esi,eax + mov edi,buffer+16 + copy_result: + lods byte [gs:esi] + cmp al,20h + je result_ready + stosb + inc esi + jmp copy_result + result_ready: + mov ecx,edi + sub ecx,buffer+16 + mov ebx,buffer + mov [ebx+8],cx + mov [ebx+12],cx + xor eax,eax + mov [ebx+10],ax + mov [ebx+14],ax + cmp [current_box],0 + jne activate_expression_box + call draw_edit_box + jmp calculator_loop + activate_expression_box: + mov edx,[current_box] + mov ebx,[boxes+edx*4] + call kill_box_focus + mov [current_box],0 + mov ebx,buffer + call set_box_focus + jmp calculator_loop + close_calculator: + ret + calculate_result: + mov esi,buffer+16 + movzx eax,word [buffer+8] + lea edi,[esi+eax] + xor eax,eax + stosb + mov [progress_offset],eax + mov [source_start],eax + mov [hash_tree],eax + mov [macro_status],al + mov [symbols_file],eax + mov [memory_end],buffer+1000h + mov [resume_esp],esp + mov [resume_eip],calculator_error + call convert_line + push edi + call convert_expression + cmp byte [esi],0 + jne invalid_expression + mov al,')' + stosb + pop esi + mov [error_line],0 + mov [current_line],-1 + mov [value_size],0 + call calculate_expression + cmp [error_line],0 + je present_result + jmp [error] + present_result: + mov ebp,edi + cmp byte [ebp+13],0 + je result_in_64bit_composite_range + test byte [ebp+7],80h + jnz result_in_64bit_composite_range + mov esi,_null + mov edi,[results_offset] + add edi,[video_pitch] + mov ecx,65 + push edi + call draw_static + pop edi + add edi,[video_pitch] + mov ecx,65 + push edi + call draw_static + pop edi + add edi,[video_pitch] + mov ecx,65 + call draw_static + jmp present_decimal + result_in_64bit_composite_range: + mov eax,[ebp] + mov edx,[ebp+4] + mov edi,buffer+3000h + mov word [edi],'b' + make_binary_number: + mov bl,'0' + shrd eax,edx,1 + adc bl,0 + dec edi + mov [edi],bl + shr edx,1 + jnz make_binary_number + test eax,eax + jnz make_binary_number + mov esi,edi + mov eax,[video_pitch] + mov edi,[results_offset] + lea edi,[edi+eax*2] + mov ecx,65 + call draw_static + mov ecx,[ebp] + mov edx,[ebp+4] + mov edi,buffer+3000h + mov word [edi],'o' + make_octal_number: + mov al,cl + and al,111b + add al,'0' + dec edi + mov [edi],al + shrd ecx,edx,3 + shr edx,3 + jnz make_octal_number + test ecx,ecx + jnz make_octal_number + mov esi,edi + mov eax,[video_pitch] + mov edi,[results_offset] + lea eax,[eax*3] + add edi,eax + mov ecx,65 + call draw_static + mov ecx,[ebp] + mov edx,[ebp+4] + mov edi,buffer+3000h + mov word [edi],'h' + make_hexadecimal_number: + mov al,cl + and al,0Fh + cmp al,10 + sbb al,69h + das + dec edi + mov [edi],al + shrd ecx,edx,4 + shr edx,4 + jnz make_hexadecimal_number + test ecx,ecx + jnz make_hexadecimal_number + cmp al,'A' + jb hexadecimal_number_ok + dec edi + mov byte [edi],'0' + hexadecimal_number_ok: + mov esi,edi + mov eax,[video_pitch] + mov edi,[results_offset] + lea edi,[edi+eax] + mov ecx,65 + call draw_static + present_decimal: + mov edi,buffer+3000h + mov byte [edi],0 + mov ecx,10 + xor bl,bl + cmp byte [ebp+13],0 + je make_decimal_number + mov bl,'-' + mov eax,[ebp] + mov edx,[ebp+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [ebp],eax + mov [ebp+4],edx + or eax,edx + jnz make_decimal_number + dec edi + mov byte [edi],'6' + mov dword [ebp],99999999h + mov dword [ebp+4],19999999h + make_decimal_number: + mov eax,[ebp+4] + xor edx,edx + div ecx + mov [ebp+4],eax + mov eax,[ebp] + div ecx + mov [ebp],eax + add dl,'0' + dec edi + mov [edi],dl + or eax,[ebp+4] + jnz make_decimal_number + test bl,bl + jz decimal_number_ok + dec edi + mov [edi],bl + decimal_number_ok: + mov esi,edi + mov edi,[results_offset] + mov ecx,65 + call draw_static + ret + calculator_error: + mov ebx,[video_pitch] + mov ebp,[results_offset] + mov edx,4 + clear_results: + mov ecx,65 + mov edi,ebp + call fill_static + add ebp,ebx + dec edx + jnz clear_results + ret + +; Memory allocation + + get_memory: + push esi edi + mov ebx,ecx + shr ebx,16 + mov ax,501h + int 31h + jc dpmi_allocation_failed + mov ax,bx + shl eax,16 + mov ax,cx + mov edx,main + shl edx,4 + sub eax,edx + mov bx,si + shl ebx,16 + mov bx,di + pop edi esi + ret + dpmi_allocation_failed: + xor eax,eax + pop edi esi + ret + release_memory: + push esi edi + mov esi,ebx + shr esi,16 + mov di,bx + mov ax,502h + int 31h + pop edi esi + ret + get_low_memory: + mov ax,100h + mov bx,-1 + int 31h + movzx eax,bx + shl eax,4 + mov [low_memory_size],eax + mov ax,100h + int 31h + mov [low_memory_selector],dx + jnc low_memory_ok + xor edx,edx + mov [low_memory_size],edx + low_memory_ok: + ret + release_low_memory: + cmp [low_memory_size],0 + je low_memory_ok + mov ax,101h + mov dx,[low_memory_selector] + int 31h + ret + +; File operations + + dos_int: + push 0 0 0 + pushw buffer_segment buffer_segment + stc + pushfw + push eax + push ecx + push edx + push ebx + push 0 + push ebp + push esi + push edi + mov ax,300h + mov bx,21h + xor cx,cx + mov edi,esp + push es ss + pop es + int 31h + pop es + mov edi,[esp] + mov esi,[esp+4] + mov ebp,[esp+8] + mov ebx,[esp+10h] + mov edx,[esp+14h] + mov ecx,[esp+18h] + mov ah,[esp+20h] + add esp,32h + sahf + mov eax,[esp-32h+1Ch] + ret + open: + push esi edi + call adapt_path + mov ax,716Ch + mov bx,100000b + mov dx,1 + xor cx,cx + xor si,si + call dos_int + jnc open_done + cmp ax,7100h + je old_open + stc + jmp open_done + old_open: + mov ax,3D00h + xor dx,dx + call dos_int + open_done: + mov bx,ax + pop edi esi + ret + adapt_path: + mov esi,edx + mov edi,buffer + copy_path: + lodsb + cmp al,'/' + jne path_char_ok + mov al,'\' + path_char_ok: + stosb + or al,al + jnz copy_path + ret + create: + push esi edi + call adapt_path + mov ax,716Ch + mov bx,100001b + mov dx,10010b + xor cx,cx + xor si,si + xor di,di + call dos_int + jnc create_done + cmp ax,7100h + je old_create + stc + jmp create_done + old_create: + mov ah,3Ch + xor cx,cx + xor dx,dx + call dos_int + create_done: + mov bx,ax + pop edi esi + ret + write: + push edx esi edi ebp + mov ebp,ecx + mov esi,edx + write_loop: + mov ecx,1000h + sub ebp,1000h + jnc do_write + add ebp,1000h + mov ecx,ebp + xor ebp,ebp + do_write: + push ecx + mov edi,buffer + shr ecx,2 + rep movsd + mov ecx,[esp] + and ecx,11b + rep movsb + pop ecx + mov ah,40h + xor dx,dx + call dos_int + or ebp,ebp + jnz write_loop + pop ebp edi esi edx + ret + read: + push edx esi edi ebp + mov ebp,ecx + mov edi,edx + read_loop: + mov ecx,1000h + sub ebp,1000h + jnc do_read + add ebp,1000h + mov ecx,ebp + xor ebp,ebp + do_read: + push ecx + mov ah,3Fh + xor dx,dx + call dos_int + cmp ax,cx + jne eof + mov esi,buffer + mov ecx,[esp] + shr ecx,2 + rep movsd + pop ecx + and ecx,11b + rep movsb + or ebp,ebp + jnz read_loop + read_done: + pop ebp edi esi edx + ret + eof: + pop ecx + stc + jmp read_done + close: + mov ah,3Eh + int 21h + ret + lseek: + mov ah,42h + mov ecx,edx + shr ecx,16 + int 21h + pushf + shl edx,16 + popf + mov dx,ax + mov eax,edx + ret + +; Other functions needed by assembler core + + get_environment_variable: + push esi edi + mov ebx,_section_environment + call get_ini_value + pop edi ebx + jnc found_value_in_ini + push ds + mov ds,[environment_selector] + xor esi,esi + compare_variable_names: + mov edx,ebx + compare_name_char: + lodsb + mov ah,[es:edx] + inc edx + cmp al,'=' + je end_of_variable_name + or ah,ah + jz next_variable + sub ah,al + jz compare_name_char + cmp ah,20h + jne next_variable + cmp al,41h + jb next_variable + cmp al,5Ah + jna compare_name_char + next_variable: + lodsb + or al,al + jnz next_variable + cmp byte [esi],0 + jne compare_variable_names + pop ds + ret + end_of_variable_name: + or ah,ah + jnz next_variable + copy_variable_value: + lodsb + cmp edi,[es:memory_end] + jae out_of_memory + stosb + or al,al + jnz copy_variable_value + dec edi + pop ds + ret + found_value_in_ini: + lea eax,[edi+ecx] + cmp eax,[memory_end] + jae out_of_memory + rep movsb + ret + make_timestamp: + mov ah,2Ah + int 21h + push dx cx + movzx ecx,cx + mov eax,ecx + sub eax,1970 + mov ebx,365 + mul ebx + mov ebp,eax + mov eax,ecx + sub eax,1969 + shr eax,2 + add ebp,eax + mov eax,ecx + sub eax,1901 + mov ebx,100 + div ebx + sub ebp,eax + mov eax,ecx + xor edx,edx + sub eax,1601 + mov ebx,400 + div ebx + add ebp,eax + movzx ecx,byte [esp+3] + mov eax,ecx + dec eax + mov ebx,30 + mul ebx + add ebp,eax + cmp ecx,8 + jbe months_correction + mov eax,ecx + sub eax,7 + shr eax,1 + add ebp,eax + mov ecx,8 + months_correction: + mov eax,ecx + shr eax,1 + add ebp,eax + cmp ecx,2 + pop cx + jbe day_correction_ok + sub ebp,2 + test ecx,11b + jnz day_correction_ok + xor edx,edx + mov eax,ecx + mov ebx,100 + div ebx + or edx,edx + jnz day_correction + mov eax,ecx + mov ebx,400 + div ebx + or edx,edx + jnz day_correction_ok + day_correction: + inc ebp + day_correction_ok: + pop dx + movzx eax,dl + dec eax + add eax,ebp + mov ebx,24 + mul ebx + push eax + mov ah,2Ch + int 21h + pop eax + push dx + movzx ebx,ch + add eax,ebx + mov ebx,60 + mul ebx + movzx ebx,cl + add eax,ebx + mov ebx,60 + mul ebx + pop bx + movzx ebx,bh + add eax,ebx + adc edx,0 + ret + display_block: + mov edi,[display_length] + mov eax,[display_length] + add eax,ecx + cmp eax,[low_memory_size] + ja not_enough_memory + mov [display_length],eax + push es + mov es,[low_memory_selector] + rep movsb + pop es + ret + +; Error handling + + not_enough_memory: + call update_screen + mov esi,_memory_error + mov ebx,_error + movzx eax,[error_box_colors] + call message_box + mov esp,stack_top + jmp main_loop + + fatal_error: + cmp [progress_offset],0 + je error_outside_compiler + pop esi + mov esp,stack_top + push esi + mov ax,205h + mov bl,9 + mov edx,dword [keyboard_handler] + mov cx,word [keyboard_handler+4] + int 31h + mov ebx,[allocated_memory] + call release_memory + call update_screen + show_error_summary: + mov esi,buffer+3000h + call go_to_directory + mov esi,_assembler_error + mov edi,buffer + mov ebx,esp + call sprintf + mov esi,buffer + mov ebx,_compile + movzx eax,[error_box_colors] + mov [first_button],_ok + mov [second_button],_get_display + cmp [display_length],0 + je show_compilation_summary + or eax,2000000h + jmp show_compilation_summary + assembler_error: + cmp [progress_offset],0 + je error_outside_compiler + pop esi + mov esp,stack_top + push esi + mov ax,205h + mov bl,9 + mov edx,dword [keyboard_handler] + mov cx,word [keyboard_handler+4] + int 31h + and [output_file],0 + call show_display_buffer + call update_screen + mov ebx,[current_line] + find_error_origin: + test dword [ebx+4],80000000h + jz error_origin_found + mov ebx,[ebx+8] + jmp find_error_origin + error_origin_found: + mov esi,[ebx] + mov edi,filename_buffer + copy_error_file: + lodsb + stosb + or al,al + jnz copy_error_file + push dword [ebx+4] + mov ebx,[allocated_memory] + call release_memory + mov edx,filename_buffer + call load_file + show_error_line: + pop eax + call find_line + xor eax,eax + mov [selection_line],esi + mov [selection_line_number],ecx + mov [selection_position],eax + mov [caret_position],eax + push esi + lea edi,[esi+SEGMENT_HEADER_LENGTH] + lea ebp,[esi+SEGMENT_LENGTH] + mov ebx,characters + xor edx,edx + check_for_more_lines: + call peek_character + jc no_more_lines + cmp al,3Bh + je no_more_lines + mov ah,al + xlatb + or al,al + jz symbol + or edx,edx + jnz neutral + cmp ah,27h + je quoted + cmp ah,22h + je quoted + neutral: + or edx,-1 + jmp check_for_more_lines + peek_character: + cmp edi,ebp + je peek_next_segment + mov al,[edi] + inc edi + clc + ret + peek_next_segment: + mov esi,[esi] + btr esi,0 + lea edi,[esi+SEGMENT_HEADER_LENGTH] + lea ebp,[esi+SEGMENT_LENGTH] + jc peek_character + stc + ret + symbol: + cmp ah,'\' + je backslash + xor edx,edx + jmp check_for_more_lines + quoted: + call peek_character + jc no_more_lines + cmp al,ah + jne quoted + call peek_character + jc no_more_lines + cmp al,ah + je quoted + dec edi + xor edx,edx + jmp check_for_more_lines + backslash: + call peek_character + jc more_lines + cmp al,20h + je backslash + cmp al,3Bh + jne no_more_lines + comment: + mov esi,[esi] + btr esi,0 + jc comment + more_lines: + or esi,esi + jz last_line + inc ecx + mov [esp],esi + jmp check_for_more_lines + last_line: + pop [caret_line] + mov [caret_line_number],ecx + mov eax,[maximum_position] + mov [caret_position],eax + jmp error_line_highlighted + no_more_lines: + or esi,esi + jz last_line + pop eax + inc ecx + mov [caret_line],esi + mov [caret_line_number],ecx + error_line_highlighted: + call let_caret_appear + mov eax,[caret_line] + xchg eax,[selection_line] + mov [caret_line],eax + mov eax,[caret_line_number] + xchg eax,[selection_line_number] + mov [caret_line_number],eax + mov eax,[caret_position] + xchg eax,[selection_position] + mov [caret_position],eax + call let_caret_appear + call update_window + call update_screen + jmp show_error_summary + error_outside_compiler: + mov esp,[resume_esp] + jmp [resume_eip] + +; Assembler core + + include '..\..\errors.inc' + include '..\..\symbdump.inc' + include '..\..\preproce.inc' + include '..\..\parser.inc' + include '..\..\exprpars.inc' + include '..\..\assemble.inc' + include '..\..\exprcalc.inc' + include '..\..\formats.inc' + include '..\..\x86_64.inc' + include '..\..\avx.inc' + +; Assembler constants + + include '..\..\tables.inc' + include '..\..\messages.inc' + include '..\..\version.inc' + +; String constants + + _caption db 'flat assembler ',VERSION_STRING,0 + _copyright db 'Copyright (c) 1999-2017, Tomasz Grysztar',0 + + _null db 0 + _untitled db 'Untitled',0 + _compile db 'Compile',0 + _error db 'Error',0 + _ok db 'OK',0 + _yes db 'Yes',0 + _no db 'No',0 + _get_display db 'Get display to clipboard',0 + _open db 'Open',0 + _save_as db 'Save as',0 + _file db 'File:',0 + _position db 'Position',0 + _row db 'Row:',0 + _column db 'Column:',0 + _find db 'Find',0 + _replace db 'Replace',0 + _text_to_find db 'Text to find:',0 + _new_text db 'New text:',0 + _expression db 'Expression:',0 + _result db 'Result:',0 + _case_sensitive db 'Case sensitive',0 + _whole_words db 'Whole words',0 + _backward db 'Backward search',0 + _search_in_whole_text db 'Search in whole text',0 + _replace_in_whole_text db 'Replace in whole text',0 + _prompt db 'Prompt on replace',0 + _options db 'Editor options',0 + _secure_selection db 'Secure selection',0 + _auto_brackets db 'Automatic brackets',0 + _auto_indent db 'Automatic indents',0 + _smart_tabs db 'Smart tabulation',0 + _optimal_fill db 'Optimal fill on saving',0 + _ascii_table db 'ASCII table',0 + _calculator db 'Calculator',0 + + _startup_failed db 'Failed to allocate required memory.',0 + _memory_error db 'Not enough memory to complete this operation.',0 + _loading_error db 'Could not load file %s.',0 + _saving_error db 'Could not write file to disk.',0 + _not_executable db 'Cannot execute this kind of file.',0 + _saving_question db 'File was modified. Save it now?',0 + _overwrite_question db 'File %s already exists. Do you want to replace it?',0 + _directory_question db 'Directory %s does not exist. Do you want to create it now?',0 + _directory_error db 'Failed to create the directory.',0 + _invalid_path db 'Invalid path.',0 + _not_found_after db 'Text %s not found after current position.',0 + _not_found_before db 'Text %s not found before current position.',0 + _replace_prompt db 'Replace this occurence?',0 + _replaces_made db '%d replaces made.',0 + _assembler_error db 'Error: %s.',0 + + _section_environment db 'Environment',0 + _section_compiler db 'Compiler',0 + _key_compiler_memory db 'Memory',0 + _key_compiler_passes db 'Passes',0 + _section_options db 'Options',0 + _key_options_securesel db 'SecureSelection',0 + _key_options_autobrackets db 'AutoBrackets',0 + _key_options_autoindent db 'AutoIndent',0 + _key_options_smarttabs db 'SmartTabs',0 + _key_options_optimalfill db 'OptimalFill',0 + _section_colors db 'Colors',0 + _key_color_text db 'Text',0 + _key_color_background db 'Background',0 + _key_color_seltext db 'SelectionText',0 + _key_color_selbackground db 'SelectionBackground',0 + _key_color_symbols db 'Symbols',0 + _key_color_numbers db 'Numbers',0 + _key_color_strings db 'Strings',0 + _key_color_comments db 'Comments',0 + _key_color_statustext db 'StatusText',0 + _key_color_statusbackground db 'StatusBackground',0 + _key_color_wintext db 'WindowText',0 + _key_color_winbackground db 'WindowBackground',0 + _key_color_msgtext db 'MessageText',0 + _key_color_msgbackground db 'MessageBackground',0 + _key_color_msgseltext db 'MessageSelectionText',0 + _key_color_msgselbackground db 'MessageSelectionBackground',0 + _key_color_errtext db 'ErrorText',0 + _key_color_errbackground db 'ErrorBackground',0 + _key_color_errseltext db 'ErrorSelectionText',0 + _key_color_errselbackground db 'ErrorSelectionBackground',0 + _key_color_boxtext db 'BoxText',0 + _key_color_boxbackground db 'BoxBackground',0 + _key_color_boxseltext db 'BoxSelectionText',0 + _key_color_boxselbackground db 'BoxSelectionBackground',0 + +; Configuration + + editor_style dd FES_AUTOINDENT+FES_SMARTTABS+FES_SECURESEL+FES_OPTIMALFILL + + text_colors db 87h + selection_colors db 7Fh + symbol_color db 0Fh + number_color db 0Ah + string_color db 0Ch + comment_color db 3 + status_colors db 2Fh + window_colors db 3Fh + box_colors db 1Fh + box_selection_colors db 9Fh + message_box_colors dw 3F1Fh + error_box_colors dw 4E6Eh + +; Other constants + + browser_symbols db 18h,09h,07h,0F0h + +; Editor core + + include '..\memory.inc' + include '..\navigate.inc' + include '..\edit.inc' + include '..\blocks.inc' + include '..\search.inc' + include '..\undo.inc' + +; Editor constants + + SEGMENT_LENGTH = 160 + BLOCK_LENGTH = 1024 * SEGMENT_LENGTH + SEGMENT_HEADER_LENGTH = 16 + SEGMENT_DATA_LENGTH = SEGMENT_LENGTH - SEGMENT_HEADER_LENGTH + + FEMODE_OVERWRITE = 1 + FEMODE_VERTICALSEL = 2 + FEMODE_NOUNDO = 4 + FEMODE_READONLY = 8 + + FEFIND_CASESENSITIVE = 1 + FEFIND_WHOLEWORDS = 2 + FEFIND_BACKWARD = 4 + FEFIND_INWHOLETEXT = 8 + + FES_AUTOINDENT = 0001h + FES_AUTOBRACKETS = 0002h + FES_SMARTTABS = 0004h + FES_SECURESEL = 0008h + FES_OPTIMALFILL = 0010h + + include '..\version.inc' + +; Editor data + + editor_data: + + next_instance dd ? + previous_instance dd ? + file_path dd ? + file_path_handle dd ? + + include '..\variable.inc' + + editor_data_size = $ - editor_data + + if editor_data_size > SEGMENT_DATA_LENGTH + err + end if + + lower_case_table db 100h dup ? + upper_case_table db 100h dup ? + +; Assembler core data + + include '..\..\variable.inc' + +; Interface specific data + + psp_selector dw ? + environment_selector dw ? + main_selector dw ? + bios_selector dw ? + video_selector dw ? + + screen_width dd ? + screen_height dd ? + video_pitch dd ? + + video_storage dd ? + video_storage_handle dd ? + stored_cursor dw ? + stored_cursor_position dw ? + stored_page db ? + stored_mode db ? + + low_memory_size dd ? + low_memory_selector dw ? + + last_operation db ? + current_operation db ? + was_selection db ? + + line_buffer dd ? + line_buffer_size dd ? + line_buffer_handle dd ? + screen_offset dd ? + screen_row_buffer db 512 dup ? + + clipboard dd ? + clipboard_handle dd ? + + main_project_file dd ? + memory_limit dd ? + allocated_memory dd ? + start_time dd ? + progress_offset dd ? + keyboard_handler dp ? + display_length dd ? + + find_flags dd ? + replaces_count dd ? + selected_character db ? + command_flags db ? + message_width db ? + buttons_width db ? + first_button dd ? + second_button dd ? + + file_handle dd ? + filename_buffer db 17+256 dup ? + + ini_data dd ? + ini_data_handle dd ? + ini_data_length dd ? + ini_path db 260 dup ? + + file_list dd ? + file_list_buffer dd ? + file_list_buffer_top dd ? + file_list_buffer_handle dd ? + file_list_buffer_size dd ? + + current_box dd ? + boxes_count dd ? + boxes dd 16 dup ? + common_dialog_callback dd ? + + resume_esp dd ? + resume_eip dd ? + results_offset dd ? + results_selection dd ? + +segment buffer_segment + + buffer = (buffer_segment-main) shl 4 + + db 4000h dup ? + +segment stack_segment + + stack_bottom = (stack_segment-main) shl 4 + + db 4000h dup ? + + stack_top = stack_bottom + $ diff --git a/fasmw172/SOURCE/IDE/FASMW/FASM.INC b/fasmw172/SOURCE/IDE/FASMW/FASM.INC new file mode 100644 index 0000000..2583f4a --- /dev/null +++ b/fasmw172/SOURCE/IDE/FASMW/FASM.INC @@ -0,0 +1,465 @@ + +; flat assembler interface for Win32 IDE +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +flat_assembler: + + mov [initial_definitions],0 + mov edx,[esp+4] + mov [input_file],edx + invoke GetFullPathName,edx,1000h,path_buffer,param_buffer + or eax,eax + jz exit_program + mov edi,[param_buffer] + mov byte [edi-1],0 + mov [symbols_file],0 + test [command_flags],2 + jz symbols_file_name_ok + mov [symbols_file],edi + mov ecx,eax + add ecx,path_buffer + sub ecx,edi + lea edi,[edi+ecx-1] + mov ebx,edi + mov al,'.' + std + repne scasb + cld + je attach_fas_extension + mov edi,ebx + attach_fas_extension: + inc edi + mov eax,'.fas' + stosd + xor al,al + stosb + symbols_file_name_ok: + invoke SetCurrentDirectory,path_buffer + mov [hfile],0 + invoke GlobalAlloc,GMEM_MOVEABLE,1 + mov [hmem_display],eax + invoke GlobalLock,[hmem_display] + mov byte [eax],0 + invoke GlobalUnlock,[hmem_display] + mov [display_size],1 + mov [error_data_size],0 + mov [allocated_memory],0 + mov eax,[compiler_memory] + shl eax,10 + jz out_of_memory + allocate_memory: + mov edx,eax + shr edx,2 + mov ecx,eax + sub ecx,edx + mov [memory_end],ecx + mov [additional_memory_end],edx + invoke VirtualAlloc,0,eax,MEM_COMMIT,PAGE_READWRITE + or eax,eax + jnz memory_allocated + mov eax,[additional_memory_end] + shl eax,1 + cmp eax,4000h + jb out_of_memory + jmp allocate_memory + memory_allocated: + mov [allocated_memory],eax + mov [memory_start],eax + mov [code_start],eax + add eax,[memory_end] + mov [memory_end],eax + mov [additional_memory],eax + add [additional_memory_end],eax + mov [tagged_blocks],0 + + mov eax,esp + and eax,not 0FFFh + add eax,1000h-10000h + mov [stack_limit],eax + + invoke PostMessage,[hwnd_progress],PBM_SETPOS,0,0 + invoke SetThreadPriority,[hthread],[compiler_priority] + invoke GetTickCount + mov [start_time],eax + mov [preprocessing_done],0 + call preprocessor + invoke PostMessage,[hwnd_progress],PBM_SETPOS,1,0 + or [preprocessing_done],-1 + call parser + invoke PostMessage,[hwnd_progress],PBM_SETPOS,2,0 + call assembler + invoke PostMessage,[hwnd_progress],PBM_SETPOS,3,0 + call formatter + invoke PostMessage,[hwnd_progress],PBM_SETPOS,4,0 + call show_display_buffer + invoke GetTickCount + sub eax,[start_time] + mov [total_time],eax + mov esi,[output_file] + mov edi,path_buffer + copy_executable_name: + lodsb + stosb + or al,al + jnz copy_executable_name + xor al,al + +exit_program: + movzx eax,al + push eax + mov eax,[allocated_memory] + or eax,eax + jz memory_ok + invoke VirtualFree,eax,0,MEM_RELEASE + mov [allocated_memory],0 + memory_ok: + mov eax,[hfile] + or eax,eax + jz handle_ok + invoke CloseHandle,eax + handle_ok: + invoke PostMessage,[hwnd_compiler],WM_COMMAND,IDOK,0 + call [ExitThread] + +get_environment_variable: + invoke GetEnvironmentVariable,esi,string_buffer,1000h + mov ecx,[memory_end] + sub ecx,edi + cmp ecx,1000h + jbe get_local_variable + mov ecx,1000h + get_local_variable: + invoke GetPrivateProfileString,_section_environment,esi,string_buffer,edi,ecx,ini_path + add edi,eax + cmp edi,[memory_end] + jae out_of_memory + retn + +open: + mov ebx,edx + invoke WaitForSingleObject,[mutex],-1 + invoke CreateFile,ebx,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0 + cmp eax,-1 + je file_error + mov [hfile],eax + mov ebx,eax + clc + retn + file_error: + stc + retn +create: + mov ebx,edx + invoke WaitForSingleObject,[mutex],-1 + invoke CreateFile,ebx,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0 + cmp eax,-1 + je file_error + mov ebx,eax + clc + retn +write: + invoke WriteFile,ebx,edx,ecx,bytes_count,0 + or eax,eax + jz file_error + clc + retn +read: + mov ebp,ecx + invoke ReadFile,ebx,edx,ecx,bytes_count,0 + or eax,eax + jz file_error + cmp ebp,[bytes_count] + jne file_error + clc + retn +close: + cmp ebx,[hfile] + jne close_handle + mov [hfile],0 + close_handle: + invoke CloseHandle,ebx + invoke ReleaseMutex,[mutex] + retn +lseek: + movzx eax,al + invoke SetFilePointer,ebx,edx,0,eax + cmp eax,-1 + je file_error + clc + retn + +display_block: + push edi + push ecx + add ecx,[display_size] + invoke GlobalReAlloc,[hmem_display],ecx,GMEM_MOVEABLE + or eax,eax + jz out_of_memory + mov [hmem_display],eax + invoke GlobalLock,[hmem_display] + add eax,[display_size] + lea edi,[eax-1] + pop ecx + add [display_size],ecx + rep movsb + xor al,al + stosb + invoke GlobalUnlock,[hmem_display] + pop edi + retn +fatal_error: + cmp [hthread],0 + je error_outside_compiler + pop [error_message] + error_with_no_source: + mov al,0FFh + jmp exit_program +assembler_error: + cmp [hthread],0 + je error_outside_compiler + call show_display_buffer + pop [error_message] + mov ebx,[current_line] + test ebx,ebx + jz error_with_no_source + xor ecx,ecx + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + test byte [ebx+7],80h + jz error_lines_ok + inc ecx + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + mov eax,[edx+4] + and eax,7FFFFFFFh + push eax + mov edx,[edx] + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + error_lines_ok: + inc ecx + mov eax,[ebx+4] + and eax,7FFFFFFFh + push eax + mov edx,[ebx] + push edx + mov ebx,ecx + inc ecx + shl ecx,3 + mov [error_data_size],ecx + invoke GlobalAlloc,GMEM_MOVEABLE,ecx + mov [hmem_error_data],eax + invoke GlobalLock,[hmem_error_data] + mov [eax],ebx + invoke GlobalUnlock,[hmem_error_data] + xor ebx,ebx + store_error_lines: + pop edx + invoke GetFullPathName,edx,1000h,path_buffer,param_buffer + inc eax + mov esi,eax + add eax,[error_data_size] + invoke GlobalReAlloc,[hmem_error_data],eax,GMEM_MOVEABLE + invoke GlobalLock,[hmem_error_data] + mov edi,eax + add edi,[error_data_size] + mov ecx,esi + mov esi,path_buffer + rep movsb + pop edx + mov [eax+8+ebx*8+4],edx + sub edi,eax + xchg [error_data_size],edi + mov [eax+8+ebx*8],edi + mov esi,[eax] + invoke GlobalUnlock,[hmem_error_data] + inc ebx + cmp ebx,esi + jb store_error_lines + mov edi,[additional_memory] + cmp [preprocessing_done],0 + jne error_in_preprocessed + xor al,al + stosb + jmp instruction_converted + error_in_preprocessed: + mov esi,[current_line] + add esi,16 + xor dl,dl + convert_instruction: + lodsb + cmp al,1Ah + je copy_symbol + cmp al,22h + je copy_symbol + cmp al,3Bh + je ignore_preprocessor_symbols + stosb + or al,al + jz instruction_converted + xor dl,dl + jmp convert_instruction + copy_symbol: + or dl,dl + jz space_ok + mov byte [edi],20h + inc edi + space_ok: + cmp al,22h + je quoted + lodsb + movzx ecx,al + rep movsb + or dl,-1 + jmp convert_instruction + quoted: + mov al,27h + stosb + lodsd + mov ecx,eax + jecxz quoted_copied + copy_quoted: + lodsb + stosb + cmp al,27h + jne quote_ok + stosb + quote_ok: + loop copy_quoted + quoted_copied: + mov al,27h + stosb + or dl,-1 + jmp convert_instruction + ignore_preprocessor_symbols: + xor al,al + stosb + instruction_converted: + sub edi,[additional_memory] + mov ebx,[error_data_size] + lea eax,[ebx+edi] + invoke GlobalReAlloc,[hmem_error_data],eax,GMEM_MOVEABLE + invoke GlobalLock,[hmem_error_data] + mov ecx,edi + mov [eax+4],ebx + lea edi,[eax+ebx] + mov esi,[additional_memory] + rep movsb + invoke GlobalUnlock,[hmem_error_data] + mov al,2 + jmp exit_program + error_outside_compiler: + mov esp,[resume_esp] + jmp [resume_eip] + +make_timestamp: + invoke GetSystemTime,systime + movzx ecx,[systime.wYear] + mov eax,ecx + sub eax,1970 + mov ebx,365 + mul ebx + mov ebp,eax + mov eax,ecx + sub eax,1969 + shr eax,2 + add ebp,eax + mov eax,ecx + sub eax,1901 + mov ebx,100 + div ebx + sub ebp,eax + mov eax,ecx + xor edx,edx + sub eax,1601 + mov ebx,400 + div ebx + add ebp,eax + movzx ecx,[systime.wMonth] + mov eax,ecx + dec eax + mov ebx,30 + mul ebx + add ebp,eax + cmp ecx,8 + jbe months_correction + mov eax,ecx + sub eax,7 + shr eax,1 + add ebp,eax + mov ecx,8 + months_correction: + mov eax,ecx + shr eax,1 + add ebp,eax + cmp ecx,2 + jbe day_correction_ok + sub ebp,2 + movzx ecx,word [systime.wYear] + test ecx,11b + jnz day_correction_ok + xor edx,edx + mov eax,ecx + mov ebx,100 + div ebx + or edx,edx + jnz day_correction + mov eax,ecx + mov ebx,400 + div ebx + or edx,edx + jnz day_correction_ok + day_correction: + inc ebp + day_correction_ok: + movzx eax,[systime.wDay] + dec eax + add eax,ebp + mov ebx,24 + mul ebx + movzx ecx,[systime.wHour] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,[systime.wMinute] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,[systime.wSecond] + add eax,ecx + adc edx,0 + retn + +include '..\..\errors.inc' +include '..\..\symbdump.inc' +include '..\..\preproce.inc' +include '..\..\parser.inc' +include '..\..\exprpars.inc' +include '..\..\assemble.inc' +include '..\..\exprcalc.inc' +include '..\..\formats.inc' +include '..\..\x86_64.inc' +include '..\..\avx.inc' + +include '..\..\tables.inc' +include '..\..\messages.inc' + +section '.bss' readable writeable + +include '..\..\variable.inc' + +allocated_memory dd ? +start_time dd ? +total_time dd ? +display_size dd ? +error_message dd ? +error_data_size dd ? +preprocessing_done db ? diff --git a/fasmw172/SOURCE/IDE/FASMW/FASMW.ASM b/fasmw172/SOURCE/IDE/FASMW/FASMW.ASM new file mode 100644 index 0000000..cdc607f --- /dev/null +++ b/fasmw172/SOURCE/IDE/FASMW/FASMW.ASM @@ -0,0 +1,3719 @@ + +; flat assembler IDE for Win32 +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +format PE GUI 4.0 large NX +entry start +stack 20000h + +include 'win32ax.inc' +include 'fedit.ash' + +include '..\..\version.inc' + +IDE_VERSION_STRING equ "0.99.00" + +struct EDITITEM + header TC_ITEMHEADER + hwnd dd ? + pszpath dd ? +ends + +FM_NEW = WM_USER + 0 +FM_OPEN = WM_USER + 1 +FM_SAVE = WM_USER + 2 +FM_COMPILE = WM_USER + 3 +FM_SELECT = WM_USER + 4 +FM_ASSIGN = WM_USER + 5 +FM_GETSELECTED = WM_USER + 6 +FM_GETASSIGNED = WM_USER + 7 +FM_GETHANDLE = WM_USER + 8 +FM_OPENREADONLY = WM_USER + 11h +FM_SAVEMODIFIED = WM_USER + 12h + +struct HH_AKLINK + cbStruct dd ? + fReserved dd ? + pszKeywords dd ? + pszUrl dd ? + pszMsgText dd ? + pszMsgTitle dd ? + pszWindow dd ? + fIndexOnFail dd ? +ends + +HH_DISPLAY_TOPIC = 0 +HH_KEYWORD_LOOKUP = 0Dh + +section '.data' data readable writeable + + _caption db 'flat assembler ',VERSION_STRING,0 + _class db 'FASMW_IDE32',0 + _fedit_class db 'FEDIT',0 + _listbox_class db 'LISTBOX',0 + _tabctrl_class db 'SysTabControl32',0 + _htmlhelp_library db 'HHCTRL.OCX',0 + _htmlhelp_api db 'HtmlHelpA',0 + _user_library db 'USER32.DLL',0 + _setgestureconfig_api db 'SetGestureConfig',0 + _getgestureinfo_api db 'GetGestureInfo',0 + _closegestureinfohandle_api db 'CloseGestureInfoHandle',0 + + _memory_error db 'Not enough memory to complete this operation.',0 + _loading_error db 'Could not load file %s.',0 + _run_object_error db 'Cannot execute object file.',0 + _saving_question db 'File was modified. Save it now?',0 + _not_found db 'Text %s not found.',0 + _not_found_after db 'Text %s not found after current position.',0 + _not_found_before db 'Text %s not found before current position.',0 + _replace_prompt db 'Replace this occurence?',0 + _replaces_made db '%d replaces made.',0 + _untitled db 'Untitled',0 + _font_face db 'Courier New',0 + _row_column db 9,'%d,' + _value db '%d' + _null db 0 + _summary db '%d passes, %d.%d seconds, %d bytes.',0 + _summary_short db '%d passes, %d bytes.',0 + _assembler_error db 'Error: %s.',0 + _line_number db '%s [%d]',0 + _color db '%d,%d,%d',0 + _modified_status db 9,'Modified',0 + _readonly_status db 9,'Read-only',0 + _pick_help db 'Pick help file',0 + _find db 'Find',0 + _replace db 'Replace',0 + + _asm_extension db 'ASM',0 + + _section_environment db 'Environment',0 + _key_environment_include db 'Include',0 + _section_compiler db 'Compiler',0 + _key_compiler_memory db 'Memory',0 + _key_compiler_priority db 'Priority',0 + _key_compiler_passes db 'Passes',0 + _section_options db 'Options',0 + _key_options_securesel db 'SecureSelection',0 + _key_options_autobrackets db 'AutoBrackets',0 + _key_options_autoindent db 'AutoIndent',0 + _key_options_smarttabs db 'SmartTabs',0 + _key_options_optimalfill db 'OptimalFill',0 + _key_options_revivedeadkeys db 'ReviveDeadKeys',0 + _key_options_consolecaret db 'ConsoleCaret',0 + _key_options_timescroll db 'TimeScroll',0 + _key_options_oneinstanceonly db 'OneInstanceOnly',0 + _section_colors db 'Colors',0 + _key_color_text db 'Text',0 + _key_color_background db 'Background',0 + _key_color_seltext db 'SelectionText',0 + _key_color_selbackground db 'SelectionBackground',0 + _key_color_symbols db 'Symbols',0 + _key_color_numbers db 'Numbers',0 + _key_color_strings db 'Strings',0 + _key_color_comments db 'Comments',0 + _section_font db 'Font',0 + _key_font_face db 'Face',0 + _key_font_height db 'Height',0 + _key_font_width db 'Width',0 + _key_font_weight db 'Weight',0 + _key_font_italic db 'Italic',0 + _key_font_charset db 'CharSet',0 + _section_window db 'Window',0 + _key_window_top db 'Top',0 + _key_window_left db 'Left',0 + _key_window_right db 'Right',0 + _key_window_bottom db 'Bottom',0 + _key_window_maximized db 'Maximized',0 + _section_help db 'Help',0 + _key_help_path db 'Path',0 + + _reg_key_desktop db 'Control Panel\Desktop',0 + _reg_value_wheelscrolllines db 'WheelScrollLines',0 + + _appearance_settings db 'Font',0 + db 'Text color',0 + db 'Background color',0 + db 'Selection text color',0 + db 'Selection background color',0 + db 'Symbols color',0 + db 'Numbers color',0 + db 'Strings color',0 + db 'Comments color',0 + db 0 + _memory_settings db '1024',0 + db '2048',0 + db '4096',0 + db '8192',0 + db '16384',0 + db '32768',0 + db '65536',0 + db '131072',0 + db '262144',0 + db '524288',0 + db 0 + _priority_settings db 'Idle',0 + db 'Low',0 + db 'Normal',0 + db 'High',0 + db 'Realtime',0 + db 0 + + fedit_style dd FES_AUTOINDENT+FES_SMARTTABS+FES_CONSOLECARET + + editor_colors rd 4 + asm_syntax_colors dd 0xF03030,0x009000,0x0000B0,0x808080 + + preview_text db 0Dh,0Ah + db ' org 100h',0Dh,0Ah + db 0Dh,0Ah + db ' mov ah,09h ',' ; write',0Dh,0Ah + db ' mov dx,text',0Dh,0Ah + db ' int 21h',0Dh,0Ah + db ' int 20h',0Dh,0Ah + db 0Dh,0Ah + db ' text db "Hello!",24h',0Dh,0Ah + db 0 + preview_selection dd 1,5,1,6 + + asm_filter db 'Assembler files',0,'*.ASM;*.INC;*.ASH',0 + db 'All files',0,'*.*',0 + db 0 + + help_filter db 'Help files',0,'*.HLP;*.CHM',0 + db 0 + + align 4 + + wheel_scroll_lines dd 3 + + HtmlHelp dd 0 + + SetGestureConfig dd 0 + GetGestureInfo dd 0 + CloseGestureInfoHandle dd 0 + + hinstance dd ? + hkey_main dd ? + hmenu_main dd ? + hmenu_edit dd ? + hmenu_tab dd ? + hacc dd ? + hfont dd ? + hwnd_main dd ? + hwnd_status dd ? + hwnd_tabctrl dd ? + hwnd_history dd ? + hwnd_fedit dd ? + hwnd_compiler dd ? + hwnd_progress dd ? + himl dd ? + hthread dd ? + hmem_display dd ? + hmem_error_data dd ? + hfile dd ? + mutex dd ? + + command_flags dd ? + search_settings dd ? + replaces_count dd ? + compiler_memory dd ? + compiler_priority dd ? + assigned_file dd ? + program_arguments dd ? + resume_esp dd ? + resume_eip dd ? + + param_buffer rd 10h + user_colors rd 10h + name_buffer rb 100h + search_string rb 1000h + replace_string rb 1000h + string_buffer rb 2000h + help_path rb 1000h + ini_path rb 1000h + path_buffer rb 4000h + + msg MSG + wc WNDCLASS + rc RECT + pt POINT + ei EDITITEM + font LOGFONT + bm BITMAP + tcht TC_HITTESTINFO + wp WINDOWPLACEMENT + fepos FEPOS + ofn OPENFILENAME + cf CHOOSEFONT + cc CHOOSECOLOR + systime SYSTEMTIME + sinfo STARTUPINFO + pinfo PROCESS_INFORMATION + cp COPYDATASTRUCT + + bytes_count dd ? + fedit_font dd ? + + tmp_colors rd 8 + tmp_font LOGFONT + backup_font LOGFONT + + hhkey HH_AKLINK + + upper_case_table rb 100h + +section '.text' code readable executable + +include 'fedit.inc' + + start: + + invoke GetModuleHandle,0 + mov [hinstance],eax + + invoke GetModuleHandle,_user_library + or eax,eax + jz gesture_api_unavailable + mov ebx,eax + invoke GetProcAddress,ebx,_setgestureconfig_api + or eax,eax + jz gesture_api_unavailable + mov esi,eax + invoke GetProcAddress,ebx,_getgestureinfo_api + or eax,eax + jz gesture_api_unavailable + mov edi,eax + invoke GetProcAddress,ebx,_closegestureinfohandle_api + or eax,eax + jz gesture_api_unavailable + mov [CloseGestureInfoHandle],eax + mov [SetGestureConfig],esi + mov [GetGestureInfo],edi + gesture_api_unavailable: + + invoke GetCommandLine + mov esi,eax + mov edi,ini_path + find_program_path: + lodsb + cmp al,20h + je find_program_path + cmp al,22h + je quoted_program_path + cmp al,0Dh + je program_path_ok + or al,al + jnz get_program_path + dec esi + jmp program_path_ok + get_program_path: + stosb + lodsb + cmp al,20h + je program_path_ok + cmp al,0Dh + je program_path_ok + or al,al + jnz get_program_path + dec esi + jmp program_path_ok + quoted_program_path: + lodsb + cmp al,22h + je program_path_ok + cmp al,0Dh + je program_path_ok + stosb + or al,al + jnz quoted_program_path + dec esi + program_path_ok: + mov [program_arguments],esi + mov ebx,edi + find_program_extension: + cmp ebx,ini_path + je make_ini_extension + dec ebx + mov al,[ebx] + cmp al,'\' + je make_ini_extension + cmp al,'/' + je make_ini_extension + cmp al,'.' + jne find_program_extension + mov edi,ebx + jmp find_program_extension + make_ini_extension: + mov eax,'.INI' + stosd + xor al,al + stosb + invoke GetFullPathName,ini_path,1000h,ini_path,param_buffer + invoke GetFileAttributes,ini_path + cmp eax,-1 + jne ini_ok + mov esi,ini_path + mov ecx,[param_buffer] + sub ecx,esi + mov edi,path_buffer + rep movsb + mov eax,'INCL' + stosd + mov eax,'UDE' + stosd + invoke WritePrivateProfileString,_section_environment,_key_environment_include,path_buffer,ini_path + ini_ok: + + mov [param_buffer],0 + stdcall GetIniBit,ini_path,_section_options,_key_options_oneinstanceonly,param_buffer,1 + cmp [param_buffer],0 + je create_new_window + invoke FindWindow,_class,NULL + or eax,eax + jnz window_already_exists + + create_new_window: + invoke LoadCursor,0,IDC_IBEAM + mov [wc.hCursor],eax + mov [wc.style],CS_GLOBALCLASS+CS_DBLCLKS + mov [wc.lpfnWndProc],FlatEditor + mov eax,[hinstance] + mov [wc.hInstance],eax + mov [wc.cbWndExtra],4 + xor eax,eax + mov [wc.hbrBackground],eax + mov [wc.cbClsExtra],eax + mov [wc.lpszMenuName],eax + mov [wc.lpszClassName],_fedit_class + invoke RegisterClass,wc + or eax,eax + jz end_loop + invoke CreateFont,0,0,0,0,0,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_RASTER_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FIXED_PITCH+FF_DONTCARE,NULL + or eax,eax + jz end_loop + mov [fedit_font],eax + + mov edi,upper_case_table + xor ebx,ebx + mov esi,100h + make_case_table: + invoke CharUpper,ebx + stosb + inc bl + dec esi + jnz make_case_table + mov edi,characters + mov ecx,100h + xor al,al + prepare_characters_table: + stosb + inc al + loop prepare_characters_table + mov esi,characters+'a' + mov edi,characters+'A' + mov ecx,26 + rep movsb + mov edi,characters + mov esi,symbol_characters+1 + movzx ecx,byte [esi-1] + xor eax,eax + convert_table: + lodsb + mov byte [edi+eax],0 + loop convert_table + + invoke LoadIcon,[hinstance],IDI_MAIN + mov [wc.hIcon],eax + invoke LoadCursor,0,IDC_ARROW + mov [wc.hCursor],eax + mov [wc.style],0 + mov [wc.lpfnWndProc],MainWindow + mov [wc.cbClsExtra],0 + mov [wc.cbWndExtra],0 + mov eax,[hinstance] + mov [wc.hInstance],eax + mov [wc.hbrBackground],COLOR_BTNFACE+1 + mov [wc.lpszMenuName],0 + mov [wc.lpszClassName],_class + invoke RegisterClass,wc + + invoke LoadMenu,[hinstance],IDM_MAIN + mov [hmenu_main],eax + invoke GetSubMenu,eax,1 + mov [hmenu_edit],eax + invoke LoadMenu,[hinstance],IDM_TAB + invoke GetSubMenu,eax,0 + mov [hmenu_tab],eax + invoke LoadAccelerators,[hinstance],IDA_MAIN + mov [hacc],eax + invoke CreateWindowEx,0,_class,_caption,WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS,96,64,384,324,NULL,[hmenu_main],[hinstance],NULL + or eax,eax + jz end_loop + mov [hwnd_main],eax + mov eax,SW_SHOW + test [wp.flags],WPF_RESTORETOMAXIMIZED + jz show_main_window + mov eax,SW_SHOWMAXIMIZED + show_main_window: + invoke ShowWindow,[hwnd_main],eax + invoke UpdateWindow,[hwnd_main] + msg_loop: + invoke GetMessage,msg,NULL,0,0 + or eax,eax + jz end_loop + invoke TranslateAccelerator,[hwnd_main],[hacc],msg + or eax,eax + jnz msg_loop + cmp [msg.message],WM_KEYDOWN + je msg_dispatch + invoke TranslateMessage,msg + msg_dispatch: + invoke DispatchMessage,msg + jmp msg_loop + + window_already_exists: + mov ebx,eax + invoke GetWindowPlacement,ebx,wp + mov eax,SW_SHOWNORMAL + cmp [wp.showCmd],SW_SHOWMAXIMIZED + jne show_existing_window + mov eax,SW_SHOWMAXIMIZED + show_existing_window: + invoke ShowWindow,ebx,eax + invoke SetForegroundWindow,ebx + mov edi,[program_arguments] + mov [cp.lpData],edi + or ecx,-1 + xor al,al + repne scasb + neg ecx + mov [cp.cbData],ecx + invoke SendMessage,ebx,WM_COPYDATA,NULL,cp + + end_loop: + invoke ExitProcess,[msg.wParam] + +proc MainWindow hwnd,wmsg,wparam,lparam + push ebx esi edi + cmp [wmsg],WM_CREATE + je wmcreate + cmp [wmsg],WM_COPYDATA + je wmcopydata + cmp [wmsg],WM_GETMINMAXINFO + je wmgetminmaxinfo + cmp [wmsg],WM_SIZE + je wmsize + cmp [wmsg],WM_SETFOCUS + je wmsetfocus + cmp [wmsg],FM_NEW + je fmnew + cmp [wmsg],FM_OPEN + je fmopen + cmp [wmsg],FM_OPENREADONLY + je fmopenreadonly + cmp [wmsg],FM_SAVE + je fmsave + cmp [wmsg],FM_SAVEMODIFIED + je fmsavemodified + cmp [wmsg],FM_COMPILE + je fmcompile + cmp [wmsg],FM_SELECT + je fmselect + cmp [wmsg],FM_ASSIGN + je fmassign + cmp [wmsg],FM_GETSELECTED + je fmgetselected + cmp [wmsg],FM_GETASSIGNED + je fmgetassigned + cmp [wmsg],FM_GETHANDLE + je fmgethandle + cmp [wmsg],WM_INITMENU + je wminitmenu + cmp [wmsg],WM_COMMAND + je wmcommand + cmp [wmsg],WM_NOTIFY + je wmnotify + cmp [wmsg],WM_DROPFILES + je wmdropfiles + cmp [wmsg],WM_CLOSE + je wmclose + cmp [wmsg],WM_DESTROY + je wmdestroy + invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] + jmp finish + wmcreate: + xor eax,eax + mov [search_settings],eax + mov [search_string],al + mov [replace_string],al + mov [compiler_memory],65536 + mov [compiler_priority],THREAD_PRIORITY_NORMAL + mov [assigned_file],-1 + mov [help_path],0 + mov [ofn.lStructSize],sizeof.OPENFILENAME + mov eax,[hwnd] + mov [ofn.hwndOwner],eax + mov eax,[hinstance] + mov [ofn.hInstance],eax + mov [ofn.lpstrCustomFilter],NULL + mov [ofn.nFilterIndex],1 + mov [ofn.nMaxFile],1000h + mov [ofn.lpstrFileTitle],name_buffer + mov [ofn.nMaxFileTitle],100h + mov [ofn.lpstrInitialDir],NULL + mov [ofn.lpstrDefExt],_asm_extension + mov [font.lfHeight],16 + mov [font.lfWidth],0 + mov [font.lfEscapement],0 + mov [font.lfOrientation],0 + mov [font.lfWeight],0 + mov [font.lfItalic],FALSE + mov [font.lfUnderline],FALSE + mov [font.lfStrikeOut],FALSE + mov [font.lfCharSet],DEFAULT_CHARSET + mov [font.lfOutPrecision],OUT_RASTER_PRECIS + mov [font.lfClipPrecision],CLIP_DEFAULT_PRECIS + mov [font.lfQuality],DEFAULT_QUALITY + mov [font.lfPitchAndFamily],FIXED_PITCH+FF_DONTCARE + mov edi,font.lfFaceName + mov esi,_font_face + copy_font_face: + lodsb + stosb + or al,al + jnz copy_font_face + invoke GetSysColor,COLOR_WINDOWTEXT + mov [editor_colors],eax + invoke GetSysColor,COLOR_WINDOW + mov [editor_colors+4],eax + invoke GetSysColor,COLOR_HIGHLIGHTTEXT + mov [editor_colors+8],eax + invoke GetSysColor,COLOR_HIGHLIGHT + mov [editor_colors+12],eax + mov esi,editor_colors + mov edi,user_colors + mov ecx,8 + rep movsd + mov [wp.length],sizeof.WINDOWPLACEMENT + invoke GetWindowPlacement,[hwnd],wp + invoke RegOpenKeyEx,HKEY_CURRENT_USER,_reg_key_desktop,0,KEY_READ,param_buffer + test eax,eax + jnz wheel_setting_ok + mov [bytes_count],100h + invoke RegQueryValueEx,[param_buffer],_reg_value_wheelscrolllines,0,param_buffer+4,string_buffer,bytes_count + test eax,eax + jnz no_valid_wheel_setting + cmp [param_buffer+4],REG_SZ + jne no_valid_wheel_setting + mov esi,string_buffer + cmp byte [esi],0 + je no_valid_wheel_setting + call atoi + jc no_valid_wheel_setting + mov [wheel_scroll_lines],eax + no_valid_wheel_setting: + invoke RegCloseKey,[param_buffer] + wheel_setting_ok: + stdcall GetIniInteger,ini_path,_section_compiler,_key_compiler_memory,compiler_memory + stdcall GetIniInteger,ini_path,_section_compiler,_key_compiler_priority,compiler_priority + mov eax,100 + mov [passes_limit],ax + mov [param_buffer],eax + stdcall GetIniInteger,ini_path,_section_compiler,_key_compiler_passes,param_buffer + mov eax,[param_buffer] + test eax,eax + jz passes_limit_ok + cmp eax,10000h + ja passes_limit_ok + mov [passes_limit],ax + passes_limit_ok: + stdcall GetIniBit,ini_path,_section_options,_key_options_securesel,fedit_style,FES_SECURESEL + stdcall GetIniBit,ini_path,_section_options,_key_options_autobrackets,fedit_style,FES_AUTOBRACKETS + stdcall GetIniBit,ini_path,_section_options,_key_options_autoindent,fedit_style,FES_AUTOINDENT + stdcall GetIniBit,ini_path,_section_options,_key_options_smarttabs,fedit_style,FES_SMARTTABS + stdcall GetIniBit,ini_path,_section_options,_key_options_optimalfill,fedit_style,FES_OPTIMALFILL + stdcall GetIniBit,ini_path,_section_options,_key_options_revivedeadkeys,fedit_style,FES_REVIVEDEADKEYS + stdcall GetIniBit,ini_path,_section_options,_key_options_consolecaret,fedit_style,FES_CONSOLECARET + stdcall GetIniBit,ini_path,_section_options,_key_options_timescroll,fedit_style,FES_TIMESCROLL + stdcall GetIniColor,ini_path,_section_colors,_key_color_text,editor_colors + stdcall GetIniColor,ini_path,_section_colors,_key_color_background,editor_colors+4 + stdcall GetIniColor,ini_path,_section_colors,_key_color_seltext,editor_colors+8 + stdcall GetIniColor,ini_path,_section_colors,_key_color_selbackground,editor_colors+12 + stdcall GetIniColor,ini_path,_section_colors,_key_color_symbols,asm_syntax_colors + stdcall GetIniColor,ini_path,_section_colors,_key_color_numbers,asm_syntax_colors+4 + stdcall GetIniColor,ini_path,_section_colors,_key_color_strings,asm_syntax_colors+8 + stdcall GetIniColor,ini_path,_section_colors,_key_color_comments,asm_syntax_colors+12 + invoke GetPrivateProfileString,_section_font,_key_font_face,font.lfFaceName,font.lfFaceName,32,ini_path + stdcall GetIniInteger,ini_path,_section_font,_key_font_height,font.lfHeight + stdcall GetIniInteger,ini_path,_section_font,_key_font_width,font.lfWidth + stdcall GetIniInteger,ini_path,_section_font,_key_font_weight,font.lfWeight + stdcall GetIniBit,ini_path,_section_font,_key_font_italic,font.lfItalic,1 + stdcall GetIniByte,ini_path,_section_font,_key_font_charset,font.lfCharSet + stdcall GetIniInteger,ini_path,_section_window,_key_window_top,wp.rcNormalPosition.top + stdcall GetIniInteger,ini_path,_section_window,_key_window_left,wp.rcNormalPosition.left + stdcall GetIniInteger,ini_path,_section_window,_key_window_right,wp.rcNormalPosition.right + stdcall GetIniInteger,ini_path,_section_window,_key_window_bottom,wp.rcNormalPosition.bottom + stdcall GetIniBit,ini_path,_section_window,_key_window_maximized,wp.flags,WPF_RESTORETOMAXIMIZED + invoke GetPrivateProfileString,_section_help,_key_help_path,help_path,help_path,1000h,ini_path + mov [wp.showCmd],SW_HIDE + invoke SetWindowPlacement,[hwnd],wp + invoke CreateFontIndirect,font + mov [hfont],eax + invoke CreateStatusWindow,WS_CHILD+WS_VISIBLE+SBS_SIZEGRIP,NULL,[hwnd],0 + or eax,eax + jz failed + mov [hwnd_status],eax + mov [param_buffer],48h + mov [param_buffer+4],90h + mov [param_buffer+8],-1 + invoke SendMessage,eax,SB_SETPARTS,3,param_buffer + invoke CreateWindowEx,0,_listbox_class,NULL,WS_CHILD+LBS_HASSTRINGS,0,0,0,0,[hwnd],NULL,[hinstance],NULL + or eax,eax + jz failed + mov [hwnd_history],eax + invoke CreateWindowEx,0,_tabctrl_class,NULL,WS_VISIBLE+WS_CHILD+TCS_FOCUSNEVER+TCS_BOTTOM,0,0,0,0,[hwnd],NULL,[hinstance],NULL + or eax,eax + jz failed + mov [hwnd_tabctrl],eax + invoke SendMessage,[hwnd_tabctrl],TCM_SETITEMEXTRA,sizeof.EDITITEM-sizeof.TC_ITEMHEADER,0 + invoke SendMessage,[hwnd_status],WM_GETFONT,0,0 + invoke SendMessage,[hwnd_tabctrl],WM_SETFONT,eax,FALSE + invoke LoadBitmap,[hinstance],IDB_ASSIGN + mov ebx,eax + invoke GetObject,ebx,sizeof.BITMAP,bm + invoke ImageList_Create,[bm.bmWidth],[bm.bmHeight],ILC_COLOR4,1,0 + or eax,eax + jz failed + mov [himl],eax + invoke ImageList_Add,[himl],ebx,NULL + invoke DeleteObject,ebx + invoke SendMessage,[hwnd_tabctrl],TCM_SETIMAGELIST,0,[himl] + invoke SendMessage,[hwnd],FM_NEW,_untitled,0 + cmp eax,-1 + je failed + invoke DragAcceptFiles,[hwnd],TRUE + mov esi,[program_arguments] + find_argument: + lodsb + cmp al,20h + je find_argument + xor ecx,ecx + cmp al,22h + je quoted_argument + cmp al,0Dh + je command_line_ok + or al,al + jz command_line_ok + lea edx,[esi-1] + find_argument_end: + inc ecx + lodsb + cmp al,20h + je argument_end + cmp al,0Dh + je argument_end + or al,al + jz argument_end + jmp find_argument_end + quoted_argument: + mov edx,esi + find_quoted_argument_end: + lodsb + cmp al,22h + je quoted_argument_end + cmp al,0Dh + je quoted_argument_end + or al,al + jz quoted_argument_end + inc ecx + jmp find_quoted_argument_end + argument_end: + dec esi + quoted_argument_end: + push eax edx esi + mov esi,edx + mov edi,path_buffer + rep movsb + xor al,al + stosb + invoke GetFileTitle,path_buffer,name_buffer,100h + invoke SendMessage,[hwnd],FM_OPEN,name_buffer,path_buffer + cmp eax,-1 + jne load_ok + cinvoke wsprintf,string_buffer,_loading_error,path_buffer + invoke MessageBox,[hwnd],string_buffer,_caption,MB_ICONERROR+MB_OK + load_ok: + pop esi edx eax + jmp find_argument + command_line_ok: + xor eax,eax + jmp finish + wmcopydata: + mov ebx,[lparam] + virtual at ebx + cmd COPYDATASTRUCT + end virtual + mov esi,[cmd.lpData] + jmp find_argument + wmgetminmaxinfo: + mov ebx,[lparam] + virtual at ebx + mmi MINMAXINFO + end virtual + mov [mmi.ptMinTrackSize.x],240 + mov [mmi.ptMinTrackSize.y],160 + jmp finish + wmsize: + invoke SendMessage,[hwnd_status],WM_SIZE,0,0 + xor eax,eax + mov [rc.left],eax + mov [rc.top],eax + mov [rc.right],eax + mov [rc.bottom],eax + invoke SendMessage,[hwnd_tabctrl],TCM_ADJUSTRECT,TRUE,rc + mov esi,[rc.bottom] + sub esi,[rc.top] + invoke GetWindowRect,[hwnd_status],rc + mov ebx,[rc.bottom] + sub ebx,[rc.top] + invoke GetClientRect,[hwnd],rc + sub [rc.bottom],ebx + sub [rc.bottom],esi + invoke SetWindowPos,[hwnd_tabctrl],[hwnd_fedit],0,[rc.bottom],[rc.right],esi,0 + invoke GetSystemMetrics,SM_CYFIXEDFRAME + shl eax,1 + add [rc.bottom],eax + invoke MoveWindow,[hwnd_fedit],0,0,[rc.right],[rc.bottom],TRUE + jmp finish + wmsetfocus: + invoke SetFocus,[hwnd_fedit] + jmp finish + fmnew: + invoke CreateWindowEx,WS_EX_STATICEDGE,_fedit_class,NULL,WS_CHILD+WS_HSCROLL+WS_VSCROLL+ES_NOHIDESEL,0,0,0,0,[hwnd],NULL,[hinstance],NULL + or eax,eax + jz failed + mov [ei.header.mask],TCIF_TEXT+TCIF_PARAM + mov [ei.hwnd],eax + mov eax,[wparam] + mov [ei.header.pszText],eax + and [ei.pszpath],0 + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + invoke SendMessage,[hwnd_tabctrl],TCM_INSERTITEM,eax,ei + mov ebx,eax + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,eax,0 + invoke SendMessage,[hwnd],FM_SELECT,ebx,0 + invoke SetFocus,[hwnd] + mov eax,ebx + jmp finish + fmopen: + and [command_flags],0 + allocate_path_buffer: + invoke VirtualAlloc,0,1000h,MEM_COMMIT,PAGE_READWRITE + or eax,eax + jz failed + mov edi,eax + mov esi,[lparam] + mov [lparam],edi + copy_path_for_fedit: + lodsb + stosb + or al,al + jnz copy_path_for_fedit + xor ebx,ebx + check_if_already_loaded: + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei + or eax,eax + jz load_file + invoke lstrcmpi,[ei.pszpath],[lparam] + or eax,eax + jz show_already_loaded + inc ebx + jmp check_if_already_loaded + show_already_loaded: + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,ebx,0 + invoke SendMessage,[hwnd],FM_SELECT,ebx,0 + xor eax,eax + jmp finish + load_file: + invoke CreateFile,[lparam],GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0 + cmp eax,-1 + je open_failed + mov ebx,eax + invoke GetFileSize,ebx,NULL + inc eax + push eax + invoke VirtualAlloc,0,eax,MEM_COMMIT,PAGE_READWRITE + or eax,eax + pop ecx + jz load_out_of_memory + dec ecx + push MEM_RELEASE 0 eax + mov byte [eax+ecx],0 + invoke ReadFile,ebx,eax,ecx,param_buffer,0 + invoke CloseHandle,ebx + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + cmp eax,1 + jne new_fedit + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,0,ei + cmp [ei.pszpath],0 + jne new_fedit + invoke SendMessage,[ei.hwnd],FEM_ISUNMODIFIED,0,0 + or eax,eax + jz new_fedit + mov [ei.header.mask],TCIF_TEXT+TCIF_PARAM + mov eax,[wparam] + mov [ei.header.pszText],eax + mov eax,[lparam] + mov [ei.pszpath],eax + invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,0,ei + xor ebx,ebx + jmp set_fedit_text + new_fedit: + invoke SendMessage,[hwnd],FM_NEW,[wparam],0 + cmp eax,-1 + jne set_path + add esp,12 + jmp open_failed + set_path: + mov ebx,eax + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei + mov eax,[lparam] + mov [ei.pszpath],eax + invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,ebx,ei + set_fedit_text: + invoke SendMessage,[hwnd_fedit],WM_SETTEXT,0,dword [esp] + call [VirtualFree] + invoke SendMessage,[hwnd_fedit],FEM_GETMODE,0,0 + and eax,not FEMODE_READONLY + test [command_flags],1 + jz set_initial_mode + or eax,FEMODE_READONLY + set_initial_mode: + invoke SendMessage,[hwnd_fedit],FEM_SETMODE,eax,0 + jmp update_status_bar + load_out_of_memory: + invoke CloseHandle,ebx + open_failed: + invoke VirtualFree,[lparam],0,MEM_RELEASE + jmp failed + fmopenreadonly: + or [command_flags],1 + jmp allocate_path_buffer + fmsavemodified: + or ebx,-1 + jmp save_single_file + fmsave: + xor ebx,ebx + save_single_file: + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei + or eax,eax + jz failed + cmp [ei.pszpath],0 + je failed + invoke SendMessage,[ei.hwnd],FEM_GETMODE,0,0 + test eax,FEMODE_READONLY + jnz ok + invoke SendMessage,[ei.hwnd],FEM_ISUNMODIFIED,0,0 + and eax,ebx + jnz ok + invoke SendMessage,[ei.hwnd],WM_GETTEXTLENGTH,0,0 + inc eax + mov [wparam],eax + invoke VirtualAlloc,0,eax,MEM_COMMIT,PAGE_READWRITE + or eax,eax + jz failed + mov [lparam],eax + invoke CreateFile,[ei.pszpath],GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0 + cmp eax,-1 + je save_failed + mov ebx,eax + invoke SendMessage,[ei.hwnd],WM_GETTEXT,[wparam],[lparam] + invoke WriteFile,ebx,[lparam],eax,param_buffer,0 + test eax,eax + jz save_failed + invoke CloseHandle,ebx + invoke VirtualFree,[lparam],0,MEM_RELEASE + invoke SendMessage,[ei.hwnd],FEM_MARKUNMODIFIED,0,0 + xor ebx,ebx + mov eax,[ei.hwnd] + cmp eax,[hwnd_fedit] + je update_status_bar + xor eax,eax + jmp finish + save_failed: + invoke VirtualFree,[lparam],0,MEM_RELEASE + jmp failed + fmcompile: + mov eax,[assigned_file] + push eax + cmp eax,-1 + jne assigned_ok + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + mov [assigned_file],eax + assigned_ok: + invoke SendMessage,[hwnd_main],FM_SAVEMODIFIED,eax,0 + xor ebx,ebx + or eax,eax + jz save_all + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,[assigned_file],0 + invoke SendMessage,[hwnd_main],FM_SELECT,[assigned_file],0 + invoke SendMessage,[hwnd_main],WM_COMMAND,IDM_SAVEAS,0 + or eax,eax + jz save_all + or eax,-1 + jmp compile_done + save_all: + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei + or eax,eax + jz do_compile + invoke SendMessage,[hwnd_main],FM_SAVEMODIFIED,ebx,0 + inc ebx + jmp save_all + do_compile: + mov eax,[wparam] + mov [output_file],eax + invoke DialogBoxParam,[hinstance],IDD_COMPILE,[hwnd],CompileDialog,[assigned_file] + cmp eax,-1 + je compile_done + push eax + cmp eax,2 + je error_details + or eax,eax + jnz make_summary + cmp [lparam],FALSE + jne make_summary + invoke GlobalFree,[hmem_display] + jmp summary_done + make_summary: + invoke DialogBoxParam,[hinstance],IDD_SUMMARY,[hwnd],SummaryDialog,eax + jmp summary_done + error_details: + invoke DialogBoxParam,[hinstance],IDD_ERRORSUMMARY,[hwnd],SummaryDialog,eax + invoke GlobalFree,[hmem_error_data] + summary_done: + pop eax + compile_done: + pop edx + cmp edx,-1 + jne finish + or [assigned_file],-1 + jmp finish + fmselect: + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei + invoke GetWindowLong,[hwnd_fedit],GWL_STYLE + and eax,not WS_VISIBLE + invoke SetWindowLong,[hwnd_fedit],GWL_STYLE,eax + mov ebx,[ei.hwnd] + mov [hwnd_fedit],ebx + mov eax,WS_CHILD+WS_HSCROLL+WS_VSCROLL+ES_NOHIDESEL + or eax,[fedit_style] + invoke SetWindowLong,ebx,GWL_STYLE,eax + invoke SendMessage,ebx,WM_SETFONT,[hfont],0 + invoke SendMessage,ebx,FEM_SETTEXTCOLOR,[editor_colors],[editor_colors+4] + invoke SendMessage,ebx,FEM_SETSELCOLOR,[editor_colors+8],[editor_colors+12] + invoke SendMessage,ebx,FEM_SETSYNTAXHIGHLIGHT,asm_syntax_colors,fasm_syntax + invoke SendMessage,ebx,FEM_SETRIGHTCLICKMENU,[hmenu_edit],[hwnd] + invoke SendMessage,[hwnd],WM_SIZE,0,0 + invoke ShowWindow,ebx,SW_SHOW + invoke UpdateWindow,ebx + invoke SetFocus,[hwnd] + jmp finish + fmassign: + mov eax,[wparam] + cmp [assigned_file],-1 + je new_assign + push eax + mov [ei.header.mask],TCIF_IMAGE + mov [ei.header.iImage],-1 + invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,[assigned_file],ei + pop eax + new_assign: + mov [assigned_file],eax + mov [ei.header.mask],TCIF_IMAGE + mov [ei.header.iImage],0 + invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,eax,ei + or eax,eax + jnz fmgetassigned + or eax,-1 + mov [assigned_file],eax + jmp finish + fmgetassigned: + mov eax,[assigned_file] + jmp finish + fmgetselected: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + jmp finish + fmgethandle: + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei + or eax,eax + jz finish + mov eax,[ei.hwnd] + jmp finish + wminitmenu: + mov esi,[hwnd_fedit] + invoke SendMessage,esi,EM_CANUNDO,0,0 + or eax,eax + setz bl + neg bl + and ebx,MF_GRAYED + or ebx,MF_BYCOMMAND + invoke EnableMenuItem,[wparam],IDM_UNDO,ebx + invoke SendMessage,esi,FEM_CANREDO,0,0 + or eax,eax + setz bl + neg bl + and ebx,MF_GRAYED + or ebx,MF_BYCOMMAND + invoke EnableMenuItem,[wparam],IDM_REDO,ebx + invoke SendMessage,esi,FEM_GETPOS,fepos,0 + mov eax,[fepos.selectionLine] + cmp eax,[fepos.caretLine] + sete bh + mov eax,[fepos.selectionPosition] + cmp eax,[fepos.caretPosition] + sete bl + and bl,bh + neg bl + and ebx,MF_GRAYED + or ebx,MF_BYCOMMAND + invoke EnableMenuItem,[wparam],IDM_CUT,ebx + invoke EnableMenuItem,[wparam],IDM_COPY,ebx + invoke EnableMenuItem,[wparam],IDM_DELETE,ebx + invoke IsClipboardFormatAvailable,CF_TEXT + neg al + not al + and eax,MF_GRAYED + or eax,MF_BYCOMMAND + invoke EnableMenuItem,[wparam],IDM_PASTE,eax + invoke SendMessage,esi,FEM_GETMODE,0,0 + mov ebx,eax + test eax,FEMODE_VERTICALSEL + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_VERTICAL,eax + test ebx,FEMODE_READONLY + setnz bl + and ebx,MF_GRAYED + or ebx,MF_BYCOMMAND + invoke EnableMenuItem,[wparam],IDM_CUT,ebx + invoke EnableMenuItem,[wparam],IDM_PASTE,ebx + invoke EnableMenuItem,[wparam],IDM_DELETE,ebx + invoke EnableMenuItem,[wparam],IDM_REPLACE,ebx + invoke SendMessage,esi,FEM_CANFINDNEXT,0,0 + or eax,eax + setz al + neg al + and eax,MF_GRAYED + or eax,MF_BYCOMMAND + invoke EnableMenuItem,[wparam],IDM_FINDNEXT,eax + test [fedit_style],FES_SECURESEL + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_SECURESEL,eax + test [fedit_style],FES_AUTOBRACKETS + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_AUTOBRACKETS,eax + test [fedit_style],FES_AUTOINDENT + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_AUTOINDENT,eax + test [fedit_style],FES_SMARTTABS + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_SMARTTABS,eax + test [fedit_style],FES_OPTIMALFILL + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_OPTIMALFILL,eax + test [fedit_style],FES_REVIVEDEADKEYS + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_REVIVEDEADKEYS,eax + test [fedit_style],FES_TIMESCROLL + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[wparam],IDM_TIMESCROLL,eax + cmp [help_path],0 + sete bl + neg bl + and ebx,MF_GRAYED + or ebx,MF_BYCOMMAND + invoke EnableMenuItem,[wparam],IDM_CONTENTS,ebx + invoke EnableMenuItem,[wparam],IDM_KEYWORD,ebx + jmp finish + wmcommand: + mov eax,[wparam] + mov ebx,[lparam] + or ebx,ebx + jz menu_command + cmp ebx,[hwnd_fedit] + jne finish + xor ebx,ebx + shr eax,16 + cmp eax,FEN_SETFOCUS + je update_status_bar + cmp eax,FEN_TEXTCHANGE + je update_status_bar + cmp eax,FEN_POSCHANGE + je update_status_bar + cmp eax,FEN_OUTOFMEMORY + je not_enough_mem + jmp finish + update_status_bar: + invoke SendMessage,[hwnd_fedit],FEM_GETPOS,fepos,0 + cinvoke wsprintf,string_buffer,_row_column,[fepos.caretLine],[fepos.caretPosition] + invoke SendMessage,[hwnd_status],SB_SETTEXT,0,string_buffer + mov esi,_null + invoke SendMessage,[hwnd_fedit],FEM_GETMODE,0,0 + test eax,FEMODE_READONLY + jnz readonly_status + invoke SendMessage,[hwnd_fedit],FEM_ISUNMODIFIED,0,0 + or eax,eax + jnz modified_status_ok + mov esi,_modified_status + jmp modified_status_ok + readonly_status: + mov esi,_readonly_status + modified_status_ok: + invoke SendMessage,[hwnd_status],SB_SETTEXT,1,esi + mov eax,ebx + jmp finish + not_enough_mem: + invoke SendMessage,[hwnd_fedit],FEM_RELEASESEARCH,0,0 + invoke MessageBox,[hwnd],_memory_error,_caption,MB_ICONERROR+MB_OK + mov eax,ebx + jmp finish + menu_command: + and eax,0FFFFh + mov ebx,[hwnd_fedit] + cmp eax,IDM_NEW + je new_file + cmp eax,IDM_OPEN + je open_file + cmp eax,IDM_SAVE + je save_file + cmp eax,IDM_SAVEAS + je save_file_as + cmp eax,IDM_NEXT + je next_file + cmp eax,IDM_PREVIOUS + je previous_file + cmp eax,IDM_OPENFOLDER + je open_folder + cmp eax,IDM_CLOSE + je close_file + cmp eax,IDM_EXIT + je exit + cmp eax,IDM_UNDO + je undo + cmp eax,IDM_REDO + je redo + cmp eax,IDM_DISCARD_UNDO + je discard_undo + cmp eax,IDM_CUT + je cut + cmp eax,IDM_COPY + je copy + cmp eax,IDM_PASTE + je paste + cmp eax,IDM_DELETE + je delete + cmp eax,IDM_SELECTALL + je select_all + cmp eax,IDM_VERTICAL + je vertical + cmp eax,IDM_READONLY + je read_only + cmp eax,IDM_POSITION + je position + cmp eax,IDM_FIND + je find + cmp eax,IDM_FINDNEXT + je findnext + cmp eax,IDM_REPLACE + je replace + cmp eax,IDM_RUN + je run + cmp eax,IDM_COMPILE + je compile + cmp eax,IDM_SYMBOLS + je build_symbols + cmp eax,IDM_ASSIGN + je assign + cmp eax,IDM_APPEARANCE + je appearance + cmp eax,IDM_COMPILERSETUP + je compiler_setup + cmp eax,IDM_SECURESEL + je option_securesel + cmp eax,IDM_AUTOBRACKETS + je option_autobrackets + cmp eax,IDM_AUTOINDENT + je option_autoindent + cmp eax,IDM_SMARTTABS + je option_smarttabs + cmp eax,IDM_OPTIMALFILL + je option_optimalfill + cmp eax,IDM_REVIVEDEADKEYS + je option_revivedeadkeys + cmp eax,IDM_TIMESCROLL + je option_timescroll + cmp eax,IDM_CALCULATOR + je calculator + cmp eax,IDM_CONTENTS + je contents + cmp eax,IDM_KEYWORD + je keyword + cmp eax,IDM_PICKHELP + je pick_help + cmp eax,IDM_ABOUT + je about + sub eax,IDM_SELECTFILE + jc finish + cmp eax,9 + ja finish + mov ebx,eax + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + cmp ebx,eax + ja finish + dec ebx + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,ebx,0 + invoke SendMessage,[hwnd],FM_SELECT,ebx,0 + jmp finish + new_file: + invoke SendMessage,[hwnd],FM_NEW,_untitled,0 + jmp finish + open_file: + mov [ofn.lpstrFile],path_buffer + mov [path_buffer],0 + mov [ofn.lpstrFilter],asm_filter + mov [ofn.Flags],OFN_EXPLORER+OFN_ALLOWMULTISELECT+OFN_FILEMUSTEXIST + mov [ofn.lpstrFileTitle],name_buffer + mov [ofn.lpstrTitle],NULL + invoke GetOpenFileName,ofn + or eax,eax + jz finish + mov ebx,FM_OPEN + test [ofn.Flags],OFN_READONLY + jz open_chosen_files + mov ebx,FM_OPENREADONLY + open_chosen_files: + test [ofn.Flags],OFN_ALLOWMULTISELECT + jz open_single_file + mov esi,path_buffer + movzx eax,[ofn.nFileOffset] + add esi,eax + mov byte [esi-1],'\' + mov edi,esi + open_multiple_files: + cmp byte [esi],0 + je finish + push edi + move_file_name: + lodsb + stosb + or al,al + jnz move_file_name + pop edi + invoke GetFileTitle,path_buffer,name_buffer,100h + invoke SendMessage,[hwnd],ebx,name_buffer,path_buffer + cmp eax,-1 + jne open_multiple_files + invoke wvsprintf,string_buffer,_loading_error,ofn.lpstrFile + invoke MessageBox,[hwnd],string_buffer,_caption,MB_ICONERROR+MB_OK + jmp open_multiple_files + open_single_file: + invoke SendMessage,[hwnd],ebx,name_buffer,path_buffer + cmp eax,-1 + jne finish + invoke wvsprintf,string_buffer,_loading_error,ofn.lpstrFile + invoke MessageBox,[hwnd],string_buffer,_caption,MB_ICONERROR+MB_OK + jmp finish + save_file: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + invoke SendMessage,[hwnd],FM_SAVE,eax,0 + or eax,eax + jnz save_file_as + jmp finish + save_file_as: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + mov ebx,eax + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei + mov eax,[ei.pszpath] + or eax,eax + jnz alloc_ok + invoke VirtualAlloc,0,1000h,MEM_COMMIT,PAGE_READWRITE + mov [ei.pszpath],eax + and byte [eax],0 + alloc_ok: + mov [lparam],eax + mov [ofn.lpstrFile],eax + mov [ofn.lpstrFilter],asm_filter + mov [ofn.Flags],OFN_EXPLORER+OFN_HIDEREADONLY+OFN_OVERWRITEPROMPT + mov [ofn.lpstrTitle],NULL + invoke GetSaveFileName,ofn + or eax,eax + jz save_cancelled + mov eax,[ei.pszpath] + mov [ei.header.pszText],name_buffer + mov [ei.header.mask],TCIF_TEXT+TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,ebx,ei + invoke SendMessage,[hwnd],FM_SAVE,ebx,0 + xor esi,esi + check_if_overwritten: + cmp esi,ebx + je not_overwritten + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,esi,ei + or eax,eax + jz save_ok + invoke lstrcmpi,[ei.pszpath],[lparam] + or eax,eax + jz remove_overwritten + not_overwritten: + inc esi + jmp check_if_overwritten + remove_overwritten: + invoke VirtualFree,[ei.pszpath],0,MEM_RELEASE + invoke SendMessage,[hwnd_tabctrl],TCM_DELETEITEM,esi,0 + cmp [assigned_file],-1 + je save_ok + cmp esi,[assigned_file] + ja save_ok + je assigned_overwritten + dec [assigned_file] + jmp save_ok + assigned_overwritten: + mov [assigned_file],-1 + save_ok: + xor eax,eax + jmp finish + save_cancelled: + mov eax,[ei.pszpath] + cmp byte [eax],0 + jne preserve_save_path + invoke VirtualFree,[ei.pszpath],0,MEM_RELEASE + and [ei.pszpath],0 + preserve_save_path: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,eax,ei + jmp finish + next_file: + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + mov ebx,eax + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + inc eax + cmp eax,ebx + jb select_file + xor eax,eax + select_file: + push eax + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,eax,0 + pop eax + invoke SendMessage,[hwnd],FM_SELECT,eax,0 + jmp finish + previous_file: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + sub eax,1 + jnc select_file + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + dec eax + call select_file + jmp select_file + open_folder: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,eax,ei + or eax,eax + jz finish + mov eax,[ei.pszpath] + or eax,eax + jz finish + invoke GetFullPathName,eax,1000h,path_buffer,param_buffer + mov edi,[param_buffer] + xor al,al + stosb + invoke ShellExecute,HWND_DESKTOP,NULL,path_buffer,NULL,NULL,SW_SHOWNORMAL + jmp finish + close_file: + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + cmp eax,1 + jbe close_window + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + mov ebx,eax + mov [ei.header.mask],TCIF_PARAM+TCIF_TEXT + mov [ei.header.pszText],name_buffer + mov [ei.header.cchTextMax],100h + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei + mov eax,[ei.hwnd] + mov [wparam],eax + invoke SendMessage,eax,FEM_ISUNMODIFIED,0,0 + or eax,eax + jz close_modified + cmp [ei.pszpath],0 + jne do_close + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + cmp eax,1 + jne do_close + jmp failed + close_modified: + mov eax,MB_ICONQUESTION+MB_YESNOCANCEL + or eax,[lparam] + invoke MessageBox,[hwnd],_saving_question,[ei.header.pszText],eax + cmp eax,IDCANCEL + je failed + cmp eax,IDNO + je do_close + invoke SendMessage,[hwnd],WM_COMMAND,IDM_SAVE,0 + or eax,eax + jnz failed + do_close: + cmp [ei.pszpath],0 + je delete_tab + invoke VirtualFree,[ei.pszpath],0,MEM_RELEASE + delete_tab: + invoke SendMessage,[hwnd_tabctrl],TCM_DELETEITEM,ebx,0 + cmp ebx,[assigned_file] + jg tab_deleted + je assigned_deleted + dec [assigned_file] + jmp tab_deleted + assigned_deleted: + mov [assigned_file],-1 + tab_deleted: + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEMCOUNT,0,0 + dec eax + cmp eax,ebx + jge select_next + sub ebx,1 + jnc select_next + invoke SendMessage,[hwnd],FM_NEW,_untitled,0 + jmp destroy_fedit + select_next: + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,ebx,0 + invoke SendMessage,[hwnd],FM_SELECT,ebx,0 + destroy_fedit: + invoke DestroyWindow,[wparam] + xor eax,eax + jmp finish + exit: + mov [lparam],0 + jmp close_window + undo: + invoke SendMessage,ebx,WM_UNDO,0,0 + jmp finish + redo: + invoke SendMessage,ebx,FEM_REDO,0,0 + jmp finish + cut: + invoke SendMessage,ebx,WM_CUT,0,0 + jmp finish + copy: + invoke SendMessage,ebx,WM_COPY,0,0 + jmp finish + paste: + invoke SendMessage,ebx,WM_PASTE,0,0 + jmp finish + delete: + invoke SendMessage,ebx,WM_CLEAR,0,0 + jmp finish + discard_undo: + invoke SendMessage,ebx,EM_EMPTYUNDOBUFFER,0,0 + jmp finish + select_all: + mov [fepos.selectionLine],1 + mov [fepos.selectionPosition],1 + mov [fepos.caretLine],-1 + mov [fepos.caretPosition],1 + invoke SendMessage,ebx,FEM_SETPOS,fepos,0 + invoke SendMessage,ebx,FEM_GETPOS,fepos,0 + invoke SendMessage,ebx,FEM_GETLINELENGTH,[fepos.caretLine],0 + inc eax + mov [fepos.caretPosition],eax + invoke SendMessage,ebx,FEM_SETPOS,fepos,0 + jmp finish + vertical: + invoke SendMessage,ebx,FEM_GETMODE,0,0 + xor eax,FEMODE_VERTICALSEL + invoke SendMessage,ebx,FEM_SETMODE,eax,0 + jmp finish + read_only: + invoke SendMessage,ebx,FEM_GETMODE,0,0 + xor eax,FEMODE_READONLY + invoke SendMessage,ebx,FEM_SETMODE,eax,0 + xor ebx,ebx + jmp update_status_bar + position: + invoke DialogBoxParam,[hinstance],IDD_POSITION,[hwnd],PositionDialog,0 + jmp finish + find: + invoke DialogBoxParam,[hinstance],IDD_FIND,[hwnd],FindDialog,0 + or eax,eax + jz finish + invoke SendMessage,ebx,FEM_FINDFIRST,[search_settings],search_string + or eax,eax + jnz finish + not_found: + mov [param_buffer],1000h + invoke SendMessage,[hwnd_fedit],FEM_GETSEARCHTEXT,search_string,param_buffer + invoke SendMessage,[hwnd_fedit],FEM_GETSEARCHFLAGS,0,0 + mov esi,_not_found + test eax,FEFIND_INWHOLETEXT + jnz make_not_found_message + mov esi,_not_found_after + test eax,FEFIND_BACKWARD + jz make_not_found_message + mov esi,_not_found_before + make_not_found_message: + cinvoke wsprintf,string_buffer,esi,search_string + invoke SendMessage,[hwnd_fedit],FEM_RELEASESEARCH,0,0 + invoke MessageBox,[hwnd],string_buffer,_find,MB_ICONINFORMATION+MB_OK + jmp finish + findnext: + invoke SendMessage,ebx,FEM_FINDNEXT,0,0 + or eax,eax + jz not_found + jmp finish + replace: + invoke DialogBoxParam,[hinstance],IDD_REPLACE,[hwnd],ReplaceDialog,0 + or eax,eax + jz finish + mov [replaces_count],0 + invoke SendMessage,ebx,FEM_BEGINOPERATION,0,0 + test [command_flags],1 + jz .start_replacing + invoke SendMessage,ebx,FEM_ENDOPERATION,0,0 + .start_replacing: + invoke SendMessage,ebx,FEM_FINDFIRST,[search_settings],search_string + or eax,eax + jz .not_found + invoke SendMessage,ebx,FEM_GETMODE,0,0 + push eax + and eax,not (FEMODE_VERTICALSEL + FEMODE_OVERWRITE) + invoke SendMessage,ebx,FEM_SETMODE,eax,0 + .confirm_replace: + test [command_flags],1 + jz .replace + invoke UpdateWindow,edi + invoke MessageBox,[hwnd],_replace_prompt,_replace,MB_ICONQUESTION+MB_YESNOCANCEL + cmp eax,IDCANCEL + je .replace_finish + cmp eax,IDNO + je .replace_next + .replace: + push ebx edi + invoke SendMessage,ebx,EM_REPLACESEL,FALSE,replace_string + pop edi ebx + inc [replaces_count] + .replace_next: + invoke SendMessage,ebx,FEM_FINDNEXT,0,0 + or eax,eax + jnz .confirm_replace + .replace_finish: + pop eax + invoke SendMessage,ebx,FEM_SETMODE,eax,0 + test [command_flags],1 + jnz .replace_summary + invoke SendMessage,ebx,FEM_ENDOPERATION,0,0 + .replace_summary: + invoke SendMessage,[hwnd_fedit],FEM_RELEASESEARCH,0,0 + cinvoke wsprintf,string_buffer,_replaces_made,[replaces_count] + invoke MessageBox,[hwnd],string_buffer,_find,MB_ICONINFORMATION+MB_OK + jmp finish + .not_found: + invoke SendMessage,ebx,FEM_ENDOPERATION,0,0 + jmp not_found + run: + and [command_flags],0 + invoke SendMessage,[hwnd],FM_COMPILE,0,FALSE + or eax,eax + jnz finish + mov [sinfo.cb],sizeof.STARTUPINFO + mov [sinfo.dwFlags],0 + cmp [output_format],3 + ja run_object + invoke CreateProcess,path_buffer,NULL,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,sinfo,pinfo + invoke CloseHandle,[pinfo.hThread] + invoke CloseHandle,[pinfo.hProcess] + jmp finish + run_object: + invoke MessageBox,[hwnd],_run_object_error,_caption,MB_ICONERROR+MB_OK + jmp finish + compile: + and [command_flags],0 + invoke SendMessage,[hwnd],FM_COMPILE,0,TRUE + jmp finish + build_symbols: + mov [command_flags],2 + invoke SendMessage,[hwnd],FM_COMPILE,0,TRUE + jmp finish + assign: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + cmp eax,[assigned_file] + jne do_assign + or eax,-1 + do_assign: + invoke SendMessage,[hwnd],FM_ASSIGN,eax,0 + jmp finish + appearance: + invoke DialogBoxParam,[hinstance],IDD_APPEARANCE,[hwnd],AppearanceSetup,0 + or eax,eax + jnz update + jmp finish + compiler_setup: + invoke DialogBoxParam,[hinstance],IDD_COMPILERSETUP,[hwnd],CompilerSetup,0 + jmp finish + option_securesel: + xor [fedit_style],FES_SECURESEL + jmp update + option_autobrackets: + xor [fedit_style],FES_AUTOBRACKETS + jmp update + option_autoindent: + xor [fedit_style],FES_AUTOINDENT + jmp update + option_smarttabs: + xor [fedit_style],FES_SMARTTABS + jmp update + option_optimalfill: + xor [fedit_style],FES_OPTIMALFILL + jmp update + option_revivedeadkeys: + xor [fedit_style],FES_REVIVEDEADKEYS + jmp update + option_timescroll: + xor [fedit_style],FES_TIMESCROLL + jmp update + calculator: + invoke DialogBoxParam,[hinstance],IDD_CALCULATOR,[hwnd],CalculatorDialog,0 + jmp finish + contents: + call get_help_file_extension + cmp eax,'.hlp' + je winhelp_contents + call check_htmlhelp + jc winhelp_contents + invoke HtmlHelp,[hwnd],help_path,HH_DISPLAY_TOPIC,0 + jmp finish + winhelp_contents: + invoke WinHelp,[hwnd],help_path,HELP_FINDER,0 + jmp finish + get_help_file_extension: + mov esi,help_path + skip_help_path: + lodsb + or al,al + jnz skip_help_path + mov ebx,characters + dec esi + mov ecx,4 + convert_extension: + dec esi + shl eax,8 + mov al,[esi] + xlatb + loop convert_extension + retn + check_htmlhelp: + cmp [HtmlHelp],0 + jne htmlhelp_ok + invoke LoadLibrary,_htmlhelp_library + or eax,eax + jz htmlhelp_unavailable + invoke GetProcAddress,eax,_htmlhelp_api + or eax,eax + jz htmlhelp_unavailable + mov [HtmlHelp],eax + htmlhelp_ok: + clc + retn + htmlhelp_unavailable: + stc + retn + keyword: + invoke SendMessage,[hwnd_fedit],FEM_GETWORDATCARET,1000h,string_buffer + call get_help_file_extension + cmp eax,'.hlp' + je winhelp_keyword + call check_htmlhelp + jc winhelp_keyword + mov [hhkey.cbStruct],sizeof.HH_AKLINK + mov [hhkey.pszKeywords],string_buffer + mov [hhkey.pszUrl],0 + mov [hhkey.fIndexOnFail],TRUE + invoke HtmlHelp,[hwnd],help_path,HH_DISPLAY_TOPIC,0 + invoke HtmlHelp,[hwnd],help_path,HH_KEYWORD_LOOKUP,hhkey + jmp finish + winhelp_keyword: + invoke WinHelp,[hwnd],help_path,HELP_KEY,string_buffer + jmp finish + pick_help: + mov [ofn.lpstrFile],help_path + mov [ofn.lpstrFilter],help_filter + mov [ofn.Flags],OFN_EXPLORER+OFN_FILEMUSTEXIST+OFN_HIDEREADONLY + mov [ofn.lpstrTitle],_pick_help + invoke GetOpenFileName,ofn + jmp finish + about: + invoke DialogBoxParam,[hinstance],IDD_ABOUT,[hwnd],AboutDialog,0 + jmp finish + failed: + or eax,-1 + jmp finish + wmnotify: + mov ebx,[lparam] + virtual at ebx + nmh NMHDR + end virtual + cmp [nmh.code],NM_RCLICK + je rclick + cmp [nmh.code],TCN_SELCHANGING + je selchanging + cmp [nmh.code],TCN_SELCHANGE + jne finish + update: + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + invoke SendMessage,[hwnd],FM_SELECT,eax,0 + jmp finish + selchanging: + xor eax,eax + jmp finish + rclick: + invoke GetCursorPos,pt + invoke GetWindowRect,[hwnd_tabctrl],rc + mov eax,[pt.x] + sub eax,[rc.left] + mov [tcht.pt.x],eax + mov eax,[pt.y] + sub eax,[rc.top] + mov [tcht.pt.y],eax + invoke SendMessage,[hwnd_tabctrl],TCM_HITTEST,0,tcht + cmp eax,-1 + je finish + mov ebx,eax + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,ebx,0 + invoke SendMessage,[hwnd],FM_SELECT,ebx,0 + cmp ebx,[assigned_file] + sete al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[hmenu_tab],IDM_ASSIGN,eax + invoke SendMessage,[hwnd_fedit],FEM_GETMODE,0,0 + test eax,FEMODE_READONLY + setnz al + neg al + and eax,MF_CHECKED + or eax,MF_BYCOMMAND + invoke CheckMenuItem,[hmenu_tab],IDM_READONLY,eax + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei + invoke SendMessage,[hwnd_fedit],FEM_ISUNMODIFIED,0,0 + test eax,eax + setz al + cmp [ei.pszpath],0 + setz ah + or al,ah + neg al + and eax,MF_GRAYED + or eax,MF_BYCOMMAND + invoke EnableMenuItem,[hmenu_tab],IDM_READONLY,eax + invoke TrackPopupMenu,[hmenu_tab],TPM_RIGHTBUTTON,[pt.x],[pt.y],0,[hwnd],0 + jmp finish + wmdropfiles: + invoke DragQueryFile,[wparam],-1,NULL,0 + xor ebx,ebx + drop_files: + cmp ebx,eax + je drag_finish + push eax + invoke DragQueryFile,[wparam],ebx,path_buffer,1000h + push ebx + invoke GetFileTitle,path_buffer,name_buffer,100h + invoke SendMessage,[hwnd],FM_OPEN,name_buffer,path_buffer + cmp eax,-1 + jne drop_ok + cinvoke wsprintf,string_buffer,_loading_error,path_buffer + invoke MessageBox,[hwnd],string_buffer,_caption,MB_ICONERROR+MB_OK + drop_ok: + pop ebx eax + inc ebx + jmp drop_files + drag_finish: + invoke DragFinish,[wparam] + xor eax,eax + jmp finish + wmclose: + mov [lparam],MB_DEFBUTTON2 + close_window: + mov [wparam],0 + check_before_exiting: + mov [ei.header.mask],TCIF_PARAM+TCIF_TEXT + mov [ei.header.pszText],name_buffer + mov [ei.header.cchTextMax],100h + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei + or eax,eax + jz check_done + mov esi,[ei.pszpath] + invoke SendMessage,[ei.hwnd],FEM_ISUNMODIFIED,0,0 + or eax,eax + jnz check_next + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,[wparam],0 + invoke SendMessage,[hwnd],FM_SELECT,[wparam],0 + mov eax,MB_ICONQUESTION+MB_YESNOCANCEL + or eax,[lparam] + invoke MessageBox,[hwnd],_saving_question,[ei.header.pszText],eax + cmp eax,IDCANCEL + je finish + cmp eax,IDNO + je check_next + invoke SendMessage,[hwnd],WM_COMMAND,IDM_SAVE,0 + or eax,eax + jnz finish + check_next: + inc [wparam] + jmp check_before_exiting + check_done: + mov [wparam],0 + release_paths: + mov [ei.header.mask],TCIF_PARAM+TCIF_TEXT + mov [ei.header.pszText],name_buffer + mov [ei.header.cchTextMax],100h + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei + or eax,eax + jz quit + mov esi,[ei.pszpath] + or esi,esi + jz release_next_path + invoke VirtualFree,esi,0,MEM_RELEASE + release_next_path: + inc [wparam] + jmp release_paths + quit: + stdcall WriteIniInteger,ini_path,_section_compiler,_key_compiler_memory,[compiler_memory] + stdcall WriteIniInteger,ini_path,_section_compiler,_key_compiler_priority,[compiler_priority] + stdcall WriteIniBit,ini_path,_section_options,_key_options_securesel,[fedit_style],FES_SECURESEL + stdcall WriteIniBit,ini_path,_section_options,_key_options_autobrackets,[fedit_style],FES_AUTOBRACKETS + stdcall WriteIniBit,ini_path,_section_options,_key_options_autoindent,[fedit_style],FES_AUTOINDENT + stdcall WriteIniBit,ini_path,_section_options,_key_options_smarttabs,[fedit_style],FES_SMARTTABS + stdcall WriteIniBit,ini_path,_section_options,_key_options_optimalfill,[fedit_style],FES_OPTIMALFILL + stdcall WriteIniBit,ini_path,_section_options,_key_options_revivedeadkeys,[fedit_style],FES_REVIVEDEADKEYS + stdcall WriteIniBit,ini_path,_section_options,_key_options_consolecaret,[fedit_style],FES_CONSOLECARET + stdcall WriteIniBit,ini_path,_section_options,_key_options_timescroll,[fedit_style],FES_TIMESCROLL + stdcall WriteIniColor,ini_path,_section_colors,_key_color_text,[editor_colors] + stdcall WriteIniColor,ini_path,_section_colors,_key_color_background,[editor_colors+4] + stdcall WriteIniColor,ini_path,_section_colors,_key_color_seltext,[editor_colors+8] + stdcall WriteIniColor,ini_path,_section_colors,_key_color_selbackground,[editor_colors+12] + stdcall WriteIniColor,ini_path,_section_colors,_key_color_symbols,[asm_syntax_colors] + stdcall WriteIniColor,ini_path,_section_colors,_key_color_numbers,[asm_syntax_colors+4] + stdcall WriteIniColor,ini_path,_section_colors,_key_color_strings,[asm_syntax_colors+8] + stdcall WriteIniColor,ini_path,_section_colors,_key_color_comments,[asm_syntax_colors+12] + invoke WritePrivateProfileString,_section_font,_key_font_face,font.lfFaceName,ini_path + stdcall WriteIniInteger,ini_path,_section_font,_key_font_height,[font.lfHeight] + stdcall WriteIniInteger,ini_path,_section_font,_key_font_width,[font.lfWidth] + stdcall WriteIniInteger,ini_path,_section_font,_key_font_weight,[font.lfWeight] + stdcall WriteIniBit,ini_path,_section_font,_key_font_italic,dword [font.lfItalic],1 + movzx eax,[font.lfCharSet] + stdcall WriteIniInteger,ini_path,_section_font,_key_font_charset,eax + invoke GetWindowPlacement,[hwnd],wp + stdcall WriteIniInteger,ini_path,_section_window,_key_window_top,[wp.rcNormalPosition.top] + stdcall WriteIniInteger,ini_path,_section_window,_key_window_left,[wp.rcNormalPosition.left] + stdcall WriteIniInteger,ini_path,_section_window,_key_window_right,[wp.rcNormalPosition.right] + stdcall WriteIniInteger,ini_path,_section_window,_key_window_bottom,[wp.rcNormalPosition.bottom] + cmp [wp.showCmd],SW_SHOWMAXIMIZED + sete al + stdcall WriteIniBit,ini_path,_section_window,_key_window_maximized,eax,1 + invoke WritePrivateProfileString,_section_help,_key_help_path,help_path,ini_path + invoke DestroyWindow,[hwnd] + jmp finish + wmdestroy: + invoke WinHelp,[hwnd],0,HELP_QUIT,0 + invoke ImageList_Destroy,[himl] + invoke PostQuitMessage,0 + ok: + xor eax,eax + finish: + pop edi esi ebx + ret +endp + +proc WriteIniInteger ini,sec,key,val + cinvoke wsprintf,string_buffer,_value,[val] + invoke WritePrivateProfileString,[sec],[key],string_buffer,[ini] + ret +endp + +proc WriteIniColor ini,sec,key,color + movzx eax,byte [color] + movzx ebx,byte [color+1] + movzx ecx,byte [color+2] + cinvoke wsprintf,string_buffer,_color,eax,ebx,ecx + invoke WritePrivateProfileString,[sec],[key],string_buffer,[ini] + ret +endp + +proc WriteIniBit ini,sec,key,val,mask + mov eax,[val] + test eax,[mask] + setnz al + movzx eax,al + cinvoke wsprintf,string_buffer,_value,eax + invoke WritePrivateProfileString,[sec],[key],string_buffer,[ini] + ret +endp + +proc GetIniInteger ini,sec,key,lpval + mov [string_buffer],0 + invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini] + mov esi,string_buffer + cmp byte [esi],0 + je .done + call atoi + jc .done + mov ebx,[lpval] + mov [ebx],eax + .done: + ret +endp + +proc atoi + lodsb + cmp al,20h + je atoi + cmp al,9 + je atoi + mov bl,al + xor eax,eax + xor edx,edx + cmp bl,'-' + je atoi_digit + cmp bl,'+' + je atoi_digit + dec esi + atoi_digit: + mov dl,[esi] + sub dl,30h + jc atoi_done + cmp dl,9 + ja atoi_done + mov ecx,eax + shl ecx,1 + jc atoi_overflow + shl ecx,1 + jc atoi_overflow + add eax,ecx + shl eax,1 + jc atoi_overflow + js atoi_overflow + add eax,edx + jc atoi_overflow + inc esi + jmp atoi_digit + atoi_overflow: + stc + ret + atoi_done: + cmp bl,'-' + jne atoi_sign_ok + neg eax + atoi_sign_ok: + clc + ret +endp + +proc GetIniColor ini,sec,key,lpcolor + mov [string_buffer],0 + invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini] + mov esi,string_buffer + cmp byte [esi],0 + je .done + call atoi + jc .done + cmp eax,0FFh + ja .done + mov edi,eax + call .find + jne .done + call atoi + jc .done + cmp eax,0FFh + ja .done + shl eax,8 + or edi,eax + call .find + jne .done + call atoi + jc .done + cmp eax,0FFh + ja .done + shl eax,16 + or edi,eax + mov ebx,[lpcolor] + mov [ebx],edi + .done: + ret + .find: + lodsb + cmp al,20h + je .find + cmp al,9 + je .find + cmp al,',' + retn +endp + +proc GetIniByte ini,sec,key,lpval + mov [string_buffer],0 + invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini] + mov esi,string_buffer + cmp byte [esi],0 + je .done + call atoi + jc .done + cmp eax,100h + jae .done + mov ebx,[lpval] + mov [ebx],al + .done: + ret +endp + +proc GetIniBit ini,sec,key,lpval,mask + mov [string_buffer],0 + invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini] + mov esi,string_buffer + xor eax,eax + .find: + lodsb + cmp al,20h + je .find + cmp al,9 + je .find + sub al,30h + jc .done + cmp al,1 + ja .done + neg eax + mov ebx,[lpval] + mov edx,[mask] + not edx + and [ebx],edx + and eax,[mask] + or [ebx],eax + .done: + ret +endp + +proc fasm_syntax lpLine,uChars,lpColors + push ebx esi edi + mov esi,[lpLine] + mov edi,[lpColors] + mov ebx,characters + mov ecx,[uChars] + xor edx,edx + .scan_syntax: + lodsb + .check_character: + cmp al,20h + je .syntax_space + cmp al,3Bh + je .syntax_comment + mov ah,al + xlatb + or al,al + jz .syntax_symbol + or edx,edx + jnz .syntax_neutral + cmp ah,27h + je .syntax_string + cmp ah,22h + je .syntax_string + cmp ah,24h + je .syntax_pascal_hex + cmp ah,39h + ja .syntax_neutral + cmp ah,30h + jae .syntax_number + .syntax_neutral: + or edx,-1 + inc edi + loop .scan_syntax + jmp .done + .syntax_space: + xor edx,edx + inc edi + loop .scan_syntax + jmp .done + .syntax_symbol: + mov al,1 + stosb + xor edx,edx + loop .scan_syntax + jmp .done + .syntax_pascal_hex: + cmp ecx,1 + je .syntax_neutral + mov al,[esi] + mov ah,al + xlatb + or al,al + jz .syntax_neutral + cmp ah,24h + jne .syntax_number + cmp ecx,2 + je .syntax_neutral + mov al,[esi+1] + xlatb + or al,al + jz .syntax_neutral + .syntax_number: + mov al,2 + stosb + loop .number_character + jmp .done + .number_character: + lodsb + mov ah,al + xlatb + xchg al,ah + or ah,ah + jz .check_character + cmp al,20h + je .check_character + cmp al,3Bh + je .check_character + mov al,2 + stosb + loop .number_character + jmp .done + .syntax_string: + mov al,3 + stosb + dec ecx + jz .done + lodsb + cmp al,ah + jne .syntax_string + mov al,3 + stosb + dec ecx + jz .done + lodsb + cmp al,ah + je .syntax_string + xor edx,edx + jmp .check_character + .process_comment: + lodsb + cmp al,20h + jne .syntax_comment + inc edi + loop .process_comment + jmp .done + .syntax_comment: + mov al,4 + stosb + loop .process_comment + .done: + pop edi esi ebx + ret +endp + +proc PositionDialog hwnd_dlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .initdialog + cmp [msg],WM_COMMAND + je .command + cmp [msg],WM_CLOSE + je .close + xor eax,eax + jmp .finish + .initdialog: + invoke SendMessage,[hwnd_fedit],FEM_GETPOS,fepos,0 + cinvoke wsprintf,string_buffer,_value,[fepos.caretLine] + invoke SetDlgItemText,[hwnd_dlg],ID_ROW,string_buffer + cinvoke wsprintf,string_buffer,_value,[fepos.caretPosition] + invoke SetDlgItemText,[hwnd_dlg],ID_COLUMN,string_buffer + jmp .processed + .command: + cmp [wparam],IDCANCEL + je .close + cmp [wparam],IDOK + jne .processed + invoke GetDlgItemInt,[hwnd_dlg],ID_ROW,param_buffer,FALSE + mov [fepos.caretLine],eax + mov [fepos.selectionLine],eax + invoke GetDlgItemInt,[hwnd_dlg],ID_COLUMN,param_buffer,FALSE + mov [fepos.caretPosition],eax + mov [fepos.selectionPosition],eax + invoke IsDlgButtonChecked,[hwnd_dlg],ID_SELECT + or eax,eax + jz .position + mov [fepos.selectionLine],0 + mov [fepos.selectionPosition],0 + .position: + invoke SendMessage,[hwnd_fedit],FEM_SETPOS,fepos,0 + invoke EndDialog,[hwnd_dlg],TRUE + jmp .processed + .close: + invoke EndDialog,[hwnd_dlg],FALSE + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +proc GetStringsFromHistory hwnd_combobox + push ebx esi + invoke SendMessage,[hwnd_history],LB_GETCOUNT,0,0 + mov esi,eax + xor ebx,ebx + .get_string: + cmp ebx,esi + je .finish + invoke SendMessage,[hwnd_history],LB_GETTEXT,ebx,string_buffer + invoke SendMessage,[hwnd_combobox],CB_ADDSTRING,0,string_buffer + inc ebx + jmp .get_string + .finish: + pop esi ebx + ret +endp + +proc AddStringToHistory lpstr + mov eax,[lpstr] + cmp byte [eax],0 + je .finish + invoke SendMessage,[hwnd_history],LB_FINDSTRINGEXACT,-1,[lpstr] + cmp eax,LB_ERR + je .insert + invoke SendMessage,[hwnd_history],LB_DELETESTRING,eax,0 + .insert: + invoke SendMessage,[hwnd_history],LB_INSERTSTRING,0,[lpstr] + cmp eax,LB_ERRSPACE + jne .finish + invoke SendMessage,[hwnd_history],LB_GETCOUNT,0,0 + sub eax,1 + jc .finish + invoke SendMessage,[hwnd_history],LB_DELETESTRING,eax,0 + jmp .insert + .finish: + ret +endp + +proc FindDialog hwnd_dlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .initdialog + cmp [msg],WM_COMMAND + je .command + cmp [msg],WM_CLOSE + je .close + xor eax,eax + jmp .finish + .initdialog: + invoke SendMessage,[hwnd_fedit],FEM_GETWORDATCARET,1000h,search_string + invoke SetDlgItemText,[hwnd_dlg],ID_TEXT,search_string + invoke GetDlgItem,[hwnd_dlg],ID_TEXT + stdcall GetStringsFromHistory,eax + xor eax,eax + test [search_settings],FEFIND_CASESENSITIVE + setnz al + invoke CheckDlgButton,[hwnd_dlg],ID_CASESENSITIVE,eax + xor eax,eax + test [search_settings],FEFIND_WHOLEWORDS + setnz al + invoke CheckDlgButton,[hwnd_dlg],ID_WHOLEWORDS,eax + xor eax,eax + test [search_settings],FEFIND_BACKWARD + setnz al + invoke CheckDlgButton,[hwnd_dlg],ID_BACKWARD,eax + xor eax,eax + test [search_settings],FEFIND_INWHOLETEXT + setnz al + invoke CheckDlgButton,[hwnd_dlg],ID_INWHOLETEXT,eax + jmp .update + .command: + cmp [wparam],ID_TEXT + CBN_EDITCHANGE shl 16 + je .update + cmp [wparam],ID_TEXT + CBN_SELCHANGE shl 16 + je .selchange + cmp [wparam],IDCANCEL + je .close + cmp [wparam],IDOK + jne .processed + xor ebx,ebx + invoke IsDlgButtonChecked,[hwnd_dlg],ID_CASESENSITIVE + or eax,eax + jz .casesensitive_ok + or ebx,FEFIND_CASESENSITIVE + .casesensitive_ok: + invoke IsDlgButtonChecked,[hwnd_dlg],ID_WHOLEWORDS + or eax,eax + jz .wholewords_ok + or ebx,FEFIND_WHOLEWORDS + .wholewords_ok: + invoke IsDlgButtonChecked,[hwnd_dlg],ID_BACKWARD + or eax,eax + jz .backward_ok + or ebx,FEFIND_BACKWARD + .backward_ok: + invoke IsDlgButtonChecked,[hwnd_dlg],ID_INWHOLETEXT + or eax,eax + jz .inwholetext_ok + or ebx,FEFIND_INWHOLETEXT + .inwholetext_ok: + mov [search_settings],ebx + stdcall AddStringToHistory,search_string + invoke EndDialog,[hwnd_dlg],TRUE + jmp .processed + .selchange: + invoke PostMessage,[hwnd_dlg],WM_COMMAND,ID_TEXT + CBN_EDITCHANGE shl 16,0 + jmp .processed + .update: + invoke GetDlgItemText,[hwnd_dlg],ID_TEXT,search_string,1000h + xor ebx,ebx + cmp [search_string],0 + setnz bl + invoke GetDlgItem,[hwnd_dlg],IDOK + invoke EnableWindow,eax,ebx + jmp .processed + .close: + invoke EndDialog,[hwnd_dlg],FALSE + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +proc ReplaceDialog hwnd_dlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .initdialog + cmp [msg],WM_COMMAND + je .command + jmp .finish + .initdialog: + invoke SetDlgItemText,[hwnd_dlg],ID_NEWTEXT,replace_string + invoke GetDlgItem,[hwnd_dlg],ID_NEWTEXT + stdcall GetStringsFromHistory,eax + xor eax,eax + test [command_flags],1 + setnz al + invoke CheckDlgButton,[hwnd_dlg],ID_PROMPT,eax + jmp .finish + .command: + cmp [wparam],IDOK + jne .finish + invoke GetDlgItemText,[hwnd_dlg],ID_NEWTEXT,replace_string,1000h + xor ebx,ebx + invoke IsDlgButtonChecked,[hwnd_dlg],ID_PROMPT + or eax,eax + jz .prompt_ok + or ebx,1 + .prompt_ok: + mov [command_flags],ebx + stdcall AddStringToHistory,replace_string + .finish: + stdcall FindDialog,[hwnd_dlg],[msg],[wparam],[lparam] + pop edi esi ebx + ret +endp + +proc CompileDialog hwnd_dlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .initdialog + cmp [msg],WM_COMMAND + je .command + cmp [msg],WM_CLOSE + je .close + xor eax,eax + jmp .finish + .initdialog: + mov eax,[hwnd_dlg] + mov [hwnd_compiler],eax + invoke GetDlgItem,[hwnd_dlg],ID_PROGRESS + mov [hwnd_progress],eax + invoke SendMessage,eax,PBM_SETRANGE,0,40000h + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[lparam],ei + invoke CreateMutex,NULL,FALSE,NULL + mov [mutex],eax + invoke CreateThread,NULL,10000h,flat_assembler,[ei.pszpath],0,param_buffer + mov [hthread],eax + jmp .processed + .command: + cmp [wparam],IDCANCEL + je .close + cmp [wparam],IDOK + jne .finish + .get_exit_code: + invoke WaitForSingleObject,[hthread],-1 + invoke GetExitCodeThread,[hthread],param_buffer + invoke CloseHandle,[hthread] + invoke CloseHandle,[mutex] + invoke EndDialog,[hwnd_dlg],[param_buffer] + jmp .processed + .close: + invoke WaitForSingleObject,[mutex],-1 + cmp eax,WAIT_ABANDONED + je .processed + invoke TerminateThread,[hthread],0FFh + invoke CloseHandle,[hthread] + invoke CloseHandle,[mutex] + invoke GlobalFree,[hmem_display] + mov eax,[memory_start] + or eax,eax + jz .cancel + invoke VirtualFree,eax,0,MEM_RELEASE + mov [memory_start],0 + cmp [error_data_size],0 + je .cancel + invoke GlobalFree,[hmem_error_data] + .cancel: + invoke EndDialog,[hwnd_dlg],-1 + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +proc ShowLine pszPath,nLine + mov [ei.header.mask],TCIF_PARAM + invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,eax,ei + invoke lstrcmpi,[ei.pszpath],[pszPath] + or eax,eax + jz current_file_ok + xor ebx,ebx + find_file_window: + invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,ebx,ei + or eax,eax + jz load_for_show + invoke lstrcmpi,[ei.pszpath],[pszPath] + or eax,eax + jz show_file + inc ebx + jmp find_file_window + load_for_show: + mov esi,[pszPath] + mov edi,path_buffer + copy_path_for_show: + lodsb + stosb + or al,al + jnz copy_path_for_show + invoke GetFileTitle,path_buffer,name_buffer,100h + invoke SendMessage,[hwnd_main],FM_OPEN,name_buffer,path_buffer + cmp eax,-1 + je show_failed + jmp current_file_ok + show_file: + invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,ebx,0 + invoke SendMessage,[hwnd_main],FM_SELECT,ebx,0 + current_file_ok: + mov eax,[nLine] + mov [fepos.selectionLine],eax + mov [fepos.caretLine],eax + get_lines_to_show: + invoke SendMessage,[hwnd_fedit],FEM_GETLINELENGTH,[nLine],0 + mov esi,string_buffer + cmp eax,1000h + jb get_line_data + mov edi,eax + invoke VirtualAlloc,0,edi,MEM_COMMIT,PAGE_READWRITE + or eax,eax + jz show_lines + mov esi,eax + get_line_data: + invoke SendMessage,[hwnd_fedit],FEM_GETLINE,[nLine],esi + push esi + mov ecx,eax + or ecx,ecx + jz no_more_lines + mov eax,[nLine] + mov [fepos.caretLine],eax + mov ebx,characters + xor edx,edx + check_for_more_lines: + lodsb + cmp al,3Bh + je no_more_lines + mov ah,al + xlatb + or al,al + jz .symbol + or edx,edx + jnz .neutral + cmp ah,27h + je .quoted + cmp ah,22h + je .quoted + .neutral: + or edx,-1 + loop check_for_more_lines + jmp no_more_lines + .symbol: + cmp ah,'\' + je .backslash + xor edx,edx + loop check_for_more_lines + jmp no_more_lines + .quoted: + dec ecx + jz no_more_lines + lodsb + cmp al,ah + jne .quoted + dec ecx + jz no_more_lines + lodsb + cmp al,ah + je .quoted + dec esi + xor edx,edx + jmp check_for_more_lines + .backslash: + dec ecx + jz more_lines + lodsb + cmp al,20h + je .backslash + cmp al,3Bh + jne no_more_lines + more_lines: + inc [nLine] + pop esi + cmp esi,string_buffer + je get_lines_to_show + invoke VirtualFree,esi,edi,MEM_DECOMMIT + jmp get_lines_to_show + no_more_lines: + pop esi + cmp esi,string_buffer + je show_lines + invoke VirtualFree,esi,edi,MEM_DECOMMIT + show_lines: + mov [fepos.selectionPosition],1 + inc [fepos.caretLine] + mov [fepos.caretPosition],1 + invoke SendMessage,[hwnd_fedit],FEM_GETLINELENGTH,[fepos.caretLine],0 + cmp eax,-1 + jne show_ok + dec [fepos.caretLine] + invoke SendMessage,[hwnd_fedit],FEM_GETLINELENGTH,[fepos.caretLine],0 + inc eax + mov [fepos.caretPosition],eax + show_ok: + invoke SendMessage,[hwnd_fedit],FEM_SETPOS,fepos,0 + invoke SendMessage,[hwnd_fedit],FEM_GETMODE,0,0 + and eax,not FEMODE_VERTICALSEL + invoke SendMessage,[hwnd_fedit],FEM_SETMODE,eax,0 + mov eax,[fepos.selectionLine] + xchg eax,[fepos.caretLine] + mov [fepos.selectionLine],eax + mov eax,[fepos.selectionPosition] + xchg eax,[fepos.caretPosition] + mov [fepos.selectionPosition],eax + invoke SendMessage,[hwnd_fedit],FEM_SETPOS,fepos,0 + xor eax,eax + ret + show_failed: + or eax,-1 + ret +endp + +proc SummaryDialog hwnd_dlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .initdialog + cmp [msg],WM_COMMAND + je .command + cmp [msg],WM_CLOSE + je .close + xor eax,eax + jmp .finish + .initdialog: + invoke GetDlgItem,[hwnd_dlg],ID_DISPLAY + invoke SendMessage,eax,WM_SETFONT,[hfont],FALSE + invoke GlobalLock,[hmem_display] + invoke SetDlgItemText,[hwnd_dlg],ID_DISPLAY,eax + invoke GlobalUnlock,[hmem_display] + invoke GlobalFree,[hmem_display] + cmp [lparam],2 + je .error_details + cmp [lparam],0 + jne .error_message + movzx eax,[current_pass] + inc eax + mov [param_buffer],eax + mov eax,[written_size] + mov [param_buffer+4],eax + mov [param_buffer+12],eax + mov eax,[total_time] + xor edx,edx + mov ebx,100 + div ebx + mov ebx,_summary_short + or eax,eax + jz .summary_ok + xor edx,edx + mov ebx,10 + div ebx + mov [param_buffer+4],eax + mov [param_buffer+8],edx + mov ebx,_summary + .summary_ok: + invoke wvsprintf,string_buffer,ebx,param_buffer + invoke SetDlgItemText,[hwnd_dlg],ID_MESSAGE,string_buffer + cmp [lparam],2 + jne .processed + .show_line: + invoke SendDlgItemMessage,[hwnd_dlg],ID_LINES,LB_GETCURSEL,0,0 + lea ebx,[eax+1] + invoke GlobalLock,[hmem_error_data] + mov esi,[eax+ebx*8] + add esi,eax + mov eax,[eax+ebx*8+4] + stdcall ShowLine,esi,eax + invoke GlobalUnlock,[hmem_error_data] + jmp .processed + .error_details: + invoke GetDlgItem,[hwnd_dlg],ID_INSTRUCTION + invoke SendMessage,eax,WM_SETFONT,[hfont],FALSE + invoke GlobalLock,[hmem_error_data] + mov edi,eax + xor ebx,ebx + .get_error_lines: + inc ebx + mov esi,[edi+ebx*8] + add esi,edi + mov eax,[edi+ebx*8+4] + mov [param_buffer+4],eax + invoke GetFullPathName,esi,1000h,path_buffer,param_buffer + invoke wvsprintf,string_buffer,_line_number,param_buffer + invoke SendDlgItemMessage,[hwnd_dlg],ID_LINES,LB_ADDSTRING,0,string_buffer + cmp ebx,[edi] + jb .get_error_lines + mov eax,[edi+4] + add eax,edi + invoke SetDlgItemText,[hwnd_dlg],ID_INSTRUCTION,eax + invoke GlobalUnlock,[hmem_error_data] + invoke SendDlgItemMessage,[hwnd_dlg],ID_LINES,LB_SETCURSEL,0,0 + .error_message: + invoke LoadIcon,0,IDI_HAND + invoke SendDlgItemMessage,[hwnd_dlg],ID_ICON,STM_SETICON,eax,0 + mov eax,[error_message] + mov [param_buffer],eax + mov ebx,_assembler_error + jmp .summary_ok + .command: + cmp [wparam],ID_LINES + LBN_SELCHANGE shl 16 + je .show_line + cmp [wparam],IDCANCEL + je .close + cmp [wparam],IDOK + jne .finish + invoke EndDialog,[hwnd_dlg],TRUE + jmp .processed + .close: + invoke EndDialog,[hwnd_dlg],FALSE + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +proc AddStrings hwnd_combobox,lpstrings + push ebx esi + mov esi,[lpstrings] + .add_string: + cmp byte [esi],0 + je .finish + invoke SendMessage,[hwnd_combobox],CB_ADDSTRING,0,esi + .next_string: + lodsb + or al,al + jnz .next_string + jmp .add_string + .finish: + pop esi ebx + ret +endp + +proc AppearanceSetup hwnd_dlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .initdialog + cmp [msg],WM_DESTROY + je .destroy + cmp [msg],WM_COMMAND + je .command + cmp [msg],WM_CLOSE + je .close + .notprocessed: + xor eax,eax + jmp .finish + .initdialog: + xor eax,eax + test [fedit_style],FES_CONSOLECARET + setnz al + invoke CheckDlgButton,[hwnd_dlg],ID_CONSOLECARET,eax + mov [cf.lStructSize],sizeof.CHOOSEFONT + mov eax,[hwnd_dlg] + mov [cf.hwndOwner],eax + mov [cf.Flags],CF_FIXEDPITCHONLY+CF_SCREENFONTS+CF_FORCEFONTEXIST+CF_INITTOLOGFONTSTRUCT + mov [cf.lpLogFont],tmp_font + mov [cc.lStructSize],sizeof.CHOOSECOLOR + mov eax,[hinstance] + mov [cc.hInstance],eax + mov eax,[hwnd_dlg] + mov [cc.hwndOwner],eax + mov [cc.lpCustColors],user_colors + mov [cc.Flags],CC_RGBINIT + mov esi,font + mov edi,tmp_font + mov ecx,sizeof.LOGFONT shr 2 + rep movsd + mov esi,editor_colors + mov edi,tmp_colors + mov ecx,8 + rep movsd + mov esi,editor_colors + mov edi,user_colors+20h + mov ecx,8 + rep movsd + invoke GetDlgItem,[hwnd_dlg],ID_SETTING + stdcall AddStrings,eax,_appearance_settings + invoke SendDlgItemMessage,[hwnd_dlg],ID_SETTING,CB_SETCURSEL,0,0 + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,WM_SETTEXT,0,preview_text + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,FEM_SETPOS,preview_selection,0 + invoke CreateFontIndirect,[cf.lpLogFont] + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,WM_SETFONT,eax,0 + .update_colors: + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,FEM_SETTEXTCOLOR,[tmp_colors],[tmp_colors+4] + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,FEM_SETSELCOLOR,[tmp_colors+8],[tmp_colors+12] + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,FEM_SETSYNTAXHIGHLIGHT,tmp_colors+16,fasm_syntax + jmp .processed + .destroy: + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,WM_GETFONT,0,0 + invoke DeleteObject,eax + jmp .finish + .command: + cmp [wparam],IDCANCEL + je .close + cmp [wparam],IDOK + je .ok + cmp [wparam],ID_CHANGE + jne .processed + invoke SendDlgItemMessage,[hwnd_dlg],ID_SETTING,CB_GETCURSEL,0,0 + or eax,eax + jz .change_font + cmp eax,8 + ja .processed + lea ebx,[tmp_colors+(eax-1)*4] + mov eax,[ebx] + mov [cc.rgbResult],eax + invoke ChooseColor,cc + or eax,eax + jz .processed + mov eax,[cc.rgbResult] + mov [ebx],eax + jmp .update_colors + .change_font: + mov esi,tmp_font + mov edi,backup_font + mov ecx,sizeof.LOGFONT shr 2 + rep movsd + invoke ChooseFont,cf + or eax,eax + jz .change_font_cancelled + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,WM_GETFONT,0,0 + mov ebx,eax + invoke CreateFontIndirect,[cf.lpLogFont] + invoke SendDlgItemMessage,[hwnd_dlg],ID_PREVIEW,WM_SETFONT,eax,0 + invoke DeleteObject,ebx + jmp .processed + .change_font_cancelled: + mov esi,backup_font + mov edi,tmp_font + mov ecx,sizeof.LOGFONT shr 2 + rep movsd + jmp .processed + .ok: + mov esi,tmp_colors + mov edi,editor_colors + mov ecx,8 + rep movsd + mov esi,tmp_font + mov edi,font + mov ecx,sizeof.LOGFONT shr 2 + rep movsd + invoke CreateFontIndirect,font + xchg eax,[hfont] + invoke DeleteObject,eax + invoke IsDlgButtonChecked,[hwnd_dlg],ID_CONSOLECARET + or eax,eax + setnz al + neg eax + and eax,FES_CONSOLECARET + and [fedit_style],not FES_CONSOLECARET + or [fedit_style],eax + invoke EndDialog,[hwnd_dlg],TRUE + jmp .finish + .close: + invoke EndDialog,[hwnd_dlg],FALSE + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +proc CompilerSetup hwnd_dlg,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .initdialog + cmp [msg],WM_COMMAND + je .command + cmp [msg],WM_CLOSE + je .close + .notprocessed: + xor eax,eax + jmp .finish + .initdialog: + invoke GetDlgItem,[hwnd_dlg],ID_MEMORY + stdcall AddStrings,eax,_memory_settings + invoke GetDlgItem,[hwnd_dlg],ID_PRIORITY + stdcall AddStrings,eax,_priority_settings + cinvoke wsprintf,string_buffer,_value,[compiler_memory] + invoke SendDlgItemMessage,[hwnd_dlg],ID_MEMORY,CB_FINDSTRINGEXACT,-1,string_buffer + cmp eax,CB_ERR + je .set_memory + invoke SendDlgItemMessage,[hwnd_dlg],ID_MEMORY,CB_SETCURSEL,eax,0 + jmp .memory_ok + .set_memory: + invoke SetDlgItemText,[hwnd_dlg],ID_MEMORY,string_buffer + .memory_ok: + mov eax,[compiler_priority] + cmp eax,2 + jg .realtime + cmp eax,-2 + jl .idle + jmp .priority_ok + .idle: + mov eax,-4 + jmp .priority_ok + .realtime: + mov eax,4 + .priority_ok: + sar eax,1 + add eax,2 + invoke SendDlgItemMessage,[hwnd_dlg],ID_PRIORITY,CB_SETCURSEL,eax,0 + jmp .processed + .command: + cmp [wparam],IDCANCEL + je .close + cmp [wparam],IDOK + jne .finish + invoke GetDlgItemInt,[hwnd_dlg],ID_MEMORY,param_buffer,FALSE + mov [compiler_memory],eax + invoke SendDlgItemMessage,[hwnd_dlg],ID_PRIORITY,CB_GETCURSEL,0,0 + sub eax,2 + sal eax,1 + cmp eax,4 + je .set_realtime + cmp eax,-4 + je .set_idle + jmp .set_priority + .set_idle: + mov eax,-15 + jmp .set_priority + .set_realtime: + mov eax,15 + .set_priority: + mov [compiler_priority],eax + invoke EndDialog,[hwnd_dlg],TRUE + jmp .finish + .close: + invoke EndDialog,[hwnd_dlg],FALSE + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +proc CalculatorDialog hwnd,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_INITDIALOG + je .init + cmp [msg],WM_COMMAND + je .command + cmp [msg],WM_CLOSE + je .close + xor eax,eax + jmp .finish + .init: + invoke CheckDlgButton,[hwnd],ID_DECSELECT,BST_CHECKED + jmp .processed + .command: + cmp [wparam],IDCANCEL + je .close + cmp [wparam],IDOK + je .evaluate + cmp [wparam],ID_EXPRESSION + EN_CHANGE shl 16 + jne .processed + .calculate: + mov esi,string_buffer + invoke GetDlgItemText,[hwnd],ID_EXPRESSION,esi,400h + lea edi,[esi+eax] + xor eax,eax + stosb + mov [hthread],eax + mov [source_start],eax + mov [hash_tree],eax + mov [macro_status],al + mov [symbols_file],eax + lea eax,[esi+1000h] + mov [memory_end],eax + mov eax,esp + and eax,not 0FFFh + sub eax,1000h + mov [stack_limit],eax + push ebp + mov [resume_esp],esp + mov [resume_eip],.calculator_error + call convert_line + push edi + call convert_expression + cmp byte [esi],0 + jne invalid_expression + mov al,')' + stosb + pop esi + mov [error_line],0 + mov [current_line],-1 + mov [value_size],0 + call calculate_expression + cmp [error_line],0 + je .present_result + jmp [error] + .present_result: + mov esi,edi + cmp byte [esi+13],0 + je .result_in_64bit_composite_range + test byte [esi+7],80h + jnz .result_in_64bit_composite_range + invoke SetDlgItemText,[hwnd],ID_BINRESULT,_null + invoke SetDlgItemText,[hwnd],ID_OCTRESULT,_null + invoke SetDlgItemText,[hwnd],ID_HEXRESULT,_null + jmp .present_decimal + .result_in_64bit_composite_range: + mov eax,[esi] + mov edx,[esi+4] + mov edi,name_buffer+100 + mov word [edi],'b' + .make_binary: + mov bl,'0' + shrd eax,edx,1 + adc bl,0 + dec edi + mov [edi],bl + shr edx,1 + jnz .make_binary + test eax,eax + jnz .make_binary + invoke SetDlgItemText,[hwnd],ID_BINRESULT,edi + mov ecx,[esi] + mov edx,[esi+4] + mov edi,name_buffer+100 + mov word [edi],'o' + .make_octal: + mov al,cl + and al,111b + add al,'0' + dec edi + mov [edi],al + shrd ecx,edx,3 + shr edx,3 + jnz .make_octal + test ecx,ecx + jnz .make_octal + invoke SetDlgItemText,[hwnd],ID_OCTRESULT,edi + mov ecx,[esi] + mov edx,[esi+4] + mov edi,name_buffer+100 + mov word [edi],'h' + .make_hexadecimal: + mov al,cl + and al,0Fh + cmp al,10 + sbb al,69h + das + dec edi + mov [edi],al + shrd ecx,edx,4 + shr edx,4 + jnz .make_hexadecimal + test ecx,ecx + jnz .make_hexadecimal + cmp al,'A' + jb .hexadecimal_ok + dec edi + mov byte [edi],'0' + .hexadecimal_ok: + invoke SetDlgItemText,[hwnd],ID_HEXRESULT,edi + .present_decimal: + mov edi,name_buffer+100 + mov byte [edi],0 + mov ecx,10 + xor bl,bl + cmp byte [esi+13],0 + je .make_decimal + mov bl,'-' + mov eax,[esi] + mov edx,[esi+4] + not eax + not edx + add eax,1 + adc edx,0 + mov [esi],eax + mov [esi+4],edx + or eax,edx + jnz .make_decimal + dec edi + mov byte [edi],'6' + mov dword [esi],99999999h + mov dword [esi+4],19999999h + .make_decimal: + mov eax,[esi+4] + xor edx,edx + div ecx + mov [esi+4],eax + mov eax,[esi] + div ecx + mov [esi],eax + add dl,'0' + dec edi + mov [edi],dl + or eax,[esi+4] + jnz .make_decimal + test bl,bl + jz .decimal_ok + dec edi + mov [edi],bl + .decimal_ok: + invoke SetDlgItemText,[hwnd],ID_DECRESULT,edi + pop ebp + jmp .processed + .calculator_error: + pop ebp + invoke SetDlgItemText,[hwnd],ID_BINRESULT,_null + invoke SetDlgItemText,[hwnd],ID_DECRESULT,_null + invoke SetDlgItemText,[hwnd],ID_HEXRESULT,_null + invoke SetDlgItemText,[hwnd],ID_OCTRESULT,_null + jmp .processed + .evaluate: + mov ebx,ID_BINRESULT + invoke IsDlgButtonChecked,[hwnd],ID_BINSELECT + cmp eax,BST_CHECKED + je .get_result + mov ebx,ID_HEXRESULT + invoke IsDlgButtonChecked,[hwnd],ID_HEXSELECT + cmp eax,BST_CHECKED + je .get_result + mov ebx,ID_OCTRESULT + invoke IsDlgButtonChecked,[hwnd],ID_OCTSELECT + cmp eax,BST_CHECKED + je .get_result + mov ebx,ID_DECRESULT + .get_result: + invoke GetDlgItemText,[hwnd],ebx,string_buffer,100h + invoke SetDlgItemText,[hwnd],ID_EXPRESSION,string_buffer + invoke GetDlgItem,[hwnd],ID_EXPRESSION + invoke SendMessage,[hwnd],WM_NEXTDLGCTL,eax,TRUE + jmp .processed + .close: + invoke EndDialog,[hwnd],0 + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +proc AboutDialog hwnd,msg,wparam,lparam + push ebx esi edi + cmp [msg],WM_COMMAND + je .close + cmp [msg],WM_CLOSE + je .close + xor eax,eax + jmp .finish + .close: + invoke EndDialog,[hwnd],0 + .processed: + mov eax,1 + .finish: + pop edi esi ebx + ret +endp + +include 'fasm.inc' + +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + advapi,'ADVAPI32.DLL',\ + user,'USER32.DLL',\ + gdi,'GDI32.DLL',\ + comctl,'COMCTL32.DLL',\ + comdlg,'COMDLG32.DLL',\ + shell,'SHELL32.DLL' + + import kernel,\ + GetModuleHandle,'GetModuleHandleA',\ + LoadLibrary,'LoadLibraryA',\ + GetProcAddress,'GetProcAddress',\ + GetCommandLine,'GetCommandLineA',\ + GetFileAttributes,'GetFileAttributesA',\ + GetFullPathName,'GetFullPathNameA',\ + SetCurrentDirectory,'SetCurrentDirectoryA',\ + CreateFile,'CreateFileA',\ + GetFileSize,'GetFileSize',\ + ReadFile,'ReadFile',\ + WriteFile,'WriteFile',\ + SetFilePointer,'SetFilePointer',\ + CloseHandle,'CloseHandle',\ + lstrcmpi,'lstrcmpiA',\ + GlobalAlloc,'GlobalAlloc',\ + GlobalReAlloc,'GlobalReAlloc',\ + GlobalLock,'GlobalLock',\ + GlobalUnlock,'GlobalUnlock',\ + GlobalFree,'GlobalFree',\ + VirtualAlloc,'VirtualAlloc',\ + VirtualFree,'VirtualFree',\ + CreateThread,'CreateThread',\ + SetThreadPriority,'SetThreadPriority',\ + TerminateThread,'TerminateThread',\ + ExitThread,'ExitThread',\ + GetExitCodeThread,'GetExitCodeThread',\ + WaitForSingleObject,'WaitForSingleObject',\ + CreateMutex,'CreateMutexA',\ + ReleaseMutex,'ReleaseMutex',\ + CreateProcess,'CreateProcessA',\ + AllocConsole,'AllocConsole',\ + SetConsoleTitle,'SetConsoleTitleA',\ + FreeConsole,'FreeConsole',\ + GetEnvironmentVariable,'GetEnvironmentVariableA',\ + GetSystemTime,'GetSystemTime',\ + GetTickCount,'GetTickCount',\ + GetPrivateProfileString,'GetPrivateProfileStringA',\ + WritePrivateProfileString,'WritePrivateProfileStringA',\ + GetLastError,'GetLastError',\ + ExitProcess,'ExitProcess' + + import advapi,\ + RegOpenKeyEx,'RegOpenKeyExA',\ + RegQueryValueEx,'RegQueryValueExA',\ + RegCloseKey,'RegCloseKey' + + import user,\ + RegisterClass,'RegisterClassA',\ + CreateCaret,'CreateCaret',\ + ShowCaret,'ShowCaret',\ + HideCaret,'HideCaret',\ + SetCaretPos,'SetCaretPos',\ + DestroyCaret,'DestroyCaret',\ + BeginPaint,'BeginPaint',\ + EndPaint,'EndPaint',\ + GetDC,'GetDC',\ + GetUpdateRect,'GetUpdateRect',\ + ReleaseDC,'ReleaseDC',\ + DrawText,'DrawTextA',\ + FillRect,'FillRect',\ + InvalidateRect,'InvalidateRect',\ + GetKeyboardState,'GetKeyboardState',\ + ToAscii,'ToAscii',\ + GetScrollInfo,'GetScrollInfo',\ + SetScrollInfo,'SetScrollInfo',\ + SetCapture,'SetCapture',\ + ReleaseCapture,'ReleaseCapture',\ + GetCursorPos,'GetCursorPos',\ + ClientToScreen,'ClientToScreen',\ + OpenClipboard,'OpenClipboard',\ + CloseClipboard,'CloseClipboard',\ + EmptyClipboard,'EmptyClipboard',\ + GetClipboardData,'GetClipboardData',\ + SetClipboardData,'SetClipboardData',\ + LoadCursor,'LoadCursorA',\ + LoadIcon,'LoadIconA',\ + LoadBitmap,'LoadBitmapA',\ + LoadMenu,'LoadMenuA',\ + EnableMenuItem,'EnableMenuItem',\ + CheckMenuItem,'CheckMenuItem',\ + GetSubMenu,'GetSubMenu',\ + TrackPopupMenu,'TrackPopupMenu',\ + LoadAccelerators,'LoadAcceleratorsA',\ + IsClipboardFormatAvailable,'IsClipboardFormatAvailable',\ + CharLower,'CharLowerA',\ + CharUpper,'CharUpperA',\ + wsprintf,'wsprintfA',\ + wvsprintf,'wvsprintfA',\ + MessageBox,'MessageBoxA',\ + WinHelp,'WinHelpA',\ + DialogBoxParam,'DialogBoxParamA',\ + GetDlgItem,'GetDlgItem',\ + GetDlgItemInt,'GetDlgItemInt',\ + SetDlgItemText,'SetDlgItemTextA',\ + GetDlgItemText,'GetDlgItemTextA',\ + CheckDlgButton,'CheckDlgButton',\ + IsDlgButtonChecked,'IsDlgButtonChecked',\ + SendDlgItemMessage,'SendDlgItemMessageA',\ + EndDialog,'EndDialog',\ + FindWindow,'FindWindowA',\ + SetForegroundWindow,'SetForegroundWindow',\ + CreateWindowEx,'CreateWindowExA',\ + DestroyWindow,'DestroyWindow',\ + GetWindowLong,'GetWindowLongA',\ + SetWindowLong,'SetWindowLongA',\ + DefWindowProc,'DefWindowProcA',\ + GetClientRect,'GetClientRect',\ + GetWindowRect,'GetWindowRect',\ + MoveWindow,'MoveWindow',\ + SetWindowPos,'SetWindowPos',\ + GetWindowPlacement,'GetWindowPlacement',\ + SetWindowPlacement,'SetWindowPlacement',\ + ShowWindow,'ShowWindow',\ + EnableWindow,'EnableWindow',\ + UpdateWindow,'UpdateWindow',\ + IsZoomed,'IsZoomed',\ + SetFocus,'SetFocus',\ + GetSystemMetrics,'GetSystemMetrics',\ + GetSysColor,'GetSysColor',\ + SendMessage,'SendMessageA',\ + GetMessage,'GetMessageA',\ + TranslateAccelerator,'TranslateAccelerator',\ + TranslateMessage,'TranslateMessage',\ + DispatchMessage,'DispatchMessageA',\ + PostMessage,'PostMessageA',\ + PostQuitMessage,'PostQuitMessage' + + import gdi,\ + SetBkColor,'SetBkColor',\ + SetTextColor,'SetTextColor',\ + CreateSolidBrush,'CreateSolidBrush',\ + CreateFont,'CreateFontA',\ + CreateFontIndirect,'CreateFontIndirectA',\ + GetTextMetrics,'GetTextMetricsA',\ + GetTextExtentPoint32,'GetTextExtentPoint32A',\ + CreateCompatibleDC,'CreateCompatibleDC',\ + DeleteDC,'DeleteDC',\ + CreateBitmap,'CreateBitmap',\ + SelectObject,'SelectObject',\ + GetObject,'GetObjectA',\ + DeleteObject,'DeleteObject' + + import comctl,\ + CreateStatusWindow,'CreateStatusWindowA',\ + ImageList_Create,'ImageList_Create',\ + ImageList_Add,'ImageList_Add',\ + ImageList_Destroy,'ImageList_Destroy' + + import comdlg,\ + GetOpenFileName,'GetOpenFileNameA',\ + GetSaveFileName,'GetSaveFileNameA',\ + GetFileTitle,'GetFileTitleA',\ + ChooseFont,'ChooseFontA',\ + ChooseColor,'ChooseColorA' + + import shell,\ + DragAcceptFiles,'DragAcceptFiles',\ + DragQueryFile,'DragQueryFile',\ + DragFinish,'DragFinish',\ + ShellExecute,'ShellExecuteA' + +section '.rsrc' resource data readable + + directory RT_MENU,menus,\ + RT_ACCELERATOR,accelerators,\ + RT_DIALOG,dialogs,\ + RT_GROUP_ICON,group_icons,\ + RT_ICON,icons,\ + RT_BITMAP,bitmaps,\ + RT_VERSION,versions + + resource menus,\ + IDM_MAIN,LANG_ENGLISH+SUBLANG_DEFAULT,main_menu,\ + IDM_TAB,LANG_ENGLISH+SUBLANG_DEFAULT,popup_menu + + resource accelerators,\ + IDA_MAIN,LANG_ENGLISH+SUBLANG_DEFAULT,main_keys + + resource dialogs,\ + IDD_POSITION,LANG_ENGLISH+SUBLANG_DEFAULT,position_dialog,\ + IDD_FIND,LANG_ENGLISH+SUBLANG_DEFAULT,find_dialog,\ + IDD_REPLACE,LANG_ENGLISH+SUBLANG_DEFAULT,replace_dialog,\ + IDD_COMPILE,LANG_ENGLISH+SUBLANG_DEFAULT,compile_dialog,\ + IDD_SUMMARY,LANG_ENGLISH+SUBLANG_DEFAULT,summary_dialog,\ + IDD_ERRORSUMMARY,LANG_ENGLISH+SUBLANG_DEFAULT,error_summary_dialog,\ + IDD_APPEARANCE,LANG_ENGLISH+SUBLANG_DEFAULT,appearance_dialog,\ + IDD_COMPILERSETUP,LANG_ENGLISH+SUBLANG_DEFAULT,compiler_setup_dialog,\ + IDD_CALCULATOR,LANG_ENGLISH+SUBLANG_DEFAULT,calculator_dialog,\ + IDD_ABOUT,LANG_ENGLISH+SUBLANG_DEFAULT,about_dialog + + resource group_icons,\ + IDI_MAIN,LANG_NEUTRAL,main_icon + + resource icons,\ + 1,LANG_NEUTRAL,main_icon_data + + resource bitmaps,\ + IDB_ASSIGN,LANG_NEUTRAL,assign_bitmap + + resource versions,\ + 1,LANG_NEUTRAL,version + + IDM_MAIN = 101 + IDM_TAB = 102 + IDA_MAIN = 201 + IDD_POSITION = 301 + IDD_FIND = 302 + IDD_REPLACE = 303 + IDD_COMPILE = 304 + IDD_SUMMARY = 305 + IDD_ERRORSUMMARY = 306 + IDD_APPEARANCE = 307 + IDD_COMPILERSETUP = 308 + IDD_ABOUT = 309 + IDD_CALCULATOR = 310 + IDI_MAIN = 401 + IDB_ASSIGN = 501 + + IDM_NEW = 1101 + IDM_OPEN = 1102 + IDM_SAVE = 1103 + IDM_SAVEAS = 1104 + IDM_NEXT = 1105 + IDM_PREVIOUS = 1106 + IDM_OPENFOLDER = 1107 + IDM_CLOSE = 1108 + IDM_EXIT = 1109 + IDM_SELECTFILE = 1110 + IDM_UNDO = 1201 + IDM_REDO = 1202 + IDM_CUT = 1203 + IDM_COPY = 1204 + IDM_PASTE = 1205 + IDM_DELETE = 1206 + IDM_SELECTALL = 1207 + IDM_VERTICAL = 1208 + IDM_DISCARD_UNDO = 1209 + IDM_READONLY = 1210 + IDM_POSITION = 1301 + IDM_FIND = 1302 + IDM_FINDNEXT = 1303 + IDM_REPLACE = 1304 + IDM_RUN = 1401 + IDM_COMPILE = 1402 + IDM_DEBUG = 1403 + IDM_SYMBOLS = 1404 + IDM_ASSIGN = 1409 + IDM_APPEARANCE = 1501 + IDM_COMPILERSETUP = 1502 + IDM_SECURESEL = 1505 + IDM_AUTOBRACKETS = 1506 + IDM_AUTOINDENT = 1507 + IDM_SMARTTABS = 1508 + IDM_OPTIMALFILL = 1509 + IDM_REVIVEDEADKEYS = 1510 + IDM_TIMESCROLL = 1511 + IDM_CONTENTS = 1901 + IDM_KEYWORD = 1902 + IDM_PICKHELP = 1903 + IDM_CALCULATOR = 1904 + IDM_ABOUT = 1909 + + ID_CHANGE = 2001 + ID_SELECT = 2101 + ID_CASESENSITIVE = 2102 + ID_WHOLEWORDS = 2103 + ID_BACKWARD = 2104 + ID_INWHOLETEXT = 2105 + ID_PROMPT = 2106 + ID_CONSOLECARET = 2107 + ID_ROW = 2201 + ID_COLUMN = 2202 + ID_DISPLAY = 2203 + ID_INSTRUCTION = 2204 + ID_EXPRESSION = 2205 + ID_DECRESULT = 2206 + ID_HEXRESULT = 2207 + ID_BINRESULT = 2208 + ID_OCTRESULT = 2209 + ID_TEXT = 2301 + ID_NEWTEXT = 2302 + ID_SETTING = 2303 + ID_MEMORY = 2304 + ID_PRIORITY = 2305 + ID_PASSES = 2306 + ID_LINES = 2307 + ID_ICON = 2401 + ID_MESSAGE = 2402 + ID_DECSELECT = 2501 + ID_HEXSELECT = 2502 + ID_BINSELECT = 2503 + ID_OCTSELECT = 2504 + ID_PROGRESS = 2801 + ID_PREVIEW = 2901 + + _ equ ,09h, + + menu main_menu + menuitem '&File',0,MFR_POPUP + menuitem '&New' _ 'Ctrl+N',IDM_NEW + menuitem '&Open...' _ 'Ctrl+O',IDM_OPEN + menuitem '&Save' _ 'Ctrl+S',IDM_SAVE + menuitem 'Save &as...',IDM_SAVEAS + menuseparator + menuitem 'E&xit' _ 'Alt+X',IDM_EXIT,MFR_END + menuitem '&Edit',0,MFR_POPUP + menuitem '&Undo' _ 'Ctrl+Z',IDM_UNDO + menuitem '&Redo' _ 'Ctrl+Shift+Z',IDM_REDO + menuseparator + menuitem 'Cu&t' _ 'Ctrl+X',IDM_CUT + menuitem '&Copy' _ 'Ctrl+C',IDM_COPY + menuitem '&Paste' _ 'Ctrl+V',IDM_PASTE + menuitem '&Delete',IDM_DELETE + menuseparator + menuitem 'Select &all' _ 'Ctrl+A',IDM_SELECTALL + menuseparator + menuitem '&Vertical selection' _ 'Alt+Ins',IDM_VERTICAL,MFR_END + menuitem '&Search',0,MFR_POPUP + menuitem '&Position...' _ 'Ctrl+G',IDM_POSITION + menuseparator + menuitem '&Find...' _ 'Ctrl+F',IDM_FIND + menuitem 'Find &next' _ 'F3',IDM_FINDNEXT + menuitem '&Replace...' _ 'Ctrl+H',IDM_REPLACE,MFR_END + menuitem '&Run',0,MFR_POPUP + menuitem '&Run' _ 'F9',IDM_RUN + menuitem '&Compile' _ 'Ctrl+F9',IDM_COMPILE + menuseparator + ;menuitem '&Debug' _ 'F8',IDM_DEBUG + menuitem 'Build &symbols' _ 'Ctrl+F8',IDM_SYMBOLS,MFR_END + menuitem '&Options',0,MFR_POPUP + menuitem '&Appearance...',IDM_APPEARANCE + menuitem '&Compiler setup...',IDM_COMPILERSETUP + menuseparator + menuitem '&Secure selection',IDM_SECURESEL + menuitem 'Automatic &brackets',IDM_AUTOBRACKETS + menuitem 'Automatic &indents',IDM_AUTOINDENT + menuitem 'Smart &tabulation',IDM_SMARTTABS + menuitem '&Optimal fill on saving',IDM_OPTIMALFILL + menuitem '&Revive dead keys',IDM_REVIVEDEADKEYS + menuitem 'Ti&me scrolling',IDM_TIMESCROLL,MFR_END + menuitem '&Help',0,MFR_POPUP + MFR_END + menuitem '&Contents' _ 'Alt+F1',IDM_CONTENTS + menuitem '&Keyword search' _ 'F1',IDM_KEYWORD + menuseparator + menuitem '&Pick help file...',IDM_PICKHELP + menuseparator + menuitem 'Ca&lculator...' _ 'Ctrl+F6',IDM_CALCULATOR + menuseparator + menuitem '&About...',IDM_ABOUT,MFR_END + + menu popup_menu + menuitem '',0,MFR_POPUP+MFR_END + menuitem '&Assign to compiler',IDM_ASSIGN + menuitem 'Open &folder',IDM_OPENFOLDER + menuitem '&Read-only mode',IDM_READONLY + menuseparator + menuitem '&Close',IDM_CLOSE,MFR_END + + accelerator main_keys,\ + FVIRTKEY+FNOINVERT+FCONTROL,'N',IDM_NEW,\ + FVIRTKEY+FNOINVERT+FCONTROL,'O',IDM_OPEN,\ + FVIRTKEY+FNOINVERT+FCONTROL,'S',IDM_SAVE,\ + FVIRTKEY+FNOINVERT+FCONTROL,'Z',IDM_UNDO,\ + FVIRTKEY+FNOINVERT+FCONTROL+FSHIFT,'Z',IDM_REDO,\ + FVIRTKEY+FNOINVERT+FCONTROL,'X',IDM_CUT,\ + FVIRTKEY+FNOINVERT+FCONTROL,'C',IDM_COPY,\ + FVIRTKEY+FNOINVERT+FCONTROL,'V',IDM_PASTE,\ + FVIRTKEY+FNOINVERT+FCONTROL,'A',IDM_SELECTALL,\ + FVIRTKEY+FNOINVERT+FCONTROL,'G',IDM_POSITION,\ + FVIRTKEY+FNOINVERT+FCONTROL,'F',IDM_FIND,\ + FVIRTKEY+FNOINVERT+FCONTROL,'H',IDM_REPLACE,\ + FVIRTKEY+FNOINVERT+FCONTROL,VK_TAB,IDM_NEXT,\ + FVIRTKEY+FNOINVERT+FCONTROL+FSHIFT,VK_TAB,IDM_PREVIOUS,\ + FVIRTKEY+FNOINVERT,VK_F1,IDM_KEYWORD,\ + FVIRTKEY+FNOINVERT+FALT,VK_F1,IDM_CONTENTS,\ + FVIRTKEY+FNOINVERT,VK_F2,IDM_SAVE,\ + FVIRTKEY+FNOINVERT+FSHIFT,VK_F2,IDM_SAVEAS,\ + FVIRTKEY+FNOINVERT,VK_F4,IDM_OPEN,\ + FVIRTKEY+FNOINVERT,VK_F3,IDM_FINDNEXT,\ + FVIRTKEY+FNOINVERT,VK_F5,IDM_POSITION,\ + FVIRTKEY+FNOINVERT,VK_F7,IDM_FIND,\ + FVIRTKEY+FNOINVERT+FSHIFT,VK_F7,IDM_FINDNEXT,\ + FVIRTKEY+FNOINVERT+FCONTROL,VK_F7,IDM_REPLACE,\ + FVIRTKEY+FNOINVERT,VK_F9,IDM_RUN,\ + FVIRTKEY+FNOINVERT+FCONTROL,VK_F9,IDM_COMPILE,\ + FVIRTKEY+FNOINVERT,VK_F8,IDM_DEBUG,\ + FVIRTKEY+FNOINVERT+FCONTROL,VK_F8,IDM_SYMBOLS,\ + FVIRTKEY+FNOINVERT+FSHIFT,VK_F9,IDM_ASSIGN,\ + FVIRTKEY+FNOINVERT+FCONTROL,VK_F6,IDM_CALCULATOR,\ + FVIRTKEY+FNOINVERT,VK_ESCAPE,IDM_CLOSE,\ + FVIRTKEY+FNOINVERT+FALT,VK_DELETE,IDM_DISCARD_UNDO,\ + FVIRTKEY+FNOINVERT+FALT,'X',IDM_EXIT,\ + FVIRTKEY+FNOINVERT+FALT,'1',IDM_SELECTFILE+1,\ + FVIRTKEY+FNOINVERT+FALT,'2',IDM_SELECTFILE+2,\ + FVIRTKEY+FNOINVERT+FALT,'3',IDM_SELECTFILE+3,\ + FVIRTKEY+FNOINVERT+FALT,'4',IDM_SELECTFILE+4,\ + FVIRTKEY+FNOINVERT+FALT,'5',IDM_SELECTFILE+5,\ + FVIRTKEY+FNOINVERT+FALT,'6',IDM_SELECTFILE+6,\ + FVIRTKEY+FNOINVERT+FALT,'7',IDM_SELECTFILE+7,\ + FVIRTKEY+FNOINVERT+FALT,'8',IDM_SELECTFILE+8,\ + FVIRTKEY+FNOINVERT+FALT,'9',IDM_SELECTFILE+9 + + dialog position_dialog,'Position',40,40,126,54,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC','&Row:',-1,4,8,28,8,WS_VISIBLE+SS_RIGHT + dialogitem 'EDIT','',ID_ROW,36,6,34,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_NUMBER + dialogitem 'STATIC','&Column:',-1,4,26,28,8,WS_VISIBLE+SS_RIGHT + dialogitem 'EDIT','',ID_COLUMN,36,24,34,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_NUMBER + dialogitem 'BUTTON','&Select',ID_SELECT,36,42,48,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','OK',IDOK,78,6,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'BUTTON','C&ancel',IDCANCEL,78,22,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog + + dialog find_dialog,'Find',60,60,254,54,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC','&Text to find:',-1,4,8,40,8,WS_VISIBLE+SS_RIGHT + dialogitem 'COMBOBOX','',ID_TEXT,48,6,150,64,WS_VISIBLE+WS_BORDER+WS_TABSTOP+CBS_DROPDOWN+CBS_AUTOHSCROLL+WS_VSCROLL + dialogitem 'BUTTON','&Case sensitive',ID_CASESENSITIVE,48,24,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&Whole words',ID_WHOLEWORDS,48,38,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&Backward',ID_BACKWARD,124,24,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&In whole text',ID_INWHOLETEXT,124,38,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&Find first',IDOK,206,6,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'BUTTON','C&ancel',IDCANCEL,206,22,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog + + dialog replace_dialog,'Replace',60,60,254,86,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC','&Text to find:',-1,4,8,40,8,WS_VISIBLE+SS_RIGHT + dialogitem 'COMBOBOX','',ID_TEXT,48,6,150,64,WS_VISIBLE+WS_BORDER+WS_TABSTOP+CBS_DROPDOWN+CBS_AUTOHSCROLL+WS_VSCROLL + dialogitem 'STATIC','&New text:',-1,4,26,40,8,WS_VISIBLE+SS_RIGHT + dialogitem 'COMBOBOX','',ID_NEWTEXT,48,24,150,64,WS_VISIBLE+WS_BORDER+WS_TABSTOP+CBS_DROPDOWN+CBS_AUTOHSCROLL+WS_VSCROLL + dialogitem 'BUTTON','&Case sensitive',ID_CASESENSITIVE,48,42,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&Whole words',ID_WHOLEWORDS,48,56,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&Backward',ID_BACKWARD,124,42,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&In whole text',ID_INWHOLETEXT,124,56,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&Prompt on replace',ID_PROMPT,48,70,70,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','&Replace',IDOK,206,6,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'BUTTON','C&ancel',IDCANCEL,206,22,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog + + dialog compile_dialog,'Compile',64,64,192,42,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'msctls_progress32','',ID_PROGRESS,8,6,176,12,WS_VISIBLE + dialogitem 'BUTTON','C&ancel',IDCANCEL,75,24,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog + + dialog summary_dialog,'Compile',48,24,192,130,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'BUTTON','OK',IDCANCEL,142,108,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'STATIC',IDI_ASTERISK,ID_ICON,8,4,0,0,WS_VISIBLE+SS_ICON + dialogitem 'STATIC','',ID_MESSAGE,36,10,148,8,WS_VISIBLE + dialogitem 'STATIC','&Display:',-1,8,28,176,8,WS_VISIBLE + dialogitem 'EDIT','',ID_DISPLAY,8,40,176,64,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_MULTILINE+ES_READONLY+ES_AUTOHSCROLL+ES_AUTOVSCROLL+WS_VSCROLL + enddialog + + dialog error_summary_dialog,'Compile',48,24,192,144,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC','&Source:',-1,8,96,176,8,WS_VISIBLE + dialogitem 'LISTBOX','',ID_LINES,8,108,126,32,WS_VISIBLE+WS_BORDER+WS_TABSTOP+WS_VSCROLL+LBS_NOTIFY + dialogitem 'BUTTON','OK',IDCANCEL,142,108,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'STATIC',IDI_HAND,ID_ICON,8,4,0,0,WS_VISIBLE+SS_ICON + dialogitem 'STATIC','',ID_MESSAGE,36,10,148,8,WS_VISIBLE+SS_LEFTNOWORDWRAP + dialogitem 'STATIC','&Display:',-1,8,28,176,8,WS_VISIBLE + dialogitem 'EDIT','',ID_DISPLAY,8,40,176,24,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_MULTILINE+ES_READONLY+ES_AUTOHSCROLL+ES_AUTOVSCROLL+WS_VSCROLL + dialogitem 'STATIC','&Instruction:',-1,8,68,176,8,WS_VISIBLE + dialogitem 'EDIT','',ID_INSTRUCTION,8,80,176,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_READONLY+ES_AUTOHSCROLL + enddialog + + dialog appearance_dialog,'Appearance',50,20,186,166,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'COMBOBOX','',ID_SETTING,8,6,120,140,WS_VISIBLE+WS_TABSTOP+CBS_DROPDOWNLIST+WS_VSCROLL + dialogitem 'BUTTON','C&hange...',ID_CHANGE,134,6,42,13,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + dialogitem 'FEDIT','',ID_PREVIEW,8,24,168,120,WS_VISIBLE+WS_BORDER+WS_DISABLED+ES_NOHIDESEL + dialogitem 'BUTTON','&Console caret',ID_CONSOLECARET,8,151,80,8,WS_VISIBLE+WS_TABSTOP+BS_AUTOCHECKBOX + dialogitem 'BUTTON','OK',IDOK,88,148,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'BUTTON','C&ancel',IDCANCEL,134,148,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog + + dialog compiler_setup_dialog,'Compiler setup',54,28,148,44,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC','&Memory:',-1,4,8,30,8,WS_VISIBLE+SS_RIGHT + dialogitem 'COMBOBOX','',ID_MEMORY,38,6,54,96,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_NUMBER+CBS_DROPDOWN+WS_VSCROLL + dialogitem 'STATIC','&Priority:',-1,4,26,30,8,WS_VISIBLE+SS_RIGHT + dialogitem 'COMBOBOX','',ID_PRIORITY,38,24,54,96,WS_VISIBLE+WS_TABSTOP+CBS_DROPDOWNLIST+WS_VSCROLL + dialogitem 'BUTTON','OK',IDOK,100,6,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'BUTTON','C&ancel',IDCANCEL,100,22,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog + + dialog calculator_dialog,'Calculator',48,32,380,80,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC','&Expression:',-1,4,8,44,8,WS_VISIBLE+SS_RIGHT + dialogitem 'EDIT','',ID_EXPRESSION,52,6,274,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL + dialogitem 'BUTTON','&Decimal:',ID_DECSELECT,4,20,56,12,WS_VISIBLE+WS_TABSTOP+BS_AUTORADIOBUTTON+BS_RIGHT+BS_LEFTTEXT + dialogitem 'EDIT','',ID_DECRESULT,62,22,264,10,WS_VISIBLE+ES_READONLY+ES_AUTOHSCROLL + dialogitem 'BUTTON','&Hexadecimal:',ID_HEXSELECT,4,34,56,12,WS_VISIBLE+WS_TABSTOP+BS_AUTORADIOBUTTON+BS_RIGHT+BS_LEFTTEXT + dialogitem 'EDIT','',ID_HEXRESULT,62,36,264,10,WS_VISIBLE+ES_READONLY+ES_AUTOHSCROLL + dialogitem 'BUTTON','&Binary:',ID_BINSELECT,4,48,56,12,WS_VISIBLE+WS_TABSTOP+BS_AUTORADIOBUTTON+BS_RIGHT+BS_LEFTTEXT + dialogitem 'EDIT','',ID_BINRESULT,62,50,264,10,WS_VISIBLE+ES_READONLY+ES_AUTOHSCROLL + dialogitem 'BUTTON','&Octal:',ID_OCTSELECT,4,62,56,12,WS_VISIBLE+WS_TABSTOP+BS_AUTORADIOBUTTON+BS_RIGHT+BS_LEFTTEXT + dialogitem 'EDIT','',ID_OCTRESULT,62,64,264,10,WS_VISIBLE+ES_READONLY+ES_AUTOHSCROLL + dialogitem 'BUTTON','E&valuate',IDOK,332,6,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + dialogitem 'BUTTON','&Close',IDCANCEL,332,22,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON + enddialog + + dialog about_dialog,'About',40,40,172,60,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME + dialogitem 'STATIC',<'flat assembler ',2014h,' version ',VERSION_STRING,0Dh,0Ah,'Copyright ',0A9h,' 1999-2017 Tomasz Grysztar.'>,-1,27,10,144,40,WS_VISIBLE+SS_CENTER + dialogitem 'STATIC',IDI_MAIN,-1,8,8,32,32,WS_VISIBLE+SS_ICON + dialogitem 'STATIC','',-1,4,34,164,11,WS_VISIBLE+SS_ETCHEDHORZ + dialogitem 'STATIC',<'flat editor version ',FEDIT_VERSION_STRING>,-1,4,38,100,20,WS_VISIBLE+SS_LEFT + dialogitem 'STATIC',<'interface version ',IDE_VERSION_STRING>,-1,4,48,100,20,WS_VISIBLE+SS_LEFT + dialogitem 'BUTTON','OK',IDOK,124,40,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON + enddialog + + icon main_icon,main_icon_data,'resource\fasmw.ico' + + bitmap assign_bitmap,'resource\assign.bmp' + + versioninfo version,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,\ + 'FileDescription','flat assembler',\ + 'LegalCopyright',<'Copyright ',0A9h,' 1999-2017 Tomasz Grysztar.'>,\ + 'FileVersion',IDE_VERSION_STRING,\ + 'ProductVersion',VERSION_STRING,\ + 'OriginalFilename','FASMW.EXE' diff --git a/fasmw172/SOURCE/IDE/FASMW/FEDIT.ASH b/fasmw172/SOURCE/IDE/FASMW/FEDIT.ASH new file mode 100644 index 0000000..9d4e330 --- /dev/null +++ b/fasmw172/SOURCE/IDE/FASMW/FEDIT.ASH @@ -0,0 +1,69 @@ + +; flat editor mode flags + +FEMODE_OVERWRITE = 1 +FEMODE_VERTICALSEL = 2 +FEMODE_NOUNDO = 4 +FEMODE_READONLY = 8 + +; flat editor search flags + +FEFIND_CASESENSITIVE = 1 +FEFIND_WHOLEWORDS = 2 +FEFIND_BACKWARD = 4 +FEFIND_INWHOLETEXT = 8 + +; flat editor styles + +FES_AUTOINDENT = 0001h +FES_AUTOBRACKETS = 0002h +FES_SMARTTABS = 0004h +FES_SECURESEL = 0008h +FES_OPTIMALFILL = 0010h +FES_CONSOLECARET = 0020h +FES_REVIVEDEADKEYS = 0040h +FES_TIMESCROLL = 0080h + +; flat editor messages + +FEM_SETMODE = WM_USER + 0 +FEM_GETMODE = WM_USER + 1 +FEM_SETPOS = WM_USER + 2 +FEM_GETPOS = WM_USER + 3 +FEM_SETSYNTAXHIGHLIGHT = WM_USER + 4 +FEM_SETRIGHTCLICKMENU = WM_USER + 5 +FEM_SETTEXTCOLOR = WM_USER + 6 +FEM_SETSELCOLOR = WM_USER + 7 +FEM_FINDFIRST = WM_USER + 8 +FEM_FINDNEXT = WM_USER + 9 +FEM_CANFINDNEXT = WM_USER + 10 +FEM_GETLINELENGTH = WM_USER + 11 +FEM_GETLINE = WM_USER + 12 +FEM_GETWORDATCARET = WM_USER + 13 +FEM_BEGINOPERATION = WM_USER + 14 +FEM_ENDOPERATION = WM_USER + 15 +FEM_MARKUNMODIFIED = WM_USER + 16 +FEM_ISUNMODIFIED = WM_USER + 17 +FEM_GETSEARCHTEXT = WM_USER + 18 +FEM_GETSEARCHFLAGS = WM_USER + 19 +FEM_RELEASESEARCH = WM_USER + 20 +FEM_REDO = WM_USER + 84 +FEM_CANREDO = WM_USER + 85 + +; flat editor notifications + +FEN_SETFOCUS = 01h +FEN_KILLFOCUS = 02h +FEN_TEXTCHANGE = 03h +FEN_POSCHANGE = 04h +FEN_MODECHANGE = 05h +FEN_OUTOFMEMORY = 0Fh + +; flat editor position structure + +struct FEPOS + selectionPosition dd ? + selectionLine dd ? + caretPosition dd ? + caretLine dd ? +ends diff --git a/fasmw172/SOURCE/IDE/FASMW/FEDIT.INC b/fasmw172/SOURCE/IDE/FASMW/FEDIT.INC new file mode 100644 index 0000000..76871a3 --- /dev/null +++ b/fasmw172/SOURCE/IDE/FASMW/FEDIT.INC @@ -0,0 +1,2267 @@ + +; flat editor interface for Win32 IDE +; Copyright (c) 2001-2014, Tomasz Grysztar. +; All rights reserved. + +SEGMENT_LENGTH = 100h +BLOCK_LENGTH = 400h * SEGMENT_LENGTH +SEGMENT_HEADER_LENGTH = 16 +SEGMENT_DATA_LENGTH = SEGMENT_LENGTH - SEGMENT_HEADER_LENGTH + +include '../version.inc' + +proc FlatEditor hwnd,wmsg,wparam,lparam + + locals + + editor_style dd ? + + label editor_data + + include '../variable.inc' + + editor_font dd ? + font_width dd ? + font_height dd ? + font_overhang dd ? + screen_base dd ? + screen_offset dd ? + screen_width dd ? + screen_height dd ? + screen_size dd ? + line_buffer dd ? + line_buffer_size dd ? + background_color dd ? + text_color dd ? + selection_background dd ? + selection_text dd ? + syntax_proc dd ? + syntax_colors dd ? + caret_x dd ? + caret_y dd ? + pan_x dw ? + pan_y dw ? + menu_handle dd ? + menu_window dd ? + current_operation db ? + last_operation db ? + was_selection db ? + mouse_select db ? + focus db ? + macro_operation db ? + + editor_data_size = $ - editor_data + + if editor_data_size > SEGMENT_DATA_LENGTH + err + end if + + return_value dd ? + background_brush dd ? + selection_brush dd ? + line_number dd ? + ps PAINTSTRUCT + tm TEXTMETRIC + sc SCROLLINFO + gestureconfig GESTURECONFIG + gestureinfo GESTUREINFO + point POINT + rect RECT + size SIZE + char dd ? + kbstate rb 100h + line_selection db ? + clipboard_opened db ? + redraw_now db ? + notification db ? + + endl + + push ebx esi edi + invoke GetWindowLong,[hwnd],GWL_STYLE + mov [editor_style],eax + cmp [wmsg],WM_CREATE + je wm_create + cmp [wmsg],WM_GETDLGCODE + je wm_getdlgcode + invoke GetWindowLong,[hwnd],0 + or eax,eax + jz defwndproc + mov [editor_memory],eax + lea esi,[eax+SEGMENT_HEADER_LENGTH] + lea edi,[editor_data] + mov ecx,editor_data_size + rep movsb + test [editor_style],ES_READONLY + jz editor_mode_ok + or [editor_mode],FEMODE_READONLY + editor_mode_ok: + mov [return_value],0 + mov [notification],0 + mov [redraw_now],0 + mov [clipboard_opened],0 + cmp [wmsg],WM_DESTROY + je wm_destroy + cmp [wmsg],WM_PAINT + je wm_paint + cmp [wmsg],WM_HSCROLL + je wm_hscroll + cmp [wmsg],WM_VSCROLL + je wm_vscroll + cmp [wmsg],WM_GESTURE + je wm_gesture + cmp [wmsg],WM_SIZE + je wm_size + mov eax,[selection_line] + or eax,eax + jz no_selection + cmp eax,[caret_line] + jne selection_present + mov eax,[selection_position] + cmp eax,[caret_position] + je no_selection + selection_present: + mov [was_selection],1 + jmp selection_status_ok + no_selection: + mov [was_selection],0 + selection_status_ok: + xor al,al + xchg [current_operation],al + mov [last_operation],al + mov eax,[wmsg] + cmp eax,WM_SETFOCUS + je wm_setfocus + cmp eax,WM_KILLFOCUS + je wm_killfocus + cmp eax,WM_KEYDOWN + je wm_keydown + cmp eax,WM_SYSKEYDOWN + je wm_syskeydown + cmp eax,WM_CHAR + je wm_char + cmp eax,WM_LBUTTONDOWN + je wm_lbuttondown + cmp eax,WM_LBUTTONUP + je wm_lbuttonup + cmp eax,WM_MOUSEMOVE + je wm_mousemove + cmp eax,WM_LBUTTONDBLCLK + je wm_lbuttondblclk + cmp eax,WM_MOUSEWHEEL + je wm_mousewheel + cmp eax,WM_RBUTTONDOWN + je wm_rbuttondown + cmp eax,WM_COPY + je wm_copy + cmp eax,WM_CUT + je wm_cut + cmp eax,WM_PASTE + je wm_paste + cmp eax,WM_CLEAR + je wm_clear + cmp eax,WM_SETTEXT + je wm_settext + cmp eax,WM_GETTEXTLENGTH + je wm_gettextlength + cmp eax,WM_GETTEXT + je wm_gettext + cmp eax,WM_SETFONT + je wm_setfont + cmp eax,WM_GETFONT + je wm_getfont + cmp eax,WM_UNDO + je wm_undo + cmp eax,EM_UNDO + je wm_undo + cmp eax,EM_CANUNDO + je em_canundo + cmp eax,FEM_REDO + je fem_redo + cmp eax,FEM_CANREDO + je fem_canredo + cmp eax,EM_EMPTYUNDOBUFFER + je em_emptyundobuffer + cmp eax,EM_REPLACESEL + je em_replacesel + cmp eax,FEM_SETMODE + je fem_setmode + cmp eax,FEM_GETMODE + je fem_getmode + cmp eax,FEM_SETSYNTAXHIGHLIGHT + je fem_setsyntaxhighlight + cmp eax,FEM_SETRIGHTCLICKMENU + je fem_setrightclickmenu + cmp eax,FEM_GETLINELENGTH + je fem_getlinelength + cmp eax,FEM_GETLINE + je fem_getline + cmp eax,FEM_SETPOS + je fem_setpos + cmp eax,FEM_GETPOS + je fem_getpos + cmp eax,FEM_FINDFIRST + je fem_findfirst + cmp eax,FEM_FINDNEXT + je fem_findnext + cmp eax,FEM_CANFINDNEXT + je fem_canfindnext + cmp eax,FEM_GETWORDATCARET + je fem_getwordatcaret + cmp eax,FEM_SETTEXTCOLOR + je fem_settextcolor + cmp eax,FEM_SETSELCOLOR + je fem_setselcolor + cmp eax,FEM_BEGINOPERATION + je fem_beginoperation + cmp eax,FEM_ENDOPERATION + je fem_endoperation + cmp eax,FEM_MARKUNMODIFIED + je fem_setunmodified + cmp eax,FEM_ISUNMODIFIED + je fem_isunmodified + cmp eax,FEM_GETSEARCHTEXT + je fem_getsearchtext + cmp eax,FEM_GETSEARCHFLAGS + je fem_getsearchflags + cmp eax,FEM_RELEASESEARCH + je fem_releasesearch +defwndproc: + invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] + jmp finish_wndproc +wm_create: + call init_editor_memory + jc create_failed + invoke SetWindowLong,[hwnd],0,[editor_memory] + mov [syntax_proc],SyntaxProc + mov [syntax_colors],0 + mov [macro_operation],0 + mov [current_operation],0 + mov [focus],0 + mov [mouse_select],0 + mov [menu_handle],0 + mov eax,SEGMENT_DATA_LENGTH*2 + mov [line_buffer_size],eax + invoke VirtualAlloc,0,eax,MEM_COMMIT,PAGE_READWRITE + or eax,eax + jz create_failed + mov [line_buffer],eax + mov [screen_base],0 + invoke GetSysColor,COLOR_WINDOW + mov [background_color],eax + invoke GetSysColor,COLOR_WINDOWTEXT + mov [text_color],eax + invoke GetSysColor,COLOR_HIGHLIGHT + mov [selection_background],eax + invoke GetSysColor,COLOR_HIGHLIGHTTEXT + mov [selection_text],eax + mov eax,[fedit_font] + mov [editor_font],eax + invoke GetDC,[hwnd] + mov ebx,eax + invoke SelectObject,ebx,[editor_font] + lea edi,[char] + mov byte [edi],20h + lea eax,[size] + invoke GetTextExtentPoint32,ebx,edi,1,eax + lea eax,[tm] + invoke GetTextMetrics,ebx,eax + mov eax,[size.cy] + mov [font_height],eax + mov eax,[size.cx] + mov [font_width],eax + mov ecx,[tm.tmMaxCharWidth] + sub ecx,eax + mov [font_overhang],ecx + invoke ReleaseDC,[hwnd],ebx + mov [return_value],0 + cmp [SetGestureConfig],0 + je done + mov [gestureconfig.dwID],GID_PAN + mov [gestureconfig.dwWant],GC_PAN+GC_PAN_WITH_SINGLE_FINGER_VERTICALLY+GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY+GC_PAN_WITH_INERTIA + mov [gestureconfig.dwBlock],0 + lea edx,[gestureconfig] + invoke SetGestureConfig,[hwnd],0,1,edx,sizeof.GESTURECONFIG + jmp done + create_failed: + or eax,-1 + jmp finish_wndproc +wm_destroy: + invoke VirtualFree,[line_buffer],0,MEM_RELEASE + invoke VirtualFree,[screen_base],0,MEM_RELEASE + call release_search_data + call release_editor_memory + invoke SetWindowLong,[hwnd],0,0 + xor eax,eax + jmp finish_wndproc +wm_getdlgcode: + mov eax,DLGC_WANTCHARS+DLGC_WANTARROWS + jmp finish_wndproc +wm_paint: + lea eax,[rect] + invoke GetUpdateRect,[hwnd],eax,FALSE + or eax,eax + jz finish_wndproc + cmp [screen_base],0 + je finish_wndproc + lea eax,[ps] + invoke BeginPaint,[hwnd],eax + mov ebx,eax + invoke CreateSolidBrush,[background_color] + mov [background_brush],eax + invoke CreateSolidBrush,[selection_background] + mov [selection_brush],eax + invoke SelectObject,ebx,[editor_font] + mov esi,[screen_base] + add esi,[screen_offset] + mov eax,[screen_width] + mul [screen_height] + lea edi,[esi+eax] + mov [rect.top],0 + mov eax,[font_height] + mov [rect.bottom],eax + mov ecx,[screen_height] + paint_screen: + push ecx + mov [rect.left],0 + mov ecx,[screen_width] + paint_line: + cmp byte [esi],0 + je paint_empty_block + mov edx,1 + mov al,[edi] + get_characters_block: + cmp edx,ecx + je get_color + cmp al,[edi+edx] + jne get_color + cmp byte [esi+edx],0 + je get_color + inc edx + jmp get_characters_block + paint_empty_block: + mov edx,1 + test byte [edi],80h + jnz get_empty_selection + get_empty_block: + cmp edx,ecx + je fill_empty_block + cmp byte [esi+edx],0 + jne fill_empty_block + test byte [edi+edx],80h + jnz fill_empty_block + inc edx + jmp get_empty_block + fill_empty_block: + push ecx edx + mov eax,[font_width] + mul edx + add eax,[rect.left] + mov [rect.right],eax + lea eax,[rect] + invoke FillRect,ebx,eax,[background_brush] + jmp paint_next_block + get_empty_selection: + cmp edx,ecx + je fill_empty_selection + cmp byte [esi+edx],0 + jne fill_empty_selection + test byte [edi+edx],80h + jz fill_empty_selection + inc edx + jmp get_empty_selection + fill_empty_selection: + push ecx edx + mov eax,[font_width] + mul edx + add eax,[rect.left] + mov [rect.right],eax + lea eax,[rect] + invoke FillRect,ebx,eax,[selection_brush] + jmp paint_next_block + get_color: + push ecx edx + test byte [edi],80h + jnz highlight_color + invoke SetBkColor,ebx,[background_color] + mov al,[edi] + or al,al + jnz syntax_color + default_color: + invoke SetTextColor,ebx,[text_color] + jmp color_ok + syntax_color: + movzx eax,al + mov edx,[syntax_colors] + or edx,edx + jz default_color + mov eax,[edx+(eax-1)*4] + invoke SetTextColor,ebx,eax + jmp color_ok + highlight_color: + invoke SetBkColor,ebx,[selection_background] + invoke SetTextColor,ebx,[selection_text] + color_ok: + mov ecx,[esp] + mov eax,[font_width] + mul ecx + add eax,[rect.left] + mov [rect.right],eax + lea eax,[rect] + invoke DrawText,ebx,esi,ecx,eax,DT_LEFT+DT_NOPREFIX+DT_SINGLELINE + paint_next_block: + pop edx ecx + sub ecx,edx + add esi,edx + add edi,edx + mov eax,[rect.right] + mov [rect.left],eax + or ecx,ecx + jnz paint_line + mov eax,[font_height] + add [rect.top],eax + add [rect.bottom],eax + pop ecx + dec ecx + jnz paint_screen + invoke DeleteObject,[background_brush] + invoke DeleteObject,[selection_brush] + lea eax,[ps] + invoke EndPaint,[hwnd],eax + xor eax,eax + jmp finish_wndproc +wm_setfocus: + or [focus],-1 + call create_caret + mov [notification],FEN_SETFOCUS + cmp [was_selection],0 + je done + jmp moved_window +wm_killfocus: + mov [focus],0 + invoke DestroyCaret + mov [notification],FEN_KILLFOCUS + cmp [was_selection],0 + je done + jmp moved_window +wm_hscroll: + mov [sc.cbSize],sizeof.SCROLLINFO + mov [sc.fMask],SIF_ALL + lea eax,[sc] + invoke GetScrollInfo,[hwnd],SB_HORZ,eax + movzx eax,word [wparam] + cmp eax,SB_LINEUP + je hscroll_left + cmp eax,SB_LINEDOWN + je hscroll_right + cmp eax,SB_THUMBTRACK + je hscroll_pos + cmp eax,SB_PAGEUP + je hscroll_wleft + cmp eax,SB_PAGEDOWN + je hscroll_wright + hscroll_ignore: + jmp done + hscroll_left: + cmp [window_position],0 + je hscroll_ignore + dec [window_position] + jmp moved_window + hscroll_right: + mov eax,[maximum_position] + sub eax,[sc.nPage] + cmp [window_position],eax + jge hscroll_ignore + inc [window_position] + jmp moved_window + hscroll_pos: + movzx eax,word [wparam+2] + mov [window_position],eax + jmp moved_window + hscroll_wleft: + mov eax,[sc.nPage] + sub [window_position],eax + jnc moved_window + mov [window_position],0 + jmp moved_window + hscroll_wright: + mov eax,[sc.nPage] + mov ecx,[maximum_position] + sub ecx,eax + add [window_position],eax + cmp [window_position],ecx + jbe moved_window + mov [window_position],ecx + jmp moved_window +wm_vscroll: + mov [sc.cbSize],sizeof.SCROLLINFO + mov [sc.fMask],SIF_ALL + lea eax,[sc] + invoke GetScrollInfo,[hwnd],SB_VERT,eax + movzx eax,word [wparam] + cmp eax,SB_LINEUP + je vscroll_up + cmp eax,SB_LINEDOWN + je vscroll_down + cmp eax,SB_THUMBTRACK + je vscroll_pos + cmp eax,SB_PAGEUP + je vscroll_pageup + cmp eax,SB_PAGEDOWN + je vscroll_pagedown + vscroll_ignore: + jmp done + vscroll_up: + mov esi,[window_line] + mov esi,[esi+4] + or esi,esi + jz vscroll_ignore + dec [window_line_number] + mov [window_line],esi + jmp moved_window + vscroll_down: + mov eax,[sc.nPos] + add eax,[sc.nPage] + cmp eax,[sc.nMax] + ja vscroll_ignore + mov esi,[window_line] + vscroll_skip_line: + mov esi,[esi] + btr esi,0 + jc vscroll_skip_line + or esi,esi + jz vscroll_ignore + inc [window_line_number] + mov [window_line],esi + jmp moved_window + vscroll_pos: + mov eax,[sc.nTrackPos] + call find_line + or esi,esi + jz vscroll_ignore + mov [window_line],esi + mov [window_line_number],ecx + jmp moved_window + vscroll_pageup: + mov esi,[window_line] + mov ecx,[sc.nPage] + scrolling_up: + mov eax,[esi+4] + or eax,eax + jz scroll_ok + dec [window_line_number] + mov esi,eax + loop scrolling_up + jmp scroll_ok + vscroll_pagedown: + mov esi,[window_line] + mov eax,[sc.nPos] + add eax,[sc.nPage] + mov ecx,[sc.nMax] + sub ecx,eax + inc ecx + cmp ecx,[sc.nPage] + jbe scrolling_down + mov ecx,[sc.nPage] + scrolling_down: + mov eax,esi + scroll_one_line: + mov eax,[eax] + test eax,eax + jz scroll_ok + btr eax,0 + jc scroll_one_line + or eax,eax + jz scroll_ok + inc [window_line_number] + mov esi,eax + loop scrolling_down + scroll_ok: + mov [window_line],esi + jmp moved_window +wm_gesture: + cmp [GetGestureInfo],0 + je defwndproc + mov [gestureinfo.cbSize],sizeof.GESTUREINFO + lea edx,[gestureinfo] + invoke GetGestureInfo,[lparam],edx + test eax,eax + jz defwndproc + cmp [gestureinfo.dwID],GID_PAN + jne defwndproc + invoke CloseGestureInfoHandle,[lparam] + mov eax,[gestureinfo.dwFlags] + test eax,GF_BEGIN + jnz begin_panning + mov ax,[gestureinfo.ptsLocation.x] + sub ax,[pan_x] + cwde + cdq + idiv [font_width] + sub [gestureinfo.ptsLocation.x],dx + sub [window_position],eax + cmp [window_position],0 + jl horizontal_home + jmp horizontal_pan_ok + horizontal_home: + mov [window_position],0 + horizontal_pan_ok: + mov ax,[gestureinfo.ptsLocation.y] + sub ax,[pan_y] + cwde + cdq + idiv [font_height] + sub [gestureinfo.ptsLocation.y],dx + mov ecx,eax + mov eax,dword [gestureinfo.ptsLocation] + mov dword [pan_x],eax + mov esi,[window_line] + cmp ecx,0 + jz moved_window + jg scrolling_up + neg ecx + jmp scrolling_down + begin_panning: + mov eax,dword [gestureinfo.ptsLocation] + mov dword [pan_x],eax + jmp done +wm_mousewheel: + test [editor_style],FES_TIMESCROLL + jz space_scroll + lea ebx,[kbstate] + invoke GetKeyboardState,ebx + test [kbstate+VK_MENU],80h + jz space_scroll + test [kbstate+VK_CONTROL],80h + jnz time_scroll + space_scroll: + mov esi,[window_line] + mov eax,[wparam] + sar eax,16 + cdq + mov ecx,120 + idiv ecx + mov ecx,[wheel_scroll_lines] + cmp ecx,-1 + jne calculate_scroll + mov [sc.cbSize],sizeof.SCROLLINFO + mov [sc.fMask],SIF_PAGE + push eax + lea eax,[sc] + invoke GetScrollInfo,[hwnd],SB_VERT,eax + pop eax + mov ecx,[sc.nPage] + calculate_scroll: + imul ecx,eax + cmp ecx,0 + jg scrolling_up + neg ecx + jnz scrolling_down + jmp done + time_scroll: + test [editor_mode],FEMODE_READONLY + jnz ignore + test [editor_mode],FEMODE_NOUNDO + jnz enable_undo + move_through_time: + cmp word [wparam+2],0 + jge backward_in_time + neg word [wparam+2] + jmp forward_in_time + backward_in_time: + sub word [wparam+2],120 + jc time_scroll_done + mov eax,[undo_data] + test eax,eax + jz time_scroll_done + call undo_changes + jmp backward_in_time + forward_in_time: + sub word [wparam+2],120 + jc time_scroll_done + mov eax,[redo_data] + test eax,eax + jz time_scroll_done + call redo_changes + jmp forward_in_time + time_scroll_done: + call create_caret + mov [last_operation],0 + jmp text_changed +wm_size: + call update_positions + mov eax,[screen_width] + mul [screen_height] + mov [screen_size],eax + mov [screen_offset],0 + shl eax,2 + or eax,eax + jz screen_allocated + mov ebx,eax + mov eax,[screen_base] + or eax,eax + jz screen_released + invoke VirtualFree,eax,0,MEM_RELEASE + screen_released: + invoke VirtualAlloc,0,ebx,MEM_COMMIT,PAGE_READWRITE + screen_allocated: + mov [screen_base],eax + call update_screen + lea ebx,[rect] + invoke GetClientRect,[hwnd],ebx + invoke InvalidateRect,[hwnd],ebx,FALSE + jmp done +wm_keydown: + lea ebx,[kbstate] + invoke GetKeyboardState,ebx + cmp [was_selection],0 + jne process_key + mov eax,[caret_line] + mov [selection_line],eax + mov eax,[caret_position] + mov [selection_position],eax + mov eax,[caret_line_number] + mov [selection_line_number],eax + process_key: + mov eax,[wparam] + cmp eax,VK_LEFT + je left_key + cmp eax,VK_RIGHT + je right_key + cmp eax,VK_UP + je up_key + cmp eax,VK_DOWN + je down_key + cmp eax,VK_BACK + je backspace_key + cmp eax,VK_HOME + je home_key + cmp eax,VK_END + je end_key + cmp eax,VK_PGUP + je pgup_key + cmp eax,VK_PGDN + je pgdn_key + cmp eax,VK_APPS + je menu_key + cmp eax,VK_INSERT + je ins_key + cmp eax,VK_DELETE + je del_key + cmp eax,VK_F6 + je f6_key + test [kbstate+VK_CONTROL],80h + jz convert_to_ascii + cmp eax,'Y' + je ctrl_y_key + convert_to_ascii: + mov ax,word [lparam+2] + and eax,7Fh + lea ebx,[kbstate] + lea edx,[char] + invoke ToAscii,[wparam],eax,ebx,edx,FALSE + cmp eax,2 + je two_characters + or eax,eax + jz ignore + jg process_character + test [editor_style],FES_REVIVEDEADKEYS + je ignore + lea edx,[char] + invoke ToAscii,VK_SPACE,0,ebx,edx,FALSE + jmp process_character + two_characters: + movzx eax,byte [char+1] + invoke PostMessage,[hwnd],WM_CHAR,eax,1 shl 31 + process_character: + mov al,byte [char] + cmp al,20h + jae character + cmp al,0Dh + je character + cmp al,9 + je character + jmp ignore + left_key: + test [kbstate+VK_MENU],80h + jnz scroll_left + test [kbstate+VK_CONTROL],80h + jnz word_left + cmp [caret_position],0 + jle moved_caret + dec [caret_position] + jmp moved_caret + right_key: + test [kbstate+VK_MENU],80h + jnz scroll_right + test [kbstate+VK_CONTROL],80h + jnz word_right + mov eax,[caret_position] + cmp eax,[maximum_position] + jae moved_caret + inc [caret_position] + jmp moved_caret + up_key: + test [kbstate+VK_MENU],80h + jnz scroll_up + call move_line_up + jmp moved_caret + down_key: + test [kbstate+VK_MENU],80h + jnz scroll_down + call move_line_down + jmp moved_caret + home_key: + test [kbstate+VK_CONTROL],80h + jnz screen_home + mov [caret_position],0 + jmp moved_caret + end_key: + test [kbstate+VK_CONTROL],80h + jnz screen_end + call move_to_line_end + jmp moved_caret + screen_home: + mov eax,[window_line] + mov [caret_line],eax + mov eax,[window_line_number] + mov [caret_line_number],eax + jmp moved_caret + screen_end: + mov eax,[window_line_number] + add eax,[window_height] + dec eax + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + jmp moved_caret + pgup_key: + test [kbstate+VK_CONTROL],80h + jnz text_home + call move_page_up + jmp moved_caret + pgdn_key: + test [kbstate+VK_CONTROL],80h + jnz text_end + call move_page_down + jmp moved_caret + text_home: + mov eax,[first_line] + mov [caret_line],eax + mov [caret_line_number],1 + jmp moved_caret + text_end: + or eax,-1 + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + jmp moved_caret + word_left: + call move_to_previous_word + jmp moved_caret + word_right: + call get_caret_segment + call move_to_next_word + jmp moved_caret + scroll_left: + cmp [window_position],0 + je scroll_done + dec [window_position] + jmp scroll_done + scroll_right: + inc [window_position] + jmp scroll_done + scroll_up: + mov esi,[window_line] + mov esi,[esi+4] + or esi,esi + jz scroll_done + mov [window_line],esi + dec [window_line_number] + jmp scroll_done + scroll_down: + mov esi,[window_line] + find_next_window_line: + mov esi,[esi] + btr esi,0 + jc find_next_window_line + or esi,esi + jz scroll_done + mov [window_line],esi + inc [window_line_number] + scroll_done: + cmp [was_selection],0 + jne moved_window + mov [selection_line],0 + jmp moved_window + ins_key: + test [kbstate+VK_MENU],80h + jnz switch_blocks + test [kbstate+VK_CONTROL],80h + jnz wm_copy + test [kbstate+VK_SHIFT],80h + jnz wm_paste + xor [editor_mode],FEMODE_OVERWRITE + mov [notification],FEN_MODECHANGE + call create_caret + cmp [was_selection],1 + je done + mov [selection_line],0 + jmp done + del_key: + test [editor_mode],FEMODE_READONLY + jnz ignore + test [kbstate+VK_CONTROL],80h + jnz wm_clear + test [kbstate+VK_SHIFT],80h + jnz wm_cut + cmp [was_selection],0 + je no_selection_on_del + test [editor_style],FES_SECURESEL + jz wm_clear + no_selection_on_del: + mov esi,[caret_line] + test [editor_mode],FEMODE_OVERWRITE + jnz delete_char + call check_line_length + cmp ecx,[caret_position] + ja delete_char + cmp dword [esi],0 + je ignore + call make_undopoint + call cut_line_break + call finish_edit + jmp text_altered + delete_char: + mov [current_operation],VK_DELETE + cmp [last_operation],VK_DELETE + jne undopoint_for_delete + mov eax,[unmodified_state] + cmp eax,[undo_data] + jne undo_delete_ok + or [unmodified_state],-1 + undopoint_for_delete: + call make_undopoint + undo_delete_ok: + call delete_character + call finish_edit + jmp text_altered + backspace_key: + test [editor_mode],FEMODE_READONLY + jnz ignore + test [kbstate+VK_MENU],80h + jnz undo_key + cmp [was_selection],0 + je no_selection_to_clear + test [editor_style],FES_SECURESEL + jz wm_clear + no_selection_to_clear: + cmp [caret_position],0 + je line_back + test [kbstate+VK_CONTROL],80h + jnz word_back + mov [current_operation],VK_BACK + cmp [last_operation],VK_BACK + jne backspace_undopoint + mov eax,[unmodified_state] + cmp eax,[undo_data] + jne undo_backspace_ok + or [unmodified_state],-1 + jmp undo_backspace_ok + backspace_undopoint: + call make_undopoint + undo_backspace_ok: + dec [caret_position] + call delete_character + call finish_edit + jmp text_altered + line_back: + test [editor_mode],FEMODE_OVERWRITE + jnz ignore + mov esi,[caret_line] + mov esi,[esi+4] + or esi,esi + jz ignore + call make_undopoint + mov [caret_line],esi + dec [caret_line_number] + call check_line_length + mov [caret_position],ecx + call cut_line_break + call finish_edit + jmp text_altered + word_back: + call make_undopoint + push [caret_position] + mov esi,[caret_line] + xor eax,eax + xchg eax,[esi+4] + push eax + call move_to_previous_word + pop eax + mov esi,[caret_line] + mov [esi+4],eax + pop ecx + sub ecx,[caret_position] + call delete_from_line + call finish_edit + jmp text_altered + character: + test [editor_mode],FEMODE_READONLY + jnz ignore + cmp al,0Dh + je enter_key + cmp al,9 + je tab_key + cmp [was_selection],0 + je no_selection_to_replace + call make_undopoint + test [editor_style],FES_SECURESEL + jnz character_undo_ok + push eax + call delete_block + pop eax + call put_character + call finish_edit + jmp text_altered + no_selection_to_replace: + mov [current_operation],VK_SPACE + cmp [last_operation],VK_SPACE + jne character_undopoint + mov edx,[unmodified_state] + cmp edx,[undo_data] + jne character_undo_ok + or [unmodified_state],-1 + jmp character_undo_ok + character_undopoint: + call make_undopoint + character_undo_ok: + call put_character + call finish_edit + jmp text_altered + tab_key: + test [editor_mode],FEMODE_READONLY + jnz ignore + call make_undopoint + cmp [was_selection],0 + je tab_securesel + test [editor_style],FES_SECURESEL + jnz tab_securesel + call delete_block + tab_securesel: + call tabulate + call finish_edit + jmp text_altered + enter_key: + test [editor_mode],FEMODE_READONLY + jnz ignore + call make_undopoint + cmp [was_selection],0 + je enter_secureselection_ok + test [editor_style],FES_SECURESEL + jnz enter_secureselection_ok + call delete_block + enter_secureselection_ok: + call carriage_return + test [editor_mode],FEMODE_OVERWRITE + jnz text_altered + call finish_edit + jmp text_altered + ctrl_y_key: + test [editor_mode],FEMODE_READONLY + jnz ignore + call make_undopoint + call remove_line + jmp text_altered + f6_key: + test [editor_mode],FEMODE_READONLY + jnz ignore + call make_undopoint + call duplicate_line + jmp text_altered + menu_key: + cmp [menu_handle],0 + je ignore + lea ebx,[point] + mov eax,[caret_x] + mov [ebx+POINT.x],eax + mov eax,[caret_y] + add eax,[font_height] + mov [ebx+POINT.y],eax + invoke ClientToScreen,[hwnd],ebx + invoke TrackPopupMenu,[menu_handle],TPM_RIGHTBUTTON,[ebx+POINT.x],[ebx+POINT.y],0,[menu_window],0 + jmp ignore +wm_syskeydown: + lea ebx,[kbstate] + invoke GetKeyboardState,ebx + mov eax,[wparam] + cmp eax,VK_INSERT + je switch_blocks + cmp eax,VK_LEFT + je scroll_left + cmp eax,VK_RIGHT + je scroll_right + cmp eax,VK_UP + je scroll_up + cmp eax,VK_DOWN + je scroll_down + cmp eax,VK_BACK + je undo_key + mov al,[last_operation] + mov [current_operation],al + jmp defwndproc + switch_blocks: + xor [editor_mode],FEMODE_VERTICALSEL + mov [notification],FEN_MODECHANGE + cmp [was_selection],0 + je ignore + jmp moved_window +wm_char: + test [lparam],1 shl 31 + jz ignore + mov eax,[wparam] + jmp character +wm_lbuttondown: + cmp [focus],0 + jne focus_ok + invoke SetFocus,[hwnd] + mov esi,[editor_memory] + add esi,SEGMENT_HEADER_LENGTH + lea edi,[editor_data] + mov ecx,editor_data_size + rep movsb + focus_ok: + lea ebx,[kbstate] + invoke GetKeyboardState,ebx + cmp [was_selection],0 + jne selection_ok + mov eax,[caret_line] + mov [selection_line],eax + mov eax,[caret_position] + mov [selection_position],eax + mov eax,[caret_line_number] + mov [selection_line_number],eax + selection_ok: + call get_mouse_position + invoke SetCapture,[hwnd] + or [mouse_select],-1 + jmp moved_caret + get_mouse_position: + mov ax,word [lparam] + cwde + cdq + test [editor_style],FES_CONSOLECARET + jnz get_mouse_column + test [editor_mode],FEMODE_OVERWRITE + jnz get_mouse_column + mov ebx,[font_width] + shr ebx,1 + adc eax,ebx + get_mouse_column: + idiv [font_width] + add eax,[window_position] + cmp eax,[maximum_position] + jg mouse_out_of_line + cmp eax,0 + jge click_position_ok + xor eax,eax + jmp click_position_ok + mouse_out_of_line: + mov eax,[maximum_position] + click_position_ok: + mov [caret_position],eax + mov ax,word [lparam+2] + cwde + cdq + idiv [font_height] + add eax,[window_line_number] + cmp eax,0 + jg click_line_ok + mov eax,1 + click_line_ok: + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + retn +wm_lbuttonup: + invoke ReleaseCapture + mov [mouse_select],0 + jmp done +wm_mousemove: + cmp [mouse_select],0 + je ignore + cmp [was_selection],0 + jne select + mov eax,[caret_line] + mov ebx,[caret_line_number] + mov [selection_line],eax + mov [selection_line_number],ebx + mov eax,[caret_position] + mov [selection_position],eax + select: + call get_mouse_position + jmp moved_selection +wm_lbuttondblclk: + mov [mouse_select],0 + call get_mouse_position + call get_word_at_caret + mov [selection_position],edx + add edx,ecx + mov [caret_position],edx + mov eax,[caret_line] + mov [selection_line],eax + mov eax,[caret_line_number] + mov [selection_line_number],eax + jmp moved_selection +wm_rbuttondown: + cmp [menu_handle],0 + je ignore + lea eax,[point] + invoke GetCursorPos,eax + invoke TrackPopupMenu,[menu_handle],TPM_RIGHTBUTTON,[point.x],[point.y],0,[menu_window],0 + jmp ignore +wm_copy: + cmp [was_selection],0 + je ignore + call copy_to_clipboard + jmp ignore + copy_to_clipboard: + call get_block_length + inc ecx + invoke GlobalAlloc,GMEM_MOVEABLE+GMEM_DDESHARE,ecx + mov ebx,eax + invoke GlobalLock,ebx + mov edi,eax + push ebx + call copy_block + pop ebx + invoke GlobalUnlock,ebx + invoke OpenClipboard,[hwnd] + invoke EmptyClipboard + invoke SetClipboardData,CF_TEXT,ebx + or eax,eax + jz copy_failed + invoke CloseClipboard + retn + copy_failed: + invoke GlobalFree,ebx + retn +wm_cut: + test [editor_mode],FEMODE_READONLY + jnz ignore + cmp [was_selection],0 + je ignore + call copy_to_clipboard +wm_clear: + test [editor_mode],FEMODE_READONLY + jnz ignore + cmp [was_selection],0 + je ignore + call make_undopoint + call delete_block + mov [selection_line],0 + jmp text_changed +wm_paste: + test [editor_mode],FEMODE_READONLY + jnz ignore + call make_undopoint + cmp [was_selection],0 + je paste_secureselection_ok + test [editor_style],FES_SECURESEL + jnz paste_secureselection_ok + call delete_block + paste_secureselection_ok: + invoke OpenClipboard,NULL + invoke GetClipboardData,CF_TEXT + or eax,eax + jnz do_paste + invoke CloseClipboard + jmp ignore + do_paste: + or [clipboard_opened],-1 + push eax + invoke GlobalLock,dword [esp] + mov esi,eax + call insert_block + jc paste_failed + pop ebx + invoke GlobalUnlock,ebx + invoke CloseClipboard + mov [clipboard_opened],0 + test [editor_style],FES_SECURESEL + jz no_selection_after_paste + mov eax,[caret_line] + mov ecx,[caret_line_number] + mov edx,[caret_position] + xchg eax,[selection_line] + xchg ecx,[selection_line_number] + xchg edx,[selection_position] + mov [caret_line],eax + mov [caret_line_number],ecx + mov [caret_position],edx + jmp text_changed + no_selection_after_paste: + mov [selection_line],0 + jmp text_changed + paste_failed: + call undo_changes + pop ebx + invoke GlobalUnlock,ebx + invoke CloseClipboard + mov [clipboard_opened],0 + jmp text_changed +wm_settext: + mov esi,[lparam] + call set_text + mov [return_value],TRUE + jmp text_changed +wm_gettextlength: + mov esi,[first_line] + count_text_length: + mov eax,[esi+8] + add [return_value],eax + skip_counted_line_segments: + mov esi,[esi] + or esi,esi + jz ignore + btr esi,0 + jc skip_counted_line_segments + add [return_value],2 + jmp count_text_length +wm_gettext: + mov esi,[first_line] + mov edi,[lparam] + sub [wparam],1 + jc ignore + mov [line_number],0 + copy_text: + inc [line_number] + mov ecx,[esi+8] + test [editor_style],FES_OPTIMALFILL + jz direct_copy + cmp ecx,8 + jb direct_copy + push edi ecx + mov edi,[line_buffer] + xor edx,edx + call copy_from_line + push esi + mov esi,[line_buffer] + mov edi,[line_buffer] + add edi,[peak_line_length] + mov ebx,edi + mov ecx,[esp+4] + xor al,al + rep stosb + mov ecx,[esp+4] + invoke syntax_proc,esi,ecx,ebx + pop esi ecx edi + mov eax,[return_value] + add eax,ecx + cmp eax,[wparam] + jbe optimal_fill_size_ok + mov ecx,[wparam] + sub eax,[return_value] + optimal_fill_size_ok: + push esi edi + mov esi,[line_buffer] + mov ebx,[peak_line_length] + jecxz optimal_fill_done + xor edx,edx + optimal_fill: + lodsb + cmp al,20h + jne store_character + cmp byte [esi-1+ebx],0 + jne store_character + mov eax,esi + sub eax,[line_buffer] + test eax,111b + jz store_tab + inc edx + mov al,20h + stosb + loop optimal_fill + jmp optimal_fill_done + store_tab: + mov al,20h + or edx,edx + jz store_character + sub edi,edx + mov al,9 + store_character: + stosb + xor edx,edx + loop optimal_fill + optimal_fill_done: + pop eax + neg eax + add eax,edi + add [return_value],eax + pop esi + jmp line_copied + direct_copy: + mov eax,[return_value] + add eax,ecx + cmp eax,[wparam] + jbe direct_copy_size_ok + mov ecx,[wparam] + sub eax,[return_value] + direct_copy_size_ok: + add [return_value],ecx + xor edx,edx + call copy_from_line + line_copied: + or esi,esi + jz text_copied + mov ecx,[return_value] + add ecx,2 + cmp ecx,[wparam] + ja text_copied + mov ax,0A0Dh + stosw + mov [return_value],ecx + cmp ecx,[wparam] + jne copy_text + text_copied: + xor al,al + stosb + jmp ignore +fem_getlinelength: + mov esi,[caret_line] + mov eax,[wparam] + or eax,eax + jz return_length + call find_line + cmp ecx,[wparam] + je return_length + or [return_value],-1 + jmp ignore + return_length: + mov ecx,[esi+8] + mov [return_value],ecx + jmp ignore +fem_getline: + mov esi,[caret_line] + mov eax,[wparam] + or eax,eax + jz get_line + call find_line + cmp ecx,[wparam] + jne ignore + get_line: + mov ecx,[esi+8] + mov [return_value],ecx + mov edi,[lparam] + xor edx,edx + call copy_from_line + xor al,al + stosb + jmp ignore +wm_setfont: + mov esi,[wparam] + or esi,esi + jnz get_metrics + mov esi,[fedit_font] + get_metrics: + invoke GetDC,[hwnd] + mov ebx,eax + invoke SelectObject,ebx,esi + lea edi,[char] + mov byte [edi],20h + lea eax,[size] + invoke GetTextExtentPoint32,ebx,edi,1,eax + lea eax,[tm] + invoke GetTextMetrics,ebx,eax + invoke ReleaseDC,[hwnd],ebx + test [tm.tmPitchAndFamily],TMPF_FIXED_PITCH + jnz ignore + mov [return_value],esi + mov [editor_font],esi + mov eax,[size.cy] + mov [font_height],eax + mov eax,[size.cx] + mov [font_width],eax + mov ecx,[tm.tmMaxCharWidth] + sub ecx,eax + mov [font_overhang],ecx + mov eax,[lparam] + mov [redraw_now],al + cmp [focus],0 + je wm_size + call create_caret + jmp wm_size +wm_getfont: + mov eax,[editor_font] + cmp eax,[fedit_font] + je ignore + mov [return_value],eax + jmp ignore +wm_undo: + test [editor_mode],FEMODE_READONLY + jnz ignore + test [editor_mode],FEMODE_NOUNDO + jnz enable_undo + mov eax,[undo_data] + test eax,eax + jz ignore + call undo_changes + call create_caret + mov [last_operation],0 + jmp text_changed + enable_undo: + and [editor_mode],not FEMODE_NOUNDO + jmp ignore +em_canundo: + test [editor_mode],FEMODE_READONLY + jnz ignore + mov eax,[undo_data] + or eax,eax + jz ignore + mov [return_value],TRUE + jmp ignore + undo_key: + test [kbstate+VK_SHIFT],80h + jz wm_undo +fem_redo: + test [editor_mode],FEMODE_READONLY + jnz ignore + cmp [redo_data],0 + je ignore + call redo_changes + call create_caret + mov [last_operation],0 + jmp text_changed +fem_canredo: + test [editor_mode],FEMODE_READONLY + jnz ignore + mov eax,[redo_data] + or eax,eax + jz ignore + mov [return_value],TRUE + jmp ignore +fem_isunmodified: + mov eax,[undo_data] + cmp eax,[unmodified_state] + jne ignore + mov [return_value],TRUE + jmp ignore +em_emptyundobuffer: + call clear_redo_data + call clear_undo_data + jmp ignore +fem_setunmodified: + mov eax,[undo_data] + mov [unmodified_state],eax + jmp ignore +em_replacesel: + test [editor_mode],FEMODE_VERTICALSEL + FEMODE_OVERWRITE + FEMODE_READONLY + jnz ignore + cmp [undo_data],0 + je replacesel_undopoint + cmp [wparam],0 + je replace_undo_ok + replacesel_undopoint: + call make_undopoint + replace_undo_ok: + cmp [was_selection],0 + je simple_replace + push [caret_line_number] + push [caret_position] + call delete_block + pop edx ecx + cmp ecx,[caret_line_number] + jne simple_replace + cmp edx,[caret_position] + jne simple_replace + mov esi,[lparam] + call insert_block + mov esi,[caret_line] + mov ecx,[caret_line_number] + mov edx,[caret_position] + xchg esi,[selection_line] + xchg ecx,[selection_line_number] + xchg edx,[selection_position] + mov [caret_line],esi + mov [caret_line_number],ecx + mov [caret_position],edx + jmp text_changed + simple_replace: + mov esi,[lparam] + call insert_block + jmp text_changed +fem_setmode: + mov eax,[wparam] + xchg [editor_mode],eax + cmp eax,[editor_mode] + je ignore + mov [notification],FEN_MODECHANGE + call create_caret + cmp [was_selection],0 + jne moved_window + jmp done +fem_getmode: + mov eax,[editor_mode] + mov [return_value],eax + jmp ignore +fem_setsyntaxhighlight: + mov eax,[wparam] + mov ebx,[lparam] + mov [syntax_colors],eax + mov [syntax_proc],ebx + or eax,eax + jnz wm_size + mov [syntax_proc],SyntaxProc + jmp wm_size +fem_setrightclickmenu: + mov eax,[wparam] + mov ebx,[lparam] + mov [menu_handle],eax + mov [menu_window],ebx + jmp ignore +fem_settextcolor: + mov eax,[wparam] + mov ebx,[lparam] + mov [text_color],eax + mov [background_color],ebx + jmp wm_size +fem_setselcolor: + mov eax,[wparam] + mov ebx,[lparam] + mov [selection_text],eax + mov [selection_background],ebx + jmp wm_size +fem_setpos: + mov edi,[wparam] + virtual at edi + pos FEPOS + end virtual + cmp [selection_line],0 + jne selection_current_ok + mov eax,[caret_line] + mov [selection_line],eax + mov eax,[caret_line_number] + mov [selection_line_number],eax + mov eax,[caret_position] + mov [selection_position],eax + selection_current_ok: + mov eax,[pos.selectionLine] + or eax,eax + jz selection_line_ok + call find_line + mov [selection_line],esi + mov [selection_line_number],ecx + selection_line_ok: + mov eax,[pos.selectionPosition] + sub eax,1 + jc selection_position_set + mov [selection_position],eax + selection_position_set: + mov eax,[pos.caretLine] + or eax,eax + jz caret_line_ok + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + caret_line_ok: + mov eax,[pos.caretPosition] + sub eax,1 + jc moved_selection + mov [caret_position],eax + jmp moved_selection +fem_getpos: + mov edi,[wparam] + mov eax,[caret_line_number] + mov [pos.selectionLine],eax + mov [pos.caretLine],eax + mov eax,[caret_position] + inc eax + mov [pos.selectionPosition],eax + mov [pos.caretPosition],eax + cmp [selection_line],0 + je ignore + mov eax,[selection_line_number] + mov [pos.selectionLine],eax + mov eax,[selection_position] + inc eax + mov [pos.selectionPosition],eax + jmp ignore +fem_findfirst: + mov esi,[lparam] + mov eax,[wparam] + call find_first + jnc show_found_text + jmp ignore +fem_findnext: + call find_next + jc ignore + show_found_text: + mov [return_value],TRUE + cmp [macro_operation],0 + jne moved_selection + mov eax,[caret_position] + xchg eax,[selection_position] + mov [caret_position],eax + call update_window + call let_caret_appear + call update_positions + mov eax,[caret_position] + xchg eax,[selection_position] + mov [caret_position],eax + jmp moved_selection +fem_getsearchtext: + call get_search_text_length + mov edx,[lparam] + jc store_required_buffer_size + inc ecx + cmp ecx,[edx] + ja store_required_buffer_size + mov edi,[wparam] + call get_search_text + mov [return_value],TRUE + jmp ignore + store_required_buffer_size: + mov [edx],ecx + jmp ignore +fem_getsearchflags: + cmp [search_data],0 + je ignore + mov eax,[search_flags] + mov [return_value],eax + jmp ignore +fem_releasesearch: + call release_search_data + jmp ignore +fem_canfindnext: + cmp [search_data],0 + je ignore + mov [return_value],TRUE + jmp ignore +fem_getwordatcaret: + cmp [wparam],0 + je ignore + call get_word_at_caret + mov edi,[lparam] + mov eax,[wparam] + dec eax + jz word_copied + cmp ecx,eax + jbe copy_word + mov ecx,eax + copy_word: + mov [return_value],ecx + mov esi,[caret_line] + call copy_from_line + word_copied: + xor al,al + stosb + jmp ignore +fem_beginoperation: + test [editor_mode],FEMODE_READONLY + jnz ignore + mov [macro_operation],1 + call store_status_for_undo + jmp done +fem_endoperation: + test [editor_mode],FEMODE_READONLY + jnz ignore + xor al,al + xchg al,[macro_operation] + test al,2 + jnz text_changed + test al,4 + jz update_all + mov [notification],FEN_POSCHANGE + jmp update_all +moved_caret: + test [kbstate+VK_SHIFT],80h + jnz moved_selection + mov [selection_line],0 +moved_selection: + cmp [macro_operation],0 + jne position_changed_by_macro_operation + mov [notification],FEN_POSCHANGE + jmp update_all +moved_window: + call update_positions + jmp refresh +text_altered: + mov [selection_line],0 +text_changed: + cmp [macro_operation],0 + jne text_changed_by_macro_operation + mov [notification],FEN_TEXTCHANGE + mov eax,[peak_line_length] + xor edx,edx + mov ebx,SEGMENT_DATA_LENGTH + div ebx + inc eax + mul ebx + shl eax,1 + cmp eax,[line_buffer_size] + je update_all + mov [line_buffer_size],eax + invoke VirtualAlloc,0,[line_buffer_size],MEM_COMMIT,PAGE_READWRITE + or eax,eax + jz memory_shortage + xchg [line_buffer],eax + invoke VirtualFree,eax,0,MEM_RELEASE + update_all: + cmp [macro_operation],0 + jne done + call update_window + call let_caret_appear + call update_positions + refresh: + cmp [macro_operation],0 + jne done + cmp [screen_base],0 + je wm_size + mov eax,[screen_size] + shl eax,1 + xor [screen_offset],eax + call update_screen + mov esi,[screen_base] + mov eax,[screen_size] + lea edi,[esi+eax*2] + mov [rect.top],0 + mov edx,[font_height] + mov [rect.bottom],edx + mov ecx,[screen_height] + refresh_screen: + push ecx + mov ebx,[screen_size] + mov edx,[font_width] + xor eax,eax + mov [rect.left],eax + mov [rect.right],eax + mov ecx,[screen_width] + refresh_line: + mov al,[esi] + mov ah,[esi+ebx] + cmp al,[edi] + jne refresh_changed + cmp ah,[edi+ebx] + jne refresh_changed + inc esi + inc edi + add [rect.left],edx + add [rect.right],edx + loop refresh_line + jmp refresh_next_line + refresh_changed: + mov al,[esi] + mov ah,[esi+ebx] + inc esi + add [rect.right],edx + cmp al,[edi] + jne changed_more + cmp ah,[edi+ebx] + jne changed_more + inc edi + jmp invalidate + changed_more: + inc edi + loop refresh_changed + invalidate: + push ecx edx + push [rect.right] + mov eax,[font_overhang] + sub [rect.left],eax + add [rect.right],eax + lea edx,[rect] + invoke InvalidateRect,[hwnd],edx,FALSE + pop eax + mov [rect.left],eax + mov [rect.right],eax + pop edx ecx + jecxz refresh_next_line + loop refresh_line + refresh_next_line: + mov eax,[font_height] + add [rect.top],eax + add [rect.bottom],eax + pop ecx + dec ecx + jnz refresh_screen + jmp done + position_changed_by_macro_operation: + or [macro_operation],4 + jmp done + text_changed_by_macro_operation: + or [macro_operation],2 + jmp done +ignore: + mov dl,[last_operation] + mov [current_operation],dl + cmp [was_selection],0 + jne done + mov [selection_line],0 +done: + cmp [focus],0 + je caret_ok + call update_caret_position + caret_ok: + lea esi,[editor_data] + mov edi,[editor_memory] + add edi,SEGMENT_HEADER_LENGTH + mov ecx,editor_data_size + rep movsb + cmp [notification],0 + je notification_ok + invoke GetWindowLong,[hwnd],GWL_HWNDPARENT + mov edi,eax + invoke GetWindowLong,[hwnd],GWL_ID + movzx ebx,[notification] + shl ebx,16 + or eax,ebx + invoke SendMessage,edi,WM_COMMAND,eax,[hwnd] + notification_ok: + cmp [redraw_now],0 + je redraw_ok + invoke UpdateWindow,[hwnd] + redraw_ok: + mov eax,[return_value] +finish_wndproc: + pop edi esi ebx + ret +not_enough_memory: + lea esp,[editor_memory-10h] + mov [notification],FEN_OUTOFMEMORY + or [return_value],-1 + cmp [clipboard_opened],0 + je ignore + invoke CloseClipboard + mov [clipboard_opened],0 + jmp ignore +get_memory: + invoke VirtualAlloc,0,ecx,MEM_COMMIT,PAGE_READWRITE + mov ebx,eax + retn +release_memory: + invoke VirtualFree,ebx,0,MEM_RELEASE + retn +make_undopoint: + cmp [macro_operation],0 + jne undopoint_ok + call store_status_for_undo + undopoint_ok: + retn +update_positions: + lea eax,[rect] + invoke GetClientRect,[hwnd],eax + mov eax,[rect.right] + sub eax,[rect.left] + cdq + div [font_width] + mov [window_width],eax + add edx,-1 + adc eax,0 + mov [screen_width],eax + mov eax,[rect.bottom] + sub eax,[rect.top] + cdq + div [font_height] + mov [window_height],eax + add edx,-1 + adc eax,0 + mov [screen_height],eax + call update_window + setup_vscroll: + mov ecx,[lines_count] + mov [sc.cbSize],sizeof.SCROLLINFO + mov [sc.fMask],SIF_DISABLENOSCROLL+SIF_RANGE+SIF_PAGE+SIF_POS + mov [sc.nMin],1 + mov [sc.nMax],ecx + mov eax,[window_height] + mov [sc.nPage],eax + mov edx,[window_line_number] + mov [sc.nPos],edx + test [editor_style],WS_VSCROLL + jz setup_hscroll + lea eax,[sc] + invoke SetScrollInfo,[hwnd],SB_VERT,eax,TRUE + setup_hscroll: + mov ecx,[maximum_position] + mov [sc.nMin],0 + mov [sc.nMax],ecx + mov eax,[window_width] + mov [sc.nPage],eax + mov edx,[window_position] + mov [sc.nPos],edx + test [editor_style],WS_HSCROLL + jz setup_caret + lea eax,[sc] + invoke SetScrollInfo,[hwnd],SB_HORZ,eax,TRUE + setup_caret: + mov eax,[font_width] + mov edx,[caret_position] + sub edx,[window_position] + imul eax,edx + mov [caret_x],eax + mov eax,[font_height] + mov edx,[caret_line_number] + sub edx,[window_line_number] + imul eax,edx + mov [caret_y],eax + retn +create_caret: + xor eax,eax + test [editor_mode],FEMODE_OVERWRITE + jnz block_caret + test [editor_style],FES_CONSOLECARET + jnz console_caret + invoke CreateCaret,[hwnd],NULL,0,[font_height] + jmp show_caret + block_caret: + invoke CreateCaret,[hwnd],NULL,[font_width],[font_height] + jmp show_caret + console_caret: + invoke CreateCaret,[hwnd],NULL,[font_width],2 + show_caret: + invoke ShowCaret,[hwnd] +update_caret_position: + mov eax,[caret_y] + test [editor_mode],FEMODE_OVERWRITE + jnz set_position + test [editor_style],FES_CONSOLECARET + jz set_position + add eax,[font_height] + sub eax,2 + set_position: + invoke SetCaretPos,[caret_x],eax + retn +update_screen: + mov edi,[screen_base] + or edi,edi + jz screen_prepared + add edi,[screen_offset] + mov ebx,[screen_size] + add ebx,edi + push ebx + mov ecx,[screen_height] + mov edx,[window_line_number] + mov [line_number],edx + mov esi,[window_line] + prepare_screen: + push ecx + test byte [esi],1 + jnz prepare_long_line + push esi + add esi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH + call prepare_line + pop esi + mov esi,[esi] + jmp prepare_next_line + prepare_long_line: + push edi + mov edi,[line_buffer] + xor eax,eax + combine_long_line_segments: + add esi,SEGMENT_HEADER_LENGTH + mov ecx,SEGMENT_DATA_LENGTH + rep movsb + add eax,SEGMENT_DATA_LENGTH + mov esi,[esi-SEGMENT_LENGTH] + btr esi,0 + jc combine_long_line_segments + mov ecx,eax + mov eax,esi + mov esi,edi + sub esi,ecx + pop edi + push eax + call prepare_line + pop esi + prepare_next_line: + inc [line_number] + pop ecx + dec ecx + jz prepare_selection + or esi,esi + jnz prepare_screen + prepare_empty_lines: + imul ecx,[screen_width] + xor al,al + mov edx,ecx + rep stosb + xchg edi,ebx + mov ecx,edx + rep stosb + prepare_selection: + pop ebx + test [editor_style],ES_NOHIDESEL + jnz hideselection_ok + cmp [focus],0 + je screen_prepared + hideselection_ok: + cmp [selection_line],0 + je screen_prepared + mov eax,[window_line_number] + mov esi,[selection_line_number] + mov edi,[caret_line_number] + sub esi,eax + sub edi,eax + mov ecx,[window_position] + mov eax,[selection_position] + mov edx,[caret_position] + sub eax,ecx + sub edx,ecx + cmp esi,edi + jle selection_boundaries_ok + xchg esi,edi + xchg eax,edx + selection_boundaries_ok: + mov ecx,[screen_height] + cmp edi,0 + jl screen_prepared + cmp esi,ecx + jge screen_prepared + cmp esi,edi + je prepare_vsel + test [editor_mode],FEMODE_VERTICALSEL + jz prepare_hsel + prepare_vsel: + cmp eax,edx + jle vselection_boundaries_ok + xchg eax,edx + vselection_boundaries_ok: + cmp esi,0 + jge vselection_start_ok + xor esi,esi + vselection_start_ok: + inc edi + cmp edi,ecx + jle vselection_end_ok + mov edi,ecx + vselection_end_ok: + mov ecx,[screen_width] + cmp edx,0 + jl screen_prepared + cmp eax,ecx + jge screen_prepared + cmp eax,0 + jge vselection_line_start_ok + xor eax,eax + vselection_line_start_ok: + cmp edx,ecx + jle vselection_line_end_ok + mov edx,ecx + vselection_line_end_ok: + mov ecx,edi + sub ecx,esi + imul esi,[screen_width] + add ebx,esi + prepare_vselection_line: + push eax ecx + mov edi,ebx + mov ecx,edx + sub ecx,eax + lea edi,[ebx+eax] + mov al,80h + rep stosb + add ebx,[screen_width] + pop ecx eax + loop prepare_vselection_line + jmp screen_prepared + prepare_hsel: + cmp esi,0 + jge hselection_start_ok + xor esi,esi + xor eax,eax + hselection_start_ok: + cmp edi,ecx + jl hselection_end_ok + mov edi,ecx + xor edx,edx + hselection_end_ok: + inc esi + mov ecx,edi + sub ecx,esi + imul ecx,[screen_width] + imul esi,[screen_width] + lea edi,[ebx+esi] + neg eax + add eax,[screen_width] + cmp eax,0 + jle hselection_start_line_ok + sub edi,eax + add ecx,eax + sub eax,[screen_width] + jle hselection_start_line_ok + add edi,eax + sub ecx,eax + hselection_start_line_ok: + cmp edx,0 + jle hselection_end_line_ok + add ecx,edx + sub edx,[screen_width] + jle hselection_end_line_ok + sub ecx,edx + hselection_end_line_ok: + mov al,80h + rep stosb + screen_prepared: + retn + prepare_line: + push edi ecx + mov ecx,[esp] + mov edi,[line_buffer] + add edi,ecx + shr ecx,2 + xor eax,eax + rep stosd + mov ecx,[esp] + sub edi,ecx + invoke syntax_proc,esi,ecx,edi + mov edx,edi + pop eax edi + push esi edx + mov edx,[window_position] + lea esi,[esi+edx] + sub eax,edx + jnc line_position_ok + xor eax,eax + jmp line_length_ok + line_position_ok: + cmp eax,[screen_width] + jbe line_length_ok + mov eax,[screen_width] + line_length_ok: + mov ecx,eax + rep movsb + pop esi + add esi,edx + mov ecx,eax + xchg edi,ebx + rep movsb + xchg edi,ebx + pop esi + cmp eax,[screen_width] + jb after_end_of_line + retn + after_end_of_line: + mov ecx,[screen_width] + sub ecx,eax + xor al,al + mov edx,ecx + rep stosb + xchg edi,ebx + mov ecx,edx + rep stosb + xchg edi,ebx + retn + +include '..\memory.inc' +include '..\navigate.inc' +include '..\edit.inc' +include '..\blocks.inc' +include '..\search.inc' +include '..\undo.inc' + +endp + +proc SyntaxProc lpLine,uChars,lpColors + ret +endp diff --git a/fasmw172/SOURCE/IDE/FASMW/RESOURCE/ASSIGN.BMP b/fasmw172/SOURCE/IDE/FASMW/RESOURCE/ASSIGN.BMP new file mode 100644 index 0000000..3680a6e Binary files /dev/null and b/fasmw172/SOURCE/IDE/FASMW/RESOURCE/ASSIGN.BMP differ diff --git a/fasmw172/SOURCE/IDE/FASMW/RESOURCE/FASMW.ICO b/fasmw172/SOURCE/IDE/FASMW/RESOURCE/FASMW.ICO new file mode 100644 index 0000000..f90f438 Binary files /dev/null and b/fasmw172/SOURCE/IDE/FASMW/RESOURCE/FASMW.ICO differ diff --git a/fasmw172/SOURCE/IDE/MEMORY.INC b/fasmw172/SOURCE/IDE/MEMORY.INC new file mode 100644 index 0000000..9b04370 --- /dev/null +++ b/fasmw172/SOURCE/IDE/MEMORY.INC @@ -0,0 +1,199 @@ + +; flat editor core +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. + +init_editor_memory: + mov ecx,BLOCK_LENGTH + call get_memory + or eax,eax + jz memory_error + mov [editor_memory],eax + mov dword [eax],0 + mov dword [eax+4],0 + mov dword [eax+8],ebx + lea ebx,[eax+SEGMENT_LENGTH] + mov [unallocated_segments],ebx + mov [memory_search_segment],ebx + add eax,BLOCK_LENGTH + mov [unallocated_segments_end],eax + mov [memory_search_block],eax + mov [released_segments],0 + call allocate_segment + mov [first_line],eax + mov [lines_count],1 + mov [peak_line_length],0 + mov [caret_line],eax + mov [caret_line_number],1 + mov [window_line],eax + mov [window_line_number],1 + mov edi,eax + xor eax,eax + mov ecx,SEGMENT_HEADER_LENGTH shr 2 + rep stosd + mov eax,20202020h + mov ecx,SEGMENT_DATA_LENGTH shr 2 + rep stosd + call allocate_segment + jc memory_shortage + mov [lengths_table],eax + mov edi,eax + xor eax,eax + mov ecx,SEGMENT_LENGTH shr 2 + rep stosd + mov [caret_position],eax + mov [window_position],eax + mov [selection_line],eax + mov [undo_data],eax + mov [redo_data],eax + mov [search_data],eax + mov [editor_mode],eax + mov [unmodified_state],eax + clc + retn + memory_error: + stc + retn + +reset_editor_memory: + mov esi,[editor_memory] + lea eax,[esi+SEGMENT_LENGTH] + mov [unallocated_segments],eax + mov [memory_search_segment],eax + lea eax,[esi+BLOCK_LENGTH] + mov [unallocated_segments_end],eax + mov [memory_search_block],eax + mov [released_segments],0 + mov ebx,[esi] + release_blocks: + or ebx,ebx + jz release_done + push dword [ebx] + mov ebx,[ebx+8] + call release_memory + pop ebx + jmp release_blocks + release_done: + mov ebx,[editor_memory] + xor eax,eax + mov [ebx],eax + mov [undo_data],eax + mov [redo_data],eax + mov [search_data],eax + call allocate_segment + jc memory_shortage + mov [first_line],eax + mov [window_line],eax + mov [caret_line],eax + mov edi,eax + xor eax,eax + mov ecx,SEGMENT_HEADER_LENGTH shr 2 + rep stosd + mov eax,20202020h + mov ecx,SEGMENT_DATA_LENGTH shr 2 + rep stosd + xor eax,eax + mov [selection_line],eax + mov [peak_line_length],eax + mov [window_position],eax + inc eax + mov [window_line_number],eax + mov [caret_line_number],eax + mov [lines_count],eax + call allocate_segment + jc memory_shortage + mov [lengths_table],eax + mov edi,eax + xor eax,eax + mov ecx,SEGMENT_LENGTH shr 2 + rep stosd + retn + +release_editor_memory: + mov esi,[editor_memory] + release: + push dword [esi] + mov ebx,[esi+8] + call release_memory + pop esi + or esi,esi + jnz release + mov [editor_memory],0 + retn + +allocate_segment: + mov eax,[unallocated_segments] + cmp eax,[unallocated_segments_end] + je simple_allocation_failed + add [unallocated_segments],SEGMENT_LENGTH + clc + retn + simple_allocation_failed: + push ebx esi + mov ebx,[memory_search_block] + mov esi,[memory_search_segment] + cmp [released_segments],16 + jb add_new_block + find_free_segment: + cmp esi,ebx + je find_in_next_block + cmp dword [esi],-1 + je reuse_segment + add esi,SEGMENT_LENGTH + cmp esi,[memory_search_segment] + jne find_free_segment + add_new_block: + sub ebx,BLOCK_LENGTH + find_last_memory_block: + cmp dword [ebx],0 + je allocate_more_memory + mov ebx,[ebx] + jmp find_last_memory_block + allocate_more_memory: + mov ecx,BLOCK_LENGTH + push ebx + call get_memory + pop esi + or eax,eax + jz allocation_failed + mov [esi],eax + mov dword [eax],0 + mov [eax+4],esi + mov [eax+8],ebx + lea ebx,[eax+BLOCK_LENGTH] + mov [unallocated_segments_end],ebx + add eax,SEGMENT_LENGTH + lea ebx,[eax+SEGMENT_LENGTH] + mov [unallocated_segments],ebx + mov [released_segments],0 + pop esi ebx + clc + retn + allocation_failed: + xor eax,eax + pop esi ebx + stc + retn + reuse_segment: + mov eax,esi + mov [memory_search_block],ebx + add esi,SEGMENT_LENGTH + mov [memory_search_segment],esi + dec [released_segments] + pop esi ebx + clc + retn + find_in_next_block: + sub ebx,BLOCK_LENGTH + mov esi,[ebx] + lea ebx,[esi+BLOCK_LENGTH] + or esi,esi + jnz find_free_segment + mov ebx,[editor_memory] + mov esi,ebx + add ebx,BLOCK_LENGTH + jmp find_free_segment + +memory_shortage: + call undo_changes + jmp not_enough_memory diff --git a/fasmw172/SOURCE/IDE/NAVIGATE.INC b/fasmw172/SOURCE/IDE/NAVIGATE.INC new file mode 100644 index 0000000..430e127 --- /dev/null +++ b/fasmw172/SOURCE/IDE/NAVIGATE.INC @@ -0,0 +1,511 @@ + +; flat editor core +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. + +find_line: + mov esi,[first_line] + mov ecx,1 + mov edx,[window_line_number] + cmp eax,edx + jae forward_from_window + sub edx,eax + cmp edx,eax + jb backward_from_window + jmp find_forward + forward_from_window: + mov esi,[window_line] + mov ecx,edx + find_forward: + cmp ecx,eax + je line_found + cmp dword [esi],0 + je line_found + mov ebx,esi + forward_skip_line: + mov ebx,[ebx] + btr ebx,0 + jc forward_skip_line + or ebx,ebx + jz line_found + mov esi,ebx + inc ecx + jmp find_forward + backward_from_window: + mov esi,[window_line] + mov ecx,[window_line_number] + find_backward: + cmp ecx,eax + je line_found + cmp dword [esi+4],0 + je line_found + mov esi,[esi+4] + dec ecx + jmp find_backward + line_found: + retn + +get_caret_segment: + mov edx,[caret_position] + mov esi,[caret_line] + find_segment: + cmp edx,SEGMENT_DATA_LENGTH + jb segment_found + test byte [esi],1 + jz segment_found + mov esi,[esi] + dec esi + sub edx,SEGMENT_DATA_LENGTH + jmp find_segment + segment_found: + retn + +check_line_length: + xor edx,edx + mov ebx,esi + count_line_segments: + test byte [esi],1 + jz last_line_segment + mov esi,[esi] + dec esi + add edx,SEGMENT_DATA_LENGTH + jmp count_line_segments + last_line_segment: + lea edi,[esi+SEGMENT_LENGTH-1] + mov al,20h + mov ecx,SEGMENT_DATA_LENGTH + std + repe scasb + cld + setne al + movzx eax,al + add ecx,eax + jnz line_segments_ok + or edx,edx + jz line_segments_ok + call store_freed_segment_for_undo + mov eax,[esi] + mov esi,[esi+4] + dec esi + call store_segment_for_undo + mov [esi],eax + sub edx,SEGMENT_DATA_LENGTH + jmp last_line_segment + line_segments_ok: + add ecx,edx + mov edx,ecx + cmp edx,[ebx+8] + je line_length_checked + mov esi,ebx + call store_segment_for_undo + xchg [ebx+8],edx + push edx + mov eax,[ebx+8] + call register_length + pop eax + call unregister_length + line_length_checked: + retn + register_length: + cmp eax,[peak_line_length] + jbe peak_length_ok + mov [peak_line_length],eax + peak_length_ok: + or eax,eax + jz ignore_zero_length + push ebx + call find_lengths_segment + inc dword [ebx+SEGMENT_HEADER_LENGTH+eax*4] + pop ebx + ignore_zero_length: + retn + find_lengths_segment: + mov ebx,[lengths_table] + try_lengths_segment: + cmp eax,SEGMENT_DATA_LENGTH/4 + jb length_entry_ok + sub eax,SEGMENT_DATA_LENGTH/4 + cmp dword [ebx],0 + je add_lengths_segment + mov ebx,[ebx] + jmp try_lengths_segment + add_lengths_segment: + push eax ecx edi + call allocate_segment + jc memory_shortage + call store_allocated_segment_for_undo + mov [ebx],eax + mov edi,eax + xor eax,eax + stosd + mov eax,ebx + stosd + mov eax,[ebx+8] + add eax,SEGMENT_DATA_LENGTH/4 + stosd + add edi,SEGMENT_HEADER_LENGTH-12 + mov ecx,SEGMENT_DATA_LENGTH shr 2 + xor eax,eax + rep stosd + lea ebx,[edi-SEGMENT_LENGTH] + pop edi ecx eax + jmp try_lengths_segment + length_entry_ok: + retn + unregister_length: + or eax,eax + jz ignore_zero_length + push ebx + cmp eax,[peak_line_length] + je unregister_peak_length + call find_lengths_segment + dec dword [ebx+SEGMENT_HEADER_LENGTH+eax*4] + length_unregistered: + pop ebx + retn + unregister_peak_length: + call find_lengths_segment + dec dword [ebx+SEGMENT_HEADER_LENGTH+eax*4] + jnz length_unregistered + find_reduced_peak: + or eax,eax + jz try_earlier_lengths_segment + dec eax + cmp dword [ebx+SEGMENT_HEADER_LENGTH+eax*4],0 + je find_reduced_peak + add eax,[ebx+8] + mov [peak_line_length],eax + jmp length_unregistered + try_earlier_lengths_segment: + mov ebx,[ebx+4] + mov eax,SEGMENT_DATA_LENGTH/4 + or ebx,ebx + jnz find_reduced_peak + mov [peak_line_length],ebx + jmp length_unregistered + +update_window: + mov edx,[window_line_number] + cmp edx,1 + je window_vertical_position_ok + add edx,[window_height] + dec edx + cmp edx,[lines_count] + jle window_vertical_position_ok + sub edx,[lines_count] + window_vertical_correction: + mov esi,[window_line] + mov esi,[esi+4] + or esi,esi + jz window_vertical_position_ok + mov [window_line],esi + dec [window_line_number] + dec edx + jnz window_vertical_correction + window_vertical_position_ok: + mov ecx,[peak_line_length] + cmp ecx,[caret_position] + jae caret_position_ok + mov ecx,[caret_position] + caret_position_ok: + cmp [selection_line],0 + je selection_position_ok + cmp ecx,[selection_position] + jae selection_position_ok + mov ecx,[selection_position] + selection_position_ok: + mov eax,[window_width] + dec eax + cmp ecx,eax + jae edit_space_width_ok + mov ecx,eax + edit_space_width_ok: + mov [maximum_position],ecx + mov edx,[window_position] + or edx,edx + jz window_horizontal_position_ok + add edx,[window_width] + inc ecx + cmp edx,ecx + jbe window_horizontal_position_ok + sub edx,ecx + sub [window_position],edx + jnc window_horizontal_position_ok + mov [window_position],0 + window_horizontal_position_ok: + retn + +let_caret_appear: + mov eax,[caret_position] + cmp eax,[window_position] + jl horizontal_correction + mov ecx,[window_width] + jecxz last_position_ok + dec ecx + last_position_ok: + add ecx,[window_position] + mov eax,[caret_position] + sub eax,ecx + jbe horizontal_ok + add eax,[window_position] + horizontal_correction: + mov [window_position],eax + horizontal_ok: + mov esi,[caret_line] + mov ecx,[caret_line_number] + cmp ecx,[window_line_number] + jl vertical_correction + mov eax,[window_height] + or eax,eax + jz vertical_check + dec eax + vertical_check: + neg eax + add eax,[caret_line_number] + cmp [window_line_number],eax + jge vertical_ok + mov esi,[window_line] + mov ecx,[window_line_number] + vertical_find: + mov esi,[esi] + btr esi,0 + jc vertical_find + inc ecx + cmp ecx,eax + jl vertical_find + vertical_correction: + mov [window_line],esi + mov [window_line_number],ecx + vertical_ok: + retn + +move_line_up: + mov esi,[caret_line] + mov eax,[esi+4] + or eax,eax + jz cannot_move + mov [caret_line],eax + dec [caret_line_number] + clc + retn + cannot_move: + stc + retn + +move_line_down: + mov esi,[caret_line] + find_next_line: + mov eax,[esi] + or eax,eax + jz cannot_move + btr eax,0 + jnc down_ok + mov esi,eax + jmp find_next_line + down_ok: + mov [caret_line],eax + inc [caret_line_number] + clc + retn + +move_page_up: + mov eax,[caret_line_number] + sub eax,[window_height] + ja pgup_caret_ok + mov eax,1 + pgup_caret_ok: + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + mov eax,[window_line_number] + sub eax,[window_height] + ja pgup_window_ok + mov eax,1 + cmp [window_line_number],eax + je moved_ok + pgup_window_ok: + call find_line + mov [window_line],esi + mov [window_line_number],ecx + retn + +move_page_down: + mov eax,[caret_line_number] + add eax,[window_height] + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + mov eax,[window_line_number] + mov ecx,[window_height] + add eax,ecx + mov ebx,[lines_count] + sub ebx,ecx + jbe moved_ok + inc ebx + cmp eax,ebx + jb pgdn_window_ok + mov eax,ebx + cmp [window_line_number],eax + je moved_ok + pgdn_window_ok: + call find_line + mov [window_line],esi + mov [window_line_number],ecx + moved_ok: + retn + +move_to_previous_word: + call get_caret_segment + mov ecx,[caret_position] + sub ecx,edx + cmp edx,SEGMENT_DATA_LENGTH + jbe find_word_to_the_left + mov edx,SEGMENT_DATA_LENGTH + find_word_to_the_left: + sub edx,1 + jc word_in_previous_segment + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jnc find_word_start + jmp find_word_to_the_left + word_in_previous_segment: + mov eax,[esi+4] + or eax,eax + jz previous_word_ok + mov esi,eax + btr esi,0 + jnc word_in_previous_line + mov edx,SEGMENT_DATA_LENGTH + sub ecx,edx + jmp find_word_to_the_left + word_in_previous_line: + mov [caret_line],esi + dec [caret_line_number] + mov edx,SEGMENT_DATA_LENGTH + xor ecx,ecx + find_last_segment: + test byte [esi],1 + jz find_word_to_the_left + mov esi,[esi] + dec esi + add ecx,SEGMENT_DATA_LENGTH + jmp find_last_segment + find_word_start: + sub edx,1 + jc word_on_segment_edge + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jc previous_word_ok + jmp find_word_start + word_on_segment_edge: + mov esi,[esi+4] + btr esi,0 + jnc previous_word_ok + mov edx,SEGMENT_DATA_LENGTH + sub ecx,edx + jmp find_word_start + previous_word_ok: + add ecx,edx + inc ecx + mov [caret_position],ecx + retn + +move_to_next_word: + mov ecx,[caret_position] + sub ecx,edx + find_word_end: + cmp edx,SEGMENT_DATA_LENGTH + jae word_wraps_segment_edge + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jc find_word_to_the_right + add edx,1 + jmp find_word_end + word_wraps_segment_edge: + mov esi,[esi] + or esi,esi + jz move_to_line_end + btr esi,0 + jnc word_in_next_line + add ecx,SEGMENT_DATA_LENGTH + sub edx,SEGMENT_DATA_LENGTH + jmp find_word_end + find_word_to_the_right: + cmp edx,SEGMENT_DATA_LENGTH + jae word_in_next_segment + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jnc next_word_ok + add edx,1 + jmp find_word_to_the_right + word_in_next_segment: + mov esi,[esi] + or esi,esi + jz move_to_line_end + btr esi,0 + jnc word_in_next_line + add ecx,SEGMENT_DATA_LENGTH + sub edx,SEGMENT_DATA_LENGTH + jmp find_word_to_the_right + word_in_next_line: + mov [caret_line],esi + inc [caret_line_number] + xor ecx,ecx + xor edx,edx + jmp find_word_to_the_right + next_word_ok: + add ecx,edx + mov [caret_position],ecx + retn + move_to_line_end: + mov esi,[caret_line] + mov eax,[esi+8] + mov [caret_position],eax + retn + +get_word_at_caret: + call get_caret_segment + mov ebx,[caret_position] + sub ebx,edx + find_left_edge: + or edx,edx + jz left_edge_in_previous_segment + cmp edx,SEGMENT_DATA_LENGTH + ja left_edge_ok + mov al,[esi+SEGMENT_HEADER_LENGTH+edx-1] + call recognize_character + jc left_edge_ok + dec edx + jmp find_left_edge + left_edge_in_previous_segment: + mov esi,[esi+4] + btr esi,0 + jnc left_edge_ok + mov edx,SEGMENT_DATA_LENGTH + sub ebx,edx + jmp find_left_edge + left_edge_ok: + add ebx,edx + call get_caret_segment + mov ecx,[caret_position] + sub ecx,edx + find_right_edge: + cmp edx,SEGMENT_DATA_LENGTH + jae right_edge_in_next_segment + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jc right_edge_ok + inc edx + jmp find_right_edge + right_edge_in_next_segment: + mov esi,[esi] + btr esi,0 + jnc right_edge_ok + xor edx,edx + add ecx,SEGMENT_DATA_LENGTH + jmp find_right_edge + right_edge_ok: + add ecx,edx + sub ecx,ebx + mov edx,ebx + retn diff --git a/fasmw172/SOURCE/IDE/SEARCH.INC b/fasmw172/SOURCE/IDE/SEARCH.INC new file mode 100644 index 0000000..7e3554d --- /dev/null +++ b/fasmw172/SOURCE/IDE/SEARCH.INC @@ -0,0 +1,529 @@ + +; flat editor core +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. + +find_first: + mov [search_flags],eax + call release_search_data + or esi,esi + jz nothing_to_search_for + mov edi,esi + xor al,al + xor ecx,ecx + sub ecx,edi + repne scasb + lea ebx,[edi-1] + sub ebx,esi + jz nothing_to_search_for + lea ecx,[(256+ebx)*4+ebx] + push ebx + call get_memory + or eax,eax + jz not_enough_memory + mov [search_data],eax + mov [search_handle],ebx + pop ebx + mov edi,eax + lea ecx,[256+ebx] + mov eax,ebx + rep stosd + mov ecx,ebx + mov ebx,[search_data] + mov edx,ecx + test [search_flags],FEFIND_BACKWARD + jnz text_for_backward_search + test [search_flags],FEFIND_CASESENSITIVE + jnz copy_search_text + push ebx + mov ebx,upper_case_table + convert_search_text: + lodsb + xlatb + stosb + loop convert_search_text + pop ebx + jmp make_character_shifts_table + copy_search_text: + rep movsb + jmp make_character_shifts_table + text_for_backward_search: + add edi,ecx + mov edx,ecx + push ebx + mov ebx,upper_case_table + reverse_search_text: + lodsb + test [search_flags],FEFIND_CASESENSITIVE + jnz reverse_store_character + xlatb + reverse_store_character: + dec edi + mov [edi],al + dec ecx + jnz reverse_search_text + pop ebx + add edi,edx + xor ecx,ecx + make_character_shifts_table: + cmp edx,ecx + je character_shifts_table_ok + dec edi + jecxz character_shift_ok + mov al,[edi] + cmp [ebx+eax*4],edx + jne character_shift_ok + mov [ebx+eax*4],ecx + character_shift_ok: + inc ecx + jmp make_character_shifts_table + character_shifts_table_ok: + lea edi,[ebx+(256+ecx)*4] + push edi + lea edi,[edi+ecx-2] + movzx eax,byte [edi+1] + mov edx,[ebx+eax*4] + mov [ebx+256*4],edx + cmp ecx,1 + je suffix_match_shifts_table_done + mov ecx,2 + mov esi,edi + sub esi,edx + make_suffix_match_shifts_table: + cmp esi,[esp] + jb store_suffix_match_shift + mov al,[esi] + cmp al,[edi] + je store_suffix_match_shift + find_suffix_match: + dec esi + inc edx + cmp esi,[esp] + jb match_part_of_suffix + push ecx esi edi + repe cmpsb + pop edi esi ecx + jne find_suffix_match + jmp store_suffix_match_shift + match_part_of_suffix: + mov eax,[esp] + push ecx esi edi + xchg eax,esi + sub eax,esi + add ecx,eax + repe cmpsb + pop edi esi ecx + jne suffix_match_shifts_table_done + store_suffix_match_shift: + mov [ebx+256*4+(ecx-1)*4],edx + dec esi + dec edi + inc ecx + cmp ecx,[ebx] + jbe make_suffix_match_shifts_table + suffix_match_shifts_table_done: + pop eax + +find_next: + mov edi,[search_data] + or edi,edi + jz nothing_to_search_for + push [caret_line] + push [caret_line_number] + push [caret_position] + push [selection_position] + test [search_flags],FEFIND_BACKWARD + jnz search_backward + test [search_flags],FEFIND_INWHOLETEXT + jz search_for_text + mov eax,[first_line] + mov [caret_line],eax + xor eax,eax + mov [caret_position],eax + inc eax + mov [caret_line_number],eax + search_for_text: + mov ecx,[edi] + dec ecx + add ecx,[caret_position] + mov esi,[caret_line] + cmp ecx,[peak_line_length] + jae text_not_in_this_line + mov [caret_position],ecx + call get_caret_segment + mov edi,[search_data] + mov eax,[edi] + lea ebx,[edi+(256+eax)*4] + mov ah,[ebx+eax-1] + mov ebx,upper_case_table + search_in_line: + cmp edx,SEGMENT_DATA_LENGTH + jae text_not_in_this_line + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + test [search_flags],FEFIND_CASESENSITIVE + jnz compare_last_character + xlatb + compare_last_character: + cmp al,ah + je partial_match + mismatch_shift: + movzx ecx,al + mov ecx,[edi+ecx*4] + shift_search_position: + add edx,ecx + add ecx,[caret_position] + cmp ecx,[peak_line_length] + jae text_not_in_this_line + mov [caret_position],ecx + check_search_position: + cmp edx,SEGMENT_DATA_LENGTH + jb search_in_line + mov ecx,[esi] + btr ecx,0 + jnc search_in_line + sub edx,SEGMENT_DATA_LENGTH + mov esi,ecx + jmp check_search_position + partial_match: + mov ecx,[edi] + dec ecx + jz text_found + push edi + lea edi,[edi+(256+ecx+1)*4] + lea edi,[edi+ecx] + compare_text: + sub edx,1 + jc compare_in_previous_segment + dec edi + mov al,20h + cmp edx,SEGMENT_DATA_LENGTH + jae compare_character + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + test [search_flags],FEFIND_CASESENSITIVE + jnz compare_character + xlatb + compare_character: + cmp al,[edi] + loope compare_text + pop edi + je text_found + neg ecx + add ecx,[edi] + dec ecx + add edx,ecx + mov ecx,[edi+(256+ecx-1)*4] + jmp shift_search_position + compare_in_previous_segment: + mov esi,[esi+4] + and esi,not 1 + mov edx,SEGMENT_DATA_LENGTH + jmp compare_text + text_not_in_this_line: + mov esi,[esi] + or esi,esi + jz text_not_found + btr esi,0 + jc text_not_in_this_line + search_in_next_line: + mov [caret_line],esi + inc [caret_line_number] + mov [caret_position],0 + mov edi,[search_data] + jmp search_for_text + text_found: + mov eax,[caret_position] + inc eax + mov [selection_position],eax + sub eax,[edi] + mov [caret_position],eax + jz left_text_edge_ok + test [search_flags],FEFIND_WHOLEWORDS + jz left_text_edge_ok + mov edi,[search_data] + mov ecx,[edi] + mov al,[edi+(256+ecx)*4] + call recognize_character + jc left_text_edge_ok + dec [caret_position] + call get_caret_segment + inc [caret_position] + cmp edx,SEGMENT_DATA_LENGTH + jae left_text_edge_ok + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jnc found_not_acceptable + left_text_edge_ok: + mov eax,[caret_position] + xchg eax,[selection_position] + mov [caret_position],eax + mov edi,[search_data] + mov ecx,[edi] + lea edi,[edi+(256+ecx)*4] + mov al,[edi+ecx-1] + cmp al,20h + je right_text_edge_blank + test [search_flags],FEFIND_WHOLEWORDS + jz right_text_edge_ok + call recognize_character + jc right_text_edge_ok + call get_caret_segment + cmp edx,SEGMENT_DATA_LENGTH + jae right_text_edge_ok + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jc right_text_edge_ok + mov eax,[selection_position] + mov [caret_position],eax + found_not_acceptable: + mov edi,[search_data] + mov ecx,[edi] + mov eax,[edi+(256+ecx-1)*4] + add [caret_position],eax + jmp search_for_text + right_text_edge_blank: + call get_caret_segment + check_for_blank_end: + mov ecx,SEGMENT_DATA_LENGTH + sub ecx,edx + jz blank_end_next_segment + push edi + mov al,20h + lea edi,[esi+SEGMENT_HEADER_LENGTH+edx] + repe scasb + pop edi + jne right_text_edge_ok + blank_end_next_segment: + mov esi,[esi] + or esi,esi + jz text_not_found + btr esi,0 + jnc search_in_next_line + xor edx,edx + jmp check_for_blank_end + right_text_edge_ok: + mov eax,[caret_line] + mov ecx,[caret_line_number] + mov [selection_line],eax + mov [selection_line_number],ecx + and [search_flags],not FEFIND_INWHOLETEXT + add esp,16 + clc + retn + text_not_found: + pop [selection_position] + pop [caret_position] + pop [caret_line_number] + pop [caret_line] + nothing_to_search_for: + stc + retn + search_backward: + test [search_flags],FEFIND_INWHOLETEXT + jz backward_search_for_text + or eax,-1 + call find_line + mov [caret_line],esi + mov [caret_line_number],ecx + call move_to_line_end + backward_search_for_text: + mov ecx,[caret_position] + sub ecx,1 + jc backward_text_not_in_this_line + mov [caret_position],ecx + mov edi,[search_data] + mov eax,[edi] + mov al,[edi+(256+eax)*4] + cmp al,20h + jne backward_search_starting_position_ok + mov esi,[caret_line] + mov ecx,[esi+8] + mov edi,[search_data] + mov eax,[edi] + sub ecx,eax + jc backward_text_not_in_this_line + cmp ecx,[caret_position] + jae backward_search_starting_position_ok + mov [caret_position],ecx + backward_search_starting_position_ok: + call get_caret_segment + mov edi,[search_data] + mov eax,[edi] + lea ebx,[edi+(256+eax)*4] + mov ah,[ebx+eax-1] + mov ebx,upper_case_table + cmp edx,SEGMENT_DATA_LENGTH + jb backward_search_in_line + mov ecx,edx + sub ecx,SEGMENT_DATA_LENGTH-1 + sub edx,ecx + sub [caret_position],ecx + backward_search_in_line: + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + test [search_flags],FEFIND_CASESENSITIVE + jnz compare_first_character + xlatb + compare_first_character: + cmp al,ah + je backward_partial_match + backward_mismatch_shift: + movzx ecx,al + mov ecx,[edi+ecx*4] + shift_backward_search_position: + sub edx,ecx + sub [caret_position],ecx + jc backward_text_not_in_this_line + check_backward_search_position: + cmp edx,0 + jge backward_search_in_line + mov esi,[esi+4] + and esi,not 1 + add edx,SEGMENT_DATA_LENGTH + jmp check_backward_search_position + backward_partial_match: + mov ecx,[edi] + dec ecx + jz backward_text_found + push edi + lea edi,[edi+(256+ecx+1)*4] + lea edi,[edi+ecx] + backward_compare_text: + inc edx + cmp edx,SEGMENT_DATA_LENGTH + jae compare_in_next_segment + dec edi + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + test [search_flags],FEFIND_CASESENSITIVE + jnz backward_compare_character + xlatb + backward_compare_character: + cmp al,[edi] + loope backward_compare_text + pop edi + je backward_text_found + neg ecx + add ecx,[edi] + dec ecx + sub edx,ecx + mov ecx,[edi+(256+ecx)*4] + jmp shift_backward_search_position + compare_in_next_segment: + sub edx,SEGMENT_DATA_LENGTH + mov esi,[esi] + btr esi,0 + jnc compare_blank_space + dec edx + jmp backward_compare_text + compare_blank_space: + pop edi + cmp ecx,[edi] + jbe backward_text_found + backward_text_not_in_this_line: + mov esi,[caret_line] + mov esi,[esi+4] + or esi,esi + jz text_not_found + mov [caret_line],esi + dec [caret_line_number] + mov ecx,[peak_line_length] + mov [caret_position],ecx + jmp backward_search_for_text + backward_text_found: + test [search_flags],FEFIND_WHOLEWORDS + jz backward_left_text_edge_ok + cmp [caret_position],0 + je backward_left_text_edge_ok + mov edi,[search_data] + mov ecx,[edi] + lea edi,[edi+(256+ecx)*4] + mov al,[edi+ecx-1] + call recognize_character + jc backward_left_text_edge_ok + dec [caret_position] + call get_caret_segment + inc [caret_position] + cmp edx,SEGMENT_DATA_LENGTH + jae backward_left_text_edge_ok + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jnc backward_found_not_acceptable + backward_left_text_edge_ok: + mov eax,[caret_position] + mov [selection_position],eax + mov edi,[search_data] + mov ecx,[edi] + add eax,ecx + mov [caret_position],eax + test [search_flags],FEFIND_WHOLEWORDS + jz backward_right_text_edge_ok + mov al,[edi+(256+ecx)*4] + call recognize_character + jc backward_right_text_edge_ok + call get_caret_segment + cmp edx,SEGMENT_DATA_LENGTH + jae backward_right_text_edge_ok + mov al,[esi+SEGMENT_HEADER_LENGTH+edx] + call recognize_character + jc backward_right_text_edge_ok + mov eax,[selection_position] + mov [caret_position],eax + backward_found_not_acceptable: + mov edi,[search_data] + mov ecx,[edi] + mov eax,[edi+(256+ecx-1)*4] + sub [caret_position],eax + jbe backward_text_not_in_this_line + jmp backward_search_for_text + backward_right_text_edge_ok: + mov eax,[caret_position] + xchg eax,[selection_position] + mov [caret_position],eax + mov eax,[caret_line] + mov ecx,[caret_line_number] + mov [selection_line],eax + mov [selection_line_number],ecx + and [search_flags],not FEFIND_INWHOLETEXT + add esp,16 + clc + retn + +get_search_text_length: + mov ecx,[search_data] + test ecx,ecx + jz no_search_text + mov ecx,[ecx] + clc + retn +get_search_text: + mov esi,[search_data] + test esi,esi + jz no_search_text + mov ecx,[esi] + lea esi,[esi+(256+ecx)*4] + test [search_flags],FEFIND_BACKWARD + jnz copy_inverted_text + rep movsb + xor al,al + stosb + clc + retn + copy_inverted_text: + mov al,[esi+ecx-1] + stosb + loop copy_inverted_text + xor al,al + stosb + clc + retn + no_search_text: + stc + retn + +release_search_data: + mov edi,[search_data] + test edi,edi + jz search_data_released + mov eax,[search_handle] + call release_memory + mov [search_data],0 + search_data_released: + retn diff --git a/fasmw172/SOURCE/IDE/UNDO.INC b/fasmw172/SOURCE/IDE/UNDO.INC new file mode 100644 index 0000000..65e2790 --- /dev/null +++ b/fasmw172/SOURCE/IDE/UNDO.INC @@ -0,0 +1,339 @@ + +; flat editor core +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. + +store_status_for_undo: + pusha + test [editor_mode],FEMODE_NOUNDO + jnz undo_disabled + call clear_redo_data + call allocate_segment + jc not_enough_memory + mov dword [eax],0 + mov edi,eax + xchg eax,[undo_data] + push eax edi + call allocate_segment + pop edi + jnc store_editor_status + xor eax,eax + stosd + jmp not_enough_memory + store_editor_status: + mov dword [eax],0 + mov dword [eax+4],0 + stosd + pop eax + stosd + lea esi,[editor_status] + mov ecx,editor_status_size shr 2 + rep movsd + mov esi,[lengths_table] + store_lengths_table: + call store_segment_for_undo + mov esi,[esi] + or esi,esi + jnz store_lengths_table + popa + store_status_for_undo_ok: + retn + undo_disabled: + call clear_redo_data + call clear_undo_data + or [unmodified_state],-1 + popa + retn + +store_segment_for_undo: + pusha + or esi,esi + jz segment_for_undo_done + call clear_redo_data + mov esi,[undo_data] + or esi,esi + jz segment_for_undo_done + mov ebx,[esi] + mov eax,[esp+4] + call prepare_slot_for_undo_storage + jc segment_for_undo_done + push edi + call allocate_segment + pop edi + mov ebx,eax + stosd + mov eax,[esp+4] + stosd + jc memory_shortage + mov esi,eax + mov edi,ebx + mov ecx,SEGMENT_LENGTH shr 2 + rep movsd + segment_for_undo_done: + popa + store_segment_for_undo_ok: + retn + prepare_slot_for_undo_storage: + mov esi,[undo_data] + mov esi,[esi] + mov ecx,[esi+4] + lea edi,[esi+8] + repne scasd + jne get_free_slot + stc + retn + get_free_slot: + mov ecx,[esi+4] + lea edi,[esi+8+ecx*8] + inc ecx + cmp ecx,SEGMENT_DATA_LENGTH/8 + jbe slot_ok + push esi + call allocate_segment + jc memory_shortage + mov esi,eax + mov ebx,[undo_data] + mov [ebx],esi + pop dword [esi] + mov ecx,1 + lea edi,[esi+8] + slot_ok: + mov [esi+4],ecx + clc + retn + +store_allocated_segment_for_undo: + pusha + call clear_redo_data + mov eax,[esp+1Ch] + xor edx,edx + mov [eax],edx + mov esi,[undo_data] + or esi,esi + jz segment_for_undo_done + call prepare_slot_for_undo_storage + jc segment_for_undo_done + xor eax,eax + stosd + mov eax,[esp+1Ch] + stosd + popa + retn + +store_freed_segment_for_undo: + pusha + call clear_redo_data + mov esi,[undo_data] + or esi,esi + jz segment_for_undo_done + call prepare_slot_for_undo_storage + jc segment_for_undo_done + mov eax,[esp+4] + stosd + xor eax,eax + stosd + popa + retn + +undo_changes: + mov esi,[undo_data] + or esi,esi + jz undo_ok + mov ebx,[esi] + mov eax,[redo_data] + xchg eax,[esi+4] + mov [undo_data],eax + mov [redo_data],esi + add esi,8 + lea edi,[editor_status] + mov ecx,editor_status_size shr 2 + call exchange_data + xor edx,edx + segments_block: + or ebx,ebx + jz undo_finished + mov esi,ebx + xchg ebx,edx + xchg ebx,[esi] + add esi,4 + lodsd + mov ecx,eax + jecxz undo_finished + lea esi,[esi+ecx*8] + restore_segments: + sub esi,8 + push esi ecx + mov edi,[esi+4] + mov esi,[esi] + or edi,edi + jz restore_next + or esi,esi + jz restore_next + mov ecx,SEGMENT_LENGTH shr 2 + call exchange_data + restore_next: + pop ecx esi + loop restore_segments + jmp segments_block + undo_finished: + mov esi,[redo_data] + mov [esi],edx + undo_ok: + retn + exchange_data: + mov eax,[esi] + xchg eax,[edi] + mov [esi],eax + add esi,4 + add edi,4 + loop exchange_data + retn + +redo_changes: + mov esi,[redo_data] + or esi,esi + jz redo_ok + mov ebx,[esi] + mov eax,[undo_data] + xchg eax,[esi+4] + mov [redo_data],eax + mov [undo_data],esi + add esi,8 + lea edi,[editor_status] + mov ecx,editor_status_size shr 2 + call exchange_data + xor edx,edx + redo_segments_block: + or ebx,ebx + jz redo_finished + mov esi,ebx + xchg ebx,edx + xchg ebx,[esi] + add esi,4 + lodsd + mov ecx,eax + jecxz redo_finished + redo_segments: + push esi ecx + mov edi,[esi+4] + mov esi,[esi] + or edi,edi + jz redo_next + or esi,esi + jz redo_next + mov ecx,SEGMENT_LENGTH shr 2 + call exchange_data + redo_next: + pop ecx esi + add esi,8 + loop redo_segments + jmp redo_segments_block + redo_finished: + mov esi,[undo_data] + mov [esi],edx + redo_ok: + retn + +clear_redo_data: + mov esi,[redo_data] + or esi,esi + jz redo_data_ok + clear_redo_block: + or ebx,-1 + xchg ebx,[esi] + inc [released_segments] + mov eax,[esi+4] + mov [redo_data],eax + clear_redo_segments: + or ebx,ebx + jz next_redo_block + mov esi,ebx + or ebx,-1 + xchg ebx,[esi] + inc [released_segments] + add esi,4 + lodsd + mov ecx,eax + jecxz next_redo_block + release_redo_segments: + push esi ecx + mov edi,[esi+4] + mov esi,[esi] + or edi,edi + jz release_next_segment + or eax,-1 + or esi,esi + jnz release_data + xchg eax,[edi] + jmp data_released + release_data: + xchg eax,[esi] + data_released: + cmp eax,-1 + je release_next_segment + inc [released_segments] + release_next_segment: + pop ecx esi + add esi,8 + loop release_redo_segments + jmp clear_redo_segments + next_redo_block: + mov esi,[redo_data] + or esi,esi + je redo_data_ok + cmp esi,[unmodified_state] + jne clear_redo_block + mov [unmodified_state],-1 + jmp clear_redo_block + redo_data_ok: + retn + +clear_undo_data: + mov esi,[undo_data] + push esi + clear_undo_block: + or esi,esi + jz undo_data_ok + or ebx,-1 + xchg ebx,[esi] + inc [released_segments] + add esi,4 + lodsd + mov [undo_data],eax + clear_undo_segments: + or ebx,ebx + jz next_undo_block + mov esi,ebx + or ebx,-1 + xchg ebx,[esi] + inc [released_segments] + add esi,4 + lodsd + mov ecx,eax + jecxz next_undo_block + lea esi,[esi+ecx*8] + release_segments: + sub esi,8 + mov edx,[esi] + or edx,edx + jz release_next + or eax,-1 + xchg [edx],eax + cmp eax,-1 + je release_next + inc [released_segments] + release_next: + loop release_segments + next_undo_block: + mov esi,[undo_data] + cmp esi,[unmodified_state] + jne clear_undo_block + or [unmodified_state],-1 + jmp clear_undo_block + undo_data_ok: + pop esi + cmp esi,[unmodified_state] + jne unmodified_ok + mov [unmodified_state],0 + unmodified_ok: + retn diff --git a/fasmw172/SOURCE/IDE/VARIABLE.INC b/fasmw172/SOURCE/IDE/VARIABLE.INC new file mode 100644 index 0000000..88661d9 --- /dev/null +++ b/fasmw172/SOURCE/IDE/VARIABLE.INC @@ -0,0 +1,40 @@ + +; flat editor core +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. + +editor_memory dd ? + +label editor_status + +first_line dd ? +lines_count dd ? +peak_line_length dd ? +maximum_position dd ? +window_line dd ? +window_position dd ? +window_line_number dd ? +caret_line dd ? +caret_position dd ? +caret_line_number dd ? +selection_line dd ? +selection_position dd ? +selection_line_number dd ? +editor_mode dd ? + +editor_status_size = $ - editor_status + +window_width dd ? +window_height dd ? +unallocated_segments dd ? +unallocated_segments_end dd ? +released_segments dd ? +memory_search_block dd ? +memory_search_segment dd ? +lengths_table dd ? +undo_data dd ? +redo_data dd ? +search_data dd ? +search_flags dd ? +search_handle dd ? +unmodified_state dd ? diff --git a/fasmw172/SOURCE/IDE/VERSION.INC b/fasmw172/SOURCE/IDE/VERSION.INC new file mode 100644 index 0000000..3afe63d --- /dev/null +++ b/fasmw172/SOURCE/IDE/VERSION.INC @@ -0,0 +1,39 @@ + +; flat editor version 3.12 +; Copyright (c) 1999-2015, Tomasz Grysztar. +; All rights reserved. +; +; This programs is free for commercial and non-commercial use as long as +; the following conditions are adhered to. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are +; met: +; +; 1. Redistributions of source code must retain the above copyright notice, +; this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; +; The licence and distribution terms for any publically available +; version or derivative of this code cannot be changed. i.e. this code +; cannot simply be copied and put under another distribution licence +; (including the GNU Public Licence). + +FEDIT_VERSION_STRING equ "3.12" + +FEDIT_VERSION_MAJOR = 3 +FEDIT_VERSION_MINOR = 12 diff --git a/fasmw172/SOURCE/LIBC/FASM.ASM b/fasmw172/SOURCE/LIBC/FASM.ASM new file mode 100644 index 0000000..35881b0 --- /dev/null +++ b/fasmw172/SOURCE/LIBC/FASM.ASM @@ -0,0 +1,362 @@ + +; flat assembler interface for Unix/libc +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + + format ELF + public main + +macro ccall proc,[arg] + { common + local size + size = 0 + mov ebp,esp + if ~ arg eq + forward + size = size + 4 + common + sub esp,size + end if + and esp,-16 + if ~ arg eq + add esp,size + reverse + pushd arg + common + end if + call proc + mov esp,ebp } + +extrn gettimeofday + +section '.text' executable align 16 + +main: + mov ecx,[esp+4] + mov [argc],ecx + mov ebx,[esp+8] + mov [argv],ebx + push ebp + mov [stack_frame],esp + + mov [con_handle],1 + mov esi,_logo + call display_string + + call get_params + jc information + + call init_memory + + mov esi,_memory_prefix + call display_string + mov eax,[memory_end] + sub eax,[memory_start] + add eax,[additional_memory_end] + sub eax,[additional_memory] + shr eax,10 + call display_number + mov esi,_memory_suffix + call display_string + + ccall gettimeofday,buffer,0 + mov eax,dword [buffer] + mov ecx,1000 + mul ecx + mov ebx,eax + mov eax,dword [buffer+4] + div ecx + add eax,ebx + mov [start_time],eax + + and [preprocessing_done],0 + call preprocessor + or [preprocessing_done],-1 + call parser + call assembler + call formatter + + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + ccall gettimeofday,buffer,0 + mov eax,dword [buffer] + mov ecx,1000 + mul ecx + mov ebx,eax + mov eax,dword [buffer+4] + div ecx + add eax,ebx + sub eax,[start_time] + jnc time_ok + add eax,3600000 + time_ok: + xor edx,edx + mov ebx,100 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov dl,'.' + call display_character + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + jmp exit_program + +information: + mov esi,_usage + call display_string + mov al,1 + jmp exit_program + +get_params: + mov [input_file],0 + mov [output_file],0 + mov [symbols_file],0 + mov [memory_setting],0 + mov [passes_limit],100 + + mov ecx,[argc] + mov ebx,[argv] + add ebx,4 + dec ecx + jz bad_params + mov [definitions_pointer],predefinitions + get_param: + mov esi,[ebx] + mov al,[esi] + cmp al,'-' + je option_param + cmp [input_file],0 + jne get_output_file + mov [input_file],esi + jmp next_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],esi + jmp next_param + option_param: + inc esi + lodsb + cmp al,'m' + je memory_option + cmp al,'M' + je memory_option + cmp al,'p' + je passes_option + cmp al,'P' + je passes_option + cmp al,'d' + je definition_option + cmp al,'D' + je definition_option + cmp al,'s' + je symbols_option + cmp al,'S' + je symbols_option + bad_params: + stc + ret + memory_option: + cmp byte [esi],0 + jne get_memory_setting + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_memory_setting: + call get_option_value + or edx,edx + jz bad_params + cmp edx,1 shl (32-10) + jae bad_params + mov [memory_setting],edx + jmp next_param + passes_option: + cmp byte [esi],0 + jne get_passes_setting + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_passes_setting: + call get_option_value + or edx,edx + jz bad_params + cmp edx,10000h + ja bad_params + mov [passes_limit],dx + next_param: + add ebx,4 + dec ecx + jnz get_param + cmp [input_file],0 + je bad_params + mov eax,[definitions_pointer] + mov byte [eax],0 + mov [initial_definitions],predefinitions + clc + ret + definition_option: + cmp byte [esi],0 + jne get_definition + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_definition: + push edi + mov edi,[definitions_pointer] + call convert_definition_option + mov [definitions_pointer],edi + pop edi + jc bad_params + jmp next_param + symbols_option: + cmp byte [esi],0 + jne get_symbols_setting + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_symbols_setting: + mov [symbols_file],esi + jmp next_param + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + invalid_option_value: + stc + ret + convert_definition_option: + mov edx,edi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + copy_definition_name: + lodsb + cmp al,'=' + je copy_definition_value + cmp al,20h + je bad_definition_option + or al,al + jz bad_definition_option + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + inc byte [edx] + jnz copy_definition_name + bad_definition_option: + stc + ret + copy_definition_value: + lodsb + cmp al,20h + je definition_value_end + or al,al + jz definition_value_end + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + jmp copy_definition_value + definition_value_end: + dec esi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + clc + ret + +include 'system.inc' + +include '..\version.inc' + +_copyright db 'Copyright (c) 1999-2017, Tomasz Grysztar',0xA,0 + +_logo db 'flat assembler version ',VERSION_STRING,0 +_usage db 0xA + db 'usage: fasm <source> [output]',0xA + db 'optional settings:',0xA + db ' -m <limit> set the limit in kilobytes for the available memory',0xA + db ' -p <limit> set the maximum allowed number of passes',0xA + db ' -d <name>=<value> define symbolic variable',0xA + db ' -s <file> dump symbolic information for debugging',0xA + db 0 +_memory_prefix db ' (',0 +_memory_suffix db ' kilobytes memory)',0xA,0 +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',0xA,0 + +include '..\errors.inc' +include '..\symbdump.inc' +include '..\preproce.inc' +include '..\parser.inc' +include '..\exprpars.inc' +include '..\assemble.inc' +include '..\exprcalc.inc' +include '..\formats.inc' +include '..\x86_64.inc' +include '..\avx.inc' + +include '..\tables.inc' +include '..\messages.inc' + +section '.bss' writeable align 4 + +include '..\variable.inc' + +argc dd ? +argv dd ? +stack_frame dd ? +memory_setting dd ? +definitions_pointer dd ? +start_time dd ? +timestamp dq ? +con_handle dd ? +displayed_count dd ? +last_displayed db ? +character db ? +preprocessing_done db ? + +predefinitions rb 1000h +buffer rb 1000h diff --git a/fasmw172/SOURCE/LIBC/SYSTEM.INC b/fasmw172/SOURCE/LIBC/SYSTEM.INC new file mode 100644 index 0000000..f16f92a --- /dev/null +++ b/fasmw172/SOURCE/LIBC/SYSTEM.INC @@ -0,0 +1,410 @@ + +; flat assembler interface for Unix/libc +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +extrn malloc +extrn free +extrn getenv +extrn fopen +extrn fclose +extrn fread +extrn fwrite +extrn fseek +extrn ftell +extrn time +extrn exit + +extrn 'write' as libc_write + +init_memory: + mov eax,esp + and eax,not 0FFFh + add eax,1000h-10000h + mov [stack_limit],eax + mov ecx,[memory_setting] + shl ecx,10 + jnz allocate_memory + mov ecx,1000000h + allocate_memory: + mov [memory_setting],ecx + ccall malloc,ecx + or eax,eax + jz out_of_memory + mov [additional_memory],eax + add eax,[memory_setting] + mov [memory_end],eax + mov eax,[memory_setting] + shr eax,2 + add eax,[additional_memory] + mov [additional_memory_end],eax + mov [memory_start],eax + ret + +exit_program: + movzx eax,al + push eax + ccall free,[additional_memory] + pop eax + ccall exit,eax + mov esp,[stack_frame] + pop ebp + ret + +get_environment_variable: + ccall getenv,esi + mov esi,eax + or eax,eax + jz no_environment_variable + copy_variable_value: + lodsb + cmp edi,[memory_end] + jae out_of_memory + stosb + or al,al + jnz copy_variable_value + dec edi + ret + no_environment_variable: + stosb + dec edi + ret + +open: + push esi edi ebp + call adapt_path + ccall fopen,buffer,open_mode + pop ebp edi esi + or eax,eax + jz file_error + mov ebx,eax + clc + ret + adapt_path: + mov esi,edx + mov edi,buffer + copy_path: + lods byte [esi] + cmp al,'\' + jne path_char_ok + mov al,'/' + path_char_ok: + stos byte [edi] + or al,al + jnz copy_path + cmp edi,buffer+1000h + ja out_of_memory + ret +create: + push esi edi ebp + call adapt_path + ccall fopen,buffer,create_mode + pop ebp edi esi + or eax,eax + jz file_error + mov ebx,eax + clc + ret +close: + ccall fclose,ebx + ret +read: + push ebx ecx edx esi edi ebp + ccall fread,edx,1,ecx,ebx + pop ebp edi esi edx ecx ebx + cmp eax,ecx + jne file_error + clc + ret + file_error: + stc + ret +write: + push ebx ecx edx esi edi ebp + ccall fwrite,edx,1,ecx,ebx + pop ebp edi esi edx ecx ebx + cmp eax,ecx + jne file_error + clc + ret +lseek: + push ebx + movzx eax,al + ccall fseek,ebx,edx,eax + test eax,eax + jnz lseek_error + mov ebx,[esp] + ccall ftell,ebx + pop ebx + clc + ret + lseek_error: + pop ebx + stc + ret + +display_string: + lodsb + or al,al + jz string_displayed + mov dl,al + call display_character + jmp display_string + string_displayed: + ret +display_character: + mov [character],dl + ccall libc_write,[con_handle],character,1 + ret +display_number: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + push edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + push ebx ecx + call display_character + pop ecx ebx + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz display_loop + pop ebx + ret + +display_user_messages: + mov [displayed_count],0 + call show_display_buffer + cmp [displayed_count],0 + je line_break_ok + cmp [last_displayed],0Ah + je line_break_ok + mov dl,0Ah + call display_character + line_break_ok: + ret +display_block: + jecxz block_displayed + add [displayed_count],ecx + mov al,[esi+ecx-1] + mov [last_displayed],al + display_characters: + lodsb + mov dl,al + push ecx esi + call display_character + pop esi ecx + loop display_characters + block_displayed: + ret + +fatal_error: + mov [con_handle],2 + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,0FFh + jmp exit_program +assembler_error: + mov [con_handle],2 + call display_user_messages + mov ebx,[current_line] + test ebx,ebx + jz display_error_message + push dword 0 + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + call display_character + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + jz line_data_displayed + push eax + xor al,al + call lseek + mov ecx,[esp] + mov edx,[additional_memory] + lea eax,[edx+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + call read + call close + pop ecx + mov esi,[additional_memory] + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + display_line_data: + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + line_data_displayed: + mov esi,lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + cmp [preprocessing_done],0 + je display_error_message + mov esi,preprocessed_instruction_prefix + call display_string + mov esi,[current_line] + add esi,16 + mov edi,[additional_memory] + xor dl,dl + convert_instruction: + lodsb + cmp al,1Ah + je copy_symbol + cmp al,22h + je copy_symbol + cmp al,3Bh + je instruction_converted + stosb + or al,al + jz instruction_converted + xor dl,dl + jmp convert_instruction + copy_symbol: + or dl,dl + jz space_ok + mov byte [edi],20h + inc edi + space_ok: + cmp al,22h + je quoted + lodsb + movzx ecx,al + rep movsb + or dl,-1 + jmp convert_instruction + quoted: + mov al,27h + stosb + lodsd + mov ecx,eax + jecxz quoted_copied + copy_quoted: + lodsb + stosb + cmp al,27h + jne quote_ok + stosb + quote_ok: + loop copy_quoted + quoted_copied: + mov al,27h + stosb + or dl,-1 + jmp convert_instruction + instruction_converted: + xor al,al + stosb + mov esi,[additional_memory] + call display_string + mov esi,lf + call display_string + display_error_message: + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,2 + jmp exit_program + +make_timestamp: + ccall time,timestamp + mov eax,dword [timestamp] + mov edx,dword [timestamp+4] + ret + +open_mode db 'r',0 +create_mode db 'w',0 + +error_prefix db 'error: ',0 +error_suffix db '.' +lf db 0xA,0 +line_number_start db ' [',0 +line_data_start db ':',0xA,0 +preprocessed_instruction_prefix db 'processed: ',0 diff --git a/fasmw172/SOURCE/LINUX/FASM.ASM b/fasmw172/SOURCE/LINUX/FASM.ASM new file mode 100644 index 0000000..532be7c --- /dev/null +++ b/fasmw172/SOURCE/LINUX/FASM.ASM @@ -0,0 +1,341 @@ + +; flat assembler interface for Linux +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + + format ELF executable 3 + entry start + +segment readable executable + +start: + + mov [con_handle],1 + mov esi,_logo + call display_string + + mov [command_line],esp + mov ecx,[esp] + mov ebx,[esp+4+ecx*4+4] + mov [environment],ebx + call get_params + jc information + + call init_memory + + mov esi,_memory_prefix + call display_string + mov eax,[memory_end] + sub eax,[memory_start] + add eax,[additional_memory_end] + sub eax,[additional_memory] + shr eax,10 + call display_number + mov esi,_memory_suffix + call display_string + + mov eax,78 + mov ebx,buffer + xor ecx,ecx + int 0x80 + mov eax,dword [buffer] + mov ecx,1000 + mul ecx + mov ebx,eax + mov eax,dword [buffer+4] + div ecx + add eax,ebx + mov [start_time],eax + + and [preprocessing_done],0 + call preprocessor + or [preprocessing_done],-1 + call parser + call assembler + call formatter + + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + mov eax,78 + mov ebx,buffer + xor ecx,ecx + int 0x80 + mov eax,dword [buffer] + mov ecx,1000 + mul ecx + mov ebx,eax + mov eax,dword [buffer+4] + div ecx + add eax,ebx + sub eax,[start_time] + jnc time_ok + add eax,3600000 + time_ok: + xor edx,edx + mov ebx,100 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov dl,'.' + call display_character + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + jmp exit_program + +information: + mov esi,_usage + call display_string + mov al,1 + jmp exit_program + +get_params: + mov ebx,[command_line] + mov [input_file],0 + mov [output_file],0 + mov [symbols_file],0 + mov [memory_setting],0 + mov [passes_limit],100 + mov ecx,[ebx] + add ebx,8 + dec ecx + jz bad_params + mov [definitions_pointer],predefinitions + get_param: + mov esi,[ebx] + mov al,[esi] + cmp al,'-' + je option_param + cmp [input_file],0 + jne get_output_file + mov [input_file],esi + jmp next_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],esi + jmp next_param + option_param: + inc esi + lodsb + cmp al,'m' + je memory_option + cmp al,'M' + je memory_option + cmp al,'p' + je passes_option + cmp al,'P' + je passes_option + cmp al,'d' + je definition_option + cmp al,'D' + je definition_option + cmp al,'s' + je symbols_option + cmp al,'S' + je symbols_option + bad_params: + stc + ret + memory_option: + cmp byte [esi],0 + jne get_memory_setting + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_memory_setting: + call get_option_value + or edx,edx + jz bad_params + cmp edx,1 shl (32-10) + jae bad_params + mov [memory_setting],edx + jmp next_param + passes_option: + cmp byte [esi],0 + jne get_passes_setting + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_passes_setting: + call get_option_value + or edx,edx + jz bad_params + cmp edx,10000h + ja bad_params + mov [passes_limit],dx + next_param: + add ebx,4 + dec ecx + jnz get_param + cmp [input_file],0 + je bad_params + mov eax,[definitions_pointer] + mov byte [eax],0 + mov [initial_definitions],predefinitions + clc + ret + definition_option: + cmp byte [esi],0 + jne get_definition + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_definition: + push edi + mov edi,[definitions_pointer] + call convert_definition_option + mov [definitions_pointer],edi + pop edi + jc bad_params + jmp next_param + symbols_option: + cmp byte [esi],0 + jne get_symbols_setting + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_symbols_setting: + mov [symbols_file],esi + jmp next_param + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + invalid_option_value: + stc + ret + convert_definition_option: + mov edx,edi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + copy_definition_name: + lodsb + cmp al,'=' + je copy_definition_value + cmp al,20h + je bad_definition_option + or al,al + jz bad_definition_option + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + inc byte [edx] + jnz copy_definition_name + bad_definition_option: + stc + ret + copy_definition_value: + lodsb + cmp al,20h + je definition_value_end + or al,al + jz definition_value_end + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + jmp copy_definition_value + definition_value_end: + dec esi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + clc + ret + +include 'system.inc' + +include '..\version.inc' + +_copyright db 'Copyright (c) 1999-2017, Tomasz Grysztar',0xA,0 + +_logo db 'flat assembler version ',VERSION_STRING,0 +_usage db 0xA + db 'usage: fasm <source> [output]',0xA + db 'optional settings:',0xA + db ' -m <limit> set the limit in kilobytes for the available memory',0xA + db ' -p <limit> set the maximum allowed number of passes',0xA + db ' -d <name>=<value> define symbolic variable',0xA + db ' -s <file> dump symbolic information for debugging',0xA + db 0 +_memory_prefix db ' (',0 +_memory_suffix db ' kilobytes memory)',0xA,0 +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',0xA,0 + +include '..\errors.inc' +include '..\symbdump.inc' +include '..\preproce.inc' +include '..\parser.inc' +include '..\exprpars.inc' +include '..\assemble.inc' +include '..\exprcalc.inc' +include '..\formats.inc' +include '..\x86_64.inc' +include '..\avx.inc' + +include '..\tables.inc' +include '..\messages.inc' + +segment readable writeable + +align 4 + +include '..\variable.inc' + +command_line dd ? +memory_setting dd ? +definitions_pointer dd ? +environment dd ? +timestamp dq ? +start_time dd ? +con_handle dd ? +displayed_count dd ? +last_displayed db ? +character db ? +preprocessing_done db ? + +predefinitions rb 1000h +buffer rb 1000h diff --git a/fasmw172/SOURCE/LINUX/SYSTEM.INC b/fasmw172/SOURCE/LINUX/SYSTEM.INC new file mode 100644 index 0000000..eec75fd --- /dev/null +++ b/fasmw172/SOURCE/LINUX/SYSTEM.INC @@ -0,0 +1,469 @@ + +; flat assembler interface for Linux +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +O_ACCMODE = 0003o +O_RDONLY = 0000o +O_WRONLY = 0001o +O_RDWR = 0002o +O_CREAT = 0100o +O_EXCL = 0200o +O_NOCTTY = 0400o +O_TRUNC = 1000o +O_APPEND = 2000o +O_NONBLOCK = 4000o + +S_ISUID = 4000o +S_ISGID = 2000o +S_ISVTX = 1000o +S_IRUSR = 0400o +S_IWUSR = 0200o +S_IXUSR = 0100o +S_IRGRP = 0040o +S_IWGRP = 0020o +S_IXGRP = 0010o +S_IROTH = 0004o +S_IWOTH = 0002o +S_IXOTH = 0001o + +init_memory: + mov eax,esp + and eax,not 0FFFh + add eax,1000h-10000h + mov [stack_limit],eax + xor ebx,ebx + mov eax,45 + int 0x80 + mov [additional_memory],eax + mov ecx,[memory_setting] + shl ecx,10 + jnz allocate_memory + mov ecx,1000000h + allocate_memory: + mov ebx,[additional_memory] + add ebx,ecx + mov eax,45 + int 0x80 + mov [memory_end],eax + sub eax,[additional_memory] + shr eax,2 + add eax,[additional_memory] + mov [additional_memory_end],eax + mov [memory_start],eax + ret + +exit_program: + movzx ebx,al + mov eax,1 + int 0x80 + +get_environment_variable: + mov ebx,esi + mov esi,[environment] + compare_variable_names: + mov edx,ebx + compare_character: + lodsb + mov ah,[edx] + inc edx + cmp al,'=' + je end_of_variable_name + or ah,ah + jz next_variable + sub ah,al + jz compare_character + cmp ah,20h + jne next_variable + cmp al,41h + jb next_variable + cmp al,5Ah + jna compare_character + next_variable: + lodsb + or al,al + jnz next_variable + cmp byte [esi],0 + jne compare_variable_names + ret + end_of_variable_name: + or ah,ah + jnz next_variable + copy_variable_value: + lodsb + cmp edi,[memory_end] + jae out_of_memory + stosb + or al,al + jnz copy_variable_value + dec edi + ret + +open: + push esi edi ebp + call adapt_path + mov eax,5 + mov ebx,buffer + mov ecx,O_RDONLY + xor edx,edx + int 0x80 + pop ebp edi esi + test eax,eax + js file_error + mov ebx,eax + clc + ret + adapt_path: + mov esi,edx + mov edi,buffer + copy_path: + lods byte [esi] + cmp al,'\' + jne path_char_ok + mov al,'/' + path_char_ok: + stos byte [edi] + or al,al + jnz copy_path + cmp edi,buffer+1000h + ja out_of_memory + ret +create: + push esi edi ebp edx + call adapt_path + mov ebx,buffer + mov ecx,O_CREAT+O_TRUNC+O_WRONLY + mov edx,S_IRUSR+S_IWUSR+S_IRGRP+S_IROTH + pop eax + cmp eax,[output_file] + jne do_create + cmp [output_format],5 + jne do_create + bt [format_flags],0 + jnc do_create + or edx,S_IXUSR+S_IXGRP+S_IXOTH + do_create: + mov eax,5 + int 0x80 + pop ebp edi esi + test eax,eax + js file_error + mov ebx,eax + clc + ret +close: + mov eax,6 + int 0x80 + ret +read: + push ecx edx esi edi ebp + mov eax,3 + xchg ecx,edx + int 0x80 + pop ebp edi esi edx ecx + test eax,eax + js file_error + cmp eax,ecx + jne file_error + clc + ret + file_error: + stc + ret +write: + push edx esi edi ebp + mov eax,4 + xchg ecx,edx + int 0x80 + pop ebp edi esi edx + test eax,eax + js file_error + clc + ret +lseek: + mov ecx,edx + xor edx,edx + mov dl,al + mov eax,19 + int 0x80 + cmp eax,-1 + je file_error + clc + ret + +display_string: + push ebx + mov edi,esi + mov edx,esi + or ecx,-1 + xor al,al + repne scasb + neg ecx + sub ecx,2 + mov eax,4 + mov ebx,[con_handle] + xchg ecx,edx + int 0x80 + pop ebx + ret +display_character: + push ebx + mov [character],dl + mov eax,4 + mov ebx,[con_handle] + mov ecx,character + mov edx,1 + int 0x80 + pop ebx + ret +display_number: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + push edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + push ebx ecx + call display_character + pop ecx ebx + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz display_loop + pop ebx + ret + +display_user_messages: + mov [displayed_count],0 + call show_display_buffer + cmp [displayed_count],0 + je line_break_ok + cmp [last_displayed],0Ah + je line_break_ok + mov dl,0Ah + call display_character + line_break_ok: + ret +display_block: + jecxz block_displayed + add [displayed_count],ecx + mov al,[esi+ecx-1] + mov [last_displayed],al + push ebx + mov eax,4 + mov ebx,[con_handle] + mov edx,ecx + mov ecx,esi + int 0x80 + pop ebx + block_displayed: + ret + +fatal_error: + mov [con_handle],2 + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,0FFh + jmp exit_program +assembler_error: + mov [con_handle],2 + call display_user_messages + mov ebx,[current_line] + test ebx,ebx + jz display_error_message + push dword 0 + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + call display_character + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + jz line_data_displayed + push eax + xor al,al + call lseek + mov ecx,[esp] + mov edx,[additional_memory] + lea eax,[edx+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + call read + call close + pop ecx + mov esi,[additional_memory] + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + display_line_data: + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + line_data_displayed: + mov esi,lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + cmp [preprocessing_done],0 + je display_error_message + mov esi,preprocessed_instruction_prefix + call display_string + mov esi,[current_line] + add esi,16 + mov edi,[additional_memory] + xor dl,dl + convert_instruction: + lodsb + cmp al,1Ah + je copy_symbol + cmp al,22h + je copy_symbol + cmp al,3Bh + je instruction_converted + stosb + or al,al + jz instruction_converted + xor dl,dl + jmp convert_instruction + copy_symbol: + or dl,dl + jz space_ok + mov byte [edi],20h + inc edi + space_ok: + cmp al,22h + je quoted + lodsb + movzx ecx,al + rep movsb + or dl,-1 + jmp convert_instruction + quoted: + mov al,27h + stosb + lodsd + mov ecx,eax + jecxz quoted_copied + copy_quoted: + lodsb + stosb + cmp al,27h + jne quote_ok + stosb + quote_ok: + loop copy_quoted + quoted_copied: + mov al,27h + stosb + or dl,-1 + jmp convert_instruction + instruction_converted: + xor al,al + stosb + mov esi,[additional_memory] + call display_string + mov esi,lf + call display_string + display_error_message: + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,2 + jmp exit_program + +make_timestamp: + mov eax,13 + mov ebx,timestamp + int 0x80 + mov eax,dword [timestamp] + mov edx,dword [timestamp+4] + ret + +error_prefix db 'error: ',0 +error_suffix db '.' +lf db 0xA,0 +line_number_start db ' [',0 +line_data_start db ':',0xA,0 +preprocessed_instruction_prefix db 'processed: ',0 diff --git a/fasmw172/SOURCE/LINUX/X64/FASM.ASM b/fasmw172/SOURCE/LINUX/X64/FASM.ASM new file mode 100644 index 0000000..57dad8d --- /dev/null +++ b/fasmw172/SOURCE/LINUX/X64/FASM.ASM @@ -0,0 +1,360 @@ + +; flat assembler interface for Linux x64 +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + + format ELF64 executable 3 at 400000h + entry start + + include 'modes.inc' + +segment readable executable + +start: + + mov [con_handle],1 + mov esi,_logo + call display_string + + mov [command_line],rsp + mov rcx,[rsp] + mov rbx,[rsp+8+rcx*8+8] + mov [environment],rbx + call get_params + jc information + + call init_memory + + mov esi,_memory_prefix + call display_string + mov eax,[memory_end] + sub eax,[memory_start] + add eax,[additional_memory_end] + sub eax,[additional_memory] + shr eax,10 + call display_number + mov esi,_memory_suffix + call display_string + + mov eax,96 + mov edi,buffer + xor esi,esi + syscall + mov eax,dword [buffer] + mov ecx,1000 + mul ecx + mov ebx,eax + mov eax,dword [buffer+4] + div ecx + add eax,ebx + mov [start_time],eax + + and [preprocessing_done],0 + call preprocessor + or [preprocessing_done],-1 + call parser + call assembler + call formatter + + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + mov eax,96 + mov edi,buffer + xor esi,esi + syscall + mov eax,dword [buffer] + mov ecx,1000 + mul ecx + mov ebx,eax + mov eax,dword [buffer+4] + div ecx + add eax,ebx + sub eax,[start_time] + jnc time_ok + add eax,3600000 + time_ok: + xor edx,edx + mov ebx,100 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov dl,'.' + call display_character + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + jmp exit_program + +information: + mov esi,_usage + call display_string + mov al,1 + jmp exit_program + +get_params: + mov rbx,[command_line] + mov [input_file],0 + mov [output_file],0 + mov [symbols_file],0 + mov [memory_setting],0 + mov [passes_limit],100 + mov rcx,[rbx] + add rbx,8*2 + dec rcx + jz bad_params + mov [definitions_pointer],predefinitions + mov [path_pointer],paths + get_param: + mov rsi,[rbx] + mov al,[rsi] + cmp al,'-' + je option_param + cmp [input_file],0 + jne get_output_file + call collect_path + mov [input_file],edx + jmp next_param + get_output_file: + cmp [output_file],0 + jne bad_params + call collect_path + mov [output_file],edx + jmp next_param + option_param: + inc rsi + lodsb + cmp al,'m' + je memory_option + cmp al,'M' + je memory_option + cmp al,'p' + je passes_option + cmp al,'P' + je passes_option + cmp al,'d' + je definition_option + cmp al,'D' + je definition_option + cmp al,'s' + je symbols_option + cmp al,'S' + je symbols_option + bad_params: + stc + ret + memory_option: + cmp byte [rsi],0 + jne get_memory_setting + dec rcx + jz bad_params + add rbx,8 + mov rsi,[rbx] + get_memory_setting: + call get_option_value + or edx,edx + jz bad_params + cmp edx,1 shl (32-10) + jae bad_params + mov [memory_setting],edx + jmp next_param + passes_option: + cmp byte [rsi],0 + jne get_passes_setting + dec rcx + jz bad_params + add rbx,8 + mov rsi,[rbx] + get_passes_setting: + call get_option_value + or edx,edx + jz bad_params + cmp edx,10000h + ja bad_params + mov [passes_limit],dx + next_param: + add rbx,8 + dec rcx + jnz get_param + cmp [input_file],0 + je bad_params + mov eax,[definitions_pointer] + mov byte [eax],0 + mov [initial_definitions],predefinitions + clc + ret + definition_option: + cmp byte [rsi],0 + jne get_definition + dec rcx + jz bad_params + add rbx,8 + mov rsi,[rbx] + get_definition: + mov r12d,edi + mov edi,[definitions_pointer] + call convert_definition_option + mov [definitions_pointer],edi + mov edi,r12d + jc bad_params + jmp next_param + symbols_option: + cmp byte [rsi],0 + jne get_symbols_setting + dec rcx + jz bad_params + add rbx,8 + mov rsi,[rbx] + get_symbols_setting: + call collect_path + mov [symbols_file],edx + jmp next_param + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec rsi + clc + ret + invalid_option_value: + stc + ret + convert_definition_option: + mov edx,edi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + copy_definition_name: + lodsb + cmp al,'=' + je copy_definition_value + cmp al,20h + je bad_definition_option + or al,al + jz bad_definition_option + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + inc byte [edx] + jnz copy_definition_name + bad_definition_option: + stc + ret + copy_definition_value: + lodsb + cmp al,20h + je definition_value_end + or al,al + jz definition_value_end + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + jmp copy_definition_value + definition_value_end: + dec rsi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + clc + ret +collect_path: + mov edi,[path_pointer] + mov edx,edi + copy_path_to_low_memory: + lodsb + stosb + test al,al + jnz copy_path_to_low_memory + mov [path_pointer],edi + retn + +include 'system.inc' + +include '..\..\version.inc' + +_copyright db 'Copyright (c) 1999-2017, Tomasz Grysztar',0xA,0 + +_logo db 'flat assembler version ',VERSION_STRING,0 +_usage db 0xA + db 'usage: fasm <source> [output]',0xA + db 'optional settings:',0xA + db ' -m <limit> set the limit in kilobytes for the available memory',0xA + db ' -p <limit> set the maximum allowed number of passes',0xA + db ' -d <name>=<value> define symbolic variable',0xA + db ' -s <file> dump symbolic information for debugging',0xA + db 0 +_memory_prefix db ' (',0 +_memory_suffix db ' kilobytes memory, x64)',0xA,0 +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',0xA,0 +_no_low_memory db 'failed to allocate memory within 32-bit addressing range',0 + +include '..\..\errors.inc' +include '..\..\symbdump.inc' +include '..\..\preproce.inc' +include '..\..\parser.inc' +include '..\..\exprpars.inc' +include '..\..\assemble.inc' +include '..\..\exprcalc.inc' +include '..\..\formats.inc' +include '..\..\avx.inc' +include '..\..\x86_64.inc' + +include '..\..\tables.inc' +include '..\..\messages.inc' + +segment readable writeable + +align 4 + +include '..\..\variable.inc' + +command_line dq ? +memory_setting dd ? +path_pointer dd ? +definitions_pointer dd ? +environment dq ? +timestamp dq ? +start_time dd ? +con_handle dd ? +displayed_count dd ? +last_displayed db ? +character db ? +preprocessing_done db ? + +buffer rb 1000h +predefinitions rb 1000h +paths rb 10000h diff --git a/fasmw172/SOURCE/LINUX/X64/MODES.INC b/fasmw172/SOURCE/LINUX/X64/MODES.INC new file mode 100644 index 0000000..236017c --- /dev/null +++ b/fasmw172/SOURCE/LINUX/X64/MODES.INC @@ -0,0 +1,186 @@ + +; flat assembler interface for Linux x64 +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +esp equ +rsp + +macro pushD [arg] +{ + common + local offset,total + offset = 0 + lea rsp,[rsp-total] + forward + offset = offset + 4 + if arg eqtype eax + mov dword [rsp+total-offset],arg + else + mov r8d,dword arg + mov [rsp+total-offset],r8d + end if + common + total = offset +} + +macro popD [arg] +{ + common + local offset + offset = 0 + forward + if arg eqtype [mem] + mov r8d,[rsp+offset] + mov dword arg,r8d + else + mov arg,dword [rsp+offset] + end if + offset = offset + 4 + common + lea rsp,[rsp+offset] +} + +macro add dest,src +{ + if dest eq esp + add rsp,src + else + add dest,src + end if +} + +macro mov dest,src +{ + if src eq esp + mov dest,ESP + else + mov dest,src + end if +} + +macro cmp dest,src +{ + if dest eq esp + cmp ESP,src + else + cmp dest,src + end if +} + +macro use32 +{ + + macro push args + \{ + local list,arg,status + define list + define arg + irps sym, args \\{ + define status + match =dword, sym \\\{ + define status : + \\\} + match [any, status arg sym \\\{ + define arg [any + match [mem], arg \\\\{ + match previous, list \\\\\{ define list previous,[mem] \\\\\} + match , list \\\\\{ define list [mem] \\\\\} + define arg + \\\\} + define status : + \\\} + match [, status arg sym \\\{ + define arg [ + define status : + \\\} + match , status \\\{ + match previous, list \\\\{ define list previous,sym \\\\} + match , list \\\\{ define list sym \\\\} + \\\} + \\} + match arg, list \\{ pushD arg \\} + \} + + macro pop args + \{ + local list,arg,status + define list + define arg + irps sym, args \\{ + define status + match =dword, sym \\\{ + define status : + \\\} + match [any, status arg sym \\\{ + define arg [any + match [mem], arg \\\\{ + match previous, list \\\\\{ define list previous,[mem] \\\\\} + match , list \\\\\{ define list [mem] \\\\\} + define arg + \\\\} + define status : + \\\} + match [, status arg sym \\\{ + define arg [ + define status : + \\\} + match , status \\\{ + match previous, list \\\\{ define list previous,sym \\\\} + match , list \\\\{ define list sym \\\\} + \\\} + \\} + match arg, list \\{ popD arg \\} + \} + + macro jmp arg + \{ + if arg eq near eax + jmp near rax + else if arg eq near edx + jmp near rdx + else if arg eqtype [mem] + mov r8d,arg + jmp near r8 + else + jmp arg + end if + \} + + macro call arg + \{ + if 1 + match =near =dword [mem], arg \\{ + mov r8d,[mem] + call near r8 + else + \\} + call arg + end if + \} + + macro salc ; for fasm's core it does not need to preserve flags + \{ + setc al + neg al + \} + + macro jcxz target ; for fasm's core it does not need to preserve flags + \{ + test cx,cx + jz target + \} + + use64 + +} + +macro use16 +{ + + purge push,pop,jmp,call,salc,jcxz + + use16 + +} + +use32 diff --git a/fasmw172/SOURCE/LINUX/X64/SYSTEM.INC b/fasmw172/SOURCE/LINUX/X64/SYSTEM.INC new file mode 100644 index 0000000..fe7b60d --- /dev/null +++ b/fasmw172/SOURCE/LINUX/X64/SYSTEM.INC @@ -0,0 +1,505 @@ + +; flat assembler interface for Linux x64 +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +O_ACCMODE = 0003o +O_RDONLY = 0000o +O_WRONLY = 0001o +O_RDWR = 0002o +O_CREAT = 0100o +O_EXCL = 0200o +O_NOCTTY = 0400o +O_TRUNC = 1000o +O_APPEND = 2000o +O_NONBLOCK = 4000o + +S_ISUID = 4000o +S_ISGID = 2000o +S_ISVTX = 1000o +S_IRUSR = 0400o +S_IWUSR = 0200o +S_IXUSR = 0100o +S_IRGRP = 0040o +S_IWGRP = 0020o +S_IXGRP = 0010o +S_IROTH = 0004o +S_IWOTH = 0002o +S_IXOTH = 0001o + +init_memory: + mov eax,esp + and eax,not 0FFFh + add eax,1000h-10000h + mov [stack_limit],eax + xor edi,edi + mov eax,12 + syscall + mov r9,not 0FFFFFFFFh + test rax,r9 + jnz no_low_memory + mov [additional_memory],eax + mov ecx,[memory_setting] + shl ecx,10 + jnz allocate_memory + mov ecx,1000000h + allocate_memory: + mov edi,[additional_memory] + add edi,ecx + mov eax,12 + syscall + mov r9,not 0FFFFFFFFh + test rax,r9 + jnz no_low_memory + mov [memory_end],eax + sub eax,[additional_memory] + shr eax,2 + add eax,[additional_memory] + mov [additional_memory_end],eax + mov [memory_start],eax + ret + +no_low_memory: + push _no_low_memory + jmp fatal_error + +exit_program: + movzx edi,al + mov eax,60 + syscall + +get_environment_variable: + mov ebx,esi + mov rsi,[environment] + compare_variable_names: + mov edx,ebx + compare_character: + lodsb + mov ah,[edx] + inc edx + cmp al,'=' + je end_of_variable_name + or ah,ah + jz next_variable + sub ah,al + jz compare_character + cmp ah,20h + jne next_variable + cmp al,41h + jb next_variable + cmp al,5Ah + jna compare_character + next_variable: + lodsb + or al,al + jnz next_variable + cmp byte [rsi],0 + jne compare_variable_names + ret + end_of_variable_name: + or ah,ah + jnz next_variable + copy_variable_value: + lodsb + cmp edi,[memory_end] + jae out_of_memory + stosb + or al,al + jnz copy_variable_value + dec edi + ret + +open: + mov r12d,esi + mov r13d,edi + call adapt_path + mov eax,2 + mov edi,buffer + mov esi,O_RDONLY + xor edx,edx + syscall + mov esi,r12d + mov edi,r13d + test eax,eax + js file_error + mov ebx,eax + clc + ret + adapt_path: + mov esi,edx + mov edi,buffer + copy_path: + lods byte [esi] + cmp al,'\' + jne path_char_ok + mov al,'/' + path_char_ok: + stos byte [edi] + or al,al + jnz copy_path + cmp edi,buffer+1000h + ja out_of_memory + ret +create: + mov r12d,esi + mov r13d,edi + mov r15d,edx + call adapt_path + mov edi,buffer + mov esi,O_CREAT+O_TRUNC+O_WRONLY + mov edx,S_IRUSR+S_IWUSR+S_IRGRP+S_IROTH + cmp r15d,[output_file] + jne do_create + cmp [output_format],5 + jne do_create + bt [format_flags],0 + jnc do_create + or edx,S_IXUSR+S_IXGRP+S_IXOTH + do_create: + mov eax,2 + syscall + mov esi,r12d + mov edi,r13d + test eax,eax + js file_error + mov ebx,eax + clc + ret +close: + mov r13d,edi + mov edi,ebx + mov eax,3 + syscall + mov edi,r13d + ret +read: + mov r12d,esi + mov r13d,edi + mov eax,0 + mov edi,ebx + mov esi,edx + mov edx,ecx + syscall + mov ecx,edx + mov edx,esi + mov esi,r12d + mov edi,r13d + test eax,eax + js file_error + cmp eax,ecx + jne file_error + clc + ret + file_error: + stc + ret +write: + mov r12d,esi + mov r13d,edi + mov eax,1 + mov edi,ebx + mov esi,edx + mov edx,ecx + syscall + mov ecx,edx + mov edx,esi + mov esi,r12d + mov edi,r13d + test eax,eax + js file_error + clc + ret +lseek: + mov r12d,esi + mov r13d,edi + mov edi,ebx + mov esi,edx + xor edx,edx + mov dl,al + mov eax,8 + syscall + mov esi,r12d + mov edi,r13d + cmp eax,-1 + je file_error + clc + ret + +display_string: + mov edi,esi + mov edx,esi + or ecx,-1 + xor al,al + repne scasb + neg ecx + sub ecx,2 + mov eax,1 + mov edi,[con_handle] + mov esi,edx + mov edx,ecx + syscall + ret +display_character: + mov r12d,esi + mov r13d,edi + mov [character],dl + mov eax,1 + mov edi,[con_handle] + mov esi,character + mov edx,1 + syscall + mov esi,r12d + mov edi,r13d + ret +display_number: + mov r14d,ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + mov r15d,edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + mov r10d,ecx + call display_character + mov ecx,r10d + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + mov eax,r15d + or ecx,ecx + jnz display_loop + mov ebx,r14d + ret + +display_user_messages: + mov [displayed_count],0 + call show_display_buffer + cmp [displayed_count],0 + je line_break_ok + cmp [last_displayed],0Ah + je line_break_ok + mov dl,0Ah + call display_character + line_break_ok: + ret +display_block: + jecxz block_displayed + add [displayed_count],ecx + mov al,[esi+ecx-1] + mov [last_displayed],al + mov r13d,edi + mov eax,1 + mov edi,[con_handle] + mov edx,ecx + syscall + mov edi,r13d + block_displayed: + ret + +fatal_error: + mov [con_handle],2 + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,0FFh + jmp exit_program +assembler_error: + mov [con_handle],2 + call display_user_messages + mov ebx,[current_line] + test ebx,ebx + jz display_error_message + push dword 0 + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + call display_character + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + jz line_data_displayed + push eax + xor al,al + call lseek + mov ecx,[esp] + mov edx,[additional_memory] + lea eax,[edx+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + call read + call close + pop ecx + mov esi,[additional_memory] + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + display_line_data: + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + line_data_displayed: + mov esi,lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + cmp [preprocessing_done],0 + je display_error_message + mov esi,preprocessed_instruction_prefix + call display_string + mov esi,[current_line] + add esi,16 + mov edi,[additional_memory] + xor dl,dl + convert_instruction: + lodsb + cmp al,1Ah + je copy_symbol + cmp al,22h + je copy_symbol + cmp al,3Bh + je instruction_converted + stosb + or al,al + jz instruction_converted + xor dl,dl + jmp convert_instruction + copy_symbol: + or dl,dl + jz space_ok + mov byte [edi],20h + inc edi + space_ok: + cmp al,22h + je quoted + lodsb + movzx ecx,al + rep movsb + or dl,-1 + jmp convert_instruction + quoted: + mov al,27h + stosb + lodsd + mov ecx,eax + jecxz quoted_copied + copy_quoted: + lodsb + stosb + cmp al,27h + jne quote_ok + stosb + quote_ok: + loop copy_quoted + quoted_copied: + mov al,27h + stosb + or dl,-1 + jmp convert_instruction + instruction_converted: + xor al,al + stosb + mov esi,[additional_memory] + call display_string + mov esi,lf + call display_string + display_error_message: + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,2 + jmp exit_program + +make_timestamp: + mov r13d,edi + mov eax,201 + mov edi,timestamp + syscall + mov eax,dword [timestamp] + mov edx,dword [timestamp+4] + mov edi,r13d + ret + +error_prefix db 'error: ',0 +error_suffix db '.' +lf db 0xA,0 +line_number_start db ' [',0 +line_data_start db ':',0xA,0 +preprocessed_instruction_prefix db 'processed: ',0 diff --git a/fasmw172/SOURCE/MESSAGES.INC b/fasmw172/SOURCE/MESSAGES.INC new file mode 100644 index 0000000..73fd0e1 --- /dev/null +++ b/fasmw172/SOURCE/MESSAGES.INC @@ -0,0 +1,52 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +_out_of_memory db 'out of memory',0 +_stack_overflow db 'out of stack space',0 +_main_file_not_found db 'source file not found',0 +_unexpected_end_of_file db 'unexpected end of file',0 +_code_cannot_be_generated db 'code cannot be generated',0 +_format_limitations_exceeded db 'format limitations exceeded',0 +_invalid_definition db 'invalid definition provided',0 +_write_failed db 'write failed',0 +_file_not_found db 'file not found',0 +_error_reading_file db 'error reading file',0 +_invalid_file_format db 'invalid file format',0 +_invalid_macro_arguments db 'invalid macro arguments',0 +_incomplete_macro db 'incomplete macro',0 +_unexpected_characters db 'unexpected characters',0 +_invalid_argument db 'invalid argument',0 +_illegal_instruction db 'illegal instruction',0 +_invalid_operand db 'invalid operand',0 +_invalid_operand_size db 'invalid size of operand',0 +_operand_size_not_specified db 'operand size not specified',0 +_operand_sizes_do_not_match db 'operand sizes do not match',0 +_invalid_address_size db 'invalid size of address value',0 +_address_sizes_do_not_agree db 'address sizes do not agree',0 +_disallowed_combination_of_registers db 'disallowed combination of registers',0 +_long_immediate_not_encodable db 'not encodable with long immediate',0 +_relative_jump_out_of_range db 'relative jump out of range',0 +_invalid_expression db 'invalid expression',0 +_invalid_address db 'invalid address',0 +_invalid_value db 'invalid value',0 +_value_out_of_range db 'value out of range',0 +_undefined_symbol db 'undefined symbol',0 +_symbol_out_of_scope_1 db 'symbol',0 +_symbol_out_of_scope_2 db 'out of scope',0 +_invalid_use_of_symbol db 'invalid use of symbol',0 +_name_too_long db 'name too long',0 +_invalid_name db 'invalid name',0 +_reserved_word_used_as_symbol db 'reserved word used as symbol',0 +_symbol_already_defined db 'symbol already defined',0 +_missing_end_quote db 'missing end quote',0 +_missing_end_directive db 'missing end directive',0 +_unexpected_instruction db 'unexpected instruction',0 +_extra_characters_on_line db 'extra characters on line',0 +_section_not_aligned_enough db 'section is not aligned enough',0 +_setting_already_specified db 'setting already specified',0 +_data_already_defined db 'data already defined',0 +_too_many_repeats db 'too many repeats',0 +_invoked_error db 'error directive encountered in source file',0 +_assertion_failed db 'assertion failed',0 diff --git a/fasmw172/SOURCE/PARSER.INC b/fasmw172/SOURCE/PARSER.INC new file mode 100644 index 0000000..c42bd37 --- /dev/null +++ b/fasmw172/SOURCE/PARSER.INC @@ -0,0 +1,1447 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +parser: + mov eax,[memory_end] + mov [labels_list],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + xor eax,eax + mov [current_locals_prefix],eax + mov [anonymous_reverse],eax + mov [anonymous_forward],eax + mov [hash_tree],eax + mov [blocks_stack],eax + mov [parsed_lines],eax + mov esi,[memory_start] + mov edi,[source_start] + parser_loop: + mov [current_line],esi + lea eax,[edi+100h] + cmp eax,[labels_list] + jae out_of_memory + cmp byte [esi+16],0 + je empty_line + cmp byte [esi+16],3Bh + je empty_line + mov al,0Fh + stos byte [edi] + mov eax,esi + stos dword [edi] + inc [parsed_lines] + add esi,16 + parse_line: + mov [formatter_symbols_allowed],0 + mov [decorator_symbols_allowed],0 + cmp byte [esi],1Ah + jne empty_instruction + push edi + add esi,2 + movzx ecx,byte [esi-1] + cmp byte [esi+ecx],':' + je simple_label + cmp byte [esi+ecx],'=' + je constant_label + call get_instruction + jnc main_instruction_identified + cmp byte [esi+ecx],1Ah + jne no_data_label + push esi ecx + lea esi,[esi+ecx+2] + movzx ecx,byte [esi-1] + call get_data_directive + jnc data_label + pop ecx esi + no_data_label: + call get_data_directive + jnc main_instruction_identified + pop edi + sub esi,2 + xor bx,bx + call parse_line_contents + jmp parse_next_line + simple_label: + pop edi + call identify_label + cmp byte [esi+1],':' + je block_label + mov byte [edi],2 + inc edi + stos dword [edi] + inc esi + xor al,al + stos byte [edi] + jmp parse_line + block_label: + mov byte [edi],4 + inc edi + stos dword [edi] + add esi,2 + jmp parse_line + constant_label: + pop edi + call get_label_id + mov byte [edi],3 + inc edi + stos dword [edi] + xor al,al + stos byte [edi] + inc esi + xor bx,bx + call parse_line_contents + jmp parse_next_line + data_label: + pop ecx edx + pop edi + push eax ebx esi + mov esi,edx + movzx ecx,byte [esi-1] + call identify_label + mov byte [edi],2 + inc edi + stos dword [edi] + pop esi ebx eax + stos byte [edi] + push edi + main_instruction_identified: + pop edi + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + cmp bx,if_directive-instruction_handler + je parse_block + cmp bx,repeat_directive-instruction_handler + je parse_block + cmp bx,while_directive-instruction_handler + je parse_block + cmp bx,end_directive-instruction_handler + je parse_end_directive + cmp bx,else_directive-instruction_handler + je parse_else + cmp bx,assert_directive-instruction_handler + je parse_assert + common_parse: + call parse_line_contents + jmp parse_next_line + empty_instruction: + lods byte [esi] + or al,al + jz parse_next_line + cmp al,':' + je invalid_name + dec esi + mov [parenthesis_stack],0 + call parse_argument + jmp parse_next_line + empty_line: + add esi,16 + skip_rest_of_line: + call skip_foreign_line + parse_next_line: + cmp esi,[source_start] + jb parser_loop + source_parsed: + cmp [blocks_stack],0 + je blocks_stack_ok + pop eax + pop [current_line] + jmp missing_end_directive + blocks_stack_ok: + xor al,al + stos byte [edi] + add edi,0Fh + and edi,not 0Fh + mov [code_start],edi + ret + parse_block: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push [current_line] + mov ax,bx + shl eax,16 + push eax + inc [blocks_stack] + cmp bx,if_directive-instruction_handler + je parse_if + cmp bx,while_directive-instruction_handler + je parse_while + call parse_line_contents + jmp parse_next_line + parse_end_directive: + cmp byte [esi],1Ah + jne common_parse + push edi + inc esi + movzx ecx,byte [esi] + inc esi + call get_instruction + pop edi + jnc parse_end_block + sub esi,2 + jmp common_parse + parse_end_block: + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + lods byte [esi] + or al,al + jnz extra_characters_on_line + cmp bx,if_directive-instruction_handler + je close_parsing_block + cmp bx,repeat_directive-instruction_handler + je close_parsing_block + cmp bx,while_directive-instruction_handler + je close_parsing_block + jmp parse_next_line + close_parsing_block: + cmp [blocks_stack],0 + je unexpected_instruction + cmp bx,[esp+2] + jne unexpected_instruction + dec [blocks_stack] + pop eax edx + cmp bx,if_directive-instruction_handler + jne parse_next_line + test al,1100b + jz parse_next_line + test al,10000b + jnz parse_next_line + sub edi,8 + jmp parse_next_line + parse_if: + push edi + call parse_line_contents + xor al,al + stos byte [edi] + xchg esi,[esp] + mov edi,esi + call preevaluate_logical_expression + pop esi + cmp al,'0' + je parse_false_condition_block + cmp al,'1' + je parse_true_condition_block + or byte [esp],10000b + jmp parse_next_line + parse_while: + push edi + call parse_line_contents + xor al,al + stos byte [edi] + xchg esi,[esp] + mov edi,esi + call preevaluate_logical_expression + pop esi + cmp al,'0' + je parse_false_condition_block + cmp al,'1' + jne parse_next_line + stos byte [edi] + jmp parse_next_line + parse_false_condition_block: + or byte [esp],1 + sub edi,4 + jmp skip_parsing + parse_true_condition_block: + or byte [esp],100b + sub edi,4 + jmp parse_next_line + parse_else: + cmp [blocks_stack],0 + je unexpected_instruction + cmp word [esp+2],if_directive-instruction_handler + jne unexpected_instruction + lods byte [esi] + or al,al + jz parse_pure_else + cmp al,1Ah + jne extra_characters_on_line + push edi + movzx ecx,byte [esi] + inc esi + call get_instruction + jc extra_characters_on_line + pop edi + cmp bx,if_directive-instruction_handler + jne extra_characters_on_line + test byte [esp],100b + jnz skip_true_condition_else + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp parse_if + parse_assert: + push edi + call parse_line_contents + xor al,al + stos byte [edi] + xchg esi,[esp] + mov edi,esi + call preevaluate_logical_expression + pop esi + or al,al + jz parse_next_line + stos byte [edi] + jmp parse_next_line + skip_true_condition_else: + sub edi,4 + or byte [esp],1 + jmp skip_parsing_contents + parse_pure_else: + bts dword [esp],1 + jc unexpected_instruction + test byte [esp],100b + jz parse_next_line + sub edi,4 + or byte [esp],1 + jmp skip_parsing + skip_parsing: + cmp esi,[source_start] + jae source_parsed + mov [current_line],esi + add esi,16 + skip_parsing_line: + cmp byte [esi],1Ah + jne skip_parsing_contents + inc esi + movzx ecx,byte [esi] + inc esi + cmp byte [esi+ecx],':' + je skip_parsing_label + push edi + call get_instruction + pop edi + jnc skip_parsing_instruction + add esi,ecx + jmp skip_parsing_contents + skip_parsing_label: + lea esi,[esi+ecx+1] + jmp skip_parsing_line + skip_parsing_instruction: + cmp bx,if_directive-instruction_handler + je skip_parsing_block + cmp bx,repeat_directive-instruction_handler + je skip_parsing_block + cmp bx,while_directive-instruction_handler + je skip_parsing_block + cmp bx,end_directive-instruction_handler + je skip_parsing_end_directive + cmp bx,else_directive-instruction_handler + je skip_parsing_else + skip_parsing_contents: + lods byte [esi] + or al,al + jz skip_parsing + cmp al,1Ah + je skip_parsing_symbol + cmp al,3Bh + je skip_parsing_symbol + cmp al,22h + je skip_parsing_string + jmp skip_parsing_contents + skip_parsing_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_parsing_contents + skip_parsing_string: + lods dword [esi] + add esi,eax + jmp skip_parsing_contents + skip_parsing_block: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push [current_line] + mov ax,bx + shl eax,16 + push eax + inc [blocks_stack] + jmp skip_parsing_contents + skip_parsing_end_directive: + cmp byte [esi],1Ah + jne skip_parsing_contents + push edi + inc esi + movzx ecx,byte [esi] + inc esi + call get_instruction + pop edi + jnc skip_parsing_end_block + add esi,ecx + jmp skip_parsing_contents + skip_parsing_end_block: + lods byte [esi] + or al,al + jnz extra_characters_on_line + cmp bx,if_directive-instruction_handler + je close_skip_parsing_block + cmp bx,repeat_directive-instruction_handler + je close_skip_parsing_block + cmp bx,while_directive-instruction_handler + je close_skip_parsing_block + jmp skip_parsing + close_skip_parsing_block: + cmp [blocks_stack],0 + je unexpected_instruction + cmp bx,[esp+2] + jne unexpected_instruction + dec [blocks_stack] + pop eax edx + test al,1 + jz skip_parsing + cmp bx,if_directive-instruction_handler + jne parse_next_line + test al,10000b + jz parse_next_line + mov al,0Fh + stos byte [edi] + mov eax,[current_line] + stos dword [edi] + inc [parsed_lines] + mov eax,1 + (end_directive-instruction_handler) shl 8 + stos dword [edi] + mov eax,1 + (if_directive-instruction_handler) shl 8 + stos dword [edi] + jmp parse_next_line + skip_parsing_else: + cmp [blocks_stack],0 + je unexpected_instruction + cmp word [esp+2],if_directive-instruction_handler + jne unexpected_instruction + lods byte [esi] + or al,al + jz skip_parsing_pure_else + cmp al,1Ah + jne extra_characters_on_line + push edi + movzx ecx,byte [esi] + inc esi + call get_instruction + jc extra_characters_on_line + pop edi + cmp bx,if_directive-instruction_handler + jne extra_characters_on_line + mov al,[esp] + test al,1 + jz skip_parsing_contents + test al,100b + jnz skip_parsing_contents + test al,10000b + jnz parse_else_if + xor al,al + mov [esp],al + mov al,0Fh + stos byte [edi] + mov eax,[current_line] + stos dword [edi] + inc [parsed_lines] + parse_else_if: + mov eax,1 + (if_directive-instruction_handler) shl 8 + stos dword [edi] + jmp parse_if + skip_parsing_pure_else: + bts dword [esp],1 + jc unexpected_instruction + mov al,[esp] + test al,1 + jz skip_parsing + test al,100b + jnz skip_parsing + and al,not 1 + or al,1000b + mov [esp],al + jmp parse_next_line + +parse_line_contents: + mov [parenthesis_stack],0 + parse_instruction_arguments: + cmp bx,prefix_instruction-instruction_handler + je allow_embedded_instruction + cmp bx,times_directive-instruction_handler + je parse_times_directive + cmp bx,end_directive-instruction_handler + je allow_embedded_instruction + cmp bx,label_directive-instruction_handler + je parse_label_directive + cmp bx,segment_directive-instruction_handler + je parse_segment_directive + cmp bx,load_directive-instruction_handler + je parse_load_directive + cmp bx,extrn_directive-instruction_handler + je parse_extrn_directive + cmp bx,public_directive-instruction_handler + je parse_public_directive + cmp bx,section_directive-instruction_handler + je parse_formatter_argument + cmp bx,format_directive-instruction_handler + je parse_formatter_argument + cmp bx,data_directive-instruction_handler + je parse_formatter_argument + jmp parse_argument + parse_formatter_argument: + or [formatter_symbols_allowed],-1 + parse_argument: + lea eax,[edi+100h] + cmp eax,[labels_list] + jae out_of_memory + lods byte [esi] + cmp al,':' + je instruction_separator + cmp al,',' + je separator + cmp al,'=' + je expression_comparator + cmp al,'|' + je separator + cmp al,'&' + je separator + cmp al,'~' + je separator + cmp al,'>' + je greater + cmp al,'<' + je less + cmp al,')' + je close_parenthesis + or al,al + jz contents_parsed + cmp al,'[' + je address_argument + cmp al,']' + je separator + cmp al,'{' + je open_decorator + cmp al,'}' + je close_decorator + cmp al,'#' + je unallowed_character + cmp al,'`' + je unallowed_character + cmp al,3Bh + je foreign_argument + cmp [decorator_symbols_allowed],0 + je not_a_separator + cmp al,'-' + je separator + not_a_separator: + dec esi + cmp al,1Ah + jne expression_argument + push edi + mov edi,directive_operators + call get_operator + or al,al + jnz operator_argument + inc esi + movzx ecx,byte [esi] + inc esi + call get_symbol + jnc symbol_argument + cmp ecx,1 + jne check_argument + cmp byte [esi],'?' + jne check_argument + pop edi + movs byte [edi],[esi] + jmp argument_parsed + foreign_argument: + dec esi + call skip_foreign_line + jmp contents_parsed + symbol_argument: + pop edi + stos word [edi] + jmp argument_parsed + operator_argument: + pop edi + cmp al,85h + je ptr_argument + stos byte [edi] + cmp al,80h + je forced_multipart_expression + cmp al,8Ch + je forced_expression + cmp al,81h + je forced_parenthesis + cmp al,82h + je parse_from_operator + cmp al,89h + je parse_label_operator + cmp al,0F8h + je forced_expression + jmp argument_parsed + instruction_separator: + stos byte [edi] + allow_embedded_instruction: + cmp byte [esi],1Ah + jne parse_argument + push edi + inc esi + movzx ecx,byte [esi] + inc esi + call get_instruction + jnc embedded_instruction + call get_data_directive + jnc embedded_instruction + pop edi + sub esi,2 + jmp parse_argument + embedded_instruction: + pop edi + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp parse_instruction_arguments + parse_times_directive: + mov al,'(' + stos byte [edi] + call convert_expression + mov al,')' + stos byte [edi] + cmp byte [esi],':' + jne allow_embedded_instruction + movs byte [edi],[esi] + jmp allow_embedded_instruction + parse_segment_directive: + or [formatter_symbols_allowed],-1 + parse_label_directive: + cmp byte [esi],1Ah + jne argument_parsed + push esi + inc esi + movzx ecx,byte [esi] + inc esi + call identify_label + pop ebx + cmp eax,0Fh + je non_label_identified + mov byte [edi],2 + inc edi + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + non_label_identified: + mov esi,ebx + jmp argument_parsed + parse_load_directive: + cmp byte [esi],1Ah + jne argument_parsed + push esi + inc esi + movzx ecx,byte [esi] + inc esi + call get_label_id + pop ebx + cmp eax,0Fh + je non_label_identified + mov byte [edi],2 + inc edi + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + parse_public_directive: + cmp byte [esi],1Ah + jne parse_argument + inc esi + push esi + movzx ecx,byte [esi] + inc esi + push esi ecx + push edi + or [formatter_symbols_allowed],-1 + call get_symbol + mov [formatter_symbols_allowed],0 + pop edi + jc parse_public_label + cmp al,1Dh + jne parse_public_label + add esp,12 + stos word [edi] + jmp parse_public_directive + parse_public_label: + pop ecx esi + mov al,2 + stos byte [edi] + call get_label_id + stos dword [edi] + mov ax,8600h + stos word [edi] + pop ebx + push ebx esi edi + mov edi,directive_operators + call get_operator + pop edi edx ebx + cmp al,86h + je argument_parsed + mov esi,edx + xchg esi,ebx + movzx ecx,byte [esi] + inc esi + mov ax,'(' + stos word [edi] + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + xchg esi,ebx + jmp argument_parsed + parse_extrn_directive: + cmp byte [esi],22h + je parse_quoted_extrn + cmp byte [esi],1Ah + jne parse_argument + push esi + movzx ecx,byte [esi+1] + add esi,2 + mov ax,'(' + stos word [edi] + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + mov ax,8600h + stos word [edi] + pop esi + parse_label_operator: + cmp byte [esi],1Ah + jne argument_parsed + inc esi + movzx ecx,byte [esi] + inc esi + mov al,2 + stos byte [edi] + call get_label_id + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + parse_from_operator: + cmp byte [esi],22h + jne forced_multipart_expression + jmp argument_parsed + parse_quoted_extrn: + inc esi + mov ax,'(' + stos word [edi] + lods dword [esi] + mov ecx,eax + stos dword [edi] + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + push esi edi + mov edi,directive_operators + call get_operator + mov edx,esi + pop edi esi + cmp al,86h + jne argument_parsed + stos byte [edi] + mov esi,edx + jmp parse_label_operator + ptr_argument: + call parse_address + jmp address_parsed + check_argument: + push esi ecx + sub esi,2 + mov edi,single_operand_operators + call get_operator + pop ecx esi + or al,al + jnz not_instruction + call get_instruction + jnc embedded_instruction + call get_data_directive + jnc embedded_instruction + not_instruction: + pop edi + sub esi,2 + expression_argument: + cmp byte [esi],22h + jne not_string + mov eax,[esi+1] + lea ebx,[esi+5+eax] + push ebx ecx esi edi + call parse_expression + pop eax edx ecx ebx + cmp esi,ebx + jne expression_argument_parsed + mov edi,eax + mov esi,edx + string_argument: + inc esi + mov ax,'(' + stos word [edi] + lods dword [esi] + mov ecx,eax + stos dword [edi] + shr ecx,1 + jnc string_movsb_ok + movs byte [edi],[esi] + string_movsb_ok: + shr ecx,1 + jnc string_movsw_ok + movs word [edi],[esi] + string_movsw_ok: + rep movs dword [edi],[esi] + xor al,al + stos byte [edi] + jmp expression_argument_parsed + parse_expression: + mov al,'(' + stos byte [edi] + call convert_expression + mov al,')' + stos byte [edi] + ret + not_string: + cmp byte [esi],'(' + jne expression + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push esi edi + inc esi + mov al,91h + stos byte [edi] + inc [parenthesis_stack] + jmp parse_argument + expression_comparator: + stos byte [edi] + jmp forced_expression + greater: + cmp byte [esi],'=' + jne separator + inc esi + mov al,0F2h + jmp separator + less: + cmp byte [edi-1],0F6h + je separator + cmp byte [esi],'>' + je not_equal + cmp byte [esi],'=' + jne separator + inc esi + mov al,0F3h + jmp separator + not_equal: + inc esi + mov al,0F1h + jmp expression_comparator + expression: + call parse_expression + jmp expression_argument_parsed + forced_expression: + xor al,al + xchg al,[formatter_symbols_allowed] + push eax + call parse_expression + forced_expression_parsed: + pop eax + mov [formatter_symbols_allowed],al + jmp argument_parsed + forced_multipart_expression: + xor al,al + xchg al,[formatter_symbols_allowed] + push eax + call parse_expression + cmp byte [esi],':' + jne forced_expression_parsed + movs byte [edi],[esi] + call parse_expression + jmp forced_expression_parsed + address_argument: + call parse_address + lods byte [esi] + cmp al,']' + je address_parsed + cmp al,',' + je divided_address + dec esi + mov al,')' + stos byte [edi] + jmp argument_parsed + divided_address: + mov ax,'),' + stos word [edi] + jmp expression + address_parsed: + mov al,']' + stos byte [edi] + jmp argument_parsed + parse_address: + mov al,'[' + stos byte [edi] + cmp word [esi],021Ah + jne convert_address + push esi + add esi,4 + lea ebx,[esi+1] + cmp byte [esi],':' + pop esi + jne convert_address + add esi,2 + mov ecx,2 + push ebx edi + call get_symbol + pop edi esi + jc unknown_segment_prefix + cmp al,10h + jne unknown_segment_prefix + mov al,ah + and ah,11110000b + cmp ah,30h + jne unknown_segment_prefix + add al,30h + stos byte [edi] + jmp convert_address + unknown_segment_prefix: + sub esi,5 + convert_address: + push edi + mov edi,address_sizes + call get_operator + pop edi + or al,al + jz convert_expression + add al,70h + stos byte [edi] + jmp convert_expression + forced_parenthesis: + cmp byte [esi],'(' + jne argument_parsed + inc esi + mov al,91h + jmp separator + unallowed_character: + mov al,0FFh + jmp separator + open_decorator: + inc [decorator_symbols_allowed] + jmp separator + close_decorator: + dec [decorator_symbols_allowed] + jmp separator + close_parenthesis: + mov al,92h + separator: + stos byte [edi] + argument_parsed: + cmp [parenthesis_stack],0 + je parse_argument + dec [parenthesis_stack] + add esp,8 + jmp argument_parsed + expression_argument_parsed: + cmp [parenthesis_stack],0 + je parse_argument + cmp byte [esi],')' + jne argument_parsed + dec [parenthesis_stack] + pop edi esi + jmp expression + contents_parsed: + cmp [parenthesis_stack],0 + je contents_ok + dec [parenthesis_stack] + add esp,8 + jmp contents_parsed + contents_ok: + ret + +identify_label: + cmp byte [esi],'.' + je local_label_name + call get_label_id + cmp eax,10h + jb label_identified + or ebx,ebx + jz anonymous_label_name + dec ebx + mov [current_locals_prefix],ebx + label_identified: + ret + anonymous_label_name: + cmp byte [esi-1],'@' + je anonymous_label_name_ok + mov eax,0Fh + anonymous_label_name_ok: + ret + local_label_name: + call get_label_id + ret + +get_operator: + cmp byte [esi],1Ah + jne get_simple_operator + mov edx,esi + push ebp + inc esi + lods byte [esi] + movzx ebp,al + push edi + mov ecx,ebp + call lower_case + pop edi + check_operator: + mov esi,converted + movzx ecx,byte [edi] + jecxz no_operator + inc edi + mov ebx,edi + add ebx,ecx + cmp ecx,ebp + jne next_operator + repe cmps byte [esi],[edi] + je operator_found + jb no_operator + next_operator: + mov edi,ebx + inc edi + jmp check_operator + no_operator: + mov esi,edx + mov ecx,ebp + pop ebp + no_simple_operator: + xor al,al + ret + operator_found: + lea esi,[edx+2+ebp] + mov ecx,ebp + pop ebp + mov al,[edi] + ret + get_simple_operator: + mov al,[esi] + cmp al,22h + je no_simple_operator + simple_operator: + cmp byte [edi],1 + jb no_simple_operator + ja simple_next_operator + cmp al,[edi+1] + je simple_operator_found + simple_next_operator: + movzx ecx,byte [edi] + lea edi,[edi+1+ecx+1] + jmp simple_operator + simple_operator_found: + inc esi + mov al,[edi+2] + ret + +get_symbol: + push esi + mov ebp,ecx + call lower_case + mov ecx,ebp + cmp cl,11 + ja no_symbol + sub cl,1 + jc no_symbol + movzx ebx,word [symbols+ecx*4] + add ebx,symbols + movzx edx,word [symbols+ecx*4+2] + scan_symbols: + or edx,edx + jz no_symbol + mov eax,edx + shr eax,1 + lea edi,[ebp+2] + imul eax,edi + lea edi,[ebx+eax] + mov esi,converted + mov ecx,ebp + repe cmps byte [esi],[edi] + ja symbols_up + jb symbols_down + mov ax,[edi] + cmp al,18h + jb symbol_ok + cmp al,1Fh + je decorator_symbol + cmp [formatter_symbols_allowed],0 + je no_symbol + symbol_ok: + pop esi + add esi,ebp + clc + ret + decorator_symbol: + cmp [decorator_symbols_allowed],0 + jne symbol_ok + no_symbol: + pop esi + mov ecx,ebp + stc + ret + symbols_down: + shr edx,1 + jmp scan_symbols + symbols_up: + lea ebx,[edi+ecx+2] + shr edx,1 + adc edx,-1 + jmp scan_symbols + +get_data_directive: + push esi + mov ebp,ecx + call lower_case + mov ecx,ebp + cmp cl,4 + ja no_instruction + sub cl,2 + jc no_instruction + movzx ebx,word [data_directives+ecx*4] + add ebx,data_directives + movzx edx,word [data_directives+ecx*4+2] + jmp scan_instructions + +get_instruction: + push esi + mov ebp,ecx + call lower_case + mov ecx,ebp + cmp cl,16 + ja no_instruction + sub cl,2 + jc no_instruction + movzx ebx,word [instructions+ecx*4] + add ebx,instructions + movzx edx,word [instructions+ecx*4+2] + scan_instructions: + or edx,edx + jz no_instruction + mov eax,edx + shr eax,1 + lea edi,[ebp+3] + imul eax,edi + lea edi,[ebx+eax] + mov esi,converted + mov ecx,ebp + repe cmps byte [esi],[edi] + ja instructions_up + jb instructions_down + pop esi + add esi,ebp + mov al,[edi] + mov bx,[edi+1] + clc + ret + no_instruction: + pop esi + mov ecx,ebp + stc + ret + instructions_down: + shr edx,1 + jmp scan_instructions + instructions_up: + lea ebx,[edi+ecx+3] + shr edx,1 + adc edx,-1 + jmp scan_instructions + +get_label_id: + cmp ecx,100h + jae name_too_long + cmp byte [esi],'@' + je anonymous_label + cmp byte [esi],'.' + jne standard_label + cmp byte [esi+1],'.' + je standard_label + cmp [current_locals_prefix],0 + je standard_label + push edi + mov edi,[additional_memory_end] + sub edi,2 + sub edi,ecx + push ecx esi + mov esi,[current_locals_prefix] + lods byte [esi] + movzx ecx,al + sub edi,ecx + cmp edi,[free_additional_memory] + jb out_of_memory + mov word [edi],0 + add edi,2 + mov ebx,edi + rep movs byte [edi],[esi] + pop esi ecx + add al,cl + jc name_too_long + rep movs byte [edi],[esi] + pop edi + push ebx esi + movzx ecx,al + mov byte [ebx-1],al + mov esi,ebx + call get_label_id + pop esi ebx + cmp ebx,[eax+24] + jne composed_label_id_ok + lea edx,[ebx-2] + mov [additional_memory_end],edx + composed_label_id_ok: + ret + anonymous_label: + cmp ecx,2 + jne standard_label + mov al,[esi+1] + mov ebx,characters + xlat byte [ebx] + cmp al,'@' + je new_anonymous + cmp al,'b' + je anonymous_back + cmp al,'r' + je anonymous_back + cmp al,'f' + jne standard_label + add esi,2 + mov eax,[anonymous_forward] + or eax,eax + jnz anonymous_ok + mov eax,[current_line] + mov [error_line],eax + call allocate_label + mov [anonymous_forward],eax + anonymous_ok: + xor ebx,ebx + ret + anonymous_back: + mov eax,[anonymous_reverse] + add esi,2 + or eax,eax + jz bogus_anonymous + jmp anonymous_ok + bogus_anonymous: + call allocate_label + mov [anonymous_reverse],eax + jmp anonymous_ok + new_anonymous: + add esi,2 + mov eax,[anonymous_forward] + or eax,eax + jnz new_anonymous_ok + call allocate_label + new_anonymous_ok: + mov [anonymous_reverse],eax + mov [anonymous_forward],0 + jmp anonymous_ok + standard_label: + cmp byte [esi],'%' + je get_predefined_id + cmp byte [esi],'$' + je current_address_label + cmp byte [esi],'?' + jne find_label + cmp ecx,1 + jne find_label + inc esi + mov eax,0Fh + ret + current_address_label: + cmp ecx,2 + ja find_label + inc esi + jb get_current_offset_id + inc esi + cmp byte [esi-1],'$' + je get_org_origin_id + sub esi,2 + jmp find_label + get_current_offset_id: + xor eax,eax + ret + get_counter_id: + mov eax,1 + ret + get_timestamp_id: + mov eax,2 + ret + get_org_origin_id: + mov eax,3 + ret + get_predefined_id: + cmp ecx,2 + ja find_label + inc esi + cmp cl,1 + je get_counter_id + lods byte [esi] + mov ebx,characters + xlat [ebx] + cmp al,'t' + je get_timestamp_id + sub esi,2 + find_label: + xor ebx,ebx + mov eax,2166136261 + mov ebp,16777619 + hash_label: + xor al,[esi+ebx] + mul ebp + inc bl + cmp bl,cl + jb hash_label + mov ebp,eax + shl eax,8 + and ebp,0FFh shl 24 + xor ebp,eax + or ebp,ebx + mov [label_hash],ebp + push edi esi + push ecx + mov ecx,32 + mov ebx,hash_tree + follow_tree: + mov edx,[ebx] + or edx,edx + jz extend_tree + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec ecx + jnz follow_tree + mov [label_leaf],ebx + pop edx + mov eax,[ebx] + or eax,eax + jz add_label + mov ebx,esi + mov ebp,[label_hash] + compare_labels: + mov esi,ebx + mov ecx,edx + mov edi,[eax+4] + mov edi,[edi+24] + repe cmps byte [esi],[edi] + je label_found + mov eax,[eax] + or eax,eax + jnz compare_labels + jmp add_label + label_found: + add esp,4 + pop edi + mov eax,[eax+4] + ret + extend_tree: + mov edx,[free_additional_memory] + lea eax,[edx+8] + cmp eax,[additional_memory_end] + ja out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [edx],eax + mov [edx+4],eax + shl ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + dec ecx + jnz extend_tree + mov [label_leaf],ebx + pop edx + add_label: + mov ecx,edx + pop esi + cmp byte [esi-2],0 + je label_name_ok + mov al,[esi] + cmp al,30h + jb name_first_char_ok + cmp al,39h + jbe numeric_name + name_first_char_ok: + cmp al,'$' + jne check_for_reserved_word + numeric_name: + add esi,ecx + reserved_word: + mov eax,0Fh + pop edi + ret + check_for_reserved_word: + call get_instruction + jnc reserved_word + call get_data_directive + jnc reserved_word + call get_symbol + jnc reserved_word + sub esi,2 + mov edi,operators + call get_operator + or al,al + jnz reserved_word + mov edi,single_operand_operators + call get_operator + or al,al + jnz reserved_word + mov edi,directive_operators + call get_operator + or al,al + jnz reserved_word + inc esi + movzx ecx,byte [esi] + inc esi + label_name_ok: + mov edx,[free_additional_memory] + lea eax,[edx+8] + cmp eax,[additional_memory_end] + ja out_of_memory + mov [free_additional_memory],eax + mov ebx,esi + add esi,ecx + mov eax,[label_leaf] + mov edi,[eax] + mov [edx],edi + mov [eax],edx + call allocate_label + mov [edx+4],eax + mov [eax+24],ebx + pop edi + ret + allocate_label: + mov eax,[labels_list] + mov ecx,LABEL_STRUCTURE_SIZE shr 2 + initialize_label: + sub eax,4 + mov dword [eax],0 + loop initialize_label + mov [labels_list],eax + ret + +LABEL_STRUCTURE_SIZE = 32 diff --git a/fasmw172/SOURCE/PREPROCE.INC b/fasmw172/SOURCE/PREPROCE.INC new file mode 100644 index 0000000..60a0317 --- /dev/null +++ b/fasmw172/SOURCE/PREPROCE.INC @@ -0,0 +1,2899 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +preprocessor: + mov edi,characters + xor al,al + make_characters_table: + stosb + inc al + jnz make_characters_table + mov esi,characters+'a' + mov edi,characters+'A' + mov ecx,26 + rep movsb + mov edi,characters + mov esi,symbol_characters+1 + movzx ecx,byte [esi-1] + xor eax,eax + mark_symbol_characters: + lodsb + mov byte [edi+eax],0 + loop mark_symbol_characters + mov edi,locals_counter + mov ax,1 + '0' shl 8 + stos word [edi] + mov edi,[memory_start] + mov [include_paths],edi + mov esi,include_variable + call get_environment_variable + xor al,al + stos byte [edi] + mov [memory_start],edi + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [labels_list],eax + xor eax,eax + mov [source_start],eax + mov [tagged_blocks],eax + mov [hash_tree],eax + mov [error],eax + mov [macro_status],al + mov [current_line],eax + mov esi,[initial_definitions] + test esi,esi + jz predefinitions_ok + process_predefinitions: + movzx ecx,byte [esi] + test ecx,ecx + jz predefinitions_ok + inc esi + lea eax,[esi+ecx] + push eax + mov ch,10b + call add_preprocessor_symbol + pop esi + mov edi,[memory_start] + mov [edx+8],edi + convert_predefinition: + cmp edi,[memory_end] + jae out_of_memory + lods byte [esi] + or al,al + jz predefinition_converted + cmp al,20h + je convert_predefinition + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz predefinition_separator + cmp ah,27h + je predefinition_string + cmp ah,22h + je predefinition_string + mov byte [edi],1Ah + scas word [edi] + xchg al,ah + stos byte [edi] + mov ebx,characters + xor ecx,ecx + predefinition_symbol: + lods byte [esi] + stos byte [edi] + xlat byte [ebx] + or al,al + loopnzd predefinition_symbol + neg ecx + cmp ecx,255 + ja invalid_definition + mov ebx,edi + sub ebx,ecx + mov byte [ebx-2],cl + found_predefinition_separator: + dec edi + mov ah,[esi-1] + predefinition_separator: + xchg al,ah + or al,al + jz predefinition_converted + cmp al,20h + je convert_predefinition + cmp al,3Bh + je invalid_definition + cmp al,5Ch + je predefinition_backslash + stos byte [edi] + jmp convert_predefinition + predefinition_string: + mov al,22h + stos byte [edi] + scas dword [edi] + mov ebx,edi + copy_predefinition_string: + lods byte [esi] + stos byte [edi] + or al,al + jz invalid_definition + cmp al,ah + jne copy_predefinition_string + lods byte [esi] + cmp al,ah + je copy_predefinition_string + dec esi + dec edi + mov eax,edi + sub eax,ebx + mov [ebx-4],eax + jmp convert_predefinition + predefinition_backslash: + mov byte [edi],0 + lods byte [esi] + or al,al + jz invalid_definition + cmp al,20h + je invalid_definition + cmp al,3Bh + je invalid_definition + mov al,1Ah + stos byte [edi] + mov ecx,edi + mov ax,5C01h + stos word [edi] + dec esi + group_predefinition_backslashes: + lods byte [esi] + cmp al,5Ch + jne predefinition_backslashed_symbol + stos byte [edi] + inc byte [ecx] + jmp group_predefinition_backslashes + predefinition_backslashed_symbol: + cmp al,20h + je invalid_definition + cmp al,22h + je invalid_definition + cmp al,27h + je invalid_definition + cmp al,3Bh + je invalid_definition + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz predefinition_backslashed_symbol_character + mov al,ah + convert_predefinition_backslashed_symbol: + stos byte [edi] + xlat byte [ebx] + or al,al + jz found_predefinition_separator + inc byte [ecx] + jz invalid_definition + lods byte [esi] + jmp convert_predefinition_backslashed_symbol + predefinition_backslashed_symbol_character: + mov al,ah + stos byte [edi] + inc byte [ecx] + jmp convert_predefinition + predefinition_converted: + mov [memory_start],edi + sub edi,[edx+8] + mov [edx+12],edi + jmp process_predefinitions + predefinitions_ok: + mov esi,[input_file] + mov edx,esi + call open + jc main_file_not_found + mov edi,[memory_start] + call preprocess_file + cmp [macro_status],0 + je process_postponed + mov eax,[error_line] + mov [current_line],eax + jmp incomplete_macro + process_postponed: + mov edx,hash_tree + mov ecx,32 + find_postponed_list: + mov edx,[edx] + or edx,edx + loopnz find_postponed_list + jz preprocessing_finished + process_postponed_list: + mov eax,[edx] + or eax,eax + jz preprocessing_finished + push edx + mov ebx,edx + find_earliest_postponed: + mov eax,[edx] + or eax,eax + jz earliest_postponed_found + mov ebx,edx + mov edx,eax + jmp find_earliest_postponed + earliest_postponed_found: + mov [ebx],eax + call use_postponed_macro + pop edx + cmp [macro_status],0 + je process_postponed_list + mov eax,[error_line] + mov [current_line],eax + jmp incomplete_macro + preprocessing_finished: + mov [source_start],edi + ret + use_postponed_macro: + lea esi,[edi-1] + push ecx esi + mov [struc_name],0 + jmp use_macro + +preprocess_file: + push [memory_end] + push esi + mov al,2 + xor edx,edx + call lseek + push eax + xor al,al + xor edx,edx + call lseek + pop ecx + mov edx,[memory_end] + dec edx + mov byte [edx],1Ah + sub edx,ecx + jc out_of_memory + mov esi,edx + cmp edx,edi + jbe out_of_memory + mov [memory_end],edx + call read + call close + pop edx + xor ecx,ecx + mov ebx,esi + preprocess_source: + inc ecx + mov [current_line],edi + mov eax,edx + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,esi + sub eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + push ebx edx + call convert_line + call preprocess_line + pop edx ebx + next_line: + cmp byte [esi-1],0 + je file_end + cmp byte [esi-1],1Ah + jne preprocess_source + file_end: + pop [memory_end] + clc + ret + +convert_line: + push ecx + test [macro_status],0Fh + jz convert_line_data + mov ax,3Bh + stos word [edi] + convert_line_data: + cmp edi,[memory_end] + jae out_of_memory + lods byte [esi] + cmp al,20h + je convert_line_data + cmp al,9 + je convert_line_data + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz convert_separator + cmp ah,27h + je convert_string + cmp ah,22h + je convert_string + mov byte [edi],1Ah + scas word [edi] + xchg al,ah + stos byte [edi] + mov ebx,characters + xor ecx,ecx + convert_symbol: + lods byte [esi] + stos byte [edi] + xlat byte [ebx] + or al,al + loopnzd convert_symbol + neg ecx + cmp ecx,255 + ja name_too_long + mov ebx,edi + sub ebx,ecx + mov byte [ebx-2],cl + found_separator: + dec edi + mov ah,[esi-1] + convert_separator: + xchg al,ah + cmp al,20h + jb control_character + je convert_line_data + symbol_character: + cmp al,3Bh + je ignore_comment + cmp al,5Ch + je backslash_character + stos byte [edi] + jmp convert_line_data + control_character: + cmp al,1Ah + je line_end + cmp al,0Dh + je cr_character + cmp al,0Ah + je lf_character + cmp al,9 + je convert_line_data + or al,al + jnz symbol_character + jmp line_end + lf_character: + lods byte [esi] + cmp al,0Dh + je line_end + dec esi + jmp line_end + cr_character: + lods byte [esi] + cmp al,0Ah + je line_end + dec esi + jmp line_end + convert_string: + mov al,22h + stos byte [edi] + scas dword [edi] + mov ebx,edi + copy_string: + lods byte [esi] + stos byte [edi] + cmp al,0Ah + je no_end_quote + cmp al,0Dh + je no_end_quote + or al,al + jz no_end_quote + cmp al,1Ah + je no_end_quote + cmp al,ah + jne copy_string + lods byte [esi] + cmp al,ah + je copy_string + dec esi + dec edi + mov eax,edi + sub eax,ebx + mov [ebx-4],eax + jmp convert_line_data + backslash_character: + mov byte [edi],0 + lods byte [esi] + cmp al,20h + je concatenate_lines + cmp al,9 + je concatenate_lines + cmp al,1Ah + je unexpected_end_of_file + or al,al + jz unexpected_end_of_file + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + cmp al,3Bh + je find_concatenated_line + mov al,1Ah + stos byte [edi] + mov ecx,edi + mov ax,5C01h + stos word [edi] + dec esi + group_backslashes: + lods byte [esi] + cmp al,5Ch + jne backslashed_symbol + stos byte [edi] + inc byte [ecx] + jz name_too_long + jmp group_backslashes + no_end_quote: + mov byte [ebx-5],0 + jmp missing_end_quote + backslashed_symbol: + cmp al,1Ah + je unexpected_end_of_file + or al,al + jz unexpected_end_of_file + cmp al,0Ah + je extra_characters_on_line + cmp al,0Dh + je extra_characters_on_line + cmp al,20h + je extra_characters_on_line + cmp al,9 + je extra_characters_on_line + cmp al,22h + je extra_characters_on_line + cmp al,27h + je extra_characters_on_line + cmp al,3Bh + je extra_characters_on_line + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz backslashed_symbol_character + mov al,ah + convert_backslashed_symbol: + stos byte [edi] + xlat byte [ebx] + or al,al + jz found_separator + inc byte [ecx] + jz name_too_long + lods byte [esi] + jmp convert_backslashed_symbol + backslashed_symbol_character: + mov al,ah + stos byte [edi] + inc byte [ecx] + jmp convert_line_data + concatenate_lines: + lods byte [esi] + cmp al,20h + je concatenate_lines + cmp al,9 + je concatenate_lines + cmp al,1Ah + je unexpected_end_of_file + or al,al + jz unexpected_end_of_file + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + cmp al,3Bh + jne extra_characters_on_line + find_concatenated_line: + lods byte [esi] + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + or al,al + jz concatenate_ok + cmp al,1Ah + jne find_concatenated_line + jmp unexpected_end_of_file + concatenate_lf: + lods byte [esi] + cmp al,0Dh + je concatenate_ok + dec esi + jmp concatenate_ok + concatenate_cr: + lods byte [esi] + cmp al,0Ah + je concatenate_ok + dec esi + concatenate_ok: + inc dword [esp] + jmp convert_line_data + ignore_comment: + lods byte [esi] + cmp al,0Ah + je lf_character + cmp al,0Dh + je cr_character + or al,al + jz line_end + cmp al,1Ah + jne ignore_comment + line_end: + xor al,al + stos byte [edi] + pop ecx + ret + +lower_case: + mov edi,converted + mov ebx,characters + convert_case: + lods byte [esi] + xlat byte [ebx] + stos byte [edi] + loop convert_case + case_ok: + ret + +get_directive: + push edi + mov edx,esi + mov ebp,ecx + call lower_case + pop edi + scan_directives: + mov esi,converted + movzx eax,byte [edi] + or al,al + jz no_directive + mov ecx,ebp + inc edi + mov ebx,edi + add ebx,eax + mov ah,[esi] + cmp ah,[edi] + jb no_directive + ja next_directive + cmp cl,al + jne next_directive + repe cmps byte [esi],[edi] + jb no_directive + je directive_found + next_directive: + mov edi,ebx + add edi,2 + jmp scan_directives + no_directive: + mov esi,edx + mov ecx,ebp + stc + ret + directive_found: + call get_directive_handler_base + directive_handler: + lea esi,[edx+ebp] + movzx ecx,word [ebx] + add eax,ecx + clc + ret + get_directive_handler_base: + mov eax,[esp] + ret + +preprocess_line: + mov eax,esp + sub eax,[stack_limit] + cmp eax,100h + jb stack_overflow + push ecx esi + preprocess_current_line: + mov esi,[current_line] + add esi,16 + cmp word [esi],3Bh + jne line_start_ok + add esi,2 + line_start_ok: + test [macro_status],0F0h + jnz macro_preprocessing + cmp byte [esi],1Ah + jne not_fix_constant + movzx edx,byte [esi+1] + lea edx,[esi+2+edx] + cmp word [edx],031Ah + jne not_fix_constant + mov ebx,characters + movzx eax,byte [edx+2] + xlat byte [ebx] + ror eax,8 + mov al,[edx+3] + xlat byte [ebx] + ror eax,8 + mov al,[edx+4] + xlat byte [ebx] + ror eax,16 + cmp eax,'fix' + je define_fix_constant + not_fix_constant: + call process_fix_constants + jmp initial_preprocessing_ok + macro_preprocessing: + call process_macro_operators + initial_preprocessing_ok: + mov esi,[current_line] + add esi,16 + mov al,[macro_status] + test al,2 + jnz skip_macro_block + test al,1 + jnz find_macro_block + preprocess_instruction: + mov [current_offset],esi + lods byte [esi] + movzx ecx,byte [esi] + inc esi + cmp al,1Ah + jne not_preprocessor_symbol + cmp cl,3 + jb not_preprocessor_directive + push edi + mov edi,preprocessor_directives + call get_directive + pop edi + jc not_preprocessor_directive + mov byte [edx-2],3Bh + jmp near eax + not_preprocessor_directive: + xor ch,ch + call get_preprocessor_symbol + jc not_macro + mov byte [ebx-2],3Bh + mov [struc_name],0 + jmp use_macro + not_macro: + mov [struc_name],esi + add esi,ecx + lods byte [esi] + cmp al,':' + je preprocess_label + cmp al,1Ah + jne not_preprocessor_symbol + lods byte [esi] + cmp al,3 + jne not_symbolic_constant + mov ebx,characters + movzx eax,byte [esi] + xlat byte [ebx] + ror eax,8 + mov al,[esi+1] + xlat byte [ebx] + ror eax,8 + mov al,[esi+2] + xlat byte [ebx] + ror eax,16 + cmp eax,'equ' + je define_equ_constant + mov al,3 + not_symbolic_constant: + mov ch,1 + mov cl,al + call get_preprocessor_symbol + jc not_preprocessor_symbol + push edx esi + mov esi,[struc_name] + mov [struc_label],esi + sub [struc_label],2 + mov cl,[esi-1] + mov ch,10b + call get_preprocessor_symbol + jc struc_name_ok + mov ecx,[edx+12] + add ecx,3 + lea ebx,[edi+ecx] + mov ecx,edi + sub ecx,[struc_label] + lea esi,[edi-1] + lea edi,[ebx-1] + std + rep movs byte [edi],[esi] + cld + mov edi,[struc_label] + mov esi,[edx+8] + mov ecx,[edx+12] + add [struc_name],ecx + add [struc_name],3 + call move_data + mov al,3Ah + stos byte [edi] + mov ax,3Bh + stos word [edi] + mov edi,ebx + pop esi + add esi,[edx+12] + add esi,3 + pop edx + jmp use_macro + struc_name_ok: + mov edx,[struc_name] + movzx eax,byte [edx-1] + add edx,eax + push edi + lea esi,[edi-1] + mov ecx,edi + sub ecx,edx + std + rep movs byte [edi],[esi] + cld + pop edi + inc edi + mov al,3Ah + mov [edx],al + inc al + mov [edx+1],al + pop esi edx + inc esi + jmp use_macro + preprocess_label: + dec esi + sub esi,ecx + lea ebp,[esi-2] + mov ch,10b + call get_preprocessor_symbol + jnc symbolic_constant_in_label + lea esi,[esi+ecx+1] + cmp byte [esi],':' + jne preprocess_instruction + inc esi + jmp preprocess_instruction + symbolic_constant_in_label: + mov ebx,[edx+8] + mov ecx,[edx+12] + add ecx,ebx + check_for_broken_label: + cmp ebx,ecx + je label_broken + cmp byte [ebx],1Ah + jne label_broken + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp ebx,ecx + je label_constant_ok + cmp byte [ebx],':' + jne label_broken + inc ebx + cmp byte [ebx],':' + jne check_for_broken_label + inc ebx + jmp check_for_broken_label + label_broken: + push line_preprocessed + jmp replace_symbolic_constant + label_constant_ok: + mov ecx,edi + sub ecx,esi + mov edi,[edx+12] + add edi,ebp + push edi + lea eax,[edi+ecx] + push eax + cmp esi,edi + je replace_label + jb move_rest_of_line_up + rep movs byte [edi],[esi] + jmp replace_label + move_rest_of_line_up: + lea esi,[esi+ecx-1] + lea edi,[edi+ecx-1] + std + rep movs byte [edi],[esi] + cld + replace_label: + mov ecx,[edx+12] + mov edi,[esp+4] + sub edi,ecx + mov esi,[edx+8] + rep movs byte [edi],[esi] + pop edi esi + inc esi + jmp preprocess_instruction + not_preprocessor_symbol: + mov esi,[current_offset] + call process_equ_constants + line_preprocessed: + pop esi ecx + ret + +get_preprocessor_symbol: + push ebp edi esi + mov ebp,ecx + shl ebp,22 + movzx ecx,cl + mov ebx,hash_tree + mov edi,10 + follow_hashes_roots: + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec edi + jnz follow_hashes_roots + mov edi,ebx + call calculate_hash + mov ebp,eax + and ebp,3FFh + shl ebp,10 + xor ebp,eax + mov ebx,edi + mov edi,22 + follow_hashes_tree: + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec edi + jnz follow_hashes_tree + mov al,cl + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + compare_with_preprocessor_symbol: + mov edi,[edx+4] + cmp edi,1 + jbe next_equal_hash + repe cmps byte [esi],[edi] + je preprocessor_symbol_found + mov cl,al + mov esi,[esp] + next_equal_hash: + mov edx,[edx] + or edx,edx + jnz compare_with_preprocessor_symbol + preprocessor_symbol_not_found: + pop esi edi ebp + stc + ret + preprocessor_symbol_found: + pop ebx edi ebp + clc + ret + calculate_hash: + xor ebx,ebx + mov eax,2166136261 + mov ebp,16777619 + fnv1a_hash: + xor al,[esi+ebx] + mul ebp + inc bl + cmp bl,cl + jb fnv1a_hash + ret +add_preprocessor_symbol: + push edi esi + xor eax,eax + or cl,cl + jz reshape_hash + cmp ch,11b + je preprocessor_symbol_name_ok + push ecx + movzx ecx,cl + mov edi,preprocessor_directives + call get_directive + jnc reserved_word_used_as_symbol + pop ecx + preprocessor_symbol_name_ok: + call calculate_hash + reshape_hash: + mov ebp,eax + and ebp,3FFh + shr eax,10 + xor ebp,eax + shl ecx,22 + or ebp,ecx + mov ebx,hash_tree + mov ecx,32 + find_leave_for_symbol: + mov edx,[ebx] + or edx,edx + jz extend_hashes_tree + xor eax,eax + rol ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec ecx + jnz find_leave_for_symbol + mov edx,[ebx] + or edx,edx + jz add_symbol_entry + shr ebp,30 + cmp ebp,11b + je reuse_symbol_entry + cmp dword [edx+4],0 + jne add_symbol_entry + find_entry_to_reuse: + mov edi,[edx] + or edi,edi + jz reuse_symbol_entry + cmp dword [edi+4],0 + jne reuse_symbol_entry + mov edx,edi + jmp find_entry_to_reuse + add_symbol_entry: + mov eax,edx + mov edx,[labels_list] + sub edx,16 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + mov [edx],eax + mov [ebx],edx + reuse_symbol_entry: + pop esi edi + mov [edx+4],esi + ret + extend_hashes_tree: + mov edx,[labels_list] + sub edx,8 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + xor eax,eax + mov [edx],eax + mov [edx+4],eax + shl ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + dec ecx + jnz extend_hashes_tree + mov edx,[labels_list] + sub edx,16 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + mov dword [edx],0 + mov [ebx],edx + pop esi edi + mov [edx+4],esi + ret + +define_fix_constant: + add edx,5 + add esi,2 + push edx + mov ch,11b + jmp define_preprocessor_constant +define_equ_constant: + add esi,3 + push esi + call process_equ_constants + mov esi,[struc_name] + mov ch,10b + define_preprocessor_constant: + mov byte [esi-2],3Bh + mov cl,[esi-1] + call add_preprocessor_symbol + pop ebx + mov ecx,edi + dec ecx + sub ecx,ebx + mov [edx+8],ebx + mov [edx+12],ecx + jmp line_preprocessed +define_symbolic_constant: + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + mov ch,10b + call add_preprocessor_symbol + movzx eax,byte [esi-1] + add esi,eax + lea ecx,[edi-1] + sub ecx,esi + mov [edx+8],esi + mov [edx+12],ecx + jmp line_preprocessed + +define_struc: + mov ch,1 + jmp make_macro +define_macro: + xor ch,ch + make_macro: + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + call add_preprocessor_symbol + mov eax,[current_line] + mov [edx+12],eax + movzx eax,byte [esi-1] + add esi,eax + mov [edx+8],esi + mov al,[macro_status] + and al,0F0h + or al,1 + mov [macro_status],al + mov eax,[current_line] + mov [error_line],eax + xor ebp,ebp + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + je found_macro_block + dec esi + skip_macro_arguments: + lods byte [esi] + cmp al,1Ah + je skip_macro_argument + cmp al,'[' + jne invalid_macro_arguments + or ebp,-1 + jz invalid_macro_arguments + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + skip_macro_argument: + movzx eax,byte [esi] + inc esi + add esi,eax + lods byte [esi] + cmp al,':' + je macro_argument_with_default_value + cmp al,'=' + je macro_argument_with_default_value + cmp al,'*' + jne macro_argument_end + lods byte [esi] + macro_argument_end: + cmp al,',' + je skip_macro_arguments + cmp al,'&' + je macro_arguments_finisher + cmp al,']' + jne end_macro_arguments + not ebp + macro_arguments_finisher: + lods byte [esi] + end_macro_arguments: + or ebp,ebp + jnz invalid_macro_arguments + or al,al + jz line_preprocessed + cmp al,'{' + je found_macro_block + jmp invalid_macro_arguments + macro_argument_with_default_value: + or [skip_default_argument_value],-1 + call skip_macro_argument_value + inc esi + jmp macro_argument_end + skip_macro_argument_value: + cmp byte [esi],'<' + jne simple_argument + mov ecx,1 + inc esi + enclosed_argument: + lods byte [esi] + or al,al + jz invalid_macro_arguments + cmp al,1Ah + je enclosed_symbol + cmp al,22h + je enclosed_string + cmp al,'>' + je enclosed_argument_end + cmp al,'<' + jne enclosed_argument + inc ecx + jmp enclosed_argument + enclosed_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp enclosed_argument + enclosed_string: + lods dword [esi] + add esi,eax + jmp enclosed_argument + enclosed_argument_end: + loop enclosed_argument + lods byte [esi] + or al,al + jz argument_value_end + cmp al,',' + je argument_value_end + cmp [skip_default_argument_value],0 + je invalid_macro_arguments + cmp al,'{' + je argument_value_end + cmp al,'&' + je argument_value_end + or ebp,ebp + jz invalid_macro_arguments + cmp al,']' + je argument_value_end + jmp invalid_macro_arguments + simple_argument: + lods byte [esi] + or al,al + jz argument_value_end + cmp al,',' + je argument_value_end + cmp al,22h + je argument_string + cmp al,1Ah + je argument_symbol + cmp [skip_default_argument_value],0 + je simple_argument + cmp al,'{' + je argument_value_end + cmp al,'&' + je argument_value_end + or ebp,ebp + jz simple_argument + cmp al,']' + je argument_value_end + argument_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp simple_argument + argument_string: + lods dword [esi] + add esi,eax + jmp simple_argument + argument_value_end: + dec esi + ret + find_macro_block: + add esi,2 + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + jne unexpected_characters + found_macro_block: + or [macro_status],2 + skip_macro_block: + lods byte [esi] + cmp al,1Ah + je skip_macro_symbol + cmp al,3Bh + je skip_macro_symbol + cmp al,22h + je skip_macro_string + or al,al + jz line_preprocessed + cmp al,'}' + jne skip_macro_block + mov al,[macro_status] + and [macro_status],0F0h + test al,8 + jnz use_instant_macro + cmp byte [esi],0 + je line_preprocessed + mov ecx,edi + sub ecx,esi + mov edx,esi + lea esi,[esi+ecx-1] + lea edi,[edi+1+16] + mov ebx,edi + dec edi + std + rep movs byte [edi],[esi] + cld + mov edi,edx + xor al,al + stos byte [edi] + mov esi,[current_line] + mov [current_line],edi + mov ecx,4 + rep movs dword [edi],[esi] + mov edi,ebx + jmp initial_preprocessing_ok + skip_macro_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp skip_macro_block + skip_macro_string: + lods dword [esi] + add esi,eax + jmp skip_macro_block +postpone_directive: + push esi + mov esi,edx + xor ecx,ecx + call add_preprocessor_symbol + mov eax,[current_line] + mov [error_line],eax + mov [edx+12],eax + pop esi + mov [edx+8],esi + mov al,[macro_status] + and al,0F0h + or al,1 + mov [macro_status],al + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + jne unexpected_characters + jmp found_macro_block +rept_directive: + mov [base_code],0 + jmp define_instant_macro +irp_directive: + mov [base_code],1 + jmp define_instant_macro +irps_directive: + mov [base_code],2 + jmp define_instant_macro +irpv_directive: + mov [base_code],3 + jmp define_instant_macro +match_directive: + mov [base_code],10h +define_instant_macro: + mov al,[macro_status] + and al,0F0h + or al,8+1 + mov [macro_status],al + mov eax,[current_line] + mov [error_line],eax + mov [instant_macro_start],esi + cmp [base_code],10h + je prepare_match + skip_parameters: + lods byte [esi] + or al,al + jz parameters_skipped + cmp al,'{' + je parameters_skipped + cmp al,22h + je skip_quoted_parameter + cmp al,1Ah + jne skip_parameters + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_parameters + skip_quoted_parameter: + lods dword [esi] + add esi,eax + jmp skip_parameters + parameters_skipped: + dec esi + mov [parameters_end],esi + lods byte [esi] + cmp al,'{' + je found_macro_block + or al,al + jnz invalid_macro_arguments + jmp line_preprocessed +prepare_match: + call skip_pattern + mov [value_type],80h+10b + call process_symbolic_constants + jmp parameters_skipped + skip_pattern: + lods byte [esi] + or al,al + jz invalid_macro_arguments + cmp al,',' + je pattern_skipped + cmp al,22h + je skip_quoted_string_in_pattern + cmp al,1Ah + je skip_symbol_in_pattern + cmp al,'=' + jne skip_pattern + mov al,[esi] + cmp al,1Ah + je skip_pattern + cmp al,22h + je skip_pattern + inc esi + jmp skip_pattern + skip_symbol_in_pattern: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_pattern + skip_quoted_string_in_pattern: + lods dword [esi] + add esi,eax + jmp skip_pattern + pattern_skipped: + ret + +purge_macro: + xor ch,ch + jmp restore_preprocessor_symbol +purge_struc: + mov ch,1 + jmp restore_preprocessor_symbol +restore_equ_constant: + mov ch,10b + restore_preprocessor_symbol: + push ecx + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + call get_preprocessor_symbol + jc no_symbol_to_restore + mov dword [edx+4],0 + jmp symbol_restored + no_symbol_to_restore: + add esi,ecx + symbol_restored: + pop ecx + lods byte [esi] + cmp al,',' + je restore_preprocessor_symbol + or al,al + jnz extra_characters_on_line + jmp line_preprocessed + +process_fix_constants: + mov [value_type],11b + jmp process_symbolic_constants +process_equ_constants: + mov [value_type],10b + process_symbolic_constants: + mov ebp,esi + lods byte [esi] + cmp al,1Ah + je check_symbol + cmp al,22h + je ignore_string + cmp al,'{' + je check_brace + or al,al + jnz process_symbolic_constants + ret + ignore_string: + lods dword [esi] + add esi,eax + jmp process_symbolic_constants + check_brace: + test [value_type],80h + jz process_symbolic_constants + ret + no_replacing: + movzx ecx,byte [esi-1] + add esi,ecx + jmp process_symbolic_constants + check_symbol: + mov cl,[esi] + inc esi + mov ch,[value_type] + call get_preprocessor_symbol + jc no_replacing + mov [current_section],edi + replace_symbolic_constant: + mov ecx,[edx+12] + mov edx,[edx+8] + xchg esi,edx + call move_data + mov esi,edx + process_after_replaced: + lods byte [esi] + cmp al,1Ah + je symbol_after_replaced + stos byte [edi] + cmp al,22h + je string_after_replaced + cmp al,'{' + je brace_after_replaced + or al,al + jnz process_after_replaced + mov ecx,edi + sub ecx,esi + mov edi,ebp + call move_data + mov esi,edi + ret + move_data: + lea eax,[edi+ecx] + cmp eax,[memory_end] + jae out_of_memory + shr ecx,1 + jnc movsb_ok + movs byte [edi],[esi] + movsb_ok: + shr ecx,1 + jnc movsw_ok + movs word [edi],[esi] + movsw_ok: + rep movs dword [edi],[esi] + ret + string_after_replaced: + lods dword [esi] + stos dword [edi] + mov ecx,eax + call move_data + jmp process_after_replaced + brace_after_replaced: + test [value_type],80h + jz process_after_replaced + mov edx,edi + mov ecx,[current_section] + sub edx,ecx + sub ecx,esi + rep movs byte [edi],[esi] + mov ecx,edi + sub ecx,esi + mov edi,ebp + call move_data + lea esi,[ebp+edx] + ret + symbol_after_replaced: + mov cl,[esi] + inc esi + mov ch,[value_type] + call get_preprocessor_symbol + jnc replace_symbolic_constant + movzx ecx,byte [esi-1] + mov al,1Ah + mov ah,cl + stos word [edi] + call move_data + jmp process_after_replaced +process_macro_operators: + xor dl,dl + mov ebp,edi + before_macro_operators: + mov edi,esi + lods byte [esi] + cmp al,'`' + je symbol_conversion + cmp al,'#' + je concatenation + cmp al,1Ah + je symbol_before_macro_operators + cmp al,3Bh + je no_more_macro_operators + cmp al,22h + je string_before_macro_operators + xor dl,dl + or al,al + jnz before_macro_operators + mov edi,esi + ret + no_more_macro_operators: + mov edi,ebp + ret + symbol_before_macro_operators: + mov dl,1Ah + mov ebx,esi + lods byte [esi] + movzx ecx,al + jecxz symbol_before_macro_operators_ok + mov edi,esi + cmp byte [esi],'\' + je escaped_symbol + symbol_before_macro_operators_ok: + add esi,ecx + jmp before_macro_operators + string_before_macro_operators: + mov dl,22h + mov ebx,esi + lods dword [esi] + add esi,eax + jmp before_macro_operators + escaped_symbol: + dec byte [edi-1] + dec ecx + inc esi + cmp ecx,1 + rep movs byte [edi],[esi] + jne after_macro_operators + mov al,[esi-1] + mov ecx,ebx + mov ebx,characters + xlat byte [ebx] + mov ebx,ecx + or al,al + jnz after_macro_operators + sub edi,3 + mov al,[esi-1] + stos byte [edi] + xor dl,dl + jmp after_macro_operators + reduce_symbol_conversion: + inc esi + symbol_conversion: + mov edx,esi + mov al,[esi] + cmp al,1Ah + jne symbol_character_conversion + lods word [esi] + movzx ecx,ah + lea ebx,[edi+3] + jecxz convert_to_quoted_string + cmp byte [esi],'\' + jne convert_to_quoted_string + inc esi + dec ecx + dec ebx + jmp convert_to_quoted_string + symbol_character_conversion: + cmp al,22h + je after_macro_operators + cmp al,'`' + je reduce_symbol_conversion + lea ebx,[edi+5] + xor ecx,ecx + or al,al + jz convert_to_quoted_string + cmp al,'#' + je convert_to_quoted_string + inc ecx + convert_to_quoted_string: + sub ebx,edx + ja shift_line_data + mov al,22h + mov dl,al + stos byte [edi] + mov ebx,edi + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + cmp edi,esi + je before_macro_operators + jmp after_macro_operators + shift_line_data: + push ecx + mov edx,esi + lea esi,[ebp-1] + add ebp,ebx + lea edi,[ebp-1] + lea ecx,[esi+1] + sub ecx,edx + std + rep movs byte [edi],[esi] + cld + pop eax + sub edi,3 + mov dl,22h + mov [edi-1],dl + mov ebx,edi + mov [edi],eax + lea esi,[edi+4+eax] + jmp before_macro_operators + concatenation: + cmp dl,1Ah + je symbol_concatenation + cmp dl,22h + je string_concatenation + no_concatenation: + cmp esi,edi + je before_macro_operators + jmp after_macro_operators + symbol_concatenation: + cmp byte [esi],1Ah + jne no_concatenation + inc esi + lods byte [esi] + movzx ecx,al + jecxz do_symbol_concatenation + cmp byte [esi],'\' + je concatenate_escaped_symbol + do_symbol_concatenation: + add [ebx],cl + jc name_too_long + rep movs byte [edi],[esi] + jmp after_macro_operators + concatenate_escaped_symbol: + inc esi + dec ecx + jz do_symbol_concatenation + movzx eax,byte [esi] + cmp byte [characters+eax],0 + jne do_symbol_concatenation + sub esi,3 + jmp no_concatenation + string_concatenation: + cmp byte [esi],22h + je do_string_concatenation + cmp byte [esi],'`' + jne no_concatenation + concatenate_converted_symbol: + inc esi + mov al,[esi] + cmp al,'`' + je concatenate_converted_symbol + cmp al,22h + je do_string_concatenation + cmp al,1Ah + jne concatenate_converted_symbol_character + inc esi + lods byte [esi] + movzx ecx,al + jecxz finish_concatenating_converted_symbol + cmp byte [esi],'\' + jne finish_concatenating_converted_symbol + inc esi + dec ecx + finish_concatenating_converted_symbol: + add [ebx],ecx + rep movs byte [edi],[esi] + jmp after_macro_operators + concatenate_converted_symbol_character: + or al,al + jz after_macro_operators + cmp al,'#' + je after_macro_operators + inc dword [ebx] + movs byte [edi],[esi] + jmp after_macro_operators + do_string_concatenation: + inc esi + lods dword [esi] + mov ecx,eax + add [ebx],eax + rep movs byte [edi],[esi] + after_macro_operators: + lods byte [esi] + cmp al,'`' + je symbol_conversion + cmp al,'#' + je concatenation + stos byte [edi] + cmp al,1Ah + je symbol_after_macro_operators + cmp al,3Bh + je no_more_macro_operators + cmp al,22h + je string_after_macro_operators + xor dl,dl + or al,al + jnz after_macro_operators + ret + symbol_after_macro_operators: + mov dl,1Ah + mov ebx,edi + lods byte [esi] + stos byte [edi] + movzx ecx,al + jecxz symbol_after_macro_operatorss_ok + cmp byte [esi],'\' + je escaped_symbol + symbol_after_macro_operatorss_ok: + rep movs byte [edi],[esi] + jmp after_macro_operators + string_after_macro_operators: + mov dl,22h + mov ebx,edi + lods dword [esi] + stos dword [edi] + mov ecx,eax + rep movs byte [edi],[esi] + jmp after_macro_operators + +use_macro: + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],0 + push [counter_limit] + push dword [edx+4] + mov dword [edx+4],1 + push edx + mov ebx,esi + mov esi,[edx+8] + mov eax,[edx+12] + mov [macro_line],eax + mov [counter_limit],0 + xor ebp,ebp + process_macro_arguments: + mov al,[esi] + or al,al + jz arguments_end + cmp al,'{' + je arguments_end + inc esi + cmp al,'[' + jne get_macro_arguments + mov ebp,esi + inc esi + inc [counter_limit] + get_macro_arguments: + call get_macro_argument + lods byte [esi] + cmp al,',' + je next_argument + cmp al,']' + je next_arguments_group + cmp al,'&' + je arguments_end + dec esi + jmp arguments_end + next_argument: + cmp byte [ebx],',' + jne process_macro_arguments + inc ebx + jmp process_macro_arguments + next_arguments_group: + cmp byte [ebx],',' + jne arguments_end + inc ebx + inc [counter_limit] + mov esi,ebp + jmp process_macro_arguments + get_macro_argument: + lods byte [esi] + movzx ecx,al + mov eax,[counter_limit] + call add_macro_symbol + add esi,ecx + xor eax,eax + mov [default_argument_value],eax + cmp byte [esi],'*' + je required_value + cmp byte [esi],':' + je get_default_value + cmp byte [esi],'=' + jne default_value_ok + get_default_value: + inc esi + mov [default_argument_value],esi + or [skip_default_argument_value],-1 + call skip_macro_argument_value + jmp default_value_ok + required_value: + inc esi + or [default_argument_value],-1 + default_value_ok: + xchg esi,ebx + mov [edx+12],esi + mov [skip_default_argument_value],0 + cmp byte [ebx],'&' + je greedy_macro_argument + call skip_macro_argument_value + call finish_macro_argument + jmp got_macro_argument + greedy_macro_argument: + call skip_foreign_line + dec esi + mov eax,[edx+12] + mov ecx,esi + sub ecx,eax + mov [edx+8],ecx + got_macro_argument: + xchg esi,ebx + cmp dword [edx+8],0 + jne macro_argument_ok + mov eax,[default_argument_value] + or eax,eax + jz macro_argument_ok + cmp eax,-1 + je invalid_macro_arguments + mov [edx+12],eax + call finish_macro_argument + macro_argument_ok: + ret + finish_macro_argument: + mov eax,[edx+12] + mov ecx,esi + sub ecx,eax + cmp byte [eax],'<' + jne argument_value_length_ok + inc dword [edx+12] + sub ecx,2 + or ecx,80000000h + argument_value_length_ok: + mov [edx+8],ecx + ret + arguments_end: + cmp byte [ebx],0 + jne invalid_macro_arguments + mov eax,[esp+4] + dec eax + call process_macro + pop edx + pop dword [edx+4] + pop [counter_limit] + pop [macro_symbols] + pop [free_additional_memory] + jmp line_preprocessed +use_instant_macro: + push edi [current_line] esi + mov eax,[error_line] + mov [current_line],eax + mov [macro_line],eax + mov esi,[instant_macro_start] + cmp [base_code],10h + jae do_match + cmp [base_code],0 + jne do_irp + call precalculate_value + cmp eax,0 + jl value_out_of_range + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],0 + push [counter_limit] + mov [struc_name],0 + mov [counter_limit],eax + lods byte [esi] + or al,al + jz rept_counters_ok + cmp al,'{' + je rept_counters_ok + cmp al,1Ah + jne invalid_macro_arguments + add_rept_counter: + lods byte [esi] + movzx ecx,al + xor eax,eax + call add_macro_symbol + add esi,ecx + xor eax,eax + mov dword [edx+12],eax + inc eax + mov dword [edx+8],eax + lods byte [esi] + cmp al,':' + jne rept_counter_added + push edx + call precalculate_value + mov edx,eax + add edx,[counter_limit] + jo value_out_of_range + pop edx + mov dword [edx+8],eax + lods byte [esi] + rept_counter_added: + cmp al,',' + jne rept_counters_ok + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + jmp add_rept_counter + rept_counters_ok: + dec esi + cmp [counter_limit],0 + je instant_macro_finish + instant_macro_parameters_ok: + xor eax,eax + call process_macro + instant_macro_finish: + pop [counter_limit] + pop [macro_symbols] + pop [free_additional_memory] + instant_macro_done: + pop ebx esi edx + cmp byte [ebx],0 + je line_preprocessed + mov [current_line],edi + mov ecx,4 + rep movs dword [edi],[esi] + test [macro_status],0Fh + jz instant_macro_attached_line + mov ax,3Bh + stos word [edi] + instant_macro_attached_line: + mov esi,ebx + sub edx,ebx + mov ecx,edx + call move_data + jmp initial_preprocessing_ok + precalculate_value: + push edi + call convert_expression + mov al,')' + stosb + push esi + mov esi,[esp+4] + mov [error_line],0 + mov [value_size],0 + call calculate_expression + cmp [error_line],0 + je value_precalculated + jmp [error] + value_precalculated: + mov eax,[edi] + mov ecx,[edi+4] + cdq + cmp edx,ecx + jne value_out_of_range + cmp dl,[edi+13] + jne value_out_of_range + pop esi edi + ret +do_irp: + cmp byte [esi],1Ah + jne invalid_macro_arguments + movzx eax,byte [esi+1] + lea esi,[esi+2+eax] + lods byte [esi] + cmp [base_code],1 + ja irps_name_ok + cmp al,':' + je irp_with_default_value + cmp al,'=' + je irp_with_default_value + cmp al,'*' + jne irp_name_ok + lods byte [esi] + irp_name_ok: + cmp al,',' + jne invalid_macro_arguments + jmp irp_parameters_start + irp_with_default_value: + xor ebp,ebp + or [skip_default_argument_value],-1 + call skip_macro_argument_value + cmp byte [esi],',' + jne invalid_macro_arguments + inc esi + jmp irp_parameters_start + irps_name_ok: + cmp al,',' + jne invalid_macro_arguments + cmp [base_code],3 + je irp_parameters_start + mov al,[esi] + or al,al + jz instant_macro_done + cmp al,'{' + je instant_macro_done + irp_parameters_start: + xor eax,eax + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],eax + push [counter_limit] + mov [counter_limit],eax + mov [struc_name],eax + cmp [base_code],3 + je get_irpv_parameter + mov ebx,esi + cmp [base_code],2 + je get_irps_parameter + mov edx,[parameters_end] + mov al,[edx] + push eax + mov byte [edx],0 + get_irp_parameter: + inc [counter_limit] + mov esi,[instant_macro_start] + inc esi + call get_macro_argument + cmp byte [ebx],',' + jne irp_parameters_end + inc ebx + jmp get_irp_parameter + irp_parameters_end: + mov esi,ebx + pop eax + mov [esi],al + jmp instant_macro_parameters_ok + get_irps_parameter: + mov esi,[instant_macro_start] + inc esi + lods byte [esi] + movzx ecx,al + inc [counter_limit] + mov eax,[counter_limit] + call add_macro_symbol + mov [edx+12],ebx + cmp byte [ebx],1Ah + je irps_symbol + cmp byte [ebx],22h + je irps_quoted_string + mov eax,1 + jmp irps_parameter_ok + irps_quoted_string: + mov eax,[ebx+1] + add eax,1+4 + jmp irps_parameter_ok + irps_symbol: + movzx eax,byte [ebx+1] + add eax,1+1 + irps_parameter_ok: + mov [edx+8],eax + add ebx,eax + cmp byte [ebx],0 + je irps_parameters_end + cmp byte [ebx],'{' + jne get_irps_parameter + irps_parameters_end: + mov esi,ebx + jmp instant_macro_parameters_ok + get_irpv_parameter: + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + lods byte [esi] + mov ebp,esi + mov cl,al + mov ch,10b + call get_preprocessor_symbol + jc instant_macro_finish + push edx + mark_variable_value: + inc [counter_limit] + mov [edx+4],ebp + next_variable_value: + mov edx,[edx] + or edx,edx + jz variable_values_marked + mov eax,[edx+4] + cmp eax,1 + jbe next_variable_value + mov esi,ebp + movzx ecx,byte [esi-1] + xchg edi,eax + repe cmps byte [esi],[edi] + xchg edi,eax + je mark_variable_value + jmp next_variable_value + variable_values_marked: + pop edx + push [counter_limit] + add_irpv_value: + push edx + mov esi,[instant_macro_start] + inc esi + lods byte [esi] + movzx ecx,al + mov eax,[esp+4] + call add_macro_symbol + mov ebx,edx + pop edx + mov ecx,[edx+12] + mov eax,[edx+8] + mov [ebx+12],eax + mov [ebx+8],ecx + collect_next_variable_value: + mov edx,[edx] + or edx,edx + jz variable_values_collected + cmp ebp,[edx+4] + jne collect_next_variable_value + dec dword [esp] + jnz add_irpv_value + variable_values_collected: + pop eax + mov esi,ebp + movzx ecx,byte [esi-1] + add esi,ecx + cmp byte [esi],0 + je instant_macro_parameters_ok + cmp byte [esi],'{' + jne invalid_macro_arguments + jmp instant_macro_parameters_ok + +do_match: + mov ebx,esi + call skip_pattern + call exact_match + mov edx,edi + mov al,[ebx] + cmp al,1Ah + je free_match + cmp al,',' + jne instant_macro_done + cmp esi,[parameters_end] + je matched_pattern + jmp instant_macro_done + free_match: + add edx,12 + cmp edx,[memory_end] + ja out_of_memory + mov [edx-12],ebx + mov [edx-8],esi + call skip_match_element + jc try_different_matching + mov [edx-4],esi + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp byte [ebx],1Ah + je free_match + find_exact_match: + call exact_match + cmp esi,[parameters_end] + je end_matching + cmp byte [ebx],1Ah + je free_match + mov ebx,[edx-12] + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + mov esi,[edx-4] + jmp match_more_elements + try_different_matching: + sub edx,12 + cmp edx,edi + je instant_macro_done + mov ebx,[edx-12] + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp byte [ebx],1Ah + je try_different_matching + mov esi,[edx-4] + match_more_elements: + call skip_match_element + jc try_different_matching + mov [edx-4],esi + jmp find_exact_match + skip_match_element: + cmp esi,[parameters_end] + je cannot_match + mov al,[esi] + cmp al,1Ah + je skip_match_symbol + cmp al,22h + je skip_match_quoted_string + add esi,1 + ret + skip_match_quoted_string: + mov eax,[esi+1] + add esi,5 + jmp skip_match_ok + skip_match_symbol: + movzx eax,byte [esi+1] + add esi,2 + skip_match_ok: + add esi,eax + ret + cannot_match: + stc + ret + exact_match: + cmp esi,[parameters_end] + je exact_match_complete + mov ah,[esi] + mov al,[ebx] + cmp al,',' + je exact_match_complete + cmp al,1Ah + je exact_match_complete + cmp al,'=' + je match_verbatim + call match_elements + je exact_match + exact_match_complete: + ret + match_verbatim: + inc ebx + call match_elements + je exact_match + dec ebx + ret + match_elements: + mov al,[ebx] + cmp al,1Ah + je match_symbols + cmp al,22h + je match_quoted_strings + cmp al,ah + je symbol_characters_matched + ret + symbol_characters_matched: + lea ebx,[ebx+1] + lea esi,[esi+1] + ret + match_quoted_strings: + mov ecx,[ebx+1] + add ecx,5 + jmp compare_elements + match_symbols: + movzx ecx,byte [ebx+1] + add ecx,2 + compare_elements: + mov eax,esi + mov ebp,edi + mov edi,ebx + repe cmps byte [esi],[edi] + jne elements_mismatch + mov ebx,edi + mov edi,ebp + ret + elements_mismatch: + mov esi,eax + mov edi,ebp + ret + end_matching: + cmp byte [ebx],',' + jne instant_macro_done + matched_pattern: + xor eax,eax + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],eax + push [counter_limit] + mov [counter_limit],eax + mov [struc_name],eax + push esi edi edx + add_matched_symbol: + cmp edi,[esp] + je matched_symbols_ok + mov esi,[edi] + inc esi + lods byte [esi] + movzx ecx,al + xor eax,eax + call add_macro_symbol + mov eax,[edi+4] + mov dword [edx+12],eax + mov ecx,[edi+8] + sub ecx,eax + mov dword [edx+8],ecx + add edi,12 + jmp add_matched_symbol + matched_symbols_ok: + pop edx edi esi + jmp instant_macro_parameters_ok + +process_macro: + push dword [macro_status] + or [macro_status],10h + push [counter] + push [macro_block] + push [macro_block_line] + push [macro_block_line_number] + push [struc_label] + push [struc_name] + push eax + push [current_line] + lods byte [esi] + cmp al,'{' + je macro_instructions_start + or al,al + jnz unexpected_characters + find_macro_instructions: + mov [macro_line],esi + add esi,16+2 + lods byte [esi] + or al,al + jz find_macro_instructions + cmp al,'{' + je macro_instructions_start + cmp al,3Bh + jne unexpected_characters + call skip_foreign_symbol + jmp find_macro_instructions + macro_instructions_start: + mov ecx,80000000h + mov [macro_block],esi + mov eax,[macro_line] + mov [macro_block_line],eax + mov [macro_block_line_number],ecx + xor eax,eax + mov [counter],eax + cmp [counter_limit],eax + je process_macro_line + inc [counter] + process_macro_line: + lods byte [esi] + or al,al + jz process_next_line + cmp al,'}' + je macro_block_processed + dec esi + mov [current_line],edi + lea eax,[edi+10h] + cmp eax,[memory_end] + jae out_of_memory + mov eax,[esp+4] + or eax,eax + jz instant_macro_line_header + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,[esp] + stos dword [edi] + mov eax,[macro_line] + stos dword [edi] + jmp macro_line_header_ok + instant_macro_line_header: + mov eax,[esp] + add eax,16 + find_defining_directive: + inc eax + cmp byte [eax-1],3Bh + je defining_directive_ok + cmp byte [eax-1],1Ah + jne find_defining_directive + push eax + movzx eax,byte [eax] + inc eax + add [esp],eax + pop eax + jmp find_defining_directive + defining_directive_ok: + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,[macro_line] + stos dword [edi] + stos dword [edi] + macro_line_header_ok: + or [macro_status],20h + push ebx ecx + test [macro_status],0Fh + jz process_macro_line_element + mov ax,3Bh + stos word [edi] + process_macro_line_element: + lea eax,[edi+100h] + cmp eax,[memory_end] + jae out_of_memory + lods byte [esi] + cmp al,'}' + je macro_line_processed + or al,al + jz macro_line_processed + cmp al,1Ah + je process_macro_symbol + cmp al,3Bh + je macro_foreign_line + and [macro_status],not 20h + stos byte [edi] + cmp al,22h + jne process_macro_line_element + copy_macro_string: + mov ecx,[esi] + add ecx,4 + call move_data + jmp process_macro_line_element + process_macro_symbol: + push esi edi + test [macro_status],20h + jz not_macro_directive + movzx ecx,byte [esi] + inc esi + mov edi,macro_directives + call get_directive + jnc process_macro_directive + dec esi + jmp not_macro_directive + process_macro_directive: + mov edx,eax + pop edi eax + mov byte [edi],0 + inc edi + pop ecx ebx + jmp near edx + not_macro_directive: + and [macro_status],not 20h + movzx ecx,byte [esi] + inc esi + mov eax,[counter] + call get_macro_symbol + jnc group_macro_symbol + xor eax,eax + cmp [counter],eax + je multiple_macro_symbol_values + call get_macro_symbol + jc not_macro_symbol + replace_macro_symbol: + pop edi eax + mov ecx,[edx+8] + mov edx,[edx+12] + or edx,edx + jz replace_macro_counter + and ecx,not 80000000h + xchg esi,edx + call move_data + mov esi,edx + jmp process_macro_line_element + group_macro_symbol: + xor eax,eax + cmp [counter],eax + je replace_macro_symbol + push esi edx + sub esi,ecx + call get_macro_symbol + mov ebx,edx + pop edx esi + jc replace_macro_symbol + cmp edx,ebx + ja replace_macro_symbol + mov edx,ebx + jmp replace_macro_symbol + multiple_macro_symbol_values: + inc eax + push eax + call get_macro_symbol + pop eax + jc not_macro_symbol + pop edi + push ecx + mov ecx,[edx+8] + mov edx,[edx+12] + xchg esi,edx + btr ecx,31 + jc enclose_macro_symbol_value + rep movs byte [edi],[esi] + jmp macro_symbol_value_ok + enclose_macro_symbol_value: + mov byte [edi],'<' + inc edi + rep movs byte [edi],[esi] + mov byte [edi],'>' + inc edi + macro_symbol_value_ok: + cmp eax,[counter_limit] + je multiple_macro_symbol_values_ok + mov byte [edi],',' + inc edi + mov esi,edx + pop ecx + push edi + sub esi,ecx + jmp multiple_macro_symbol_values + multiple_macro_symbol_values_ok: + pop ecx eax + mov esi,edx + jmp process_macro_line_element + replace_macro_counter: + mov eax,[counter] + and eax,not 80000000h + jz group_macro_counter + add ecx,eax + dec ecx + call store_number_symbol + jmp process_macro_line_element + group_macro_counter: + mov edx,ecx + xor ecx,ecx + multiple_macro_counter_values: + push ecx edx + add ecx,edx + call store_number_symbol + pop edx ecx + inc ecx + cmp ecx,[counter_limit] + je process_macro_line_element + mov byte [edi],',' + inc edi + jmp multiple_macro_counter_values + store_number_symbol: + cmp ecx,0 + jge numer_symbol_sign_ok + neg ecx + mov al,'-' + stos byte [edi] + numer_symbol_sign_ok: + mov ax,1Ah + stos word [edi] + push edi + mov eax,ecx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + store_number_digits: + div ecx + push edx + or bl,bl + jnz store_number_digit + cmp ecx,1 + je store_number_digit + or al,al + jz number_digit_ok + not bl + store_number_digit: + add al,30h + stos byte [edi] + number_digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz store_number_digits + pop ebx + mov eax,edi + sub eax,ebx + mov [ebx-1],al + ret + not_macro_symbol: + pop edi esi + mov al,1Ah + stos byte [edi] + mov al,[esi] + inc esi + stos byte [edi] + cmp byte [esi],'.' + jne copy_raw_symbol + mov ebx,[esp+8+8] + or ebx,ebx + jz copy_raw_symbol + cmp al,1 + je copy_struc_name + xchg esi,ebx + movzx ecx,byte [esi-1] + add [edi-1],cl + jc name_too_long + rep movs byte [edi],[esi] + xchg esi,ebx + copy_raw_symbol: + movzx ecx,al + rep movs byte [edi],[esi] + jmp process_macro_line_element + copy_struc_name: + inc esi + xchg esi,ebx + movzx ecx,byte [esi-1] + mov [edi-1],cl + rep movs byte [edi],[esi] + xchg esi,ebx + mov eax,[esp+8+12] + cmp byte [eax],3Bh + je process_macro_line_element + cmp byte [eax],1Ah + jne disable_replaced_struc_name + mov byte [eax],3Bh + jmp process_macro_line_element + disable_replaced_struc_name: + mov ebx,[esp+8+8] + push esi edi + lea edi,[ebx-3] + lea esi,[edi-2] + lea ecx,[esi+1] + sub ecx,eax + std + rep movs byte [edi],[esi] + cld + mov word [eax],3Bh + pop edi esi + jmp process_macro_line_element + skip_foreign_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + skip_foreign_line: + lods byte [esi] + cmp al,1Ah + je skip_foreign_symbol + cmp al,3Bh + je skip_foreign_symbol + cmp al,22h + je skip_foreign_string + or al,al + jnz skip_foreign_line + ret + skip_foreign_string: + lods dword [esi] + add esi,eax + jmp skip_foreign_line + macro_foreign_line: + call skip_foreign_symbol + macro_line_processed: + mov byte [edi],0 + inc edi + push eax + call preprocess_line + pop eax + pop ecx ebx + cmp al,'}' + je macro_block_processed + process_next_line: + inc ecx + mov [macro_line],esi + add esi,16+2 + jmp process_macro_line + macro_block_processed: + call close_macro_block + jc process_macro_line + pop [current_line] + add esp,12 + pop [macro_block_line_number] + pop [macro_block_line] + pop [macro_block] + pop [counter] + pop eax + and al,0F0h + and [macro_status],0Fh + or [macro_status],al + ret + +local_symbols: + lods byte [esi] + cmp al,1Ah + jne invalid_argument + mov byte [edi-1],3Bh + xor al,al + stos byte [edi] + make_local_symbol: + push ecx + lods byte [esi] + movzx ecx,al + mov eax,[counter] + call add_macro_symbol + mov [edx+12],edi + movzx eax,[locals_counter] + add eax,ecx + inc eax + cmp eax,100h + jae name_too_long + lea ebp,[edi+2+eax] + cmp ebp,[memory_end] + jae out_of_memory + mov ah,al + mov al,1Ah + stos word [edi] + rep movs byte [edi],[esi] + mov al,'?' + stos byte [edi] + push esi + mov esi,locals_counter+1 + movzx ecx,[locals_counter] + rep movs byte [edi],[esi] + pop esi + mov eax,edi + sub eax,[edx+12] + mov [edx+8],eax + xor al,al + stos byte [edi] + mov eax,locals_counter + movzx ecx,byte [eax] + counter_loop: + inc byte [eax+ecx] + cmp byte [eax+ecx],'9'+1 + jb counter_ok + jne letter_digit + mov byte [eax+ecx],'A' + jmp counter_ok + letter_digit: + cmp byte [eax+ecx],'Z'+1 + jb counter_ok + jne small_letter_digit + mov byte [eax+ecx],'a' + jmp counter_ok + small_letter_digit: + cmp byte [eax+ecx],'z'+1 + jb counter_ok + mov byte [eax+ecx],'0' + loop counter_loop + inc byte [eax] + movzx ecx,byte [eax] + mov byte [eax+ecx],'0' + counter_ok: + pop ecx + lods byte [esi] + cmp al,'}' + je macro_block_processed + or al,al + jz process_next_line + cmp al,',' + jne extra_characters_on_line + dec edi + lods byte [esi] + cmp al,1Ah + je make_local_symbol + jmp invalid_argument +common_block: + call close_macro_block + jc process_macro_line + mov [counter],0 + jmp new_macro_block +forward_block: + cmp [counter_limit],0 + je common_block + call close_macro_block + jc process_macro_line + mov [counter],1 + jmp new_macro_block +reverse_block: + cmp [counter_limit],0 + je common_block + call close_macro_block + jc process_macro_line + mov eax,[counter_limit] + or eax,80000000h + mov [counter],eax + new_macro_block: + mov [macro_block],esi + mov eax,[macro_line] + mov [macro_block_line],eax + mov [macro_block_line_number],ecx + jmp process_macro_line +close_macro_block: + cmp esi,[macro_block] + je block_closed + cmp [counter],0 + je block_closed + jl reverse_counter + mov eax,[counter] + cmp eax,[counter_limit] + je block_closed + inc [counter] + jmp continue_block + reverse_counter: + mov eax,[counter] + dec eax + cmp eax,80000000h + je block_closed + mov [counter],eax + continue_block: + mov esi,[macro_block] + mov eax,[macro_block_line] + mov [macro_line],eax + mov ecx,[macro_block_line_number] + stc + ret + block_closed: + clc + ret +get_macro_symbol: + push ecx + call find_macro_symbol_leaf + jc macro_symbol_not_found + mov edx,[ebx] + mov ebx,esi + try_macro_symbol: + or edx,edx + jz macro_symbol_not_found + mov ecx,[esp] + mov edi,[edx+4] + repe cmps byte [esi],[edi] + je macro_symbol_found + mov esi,ebx + mov edx,[edx] + jmp try_macro_symbol + macro_symbol_found: + pop ecx + clc + ret + macro_symbol_not_found: + pop ecx + stc + ret + find_macro_symbol_leaf: + shl eax,8 + mov al,cl + mov ebp,eax + mov ebx,macro_symbols + follow_macro_symbols_tree: + mov edx,[ebx] + or edx,edx + jz no_such_macro_symbol + xor eax,eax + shr ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + or ebp,ebp + jnz follow_macro_symbols_tree + add ebx,8 + clc + ret + no_such_macro_symbol: + stc + ret +add_macro_symbol: + push ebx ebp + call find_macro_symbol_leaf + jc extend_macro_symbol_tree + mov eax,[ebx] + make_macro_symbol: + mov edx,[free_additional_memory] + add edx,16 + cmp edx,[labels_list] + ja out_of_memory + xchg edx,[free_additional_memory] + mov [ebx],edx + mov [edx],eax + mov [edx+4],esi + pop ebp ebx + ret + extend_macro_symbol_tree: + mov edx,[free_additional_memory] + add edx,16 + cmp edx,[labels_list] + ja out_of_memory + xchg edx,[free_additional_memory] + xor eax,eax + mov [edx],eax + mov [edx+4],eax + mov [edx+8],eax + mov [edx+12],eax + shr ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + or ebp,ebp + jnz extend_macro_symbol_tree + add ebx,8 + xor eax,eax + jmp make_macro_symbol + +include_file: + lods byte [esi] + cmp al,22h + jne invalid_argument + lods dword [esi] + cmp byte [esi+eax],0 + jne extra_characters_on_line + push esi + push edi + mov ebx,[current_line] + find_current_file_path: + mov esi,[ebx] + test byte [ebx+7],80h + jz copy_current_file_path + mov ebx,[ebx+8] + jmp find_current_file_path + copy_current_file_path: + lods byte [esi] + stos byte [edi] + or al,al + jnz copy_current_file_path + cut_current_file_name: + cmp edi,[esp] + je current_file_path_ok + cmp byte [edi-1],'\' + je current_file_path_ok + cmp byte [edi-1],'/' + je current_file_path_ok + dec edi + jmp cut_current_file_name + current_file_path_ok: + mov esi,[esp+4] + call expand_path + pop edx + mov esi,edx + call open + jnc include_path_ok + mov ebp,[include_paths] + try_include_directories: + mov edi,esi + mov esi,ebp + cmp byte [esi],0 + je try_in_current_directory + push ebp + push edi + call get_include_directory + mov [esp+4],esi + mov esi,[esp+8] + call expand_path + pop edx + mov esi,edx + call open + pop ebp + jnc include_path_ok + jmp try_include_directories + mov edi,esi + try_in_current_directory: + mov esi,[esp] + push edi + call expand_path + pop edx + mov esi,edx + call open + jc file_not_found + include_path_ok: + mov edi,[esp] + copy_preprocessed_path: + lods byte [esi] + stos byte [edi] + or al,al + jnz copy_preprocessed_path + pop esi + lea ecx,[edi-1] + sub ecx,esi + mov [esi-4],ecx + push dword [macro_status] + and [macro_status],0Fh + call preprocess_file + pop eax + and al,0F0h + and [macro_status],0Fh + or [macro_status],al + jmp line_preprocessed diff --git a/fasmw172/SOURCE/SYMBDUMP.INC b/fasmw172/SOURCE/SYMBDUMP.INC new file mode 100644 index 0000000..c5cc295 --- /dev/null +++ b/fasmw172/SOURCE/SYMBDUMP.INC @@ -0,0 +1,450 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +dump_symbols: + mov edi,[code_start] + call setup_dump_header + mov esi,[input_file] + call copy_asciiz + cmp edi,[tagged_blocks] + jae out_of_memory + mov eax,edi + sub eax,ebx + mov [ebx-40h+0Ch],eax + mov esi,[output_file] + call copy_asciiz + cmp edi,[tagged_blocks] + jae out_of_memory + mov edx,[symbols_stream] + mov ebp,[free_additional_memory] + and [number_of_sections],0 + cmp [output_format],4 + je prepare_strings_table + cmp [output_format],5 + jne strings_table_ready + bt [format_flags],0 + jc strings_table_ready + prepare_strings_table: + cmp edx,ebp + je strings_table_ready + mov al,[edx] + test al,al + jz prepare_string + cmp al,80h + je prepare_string + add edx,0Ch + cmp al,0C0h + jb prepare_strings_table + add edx,4 + jmp prepare_strings_table + prepare_string: + mov esi,edi + sub esi,ebx + xchg esi,[edx+4] + test al,al + jz prepare_section_string + or dword [edx+4],1 shl 31 + add edx,0Ch + prepare_external_string: + mov ecx,[esi] + add esi,4 + rep movs byte [edi],[esi] + mov byte [edi],0 + inc edi + cmp edi,[tagged_blocks] + jae out_of_memory + jmp prepare_strings_table + prepare_section_string: + mov ecx,[number_of_sections] + mov eax,ecx + inc eax + mov [number_of_sections],eax + xchg eax,[edx+4] + shl ecx,2 + add ecx,[free_additional_memory] + mov [ecx],eax + add edx,20h + test esi,esi + jz prepare_default_section_string + cmp [output_format],5 + jne prepare_external_string + bt [format_flags],0 + jc prepare_external_string + mov esi,[esi] + add esi,[resource_data] + copy_elf_section_name: + lods byte [esi] + cmp edi,[tagged_blocks] + jae out_of_memory + stos byte [edi] + test al,al + jnz copy_elf_section_name + jmp prepare_strings_table + prepare_default_section_string: + mov eax,'.fla' + stos dword [edi] + mov ax,'t' + stos word [edi] + cmp edi,[tagged_blocks] + jae out_of_memory + jmp prepare_strings_table + strings_table_ready: + mov edx,[tagged_blocks] + mov ebp,[memory_end] + sub ebp,[labels_list] + add ebp,edx + prepare_labels_dump: + cmp edx,ebp + je labels_dump_ok + mov eax,[edx+24] + test eax,eax + jz label_dump_name_ok + cmp eax,[memory_start] + jb label_name_outside_source + cmp eax,[source_start] + ja label_name_outside_source + sub eax,[memory_start] + dec eax + mov [edx+24],eax + jmp label_dump_name_ok + label_name_outside_source: + mov esi,eax + mov eax,edi + sub eax,ebx + or eax,1 shl 31 + mov [edx+24],eax + movzx ecx,byte [esi-1] + lea eax,[edi+ecx+1] + cmp edi,[tagged_blocks] + jae out_of_memory + rep movsb + xor al,al + stosb + label_dump_name_ok: + mov eax,[edx+28] + test eax,eax + jz label_dump_line_ok + sub eax,[memory_start] + mov [edx+28],eax + label_dump_line_ok: + test byte [edx+9],4 + jz convert_base_symbol_for_label + xor eax,eax + mov [edx],eax + mov [edx+4],eax + jmp base_symbol_for_label_ok + convert_base_symbol_for_label: + mov eax,[edx+20] + test eax,eax + jz base_symbol_for_label_ok + cmp eax,[symbols_stream] + mov eax,[eax+4] + jae base_symbol_for_label_ok + xor eax,eax + base_symbol_for_label_ok: + mov [edx+20],eax + mov ax,[current_pass] + cmp ax,[edx+16] + je label_defined_flag_ok + and byte [edx+8],not 1 + label_defined_flag_ok: + cmp ax,[edx+18] + je label_used_flag_ok + and byte [edx+8],not 8 + label_used_flag_ok: + add edx,LABEL_STRUCTURE_SIZE + jmp prepare_labels_dump + labels_dump_ok: + mov eax,edi + sub eax,ebx + mov [ebx-40h+14h],eax + add eax,40h + mov [ebx-40h+18h],eax + mov ecx,[memory_end] + sub ecx,[labels_list] + mov [ebx-40h+1Ch],ecx + add eax,ecx + mov [ebx-40h+20h],eax + mov ecx,[source_start] + sub ecx,[memory_start] + mov [ebx-40h+24h],ecx + add eax,ecx + mov [ebx-40h+28h],eax + mov eax,[number_of_sections] + shl eax,2 + mov [ebx-40h+34h],eax + call prepare_preprocessed_source + mov esi,[labels_list] + mov ebp,edi + make_lines_dump: + cmp esi,[tagged_blocks] + je lines_dump_ok + mov eax,[esi-4] + mov ecx,[esi-8] + sub esi,8 + sub esi,ecx + cmp eax,1 + je process_line_dump + cmp eax,2 + jne make_lines_dump + add dword [ebx-40h+3Ch],8 + jmp make_lines_dump + process_line_dump: + push ebx + mov ebx,[esi+8] + mov eax,[esi+4] + sub eax,[code_start] + add eax,[headers_size] + test byte [ebx+0Ah],1 + jz store_offset + xor eax,eax + store_offset: + stos dword [edi] + mov eax,[esi] + sub eax,[memory_start] + stos dword [edi] + mov eax,[esi+4] + xor edx,edx + xor cl,cl + sub eax,[ebx] + sbb edx,[ebx+4] + sbb cl,[ebx+8] + stos dword [edi] + mov eax,edx + stos dword [edi] + mov eax,[ebx+10h] + stos dword [edi] + mov eax,[ebx+14h] + test eax,eax + jz base_symbol_for_line_ok + cmp eax,[symbols_stream] + mov eax,[eax+4] + jae base_symbol_for_line_ok + xor eax,eax + base_symbol_for_line_ok: + stos dword [edi] + mov al,[ebx+9] + stos byte [edi] + mov al,[esi+10h] + stos byte [edi] + mov al,[ebx+0Ah] + and al,1 + stos byte [edi] + mov al,cl + stos byte [edi] + pop ebx + cmp edi,[tagged_blocks] + jae out_of_memory + mov eax,edi + sub eax,1Ch + sub eax,ebp + mov [esi],eax + jmp make_lines_dump + lines_dump_ok: + mov edx,edi + mov eax,[current_offset] + sub eax,[code_start] + add eax,[headers_size] + stos dword [edi] + mov ecx,edi + sub ecx,ebx + sub ecx,[ebx-40h+14h] + mov [ebx-40h+2Ch],ecx + add ecx,[ebx-40h+28h] + mov [ebx-40h+30h],ecx + add ecx,[ebx-40h+34h] + mov [ebx-40h+38h],ecx + find_inexisting_offsets: + sub edx,1Ch + cmp edx,ebp + jb write_symbols + test byte [edx+1Ah],1 + jnz find_inexisting_offsets + cmp eax,[edx] + jb correct_inexisting_offset + mov eax,[edx] + jmp find_inexisting_offsets + correct_inexisting_offset: + and dword [edx],0 + or byte [edx+1Ah],2 + jmp find_inexisting_offsets + write_symbols: + mov edx,[symbols_file] + call create + jc write_failed + mov edx,[code_start] + mov ecx,[edx+14h] + add ecx,40h + call write + jc write_failed + mov edx,[tagged_blocks] + mov ecx,[memory_end] + sub ecx,[labels_list] + call write + jc write_failed + mov edx,[memory_start] + mov ecx,[source_start] + sub ecx,edx + call write + jc write_failed + mov edx,ebp + mov ecx,edi + sub ecx,edx + call write + jc write_failed + mov edx,[free_additional_memory] + mov ecx,[number_of_sections] + shl ecx,2 + call write + jc write_failed + mov esi,[labels_list] + mov edi,[memory_start] + make_references_dump: + cmp esi,[tagged_blocks] + je references_dump_ok + mov eax,[esi-4] + mov ecx,[esi-8] + sub esi,8 + sub esi,ecx + cmp eax,2 + je dump_reference + cmp eax,1 + jne make_references_dump + mov edx,[esi] + jmp make_references_dump + dump_reference: + mov eax,[memory_end] + sub eax,[esi] + sub eax,LABEL_STRUCTURE_SIZE + stosd + mov eax,edx + stosd + cmp edi,[tagged_blocks] + jb make_references_dump + jmp out_of_memory + references_dump_ok: + mov edx,[memory_start] + mov ecx,edi + sub ecx,edx + call write + jc write_failed + call close + ret + setup_dump_header: + xor eax,eax + mov ecx,40h shr 2 + rep stos dword [edi] + mov ebx,edi + mov dword [ebx-40h],'fas'+1Ah shl 24 + mov dword [ebx-40h+4],VERSION_MAJOR + VERSION_MINOR shl 8 + 40h shl 16 + mov dword [ebx-40h+10h],40h + ret +prepare_preprocessed_source: + mov esi,[memory_start] + mov ebp,[source_start] + test ebp,ebp + jnz prepare_preprocessed_line + mov ebp,[current_line] + inc ebp + prepare_preprocessed_line: + cmp esi,ebp + jae preprocessed_source_ok + mov eax,[memory_start] + mov edx,[input_file] + cmp [esi],edx + jne line_not_from_main_input + mov [esi],eax + line_not_from_main_input: + sub [esi],eax + test byte [esi+7],1 shl 7 + jz prepare_next_preprocessed_line + sub [esi+8],eax + sub [esi+12],eax + prepare_next_preprocessed_line: + call skip_preprocessed_line + jmp prepare_preprocessed_line + preprocessed_source_ok: + ret + skip_preprocessed_line: + add esi,16 + skip_preprocessed_line_content: + lods byte [esi] + cmp al,1Ah + je skip_preprocessed_symbol + cmp al,3Bh + je skip_preprocessed_symbol + cmp al,22h + je skip_preprocessed_string + or al,al + jnz skip_preprocessed_line_content + ret + skip_preprocessed_string: + lods dword [esi] + add esi,eax + jmp skip_preprocessed_line_content + skip_preprocessed_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_preprocessed_line_content +restore_preprocessed_source: + mov esi,[memory_start] + mov ebp,[source_start] + test ebp,ebp + jnz restore_preprocessed_line + mov ebp,[current_line] + inc ebp + restore_preprocessed_line: + cmp esi,ebp + jae preprocessed_source_restored + mov eax,[memory_start] + add [esi],eax + cmp [esi],eax + jne preprocessed_line_source_restored + mov edx,[input_file] + mov [esi],edx + preprocessed_line_source_restored: + test byte [esi+7],1 shl 7 + jz restore_next_preprocessed_line + add [esi+8],eax + add [esi+12],eax + restore_next_preprocessed_line: + call skip_preprocessed_line + jmp restore_preprocessed_line + preprocessed_source_restored: + ret +dump_preprocessed_source: + mov edi,[free_additional_memory] + call setup_dump_header + mov esi,[input_file] + call copy_asciiz + cmp edi,[additional_memory_end] + jae out_of_memory + mov eax,edi + sub eax,ebx + dec eax + mov [ebx-40h+0Ch],eax + mov eax,edi + sub eax,ebx + mov [ebx-40h+14h],eax + add eax,40h + mov [ebx-40h+20h],eax + call prepare_preprocessed_source + sub esi,[memory_start] + mov [ebx-40h+24h],esi + mov edx,[symbols_file] + call create + jc write_failed + mov edx,[free_additional_memory] + mov ecx,[edx+14h] + add ecx,40h + call write + jc write_failed + mov edx,[memory_start] + mov ecx,esi + call write + jc write_failed + call close + ret \ No newline at end of file diff --git a/fasmw172/SOURCE/TABLES.INC b/fasmw172/SOURCE/TABLES.INC new file mode 100644 index 0000000..f5004dd --- /dev/null +++ b/fasmw172/SOURCE/TABLES.INC @@ -0,0 +1,4230 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +include_variable db 'INCLUDE',0 + +symbol_characters db 27 + db 9,0Ah,0Dh,1Ah,20h,'+-/*=<>()[]{}:,|&~#`;\' + +preprocessor_directives: + db 6,'define' + dw define_symbolic_constant-directive_handler + db 7,'include' + dw include_file-directive_handler + db 3,'irp' + dw irp_directive-directive_handler + db 4,'irps' + dw irps_directive-directive_handler + db 4,'irpv' + dw irpv_directive-directive_handler + db 5,'macro' + dw define_macro-directive_handler + db 5,'match' + dw match_directive-directive_handler + db 8,'postpone' + dw postpone_directive-directive_handler + db 5,'purge' + dw purge_macro-directive_handler + db 4,'rept' + dw rept_directive-directive_handler + db 7,'restore' + dw restore_equ_constant-directive_handler + db 7,'restruc' + dw purge_struc-directive_handler + db 5,'struc' + dw define_struc-directive_handler + db 0 + +macro_directives: + db 6,'common' + dw common_block-directive_handler + db 7,'forward' + dw forward_block-directive_handler + db 5,'local' + dw local_symbols-directive_handler + db 7,'reverse' + dw reverse_block-directive_handler + db 0 + +operators: + db 1,'+',80h + db 1,'-',81h + db 1,'*',90h + db 1,'/',91h + db 3,'and',0B0h + db 3,'mod',0A0h + db 2,'or',0B1h + db 3,'shl',0C0h + db 3,'shr',0C1h + db 3,'xor',0B2h + db 0 + +single_operand_operators: + db 1,'+',82h + db 1,'-',83h + db 3,'bsf',0E0h + db 3,'bsr',0E1h + db 3,'not',0D0h + db 3,'plt',0F1h + db 3,'rva',0F0h + db 0 + +directive_operators: + db 5,'align',8Ch + db 2,'as',86h + db 2,'at',80h + db 7,'defined',88h + db 3,'dup',81h + db 2,'eq',0F0h + db 6,'eqtype',0F7h + db 4,'from',82h + db 2,'in',0F6h + db 2,'on',84h + db 3,'ptr',85h + db 10,'relativeto',0F8h + db 4,'used',89h + db 0 + +address_sizes: + db 4,'byte',1 + db 5,'dword',4 + db 5,'qword',8 + db 4,'word',2 + db 0 + +symbols: + dw symbols_1-symbols,(symbols_2-symbols_1)/(1+2) + dw symbols_2-symbols,(symbols_3-symbols_2)/(2+2) + dw symbols_3-symbols,(symbols_4-symbols_3)/(3+2) + dw symbols_4-symbols,(symbols_5-symbols_4)/(4+2) + dw symbols_5-symbols,(symbols_6-symbols_5)/(5+2) + dw symbols_6-symbols,(symbols_7-symbols_6)/(6+2) + dw symbols_7-symbols,(symbols_8-symbols_7)/(7+2) + dw symbols_8-symbols,(symbols_9-symbols_8)/(8+2) + dw symbols_9-symbols,(symbols_10-symbols_9)/(9+2) + dw symbols_10-symbols,(symbols_11-symbols_10)/(10+2) + dw symbols_11-symbols,(symbols_end-symbols_11)/(11+2) + +symbols_1: + db 'z',1Fh,0 +symbols_2: + db 'ah',10h,04h + db 'al',10h,10h + db 'ax',10h,20h + db 'bh',10h,07h + db 'bl',10h,13h + db 'bp',10h,25h + db 'bx',10h,23h + db 'ch',10h,05h + db 'cl',10h,11h + db 'cs',10h,32h + db 'cx',10h,21h + db 'dh',10h,06h + db 'di',10h,27h + db 'dl',10h,12h + db 'ds',10h,34h + db 'dx',10h,22h + db 'es',10h,31h + db 'fs',10h,35h + db 'gs',10h,36h + db 'k0',14h,50h + db 'k1',14h,51h + db 'k2',14h,52h + db 'k3',14h,53h + db 'k4',14h,54h + db 'k5',14h,55h + db 'k6',14h,56h + db 'k7',14h,57h + db 'ms',1Ch,41h + db 'mz',18h,20h + db 'nx',1Bh,83h + db 'pe',18h,30h + db 'r8',10h,88h + db 'r9',10h,89h + db 'rd',1Fh,21h + db 'rn',1Fh,20h + db 'ru',1Fh,22h + db 'rz',1Fh,23h + db 'si',10h,26h + db 'sp',10h,24h + db 'ss',10h,33h + db 'st',10h,0A0h +symbols_3: + db 'bpl',10h,15h + db 'cr0',14h,00h + db 'cr1',14h,01h + db 'cr2',14h,02h + db 'cr3',14h,03h + db 'cr4',14h,04h + db 'cr5',14h,05h + db 'cr6',14h,06h + db 'cr7',14h,07h + db 'cr8',14h,08h + db 'cr9',14h,09h + db 'dil',10h,17h + db 'dll',1Bh,80h + db 'dr0',14h,10h + db 'dr1',14h,11h + db 'dr2',14h,12h + db 'dr3',14h,13h + db 'dr4',14h,14h + db 'dr5',14h,15h + db 'dr6',14h,16h + db 'dr7',14h,17h + db 'dr8',14h,18h + db 'dr9',14h,19h + db 'eax',10h,40h + db 'ebp',10h,45h + db 'ebx',10h,43h + db 'ecx',10h,41h + db 'edi',10h,47h + db 'edx',10h,42h + db 'efi',1Bh,10 + db 'eip',10h,94h + db 'elf',18h,50h + db 'esi',10h,46h + db 'esp',10h,44h + db 'far',12h,3 + db 'gui',1Bh,2 + db 'mm0',10h,0B0h + db 'mm1',10h,0B1h + db 'mm2',10h,0B2h + db 'mm3',10h,0B3h + db 'mm4',10h,0B4h + db 'mm5',10h,0B5h + db 'mm6',10h,0B6h + db 'mm7',10h,0B7h + db 'r10',10h,8Ah + db 'r11',10h,8Bh + db 'r12',10h,8Ch + db 'r13',10h,8Dh + db 'r14',10h,8Eh + db 'r15',10h,8Fh + db 'r8b',10h,18h + db 'r8d',10h,48h + db 'r8l',10h,18h + db 'r8w',10h,28h + db 'r9b',10h,19h + db 'r9d',10h,49h + db 'r9l',10h,19h + db 'r9w',10h,29h + db 'rax',10h,80h + db 'rbp',10h,85h + db 'rbx',10h,83h + db 'rcx',10h,81h + db 'rdi',10h,87h + db 'rdx',10h,82h + db 'rip',10h,98h + db 'rsi',10h,86h + db 'rsp',10h,84h + db 'sae',1Fh,30h + db 'sil',10h,16h + db 'spl',10h,14h + db 'st0',10h,0A0h + db 'st1',10h,0A1h + db 'st2',10h,0A2h + db 'st3',10h,0A3h + db 'st4',10h,0A4h + db 'st5',10h,0A5h + db 'st6',10h,0A6h + db 'st7',10h,0A7h + db 'tr0',14h,40h + db 'tr1',14h,41h + db 'tr2',14h,42h + db 'tr3',14h,43h + db 'tr4',14h,44h + db 'tr5',14h,45h + db 'tr6',14h,46h + db 'tr7',14h,47h + db 'wdm',1Bh,81h +symbols_4: + db '1to2',1Fh,11h + db '1to4',1Fh,12h + db '1to8',1Fh,13h + db 'bnd0',14h,60h + db 'bnd1',14h,61h + db 'bnd2',14h,62h + db 'bnd3',14h,63h + db 'byte',11h,1 + db 'code',19h,5 + db 'coff',18h,40h + db 'cr10',14h,0Ah + db 'cr11',14h,0Bh + db 'cr12',14h,0Ch + db 'cr13',14h,0Dh + db 'cr14',14h,0Eh + db 'cr15',14h,0Fh + db 'data',19h,6 + db 'dr10',14h,1Ah + db 'dr11',14h,1Bh + db 'dr12',14h,1Ch + db 'dr13',14h,1Dh + db 'dr14',14h,1Eh + db 'dr15',14h,1Fh + db 'ms64',1Ch,49h + db 'near',12h,2 + db 'note',1Eh,4 + db 'pe64',18h,3Ch + db 'r10b',10h,1Ah + db 'r10d',10h,4Ah + db 'r10l',10h,1Ah + db 'r10w',10h,2Ah + db 'r11b',10h,1Bh + db 'r11d',10h,4Bh + db 'r11l',10h,1Bh + db 'r11w',10h,2Bh + db 'r12b',10h,1Ch + db 'r12d',10h,4Ch + db 'r12l',10h,1Ch + db 'r12w',10h,2Ch + db 'r13b',10h,1Dh + db 'r13d',10h,4Dh + db 'r13l',10h,1Dh + db 'r13w',10h,2Dh + db 'r14b',10h,1Eh + db 'r14d',10h,4Eh + db 'r14l',10h,1Eh + db 'r14w',10h,2Eh + db 'r15b',10h,1Fh + db 'r15d',10h,4Fh + db 'r15l',10h,1Fh + db 'r15w',10h,2Fh + db 'word',11h,2 + db 'xmm0',10h,0C0h + db 'xmm1',10h,0C1h + db 'xmm2',10h,0C2h + db 'xmm3',10h,0C3h + db 'xmm4',10h,0C4h + db 'xmm5',10h,0C5h + db 'xmm6',10h,0C6h + db 'xmm7',10h,0C7h + db 'xmm8',10h,0C8h + db 'xmm9',10h,0C9h + db 'ymm0',10h,0E0h + db 'ymm1',10h,0E1h + db 'ymm2',10h,0E2h + db 'ymm3',10h,0E3h + db 'ymm4',10h,0E4h + db 'ymm5',10h,0E5h + db 'ymm6',10h,0E6h + db 'ymm7',10h,0E7h + db 'ymm8',10h,0E8h + db 'ymm9',10h,0E9h + db 'zmm0',10h,60h + db 'zmm1',10h,61h + db 'zmm2',10h,62h + db 'zmm3',10h,63h + db 'zmm4',10h,64h + db 'zmm5',10h,65h + db 'zmm6',10h,66h + db 'zmm7',10h,67h + db 'zmm8',10h,68h + db 'zmm9',10h,69h +symbols_5: + db '1to16',1Fh,14h + db 'dword',11h,4 + db 'elf64',18h,58h + db 'fword',11h,6 + db 'large',1Bh,82h + db 'pword',11h,6 + db 'qword',11h,8 + db 'short',12h,1 + db 'tbyte',11h,0Ah + db 'tword',11h,0Ah + db 'use16',13h,16 + db 'use32',13h,32 + db 'use64',13h,64 + db 'xmm10',10h,0CAh + db 'xmm11',10h,0CBh + db 'xmm12',10h,0CCh + db 'xmm13',10h,0CDh + db 'xmm14',10h,0CEh + db 'xmm15',10h,0CFh + db 'xmm16',10h,0D0h + db 'xmm17',10h,0D1h + db 'xmm18',10h,0D2h + db 'xmm19',10h,0D3h + db 'xmm20',10h,0D4h + db 'xmm21',10h,0D5h + db 'xmm22',10h,0D6h + db 'xmm23',10h,0D7h + db 'xmm24',10h,0D8h + db 'xmm25',10h,0D9h + db 'xmm26',10h,0DAh + db 'xmm27',10h,0DBh + db 'xmm28',10h,0DCh + db 'xmm29',10h,0DDh + db 'xmm30',10h,0DEh + db 'xmm31',10h,0DFh + db 'xword',11h,16 + db 'ymm10',10h,0EAh + db 'ymm11',10h,0EBh + db 'ymm12',10h,0ECh + db 'ymm13',10h,0EDh + db 'ymm14',10h,0EEh + db 'ymm15',10h,0EFh + db 'ymm16',10h,0F0h + db 'ymm17',10h,0F1h + db 'ymm18',10h,0F2h + db 'ymm19',10h,0F3h + db 'ymm20',10h,0F4h + db 'ymm21',10h,0F5h + db 'ymm22',10h,0F6h + db 'ymm23',10h,0F7h + db 'ymm24',10h,0F8h + db 'ymm25',10h,0F9h + db 'ymm26',10h,0FAh + db 'ymm27',10h,0FBh + db 'ymm28',10h,0FCh + db 'ymm29',10h,0FDh + db 'ymm30',10h,0FEh + db 'ymm31',10h,0FFh + db 'yword',11h,32 + db 'zmm10',10h,6Ah + db 'zmm11',10h,6Bh + db 'zmm12',10h,6Ch + db 'zmm13',10h,6Dh + db 'zmm14',10h,6Eh + db 'zmm15',10h,6Fh + db 'zmm16',10h,70h + db 'zmm17',10h,71h + db 'zmm18',10h,72h + db 'zmm19',10h,73h + db 'zmm20',10h,74h + db 'zmm21',10h,75h + db 'zmm22',10h,76h + db 'zmm23',10h,77h + db 'zmm24',10h,78h + db 'zmm25',10h,79h + db 'zmm26',10h,7Ah + db 'zmm27',10h,7Bh + db 'zmm28',10h,7Ch + db 'zmm29',10h,7Dh + db 'zmm30',10h,7Eh + db 'zmm31',10h,7Fh + db 'zword',11h,64 +symbols_6: + db 'binary',18h,10h + db 'dqword',11h,16 + db 'export',1Ah,0 + db 'fixups',1Ah,5 + db 'import',1Ah,1 + db 'native',1Bh,1 + db 'qqword',11h,32 + db 'static',1Dh,1 +symbols_7: + db 'console',1Bh,3 + db 'dqqword',11h,64 + db 'dynamic',1Eh,2 + db 'efiboot',1Bh,11 +symbols_8: + db 'gnustack',1Eh,51h + db 'linkinfo',19h,9 + db 'readable',19h,30 + db 'resource',1Ah,2 + db 'writable',19h,31 +symbols_9: + db 'shareable',19h,28 + db 'writeable',19h,31 +symbols_10: + db 'efiruntime',1Bh,12 + db 'executable',19h,29 + db 'gnuehframe',1Eh,50h + db 'linkremove',19h,11 +symbols_11: + db 'discardable',19h,25 + db 'interpreter',1Eh,3 + db 'notpageable',19h,27 +symbols_end: + +instructions: + dw instructions_2-instructions,(instructions_3-instructions_2)/(2+3) + dw instructions_3-instructions,(instructions_4-instructions_3)/(3+3) + dw instructions_4-instructions,(instructions_5-instructions_4)/(4+3) + dw instructions_5-instructions,(instructions_6-instructions_5)/(5+3) + dw instructions_6-instructions,(instructions_7-instructions_6)/(6+3) + dw instructions_7-instructions,(instructions_8-instructions_7)/(7+3) + dw instructions_8-instructions,(instructions_9-instructions_8)/(8+3) + dw instructions_9-instructions,(instructions_10-instructions_9)/(9+3) + dw instructions_10-instructions,(instructions_11-instructions_10)/(10+3) + dw instructions_11-instructions,(instructions_12-instructions_11)/(11+3) + dw instructions_12-instructions,(instructions_13-instructions_12)/(12+3) + dw instructions_13-instructions,(instructions_14-instructions_13)/(13+3) + dw instructions_14-instructions,(instructions_15-instructions_14)/(14+3) + dw instructions_15-instructions,(instructions_16-instructions_15)/(15+3) + dw instructions_16-instructions,(instructions_end-instructions_16)/(16+3) + +instructions_2: + db 'bt',4 + dw bt_instruction-instruction_handler + db 'if',0 + dw if_directive-instruction_handler + db 'in',0 + dw in_instruction-instruction_handler + db 'ja',77h + dw conditional_jump-instruction_handler + db 'jb',72h + dw conditional_jump-instruction_handler + db 'jc',72h + dw conditional_jump-instruction_handler + db 'je',74h + dw conditional_jump-instruction_handler + db 'jg',7Fh + dw conditional_jump-instruction_handler + db 'jl',7Ch + dw conditional_jump-instruction_handler + db 'jo',70h + dw conditional_jump-instruction_handler + db 'jp',7Ah + dw conditional_jump-instruction_handler + db 'js',78h + dw conditional_jump-instruction_handler + db 'jz',74h + dw conditional_jump-instruction_handler + db 'or',08h + dw basic_instruction-instruction_handler +instructions_3: + db 'aaa',37h + dw simple_instruction_except64-instruction_handler + db 'aad',0D5h + dw aa_instruction-instruction_handler + db 'aam',0D4h + dw aa_instruction-instruction_handler + db 'aas',3Fh + dw simple_instruction_except64-instruction_handler + db 'adc',10h + dw basic_instruction-instruction_handler + db 'add',00h + dw basic_instruction-instruction_handler + db 'and',20h + dw basic_instruction-instruction_handler + db 'bnd',0F2h + dw bnd_prefix_instruction-instruction_handler + db 'bsf',0BCh + dw bs_instruction-instruction_handler + db 'bsr',0BDh + dw bs_instruction-instruction_handler + db 'btc',7 + dw bt_instruction-instruction_handler + db 'btr',6 + dw bt_instruction-instruction_handler + db 'bts',5 + dw bt_instruction-instruction_handler + db 'cbw',98h + dw simple_instruction_16bit-instruction_handler + db 'cdq',99h + dw simple_instruction_32bit-instruction_handler + db 'clc',0F8h + dw simple_instruction-instruction_handler + db 'cld',0FCh + dw simple_instruction-instruction_handler + db 'cli',0FAh + dw simple_instruction-instruction_handler + db 'cmc',0F5h + dw simple_instruction-instruction_handler + db 'cmp',38h + dw basic_instruction-instruction_handler + db 'cqo',99h + dw simple_instruction_64bit-instruction_handler + db 'cwd',99h + dw simple_instruction_16bit-instruction_handler + db 'daa',27h + dw simple_instruction_except64-instruction_handler + db 'das',2Fh + dw simple_instruction_except64-instruction_handler + db 'dec',1 + dw inc_instruction-instruction_handler + db 'div',6 + dw single_operand_instruction-instruction_handler + db 'end',0 + dw end_directive-instruction_handler + db 'err',0 + dw err_directive-instruction_handler + db 'fld',0 + dw fld_instruction-instruction_handler + db 'fst',2 + dw fld_instruction-instruction_handler + db 'hlt',0F4h + dw simple_instruction-instruction_handler + db 'inc',0 + dw inc_instruction-instruction_handler + db 'ins',6Ch + dw ins_instruction-instruction_handler + db 'int',0CDh + dw int_instruction-instruction_handler + db 'jae',73h + dw conditional_jump-instruction_handler + db 'jbe',76h + dw conditional_jump-instruction_handler + db 'jge',7Dh + dw conditional_jump-instruction_handler + db 'jle',7Eh + dw conditional_jump-instruction_handler + db 'jmp',0 + dw jmp_instruction-instruction_handler + db 'jna',76h + dw conditional_jump-instruction_handler + db 'jnb',73h + dw conditional_jump-instruction_handler + db 'jnc',73h + dw conditional_jump-instruction_handler + db 'jne',75h + dw conditional_jump-instruction_handler + db 'jng',7Eh + dw conditional_jump-instruction_handler + db 'jnl',7Dh + dw conditional_jump-instruction_handler + db 'jno',71h + dw conditional_jump-instruction_handler + db 'jnp',7Bh + dw conditional_jump-instruction_handler + db 'jns',79h + dw conditional_jump-instruction_handler + db 'jnz',75h + dw conditional_jump-instruction_handler + db 'jpe',7Ah + dw conditional_jump-instruction_handler + db 'jpo',7Bh + dw conditional_jump-instruction_handler + db 'lar',2 + dw lar_instruction-instruction_handler + db 'lds',3 + dw ls_instruction-instruction_handler + db 'lea',0 + dw lea_instruction-instruction_handler + db 'les',0 + dw ls_instruction-instruction_handler + db 'lfs',4 + dw ls_instruction-instruction_handler + db 'lgs',5 + dw ls_instruction-instruction_handler + db 'lsl',3 + dw lar_instruction-instruction_handler + db 'lss',2 + dw ls_instruction-instruction_handler + db 'ltr',3 + dw pm_word_instruction-instruction_handler + db 'mov',0 + dw mov_instruction-instruction_handler + db 'mul',4 + dw single_operand_instruction-instruction_handler + db 'neg',3 + dw single_operand_instruction-instruction_handler + db 'nop',90h + dw nop_instruction-instruction_handler + db 'not',2 + dw single_operand_instruction-instruction_handler + db 'org',0 + dw org_directive-instruction_handler + db 'out',0 + dw out_instruction-instruction_handler + db 'pop',0 + dw pop_instruction-instruction_handler + db 'por',0EBh + dw basic_mmx_instruction-instruction_handler + db 'rcl',2 + dw sh_instruction-instruction_handler + db 'rcr',3 + dw sh_instruction-instruction_handler + db 'rep',0F3h + dw prefix_instruction-instruction_handler + db 'ret',0C2h + dw ret_instruction-instruction_handler + db 'rol',0 + dw sh_instruction-instruction_handler + db 'ror',1 + dw sh_instruction-instruction_handler + db 'rsm',0AAh + dw simple_extended_instruction-instruction_handler + db 'sal',4 + dw sh_instruction-instruction_handler + db 'sar',7 + dw sh_instruction-instruction_handler + db 'sbb',18h + dw basic_instruction-instruction_handler + db 'shl',4 + dw sh_instruction-instruction_handler + db 'shr',5 + dw sh_instruction-instruction_handler + db 'stc',0F9h + dw simple_instruction-instruction_handler + db 'std',0FDh + dw simple_instruction-instruction_handler + db 'sti',0FBh + dw simple_instruction-instruction_handler + db 'str',1 + dw pm_store_word_instruction-instruction_handler + db 'sub',28h + dw basic_instruction-instruction_handler + db 'ud2',0Bh + dw simple_extended_instruction-instruction_handler + db 'xor',30h + dw basic_instruction-instruction_handler +instructions_4: + db 'adcx',66h + dw adx_instruction-instruction_handler + db 'adox',0F3h + dw adx_instruction-instruction_handler + db 'andn',0F2h + dw andn_instruction-instruction_handler + db 'arpl',0 + dw arpl_instruction-instruction_handler + db 'blci',26h + dw tbm_instruction-instruction_handler + db 'blcs',13h + dw tbm_instruction-instruction_handler + db 'blsi',3 + dw bmi_instruction-instruction_handler + db 'blsr',1 + dw bmi_instruction-instruction_handler + db 'bzhi',0F5h + dw bzhi_instruction-instruction_handler + db 'call',0 + dw call_instruction-instruction_handler + db 'cdqe',98h + dw simple_instruction_64bit-instruction_handler + db 'clac',0CAh + dw simple_instruction_0f_01-instruction_handler + db 'clgi',0DDh + dw simple_instruction_0f_01-instruction_handler + db 'clts',6 + dw simple_extended_instruction-instruction_handler + db 'clwb',6 + dw clflushopt_instruction-instruction_handler + db 'cmps',0A6h + dw cmps_instruction-instruction_handler + db 'cwde',98h + dw simple_instruction_32bit-instruction_handler + db 'data',0 + dw data_directive-instruction_handler + db 'dppd',41h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'dpps',40h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'else',0 + dw else_directive-instruction_handler + db 'emms',77h + dw simple_extended_instruction-instruction_handler + db 'fabs',100001b + dw simple_fpu_instruction-instruction_handler + db 'fadd',0 + dw basic_fpu_instruction-instruction_handler + db 'fbld',4 + dw fbld_instruction-instruction_handler + db 'fchs',100000b + dw simple_fpu_instruction-instruction_handler + db 'fcom',2 + dw basic_fpu_instruction-instruction_handler + db 'fcos',111111b + dw simple_fpu_instruction-instruction_handler + db 'fdiv',6 + dw basic_fpu_instruction-instruction_handler + db 'feni',0E0h + dw finit_instruction-instruction_handler + db 'fild',0 + dw fild_instruction-instruction_handler + db 'fist',2 + dw fild_instruction-instruction_handler + db 'fld1',101000b + dw simple_fpu_instruction-instruction_handler + db 'fldz',101110b + dw simple_fpu_instruction-instruction_handler + db 'fmul',1 + dw basic_fpu_instruction-instruction_handler + db 'fnop',010000b + dw simple_fpu_instruction-instruction_handler + db 'fsin',111110b + dw simple_fpu_instruction-instruction_handler + db 'fstp',3 + dw fld_instruction-instruction_handler + db 'fsub',4 + dw basic_fpu_instruction-instruction_handler + db 'ftst',100100b + dw simple_fpu_instruction-instruction_handler + db 'fxam',100101b + dw simple_fpu_instruction-instruction_handler + db 'fxch',0 + dw fxch_instruction-instruction_handler + db 'heap',0 + dw heap_directive-instruction_handler + db 'idiv',7 + dw single_operand_instruction-instruction_handler + db 'imul',0 + dw imul_instruction-instruction_handler + db 'insb',6Ch + dw simple_instruction-instruction_handler + db 'insd',6Dh + dw simple_instruction_32bit-instruction_handler + db 'insw',6Dh + dw simple_instruction_16bit-instruction_handler + db 'int1',0F1h + dw simple_instruction-instruction_handler + db 'int3',0CCh + dw simple_instruction-instruction_handler + db 'into',0CEh + dw simple_instruction_except64-instruction_handler + db 'invd',8 + dw simple_extended_instruction-instruction_handler + db 'iret',0CFh + dw iret_instruction-instruction_handler + db 'jcxz',0E3h + dw loop_instruction_16bit-instruction_handler + db 'jnae',72h + dw conditional_jump-instruction_handler + db 'jnbe',77h + dw conditional_jump-instruction_handler + db 'jnge',7Ch + dw conditional_jump-instruction_handler + db 'jnle',7Fh + dw conditional_jump-instruction_handler + db 'korb',45h + dw mask_instruction_b-instruction_handler + db 'kord',45h + dw mask_instruction_d-instruction_handler + db 'korq',45h + dw mask_instruction_q-instruction_handler + db 'korw',45h + dw mask_instruction_w-instruction_handler + db 'lahf',9Fh + dw simple_instruction-instruction_handler + db 'lgdt',2 + dw lgdt_instruction-instruction_handler + db 'lidt',3 + dw lgdt_instruction-instruction_handler + db 'lldt',2 + dw pm_word_instruction-instruction_handler + db 'lmsw',16h + dw pm_word_instruction-instruction_handler + db 'load',0 + dw load_directive-instruction_handler + db 'lock',0F0h + dw prefix_instruction-instruction_handler + db 'lods',0ACh + dw lods_instruction-instruction_handler + db 'loop',0E2h + dw loop_instruction-instruction_handler + db 'movd',0 + dw movd_instruction-instruction_handler + db 'movq',0 + dw movq_instruction-instruction_handler + db 'movs',0A4h + dw movs_instruction-instruction_handler + db 'mulx',0F6h + dw pdep_instruction-instruction_handler + db 'orpd',56h + dw sse_pd_instruction-instruction_handler + db 'orps',56h + dw sse_ps_instruction-instruction_handler + db 'outs',6Eh + dw outs_instruction-instruction_handler + db 'pand',0DBh + dw basic_mmx_instruction-instruction_handler + db 'pdep',0F5h + dw pdep_instruction-instruction_handler + db 'pext',0F5h + dw pext_instruction-instruction_handler + db 'popa',61h + dw simple_instruction_except64-instruction_handler + db 'popd',4 + dw pop_instruction-instruction_handler + db 'popf',9Dh + dw simple_instruction-instruction_handler + db 'popq',8 + dw pop_instruction-instruction_handler + db 'popw',2 + dw pop_instruction-instruction_handler + db 'push',0 + dw push_instruction-instruction_handler + db 'pxor',0EFh + dw basic_mmx_instruction-instruction_handler + db 'repe',0F3h + dw prefix_instruction-instruction_handler + db 'repz',0F3h + dw prefix_instruction-instruction_handler + db 'retd',0C2h + dw ret_instruction_32bit_except64-instruction_handler + db 'retf',0CAh + dw retf_instruction-instruction_handler + db 'retn',0C2h + dw ret_instruction-instruction_handler + db 'retq',0C2h + dw ret_instruction_only64-instruction_handler + db 'retw',0C2h + dw ret_instruction_16bit-instruction_handler + db 'rorx',0F0h + dw rorx_instruction-instruction_handler + db 'sahf',9Eh + dw simple_instruction-instruction_handler + db 'salc',0D6h + dw simple_instruction_except64-instruction_handler + db 'sarx',0F7h + dw sarx_instruction-instruction_handler + db 'scas',0AEh + dw stos_instruction-instruction_handler + db 'seta',97h + dw set_instruction-instruction_handler + db 'setb',92h + dw set_instruction-instruction_handler + db 'setc',92h + dw set_instruction-instruction_handler + db 'sete',94h + dw set_instruction-instruction_handler + db 'setg',9Fh + dw set_instruction-instruction_handler + db 'setl',9Ch + dw set_instruction-instruction_handler + db 'seto',90h + dw set_instruction-instruction_handler + db 'setp',9Ah + dw set_instruction-instruction_handler + db 'sets',98h + dw set_instruction-instruction_handler + db 'setz',94h + dw set_instruction-instruction_handler + db 'sgdt',0 + dw lgdt_instruction-instruction_handler + db 'shld',0A4h + dw shd_instruction-instruction_handler + db 'shlx',0F7h + dw shlx_instruction-instruction_handler + db 'shrd',0ACh + dw shd_instruction-instruction_handler + db 'shrx',0F7h + dw shrx_instruction-instruction_handler + db 'sidt',1 + dw lgdt_instruction-instruction_handler + db 'sldt',0 + dw pm_store_word_instruction-instruction_handler + db 'smsw',14h + dw pm_store_word_instruction-instruction_handler + db 'stac',0CBh + dw simple_instruction_0f_01-instruction_handler + db 'stgi',0DCh + dw simple_instruction_0f_01-instruction_handler + db 'stos',0AAh + dw stos_instruction-instruction_handler + db 'test',0 + dw test_instruction-instruction_handler + db 'verr',4 + dw pm_word_instruction-instruction_handler + db 'verw',5 + dw pm_word_instruction-instruction_handler + db 'vpor',0EBh + dw avx_pd_instruction_noevex-instruction_handler + db 'wait',9Bh + dw simple_instruction-instruction_handler + db 'xadd',0C0h + dw basic_486_instruction-instruction_handler + db 'xchg',0 + dw xchg_instruction-instruction_handler + db 'xend',0D5h + dw simple_instruction_0f_01-instruction_handler + db 'xlat',0D7h + dw xlat_instruction-instruction_handler +instructions_5: + db 'addpd',58h + dw sse_pd_instruction-instruction_handler + db 'addps',58h + dw sse_ps_instruction-instruction_handler + db 'addsd',58h + dw sse_sd_instruction-instruction_handler + db 'addss',58h + dw sse_ss_instruction-instruction_handler + db 'align',0 + dw align_directive-instruction_handler + db 'andpd',54h + dw sse_pd_instruction-instruction_handler + db 'andps',54h + dw sse_ps_instruction-instruction_handler + db 'bextr',0F7h + dw bextr_instruction-instruction_handler + db 'blcic',15h + dw tbm_instruction-instruction_handler + db 'blsic',16h + dw tbm_instruction-instruction_handler + db 'bndcl',1Ah + dw bndcl_instruction-instruction_handler + db 'bndcn',1Bh + dw bndcu_instruction-instruction_handler + db 'bndcu',1Ah + dw bndcu_instruction-instruction_handler + db 'bndmk',1Bh + dw bndmk_instruction-instruction_handler + db 'bound',0 + dw bound_instruction-instruction_handler + db 'break',0 + dw break_directive-instruction_handler + db 'bswap',0 + dw bswap_instruction-instruction_handler + db 'cmova',47h + dw bs_instruction-instruction_handler + db 'cmovb',42h + dw bs_instruction-instruction_handler + db 'cmovc',42h + dw bs_instruction-instruction_handler + db 'cmove',44h + dw bs_instruction-instruction_handler + db 'cmovg',4Fh + dw bs_instruction-instruction_handler + db 'cmovl',4Ch + dw bs_instruction-instruction_handler + db 'cmovo',40h + dw bs_instruction-instruction_handler + db 'cmovp',4Ah + dw bs_instruction-instruction_handler + db 'cmovs',48h + dw bs_instruction-instruction_handler + db 'cmovz',44h + dw bs_instruction-instruction_handler + db 'cmppd',-1 + dw cmp_pd_instruction-instruction_handler + db 'cmpps',-1 + dw cmp_ps_instruction-instruction_handler + db 'cmpsb',0A6h + dw simple_instruction-instruction_handler + db 'cmpsd',-1 + dw cmpsd_instruction-instruction_handler + db 'cmpsq',0A7h + dw simple_instruction_64bit-instruction_handler + db 'cmpss',-1 + dw cmp_ss_instruction-instruction_handler + db 'cmpsw',0A7h + dw simple_instruction_16bit-instruction_handler + db 'cpuid',0A2h + dw simple_extended_instruction-instruction_handler + db 'crc32',0 + dw crc32_instruction-instruction_handler + db 'divpd',5Eh + dw sse_pd_instruction-instruction_handler + db 'divps',5Eh + dw sse_ps_instruction-instruction_handler + db 'divsd',5Eh + dw sse_sd_instruction-instruction_handler + db 'divss',5Eh + dw sse_ss_instruction-instruction_handler + db 'enter',0 + dw enter_instruction-instruction_handler + db 'entry',0 + dw entry_directive-instruction_handler + db 'extrn',0 + dw extrn_directive-instruction_handler + db 'extrq',0 + dw extrq_instruction-instruction_handler + db 'f2xm1',110000b + dw simple_fpu_instruction-instruction_handler + db 'faddp',0 + dw faddp_instruction-instruction_handler + db 'fbstp',6 + dw fbld_instruction-instruction_handler + db 'fclex',0E2h + dw finit_instruction-instruction_handler + db 'fcomi',0F0h + dw fcomi_instruction-instruction_handler + db 'fcomp',3 + dw basic_fpu_instruction-instruction_handler + db 'fdisi',0E1h + dw finit_instruction-instruction_handler + db 'fdivp',7 + dw faddp_instruction-instruction_handler + db 'fdivr',7 + dw basic_fpu_instruction-instruction_handler + db 'femms',0Eh + dw simple_extended_instruction-instruction_handler + db 'ffree',0 + dw ffree_instruction-instruction_handler + db 'fiadd',0 + dw fi_instruction-instruction_handler + db 'ficom',2 + dw fi_instruction-instruction_handler + db 'fidiv',6 + dw fi_instruction-instruction_handler + db 'fimul',1 + dw fi_instruction-instruction_handler + db 'finit',0E3h + dw finit_instruction-instruction_handler + db 'fistp',3 + dw fild_instruction-instruction_handler + db 'fisub',4 + dw fi_instruction-instruction_handler + db 'fldcw',5 + dw fldcw_instruction-instruction_handler + db 'fldpi',101011b + dw simple_fpu_instruction-instruction_handler + db 'fmulp',1 + dw faddp_instruction-instruction_handler + db 'fneni',0E0h + dw fninit_instruction-instruction_handler + db 'fprem',111000b + dw simple_fpu_instruction-instruction_handler + db 'fptan',110010b + dw simple_fpu_instruction-instruction_handler + db 'fsave',6 + dw fsave_instruction-instruction_handler + db 'fsqrt',111010b + dw simple_fpu_instruction-instruction_handler + db 'fstcw',7 + dw fstcw_instruction-instruction_handler + db 'fstsw',0 + dw fstsw_instruction-instruction_handler + db 'fsubp',5 + dw faddp_instruction-instruction_handler + db 'fsubr',5 + dw basic_fpu_instruction-instruction_handler + db 'fucom',4 + dw ffree_instruction-instruction_handler + db 'fwait',9Bh + dw simple_instruction-instruction_handler + db 'fyl2x',110001b + dw simple_fpu_instruction-instruction_handler + db 'icebp',0F1h + dw simple_instruction-instruction_handler + db 'iretd',0CFh + dw simple_instruction_32bit-instruction_handler + db 'iretq',0CFh + dw simple_instruction_64bit-instruction_handler + db 'iretw',0CFh + dw simple_instruction_16bit-instruction_handler + db 'jecxz',0E3h + dw loop_instruction_32bit-instruction_handler + db 'jrcxz',0E3h + dw loop_instruction_64bit-instruction_handler + db 'kaddb',4Ah + dw mask_instruction_b-instruction_handler + db 'kaddd',4Ah + dw mask_instruction_d-instruction_handler + db 'kaddq',4Ah + dw mask_instruction_q-instruction_handler + db 'kaddw',4Ah + dw mask_instruction_w-instruction_handler + db 'kandb',41h + dw mask_instruction_b-instruction_handler + db 'kandd',41h + dw mask_instruction_d-instruction_handler + db 'kandq',41h + dw mask_instruction_q-instruction_handler + db 'kandw',41h + dw mask_instruction_w-instruction_handler + db 'kmovb',1 + dw kmov_instruction-instruction_handler + db 'kmovd',4 + dw kmov_instruction-instruction_handler + db 'kmovq',8 + dw kmov_instruction-instruction_handler + db 'kmovw',2 + dw kmov_instruction-instruction_handler + db 'knotb',44h + dw mask_instruction_single_source_b-instruction_handler + db 'knotd',44h + dw mask_instruction_single_source_d-instruction_handler + db 'knotq',44h + dw mask_instruction_single_source_q-instruction_handler + db 'knotw',44h + dw mask_instruction_single_source_w-instruction_handler + db 'kxorb',47h + dw mask_instruction_b-instruction_handler + db 'kxord',47h + dw mask_instruction_d-instruction_handler + db 'kxorq',47h + dw mask_instruction_q-instruction_handler + db 'kxorw',47h + dw mask_instruction_w-instruction_handler + db 'label',0 + dw label_directive-instruction_handler + db 'lddqu',0 + dw lddqu_instruction-instruction_handler + db 'leave',0C9h + dw simple_instruction-instruction_handler + db 'lodsb',0ACh + dw simple_instruction-instruction_handler + db 'lodsd',0ADh + dw simple_instruction_32bit-instruction_handler + db 'lodsq',0ADh + dw simple_instruction_64bit-instruction_handler + db 'lodsw',0ADh + dw simple_instruction_16bit-instruction_handler + db 'loopd',0E2h + dw loop_instruction_32bit-instruction_handler + db 'loope',0E1h + dw loop_instruction-instruction_handler + db 'loopq',0E2h + dw loop_instruction_64bit-instruction_handler + db 'loopw',0E2h + dw loop_instruction_16bit-instruction_handler + db 'loopz',0E1h + dw loop_instruction-instruction_handler + db 'lzcnt',0BDh + dw popcnt_instruction-instruction_handler + db 'maxpd',5Fh + dw sse_pd_instruction-instruction_handler + db 'maxps',5Fh + dw sse_ps_instruction-instruction_handler + db 'maxsd',5Fh + dw sse_sd_instruction-instruction_handler + db 'maxss',5Fh + dw sse_ss_instruction-instruction_handler + db 'minpd',5Dh + dw sse_pd_instruction-instruction_handler + db 'minps',5Dh + dw sse_ps_instruction-instruction_handler + db 'minsd',5Dh + dw sse_sd_instruction-instruction_handler + db 'minss',5Dh + dw sse_ss_instruction-instruction_handler + db 'movbe',0F0h + dw movbe_instruction-instruction_handler + db 'movsb',0A4h + dw simple_instruction-instruction_handler + db 'movsd',0 + dw movsd_instruction-instruction_handler + db 'movsq',0A5h + dw simple_instruction_64bit-instruction_handler + db 'movss',0 + dw movss_instruction-instruction_handler + db 'movsw',0A5h + dw simple_instruction_16bit-instruction_handler + db 'movsx',0BEh + dw movx_instruction-instruction_handler + db 'movzx',0B6h + dw movx_instruction-instruction_handler + db 'mulpd',59h + dw sse_pd_instruction-instruction_handler + db 'mulps',59h + dw sse_ps_instruction-instruction_handler + db 'mulsd',59h + dw sse_sd_instruction-instruction_handler + db 'mulss',59h + dw sse_ss_instruction-instruction_handler + db 'mwait',0C9h + dw monitor_instruction-instruction_handler + db 'outsb',6Eh + dw simple_instruction-instruction_handler + db 'outsd',6Fh + dw simple_instruction_32bit-instruction_handler + db 'outsw',6Fh + dw simple_instruction_16bit-instruction_handler + db 'pabsb',1Ch + dw ssse3_instruction-instruction_handler + db 'pabsd',1Eh + dw ssse3_instruction-instruction_handler + db 'pabsw',1Dh + dw ssse3_instruction-instruction_handler + db 'paddb',0FCh + dw basic_mmx_instruction-instruction_handler + db 'paddd',0FEh + dw basic_mmx_instruction-instruction_handler + db 'paddq',0D4h + dw basic_mmx_instruction-instruction_handler + db 'paddw',0FDh + dw basic_mmx_instruction-instruction_handler + db 'pandn',0DFh + dw basic_mmx_instruction-instruction_handler + db 'pause',0 + dw pause_instruction-instruction_handler + db 'pavgb',0E0h + dw basic_mmx_instruction-instruction_handler + db 'pavgw',0E3h + dw basic_mmx_instruction-instruction_handler + db 'pf2id',1Dh + dw amd3dnow_instruction-instruction_handler + db 'pf2iw',1Ch + dw amd3dnow_instruction-instruction_handler + db 'pfacc',0AEh + dw amd3dnow_instruction-instruction_handler + db 'pfadd',9Eh + dw amd3dnow_instruction-instruction_handler + db 'pfmax',0A4h + dw amd3dnow_instruction-instruction_handler + db 'pfmin',94h + dw amd3dnow_instruction-instruction_handler + db 'pfmul',0B4h + dw amd3dnow_instruction-instruction_handler + db 'pfrcp',96h + dw amd3dnow_instruction-instruction_handler + db 'pfsub',9Ah + dw amd3dnow_instruction-instruction_handler + db 'pi2fd',0Dh + dw amd3dnow_instruction-instruction_handler + db 'pi2fw',0Ch + dw amd3dnow_instruction-instruction_handler + db 'popad',61h + dw simple_instruction_32bit_except64-instruction_handler + db 'popaw',61h + dw simple_instruction_16bit_except64-instruction_handler + db 'popfd',9Dh + dw simple_instruction_32bit_except64-instruction_handler + db 'popfq',9Dh + dw simple_instruction_only64-instruction_handler + db 'popfw',9Dh + dw simple_instruction_16bit-instruction_handler + db 'pslld',0F2h + dw mmx_bit_shift_instruction-instruction_handler + db 'psllq',0F3h + dw mmx_bit_shift_instruction-instruction_handler + db 'psllw',0F1h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrad',0E2h + dw mmx_bit_shift_instruction-instruction_handler + db 'psraw',0E1h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrld',0D2h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrlq',0D3h + dw mmx_bit_shift_instruction-instruction_handler + db 'psrlw',0D1h + dw mmx_bit_shift_instruction-instruction_handler + db 'psubb',0F8h + dw basic_mmx_instruction-instruction_handler + db 'psubd',0FAh + dw basic_mmx_instruction-instruction_handler + db 'psubq',0FBh + dw basic_mmx_instruction-instruction_handler + db 'psubw',0F9h + dw basic_mmx_instruction-instruction_handler + db 'ptest',17h + dw sse4_instruction_66_38-instruction_handler + db 'pusha',60h + dw simple_instruction_except64-instruction_handler + db 'pushd',4 + dw push_instruction-instruction_handler + db 'pushf',9Ch + dw simple_instruction-instruction_handler + db 'pushq',8 + dw push_instruction-instruction_handler + db 'pushw',2 + dw push_instruction-instruction_handler + db 'rcpps',53h + dw sse_ps_instruction-instruction_handler + db 'rcpss',53h + dw sse_ss_instruction-instruction_handler + db 'rdmsr',32h + dw simple_extended_instruction-instruction_handler + db 'rdpmc',33h + dw simple_extended_instruction-instruction_handler + db 'rdtsc',31h + dw simple_extended_instruction-instruction_handler + db 'repne',0F2h + dw prefix_instruction-instruction_handler + db 'repnz',0F2h + dw prefix_instruction-instruction_handler + db 'retfd',0CAh + dw retf_instruction_32bit-instruction_handler + db 'retfq',0CAh + dw retf_instruction_64bit-instruction_handler + db 'retfw',0CAh + dw retf_instruction_16bit-instruction_handler + db 'retnd',0C2h + dw ret_instruction_32bit_except64-instruction_handler + db 'retnq',0C2h + dw ret_instruction_only64-instruction_handler + db 'retnw',0C2h + dw ret_instruction_16bit-instruction_handler + db 'scasb',0AEh + dw simple_instruction-instruction_handler + db 'scasd',0AFh + dw simple_instruction_32bit-instruction_handler + db 'scasq',0AFh + dw simple_instruction_64bit-instruction_handler + db 'scasw',0AFh + dw simple_instruction_16bit-instruction_handler + db 'setae',93h + dw set_instruction-instruction_handler + db 'setbe',96h + dw set_instruction-instruction_handler + db 'setge',9Dh + dw set_instruction-instruction_handler + db 'setle',9Eh + dw set_instruction-instruction_handler + db 'setna',96h + dw set_instruction-instruction_handler + db 'setnb',93h + dw set_instruction-instruction_handler + db 'setnc',93h + dw set_instruction-instruction_handler + db 'setne',95h + dw set_instruction-instruction_handler + db 'setng',9Eh + dw set_instruction-instruction_handler + db 'setnl',9Dh + dw set_instruction-instruction_handler + db 'setno',91h + dw set_instruction-instruction_handler + db 'setnp',9Bh + dw set_instruction-instruction_handler + db 'setns',99h + dw set_instruction-instruction_handler + db 'setnz',95h + dw set_instruction-instruction_handler + db 'setpe',9Ah + dw set_instruction-instruction_handler + db 'setpo',9Bh + dw set_instruction-instruction_handler + db 'stack',0 + dw stack_directive-instruction_handler + db 'store',0 + dw store_directive-instruction_handler + db 'stosb',0AAh + dw simple_instruction-instruction_handler + db 'stosd',0ABh + dw simple_instruction_32bit-instruction_handler + db 'stosq',0ABh + dw simple_instruction_64bit-instruction_handler + db 'stosw',0ABh + dw simple_instruction_16bit-instruction_handler + db 'subpd',5Ch + dw sse_pd_instruction-instruction_handler + db 'subps',5Ch + dw sse_ps_instruction-instruction_handler + db 'subsd',5Ch + dw sse_sd_instruction-instruction_handler + db 'subss',5Ch + dw sse_ss_instruction-instruction_handler + db 'times',0 + dw times_directive-instruction_handler + db 'tzcnt',0BCh + dw popcnt_instruction-instruction_handler + db 'tzmsk',14h + dw tbm_instruction-instruction_handler + db 'vdppd',41h + dw avx_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vdpps',40h + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vmovd',0 + dw avx_movd_instruction-instruction_handler + db 'vmovq',0 + dw avx_movq_instruction-instruction_handler + db 'vmrun',0D8h + dw simple_svm_instruction-instruction_handler + db 'vmxon',6 + dw vmxon_instruction-instruction_handler + db 'vorpd',56h + dw avx_pd_instruction-instruction_handler + db 'vorps',56h + dw avx_ps_instruction-instruction_handler + db 'vpand',0DBh + dw avx_pd_instruction_noevex-instruction_handler + db 'vpord',0EBh + dw avx_d_instruction_evex-instruction_handler + db 'vporq',0EBh + dw avx_q_instruction_evex-instruction_handler + db 'vpxor',0EFh + dw avx_pd_instruction_noevex-instruction_handler + db 'while',0 + dw while_directive-instruction_handler + db 'wrmsr',30h + dw simple_extended_instruction-instruction_handler + db 'xlatb',0D7h + dw simple_instruction-instruction_handler + db 'xorpd',57h + dw sse_pd_instruction-instruction_handler + db 'xorps',57h + dw sse_ps_instruction-instruction_handler + db 'xsave',100b + dw fxsave_instruction-instruction_handler + db 'xtest',0D6h + dw simple_instruction_0f_01-instruction_handler +instructions_6: + db 'aesdec',0DEh + dw sse4_instruction_66_38-instruction_handler + db 'aesenc',0DCh + dw sse4_instruction_66_38-instruction_handler + db 'aesimc',0DBh + dw sse4_instruction_66_38-instruction_handler + db 'andnpd',55h + dw sse_pd_instruction-instruction_handler + db 'andnps',55h + dw sse_ps_instruction-instruction_handler + db 'assert',0 + dw assert_directive-instruction_handler + db 'blcmsk',21h + dw tbm_instruction-instruction_handler + db 'blsmsk',2 + dw bmi_instruction-instruction_handler + db 'bndldx',1Ah + dw bndldx_instruction-instruction_handler + db 'bndmov',1Ah + dw bndmov_instruction-instruction_handler + db 'bndstx',1Bh + dw bndstx_instruction-instruction_handler + db 'cmovae',43h + dw bs_instruction-instruction_handler + db 'cmovbe',46h + dw bs_instruction-instruction_handler + db 'cmovge',4Dh + dw bs_instruction-instruction_handler + db 'cmovle',4Eh + dw bs_instruction-instruction_handler + db 'cmovna',46h + dw bs_instruction-instruction_handler + db 'cmovnb',43h + dw bs_instruction-instruction_handler + db 'cmovnc',43h + dw bs_instruction-instruction_handler + db 'cmovne',45h + dw bs_instruction-instruction_handler + db 'cmovng',4Eh + dw bs_instruction-instruction_handler + db 'cmovnl',4Dh + dw bs_instruction-instruction_handler + db 'cmovno',41h + dw bs_instruction-instruction_handler + db 'cmovnp',4Bh + dw bs_instruction-instruction_handler + db 'cmovns',49h + dw bs_instruction-instruction_handler + db 'cmovnz',45h + dw bs_instruction-instruction_handler + db 'cmovpe',4Ah + dw bs_instruction-instruction_handler + db 'cmovpo',4Bh + dw bs_instruction-instruction_handler + db 'comisd',2Fh + dw comisd_instruction-instruction_handler + db 'comiss',2Fh + dw comiss_instruction-instruction_handler + db 'fcmovb',0C0h + dw fcmov_instruction-instruction_handler + db 'fcmove',0C8h + dw fcmov_instruction-instruction_handler + db 'fcmovu',0D8h + dw fcmov_instruction-instruction_handler + db 'fcomip',0F0h + dw fcomip_instruction-instruction_handler + db 'fcompp',0 + dw fcompp_instruction-instruction_handler + db 'fdivrp',6 + dw faddp_instruction-instruction_handler + db 'ffreep',0 + dw ffreep_instruction-instruction_handler + db 'ficomp',3 + dw fi_instruction-instruction_handler + db 'fidivr',7 + dw fi_instruction-instruction_handler + db 'fisttp',1 + dw fild_instruction-instruction_handler + db 'fisubr',5 + dw fi_instruction-instruction_handler + db 'fldenv',4 + dw fldenv_instruction-instruction_handler + db 'fldl2e',101010b + dw simple_fpu_instruction-instruction_handler + db 'fldl2t',101001b + dw simple_fpu_instruction-instruction_handler + db 'fldlg2',101100b + dw simple_fpu_instruction-instruction_handler + db 'fldln2',101101b + dw simple_fpu_instruction-instruction_handler + db 'fnclex',0E2h + dw fninit_instruction-instruction_handler + db 'fndisi',0E1h + dw fninit_instruction-instruction_handler + db 'fninit',0E3h + dw fninit_instruction-instruction_handler + db 'fnsave',6 + dw fnsave_instruction-instruction_handler + db 'fnstcw',7 + dw fldcw_instruction-instruction_handler + db 'fnstsw',0 + dw fnstsw_instruction-instruction_handler + db 'format',0 + dw format_directive-instruction_handler + db 'fpatan',110011b + dw simple_fpu_instruction-instruction_handler + db 'fprem1',110101b + dw simple_fpu_instruction-instruction_handler + db 'frstor',4 + dw fnsave_instruction-instruction_handler + db 'frstpm',0E5h + dw fninit_instruction-instruction_handler + db 'fsaved',6 + dw fsave_instruction_32bit-instruction_handler + db 'fsavew',6 + dw fsave_instruction_16bit-instruction_handler + db 'fscale',111101b + dw simple_fpu_instruction-instruction_handler + db 'fsetpm',0E4h + dw fninit_instruction-instruction_handler + db 'fstenv',6 + dw fstenv_instruction-instruction_handler + db 'fsubrp',4 + dw faddp_instruction-instruction_handler + db 'fucomi',0E8h + dw fcomi_instruction-instruction_handler + db 'fucomp',5 + dw ffree_instruction-instruction_handler + db 'fxsave',0 + dw fxsave_instruction-instruction_handler + db 'getsec',37h + dw simple_extended_instruction-instruction_handler + db 'haddpd',07Ch + dw sse_pd_instruction-instruction_handler + db 'haddps',07Ch + dw cvtpd2dq_instruction-instruction_handler + db 'hsubpd',07Dh + dw sse_pd_instruction-instruction_handler + db 'hsubps',07Dh + dw cvtpd2dq_instruction-instruction_handler + db 'invept',80h + dw vmx_inv_instruction-instruction_handler + db 'invlpg',0 + dw invlpg_instruction-instruction_handler + db 'kandnb',42h + dw mask_instruction_b-instruction_handler + db 'kandnd',42h + dw mask_instruction_d-instruction_handler + db 'kandnq',42h + dw mask_instruction_q-instruction_handler + db 'kandnw',42h + dw mask_instruction_w-instruction_handler + db 'ktestb',99h + dw mask_instruction_single_source_b-instruction_handler + db 'ktestd',99h + dw mask_instruction_single_source_d-instruction_handler + db 'ktestq',99h + dw mask_instruction_single_source_q-instruction_handler + db 'ktestw',99h + dw mask_instruction_single_source_w-instruction_handler + db 'kxnorb',46h + dw mask_instruction_b-instruction_handler + db 'kxnord',46h + dw mask_instruction_d-instruction_handler + db 'kxnorq',46h + dw mask_instruction_q-instruction_handler + db 'kxnorw',46h + dw mask_instruction_w-instruction_handler + db 'lfence',0E8h + dw fence_instruction-instruction_handler + db 'llwpcb',0 + dw llwpcb_instruction-instruction_handler + db 'looped',0E1h + dw loop_instruction_32bit-instruction_handler + db 'loopeq',0E1h + dw loop_instruction_64bit-instruction_handler + db 'loopew',0E1h + dw loop_instruction_16bit-instruction_handler + db 'loopne',0E0h + dw loop_instruction-instruction_handler + db 'loopnz',0E0h + dw loop_instruction-instruction_handler + db 'loopzd',0E1h + dw loop_instruction_32bit-instruction_handler + db 'loopzq',0E1h + dw loop_instruction_64bit-instruction_handler + db 'loopzw',0E1h + dw loop_instruction_16bit-instruction_handler + db 'lwpins',0 + dw lwpins_instruction-instruction_handler + db 'lwpval',1 + dw lwpins_instruction-instruction_handler + db 'mfence',0F0h + dw fence_instruction-instruction_handler + db 'movapd',28h + dw movpd_instruction-instruction_handler + db 'movaps',28h + dw movps_instruction-instruction_handler + db 'movdqa',66h + dw movdq_instruction-instruction_handler + db 'movdqu',0F3h + dw movdq_instruction-instruction_handler + db 'movhpd',16h + dw movlpd_instruction-instruction_handler + db 'movhps',16h + dw movlps_instruction-instruction_handler + db 'movlpd',12h + dw movlpd_instruction-instruction_handler + db 'movlps',12h + dw movlps_instruction-instruction_handler + db 'movnti',0C3h + dw movnti_instruction-instruction_handler + db 'movntq',0E7h + dw movntq_instruction-instruction_handler + db 'movsxd',63h + dw movsxd_instruction-instruction_handler + db 'movupd',10h + dw movpd_instruction-instruction_handler + db 'movups',10h + dw movps_instruction-instruction_handler + db 'paddsb',0ECh + dw basic_mmx_instruction-instruction_handler + db 'paddsw',0EDh + dw basic_mmx_instruction-instruction_handler + db 'pextrb',14h + dw pextrb_instruction-instruction_handler + db 'pextrd',16h + dw pextrd_instruction-instruction_handler + db 'pextrq',16h + dw pextrq_instruction-instruction_handler + db 'pextrw',15h + dw pextrw_instruction-instruction_handler + db 'pfnacc',8Ah + dw amd3dnow_instruction-instruction_handler + db 'pfsubr',0AAh + dw amd3dnow_instruction-instruction_handler + db 'phaddd',2 + dw ssse3_instruction-instruction_handler + db 'phaddw',1 + dw ssse3_instruction-instruction_handler + db 'phsubd',6 + dw ssse3_instruction-instruction_handler + db 'phsubw',5 + dw ssse3_instruction-instruction_handler + db 'pinsrb',20h + dw pinsrb_instruction-instruction_handler + db 'pinsrd',22h + dw pinsrd_instruction-instruction_handler + db 'pinsrq',22h + dw pinsrq_instruction-instruction_handler + db 'pinsrw',0C4h + dw pinsrw_instruction-instruction_handler + db 'pmaxsb',3Ch + dw sse4_instruction_66_38-instruction_handler + db 'pmaxsd',3Dh + dw sse4_instruction_66_38-instruction_handler + db 'pmaxsw',0EEh + dw basic_mmx_instruction-instruction_handler + db 'pmaxub',0DEh + dw basic_mmx_instruction-instruction_handler + db 'pmaxud',3Fh + dw sse4_instruction_66_38-instruction_handler + db 'pmaxuw',3Eh + dw sse4_instruction_66_38-instruction_handler + db 'pminsb',38h + dw sse4_instruction_66_38-instruction_handler + db 'pminsd',39h + dw sse4_instruction_66_38-instruction_handler + db 'pminsw',0EAh + dw basic_mmx_instruction-instruction_handler + db 'pminub',0DAh + dw basic_mmx_instruction-instruction_handler + db 'pminud',3Bh + dw sse4_instruction_66_38-instruction_handler + db 'pminuw',3Ah + dw sse4_instruction_66_38-instruction_handler + db 'pmuldq',28h + dw sse4_instruction_66_38-instruction_handler + db 'pmulhw',0E5h + dw basic_mmx_instruction-instruction_handler + db 'pmulld',40h + dw sse4_instruction_66_38-instruction_handler + db 'pmullw',0D5h + dw basic_mmx_instruction-instruction_handler + db 'popcnt',0B8h + dw popcnt_instruction-instruction_handler + db 'psadbw',0F6h + dw basic_mmx_instruction-instruction_handler + db 'pshufb',0 + dw ssse3_instruction-instruction_handler + db 'pshufd',66h + dw pshufd_instruction-instruction_handler + db 'pshufw',0 + dw pshufw_instruction-instruction_handler + db 'psignb',8 + dw ssse3_instruction-instruction_handler + db 'psignd',0Ah + dw ssse3_instruction-instruction_handler + db 'psignw',9 + dw ssse3_instruction-instruction_handler + db 'pslldq',111b + dw pslldq_instruction-instruction_handler + db 'psrldq',011b + dw pslldq_instruction-instruction_handler + db 'psubsb',0E8h + dw basic_mmx_instruction-instruction_handler + db 'psubsw',0E9h + dw basic_mmx_instruction-instruction_handler + db 'pswapd',0BBh + dw amd3dnow_instruction-instruction_handler + db 'public',0 + dw public_directive-instruction_handler + db 'pushad',60h + dw simple_instruction_32bit_except64-instruction_handler + db 'pushaw',60h + dw simple_instruction_16bit_except64-instruction_handler + db 'pushfd',9Ch + dw simple_instruction_32bit_except64-instruction_handler + db 'pushfq',9Ch + dw simple_instruction_only64-instruction_handler + db 'pushfw',9Ch + dw simple_instruction_16bit-instruction_handler + db 'rdmsrq',32h + dw simple_extended_instruction_64bit-instruction_handler + db 'rdpkru',0EEh + dw simple_instruction_0f_01-instruction_handler + db 'rdrand',110b + dw rdrand_instruction-instruction_handler + db 'rdseed',111b + dw rdrand_instruction-instruction_handler + db 'rdtscp',0F9h + dw simple_instruction_0f_01-instruction_handler + db 'repeat',0 + dw repeat_directive-instruction_handler + db 'setalc',0D6h + dw simple_instruction_except64-instruction_handler + db 'setnae',92h + dw set_instruction-instruction_handler + db 'setnbe',97h + dw set_instruction-instruction_handler + db 'setnge',9Ch + dw set_instruction-instruction_handler + db 'setnle',9Fh + dw set_instruction-instruction_handler + db 'sfence',0F8h + dw fence_instruction-instruction_handler + db 'shufpd',0C6h + dw sse_pd_instruction_imm8-instruction_handler + db 'shufps',0C6h + dw sse_ps_instruction_imm8-instruction_handler + db 'skinit',0 + dw skinit_instruction-instruction_handler + db 'slwpcb',1 + dw llwpcb_instruction-instruction_handler + db 'sqrtpd',51h + dw sse_pd_instruction-instruction_handler + db 'sqrtps',51h + dw sse_ps_instruction-instruction_handler + db 'sqrtsd',51h + dw sse_sd_instruction-instruction_handler + db 'sqrtss',51h + dw sse_ss_instruction-instruction_handler + db 'swapgs',0F8h + dw swapgs_instruction-instruction_handler + db 'sysret',07h + dw simple_extended_instruction-instruction_handler + db 't1mskc',17h + dw tbm_instruction-instruction_handler + db 'vaddpd',58h + dw avx_pd_instruction_er-instruction_handler + db 'vaddps',58h + dw avx_ps_instruction_er-instruction_handler + db 'vaddsd',58h + dw avx_sd_instruction_er-instruction_handler + db 'vaddss',58h + dw avx_ss_instruction_er-instruction_handler + db 'vandpd',54h + dw avx_pd_instruction-instruction_handler + db 'vandps',54h + dw avx_ps_instruction-instruction_handler + db 'vcmppd',-1 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpps',-1 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpsd',-1 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpss',-1 + dw avx_cmp_ss_instruction-instruction_handler + db 'vdivpd',5Eh + dw avx_pd_instruction_er-instruction_handler + db 'vdivps',5Eh + dw avx_ps_instruction_er-instruction_handler + db 'vdivsd',5Eh + dw avx_sd_instruction_er-instruction_handler + db 'vdivss',5Eh + dw avx_ss_instruction_er-instruction_handler + db 'vlddqu',0F0h + dw avx_lddqu_instruction-instruction_handler + db 'vmaxpd',5Fh + dw avx_pd_instruction_sae-instruction_handler + db 'vmaxps',5Fh + dw avx_ps_instruction_sae-instruction_handler + db 'vmaxsd',5Fh + dw avx_sd_instruction_sae-instruction_handler + db 'vmaxss',5Fh + dw avx_ss_instruction_sae-instruction_handler + db 'vmcall',0C1h + dw simple_instruction_0f_01-instruction_handler + db 'vmfunc',0D4h + dw simple_instruction_0f_01-instruction_handler + db 'vminpd',5Dh + dw avx_pd_instruction_sae-instruction_handler + db 'vminps',5Dh + dw avx_ps_instruction_sae-instruction_handler + db 'vminsd',5Dh + dw avx_sd_instruction_sae-instruction_handler + db 'vminss',5Dh + dw avx_ss_instruction_sae-instruction_handler + db 'vmload',0DAh + dw simple_svm_instruction-instruction_handler + db 'vmovsd',0 + dw avx_movsd_instruction-instruction_handler + db 'vmovss',0 + dw avx_movss_instruction-instruction_handler + db 'vmread',0 + dw vmread_instruction-instruction_handler + db 'vmsave',0DBh + dw simple_svm_instruction-instruction_handler + db 'vmulpd',59h + dw avx_pd_instruction_er-instruction_handler + db 'vmulps',59h + dw avx_ps_instruction_er-instruction_handler + db 'vmulsd',59h + dw avx_sd_instruction_er-instruction_handler + db 'vmulss',59h + dw avx_ss_instruction_er-instruction_handler + db 'vmxoff',0C4h + dw simple_instruction_0f_01-instruction_handler + db 'vpabsb',1Ch + dw avx_single_source_bw_instruction_38-instruction_handler + db 'vpabsd',1Eh + dw avx_single_source_d_instruction_38-instruction_handler + db 'vpabsq',1Fh + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vpabsw',1Dh + dw avx_single_source_bw_instruction_38-instruction_handler + db 'vpaddb',0FCh + dw avx_bw_instruction-instruction_handler + db 'vpaddd',0FEh + dw avx_d_instruction-instruction_handler + db 'vpaddq',0D4h + dw avx_q_instruction-instruction_handler + db 'vpaddw',0FDh + dw avx_bw_instruction-instruction_handler + db 'vpandd',0DBh + dw avx_d_instruction_evex-instruction_handler + db 'vpandn',0DFh + dw avx_pd_instruction_noevex-instruction_handler + db 'vpandq',0DBh + dw avx_q_instruction_evex-instruction_handler + db 'vpavgb',0E0h + dw avx_bw_instruction-instruction_handler + db 'vpavgw',0E3h + dw avx_bw_instruction-instruction_handler + db 'vpcmov',0A2h + dw vpcmov_instruction-instruction_handler + db 'vpcmpb',-1 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpd',-1 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpq',-1 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpw',-1 + dw avx512_cmp_w_instruction-instruction_handler + db 'vpcomb',-1 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomd',-1 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomq',-1 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomw',-1 + dw xop_pcom_w_instruction-instruction_handler + db 'vpermb',8Dh + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpermd',36h + dw avx_permd_instruction-instruction_handler + db 'vpermq',0 + dw avx_permq_instruction-instruction_handler + db 'vpermw',8Dh + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpperm',0A3h + dw xop_128bit_instruction-instruction_handler + db 'vprold',1 + dw avx512_rotate_d_instruction-instruction_handler + db 'vprolq',1 + dw avx512_rotate_q_instruction-instruction_handler + db 'vprord',0 + dw avx512_rotate_d_instruction-instruction_handler + db 'vprorq',0 + dw avx512_rotate_q_instruction-instruction_handler + db 'vprotb',90h + dw xop_shift_instruction-instruction_handler + db 'vprotd',92h + dw xop_shift_instruction-instruction_handler + db 'vprotq',93h + dw xop_shift_instruction-instruction_handler + db 'vprotw',91h + dw xop_shift_instruction-instruction_handler + db 'vpshab',98h + dw xop_shift_instruction-instruction_handler + db 'vpshad',9Ah + dw xop_shift_instruction-instruction_handler + db 'vpshaq',9Bh + dw xop_shift_instruction-instruction_handler + db 'vpshaw',99h + dw xop_shift_instruction-instruction_handler + db 'vpshlb',94h + dw xop_shift_instruction-instruction_handler + db 'vpshld',96h + dw xop_shift_instruction-instruction_handler + db 'vpshlq',97h + dw xop_shift_instruction-instruction_handler + db 'vpshlw',95h + dw xop_shift_instruction-instruction_handler + db 'vpslld',0F2h + dw avx_shift_d_instruction-instruction_handler + db 'vpsllq',0F3h + dw avx_shift_q_instruction-instruction_handler + db 'vpsllw',0F1h + dw avx_shift_bw_instruction-instruction_handler + db 'vpsrad',0E2h + dw avx_shift_d_instruction-instruction_handler + db 'vpsraq',0E2h + dw avx_shift_q_instruction_evex-instruction_handler + db 'vpsraw',0E1h + dw avx_shift_bw_instruction-instruction_handler + db 'vpsrld',0D2h + dw avx_shift_d_instruction-instruction_handler + db 'vpsrlq',0D3h + dw avx_shift_q_instruction-instruction_handler + db 'vpsrlw',0D1h + dw avx_shift_bw_instruction-instruction_handler + db 'vpsubb',0F8h + dw avx_bw_instruction-instruction_handler + db 'vpsubd',0FAh + dw avx_d_instruction-instruction_handler + db 'vpsubq',0FBh + dw avx_q_instruction-instruction_handler + db 'vpsubw',0F9h + dw avx_bw_instruction-instruction_handler + db 'vptest',17h + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'vpxord',0EFh + dw avx_d_instruction_evex-instruction_handler + db 'vpxorq',0EFh + dw avx_q_instruction_evex-instruction_handler + db 'vrcpps',53h + dw avx_single_source_ps_instruction_noevex-instruction_handler + db 'vrcpss',53h + dw avx_ss_instruction_noevex-instruction_handler + db 'vsubpd',5Ch + dw avx_pd_instruction_er-instruction_handler + db 'vsubps',5Ch + dw avx_ps_instruction_er-instruction_handler + db 'vsubsd',5Ch + dw avx_sd_instruction_er-instruction_handler + db 'vsubss',5Ch + dw avx_ss_instruction_er-instruction_handler + db 'vxorpd',57h + dw avx_pd_instruction-instruction_handler + db 'vxorps',57h + dw avx_ps_instruction-instruction_handler + db 'wbinvd',9 + dw simple_extended_instruction-instruction_handler + db 'wrmsrq',30h + dw simple_extended_instruction_64bit-instruction_handler + db 'wrpkru',0EFh + dw simple_instruction_0f_01-instruction_handler + db 'xabort',0 + dw xabort_instruction-instruction_handler + db 'xbegin',0 + dw xbegin_instruction-instruction_handler + db 'xgetbv',0D0h + dw simple_instruction_0f_01-instruction_handler + db 'xrstor',101b + dw fxsave_instruction-instruction_handler + db 'xsetbv',0D1h + dw simple_instruction_0f_01-instruction_handler +instructions_7: + db 'blcfill',11h + dw tbm_instruction-instruction_handler + db 'blendpd',0Dh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'blendps',0Ch + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'blsfill',12h + dw tbm_instruction-instruction_handler + db 'clflush',111b + dw fxsave_instruction-instruction_handler + db 'cmovnae',42h + dw bs_instruction-instruction_handler + db 'cmovnbe',47h + dw bs_instruction-instruction_handler + db 'cmovnge',4Ch + dw bs_instruction-instruction_handler + db 'cmovnle',4Fh + dw bs_instruction-instruction_handler + db 'cmpeqpd',0 + dw cmp_pd_instruction-instruction_handler + db 'cmpeqps',0 + dw cmp_ps_instruction-instruction_handler + db 'cmpeqsd',0 + dw cmp_sd_instruction-instruction_handler + db 'cmpeqss',0 + dw cmp_ss_instruction-instruction_handler + db 'cmplepd',2 + dw cmp_pd_instruction-instruction_handler + db 'cmpleps',2 + dw cmp_ps_instruction-instruction_handler + db 'cmplesd',2 + dw cmp_sd_instruction-instruction_handler + db 'cmpless',2 + dw cmp_ss_instruction-instruction_handler + db 'cmpltpd',1 + dw cmp_pd_instruction-instruction_handler + db 'cmpltps',1 + dw cmp_ps_instruction-instruction_handler + db 'cmpltsd',1 + dw cmp_sd_instruction-instruction_handler + db 'cmpltss',1 + dw cmp_ss_instruction-instruction_handler + db 'cmpxchg',0B0h + dw basic_486_instruction-instruction_handler + db 'display',0 + dw display_directive-instruction_handler + db 'fcmovbe',0D0h + dw fcmov_instruction-instruction_handler + db 'fcmovnb',0C0h + dw fcomi_instruction-instruction_handler + db 'fcmovne',0C8h + dw fcomi_instruction-instruction_handler + db 'fcmovnu',0D8h + dw fcomi_instruction-instruction_handler + db 'fdecstp',110110b + dw simple_fpu_instruction-instruction_handler + db 'fincstp',110111b + dw simple_fpu_instruction-instruction_handler + db 'fldenvd',4 + dw fldenv_instruction_32bit-instruction_handler + db 'fldenvw',4 + dw fldenv_instruction_16bit-instruction_handler + db 'fnsaved',6 + dw fnsave_instruction_32bit-instruction_handler + db 'fnsavew',6 + dw fnsave_instruction_16bit-instruction_handler + db 'fnstenv',6 + dw fldenv_instruction-instruction_handler + db 'frndint',111100b + dw simple_fpu_instruction-instruction_handler + db 'frstord',4 + dw fnsave_instruction_32bit-instruction_handler + db 'frstorw',4 + dw fnsave_instruction_16bit-instruction_handler + db 'fsincos',111011b + dw simple_fpu_instruction-instruction_handler + db 'fstenvd',6 + dw fstenv_instruction_32bit-instruction_handler + db 'fstenvw',6 + dw fstenv_instruction_16bit-instruction_handler + db 'fucomip',0E8h + dw fcomip_instruction-instruction_handler + db 'fucompp',0 + dw fucompp_instruction-instruction_handler + db 'fxrstor',1 + dw fxsave_instruction-instruction_handler + db 'fxtract',110100b + dw simple_fpu_instruction-instruction_handler + db 'fyl2xp1',111001b + dw simple_fpu_instruction-instruction_handler + db 'insertq',0 + dw insertq_instruction-instruction_handler + db 'invlpga',0DFh + dw invlpga_instruction-instruction_handler + db 'invpcid',82h + dw vmx_inv_instruction-instruction_handler + db 'invvpid',81h + dw vmx_inv_instruction-instruction_handler + db 'ldmxcsr',10b + dw fxsave_instruction-instruction_handler + db 'loopned',0E0h + dw loop_instruction_32bit-instruction_handler + db 'loopneq',0E0h + dw loop_instruction_64bit-instruction_handler + db 'loopnew',0E0h + dw loop_instruction_16bit-instruction_handler + db 'loopnzd',0E0h + dw loop_instruction_32bit-instruction_handler + db 'loopnzq',0E0h + dw loop_instruction_64bit-instruction_handler + db 'loopnzw',0E0h + dw loop_instruction_16bit-instruction_handler + db 'monitor',0C8h + dw monitor_instruction-instruction_handler + db 'movddup',12h + dw sse_sd_instruction-instruction_handler + db 'movdq2q',0 + dw movdq2q_instruction-instruction_handler + db 'movhlps',12h + dw movhlps_instruction-instruction_handler + db 'movlhps',16h + dw movhlps_instruction-instruction_handler + db 'movntdq',0E7h + dw movntpd_instruction-instruction_handler + db 'movntpd',2Bh + dw movntpd_instruction-instruction_handler + db 'movntps',2Bh + dw movntps_instruction-instruction_handler + db 'movntsd',2Bh + dw movntsd_instruction-instruction_handler + db 'movntss',2Bh + dw movntss_instruction-instruction_handler + db 'movq2dq',0 + dw movq2dq_instruction-instruction_handler + db 'mpsadbw',42h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'paddusb',0DCh + dw basic_mmx_instruction-instruction_handler + db 'paddusw',0DDh + dw basic_mmx_instruction-instruction_handler + db 'palignr',0 + dw palignr_instruction-instruction_handler + db 'pavgusb',0BFh + dw amd3dnow_instruction-instruction_handler + db 'pblendw',0Eh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpeqb',74h + dw basic_mmx_instruction-instruction_handler + db 'pcmpeqd',76h + dw basic_mmx_instruction-instruction_handler + db 'pcmpeqq',29h + dw sse4_instruction_66_38-instruction_handler + db 'pcmpeqw',75h + dw basic_mmx_instruction-instruction_handler + db 'pcmpgtb',64h + dw basic_mmx_instruction-instruction_handler + db 'pcmpgtd',66h + dw basic_mmx_instruction-instruction_handler + db 'pcmpgtq',37h + dw sse4_instruction_66_38-instruction_handler + db 'pcmpgtw',65h + dw basic_mmx_instruction-instruction_handler + db 'pcommit',0F8h + dw pcommit_instruction-instruction_handler + db 'pfcmpeq',0B0h + dw amd3dnow_instruction-instruction_handler + db 'pfcmpge',90h + dw amd3dnow_instruction-instruction_handler + db 'pfcmpgt',0A0h + dw amd3dnow_instruction-instruction_handler + db 'pfpnacc',8Eh + dw amd3dnow_instruction-instruction_handler + db 'pfrsqrt',97h + dw amd3dnow_instruction-instruction_handler + db 'phaddsw',3 + dw ssse3_instruction-instruction_handler + db 'phsubsw',7 + dw ssse3_instruction-instruction_handler + db 'pmaddwd',0F5h + dw basic_mmx_instruction-instruction_handler + db 'pmulhrw',0B7h + dw amd3dnow_instruction-instruction_handler + db 'pmulhuw',0E4h + dw basic_mmx_instruction-instruction_handler + db 'pmuludq',0F4h + dw basic_mmx_instruction-instruction_handler + db 'pshufhw',0F3h + dw pshufd_instruction-instruction_handler + db 'pshuflw',0F2h + dw pshufd_instruction-instruction_handler + db 'psubusb',0D8h + dw basic_mmx_instruction-instruction_handler + db 'psubusw',0D9h + dw basic_mmx_instruction-instruction_handler + db 'roundpd',9 + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'roundps',8 + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'roundsd',0Bh + dw sse4_sd_instruction_66_3a_imm8-instruction_handler + db 'roundss',0Ah + dw sse4_ss_instruction_66_3a_imm8-instruction_handler + db 'rsqrtps',52h + dw sse_ps_instruction-instruction_handler + db 'rsqrtss',52h + dw sse_ss_instruction-instruction_handler + db 'section',0 + dw section_directive-instruction_handler + db 'segment',0 + dw segment_directive-instruction_handler + db 'stmxcsr',11b + dw fxsave_instruction-instruction_handler + db 'syscall',05h + dw simple_extended_instruction-instruction_handler + db 'sysexit',35h + dw simple_extended_instruction-instruction_handler + db 'sysretq',07h + dw simple_extended_instruction_64bit-instruction_handler + db 'ucomisd',2Eh + dw comisd_instruction-instruction_handler + db 'ucomiss',2Eh + dw comiss_instruction-instruction_handler + db 'vaesdec',0DEh + dw avx_128bit_instruction_38_noevex-instruction_handler + db 'vaesenc',0DCh + dw avx_128bit_instruction_38_noevex-instruction_handler + db 'vaesimc',0DBh + dw avx_single_source_128bit_instruction_38_noevex-instruction_handler + db 'valignd',3 + dw avx_d_instruction_3a_imm8_evex-instruction_handler + db 'valignq',3 + dw avx_q_instruction_3a_imm8_evex-instruction_handler + db 'vandnpd',55h + dw avx_pd_instruction-instruction_handler + db 'vandnps',55h + dw avx_ps_instruction-instruction_handler + db 'vcomisd',2Fh + dw avx_comisd_instruction-instruction_handler + db 'vcomiss',2Fh + dw avx_comiss_instruction-instruction_handler + db 'vexp2pd',0C8h + dw avx512_exp2pd_instruction-instruction_handler + db 'vexp2ps',0C8h + dw avx512_exp2ps_instruction-instruction_handler + db 'vfrczpd',81h + dw xop_single_source_instruction-instruction_handler + db 'vfrczps',80h + dw xop_single_source_instruction-instruction_handler + db 'vfrczsd',83h + dw xop_single_source_sd_instruction-instruction_handler + db 'vfrczss',82h + dw xop_single_source_ss_instruction-instruction_handler + db 'vhaddpd',07Ch + dw avx_pd_instruction_noevex-instruction_handler + db 'vhaddps',07Ch + dw avx_ps_instruction_noevex-instruction_handler + db 'vhsubpd',07Dh + dw avx_pd_instruction_noevex-instruction_handler + db 'vhsubps',07Dh + dw avx_ps_instruction_noevex-instruction_handler + db 'virtual',0 + dw virtual_directive-instruction_handler + db 'vmclear',6 + dw vmclear_instruction-instruction_handler + db 'vmmcall',0D9h + dw simple_instruction_0f_01-instruction_handler + db 'vmovapd',28h + dw avx_movpd_instruction-instruction_handler + db 'vmovaps',28h + dw avx_movps_instruction-instruction_handler + db 'vmovdqa',6Fh + dw avx_movdqa_instruction-instruction_handler + db 'vmovdqu',6Fh + dw avx_movdqu_instruction-instruction_handler + db 'vmovhpd',16h + dw avx_movlpd_instruction-instruction_handler + db 'vmovhps',16h + dw avx_movlps_instruction-instruction_handler + db 'vmovlpd',12h + dw avx_movlpd_instruction-instruction_handler + db 'vmovlps',12h + dw avx_movlps_instruction-instruction_handler + db 'vmovupd',10h + dw avx_movpd_instruction-instruction_handler + db 'vmovups',10h + dw avx_movps_instruction-instruction_handler + db 'vmptrld',6 + dw vmx_instruction-instruction_handler + db 'vmptrst',7 + dw vmx_instruction-instruction_handler + db 'vmwrite',0 + dw vmwrite_instruction-instruction_handler + db 'vpaddsb',0ECh + dw avx_bw_instruction-instruction_handler + db 'vpaddsw',0EDh + dw avx_bw_instruction-instruction_handler + db 'vpandnd',0DFh + dw avx_d_instruction_evex-instruction_handler + db 'vpandnq',0DFh + dw avx_q_instruction_evex-instruction_handler + db 'vpcmpub',-1 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpud',-1 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpuq',-1 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpuw',-1 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcomub',-1 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomud',-1 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomuq',-1 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomuw',-1 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpermpd',1 + dw avx_permq_instruction-instruction_handler + db 'vpermps',16h + dw avx_permd_instruction-instruction_handler + db 'vpextrb',14h + dw avx_extract_b_instruction-instruction_handler + db 'vpextrd',16h + dw avx_extract_d_instruction-instruction_handler + db 'vpextrq',16h + dw avx_extract_q_instruction-instruction_handler + db 'vpextrw',15h + dw avx_extract_w_instruction-instruction_handler + db 'vphaddd',2 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphaddw',1 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphsubd',6 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphsubw',5 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpinsrb',20h + dw avx_pinsrb_instruction-instruction_handler + db 'vpinsrd',22h + dw avx_pinsrd_instruction-instruction_handler + db 'vpinsrq',22h + dw avx_pinsrq_instruction-instruction_handler + db 'vpinsrw',0C4h + dw avx_pinsrw_instruction-instruction_handler + db 'vpmaxsb',3Ch + dw avx_bw_instruction_38-instruction_handler + db 'vpmaxsd',3Dh + dw avx_d_instruction_38-instruction_handler + db 'vpmaxsq',3Dh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmaxsw',0EEh + dw avx_bw_instruction-instruction_handler + db 'vpmaxub',0DEh + dw avx_bw_instruction-instruction_handler + db 'vpmaxud',3Fh + dw avx_d_instruction_38-instruction_handler + db 'vpmaxuq',3Fh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmaxuw',3Eh + dw avx_bw_instruction_38-instruction_handler + db 'vpminsb',38h + dw avx_bw_instruction_38-instruction_handler + db 'vpminsd',39h + dw avx_d_instruction_38-instruction_handler + db 'vpminsq',39h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpminsw',0EAh + dw avx_bw_instruction-instruction_handler + db 'vpminub',0DAh + dw avx_bw_instruction-instruction_handler + db 'vpminud',3Bh + dw avx_d_instruction_38-instruction_handler + db 'vpminuq',3Bh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpminuw',3Ah + dw avx_bw_instruction_38-instruction_handler + db 'vpmovdb',31h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovdw',33h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovqb',32h + dw avx512_pmovqb_instruction-instruction_handler + db 'vpmovqd',35h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovqw',34h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovwb',30h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmuldq',28h + dw avx_q_instruction_38-instruction_handler + db 'vpmulhw',0E5h + dw avx_bw_instruction-instruction_handler + db 'vpmulld',40h + dw avx_d_instruction_38-instruction_handler + db 'vpmullq',40h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmullw',0D5h + dw avx_bw_instruction-instruction_handler + db 'vprolvd',15h + dw avx_d_instruction_38_evex-instruction_handler + db 'vprolvq',15h + dw avx_q_instruction_38_evex-instruction_handler + db 'vprorvd',14h + dw avx_d_instruction_38_evex-instruction_handler + db 'vprorvq',14h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpsadbw',0F6h + dw avx_bw_instruction-instruction_handler + db 'vpshufb',0 + dw avx_bw_instruction_38-instruction_handler + db 'vpshufd',70h + dw avx_single_source_d_instruction_imm8-instruction_handler + db 'vpsignb',8 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpsignd',0Ah + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpsignw',9 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vpslldq',111b + dw avx_shift_dq_instruction-instruction_handler + db 'vpsllvd',47h + dw avx_d_instruction_38-instruction_handler + db 'vpsllvq',47h + dw avx_q_instruction_38_w1-instruction_handler + db 'vpsllvw',12h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpsravd',46h + dw avx_d_instruction_38-instruction_handler + db 'vpsravq',46h + dw avx_q_instruction_38_w1_evex-instruction_handler + db 'vpsravw',11h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpsrldq',011b + dw avx_shift_dq_instruction-instruction_handler + db 'vpsrlvd',45h + dw avx_d_instruction_38-instruction_handler + db 'vpsrlvq',45h + dw avx_q_instruction_38_w1-instruction_handler + db 'vpsrlvw',10h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpsubsb',0E8h + dw avx_bw_instruction-instruction_handler + db 'vpsubsw',0E9h + dw avx_bw_instruction-instruction_handler + db 'vshufpd',0C6h + dw avx_pd_instruction_imm8-instruction_handler + db 'vshufps',0C6h + dw avx_ps_instruction_imm8-instruction_handler + db 'vsqrtpd',51h + dw avx_single_source_pd_instruction_er-instruction_handler + db 'vsqrtps',51h + dw avx_single_source_ps_instruction_er-instruction_handler + db 'vsqrtsd',51h + dw avx_sd_instruction_er-instruction_handler + db 'vsqrtss',51h + dw avx_ss_instruction_er-instruction_handler + db 'vtestpd',0Fh + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'vtestps',0Eh + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'xsave64',100b + dw fxsave_instruction_64bit-instruction_handler +instructions_8: + db 'addsubpd',0D0h + dw sse_pd_instruction-instruction_handler + db 'addsubps',0D0h + dw cvtpd2dq_instruction-instruction_handler + db 'blendvpd',15h + dw sse4_instruction_66_38_xmm0-instruction_handler + db 'blendvps',14h + dw sse4_instruction_66_38_xmm0-instruction_handler + db 'cmpneqpd',4 + dw cmp_pd_instruction-instruction_handler + db 'cmpneqps',4 + dw cmp_ps_instruction-instruction_handler + db 'cmpneqsd',4 + dw cmp_sd_instruction-instruction_handler + db 'cmpneqss',4 + dw cmp_ss_instruction-instruction_handler + db 'cmpnlepd',6 + dw cmp_pd_instruction-instruction_handler + db 'cmpnleps',6 + dw cmp_ps_instruction-instruction_handler + db 'cmpnlesd',6 + dw cmp_sd_instruction-instruction_handler + db 'cmpnless',6 + dw cmp_ss_instruction-instruction_handler + db 'cmpnltpd',5 + dw cmp_pd_instruction-instruction_handler + db 'cmpnltps',5 + dw cmp_ps_instruction-instruction_handler + db 'cmpnltsd',5 + dw cmp_sd_instruction-instruction_handler + db 'cmpnltss',5 + dw cmp_ss_instruction-instruction_handler + db 'cmpordpd',7 + dw cmp_pd_instruction-instruction_handler + db 'cmpordps',7 + dw cmp_ps_instruction-instruction_handler + db 'cmpordsd',7 + dw cmp_sd_instruction-instruction_handler + db 'cmpordss',7 + dw cmp_ss_instruction-instruction_handler + db 'cvtdq2pd',0E6h + dw cvtdq2pd_instruction-instruction_handler + db 'cvtdq2ps',5Bh + dw sse_ps_instruction-instruction_handler + db 'cvtpd2dq',0E6h + dw cvtpd2dq_instruction-instruction_handler + db 'cvtpd2pi',2Dh + dw cvtpd2pi_instruction-instruction_handler + db 'cvtpd2ps',5Ah + dw sse_pd_instruction-instruction_handler + db 'cvtpi2pd',2Ah + dw cvtpi2pd_instruction-instruction_handler + db 'cvtpi2ps',2Ah + dw cvtpi2ps_instruction-instruction_handler + db 'cvtps2dq',5Bh + dw sse_pd_instruction-instruction_handler + db 'cvtps2pd',5Ah + dw cvtps2pd_instruction-instruction_handler + db 'cvtps2pi',2Dh + dw cvtps2pi_instruction-instruction_handler + db 'cvtsd2si',2Dh + dw cvtsd2si_instruction-instruction_handler + db 'cvtsd2ss',5Ah + dw sse_sd_instruction-instruction_handler + db 'cvtsi2sd',2Ah + dw cvtsi2sd_instruction-instruction_handler + db 'cvtsi2ss',2Ah + dw cvtsi2ss_instruction-instruction_handler + db 'cvtss2sd',5Ah + dw sse_ss_instruction-instruction_handler + db 'cvtss2si',2Dh + dw cvtss2si_instruction-instruction_handler + db 'fcmovnbe',0D0h + dw fcomi_instruction-instruction_handler + db 'fnstenvd',6 + dw fldenv_instruction_32bit-instruction_handler + db 'fnstenvw',6 + dw fldenv_instruction_16bit-instruction_handler + db 'fxsave64',0 + dw fxsave_instruction_64bit-instruction_handler + db 'insertps',21h + dw insertps_instruction-instruction_handler + db 'kortestb',98h + dw mask_instruction_single_source_b-instruction_handler + db 'kortestd',98h + dw mask_instruction_single_source_d-instruction_handler + db 'kortestq',98h + dw mask_instruction_single_source_q-instruction_handler + db 'kortestw',98h + dw mask_instruction_single_source_w-instruction_handler + db 'kshiftlb',32h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftld',33h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftlq',33h + dw mask_shift_instruction_q-instruction_handler + db 'kshiftlw',32h + dw mask_shift_instruction_q-instruction_handler + db 'kshiftrb',30h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftrd',31h + dw mask_shift_instruction_d-instruction_handler + db 'kshiftrq',31h + dw mask_shift_instruction_q-instruction_handler + db 'kshiftrw',30h + dw mask_shift_instruction_q-instruction_handler + db 'kunpckbw',4Bh + dw mask_instruction_b-instruction_handler + db 'kunpckdq',4Bh + dw mask_instruction_q-instruction_handler + db 'kunpckwd',4Bh + dw mask_instruction_w-instruction_handler + db 'maskmovq',0 + dw maskmovq_instruction-instruction_handler + db 'movmskpd',0 + dw movmskpd_instruction-instruction_handler + db 'movmskps',0 + dw movmskps_instruction-instruction_handler + db 'movntdqa',2Ah + dw movntdqa_instruction-instruction_handler + db 'movshdup',16h + dw movshdup_instruction-instruction_handler + db 'movsldup',12h + dw movshdup_instruction-instruction_handler + db 'packssdw',6Bh + dw basic_mmx_instruction-instruction_handler + db 'packsswb',63h + dw basic_mmx_instruction-instruction_handler + db 'packusdw',2Bh + dw sse4_instruction_66_38-instruction_handler + db 'packuswb',67h + dw basic_mmx_instruction-instruction_handler + db 'pblendvb',10h + dw sse4_instruction_66_38_xmm0-instruction_handler + db 'pfrcpit1',0A6h + dw amd3dnow_instruction-instruction_handler + db 'pfrcpit2',0B6h + dw amd3dnow_instruction-instruction_handler + db 'pfrsqit1',0A7h + dw amd3dnow_instruction-instruction_handler + db 'pmovmskb',0D7h + dw pmovmskb_instruction-instruction_handler + db 'pmovsxbd',21h + dw pmovsxbd_instruction-instruction_handler + db 'pmovsxbq',22h + dw pmovsxbq_instruction-instruction_handler + db 'pmovsxbw',20h + dw pmovsxbw_instruction-instruction_handler + db 'pmovsxdq',25h + dw pmovsxdq_instruction-instruction_handler + db 'pmovsxwd',23h + dw pmovsxwd_instruction-instruction_handler + db 'pmovsxwq',24h + dw pmovsxwq_instruction-instruction_handler + db 'pmovzxbd',31h + dw pmovsxbd_instruction-instruction_handler + db 'pmovzxbq',32h + dw pmovsxbq_instruction-instruction_handler + db 'pmovzxbw',30h + dw pmovsxbw_instruction-instruction_handler + db 'pmovzxdq',35h + dw pmovsxdq_instruction-instruction_handler + db 'pmovzxwd',33h + dw pmovsxwd_instruction-instruction_handler + db 'pmovzxwq',34h + dw pmovsxwq_instruction-instruction_handler + db 'pmulhrsw',0Bh + dw ssse3_instruction-instruction_handler + db 'prefetch',0 + dw amd_prefetch_instruction-instruction_handler + db 'rdfsbase',0 + dw rdfsbase_instruction-instruction_handler + db 'rdgsbase',1 + dw rdfsbase_instruction-instruction_handler + db 'sha1msg1',0C9h + dw sse4_instruction_38-instruction_handler + db 'sha1msg2',0CAh + dw sse4_instruction_38-instruction_handler + db 'sysenter',34h + dw simple_extended_instruction-instruction_handler + db 'sysexitq',35h + dw simple_extended_instruction_64bit-instruction_handler + db 'unpckhpd',15h + dw sse_pd_instruction-instruction_handler + db 'unpckhps',15h + dw sse_ps_instruction-instruction_handler + db 'unpcklpd',14h + dw sse_pd_instruction-instruction_handler + db 'unpcklps',14h + dw sse_ps_instruction-instruction_handler + db 'vblendpd',0Dh + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vblendps',0Ch + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vcmpeqpd',0 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeqps',0 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeqsd',0 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeqss',0 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpgepd',0Dh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpgeps',0Dh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpgesd',0Dh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpgess',0Dh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpgtpd',0Eh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpgtps',0Eh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpgtsd',0Eh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpgtss',0Eh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmplepd',2 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpleps',2 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmplesd',2 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpless',2 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpltpd',1 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpltps',1 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpltsd',1 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpltss',1 + dw avx_cmp_ss_instruction-instruction_handler + db 'vfmaddpd',69h + dw fma4_instruction_p-instruction_handler + db 'vfmaddps',68h + dw fma4_instruction_p-instruction_handler + db 'vfmaddsd',6Bh + dw fma4_instruction_sd-instruction_handler + db 'vfmaddss',6Ah + dw fma4_instruction_ss-instruction_handler + db 'vfmsubpd',6Dh + dw fma4_instruction_p-instruction_handler + db 'vfmsubps',6Ch + dw fma4_instruction_p-instruction_handler + db 'vfmsubsd',6Fh + dw fma4_instruction_sd-instruction_handler + db 'vfmsubss',6Eh + dw fma4_instruction_ss-instruction_handler + db 'vldmxcsr',10b + dw vldmxcsr_instruction-instruction_handler + db 'vmlaunch',0C2h + dw simple_instruction_0f_01-instruction_handler + db 'vmovddup',12h + dw avx_movddup_instruction-instruction_handler + db 'vmovdqu8',6Fh + dw avx512_movdqu8_instruction-instruction_handler + db 'vmovhlps',12h + dw avx_movhlps_instruction-instruction_handler + db 'vmovlhps',16h + dw avx_movhlps_instruction-instruction_handler + db 'vmovntdq',0E7h + dw avx_movntdq_instruction-instruction_handler + db 'vmovntpd',2Bh + dw avx_movntpd_instruction-instruction_handler + db 'vmovntps',2Bh + dw avx_movntps_instruction-instruction_handler + db 'vmpsadbw',42h + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vmresume',0C3h + dw simple_instruction_0f_01-instruction_handler + db 'vpaddusb',0DCh + dw avx_bw_instruction-instruction_handler + db 'vpaddusw',0DDh + dw avx_bw_instruction-instruction_handler + db 'vpalignr',0Fh + dw avx_pi_instruction_3a_imm8-instruction_handler + db 'vpblendd',2 + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vpblendw',0Eh + dw avx_pi_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpeqb',74h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpeqd',76h + dw avx_cmpeqd_instruction-instruction_handler + db 'vpcmpeqq',29h + dw avx_cmpeqq_instruction-instruction_handler + db 'vpcmpeqw',75h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpgtb',64h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpgtd',66h + dw avx_cmpeqd_instruction-instruction_handler + db 'vpcmpgtq',37h + dw avx_cmpeqq_instruction-instruction_handler + db 'vpcmpgtw',65h + dw avx_cmpeqb_instruction-instruction_handler + db 'vpcmpleb',2 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpled',2 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpleq',2 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmplew',2 + dw avx512_cmp_w_instruction-instruction_handler + db 'vpcmpltb',1 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpltd',1 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpltq',1 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpltw',1 + dw avx512_cmp_w_instruction-instruction_handler + db 'vpcomeqb',4 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomeqd',4 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomeqq',4 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomeqw',4 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomgeb',3 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomged',3 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomgeq',3 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomgew',3 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomgtb',2 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomgtd',2 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomgtq',2 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomgtw',2 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomleb',1 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomled',1 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomleq',1 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomlew',1 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcomltb',0 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomltd',0 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomltq',0 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomltw',0 + dw xop_pcom_w_instruction-instruction_handler + db 'vpermi2b',75h + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpermi2d',76h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermi2q',76h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermi2w',75h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpermt2b',7Dh + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpermt2d',7Eh + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermt2q',7Eh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermt2w',7Dh + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vphaddbd',0C2h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddbq',0C3h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddbw',0C1h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphadddq',0CBh + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddsw',3 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphaddwd',0C6h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddwq',0C7h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphsubbw',0E1h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphsubdq',0E3h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphsubsw',7 + dw avx_pi_instruction_38_noevex-instruction_handler + db 'vphsubwd',0E2h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vplzcntd',44h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vplzcntq',44h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vpmacsdd',9Eh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacswd',96h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacsww',95h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmaddwd',0F5h + dw avx_bw_instruction-instruction_handler + db 'vpmovb2m',29h + dw avx512_pmov_2m_instruction-instruction_handler + db 'vpmovd2m',39h + dw avx512_pmov_2m_instruction-instruction_handler + db 'vpmovm2b',28h + dw avx512_pmov_m2_instruction-instruction_handler + db 'vpmovm2d',38h + dw avx512_pmov_m2_instruction-instruction_handler + db 'vpmovm2q',38h + dw avx512_pmov_m2_instruction_w1-instruction_handler + db 'vpmovm2w',28h + dw avx512_pmov_m2_instruction_w1-instruction_handler + db 'vpmovq2m',39h + dw avx512_pmov_2m_instruction_w1-instruction_handler + db 'vpmovsdb',21h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovsdw',23h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovsqb',22h + dw avx512_pmovqb_instruction-instruction_handler + db 'vpmovsqd',25h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovsqw',24h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovswb',20h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovw2m',29h + dw avx512_pmov_2m_instruction_w1-instruction_handler + db 'vpmulhuw',0E4h + dw avx_bw_instruction-instruction_handler + db 'vpmuludq',0F4h + dw avx_q_instruction-instruction_handler + db 'vpshufhw',0F3h + dw avx_pshuf_w_instruction-instruction_handler + db 'vpshuflw',0F2h + dw avx_pshuf_w_instruction-instruction_handler + db 'vpsubusb',0D8h + dw avx_bw_instruction-instruction_handler + db 'vpsubusw',0D9h + dw avx_bw_instruction-instruction_handler + db 'vptestmb',26h + dw avx512_ptestmb_instruction-instruction_handler + db 'vptestmd',27h + dw avx512_ptestmd_instruction-instruction_handler + db 'vptestmq',27h + dw avx512_ptestmq_instruction-instruction_handler + db 'vptestmw',26h + dw avx512_ptestmw_instruction-instruction_handler + db 'vrangepd',50h + dw avx512_pd_instruction_sae_imm8-instruction_handler + db 'vrangeps',50h + dw avx512_ps_instruction_sae_imm8-instruction_handler + db 'vrangesd',51h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vrangess',51h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vrcp14pd',4Ch + dw avx512_single_source_pd_instruction-instruction_handler + db 'vrcp14ps',4Ch + dw avx512_single_source_ps_instruction-instruction_handler + db 'vrcp14sd',4Dh + dw avx512_sd_instruction-instruction_handler + db 'vrcp14ss',4Dh + dw avx512_ss_instruction-instruction_handler + db 'vrcp28pd',0CAh + dw avx512_exp2pd_instruction-instruction_handler + db 'vrcp28ps',0CAh + dw avx512_exp2ps_instruction-instruction_handler + db 'vrcp28sd',0CBh + dw avx512_sd_instruction_sae-instruction_handler + db 'vrcp28ss',0CBh + dw avx512_ss_instruction_sae-instruction_handler + db 'vroundpd',9 + dw avx_single_source_instruction_3a_imm8_noevex-instruction_handler + db 'vroundps',8 + dw avx_single_source_instruction_3a_imm8_noevex-instruction_handler + db 'vroundsd',0Bh + dw avx_sd_instruction_3a_imm8_noevex-instruction_handler + db 'vroundss',0Ah + dw avx_ss_instruction_3a_imm8_noevex-instruction_handler + db 'vrsqrtps',52h + dw avx_single_source_ps_instruction_noevex-instruction_handler + db 'vrsqrtss',52h + dw avx_ss_instruction_noevex-instruction_handler + db 'vstmxcsr',11b + dw vldmxcsr_instruction-instruction_handler + db 'vucomisd',2Eh + dw avx_comisd_instruction-instruction_handler + db 'vucomiss',2Eh + dw avx_comiss_instruction-instruction_handler + db 'vzeroall',77h + dw vzeroall_instruction-instruction_handler + db 'wrfsbase',2 + dw rdfsbase_instruction-instruction_handler + db 'wrgsbase',3 + dw rdfsbase_instruction-instruction_handler + db 'xacquire',0F2h + dw prefix_instruction-instruction_handler + db 'xrelease',0F3h + dw prefix_instruction-instruction_handler + db 'xrstor64',101b + dw fxsave_instruction_64bit-instruction_handler + db 'xsaveopt',110b + dw fxsave_instruction-instruction_handler +instructions_9: + db 'cmpxchg8b',8 + dw cmpxchgx_instruction-instruction_handler + db 'cvttpd2dq',0E6h + dw sse_pd_instruction-instruction_handler + db 'cvttpd2pi',2Ch + dw cvtpd2pi_instruction-instruction_handler + db 'cvttps2dq',5Bh + dw movshdup_instruction-instruction_handler + db 'cvttps2pi',2Ch + dw cvtps2pi_instruction-instruction_handler + db 'cvttsd2si',2Ch + dw cvtsd2si_instruction-instruction_handler + db 'cvttss2si',2Ch + dw cvtss2si_instruction-instruction_handler + db 'extractps',17h + dw extractps_instruction-instruction_handler + db 'fxrstor64',1 + dw fxsave_instruction_64bit-instruction_handler + db 'pclmulqdq',-1 + dw pclmulqdq_instruction-instruction_handler + db 'pcmpestri',61h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpestrm',60h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpistri',63h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pcmpistrm',62h + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'pmaddubsw',4 + dw ssse3_instruction-instruction_handler + db 'prefetchw',1 + dw amd_prefetch_instruction-instruction_handler + db 'punpckhbw',68h + dw basic_mmx_instruction-instruction_handler + db 'punpckhdq',6Ah + dw basic_mmx_instruction-instruction_handler + db 'punpckhwd',69h + dw basic_mmx_instruction-instruction_handler + db 'punpcklbw',60h + dw basic_mmx_instruction-instruction_handler + db 'punpckldq',62h + dw basic_mmx_instruction-instruction_handler + db 'punpcklwd',61h + dw basic_mmx_instruction-instruction_handler + db 'sha1nexte',0C8h + dw sse4_instruction_38-instruction_handler + db 'sha1rnds4',0CCh + dw sse4_instruction_3a_imm8-instruction_handler + db 'useavx256',0 + dw set_evex_mode-instruction_handler + db 'useavx512',1 + dw set_evex_mode-instruction_handler + db 'vaddsubpd',0D0h + dw avx_pd_instruction_noevex-instruction_handler + db 'vaddsubps',0D0h + dw avx_ps_instruction_noevex-instruction_handler + db 'vblendmpd',65h + dw avx_pd_instruction_38_evex-instruction_handler + db 'vblendmps',65h + dw avx_ps_instruction_66_38_evex-instruction_handler + db 'vblendvpd',4Bh + dw avx_triple_source_instruction_3a_noevex-instruction_handler + db 'vblendvps',4Ah + dw avx_triple_source_instruction_3a_noevex-instruction_handler + db 'vcmpneqpd',4 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneqps',4 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneqsd',4 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneqss',4 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpngepd',9 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpngeps',9 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpngesd',9 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpngess',9 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpngtpd',0Ah + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpngtps',0Ah + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpngtsd',0Ah + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpngtss',0Ah + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnlepd',6 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnleps',6 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnlesd',6 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnless',6 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnltpd',5 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnltps',5 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnltsd',5 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnltss',5 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpordpd',7 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpordps',7 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpordsd',7 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpordss',7 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcvtdq2pd',0E6h + dw avx_cvtdq2pd_instruction-instruction_handler + db 'vcvtdq2ps',5Bh + dw avx_single_source_ps_instruction_er-instruction_handler + db 'vcvtpd2dq',0E6h + dw avx_cvtpd2dq_instruction-instruction_handler + db 'vcvtpd2ps',5Ah + dw avx_cvtpd2ps_instruction-instruction_handler + db 'vcvtpd2qq',7Bh + dw avx_single_source_pd_instruction_er_evex-instruction_handler + db 'vcvtph2ps',13h + dw avx_cvtph2ps_instruction-instruction_handler + db 'vcvtps2dq',5Bh + dw avx_cvtps2dq_instruction-instruction_handler + db 'vcvtps2pd',5Ah + dw avx_cvtps2pd_instruction-instruction_handler + db 'vcvtps2ph',1Dh + dw avx_cvtps2ph_instruction-instruction_handler + db 'vcvtps2qq',7Bh + dw avx_cvtps2qq_instruction-instruction_handler + db 'vcvtqq2pd',0E6h + dw avx_cvtqq2pd_instruction-instruction_handler + db 'vcvtqq2ps',5Bh + dw avx_cvtpd2udq_instruction-instruction_handler + db 'vcvtsd2si',2Dh + dw avx_cvtsd2si_instruction-instruction_handler + db 'vcvtsd2ss',5Ah + dw avx_sd_instruction_er-instruction_handler + db 'vcvtsi2sd',2Ah + dw avx_cvtsi2sd_instruction-instruction_handler + db 'vcvtsi2ss',2Ah + dw avx_cvtsi2ss_instruction-instruction_handler + db 'vcvtss2sd',5Ah + dw avx_ss_instruction_sae-instruction_handler + db 'vcvtss2si',2Dh + dw avx_cvtss2si_instruction-instruction_handler + db 'vdbpsadbw',42h + dw avx_d_instruction_3a_imm8_evex-instruction_handler + db 'vexpandpd',88h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vexpandps',88h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vfnmaddpd',79h + dw fma4_instruction_p-instruction_handler + db 'vfnmaddps',78h + dw fma4_instruction_p-instruction_handler + db 'vfnmaddsd',7Bh + dw fma4_instruction_sd-instruction_handler + db 'vfnmaddss',7Ah + dw fma4_instruction_ss-instruction_handler + db 'vfnmsubpd',7Dh + dw fma4_instruction_p-instruction_handler + db 'vfnmsubps',7Ch + dw fma4_instruction_p-instruction_handler + db 'vfnmsubsd',7Fh + dw fma4_instruction_sd-instruction_handler + db 'vfnmsubss',7Eh + dw fma4_instruction_ss-instruction_handler + db 'vgetexppd',42h + dw avx512_single_source_pd_instruction_sae-instruction_handler + db 'vgetexpps',42h + dw avx512_single_source_ps_instruction_sae-instruction_handler + db 'vgetexpsd',43h + dw avx512_sd_instruction_sae-instruction_handler + db 'vgetexpss',43h + dw avx512_ss_instruction_sae-instruction_handler + db 'vinsertps',21h + dw avx_insertps_instruction-instruction_handler + db 'vmovdqa32',6Fh + dw avx512_movdqa32_instruction-instruction_handler + db 'vmovdqa64',6Fh + dw avx512_movdqa64_instruction-instruction_handler + db 'vmovdqu16',6Fh + dw avx512_movdqu16_instruction-instruction_handler + db 'vmovdqu32',6Fh + dw avx512_movdqu32_instruction-instruction_handler + db 'vmovdqu64',6Fh + dw avx512_movdqu64_instruction-instruction_handler + db 'vmovmskpd',0 + dw avx_movmskpd_instruction-instruction_handler + db 'vmovmskps',0 + dw avx_movmskps_instruction-instruction_handler + db 'vmovntdqa',2Ah + dw avx_movntdqa_instruction-instruction_handler + db 'vmovshdup',16h + dw avx_movshdup_instruction-instruction_handler + db 'vmovsldup',12h + dw avx_movshdup_instruction-instruction_handler + db 'vpackssdw',6Bh + dw avx_d_instruction-instruction_handler + db 'vpacksswb',63h + dw avx_bw_instruction-instruction_handler + db 'vpackusdw',2Bh + dw avx_d_instruction_38-instruction_handler + db 'vpackuswb',67h + dw avx_bw_instruction-instruction_handler + db 'vpblendmb',66h + dw avx_bw_instruction_38_evex-instruction_handler + db 'vpblendmd',64h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpblendmq',64h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpblendmw',66h + dw avx_bw_instruction_38_w1_evex-instruction_handler + db 'vpblendvb',4Ch + dw avx_triple_source_instruction_3a_noevex-instruction_handler + db 'vpcmpleub',2 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpleud',2 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpleuq',2 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpleuw',2 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpltub',1 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpltud',1 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpltuq',1 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpltuw',1 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpneqb',4 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpneqd',4 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpneqq',4 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpneqw',4 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnleb',6 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnled',6 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpnleq',6 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpnlew',6 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnltb',5 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcmpnltd',5 + dw avx512_cmp_d_instruction-instruction_handler + db 'vpcmpnltq',5 + dw avx512_cmp_q_instruction-instruction_handler + db 'vpcmpnltw',5 + dw avx512_cmp_b_instruction-instruction_handler + db 'vpcomequb',4 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomequd',4 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomequq',4 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomequw',4 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomgeub',3 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomgeud',3 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomgeuq',3 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomgeuw',3 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomgtub',2 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomgtud',2 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomgtuq',2 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomgtuw',2 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomleub',1 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomleud',1 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomleuq',1 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomleuw',1 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomltub',0 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomltud',0 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomltuq',0 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomltuw',0 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomneqb',5 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomneqd',5 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomneqq',5 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomneqw',5 + dw xop_pcom_w_instruction-instruction_handler + db 'vpermi2pd',77h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermi2ps',77h + dw avx_d_instruction_38_evex-instruction_handler + db 'vpermilpd',5 + dw avx_permilpd_instruction-instruction_handler + db 'vpermilps',4 + dw avx_permilps_instruction-instruction_handler + db 'vpermt2pd',7Fh + dw avx_q_instruction_38_evex-instruction_handler + db 'vpermt2ps',7Fh + dw avx_d_instruction_38_evex-instruction_handler + db 'vpexpandd',89h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vpexpandq',89h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vphaddubd',0D2h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddubq',0D3h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddubw',0D1h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphaddudq',0DBh + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphadduwd',0D6h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vphadduwq',0D7h + dw xop_single_source_128bit_instruction-instruction_handler + db 'vpmacsdqh',9Fh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacsdql',97h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacssdd',8Eh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacsswd',86h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacssww',85h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmadcswd',0B6h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmovmskb',0D7h + dw avx_pmovmskb_instruction-instruction_handler + db 'vpmovsxbd',21h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmovsxbq',22h + dw avx_pmovsxbq_instruction-instruction_handler + db 'vpmovsxbw',20h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovsxdq',25h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovsxwd',23h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovsxwq',24h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmovusdb',11h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovusdw',13h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovusqb',12h + dw avx512_pmovqb_instruction-instruction_handler + db 'vpmovusqd',15h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovusqw',14h + dw avx512_pmovdb_instruction-instruction_handler + db 'vpmovuswb',10h + dw avx512_pmovwb_instruction-instruction_handler + db 'vpmovzxbd',31h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmovzxbq',32h + dw avx_pmovsxbq_instruction-instruction_handler + db 'vpmovzxbw',30h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovzxdq',35h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovzxwd',33h + dw avx_pmovsxbw_instruction-instruction_handler + db 'vpmovzxwq',34h + dw avx_pmovsxbd_instruction-instruction_handler + db 'vpmulhrsw',0Bh + dw avx_bw_instruction_38-instruction_handler + db 'vptestnmb',26h + dw avx512_ptestnmb_instruction-instruction_handler + db 'vptestnmd',27h + dw avx512_ptestnmd_instruction-instruction_handler + db 'vptestnmq',27h + dw avx512_ptestnmq_instruction-instruction_handler + db 'vptestnmw',26h + dw avx512_ptestnmw_instruction-instruction_handler + db 'vreducepd',56h + dw avx512_single_source_pd_instruction_sae_imm8-instruction_handler + db 'vreduceps',56h + dw avx512_single_source_ps_instruction_sae_imm8-instruction_handler + db 'vreducesd',57h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vreducess',57h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vscalefpd',2Ch + dw avx512_pd_instruction_er-instruction_handler + db 'vscalefps',2Ch + dw avx512_ps_instruction_er-instruction_handler + db 'vscalefsd',2Dh + dw avx512_sd_instruction_er-instruction_handler + db 'vscalefss',2Dh + dw avx512_ss_instruction_er-instruction_handler + db 'vunpckhpd',15h + dw avx_pd_instruction-instruction_handler + db 'vunpckhps',15h + dw avx_ps_instruction-instruction_handler + db 'vunpcklpd',14h + dw avx_pd_instruction-instruction_handler + db 'vunpcklps',14h + dw avx_ps_instruction-instruction_handler +instructions_10: + db 'aesdeclast',0DFh + dw sse4_instruction_66_38-instruction_handler + db 'aesenclast',0DDh + dw sse4_instruction_66_38-instruction_handler + db 'clflushopt',7 + dw clflushopt_instruction-instruction_handler + db 'cmpunordpd',3 + dw cmp_pd_instruction-instruction_handler + db 'cmpunordps',3 + dw cmp_ps_instruction-instruction_handler + db 'cmpunordsd',3 + dw cmp_sd_instruction-instruction_handler + db 'cmpunordss',3 + dw cmp_ss_instruction-instruction_handler + db 'cmpxchg16b',16 + dw cmpxchgx_instruction-instruction_handler + db 'loadall286',5 + dw simple_extended_instruction-instruction_handler + db 'loadall386',7 + dw simple_extended_instruction-instruction_handler + db 'maskmovdqu',0 + dw maskmovdqu_instruction-instruction_handler + db 'phminposuw',41h + dw sse4_instruction_66_38-instruction_handler + db 'prefetcht0',1 + dw prefetch_instruction-instruction_handler + db 'prefetcht1',2 + dw prefetch_instruction-instruction_handler + db 'prefetcht2',3 + dw prefetch_instruction-instruction_handler + db 'punpckhqdq',6Dh + dw sse_pd_instruction-instruction_handler + db 'punpcklqdq',6Ch + dw sse_pd_instruction-instruction_handler + db 'sha256msg1',0CCh + dw sse4_instruction_38-instruction_handler + db 'sha256msg2',0CDh + dw sse4_instruction_38-instruction_handler + db 'vcmptruepd',0Fh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmptrueps',0Fh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmptruesd',0Fh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmptruess',0Fh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcvtpd2udq',79h + dw avx_cvtpd2udq_instruction-instruction_handler + db 'vcvtpd2uqq',79h + dw avx_single_source_pd_instruction_er_evex-instruction_handler + db 'vcvtps2udq',79h + dw avx_single_source_ps_instruction_er_evex-instruction_handler + db 'vcvtps2uqq',79h + dw avx_cvtps2qq_instruction-instruction_handler + db 'vcvtsd2usi',79h + dw avx_cvtsd2usi_instruction-instruction_handler + db 'vcvtss2usi',79h + dw avx_cvtss2usi_instruction-instruction_handler + db 'vcvttpd2dq',0E6h + dw avx_cvttpd2dq_instruction-instruction_handler + db 'vcvttpd2qq',7Ah + dw avx_single_source_pd_instruction_sae_evex-instruction_handler + db 'vcvttps2dq',5Bh + dw avx_cvttps2dq_instruction-instruction_handler + db 'vcvttps2qq',7Ah + dw avx_cvttps2qq_instruction-instruction_handler + db 'vcvttsd2si',2Ch + dw avx_cvttsd2si_instruction-instruction_handler + db 'vcvttss2si',2Ch + dw avx_cvttss2si_instruction-instruction_handler + db 'vcvtudq2pd',7Ah + dw avx_cvtudq2pd_instruction-instruction_handler + db 'vcvtudq2ps',7Ah + dw avx_cvtudq2ps_instruction-instruction_handler + db 'vcvtuqq2pd',7Ah + dw avx_cvtqq2pd_instruction-instruction_handler + db 'vcvtuqq2ps',7Ah + dw avx_cvtuqq2ps_instruction-instruction_handler + db 'vcvtusi2sd',7Bh + dw avx_cvtusi2sd_instruction-instruction_handler + db 'vcvtusi2ss',7Bh + dw avx_cvtusi2ss_instruction-instruction_handler + db 'vextractps',17h + dw avx_extract_d_instruction-instruction_handler + db 'vfpclasspd',66h + dw avx512_fpclasspd_instruction-instruction_handler + db 'vfpclassps',66h + dw avx512_fpclassps_instruction-instruction_handler + db 'vfpclasssd',67h + dw avx512_fpclasssd_instruction-instruction_handler + db 'vfpclassss',67h + dw avx512_fpclassss_instruction-instruction_handler + db 'vgatherdpd',92h + dw gather_pd_instruction-instruction_handler + db 'vgatherdps',92h + dw gather_ps_instruction-instruction_handler + db 'vgatherqpd',93h + dw gather_pd_instruction-instruction_handler + db 'vgatherqps',93h + dw gather_ps_instruction-instruction_handler + db 'vgetmantpd',26h + dw avx512_single_source_pd_instruction_sae_imm8-instruction_handler + db 'vgetmantps',26h + dw avx512_single_source_ps_instruction_sae_imm8-instruction_handler + db 'vgetmantsd',27h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vgetmantss',27h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vmaskmovpd',2Dh + dw avx_maskmov_instruction-instruction_handler + db 'vmaskmovps',2Ch + dw avx_maskmov_instruction-instruction_handler + db 'vpclmulqdq',-1 + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpcmpestri',61h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpestrm',60h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpistri',63h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpistrm',62h + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler + db 'vpcmpnequb',4 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpnequd',4 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpnequq',4 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpnequw',4 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpnleub',6 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpnleud',6 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpnleuq',6 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpnleuw',6 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcmpnltub',5 + dw avx512_cmp_ub_instruction-instruction_handler + db 'vpcmpnltud',5 + dw avx512_cmp_ud_instruction-instruction_handler + db 'vpcmpnltuq',5 + dw avx512_cmp_uq_instruction-instruction_handler + db 'vpcmpnltuw',5 + dw avx512_cmp_uw_instruction-instruction_handler + db 'vpcomnequb',5 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomnequd',5 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomnequq',5 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomnequw',5 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpcomtrueb',7 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomtrued',7 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomtrueq',7 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomtruew',7 + dw xop_pcom_w_instruction-instruction_handler + db 'vperm2f128',6 + dw avx_perm2f128_instruction-instruction_handler + db 'vperm2i128',46h + dw avx_perm2f128_instruction-instruction_handler + db 'vpermil2pd',49h + dw vpermil2_instruction-instruction_handler + db 'vpermil2ps',48h + dw vpermil2_instruction-instruction_handler + db 'vpgatherdd',90h + dw gather_ps_instruction-instruction_handler + db 'vpgatherdq',90h + dw gather_pd_instruction-instruction_handler + db 'vpgatherqd',91h + dw gather_ps_instruction-instruction_handler + db 'vpgatherqq',91h + dw gather_pd_instruction-instruction_handler + db 'vpmacssdqh',8Fh + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmacssdql',87h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmadcsswd',0A6h + dw xop_triple_source_128bit_instruction-instruction_handler + db 'vpmaddubsw',4 + dw avx_bw_instruction_38-instruction_handler + db 'vpmaskmovd',8Ch + dw avx_maskmov_instruction-instruction_handler + db 'vpmaskmovq',8Ch + dw avx_maskmov_w1_instruction-instruction_handler + db 'vpternlogd',25h + dw avx_d_instruction_3a_imm8_evex-instruction_handler + db 'vpternlogq',25h + dw avx_q_instruction_3a_imm8_evex-instruction_handler + db 'vpunpckhbw',68h + dw avx_bw_instruction-instruction_handler + db 'vpunpckhdq',6Ah + dw avx_d_instruction-instruction_handler + db 'vpunpckhwd',69h + dw avx_bw_instruction-instruction_handler + db 'vpunpcklbw',60h + dw avx_bw_instruction-instruction_handler + db 'vpunpckldq',62h + dw avx_d_instruction-instruction_handler + db 'vpunpcklwd',61h + dw avx_bw_instruction-instruction_handler + db 'vrsqrt14pd',4Eh + dw avx512_single_source_pd_instruction-instruction_handler + db 'vrsqrt14ps',4Eh + dw avx512_single_source_ps_instruction-instruction_handler + db 'vrsqrt14sd',4Fh + dw avx512_sd_instruction-instruction_handler + db 'vrsqrt14ss',4Fh + dw avx512_ss_instruction-instruction_handler + db 'vrsqrt28pd',0CCh + dw avx512_exp2pd_instruction-instruction_handler + db 'vrsqrt28ps',0CCh + dw avx512_exp2ps_instruction-instruction_handler + db 'vrsqrt28sd',0CDh + dw avx512_sd_instruction_sae-instruction_handler + db 'vrsqrt28ss',0CDh + dw avx512_ss_instruction_sae-instruction_handler + db 'vshuff32x4',23h + dw avx512_shuf_d_instruction-instruction_handler + db 'vshuff64x2',23h + dw avx512_shuf_q_instruction-instruction_handler + db 'vshufi32x4',43h + dw avx512_shuf_d_instruction-instruction_handler + db 'vshufi64x2',43h + dw avx512_shuf_q_instruction-instruction_handler + db 'vzeroupper',77h + dw vzeroupper_instruction-instruction_handler + db 'xsaveopt64',110b + dw fxsave_instruction_64bit-instruction_handler +instructions_11: + db 'pclmulhqhdq',10001b + dw pclmulqdq_instruction-instruction_handler + db 'pclmullqhdq',10000b + dw pclmulqdq_instruction-instruction_handler + db 'prefetchnta',0 + dw prefetch_instruction-instruction_handler + db 'prefetchwt1',2 + dw amd_prefetch_instruction-instruction_handler + db 'sha256rnds2',0CBh + dw sse4_instruction_38_xmm0-instruction_handler + db 'vaesdeclast',0DFh + dw avx_128bit_instruction_38_noevex-instruction_handler + db 'vaesenclast',0DDh + dw avx_128bit_instruction_38_noevex-instruction_handler + db 'vcmpeq_ospd',10h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeq_osps',10h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeq_ossd',10h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeq_osss',10h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpeq_uqpd',8 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeq_uqps',8 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeq_uqsd',8 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeq_uqss',8 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpeq_uspd',18h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpeq_usps',18h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpeq_ussd',18h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpeq_usss',18h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpfalsepd',0Bh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpfalseps',0Bh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpfalsesd',0Bh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpfalsess',0Bh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpge_oqpd',1Dh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpge_oqps',1Dh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpge_oqsd',1Dh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpge_oqss',1Dh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpgt_oqpd',1Eh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpgt_oqps',1Eh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpgt_oqsd',1Eh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpgt_oqss',1Eh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmple_oqpd',12h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmple_oqps',12h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmple_oqsd',12h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmple_oqss',12h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmplt_oqpd',11h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmplt_oqps',11h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmplt_oqsd',11h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmplt_oqss',11h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpord_spd',17h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpord_sps',17h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpord_ssd',17h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpord_sss',17h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpunordpd',3 + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpunordps',3 + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpunordsd',3 + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpunordss',3 + dw avx_cmp_ss_instruction-instruction_handler + db 'vcompresspd',8Ah + dw avx_compress_q_instruction-instruction_handler + db 'vcompressps',8Ah + dw avx_compress_d_instruction-instruction_handler + db 'vcvttpd2udq',78h + dw avx_cvttpd2udq_instruction-instruction_handler + db 'vcvttpd2uqq',78h + dw avx_single_source_pd_instruction_sae_evex-instruction_handler + db 'vcvttps2udq',78h + dw avx_cvttps2udq_instruction-instruction_handler + db 'vcvttps2uqq',78h + dw avx_cvttps2qq_instruction-instruction_handler + db 'vcvttsd2usi',78h + dw avx_cvttsd2usi_instruction-instruction_handler + db 'vcvttss2usi',78h + dw avx_cvttss2usi_instruction-instruction_handler + db 'vfixupimmpd',54h + dw avx512_pd_instruction_sae_imm8-instruction_handler + db 'vfixupimmps',54h + dw avx512_ps_instruction_sae_imm8-instruction_handler + db 'vfixupimmsd',55h + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vfixupimmss',55h + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vfmadd132pd',98h + dw fma_instruction_pd-instruction_handler + db 'vfmadd132ps',98h + dw fma_instruction_ps-instruction_handler + db 'vfmadd132sd',99h + dw fma_instruction_sd-instruction_handler + db 'vfmadd132ss',99h + dw fma_instruction_ss-instruction_handler + db 'vfmadd213pd',0A8h + dw fma_instruction_pd-instruction_handler + db 'vfmadd213ps',0A8h + dw fma_instruction_ps-instruction_handler + db 'vfmadd213sd',0A9h + dw fma_instruction_sd-instruction_handler + db 'vfmadd213ss',0A9h + dw fma_instruction_ss-instruction_handler + db 'vfmadd231pd',0B8h + dw fma_instruction_pd-instruction_handler + db 'vfmadd231ps',0B8h + dw fma_instruction_ps-instruction_handler + db 'vfmadd231sd',0B9h + dw fma_instruction_sd-instruction_handler + db 'vfmadd231ss',0B9h + dw fma_instruction_ss-instruction_handler + db 'vfmaddsubpd',5Dh + dw fma4_instruction_p-instruction_handler + db 'vfmaddsubps',5Ch + dw fma4_instruction_p-instruction_handler + db 'vfmsub132pd',9Ah + dw fma_instruction_pd-instruction_handler + db 'vfmsub132ps',9Ah + dw fma_instruction_ps-instruction_handler + db 'vfmsub132sd',9Bh + dw fma_instruction_sd-instruction_handler + db 'vfmsub132ss',9Bh + dw fma_instruction_ss-instruction_handler + db 'vfmsub213pd',0AAh + dw fma_instruction_pd-instruction_handler + db 'vfmsub213ps',0AAh + dw fma_instruction_ps-instruction_handler + db 'vfmsub213sd',0ABh + dw fma_instruction_sd-instruction_handler + db 'vfmsub213ss',0ABh + dw fma_instruction_ss-instruction_handler + db 'vfmsub231pd',0BAh + dw fma_instruction_pd-instruction_handler + db 'vfmsub231ps',0BAh + dw fma_instruction_ps-instruction_handler + db 'vfmsub231sd',0BBh + dw fma_instruction_sd-instruction_handler + db 'vfmsub231ss',0BBh + dw fma_instruction_ss-instruction_handler + db 'vfmsubaddpd',5Fh + dw fma4_instruction_p-instruction_handler + db 'vfmsubaddps',5Eh + dw fma4_instruction_p-instruction_handler + db 'vinsertf128',18h + dw avx_insertf128_instruction-instruction_handler + db 'vinserti128',38h + dw avx_insertf128_instruction-instruction_handler + db 'vmaskmovdqu',0 + dw avx_maskmovdqu_instruction-instruction_handler + db 'vpcomfalseb',6 + dw xop_pcom_b_instruction-instruction_handler + db 'vpcomfalsed',6 + dw xop_pcom_d_instruction-instruction_handler + db 'vpcomfalseq',6 + dw xop_pcom_q_instruction-instruction_handler + db 'vpcomfalsew',6 + dw xop_pcom_w_instruction-instruction_handler + db 'vpcompressd',8Bh + dw avx_compress_d_instruction-instruction_handler + db 'vpcompressq',8Bh + dw avx_compress_q_instruction-instruction_handler + db 'vpcomtrueub',7 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomtrueud',7 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomtrueuq',7 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomtrueuw',7 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpconflictd',0C4h + dw avx_single_source_d_instruction_38_evex-instruction_handler + db 'vpconflictq',0C4h + dw avx_single_source_q_instruction_38_evex-instruction_handler + db 'vphminposuw',41h + dw avx_single_source_instruction_38_noevex-instruction_handler + db 'vpmadd52huq',0B5h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpmadd52luq',0B4h + dw avx_q_instruction_38_evex-instruction_handler + db 'vpscatterdd',0A0h + dw scatter_ps_instruction-instruction_handler + db 'vpscatterdq',0A0h + dw scatter_pd_instruction-instruction_handler + db 'vpscatterqd',0A1h + dw scatter_ps_instruction-instruction_handler + db 'vpscatterqq',0A1h + dw scatter_pd_instruction-instruction_handler + db 'vpunpckhqdq',6Dh + dw avx_q_instruction-instruction_handler + db 'vpunpcklqdq',6Ch + dw avx_q_instruction-instruction_handler + db 'vrndscalepd',9 + dw avx512_single_source_pd_instruction_sae_imm8-instruction_handler + db 'vrndscaleps',8 + dw avx512_single_source_ps_instruction_sae_imm8-instruction_handler + db 'vrndscalesd',0Bh + dw avx512_sd_instruction_sae_imm8-instruction_handler + db 'vrndscaless',0Ah + dw avx512_ss_instruction_sae_imm8-instruction_handler + db 'vscatterdpd',0A2h + dw scatter_pd_instruction-instruction_handler + db 'vscatterdps',0A2h + dw scatter_ps_instruction-instruction_handler + db 'vscatterqpd',0A3h + dw scatter_pd_instruction-instruction_handler + db 'vscatterqps',0A3h + dw scatter_ps_instruction-instruction_handler +instructions_12: + db 'pclmulhqhqdq',10001b + dw pclmulqdq_instruction-instruction_handler + db 'pclmulhqlqdq',1 + dw pclmulqdq_instruction-instruction_handler + db 'pclmullqhqdq',10000b + dw pclmulqdq_instruction-instruction_handler + db 'pclmullqlqdq',0 + dw pclmulqdq_instruction-instruction_handler + db 'vbroadcastsd',19h + dw avx_broadcastsd_instruction-instruction_handler + db 'vbroadcastss',18h + dw avx_broadcastss_instruction-instruction_handler + db 'vcmpneq_oqpd',0Ch + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneq_oqps',0Ch + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneq_oqsd',0Ch + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneq_oqss',0Ch + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpneq_ospd',1Ch + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneq_osps',1Ch + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneq_ossd',1Ch + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneq_osss',1Ch + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpneq_uspd',14h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpneq_usps',14h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpneq_ussd',14h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpneq_usss',14h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnge_uqpd',19h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnge_uqps',19h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnge_uqsd',19h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnge_uqss',19h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpngt_uqpd',1Ah + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpngt_uqps',1Ah + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpngt_uqsd',1Ah + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpngt_uqss',1Ah + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnle_uqpd',16h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnle_uqps',16h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnle_uqsd',16h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnle_uqss',16h + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpnlt_uqpd',15h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpnlt_uqps',15h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpnlt_uqsd',15h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpnlt_uqss',15h + dw avx_cmp_ss_instruction-instruction_handler + db 'vextractf128',19h + dw avx_extractf128_instruction-instruction_handler + db 'vextracti128',39h + dw avx_extractf128_instruction-instruction_handler + db 'vfnmadd132pd',9Ch + dw fma_instruction_pd-instruction_handler + db 'vfnmadd132ps',9Ch + dw fma_instruction_ps-instruction_handler + db 'vfnmadd132sd',9Dh + dw fma_instruction_sd-instruction_handler + db 'vfnmadd132ss',9Dh + dw fma_instruction_ss-instruction_handler + db 'vfnmadd213pd',0ACh + dw fma_instruction_pd-instruction_handler + db 'vfnmadd213ps',0ACh + dw fma_instruction_ps-instruction_handler + db 'vfnmadd213sd',0ADh + dw fma_instruction_sd-instruction_handler + db 'vfnmadd213ss',0ADh + dw fma_instruction_ss-instruction_handler + db 'vfnmadd231pd',0BCh + dw fma_instruction_pd-instruction_handler + db 'vfnmadd231ps',0BCh + dw fma_instruction_ps-instruction_handler + db 'vfnmadd231sd',0BDh + dw fma_instruction_sd-instruction_handler + db 'vfnmadd231ss',0BDh + dw fma_instruction_ss-instruction_handler + db 'vfnmsub132pd',9Eh + dw fma_instruction_pd-instruction_handler + db 'vfnmsub132ps',9Eh + dw fma_instruction_ps-instruction_handler + db 'vfnmsub132sd',9Fh + dw fma_instruction_sd-instruction_handler + db 'vfnmsub132ss',9Fh + dw fma_instruction_ss-instruction_handler + db 'vfnmsub213pd',0AEh + dw fma_instruction_pd-instruction_handler + db 'vfnmsub213ps',0AEh + dw fma_instruction_ps-instruction_handler + db 'vfnmsub213sd',0AFh + dw fma_instruction_sd-instruction_handler + db 'vfnmsub213ss',0AFh + dw fma_instruction_ss-instruction_handler + db 'vfnmsub231pd',0BEh + dw fma_instruction_pd-instruction_handler + db 'vfnmsub231ps',0BEh + dw fma_instruction_ps-instruction_handler + db 'vfnmsub231sd',0BFh + dw fma_instruction_sd-instruction_handler + db 'vfnmsub231ss',0BFh + dw fma_instruction_ss-instruction_handler + db 'vinsertf32x4',18h + dw avx512_insert_32x4_instruction-instruction_handler + db 'vinsertf32x8',1Ah + dw avx512_insert_32x8_instruction-instruction_handler + db 'vinsertf64x2',18h + dw avx512_insert_64x2_instruction-instruction_handler + db 'vinsertf64x4',1Ah + dw avx512_insert_64x4_instruction-instruction_handler + db 'vinserti32x4',38h + dw avx512_insert_32x4_instruction-instruction_handler + db 'vinserti32x8',3Ah + dw avx512_insert_32x8_instruction-instruction_handler + db 'vinserti64x2',38h + dw avx512_insert_64x2_instruction-instruction_handler + db 'vinserti64x4',3Ah + dw avx512_insert_64x4_instruction-instruction_handler + db 'vpbroadcastb',78h + dw avx_pbroadcastb_instruction-instruction_handler + db 'vpbroadcastd',58h + dw avx_pbroadcastd_instruction-instruction_handler + db 'vpbroadcastq',59h + dw avx_pbroadcastq_instruction-instruction_handler + db 'vpbroadcastw',79h + dw avx_pbroadcastw_instruction-instruction_handler + db 'vpclmulhqhdq',10001b + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpclmullqhdq',10000b + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpcomfalseub',6 + dw xop_pcom_ub_instruction-instruction_handler + db 'vpcomfalseud',6 + dw xop_pcom_ud_instruction-instruction_handler + db 'vpcomfalseuq',6 + dw xop_pcom_uq_instruction-instruction_handler + db 'vpcomfalseuw',6 + dw xop_pcom_uw_instruction-instruction_handler + db 'vpermilmo2pd',10b + dw vpermil_2pd_instruction-instruction_handler + db 'vpermilmo2ps',10b + dw vpermil_2ps_instruction-instruction_handler + db 'vpermilmz2pd',11b + dw vpermil_2pd_instruction-instruction_handler + db 'vpermilmz2ps',11b + dw vpermil_2ps_instruction-instruction_handler + db 'vpermiltd2pd',0 + dw vpermil_2pd_instruction-instruction_handler + db 'vpermiltd2ps',0 + dw vpermil_2ps_instruction-instruction_handler +instructions_13: + db 'vcmptrue_uspd',1Fh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmptrue_usps',1Fh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmptrue_ussd',1Fh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmptrue_usss',1Fh + dw avx_cmp_ss_instruction-instruction_handler + db 'vcmpunord_spd',13h + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpunord_sps',13h + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpunord_ssd',13h + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpunord_sss',13h + dw avx_cmp_ss_instruction-instruction_handler + db 'vextractf32x4',19h + dw avx512_extract_32x4_instruction-instruction_handler + db 'vextractf32x8',1Bh + dw avx512_extract_32x8_instruction-instruction_handler + db 'vextractf64x2',19h + dw avx512_extract_64x2_instruction-instruction_handler + db 'vextractf64x4',1Bh + dw avx512_extract_64x4_instruction-instruction_handler + db 'vextracti32x4',39h + dw avx512_extract_32x4_instruction-instruction_handler + db 'vextracti32x8',3Bh + dw avx512_extract_32x8_instruction-instruction_handler + db 'vextracti64x2',39h + dw avx512_extract_64x2_instruction-instruction_handler + db 'vextracti64x4',3Bh + dw avx512_extract_64x4_instruction-instruction_handler + db 'vgatherpf0dpd',1 + dw gatherpf_dpd_instruction-instruction_handler + db 'vgatherpf0dps',1 + dw gatherpf_dps_instruction-instruction_handler + db 'vgatherpf0qpd',1 + dw gatherpf_qpd_instruction-instruction_handler + db 'vgatherpf0qps',1 + dw gatherpf_qps_instruction-instruction_handler + db 'vgatherpf1dpd',2 + dw gatherpf_dpd_instruction-instruction_handler + db 'vgatherpf1dps',2 + dw gatherpf_dps_instruction-instruction_handler + db 'vgatherpf1qpd',2 + dw gatherpf_qpd_instruction-instruction_handler + db 'vgatherpf1qps',2 + dw gatherpf_qps_instruction-instruction_handler + db 'vpclmulhqlqdq',1 + dw avx_pclmulqdq_instruction-instruction_handler + db 'vpclmullqlqdq',0 + dw avx_pclmulqdq_instruction-instruction_handler +instructions_14: + db 'vbroadcastf128',1Ah + dw avx_broadcast_128_instruction_noevex-instruction_handler + db 'vbroadcasti128',5Ah + dw avx_broadcast_128_instruction_noevex-instruction_handler + db 'vcmpfalse_ospd',1Bh + dw avx_cmp_pd_instruction-instruction_handler + db 'vcmpfalse_osps',1Bh + dw avx_cmp_ps_instruction-instruction_handler + db 'vcmpfalse_ossd',1Bh + dw avx_cmp_sd_instruction-instruction_handler + db 'vcmpfalse_osss',1Bh + dw avx_cmp_ss_instruction-instruction_handler + db 'vfmaddsub132pd',96h + dw fma_instruction_pd-instruction_handler + db 'vfmaddsub132ps',96h + dw fma_instruction_ps-instruction_handler + db 'vfmaddsub213pd',0A6h + dw fma_instruction_pd-instruction_handler + db 'vfmaddsub213ps',0A6h + dw fma_instruction_ps-instruction_handler + db 'vfmaddsub231pd',0B6h + dw fma_instruction_pd-instruction_handler + db 'vfmaddsub231ps',0B6h + dw fma_instruction_ps-instruction_handler + db 'vfmsubadd132pd',97h + dw fma_instruction_pd-instruction_handler + db 'vfmsubadd132ps',97h + dw fma_instruction_ps-instruction_handler + db 'vfmsubadd213pd',0A7h + dw fma_instruction_pd-instruction_handler + db 'vfmsubadd213ps',0A7h + dw fma_instruction_ps-instruction_handler + db 'vfmsubadd231pd',0B7h + dw fma_instruction_pd-instruction_handler + db 'vfmsubadd231ps',0B7h + dw fma_instruction_ps-instruction_handler + db 'vpmultishiftqb',83h + dw avx_q_instruction_38_evex-instruction_handler + db 'vscatterpf0dpd',5 + dw gatherpf_dpd_instruction-instruction_handler + db 'vscatterpf0dps',5 + dw gatherpf_dps_instruction-instruction_handler + db 'vscatterpf0qpd',5 + dw gatherpf_qpd_instruction-instruction_handler + db 'vscatterpf0qps',5 + dw gatherpf_qps_instruction-instruction_handler + db 'vscatterpf1dpd',6 + dw gatherpf_dpd_instruction-instruction_handler + db 'vscatterpf1dps',6 + dw gatherpf_dps_instruction-instruction_handler + db 'vscatterpf1qpd',6 + dw gatherpf_qpd_instruction-instruction_handler + db 'vscatterpf1qps',6 + dw gatherpf_qps_instruction-instruction_handler +instructions_15: + db 'aeskeygenassist',0DFh + dw sse4_instruction_66_3a_imm8-instruction_handler + db 'vbroadcastf32x2',19h + dw avx512_broadcast_32x2_instruction-instruction_handler + db 'vbroadcastf32x4',1Ah + dw avx512_broadcast_32x4_instruction-instruction_handler + db 'vbroadcastf32x8',1Bh + dw avx512_broadcast_32x8_instruction-instruction_handler + db 'vbroadcastf64x2',1Ah + dw avx512_broadcast_64x2_instruction-instruction_handler + db 'vbroadcastf64x4',1Bh + dw avx512_broadcast_64x4_instruction-instruction_handler + db 'vbroadcasti32x2',59h + dw avx512_broadcast_32x2_instruction-instruction_handler + db 'vbroadcasti32x4',5Ah + dw avx512_broadcast_32x4_instruction-instruction_handler + db 'vbroadcasti32x8',5Bh + dw avx512_broadcast_32x8_instruction-instruction_handler + db 'vbroadcasti64x2',5Ah + dw avx512_broadcast_64x2_instruction-instruction_handler + db 'vbroadcasti64x4',5Bh + dw avx512_broadcast_64x4_instruction-instruction_handler + db 'vpbroadcastmb2q',2Ah + dw avx512_pmov_m2_instruction_w1-instruction_handler + db 'vpbroadcastmw2d',3Ah + dw avx512_pmov_m2_instruction-instruction_handler +instructions_16: + db 'vaeskeygenassist',0DFh + dw avx_single_source_128bit_instruction_3a_imm8_noevex-instruction_handler +instructions_end: + +data_directives: + dw data_directives_2-data_directives,(data_directives_3-data_directives_2)/(2+3) + dw data_directives_3-data_directives,(data_directives_4-data_directives_3)/(3+3) + dw data_directives_4-data_directives,(data_directives_end-data_directives_4)/(4+3) + +data_directives_2: + db 'db',1 + dw data_bytes-instruction_handler + db 'dd',4 + dw data_dwords-instruction_handler + db 'df',6 + dw data_pwords-instruction_handler + db 'dp',6 + dw data_pwords-instruction_handler + db 'dq',8 + dw data_qwords-instruction_handler + db 'dt',10 + dw data_twords-instruction_handler + db 'du',2 + dw data_unicode-instruction_handler + db 'dw',2 + dw data_words-instruction_handler + db 'rb',1 + dw reserve_bytes-instruction_handler + db 'rd',4 + dw reserve_dwords-instruction_handler + db 'rf',6 + dw reserve_pwords-instruction_handler + db 'rp',6 + dw reserve_pwords-instruction_handler + db 'rq',8 + dw reserve_qwords-instruction_handler + db 'rt',10 + dw reserve_twords-instruction_handler + db 'rw',2 + dw reserve_words-instruction_handler +data_directives_3: +data_directives_4: + db 'file',1 + dw data_file-instruction_handler +data_directives_end: diff --git a/fasmw172/SOURCE/VARIABLE.INC b/fasmw172/SOURCE/VARIABLE.INC new file mode 100644 index 0000000..5760b9e --- /dev/null +++ b/fasmw172/SOURCE/VARIABLE.INC @@ -0,0 +1,155 @@ + +; flat assembler core variables +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +; Variables which have to be set up by interface: + +memory_start dd ? +memory_end dd ? + +additional_memory dd ? +additional_memory_end dd ? + +stack_limit dd ? + +initial_definitions dd ? +input_file dd ? +output_file dd ? +symbols_file dd ? + +passes_limit dw ? + +; Internal core variables: + +current_pass dw ? + +include_paths dd ? +free_additional_memory dd ? +source_start dd ? +code_start dd ? +code_size dd ? +real_code_size dd ? +written_size dd ? +headers_size dd ? + +current_line dd ? +macro_line dd ? +macro_block dd ? +macro_block_line dd ? +macro_block_line_number dd ? +macro_symbols dd ? +struc_name dd ? +struc_label dd ? +instant_macro_start dd ? +parameters_end dd ? +default_argument_value dd ? +locals_counter rb 8 +current_locals_prefix dd ? +anonymous_reverse dd ? +anonymous_forward dd ? +labels_list dd ? +label_hash dd ? +label_leaf dd ? +hash_tree dd ? +addressing_space dd ? +undefined_data_start dd ? +undefined_data_end dd ? +counter dd ? +counter_limit dd ? +error_info dd ? +error_line dd ? +error dd ? +tagged_blocks dd ? +structures_buffer dd ? +number_start dd ? +current_offset dd ? +value dq ? +fp_value rd 8 +adjustment dq ? +symbol_identifier dd ? +address_symbol dd ? +address_high dd ? +uncompressed_displacement dd ? +format_flags dd ? +resolver_flags dd ? +symbols_stream dd ? +number_of_relocations dd ? +number_of_sections dd ? +stub_size dd ? +stub_file dd ? +current_section dd ? +machine dw ? +subsystem dw ? +subsystem_version dd ? +image_base dd ? +image_base_high dd ? +resource_data dd ? +resource_size dd ? +actual_fixups_size dd ? +reserved_fixups dd ? +reserved_fixups_size dd ? +last_fixup_base dd ? +last_fixup_header dd ? +parenthesis_stack dd ? +blocks_stack dd ? +parsed_lines dd ? +logical_value_parentheses dd ? +file_extension dd ? + +operand_size db ? +operand_flags db ? +operand_prefix db ? +rex_prefix db ? +opcode_prefix db ? +vex_required db ? +vex_register db ? +immediate_size db ? +mask_register db ? +broadcast_size db ? +rounding_mode db ? + +base_code db ? +extended_code db ? +supplemental_code db ? +postbyte_register db ? +segment_register db ? +xop_opcode_map db ? + +mmx_size db ? +jump_type db ? +push_size db ? +value_size db ? +address_size db ? +label_size db ? +size_declared db ? +address_size_declared db ? +displacement_compression db ? + +value_undefined db ? +value_constant db ? +value_type db ? +value_sign db ? +fp_sign db ? +fp_format db ? +address_sign db ? +address_register db ? +compare_type db ? +logical_value_wrapping db ? +next_pass_needed db ? +output_format db ? +code_type db ? +adjustment_sign db ? +evex_mode db ? + +macro_status db ? +skip_default_argument_value db ? +prefix_flags db ? +formatter_symbols_allowed db ? +decorator_symbols_allowed db ? +free_address_range db ? + + +characters rb 100h +converted rb 100h +message rb 200h diff --git a/fasmw172/SOURCE/VERSION.INC b/fasmw172/SOURCE/VERSION.INC new file mode 100644 index 0000000..5028e29 --- /dev/null +++ b/fasmw172/SOURCE/VERSION.INC @@ -0,0 +1,39 @@ + +; flat assembler version 1.72 +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. +; +; This programs is free for commercial and non-commercial use as long as +; the following conditions are adhered to. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are +; met: +; +; 1. Redistributions of source code must retain the above copyright notice, +; this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; +; The licence and distribution terms for any publically available +; version or derivative of this code cannot be changed. i.e. this code +; cannot simply be copied and put under another distribution licence +; (including the GNU Public Licence). + +VERSION_STRING equ "1.72" + +VERSION_MAJOR = 1 +VERSION_MINOR = 72 diff --git a/fasmw172/SOURCE/WIN32/FASM.ASM b/fasmw172/SOURCE/WIN32/FASM.ASM new file mode 100644 index 0000000..d232a7a --- /dev/null +++ b/fasmw172/SOURCE/WIN32/FASM.ASM @@ -0,0 +1,436 @@ + +; flat assembler interface for Win32 +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + + format PE console + +section '.text' code readable executable + +start: + + mov [con_handle],STD_OUTPUT_HANDLE + mov esi,_logo + call display_string + + call get_params + jc information + + call init_memory + + mov esi,_memory_prefix + call display_string + mov eax,[memory_end] + sub eax,[memory_start] + add eax,[additional_memory_end] + sub eax,[additional_memory] + shr eax,10 + call display_number + mov esi,_memory_suffix + call display_string + + call [GetTickCount] + mov [start_time],eax + + and [preprocessing_done],0 + call preprocessor + or [preprocessing_done],-1 + call parser + call assembler + call formatter + + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + call [GetTickCount] + sub eax,[start_time] + xor edx,edx + mov ebx,100 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov dl,'.' + call display_character + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + jmp exit_program + +information: + mov esi,_usage + call display_string + mov al,1 + jmp exit_program + +get_params: + mov [input_file],0 + mov [output_file],0 + mov [symbols_file],0 + mov [memory_setting],0 + mov [passes_limit],100 + call [GetCommandLine] + mov [definitions_pointer],predefinitions + mov esi,eax + mov edi,params + find_command_start: + lodsb + cmp al,20h + je find_command_start + cmp al,22h + je skip_quoted_name + skip_name: + lodsb + cmp al,20h + je find_param + or al,al + jz all_params + jmp skip_name + skip_quoted_name: + lodsb + cmp al,22h + je find_param + or al,al + jz all_params + jmp skip_quoted_name + find_param: + lodsb + cmp al,20h + je find_param + cmp al,'-' + je option_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [input_file],0 + jne get_output_file + mov [input_file],edi + jmp process_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + cmp edi,params+1000h + jae bad_params + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + cmp edi,params+1000h + jae bad_params + stosb + jmp string_param + option_param: + lodsb + cmp al,'m' + je memory_option + cmp al,'M' + je memory_option + cmp al,'p' + je passes_option + cmp al,'P' + je passes_option + cmp al,'d' + je definition_option + cmp al,'D' + je definition_option + cmp al,'s' + je symbols_option + cmp al,'S' + je symbols_option + bad_params: + stc + ret + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + invalid_option_value: + stc + ret + memory_option: + lodsb + cmp al,20h + je memory_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + call get_option_value + or edx,edx + jz bad_params + cmp edx,1 shl (32-10) + jae bad_params + mov [memory_setting],edx + jmp find_param + passes_option: + lodsb + cmp al,20h + je passes_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + call get_option_value + or edx,edx + jz bad_params + cmp edx,10000h + ja bad_params + mov [passes_limit],dx + jmp find_param + definition_option: + lodsb + cmp al,20h + je definition_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + push edi + mov edi,[definitions_pointer] + call convert_definition_option + mov [definitions_pointer],edi + pop edi + jc bad_params + jmp find_param + symbols_option: + mov [symbols_file],edi + find_symbols_file_name: + lodsb + cmp al,20h + jne process_param + jmp find_symbols_file_name + param_end: + dec esi + string_param_end: + cmp edi,params+1000h + jae bad_params + xor al,al + stosb + jmp find_param + all_params: + cmp [input_file],0 + je bad_params + mov eax,[definitions_pointer] + mov byte [eax],0 + mov [initial_definitions],predefinitions + clc + ret + convert_definition_option: + mov ecx,edi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + copy_definition_name: + lodsb + cmp al,'=' + je copy_definition_value + cmp al,20h + je bad_definition_option + cmp al,0Dh + je bad_definition_option + or al,al + jz bad_definition_option + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + inc byte [ecx] + jnz copy_definition_name + bad_definition_option: + stc + ret + copy_definition_value: + lodsb + cmp al,20h + je definition_value_end + cmp al,0Dh + je definition_value_end + or al,al + jz definition_value_end + cmp al,'\' + jne definition_value_character + cmp byte [esi],20h + jne definition_value_character + lodsb + definition_value_character: + cmp edi,predefinitions+1000h + jae bad_definition_option + stosb + jmp copy_definition_value + definition_value_end: + dec esi + cmp edi,predefinitions+1000h + jae bad_definition_option + xor al,al + stosb + clc + ret + +include 'system.inc' + +include '..\errors.inc' +include '..\symbdump.inc' +include '..\preproce.inc' +include '..\parser.inc' +include '..\exprpars.inc' +include '..\assemble.inc' +include '..\exprcalc.inc' +include '..\formats.inc' +include '..\x86_64.inc' +include '..\avx.inc' + +include '..\tables.inc' +include '..\messages.inc' + +section '.data' data readable writeable + +include '..\version.inc' + +_copyright db 'Copyright (c) 1999-2017, Tomasz Grysztar',0Dh,0Ah,0 + +_logo db 'flat assembler version ',VERSION_STRING,0 +_usage db 0Dh,0Ah + db 'usage: fasm <source> [output]',0Dh,0Ah + db 'optional settings:',0Dh,0Ah + db ' -m <limit> set the limit in kilobytes for the available memory',0Dh,0Ah + db ' -p <limit> set the maximum allowed number of passes',0Dh,0Ah + db ' -d <name>=<value> define symbolic variable',0Dh,0Ah + db ' -s <file> dump symbolic information for debugging',0Dh,0Ah + db 0 +_memory_prefix db ' (',0 +_memory_suffix db ' kilobytes memory)',0Dh,0Ah,0 +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',0Dh,0Ah,0 + +align 4 + +include '..\variable.inc' + +con_handle dd ? +memory_setting dd ? +start_time dd ? +definitions_pointer dd ? +bytes_count dd ? +displayed_count dd ? +character db ? +last_displayed rb 2 +preprocessing_done db ? + +params rb 1000h +options rb 1000h +predefinitions rb 1000h +buffer rb 4000h + +stack 10000h + +section '.idata' import data readable writeable + + dd 0,0,0,rva kernel_name,rva kernel_table + dd 0,0,0,0,0 + + kernel_table: + ExitProcess dd rva _ExitProcess + CreateFile dd rva _CreateFileA + ReadFile dd rva _ReadFile + WriteFile dd rva _WriteFile + CloseHandle dd rva _CloseHandle + SetFilePointer dd rva _SetFilePointer + GetCommandLine dd rva _GetCommandLineA + GetEnvironmentVariable dd rva _GetEnvironmentVariable + GetStdHandle dd rva _GetStdHandle + VirtualAlloc dd rva _VirtualAlloc + VirtualFree dd rva _VirtualFree + GetTickCount dd rva _GetTickCount + GetSystemTime dd rva _GetSystemTime + GlobalMemoryStatus dd rva _GlobalMemoryStatus + dd 0 + + kernel_name db 'KERNEL32.DLL',0 + + _ExitProcess dw 0 + db 'ExitProcess',0 + _CreateFileA dw 0 + db 'CreateFileA',0 + _ReadFile dw 0 + db 'ReadFile',0 + _WriteFile dw 0 + db 'WriteFile',0 + _CloseHandle dw 0 + db 'CloseHandle',0 + _SetFilePointer dw 0 + db 'SetFilePointer',0 + _GetCommandLineA dw 0 + db 'GetCommandLineA',0 + _GetEnvironmentVariable dw 0 + db 'GetEnvironmentVariableA',0 + _GetStdHandle dw 0 + db 'GetStdHandle',0 + _VirtualAlloc dw 0 + db 'VirtualAlloc',0 + _VirtualFree dw 0 + db 'VirtualFree',0 + _GetTickCount dw 0 + db 'GetTickCount',0 + _GetSystemTime dw 0 + db 'GetSystemTime',0 + _GlobalMemoryStatus dw 0 + db 'GlobalMemoryStatus',0 + +section '.reloc' fixups data readable discardable diff --git a/fasmw172/SOURCE/WIN32/SYSTEM.INC b/fasmw172/SOURCE/WIN32/SYSTEM.INC new file mode 100644 index 0000000..6d519c0 --- /dev/null +++ b/fasmw172/SOURCE/WIN32/SYSTEM.INC @@ -0,0 +1,570 @@ + +; flat assembler interface for Win32 +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +CREATE_NEW = 1 +CREATE_ALWAYS = 2 +OPEN_EXISTING = 3 +OPEN_ALWAYS = 4 +TRUNCATE_EXISTING = 5 + +FILE_SHARE_READ = 1 +FILE_SHARE_WRITE = 2 +FILE_SHARE_DELETE = 4 + +GENERIC_READ = 80000000h +GENERIC_WRITE = 40000000h + +STD_INPUT_HANDLE = 0FFFFFFF6h +STD_OUTPUT_HANDLE = 0FFFFFFF5h +STD_ERROR_HANDLE = 0FFFFFFF4h + +MEM_COMMIT = 1000h +MEM_RESERVE = 2000h +MEM_DECOMMIT = 4000h +MEM_RELEASE = 8000h +MEM_FREE = 10000h +MEM_PRIVATE = 20000h +MEM_MAPPED = 40000h +MEM_RESET = 80000h +MEM_TOP_DOWN = 100000h + +PAGE_NOACCESS = 1 +PAGE_READONLY = 2 +PAGE_READWRITE = 4 +PAGE_WRITECOPY = 8 +PAGE_EXECUTE = 10h +PAGE_EXECUTE_READ = 20h +PAGE_EXECUTE_READWRITE = 40h +PAGE_EXECUTE_WRITECOPY = 80h +PAGE_GUARD = 100h +PAGE_NOCACHE = 200h + +init_memory: + xor eax,eax + mov [memory_start],eax + mov eax,esp + and eax,not 0FFFh + add eax,1000h-10000h + mov [stack_limit],eax + mov eax,[memory_setting] + shl eax,10 + jnz allocate_memory + push buffer + call [GlobalMemoryStatus] + mov eax,dword [buffer+20] + mov edx,dword [buffer+12] + cmp eax,0 + jl large_memory + cmp edx,0 + jl large_memory + shr eax,2 + add eax,edx + jmp allocate_memory + large_memory: + mov eax,80000000h + allocate_memory: + mov edx,eax + shr edx,2 + mov ecx,eax + sub ecx,edx + mov [memory_end],ecx + mov [additional_memory_end],edx + push PAGE_READWRITE + push MEM_COMMIT + push eax + push 0 + call [VirtualAlloc] + or eax,eax + jz not_enough_memory + mov [memory_start],eax + add eax,[memory_end] + mov [memory_end],eax + mov [additional_memory],eax + add [additional_memory_end],eax + ret + not_enough_memory: + mov eax,[additional_memory_end] + shl eax,1 + cmp eax,4000h + jb out_of_memory + jmp allocate_memory + +exit_program: + movzx eax,al + push eax + mov eax,[memory_start] + test eax,eax + jz do_exit + push MEM_RELEASE + push 0 + push eax + call [VirtualFree] + do_exit: + call [ExitProcess] + +get_environment_variable: + mov ecx,[memory_end] + sub ecx,edi + cmp ecx,4000h + jbe buffer_for_variable_ok + mov ecx,4000h + buffer_for_variable_ok: + push ecx + push edi + push esi + call [GetEnvironmentVariable] + add edi,eax + cmp edi,[memory_end] + jae out_of_memory + ret + +open: + push 0 + push 0 + push OPEN_EXISTING + push 0 + push FILE_SHARE_READ + push GENERIC_READ + push edx + call [CreateFile] + cmp eax,-1 + je file_error + mov ebx,eax + clc + ret + file_error: + stc + ret +create: + push 0 + push 0 + push CREATE_ALWAYS + push 0 + push FILE_SHARE_READ + push GENERIC_WRITE + push edx + call [CreateFile] + cmp eax,-1 + je file_error + mov ebx,eax + clc + ret +write: + push 0 + push bytes_count + push ecx + push edx + push ebx + call [WriteFile] + or eax,eax + jz file_error + clc + ret +read: + mov ebp,ecx + push 0 + push bytes_count + push ecx + push edx + push ebx + call [ReadFile] + or eax,eax + jz file_error + cmp ebp,[bytes_count] + jne file_error + clc + ret +close: + push ebx + call [CloseHandle] + ret +lseek: + movzx eax,al + push eax + push 0 + push edx + push ebx + call [SetFilePointer] + cmp eax,-1 + je file_error + clc + ret + +display_string: + push [con_handle] + call [GetStdHandle] + mov ebp,eax + mov edi,esi + or ecx,-1 + xor al,al + repne scasb + neg ecx + sub ecx,2 + push 0 + push bytes_count + push ecx + push esi + push ebp + call [WriteFile] + ret +display_character: + push ebx + mov [character],dl + push [con_handle] + call [GetStdHandle] + mov ebx,eax + push 0 + push bytes_count + push 1 + push character + push ebx + call [WriteFile] + pop ebx + ret +display_number: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + push edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + push ecx + call display_character + pop ecx + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz display_loop + pop ebx + ret + +display_user_messages: + mov [displayed_count],0 + call show_display_buffer + cmp [displayed_count],1 + jb line_break_ok + je make_line_break + mov ax,word [last_displayed] + cmp ax,0A0Dh + je line_break_ok + cmp ax,0D0Ah + je line_break_ok + make_line_break: + mov word [buffer],0A0Dh + push [con_handle] + call [GetStdHandle] + push 0 + push bytes_count + push 2 + push buffer + push eax + call [WriteFile] + line_break_ok: + ret +display_block: + add [displayed_count],ecx + cmp ecx,1 + ja take_last_two_characters + jb block_displayed + mov al,[last_displayed+1] + mov ah,[esi] + mov word [last_displayed],ax + jmp block_ok + take_last_two_characters: + mov ax,[esi+ecx-2] + mov word [last_displayed],ax + block_ok: + push ecx + push [con_handle] + call [GetStdHandle] + pop ecx + push 0 + push bytes_count + push ecx + push esi + push eax + call [WriteFile] + block_displayed: + ret + +fatal_error: + mov [con_handle],STD_ERROR_HANDLE + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,0FFh + jmp exit_program +assembler_error: + mov [con_handle],STD_ERROR_HANDLE + call display_user_messages + mov ebx,[current_line] + test ebx,ebx + jz display_error_message + push dword 0 + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + call display_character + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + jz line_data_displayed + push eax + xor al,al + call lseek + mov ecx,[esp] + mov edx,[additional_memory] + lea eax,[edx+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + call read + call close + pop ecx + mov esi,[additional_memory] + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + display_line_data: + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + line_data_displayed: + mov esi,cr_lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + cmp [preprocessing_done],0 + je display_error_message + mov esi,preprocessed_instruction_prefix + call display_string + mov esi,[current_line] + add esi,16 + mov edi,[additional_memory] + xor dl,dl + convert_instruction: + lodsb + cmp al,1Ah + je copy_symbol + cmp al,22h + je copy_symbol + cmp al,3Bh + je instruction_converted + stosb + or al,al + jz instruction_converted + xor dl,dl + jmp convert_instruction + copy_symbol: + or dl,dl + jz space_ok + mov byte [edi],20h + inc edi + space_ok: + cmp al,22h + je quoted + lodsb + movzx ecx,al + rep movsb + or dl,-1 + jmp convert_instruction + quoted: + mov al,27h + stosb + lodsd + mov ecx,eax + jecxz quoted_copied + copy_quoted: + lodsb + stosb + cmp al,27h + jne quote_ok + stosb + quote_ok: + loop copy_quoted + quoted_copied: + mov al,27h + stosb + or dl,-1 + jmp convert_instruction + instruction_converted: + xor al,al + stosb + mov esi,[additional_memory] + call display_string + mov esi,cr_lf + call display_string + display_error_message: + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,2 + jmp exit_program + +make_timestamp: + push buffer + call [GetSystemTime] + movzx ecx,word [buffer] + mov eax,ecx + sub eax,1970 + mov ebx,365 + mul ebx + mov ebp,eax + mov eax,ecx + sub eax,1969 + shr eax,2 + add ebp,eax + mov eax,ecx + sub eax,1901 + mov ebx,100 + div ebx + sub ebp,eax + mov eax,ecx + xor edx,edx + sub eax,1601 + mov ebx,400 + div ebx + add ebp,eax + movzx ecx,word [buffer+2] + mov eax,ecx + dec eax + mov ebx,30 + mul ebx + add ebp,eax + cmp ecx,8 + jbe months_correction + mov eax,ecx + sub eax,7 + shr eax,1 + add ebp,eax + mov ecx,8 + months_correction: + mov eax,ecx + shr eax,1 + add ebp,eax + cmp ecx,2 + jbe day_correction_ok + sub ebp,2 + movzx ecx,word [buffer] + test ecx,11b + jnz day_correction_ok + xor edx,edx + mov eax,ecx + mov ebx,100 + div ebx + or edx,edx + jnz day_correction + mov eax,ecx + mov ebx,400 + div ebx + or edx,edx + jnz day_correction_ok + day_correction: + inc ebp + day_correction_ok: + movzx eax,word [buffer+6] + dec eax + add eax,ebp + mov ebx,24 + mul ebx + movzx ecx,word [buffer+8] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,word [buffer+10] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,word [buffer+12] + add eax,ecx + adc edx,0 + ret + +error_prefix db 'error: ',0 +error_suffix db '.' +cr_lf db 0Dh,0Ah,0 +line_number_start db ' [',0 +line_data_start db ':',0Dh,0Ah,0 +preprocessed_instruction_prefix db 'processed: ',0 diff --git a/fasmw172/SOURCE/X86_64.INC b/fasmw172/SOURCE/X86_64.INC new file mode 100644 index 0000000..6cf0cda --- /dev/null +++ b/fasmw172/SOURCE/X86_64.INC @@ -0,0 +1,7080 @@ + +; flat assembler core +; Copyright (c) 1999-2017, Tomasz Grysztar. +; All rights reserved. + +simple_instruction_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction: + stos byte [edi] + jmp instruction_assembled +simple_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp simple_instruction +simple_instruction_16bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_16bit: + cmp [code_type],16 + jne size_prefix + stos byte [edi] + jmp instruction_assembled + size_prefix: + mov ah,al + mov al,66h + stos word [edi] + jmp instruction_assembled +simple_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_32bit: + cmp [code_type],16 + je size_prefix + stos byte [edi] + jmp instruction_assembled +iret_instruction: + cmp [code_type],64 + jne simple_instruction +simple_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov ah,al + mov al,48h + stos word [edi] + jmp instruction_assembled +simple_extended_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov byte [edi],48h + inc edi +simple_extended_instruction: + mov ah,al + mov al,0Fh + stos word [edi] + jmp instruction_assembled +prefix_instruction: + stos byte [edi] + or [prefix_flags],1 + jmp continue_line +segment_prefix: + mov ah,al + shr ah,4 + cmp ah,3 + jne illegal_instruction + and al,1111b + mov [segment_register],al + call store_segment_prefix + or [prefix_flags],1 + jmp continue_line +bnd_prefix_instruction: + stos byte [edi] + or [prefix_flags],1 + 10h + jmp continue_line +int_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + test eax,eax + jns int_imm_ok + call recoverable_overflow + int_imm_ok: + mov ah,al + mov al,0CDh + stos word [edi] + jmp instruction_assembled +aa_instruction: + cmp [code_type],64 + je illegal_instruction + push eax + mov bl,10 + cmp byte [esi],'(' + jne aa_store + inc esi + xor al,al + xchg al,[operand_size] + cmp al,1 + ja invalid_operand_size + call get_byte_value + mov bl,al + aa_store: + cmp [operand_size],0 + jne invalid_operand + pop eax + mov ah,bl + stos word [edi] + jmp instruction_assembled + +basic_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg + cmp al,'[' + jne invalid_operand + basic_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je basic_mem_imm + cmp al,10h + jne invalid_operand + basic_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je instruction_ready + call operand_autodetect + inc [base_code] + instruction_ready: + call store_instruction + jmp instruction_assembled + basic_mem_imm: + mov al,[operand_size] + cmp al,1 + jb basic_mem_imm_nosize + je basic_mem_imm_8bit + cmp al,2 + je basic_mem_imm_16bit + cmp al,4 + je basic_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_mem_imm_32bit_ok + basic_mem_imm_nosize: + call recoverable_unknown_size + basic_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + mov [base_code],80h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_16bit_store + cmp [size_declared],0 + jne basic_mem_imm_16bit_store + cmp word [value],80h + jb basic_mem_simm_8bit + cmp word [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_16bit_store: + mov [base_code],81h + call store_instruction_with_imm16 + jmp instruction_assembled + basic_mem_simm_8bit: + mov [base_code],83h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_32bit: + call operand_32bit + call get_dword_value + basic_mem_imm_32bit_ok: + mov dword [value],eax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_32bit_store + cmp [size_declared],0 + jne basic_mem_imm_32bit_store + cmp dword [value],80h + jb basic_mem_simm_8bit + cmp dword [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_32bit_store: + mov [base_code],81h + call store_instruction_with_imm32 + jmp instruction_assembled + get_simm32: + call get_qword_value + mov ecx,edx + cdq + cmp ecx,edx + jne value_out_of_range + cmp [value_type],4 + jne get_simm32_ok + mov [value_type],2 + get_simm32_ok: + ret + basic_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg_reg + cmp al,'(' + je basic_reg_imm + cmp al,'[' + jne invalid_operand + basic_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je basic_reg_mem_8bit + call operand_autodetect + add [base_code],3 + jmp instruction_ready + basic_reg_mem_8bit: + add [base_code],2 + jmp instruction_ready + basic_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je nomem_instruction_ready + call operand_autodetect + inc [base_code] + nomem_instruction_ready: + call store_nomem_instruction + jmp instruction_assembled + basic_reg_imm: + mov al,[operand_size] + cmp al,1 + je basic_reg_imm_8bit + cmp al,2 + je basic_reg_imm_16bit + cmp al,4 + je basic_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_reg_imm_32bit_ok + basic_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + or bl,bl + jz basic_al_imm + mov [base_code],80h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_al_imm: + mov al,[base_code] + add al,4 + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_16bit_store + cmp [size_declared],0 + jne basic_reg_imm_16bit_store + cmp dx,80h + jb basic_reg_simm_8bit + cmp dx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_16bit_store: + or bl,bl + jz basic_ax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_16bit: + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + basic_reg_simm_8bit: + mov [base_code],83h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_ax_imm: + add [base_code],5 + call store_classic_instruction_code + jmp basic_store_imm_16bit + basic_reg_imm_32bit: + call operand_32bit + call get_dword_value + basic_reg_imm_32bit_ok: + mov edx,eax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_32bit_store + cmp [size_declared],0 + jne basic_reg_imm_32bit_store + cmp edx,80h + jb basic_reg_simm_8bit + cmp edx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_32bit_store: + or bl,bl + jz basic_eax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + basic_eax_imm: + add [base_code],5 + call store_classic_instruction_code + jmp basic_store_imm_32bit + recoverable_unknown_size: + cmp [error_line],0 + jne ignore_unknown_size + push [current_line] + pop [error_line] + mov [error],operand_size_not_specified + ignore_unknown_size: + ret +single_operand_instruction: + mov [base_code],0F6h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je single_reg + cmp al,'[' + jne invalid_operand + single_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je single_mem_8bit + jb single_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + single_mem_nosize: + call recoverable_unknown_size + single_mem_8bit: + jmp instruction_ready + single_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je single_reg_8bit + call operand_autodetect + inc [base_code] + single_reg_8bit: + jmp nomem_instruction_ready +mov_instruction: + mov [base_code],88h + lods byte [esi] + call get_size_operator + cmp al,10h + je mov_reg + cmp al,14h + je mov_creg + cmp al,'[' + jne invalid_operand + mov_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je mov_mem_imm + cmp al,10h + jne invalid_operand + mov_mem_reg: + lods byte [esi] + cmp al,30h + jb mov_mem_general_reg + cmp al,40h + jb mov_mem_sreg + mov_mem_general_reg: + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + cmp ah,1 + je mov_mem_reg_8bit + mov al,ah + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_mem_ax + inc [base_code] + jmp instruction_ready + mov_mem_reg_8bit: + or al,bl + or al,bh + jnz instruction_ready + mov_mem_al: + test ch,22h + jnz mov_mem_address16_al + test ch,44h + jnz mov_mem_address32_al + test ch,88h + jnz mov_mem_address64_al + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_al + cmp [code_type],32 + je mov_mem_address32_al + cmp edx,10000h + jb mov_mem_address16_al + mov_mem_address32_al: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A2h + store_mov_address32: + call store_classic_instruction_code + call store_address_32bit_value + jmp instruction_assembled + mov_mem_address16_al: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A2h + store_mov_address16: + cmp [code_type],64 + je invalid_address + call store_classic_instruction_code + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + jmp instruction_assembled + mov_mem_address64_al: + call store_segment_prefix_if_necessary + mov [base_code],0A2h + store_mov_address64: + call store_classic_instruction_code + call store_address_64bit_value + jmp instruction_assembled + mov_mem_ax: + test ch,22h + jnz mov_mem_address16_ax + test ch,44h + jnz mov_mem_address32_ax + test ch,88h + jnz mov_mem_address64_ax + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_ax + cmp [code_type],32 + je mov_mem_address32_ax + cmp edx,10000h + jb mov_mem_address16_ax + mov_mem_address32_ax: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A3h + jmp store_mov_address32 + mov_mem_address16_ax: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A3h + jmp store_mov_address16 + mov_mem_address64_ax: + call store_segment_prefix_if_necessary + mov [base_code],0A3h + jmp store_mov_address64 + mov_mem_sreg: + sub al,31h + mov [postbyte_register],al + pop ecx ebx edx + mov ah,[operand_size] + or ah,ah + jz mov_mem_sreg_store + cmp ah,2 + jne invalid_operand_size + mov_mem_sreg_store: + mov [base_code],8Ch + jmp instruction_ready + mov_mem_imm: + mov al,[operand_size] + cmp al,1 + jb mov_mem_imm_nosize + je mov_mem_imm_8bit + cmp al,2 + je mov_mem_imm_16bit + cmp al,4 + je mov_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp mov_mem_imm_32bit_store + mov_mem_imm_nosize: + call recoverable_unknown_size + mov_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0C6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + mov_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + mov_mem_imm_32bit: + call operand_32bit + call get_dword_value + mov_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + mov_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_sreg + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_reg_mem + cmp al,'(' + je mov_reg_imm + cmp al,14h + je mov_reg_creg + cmp al,10h + jne invalid_operand + mov_reg_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_reg_sreg + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je mov_reg_reg_8bit + call operand_autodetect + inc [base_code] + mov_reg_reg_8bit: + jmp nomem_instruction_ready + mov_reg_sreg: + mov bl,[postbyte_register] + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,3 + jne invalid_operand + dec [postbyte_register] + cmp [operand_size],8 + je mov_reg_sreg64 + cmp [operand_size],4 + je mov_reg_sreg32 + cmp [operand_size],2 + jne invalid_operand_size + call operand_16bit + jmp mov_reg_sreg_store + mov_reg_sreg64: + call operand_64bit + jmp mov_reg_sreg_store + mov_reg_sreg32: + call operand_32bit + mov_reg_sreg_store: + mov [base_code],8Ch + jmp nomem_instruction_ready + mov_reg_creg: + lods byte [esi] + mov bl,al + shr al,4 + cmp al,4 + ja invalid_operand + add al,20h + mov [extended_code],al + and bl,1111b + xchg bl,[postbyte_register] + mov [base_code],0Fh + cmp [code_type],64 + je mov_reg_creg_64bit + cmp [operand_size],4 + jne invalid_operand_size + cmp [postbyte_register],8 + jb mov_reg_creg_store + cmp [extended_code],20h + jne mov_reg_creg_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_reg_creg_store: + jmp nomem_instruction_ready + mov_reg_creg_64bit: + cmp [operand_size],8 + jne invalid_operand_size + jmp nomem_instruction_ready + mov_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je mov_reg_mem_8bit + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_ax_mem + add [base_code],3 + jmp instruction_ready + mov_reg_mem_8bit: + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_al_mem + add [base_code],2 + jmp instruction_ready + mov_al_mem: + test ch,22h + jnz mov_al_mem_address16 + test ch,44h + jnz mov_al_mem_address32 + test ch,88h + jnz mov_al_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_al_mem_address64 + cmp [code_type],32 + je mov_al_mem_address32 + cmp edx,10000h + jb mov_al_mem_address16 + mov_al_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A0h + jmp store_mov_address32 + mov_al_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A0h + jmp store_mov_address16 + mov_al_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A0h + jmp store_mov_address64 + mov_ax_mem: + test ch,22h + jnz mov_ax_mem_address16 + test ch,44h + jnz mov_ax_mem_address32 + test ch,88h + jnz mov_ax_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_ax_mem_address64 + cmp [code_type],32 + je mov_ax_mem_address32 + cmp edx,10000h + jb mov_ax_mem_address16 + mov_ax_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A1h + jmp store_mov_address32 + mov_ax_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A1h + jmp store_mov_address16 + mov_ax_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A1h + jmp store_mov_address64 + mov_reg_imm: + mov al,[operand_size] + cmp al,1 + je mov_reg_imm_8bit + cmp al,2 + je mov_reg_imm_16bit + cmp al,4 + je mov_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_reg_imm_64bit: + call operand_64bit + call get_qword_value + mov ecx,edx + cmp [size_declared],0 + jne mov_reg_imm_64bit_store + cmp [value_type],4 + jae mov_reg_imm_64bit_store + cdq + cmp ecx,edx + je mov_reg_64bit_imm_32bit + mov_reg_imm_64bit_store: + push eax ecx + mov al,0B8h + call store_mov_reg_imm_code + pop edx eax + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + mov_reg_imm_8bit: + call get_byte_value + mov dl,al + mov al,0B0h + call store_mov_reg_imm_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + mov_reg_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + mov al,0B8h + call store_mov_reg_imm_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + mov_reg_imm_32bit: + call operand_32bit + call get_dword_value + mov edx,eax + mov al,0B8h + call store_mov_reg_imm_code + mov_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + store_mov_reg_imm_code: + mov ah,[postbyte_register] + test ah,1000b + jz mov_reg_imm_prefix_ok + or [rex_prefix],41h + mov_reg_imm_prefix_ok: + and ah,111b + add al,ah + mov [base_code],al + call store_classic_instruction_code + ret + mov_reg_64bit_imm_32bit: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0C7h + call store_nomem_instruction + jmp mov_store_imm_32bit + mov_sreg: + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,3 + jne invalid_operand + cmp al,2 + je illegal_instruction + dec [postbyte_register] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_sreg_mem + cmp al,10h + jne invalid_operand + mov_sreg_reg: + lods byte [esi] + call convert_register + or ah,ah + jz mov_sreg_reg_size_ok + cmp ah,2 + jne invalid_operand_size + mov bl,al + mov_sreg_reg_size_ok: + mov [base_code],8Eh + jmp nomem_instruction_ready + mov_sreg_mem: + call get_address + mov al,[operand_size] + or al,al + jz mov_sreg_mem_size_ok + cmp al,2 + jne invalid_operand_size + mov_sreg_mem_size_ok: + mov [base_code],8Eh + jmp instruction_ready + mov_creg: + lods byte [esi] + mov ah,al + shr ah,4 + cmp ah,4 + ja invalid_operand + add ah,22h + mov [extended_code],ah + and al,1111b + mov [postbyte_register],al + mov [base_code],0Fh + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov bl,al + cmp [code_type],64 + je mov_creg_64bit + cmp ah,4 + jne invalid_operand_size + cmp [postbyte_register],8 + jb mov_creg_store + cmp [extended_code],22h + jne mov_creg_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_creg_store: + jmp nomem_instruction_ready + mov_creg_64bit: + cmp ah,8 + je mov_creg_store + jmp invalid_operand_size +test_instruction: + mov [base_code],84h + lods byte [esi] + call get_size_operator + cmp al,10h + je test_reg + cmp al,'[' + jne invalid_operand + test_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je test_mem_imm + cmp al,10h + jne invalid_operand + test_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je test_mem_reg_8bit + call operand_autodetect + inc [base_code] + test_mem_reg_8bit: + jmp instruction_ready + test_mem_imm: + mov al,[operand_size] + cmp al,1 + jb test_mem_imm_nosize + je test_mem_imm_8bit + cmp al,2 + je test_mem_imm_16bit + cmp al,4 + je test_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + test_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_mem_imm_32bit_store + test_mem_imm_nosize: + call recoverable_unknown_size + test_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0F6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + test_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + test_mem_imm_32bit: + call operand_32bit + call get_dword_value + test_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + test_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,'(' + je test_reg_imm + cmp al,10h + jne invalid_operand + test_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je test_reg_reg_8bit + call operand_autodetect + inc [base_code] + test_reg_reg_8bit: + jmp nomem_instruction_ready + test_reg_imm: + mov al,[operand_size] + cmp al,1 + je test_reg_imm_8bit + cmp al,2 + je test_reg_imm_16bit + cmp al,4 + je test_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + test_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_reg_imm_32bit_store + test_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F6h + or bl,bl + jz test_al_imm + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_al_imm: + mov [base_code],0A8h + call store_classic_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_ax_imm + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + test_ax_imm: + mov [base_code],0A9h + call store_classic_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + test_reg_imm_32bit: + call operand_32bit + call get_dword_value + test_reg_imm_32bit_store: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_eax_imm + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + test_eax_imm: + mov [base_code],0A9h + call store_classic_instruction_code + mov eax,edx + stos dword [edi] + jmp instruction_assembled + test_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je test_reg_mem_8bit + call operand_autodetect + inc [base_code] + test_reg_mem_8bit: + jmp instruction_ready +xchg_instruction: + mov [base_code],86h + lods byte [esi] + call get_size_operator + cmp al,10h + je xchg_reg + cmp al,'[' + jne invalid_operand + xchg_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je test_mem_reg + jmp invalid_operand + xchg_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,10h + jne invalid_operand + xchg_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je xchg_reg_reg_8bit + call operand_autodetect + cmp [postbyte_register],0 + je xchg_ax_reg + or bl,bl + jnz xchg_reg_reg_store + mov bl,[postbyte_register] + xchg_ax_reg: + cmp [code_type],64 + jne xchg_ax_reg_ok + cmp ah,4 + jne xchg_ax_reg_ok + or bl,bl + jz xchg_reg_reg_store + xchg_ax_reg_ok: + test bl,1000b + jz xchg_ax_reg_store + or [rex_prefix],41h + and bl,111b + xchg_ax_reg_store: + add bl,90h + mov [base_code],bl + call store_classic_instruction_code + jmp instruction_assembled + xchg_reg_reg_store: + inc [base_code] + xchg_reg_reg_8bit: + jmp nomem_instruction_ready +push_instruction: + mov [push_size],al + push_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je push_reg + cmp al,'(' + je push_imm + cmp al,'[' + jne invalid_operand + push_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je push_mem_16bit + cmp al,4 + je push_mem_32bit + cmp al,8 + je push_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je push_mem_16bit + cmp ah,4 + je push_mem_32bit + cmp ah,8 + je push_mem_64bit + call recoverable_unknown_size + jmp push_mem_store + push_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_mem_store + push_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_mem_store + push_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_mem_store: + mov [base_code],0FFh + mov [postbyte_register],110b + call store_instruction + jmp push_done + push_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz push_sreg + call convert_register + test al,1000b + jz push_reg_ok + or [rex_prefix],41h + and al,111b + push_reg_ok: + add al,50h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je push_reg_16bit + cmp al,4 + je push_reg_32bit + cmp al,8 + jne invalid_operand_size + push_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp push_reg_store + push_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_reg_store + push_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + push_reg_store: + call store_classic_instruction_code + jmp push_done + push_sreg: + mov bl,al + mov dl,[operand_size] + mov dh,[push_size] + cmp dl,2 + je push_sreg16 + cmp dl,4 + je push_sreg32 + cmp dl,8 + je push_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je push_sreg16 + cmp dh,4 + je push_sreg32 + cmp dh,8 + je push_sreg64 + jmp push_sreg_store + push_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_sreg_store + push_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_sreg_store + push_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_sreg_store: + mov al,bl + cmp al,40h + jae invalid_operand + sub al,31h + jc invalid_operand + cmp al,4 + jae push_sreg_386 + shl al,3 + add al,6 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp push_reg_store + push_sreg_386: + sub al,4 + shl al,3 + add al,0A0h + mov [extended_code],al + mov [base_code],0Fh + jmp push_reg_store + push_imm: + mov al,[operand_size] + mov ah,[push_size] + or al,al + je push_imm_size_ok + or ah,ah + je push_imm_size_ok + cmp al,ah + jne invalid_operand_size + push_imm_size_ok: + cmp al,2 + je push_imm_16bit + cmp al,4 + je push_imm_32bit + cmp al,8 + je push_imm_64bit + cmp ah,2 + je push_imm_optimized_16bit + cmp ah,4 + je push_imm_optimized_32bit + cmp ah,8 + je push_imm_optimized_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je push_imm_optimized_16bit + cmp [code_type],32 + je push_imm_optimized_32bit + push_imm_optimized_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_16bit: + call get_word_value + mov dx,ax + call operand_16bit + cmp [value_type],0 + jne push_imm_16bit_store + cmp ax,-80h + jl push_imm_16bit_store + cmp ax,80h + jge push_imm_16bit_store + push_imm_8bit: + mov ah,al + mov [base_code],6Ah + call store_classic_instruction_code + mov al,ah + stos byte [edi] + jmp push_done + push_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + push_imm_16bit_store: + mov [base_code],68h + call store_classic_instruction_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp push_done + push_imm_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + jmp push_imm_32bit_store + push_imm_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + push_imm_32bit_store: + mov [base_code],68h + call store_classic_instruction_code + mov eax,edx + call mark_relocation + stos dword [edi] + push_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled +; mov [operand_size],0 +; mov [operand_flags],0 +; mov [operand_prefix],0 +; mov [rex_prefix],0 + and dword [operand_size],0 + jmp push_next +pop_instruction: + mov [push_size],al + pop_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je pop_reg + cmp al,'[' + jne invalid_operand + pop_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je pop_mem_16bit + cmp al,4 + je pop_mem_32bit + cmp al,8 + je pop_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je pop_mem_16bit + cmp ah,4 + je pop_mem_32bit + cmp ah,8 + je pop_mem_64bit + call recoverable_unknown_size + jmp pop_mem_store + pop_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_mem_store + pop_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_mem_store + pop_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_mem_store: + mov [base_code],08Fh + mov [postbyte_register],0 + call store_instruction + jmp pop_done + pop_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz pop_sreg + call convert_register + test al,1000b + jz pop_reg_ok + or [rex_prefix],41h + and al,111b + pop_reg_ok: + add al,58h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je pop_reg_16bit + cmp al,4 + je pop_reg_32bit + cmp al,8 + je pop_reg_64bit + jmp invalid_operand_size + pop_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp pop_reg_store + pop_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_reg_store + pop_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + pop_reg_store: + call store_classic_instruction_code + pop_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled +; mov [operand_size],0 +; mov [operand_flags],0 +; mov [operand_prefix],0 +; mov [rex_prefix],0 + and dword [operand_size],0 + jmp pop_next + pop_sreg: + mov dl,[operand_size] + mov dh,[push_size] + cmp al,32h + je pop_cs + mov bl,al + cmp dl,2 + je pop_sreg16 + cmp dl,4 + je pop_sreg32 + cmp dl,8 + je pop_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_sreg16 + cmp dh,4 + je pop_sreg32 + cmp dh,8 + je pop_sreg64 + jmp pop_sreg_store + pop_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_sreg_store + pop_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_sreg_store + pop_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_sreg_store: + mov al,bl + cmp al,40h + jae invalid_operand + sub al,31h + jc invalid_operand + cmp al,4 + jae pop_sreg_386 + shl al,3 + add al,7 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp pop_reg_store + pop_cs: + cmp [code_type],16 + jne illegal_instruction + cmp dl,2 + je pop_cs_store + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_cs_store + or dh,dh + jnz illegal_instruction + pop_cs_store: + test dh,not 2 + jnz invalid_operand_size + mov al,0Fh + stos byte [edi] + jmp pop_done + pop_sreg_386: + sub al,4 + shl al,3 + add al,0A1h + mov [extended_code],al + mov [base_code],0Fh + jmp pop_reg_store +inc_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je inc_reg + cmp al,'[' + je inc_mem + jne invalid_operand + inc_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je inc_mem_8bit + jb inc_mem_nosize + call operand_autodetect + mov al,0FFh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_mem_nosize: + call recoverable_unknown_size + inc_mem_8bit: + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je inc_reg_8bit + call operand_autodetect + cmp [code_type],64 + je inc_reg_long_form + mov al,[postbyte_register] + shl al,3 + add al,bl + add al,40h + mov [base_code],al + call store_classic_instruction_code + jmp instruction_assembled + inc_reg_long_form: + inc [base_code] + inc_reg_8bit: + jmp nomem_instruction_ready +set_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je set_reg + cmp al,'[' + jne invalid_operand + set_mem: + call get_address + cmp [operand_size],1 + ja invalid_operand_size + mov [postbyte_register],0 + jmp instruction_ready + set_reg: + lods byte [esi] + call convert_register + cmp ah,1 + jne invalid_operand_size + mov bl,al + mov [postbyte_register],0 + jmp nomem_instruction_ready +arpl_instruction: + cmp [code_type],64 + je illegal_instruction + mov [base_code],63h + lods byte [esi] + call get_size_operator + cmp al,10h + je arpl_reg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + cmp ah,2 + jne invalid_operand_size + jmp instruction_ready + arpl_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + jmp nomem_instruction_ready +bound_instruction: + cmp [code_type],64 + je illegal_instruction + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je bound_store + cmp al,4 + jne invalid_operand_size + bound_store: + call operand_autodetect + mov [base_code],62h + jmp instruction_ready +enter_instruction: + lods byte [esi] + call get_size_operator + cmp ah,2 + je enter_imm16_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm16_size_ok: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne enter_imm16_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + enter_imm16_ok: + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp ah,1 + je enter_imm8_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm8_size_ok: + cmp al,'(' + jne invalid_operand + call get_byte_value + cmp [next_pass_needed],0 + jne enter_imm8_ok + test eax,eax + js value_out_of_range + enter_imm8_ok: + mov dl,al + pop ebx + mov al,0C8h + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +ret_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp ret_instruction +ret_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +ret_instruction_32bit: + call operand_32bit + jmp ret_instruction +ret_instruction_16bit: + call operand_16bit + jmp ret_instruction +ret_instruction_64bit: + call operand_64bit +ret_instruction: + and [prefix_flags],not 10h + ret_common: + mov [base_code],al + lods byte [esi] + dec esi + or al,al + jz simple_ret + cmp al,0Fh + je simple_ret + lods byte [esi] + call get_size_operator + or ah,ah + jz ret_imm + cmp ah,2 + je ret_imm + jmp invalid_operand_size + ret_imm: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne ret_imm_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + ret_imm_ok: + cmp [size_declared],0 + jne ret_imm_store + or ax,ax + jz simple_ret + ret_imm_store: + mov dx,ax + call store_classic_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + simple_ret: + inc [base_code] + call store_classic_instruction_code + jmp instruction_assembled +retf_instruction: + cmp [code_type],64 + jne ret_common +retf_instruction_64bit: + call operand_64bit + jmp ret_common +retf_instruction_32bit: + call operand_32bit + jmp ret_common +retf_instruction_16bit: + call operand_16bit + jmp ret_common +lea_instruction: + mov [base_code],8Dh + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + or [operand_flags],1 + call get_address + pop eax + mov [operand_size],al + call operand_autodetect + jmp instruction_ready +ls_instruction: + or al,al + jz les_instruction + cmp al,3 + jz lds_instruction + add al,0B0h + mov [extended_code],al + mov [base_code],0Fh + jmp ls_code_ok + les_instruction: + mov [base_code],0C4h + jmp ls_short_code + lds_instruction: + mov [base_code],0C5h + ls_short_code: + cmp [code_type],64 + je illegal_instruction + ls_code_ok: + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + add [operand_size],2 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je ls_16bit + cmp al,6 + je ls_32bit + cmp al,10 + je ls_64bit + jmp invalid_operand_size + ls_16bit: + call operand_16bit + jmp instruction_ready + ls_32bit: + call operand_32bit + jmp instruction_ready + ls_64bit: + call operand_64bit + jmp instruction_ready +sh_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je sh_reg + cmp al,'[' + jne invalid_operand + sh_mem: + call get_address + push edx ebx ecx + mov al,[operand_size] + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_mem_imm + cmp al,10h + jne invalid_operand + sh_mem_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + cmp al,1 + je sh_mem_cl_8bit + jb sh_mem_cl_nosize + call operand_autodetect + mov [base_code],0D3h + jmp instruction_ready + sh_mem_cl_nosize: + call recoverable_unknown_size + sh_mem_cl_8bit: + mov [base_code],0D2h + jmp instruction_ready + sh_mem_imm: + mov al,[operand_size] + or al,al + jz sh_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + cmp al,1 + je sh_mem_imm_8bit + jb sh_mem_imm_nosize + call operand_autodetect + cmp byte [value],1 + je sh_mem_1 + mov [base_code],0C1h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1: + mov [base_code],0D1h + jmp instruction_ready + sh_mem_imm_nosize: + call recoverable_unknown_size + sh_mem_imm_8bit: + cmp byte [value],1 + je sh_mem_1_8bit + mov [base_code],0C0h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1_8bit: + mov [base_code],0D0h + jmp instruction_ready + sh_reg: + lods byte [esi] + call convert_register + mov bx,ax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_reg_imm + cmp al,10h + jne invalid_operand + sh_reg_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + mov al,bh + cmp al,1 + je sh_reg_cl_8bit + call operand_autodetect + mov [base_code],0D3h + jmp nomem_instruction_ready + sh_reg_cl_8bit: + mov [base_code],0D2h + jmp nomem_instruction_ready + sh_reg_imm: + mov al,[operand_size] + or al,al + jz sh_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_reg_imm_size_ok: + push ebx + call get_byte_value + mov dl,al + pop ebx + mov al,bh + cmp al,1 + je sh_reg_imm_8bit + call operand_autodetect + cmp dl,1 + je sh_reg_1 + mov [base_code],0C1h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1: + mov [base_code],0D1h + jmp nomem_instruction_ready + sh_reg_imm_8bit: + cmp dl,1 + je sh_reg_1_8bit + mov [base_code],0C0h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1_8bit: + mov [base_code],0D0h + jmp nomem_instruction_ready +shd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je shd_reg + cmp al,'[' + jne invalid_operand + shd_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + mov [operand_size],0 + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_mem_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + call operand_autodetect + inc [extended_code] + jmp instruction_ready + shd_mem_reg_imm: + mov al,[operand_size] + or al,al + jz shd_mem_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_mem_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + call operand_autodetect + call store_instruction_with_imm8 + jmp instruction_assembled + shd_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_reg_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop ebx eax + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready + shd_reg_reg_imm: + mov al,[operand_size] + or al,al + jz shd_reg_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_reg_reg_imm_size_ok: + call get_byte_value + mov dl,al + pop ebx eax + call operand_autodetect + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +movx_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_register + mov [postbyte_register],al + mov al,ah + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movx_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov ah,[operand_size] + or ah,ah + jz movx_unknown_size + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_mem_store + cmp ah,2 + jne invalid_operand_size + inc [extended_code] + movx_mem_store: + call operand_autodetect + jmp instruction_ready + movx_unknown_size: + call recoverable_unknown_size + jmp movx_mem_store + movx_reg: + lods byte [esi] + call convert_register + pop ebx + xchg bl,al + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_reg_8bit + cmp ah,2 + je movx_reg_16bit + jmp invalid_operand_size + movx_reg_8bit: + call operand_autodetect + jmp nomem_instruction_ready + movx_reg_16bit: + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready +movsxd_instruction: + mov [base_code],al + call take_register + mov [postbyte_register],al + cmp ah,8 + jne invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movsxd_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je movsxd_mem_store + cmp [operand_size],0 + jne invalid_operand_size + movsxd_mem_store: + call operand_64bit + jmp instruction_ready + movsxd_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + call operand_64bit + jmp nomem_instruction_ready +bt_instruction: + mov [postbyte_register],al + shl al,3 + add al,83h + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je bt_reg + cmp al,'[' + jne invalid_operand + call get_address + push eax ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_mem_imm + cmp byte [esi],11h + jne bt_mem_reg + cmp byte [esi+2],'(' + je bt_mem_imm + bt_mem_reg: + call take_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + call operand_autodetect + jmp instruction_ready + bt_mem_imm: + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax + or al,al + jz bt_mem_imm_nosize + call operand_autodetect + bt_mem_imm_store: + pop ecx ebx edx + mov [extended_code],0BAh + call store_instruction_with_imm8 + jmp instruction_assembled + bt_mem_imm_nosize: + call recoverable_unknown_size + jmp bt_mem_imm_store + bt_reg: + lods byte [esi] + call convert_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_reg_imm + cmp byte [esi],11h + jne bt_reg_reg + cmp byte [esi+2],'(' + je bt_reg_imm + bt_reg_reg: + call take_register + mov [postbyte_register],al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + bt_reg_imm: + xor al,al + xchg al,[operand_size] + push eax ebx + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop ebx eax + call operand_autodetect + bt_reg_imm_store: + mov [extended_code],0BAh + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +bs_instruction: + mov [extended_code],al + mov [base_code],0Fh + call get_reg_mem + jc bs_reg_reg + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + bs_reg_reg: + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + get_reg_mem: + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je get_reg_reg + cmp al,'[' + jne invalid_argument + call get_address + clc + ret + get_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + stc + ret + +imul_instruction: + mov [base_code],0F6h + mov [postbyte_register],5 + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg + cmp al,'[' + jne invalid_operand + imul_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je imul_mem_8bit + jb imul_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + imul_mem_nosize: + call recoverable_unknown_size + imul_mem_8bit: + jmp instruction_ready + imul_reg: + lods byte [esi] + call convert_register + cmp byte [esi],',' + je imul_reg_ + mov bl,al + mov al,ah + cmp al,1 + je imul_reg_8bit + call operand_autodetect + inc [base_code] + imul_reg_8bit: + jmp nomem_instruction_ready + imul_reg_: + mov [postbyte_register],al + inc esi + cmp byte [esi],'(' + je imul_reg_imm + cmp byte [esi],11h + jne imul_reg_noimm + cmp byte [esi+2],'(' + je imul_reg_imm + imul_reg_noimm: + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg_reg + cmp al,'[' + jne invalid_operand + imul_reg_mem: + call get_address + push edx ebx ecx + cmp byte [esi],',' + je imul_reg_mem_imm + mov al,[operand_size] + call operand_autodetect + pop ecx ebx edx + mov [base_code],0Fh + mov [extended_code],0AFh + jmp instruction_ready + imul_reg_mem_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_mem_imm_16bit + cmp al,4 + je imul_reg_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_mem_imm_32bit_ok + imul_reg_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + cmp [value_type],0 + jne imul_reg_mem_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_16bit_store + cmp ax,-80h + jl imul_reg_mem_imm_16bit_store + cmp ax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_16bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm16 + jmp instruction_assembled + imul_reg_mem_imm_32bit: + call operand_32bit + call get_dword_value + imul_reg_mem_imm_32bit_ok: + mov dword [value],eax + cmp [value_type],0 + jne imul_reg_mem_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_32bit_store + cmp eax,-80h + jl imul_reg_mem_imm_32bit_store + cmp eax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_32bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm32 + jmp instruction_assembled + imul_reg_mem_imm_8bit_store: + pop ecx ebx edx + mov [base_code],6Bh + call store_instruction_with_imm8 + jmp instruction_assembled + imul_reg_imm: + mov bl,[postbyte_register] + dec esi + jmp imul_reg_reg_imm + imul_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp byte [esi],',' + je imul_reg_reg_imm + mov al,ah + call operand_autodetect + mov [base_code],0Fh + mov [extended_code],0AFh + jmp nomem_instruction_ready + imul_reg_reg_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_reg_imm_16bit + cmp al,4 + je imul_reg_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + push ebx + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_reg_imm_32bit_ok + imul_reg_reg_imm_16bit: + call operand_16bit + push ebx + call get_word_value + pop ebx + mov dx,ax + cmp [value_type],0 + jne imul_reg_reg_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_16bit_store + cmp ax,-80h + jl imul_reg_reg_imm_16bit_store + cmp ax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_16bit_store: + mov [base_code],69h + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + imul_reg_reg_imm_32bit: + call operand_32bit + push ebx + call get_dword_value + imul_reg_reg_imm_32bit_ok: + pop ebx + mov edx,eax + cmp [value_type],0 + jne imul_reg_reg_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_32bit_store + cmp eax,-80h + jl imul_reg_reg_imm_32bit_store + cmp eax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_32bit_store: + mov [base_code],69h + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + imul_reg_reg_imm_8bit_store: + mov [base_code],6Bh + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +in_instruction: + call take_register + or al,al + jnz invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + push eax + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je in_imm + cmp al,10h + je in_reg + jmp invalid_operand + in_reg: + lods byte [esi] + cmp al,22h + jne invalid_operand + pop eax + cmp al,1 + je in_al_dx + cmp al,2 + je in_ax_dx + cmp al,4 + jne invalid_operand_size + in_ax_dx: + call operand_autodetect + mov [base_code],0EDh + call store_classic_instruction_code + jmp instruction_assembled + in_al_dx: + mov al,0ECh + stos byte [edi] + jmp instruction_assembled + in_imm: + mov al,[operand_size] + or al,al + jz in_imm_size_ok + cmp al,1 + jne invalid_operand_size + in_imm_size_ok: + call get_byte_value + mov dl,al + pop eax + cmp al,1 + je in_al_imm + cmp al,2 + je in_ax_imm + cmp al,4 + jne invalid_operand_size + in_ax_imm: + call operand_autodetect + mov [base_code],0E5h + call store_classic_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + in_al_imm: + mov al,0E4h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +out_instruction: + lods byte [esi] + call get_size_operator + cmp al,'(' + je out_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + call take_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_dx_al + cmp al,2 + je out_dx_ax + cmp al,4 + jne invalid_operand_size + out_dx_ax: + call operand_autodetect + mov [base_code],0EFh + call store_classic_instruction_code + jmp instruction_assembled + out_dx_al: + mov al,0EEh + stos byte [edi] + jmp instruction_assembled + out_imm: + mov al,[operand_size] + or al,al + jz out_imm_size_ok + cmp al,1 + jne invalid_operand_size + out_imm_size_ok: + call get_byte_value + mov dl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + call take_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_imm_al + cmp al,2 + je out_imm_ax + cmp al,4 + jne invalid_operand_size + out_imm_ax: + call operand_autodetect + mov [base_code],0E7h + call store_classic_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + out_imm_al: + mov al,0E6h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + +call_instruction: + mov [postbyte_register],10b + mov [base_code],0E8h + mov [extended_code],9Ah + jmp process_jmp +jmp_instruction: + mov [postbyte_register],100b + mov [base_code],0E9h + mov [extended_code],0EAh + process_jmp: + lods byte [esi] + call get_jump_operator + test [prefix_flags],10h + jz jmp_type_ok + test [jump_type],not 2 + jnz illegal_instruction + mov [jump_type],2 + and [prefix_flags],not 10h + jmp_type_ok: + call get_size_operator + cmp al,'(' + je jmp_imm + mov [base_code],0FFh + cmp al,10h + je jmp_reg + cmp al,'[' + jne invalid_operand + jmp_mem: + cmp [jump_type],1 + je illegal_instruction + call get_address + mov edx,eax + mov al,[operand_size] + or al,al + jz jmp_mem_size_not_specified + cmp al,2 + je jmp_mem_16bit + cmp al,4 + je jmp_mem_32bit + cmp al,6 + je jmp_mem_48bit + cmp al,8 + je jmp_mem_64bit + cmp al,10 + je jmp_mem_80bit + jmp invalid_operand_size + jmp_mem_size_not_specified: + cmp [jump_type],3 + je jmp_mem_far + cmp [jump_type],2 + je jmp_mem_near + call recoverable_unknown_size + jmp_mem_near: + cmp [code_type],16 + je jmp_mem_16bit + cmp [code_type],32 + je jmp_mem_near_32bit + jmp_mem_64bit: + cmp [jump_type],3 + je invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp instruction_ready + jmp_mem_far: + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_48bit: + call operand_32bit + jmp_mem_far_store: + cmp [jump_type],2 + je invalid_operand_size + inc [postbyte_register] + jmp instruction_ready + jmp_mem_80bit: + call operand_64bit + jmp jmp_mem_far_store + jmp_mem_far_32bit: + call operand_16bit + jmp jmp_mem_far_store + jmp_mem_32bit: + cmp [jump_type],3 + je jmp_mem_far_32bit + cmp [jump_type],2 + je jmp_mem_near_32bit + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_near_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp instruction_ready + jmp_mem_16bit: + cmp [jump_type],3 + je invalid_operand_size + call operand_16bit + jmp instruction_ready + jmp_reg: + test [jump_type],1 + jnz invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,2 + je jmp_reg_16bit + cmp al,4 + je jmp_reg_32bit + cmp al,8 + jne invalid_operand_size + jmp_reg_64bit: + cmp [code_type],64 + jne illegal_instruction + jmp nomem_instruction_ready + jmp_reg_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp nomem_instruction_ready + jmp_reg_16bit: + call operand_16bit + jmp nomem_instruction_ready + jmp_imm: + cmp byte [esi],'.' + je invalid_value + mov ebx,esi + dec esi + call skip_symbol + xchg esi,ebx + cmp byte [ebx],':' + je jmp_far + cmp [jump_type],3 + je invalid_operand + jmp_near: + mov al,[operand_size] + cmp al,2 + je jmp_imm_16bit + cmp al,4 + je jmp_imm_32bit + cmp al,8 + je jmp_imm_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je jmp_imm_16bit + cmp [code_type],64 + je jmp_imm_64bit + jmp_imm_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne jmp_imm_32bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc jmp_short + jmp_imm_32bit_store: + mov edx,eax + sub edx,3 + jno jmp_imm_32bit_ok + cmp [code_type],64 + je jump_out_of_range + jmp_imm_32bit_ok: + mov al,[base_code] + stos byte [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + jmp_imm_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne jump_out_of_range + call check_for_short_jump + jnc jmp_imm_32bit_store + jmp_short: + mov ah,al + mov al,0EBh + stos word [edi] + jmp instruction_assembled + jmp_imm_16bit: + call get_address_word_value + cmp [code_type],16 + je jmp_imm_16bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc jmp_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + dec edx + mov al,[base_code] + stos byte [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled + calculate_jump_offset: + add edi,2 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,2 + ret + check_for_short_jump: + cmp [jump_type],1 + je forced_short + ja no_short_jump + cmp [base_code],0E8h + je no_short_jump + cmp [value_type],0 + jne no_short_jump + cmp eax,80h + jb short_jump + cmp eax,-80h + jae short_jump + no_short_jump: + clc + ret + forced_short: + cmp [base_code],0E8h + je illegal_instruction + cmp [next_pass_needed],0 + jne jmp_short_value_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + jmp_short_value_type_ok: + cmp eax,-80h + jae short_jump + cmp eax,80h + jae jump_out_of_range + short_jump: + stc + ret + jump_out_of_range: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],relative_jump_out_of_range + jmp instruction_assembled + jmp_far: + cmp [jump_type],2 + je invalid_operand + cmp [code_type],64 + je illegal_instruction + mov al,[extended_code] + mov [base_code],al + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax [symbol_identifier] + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,4 + je jmp_far_16bit + cmp al,6 + je jmp_far_32bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + jne jmp_far_32bit + jmp_far_16bit: + call get_word_value + mov ebx,eax + call operand_16bit + call store_classic_instruction_code + mov ax,bx + call mark_relocation + stos word [edi] + jmp_far_segment: + pop [symbol_identifier] eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + jmp instruction_assembled + jmp_far_32bit: + call get_dword_value + mov ebx,eax + call operand_32bit + call store_classic_instruction_code + mov eax,ebx + call mark_relocation + stos dword [edi] + jmp jmp_far_segment +conditional_jump: + mov [base_code],al + and [prefix_flags],not 10h + lods byte [esi] + call get_jump_operator + cmp [jump_type],3 + je invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je conditional_jump_16bit + cmp al,4 + je conditional_jump_32bit + cmp al,8 + je conditional_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je conditional_jump_16bit + cmp [code_type],64 + je conditional_jump_64bit + conditional_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne conditional_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc conditional_jump_short + conditional_jump_32bit_store: + mov edx,eax + sub edx,4 + jno conditional_jump_32bit_range_ok + cmp [code_type],64 + je jump_out_of_range + conditional_jump_32bit_range_ok: + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + conditional_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne jump_out_of_range + call check_for_short_jump + jnc conditional_jump_32bit_store + conditional_jump_short: + mov ah,al + mov al,[base_code] + stos word [edi] + jmp instruction_assembled + conditional_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je conditional_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc conditional_jump_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + sub dx,2 + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled +loop_instruction_16bit: + cmp [code_type],64 + je illegal_instruction + cmp [code_type],16 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_32bit: + cmp [code_type],32 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction +loop_instruction: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],1 + ja invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je loop_jump_16bit + cmp al,4 + je loop_jump_32bit + cmp al,8 + je loop_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je loop_jump_16bit + cmp [code_type],64 + je loop_jump_64bit + loop_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne loop_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_32bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cdq + make_loop_jump: + call check_for_short_jump + jc conditional_jump_short + scas word [edi] + jmp jump_out_of_range + loop_counter_size: + cmp [operand_prefix],0 + je loop_counter_size_ok + push eax + mov al,[operand_prefix] + stos byte [edi] + pop eax + loop_counter_size_ok: + ret + loop_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call loop_counter_size + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne jump_out_of_range + jmp make_loop_jump + loop_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je loop_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_16bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cwde + cdq + jmp make_loop_jump + +movs_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp [segment_register],1 + ja invalid_address + push ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop edx + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,6 + jne invalid_address + cmp dh,7 + jne invalid_address + cmp al,2 + je movs_address_16bit + cmp al,4 + je movs_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp movs_store + movs_address_32bit: + call address_32bit_prefix + jmp movs_store + movs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + movs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A4h + movs_check_size: + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jnz invalid_operand_size + call recoverable_unknown_size + jmp simple_instruction +lods_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je lods_address_16bit + cmp bh,46h + je lods_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp lods_store + lods_address_32bit: + call address_32bit_prefix + jmp lods_store + lods_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + lods_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0ACh + jmp movs_check_size +stos_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je stos_address_16bit + cmp bh,47h + je stos_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp stos_store + stos_address_32bit: + call address_32bit_prefix + jmp stos_store + stos_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + stos_store: + cmp [segment_register],1 + ja invalid_address + mov al,[base_code] + jmp movs_check_size +cmps_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,[segment_register] + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + pop edx eax + cmp [segment_register],1 + ja invalid_address + mov [segment_register],al + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,7 + jne invalid_address + cmp dh,6 + jne invalid_address + cmp al,2 + je cmps_address_16bit + cmp al,4 + je cmps_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp cmps_store + cmps_address_32bit: + call address_32bit_prefix + jmp cmps_store + cmps_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + cmps_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A6h + jmp movs_check_size +ins_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je ins_address_16bit + cmp bh,47h + je ins_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp ins_store + ins_address_32bit: + call address_32bit_prefix + jmp ins_store + ins_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + ins_store: + cmp [segment_register],1 + ja invalid_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + mov al,6Ch + ins_check_size: + cmp [operand_size],8 + jne movs_check_size + jmp invalid_operand_size +outs_instruction: + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je outs_address_16bit + cmp bh,46h + je outs_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp outs_store + outs_address_32bit: + call address_32bit_prefix + jmp outs_store + outs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + outs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,6Eh + jmp ins_check_size +xlat_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,23h + je xlat_address_16bit + cmp bh,43h + je xlat_address_32bit + cmp bh,83h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp xlat_store + xlat_address_32bit: + call address_32bit_prefix + jmp xlat_store + xlat_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + xlat_store: + call store_segment_prefix_if_necessary + mov al,0D7h + cmp [operand_size],1 + jbe simple_instruction + jmp invalid_operand_size + +pm_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je pm_reg + pm_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je pm_mem_store + or al,al + jnz invalid_operand_size + pm_mem_store: + jmp instruction_ready + pm_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp ah,2 + jne invalid_operand_size + jmp nomem_instruction_ready +pm_store_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne pm_mem + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +lgdt_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,6 + je lgdt_mem_48bit + cmp al,10 + je lgdt_mem_80bit + or al,al + jnz invalid_operand_size + jmp lgdt_mem_store + lgdt_mem_80bit: + cmp [code_type],64 + jne illegal_instruction + jmp lgdt_mem_store + lgdt_mem_48bit: + cmp [code_type],64 + je illegal_instruction + cmp [postbyte_register],2 + jb lgdt_mem_store + call operand_32bit + lgdt_mem_store: + jmp instruction_ready +lar_instruction: + mov [extended_code],al + mov [base_code],0Fh + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + call operand_autodetect + lods byte [esi] + call get_size_operator + cmp al,10h + je lar_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz lar_reg_mem + cmp al,2 + jne invalid_operand_size + lar_reg_mem: + jmp instruction_ready + lar_reg_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +invlpg_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready +swapgs_instruction: + cmp [code_type],64 + jne illegal_instruction +simple_instruction_0f_01: + mov ah,al + mov al,0Fh + stos byte [edi] + mov al,1 + stos word [edi] + jmp instruction_assembled + +basic_486_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_486_reg + cmp al,'[' + jne invalid_operand + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je basic_486_mem_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_mem_reg_8bit: + jmp instruction_ready + basic_486_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je basic_486_reg_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_reg_reg_8bit: + jmp nomem_instruction_ready +bswap_instruction: + call take_register + test al,1000b + jz bswap_reg_code_ok + or [rex_prefix],41h + and al,111b + bswap_reg_code_ok: + add al,0C8h + mov [extended_code],al + mov [base_code],0Fh + cmp ah,8 + je bswap_reg64 + cmp ah,4 + jne invalid_operand_size + call operand_32bit + call store_classic_instruction_code + jmp instruction_assembled + bswap_reg64: + call operand_64bit + call store_classic_instruction_code + jmp instruction_assembled +cmpxchgx_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,1 + xchg [postbyte_register],ah + mov al,[operand_size] + or al,al + jz cmpxchgx_size_ok + cmp al,ah + jne invalid_operand_size + cmpxchgx_size_ok: + cmp ah,16 + jne cmpxchgx_store + call operand_64bit + cmpxchgx_store: + jmp instruction_ready +nop_instruction: + mov ah,[esi] + cmp ah,10h + je extended_nop + cmp ah,11h + je extended_nop + cmp ah,'[' + je extended_nop + stos byte [edi] + jmp instruction_assembled + extended_nop: + mov [base_code],0Fh + mov [extended_code],1Fh + mov [postbyte_register],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je extended_nop_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz extended_nop_store + call operand_autodetect + extended_nop_store: + jmp instruction_ready + extended_nop_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + +basic_fpu_instruction: + mov [postbyte_register],al + mov [base_code],0D8h + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_fpu_streg + cmp al,'[' + je basic_fpu_mem + dec esi + mov ah,[postbyte_register] + cmp ah,2 + jb invalid_operand + cmp ah,3 + ja invalid_operand + mov bl,1 + jmp nomem_instruction_ready + basic_fpu_mem: + call get_address + mov al,[operand_size] + cmp al,4 + je basic_fpu_mem_32bit + cmp al,8 + je basic_fpu_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + basic_fpu_mem_32bit: + jmp instruction_ready + basic_fpu_mem_64bit: + mov [base_code],0DCh + jmp instruction_ready + basic_fpu_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + mov ah,[postbyte_register] + cmp ah,2 + je basic_fpu_single_streg + cmp ah,3 + je basic_fpu_single_streg + or al,al + jz basic_fpu_st0 + test ah,110b + jz basic_fpu_streg_st0 + xor [postbyte_register],1 + basic_fpu_streg_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + mov [base_code],0DCh + jmp nomem_instruction_ready + basic_fpu_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov bl,al + basic_fpu_single_streg: + mov [base_code],0D8h + jmp nomem_instruction_ready +simple_fpu_instruction: + mov ah,al + or ah,11000000b + mov al,0D9h + stos word [edi] + jmp instruction_assembled +fi_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fi_mem_16bit + cmp al,4 + je fi_mem_32bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fi_mem_32bit: + mov [base_code],0DAh + jmp instruction_ready + fi_mem_16bit: + mov [base_code],0DEh + jmp instruction_ready +fld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je fld_streg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je fld_mem_32bit + cmp al,8 + je fld_mem_64bit + cmp al,10 + je fld_mem_80bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fld_mem_32bit: + mov [base_code],0D9h + jmp instruction_ready + fld_mem_64bit: + mov [base_code],0DDh + jmp instruction_ready + fld_mem_80bit: + mov al,[postbyte_register] + cmp al,0 + je fld_mem_80bit_store + dec [postbyte_register] + cmp al,3 + je fld_mem_80bit_store + jmp invalid_operand_size + fld_mem_80bit_store: + add [postbyte_register],5 + mov [base_code],0DBh + jmp instruction_ready + fld_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + cmp [postbyte_register],2 + jae fst_streg + mov [base_code],0D9h + jmp nomem_instruction_ready + fst_streg: + mov [base_code],0DDh + jmp nomem_instruction_ready +fild_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fild_mem_16bit + cmp al,4 + je fild_mem_32bit + cmp al,8 + je fild_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fild_mem_32bit: + mov [base_code],0DBh + jmp instruction_ready + fild_mem_16bit: + mov [base_code],0DFh + jmp instruction_ready + fild_mem_64bit: + mov al,[postbyte_register] + cmp al,1 + je fisttp_64bit_store + jb fild_mem_64bit_store + dec [postbyte_register] + cmp al,3 + je fild_mem_64bit_store + jmp invalid_operand_size + fild_mem_64bit_store: + add [postbyte_register],5 + mov [base_code],0DFh + jmp instruction_ready + fisttp_64bit_store: + mov [base_code],0DDh + jmp instruction_ready +fbld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fbld_mem_80bit + cmp al,10 + je fbld_mem_80bit + jmp invalid_operand_size + fbld_mem_80bit: + mov [base_code],0DFh + jmp instruction_ready +faddp_instruction: + mov [postbyte_register],al + mov [base_code],0DEh + mov edx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je faddp_streg + mov esi,edx + mov bl,1 + jmp nomem_instruction_ready + faddp_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + jmp nomem_instruction_ready +fcompp_instruction: + mov ax,0D9DEh + stos word [edi] + jmp instruction_assembled +fucompp_instruction: + mov ax,0E9DAh + stos word [edi] + jmp instruction_assembled +fxch_instruction: + mov dx,01D9h + jmp fpu_single_operand +ffreep_instruction: + mov dx,00DFh + jmp fpu_single_operand +ffree_instruction: + mov dl,0DDh + mov dh,al + fpu_single_operand: + mov ebx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je fpu_streg + or dh,dh + jz invalid_operand + mov esi,ebx + shl dh,3 + or dh,11000001b + mov ax,dx + stos word [edi] + jmp instruction_assembled + fpu_streg: + lods byte [esi] + call convert_fpu_register + shl dh,3 + or dh,al + or dh,11000000b + mov ax,dx + stos word [edi] + jmp instruction_assembled + +fstenv_instruction: + mov byte [edi],9Bh + inc edi +fldenv_instruction: + mov [base_code],0D9h + jmp fpu_mem +fstenv_instruction_16bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_16bit: + call operand_16bit + jmp fldenv_instruction +fstenv_instruction_32bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_32bit: + call operand_32bit + jmp fldenv_instruction +fsave_instruction_32bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_32bit: + call operand_32bit + jmp fnsave_instruction +fsave_instruction_16bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_16bit: + call operand_16bit + jmp fnsave_instruction +fsave_instruction: + mov byte [edi],9Bh + inc edi +fnsave_instruction: + mov [base_code],0DDh + fpu_mem: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + jne invalid_operand_size + jmp instruction_ready +fstcw_instruction: + mov byte [edi],9Bh + inc edi +fldcw_instruction: + mov [postbyte_register],al + mov [base_code],0D9h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fldcw_mem_16bit + cmp al,2 + je fldcw_mem_16bit + jmp invalid_operand_size + fldcw_mem_16bit: + jmp instruction_ready +fstsw_instruction: + mov al,9Bh + stos byte [edi] +fnstsw_instruction: + mov [base_code],0DDh + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,10h + je fstsw_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fstsw_mem_16bit + cmp al,2 + je fstsw_mem_16bit + jmp invalid_operand_size + fstsw_mem_16bit: + jmp instruction_ready + fstsw_reg: + lods byte [esi] + call convert_register + cmp ax,0200h + jne invalid_operand + mov ax,0E0DFh + stos word [edi] + jmp instruction_assembled +finit_instruction: + mov byte [edi],9Bh + inc edi +fninit_instruction: + mov ah,al + mov al,0DBh + stos word [edi] + jmp instruction_assembled +fcmov_instruction: + mov dh,0DAh + jmp fcomi_streg +fcomi_instruction: + mov dh,0DBh + jmp fcomi_streg +fcomip_instruction: + mov dh,0DFh + fcomi_streg: + mov dl,al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + cmp byte [esi],',' + je fcomi_st0_streg + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + fcomi_st0_streg: + or ah,ah + jnz invalid_operand + inc esi + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + +basic_mmx_instruction: + mov [base_code],0Fh + mov [extended_code],al + mmx_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'[' + jne invalid_operand + mmx_mmreg_mem: + call get_address + jmp instruction_ready + mmx_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +mmx_bit_shift_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'(' + je mmx_ps_mmreg_imm8 + cmp al,'[' + je mmx_mmreg_mem + jmp invalid_operand + mmx_ps_mmreg_imm8: + call get_byte_value + mov byte [value],al + test [operand_size],not 1 + jnz invalid_value + mov bl,[extended_code] + mov al,bl + shr bl,4 + and al,1111b + add al,70h + mov [extended_code],al + sub bl,0Ch + shl bl,1 + xchg bl,[postbyte_register] + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +pmovmskb_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_register + cmp ah,4 + je pmovmskb_reg_size_ok + cmp [code_type],64 + jne invalid_operand_size + cmp ah,8 + jnz invalid_operand_size + pmovmskb_reg_size_ok: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + call make_mmx_prefix + cmp [extended_code],0C5h + je mmx_nomem_imm8 + jmp nomem_instruction_ready + mmx_imm8: + push ebx ecx edx + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + mov [operand_size],cl + cmp al,'(' + jne invalid_operand + call get_byte_value + mov byte [value],al + pop edx ecx ebx + call store_instruction_with_imm8 + jmp instruction_assembled + mmx_nomem_imm8: + call store_nomem_instruction + call append_imm8 + jmp instruction_assembled + append_imm8: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + stosb + ret +pinsrw_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsrw_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + cmp [operand_size],2 + jne invalid_operand_size + jmp mmx_imm8 + pinsrw_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp mmx_nomem_imm8 +pshufw_instruction: + mov [mmx_size],8 + mov [opcode_prefix],al + jmp pshuf_instruction +pshufd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],al + pshuf_instruction: + mov [base_code],0Fh + mov [extended_code],70h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pshuf_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + pshuf_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +movd_instruction: + mov [base_code],0Fh + mov [extended_code],7Eh + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + call get_mmx_source_register + jmp instruction_ready + movd_reg: + lods byte [esi] + cmp al,0B0h + jae movd_mmreg + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + call get_mmx_source_register + jmp nomem_instruction_ready + movd_mmreg: + mov [extended_code],6Eh + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + jmp instruction_ready + movd_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready + get_mmx_source_register: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + make_mmx_prefix: + cmp [operand_size],16 + jne no_mmx_prefix + mov [operand_prefix],66h + no_mmx_prefix: + ret +movq_instruction: + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + call get_mmx_source_register + mov al,7Fh + cmp ah,8 + je movq_mem_ready + mov al,0D6h + movq_mem_ready: + mov [extended_code],al + jmp instruction_ready + movq_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg + call convert_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + mov [extended_code],7Eh + call operand_64bit + call get_mmx_source_register + jmp nomem_instruction_ready + movq_mmreg: + call convert_mmx_register + mov [postbyte_register],al + mov [extended_code],6Fh + mov [mmx_size],ah + cmp ah,16 + jne movq_mmreg_ + mov [extended_code],7Eh + mov [opcode_prefix],0F3h + movq_mmreg_: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + jmp instruction_ready + movq_mmreg_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg_mmreg + mov [operand_size],0 + call convert_register + cmp ah,8 + jne invalid_operand_size + mov [extended_code],6Eh + mov [opcode_prefix],0 + mov bl,al + cmp [mmx_size],16 + jne movq_mmreg_reg_store + mov [opcode_prefix],66h + movq_mmreg_reg_store: + call operand_64bit + jmp nomem_instruction_ready + movq_mmreg_mmreg: + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +movdq_instruction: + mov [opcode_prefix],al + mov [base_code],0Fh + mov [extended_code],6Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [extended_code],7Fh + jmp instruction_ready + movdq_mmreg: + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + movdq_mmreg_mmreg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +lddqu_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov [postbyte_register],al + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],0F0h + jmp instruction_ready + +movdq2q_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movq2dq_ +movq2dq_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],16 + movq2dq_: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + xor [mmx_size],8+16 + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + mov [base_code],0Fh + mov [extended_code],0D6h + jmp nomem_instruction_ready + +sse_ps_instruction_imm8: + mov [immediate_size],1 +sse_ps_instruction: + mov [mmx_size],16 + jmp sse_instruction +sse_pd_instruction_imm8: + mov [immediate_size],1 +sse_pd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],66h + jmp sse_instruction +sse_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_instruction +sse_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + jmp sse_instruction +cmp_pd_instruction: + mov [opcode_prefix],66h +cmp_ps_instruction: + mov [mmx_size],16 + mov byte [value],al + mov al,0C2h + jmp sse_instruction +cmp_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp cmp_sx_instruction +cmpsd_instruction: + mov al,0A7h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov al,-1 +cmp_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + cmp_sx_instruction: + mov byte [value],al + mov al,0C2h + jmp sse_instruction +comiss_instruction: + mov [mmx_size],4 + jmp sse_instruction +comisd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],66h + jmp sse_instruction +cvtdq2pd_instruction: + mov [opcode_prefix],0F3h +cvtps2pd_instruction: + mov [mmx_size],8 + jmp sse_instruction +cvtpd2dq_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F2h + jmp sse_instruction +movshdup_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F3h +sse_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + sse_xmmreg: + lods byte [esi] + call convert_xmm_register + sse_reg: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg + sse_reg_mem: + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je sse_mem_size_ok + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + sse_mem_size_ok: + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_mem_ok + cmp ax,443Ah + je sse_cmp_mem_ok + cmp [immediate_size],1 + je mmx_imm8 + cmp [immediate_size],-1 + jne sse_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_ok: + jmp instruction_ready + sse_cmp_mem_ok: + cmp byte [value],-1 + je mmx_imm8 + call store_instruction_with_imm8 + jmp instruction_assembled + sse_xmmreg_xmmreg: + cmp [operand_prefix],66h + jne sse_xmmreg_xmmreg_ok + cmp [extended_code],12h + je invalid_operand + cmp [extended_code],16h + je invalid_operand + sse_xmmreg_xmmreg_ok: + lods byte [esi] + call convert_xmm_register + mov bl,al + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_nomem_ok + cmp ax,443Ah + je sse_cmp_nomem_ok + cmp [immediate_size],1 + je mmx_nomem_imm8 + cmp [immediate_size],-1 + jne sse_nomem_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_nomem_ok: + jmp nomem_instruction_ready + sse_cmp_nomem_ok: + cmp byte [value],-1 + je mmx_nomem_imm8 + call store_nomem_instruction + mov al,byte [value] + stosb + jmp instruction_assembled + take_additional_xmm0: + cmp byte [esi],',' + jne additional_xmm0_ok + inc esi + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + test al,al + jnz invalid_operand + additional_xmm0_ok: + ret + +pslldq_instruction: + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],73h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp mmx_nomem_imm8 +movpd_instruction: + mov [opcode_prefix],66h +movps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],16 + jmp sse_mov_instruction +movss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_movs +movsd_instruction: + mov al,0A5h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov [mmx_size],8 + mov [opcode_prefix],0F2h + sse_movs: + mov [base_code],0Fh + mov [extended_code],10h + jmp sse_mov_instruction +sse_mov_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg + sse_mem: + cmp al,'[' + jne invalid_operand + inc [extended_code] + call get_address + cmp [operand_size],0 + je sse_mem_xmmreg + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + mov [operand_size],0 + sse_mem_xmmreg: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready +movlpd_instruction: + mov [opcode_prefix],66h +movlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],8 + lods byte [esi] + call get_size_operator + cmp al,10h + jne sse_mem + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + jmp sse_reg_mem +movhlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand +maskmovq_instruction: + mov cl,8 + jmp maskmov_instruction +maskmovdqu_instruction: + mov cl,16 + mov [opcode_prefix],66h + maskmov_instruction: + mov [base_code],0Fh + mov [extended_code],0F7h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,cl + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +movmskpd_instruction: + mov [opcode_prefix],66h +movmskps_instruction: + mov [base_code],0Fh + mov [extended_code],50h + call take_register + mov [postbyte_register],al + cmp ah,4 + je movmskps_reg_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + movmskps_reg_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand + +cvtpi2pd_instruction: + mov [opcode_prefix],66h +cvtpi2ps_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtpi_xmmreg_xmmreg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtpi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + cvtpi_size_ok: + jmp instruction_ready + cvtpi_xmmreg_xmmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +cvtsi2ss_instruction: + mov [opcode_prefix],0F3h + jmp cvtsi_instruction +cvtsi2sd_instruction: + mov [opcode_prefix],0F2h + cvtsi_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + cvtsi_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtsi_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtsi_size_ok + cmp [operand_size],4 + je cvtsi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + call operand_64bit + cvtsi_size_ok: + jmp instruction_ready + cvtsi_xmmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + je cvtsi_xmmreg_reg_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + cvtsi_xmmreg_reg_store: + mov bl,al + jmp nomem_instruction_ready +cvtps2pi_instruction: + mov [mmx_size],8 + jmp cvtpd_instruction +cvtpd2pi_instruction: + mov [opcode_prefix],66h + mov [mmx_size],16 + cvtpd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [operand_size],0 + jmp sse_reg +cvtss2si_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + jmp cvt2si_instruction +cvtsd2si_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + cvt2si_instruction: + mov [extended_code],al + mov [base_code],0Fh + call take_register + mov [operand_size],0 + cmp ah,4 + je sse_reg + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp sse_reg + +ssse3_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + jmp mmx_instruction +palignr_instruction: + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je palignr_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + palignr_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +amd3dnow_instruction: + mov [base_code],0Fh + mov [extended_code],0Fh + mov byte [value],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je amd3dnow_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + call store_instruction_with_imm8 + jmp instruction_assembled + amd3dnow_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + +sse4_instruction_38_xmm0: + mov [immediate_size],-1 + jmp sse4_instruction_38 +sse4_instruction_66_38_xmm0: + mov [immediate_size],-1 +sse4_instruction_66_38: + mov [opcode_prefix],66h +sse4_instruction_38: + mov [mmx_size],16 + mov [supplemental_code],al + mov al,38h + jmp sse_instruction +sse4_ss_instruction_66_3a_imm8: + mov [immediate_size],1 + mov cl,4 + jmp sse4_instruction_66_3a_setup +sse4_sd_instruction_66_3a_imm8: + mov [immediate_size],1 + mov cl,8 + jmp sse4_instruction_66_3a_setup +sse4_instruction_66_3a_imm8: + mov [immediate_size],1 + mov cl,16 + sse4_instruction_66_3a_setup: + mov [opcode_prefix],66h + sse4_instruction_3a_setup: + mov [supplemental_code],al + mov al,3Ah + mov [mmx_size],cl + jmp sse_instruction +sse4_instruction_3a_imm8: + mov [immediate_size],1 + mov cl,16 + jmp sse4_instruction_3a_setup +pclmulqdq_instruction: + mov byte [value],al + mov al,44h + mov cl,16 + jmp sse4_instruction_66_3a_setup +extractps_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + je extractps_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je extractps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + extractps_size_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + extractps_reg: + lods byte [esi] + call convert_register + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ebx + mov al,bh + cmp al,4 + je mmx_nomem_imm8 + cmp al,8 + jne invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp mmx_nomem_imm8 + setup_66_0f_3a: + mov [extended_code],3Ah + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],66h + ret +insertps_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je insertps_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je insertps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + insertps_size_ok: + jmp mmx_imm8 + insertps_xmmreg_reg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +pextrq_instruction: + mov [mmx_size],8 + jmp pextr_instruction +pextrd_instruction: + mov [mmx_size],4 + jmp pextr_instruction +pextrw_instruction: + mov [mmx_size],2 + jmp pextr_instruction +pextrb_instruction: + mov [mmx_size],1 + pextr_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + je pextr_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + cmp al,[operand_size] + je pextr_size_ok + cmp [operand_size],0 + jne invalid_operand_size + pextr_size_ok: + cmp al,8 + jne pextr_prefix_ok + call operand_64bit + pextr_prefix_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + pextr_reg: + lods byte [esi] + call convert_register + cmp [mmx_size],4 + ja pextrq_reg + cmp ah,4 + je pextr_reg_size_ok + cmp [code_type],64 + jne pextr_invalid_size + cmp ah,8 + je pextr_reg_size_ok + pextr_invalid_size: + jmp invalid_operand_size + pextrq_reg: + cmp ah,8 + jne pextr_invalid_size + call operand_64bit + pextr_reg_size_ok: + mov [operand_size],0 + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov ebx,eax + pop eax + mov [postbyte_register],al + mov al,ah + cmp [mmx_size],2 + jne pextr_reg_store + mov [opcode_prefix],0 + mov [extended_code],0C5h + call make_mmx_prefix + jmp mmx_nomem_imm8 + pextr_reg_store: + cmp bh,16 + jne invalid_operand_size + xchg bl,[postbyte_register] + jmp mmx_nomem_imm8 +pinsrb_instruction: + mov [mmx_size],1 + jmp pinsr_instruction +pinsrd_instruction: + mov [mmx_size],4 + jmp pinsr_instruction +pinsrq_instruction: + mov [mmx_size],8 + call operand_64bit + pinsr_instruction: + call setup_66_0f_3a + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pinsr_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsr_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + mov al,[mmx_size] + cmp al,[operand_size] + je mmx_imm8 + jmp invalid_operand_size + pinsr_xmmreg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp [mmx_size],8 + je pinsrq_xmmreg_reg + cmp ah,4 + je mmx_nomem_imm8 + jmp invalid_operand_size + pinsrq_xmmreg_reg: + cmp ah,8 + je mmx_nomem_imm8 + jmp invalid_operand_size +pmovsxbw_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxbd_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxbq_instruction: + mov [mmx_size],2 + jmp pmovsx_instruction +pmovsxwd_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxwq_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxdq_instruction: + mov [mmx_size],8 + pmovsx_instruction: + call setup_66_0f_38 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je pmovsx_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je instruction_ready + mov al,[mmx_size] + cmp al,[operand_size] + jne invalid_operand_size + jmp instruction_ready + pmovsx_xmmreg_reg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready + setup_66_0f_38: + mov [extended_code],38h + mov [supplemental_code],al + mov [base_code],0Fh + mov [opcode_prefix],66h + ret + +fxsave_instruction_64bit: + call operand_64bit +fxsave_instruction: + mov [extended_code],0AEh + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,[operand_size] + or ah,ah + jz fxsave_size_ok + mov al,[postbyte_register] + cmp al,111b + je clflush_size_check + cmp al,10b + jb invalid_operand_size + cmp al,11b + ja invalid_operand_size + cmp ah,4 + jne invalid_operand_size + jmp fxsave_size_ok + clflush_size_check: + cmp ah,1 + jne invalid_operand_size + fxsave_size_ok: + jmp instruction_ready +prefetch_instruction: + mov [extended_code],18h + prefetch_mem_8bit: + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + or ah,ah + jz prefetch_size_ok + cmp ah,1 + jne invalid_operand_size + prefetch_size_ok: + call get_address + jmp instruction_ready +amd_prefetch_instruction: + mov [extended_code],0Dh + jmp prefetch_mem_8bit +clflushopt_instruction: + mov [extended_code],0AEh + mov [opcode_prefix],66h + jmp prefetch_mem_8bit +pcommit_instruction: + mov byte [edi],66h + inc edi +fence_instruction: + mov bl,al + mov ax,0AE0Fh + stos word [edi] + mov al,bl + stos byte [edi] + jmp instruction_assembled +pause_instruction: + mov ax,90F3h + stos word [edi] + jmp instruction_assembled +movntq_instruction: + mov [mmx_size],8 + jmp movnt_instruction +movntpd_instruction: + mov [opcode_prefix],66h +movntps_instruction: + mov [mmx_size],16 + movnt_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + jmp instruction_ready + +movntsd_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movnts_instruction +movntss_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + movnts_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,[mmx_size] + je movnts_size_ok + test al,al + jnz invalid_operand_size + movnts_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready + +movnti_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ah,4 + je movnti_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + movnti_store: + mov [postbyte_register],al + jmp instruction_ready +monitor_instruction: + mov [postbyte_register],al + cmp byte [esi],0 + je monitor_instruction_store + cmp byte [esi],0Fh + je monitor_instruction_store + call take_register + cmp ax,0400h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ax,0401h + jne invalid_operand + cmp [postbyte_register],0C8h + jne monitor_instruction_store + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ax,0402h + jne invalid_operand + monitor_instruction_store: + mov ax,010Fh + stos word [edi] + mov al,[postbyte_register] + stos byte [edi] + jmp instruction_assembled +movntdqa_instruction: + call setup_66_0f_38 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + +extrq_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je extrq_xmmreg_xmmreg + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + xor bl,bl + xchg bl,[postbyte_register] + call store_nomem_instruction + call get_byte_value + stosb + call append_imm8 + jmp instruction_assembled + extrq_xmmreg_xmmreg: + inc [extended_code] + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +insertq_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + cmp byte [esi],',' + je insertq_with_imm + inc [extended_code] + jmp nomem_instruction_ready + insertq_with_imm: + call store_nomem_instruction + call append_imm8 + call append_imm8 + jmp instruction_assembled + +crc32_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F0h + call take_register + mov [postbyte_register],al + cmp ah,4 + je crc32_reg_size_ok + cmp ah,8 + jne invalid_operand + cmp [code_type],64 + jne illegal_instruction + crc32_reg_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je crc32_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + test al,al + jz crc32_unknown_size + cmp al,1 + je crc32_reg_mem_store + inc [supplemental_code] + call operand_autodetect + crc32_reg_mem_store: + jmp instruction_ready + crc32_unknown_size: + call recoverable_unknown_size + jmp crc32_reg_mem_store + crc32_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je crc32_reg_reg_store + inc [supplemental_code] + call operand_autodetect + crc32_reg_reg_store: + jmp nomem_instruction_ready +popcnt_instruction: + mov [opcode_prefix],0F3h + jmp bs_instruction +movbe_instruction: + mov [supplemental_code],al + mov [extended_code],38h + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + je movbe_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + movbe_mem: + inc [supplemental_code] + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready +adx_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F6h + mov [operand_prefix],al + call get_reg_mem + jc adx_reg_reg + mov al,[operand_size] + cmp al,4 + je instruction_ready + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp instruction_ready + adx_reg_reg: + cmp ah,4 + je nomem_instruction_ready + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp nomem_instruction_ready + +vmclear_instruction: + mov [opcode_prefix],66h + jmp vmx_instruction +vmxon_instruction: + mov [opcode_prefix],0F3h +vmx_instruction: + mov [postbyte_register],al + mov [extended_code],0C7h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,8 + jne invalid_operand_size + vmx_size_ok: + mov [base_code],0Fh + jmp instruction_ready +vmread_instruction: + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + je vmread_nomem + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + call vmread_check_size + jmp vmx_size_ok + vmread_nomem: + lods byte [esi] + call convert_register + push eax + call vmread_check_size + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + mov [postbyte_register],al + call vmread_check_size + pop ebx + mov [base_code],0Fh + jmp nomem_instruction_ready + vmread_check_size: + cmp [code_type],64 + je vmread_long + cmp [operand_size],4 + jne invalid_operand_size + ret + vmread_long: + cmp [operand_size],8 + jne invalid_operand_size + ret +vmwrite_instruction: + mov [extended_code],79h + call take_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je vmwrite_nomem + cmp al,'[' + jne invalid_operand + call get_address + call vmread_check_size + jmp vmx_size_ok + vmwrite_nomem: + lods byte [esi] + call convert_register + mov bl,al + mov [base_code],0Fh + jmp nomem_instruction_ready +vmx_inv_instruction: + call setup_66_0f_38 + call take_register + mov [postbyte_register],al + call vmread_check_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,16 + jne invalid_operand_size + jmp vmx_size_ok +simple_svm_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + call take_register + or al,al + jnz invalid_operand + simple_svm_detect_size: + cmp ah,2 + je simple_svm_16bit + cmp ah,4 + je simple_svm_32bit + cmp [code_type],64 + jne invalid_operand_size + jmp simple_svm_store + simple_svm_16bit: + cmp [code_type],16 + je simple_svm_store + cmp [code_type],64 + je invalid_operand_size + jmp prefixed_svm_store + simple_svm_32bit: + cmp [code_type],32 + je simple_svm_store + prefixed_svm_store: + mov al,67h + stos byte [edi] + simple_svm_store: + call store_classic_instruction_code + pop eax + stos byte [edi] + jmp instruction_assembled +skinit_instruction: + call take_register + cmp ax,0400h + jne invalid_operand + mov al,0DEh + jmp simple_instruction_0f_01 +invlpga_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + call take_register + or al,al + jnz invalid_operand + mov bl,ah + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_register + cmp ax,0401h + jne invalid_operand + mov ah,bl + jmp simple_svm_detect_size + +rdrand_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + call take_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +rdfsbase_instruction: + cmp [code_type],64 + jne illegal_instruction + mov [opcode_prefix],0F3h + mov [base_code],0Fh + mov [extended_code],0AEh + mov [postbyte_register],al + call take_register + mov bl,al + mov al,ah + cmp ah,2 + je invalid_operand_size + call operand_autodetect + jmp nomem_instruction_ready + +xabort_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + mov dl,al + mov ax,0F8C6h + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +xbegin_instruction: + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[code_type] + cmp al,64 + je xbegin_64bit + cmp al,32 + je xbegin_32bit + xbegin_16bit: + call get_address_word_value + add edi,4 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,4 + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_32bit: + call get_address_dword_value + jmp xbegin_address_ok + xbegin_64bit: + call get_address_qword_value + xbegin_address_ok: + add edi,5 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,5 + mov edx,eax + cwde + cmp eax,edx + jne xbegin_rel32 + mov al,66h + stos byte [edi] + mov eax,edx + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_rel32: + sub edx,1 + jno xbegin_rel32_ok + cmp [code_type],64 + je jump_out_of_range + xbegin_rel32_ok: + mov ax,0F8C7h + stos word [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + +bndcl_instruction: + mov ah,0F3h + jmp bndc_instruction +bndcu_instruction: + mov ah,0F2h + bndc_instruction: + mov [opcode_prefix],ah + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_register + mov [postbyte_register],al + call get_bnd_size + mov [operand_size],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je bndc_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + jmp nomem_instruction_ready + bndc_mem: + call get_address_of_required_size + jmp instruction_ready +bndmov_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],al + call get_bnd_size + shl al,1 + mov [operand_size],al + lods byte [esi] + cmp al,14h + je bndmov_reg + call get_size_operator + cmp al,'[' + jne invalid_operand + inc [extended_code] + call get_address_of_required_size + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_bnd_register + mov [postbyte_register],al + jmp instruction_ready + bndmov_reg: + lods byte [esi] + call convert_bnd_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,14h + je bndmov_reg_reg + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address_of_required_size + jmp instruction_ready + bndmov_reg_reg: + lods byte [esi] + call convert_bnd_register + mov bl,al + jmp nomem_instruction_ready + take_bnd_register: + lods byte [esi] + cmp al,14h + jne invalid_operand + lods byte [esi] + convert_bnd_register: + mov ah,al + shr ah,4 + cmp ah,6 + jne invalid_operand + and al,1111b + ret +bndmk_instruction: + mov [opcode_prefix],0F3h + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_bnd_size + call get_address_prefixes + call get_address_component + cmp byte [esi-1],']' + je bndmk_ready + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,'(' + jne invalid_operand + or dl,bl + or dl,[address_sign] + or edx,[address_high] + jnz invalid_address + mov [address_register],bh + call get_address_component + lods byte [esi] + cmp al,']' + jne invalid_operand + or bh,bh + jz bndmk_selected_base + cmp bl,bh + je bndmk_to_index + or bl,bl + jnz invalid_address + mov bl,bh + bndmk_to_index: + inc cl + bndmk_selected_base: + mov bh,[address_register] + bndmk_ready: + or bx,bx + jz instruction_ready + cmp [address_size_declared],0 + jne instruction_ready + and ch,not 0Fh + jmp instruction_ready + get_bnd_size: + mov al,4 + cmp [code_type],64 + jne bnd_size_ok + add al,4 + bnd_size_ok: + mov [address_size],al + ret + get_address_component: + mov [free_address_range],0 + call calculate_address + mov [address_high],edx + mov edx,eax + or bx,bx + jz address_component_ok + mov al,bl + or al,bh + shr al,4 + cmp al,[address_size] + jne invalid_address + address_component_ok: + ret +bndldx_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_bnd_mib + jmp bndmk_ready +bndstx_instruction: + mov [base_code],0Fh + mov [extended_code],al + call take_bnd_mib + lods byte [esi] + cmp al,',' + jne invalid_operand + call take_bnd_register + mov [postbyte_register],al + jmp bndmk_ready + take_bnd_mib: + lods byte [esi] + cmp al,'[' + jne invalid_operand + call get_bnd_size + call get_address_prefixes + call get_address_component + cmp byte [esi-1],']' + je bnd_mib_ok + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[address_sign] + push eax ebx ecx edx [address_symbol] + call get_address_component + lods byte [esi] + cmp al,']' + jne invalid_operand + or dl,bl + or dl,[address_sign] + or edx,[address_high] + jnz invalid_address + mov [address_register],bh + pop [address_symbol] edx ecx ebx eax + mov [address_sign],al + or bl,bl + jz mib_place_index + or bh,bh + jnz invalid_address + cmp cl,1 + jne invalid_address + mov bh,bl + mib_place_index: + mov bl,[address_register] + xor cl,cl + or al,al + jz bnd_mib_ok + inc cl + bnd_mib_ok: + ret + +take_register: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] +convert_register: + mov ah,al + shr ah,4 + and al,0Fh + cmp ah,8 + je match_register_size + cmp ah,4 + ja invalid_operand + cmp ah,1 + ja match_register_size + cmp al,4 + jb match_register_size + or ah,ah + jz high_byte_register + or [rex_prefix],40h + match_register_size: + cmp ah,[operand_size] + je register_size_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + register_size_ok: + ret + high_byte_register: + mov ah,1 + or [rex_prefix],10h + jmp match_register_size +convert_fpu_register: + mov ah,al + shr ah,4 + and al,111b + cmp ah,10 + jne invalid_operand + jmp match_register_size +convert_mmx_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + ja invalid_operand + and al,111b + cmp ah,0Bh + jne invalid_operand + mov ah,8 + jmp match_register_size + xmm_register: + and al,0Fh + mov ah,16 + cmp al,8 + jb match_register_size + cmp [code_type],64 + jne invalid_operand + jmp match_register_size +convert_xmm_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + jmp invalid_operand +get_size_operator: + xor ah,ah + cmp al,11h + jne no_size_operator + mov [size_declared],1 + lods word [esi] + xchg al,ah + or [operand_flags],1 + cmp ah,[operand_size] + je size_operator_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + size_operator_ok: + ret + no_size_operator: + mov [size_declared],0 + cmp al,'[' + jne size_operator_ok + and [operand_flags],not 1 + ret +get_jump_operator: + mov [jump_type],0 + cmp al,12h + jne jump_operator_ok + lods word [esi] + mov [jump_type],al + mov al,ah + jump_operator_ok: + ret +get_address: + and [address_size],0 + get_address_of_required_size: + call get_address_prefixes + and [free_address_range],0 + call calculate_address + cmp byte [esi-1],']' + jne invalid_address + mov [address_high],edx + mov edx,eax + cmp [address_size_declared],0 + jne address_ok + or bx,bx + jnz clear_address_size + cmp [code_type],64 + jne address_ok + calculate_relative_address: + mov edx,[address_symbol] + mov [symbol_identifier],edx + mov edx,[address_high] + mov ebp,[addressing_space] + call calculate_relative_offset + mov [address_high],edx + cdq + cmp edx,[address_high] + je address_high_ok + call recoverable_overflow + address_high_ok: + mov edx,eax + ror ecx,16 + mov cl,[value_type] + rol ecx,16 + mov bx,9900h + clear_address_size: + and ch,not 0Fh + address_ok: + ret +get_address_prefixes: + and [segment_register],0 + and [address_size_declared],0 + mov al,[code_type] + shr al,3 + mov [value_size],al + mov al,[esi] + and al,11110000b + cmp al,60h + jne get_address_size_prefix + lods byte [esi] + sub al,60h + mov [segment_register],al + mov al,[esi] + and al,11110000b + get_address_size_prefix: + cmp al,70h + jne address_size_prefix_ok + lods byte [esi] + sub al,70h + cmp al,2 + jb invalid_address_size + cmp al,8 + ja invalid_address_size + mov [value_size],al + or [address_size_declared],1 + or [address_size],al + cmp al,[address_size] + jne invalid_address_size + address_size_prefix_ok: + ret +operand_16bit: + cmp [code_type],16 + je size_prefix_ok + mov [operand_prefix],66h + ret +operand_32bit: + cmp [code_type],16 + jne size_prefix_ok + mov [operand_prefix],66h + size_prefix_ok: + ret +operand_64bit: + cmp [code_type],64 + jne illegal_instruction + or [rex_prefix],48h + ret +operand_autodetect: + cmp al,2 + je operand_16bit + cmp al,4 + je operand_32bit + cmp al,8 + je operand_64bit + jmp invalid_operand_size +store_segment_prefix_if_necessary: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,4 + ja segment_prefix_386 + cmp [code_type],64 + je segment_prefix_ok + cmp al,3 + je ss_prefix + jb segment_prefix_86 + cmp bl,25h + je segment_prefix_86 + cmp bh,25h + je segment_prefix_86 + cmp bh,45h + je segment_prefix_86 + cmp bh,44h + je segment_prefix_86 + ret + ss_prefix: + cmp bl,25h + je segment_prefix_ok + cmp bh,25h + je segment_prefix_ok + cmp bh,45h + je segment_prefix_ok + cmp bh,44h + je segment_prefix_ok + jmp segment_prefix_86 +store_segment_prefix: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,5 + jae segment_prefix_386 + segment_prefix_86: + dec al + shl al,3 + add al,26h + stos byte [edi] + jmp segment_prefix_ok + segment_prefix_386: + add al,64h-5 + stos byte [edi] + segment_prefix_ok: + ret +store_instruction_code: + cmp [vex_required],0 + jne store_vex_instruction_code +store_classic_instruction_code: + mov al,[operand_prefix] + or al,al + jz operand_prefix_ok + stos byte [edi] + operand_prefix_ok: + mov al,[opcode_prefix] + or al,al + jz opcode_prefix_ok + stos byte [edi] + opcode_prefix_ok: + mov al,[rex_prefix] + test al,40h + jz rex_prefix_ok + cmp [code_type],64 + jne invalid_operand + test al,0B0h + jnz disallowed_combination_of_registers + stos byte [edi] + rex_prefix_ok: + mov al,[base_code] + stos byte [edi] + cmp al,0Fh + jne instruction_code_ok + store_extended_code: + mov al,[extended_code] + stos byte [edi] + cmp al,38h + je store_supplemental_code + cmp al,3Ah + je store_supplemental_code + instruction_code_ok: + ret + store_supplemental_code: + mov al,[supplemental_code] + stos byte [edi] + ret +store_nomem_instruction: + test [postbyte_register],10000b + jz nomem_reg_high_code_ok + or [vex_required],10h + and [postbyte_register],1111b + nomem_reg_high_code_ok: + test [postbyte_register],1000b + jz nomem_reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + nomem_reg_code_ok: + test bl,10000b + jz nomem_rm_high_code_ok + or [rex_prefix],42h + or [vex_required],8 + and bl,1111b + nomem_rm_high_code_ok: + test bl,1000b + jz nomem_rm_code_ok + or [rex_prefix],41h + and bl,111b + nomem_rm_code_ok: + and [displacement_compression],0 + call store_instruction_code + mov al,[postbyte_register] + shl al,3 + or al,bl + or al,11000000b + stos byte [edi] + ret +store_instruction: + mov [current_offset],edi + and [displacement_compression],0 + test [postbyte_register],10000b + jz reg_high_code_ok + or [vex_required],10h + and [postbyte_register],1111b + reg_high_code_ok: + test [postbyte_register],1000b + jz reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + reg_code_ok: + cmp [code_type],64 + jne address_value_ok + xor eax,eax + bt edx,31 + sbb eax,[address_high] + jz address_value_ok + cmp [address_high],0 + jne address_value_out_of_range + test ch,44h + jnz address_value_ok + test bx,8080h + jz address_value_ok + address_value_out_of_range: + call recoverable_overflow + address_value_ok: + call store_segment_prefix_if_necessary + test [vex_required],4 + jnz address_vsib + or bx,bx + jz address_immediate + cmp bx,9800h + je address_rip_based + cmp bx,9400h + je address_eip_based + cmp bx,9900h + je address_relative + mov al,bl + or al,bh + and al,11110000b + cmp al,80h + je postbyte_64bit + cmp al,40h + je postbyte_32bit + cmp al,20h + jne invalid_address + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + test ch,22h + setz [displacement_compression] + call store_instruction_code + cmp bl,bh + jbe determine_16bit_address + xchg bl,bh + determine_16bit_address: + cmp bx,2600h + je address_si + cmp bx,2700h + je address_di + cmp bx,2300h + je address_bx + cmp bx,2500h + je address_bp + cmp bx,2625h + je address_bp_si + cmp bx,2725h + je address_bp_di + cmp bx,2723h + je address_bx_di + cmp bx,2623h + jne invalid_address + address_bx_si: + xor al,al + jmp postbyte_16bit + address_bx_di: + mov al,1 + jmp postbyte_16bit + address_bp_si: + mov al,10b + jmp postbyte_16bit + address_bp_di: + mov al,11b + jmp postbyte_16bit + address_si: + mov al,100b + jmp postbyte_16bit + address_di: + mov al,101b + jmp postbyte_16bit + address_bx: + mov al,111b + jmp postbyte_16bit + address_bp: + mov al,110b + postbyte_16bit: + test ch,22h + jnz address_16bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + or dx,dx + jz address + cmp [displacement_compression],2 + ja address_8bit_value + je address_16bit_value + cmp dx,80h + jb address_8bit_value + cmp dx,-80h + jae address_8bit_value + address_16bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + ret + address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + ret + address: + cmp al,110b + je address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_vsib: + mov al,bl + shr al,4 + test al,1 + jz vsib_high_code_ok + or [vex_register],10000b + or [vex_required],8 + xor al,1 + vsib_high_code_ok: + cmp al,6 + je vsib_index_ok + cmp al,0Ch + jb invalid_address + vsib_index_ok: + mov al,bh + shr al,4 + cmp al,4 + je postbyte_32bit + cmp [code_type],64 + je address_prefix_ok + test al,al + jnz invalid_address + postbyte_32bit: + call address_32bit_prefix + jmp address_prefix_ok + postbyte_64bit: + cmp [code_type],64 + jne invalid_address_size + address_prefix_ok: + cmp bl,44h + je invalid_address + cmp bl,84h + je invalid_address + test bh,1000b + jz base_code_ok + or [rex_prefix],41h + base_code_ok: + test bl,1000b + jz index_code_ok + or [rex_prefix],42h + index_code_ok: + test ch,44h or 88h + setz [displacement_compression] + call store_instruction_code + or cl,cl + jz only_base_register + base_and_index: + mov al,100b + xor ah,ah + cmp cl,1 + je scale_ok + cmp cl,2 + je scale_1 + cmp cl,4 + je scale_2 + or ah,11000000b + jmp scale_ok + scale_2: + or ah,10000000b + jmp scale_ok + scale_1: + or ah,01000000b + scale_ok: + or bh,bh + jz only_index_register + and bl,111b + shl bl,3 + or ah,bl + and bh,111b + or ah,bh + sib_ready: + test ch,44h or 88h + jnz sib_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp bh,5 + je address_value + or edx,edx + jz sib_address + address_value: + cmp [displacement_compression],2 + ja sib_address_8bit_value + je sib_address_32bit_value + cmp edx,80h + jb sib_address_8bit_value + cmp edx,-80h + jnb sib_address_8bit_value + sib_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + sib_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + mov al,dl + stos byte [edi] + ret + sib_address: + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + ret + only_index_register: + or ah,101b + and bl,111b + shl bl,3 + or ah,bl + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + test ch,44h or 88h + jnz store_address_32bit_value + or ch,ch + jnz invalid_address_size + cmp [displacement_compression],2 + jbe store_address_32bit_value + mov edx,[uncompressed_displacement] + jmp store_address_32bit_value + zero_index_register: + mov bl,4 + mov cl,1 + jmp base_and_index + only_base_register: + mov al,bh + and al,111b + cmp al,4 + je zero_index_register + test ch,44h or 88h + jnz simple_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + or edx,edx + jz simple_address + cmp [displacement_compression],2 + ja simple_address_8bit_value + je simple_address_32bit_value + cmp edx,80h + jb simple_address_8bit_value + cmp edx,-80h + jnb simple_address_8bit_value + simple_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + jmp store_address_32bit_value + simple_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + ret + simple_address: + cmp al,5 + je simple_address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_immediate: + cmp [code_type],64 + je address_immediate_sib + test ch,44h or 88h + jnz address_immediate_32bit + test ch,22h + jnz address_immediate_16bit + or ch,ch + jnz invalid_address_size + cmp [code_type],16 + je addressing_16bit + address_immediate_32bit: + call address_32bit_prefix + call store_instruction_code + store_immediate_address: + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + store_address_32bit_value: + test ch,0F0h + jz address_32bit_relocation_ok + mov eax,ecx + shr eax,16 + cmp al,4 + jne address_32bit_relocation + mov al,2 + address_32bit_relocation: + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_32bit_relocation_ok: + mov eax,edx + stos dword [edi] + ret + store_address_64bit_value: + test ch,0F0h + jz address_64bit_relocation_ok + mov eax,ecx + shr eax,16 + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_64bit_relocation_ok: + mov eax,edx + stos dword [edi] + mov eax,[address_high] + stos dword [edi] + ret + address_immediate_sib: + test ch,44h + jnz address_immediate_sib_32bit + test ch,not 88h + jnz invalid_address_size + test edx,80000000h + jz address_immediate_sib_store + cmp [address_high],0 + je address_immediate_sib_nosignextend + address_immediate_sib_store: + call store_instruction_code + mov al,100b + mov ah,100101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + address_immediate_sib_32bit: + test ecx,0FF0000h + jnz address_immediate_sib_nosignextend + test edx,80000000h + jz address_immediate_sib_store + address_immediate_sib_nosignextend: + call address_32bit_prefix + jmp address_immediate_sib_store + address_eip_based: + mov al,67h + stos byte [edi] + address_rip_based: + cmp [code_type],64 + jne invalid_address + call store_instruction_code + jmp store_immediate_address + address_relative: + call store_instruction_code + movzx eax,[immediate_size] + add eax,edi + sub eax,[current_offset] + add eax,5 + sub edx,eax + jno @f + call recoverable_overflow + @@: + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + shr ecx,16 + xchg [value_type],cl + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + mov eax,edx + call mark_relocation + mov [value_type],cl + mov [symbol_identifier],ebx + stos dword [edi] + ret + addressing_16bit: + cmp edx,10000h + jge address_immediate_32bit + cmp edx,-8000h + jl address_immediate_32bit + movzx edx,dx + address_immediate_16bit: + call address_16bit_prefix + call store_instruction_code + mov al,110b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + ret + address_16bit_prefix: + cmp [code_type],16 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + ret + address_32bit_prefix: + cmp [code_type],32 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + instruction_prefix_ok: + ret +store_instruction_with_imm8: + mov [immediate_size],1 + call store_instruction + mov al,byte [value] + stos byte [edi] + ret +store_instruction_with_imm16: + mov [immediate_size],2 + call store_instruction + mov ax,word [value] + call mark_relocation + stos word [edi] + ret +store_instruction_with_imm32: + mov [immediate_size],4 + call store_instruction + mov eax,dword [value] + call mark_relocation + stos dword [edi] + ret diff --git a/fasmw172/TOOLS/DOS/LISTING.ASM b/fasmw172/TOOLS/DOS/LISTING.ASM new file mode 100644 index 0000000..b160732 --- /dev/null +++ b/fasmw172/TOOLS/DOS/LISTING.ASM @@ -0,0 +1,229 @@ + + format MZ + heap 0 + stack 8000h + entry loader:init + +include 'loader.inc' + +segment main use32 + + start: + + call get_params + jnc make_listing + + mov esi,_usage + call display_string + mov ax,4C02h + int 21h + + make_listing: + call listing + mov ax,4C00h + int 21h + + error: + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + mov ax,4C00h + int 21h + + get_params: + push ds + mov ds,[psp_selector] + mov esi,81h + mov edi,params + find_param: + lodsb + cmp al,20h + je find_param + cmp al,'-' + je option_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [es:input_file],0 + jne get_output_file + mov [es:input_file],edi + jmp process_param + get_output_file: + cmp [es:output_file],0 + jne bad_params + mov [es:output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + option_param: + lodsb + cmp al,'a' + je addresses_option + cmp al,'A' + je addresses_option + cmp al,'b' + je bytes_per_line_option + cmp al,'B' + je bytes_per_line_option + invalid_option: + pop ds + stc + ret + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc bad_params_value + cmp al,9 + ja bad_params_value + imul edx,10 + jo bad_params_value + add edx,eax + jc bad_params_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + bad_params_value: + stc + ret + bytes_per_line_option: + lodsb + cmp al,20h + je bytes_per_line_option + cmp al,0Dh + je invalid_option + or al,al + jz invalid_option + dec esi + call get_option_value + jc bad_params + or edx,edx + jz invalid_option + cmp edx,1000 + ja invalid_option + mov [es:code_bytes_per_line],edx + jmp find_param + addresses_option: + lodsb + cmp al,20h + je set_addresses_option + cmp al,0Dh + je set_addresses_option + or al,al + jnz bad_params + set_addresses_option: + dec esi + mov [es:show_addresses],1 + jmp find_param + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + xor al,al + stosb + pop ds + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + bad_params: + stc + ret + + include 'system.inc' + + include '..\listing.inc' + + _usage db 'listing generator for flat assembler',0Dh,0Ah + db 'usage: listing <input> <output>',0Dh,0Ah + db 'optional settings:',0Dh,0Ah + db ' -a show target addresses for assembled code',0Dh,0Ah + db ' -b <number> set the amount of bytes listed per line',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + + input_file dd 0 + output_file dd 0 + code_bytes_per_line dd 16 + show_addresses db 0 + + line_break db 0Dh,0Ah + + input dd ? + assembled_code dd ? + assembled_code_length dd ? + code_end dd ? + code_offset dd ? + code_length dd ? + output_handle dd ? + output_buffer dd ? + current_source_file dd ? + current_source_line dd ? + source dd ? + source_length dd ? + maximum_address_length dd ? + address_start dd ? + last_listed_address dd ? + + psp_selector dw ? + environment_selector dw ? + + memory_handles_count dd ? + memory_handles rd 400h + + params rb 1000h + characters rb 100h + +segment buffer_segment + + buffer = (buffer_segment-main) shl 4 + + db 1000h dup ? + +segment stack_segment + + stack_bottom = (stack_segment-main) shl 4 + + db 4000h dup ? + + stack_top = stack_bottom + $ diff --git a/fasmw172/TOOLS/DOS/LOADER.INC b/fasmw172/TOOLS/DOS/LOADER.INC new file mode 100644 index 0000000..933c918 --- /dev/null +++ b/fasmw172/TOOLS/DOS/LOADER.INC @@ -0,0 +1,102 @@ + +segment loader use16 + +init: + + mov ax,1687h + int 2Fh + or ax,ax ; DPMI installed? + jnz short no_dpmi + test bl,1 ; 32-bit programs supported? + jz short no_dpmi + mov word [cs:mode_switch],di + mov word [cs:mode_switch+2],es + mov bx,si ; allocate memory for DPMI data + mov ah,48h + int 21h + jnc init_protected_mode + init_failed: + call init_error + db 'error: DPMI initialization failed.',0Dh,0Ah,0 + no_dpmi: + call init_error + db 'error: 32-bit DPMI services are not available.',0Dh,0Ah,0 + init_error: + pop si + push cs + pop ds + display_error: + lodsb + test al,al + jz short error_finish + mov dl,al + mov ah,2 + int 21h + jmp short display_error + error_finish: + mov ax,4CFFh + int 21h + init_protected_mode: + mov es,ax + mov ds,[ds:2Ch] + mov ax,1 + call far [cs:mode_switch] ; switch to protected mode + jc init_failed + mov cx,1 + xor ax,ax + int 31h ; allocate descriptor for code + jc init_failed + mov si,ax + xor ax,ax + int 31h ; allocate descriptor for data + jc init_failed + mov di,ax + mov dx,cs + lar cx,dx + shr cx,8 + or cx,0C000h + mov bx,si + mov ax,9 + int 31h ; set code descriptor access rights + jc init_failed + mov dx,ds + lar cx,dx + shr cx,8 + or cx,0C000h + mov bx,di + int 31h ; set data descriptor access rights + jc init_failed + mov ecx,main + shl ecx,4 + mov dx,cx + shr ecx,16 + mov ax,7 + int 31h ; set data descriptor base address + jc init_failed + mov bx,si + int 31h ; set code descriptor base address + jc init_failed + mov cx,0FFFFh + mov dx,0FFFFh + mov ax,8 ; set segment limit to 4 GB + int 31h + jc init_failed + mov bx,di + int 31h + jc init_failed + mov ax,ds + mov ds,di + mov [psp_selector],es + mov [environment_selector],ax + cli + mov ss,di + mov esp,stack_top + sti + mov es,di + xor eax,eax + mov [memory_handles_count],eax + push si + push start + retf + + mode_switch dd ? diff --git a/fasmw172/TOOLS/DOS/PREPSRC.ASM b/fasmw172/TOOLS/DOS/PREPSRC.ASM new file mode 100644 index 0000000..aa0d654 --- /dev/null +++ b/fasmw172/TOOLS/DOS/PREPSRC.ASM @@ -0,0 +1,136 @@ + + format MZ + heap 0 + stack 8000h + entry loader:init + +include 'loader.inc' + +segment main use32 + + start: + + call get_params + jnc make_dump + + mov esi,_usage + call display_string + mov ax,4C02h + int 21h + + make_dump: + call preprocessed_source + mov ax,4C00h + int 21h + + error: + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + mov ax,4C00h + int 21h + + get_params: + push ds + mov ds,[psp_selector] + mov esi,81h + mov edi,params + find_param: + lodsb + cmp al,20h + je find_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [es:input_file],0 + jne get_output_file + mov [es:input_file],edi + jmp process_param + get_output_file: + cmp [es:output_file],0 + jne bad_params + mov [es:output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + bad_params_value: + stc + ret + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + xor al,al + stosb + pop ds + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + bad_params: + stc + ret + + include 'system.inc' + + include '..\prepsrc.inc' + + _usage db 'preprocessed source dumper for flat assembler',0Dh,0Ah + db 'usage: prepsrc <input> <output>',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + + input_file dd 0 + output_file dd 0 + + psp_selector dw ? + environment_selector dw ? + + memory_handles_count dd ? + memory_handles rd 400h + + params rb 1000h + +segment buffer_segment + + buffer = (buffer_segment-main) shl 4 + + db 1000h dup ? + +segment stack_segment + + stack_bottom = (stack_segment-main) shl 4 + + db 4000h dup ? + + stack_top = stack_bottom + $ diff --git a/fasmw172/TOOLS/DOS/SYMBOLS.ASM b/fasmw172/TOOLS/DOS/SYMBOLS.ASM new file mode 100644 index 0000000..0b96961 --- /dev/null +++ b/fasmw172/TOOLS/DOS/SYMBOLS.ASM @@ -0,0 +1,140 @@ + + format MZ + heap 0 + stack 8000h + entry loader:init + +include 'loader.inc' + +segment main use32 + + start: + + call get_params + jnc make_dump + + mov esi,_usage + call display_string + mov ax,4C02h + int 21h + + make_dump: + call symbols + mov ax,4C00h + int 21h + + error: + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + mov ax,4C00h + int 21h + + get_params: + push ds + mov ds,[psp_selector] + mov esi,81h + mov edi,params + find_param: + lodsb + cmp al,20h + je find_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [es:input_file],0 + jne get_output_file + mov [es:input_file],edi + jmp process_param + get_output_file: + cmp [es:output_file],0 + jne bad_params + mov [es:output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + bad_params_value: + stc + ret + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + xor al,al + stosb + pop ds + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + bad_params: + stc + ret + + include 'system.inc' + + include '..\symbols.inc' + + _usage db 'symbols dumper for flat assembler',0Dh,0Ah + db 'usage: symbols <input> <output>',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + + input_file dd 0 + output_file dd 0 + + input dd ? + output_buffer dd ? + output_handle dd ? + + psp_selector dw ? + environment_selector dw ? + + memory_handles_count dd ? + memory_handles rd 400h + + params rb 1000h + +segment buffer_segment + + buffer = (buffer_segment-main) shl 4 + + db 1000h dup ? + +segment stack_segment + + stack_bottom = (stack_segment-main) shl 4 + + db 4000h dup ? + + stack_top = stack_bottom + $ diff --git a/fasmw172/TOOLS/DOS/SYSTEM.INC b/fasmw172/TOOLS/DOS/SYSTEM.INC new file mode 100644 index 0000000..67eb63f --- /dev/null +++ b/fasmw172/TOOLS/DOS/SYSTEM.INC @@ -0,0 +1,239 @@ + +display_string: + lods byte [esi] + or al,al + jz string_end + mov dl,al + mov ah,2 + int 21h + jmp display_string + string_end: + ret +alloc: + push ebx esi edi + mov cx,ax + shr eax,16 + mov bx,ax + mov ax,501h + int 31h + jc dpmi_allocation_failed + mov ax,bx + shl eax,16 + mov ax,cx + mov edx,main + shl edx,4 + sub eax,edx + mov bx,si + shl ebx,16 + mov bx,di + mov ecx,[memory_handles_count] + inc [memory_handles_count] + shl ecx,3 + add ecx,memory_handles + mov [ecx],eax + mov [ecx+4],ebx + pop edi esi ebx + clc + ret + dpmi_allocation_failed: + pop edi esi ebx + stc + ret +free: + push ebx esi edi + mov esi,memory_handles + mov ecx,[memory_handles_count] + find_memory_handle: + cmp eax,[esi] + je memory_handle_found + add esi,8 + loop find_memory_handle + pop edi esi + ret + memory_handle_found: + mov ebx,[esi+4] + dec [memory_handles_count] + dec ecx + jz free_memory + remove_memory_handle: + mov edx,[esi+8] + mov edi,[esi+8+4] + mov [esi],edx + mov [esi+4],edi + add esi,8 + loop remove_memory_handle + free_memory: + mov esi,ebx + shr esi,16 + mov di,bx + mov ax,502h + int 31h + pop edi esi ebx + ret +open: + push esi edi ebp + call adapt_path + mov ax,716Ch + mov bx,100000b + mov dx,1 + xor cx,cx + xor si,si + call dos_int + jnc open_done + cmp ax,7100h + je old_open + stc + jmp open_done + old_open: + mov ax,3D00h + xor dx,dx + call dos_int + open_done: + mov bx,ax + pop ebp edi esi + ret + adapt_path: + mov esi,edx + mov edi,buffer + copy_path: + lodsb + cmp al,'/' + jne path_char_ok + mov al,'\' + path_char_ok: + stosb + or al,al + jnz copy_path + ret + dos_int: + push 0 0 0 + pushw buffer_segment buffer_segment + stc + pushfw + push eax + push ecx + push edx + push ebx + push 0 + push ebp + push esi + push edi + mov ax,300h + mov bx,21h + xor cx,cx + mov edi,esp + push es ss + pop es + int 31h + pop es + mov edi,[esp] + mov esi,[esp+4] + mov ebp,[esp+8] + mov ebx,[esp+10h] + mov edx,[esp+14h] + mov ecx,[esp+18h] + mov ah,[esp+20h] + add esp,32h + sahf + mov eax,[esp-32h+1Ch] + ret +create: + push esi edi ebp + call adapt_path + mov ax,716Ch + mov bx,100001b + mov dx,10010b + xor cx,cx + xor si,si + xor di,di + call dos_int + jnc create_done + cmp ax,7100h + je old_create + stc + jmp create_done + old_create: + mov ah,3Ch + xor cx,cx + xor dx,dx + call dos_int + create_done: + mov bx,ax + pop ebp edi esi + ret +write: + push edx esi edi ebp + mov ebp,ecx + mov esi,edx + write_loop: + mov ecx,1000h + sub ebp,1000h + jnc do_write + add ebp,1000h + mov ecx,ebp + xor ebp,ebp + do_write: + push ecx + mov edi,buffer + shr ecx,2 + rep movsd + mov ecx,[esp] + and ecx,11b + rep movsb + pop ecx + mov ah,40h + xor dx,dx + call dos_int + or ebp,ebp + jnz write_loop + pop ebp edi esi edx + ret +read: + push edx esi edi ebp + mov ebp,ecx + mov edi,edx + read_loop: + mov ecx,1000h + sub ebp,1000h + jnc do_read + add ebp,1000h + mov ecx,ebp + xor ebp,ebp + do_read: + push ecx + mov ah,3Fh + xor dx,dx + call dos_int + cmp ax,cx + jne eof + mov esi,buffer + mov ecx,[esp] + shr ecx,2 + rep movsd + pop ecx + and ecx,11b + rep movsb + or ebp,ebp + jnz read_loop + read_done: + pop ebp edi esi edx + ret + eof: + pop ecx + stc + jmp read_done +close: + mov ah,3Eh + int 21h + ret +lseek: + mov ah,42h + mov ecx,edx + shr ecx,16 + int 21h + pushf + shl edx,16 + popf + mov dx,ax + mov eax,edx + ret diff --git a/fasmw172/TOOLS/LIBC/CCALL.INC b/fasmw172/TOOLS/LIBC/CCALL.INC new file mode 100644 index 0000000..cf9f826 --- /dev/null +++ b/fasmw172/TOOLS/LIBC/CCALL.INC @@ -0,0 +1,23 @@ + +macro ccall proc,[arg] + { common + push ebp + mov ebp,esp + local size + size = 0 + if ~ arg eq + forward + size = size + 4 + common + sub esp,size + end if + and esp,-16 + if ~ arg eq + add esp,size + reverse + pushd arg + common + end if + call proc + leave } + diff --git a/fasmw172/TOOLS/LIBC/LISTING.ASM b/fasmw172/TOOLS/LIBC/LISTING.ASM new file mode 100644 index 0000000..2075153 --- /dev/null +++ b/fasmw172/TOOLS/LIBC/LISTING.ASM @@ -0,0 +1,177 @@ + + format ELF + public main + +include 'ccall.inc' + +section '.text' executable align 16 + + main: + mov ecx,[esp+4] + mov [argc],ecx + mov ebx,[esp+8] + mov [argv],ebx + + mov [display_handle],1 + + call get_params + jnc make_listing + + mov esi,_usage + call display_string + ccall exit,2 + + make_listing: + call listing + ccall exit,0 + + error: + mov [display_handle],2 + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + ccall exit,0 + + get_params: + mov ecx,[argc] + mov ebx,[argv] + add ebx,4 + dec ecx + jz bad_params + get_param: + mov esi,[ebx] + mov al,[esi] + cmp al,'-' + je option_param + cmp [input_file],0 + jne get_output_file + mov [input_file],esi + jmp next_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],esi + jmp next_param + option_param: + inc esi + lodsb + cmp al,'a' + je addresses_option + cmp al,'A' + je addresses_option + cmp al,'b' + je bytes_per_line_option + cmp al,'B' + je bytes_per_line_option + bad_params: + stc + ret + addresses_option: + cmp byte [esi],0 + jne bad_params + mov [show_addresses],1 + jmp next_param + bytes_per_line_option: + cmp byte [esi],0 + jne get_bytes_per_line_setting + dec ecx + jz bad_params + add ebx,4 + mov esi,[ebx] + get_bytes_per_line_setting: + call get_option_value + or edx,edx + jz bad_params + cmp edx,1000 + ja bad_params + mov [code_bytes_per_line],edx + next_param: + add ebx,4 + dec ecx + jnz get_param + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + invalid_option_value: + stc + ret + + include 'system.inc' + + include '..\listing.inc' + +section '.data' writeable align 4 + + input_file dd 0 + output_file dd 0 + code_bytes_per_line dd 16 + show_addresses db 0 + + line_break db 0Dh,0Ah + + _usage db 'listing generator for flat assembler',0Dh,0Ah + db 'usage: listing <input> <output>',0Dh,0Ah + db 'optional settings:',0Dh,0Ah + db ' -a show target addresses for assembled code',0Dh,0Ah + db ' -b <number> set the amount of bytes listed per line',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + +section '.bss' writeable align 4 + + argc dd ? + argv dd ? + + input dd ? + assembled_code dd ? + assembled_code_length dd ? + code_end dd ? + code_offset dd ? + code_length dd ? + output_handle dd ? + output_buffer dd ? + current_source_file dd ? + current_source_line dd ? + source dd ? + source_length dd ? + maximum_address_length dd ? + address_start dd ? + last_listed_address dd ? + + display_handle dd ? + character db ? + + params rb 1000h + characters rb 100h + buffer rb 1000h diff --git a/fasmw172/TOOLS/LIBC/PREPSRC.ASM b/fasmw172/TOOLS/LIBC/PREPSRC.ASM new file mode 100644 index 0000000..2ccaca5 --- /dev/null +++ b/fasmw172/TOOLS/LIBC/PREPSRC.ASM @@ -0,0 +1,94 @@ + + format ELF + public main + +include 'ccall.inc' + +section '.text' executable align 16 + + main: + mov ecx,[esp+4] + mov [argc],ecx + mov ebx,[esp+8] + mov [argv],ebx + + mov [display_handle],1 + + call get_params + jnc make_dump + + mov esi,_usage + call display_string + ccall exit,2 + + make_dump: + call preprocessed_source + ccall exit,0 + + error: + mov [display_handle],2 + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + ccall exit,0 + + get_params: + mov ecx,[argc] + mov ebx,[argv] + add ebx,4 + dec ecx + jz bad_params + get_param: + mov esi,[ebx] + mov al,[esi] + cmp [input_file],0 + jne get_output_file + mov [input_file],esi + jmp next_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],esi + jmp next_param + bad_params: + stc + ret + next_param: + add ebx,4 + dec ecx + jnz get_param + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + + include 'system.inc' + + include '..\prepsrc.inc' + +section '.data' writeable align 4 + + input_file dd 0 + output_file dd 0 + + _usage db 'preprocessed source dumper for flat assembler',0Dh,0Ah + db 'usage: prepsrc <input> <output>',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + +section '.bss' writeable align 4 + + argc dd ? + argv dd ? + + display_handle dd ? + character db ? + + params rb 1000h + buffer rb 1000h diff --git a/fasmw172/TOOLS/LIBC/SYMBOLS.ASM b/fasmw172/TOOLS/LIBC/SYMBOLS.ASM new file mode 100644 index 0000000..1d33265 --- /dev/null +++ b/fasmw172/TOOLS/LIBC/SYMBOLS.ASM @@ -0,0 +1,98 @@ + + format ELF + public main + +include 'ccall.inc' + +section '.text' executable align 16 + + main: + mov ecx,[esp+4] + mov [argc],ecx + mov ebx,[esp+8] + mov [argv],ebx + + mov [display_handle],1 + + call get_params + jnc make_dump + + mov esi,_usage + call display_string + ccall exit,2 + + make_dump: + call symbols + ccall exit,0 + + error: + mov [display_handle],2 + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + ccall exit,0 + + get_params: + mov ecx,[argc] + mov ebx,[argv] + add ebx,4 + dec ecx + jz bad_params + get_param: + mov esi,[ebx] + mov al,[esi] + cmp [input_file],0 + jne get_output_file + mov [input_file],esi + jmp next_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],esi + jmp next_param + bad_params: + stc + ret + next_param: + add ebx,4 + dec ecx + jnz get_param + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + + include 'system.inc' + + include '..\symbols.inc' + +section '.data' writeable align 4 + + input_file dd 0 + output_file dd 0 + + _usage db 'symbols dumper for flat assembler',0Dh,0Ah + db 'usage: symbols <input> <output>',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + +section '.bss' writeable align 4 + + input dd ? + output_buffer dd ? + output_handle dd ? + + argc dd ? + argv dd ? + + display_handle dd ? + character db ? + + params rb 1000h + buffer rb 1000h diff --git a/fasmw172/TOOLS/LIBC/SYSTEM.INC b/fasmw172/TOOLS/LIBC/SYSTEM.INC new file mode 100644 index 0000000..8252fbd --- /dev/null +++ b/fasmw172/TOOLS/LIBC/SYSTEM.INC @@ -0,0 +1,107 @@ + +extrn malloc +extrn getenv +extrn fopen +extrn fclose +extrn fread +extrn fwrite +extrn fseek +extrn ftell +extrn time +extrn exit +extrn 'free' as libc_free +extrn 'write' as libc_write + +alloc: + ccall malloc,eax + test eax,eax + jz allocation_failed + clc + ret + allocation_failed: + stc + ret +free: + ccall libc_free,eax + ret +display_string: + lodsb + or al,al + jz string_displayed + mov dl,al + call display_character + jmp display_string + string_displayed: + ret + display_character: + mov [character],dl + ccall libc_write,[display_handle],character,1 + ret +open: + push esi edi ebp + call adapt_path + ccall fopen,buffer,open_mode + pop ebp edi esi + or eax,eax + jz file_error + mov ebx,eax + clc + ret + adapt_path: + mov esi,edx + mov edi,buffer + copy_path: + lods byte [esi] + cmp al,'\' + jne path_char_ok + mov al,'/' + path_char_ok: + stos byte [edi] + or al,al + jnz copy_path + cmp edi,buffer+1000h + ja not_enough_memory + ret +create: + push esi edi ebp + call adapt_path + ccall fopen,buffer,create_mode + pop ebp edi esi + or eax,eax + jz file_error + mov ebx,eax + clc + ret +close: + ccall fclose,ebx + ret +read: + push ebx ecx edx esi edi + ccall fread,edx,1,ecx,ebx + pop edi esi edx ecx ebx + cmp eax,ecx + jne file_error + clc + ret + file_error: + stc + ret +write: + push ebx ecx edx esi edi + ccall fwrite,edx,1,ecx,ebx + pop edi esi edx ecx ebx + cmp eax,ecx + jne file_error + clc + ret +lseek: + push ebx + movzx eax,al + ccall fseek,ebx,edx,eax + mov ebx,[esp] + ccall ftell,ebx + pop ebx + ret + +open_mode db 'r',0 +create_mode db 'w',0 diff --git a/fasmw172/TOOLS/LISTING.INC b/fasmw172/TOOLS/LISTING.INC new file mode 100644 index 0000000..d301639 --- /dev/null +++ b/fasmw172/TOOLS/LISTING.INC @@ -0,0 +1,690 @@ + +listing: + mov edx,[input_file] + call open + jc input_not_found + call load_file + mov [input],eax + cmp ecx,38h + jb invalid_input + cmp dword [eax],1A736166h + jne invalid_input + cmp dword [eax+44],0 + je incomplete_input + add [eax+16],eax + add [eax+24],eax + add [eax+32],eax + add [eax+40],eax + add [eax+48],eax + mov edx,[eax+16] + add [eax+8],edx + add [eax+12],edx + mov edx,[eax+12] + call open + jc code_not_found + call load_file + mov [assembled_code],eax + mov [assembled_code_length],ecx + call close + mov [maximum_address_length],0 + mov ebx,[input] + mov esi,[ebx+40] + lea ebp,[esi-4] + add ebp,[ebx+44] + get_offsets_for_lines: + cmp esi,ebp + je offsets_prepared + mov edx,[esi+4] + add edx,[ebx+32] + find_line_loaded_from_source: + test byte [edx+7],1 shl 7 + jz store_offset_in_line + mov edx,[edx+8] + add edx,[ebx+32] + jmp find_line_loaded_from_source + store_offset_in_line: + cmp dword [edx+12],0 + jne get_next_offset + mov [edx+12],esi + movzx ecx,byte [esi+27] + and cl,1 + mov edi,[esi+20] + test edi,edi + jz base_name_length_ok + xor ecx,ecx + btr edi,31 + jc count_base_name_characters + dec edi + shl edi,2 + add edi,[ebx+48] + mov edi,[edi] + count_base_name_characters: + mov ecx,[ebx+20] + sub ecx,edi + add edi,[ebx+16] + mov edx,edi + xor al,al + repne scasb + mov ecx,edi + sub ecx,edx + base_name_length_ok: + cmp byte [esi+18],1 + jb first_register_length_ok + ja first_register_with_scale + add ecx,5 + jmp first_register_length_ok + first_register_with_scale: + add ecx,5+3 + first_register_length_ok: + cmp byte [esi+19],1 + jb second_register_length_ok + ja second_register_with_scale + add ecx,5 + jmp second_register_length_ok + second_register_with_scale: + add ecx,5+3 + second_register_length_ok: + cmp ecx,[maximum_address_length] + jb get_next_offset + mov [maximum_address_length],ecx + get_next_offset: + add esi,28 + jmp get_offsets_for_lines + offsets_prepared: + mov eax,[esi] + mov [code_end],eax + add [maximum_address_length],19 + mov edi,characters + xor al,al + make_characters_table: + stosb + inc al + jnz make_characters_table + mov edi,characters + mov esi,symbol_characters+1 + movzx ecx,byte [esi-1] + xor eax,eax + mark_symbol_characters: + lodsb + mov byte [edi+eax],0 + loop mark_symbol_characters + mov eax,[code_bytes_per_line] + imul eax,3 + add eax,[maximum_address_length] + add eax,18 + call alloc + jc not_enough_memory + mov [output_buffer],eax + mov esi,[ebx+32] + mov ebp,esi + add ebp,[ebx+36] + mov edx,[output_file] + call create + jc writing_error + mov [output_handle],ebx + xor eax,eax + mov [current_source_file],eax + mov [last_listed_address],eax + mov [code_length],eax + generate_listing: + cmp esi,ebp + jae listing_done + mov edi,[output_buffer] + test byte [esi+7],1 shl 7 + jnz next_line + mov ebx,[esi+12] + test ebx,ebx + jz no_code_listing + test byte [ebx+26],11b + jnz no_code_listing + push esi + mov edx,[esi] + mov ecx,[esi+4] + find_next_code_point: + add esi,16 + call skip_preprocessed_line + cmp esi,ebp + je last_code_point + cmp edx,[esi] + jne next_line_ok + cmp ecx,[esi+4] + je find_next_code_point + next_line_ok: + test byte [esi+7],1 shl 7 + jnz find_next_code_point + mov eax,[esi+12] + test eax,eax + jz find_next_code_point + test byte [eax+26],11b + jnz find_next_code_point + mov eax,[eax] + jmp calculate_code_length + last_code_point: + mov eax,[code_end] + calculate_code_length: + pop esi + mov edx,[ebx] + sub eax,edx + jz no_code_listing + mov [code_length],eax + mov [code_offset],edx + add eax,edx + cmp eax,[assembled_code_length] + jbe write_file_offset + mov [code_length],0 + write_file_offset: + call write_hex_dword + mov ax,': ' + stosw + call list_address + call list_code + jmp code_listing_ok + no_code_listing: + mov al,20h + mov ecx,8+2 + rep stosb + call list_address + mov ecx,[code_bytes_per_line] + imul ecx,3 + mov al,20h + rep stosb + code_listing_ok: + call write_listing_data + mov eax,[input] + mov edx,[esi] + test edx,edx + jz main_source_file + add edx,[eax+32] + jmp source_name_ok + main_source_file: + mov edx,[eax+8] + source_name_ok: + cmp edx,[current_source_file] + je source_loaded + push ebx + push edx + call open + jc source_not_found + pop eax + xchg eax,[current_source_file] + test eax,eax + jz load_source + mov eax,[source] + call free + load_source: + call load_file + mov [source],eax + mov [source_length],ecx + call close + pop ebx + source_loaded: + mov eax,[source] + add eax,[esi+8] + mov [current_source_line],eax + push esi ebp + call write_source_line + pop ebp esi + write_supplemental_rows: + mov eax,[code_length] + or eax,[current_source_line] + jz next_line + mov edi,[output_buffer] + mov ecx,8+2 + movzx eax,[show_addresses] + imul eax,[maximum_address_length] + add ecx,eax + mov al,20h + rep stosb + call list_code + call write_listing_data + push esi ebp + call write_source_line + pop ebp esi + jmp write_supplemental_rows + next_line: + mov edx,[esi] + mov ecx,[esi+4] + find_next_line: + add esi,16 + call skip_preprocessed_line + cmp edx,[esi] + jne generate_listing + cmp ecx,[esi+4] + jne generate_listing + jmp find_next_line + list_address: + cmp [show_addresses],0 + je address_ok + mov [address_start],edi + mov eax,[esi+12] + test eax,eax + jz address_finished + cmp [last_listed_address],0 + je make_address + push esi edi + lea esi,[eax+8] + mov edi,[last_listed_address] + mov ecx,17 + repe cmpsb + pop edi esi + je address_finished + make_address: + mov ebx,[esi+12] + lea eax,[ebx+8] + mov [last_listed_address],eax + mov al,'[' + stosb + mov edx,[ebx+20] + test edx,edx + jz write_main_address + push esi + mov esi,edx + mov eax,[input] + btr esi,31 + jc base_name_ready + dec esi + shl esi,2 + add esi,[eax+48] + mov esi,[esi] + base_name_ready: + add esi,[eax+16] + copy_section_name: + lodsb + test al,al + jz section_name_ok + stosb + jmp copy_section_name + section_name_ok: + pop esi + mov al,':' + test edx,80000000h + jz address_separator_ok + cmp byte [ebx+27],0 + jne address_separator_ok + mov al,'+' + address_separator_ok: + stosb + write_main_address: + cmp byte [ebx+27],0 + jne write_negative_address + mov edx,[ebx+8+4] + call write_hex_dword + mov edx,[ebx+8] + call write_hex_dword + jmp write_address_registers + write_negative_address: + mov al,'-' + stosb + mov eax,[ebx+8] + mov edx,[ebx+8+4] + not eax + not edx + add eax,1 + adc edx,0 + push eax + call write_hex_dword + pop edx + call write_hex_dword + write_address_registers: + mov dl,[ebx+16] + mov dh,[ebx+18] + call address_register + mov dl,[ebx+17] + mov dh,[ebx+19] + call address_register + mov ax,']' + stosb + address_finished: + mov ecx,[maximum_address_length] + sub ecx,edi + add ecx,[address_start] + mov al,20h + rep stosb + address_ok: + ret + address_register: + cmp dh,0 + je register_ok + jl negative_register + mov al,'+' + jmp register_sign_ok + negative_register: + mov al,'-' + register_sign_ok: + stosb + push esi + mov esi,address_registers + find_register: + lodsb + test al,al + jz register_found + cmp al,dl + je register_found + cmp dl,[esi] + je register_found + lodsb + movzx eax,al + add esi,eax + jmp find_register + register_found: + lodsb + movzx ecx,al + rep movsb + pop esi + cmp dh,1 + je register_ok + mov al,'*' + stosb + test dh,0F0h + jz first_scale_digit_ok + mov al,dh + shr al,4 + cmp al,10 + sbb al,69h + das + stosb + first_scale_digit_ok: + mov al,dh + and al,1111b + cmp al,10 + sbb al,69h + das + stosb + register_ok: + ret + list_code: + mov ecx,[code_length] + cmp ecx,[code_bytes_per_line] + jb code_bytes_count_ready + mov ecx,[code_bytes_per_line] + code_bytes_count_ready: + sub [code_length],ecx + mov edx,[code_offset] + add [code_offset],ecx + jecxz code_bytes_ok + push ecx + add edx,[assembled_code] + list_code_bytes: + mov al,[edx] + and al,1111b + cmp al,10 + sbb al,69h + das + mov ah,al + mov al,[edx] + shr al,4 + cmp al,10 + sbb al,69h + das + stosw + mov al,20h + stosb + inc edx + loop list_code_bytes + pop ecx + code_bytes_ok: + neg ecx + add ecx,[code_bytes_per_line] + imul ecx,3 + mov al,20h + rep stosb + ret + write_listing_data: + mov ecx,[output_buffer] + sub ecx,edi + and ecx,111b + mov al,20h + rep stosb + mov edx,[output_buffer] + mov ecx,edi + sub ecx,edx + mov ebx,[output_handle] + call write + jc writing_error + ret + write_source_line: + mov esi,[current_source_line] + test esi,esi + je write_line_break + mov ebp,[source_length] + add ebp,[source] + mov ebx,characters + xor cl,cl + start_cutting: + xor dl,dl + cut_source_line: + cmp esi,ebp + je end_of_file + lodsb + cmp al,0Dh + je cr_character + cmp al,0Ah + je lf_character + cmp al,1Ah + je end_of_line + or al,al + jz end_of_line + cmp dl,3Bh + je cut_source_line + cmp al,3Bh + je start_special_block + cmp dl,22h + je inside_string + cmp dl,27h + je inside_string + cmp al,'\' + je check_for_line_continuation + xlatb + test al,al + jz start_cutting + cmp dl,0FFh + je cut_source_line + cmp al,22h + je start_special_block + cmp al,27h + je start_special_block + mov dl,0FFh + jmp cut_source_line + start_special_block: + mov dl,al + jmp cut_source_line + inside_string: + cmp al,dl + jne cut_source_line + jmp start_cutting + check_for_line_continuation: + or cl,0FFh + cmp esi,ebp + je end_of_file + mov al,[esi] + cmp al,20h + je start_cutting + cmp al,0Dh + je start_cutting + cmp al,0Ah + je start_cutting + cmp al,3Bh + je start_cutting + xor cl,cl + jmp start_cutting + cr_character: + mov edx,esi + mov word [line_break],0Dh + cmp esi,ebp + je line_with_break + mov al,[esi] + cmp al,0Ah + jne line_with_break + inc edx + mov [line_break+1],al + jmp line_with_break + lf_character: + mov edx,esi + mov word [line_break],0Ah + cmp esi,ebp + je line_with_break + mov al,[esi] + cmp al,0Dh + jne line_with_break + inc edx + mov [line_break+1],al + line_with_break: + dec esi + jmp write_line + end_of_line: + dec esi + end_of_file: + mov edx,esi + write_line: + cmp cl,0FFh + je continued_line + xor edx,edx + continued_line: + xchg edx,[current_source_line] + mov ecx,esi + sub ecx,edx + mov ebx,[output_handle] + call write + jc writing_error + write_line_break: + mov edx,line_break + mov ecx,2 + cmp [line_break+1],0 + jne line_break_size_ok + dec ecx + line_break_size_ok: + call write + jc writing_error + ret + listing_done: + mov ebx,[output_handle] + call close + ret + +load_file: + push ebx + mov al,2 + xor edx,edx + call lseek + test eax,eax + jz empty_file + push eax + call alloc + jc not_enough_memory + push eax + xor al,al + xor edx,edx + call lseek + mov ecx,[esp+4] + mov edx,[esp] + call read + jc reading_error + pop eax ecx + pop ebx + ret + empty_file: + pop ebx + mov ecx,eax + ret + +write_hex_dword: + mov ecx,8 + write_hex_digits: + xor al,al + shld eax,edx,4 + cmp al,10 + sbb al,69h + das + stosb + shl edx,4 + loop write_hex_digits + ret + +skip_preprocessed_line: + lods byte [esi] + cmp al,1Ah + je skip_preprocessed_symbol + cmp al,3Bh + je skip_preprocessed_symbol + cmp al,22h + je skip_preprocessed_string + or al,al + jnz skip_preprocessed_line + ret + skip_preprocessed_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_preprocessed_line + skip_preprocessed_string: + lods dword [esi] + add esi,eax + jmp skip_preprocessed_line + + +not_enough_memory: + call error + db 'not enough memory to load the required data',0 +input_not_found: + call error + db 'the input file was not found',0 +code_not_found: + call error + db 'the assembled file was not found',0 +source_not_found: + call error + db 'could not find some of the source files',0 +reading_error: + call error + db 'some error occured while trying to read file',0 +writing_error: + call error + db 'some error occured while trying to write file',0 +invalid_input: + call error + db 'input file is not a recognized assembly information format',0 +incomplete_input: + call error + db 'input file does not contain an assembly dump',0 + +symbol_characters db 27, 9,0Ah,0Dh,1Ah,20h,'+-/*=<>()[]{}:,|&~#`;\' + +address_registers db 23h,2,'bx' + db 25h,2,'bp' + db 26h,2,'si' + db 27h,2,'di' + db 40h,3,'eax' + db 41h,3,'ecx' + db 42h,3,'edx' + db 43h,3,'ebx' + db 44h,3,'esp' + db 45h,3,'ebp' + db 46h,3,'esi' + db 47h,3,'edi' + db 48h,3,'r8d' + db 49h,3,'r9d' + db 4Ah,4,'r10d' + db 4Bh,4,'r11d' + db 4Ch,4,'r12d' + db 4Dh,4,'r13d' + db 4Eh,4,'r14d' + db 4Fh,4,'r15d' + db 80h,3,'rax' + db 81h,3,'rcx' + db 82h,3,'rdx' + db 83h,3,'rbx' + db 84h,3,'rsp' + db 85h,3,'rbp' + db 86h,3,'rsi' + db 87h,3,'rdi' + db 88h,2,'r8' + db 89h,2,'r9' + db 8Ah,3,'r10' + db 8Bh,3,'r11' + db 8Ch,3,'r12' + db 8Dh,3,'r13' + db 8Eh,3,'r14' + db 8Fh,3,'r15' + db 0F4h,3,'eip' + db 0F8h,3,'rip' + db 0,1,'?' diff --git a/fasmw172/TOOLS/PREPSRC.INC b/fasmw172/TOOLS/PREPSRC.INC new file mode 100644 index 0000000..fb9e1c7 --- /dev/null +++ b/fasmw172/TOOLS/PREPSRC.INC @@ -0,0 +1,115 @@ + +preprocessed_source: + mov edx,[input_file] + call open + jc input_not_found + mov al,2 + xor edx,edx + call lseek + cmp eax,30h + jb invalid_input + push eax + call alloc + jc not_enough_memory + push eax + xor al,al + xor edx,edx + call lseek + mov ecx,[esp+4] + mov edx,[esp] + call read + jc reading_error + pop eax ecx + cmp dword [eax],1A736166h + jne invalid_input + mov esi,[eax+32] + add esi,eax + mov ebp,[eax+36] + add ebp,esi + mov edi,eax + push eax + preprocessed_to_text: + cmp esi,ebp + jae conversion_done + add esi,16 + xor dl,dl + convert_preprocessed_line: + lodsb + cmp al,1Ah + je copy_symbol + cmp al,22h + je copy_symbol + cmp al,3Bh + je preprocessor_symbols + or al,al + jz line_converted + stosb + xor dl,dl + jmp convert_preprocessed_line + copy_symbol: + or dl,dl + jz space_ok + mov byte [edi],20h + inc edi + space_ok: + cmp al,22h + je quoted + lodsb + movzx ecx,al + rep movsb + or dl,-1 + jmp convert_preprocessed_line + quoted: + mov al,27h + stosb + lodsd + mov ecx,eax + jecxz quoted_copied + copy_quoted: + lodsb + stosb + cmp al,27h + jne quote_ok + stosb + quote_ok: + loop copy_quoted + quoted_copied: + mov al,27h + stosb + or dl,-1 + jmp convert_preprocessed_line + preprocessor_symbols: + mov al,3Bh + stosb + jmp copy_symbol + line_converted: + mov ax,0A0Dh + stosw + jmp preprocessed_to_text + conversion_done: + mov edx,[output_file] + call create + jc writing_error + pop edx + mov ecx,edi + sub ecx,edx + call write + jc writing_error + call close + ret + +not_enough_memory: + call error + db 'not enough memory to load the required data',0 +input_not_found: + call error + db 'the input file was not found',0 +reading_error: + call error + db 'some error occured while trying to read file',0 +writing_error: + call error + db 'some error occured while trying to write file',0 +invalid_input: + call error + db 'input file is not a recognized assembly information format',0 diff --git a/fasmw172/TOOLS/README.TXT b/fasmw172/TOOLS/README.TXT new file mode 100644 index 0000000..5932121 --- /dev/null +++ b/fasmw172/TOOLS/README.TXT @@ -0,0 +1,26 @@ + +This directory contains some tools, which extract various types of information +from the symbolic information file generated by flat assembler, and present +them in a human-readable form. + +The listing tool creates a listing of assembled code - this tool needs to be +executed in the exact configuration, in which the assembly was taking place. +All the source files and the output file aswell must not have been moved or +modified - if any of them was altered before generating the listing, it is +going to contain garbage instead of useful information. For example, if you +assembled the file with the command like: + + fasm example.asm example.exe -s example.fas + +you should generate listing by immediately running this command from the same +directory: + + listing example.fas example.lst + +In addition, the "-a" switch is recommended to use in the case of executable +formats, as it allows to get the run-time addresses for all the assembled code +and data. + +The preprocessed source and symbols dump tools are simpler ones - they only +need the symbolic information file as input and generate proper output text +regardless of the availability of other files. diff --git a/fasmw172/TOOLS/SYMBOLS.INC b/fasmw172/TOOLS/SYMBOLS.INC new file mode 100644 index 0000000..fc53917 --- /dev/null +++ b/fasmw172/TOOLS/SYMBOLS.INC @@ -0,0 +1,444 @@ + +symbols: + mov edx,[input_file] + call open + jc input_not_found + mov al,2 + xor edx,edx + call lseek + cmp eax,30h + jb invalid_input + push eax + call alloc + jc not_enough_memory + push eax + xor al,al + xor edx,edx + call lseek + mov ecx,[esp+4] + mov edx,[esp] + call read + jc reading_error + pop eax ecx + cmp dword [eax],1A736166h + jne invalid_input + mov [input],eax + add [eax+16],eax + add [eax+24],eax + add [eax+32],eax + add [eax+48],eax + mov edx,[eax+16] + add [eax+8],edx + + mov ebx,eax + mov eax,[ebx+20] + add eax,[ebx+36] + cmp eax,1000h + ja allocate_output_buffer + mov eax,1000h + allocate_output_buffer: + call alloc + jc not_enough_memory + mov [output_buffer],eax + + mov edx,[output_file] + call create + jc writing_error + mov [output_handle],ebx + + mov ebx,[input] + mov edx,[ebx+24] + mov ebp,[ebx+28] + add ebp,edx + dump_symbols: + cmp edx,ebp + je dump_done + test byte [edx+8],1 + jz next_symbol + test byte [edx+9],4 + jnz next_symbol + mov edi,[output_buffer] + mov esi,[edx+24] + test esi,esi + jz anonymous_symbol + mov ebx,[input] + btr esi,31 + jc symbol_name_in_strings_table + add esi,[ebx+32] + lodsb + movzx ecx,al + rep movsb + jmp symbol_name_ok + symbol_name_in_strings_table: + add esi,[ebx+16] + call write_string + jmp symbol_name_ok + anonymous_symbol: + mov al,'@' + stosb + stosb + symbol_name_ok: + test byte [edx+9],2 + jnz negative_value + mov eax,': 0x' + stosd + mov eax,[edx+4] + call write_hex_dword + mov eax,[edx] + call write_hex_dword + jmp write_address_registers + negative_value: + mov eax,': -0' + stosd + mov al,'x' + stosb + mov ecx,[edx] + mov eax,[edx+4] + not ecx + not eax + add ecx,1 + adc eax,0 + push ecx + or ecx,eax + jnz negative_value_ok + mov byte [edi],'1' + inc edi + negative_value_ok: + call write_hex_dword + pop eax + call write_hex_dword + write_address_registers: + mov bl,[edx+12] + mov bh,[edx+14] + call write_address_register + mov bl,[edx+13] + mov bh,[edx+15] + call write_address_register + mov bl,[edx+11] + cmp bl,0 + je symbol_type_ok + jl negated_symbol + mov ax,', ' + stosw + jmp write_symbol_type + negated_symbol: + mov ax,', ' + stosw + mov esi,_negated + call write_string + neg bl + write_symbol_type: + cmp bl,1 + je segment_type + cmp bl,5 + je rva_type + cmp bl,6 + je plt_type + test byte [edx+20+3],80h + jnz external + mov esi,_relocatable + call write_string + cmp dword [edx+20],0 + je symbol_type_ok + mov esi,_in_section + call write_string + jmp write_symbol_base + simple_relocatable: + mov esi,_relocatable + call write_string + jmp symbol_type_ok + external: + mov esi,_relative_to_external + call write_string + jmp write_symbol_base + segment_type: + mov esi,_relocatable_segment + call write_string + jmp symbol_type_ok + rva_type: + mov esi,_rva + call write_string + jmp write_symbol_base + plt_type: + mov esi,_plt + call write_string + write_symbol_base: + mov esi,[edx+20] + btr esi,31 + jc write_external_name + dec esi + shl esi,2 + mov ebx,[input] + add esi,[ebx+48] + mov esi,[esi] + add esi,[ebx+16] + call write_string + mov al,'(' + stosb + mov eax,[edx+20] + call write_dec_number + mov al,')' + stosb + jmp symbol_type_ok + write_external_name: + mov ebx,[input] + add esi,[ebx+16] + call write_string + jmp symbol_type_ok + symbol_type_ok: + mov esi,_defined + call write_string + mov ebx,[edx+28] + mov eax,[input] + add ebx,[eax+32] + call write_line_identifier + mov ax,0A0Dh + stosw + push edx + mov ebx,[output_handle] + mov ecx,edi + mov edx,[output_buffer] + sub ecx,edx + call write + pop edx + next_symbol: + add edx,32 + jmp dump_symbols + dump_done: + mov ebx,[output_handle] + call close + ret + +write_string: + lodsb + test al,al + jz string_ok + stosb + jmp write_string + string_ok: + ret +write_hex_dword: + mov ebx,eax + mov ecx,8 + write_hex_digits: + xor al,al + shld eax,ebx,4 + cmp al,10 + sbb al,69h + das + stosb + shl ebx,4 + loop write_hex_digits + ret +write_dec_number: + push ebx edx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + dec_number_loop: + div ecx + push edx + cmp ecx,1 + je write_dec_digit + or bl,bl + jnz write_dec_digit + or al,al + jz dec_digit_ok + not bl + write_dec_digit: + add al,30h + stosb + dec_digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz dec_number_loop + pop edx ebx + ret +write_address_register: + cmp bh,0 + je register_ok + jl negative_register + mov al,'+' + jmp register_sign_ok + negative_register: + mov al,'-' + register_sign_ok: + stosb + push esi + mov esi,address_registers + find_register: + lodsb + test al,al + jz register_not_found + cmp al,bl + je register_found + cmp bl,[esi] + je register_found + lodsb + movzx eax,al + add esi,eax + jmp find_register + register_not_found: + mov al,bl + shr al,5 + cmp al,0Ch shr 1 + je xmm_register + cmp al,0Eh shr 1 + je ymm_register + cmp al,6 shr 1 + je zmm_register + register_found: + lodsb + movzx ecx,al + rep movsb + write_register_scale: + pop esi + cmp bh,1 + je register_ok + mov al,'*' + stosb + movzx eax,bh + call write_dec_number + register_ok: + ret + zmm_register: + mov al,'z' + jmp vector_address_register + ymm_register: + mov al,'y' + jmp vector_address_register + xmm_register: + mov al,'x' + vector_address_register: + stosb + mov ax,'mm' + stosw + mov al,bl + and eax,11111b + call write_dec_number + jmp write_register_scale + +write_line_identifier: + test dword [ebx+4],80000000h + jnz identify_macro_generated_line + mov esi,[ebx] + mov eax,[input] + test esi,esi + jz main_file + add esi,[eax+32] + jmp file_name_ok + main_file: + mov esi,[eax+8] + file_name_ok: + call write_string + mov al,'[' + stosb + mov eax,[ebx+4] + call write_dec_number + mov al,']' + stosb + ret + identify_macro_generated_line: + mov al,'{' + stosb + mov esi,_generated_by + call write_string + push ebx + mov ebx,[ebx+8] + mov eax,[input] + add ebx,[eax+32] + call write_line_identifier + pop ebx + mov eax,[ebx+8] + cmp eax,[ebx+12] + je macro_generated_line_identifier_ok + mov esi,_from + call write_string + push ebx + mov ebx,[ebx+12] + mov eax,[input] + add ebx,[eax+32] + call write_line_identifier + pop ebx + macro_generated_line_identifier_ok: + mov al,'}' + stosb + ret + +not_enough_memory: + call error + db 'not enough memory to load the required data',0 +input_not_found: + call error + db 'the input file was not found',0 +code_not_found: + call error + db 'the assembled file was not found',0 +source_not_found: + call error + db 'could not find some of the source files',0 +reading_error: + call error + db 'some error occured while trying to read file',0 +writing_error: + call error + db 'some error occured while trying to write file',0 +invalid_input: + call error + db 'input file is not a recognized assembly information format',0 + +address_registers db 23h,2,'bx' + db 25h,2,'bp' + db 26h,2,'si' + db 27h,2,'di' + db 40h,3,'eax' + db 41h,3,'ecx' + db 42h,3,'edx' + db 43h,3,'ebx' + db 44h,3,'esp' + db 45h,3,'ebp' + db 46h,3,'esi' + db 47h,3,'edi' + db 48h,3,'r8d' + db 49h,3,'r9d' + db 4Ah,4,'r10d' + db 4Bh,4,'r11d' + db 4Ch,4,'r12d' + db 4Dh,4,'r13d' + db 4Eh,4,'r14d' + db 4Fh,4,'r15d' + db 80h,3,'rax' + db 81h,3,'rcx' + db 82h,3,'rdx' + db 83h,3,'rbx' + db 84h,3,'rsp' + db 85h,3,'rbp' + db 86h,3,'rsi' + db 87h,3,'rdi' + db 88h,2,'r8' + db 89h,2,'r9' + db 8Ah,3,'r10' + db 8Bh,3,'r11' + db 8Ch,3,'r12' + db 8Dh,3,'r13' + db 8Eh,3,'r14' + db 8Fh,3,'r15' + db 94h,3,'eip' + db 98h,3,'rip' + db 0,1,'?' + +_negated db 'negated ',0 +_relocatable_segment db 'relocatable segment',0 +_relocatable db 'relocatable',0 +_in_section db ' in section ',0 +_relative_to_external db 'relative to external ',0 +_rva db 'relative to RVA or GOT-based offset of ',0 +_plt db 'relative to address of PLT entry for ',0 +_defined db ', defined in ',0 +_generated_by db 'line generated by ',0 +_from db ' from ',0 diff --git a/fasmw172/TOOLS/WIN32/LISTING.ASM b/fasmw172/TOOLS/WIN32/LISTING.ASM new file mode 100644 index 0000000..7f3ad1a --- /dev/null +++ b/fasmw172/TOOLS/WIN32/LISTING.ASM @@ -0,0 +1,229 @@ + +format PE console 4.0 +entry start + +include 'win32a.inc' + +section '.data' data readable writeable + + _usage db 'listing generator for flat assembler',0Dh,0Ah + db 'usage: listing <input> <output>',0Dh,0Ah + db 'optional settings:',0Dh,0Ah + db ' -a show target addresses for assembled code',0Dh,0Ah + db ' -b <number> set the amount of bytes listed per line',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + + line_break db 0Dh,0Ah + + input_file dd 0 + output_file dd 0 + code_bytes_per_line dd 16 + show_addresses db 0 + + input dd ? + assembled_code dd ? + assembled_code_length dd ? + code_end dd ? + code_offset dd ? + code_length dd ? + output_handle dd ? + output_buffer dd ? + current_source_file dd ? + current_source_line dd ? + source dd ? + source_length dd ? + maximum_address_length dd ? + address_start dd ? + last_listed_address dd ? + + display_handle dd ? + bytes_count dd ? + + params rb 1000h + characters rb 100h + +section '.text' code readable executable + + start: + + mov [display_handle],STD_OUTPUT_HANDLE + + call get_params + jnc make_listing + + mov esi,_usage + call display_string + invoke ExitProcess,2 + + make_listing: + call listing + invoke ExitProcess,0 + + error: + mov [display_handle],STD_ERROR_HANDLE + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + invoke ExitProcess,1 + + get_params: + invoke GetCommandLine + mov esi,eax + mov edi,params + find_command_start: + lodsb + cmp al,20h + je find_command_start + cmp al,22h + je skip_quoted_name + skip_name: + lodsb + cmp al,20h + je find_param + or al,al + jz all_params + jmp skip_name + skip_quoted_name: + lodsb + cmp al,22h + je find_param + or al,al + jz all_params + jmp skip_quoted_name + find_param: + lodsb + cmp al,20h + je find_param + cmp al,'-' + je option_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [input_file],0 + jne get_output_file + mov [input_file],edi + jmp process_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + option_param: + lodsb + cmp al,'a' + je addresses_option + cmp al,'A' + je addresses_option + cmp al,'b' + je bytes_per_line_option + cmp al,'B' + je bytes_per_line_option + bad_params: + stc + ret + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + invalid_option_value: + stc + ret + bytes_per_line_option: + lodsb + cmp al,20h + je bytes_per_line_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + call get_option_value + or edx,edx + jz bad_params + cmp edx,1000 + ja bad_params + mov [code_bytes_per_line],edx + jmp find_param + addresses_option: + lodsb + cmp al,20h + je set_addresses_option + cmp al,0Dh + je set_addresses_option + or al,al + jnz bad_params + set_addresses_option: + dec esi + mov [show_addresses],1 + jmp find_param + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + + include 'system.inc' + + include '..\listing.inc' + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL' + + include 'api\kernel32.inc' diff --git a/fasmw172/TOOLS/WIN32/PREPSRC.ASM b/fasmw172/TOOLS/WIN32/PREPSRC.ASM new file mode 100644 index 0000000..7ab4c95 --- /dev/null +++ b/fasmw172/TOOLS/WIN32/PREPSRC.ASM @@ -0,0 +1,138 @@ + +format PE console 4.0 +entry start + +include 'win32a.inc' + +section '.data' data readable writeable + + _usage db 'preprocessed source dumper for flat assembler',0Dh,0Ah + db 'usage: prepsrc <input> <output>',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + + input_file dd 0 + output_file dd 0 + + display_handle dd ? + bytes_count dd ? + + params rb 1000h + +section '.text' code readable executable + + start: + + mov [display_handle],STD_OUTPUT_HANDLE + + call get_params + jnc make_dump + + mov esi,_usage + call display_string + invoke ExitProcess,2 + + make_dump: + call preprocessed_source + invoke ExitProcess,0 + + error: + mov [display_handle],STD_ERROR_HANDLE + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + invoke ExitProcess,1 + + get_params: + invoke GetCommandLine + mov esi,eax + mov edi,params + find_command_start: + lodsb + cmp al,20h + je find_command_start + cmp al,22h + je skip_quoted_name + skip_name: + lodsb + cmp al,20h + je find_param + or al,al + jz all_params + jmp skip_name + skip_quoted_name: + lodsb + cmp al,22h + je find_param + or al,al + jz all_params + jmp skip_quoted_name + find_param: + lodsb + cmp al,20h + je find_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [input_file],0 + jne get_output_file + mov [input_file],edi + jmp process_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + bad_params: + stc + ret + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + + include 'system.inc' + + include '..\prepsrc.inc' + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL' + + include 'api\kernel32.inc' diff --git a/fasmw172/TOOLS/WIN32/SYMBOLS.ASM b/fasmw172/TOOLS/WIN32/SYMBOLS.ASM new file mode 100644 index 0000000..e4f1e71 --- /dev/null +++ b/fasmw172/TOOLS/WIN32/SYMBOLS.ASM @@ -0,0 +1,142 @@ + +format PE console 4.0 +entry start + +include 'win32a.inc' + +section '.data' data readable writeable + + _usage db 'symbols dumper for flat assembler',0Dh,0Ah + db 'usage: symbols <input> <output>',0Dh,0Ah + db 0 + _error_prefix db 'error: ',0 + _error_suffix db '.',0Dh,0Ah,0 + + input_file dd 0 + output_file dd 0 + + input dd ? + output_buffer dd ? + output_handle dd ? + + display_handle dd ? + bytes_count dd ? + + params rb 1000h + +section '.text' code readable executable + + start: + + mov [display_handle],STD_OUTPUT_HANDLE + + call get_params + jnc make_dump + + mov esi,_usage + call display_string + invoke ExitProcess,2 + + make_dump: + call symbols + invoke ExitProcess,0 + + error: + mov [display_handle],STD_ERROR_HANDLE + mov esi,_error_prefix + call display_string + pop esi + call display_string + mov esi,_error_suffix + call display_string + invoke ExitProcess,1 + + get_params: + invoke GetCommandLine + mov esi,eax + mov edi,params + find_command_start: + lodsb + cmp al,20h + je find_command_start + cmp al,22h + je skip_quoted_name + skip_name: + lodsb + cmp al,20h + je find_param + or al,al + jz all_params + jmp skip_name + skip_quoted_name: + lodsb + cmp al,22h + je find_param + or al,al + jz all_params + jmp skip_quoted_name + find_param: + lodsb + cmp al,20h + je find_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [input_file],0 + jne get_output_file + mov [input_file],edi + jmp process_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + bad_params: + stc + ret + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + cmp [input_file],0 + je bad_params + cmp [output_file],0 + je bad_params + clc + ret + + include 'system.inc' + + include '..\symbols.inc' + +section '.idata' import data readable writeable + + library kernel32,'KERNEL32.DLL' + + include 'api\kernel32.inc' diff --git a/fasmw172/TOOLS/WIN32/SYSTEM.INC b/fasmw172/TOOLS/WIN32/SYSTEM.INC new file mode 100644 index 0000000..999bdfb --- /dev/null +++ b/fasmw172/TOOLS/WIN32/SYSTEM.INC @@ -0,0 +1,66 @@ + +display_string: + invoke GetStdHandle,[display_handle] + mov edx,eax + mov edi,esi + or ecx,-1 + xor al,al + repne scasb + neg ecx + sub ecx,2 + invoke WriteFile,edx,esi,ecx,bytes_count,0 + retn +alloc: + invoke VirtualAlloc,0,eax,MEM_COMMIT,PAGE_READWRITE + or eax,eax + jz allocation_error + clc + retn + allocation_error: + stc + retn +free: + invoke VirtualFree,eax,0,MEM_RELEASE + retn +open: + invoke CreateFile,edx,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0 + cmp eax,-1 + je file_error + mov ebx,eax + clc + retn + file_error: + stc + retn +create: + invoke CreateFile,edx,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0 + cmp eax,-1 + je file_error + mov ebx,eax + clc + retn +write: + invoke WriteFile,ebx,edx,ecx,bytes_count,0 + or eax,eax + jz file_error + clc + retn +read: + push ecx + invoke ReadFile,ebx,edx,ecx,bytes_count,0 + pop edx + or eax,eax + jz file_error + cmp edx,[bytes_count] + jne file_error + clc + retn +close: + invoke CloseHandle,ebx + retn +lseek: + movzx eax,al + invoke SetFilePointer,ebx,edx,0,eax + cmp eax,-1 + je file_error + retn diff --git a/fasmw172/WHATSNEW.TXT b/fasmw172/WHATSNEW.TXT new file mode 100644 index 0000000..1dfca61 --- /dev/null +++ b/fasmw172/WHATSNEW.TXT @@ -0,0 +1,306 @@ + +Visit http://flatassembler.net/ for more information. + + +version 1.72 (Oct 10, 2017) + +[+] Support for Intel AVX-512, SHA, CLFLUSHOPT, CLWB, PCOMMIT, ADX, RDSEED, SMAP + and MPX instruction sets. + +[+] Added "irpv" and "postpone" directives. + +[+] Added ability to define a special kind of label identifying the + addressing space. This label can the be used with "load" or "store" + directives to allow operations on bytes in any addressing space, + not just the current one. This special label is defined by following + its name with double colon, and can only be used with "load" and + "store" directive, where address can now be specified in two parts, + first the adressing space label, then the colon and then the + address inside that addressing space. + +[+] In the definition of macroinstruction the last argument can now be followed by + "&" character to indicate that this argument can be filled with all the remaining + contents of line that called the macro. This feature cannot be combined with a + multi-value arguments. + +[+] Default value for macroinstruction parameter can now be defined with ":" + character as an alternative to "=". + +[+] Added a 64-bit ELF executable version of flat assembler for Linux. It has + no extended capabilities compared to regular versions, it just simulates + the 32-bit environment to allow running the assembler on systems that + support only 64-bit executables. + +[+] Added "gnustack" and "gnuehframe" segment types to ELF executable formatter. + +[+] Console versions now display preprocessed instruction that caused an error + (previously only displayed by Windows GUI interface). + +[+] Brought back the "-d" switch for command line. + +[-] Removed dependence on size context for expression operators like NOT and XOR. + +[+] Added "bsf" and "bsr" operators to numerical expressions. + +[+] Allowed underscore character to be put inside a number value. + +[+] Allowed octal numbers ending with "q". + +[-] Removed the restriction that disallowed numerical constant to + forward-reference its own value. + + +version 1.70 (Apr 17, 2012) + +[+] Added support for AVX, AVX2, AES, CLMUL, FMA, RDRAND, FSGSBASE, F16C, + FMA4, XOP, MOVBE, BMI, TBM, INVPCID, HLE and RTM instruction sets. + +[+] Added half-precision floating point values support. + +[+] Extended the syntax of "rept" directive to allow numerical expressions + to be calculated by preprocessor in its arguments. + +[+] Added "large" and "NX" settings for PE format. + +[+] Allowed PE fixups to be resolved anywhere in the generated executable. + +[+] Allowed to specify branding value (use 3 for Linux) after the + "format ELF executable" setting. + +[+] Added "intepreter", "dynamic" and "note" keywords for creation of + special segments in ELF executables. + +[-] Fixed long mode opcode generator to allow absolute addresses to be + generated with "qword" keyword inside square brackets. + +[-] Disallowed negative immediates with "int", "enter", "ret" instructions. + +[+] Allowed symbolic information dump file to be created even in case of error. + In such case it contains only the preprocessed source that can be extracted + with PREPSRC tool. If error occured during preprocessing, only the source up + to the point of error is provided. + +[+] Added symbol references table to symbolic dump file. + +[-] Corrected the "defined" and "used" flags in the symbols dump to reflect the + state from the final assembly pass. + +[+] Added "assert" directive. + +[-] Formatter symbols like "PE" or "readable" are now recognized only in the + context of formatter directives, and thus are no longer disallowed as + labels. + +[+] Macroinstruction argument now can have default value, defined with "=" + symbol followed by value after the argument name in definition. + +[+] Added "relativeto" operator, which can be used in logical expressions + to test whether two values differ only by a constant and not relocatable + amount. + +[-] Revised the expression calculator, it now is able to correctly perform + calculations in signed and unsigned ranges in full 64-bit. This fixes + a number of issues - the overflow will now be correctly detected for + 64-bit values in cases, where previous versions could not distinguish + whether it was an overflow or not. The effect of these corrections is + that "dq" directive will now behave consistently with behavior of the + data directives for smaller sizes, and the same applies to all the + places where "qword" size for value is used. + + +version 1.68 (Jun 13, 2009) + +[+] Added SSSE3 (Supplemental SSE3), SSE4.1, SSE4.2 and SSE4a instructions. + +[+] Added the AMD SVM and Intel SMX instructions. + +[+] Added "rdmsrq", "wrmsrq", "sysexitq" and "sysretq" mnemonics for the + 64-bit variants of respective instructions. + +[+] Added "fstenvw", "fstenvd", "fsavew", "fsaved", "frstorw" and "frstord" + mnemonics to allow choosing between 16-bit and 32-bit variants of + structures used by the "fstenv", "fsave" and "frstor" instructions. + +[+] Added "plt" operator for the ELF output format. + +[+] Allowed "rva" operator to be used in MS COFF object format, and also + added "static" keyword for the "public" directive. + +[+] Added Intel-style aliases for the additional long mode 8-bit registers. + +[-] The PE formatter now automatically detects whether relocatable labels + should be used, depending on whether the fixups directory is placed + somewhere into executable by programer, or not. This makes possible the + more flexible use of the addressing symbols in case of PE executable fixed + at some position. + +[-] Added support for outputting the 32-bit address relocations in case of + 64-bit object formats and PE executable. This makes some specific + instructions compilable, but it also forces linker to put such + generated code into the low 2 gigabytes of addressing space. + +[+] Added "EFI", "EFIboot" and "EFIruntime" subsystem keywords for PE format. + +[-] Corrected the precedence of operators of macroinstruction line maker. + The symbol escaping now has always the higher priority than symbol conversion, + and both have higher precedence than concatenation. + +[+] Allowed to check "@b" and "@f" symbols with "defined" operator. + +[+] Allowed "as" operator to specify the output file extension when + placed at the end of the "format" directive line. + +[-] Definition of macro with the same name as one of the preprocessor's directives + is no longer allowed. + +[+] Allowed single quote character to be put inside the number value, + to help improve long numbers readability. + +[+] Added optional symbolic information output, and a set of tools that extract + various kinds of information from it. + +[+] Added "err" directive that allows to signalize error from the source. + + +version 1.66 (May 7, 2006) + +[+] Added "define" directive to preprocessor, which defines symbolic constants, + the same kind as "equ" directive, however there's an important difference + that "define" doesn't process symbolic constants in the value before + assigning it. For example: + + a equ 1 + a equ a+a + + define b 1 + define b b+b + + defines the "a" constant with value "1+1", but the "b" is defined with + value "b+b". This directive may be useful in some advanced + macroinstructions. + +[-] Moved part of the conditional expression processing into parser, + for slightly better performance and lesser memory usage by assembler. + The logical values defined with "eq", "eqtype" and "in" operators are now + evaluated by the parser and if they are enough to determine the condition, + the whole block is processed accordingly. Thus this block: + + if eax eq EAX | 0/0 + nop + end if + + is parsed into just "nop" instruction, since parser is able to determine + that the condition is true, even though one of the logical values makes no + sense - but since this is none of the "eq", "eqtype" and "in" expressions, + the parser doesn't investigate. + +[-] Also the assembler is now calculating only as many logical values as it + needs to determine the condition. So this block: + + if defined alpha & alpha + + end if + + will not cause error when "alpha" is not defined, as it would with previous + versions. This is because after checking that "defined alpha" is false + condition it doesn't need to know the second logical value to determine the + value of conjunction. + +[+] Added "short" keyword for specifying jump type, the "jmp byte" form is now + obsolete and no longer correct - use "jmp short" instead. + +[-] The size operator applied to jump no longer applies to the size of relative + displacement - now it applies to the size of target address. + +[-] The "ret" instruction with 0 parameter is now assembled into short form, + unless you force using the 16-bit immediate with "word" operator. + +[+] Added missing extended registers for the 32-bit addressing in long mode. + +[+] Added "linkremove" and "linkinfo" section flags for MS COFF output. + +[+] Added support for GOT offsets in ELF object formatter, which can be useful + when making position-independent code for shared libraries. For any label + you can get its offset relative to GOT by preceding it with "rva" operator + (the same keyword as for PE format is used, to avoid adding a new one, + while this one has very similar meaning). + +[-] Changed ELF executable to use "segment" directive in place of "section", + to make the distinction between the run-time segments and linkable + sections. If you had a "section" directive in your ELF executables and they + no longer assemble, replace it with "segment". + +[-] The PE formatter now always creates the fixups directory when told to - + even when there are no fixups to be put there (in such case it creates the + directory with one empty block). + +[-] Some of the internal structures have been extended to provide the + possibility of making extensive symbol dumps. + +[-] Corrected "fix" directive to keep the value intact before assigning it to the + prioritized constant. + +[+] The ` operator now works with any kind of symbol; when used with quoted + string it simply does nothing. Thus the sequence of ` operators applied to + one symbol work the same as if there was just one. In similar manner, the + sequence of # operators now works as if it was a single one - using such a + sequence instead of escaping, which was kept for some backward + compatibility, is now deprecated. + +[-] Corrected order of identifying assembler directives ("if db eq db" was + incorrectly interpreted as data definition). + +[-] Many other small bugs fixed. + + +version 1.64 (Aug 8, 2005) + +[+] Output of PE executables for Win64 architecture (with "format PE64" + setting). + +[+] Added "while" and "break" directives. + +[+] Added "irp" and "irps" directives. + +[+] The macro arguments can be marked as required with the "*" character. + +[-] Fixed checking for overflow when multiplying 64-bit values - the result + must always fit in the range of signed 64 integer now. + +[-] Segment prefixes were generated incorrectly in 16-bit mode when BP was used + as a second addressing register - fixed. + +[-] The "local" directive was not creating unique labels in some cases - fixed. + +[-] The "not encodable with long immediate" error in 64-bit mode was sometimes + wrongly signaled - fixed. + +[-] Other minor fixes and corrections. + + +version 1.62 (Jun 14, 2005) + +[+] Escaping of symbols inside macroinstructions with backslash. + +[+] Ability of outputting the COFF object files for Win64 architecture + (with "format MS64 COFF" setting). + +[+] New preprocessor directives: "restruc", "rept" and "match" + +[+] VMX instructions support (not documented). + +[+] Extended data directives to allow use of the "dup" operator. + +[+] Extended "struc" features to allow custom definitions of main structure's + label. + +[-] When building resources from the the .RES file that contained more + than one resource of the same string name, the separate resource + directories were created with the same names - fixed. + +[-] Several bugs in the ELF64 object output has been fixed. + +[-] Corrected behavior of "fix" directive to more straightforward. + +[-] Fixed bug in "include" directive, which caused files included from within + macros to be processed the wrong way.