├── .gitattributes ├── .gitignore ├── Go ├── .idea │ └── Go.iml └── LoadIntelDoc │ ├── .idea │ └── .gitignore │ └── Main.go ├── Images ├── AsmDude-doc-links-2.png ├── AsmDude-signature-help.png ├── AsmDude2-code-completion.png ├── AsmDude2-descriptions.png ├── AsmDude2-signature-help.png └── AsmDude2-syntax-highlighting.png ├── LICENSE ├── README.md └── VS ├── .editorconfig ├── AsmDude.sln ├── CPP ├── ConsoleLinuxApplicationTest │ ├── ConsoleLinuxApplicationTest.vcxproj │ └── main.cpp └── ConsoleTest │ ├── ConsoleTest.sln │ ├── ConsoleTest │ ├── ConsoleTest.vcxproj │ ├── ConsoleTest.vcxproj.filters │ └── Main.cpp │ └── example_semantic_analysis2.asm ├── CSHARP ├── asm-annotate │ ├── ParserXed.cs │ ├── Program.cs │ ├── asm-annotate.csproj │ └── data │ │ ├── 10th generation Intel Core Processor based on Ice Lake microarchitecture Throughput and Latency README.pdf │ │ └── icelake.csv ├── asm-dude-vsix │ ├── .editorconfig │ ├── AsmDoc │ │ ├── AsmDocClassificationDefinition.cs │ │ ├── AsmDocClassificationFormat.cs │ │ ├── AsmDocKeyProcessor.cs │ │ ├── AsmDocKeyProcessorProvider.cs │ │ ├── AsmDocMouseHandler.cs │ │ ├── AsmDocMouseHandlerProvider.cs │ │ ├── AsmDocUnderlineTagger.cs │ │ ├── AsmDocUnderlineTaggerProvider.cs │ │ └── CtrlKeyState.cs │ ├── AsmDudePackage.cs │ ├── AsmDudePackage.ico │ ├── BraceMatching │ │ ├── BraceMatchingTagger.cs │ │ └── BraceMatchingTaggerProvider.cs │ ├── ClearMefCache │ │ ├── ClearMefCache.cs │ │ └── ComponentModelExtensions.cs │ ├── CodeCompletion │ │ ├── CodeCompletionCommandFilter.cs │ │ ├── CodeCompletionSource.cs │ │ ├── CodeCompletionSourceProvider.cs │ │ └── VsTextViewCreationListener.cs │ ├── CodeFolding │ │ ├── CodeFoldingTagger.cs │ │ └── CodeFoldingTaggerProvider.cs │ ├── CodeFormatting │ │ ├── CodeLayout.sln │ │ ├── CustomMoniker.vsct │ │ ├── GlobalSuppressions.cs │ │ ├── Guids.cs │ │ ├── PkgCmd.vsct │ │ ├── PkgCmdId.cs │ │ ├── VSPackage.Designer.cs │ │ ├── VSPackage.resx │ │ └── VsPkg.cs │ ├── Experimental │ │ ├── CurrentLine │ │ │ ├── AdornmentFactory.cs │ │ │ └── LineHighlight.cs │ │ ├── LightBulb │ │ │ └── AsmLightBulb.cs │ │ └── Menu │ │ │ ├── DynamicTextCommand.cs │ │ │ └── PkgCmdId.cs │ ├── HighlightWord │ │ ├── HighlightWordTagger.cs │ │ └── HighlightWordTaggerProvider.cs │ ├── Key.snk │ ├── LICENSE.txt │ ├── OptionsPage │ │ ├── AsmDudeOptionPageUI.xaml │ │ ├── AsmDudeOptionPageUI.xaml.cs │ │ └── AsmDudeOptionsPage.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── Guids.cs │ ├── QuickInfo │ │ ├── AsmQuickInfoController.cs │ │ ├── AsmQuickInfoControllerProvider.cs │ │ ├── AsmQuickInfoSource.cs │ │ ├── AsmQuickInfoSourceProvider.cs │ │ ├── ButtonInfo.cs │ │ ├── InstructionTooltipWindow.xaml │ │ ├── InstructionTooltipWindow.xaml.cs │ │ ├── RegisterTooltipWindow.xaml │ │ ├── RegisterTooltipWindow.xaml.cs │ │ ├── TextBoxWindow.xaml │ │ └── TextBoxWindow.xaml.cs │ ├── Resources │ │ ├── AsmDudeData.xml │ │ ├── Performance │ │ │ ├── Broadwell.tsv │ │ │ ├── Haswell.tsv │ │ │ ├── Instructions-Translations.tsv │ │ │ ├── IvyBridge.tsv │ │ │ ├── Skylake.tsv │ │ │ └── SkylakeX.tsv │ │ ├── examples │ │ │ ├── TextFile1.asm │ │ │ ├── all_mnemonics.asm │ │ │ ├── data.foo │ │ │ ├── example.asm │ │ │ ├── example_att.s │ │ │ ├── example_masm.asm │ │ │ ├── example_masm2.asm │ │ │ ├── example_nasm.asm │ │ │ ├── example_semantic_analysis.asm │ │ │ ├── example_semantic_analysis2.asm │ │ │ ├── inc │ │ │ │ └── example.inc │ │ │ └── nn.asm │ │ ├── images │ │ │ ├── AsmDude.bmp │ │ │ ├── asm.png │ │ │ ├── icon-D.png │ │ │ ├── icon-I.png │ │ │ ├── icon-L.png │ │ │ ├── icon-M.png │ │ │ ├── icon-R-blue.png │ │ │ ├── icon-R.png │ │ │ ├── icon-W.png │ │ │ ├── icon-Z.png │ │ │ └── icon-question.png │ │ ├── old │ │ │ ├── Package.ico │ │ │ ├── mnemonics-nasm-test.txt │ │ │ ├── mnemonics-nasm.txt │ │ │ ├── signature-dec2018.txt │ │ │ └── signature-june2016.old.txt │ │ ├── signature-dec2018.txt │ │ ├── signature-hand-1.txt │ │ └── signature-may2019.txt │ ├── Settings.Designer.cs │ ├── Settings.cs │ ├── Settings.settings │ ├── SignatureHelp │ │ ├── AsmParameter.cs │ │ ├── AsmSignature.cs │ │ ├── AsmSignatureElement.cs │ │ ├── AsmSignatureEnum.cs │ │ ├── AsmSignatureHelpCommandFilter.cs │ │ ├── AsmSignatureHelpCommandProvider.cs │ │ ├── AsmSignatureHelpSource.cs │ │ └── AsmSignatureHelpSourceProvider.cs │ ├── Squiggles │ │ ├── SquigglesTagger.cs │ │ └── SquigglesTaggerProvider.cs │ ├── SyntaxHighlighting │ │ ├── AsmClassificationDefinition.cs │ │ ├── AsmClassificationFormat.cs │ │ ├── AsmContentTypeProvider.cs │ │ ├── AsmDisassemblyTaggerProvider.cs │ │ ├── AsmDisassemblyTokenTagProvider.cs │ │ ├── AsmTagger.cs │ │ ├── AsmTaggerProvider.cs │ │ ├── AsmTokenTag.cs │ │ ├── AsmTokenTaggerProvider.cs │ │ ├── AsmTokenTypes.cs │ │ ├── MasmDisassemblyTokenTagger.cs │ │ ├── MasmTokenTagger.cs │ │ ├── NasmAttDisassemblyTokenTagger.cs │ │ ├── NasmAttTokenTagger.cs │ │ └── NasmIntelTokenTagger.cs │ ├── Tools │ │ ├── ApplicationInformation.cs │ │ ├── AsmDudeTools.cs │ │ ├── AsmDudeToolsStatic.cs │ │ ├── AsmMessageEnum.cs │ │ ├── AsmSimulator.cs │ │ ├── Delay.cs │ │ ├── LabelGraph.cs │ │ ├── LineUpdatedEventArgs.cs │ │ ├── MnemonicStore.cs │ │ └── PerformanceStore.cs │ ├── VsPackage.resx │ ├── app.config │ ├── asm-dude-vsix.csproj │ ├── source.extension.cs │ └── source.extension.vsixmanifest ├── asm-dude2-ls-lib │ ├── AsmDiagnosticTag.cs │ ├── AsmSignatureInformation.cs │ ├── LabelGraph.cs │ ├── LanguageServer.cs │ ├── LanguageServerTarget.cs │ ├── MnemonicStore.cs │ ├── PerformanceStore.cs │ ├── Resources │ │ ├── AsmDudeData.xml │ │ ├── Performance │ │ │ ├── Broadwell.tsv │ │ │ ├── Haswell.tsv │ │ │ ├── Instructions-Translations.tsv │ │ │ ├── IvyBridge.tsv │ │ │ ├── Skylake.tsv │ │ │ └── SkylakeX.tsv │ │ ├── signature-hand-1.txt │ │ └── signature-may2019.txt │ ├── Tools.cs │ └── asm-dude2-ls-lib.csproj ├── asm-dude2-ls │ ├── AsmDudePackage.ico │ ├── LICENSE.txt │ ├── Program.cs │ ├── Worker.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── asm-dude2-ls.csproj │ └── lsp-version.txt ├── asm-dude2-vsix │ ├── App.config │ ├── AsmContentTypeDefinition.cs │ ├── AsmDude2.png │ ├── AsmDude2Package.cs │ ├── AsmDudePackage.ico │ ├── AsmLanguageClient.cs │ ├── LICENSE.txt │ ├── OptionsPage │ │ ├── AsmDudeOptionPageUI.xaml │ │ ├── AsmDudeOptionPageUI.xaml.cs │ │ └── AsmDudeOptionsPage.cs │ ├── Properties │ │ └── Guids.cs │ ├── Resources │ │ ├── AsmDudeData.xml │ │ ├── examples │ │ │ ├── TextFile1.asm │ │ │ ├── all_mnemonics.asm │ │ │ ├── data.foo │ │ │ ├── example.asm │ │ │ ├── example_att.s │ │ │ ├── example_masm.asm │ │ │ ├── example_masm2.asm │ │ │ ├── example_nasm.asm │ │ │ ├── example_semantic_analysis.asm │ │ │ ├── example_semantic_analysis2.asm │ │ │ ├── inc │ │ │ │ └── example.inc │ │ │ └── nn.asm │ │ ├── signature-hand-1.txt │ │ └── signature-may2019.txt │ ├── Settings.Designer.cs │ ├── Settings.settings │ ├── SyntaxHighlighting │ │ ├── AsmClassificationDefinition.cs │ │ ├── AsmClassificationFormat.cs │ │ ├── AsmDisassemblyTaggerProvider.cs │ │ ├── AsmDisassemblyTokenTagProvider.cs │ │ ├── AsmTagger.cs │ │ ├── AsmTaggerProvider.cs │ │ ├── AsmTokenTag.cs │ │ ├── AsmTokenTaggerProvider.cs │ │ ├── MasmDisassemblyTokenTagger.cs │ │ ├── MasmTokenTagger.cs │ │ ├── NasmAttDisassemblyTokenTagger.cs │ │ ├── NasmAttTokenTagger.cs │ │ └── NasmIntelTokenTagger.cs │ ├── Tools │ │ ├── ApplicationInformation.cs │ │ └── AsmDudeToolsStatic.cs │ ├── asm-dude2-vsix.csproj │ ├── asmdude2-version.txt │ ├── howto-release.txt │ └── source.extension.vsixmanifest ├── asm-irony │ ├── App.config │ ├── Example.cs │ ├── Example2.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── asm-irony.csproj ├── asm-sim-lib │ ├── BitOperations.cs │ ├── BranchInfo.cs │ ├── BranchInfoStore.cs │ ├── ConditionalElement.cs │ ├── DynamicFlow.cs │ ├── ExecutionTree.cs │ ├── GraphTools.cs │ ├── Mnemonics.cs │ ├── ProgramGenerator.cs │ ├── ProgramSyntesizer.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Runner.cs │ ├── State.cs │ ├── StateConfig.cs │ ├── StateUpdate.cs │ ├── StaticFlow.cs │ ├── Tools.cs │ ├── ToolsFlags.cs │ ├── ToolsFloatingPoint.cs │ ├── ToolsZ3.cs │ ├── Tv.cs │ └── asm-sim-lib.csproj ├── asm-sim-main │ ├── DotVisualizer.cs │ ├── ProgramZ3.cs │ └── asm-sim-main.csproj ├── asm-sim-tests │ ├── AsmTestTools.cs │ ├── GlobalUsings.cs │ ├── Test_BitTricks.cs │ ├── Test_ExecutionTree.cs │ ├── Test_FPTools.cs │ ├── Test_FlagTools.cs │ ├── Test_MemZ3.cs │ ├── Test_Mnemonic.cs │ ├── Test_Runner.cs │ ├── Test_State.cs │ ├── Test_StaticFlow.cs │ ├── Test_Z3.cs │ └── asm-sim-tests.csproj ├── asm-tools-lib-net48 │ ├── app.config │ └── asm-tools-lib-net48.csproj ├── asm-tools-lib │ ├── Arch.cs │ ├── AsmDudeTools.cs │ ├── AsmLanguageServerOptions.cs │ ├── AsmSignatureEnum.cs │ ├── AsmSourceTools.cs │ ├── AsmTokenTypes.cs │ ├── AssemblerEnum.cs │ ├── AssemblyInfo.cs │ ├── ExpressionEvaluator.cs │ ├── Flags.cs │ ├── KeywordID.cs │ ├── MicroArch.cs │ ├── Mnemonic.cs │ ├── NumerationEnum.cs │ ├── Operand.cs │ ├── OperandType.cs │ ├── Parameter.cs │ ├── Parse.cs │ ├── RegisterName.cs │ ├── RegisterTools.cs │ ├── StopWatch.cs │ └── asm-tools-lib.csproj ├── asm-tools-tests │ ├── GlobalUsings.cs │ ├── Test_AsmSourceTools.cs │ ├── Test_Operand.cs │ ├── Test_ToolsZ3.cs │ └── asm-tools-tests.csproj └── intel-doc-2-data │ ├── Program.cs │ └── intel-doc-2-data.csproj └── Python └── intel-doc-2-md ├── .gitignore ├── copy.cmd ├── get-pip.py ├── intel-doc-2-md.pyproj ├── intel-doc-2-md.sln ├── inteldoc2md ├── __init__.py ├── parser.py ├── pile.py └── writer.py ├── main.py ├── pile ├── __init__.py └── pile.py ├── readme.md ├── resources ├── architecture-instruction-set-extensions-programming-reference-selection.pdf ├── install.pdftk.sh ├── make.sh └── old │ ├── 325462-sdm-vol-1-2abcd-3abcd-selection.pdf │ └── architecture-instruction-set-extensions-programming-reference-selection.PDF └── run.cmd /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | #ignore thumbnails created by windows 3 | Thumbs.db 4 | #Ignore files build by Visual Studio 5 | *.obj 6 | *.exe 7 | *.pdb 8 | *.user 9 | *.aps 10 | *.pch 11 | *.vspscc 12 | *_i.c 13 | *_p.c 14 | *.ncb 15 | *.suo 16 | *.tlb 17 | *.tlh 18 | *.bak 19 | *.cache 20 | *.ilk 21 | *.log 22 | [Dd]ebug*/ 23 | obj/ 24 | [Rr]elease*/ 25 | _ReSharper*/ 26 | [Tt]est[Rr]esult* 27 | *.dropbox.attr 28 | *.tmp_proj 29 | **/.vs/* 30 | 31 | VS/packages/* 32 | VS/Python/intel-doc-2-md/resources/architecture-instruction-set-extensions-programming-reference.pdf 33 | VS/CSHARP/asm-dude-vsix/Resources/Performance/instruction_tables.ods 34 | 35 | #VS/CSHARP/asm-sim-lib/libs/* 36 | **/.idea/* 37 | /VS/CSHARP/asm-dude2-vsix/vsix/** 38 | -------------------------------------------------------------------------------- /Go/.idea/Go.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Go/LoadIntelDoc/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /Go/LoadIntelDoc/Main.go: -------------------------------------------------------------------------------- 1 | /* 2 | * PDF to text: Extract all text for each page of a pdf file. 3 | * 4 | * Run as: go run pdf_extract_text.go input.pdf 5 | */ 6 | 7 | package main 8 | 9 | import ( 10 | "fmt" 11 | "os" 12 | 13 | "github.com/unidoc/unipdf/v3/extractor" 14 | pdf "github.com/unidoc/unipdf/v3/model" 15 | ) 16 | 17 | func main() { 18 | if len(os.Args) < 2 { 19 | fmt.Printf("Usage: go run pdf_extract_text.go input.pdf\n") 20 | os.Exit(1) 21 | } 22 | 23 | // Make sure to enter a valid license key. 24 | // Otherwise text is truncated and a watermark added to the text. 25 | // License keys are available via: https://unidoc.io 26 | /* 27 | license.SetLicenseKey(` 28 | -----BEGIN UNIDOC LICENSE KEY----- 29 | ...key contents... 30 | -----END UNIDOC LICENSE KEY----- 31 | `) 32 | */ 33 | 34 | // For debugging. 35 | // common.SetLogger(common.NewConsoleLogger(common.LogLevelDebug)) 36 | 37 | inputPath := os.Args[1] 38 | 39 | err := outputPdfText(inputPath) 40 | if err != nil { 41 | fmt.Printf("Error: %v\n", err) 42 | os.Exit(1) 43 | } 44 | } 45 | 46 | // outputPdfText prints out contents of PDF file to stdout. 47 | func outputPdfText(inputPath string) error { 48 | f, err := os.Open(inputPath) 49 | if err != nil { 50 | return err 51 | } 52 | 53 | defer f.Close() 54 | 55 | pdfReader, err := pdf.NewPdfReader(f) 56 | if err != nil { 57 | return err 58 | } 59 | 60 | numPages, err := pdfReader.GetNumPages() 61 | if err != nil { 62 | return err 63 | } 64 | 65 | fmt.Printf("--------------------\n") 66 | fmt.Printf("PDF to text extraction:\n") 67 | fmt.Printf("--------------------\n") 68 | for i := 0; i < numPages; i++ { 69 | pageNum := i + 1 70 | 71 | page, err := pdfReader.GetPage(pageNum) 72 | if err != nil { 73 | return err 74 | } 75 | 76 | ex, err := extractor.New(page) 77 | if err != nil { 78 | return err 79 | } 80 | 81 | text, err := ex.ExtractText() 82 | if err != nil { 83 | return err 84 | } 85 | 86 | fmt.Println("------------------------------") 87 | fmt.Printf("Page %d:\n", pageNum) 88 | fmt.Printf("\"%s\"\n", text) 89 | fmt.Println("------------------------------") 90 | } 91 | 92 | return nil 93 | } 94 | -------------------------------------------------------------------------------- /Images/AsmDude-doc-links-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/Images/AsmDude-doc-links-2.png -------------------------------------------------------------------------------- /Images/AsmDude-signature-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/Images/AsmDude-signature-help.png -------------------------------------------------------------------------------- /Images/AsmDude2-code-completion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/Images/AsmDude2-code-completion.png -------------------------------------------------------------------------------- /Images/AsmDude2-descriptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/Images/AsmDude2-descriptions.png -------------------------------------------------------------------------------- /Images/AsmDude2-signature-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/Images/AsmDude2-signature-help.png -------------------------------------------------------------------------------- /Images/AsmDude2-syntax-highlighting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/Images/AsmDude2-syntax-highlighting.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Henk-Jan Lebbink 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /VS/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # CS0162: Unreachable code detected 4 | dotnet_diagnostic.CS0162.severity = warning 5 | -------------------------------------------------------------------------------- /VS/CPP/ConsoleLinuxApplicationTest/main.cpp: -------------------------------------------------------------------------------- 1 | // 'Hello World!' program 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // 0] setup wsl: sudo apt install g++ gdb make rsync zip 8 | // 1] set a breakpoint at line 16. 9 | // 2] hit Local Windows Debugger to run this program, 10 | // 3] the breakpoint will hit, 11 | // 4] Press Control + Alt + D to open the Disassembly window 12 | 13 | int main() 14 | { 15 | //__m512d zmm_a = _mm512_set1_pd(1.0); 16 | //for (int i = 0; i < (1 << 6); ++i) { 17 | // zmm_a = _mm512_div_pd(zmm_a, _mm512_set1_pd(i)); // search for vdivpd in the disassembly window 18 | //} 19 | //std::cout << "Hello world! " << zmm_a[0] << std::endl; // print the result such that it is not optimized away 20 | 21 | //__m256d ymm_a = _mm256_set1_pd(1.0); 22 | //for (int i = 0; i < (1 << 5); ++i) { 23 | // ymm_a = _mm256_div_pd(ymm_a, _mm256_set1_pd(i)); // search for vdivpd in the disassembly window 24 | //} 25 | //std::cout << "Hello world! " << ymm_a[0] << std::endl; // print the result such that it is not optimized away 26 | 27 | __m128d xmm_a = _mm_set1_pd(1.0); 28 | for (int i = 0; i < (1 << 4); ++i) { 29 | xmm_a = _mm_div_pd(xmm_a, _mm_set1_pd(i)); // search for vdivpd in the disassembly window 30 | } 31 | std::cout << "Hello world! " << xmm_a[0] << std::endl; // print the result such that it is not optimized away 32 | 33 | std::cout << "Press any key to exit" << std::endl; 34 | 35 | static_cast(getchar()); 36 | return 0; 37 | } -------------------------------------------------------------------------------- /VS/CPP/ConsoleTest/ConsoleTest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26430.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleTest", "ConsoleTest\ConsoleTest.vcxproj", "{3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Debug|x64.ActiveCfg = Debug|x64 17 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Debug|x64.Build.0 = Debug|x64 18 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Debug|x86.ActiveCfg = Debug|Win32 19 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Debug|x86.Build.0 = Debug|Win32 20 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Release|x64.ActiveCfg = Release|x64 21 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Release|x64.Build.0 = Release|x64 22 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Release|x86.ActiveCfg = Release|Win32 23 | {3999DC4F-3A96-4B9B-805E-6BBDF0B101E1}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /VS/CPP/ConsoleTest/ConsoleTest/ConsoleTest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | 15 | 16 | Source Files 17 | 18 | 19 | -------------------------------------------------------------------------------- /VS/CPP/ConsoleTest/ConsoleTest/Main.cpp: -------------------------------------------------------------------------------- 1 | // 'Hello World!' program 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // 1] set a breakpoint at line 16. 8 | // 2] hit Local Windows Debugger to run this program, 9 | // 3] the breakpoint will hit, 10 | // 4] Press Control + Alt + D to open the Disassembly window 11 | 12 | int main() 13 | { 14 | __m512d zmm_a = _mm512_set1_pd(1.0); 15 | for (int i = 0; i < (1 << 6); ++i) { 16 | zmm_a = _mm512_div_pd(zmm_a, _mm512_set1_pd(i)); // search for vdivpd in the disassembly window 17 | } 18 | 19 | std::cout << "Hello world! " << zmm_a.m512d_f64[0] << std::endl; // print the result such that it is not optimized away 20 | std::cout << "Press any key to exit" << std::endl; 21 | 22 | static_cast(getchar()); 23 | return 0; 24 | } -------------------------------------------------------------------------------- /VS/CPP/ConsoleTest/example_semantic_analysis2.asm: -------------------------------------------------------------------------------- 1 | ;mov rax, 10 2 | cmp rax, 0 3 | jz label1 4 | xor rax, rax 5 | mov rcx, rax 6 | add rax, 1 7 | label1: 8 | inc rax 9 | mov rbx, rax 10 | mov rax, rbx 11 | 12 | 13 | 14 | mov rcx, 10 15 | labelx: 16 | dec rcx 17 | jnz labelx 18 | mov rax, rcx 19 | 20 | aaa 21 | 22 | mov rcx, 10 23 | mov r10, rcx ; store the parameter rcx in r10 24 | ;mod3 PROC 25 | ; parameter 1: rcx 26 | mov r8, 0aaaaaaaaaaaaaaabH ;; (scaled) reciprocal of 3 27 | mov rax, rcx 28 | mul r8 ;; multiply with reciprocal 29 | shr rdx, 1 ;; quotient 30 | lea r9, QWORD PTR [rdx+rdx*2] ;; back multiply with 3 31 | neg r9 32 | add rcx, r9 ;; subtract from dividend 33 | ;mov rax, rcx ;; remainder 34 | ; rcx has the result (mod3) 35 | 36 | ; ret 37 | ;mod3 ENDP 38 | 39 | 40 | mov rax, r10 41 | xor rdx, rdx 42 | mov r8, 3 43 | idiv r8 44 | ; rdx has the result (mod3) 45 | 46 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-annotate/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace asm_annotate 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | Console.WriteLine("Hello World!"); 10 | ParserXed.ParseFile(@".\data\icelake.csv"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-annotate/asm-annotate.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0-windows8.0 6 | asm_annotate 7 | AnyCPU 8 | 8.0 9 | True 10 | True 11 | x64 12 | 13 | 14 | 15 | 16 | all 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | 19 | 20 | all 21 | runtime; build; native; contentfiles; analyzers; buildtransitive 22 | 23 | 24 | 25 | all 26 | runtime; build; native; contentfiles; analyzers; buildtransitive 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Always 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-annotate/data/10th generation Intel Core Processor based on Ice Lake microarchitecture Throughput and Latency README.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-annotate/data/10th generation Intel Core Processor based on Ice Lake microarchitecture Throughput and Latency README.pdf -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocClassificationDefinition.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.AsmDoc 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Text.Classification; 27 | using Microsoft.VisualStudio.Utilities; 28 | 29 | internal static class AsmDocClassificationDefinition 30 | { 31 | internal static class ClassificationTypeNames 32 | { 33 | public const string Underline = "underline-D74860FA-F0BC-4441-9D76-DF4ECB19CF71"; 34 | } 35 | 36 | [Export(typeof(ClassificationTypeDefinition))] 37 | [Name(ClassificationTypeNames.Underline)] 38 | internal static ClassificationTypeDefinition UnderlineClassificationType = null; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocClassificationFormat.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.AsmDoc 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Text.Classification; 27 | using Microsoft.VisualStudio.Utilities; 28 | 29 | [Export(typeof(EditorFormatDefinition))] 30 | [ClassificationType(ClassificationTypeNames = AsmDocClassificationDefinition.ClassificationTypeNames.Underline)] 31 | [Name("underline-693485E0-B4BC-47D2-B4E1-177E9AF0C445")] 32 | [UserVisible(true)] // sets this editor format definition visible for the user (in Tools>Options>Environment>Fonts and Colors>Text Editor 33 | [Order(Before = Priority.High)] //set the priority to be after the default classifiers 34 | internal sealed class UnderlineFormatDefinition : ClassificationFormatDefinition 35 | { 36 | public UnderlineFormatDefinition() 37 | { 38 | this.DisplayName = "AsmDude - Documentation Link"; 39 | this.TextDecorations = System.Windows.TextDecorations.Underline; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocKeyProcessor.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.AsmDoc 24 | { 25 | using System.Windows.Input; 26 | using Microsoft.VisualStudio.Text.Editor; 27 | 28 | /// 29 | /// Listen for the control key being pressed or released to update the CtrlKeyStateChanged for a view. 30 | /// 31 | internal sealed class AsmDocKeyProcessor : KeyProcessor 32 | { 33 | private readonly CtrlKeyState state_; 34 | 35 | public AsmDocKeyProcessor(CtrlKeyState state) 36 | { 37 | this.state_ = state; 38 | } 39 | 40 | private void UpdateState(KeyEventArgs args) 41 | { 42 | this.state_.Enabled = 43 | ((args.KeyboardDevice.Modifiers & ModifierKeys.Control) != 0) && 44 | ((args.KeyboardDevice.Modifiers & ModifierKeys.Shift) == 0); 45 | } 46 | 47 | public override void PreviewKeyDown(KeyEventArgs args) 48 | { 49 | this.UpdateState(args); 50 | } 51 | 52 | public override void PreviewKeyUp(KeyEventArgs args) 53 | { 54 | this.UpdateState(args); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocKeyProcessorProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.AsmDoc 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Text.Editor; 27 | using Microsoft.VisualStudio.Utilities; 28 | 29 | [Export(typeof(IKeyProcessorProvider))] 30 | [ContentType(AsmDudePackage.AsmDudeContentType)] 31 | [ContentType(AsmDudePackage.DisassemblyContentType)] 32 | [Name("AsmDocKeyProcessorProvider")] 33 | [Order(Before = "VisualStudioKeyboardProcessor")] 34 | internal sealed class AsmDocKeyProcessorProvider : IKeyProcessorProvider 35 | { 36 | public KeyProcessor GetAssociatedProcessor(IWpfTextView view) 37 | { 38 | //AsmDudeToolsStatic.Output_INFO("AsmDocKeyProcessorProvider:GetAssociatedProcessor: file=" + AsmDudeToolsStatic.GetFileName(view.TextBuffer)); 39 | AsmDocKeyProcessor sc() 40 | { 41 | return new AsmDocKeyProcessor(CtrlKeyState.GetStateForView(view)); 42 | } 43 | return view.Properties.GetOrCreateSingletonProperty(typeof(AsmDocKeyProcessor), sc); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocMouseHandlerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.AsmDoc 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Text.Editor; 27 | using Microsoft.VisualStudio.Text.Tagging; 28 | using Microsoft.VisualStudio.Utilities; 29 | 30 | [Export(typeof(IMouseProcessorProvider))] 31 | [ContentType(AsmDudePackage.AsmDudeContentType)] 32 | [ContentType(AsmDudePackage.DisassemblyContentType)] 33 | [Name("AsmDocMouseHandlerProvider")] 34 | [TextViewRole(PredefinedTextViewRoles.Debuggable)] // necessary for disassembly window 35 | [Order(Before = "WordSelection")] 36 | internal sealed class AsmDocMouseHandlerProvider : IMouseProcessorProvider 37 | { 38 | [Import] 39 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 40 | 41 | public IMouseProcessor GetAssociatedProcessor(IWpfTextView view) 42 | { 43 | return new AsmDocMouseHandler( 44 | view, 45 | this.aggregatorFactory_, 46 | CtrlKeyState.GetStateForView(view), 47 | AsmDudeTools.Instance); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDoc/AsmDocUnderlineTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.AsmDoc 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Text; 27 | using Microsoft.VisualStudio.Text.Classification; 28 | using Microsoft.VisualStudio.Text.Editor; 29 | using Microsoft.VisualStudio.Text.Tagging; 30 | using Microsoft.VisualStudio.Utilities; 31 | 32 | [Export(typeof(IViewTaggerProvider))] 33 | [ContentType(AsmDudePackage.AsmDudeContentType)] 34 | [ContentType(AsmDudePackage.DisassemblyContentType)] 35 | [Name("AsmDocUnderlineTaggerProvider")] 36 | [TagType(typeof(ClassificationTag))] 37 | internal sealed class AsmDocUnderlineTaggerProvider : IViewTaggerProvider 38 | { 39 | [Import] 40 | private readonly IClassificationTypeRegistryService classificationTypeRegistry_ = null; 41 | 42 | private static IClassificationType underlineClassification = null; 43 | 44 | public static AsmDocUnderlineTagger GetClassifierForView(ITextView view) 45 | { 46 | return (underlineClassification == null) ? null : view.Properties.GetOrCreateSingletonProperty(() => new AsmDocUnderlineTagger(view, underlineClassification)); 47 | } 48 | 49 | public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag 50 | { 51 | if (textView == null) 52 | { 53 | return null; 54 | } 55 | 56 | if (textView.TextBuffer != buffer) 57 | { 58 | return null; 59 | } 60 | 61 | //AsmDudeToolsStatic.Output_INFO("AsmDocUnderlineTaggerProvider:CreateTagger: file=" + AsmDudeToolsStatic.GetFileName(buffer)); 62 | if (underlineClassification == null) 63 | { 64 | underlineClassification = this.classificationTypeRegistry_.GetClassificationType(AsmDocClassificationDefinition.ClassificationTypeNames.Underline); 65 | } 66 | return GetClassifierForView(textView) as ITagger; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDoc/CtrlKeyState.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.AsmDoc 24 | { 25 | using System; 26 | using System.Windows.Input; 27 | using Microsoft.VisualStudio.Text.Editor; 28 | 29 | /// 30 | /// The state of the control key for a given view, which is kept up-to-date by a combination of the 31 | /// key processor and the mouse process 32 | /// 33 | internal sealed class CtrlKeyState 34 | { 35 | internal static CtrlKeyState GetStateForView(ITextView view) 36 | { 37 | return view.Properties.GetOrCreateSingletonProperty(typeof(CtrlKeyState), () => new CtrlKeyState()); 38 | } 39 | 40 | public CtrlKeyState() 41 | { 42 | //AsmDudeToolsStatic.Output_INFO("CtrlKeyState:Constructor"); 43 | } 44 | 45 | private bool enabled_ = false; 46 | 47 | internal bool Enabled 48 | { 49 | get 50 | { 51 | // Check and see if ctrl is down but we missed it somehow. 52 | bool ctrlDown = (Keyboard.Modifiers & ModifierKeys.Control) != 0 && 53 | (Keyboard.Modifiers & ModifierKeys.Shift) == 0; 54 | if (ctrlDown != this.enabled_) 55 | { 56 | this.Enabled = ctrlDown; 57 | } 58 | return this.enabled_; 59 | } 60 | 61 | set 62 | { 63 | bool oldVal = this.enabled_; 64 | this.enabled_ = value; 65 | if (oldVal != this.enabled_) 66 | { 67 | this.CtrlKeyStateChanged?.Invoke(this, new EventArgs()); 68 | } 69 | } 70 | } 71 | 72 | internal event EventHandler CtrlKeyStateChanged; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/AsmDudePackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/AsmDudePackage.ico -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/BraceMatching/BraceMatchingTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.BraceMatching 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Text; 27 | using Microsoft.VisualStudio.Text.Editor; 28 | using Microsoft.VisualStudio.Text.Tagging; 29 | using Microsoft.VisualStudio.Utilities; 30 | 31 | [Export(typeof(IViewTaggerProvider))] 32 | [ContentType(AsmDudePackage.AsmDudeContentType)] 33 | [TagType(typeof(TextMarkerTag))] 34 | [TextViewRole(PredefinedTextViewRoles.Document)] 35 | 36 | internal sealed class BraceMatchingTaggerProvider : IViewTaggerProvider 37 | { 38 | public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag 39 | { 40 | if (textView == null) 41 | { 42 | return null; 43 | } 44 | //provide highlighting only on the top-level buffer 45 | if (textView.TextBuffer != buffer) 46 | { 47 | return null; 48 | } 49 | 50 | ITagger sc() 51 | { 52 | return new BraceMatchingTagger(textView, buffer) as ITagger; 53 | } 54 | return buffer.Properties.GetOrCreateSingletonProperty(sc); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/ClearMefCache/ClearMefCache.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.ClearMefCache 24 | { 25 | using System.IO; 26 | using Microsoft; 27 | using Microsoft.VisualStudio.Shell; 28 | using Microsoft.VisualStudio.Shell.Interop; 29 | 30 | internal sealed class ClearMefCache 31 | { 32 | private ClearMefCache(AsyncPackage package) 33 | { 34 | this.ServiceProvider = package; 35 | } 36 | 37 | private static ClearMefCache instance; 38 | 39 | private AsyncPackage ServiceProvider { get; } 40 | 41 | public static void Initialize(AsyncPackage package) 42 | { 43 | instance = new ClearMefCache(package); 44 | } 45 | 46 | //Clear the MEF Cache 47 | public static async System.Threading.Tasks.Task ClearAsync() 48 | { 49 | if (!ThreadHelper.CheckAccess()) 50 | { 51 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 52 | } 53 | 54 | IVsComponentModelHost componentModelHost = await instance.ServiceProvider.GetServiceAsync(typeof(SVsComponentModelHost)).ConfigureAwait(true) as IVsComponentModelHost; 55 | if (componentModelHost != null) 56 | { 57 | string folder = await componentModelHost.GetFolderPathAsync().ConfigureAwait(true); 58 | 59 | if (!string.IsNullOrEmpty(folder) && Directory.Exists(folder)) 60 | { 61 | Directory.Delete(folder, true); 62 | } 63 | } 64 | } 65 | 66 | //Restart Visual Studio 67 | public static async System.Threading.Tasks.Task RestartAsync() 68 | { 69 | if (!ThreadHelper.CheckAccess()) 70 | { 71 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 72 | } 73 | 74 | IVsShell4 shell = await instance.ServiceProvider.GetServiceAsync(typeof(SVsShell)).ConfigureAwait(true) as IVsShell4; 75 | Assumes.Present(shell); 76 | shell.Restart((uint)__VSRESTARTTYPE.RESTART_Normal); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/ClearMefCache/ComponentModelExtensions.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.ClearMefCache 24 | { 25 | using System.Diagnostics.Contracts; 26 | using System.Threading.Tasks; 27 | using Microsoft.VisualStudio.Shell; 28 | using Microsoft.VisualStudio.Shell.Interop; 29 | 30 | public static class ComponentModelExtensions 31 | { 32 | public static async Task GetFolderPathAsync(this IVsComponentModelHost componentModelHost) 33 | { 34 | Contract.Requires(componentModelHost != null); 35 | 36 | if (!ThreadHelper.CheckAccess()) 37 | { 38 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 39 | } 40 | 41 | componentModelHost.GetCatalogCacheFolder(out string folderPath); 42 | return folderPath; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeCompletion/CodeCompletionSourceProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude 24 | { 25 | using System.ComponentModel.Composition; 26 | using System.Diagnostics.Contracts; 27 | using AsmDude.Tools; 28 | using Microsoft.VisualStudio.Language.Intellisense; 29 | using Microsoft.VisualStudio.Text; 30 | using Microsoft.VisualStudio.Text.Editor; 31 | using Microsoft.VisualStudio.Text.Tagging; 32 | using Microsoft.VisualStudio.Utilities; 33 | 34 | [Export(typeof(ICompletionSourceProvider))] 35 | [ContentType(AsmDudePackage.AsmDudeContentType)] 36 | [Name("asmCompletion")] 37 | [TextViewRole(PredefinedTextViewRoles.Document)] 38 | public sealed class CodeCompletionSourceProvider : ICompletionSourceProvider 39 | { 40 | [Import] 41 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 42 | 43 | [Import] 44 | private readonly ITextDocumentFactoryService docFactory_ = null; 45 | 46 | [Import] 47 | private readonly IContentTypeRegistryService contentService_ = null; 48 | 49 | public ICompletionSource TryCreateCompletionSource(ITextBuffer buffer) 50 | { 51 | Contract.Requires(buffer != null); 52 | CodeCompletionSource sc() 53 | { 54 | LabelGraph labelGraph = AsmDudeToolsStatic.GetOrCreate_Label_Graph(buffer, this.aggregatorFactory_, this.docFactory_, this.contentService_); 55 | AsmSimulator asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(buffer, this.aggregatorFactory_); 56 | return new CodeCompletionSource(buffer, labelGraph, asmSimulator); 57 | } 58 | return buffer.Properties.GetOrCreateSingletonProperty(sc); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeCompletion/VsTextViewCreationListener.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.CodeCompletion 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Editor; 27 | using Microsoft.VisualStudio.Language.Intellisense; 28 | using Microsoft.VisualStudio.Text.Editor; 29 | using Microsoft.VisualStudio.TextManager.Interop; 30 | using Microsoft.VisualStudio.Utilities; 31 | 32 | [Export(typeof(IVsTextViewCreationListener))] 33 | [ContentType(AsmDudePackage.AsmDudeContentType)] 34 | [TextViewRole(PredefinedTextViewRoles.Interactive)] 35 | internal sealed class VsTextViewCreationListener : IVsTextViewCreationListener 36 | { 37 | [Import] 38 | private readonly IVsEditorAdaptersFactoryService adaptersFactory_ = null; 39 | 40 | [Import] 41 | private readonly ICompletionBroker completionBroker_ = null; 42 | 43 | public void VsTextViewCreated(IVsTextView textViewAdapter) 44 | { 45 | IWpfTextView view = this.adaptersFactory_.GetWpfTextView(textViewAdapter); 46 | CodeCompletionCommandFilter filter = new CodeCompletionCommandFilter(view, this.completionBroker_); 47 | textViewAdapter.AddCommandFilter(filter, out Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget next); 48 | filter.NextCommandHandler = next; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeFolding/CodeFoldingTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.CodeFolding 24 | { 25 | using System.ComponentModel.Composition; 26 | using AsmDude.Tools; 27 | using Microsoft.VisualStudio.Text; 28 | using Microsoft.VisualStudio.Text.Editor; 29 | using Microsoft.VisualStudio.Text.Tagging; 30 | using Microsoft.VisualStudio.Utilities; 31 | 32 | /// 33 | /// Export a 34 | /// 35 | [Export(typeof(ITaggerProvider))] 36 | [ContentType(AsmDudePackage.AsmDudeContentType)] 37 | [TagType(typeof(IOutliningRegionTag))] 38 | [TextViewRole(PredefinedTextViewRoles.Document)] 39 | internal sealed class CodeFoldingTaggerProvider : ITaggerProvider 40 | { 41 | [Import] 42 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 43 | 44 | /// 45 | /// This method is called by VS to generate the tagger 46 | /// 47 | /// 48 | /// The text view we are creating a tagger for 49 | /// Returns a OutliningTagger instance 50 | public ITagger CreateTagger(ITextBuffer buffer) where T : ITag 51 | { 52 | ITagger sc() 53 | { 54 | ITagAggregator aggregator = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, this.aggregatorFactory_); 55 | return new CodeFoldingTagger(buffer, aggregator, AsmDudeTools.Instance.Error_List_Provider) as ITagger; 56 | } 57 | return buffer.Properties.GetOrCreateSingletonProperty(sc); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeFormatting/CodeLayout.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26127.3 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeLayout", "CodeLayout.csproj", "{F3E3199F-C005-4A14-B96B-974896986EDC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {F3E3199F-C005-4A14-B96B-974896986EDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {F3E3199F-C005-4A14-B96B-974896986EDC}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {F3E3199F-C005-4A14-B96B-974896986EDC}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {F3E3199F-C005-4A14-B96B-974896986EDC}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeFormatting/CustomMoniker.vsct: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeFormatting/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. Project-level 3 | // suppressions either have no target or are given a specific target 4 | // and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Error List, point to "Suppress Message(s)", and click "In Project 8 | // Suppression File". You do not need to add suppressions to this 9 | // file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")] 12 | 13 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeFormatting/Guids.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | 9 | ***************************************************************************/ 10 | 11 | using System; 12 | 13 | namespace Microsoft.Samples.VisualStudio.MenuCommands 14 | { 15 | /// 16 | /// This class is used only to expose the list of Guids used by this package. 17 | /// This list of guids must match the set of Guids used inside the VSCT file. 18 | /// 19 | internal static class GuidsList 20 | { 21 | // Now define the list of guids as public static members. 22 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 23 | public static readonly Guid guidMenuAndCommandsPkg = new Guid("{3C7C5ABE-82AC-4A37-B077-0FF60E8B1FD3}"); 24 | public const string guidMenuAndCommandsPkg_string = "3C7C5ABE-82AC-4A37-B077-0FF60E8B1FD3"; 25 | 26 | public static readonly Guid guidMenuAndCommandsCmdSet = new Guid("{19492BCB-32B3-4EC3-8826-D67CD5526653}"); 27 | 28 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 29 | public static readonly Guid guidGenericCmdBmp = new Guid("{0A4C51BD-3239-4370-8869-16E0AE8C0A46}"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/CodeFormatting/PkgCmdId.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | 9 | ***************************************************************************/ 10 | 11 | using System; 12 | 13 | namespace Microsoft.Samples.VisualStudio.MenuCommands 14 | { 15 | /// 16 | /// This class is used to expose the list of the IDs of the commands implemented 17 | /// by this package. This list of IDs must match the set of IDs defined inside the 18 | /// Buttons section of the VSCT file. 19 | /// 20 | internal static class PkgCmdIDList 21 | { 22 | // Now define the list a set of public static members. 23 | public const int asmDudeCommand1 = 0x2001; 24 | public const int asmDudeCommand2 = 0x2002; 25 | public const int asmDudeCommand3 = 0x2003; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Experimental/CurrentLine/AdornmentFactory.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Text.Editor; 3 | using Microsoft.VisualStudio.Utilities; 4 | using Microsoft.VisualStudio.Text.Classification; 5 | using System.Windows.Media; 6 | using AsmDude; 7 | 8 | namespace Winterdom.VisualStudio.Extensions.Text 9 | { 10 | /* 11 | 12 | 13 | static class CurrentLineClassificationDefinition 14 | { 15 | [Export(typeof(ClassificationTypeDefinition))] 16 | [Name(LineHighlight.NAME)] 17 | internal static ClassificationTypeDefinition CurrentLineClassificationType = null; 18 | } 19 | 20 | [Export(typeof(EditorFormatDefinition))] 21 | [ClassificationType(ClassificationTypeNames = LineHighlight.NAME)] 22 | [Name(LineHighlight.NAME)] 23 | [UserVisible(true)] 24 | [Order(Before = Priority.Default)] 25 | sealed class CurrentLineFormat : ClassificationFormatDefinition 26 | { 27 | public CurrentLineFormat() 28 | { 29 | this.BackgroundColor = Colors.Teal; 30 | this.ForegroundColor = Colors.DarkCyan; 31 | this.BackgroundOpacity = 0.3; 32 | } 33 | } 34 | 35 | [Export(typeof(IWpfTextViewCreationListener))] 36 | [ContentType(AsmDudePackage.AsmDudeContentType)] 37 | [TextViewRole(PredefinedTextViewRoles.Document)] 38 | internal sealed class EditorAdornmentFactory : IWpfTextViewCreationListener 39 | { 40 | [Import] 41 | public IClassificationTypeRegistryService ClassificationRegistry = null; 42 | [Import] 43 | public IClassificationFormatMapService FormatMapService = null; 44 | 45 | [Export(typeof(AdornmentLayerDefinition))] 46 | [Name(LineHighlight.NAME)] 47 | [Order(Before = "Selection")] 48 | [TextViewRole(PredefinedTextViewRoles.Document)] 49 | public AdornmentLayerDefinition editorAdornmentLayer = null; 50 | 51 | public void TextViewCreated(IWpfTextView textView) 52 | { 53 | IClassificationType classification = ClassificationRegistry.GetClassificationType(LineHighlight.NAME); 54 | IClassificationFormatMap map = FormatMapService.GetClassificationFormatMap(textView); 55 | new LineHighlight(textView, map, classification); 56 | } 57 | } 58 | 59 | */ 60 | } 61 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Experimental/Menu/DynamicTextCommand.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | 9 | ***************************************************************************/ 10 | 11 | using Microsoft.VisualStudio.Shell; 12 | using System; 13 | using System.ComponentModel.Design; 14 | using System.Globalization; 15 | 16 | namespace AsmDude 17 | { 18 | /// 19 | /// This class implements a very specific type of command: this command will count the 20 | /// number of times the user has clicked on it and will change its text to show this count. 21 | /// 22 | internal class DynamicTextCommand : OleMenuCommand 23 | { 24 | // Counter of the clicks. 25 | private int clickCount; 26 | 27 | /// 28 | /// This is the function that is called when the user clicks on the menu command. 29 | /// It will check that the selected object is actually an instance of this class and 30 | /// increment its click counter. 31 | /// 32 | private static void ClickCallback(object sender, EventArgs args) 33 | { 34 | DynamicTextCommand cmd = sender as DynamicTextCommand; 35 | if (null != cmd) 36 | { 37 | cmd.clickCount++; 38 | } 39 | } 40 | 41 | /// 42 | /// Creates a new DynamicTextCommand object with a specific CommandID and base text. 43 | /// 44 | public DynamicTextCommand(CommandID id, string text) : 45 | base(new EventHandler(ClickCallback), id, text) 46 | { 47 | } 48 | 49 | /// 50 | /// If a command is defined with the TEXTCHANGES flag in the VSCT file and this package is 51 | /// loaded, then Visual Studio will call this property to get the text to display. 52 | /// 53 | public override string Text 54 | { 55 | get 56 | { 57 | //return string.Format(CultureInfo.CurrentCulture, VsPackage.ResourceManager.GetString("DynamicTextFormat"), base.Text, clickCount); 58 | return ""; 59 | } 60 | set { base.Text = value; } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Experimental/Menu/PkgCmdId.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | 9 | ***************************************************************************/ 10 | 11 | using System; 12 | 13 | namespace AsmDude { 14 | 15 | /// 16 | /// This class is used to expose the list of the IDs of the commands implemented 17 | /// by this package. This list of IDs must match the set of IDs defined inside the 18 | /// Buttons section of the VSCT file. 19 | /// 20 | internal static class PkgCmdIDList 21 | { 22 | // Now define the list a set of public static members. 23 | public const int cmdidMyCommand = 0x2001; 24 | public const int cmdidMyGraph = 0x2002; 25 | public const int cmdidMyZoom = 0x2003; 26 | public const int cmdidDynamicTxt = 0x2004; 27 | public const int cmdidDynVisibility1 = 0x2005; 28 | public const int cmdidDynVisibility2 = 0x2006; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Key.snk -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Henk-Jan Lebbink 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | using System.Reflection; 24 | using System.Runtime.InteropServices; 25 | using AsmDude; 26 | 27 | // General Information about an assembly is controlled through the following 28 | // set of attributes. Change these attribute values to modify the information 29 | // associated with an assembly. 30 | [assembly: AssemblyTitle("AsmDude")] 31 | [assembly: AssemblyDescription("AsmDude")] 32 | [assembly: AssemblyConfiguration("")] 33 | [assembly: AssemblyCompany("Lebbink")] 34 | [assembly: AssemblyProduct("AsmDude")] 35 | [assembly: AssemblyCopyright("Copyright © Henk-Jan Lebbink 2021")] 36 | [assembly: AssemblyTrademark("")] 37 | [assembly: AssemblyCulture("")] 38 | 39 | // Version information for an assembly consists of the following four values: 40 | // 41 | // Major Version 42 | // Minor Version 43 | // Build Number 44 | // Revision 45 | // 46 | // You can specify all the values or you can default the Build and Revision Numbers 47 | // by using the '*' as shown below: 48 | // [assembly: AssemblyVersion("1.0.*")] 49 | //[assembly: AssemblyVersion("1.0.0.0")] 50 | //[assembly: AssemblyFileVersion("1.0.0.0")] 51 | [assembly: AssemblyVersion(Vsix.Version)] 52 | [assembly: AssemblyFileVersion(Vsix.Version)] 53 | 54 | // Setting ComVisible to false makes the types in this assembly not visible 55 | // to COM components. If you need to access a type in this assembly from 56 | // COM, set the ComVisible attribute to true on that type. 57 | [assembly: ComVisible(false)] 58 | 59 | // Mark the assembly as not CLSCompliant 60 | //[assembly: System.CLSCompliant(false)] 61 | [assembly: Guid("c729d6b2-f412-49ed-893d-a8f61f25db98")] 62 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Properties/Guids.cs: -------------------------------------------------------------------------------- 1 | namespace AsmDude 2 | { 3 | internal static class Guids 4 | { 5 | public const string GuidOptionsPageAsmDude = "3940DE73-43EF-44B6-8EC2-E3686FC40354"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoControllerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.QuickInfo 24 | { 25 | using System.Collections.Generic; 26 | using System.ComponentModel.Composition; 27 | using AsmDude.Tools; 28 | using Microsoft.VisualStudio.Language.Intellisense; 29 | using Microsoft.VisualStudio.Text; 30 | using Microsoft.VisualStudio.Text.Editor; 31 | using Microsoft.VisualStudio.Text.Tagging; 32 | using Microsoft.VisualStudio.Utilities; 33 | 34 | [Export(typeof(IIntellisenseControllerProvider))] 35 | [ContentType(AsmDudePackage.DisassemblyContentType)] 36 | [Name("AsmQuickInfoControllerProvider")] 37 | [TextViewRole(PredefinedTextViewRoles.Debuggable)] 38 | internal sealed class AsmQuickInfoControllerProvider : IIntellisenseControllerProvider 39 | { 40 | [Import] 41 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 42 | 43 | [Import] 44 | private readonly IAsyncQuickInfoBroker quickInfoBroker_ = null; 45 | 46 | public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList subjectBuffers) 47 | { 48 | AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:TryCreateIntellisenseController", this.ToString())); 49 | //NOTE the QuickInfoController is only for the disassembly window, not for the regular windows 50 | return new AsmQuickInfoController(textView, subjectBuffers, this.quickInfoBroker_, this.aggregatorFactory_); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/QuickInfo/AsmQuickInfoSourceProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.QuickInfo 24 | { 25 | using System.ComponentModel.Composition; 26 | using AsmDude.Tools; 27 | using Microsoft.VisualStudio.Language.Intellisense; 28 | using Microsoft.VisualStudio.Text; 29 | using Microsoft.VisualStudio.Text.Editor; 30 | using Microsoft.VisualStudio.Text.Tagging; 31 | using Microsoft.VisualStudio.Utilities; 32 | 33 | 34 | [Export(typeof(IAsyncQuickInfoSourceProvider))] 35 | [ContentType(AsmDudePackage.AsmDudeContentType)] 36 | [TextViewRole(PredefinedTextViewRoles.Debuggable)] 37 | [Name("AsmQuickInfoSourceProvider")] 38 | [Order] 39 | internal sealed class QuickInfoSourceProvider : IAsyncQuickInfoSourceProvider 40 | { 41 | [Import] 42 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 43 | 44 | [Import] 45 | private readonly ITextDocumentFactoryService docFactory_ = null; 46 | 47 | [Import] 48 | private readonly IContentTypeRegistryService contentService_ = null; 49 | 50 | public IAsyncQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer) 51 | { 52 | AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:TryCreateQuickInfoSource", this.ToString())); 53 | AsmQuickInfoSource sc() 54 | { 55 | LabelGraph labelGraph = AsmDudeToolsStatic.GetOrCreate_Label_Graph(textBuffer, this.aggregatorFactory_, this.docFactory_, this.contentService_); 56 | AsmSimulator asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(textBuffer, this.aggregatorFactory_); 57 | return new AsmQuickInfoSource(textBuffer, this.aggregatorFactory_, labelGraph, asmSimulator); 58 | } 59 | return textBuffer.Properties.GetOrCreateSingletonProperty(sc); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/QuickInfo/ButtonInfo.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | 24 | // thib 25 | namespace AsmDude.QuickInfo 26 | { 27 | using System.Windows.Controls; 28 | using AsmTools; 29 | 30 | public class ButtonInfo 31 | { 32 | public readonly TextBox Text; 33 | public readonly Rn Reg; 34 | public readonly Flags Flag; 35 | public readonly bool Before; 36 | 37 | public ButtonInfo(TextBox text, Rn reg, bool before) 38 | { 39 | this.Text = text; 40 | this.Reg = reg; 41 | this.Flag = Flags.NONE; 42 | this.Before = before; 43 | } 44 | 45 | public ButtonInfo(TextBox text, Flags flag, bool before) 46 | { 47 | this.Text = text; 48 | this.Reg = Rn.NOREG; 49 | this.Flag = flag; 50 | this.Before = before; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/QuickInfo/RegisterTooltipWindow.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | Center 24 | Center 25 | 26 | HEX 27 | BIN 28 | DEC 29 | OCT 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/QuickInfo/TextBoxWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/QuickInfo/TextBoxWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AsmDude.QuickInfo 2 | { 3 | using Microsoft.VisualStudio.Language.Intellisense; 4 | 5 | /// 6 | /// Interaction logic for TextBoxWindow.xaml 7 | /// 8 | public partial class TextBoxWindow : IInteractiveQuickInfoContent 9 | { 10 | public TextBoxWindow() 11 | { 12 | this.InitializeComponent(); 13 | } 14 | 15 | public bool KeepQuickInfoOpen 16 | { 17 | get 18 | { 19 | return this.IsMouseOverAggregated || this.IsKeyboardFocusWithin || this.IsKeyboardFocused || this.IsFocused; 20 | } 21 | } 22 | 23 | public bool IsMouseOverAggregated 24 | { 25 | get 26 | { 27 | return this.IsMouseOver || this.IsMouseDirectlyOver; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/Performance/Broadwell.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/Performance/Broadwell.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/Performance/Haswell.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/Performance/Haswell.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/Performance/IvyBridge.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/Performance/IvyBridge.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/Performance/Skylake.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/Performance/Skylake.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/Performance/SkylakeX.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/Performance/SkylakeX.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/TextFile1.asm: -------------------------------------------------------------------------------- 1 | 2 | mov rax, -10 3 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/all_mnemonics.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/examples/all_mnemonics.asm -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/data.foo: -------------------------------------------------------------------------------- 1 | This is a xyzzy file. 2 | 3 | blah 4 | blah 5 | 6 | bla 7 | 8 | vxpor 9 | 10 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/example_att.s: -------------------------------------------------------------------------------- 1 | .text 2 | LC0: 3 | .ascii "Hello, world!\12\0" 4 | .globl _main 5 | _main: 6 | pushl %ebp 7 | movl %esp, %ebp 8 | subl $8, %esp 9 | andl $-16, %esp 10 | movl $0, %eax 11 | movl %eax, -4(%ebp) 12 | movl -4(%ebp), %eax 13 | call __alloca 14 | call ___main 15 | movl $LC0, (%esp) 16 | call _printf 17 | movl $0, %eax 18 | leave 19 | ret 20 | 21 | 22 | _static_initialization_and_destruction_0(int, int): 23 | push %rbp 24 | mov %rsp,%rbp 25 | sub $0x10,%rsp 26 | mov %edi,-0x4(%rbp) 27 | mov %esi,-0x8(%rbp) 28 | cmpl $0x1,-0x4(%rbp) 29 | jne 0x8000d1c <__static_initialization_and_destruction_0(int, int)+70> 30 | cmpl $0xffff,-0x8(%rbp) 31 | jne 0x8000d1c <__static_initialization_and_destruction_0(int, int)+70> 32 | lea 0x201437(%rip),%rdi # 0x8202131 <_ZStL8__ioinit> 33 | callq 0x8000880 <_ZNSt8ios_base4InitC1Ev@plt> 34 | lea 0x201302(%rip),%rdx # 0x8202008 35 | lea 0x201424(%rip),%rsi # 0x8202131 <_ZStL8__ioinit> 36 | mov 0x2012e4(%rip),%rax # 0x8201ff8 37 | mov %rax,%rdi 38 | callq 0x8000830 <__cxa_atexit@plt> 39 | nop 40 | leaveq 41 | retq 42 | 43 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/example_masm2.asm: -------------------------------------------------------------------------------- 1 | ;#region 2 | extrn printf : proc 3 | ;#endregion 4 | 5 | include "inc\example.inc" 6 | jmp FOO # FOO is defined in an included file 7 | call procedure3 8 | 9 | 10 | procedure1 PROTO a, b 11 | 12 | global_label1: 13 | xor rcx, rcx 14 | 15 | procedure1A PROC a, b 16 | jmp local_label1 17 | local_label1: 18 | call printf 19 | 20 | procedure1A ENDP 21 | 22 | procedure2 PROC 23 | call procedure1A 24 | invoke procedure1 25 | jmp local_label1 26 | 27 | local_label1: 28 | jmp global_label1 29 | 30 | procedure2 ENDP 31 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/example_semantic_analysis.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | 3 | #region Unreachable code 4 | #pragma assume mov al, 1 << 3 5 | cmp al, 1<<3 6 | jz label2 7 | mov al, 1 8 | jz label2 9 | mov al, 2 10 | label2: 11 | mov rbx, rax 12 | #endregion 13 | 14 | 15 | #pragma assume HLT ; HLT instruction will reset the simulator 16 | 17 | 18 | #region negative constants 19 | mov rax, -10 20 | mov rbx, 10 21 | add rax, rbx 22 | #endregion 23 | 24 | 25 | #pragma assume HLT ; HLT instruction will reset the simulator 26 | 27 | 28 | #region Jump test 29 | cmp al, 0 30 | jp label1 31 | mov al, 1 32 | jc label1 33 | mov al, 3 34 | jnz label1 35 | mov al, 2 36 | label1: 37 | mov rbx, rax 38 | #endregion 39 | 40 | 41 | #pragma assume HLT ; HLT instruction will reset the simulator 42 | 43 | 44 | #region Semantic Error: usage of undefined register ax 45 | mov cl, bl 46 | xor cx, bx 47 | bsf ax, cx 48 | inc rax 49 | #endregion 50 | 51 | 52 | #pragma assume HLT ; HLT instruction will reset the simulator 53 | 54 | 55 | #region Test unimplemented instructions do not destroy known register content 56 | mov rax, 10 57 | subpd xmm1, xmm2 58 | mov rbx, rax # rbx has content 10 59 | #endregion 60 | 61 | 62 | #pragma assume HLT ; HLT instruction will reset the simulator 63 | 64 | 65 | #region Semantic Error: usage of undefined carry 66 | mov cl, 0 67 | bsf ax, cx 68 | add eax, 1 69 | #endregion 70 | 71 | 72 | #pragma assume HLT ; HLT instruction will reset the simulator 73 | 74 | 75 | #region move value to memory 76 | mov ptr qword [rax], 10 77 | mov rax, ptr qword [rax] 78 | #endregion 79 | 80 | 81 | #pragma assume HLT ; HLT instruction will reset the simulator 82 | 83 | 84 | #region slow (expensive) instruction 85 | mov ptr qword [rax], 10 86 | mov rax, ptr qword [rax] 87 | popcnt rbx, rax 88 | #endregion 89 | 90 | 91 | #pragma assume HLT ; HLT instruction will reset the simulator 92 | 93 | 94 | #region moving undefined values to memory and retrieving it. 95 | mov cx, 0 96 | bsf ax, cx 97 | mov ptr dword [rbx], eax 98 | mov rcx, ptr qword [rbx] 99 | #endregion 100 | 101 | 102 | #pragma assume HLT ; HLT instruction will reset the simulator 103 | 104 | 105 | #region Redundant instruction warning 106 | mov rax, rbx 107 | mov rbx, rax 108 | #endregion 109 | 110 | 111 | #pragma assume HLT ; HLT instruction will reset the simulator 112 | 113 | 114 | #region Redundant instruction warning (but AsmSim may not find it simply because it times out) 115 | mov rax, rsp 116 | push rbx 117 | pop rcx 118 | mov rax, rsp 119 | #endregion 120 | 121 | 122 | #pragma assume HLT ; HLT instruction will reset the simulator 123 | 124 | 125 | #region Redundant instruction warning in memory (but AsmSim may not find it simply because it times out) 126 | mov rax, rbx 127 | mov qword [rcx], rax 128 | mov qword [rcx], rbx 129 | #endregion 130 | 131 | 132 | #pragma assume HLT ; HLT instruction will reset the simulator 133 | 134 | 135 | #region Redundant instruction warning in memory (but AsmSim may not find it simply because it times out) 136 | #mov qword [rdx], 0xFF #bug if memory content at rdx is known, then the redundant instruction is not flagged. 137 | mov rax, qword [rcx] 138 | mov rbx, qword [rdx] 139 | cmp rcx, rdx 140 | jne label4 141 | mov rbx, rax 142 | label4: 143 | 144 | 145 | #endregion 146 | 147 | 148 | 149 | 150 | .att_syntax 151 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/example_semantic_analysis2.asm: -------------------------------------------------------------------------------- 1 | ;mov rax, 10 2 | 3 | 4 | #pragma assume mov al, 0000_0001 5 | cmp rax, 0 6 | jz label1 7 | xor rax, rax 8 | mov rcx, rax 9 | add rax, 1 10 | label1: 11 | inc rax 12 | mov rbx, rax 13 | mov rax, rbx 14 | 15 | 16 | 17 | mov rcx, 10 18 | labelx: 19 | dec rcx 20 | jnz labelx 21 | mov rax, rcx 22 | 23 | vaddpd 24 | 25 | mov rcx, 10 26 | mov r10, rcx ; store the parameter rcx in r10 27 | ;mod3 PROC 28 | ; parameter 1: rcx 29 | mov r8, 0aaaaaaaaaaaaaaabH ;; (scaled) reciprocal of 3 30 | mov rax, rcx 31 | mul r8 ;; multiply with reciprocal 32 | shr rdx, 1 ;; quotient 33 | lea r9, QWORD PTR [rdx+rdx*2] ;; back multiply with 3 34 | neg r9 35 | add rcx, r9 ;; subtract from dividend 36 | ;mov rax, rcx ;; remainder 37 | ; rcx has the result (mod3) 38 | 39 | ; ret 40 | ;mod3 ENDP 41 | 42 | 43 | mov rax, r10 44 | xor rdx, rdx 45 | mov r8, 3 46 | idiv r8 47 | ; rdx has the result (mod3) 48 | 49 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/inc/example.inc: -------------------------------------------------------------------------------- 1 | extrn printf : proc 2 | include bla2 3 | 4 | FOO: #label definition in included file 5 | xor rax, rax 6 | alias labelx = FOO 7 | 8 | procedure3 PROC a, b 9 | jmp local_label1 10 | local_label1: 11 | call printf 12 | 13 | procedure3 ENDP 14 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/examples/nn.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | 3 | 4 | .align 16 5 | .data 6 | # __m256i maskA = _mm256_set_epi8(0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29); 7 | maskA: 8 | .long 0x0C0D0E0F 9 | .long 0x08090A0B 10 | .long 0x04050607 11 | .long 0x00010203 12 | 13 | .long 0x0E0F 14 | .long 0x0A0B0C0D 15 | .long 0x08090405 16 | .long 0x00010405 17 | 18 | .align 64 19 | .text # Code section 20 | .global nn_gas 21 | nn_gas: 22 | 23 | ; constants 24 | mov eax, 32 25 | vmovd XMM6, eax 26 | VBROADCASTSS ZMM6, XMM6 27 | 28 | ; parameters 29 | mov r10, 10 ; r10 (const) = previous states ptr 30 | mov r11, 11 ; r11 (const) = new states ptr 31 | mov r12, 32 ; r12 (const) = number of neurons, has to be multiple of 16 32 | mov r13, 13 ; r13 (const) = weights ptr 33 | 34 | ; code 35 | 36 | mov r15, r12 ; r15 (const) = number of times loop1 and loop2 has to be taken 37 | shl r15, 5 ; divide by 16 38 | 39 | mov r9, r15 ; init loop2 counter; r9 = loop2 counter 40 | mov rbx, r13 ; init weights ptr; rbx = weight ptr index 41 | mov rcx, r11 ; init new state ptr; rcx = previouis state ptr index 42 | 43 | #region Loop2 code 44 | loop2: ; loop2 calculates the new state of all neurons: r9 = loop2 counter 45 | 46 | mov rdx, r10 ; init previous state ptr 47 | mov rax, r15 ; init loop1 counter; rax is loop1 counter 48 | 49 | vxorpd zmm0, zmm0 ; zmm0 is the new state; set new state of 16 neurons to zero 50 | 51 | #region Loop1 code 52 | loop1: ; loop calculates new state of 16 neurons 53 | vmovdqa32 zmm10, zmmword ptr [rbx + (0 * 64)] 54 | vmovdqa32 zmm11, zmmword ptr [rbx + (1 * 64)] 55 | vmovdqa32 zmm12, zmmword ptr [rbx + (2 * 64)] 56 | vmovdqa32 zmm13, zmmword ptr [rbx + (3 * 64)] 57 | vmovdqa32 zmm14, zmmword ptr [rbx + (4 * 64)] 58 | vmovdqa32 zmm15, zmmword ptr [rbx + (5 * 64)] 59 | vmovdqa32 zmm16, zmmword ptr [rbx + (6 * 64)] 60 | vmovdqa32 zmm17, zmmword ptr [rbx + (7 * 64)] 61 | 62 | vp4dpwssds zmm0, zmm10, xmmword ptr [rdx + (0 * 64)] 63 | vp4dpwssds zmm0, zmm14, xmmword ptr [rdx + (1 * 64)] 64 | 65 | add rdx, 2*64 ; update previous state ptr 66 | add rbx, 8*64 ; update weights ptr 67 | dec rax ; decrement loop1 counter 68 | jnz loop1 69 | #endregion Loop1 code 70 | 71 | #region Do something with the new state, eq threshold it 72 | ;zmm0 contains the new state of 16 neurons but these states are i32 and have to be reduced to i16 73 | vcvtdq2ps zmm0, zmm0 ; convert i32 to Single-Precision FP 74 | 75 | vmovd xmm1, r12d 76 | vbroadcastss zmm2, xmm1 77 | vdivps zmm0, zmm0, zmm2 ; divide by the number of neurons 78 | 79 | vcvtps2dq zmm0, zmm0 ; convert Single-Precision FP to i32 80 | vpxor zmm1, zmm1 81 | vmovdqa32 ymm1, ymmword ptr [maskA] 82 | vpermb zmm0, zmm1, zmm0 83 | 84 | vmovdqa32 ymmword ptr [rcx], ymm0 ; store the new states 85 | #endregion 86 | 87 | add rcx, 32 ; update new state ptr 88 | dec r9 ; decrement loop2 counter 89 | jnz loop2 90 | #endregion Loop2 code 91 | 92 | ret 93 | 94 | jmp loop1 95 | 96 | label1: 97 | label1: 98 | 99 | label2: 100 | label1: 101 | 102 | 103 | 104 | 105 | .att_syntax -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/AsmDude.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/AsmDude.bmp -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/asm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/asm.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-D.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-I.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-I.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-L.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-L.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-M.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-M.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-R-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-R-blue.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-R.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-W.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-W.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-Z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-Z.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/images/icon-question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/images/icon-question.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/old/Package.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/old/Package.ico -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Resources/old/mnemonics-nasm.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude-vsix/Resources/old/mnemonics-nasm.txt -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Settings.cs: -------------------------------------------------------------------------------- 1 | namespace AsmDude 2 | { 3 | // This class allows you to handle specific events on the settings class: 4 | // The SettingChanging event is raised before a setting's value is changed. 5 | // The PropertyChanged event is raised after a setting's value is changed. 6 | // The SettingsLoaded event is raised after the setting values are loaded. 7 | // The SettingsSaving event is raised before the setting values are saved. 8 | public sealed partial class Settings 9 | { 10 | public Settings() 11 | { 12 | // // To add event handlers for saving and changing settings, uncomment the lines below: 13 | // 14 | // this.SettingChanging += this.SettingChangingEventHandler; 15 | // 16 | // this.SettingsSaving += this.SettingsSavingEventHandler; 17 | // 18 | } 19 | 20 | private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) 21 | { 22 | // Add code to handle the SettingChangingEvent event here. 23 | } 24 | 25 | private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) 26 | { 27 | // Add code to handle the SettingsSaving event here. 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/SignatureHelp/AsmParameter.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.SignatureHelp 24 | { 25 | using Microsoft.VisualStudio.Language.Intellisense; 26 | using Microsoft.VisualStudio.Text; 27 | 28 | internal class AsmParameter : IParameter 29 | { 30 | public AsmParameter(string documentation, Span locus, string name, ISignature signature) 31 | { 32 | this.Documentation = documentation; 33 | this.Locus = locus; 34 | this.Name = name; 35 | this.Signature = signature; 36 | this.PrettyPrintedLocus = locus; 37 | } 38 | 39 | public string Documentation { get; private set; } 40 | 41 | public Span Locus { get; private set; } 42 | 43 | public string Name { get; private set; } 44 | 45 | public ISignature Signature { get; private set; } 46 | 47 | public Span PrettyPrintedLocus { get; private set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/SignatureHelp/AsmSignatureHelpCommandProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.SignatureHelp 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Editor; 27 | using Microsoft.VisualStudio.Language.Intellisense; 28 | using Microsoft.VisualStudio.Text.Editor; 29 | using Microsoft.VisualStudio.TextManager.Interop; 30 | using Microsoft.VisualStudio.Utilities; 31 | 32 | [Export(typeof(IVsTextViewCreationListener))] 33 | [Name("Signature Help controller")] 34 | [TextViewRole(PredefinedTextViewRoles.Editable)] 35 | [ContentType(AsmDudePackage.AsmDudeContentType)] 36 | //[TextViewRole(PredefinedTextViewRoles.Document)] 37 | internal sealed class AsmSignatureHelpCommandProvider : IVsTextViewCreationListener 38 | { 39 | [Import] 40 | private readonly IVsEditorAdaptersFactoryService adapterService_ = null; 41 | 42 | [Import] 43 | private readonly ISignatureHelpBroker signatureHelpBroker_ = null; 44 | 45 | public void VsTextViewCreated(IVsTextView textViewAdapter) 46 | { 47 | ITextView textView = this.adapterService_.GetWpfTextView(textViewAdapter); 48 | textView?.Properties.GetOrCreateSingletonProperty(() => new AsmSignatureHelpCommandFilter(textViewAdapter, textView, this.signatureHelpBroker_)); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/SignatureHelp/AsmSignatureHelpSourceProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.SignatureHelp 24 | { 25 | using System.ComponentModel.Composition; 26 | using Microsoft.VisualStudio.Language.Intellisense; 27 | using Microsoft.VisualStudio.Text; 28 | using Microsoft.VisualStudio.Text.Editor; 29 | using Microsoft.VisualStudio.Utilities; 30 | 31 | [Export(typeof(ISignatureHelpSourceProvider))] 32 | [Name("Signature Help source")] 33 | [Order(Before = "High")] 34 | [ContentType(AsmDudePackage.AsmDudeContentType)] 35 | //[TextViewRole(PredefinedTextViewRoles.Document)] 36 | internal class AsmSignatureHelpSourceProvider : ISignatureHelpSourceProvider 37 | { 38 | public ISignatureHelpSource TryCreateSignatureHelpSource(ITextBuffer textBuffer) 39 | { 40 | return new AsmSignatureHelpSource(textBuffer); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Squiggles/SquigglesTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.Squiggles 24 | { 25 | using System.ComponentModel.Composition; 26 | using AsmDude.Tools; 27 | using Microsoft.VisualStudio.Text; 28 | using Microsoft.VisualStudio.Text.Editor; 29 | using Microsoft.VisualStudio.Text.Tagging; 30 | using Microsoft.VisualStudio.Utilities; 31 | 32 | /// 33 | /// Export a 34 | /// 35 | [Export(typeof(IViewTaggerProvider))] 36 | [ContentType(AsmDudePackage.AsmDudeContentType)] 37 | [TagType(typeof(ErrorTag))] 38 | [TextViewRole(PredefinedTextViewRoles.Document)] 39 | internal sealed class SquigglesTaggerProvider : IViewTaggerProvider 40 | { 41 | [Import] 42 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 43 | 44 | [Import] 45 | private readonly ITextDocumentFactoryService docFactory_ = null; 46 | 47 | [Import] 48 | private readonly IContentTypeRegistryService contentService_ = null; 49 | 50 | public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag 51 | { 52 | ITagger sc() 53 | { 54 | LabelGraph labelGraph = AsmDudeToolsStatic.GetOrCreate_Label_Graph(buffer, this.aggregatorFactory_, this.docFactory_, this.contentService_); 55 | AsmSimulator asmSimulator = AsmSimulator.GetOrCreate_AsmSimulator(buffer, this.aggregatorFactory_); 56 | return new SquigglesTagger(buffer, this.aggregatorFactory_, labelGraph, asmSimulator) as ITagger; 57 | } 58 | return buffer.Properties.GetOrCreateSingletonProperty(sc); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/SyntaxHighlighting/AsmDisassemblyTokenTagProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude 24 | { 25 | using System.ComponentModel.Composition; 26 | using AsmDude.SyntaxHighlighting; 27 | using AsmDude.Tools; 28 | using AsmTools; 29 | using Microsoft.VisualStudio.Text; 30 | using Microsoft.VisualStudio.Text.Tagging; 31 | using Microsoft.VisualStudio.Utilities; 32 | 33 | [Export(typeof(ITaggerProvider))] 34 | [ContentType(AsmDudePackage.DisassemblyContentType)] 35 | [TagType(typeof(AsmTokenTag))] 36 | [Name("AsmDude Disassembly Token Tag Provider")] 37 | internal sealed class AsmDisassemblyTokenTagProvider : ITaggerProvider 38 | { 39 | public ITagger CreateTagger(ITextBuffer buffer) where T : ITag 40 | { 41 | //AsmDudeToolsStatic.Output_INFO(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:CreateTagger", this.ToString())); 42 | ITagger sc() 43 | { 44 | if (AsmDudeToolsStatic.Used_Assembler_Disassembly_Window.HasFlag(AssemblerEnum.AUTO_DETECT)) 45 | { 46 | int nLinesMax = 40; 47 | bool has_intel_syntax = AsmDudeToolsStatic.Guess_Intel_Syntax(buffer, nLinesMax); 48 | 49 | return (has_intel_syntax) 50 | ? new MasmDisassemblyTokenTagger(buffer) as ITagger 51 | : new NasmAttDisassemblyTokenTagger(buffer) as ITagger; 52 | } 53 | if (AsmDudeToolsStatic.Used_Assembler_Disassembly_Window.HasFlag(AssemblerEnum.NASM_ATT)) 54 | { 55 | return new NasmAttDisassemblyTokenTagger(buffer) as ITagger; 56 | } 57 | if (AsmDudeToolsStatic.Used_Assembler_Disassembly_Window.HasFlag(AssemblerEnum.MASM)) 58 | { 59 | return new MasmDisassemblyTokenTagger(buffer) as ITagger; 60 | } 61 | AsmDudeToolsStatic.Output_WARNING(string.Format(AsmDudeToolsStatic.CultureUI, "{0}:CreateTagger: could not determine the used assembler", this.ToString())); 62 | return new MasmDisassemblyTokenTagger(buffer) as ITagger; 63 | } 64 | return buffer.Properties.GetOrCreateSingletonProperty(sc); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/SyntaxHighlighting/AsmTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.SyntaxHighlighting 24 | { 25 | using System.ComponentModel.Composition; 26 | using AsmDude.Tools; 27 | using Microsoft.VisualStudio.Text; 28 | using Microsoft.VisualStudio.Text.Classification; 29 | using Microsoft.VisualStudio.Text.Tagging; 30 | using Microsoft.VisualStudio.Utilities; 31 | 32 | [Export(typeof(ITaggerProvider))] 33 | [ContentType(AsmDudePackage.AsmDudeContentType)] 34 | [TagType(typeof(ClassificationTag))] 35 | [Name("AsmDude-AsmTaggerProvider")] 36 | internal sealed class AsmTaggerProvider : ITaggerProvider 37 | { 38 | [Import] 39 | private readonly IClassificationTypeRegistryService classificationTypeRegistry_ = null; 40 | 41 | [Import] 42 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 43 | 44 | public ITagger CreateTagger(ITextBuffer buffer) where T : ITag 45 | { 46 | ITagger sc() 47 | { 48 | ITagAggregator aggregator = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, this.aggregatorFactory_); 49 | return new AsmClassifier(buffer, aggregator, this.classificationTypeRegistry_) as ITagger; 50 | } 51 | return buffer.Properties.GetOrCreateSingletonProperty(sc); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/SyntaxHighlighting/AsmTokenTag.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.SyntaxHighlighting 24 | { 25 | using Microsoft.VisualStudio.Text.Tagging; 26 | 27 | public class AsmTokenTag : ITag 28 | { 29 | public static readonly string MISC_KEYWORD_PROTO = "PROTO"; 30 | 31 | public AsmTokenType Type { get; private set; } 32 | 33 | public string Misc { get; private set; } 34 | 35 | public AsmTokenTag(AsmTokenType type) 36 | { 37 | this.Type = type; 38 | } 39 | 40 | public AsmTokenTag(AsmTokenType type, string misc) 41 | { 42 | this.Type = type; 43 | this.Misc = misc; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/SyntaxHighlighting/AsmTokenTypes.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude 24 | { 25 | /// 26 | /// Types of token used in assembly source files. Mnemonic, Register, Remark, Directive, Constant, Jump, Label, LabelDef, Misc, UserDefined1, UserDefined2, UserDefined3, UNKNOWN 27 | /// 28 | public enum AsmTokenType 29 | { 30 | Mnemonic, MnemonicOff, Register, Remark, Directive, Constant, Jump, Label, LabelDef, Misc, UserDefined1, UserDefined2, UserDefined3, UNKNOWN, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Tools/AsmMessageEnum.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.Tools 24 | { 25 | using System; 26 | 27 | [Flags] 28 | public enum AsmMessageEnum 29 | { 30 | NONE = 0, 31 | 32 | LABEL_UNDEFINED = 1 << 1, 33 | LABEL_CLASH = 1 << 2, 34 | INCLUDE_UNDEFINED = 1 << 3, 35 | SYNTAX_ERROR = 1 << 4, 36 | USAGE_OF_UNDEFINED = 1 << 5, 37 | NOT_IMPLEMENTED = 1 << 6, 38 | REDUNDANT = 1 << 7, 39 | UNREACHABLE = 1 << 8, 40 | 41 | DECORATE_REG = 1 << 9, 42 | OTHER = 1 << 10, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Tools/Delay.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.Tools 24 | { 25 | using System; 26 | using System.Threading; 27 | using Amib.Threading; 28 | 29 | public class Delay 30 | { 31 | private readonly SmartThreadPool threadPool_; 32 | private readonly int defaultDelayInMs_; 33 | private readonly int maxResets_; 34 | private int nResets_; 35 | private IWorkItemResult current_; 36 | 37 | public Delay(int defaultDelayInMs, int maxResets, SmartThreadPool threadPool) 38 | { 39 | this.defaultDelayInMs_ = defaultDelayInMs; 40 | this.maxResets_ = maxResets; 41 | this.threadPool_ = threadPool; 42 | } 43 | 44 | public void Reset(int delay = -1) 45 | { 46 | if ((this.current_ == null) || this.current_.IsCompleted || this.current_.IsCanceled) 47 | { 48 | //AsmDudeToolsStatic.Output_INFO("Delay:Reset: starting a new timer"); 49 | this.nResets_ = 0; 50 | this.current_ = this.threadPool_.QueueWorkItem(this.Timer, delay); 51 | } 52 | else 53 | { 54 | if (this.nResets_ < this.maxResets_) 55 | { 56 | //AsmDudeToolsStatic.Output_INFO("Delay:Reset: resetting the timer: "+this._nResets); 57 | this.current_.Cancel(true); 58 | this.nResets_++; 59 | this.current_ = this.threadPool_.QueueWorkItem(this.Timer, delay); 60 | } 61 | } 62 | } 63 | 64 | private void Timer(int delay) 65 | { 66 | Thread.Sleep((delay == -1) ? this.defaultDelayInMs_ : delay); 67 | //AsmDudeToolsStatic.Output_INFO("Delay:Timer: delay elapsed"); 68 | this.Done_Event?.Invoke(this, new EventArgs()); 69 | } 70 | 71 | public event EventHandler Done_Event; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/Tools/LineUpdatedEventArgs.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude.Tools 24 | { 25 | using System; 26 | 27 | public class CustomEventArgs : EventArgs 28 | { 29 | public string Message { get; set; } 30 | 31 | public CustomEventArgs(string message) 32 | { 33 | this.Message = message; 34 | } 35 | } 36 | 37 | public class LineUpdatedEventArgs : EventArgs 38 | { 39 | public int LineNumber { get; set; } 40 | 41 | public AsmMessageEnum Message { get; set; } 42 | 43 | public LineUpdatedEventArgs(int lineNumber, AsmMessageEnum message) 44 | { 45 | this.LineNumber = lineNumber; 46 | this.Message = message; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by Extensibility Tools v1.8.166 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace AsmDude 7 | { 8 | static class Vsix 9 | { 10 | public const string Id = "c729d6b2-f412-49ed-893d-a8f61f25db99"; 11 | public const string Name = "AsmDude"; 12 | public const string Description = "Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window "; 13 | public const string Language = "en-US"; 14 | public const string Version = "2.0.0.0"; 15 | public const string Author = "Henk-Jan Lebbink"; 16 | public const string Tags = "Assembly, Assembler, ASM, Syntax Highlighting, Code Completion, Disassembly Window, Code Analysis, x86_64, SSE, AVX, AVX2, AVX512"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude-vsix/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | AsmDude 6 | Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window 7 | https://github.com/HJLebbink/asm-dude 8 | LICENSE.txt 9 | https://github.com/HJLebbink/asm-dude 10 | Resources\images\asm.png 11 | Resources\images\AsmDude.bmp 12 | Assembly, Assembler, ASM, Syntax Highlighting, Code Completion, Disassembly Window, Code Analysis, x86_64, SSE, AVX, AVX2, AVX512 13 | 14 | 15 | 16 | x86 17 | 18 | 19 | x86 20 | 21 | 22 | x86 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls-lib/AsmDiagnosticTag.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.LanguageServer.Protocol; 2 | 3 | namespace AsmDude2LS 4 | { 5 | public enum AsmDiagnosticTag 6 | { 7 | Unnecessary = DiagnosticTag.Unnecessary, 8 | Deprecated = DiagnosticTag.Deprecated, 9 | BuildError = VSDiagnosticTags.BuildError, 10 | IntellisenseError = VSDiagnosticTags.IntellisenseError, 11 | AsmDudeSimulatorError = -9, 12 | } 13 | } -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls-lib/AsmSignatureInformation.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | using AsmSourceTools; 24 | using AsmTools; 25 | using Microsoft.VisualStudio.LanguageServer.Protocol; 26 | using System; 27 | using System.Collections.Generic; 28 | 29 | namespace AsmDude2LS 30 | { 31 | public class AsmSignatureInformation 32 | { 33 | public SignatureInformation SignatureInformation; 34 | public Mnemonic Mnemonic; 35 | public Arch[] Arch; 36 | public IList> Operands; 37 | 38 | /// Return true if this Signature Element is allowed with the constraints of the provided operand 39 | public bool Is_Allowed(Operand op, int operandIndex) 40 | { 41 | if (op == null) 42 | { 43 | return true; 44 | } 45 | if (operandIndex >= this.Operands.Count) 46 | { 47 | //LanguageServer.LogInfo($"AsmSignatureInformation:Is_Allowed operandIndex={operandIndex} >= Operands.Count={this.Operands.Count}"); 48 | return false; 49 | } 50 | foreach (AsmSignatureEnum operandType in this.Operands[operandIndex]) 51 | { 52 | if (AsmSignatureTools.Is_Allowed_Operand(op, operandType)) 53 | { 54 | return true; 55 | } 56 | //LanguageServer.LogInfo($"AsmSignatureInformation:Is_Allowed operandType={operandType} is not allowed for op={op}"); 57 | } 58 | return false; 59 | } 60 | 61 | /// Return true if this Signature Element is allowed in the provided architectures 62 | public bool Is_Allowed(HashSet selectedArchitectures) 63 | { 64 | System.Diagnostics.Contracts.Contract.Requires(selectedArchitectures != null); 65 | foreach (Arch a in this.Arch) 66 | { 67 | if (selectedArchitectures.Contains(a)) 68 | { 69 | //LanguageServer.LogInfo("AsmSignatureElement: isAllowed: selected architectures=" + ArchTools.ToString(selectedArchitectures) + "; arch = " + ArchTools.ToString(a)); 70 | return true; 71 | } 72 | } 73 | return false; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/Broadwell.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/Broadwell.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/Haswell.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/Haswell.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/IvyBridge.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/IvyBridge.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/Skylake.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/Skylake.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/SkylakeX.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-ls-lib/Resources/Performance/SkylakeX.tsv -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/AsmDudePackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-ls/AsmDudePackage.ico -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Henk-Jan Lebbink 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/Program.cs: -------------------------------------------------------------------------------- 1 | using AsmDude2LS; 2 | 3 | try 4 | { 5 | var builder = Host.CreateApplicationBuilder(args); 6 | builder.Services.AddHostedService(); 7 | 8 | var host = builder.Build(); 9 | host.Run(); 10 | } catch (Exception e) 11 | { 12 | Console.WriteLine(e); 13 | } 14 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/Worker.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Pipes; 2 | using System.Runtime.InteropServices; 3 | using System.Security.Principal; 4 | 5 | namespace AsmDude2LS; 6 | 7 | public partial class Worker : BackgroundService 8 | { 9 | [LibraryImport("kernel32.dll")] 10 | private static partial IntPtr GetConsoleWindow(); 11 | 12 | [LibraryImport("user32.dll")] 13 | [return: MarshalAs(UnmanagedType.Bool)] 14 | private static partial bool ShowWindow(IntPtr hWnd, int nCmdShow); 15 | 16 | private const int SW_HIDE = 0; 17 | private const int SW_SHOW = 5; 18 | 19 | private readonly ILogger _logger; 20 | private readonly LanguageServer _languageServer; 21 | private bool _shutdownRequested; 22 | 23 | public Worker(ILogger logger) 24 | { 25 | #if DEBUG 26 | // in a debug run we want to see the console with the LSP 27 | ShowWindow(GetConsoleWindow(), SW_SHOW); 28 | #else 29 | // in a release run we do not want to see the console with the LSP 30 | ShowWindow(GetConsoleWindow(), SW_HIDE); 31 | #endif 32 | logger.LogInformation("Worker created at: {time}", DateTimeOffset.Now); 33 | 34 | this._logger = logger; 35 | const string stdInPipeName = @"input"; 36 | const string stdOutPipeName = @"output"; 37 | 38 | SecurityIdentifier everyone = new(WellKnownSidType.WorldSid, null); 39 | PipeAccessRule pipeAccessRule = new(everyone, PipeAccessRights.ReadWrite, System.Security.AccessControl.AccessControlType.Allow); 40 | PipeSecurity pipeSecurity = new(); 41 | pipeSecurity.AddAccessRule(pipeAccessRule); 42 | 43 | NamedPipeClientStream readerPipe = new(stdInPipeName); 44 | NamedPipeClientStream writerPipe = new(stdOutPipeName); 45 | 46 | readerPipe.Connect(); 47 | writerPipe.Connect(); 48 | 49 | this._shutdownRequested = false; 50 | this._languageServer = LanguageServer.Create(writerPipe, readerPipe); 51 | this._languageServer.Disconnected += this.OnDisconnected; 52 | this._languageServer.ShowWindow += this.OnShowWindow; 53 | } 54 | 55 | private void OnDisconnected(object? sender, EventArgs e) 56 | { 57 | _logger.LogInformation("OnDisconnected at: {time}", DateTimeOffset.Now); 58 | this._shutdownRequested = true; 59 | } 60 | 61 | public void OnShowWindow(object? sender, EventArgs e) 62 | { 63 | ShowWindow(GetConsoleWindow(), SW_SHOW); 64 | } 65 | 66 | protected override async Task ExecuteAsync(CancellationToken cancelToken) 67 | { 68 | try 69 | { 70 | while (true) 71 | { 72 | cancelToken.ThrowIfCancellationRequested(); 73 | if (this._shutdownRequested) 74 | { 75 | throw new OperationCanceledException(); 76 | } 77 | await Task.Delay(1000, cancelToken); 78 | } 79 | } 80 | catch (OperationCanceledException) 81 | { 82 | _logger.LogWarning("AsmDude2 LSP canceled"); 83 | } 84 | Environment.Exit(0); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/asm-dude2-ls.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | AsmDude2 Language Server Protocol (LSP) 5 | 1.0.0.4 6 | Henk-Jan Lebbink 7 | AsmDude2 Language Server Protocol (LSP) for assembly language 8 | AsmDude2.LSP 9 | 10 | net7.0-windows 11 | enable 12 | enable 13 | dotnet-WindowsService-7b46c878-2e29-4de0-b355-fe97116ed91a 14 | x64 15 | AsmDudePackage.ico 16 | False 17 | true 18 | 19 | 20 | 21 | build$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss")) 22 | LICENSE.txt 23 | True 24 | AsmDude2LS 25 | git 26 | https://github.com/SnellerInc/asm-dude 27 | 28 | 29 | 30 | 7 31 | 32 | 33 | 34 | 7 35 | 36 | 37 | 38 | 39 | 40 | Always 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | True 55 | \ 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-ls/lsp-version.txt: -------------------------------------------------------------------------------- 1 | 1.0.1.0 -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/AsmDude2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-vsix/AsmDude2.png -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/AsmDudePackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-vsix/AsmDudePackage.ico -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Henk-Jan Lebbink 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Properties/Guids.cs: -------------------------------------------------------------------------------- 1 | namespace AsmDude2 2 | { 3 | internal static class Guids 4 | { 5 | public const string GuidOptionsPageAsmDude = "3940DE73-43EF-44B6-8EC2-E3686FC40354"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/TextFile1.asm: -------------------------------------------------------------------------------- 1 | 2 | mov rax, -10 3 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/all_mnemonics.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/CSHARP/asm-dude2-vsix/Resources/examples/all_mnemonics.asm -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/data.foo: -------------------------------------------------------------------------------- 1 | This is a xyzzy file. 2 | 3 | blah 4 | blah 5 | 6 | bla 7 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/example_att.s: -------------------------------------------------------------------------------- 1 | .text 2 | LC0: 3 | .ascii "Hello, world!\12\0" 4 | .globl _main 5 | _main: 6 | pushl %ebp 7 | movl %esp, %ebp 8 | subl $8, %esp 9 | andl $-16, %esp 10 | movl $0, %eax 11 | movl %eax, -4(%ebp) 12 | movl -4(%ebp), %eax 13 | call __alloca 14 | call ___main 15 | movl $LC0, (%esp) 16 | call _printf 17 | movl $0, %eax 18 | leave 19 | ret 20 | 21 | 22 | _static_initialization_and_destruction_0(int, int): 23 | push %rbp 24 | mov %rsp,%rbp 25 | sub $0x10,%rsp 26 | mov %edi,-0x4(%rbp) 27 | mov %esi,-0x8(%rbp) 28 | cmpl $0x1,-0x4(%rbp) 29 | jne 0x8000d1c <__static_initialization_and_destruction_0(int, int)+70> 30 | cmpl $0xffff,-0x8(%rbp) 31 | jne 0x8000d1c <__static_initialization_and_destruction_0(int, int)+70> 32 | lea 0x201437(%rip),%rdi # 0x8202131 <_ZStL8__ioinit> 33 | callq 0x8000880 <_ZNSt8ios_base4InitC1Ev@plt> 34 | lea 0x201302(%rip),%rdx # 0x8202008 35 | lea 0x201424(%rip),%rsi # 0x8202131 <_ZStL8__ioinit> 36 | mov 0x2012e4(%rip),%rax # 0x8201ff8 37 | mov %rax,%rdi 38 | callq 0x8000830 <__cxa_atexit@plt> 39 | nop 40 | leaveq 41 | retq 42 | 43 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/example_masm2.asm: -------------------------------------------------------------------------------- 1 | ;#region 2 | extrn printf : proc 3 | ;#endregion 4 | 5 | include "inc\example.inc" 6 | jmp FOO # FOO is defined in an included file 7 | call procedure3 8 | 9 | 10 | procedure1 PROTO a, b 11 | 12 | global_label1: 13 | xor rcx, rcx 14 | 15 | procedure1A PROC a, b 16 | jmp local_label1 17 | local_label1: 18 | call printf 19 | 20 | procedure1A ENDP 21 | 22 | procedure2 PROC 23 | call procedure1A 24 | invoke procedure1 25 | jmp local_label1 26 | 27 | local_label1: 28 | jmp global_label1 29 | 30 | procedure2 ENDP 31 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/example_semantic_analysis.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | 3 | #region Unreachable code 4 | #pragma assume mov al, 1 << 3 5 | cmp al, 1<<3 6 | jz label2 7 | mov al, 1 8 | jz label2 9 | mov al, 2 10 | label2: 11 | mov rbx, rax 12 | #endregion 13 | 14 | 15 | #pragma assume HLT ; HLT instruction will reset the simulator 16 | 17 | 18 | #region negative constants 19 | mov rax, -10 20 | mov rbx, 10 21 | add rax, rbx 22 | #endregion 23 | 24 | 25 | #pragma assume HLT ; HLT instruction will reset the simulator 26 | 27 | 28 | #region Jump test 29 | cmp al, 0 30 | jp label1 31 | mov al, 1 32 | jc label1 33 | mov al, 3 34 | jnz label1 35 | mov al, 2 36 | label1: 37 | mov rbx, rax 38 | #endregion 39 | 40 | 41 | #pragma assume HLT ; HLT instruction will reset the simulator 42 | 43 | 44 | #region Semantic Error: usage of undefined register ax 45 | mov cl, bl 46 | xor cx, bx 47 | bsf ax, cx 48 | inc rax 49 | #endregion 50 | 51 | 52 | #pragma assume HLT ; HLT instruction will reset the simulator 53 | 54 | 55 | #region Test unimplemented instructions do not destroy known register content 56 | mov rax, 10 57 | subpd xmm1, xmm2 58 | mov rbx, rax # rbx has content 10 59 | #endregion 60 | 61 | 62 | #pragma assume HLT ; HLT instruction will reset the simulator 63 | 64 | 65 | #region Semantic Error: usage of undefined carry 66 | mov cl, 0 67 | bsf ax, cx 68 | add eax, 1 69 | #endregion 70 | 71 | 72 | #pragma assume HLT ; HLT instruction will reset the simulator 73 | 74 | 75 | #region move value to memory 76 | mov ptr qword [rax], 10 77 | mov rax, ptr qword [rax] 78 | #endregion 79 | 80 | 81 | #pragma assume HLT ; HLT instruction will reset the simulator 82 | 83 | 84 | #region slow (expensive) instruction 85 | mov ptr qword [rax], 10 86 | mov rax, ptr qword [rax] 87 | popcnt rbx, rax 88 | #endregion 89 | 90 | 91 | #pragma assume HLT ; HLT instruction will reset the simulator 92 | 93 | 94 | #region moving undefined values to memory and retrieving it. 95 | mov cx, 0 96 | bsf ax, cx 97 | mov ptr dword [rbx], eax 98 | mov rcx, ptr qword [rbx] 99 | #endregion 100 | 101 | 102 | #pragma assume HLT ; HLT instruction will reset the simulator 103 | 104 | 105 | #region Redundant instruction warning 106 | mov rax, rbx 107 | mov rbx, rax 108 | #endregion 109 | 110 | 111 | #pragma assume HLT ; HLT instruction will reset the simulator 112 | 113 | 114 | #region Redundant instruction warning (but AsmSim may not find it simply because it times out) 115 | mov rax, rsp 116 | push rbx 117 | pop rcx 118 | mov rax, rsp 119 | #endregion 120 | 121 | 122 | #pragma assume HLT ; HLT instruction will reset the simulator 123 | 124 | 125 | #region Redundant instruction warning in memory (but AsmSim may not find it simply because it times out) 126 | mov rax, rbx 127 | mov qword [rcx], rax 128 | mov qword [rcx], rbx 129 | #endregion 130 | 131 | 132 | #pragma assume HLT ; HLT instruction will reset the simulator 133 | 134 | 135 | #region Redundant instruction warning in memory (but AsmSim may not find it simply because it times out) 136 | #mov qword [rdx], 0xFF #bug if memory content at rdx is known, then the redundant instruction is not flagged. 137 | mov rax, qword [rcx] 138 | mov rbx, qword [rdx] 139 | cmp rcx, rdx 140 | jne label4 141 | mov rbx, rax 142 | label4: 143 | 144 | 145 | #endregion 146 | 147 | 148 | 149 | 150 | .att_syntax 151 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/example_semantic_analysis2.asm: -------------------------------------------------------------------------------- 1 | ;mov rax, 10 2 | 3 | 4 | #pragma assume mov al, 0000_0001 5 | cmp rax, 0 6 | jz label1 7 | xor rax, rax 8 | mov rcx, rax 9 | add rax, 1 10 | label1: 11 | inc rax 12 | mov rbx, rax 13 | mov rax, rbx 14 | 15 | 16 | 17 | mov rcx, 10 18 | labelx: 19 | dec rcx 20 | jnz labelx 21 | mov rax, rcx 22 | 23 | vaddpd 24 | 25 | mov rcx, 10 26 | mov r10, rcx ; store the parameter rcx in r10 27 | ;mod3 PROC 28 | ; parameter 1: rcx 29 | mov r8, 0aaaaaaaaaaaaaaabH ;; (scaled) reciprocal of 3 30 | mov rax, rcx 31 | mul r8 ;; multiply with reciprocal 32 | shr rdx, 1 ;; quotient 33 | lea r9, QWORD PTR [rdx+rdx*2] ;; back multiply with 3 34 | neg r9 35 | add rcx, r9 ;; subtract from dividend 36 | ;mov rax, rcx ;; remainder 37 | ; rcx has the result (mod3) 38 | 39 | ; ret 40 | ;mod3 ENDP 41 | 42 | 43 | mov rax, r10 44 | xor rdx, rdx 45 | mov r8, 3 46 | idiv r8 47 | ; rdx has the result (mod3) 48 | 49 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/inc/example.inc: -------------------------------------------------------------------------------- 1 | extrn printf : proc 2 | include bla2 3 | 4 | FOO: #label definition in included file 5 | xor rax, rax 6 | alias labelx = FOO 7 | 8 | procedure3 PROC a, b 9 | jmp local_label1 10 | local_label1: 11 | call printf 12 | 13 | procedure3 ENDP 14 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/Resources/examples/nn.asm: -------------------------------------------------------------------------------- 1 | .intel_syntax noprefix 2 | 3 | 4 | .align 16 5 | .data 6 | # __m256i maskA = _mm256_set_epi8(0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29); 7 | maskA: 8 | .long 0x0C0D0E0F 9 | .long 0x08090A0B 10 | .long 0x04050607 11 | .long 0x00010203 12 | 13 | .long 0x0E0F 14 | .long 0x0A0B0C0D 15 | .long 0x08090405 16 | .long 0x00010405 17 | 18 | .align 64 19 | .text # Code section 20 | .global nn_gas 21 | nn_gas: 22 | 23 | ; constants 24 | mov eax, 32 25 | vmovd XMM6, eax 26 | VBROADCASTSS ZMM6, XMM6 27 | 28 | ; parameters 29 | mov r10, 10 ; r10 (const) = previous states ptr 30 | mov r11, 11 ; r11 (const) = new states ptr 31 | mov r12, 32 ; r12 (const) = number of neurons, has to be multiple of 16 32 | mov r13, 13 ; r13 (const) = weights ptr 33 | 34 | ; code 35 | 36 | mov r15, r12 ; r15 (const) = number of times loop1 and loop2 has to be taken 37 | shl r15, 5 ; divide by 16 38 | 39 | mov r9, r15 ; init loop2 counter; r9 = loop2 counter 40 | mov rbx, r13 ; init weights ptr; rbx = weight ptr index 41 | mov rcx, r11 ; init new state ptr; rcx = previouis state ptr index 42 | 43 | #region Loop2 code 44 | loop2: ; loop2 calculates the new state of all neurons: r9 = loop2 counter 45 | 46 | mov rdx, r10 ; init previous state ptr 47 | mov rax, r15 ; init loop1 counter; rax is loop1 counter 48 | 49 | vxorpd zmm0, zmm0 ; zmm0 is the new state; set new state of 16 neurons to zero 50 | 51 | #region Loop1 code 52 | loop1: ; loop calculates new state of 16 neurons 53 | vmovdqa32 zmm10, zmmword ptr [rbx + (0 * 64)] 54 | vmovdqa32 zmm11, zmmword ptr [rbx + (1 * 64)] 55 | vmovdqa32 zmm12, zmmword ptr [rbx + (2 * 64)] 56 | vmovdqa32 zmm13, zmmword ptr [rbx + (3 * 64)] 57 | vmovdqa32 zmm14, zmmword ptr [rbx + (4 * 64)] 58 | vmovdqa32 zmm15, zmmword ptr [rbx + (5 * 64)] 59 | vmovdqa32 zmm16, zmmword ptr [rbx + (6 * 64)] 60 | vmovdqa32 zmm17, zmmword ptr [rbx + (7 * 64)] 61 | 62 | vp4dpwssds zmm0, zmm10, xmmword ptr [rdx + (0 * 64)] 63 | vp4dpwssds zmm0, zmm14, xmmword ptr [rdx + (1 * 64)] 64 | 65 | add rdx, 2*64 ; update previous state ptr 66 | add rbx, 8*64 ; update weights ptr 67 | dec rax ; decrement loop1 counter 68 | jnz loop1 69 | #endregion Loop1 code 70 | 71 | #region Do something with the new state, eq threshold it 72 | ;zmm0 contains the new state of 16 neurons but these states are i32 and have to be reduced to i16 73 | vcvtdq2ps zmm0, zmm0 ; convert i32 to Single-Precision FP 74 | 75 | vmovd xmm1, r12d 76 | vbroadcastss zmm2, xmm1 77 | vdivps zmm0, zmm0, zmm2 ; divide by the number of neurons 78 | 79 | vcvtps2dq zmm0, zmm0 ; convert Single-Precision FP to i32 80 | vpxor zmm1, zmm1 81 | vmovdqa32 ymm1, ymmword ptr [maskA] 82 | vpermb zmm0, zmm1, zmm0 83 | 84 | vmovdqa32 ymmword ptr [rcx], ymm0 ; store the new states 85 | #endregion 86 | 87 | add rcx, 32 ; update new state ptr 88 | dec r9 ; decrement loop2 counter 89 | jnz loop2 90 | #endregion Loop2 code 91 | 92 | ret 93 | 94 | jmp loop1 95 | 96 | label1: 97 | label1: 98 | 99 | label2: 100 | label1: 101 | 102 | 103 | 104 | 105 | .att_syntax -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/SyntaxHighlighting/AsmTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude2.SyntaxHighlighting 24 | { 25 | using System.ComponentModel.Composition; 26 | using AsmDude2.Tools; 27 | using Microsoft.VisualStudio.Text; 28 | using Microsoft.VisualStudio.Text.Classification; 29 | using Microsoft.VisualStudio.Text.Tagging; 30 | using Microsoft.VisualStudio.Utilities; 31 | 32 | [Export(typeof(ITaggerProvider))] 33 | [ContentType(AsmDude2Package.AsmDudeContentType)] 34 | [TagType(typeof(ClassificationTag))] 35 | [Name("AsmDude-AsmTaggerProvider")] 36 | internal sealed class AsmTaggerProvider : ITaggerProvider 37 | { 38 | [Import] 39 | private readonly IClassificationTypeRegistryService classificationTypeRegistry_ = null; 40 | 41 | [Import] 42 | private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null; 43 | 44 | public ITagger CreateTagger(ITextBuffer buffer) where T : ITag 45 | { 46 | ITagger sc() 47 | { 48 | ITagAggregator aggregator = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, this.aggregatorFactory_); 49 | return new AsmClassifier(buffer, aggregator, this.classificationTypeRegistry_) as ITagger; 50 | } 51 | return buffer.Properties.GetOrCreateSingletonProperty(sc); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/SyntaxHighlighting/AsmTokenTag.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmDude2.SyntaxHighlighting 24 | { 25 | using Microsoft.VisualStudio.Text.Tagging; 26 | 27 | public class AsmTokenTag : ITag 28 | { 29 | public static readonly string MISC_KEYWORD_PROTO = "PROTO"; 30 | 31 | public AsmTools.AsmTokenType Type { get; private set; } 32 | 33 | public string Misc { get; private set; } 34 | 35 | public AsmTokenTag(AsmTools.AsmTokenType type) 36 | { 37 | this.Type = type; 38 | } 39 | 40 | public AsmTokenTag(AsmTools.AsmTokenType type, string misc) 41 | { 42 | this.Type = type; 43 | this.Misc = misc; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/asmdude2-version.txt: -------------------------------------------------------------------------------- 1 | 2.0.1.0 -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/howto-release.txt: -------------------------------------------------------------------------------- 1 | What to do to update the versions: (TODO: make one file with versions...) 2 | 3 | 4 | 1.A] Edit "asm-dude\VS\CSHARP\asm-dude2-vsix\asmdude2-version.txt". 5 | 1.B] Edit asm-dude-vsix.csproj. Search for: 2.0.0.4. 6 | 1.C] Edit source.extension.vsixmanifest. Search for Version="2.0.0.4". 7 | 8 | 2.A] Edit "asm-dude\VS\CSHARP\asm-dude2-ls\lsp-version.txt". 9 | 2.B] Edit asm-dude2-ls.csproj. Search for: 1.0.0.4. 10 | 11 | 3] Delete "bin" and "obj" directory in "asm-dude\VS\CSHARP\asm-dude2-vsix" 12 | 13 | 4] In VS: right click asm-dude2-vsix project, run "Build" release. 14 | 15 | 5] Copy: asm-dude\VS\CSHARP\asm-dude2-vsix\bin\Release\net48\asm-dude2-vsix.vsix 16 | 17 | 6] Rename asm-dude2-vsix.vsix to AsmDude2-2_0_0_4.vsix 18 | 19 | 7] Upload to Github: https://github.com/HJLebbink/asm-dude/releases 20 | 21 | 8] Upload to MS Marketplace: https://marketplace.visualstudio.com/manage/publishers/henk-janlebbink -------------------------------------------------------------------------------- /VS/CSHARP/asm-dude2-vsix/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | AsmDude2 6 | Syntax highlighting and code assistance for assembly source code (.asm, .cod, .inc, .s) and the Disassembly Window. 7 | 8 | 9 | 10 | amd64 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-irony/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-irony/Example2.cs: -------------------------------------------------------------------------------- 1 | using Irony.Parsing; 2 | using System.Diagnostics; 3 | using System.Linq; 4 | 5 | namespace asm_irony 6 | { 7 | 8 | [Language("asm2", "1.0", "Assembly Intel-Style Grammar")] 9 | public class AsmGrammar2 : Grammar 10 | { 11 | private readonly TerminalSet _skipTokensInPreview = new TerminalSet(); //used in token preview for conflict resolution 12 | public AsmGrammar2() 13 | { 14 | 15 | NumberLiteral number = new NumberLiteral("NUMBER", NumberOptions.Default); 16 | 17 | KeyTerm PLUS = this.ToTerm("+", "PLUS"); 18 | KeyTerm TIMES = this.ToTerm("*", "TIMES"); 19 | 20 | NonTerminal mem_op = new NonTerminal("MemOp"); 21 | NonTerminal scaleIdx = new NonTerminal("ScaleIdx"); 22 | NonTerminal scaleIdxBr = new NonTerminal("ScaleIdxBrac64"); 23 | 24 | NonTerminal baseReg = new NonTerminal("Base"); 25 | NonTerminal scale = new NonTerminal("Scale"); 26 | NonTerminal idxReg = new NonTerminal("Idx"); 27 | NonTerminal disp = new NonTerminal("Disp"); 28 | 29 | 30 | this.Root = mem_op; 31 | 32 | mem_op.Rule = "[" + baseReg + PLUS + scaleIdxBr + disp + "]"; 33 | mem_op.Rule |= "[" + baseReg + disp + PLUS + scaleIdxBr + "]"; 34 | 35 | scaleIdxBr.Rule = "(" + scaleIdx + ")"; 36 | scaleIdxBr.Rule |= scaleIdx; 37 | 38 | scaleIdx.Rule = scale + TIMES + idxReg; 39 | scaleIdx.Rule |= idxReg + TIMES + scale; 40 | scaleIdx.Rule |= idxReg; 41 | 42 | baseReg.Rule = this.ToTerm("rax"); 43 | scale.Rule = this.ToTerm("0") | "1" | "2" | "4" | "8"; 44 | idxReg.Rule = this.ToTerm("rbx"); 45 | 46 | disp.Rule = PLUS + this.CustomActionHere(this.findTimesChar) + number; 47 | } 48 | 49 | private void findTimesChar(ParsingContext context, CustomParserAction customAction) 50 | { 51 | 52 | string currentStr = context.CurrentParserInput.Term.Name; 53 | Debug.WriteLine("findTimesChar: current Term = " + currentStr); 54 | 55 | if (context.CurrentParserInput.Term == this.Eof) 56 | { 57 | return; 58 | } 59 | Scanner scanner = context.Parser.Scanner; 60 | ParserAction action; 61 | 62 | scanner.BeginPreview(); 63 | Token preview = scanner.GetToken(); 64 | scanner.EndPreview(true); 65 | 66 | string previewStr = preview.Terminal.Name; 67 | Debug.WriteLine("findTimesChar: preview Term = " + previewStr); 68 | if (currentStr.Equals("NUMBER") && previewStr.Equals("TIMES")) 69 | { 70 | action = customAction.ReduceActions.First(); 71 | } 72 | else 73 | { 74 | action = customAction.ShiftActions.First(a => a.Term.Name == "NUMBER"); 75 | } 76 | action.Execute(context); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-irony/Program.cs: -------------------------------------------------------------------------------- 1 |  2 | using Irony.Interpreter; 3 | using Irony.Parsing; 4 | 5 | 6 | namespace asm_irony 7 | { 8 | internal class Program 9 | { 10 | private static void Main(string[] args) 11 | { 12 | 13 | Grammar grammar = new AsmGrammar2(); 14 | LanguageData language = new LanguageData(grammar); 15 | LanguageRuntime runtime = new LanguageRuntime(language); 16 | CommandLine commandLine = new CommandLine(runtime); 17 | commandLine.Run(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-irony/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("asm-irony")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("asm-irony")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("86771818-366e-4e0d-8ebf-c37699f444e9")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-lib/BranchInfo.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmSim 24 | { 25 | using System.Diagnostics.Contracts; 26 | using Microsoft.Z3; 27 | 28 | public class BranchInfo 29 | { 30 | public readonly BoolExpr BranchCondition; 31 | public readonly string Key; 32 | public readonly bool BranchTaken; 33 | 34 | public BranchInfo(BoolExpr condition, bool taken) 35 | { 36 | Contract.Requires(condition != null); 37 | Contract.Assert(condition != null); 38 | this.BranchCondition = condition; 39 | this.Key = condition.ToString(); 40 | this.BranchTaken = taken; 41 | } 42 | 43 | public BranchInfo Translate(Context ctx) 44 | { 45 | return new BranchInfo(this.BranchCondition.Translate(ctx) as BoolExpr, this.BranchTaken); 46 | } 47 | 48 | public BoolExpr GetData(Context ctx) 49 | { 50 | Contract.Requires(ctx != null); 51 | Contract.Assert(ctx != null); 52 | 53 | if (false) 54 | { 55 | BoolExpr bc = this.BranchCondition.Translate(ctx) as BoolExpr; 56 | return this.BranchTaken ? bc : ctx.MkNot(bc); 57 | } 58 | else 59 | { 60 | return this.BranchTaken ? this.BranchCondition : ctx.MkNot(this.BranchCondition); 61 | } 62 | } 63 | 64 | public override string ToString() 65 | { 66 | return "BranchInfo: " + this.BranchCondition + "\n(branch taken " + this.BranchTaken + ")"; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-lib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | [assembly: AssemblyTrademark("")] 4 | [assembly: AssemblyCulture("")] 5 | 6 | // Setting ComVisible to false makes the types in this assembly not visible 7 | // to COM components. If you need to access a type in this assembly from 8 | // COM, set the ComVisible attribute to true on that type. 9 | [assembly: ComVisible(false)] 10 | 11 | // The following GUID is for the ID of the typelib if this project is exposed to COM 12 | [assembly: Guid("e0d833c8-652e-4026-bdc1-13568940b1a8")] 13 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-lib/ToolsFloatingPoint.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | namespace AsmSim 13 | { 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | // SOFTWARE. 24 | 25 | using System; 26 | using System.Collections.Generic; 27 | using System.Diagnostics.Contracts; 28 | using Microsoft.Z3; 29 | 30 | public static class ToolsFloatingPoint 31 | { 32 | public static IEnumerable BV_2_Doubles(BitVecExpr value, Context ctx) 33 | { 34 | Contract.Requires(value != null); 35 | Contract.Requires(ctx != null); 36 | 37 | uint nBits = value.SortSize; 38 | 39 | if (nBits == 128) 40 | { 41 | uint pos = nBits; 42 | { 43 | BitVecExpr sgn = ctx.MkExtract(pos - 1, pos - 1, value); 44 | BitVecExpr sig = ctx.MkExtract(pos - 2, pos - 13, value); 45 | BitVecExpr exp = ctx.MkExtract(pos - 14, pos - 64, value); 46 | yield return ctx.MkFP(sgn, sig, exp); 47 | } 48 | pos -= 64; 49 | { 50 | BitVecExpr sgn = ctx.MkExtract(pos - 1, pos - 1, value); 51 | BitVecExpr sig = ctx.MkExtract(pos - 2, pos - 13, value); 52 | BitVecExpr exp = ctx.MkExtract(pos - 14, pos - 64, value); 53 | yield return ctx.MkFP(sgn, sig, exp); 54 | } 55 | } 56 | else if (nBits == 256) 57 | { 58 | } 59 | else if (nBits == 512) 60 | { 61 | } 62 | else 63 | { 64 | throw new Exception(); 65 | } 66 | } 67 | 68 | public static BitVecExpr FP_2_BV(IEnumerable fps, Context ctx) 69 | { 70 | Contract.Requires(fps != null); 71 | Contract.Requires(ctx != null); 72 | 73 | BitVecExpr result = null; 74 | foreach (FPExpr fp in fps) 75 | { 76 | result = (result == null) ? ctx.MkFPToIEEEBV(fp) : ctx.MkConcat(result, ctx.MkFPToIEEEBV(fp)); 77 | } 78 | return result; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-lib/Tv.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmSim 24 | { 25 | using System; 26 | 27 | [Flags] 28 | public enum Tv 29 | { 30 | /// 31 | /// Unknown bit value: the value of a bit is neither 1 or 0. This happens when Z3 determines that 1] the bit value of 1 is consistent, and 2] the bit value of 0 is consistent. 32 | /// (This is the default value: The default value of an enum E is the value produced by the expression (E)0) 33 | /// 34 | UNKNOWN = 0, 35 | 36 | /// 37 | /// Undefined bit value: the value of a bit is undefined. Instructions may produce this value as a result of normal operation 38 | /// 39 | UNDEFINED = 1 << 0, 40 | 41 | /// 42 | /// Set bit value: the value of a bit is set to 1/True. Instructions may produce this value as a result of normal operation 43 | /// 44 | ONE = 1 << 1, 45 | 46 | /// 47 | /// Cleared bit value: the value of a bit is set to 0/False. Instructions may produce this value as a result of normal operation 48 | /// 49 | ZERO = 1 << 2, 50 | 51 | /// 52 | /// Inconsistent bit value: the value of a bit is set to both 1 and 0. This happens when Z3 determines that 1] the bit value of 1 is inconsistent, and 2] the bit value 0 is inconsistent. This happens when unreachable code is evaluated 53 | /// 54 | INCONSISTENT = 1 << 3, 55 | 56 | /// 57 | /// Undetermined bit value: the value of a bit could not be determined by Z3. This happens when Z3 cannot determine consistency due to timeouts 58 | /// 59 | UNDETERMINED = 1 << 4, 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-lib/asm-sim-lib.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0-windows 5 | asm_sim_lib2 6 | x64 7 | enable 8 | enable 9 | true 10 | True 11 | latest 12 | False 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-main/asm-sim-main.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net7.0-windows 6 | asm_sim_main2 7 | enable 8 | enable 9 | AsmSim.AsmSimMain 10 | x64 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-tests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.VisualStudio.TestTools.UnitTesting; -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-tests/Test_FPTools.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace unit_tests_asm_z3 24 | { 25 | using System; 26 | using System.Collections.Generic; 27 | using AsmSim; 28 | using Microsoft.VisualStudio.TestTools.UnitTesting; 29 | using Microsoft.Z3; 30 | 31 | [TestClass] 32 | public class Test_FPTools 33 | { 34 | [TestMethod] 35 | public void Test_FPTools_BV_2_Doubles() 36 | { 37 | Context ctx = new Context(); // housekeeping OK! 38 | Solver solver = ctx.MkSolver(); 39 | FPSort fpSort64 = ctx.MkFPSort64(); 40 | 41 | FPExpr[] values_FP = new FPExpr[] { ctx.MkFP(2, fpSort64), ctx.MkFP(4, fpSort64) }; 42 | 43 | BitVecExpr value_BV = ToolsFloatingPoint.FP_2_BV(values_FP, ctx); 44 | Console.WriteLine(ToolsZ3.ToStringBin(ToolsZ3.GetTvArray(value_BV, 128, solver, ctx))); 45 | 46 | IList results_FP = new List(ToolsFloatingPoint.BV_2_Doubles(value_BV, ctx)); 47 | 48 | for (int i = 0; i < values_FP.Length; ++i) 49 | { 50 | string expected = ToolsZ3.ToStringBin(ToolsZ3.GetTvArray(ctx.MkFPToIEEEBV(values_FP[i]), 64, solver, ctx)); 51 | string actual = ToolsZ3.ToStringBin(ToolsZ3.GetTvArray(ctx.MkFPToIEEEBV(results_FP[i]), 64, solver, ctx)); 52 | Assert.AreEqual(expected, actual); 53 | } 54 | ctx.Dispose(); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-sim-tests/asm-sim-tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0-windows 5 | asm_sim_tests 6 | enable 7 | enable 8 | 9 | false 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers; buildtransitive 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib-net48/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/AsmTokenTypes.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmTools 24 | { 25 | /// 26 | /// Types of token used in assembly source files. Mnemonic, Register, Remark, Directive, Constant, Jump, Label, LabelDef, Misc, UserDefined1, UserDefined2, UserDefined3, UNKNOWN 27 | /// 28 | public enum AsmTokenType 29 | { 30 | Mnemonic, MnemonicOff, Register, Remark, Directive, Constant, Jump, Label, LabelDef, Misc, UserDefined1, UserDefined2, UserDefined3, UNKNOWN, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/AssemblerEnum.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmTools 24 | { 25 | using System; 26 | 27 | [Flags] 28 | public enum AssemblerEnum 29 | { 30 | UNKNOWN = 0, 31 | MASM = 1 << 0, 32 | NASM_INTEL = 1 << 1, 33 | NASM_ATT = 1 << 2, 34 | ALL = NASM_INTEL | NASM_ATT | MASM, 35 | AUTO_DETECT = 1 << 3, 36 | } 37 | 38 | public static partial class AsmSourceTools 39 | { 40 | public static AssemblerEnum ParseAssembler(string str, bool strIsCapitals) 41 | { 42 | if (string.IsNullOrEmpty(str)) 43 | { 44 | return AssemblerEnum.UNKNOWN; 45 | } 46 | AssemblerEnum result = AssemblerEnum.UNKNOWN; 47 | 48 | foreach (string str2 in ToCapitals(str, strIsCapitals).Split(',')) 49 | { 50 | switch (str2.Trim()) 51 | { 52 | case "MASM": result |= AssemblerEnum.MASM; break; 53 | case "NASM": result |= AssemblerEnum.NASM_INTEL; break; 54 | } 55 | } 56 | return result; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | using System.Reflection; 24 | using System.Runtime.InteropServices; 25 | [assembly: AssemblyTrademark("")] 26 | [assembly: AssemblyCulture("")] 27 | 28 | // Setting ComVisible to false makes the types in this assembly not visible 29 | // to COM components. If you need to access a type in this assembly from 30 | // COM, set the ComVisible attribute to true on that type. 31 | [assembly: ComVisible(false)] 32 | 33 | // The following GUID is for the ID of the typelib if this project is exposed to COM 34 | [assembly: Guid("49505283-48a9-45c5-a12b-8dccee32b0da")] 35 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/KeywordID.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmTools 24 | { 25 | public readonly struct KeywordID 26 | { 27 | private readonly ulong data; 28 | 29 | public KeywordID(int lineNumber, int fileID, int startPos, int endPos, AsmTokenType type = AsmTokenType.UNKNOWN) 30 | { 31 | this.data = ((ulong)lineNumber & 0xFFFFFF) // 24 bits for linenumber 32 | | ((ulong)(fileID & 0xFF) << 24) // 8 bits for fileID 33 | | ((ulong)(startPos & 0x3FFF) << 32) // 14 bits for startPos 34 | | ((ulong)(endPos & 0x3FFF) << 46) // 14 bits for endPos 35 | | ((ulong)(type) << 60); // 4 bits for type 36 | } 37 | 38 | public int LineNumber 39 | { 40 | get 41 | { 42 | return (int)(this.data & 0x00FFFFFF); 43 | } 44 | } 45 | 46 | public int File_Id 47 | { 48 | get 49 | { 50 | return (int)((this.data >> 24) & 0xFF); 51 | } 52 | } 53 | 54 | public int Start_Pos 55 | { 56 | get 57 | { 58 | return (int)((this.data >> 32) & 0x3FFF); 59 | } 60 | 61 | } 62 | 63 | public int End_Pos 64 | { 65 | get 66 | { 67 | return (int)((this.data >> 46) & 0x3FFF); 68 | } 69 | } 70 | 71 | public AsmTokenType Type 72 | { 73 | get 74 | { 75 | return (AsmTokenType)((this.data >> 60) & 0xF); 76 | } 77 | } 78 | 79 | public bool Is_From_Main_File 80 | { 81 | get 82 | { 83 | return this.File_Id == 0; 84 | } 85 | } 86 | 87 | public override string ToString() 88 | { 89 | return $"KeywordID({this.LineNumber}, {this.File_Id}, {this.Start_Pos}, {this.End_Pos}, {this.Type})"; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/MicroArch.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmTools 24 | { 25 | using System; 26 | using System.Diagnostics.Contracts; 27 | 28 | [Flags] 29 | public enum MicroArch 30 | { 31 | NONE = 0, 32 | SandyBridge = 1 << 0, 33 | IvyBridge = 1 << 1, 34 | Haswell = 1 << 2, 35 | Broadwell = 1 << 3, 36 | Skylake = 1 << 4, 37 | SkylakeX = 1 << 5, 38 | Kabylake = 1 << 6, 39 | Cannonlake = 1 << 7, 40 | Icelake = 1 << 8, 41 | Tigerlake = 1 << 9, 42 | 43 | KnightsCorner = 1 << 10, 44 | KnightsLanding = 1 << 11, 45 | } 46 | 47 | public static partial class AsmSourceTools 48 | { 49 | public static MicroArch ParseMicroArch(string str, bool strIsCapitals) 50 | { 51 | Contract.Requires(str != null); 52 | Contract.Assume(str != null); 53 | 54 | switch (ToCapitals(str, strIsCapitals)) 55 | { 56 | case "SANDYBRIDGE": return MicroArch.SandyBridge; 57 | case "IVYBRIDGE": return MicroArch.IvyBridge; 58 | case "HASWELL": return MicroArch.Haswell; 59 | case "BROADWELL": return MicroArch.Broadwell; 60 | case "SKYLAKE": return MicroArch.Skylake; 61 | case "SKYLAKEX": return MicroArch.SkylakeX; 62 | case "KABYLAKE": return MicroArch.Kabylake; 63 | case "CANNONLAKE": return MicroArch.Cannonlake; 64 | case "ICELAKE": return MicroArch.Icelake; 65 | case "TIGERLAKE": return MicroArch.Tigerlake; 66 | case "KNIGHTSCORNER": return MicroArch.KnightsCorner; 67 | case "KNIGHTSLANDING": return MicroArch.KnightsLanding; 68 | default: return MicroArch.NONE; 69 | } 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/NumerationEnum.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmTools 24 | { 25 | public enum NumerationEnum 26 | { 27 | UNKNOWN, 28 | HEX, 29 | BIN, 30 | DEC, 31 | OCT, 32 | } 33 | 34 | public static partial class AsmSourceTools 35 | { 36 | public static NumerationEnum ParseNumeration(string str, bool strIsCapitals) 37 | { 38 | if (string.IsNullOrEmpty(str)) 39 | { 40 | return NumerationEnum.UNKNOWN; 41 | } 42 | switch (ToCapitals(str, strIsCapitals).Trim()) 43 | { 44 | case "HEX": return NumerationEnum.HEX; 45 | case "BIN": return NumerationEnum.BIN; 46 | case "DEC": return NumerationEnum.DEC; 47 | case "OCT": return NumerationEnum.OCT; 48 | default: return NumerationEnum.UNKNOWN; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/Parameter.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmTools 24 | { 25 | public class AsmParameters 26 | { 27 | public bool assume_initial_known_mem { get; private set; } 28 | 29 | public bool mode_64bit { get; set; } 30 | 31 | public bool mode_32bit { get; set; } 32 | 33 | public bool mode_16bit { get; set; } 34 | 35 | public AsmParameters() 36 | { 37 | // default values 38 | this.assume_initial_known_mem = true; 39 | this.mode_64bit = true; 40 | this.mode_32bit = false; 41 | this.mode_16bit = false; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/RegisterName.cs: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2023 Henk-Jan Lebbink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | namespace AsmTools 24 | { 25 | /// Register Name Enumeration 26 | public enum Rn 27 | { 28 | NOREG, 29 | RAX, EAX, AX, AL, AH, 30 | RBX, EBX, BX, BL, BH, 31 | RCX, ECX, CX, CL, CH, 32 | RDX, EDX, DX, DL, DH, 33 | 34 | RSI, ESI, SI, SIL, 35 | RDI, EDI, DI, DIL, 36 | RBP, EBP, BP, BPL, 37 | RSP, ESP, SP, SPL, 38 | 39 | R8, R8D, R8W, R8B, 40 | R9, R9D, R9W, R9B, 41 | R10, R10D, R10W, R10B, 42 | R11, R11D, R11W, R11B, 43 | 44 | R12, R12D, R12W, R12B, 45 | R13, R13D, R13W, R13B, 46 | R14, R14D, R14W, R14B, 47 | R15, R15D, R15W, R15B, 48 | 49 | MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, 50 | 51 | XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, 52 | XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, 53 | XMM16, XMM17, XMM18, XMM19, XMM20, XMM21, XMM22, XMM23, 54 | XMM24, XMM25, XMM26, XMM27, XMM28, XMM29, XMM30, XMM31, 55 | 56 | YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7, 57 | YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15, 58 | YMM16, YMM17, YMM18, YMM19, YMM20, YMM21, YMM22, YMM23, 59 | YMM24, YMM25, YMM26, YMM27, YMM28, YMM29, YMM30, YMM31, 60 | 61 | ZMM0, ZMM1, ZMM2, ZMM3, ZMM4, ZMM5, ZMM6, ZMM7, 62 | ZMM8, ZMM9, ZMM10, ZMM11, ZMM12, ZMM13, ZMM14, ZMM15, 63 | ZMM16, ZMM17, ZMM18, ZMM19, ZMM20, ZMM21, ZMM22, ZMM23, 64 | ZMM24, ZMM25, ZMM26, ZMM27, ZMM28, ZMM29, ZMM30, ZMM31, 65 | 66 | K0, K1, K2, K3, K4, K5, K6, K7, 67 | 68 | CS, DS, ES, SS, FS, GS, 69 | 70 | CR0, CR1, CR2, CR3, CR4, CR5, CR6, CR7, CR8, 71 | DR0, DR1, DR2, DR3, DR4, DR5, DR6, DR7, 72 | BND0, BND1, BND2, BND3, 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-lib/asm-tools-lib.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0-windows 5 | AsmTools 6 | enable 7 | enable 8 | x64 9 | CS1668 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-tests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.VisualStudio.TestTools.UnitTesting; -------------------------------------------------------------------------------- /VS/CSHARP/asm-tools-tests/asm-tools-tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0-windows 5 | asm_tools_tests 6 | enable 7 | enable 8 | 9 | false 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers; buildtransitive 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /VS/CSHARP/intel-doc-2-data/intel-doc-2-data.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net7.0-windows 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | /output/* 3 | /resources/test/* 4 | /resources/325462-sdm-vol-1-2abcd-3abcd.pdf -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/copy.cmd: -------------------------------------------------------------------------------- 1 | copy /V /A /Y .\output\*.md ..\..\..\..\asm-dude.wiki\doc 2 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/intel-doc-2-md.pyproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | 2.0 6 | {bf80ae23-e323-48fb-8b44-156b2524efff} 7 | 8 | main.py 9 | 10 | . 11 | . 12 | {888888a0-9f3d-457c-b088-3a5042f75d52} 13 | Standard Python launcher 14 | 15 | 16 | False 17 | 18 | 19 | 20 | 21 | 10.0 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/intel-doc-2-md.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26430.16 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "pdf-to-markdown", "pdf-to-markdown.pyproj", "{BF80AE23-E323-48FB-8B44-156B2524EFFF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {BF80AE23-E323-48FB-8B44-156B2524EFFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {BF80AE23-E323-48FB-8B44-156B2524EFFF}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/inteldoc2md/__init__.py: -------------------------------------------------------------------------------- 1 | from inteldoc2md.parser import Parser 2 | from inteldoc2md.writer import Writer 3 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/inteldoc2md/parser.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from pdfminer.pdfparser import PDFParser 4 | from pdfminer.pdfdocument import PDFDocument 5 | from pdfminer.pdfpage import PDFPage 6 | from pdfminer.pdfinterp import PDFResourceManager 7 | from pdfminer.pdfinterp import PDFPageInterpreter 8 | from pdfminer.pdfdevice import PDFDevice 9 | from pdfminer.layout import LAParams 10 | from pdfminer.converter import PDFPageAggregator 11 | from pile import Pile 12 | 13 | 14 | class Parser(object): 15 | def __init__(self, filename): 16 | self._document = self._read_file(filename) 17 | self._device, self._interpreter = self._prepare_tools() 18 | self._pages = {} 19 | 20 | 21 | def extract(self, page_num_start=None, page_num_end=None): 22 | 23 | counter = 0 24 | page_counter = 1 25 | 26 | if (page_num_start == None): 27 | page_num_start = 0 28 | 29 | for page in PDFPage.create_pages(self._document): 30 | 31 | if (page_num_end != None) and (page_counter >= page_num_end): 32 | return 33 | 34 | if (page_counter >= page_num_start): 35 | self._interpreter.process_page(page) 36 | layout = self._device.get_result() 37 | print('page no.' + str(page_counter) + '; extracted page no.' + str(layout.pageid)) 38 | self._pages[counter] = layout 39 | counter = counter + 1 40 | 41 | page_counter = page_counter + 1 42 | 43 | 44 | def parse(self, page_num=None): 45 | piles = [] 46 | if page_num == None: 47 | for page_num, page in self._pages.items(): 48 | piles += self._parse_page(page) 49 | else: 50 | page = self._pages[page_num] 51 | piles = self._parse_page(page) 52 | return piles 53 | 54 | 55 | def _read_file(self, filename): 56 | print('going to read file '+filename) 57 | parser = PDFParser(open(filename, 'rb')) 58 | document = PDFDocument(parser) 59 | print('done reading file '+filename) 60 | return document 61 | 62 | 63 | def _prepare_tools(self): 64 | laparams = LAParams() 65 | rsrcmgr = PDFResourceManager() 66 | device = PDFPageAggregator(rsrcmgr, laparams=laparams) 67 | interpreter = PDFPageInterpreter(rsrcmgr, device) 68 | return device, interpreter 69 | 70 | 71 | def _parse_page(self, page): 72 | print('parsing page '+str(page.pageid)) 73 | pile = Pile() 74 | pile.parse_layout(page) 75 | piles = pile.split_piles() 76 | return piles 77 | 78 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/main.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | import os 4 | import inteldoc2md 5 | 6 | def main(argv): 7 | if len(argv) == 2: 8 | filename = argv[1] 9 | title = os.path.splitext(os.path.basename(filename))[0] 10 | print('Parsing', filename) 11 | else: 12 | # filename = './resources/test/jcc.pdf' # parse instruction ADD 13 | # filename = './resources/test/selection__(p14-15).pdf' # parse instruction ADD 14 | # filename = './resources/test/selection__(p250-253).pdf' # parse instruction CVTTPD2DQ 15 | # filename = './resources/325462-sdm-vol-1-2abcd-3abcd-selection.pdf' 16 | # filename = './resources/architecture-instruction-set-extensions-programming-reference-selection.pdf' 17 | filename = './resources/selection-ext.pdf' 18 | title = os.path.splitext(os.path.basename(filename))[0] 19 | print('Parsing', filename) 20 | 21 | 22 | parser = inteldoc2md.Parser(filename) 23 | parser.extract() 24 | # parser.extract(469, 473) # extract a selected range of pages 25 | piles = parser.parse() 26 | 27 | writer = inteldoc2md.Writer() 28 | writer.write(piles) 29 | 30 | 31 | if __name__ == '__main__': 32 | main(sys.argv) 33 | 34 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/pile/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/readme.md: -------------------------------------------------------------------------------- 1 | Simple project to read the Intel documentation and save for every instruction a md page. -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/resources/architecture-instruction-set-extensions-programming-reference-selection.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/Python/intel-doc-2-md/resources/architecture-instruction-set-extensions-programming-reference-selection.pdf -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/resources/install.pdftk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # author: abu 4 | # date: May 12 2018 5 | # description: bash script to install pdftk on Ubuntu 18.04 for amd64 machines 6 | ############################################################################## 7 | # 8 | # change to /tmp directory 9 | cd /tmp 10 | # download packages 11 | wget http://mirrors.edge.kernel.org/ubuntu/pool/main/g/gcc-5/libgcj16_5.4.0-6ubuntu1~16.04.10_amd64.deb \ 12 | http://mirrors.edge.kernel.org/ubuntu/pool/main/g/gcc-defaults/libgcj-common_4.9.3-9ubuntu1_all.deb \ 13 | http://mirrors.edge.kernel.org/ubuntu/pool/universe/p/pdftk/pdftk_2.02-4_amd64.deb \ 14 | http://mirrors.edge.kernel.org/ubuntu/pool/universe/p/pdftk/pdftk-dbg_2.02-4_amd64.deb 15 | 16 | echo -e "Packages for pdftk downloaded\n\n" 17 | # install packages 18 | echo -e "\n\n Installing pdftk: \n\n" 19 | sudo apt-get install ./libgcj16_5.4.0-6ubuntu1~16.04.10_amd64.deb \ 20 | ./libgcj-common_4.9.3-9ubuntu1_all.deb \ 21 | ./pdftk_2.02-4_amd64.deb \ 22 | ./pdftk-dbg_2.02-4_amd64.deb 23 | echo -e "\n\n pdftk installed\n" 24 | echo -e " try it in shell with: > pdftk \n" 25 | # delete deb files in /tmp directory 26 | rm ./libgcj16_5.4.0-6ubuntu1~16.04.10_amd64.deb 27 | rm ./libgcj-common_4.9.3-9ubuntu1_all.deb 28 | rm ./pdftk_2.02-4_amd64.deb 29 | rm ./pdftk-dbg_2.02-4_amd64.deb 30 | http://mirrors.edge.kernel.org/ubuntu/pool/universe/p/pdftk/pdftk-dbg_2.02-4_amd64.deb 31 | 32 | echo -e "Packages for pdftk downloaded\n\n" 33 | # install packages 34 | echo -e "\n\n Installing pdftk: \n\n" 35 | sudo apt-get install ./libgcj16_5.4.0-6ubuntu1~16.04.10_amd64.deb \ 36 | ./libgcj-common_4.9.3-9ubuntu1_all.deb \ 37 | ./pdftk_2.02-4_amd64.deb \ 38 | ./pdftk-dbg_2.02-4_amd64.deb 39 | echo -e "\n\n pdftk installed\n" 40 | echo -e " try it in shell with: > pdftk \n" 41 | # delete deb files in /tmp directory 42 | rm ./libgcj16_5.4.0-6ubuntu1~16.04.10_amd64.deb 43 | rm ./libgcj-common_4.9.3-9ubuntu1_all.deb 44 | rm ./pdftk_2.02-4_amd64.deb 45 | rm ./pdftk-dbg_2.02-4_amd64.deb 46 | 47 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/resources/make.sh: -------------------------------------------------------------------------------- 1 | #extract pages 2 | #pdftk A=325462-sdm-vol-1-2abcd-3abcd.pdf cat A590-1125 A1134-1825 A1831-2436 A2443-2478 A2480-2516 A4163-4237 A4239-4281 A4283-4293 output selection.pdf 3 | ##pdftk A=325462-sdm-vol-1-2abcd-3abcd.pdf cat A591-1126 A1134-1825 A1831-2436 A2443-2478 A2480-2509 A4152-4219 A4221-4263 A4265-4275 output selection.pdf 4 | ##pdftk A=325462-sdm-vol-1-2abcd-3abcd.pdf cat A590-1125 A1134-1825 A1831-2435 A2443-2478 A2480-2509 output selection.pdf 5 | pdftk A=325462-sdm-vol-1-2abcd-3abcd.pdf cat A590-1134 A1142-1841 A1847-2451 A2459-2494 A2496-2533 output selection.pdf 6 | 7 | 8 | ##pdftk A=architecture-instruction-set-extensions-programming-reference.pdf cat A56-125 output selection-ext.pdf 9 | ##pdftk A=architecture-instruction-set-extensions-programming-reference.pdf cat A52-100 A102-109 output selection-ext.pdf 10 | 11 | pdftk A=architecture-instruction-set-extensions-programming-reference.pdf cat A66-93 A106-119 output selection-ext.pdf 12 | 13 | -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/resources/old/325462-sdm-vol-1-2abcd-3abcd-selection.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/Python/intel-doc-2-md/resources/old/325462-sdm-vol-1-2abcd-3abcd-selection.pdf -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/resources/old/architecture-instruction-set-extensions-programming-reference-selection.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HJLebbink/asm-dude/9e1ab93e4aefa16de7e93ded5ed684f7fd20984d/VS/Python/intel-doc-2-md/resources/old/architecture-instruction-set-extensions-programming-reference-selection.PDF -------------------------------------------------------------------------------- /VS/Python/intel-doc-2-md/run.cmd: -------------------------------------------------------------------------------- 1 | ::python main.py .\resources\325462-sdm-vol-1-2abcd-3abcd-selection.pdf 2 | ::python main.py .\resources\architecture-instruction-set-extensions-programming-reference-selection.pdf 3 | 4 | ::python main.py .\resources\325462-sdm-vol-1-2abcd-3abcd-selection.pdf 5 | python main.py .\resources\architecture-instruction-set-extensions-programming-reference-selection.pdf --------------------------------------------------------------------------------