diff --git a/github-linguist.gemspec b/github-linguist.gemspec index dbfd58a9..d4c2337a 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -13,10 +13,10 @@ Gem::Specification.new do |s| s.files = Dir['lib/**/*'] s.executables << 'linguist' - s.add_dependency 'charlock_holmes', '~> 0.7.2' + s.add_dependency 'charlock_holmes', '~> 0.7.3' s.add_dependency 'escape_utils', '~> 1.0.1' s.add_dependency 'mime-types', '~> 1.19' - s.add_dependency 'pygments.rb', '~> 0.5.4' + s.add_dependency 'pygments.rb', '~> 0.6.0' s.add_development_dependency 'json' s.add_development_dependency 'mocha' diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index 5c3de141..761288f0 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -63,7 +63,8 @@ module Linguist generated_jni_header? || composer_lock? || node_modules? || - vcr_cassette? + vcr_cassette? || + generated_by_zephir? end # Internal: Is the blob an XCode project file? @@ -237,6 +238,13 @@ module Linguist !!name.match(/composer.lock/) end + # Internal: Is the blob a generated by Zephir + # + # Returns true or false. + def generated_by_zephir? + !!name.match(/.\.zep\.(?:c|h|php)$/) + end + # Is the blob a VCR Cassette file? # # Returns true or false diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index f573eec4..4b74c66d 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -157,6 +157,7 @@ Assembly: - nasm extensions: - .asm + - .inc Augeas: type: programming @@ -998,6 +999,13 @@ Ioke: extensions: - .ik +Isabelle: + type: programming + lexer: Text only + color: "#fdcd00" + extensions: + - .thy + J: type: programming lexer: Text only @@ -1700,6 +1708,7 @@ Python: - .gyp - .lmi - .pyde + - .pyp - .pyt - .pyw - .wsgi @@ -1905,6 +1914,13 @@ SQL: - .udf - .viw +STON: + type: data + group: Smalltalk + lexer: JSON + extensions: + - .ston + Sage: type: programming lexer: Python @@ -1997,6 +2013,14 @@ Slash: extensions: - .sl +Slim: + group: HTML + type: markup + lexer: Slim + color: "#ff8877" + extensions: + - .slim + Smalltalk: type: programming color: "#596706" @@ -2059,8 +2083,8 @@ SuperCollider: Swift: type: programming + lexer: Swift color: "#ffac45" - lexer: Text only extensions: - .swift @@ -2275,6 +2299,7 @@ XML: - .launch - .mxml - .nproj + - .nuspec - .osm - .plist - .pluginspec @@ -2346,6 +2371,17 @@ XSLT: - .xslt - .xsl +Xojo: + type: programming + lexer: VB.net + extensions: + - .xojo_code + - .xojo_menu + - .xojo_report + - .xojo_script + - .xojo_toolbar + - .xojo_window + Xtend: type: programming extensions: diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 9cbfceb0..4a1fb89a 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -26,6 +26,10 @@ "AspectJ": [ ".aj" ], + "Assembly": [ + ".asm", + ".inc" + ], "ATS": [ ".atxt", ".dats", @@ -231,6 +235,9 @@ "Ioke": [ ".ik" ], + "Isabelle": [ + ".thy" + ], "Jade": [ ".jade" ], @@ -462,6 +469,7 @@ "Python": [ ".py", ".pyde", + ".pyp", ".script!" ], "R": [ @@ -549,6 +557,9 @@ "Slash": [ ".sl" ], + "Slim": [ + ".slim" + ], "Smalltalk": [ ".st" ], @@ -580,6 +591,9 @@ ".matah", ".sthlp" ], + "STON": [ + ".ston" + ], "Stylus": [ ".styl" ], @@ -645,12 +659,21 @@ ".fsproj", ".ivy", ".nproj", + ".nuspec", ".pluginspec", ".targets", ".vbproj", ".vcxproj", ".xml" ], + "Xojo": [ + ".xojo_code", + ".xojo_menu", + ".xojo_report", + ".xojo_script", + ".xojo_toolbar", + ".xojo_window" + ], "XProc": [ ".xpl" ], @@ -735,10 +758,15 @@ ], "YAML": [ ".gemrc" + ], + "Zephir": [ + "exception.zep.c", + "exception.zep.h", + "exception.zep.php" ] }, - "tokens_total": 614257, - "languages_total": 804, + "tokens_total": 639782, + "languages_total": 830, "tokens": { "ABAP": { "*/**": 1, @@ -2553,6 +2581,1323 @@ "_cache.put": 1, "_cache.size": 1 }, + "Assembly": { + ";": 20, + "flat": 4, + "assembler": 6, + "core": 2, + "Copyright": 4, + "(": 13, + "c": 4, + ")": 6, + "-": 87, + "Tomasz": 4, + "Grysztar.": 4, + "All": 4, + "rights": 4, + "reserved.": 4, + "xor": 52, + "eax": 510, + "mov": 1253, + "[": 2026, + "stub_size": 1, + "]": 2026, + "current_pass": 16, + "ax": 87, + "resolver_flags": 1, + "number_of_sections": 1, + "actual_fixups_size": 1, + "assembler_loop": 2, + "labels_list": 3, + "tagged_blocks": 23, + "additional_memory": 6, + "free_additional_memory": 2, + "additional_memory_end": 9, + "structures_buffer": 9, + "esi": 619, + "source_start": 1, + "edi": 250, + "code_start": 2, + "dword": 87, + "adjustment": 4, + "+": 232, + "addressing_space": 17, + "error_line": 16, + "counter": 13, + "format_flags": 2, + "number_of_relocations": 1, + "undefined_data_end": 4, + "file_extension": 1, + "next_pass_needed": 16, + "al": 1174, + "output_format": 3, + "adjustment_sign": 2, + "code_type": 106, + "call": 845, + "init_addressing_space": 6, + "pass_loop": 2, + "assemble_line": 3, + "jnc": 11, + "cmp": 1088, + "je": 485, + "pass_done": 2, + "sub": 64, + "h": 376, + "current_line": 24, + "jmp": 450, + "missing_end_directive": 7, + "close_pass": 1, + "check_symbols": 2, + "memory_end": 7, + "jae": 34, + "symbols_checked": 2, + "test": 95, + "byte": 549, + "jz": 107, + "symbol_defined_ok": 5, + "cx": 42, + "jne": 485, + "and": 50, + "not": 42, + "or": 194, + "use_prediction_ok": 5, + "jnz": 125, + "check_use_prediction": 2, + "use_misprediction": 3, + "check_next_symbol": 5, + "define_misprediction": 4, + "check_define_prediction": 2, + "add": 76, + "LABEL_STRUCTURE_SIZE": 1, + "next_pass": 3, + "assemble_ok": 2, + "error": 7, + "undefined_symbol": 2, + "error_confirmed": 3, + "error_info": 2, + "error_handler": 3, + "esp": 14, + "ret": 70, + "inc": 87, + "passes_limit": 3, + "code_cannot_be_generated": 1, + "create_addressing_space": 1, + "ebx": 336, + "Ah": 25, + "illegal_instruction": 48, + "Ch": 11, + "jbe": 11, + "out_of_memory": 19, + "ja": 28, + "lods": 366, + "assemble_instruction": 2, + "jb": 34, + "source_end": 2, + "define_label": 2, + "define_constant": 2, + "label_addressing_space": 2, + "Fh": 73, + "new_line": 2, + "code_type_setting": 2, + "segment_prefix": 2, + "instruction_assembled": 138, + "prefixed_instruction": 11, + "symbols_file": 4, + "continue_line": 8, + "line_assembled": 3, + "invalid_use_of_symbol": 17, + "reserved_word_used_as_symbol": 6, + "label_size": 5, + "make_label": 3, + "edx": 219, + "cl": 42, + "ebp": 49, + "ds": 21, + "sbb": 9, + "jp": 2, + "label_value_ok": 2, + "recoverable_overflow": 4, + "address_sign": 4, + "make_virtual_label": 2, + "xchg": 31, + "ch": 55, + "shr": 30, + "neg": 4, + "setnz": 5, + "ah": 229, + "finish_label": 2, + "setne": 14, + "finish_label_symbol": 2, + "b": 30, + "label_symbol_ok": 2, + "new_label": 2, + "symbol_already_defined": 3, + "btr": 2, + "jc": 28, + "requalified_label": 2, + "label_made": 4, + "push": 150, + "get_constant_value": 4, + "dl": 58, + "size_override": 7, + "get_value": 2, + "pop": 99, + "bl": 124, + "ecx": 153, + "constant_referencing_mode_ok": 2, + "value_type": 42, + "make_constant": 2, + "value_sign": 3, + "constant_symbol_ok": 2, + "symbol_identifier": 4, + "new_constant": 2, + "redeclare_constant": 2, + "requalified_constant": 2, + "make_addressing_space_label": 3, + "dx": 27, + "operand_size": 121, + "operand_prefix": 9, + "opcode_prefix": 30, + "rex_prefix": 9, + "vex_required": 2, + "vex_register": 1, + "immediate_size": 9, + "instruction_handler": 32, + "movzx": 13, + "word": 79, + "extra_characters_on_line": 8, + "clc": 11, + "dec": 30, + "stc": 9, + "org_directive": 1, + "invalid_argument": 28, + "invalid_value": 21, + "get_qword_value": 5, + "in_virtual": 2, + "org_space_ok": 2, + "close_virtual_addressing_space": 3, + "org_value_ok": 2, + "bts": 1, + "label_directive": 1, + "get_label_size": 2, + "label_size_ok": 2, + "get_free_label_value": 2, + "get_address_value": 3, + "bh": 34, + "bp": 2, + "shl": 17, + "bx": 8, + "make_free_label": 1, + "address_symbol": 2, + "load_directive": 1, + "load_size_ok": 2, + "value": 38, + "get_data_point": 3, + "value_loaded": 2, + "rep": 7, + "movs": 8, + "get_data_address": 5, + "addressing_space_unavailable": 3, + "symbol_out_of_scope": 1, + "get_addressing_space": 3, + "store_label_reference": 1, + "calculate_relative_offset": 2, + "data_address_type_ok": 2, + "adc": 9, + "bad_data_address": 3, + "store_directive": 1, + "sized_store": 2, + "get_byte_value": 23, + "store_value_ok": 2, + "undefined_data_start": 3, + "display_directive": 2, + "display_byte": 2, + "stos": 107, + "display_next": 2, + "show_display_buffer": 2, + "display_done": 3, + "display_messages": 2, + "skip_block": 2, + "display_block": 4, + "times_directive": 1, + "get_count_value": 6, + "zero_times": 3, + "times_argument_ok": 2, + "counter_limit": 7, + "times_loop": 2, + "stack_overflow": 2, + "stack_limit": 2, + "times_done": 2, + "skip_symbol": 5, + "virtual_directive": 3, + "virtual_at_current": 2, + "set_virtual": 2, + "allocate_structure_data": 5, + "find_structure_data": 6, + "scan_structures": 2, + "no_such_structure": 2, + "structure_data_found": 2, + "end_virtual": 2, + "unexpected_instruction": 18, + "remove_structure_data": 7, + "lea": 8, + "std": 2, + "cld": 2, + "addressing_space_closed": 2, + "virtual_byte_ok": 2, + "virtual_word_ok": 2, + "repeat_directive": 7, + "zero_repeat": 2, + "end_repeat": 2, + "continue_repeating": 2, + "stop_repeat": 2, + "find_end_repeat": 4, + "find_structure_end": 5, + "while_directive": 7, + "do_while": 2, + "calculate_logical_expression": 3, + "while_true": 2, + "stop_while": 2, + "find_end_while": 3, + "end_while": 2, + "too_many_repeats": 1, + "if_directive": 13, + "if_true": 2, + "find_else": 4, + "else_true": 3, + "make_if_structure": 2, + "else_directive": 3, + "found_else": 2, + "skip_else": 3, + "find_end_if": 3, + "end_if": 2, + "else_found": 2, + "find_end_directive": 10, + "no_end_directive": 2, + "skip_labels": 2, + "labels_ok": 2, + "prefix_instruction": 2, + "skip_repeat": 2, + "skip_while": 2, + "skip_if": 2, + "structure_end": 4, + "end_directive": 2, + "skip_if_block": 4, + "if_block_skipped": 2, + "skip_after_else": 3, + "data_directive": 1, + "end_data": 1, + "break_directive": 1, + "find_breakable_structure": 4, + "break_repeat": 2, + "break_while": 2, + "break_if": 2, + "data_bytes": 1, + "define_data": 8, + "get_byte": 2, + "undefined_data": 7, + "get_string": 2, + "mark_undefined_data": 2, + "undefined_data_ok": 2, + "simple_data_value": 3, + "skip_expression": 1, + "duplicate_zero_times": 2, + "duplicate_single_data_value": 3, + "duplicate_data": 2, + "duplicated_values": 2, + "near": 3, + "data_defined": 5, + "skip_single_data_value": 2, + "skip_data_value": 2, + "data_unicode": 1, + "base_code": 195, + "define_words": 2, + "data_words": 1, + "get_word": 2, + "scas": 10, + "word_data_value": 2, + "word_string": 2, + "get_word_value": 19, + "mark_relocation": 26, + "jecxz": 1, + "word_string_ok": 2, + "ecx*2": 1, + "copy_word_string": 2, + "loop": 2, + "data_dwords": 1, + "get_dword": 2, + "get_dword_value": 13, + "complex_dword": 2, + "invalid_operand": 239, + "data_pwords": 1, + "get_pword": 2, + "get_pword_value": 1, + "complex_pword": 2, + "data_qwords": 1, + "get_qword": 2, + "data_twords": 1, + "get_tword": 2, + "complex_tword": 2, + "fp_zero_tword": 2, + "FFFh": 3, + "jo": 2, + "value_out_of_range": 10, + "jge": 5, + "jg": 1, + "tword_exp_ok": 3, + "large_shift": 2, + "shrd": 1, + "tword_mantissa_shift_done": 2, + "store_shifted_mantissa": 2, + "data_file": 2, + "open_binary_file": 2, + "lseek": 5, + "position_ok": 2, + "size_ok": 2, + "read": 3, + "error_reading_file": 1, + "close": 3, + "find_current_source_path": 2, + "get_current_path": 3, + "lodsb": 12, + "stosb": 6, + "cut_current_path": 1, + "current_path_ok": 1, + "/": 1, + ".": 7, + "invalid_align_value": 3, + "section_not_aligned_enough": 4, + "make_alignment": 3, + "pe_alignment": 2, + "nops": 2, + "reserved_data": 2, + "nops_stosb_ok": 2, + "nops_stosw_ok": 2, + "err_directive": 1, + "invoked_error": 2, + "assert_directive": 1, + "assertion_failed": 1, + "interface": 2, + "for": 2, + "Win32": 2, + "format": 1, + "PE": 1, + "console": 1, + "section": 4, + "code": 1, + "readable": 4, + "executable": 1, + "start": 1, + "con_handle": 8, + "STD_OUTPUT_HANDLE": 2, + "_logo": 2, + "display_string": 19, + "get_params": 2, + "information": 2, + "init_memory": 2, + "_memory_prefix": 2, + "memory_start": 4, + "display_number": 8, + "_memory_suffix": 2, + "GetTickCount": 3, + "start_time": 3, + "preprocessor": 1, + "parser": 1, + "formatter": 1, + "display_user_messages": 3, + "_passes_suffix": 2, + "div": 8, + "display_bytes_count": 2, + "display_character": 6, + "_seconds_suffix": 2, + "written_size": 1, + "_bytes_suffix": 2, + "exit_program": 5, + "_usage": 2, + "input_file": 4, + "output_file": 3, + "memory_setting": 4, + "GetCommandLine": 2, + "params": 2, + "find_command_start": 2, + "skip_quoted_name": 3, + "skip_name": 2, + "find_param": 7, + "all_params": 5, + "option_param": 2, + "Dh": 19, + "get_output_file": 2, + "process_param": 3, + "bad_params": 11, + "string_param": 3, + "copy_param": 2, + "param_end": 6, + "string_param_end": 2, + "memory_option": 4, + "passes_option": 4, + "symbols_option": 3, + "get_option_value": 3, + "get_option_digit": 2, + "option_value_ok": 4, + "invalid_option_value": 5, + "imul": 1, + "find_symbols_file_name": 2, + "include": 15, + "data": 3, + "writeable": 2, + "_copyright": 1, + "db": 35, + "VERSION_STRING": 1, + "align": 1, + "dd": 22, + "bytes_count": 8, + "displayed_count": 4, + "character": 3, + "last_displayed": 5, + "rb": 4, + "options": 1, + "buffer": 14, + "stack": 1, + "import": 1, + "rva": 16, + "kernel_name": 2, + "kernel_table": 2, + "ExitProcess": 2, + "_ExitProcess": 2, + "CreateFile": 3, + "_CreateFileA": 2, + "ReadFile": 2, + "_ReadFile": 2, + "WriteFile": 6, + "_WriteFile": 2, + "CloseHandle": 2, + "_CloseHandle": 2, + "SetFilePointer": 2, + "_SetFilePointer": 2, + "_GetCommandLineA": 2, + "GetEnvironmentVariable": 2, + "_GetEnvironmentVariable": 2, + "GetStdHandle": 5, + "_GetStdHandle": 2, + "VirtualAlloc": 2, + "_VirtualAlloc": 2, + "VirtualFree": 2, + "_VirtualFree": 2, + "_GetTickCount": 2, + "GetSystemTime": 2, + "_GetSystemTime": 2, + "GlobalMemoryStatus": 2, + "_GlobalMemoryStatus": 2, + "dw": 14, + "fixups": 1, + "discardable": 1, + "CREATE_NEW": 1, + "CREATE_ALWAYS": 2, + "OPEN_EXISTING": 2, + "OPEN_ALWAYS": 1, + "TRUNCATE_EXISTING": 1, + "FILE_SHARE_READ": 3, + "FILE_SHARE_WRITE": 1, + "FILE_SHARE_DELETE": 1, + "GENERIC_READ": 2, + "GENERIC_WRITE": 2, + "STD_INPUT_HANDLE": 1, + "FFFFFFF6h": 1, + "FFFFFFF5h": 1, + "STD_ERROR_HANDLE": 3, + "FFFFFFF4h": 1, + "MEM_COMMIT": 2, + "MEM_RESERVE": 1, + "MEM_DECOMMIT": 1, + "MEM_RELEASE": 2, + "MEM_FREE": 1, + "MEM_PRIVATE": 1, + "MEM_MAPPED": 1, + "MEM_RESET": 1, + "MEM_TOP_DOWN": 1, + "PAGE_NOACCESS": 1, + "PAGE_READONLY": 1, + "PAGE_READWRITE": 2, + "PAGE_WRITECOPY": 1, + "PAGE_EXECUTE": 1, + "PAGE_EXECUTE_READ": 1, + "PAGE_EXECUTE_READWRITE": 1, + "PAGE_EXECUTE_WRITECOPY": 1, + "PAGE_GUARD": 1, + "PAGE_NOCACHE": 1, + "allocate_memory": 4, + "jl": 13, + "large_memory": 3, + "not_enough_memory": 2, + "do_exit": 2, + "get_environment_variable": 1, + "buffer_for_variable_ok": 2, + "open": 2, + "file_error": 6, + "create": 1, + "write": 1, + "repne": 1, + "scasb": 1, + "display_loop": 2, + "display_digit": 3, + "digit_ok": 2, + "line_break_ok": 4, + "make_line_break": 2, + "A0Dh": 2, + "D0Ah": 1, + "take_last_two_characters": 2, + "block_displayed": 2, + "block_ok": 2, + "fatal_error": 1, + "error_prefix": 3, + "error_suffix": 3, + "FFh": 4, + "assembler_error": 1, + "get_error_lines": 2, + "get_next_error_line": 2, + "display_error_line": 3, + "find_definition_origin": 2, + "line_number_start": 3, + "FFFFFFFh": 2, + "line_number_ok": 2, + "line_data_start": 2, + "line_data_displayed": 2, + "get_line_data": 2, + "display_line_data": 5, + "cr_lf": 2, + "make_timestamp": 1, + "mul": 5, + "months_correction": 2, + "day_correction_ok": 4, + "day_correction": 2, + "simple_instruction_except64": 1, + "simple_instruction": 6, + "simple_instruction_only64": 1, + "simple_instruction_16bit_except64": 1, + "simple_instruction_16bit": 2, + "size_prefix": 3, + "simple_instruction_32bit_except64": 1, + "simple_instruction_32bit": 6, + "iret_instruction": 1, + "simple_instruction_64bit": 2, + "simple_extended_instruction_64bit": 1, + "simple_extended_instruction": 1, + "segment_register": 7, + "store_segment_prefix": 1, + "int_instruction": 1, + "get_size_operator": 137, + "invalid_operand_size": 131, + "jns": 1, + "int_imm_ok": 2, + "CDh": 1, + "aa_instruction": 1, + "aa_store": 2, + "basic_instruction": 1, + "basic_reg": 2, + "basic_mem": 1, + "get_address": 62, + "basic_mem_imm": 2, + "basic_mem_reg": 1, + "convert_register": 60, + "postbyte_register": 137, + "instruction_ready": 72, + "operand_autodetect": 47, + "store_instruction": 3, + "basic_mem_imm_nosize": 2, + "basic_mem_imm_8bit": 2, + "basic_mem_imm_16bit": 2, + "basic_mem_imm_32bit": 2, + "basic_mem_imm_64bit": 1, + "size_declared": 17, + "long_immediate_not_encodable": 14, + "operand_64bit": 18, + "get_simm32": 10, + "basic_mem_imm_32bit_ok": 2, + "recoverable_unknown_size": 19, + "store_instruction_with_imm8": 11, + "operand_16bit": 25, + "basic_mem_imm_16bit_store": 3, + "basic_mem_simm_8bit": 5, + "store_instruction_with_imm16": 4, + "operand_32bit": 27, + "basic_mem_imm_32bit_store": 3, + "store_instruction_with_imm32": 4, + "cdq": 11, + "get_simm32_ok": 2, + "basic_reg_reg": 2, + "basic_reg_imm": 2, + "basic_reg_mem": 1, + "basic_reg_mem_8bit": 2, + "nomem_instruction_ready": 53, + "store_nomem_instruction": 19, + "basic_reg_imm_8bit": 2, + "basic_reg_imm_16bit": 2, + "basic_reg_imm_32bit": 2, + "basic_reg_imm_64bit": 1, + "basic_reg_imm_32bit_ok": 2, + "basic_al_imm": 2, + "basic_reg_imm_16bit_store": 3, + "basic_reg_simm_8bit": 5, + "basic_ax_imm": 2, + "basic_store_imm_16bit": 2, + "store_instruction_code": 26, + "basic_reg_imm_32bit_store": 3, + "basic_eax_imm": 2, + "basic_store_imm_32bit": 2, + "ignore_unknown_size": 2, + "operand_size_not_specified": 1, + "single_operand_instruction": 1, + "F6h": 4, + "single_reg": 2, + "single_mem": 1, + "single_mem_8bit": 2, + "single_mem_nosize": 2, + "single_reg_8bit": 2, + "mov_instruction": 1, + "mov_reg": 2, + "mov_mem": 1, + "mov_mem_imm": 2, + "mov_mem_reg": 1, + "mov_mem_general_reg": 2, + "mov_mem_sreg": 2, + "mov_mem_reg_8bit": 2, + "mov_mem_ax": 2, + "mov_mem_al": 1, + "mov_mem_address16_al": 3, + "mov_mem_address32_al": 3, + "mov_mem_address64_al": 3, + "invalid_address_size": 18, + "store_segment_prefix_if_necessary": 17, + "address_32bit_prefix": 11, + "A2h": 3, + "store_mov_address32": 4, + "store_address_32bit_value": 1, + "address_16bit_prefix": 11, + "store_mov_address16": 4, + "invalid_address": 32, + "store_mov_address64": 4, + "store_address_64bit_value": 1, + "mov_mem_address16_ax": 3, + "mov_mem_address32_ax": 3, + "mov_mem_address64_ax": 3, + "A3h": 3, + "mov_mem_sreg_store": 2, + "mov_mem_imm_nosize": 2, + "mov_mem_imm_8bit": 2, + "mov_mem_imm_16bit": 2, + "mov_mem_imm_32bit": 2, + "mov_mem_imm_64bit": 1, + "mov_mem_imm_32bit_store": 2, + "C6h": 1, + "C7h": 4, + "F0h": 7, + "mov_sreg": 2, + "mov_reg_mem": 2, + "mov_reg_imm": 2, + "mov_reg_reg": 1, + "mov_reg_sreg": 2, + "mov_reg_reg_8bit": 2, + "mov_reg_creg": 2, + "mov_reg_dreg": 2, + "mov_reg_treg": 2, + "mov_reg_sreg64": 2, + "mov_reg_sreg32": 2, + "mov_reg_sreg_store": 3, + "extended_code": 73, + "mov_reg_xrx": 3, + "mov_reg_xrx_64bit": 2, + "mov_reg_xrx_store": 3, + "mov_reg_mem_8bit": 2, + "mov_ax_mem": 2, + "mov_al_mem": 2, + "mov_al_mem_address16": 3, + "mov_al_mem_address32": 3, + "mov_al_mem_address64": 3, + "A0h": 4, + "mov_ax_mem_address16": 3, + "mov_ax_mem_address32": 3, + "mov_ax_mem_address64": 3, + "A1h": 4, + "mov_reg_imm_8bit": 2, + "mov_reg_imm_16bit": 2, + "mov_reg_imm_32bit": 2, + "mov_reg_imm_64bit": 1, + "mov_reg_imm_64bit_store": 3, + "mov_reg_64bit_imm_32bit": 2, + "B8h": 3, + "store_mov_reg_imm_code": 5, + "B0h": 5, + "mov_store_imm_32bit": 2, + "mov_reg_imm_prefix_ok": 2, + "mov_creg": 2, + "mov_dreg": 2, + "mov_treg": 2, + "mov_sreg_mem": 2, + "mov_sreg_reg": 1, + "mov_sreg_reg_size_ok": 2, + "Eh": 8, + "mov_sreg_mem_size_ok": 2, + "mov_xrx": 3, + "mov_xrx_64bit": 2, + "mov_xrx_store": 4, + "test_instruction": 1, + "test_reg": 2, + "test_mem": 1, + "test_mem_imm": 2, + "test_mem_reg": 2, + "test_mem_reg_8bit": 2, + "test_mem_imm_nosize": 2, + "test_mem_imm_8bit": 2, + "test_mem_imm_16bit": 2, + "test_mem_imm_32bit": 2, + "test_mem_imm_64bit": 1, + "test_mem_imm_32bit_store": 2, + "F7h": 5, + "test_reg_mem": 3, + "test_reg_imm": 2, + "test_reg_reg": 1, + "test_reg_reg_8bit": 2, + "test_reg_imm_8bit": 2, + "test_reg_imm_16bit": 2, + "test_reg_imm_32bit": 2, + "test_reg_imm_64bit": 1, + "test_reg_imm_32bit_store": 2, + "test_al_imm": 2, + "A8h": 1, + "test_ax_imm": 2, + "A9h": 2, + "test_eax_imm": 2, + "test_reg_mem_8bit": 2, + "xchg_instruction": 1, + "xchg_reg": 2, + "xchg_mem": 1, + "xchg_reg_reg": 1, + "xchg_reg_reg_8bit": 2, + "xchg_ax_reg": 2, + "xchg_reg_reg_store": 3, + "xchg_ax_reg_ok": 3, + "xchg_ax_reg_store": 2, + "push_instruction": 1, + "push_size": 9, + "push_next": 2, + "push_reg": 2, + "push_imm": 2, + "push_mem": 1, + "push_mem_16bit": 3, + "push_mem_32bit": 3, + "push_mem_64bit": 3, + "push_mem_store": 4, + "push_done": 5, + "push_sreg": 2, + "push_reg_ok": 2, + "push_reg_16bit": 2, + "push_reg_32bit": 2, + "push_reg_64bit": 1, + "push_reg_store": 5, + "dh": 37, + "push_sreg16": 3, + "push_sreg32": 3, + "push_sreg64": 3, + "push_sreg_store": 4, + "push_sreg_386": 2, + "push_imm_size_ok": 3, + "push_imm_16bit": 2, + "push_imm_32bit": 2, + "push_imm_64bit": 2, + "push_imm_optimized_16bit": 3, + "push_imm_optimized_32bit": 3, + "push_imm_optimized_64bit": 2, + "push_imm_32bit_store": 8, + "push_imm_8bit": 3, + "push_imm_16bit_store": 4, + "pop_instruction": 1, + "pop_next": 2, + "pop_reg": 2, + "pop_mem": 1, + "pop_mem_16bit": 3, + "pop_mem_32bit": 3, + "pop_mem_64bit": 3, + "pop_mem_store": 4, + "pop_done": 3, + "pop_sreg": 2, + "pop_reg_ok": 2, + "pop_reg_16bit": 2, + "pop_reg_32bit": 2, + "pop_reg_64bit": 2, + "pop_reg_store": 5, + "pop_cs": 2, + "pop_sreg16": 3, + "pop_sreg32": 3, + "pop_sreg64": 3, + "pop_sreg_store": 4, + "pop_sreg_386": 2, + "pop_cs_store": 3, + "inc_instruction": 1, + "inc_reg": 2, + "inc_mem": 2, + "inc_mem_8bit": 2, + "inc_mem_nosize": 2, + "FEh": 2, + "inc_reg_8bit": 2, + "inc_reg_long_form": 2, + "set_instruction": 1, + "set_reg": 2, + "set_mem": 1, + "arpl_instruction": 1, + "arpl_reg": 2, + "bound_instruction": 1, + "bound_store": 2, + "enter_instruction": 1, + "enter_imm16_size_ok": 2, + "enter_imm16_ok": 2, + "js": 3, + "enter_imm8_size_ok": 2, + "enter_imm8_ok": 2, + "C8h": 2, + "ret_instruction_only64": 1, + "ret_instruction": 5, + "ret_instruction_32bit_except64": 1, + "ret_instruction_32bit": 1, + "ret_instruction_16bit": 1, + "retf_instruction": 1, + "ret_instruction_64bit": 1, + "simple_ret": 4, + "ret_imm": 3, + "ret_imm_ok": 2, + "ret_imm_store": 2, + "lea_instruction": 1, + "ls_instruction": 1, + "les_instruction": 2, + "lds_instruction": 2, + "ls_code_ok": 2, + "C4h": 1, + "ls_short_code": 2, + "C5h": 2, + "ls_16bit": 2, + "ls_32bit": 2, + "ls_64bit": 2, + "sh_instruction": 1, + "sh_reg": 2, + "sh_mem": 1, + "sh_mem_imm": 2, + "sh_mem_reg": 1, + "sh_mem_cl_8bit": 2, + "sh_mem_cl_nosize": 2, + "D3h": 2, + "D2h": 2, + "sh_mem_imm_size_ok": 2, + "sh_mem_imm_8bit": 2, + "sh_mem_imm_nosize": 2, + "sh_mem_1": 2, + "C1h": 2, + "D1h": 2, + "sh_mem_1_8bit": 2, + "C0h": 2, + "D0h": 2, + "sh_reg_imm": 2, + "sh_reg_reg": 1, + "sh_reg_cl_8bit": 2, + "sh_reg_imm_size_ok": 2, + "sh_reg_imm_8bit": 2, + "sh_reg_1": 2, + "sh_reg_1_8bit": 2, + "shd_instruction": 1, + "shd_reg": 2, + "shd_mem": 1, + "shd_mem_reg_imm": 2, + "shd_mem_reg_imm_size_ok": 2, + "shd_reg_reg_imm": 2, + "shd_reg_reg_imm_size_ok": 2, + "movx_instruction": 1, + "movx_reg": 2, + "movx_unknown_size": 2, + "movx_mem_store": 3, + "movx_reg_8bit": 2, + "movx_reg_16bit": 2, + "movsxd_instruction": 1, + "movsxd_reg": 2, + "movsxd_mem_store": 2, + "bt_instruction": 1, + "bt_reg": 2, + "bt_mem_imm": 3, + "bt_mem_reg": 2, + "bt_mem_imm_size_ok": 2, + "bt_mem_imm_nosize": 2, + "bt_mem_imm_store": 2, + "BAh": 2, + "bt_reg_imm": 3, + "bt_reg_reg": 2, + "bt_reg_imm_size_ok": 2, + "bt_reg_imm_store": 1, + "bs_instruction": 1, + "get_reg_mem": 2, + "bs_reg_reg": 2, + "get_reg_reg": 2, + "imul_instruction": 1, + "imul_reg": 2, + "imul_mem": 1, + "imul_mem_8bit": 2, + "imul_mem_nosize": 2, + "imul_reg_": 2, + "imul_reg_8bit": 2, + "imul_reg_imm": 3, + "imul_reg_noimm": 2, + "imul_reg_reg": 2, + "imul_reg_mem": 1, + "imul_reg_mem_imm": 2, + "AFh": 2, + "imul_reg_mem_imm_16bit": 2, + "imul_reg_mem_imm_32bit": 2, + "imul_reg_mem_imm_64bit": 1, + "imul_reg_mem_imm_32bit_ok": 2, + "imul_reg_mem_imm_16bit_store": 4, + "imul_reg_mem_imm_8bit_store": 3, + "imul_reg_mem_imm_32bit_store": 4, + "Bh": 11, + "imul_reg_reg_imm": 3, + "imul_reg_reg_imm_16bit": 2, + "imul_reg_reg_imm_32bit": 2, + "imul_reg_reg_imm_64bit": 1, + "imul_reg_reg_imm_32bit_ok": 2, + "imul_reg_reg_imm_16bit_store": 4, + "imul_reg_reg_imm_8bit_store": 3, + "imul_reg_reg_imm_32bit_store": 4, + "in_instruction": 1, + "in_imm": 2, + "in_reg": 2, + "in_al_dx": 2, + "in_ax_dx": 2, + "EDh": 1, + "ECh": 1, + "in_imm_size_ok": 2, + "in_al_imm": 2, + "in_ax_imm": 2, + "E5h": 1, + "E4h": 1, + "out_instruction": 1, + "out_imm": 2, + "out_dx_al": 2, + "out_dx_ax": 2, + "EFh": 1, + "EEh": 1, + "out_imm_size_ok": 2, + "out_imm_al": 2, + "out_imm_ax": 2, + "E7h": 1, + "E6h": 1, + "call_instruction": 1, + "E8h": 3, + "process_jmp": 2, + "jmp_instruction": 1, + "E9h": 1, + "EAh": 1, + "get_jump_operator": 3, + "jmp_imm": 2, + "jmp_reg": 2, + "jmp_mem": 1, + "jump_type": 14, + "jmp_mem_size_not_specified": 2, + "jmp_mem_16bit": 3, + "jmp_mem_32bit": 2, + "jmp_mem_48bit": 2, + "jmp_mem_64bit": 2, + "jmp_mem_80bit": 2, + "jmp_mem_far": 2, + "jmp_mem_near": 2, + "jmp_mem_near_32bit": 3, + "jmp_mem_far_32bit": 4, + "jmp_mem_far_store": 3, + "jmp_reg_16bit": 2, + "jmp_reg_32bit": 2, + "jmp_reg_64bit": 1, + "jmp_far": 2, + "jmp_near": 1, + "jmp_imm_16bit": 3, + "jmp_imm_32bit": 2, + "jmp_imm_64bit": 3, + "get_address_dword_value": 3, + "jmp_imm_32bit_prefix_ok": 2, + "calculate_jump_offset": 10, + "check_for_short_jump": 8, + "jmp_short": 3, + "jmp_imm_32bit_store": 2, + "jno": 2, + "jmp_imm_32bit_ok": 2, + "relative_jump_out_of_range": 6, + "get_address_qword_value": 3, + "EBh": 1, + "get_address_word_value": 3, + "jmp_imm_16bit_prefix_ok": 2, + "cwde": 3, + "forced_short": 2, + "no_short_jump": 4, + "short_jump": 4, + "jmp_short_value_type_ok": 2, + "jump_out_of_range": 3, + "jmp_far_16bit": 2, + "jmp_far_32bit": 3, + "jmp_far_segment": 2, + "conditional_jump": 1, + "conditional_jump_16bit": 3, + "conditional_jump_32bit": 2, + "conditional_jump_64bit": 3, + "conditional_jump_32bit_prefix_ok": 2, + "conditional_jump_short": 4, + "conditional_jump_32bit_store": 2, + "conditional_jump_32bit_range_ok": 2, + "conditional_jump_16bit_prefix_ok": 2, + "loop_instruction_16bit": 1, + "loop_instruction": 5, + "loop_instruction_32bit": 1, + "loop_instruction_64bit": 1, + "loop_jump_16bit": 3, + "loop_jump_32bit": 2, + "loop_jump_64bit": 3, + "loop_jump_32bit_prefix_ok": 2, + "loop_counter_size": 4, + "make_loop_jump": 3, + "loop_counter_size_ok": 2, + "loop_jump_16bit_prefix_ok": 2, + "movs_instruction": 1, + "address_sizes_do_not_agree": 2, + "movs_address_16bit": 2, + "movs_address_32bit": 2, + "movs_store": 3, + "A4h": 1, + "movs_check_size": 5, + "lods_instruction": 1, + "lods_address_16bit": 2, + "lods_address_32bit": 2, + "lods_store": 3, + "ACh": 1, + "stos_instruction": 1, + "stos_address_16bit": 2, + "stos_address_32bit": 2, + "stos_store": 3, + "cmps_instruction": 1, + "cmps_address_16bit": 2, + "cmps_address_32bit": 2, + "cmps_store": 3, + "A6h": 1, + "ins_instruction": 1, + "ins_address_16bit": 2, + "ins_address_32bit": 2, + "ins_store": 3, + "ins_check_size": 2, + "outs_instruction": 1, + "outs_address_16bit": 2, + "outs_address_32bit": 2, + "outs_store": 3, + "xlat_instruction": 1, + "xlat_address_16bit": 2, + "xlat_address_32bit": 2, + "xlat_store": 3, + "D7h": 1, + "pm_word_instruction": 1, + "pm_reg": 2, + "pm_mem": 2, + "pm_mem_store": 2, + "pm_store_word_instruction": 1, + "lgdt_instruction": 1, + "lgdt_mem_48bit": 2, + "lgdt_mem_80bit": 2, + "lgdt_mem_store": 4, + "lar_instruction": 1, + "lar_reg_reg": 2, + "lar_reg_mem": 2, + "invlpg_instruction": 1, + "swapgs_instruction": 1, + "rdtscp_instruction": 1, + "basic_486_instruction": 1, + "basic_486_reg": 2, + "basic_486_mem_reg_8bit": 2, + "basic_486_reg_reg_8bit": 2, + "bswap_instruction": 1, + "bswap_reg_code_ok": 2, + "bswap_reg64": 2, + "cmpxchgx_instruction": 1, + "cmpxchgx_size_ok": 2, + "cmpxchgx_store": 2, + "nop_instruction": 1, + "extended_nop": 4, + "extended_nop_reg": 2, + "extended_nop_store": 2, + "basic_fpu_instruction": 1, + "D8h": 2, + "basic_fpu_streg": 2, + "basic_fpu_mem": 2, + "basic_fpu_mem_32bit": 2, + "basic_fpu_mem_64bit": 2, + "DCh": 2, + "convert_fpu_register": 9, + "basic_fpu_single_streg": 3, + "basic_fpu_st0": 2, + "basic_fpu_streg_st0": 2, + "simple_fpu_instruction": 1, + "D9h": 6, + "fi_instruction": 1, + "fi_mem_16bit": 2, + "fi_mem_32bit": 2, + "DAh": 2, + "DEh": 2, + "fld_instruction": 1, + "fld_streg": 2, + "fld_mem_32bit": 2, + "fld_mem_64bit": 2, + "fld_mem_80bit": 2, + "DDh": 6, + "fld_mem_80bit_store": 3, + "DBh": 4, + "fst_streg": 2, + "fild_instruction": 1, + "fild_mem_16bit": 2, + "fild_mem_32bit": 2, + "fild_mem_64bit": 2, + "DFh": 5, + "fisttp_64bit_store": 2, + "fild_mem_64bit_store": 3, + "fbld_instruction": 1, + "fbld_mem_80bit": 3, + "faddp_instruction": 1, + "faddp_streg": 2, + "fcompp_instruction": 1, + "D9DEh": 1, + "fucompp_instruction": 1, + "E9DAh": 1, + "fxch_instruction": 1, + "fpu_single_operand": 3, + "ffreep_instruction": 1, + "ffree_instruction": 1, + "fpu_streg": 2, + "fstenv_instruction": 1, + "fldenv_instruction": 3, + "fpu_mem": 2, + "fstenv_instruction_16bit": 1, + "fldenv_instruction_16bit": 1, + "fstenv_instruction_32bit": 1, + "fldenv_instruction_32bit": 1, + "fsave_instruction_32bit": 1, + "fnsave_instruction_32bit": 1, + "fnsave_instruction": 3, + "fsave_instruction_16bit": 1, + "fnsave_instruction_16bit": 1, + "fsave_instruction": 1, + "fstcw_instruction": 1, + "fldcw_instruction": 1, + "fldcw_mem_16bit": 3, + "fstsw_instruction": 1, + "fnstsw_instruction": 1, + "fstsw_reg": 2, + "fstsw_mem_16bit": 3, + "E0DFh": 1, + "finit_instruction": 1, + "fninit_instruction": 1, + "fcmov_instruction": 1, + "fcomi_streg": 3, + "fcomi_instruction": 1, + "fcomip_instruction": 1, + "fcomi_st0_streg": 2, + "basic_mmx_instruction": 1, + "mmx_instruction": 1, + "convert_mmx_register": 18, + "make_mmx_prefix": 9, + "mmx_mmreg_mmreg": 3, + "mmx_mmreg_mem": 2, + "mmx_bit_shift_instruction": 1, + "mmx_ps_mmreg_imm8": 2, + "pmovmskb_instruction": 1, + "pmovmskb_reg_size_ok": 2, + "mmx_nomem_imm8": 7, + "mmx_imm8": 6, + "append_imm8": 2, + "pinsrw_instruction": 1, + "pinsrw_mmreg_reg": 2, + "pshufw_instruction": 1, + "mmx_size": 30, + "pshuf_instruction": 2, + "pshufd_instruction": 1, + "pshuf_mmreg_mmreg": 2, + "movd_instruction": 1, + "movd_reg": 2, + "movd_mmreg": 2, + "movd_mmreg_reg": 2, + "mmx_prefix_for_vex": 2, + "no_mmx_prefix": 2, + "movq_instruction": 1, + "movq_reg": 2, + "movq_mem_xmmreg": 2, + "D6h": 2, + "movq_mmreg": 2, + "movq_mmreg_": 2, + "F3h": 7, + "movq_mmreg_reg": 2, + "movq_mmreg_mmreg": 2, + "movq_mmreg_reg_store": 2, + "movdq_instruction": 1, + "movdq_mmreg": 2, + "convert_xmm_register": 12, + "movdq_mmreg_mmreg": 2, + "lddqu_instruction": 1, + "F2h": 6, + "movdq2q_instruction": 1, + "movq2dq_": 2, + "movq2dq_instruction": 1, + "sse_ps_instruction_imm8": 1, + "sse_ps_instruction": 1, + "sse_instruction": 11, + "sse_pd_instruction_imm8": 1, + "sse_pd_instruction": 1, + "sse_ss_instruction": 1, + "sse_sd_instruction": 1, + "cmp_pd_instruction": 1, + "cmp_ps_instruction": 1, + "C2h": 4, + "cmp_ss_instruction": 1, + "cmp_sx_instruction": 2, + "cmpsd_instruction": 1, + "A7h": 1, + "cmp_sd_instruction": 1, + "comiss_instruction": 1, + "comisd_instruction": 1, + "cvtdq2pd_instruction": 1, + "cvtps2pd_instruction": 1, + "cvtpd2dq_instruction": 1, + "movshdup_instruction": 1, + "sse_xmmreg": 2, + "sse_reg": 1, + "sse_xmmreg_xmmreg": 2, + "sse_reg_mem": 2, + "sse_mem_size_ok": 2, + "supplemental_code": 2, + "sse_cmp_mem_ok": 3, + "sse_ok": 2, + "take_additional_xmm0": 3, + "sse_xmmreg_xmmreg_ok": 4, + "sse_cmp_nomem_ok": 3, + "sse_nomem_ok": 2, + "additional_xmm0_ok": 2, + "pslldq_instruction": 1, + "movpd_instruction": 1, + "movps_instruction": 1, + "sse_mov_instruction": 3, + "movss_instruction": 1, + "sse_movs": 2, + "movsd_instruction": 1, + "A5h": 1, + "sse_mem": 2, + "sse_mem_xmmreg": 2, + "movlpd_instruction": 1, + "movlps_instruction": 1, + "movhlps_instruction": 1, + "maskmovq_instruction": 1, + "maskmov_instruction": 2, + "maskmovdqu_instruction": 1, + "movmskpd_instruction": 1, + "movmskps_instruction": 1, + "movmskps_reg_ok": 2, + "cvtpi2pd_instruction": 1, + "cvtpi2ps_instruction": 1 + }, "ATS": { "//": 211, "#include": 16, @@ -26114,6 +27459,87 @@ "SHEBANG#!ioke": 1, "println": 1 }, + "Isabelle": { + "theory": 1, + "HelloWorld": 3, + "imports": 1, + "Main": 1, + "begin": 1, + "section": 1, + "{": 5, + "*Playing": 1, + "around": 1, + "with": 2, + "Isabelle*": 1, + "}": 5, + "text": 4, + "*": 4, + "creating": 1, + "a": 2, + "lemma": 2, + "the": 2, + "name": 1, + "hello_world*": 1, + "hello_world": 2, + "by": 9, + "simp": 8, + "thm": 1, + "defining": 1, + "string": 1, + "constant": 1, + "definition": 1, + "where": 1, + "theorem": 2, + "(": 5, + "fact": 1, + "List.rev_rev_ident": 4, + ")": 5, + "*now": 1, + "we": 1, + "delete": 1, + "already": 1, + "proven": 1, + "lema": 1, + "and": 1, + "show": 2, + "it": 2, + "hand*": 1, + "declare": 1, + "[": 1, + "del": 1, + "]": 1, + "hide_fact": 1, + "corollary": 2, + "apply": 1, + "add": 1, + "HelloWorld_def": 1, + "done": 1, + "*does": 1, + "hold": 1, + "in": 1, + "general": 1, + "rev_rev_ident": 2, + "proof": 1, + "induction": 1, + "l": 2, + "case": 3, + "Nil": 1, + "thus": 1, + "next": 1, + "Cons": 1, + "ls": 1, + "assume": 1, + "IH": 2, + "have": 2, + "hence": 1, + "also": 1, + "finally": 1, + "using": 1, + "qed": 1, + "fastforce": 1, + "intro": 1, + "end": 1 + }, "Jade": { "p.": 1, "Hello": 1, @@ -51936,27 +53362,330 @@ "TWO_PI": 1 }, "Prolog": { - "-": 52, + "-": 161, + "module": 3, + "(": 327, + "format_spec": 12, + "[": 87, + "format_error/2": 1, + "format_spec/2": 1, + "format_spec//1": 1, + "spec_arity/2": 1, + "spec_types/2": 1, + "]": 87, + ")": 326, + ".": 107, + "use_module": 8, + "library": 8, + "dcg/basics": 1, + "eos//0": 1, + "integer//1": 1, + "string_without//2": 1, + "error": 6, + "when": 3, + "when/2": 1, + "%": 71, + "mavis": 1, + "format_error": 8, + "+": 14, + "Goal": 29, + "Error": 25, + "string": 8, + "is": 12, + "nondet.": 1, + "format": 8, + "Format": 23, + "Args": 19, + "format_error_": 5, + "_": 30, + "debug": 4, + "Spec": 10, + "is_list": 1, + "spec_types": 8, + "Types": 16, + "types_error": 3, + "length": 4, + "TypesLen": 3, + "ArgsLen": 3, + "types_error_": 4, + "Arg": 6, + "|": 25, + "Type": 3, + "ground": 5, + "is_of_type": 2, + "message_to_string": 1, + "type_error": 1, + "_Location": 1, + "multifile": 2, + "check": 3, + "checker/2.": 2, + "dynamic": 2, + "checker": 3, + "format_fail/3.": 1, + "prolog_walk_code": 1, + "module_class": 1, + "user": 5, + "infer_meta_predicates": 1, + "false": 2, + "autoload": 1, + "format/": 1, + "{": 7, + "}": 7, + "are": 3, + "always": 1, + "loaded": 1, + "undefined": 1, + "ignore": 1, + "trace_reference": 1, + "on_trace": 1, + "check_format": 3, + "retract": 1, + "format_fail": 2, + "Location": 6, + "print_message": 1, + "warning": 1, + "fail.": 3, + "iterate": 1, + "all": 1, + "errors": 2, + "checker.": 1, + "succeed": 2, + "even": 1, + "if": 1, + "no": 1, + "found": 1, + "Module": 4, + "_Caller": 1, + "predicate_property": 1, + "imported_from": 1, + "Source": 2, + "memberchk": 2, + "system": 1, + "prolog_debug": 1, + "can_check": 2, + "assert": 2, + "to": 5, + "avoid": 1, + "printing": 1, + "goals": 1, + "once": 3, + "clause": 1, + "prolog": 2, + "message": 1, + "message_location": 1, + "//": 1, + "eos.": 1, + "escape": 2, + "Numeric": 4, + "Modifier": 2, + "Action": 15, + "Rest": 12, + "numeric_argument": 5, + "modifier_argument": 3, + "action": 6, + "text": 4, + "String": 6, + ";": 12, + "Codes": 21, + "string_codes": 4, + "string_without": 1, + "list": 4, + "semidet.": 3, + "text_codes": 6, + "phrase": 3, + "spec_arity": 2, + "FormatSpec": 2, + "Arity": 3, + "positive_integer": 1, + "det.": 4, + "type": 2, + "Item": 2, + "Items": 2, + "item_types": 3, + "numeric_types": 5, + "action_types": 18, + "number": 3, + "character": 2, + "star": 2, + "nothing": 2, + "atom_codes": 4, + "Code": 2, + "Text": 1, + "codes": 5, + "Var": 5, + "var": 4, + "Atom": 3, + "atom": 6, + "N": 5, + "integer": 7, + "C": 5, + "colon": 1, + "no_colon": 1, + "is_action": 4, + "multi.": 1, + "a": 4, + "d": 3, + "e": 1, + "float": 3, + "f": 1, + "G": 2, + "I": 1, + "n": 1, + "p": 1, + "any": 3, + "r": 1, + "s": 2, + "t": 1, + "W": 1, + "func": 13, + "op": 2, + "xfy": 2, + "of": 8, + "/2": 3, + "list_util": 1, + "xfy_list/3": 1, + "function_expansion": 5, + "arithmetic": 2, + "wants_func": 4, + "prolog_load_context": 1, + "we": 1, + "don": 1, + "used": 1, + "at": 3, + "compile": 3, + "time": 3, + "for": 1, + "macro": 1, + "expansion.": 1, + "compile_function/4.": 1, + "compile_function": 8, + "Expr": 5, + "In": 15, + "Out": 16, + "evaluable/1": 1, + "throws": 1, + "exception": 1, + "with": 2, + "strings": 1, + "evaluable": 1, + "term_variables": 1, + "F": 26, + "function_composition_term": 2, + "Functor": 8, + "true": 5, + "..": 6, + "format_template": 7, + "has_type": 2, + "fail": 1, + "be": 4, + "explicit": 1, + "Dict": 3, + "is_dict": 1, + "get_dict": 1, + "Function": 5, + "Argument": 1, + "Apply": 1, + "an": 1, + "Argument.": 1, + "A": 1, + "predicate": 4, + "whose": 2, + "final": 1, + "argument": 2, + "generates": 1, + "output": 1, + "and": 2, + "penultimate": 1, + "accepts": 1, + "input.": 1, + "This": 1, + "realized": 1, + "by": 2, + "expanding": 1, + "function": 2, + "application": 2, + "chained": 1, + "calls": 1, + "time.": 1, + "itself": 1, + "can": 3, + "chained.": 2, + "Reversed": 2, + "reverse": 4, + "sort": 2, + "c": 2, + "b": 4, + "meta_predicate": 2, + "throw": 1, + "permission_error": 1, + "call": 4, + "context": 1, + "X": 10, + "Y": 7, + "defer": 1, + "until": 1, + "run": 1, + "P": 2, + "Creates": 1, + "new": 2, + "composing": 1, + "G.": 1, + "The": 1, + "functions": 2, + "composed": 1, + "create": 1, + "compiled": 1, + "which": 1, + "behaves": 1, + "like": 1, + "function.": 1, + "composition": 1, + "Composed": 1, + "also": 1, + "applied": 1, + "/2.": 1, + "fix": 1, + "syntax": 1, + "highlighting": 1, + "functions_to_compose": 2, + "Term": 10, + "Funcs": 7, + "functor": 1, + "Op": 3, + "xfy_list": 2, + "thread_state": 4, + "Goals": 2, + "Tmp": 3, + "instantiation_error": 1, + "append": 2, + "NewArgs": 2, + "variant_sha1": 1, + "Sha": 2, + "current_predicate": 1, + "Functor/2": 2, + "RevFuncs": 2, + "Threaded": 2, + "Body": 2, + "Head": 2, + "compile_predicates": 1, + "Output": 2, + "compound": 1, + "setof": 1, + "arg": 1, + "Name": 2, + "Args0": 2, + "nth1": 2, "lib": 1, - "(": 49, "ic": 1, - ")": 49, - ".": 25, "vabs": 2, "Val": 8, "AbsVal": 10, "#": 9, - ";": 1, "labeling": 2, - "[": 21, - "]": 21, "vabsIC": 1, "or": 1, "faitListe": 3, - "_": 2, "First": 2, - "|": 12, - "Rest": 6, "Taille": 2, "Min": 2, "Max": 2, @@ -51971,7 +53700,6 @@ "Xi.": 1, "checkPeriode": 3, "ListVar": 2, - "length": 1, "Length": 2, "<": 1, "X1": 2, @@ -51992,9 +53720,6 @@ "christie": 3, "parents": 4, "brother": 1, - "X": 3, - "Y": 2, - "F": 2, "M": 2, "turing": 1, "Tape0": 2, @@ -52003,9 +53728,7 @@ "q0": 1, "Ls": 12, "Rs": 16, - "reverse": 1, "Ls1": 4, - "append": 1, "qf": 1, "Q0": 2, "Ls0": 6, @@ -52013,14 +53736,10 @@ "symbol": 3, "Sym": 6, "RsRest": 2, - "once": 1, "rule": 1, "Q1": 2, "NewSym": 2, - "Action": 2, - "action": 4, "Rs1": 2, - "b": 2, "left": 4, "stay": 1, "right": 1, @@ -54369,7 +56088,7 @@ }, "Python": { "xspacing": 4, - "#": 21, + "#": 28, "How": 2, "far": 1, "apart": 1, @@ -54388,26 +56107,26 @@ "together": 1, "theta": 3, "amplitude": 3, - "[": 161, - "]": 161, + "[": 165, + "]": 165, "Height": 1, "wave": 2, "dx": 8, "yvalues": 7, - "def": 74, + "def": 87, "setup": 2, - "(": 762, - ")": 773, - "size": 2, + "(": 850, + ")": 861, + "size": 5, "frameRate": 1, "colorMode": 1, "RGB": 1, "w": 2, "width": 1, - "+": 44, - "for": 65, + "+": 51, + "for": 69, "i": 13, - "in": 85, + "in": 91, "range": 5, "amplitude.append": 1, "random": 2, @@ -54420,7 +56139,7 @@ "dx.append": 1, "TWO_PI": 1, "/": 26, - "*": 37, + "*": 38, "_": 6, "yvalues.append": 1, "draw": 2, @@ -54429,26 +56148,167 @@ "renderWave": 2, "len": 11, "j": 7, - "x": 28, - "if": 146, + "x": 34, + "if": 160, "%": 33, "sin": 1, - "else": 31, + "else": 33, "cos": 1, "noStroke": 2, "fill": 2, "ellipseMode": 1, "CENTER": 1, - "v": 13, + "v": 19, "enumerate": 2, "ellipse": 1, "height": 1, - "from": 34, + "import": 55, + "os": 2, + "sys": 3, + "json": 1, + "c4d": 1, + "c4dtools": 1, + "itertools": 1, + "from": 36, + "c4d.modules": 1, + "graphview": 1, + "as": 14, + "gv": 1, + "c4dtools.misc": 1, + "graphnode": 1, + "res": 3, + "importer": 1, + "c4dtools.prepare": 1, + "__file__": 1, + "__res__": 1, + "settings": 2, + "c4dtools.helpers.Attributor": 2, + "{": 27, + "res.file": 3, + "}": 27, + "align_nodes": 2, + "nodes": 11, + "mode": 5, + "spacing": 7, + "r": 9, + "modes": 3, + "not": 69, + "return": 68, + "raise": 23, + "ValueError": 6, + ".join": 4, + "get_0": 12, + "lambda": 6, + "x.x": 1, + "get_1": 4, + "x.y": 1, + "set_0": 6, + "setattr": 16, + "set_1": 4, + "graphnode.GraphNode": 1, + "n": 6, + "nodes.sort": 1, + "key": 6, + "n.position": 1, + "midpoint": 3, + "graphnode.find_nodes_mid": 1, + "first_position": 2, + ".position": 1, + "new_positions": 2, + "prev_offset": 6, + "node": 2, + "position": 12, + "node.position": 2, + "-": 36, + "node.size": 1, + "<": 2, + "new_positions.append": 1, + "bbox_size": 2, + "bbox_size_2": 2, + "itertools.izip": 1, + "align_nodes_shortcut": 3, + "master": 2, + "gv.GetMaster": 1, + "root": 3, + "master.GetRoot": 1, + "graphnode.find_selected_nodes": 1, + "master.AddUndo": 1, + "c4d.EventAdd": 1, + "True": 25, + "class": 19, + "XPAT_Options": 3, + "defaults": 1, + "__init__": 7, + "self": 113, + "filename": 12, + "None": 92, + "super": 4, + ".__init__": 3, + "self.load": 1, + "load": 1, + "is": 31, + "settings.options_filename": 2, + "os.path.isfile": 1, + "self.dict_": 2, + "self.defaults.copy": 2, + "with": 2, + "open": 2, + "fp": 4, + "self.dict_.update": 1, + "json.load": 1, + "self.save": 1, + "save": 2, + "values": 15, + "dict": 4, + "k": 7, + "self.dict_.iteritems": 1, + "self.defaults": 1, + "json.dump": 1, + "XPAT_OptionsDialog": 2, + "c4d.gui.GeDialog": 1, + "CreateLayout": 1, + "self.LoadDialogResource": 1, + "res.DLG_OPTIONS": 1, + "InitValues": 1, + "self.SetLong": 2, + "res.EDT_HSPACE": 2, + "options.hspace": 3, + "res.EDT_VSPACE": 2, + "options.vspace": 3, + "Command": 1, + "id": 2, + "msg": 1, + "res.BTN_SAVE": 1, + "self.GetLong": 2, + "options.save": 1, + "self.Close": 1, + "XPAT_Command_OpenOptionsDialog": 2, + "c4dtools.plugins.Command": 3, + "self._dialog": 4, + "@property": 2, + "dialog": 1, + "PLUGIN_ID": 3, + "PLUGIN_NAME": 3, + "res.string.XPAT_COMMAND_OPENOPTIONSDIALOG": 1, + "PLUGIN_HELP": 3, + "res.string.XPAT_COMMAND_OPENOPTIONSDIALOG_HELP": 1, + "Execute": 3, + "doc": 3, + "self.dialog.Open": 1, + "c4d.DLG_TYPE_MODAL": 1, + "XPAT_Command_AlignHorizontal": 1, + "res.string.XPAT_COMMAND_ALIGNHORIZONTAL": 1, + "PLUGIN_ICON": 2, + "res.string.XPAT_COMMAND_ALIGNHORIZONTAL_HELP": 1, + "XPAT_Command_AlignVertical": 1, + "res.string.XPAT_COMMAND_ALIGNVERTICAL": 1, + "res.string.XPAT_COMMAND_ALIGNVERTICAL_HELP": 1, + "options": 4, + "__name__": 3, + "c4dtools.plugins.main": 1, "__future__": 2, - "import": 47, "unicode_literals": 1, "copy": 1, - "sys": 2, "functools": 1, "update_wrapper": 2, "future_builtins": 1, @@ -54459,7 +56319,6 @@ "signal": 1, "handler.": 1, "django.conf": 1, - "settings": 1, "django.core.exceptions": 1, "ObjectDoesNotExist": 2, "MultipleObjectsReturned": 2, @@ -54495,7 +56354,6 @@ "get_model": 3, "django.utils.translation": 1, "ugettext_lazy": 1, - "as": 11, "django.utils.functional": 1, "curry": 6, "django.utils.encoding": 1, @@ -54504,7 +56362,6 @@ "django.utils.text": 1, "get_text_list": 2, "capfirst": 6, - "class": 14, "ModelBase": 4, "type": 6, "__new__": 2, @@ -54513,32 +56370,24 @@ "bases": 6, "attrs": 7, "super_new": 3, - "super": 2, ".__new__": 1, "parents": 8, "b": 11, "isinstance": 11, - "not": 64, - "return": 57, "module": 6, "attrs.pop": 2, "new_class": 9, - "{": 25, - "}": 25, "attr_meta": 5, - "None": 86, "abstract": 3, "getattr": 30, "False": 28, "meta": 12, "base_meta": 2, - "is": 29, "model_module": 1, "sys.modules": 1, "new_class.__module__": 1, "kwargs": 9, "model_module.__name__.split": 1, - "-": 33, "new_class.add_to_class": 7, "**kwargs": 9, "subclass_exception": 3, @@ -54579,14 +56428,12 @@ "parent": 5, "parent._meta.abstract": 1, "parent._meta.fields": 1, - "raise": 22, "TypeError": 4, "continue": 10, "new_class._meta.setup_proxy": 1, "new_class._meta.concrete_model": 2, "base._meta.concrete_model": 2, "o2o_map": 3, - "dict": 3, "f.rel.to": 1, "original_base": 1, "parent_fields": 3, @@ -54600,7 +56447,6 @@ "attr_name": 3, "base._meta.module_name": 1, "auto_created": 1, - "True": 20, "parent_link": 1, "new_class._meta.parents": 1, "copy.deepcopy": 2, @@ -54625,7 +56471,6 @@ "add_to_class": 1, "value": 9, "value.contribute_to_class": 1, - "setattr": 14, "_prepare": 1, "opts": 5, "cls._meta": 3, @@ -54644,7 +56489,6 @@ "opts.order_with_respect_to.rel.to": 1, "cls.__doc__": 3, "cls.__name__": 1, - ".join": 3, "f.attname": 5, "opts.fields": 1, "cls.get_absolute_url": 3, @@ -54653,8 +56497,6 @@ "sender": 5, "ModelState": 2, "object": 6, - "__init__": 5, - "self": 100, "db": 2, "self.db": 1, "self.adding": 1, @@ -54687,7 +56529,6 @@ "property": 2, "AttributeError": 1, "pass": 4, - ".__init__": 1, "signals.post_init.send": 1, "instance": 5, "__repr__": 2, @@ -54726,12 +56567,10 @@ "serializable_value": 1, "field_name": 8, "self._meta.get_field_by_name": 1, - "save": 1, "force_insert": 7, "force_update": 10, "using": 30, "update_fields": 23, - "ValueError": 5, "frozenset": 2, "field.primary_key": 1, "non_model_fields": 2, @@ -54760,7 +56599,6 @@ "manager.using": 3, ".filter": 7, ".exists": 1, - "values": 13, "f.pre_save": 1, "rows": 3, "._update": 1, @@ -54825,7 +56663,6 @@ "self._perform_unique_checks": 1, "date_errors": 1, "self._perform_date_checks": 1, - "k": 4, "date_errors.items": 1, "errors.setdefault": 3, ".extend": 2, @@ -54863,7 +56700,6 @@ "model_class._meta": 2, "qs.exclude": 2, "qs.exists": 2, - "key": 5, ".append": 2, "self.unique_error_message": 1, "_perform_date_checks": 1, @@ -54885,7 +56721,6 @@ "field.error_messages": 1, "field_labels": 4, "map": 1, - "lambda": 1, "full_clean": 1, "self.clean_fields": 1, "e": 13, @@ -54912,7 +56747,6 @@ "_order": 1, "pk_name": 3, "ordered_obj._meta.pk.name": 1, - "r": 3, ".values": 1, "##############################################": 2, "func": 2, @@ -55007,7 +56841,6 @@ "_PERSON": 3, "_descriptor.Descriptor": 1, "full_name": 2, - "filename": 1, "file": 1, "containing_type": 2, "_descriptor.FieldDescriptor": 1, @@ -55021,7 +56854,6 @@ "enum_type": 1, "is_extension": 1, "extension_scope": 1, - "options": 3, "extensions": 1, "nested_types": 1, "enum_types": 1, @@ -55035,13 +56867,11 @@ "_reflection.GeneratedProtocolMessageType": 1, "SHEBANG#!python": 4, "print": 39, - "os": 1, "main": 4, "usage": 3, "string": 1, "command": 4, "sys.argv": 2, - "<": 1, "sys.exit": 1, "printDelimiter": 4, "get": 1, @@ -55064,7 +56894,6 @@ "os.walk": 1, ".next": 1, "os.path.isdir": 1, - "__name__": 2, "argparse": 1, "matplotlib.pyplot": 1, "pl": 1, @@ -55364,7 +57193,6 @@ "uri.partition": 1, "self.arguments": 2, "supports_http_1_1": 1, - "@property": 1, "cookies": 1, "self._cookies": 3, "Cookie.SimpleCookie": 1, @@ -55376,10 +57204,8 @@ "get_ssl_certificate": 1, "self.connection.stream.socket.getpeercert": 1, "ssl.SSLError": 1, - "n": 3, "_valid_ip": 1, "ip": 2, - "res": 2, "socket.getaddrinfo": 1, "socket.AF_UNSPEC": 1, "socket.SOCK_STREAM": 1, @@ -60167,6 +61993,70 @@ "ast.eval": 1, "Env.new": 1 }, + "Slim": { + "doctype": 1, + "html": 2, + "head": 1, + "title": 1, + "Slim": 2, + "Examples": 1, + "meta": 2, + "name": 2, + "content": 2, + "author": 2, + "javascript": 1, + "alert": 1, + "(": 1, + ")": 1, + "body": 1, + "h1": 1, + "Markup": 1, + "examples": 1, + "#content": 1, + "p": 2, + "This": 1, + "example": 1, + "shows": 1, + "you": 2, + "how": 1, + "a": 1, + "basic": 1, + "file": 1, + "looks": 1, + "like.": 1, + "yield": 1, + "-": 3, + "unless": 1, + "items.empty": 1, + "table": 1, + "for": 1, + "item": 1, + "in": 1, + "items": 2, + "do": 1, + "tr": 1, + "td.name": 1, + "item.name": 1, + "td.price": 1, + "item.price": 1, + "else": 1, + "|": 2, + "No": 1, + "found.": 1, + "Please": 1, + "add": 1, + "some": 1, + "inventory.": 1, + "Thank": 1, + "div": 1, + "id": 1, + "render": 1, + "Copyright": 1, + "#": 2, + "{": 2, + "year": 1, + "}": 2 + }, "Smalltalk": { "Object": 1, "subclass": 2, @@ -61981,6 +63871,56 @@ "return": 1, "/": 1 }, + "STON": { + "[": 11, + "]": 11, + "{": 15, + "#a": 1, + "#b": 1, + "}": 15, + "Rectangle": 1, + "#origin": 1, + "Point": 2, + "-": 2, + "#corner": 1, + "TestDomainObject": 1, + "#created": 1, + "DateAndTime": 2, + "#modified": 1, + "#integer": 1, + "#float": 1, + "#description": 1, + "#color": 1, + "#green": 1, + "#tags": 1, + "#two": 1, + "#beta": 1, + "#medium": 1, + "#bytes": 1, + "ByteArray": 1, + "#boolean": 1, + "false": 1, + "ZnResponse": 1, + "#headers": 2, + "ZnHeaders": 1, + "ZnMultiValueDictionary": 1, + "#entity": 1, + "ZnStringEntity": 1, + "#contentType": 1, + "ZnMimeType": 1, + "#main": 1, + "#sub": 1, + "#parameters": 1, + "#contentLength": 1, + "#string": 1, + "#encoder": 1, + "ZnUTF8Encoder": 1, + "#statusLine": 1, + "ZnStatusLine": 1, + "#version": 1, + "#code": 1, + "#reason": 1 + }, "Stylus": { "border": 6, "-": 10, @@ -65140,13 +67080,13 @@ "return": 1 }, "XML": { - "": 10, - "version=": 16, + "": 11, + "version=": 17, "encoding=": 7, "": 7, "ToolsVersion=": 6, "DefaultTargets=": 5, - "xmlns=": 7, + "xmlns=": 8, "": 21, "Project=": 12, "Condition=": 37, @@ -65195,7 +67135,7 @@ "full": 4, "": 6, "": 7, - "false": 10, + "false": 11, "": 7, "": 8, "bin": 11, @@ -65270,7 +67210,7 @@ "name=": 227, "xmlns": 2, "ea=": 2, - "": 3, + "": 4, "This": 21, "easyant": 3, "module.ant": 1, @@ -65287,7 +67227,7 @@ "own": 2, "specific": 8, "target.": 1, - "": 3, + "": 4, "": 2, "": 2, "my": 2, @@ -65350,7 +67290,7 @@ "": 1, "": 1, "": 120, - "": 120, + "": 121, "IObservedChange": 5, "generic": 3, "interface": 4, @@ -65378,7 +67318,7 @@ "casting": 1, "between": 15, "changes.": 2, - "": 121, + "": 122, "": 120, "The": 75, "object": 42, @@ -65386,7 +67326,7 @@ "raised": 1, "change.": 12, "name": 7, - "of": 75, + "of": 76, "property": 74, "changed": 18, "on": 35, @@ -65482,7 +67422,7 @@ "itself": 2, "changes": 13, ".": 20, - "It": 1, + "It": 2, "important": 6, "implement": 5, "Changing/Changed": 1, @@ -65571,7 +67511,7 @@ "to.": 7, "": 12, "": 84, - "A": 20, + "A": 21, "identical": 11, "types": 10, "one": 27, @@ -66115,6 +68055,43 @@ "Ingl": 1, "": 1, "": 1, + "": 1, + "": 1, + "": 1, + "Sample": 2, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "Hugh": 2, + "Bot": 2, + "": 1, + "": 1, + "": 1, + "package": 1, + "nuget": 1, + "just": 1, + "works": 1, + "": 1, + "http": 2, + "//hubot.github.com": 1, + "": 1, + "": 1, + "": 1, + "https": 1, + "//github.com/github/hubot/LICENSEmd": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "src=": 1, + "target=": 1, + "": 1, + "": 1, "MyCommon": 1, "": 1, "Name=": 1, @@ -66327,13 +68304,194 @@ "loader/saver": 1, "FreeMedForms.": 1, "": 1, - "http": 1, "//www.freemedforms.com/": 1, "": 1, "": 1, "": 1, "": 1 }, + "Xojo": { + "#tag": 88, + "Class": 3, + "Protected": 1, + "App": 1, + "Inherits": 1, + "Application": 1, + "Constant": 3, + "Name": 31, + "kEditClear": 1, + "Type": 34, + "String": 3, + "Dynamic": 3, + "False": 14, + "Default": 9, + "Scope": 4, + "Public": 3, + "#Tag": 5, + "Instance": 5, + "Platform": 5, + "Windows": 2, + "Language": 5, + "Definition": 5, + "Linux": 2, + "EndConstant": 3, + "kFileQuit": 1, + "kFileQuitShortcut": 1, + "Mac": 1, + "OS": 1, + "ViewBehavior": 2, + "EndViewBehavior": 2, + "End": 27, + "EndClass": 1, + "Report": 2, + "Begin": 23, + "BillingReport": 1, + "Compatibility": 2, + "Units": 1, + "Width": 3, + "PageHeader": 1, + "Height": 5, + "Body": 1, + "PageFooter": 1, + "EndReport": 1, + "ReportCode": 1, + "EndReportCode": 1, + "Dim": 3, + "dbFile": 3, + "As": 4, + "FolderItem": 1, + "db": 1, + "New": 1, + "SQLiteDatabase": 1, + "GetFolderItem": 1, + "(": 7, + ")": 7, + "db.DatabaseFile": 1, + "If": 4, + "db.Connect": 1, + "Then": 1, + "db.SQLExecute": 2, + "_": 1, + "+": 5, + "db.Error": 1, + "then": 1, + "MsgBox": 3, + "db.ErrorMessage": 2, + "db.Rollback": 1, + "Else": 2, + "db.Commit": 1, + "Menu": 2, + "MainMenuBar": 1, + "MenuItem": 11, + "FileMenu": 1, + "SpecialMenu": 13, + "Text": 13, + "Index": 14, + "-": 14, + "AutoEnable": 13, + "True": 46, + "Visible": 41, + "QuitMenuItem": 1, + "FileQuit": 1, + "ShortcutKey": 6, + "Shortcut": 6, + "EditMenu": 1, + "EditUndo": 1, + "MenuModifier": 5, + "EditSeparator1": 1, + "EditCut": 1, + "EditCopy": 1, + "EditPaste": 1, + "EditClear": 1, + "EditSeparator2": 1, + "EditSelectAll": 1, + "UntitledSeparator": 1, + "AppleMenuItem": 1, + "AboutItem": 1, + "EndMenu": 1, + "Toolbar": 2, + "MyToolbar": 1, + "ToolButton": 2, + "FirstItem": 1, + "Caption": 3, + "HelpTag": 3, + "Style": 2, + "SecondItem": 1, + "EndToolbar": 1, + "Window": 2, + "Window1": 1, + "BackColor": 1, + "&": 1, + "cFFFFFF00": 1, + "Backdrop": 1, + "CloseButton": 1, + "Composite": 1, + "Frame": 1, + "FullScreen": 1, + "FullScreenButton": 1, + "HasBackColor": 1, + "ImplicitInstance": 1, + "LiveResize": 1, + "MacProcID": 1, + "MaxHeight": 1, + "MaximizeButton": 1, + "MaxWidth": 1, + "MenuBar": 1, + "MenuBarVisible": 1, + "MinHeight": 1, + "MinimizeButton": 1, + "MinWidth": 1, + "Placement": 1, + "Resizeable": 1, + "Title": 1, + "PushButton": 1, + "HelloWorldButton": 2, + "AutoDeactivate": 1, + "Bold": 1, + "ButtonStyle": 1, + "Cancel": 1, + "Enabled": 1, + "InitialParent": 1, + "Italic": 1, + "Left": 1, + "LockBottom": 1, + "LockedInPosition": 1, + "LockLeft": 1, + "LockRight": 1, + "LockTop": 1, + "TabIndex": 1, + "TabPanelIndex": 1, + "TabStop": 1, + "TextFont": 1, + "TextSize": 1, + "TextUnit": 1, + "Top": 1, + "Underline": 1, + "EndWindow": 1, + "WindowCode": 1, + "EndWindowCode": 1, + "Events": 1, + "Event": 1, + "Sub": 2, + "Action": 1, + "total": 4, + "Integer": 2, + "For": 1, + "i": 2, + "To": 1, + "Next": 1, + "Str": 1, + "EndEvent": 1, + "EndEvents": 1, + "ViewProperty": 28, + "true": 26, + "Group": 28, + "InitialValue": 23, + "EndViewProperty": 28, + "EditorType": 14, + "EnumValues": 2, + "EndEnumValues": 2 + }, "XProc": { "": 1, "version=": 2, @@ -66690,27 +68848,27 @@ }, "Zephir": { "%": 10, - "{": 56, + "{": 58, "#define": 1, "MAX_FACTOR": 3, - "}": 50, - "namespace": 3, - "Test": 2, - ";": 86, - "#include": 1, + "}": 52, + "namespace": 4, + "Test": 4, + ";": 91, + "#include": 9, "static": 1, "long": 3, "fibonacci": 4, - "(": 55, + "(": 59, "n": 5, - ")": 53, + ")": 57, "if": 39, - "<": 1, - "return": 25, + "<": 2, + "return": 26, "else": 11, "-": 25, "+": 5, - "class": 2, + "class": 3, "Cblock": 1, "public": 22, "function": 22, @@ -66718,7 +68876,29 @@ "int": 3, "a": 6, "testCblock2": 1, - "Router": 1, + "#ifdef": 1, + "HAVE_CONFIG_H": 1, + "#endif": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "ZEPHIR_INIT_CLASS": 2, + "Test_Router_Exception": 2, + "ZEPHIR_REGISTER_CLASS_EX": 1, + "Router": 3, + "Exception": 4, + "test": 1, + "router_exception": 1, + "zend_exception_get_default": 1, + "TSRMLS_C": 1, + "NULL": 1, + "SUCCESS": 1, + "extern": 1, + "zend_class_entry": 1, + "*test_router_exception_ce": 1, + "php": 1, + "extends": 1, "Route": 1, "protected": 9, "_pattern": 3, @@ -66797,7 +68977,6 @@ "typeof": 2, "throw": 1, "new": 1, - "Exception": 1, "explode": 1, "switch": 1, "count": 1, @@ -66891,6 +69070,7 @@ "Arduino": 20, "AsciiDoc": 103, "AspectJ": 324, + "Assembly": 21750, "ATS": 4558, "AutoHotkey": 3, "Awk": 544, @@ -66946,6 +69126,7 @@ "Inform 7": 75, "INI": 27, "Ioke": 2, + "Isabelle": 136, "Jade": 3, "Java": 8987, "JavaScript": 76970, @@ -67010,11 +69191,11 @@ "PostScript": 107, "PowerShell": 12, "Processing": 74, - "Prolog": 468, + "Prolog": 2420, "Propeller Spin": 13519, "Protocol Buffer": 63, "PureScript": 1652, - "Python": 5994, + "Python": 6587, "R": 1790, "Racket": 331, "Ragel in Ruby Host": 593, @@ -67036,12 +69217,14 @@ "ShellSession": 233, "Shen": 3472, "Slash": 187, + "Slim": 77, "Smalltalk": 423, "SourcePawn": 2080, "SQL": 1485, "Squirrel": 130, "Standard ML": 6567, "Stata": 3133, + "STON": 100, "Stylus": 76, "SuperCollider": 133, "Swift": 1128, @@ -67061,13 +69244,14 @@ "Volt": 388, "wisp": 1363, "XC": 24, - "XML": 7006, + "XML": 7057, + "Xojo": 807, "XProc": 22, "XQuery": 801, "XSLT": 44, "Xtend": 399, "YAML": 77, - "Zephir": 1026, + "Zephir": 1085, "Zimpl": 123 }, "languages": { @@ -67080,6 +69264,7 @@ "Arduino": 1, "AsciiDoc": 3, "AspectJ": 2, + "Assembly": 4, "ATS": 10, "AutoHotkey": 1, "Awk": 1, @@ -67135,6 +69320,7 @@ "Inform 7": 2, "INI": 2, "Ioke": 1, + "Isabelle": 1, "Jade": 1, "Java": 6, "JavaScript": 22, @@ -67199,11 +69385,11 @@ "PostScript": 1, "PowerShell": 2, "Processing": 1, - "Prolog": 3, + "Prolog": 5, "Propeller Spin": 10, "Protocol Buffer": 1, "PureScript": 4, - "Python": 9, + "Python": 10, "R": 7, "Racket": 2, "Ragel in Ruby Host": 3, @@ -67225,12 +69411,14 @@ "ShellSession": 3, "Shen": 3, "Slash": 1, + "Slim": 1, "Smalltalk": 3, "SourcePawn": 1, "SQL": 5, "Squirrel": 1, "Standard ML": 5, "Stata": 7, + "STON": 7, "Stylus": 1, "SuperCollider": 1, "Swift": 43, @@ -67250,14 +69438,15 @@ "Volt": 1, "wisp": 1, "XC": 1, - "XML": 12, + "XML": 13, + "Xojo": 6, "XProc": 1, "XQuery": 1, "XSLT": 1, "Xtend": 2, "YAML": 2, - "Zephir": 2, + "Zephir": 5, "Zimpl": 1 }, - "md5": "e69777074750ed98faadf08497ba6339" + "md5": "95cec2f85e2b8d7b956746aab7aa16aa" } \ No newline at end of file diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index a77fa417..4d8481e5 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -204,3 +204,7 @@ - ^vignettes/ - ^inst/extdata/ +# Octicons +- octicons.css +- octicons.min.css +- sprockets-octicons.scss diff --git a/lib/linguist/version.rb b/lib/linguist/version.rb index b681d0e0..6704b3fb 100644 --- a/lib/linguist/version.rb +++ b/lib/linguist/version.rb @@ -1,3 +1,3 @@ module Linguist - VERSION = "2.11.4" + VERSION = "2.12.0" end diff --git a/samples/Assembly/ASSEMBLE.inc b/samples/Assembly/ASSEMBLE.inc new file mode 100644 index 00000000..c4ffdae3 --- /dev/null +++ b/samples/Assembly/ASSEMBLE.inc @@ -0,0 +1,2048 @@ + +; flat assembler core +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + +assembler: + xor eax,eax + mov [stub_size],eax + mov [current_pass],ax + mov [resolver_flags],eax + mov [number_of_sections],eax + mov [actual_fixups_size],eax + assembler_loop: + mov eax,[labels_list] + mov [tagged_blocks],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [structures_buffer],eax + mov esi,[source_start] + mov edi,[code_start] + xor eax,eax + mov dword [adjustment],eax + mov dword [adjustment+4],eax + mov [addressing_space],eax + mov [error_line],eax + mov [counter],eax + mov [format_flags],eax + mov [number_of_relocations],eax + mov [undefined_data_end],eax + mov [file_extension],eax + mov [next_pass_needed],al + mov [output_format],al + mov [adjustment_sign],al + mov [code_type],16 + call init_addressing_space + pass_loop: + call assemble_line + jnc pass_loop + mov eax,[additional_memory_end] + cmp eax,[structures_buffer] + je pass_done + sub eax,18h + mov eax,[eax+4] + mov [current_line],eax + jmp missing_end_directive + pass_done: + call close_pass + mov eax,[labels_list] + check_symbols: + cmp eax,[memory_end] + jae symbols_checked + test byte [eax+8],8 + jz symbol_defined_ok + mov cx,[current_pass] + cmp cx,[eax+18] + jne symbol_defined_ok + test byte [eax+8],1 + jz symbol_defined_ok + sub cx,[eax+16] + cmp cx,1 + jne symbol_defined_ok + and byte [eax+8],not 1 + or [next_pass_needed],-1 + symbol_defined_ok: + test byte [eax+8],10h + jz use_prediction_ok + mov cx,[current_pass] + and byte [eax+8],not 10h + test byte [eax+8],20h + jnz check_use_prediction + cmp cx,[eax+18] + jne use_prediction_ok + test byte [eax+8],8 + jz use_prediction_ok + jmp use_misprediction + check_use_prediction: + test byte [eax+8],8 + jz use_misprediction + cmp cx,[eax+18] + je use_prediction_ok + use_misprediction: + or [next_pass_needed],-1 + use_prediction_ok: + test byte [eax+8],40h + jz check_next_symbol + and byte [eax+8],not 40h + test byte [eax+8],4 + jnz define_misprediction + mov cx,[current_pass] + test byte [eax+8],80h + jnz check_define_prediction + cmp cx,[eax+16] + jne check_next_symbol + test byte [eax+8],1 + jz check_next_symbol + jmp define_misprediction + check_define_prediction: + test byte [eax+8],1 + jz define_misprediction + cmp cx,[eax+16] + je check_next_symbol + define_misprediction: + or [next_pass_needed],-1 + check_next_symbol: + add eax,LABEL_STRUCTURE_SIZE + jmp check_symbols + symbols_checked: + cmp [next_pass_needed],0 + jne next_pass + mov eax,[error_line] + or eax,eax + jz assemble_ok + mov [current_line],eax + cmp [error],undefined_symbol + jne error_confirmed + mov eax,[error_info] + or eax,eax + jz error_confirmed + test byte [eax+8],1 + jnz next_pass + error_confirmed: + call error_handler + error_handler: + mov eax,[error] + sub eax,error_handler + add [esp],eax + ret + next_pass: + inc [current_pass] + mov ax,[current_pass] + cmp ax,[passes_limit] + je code_cannot_be_generated + jmp assembler_loop + assemble_ok: + ret + +create_addressing_space: + mov ebx,[addressing_space] + test ebx,ebx + jz init_addressing_space + test byte [ebx+0Ah],1 + jnz illegal_instruction + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + init_addressing_space: + mov ebx,[tagged_blocks] + mov dword [ebx-4],10h + mov dword [ebx-8],20h + sub ebx,8+20h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [addressing_space],ebx + xor eax,eax + mov [ebx],edi + mov [ebx+4],eax + mov [ebx+8],eax + mov [ebx+10h],eax + mov [ebx+14h],eax + mov [ebx+18h],edi + mov [ebx+1Ch],eax + ret + +assemble_line: + mov eax,[tagged_blocks] + sub eax,100h + cmp edi,eax + ja out_of_memory + lods byte [esi] + cmp al,1 + je assemble_instruction + jb source_end + cmp al,3 + jb define_label + je define_constant + cmp al,4 + je label_addressing_space + cmp al,0Fh + je new_line + cmp al,13h + je code_type_setting + cmp al,10h + jne illegal_instruction + lods byte [esi] + jmp segment_prefix + code_type_setting: + lods byte [esi] + mov [code_type],al + jmp instruction_assembled + new_line: + lods dword [esi] + mov [current_line],eax + mov [prefixed_instruction],0 + cmp [symbols_file],0 + je continue_line + cmp [next_pass_needed],0 + jne continue_line + mov ebx,[tagged_blocks] + mov dword [ebx-4],1 + mov dword [ebx-8],14h + sub ebx,8+14h + cmp ebx,edi + jbe out_of_memory + mov [tagged_blocks],ebx + mov [ebx],eax + mov [ebx+4],edi + mov eax,[addressing_space] + mov [ebx+8],eax + mov al,[code_type] + mov [ebx+10h],al + continue_line: + cmp byte [esi],0Fh + je line_assembled + jmp assemble_line + define_label: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov ebx,eax + lods byte [esi] + mov [label_size],al + call make_label + jmp continue_line + make_label: + mov eax,edi + xor edx,edx + xor cl,cl + mov ebp,[addressing_space] + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + jp label_value_ok + call recoverable_overflow + label_value_ok: + mov [address_sign],cl + test byte [ds:ebp+0Ah],1 + jnz make_virtual_label + or byte [ebx+9],1 + xchg eax,[ebx] + xchg edx,[ebx+4] + mov ch,[ebx+9] + shr ch,1 + and ch,1 + neg ch + sub eax,[ebx] + sbb edx,[ebx+4] + sbb ch,cl + mov dword [adjustment],eax + mov dword [adjustment+4],edx + mov [adjustment_sign],ch + or al,ch + or eax,edx + setnz ah + jmp finish_label + make_virtual_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + finish_label: + mov ebp,[addressing_space] + mov ch,[ds:ebp+9] + mov cl,[label_size] + mov edx,[ds:ebp+14h] + mov ebp,[ds:ebp+10h] + finish_label_symbol: + mov al,[address_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + cmp ebp,[ebx+12] + mov [ebx+12],ebp + setne al + or ah,al + or ch,ch + jz label_symbol_ok + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + label_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + and byte [ebx+8],not 2 + test byte [ebx+8],1 + jz new_label + cmp cx,[ebx+16] + je symbol_already_defined + btr dword [ebx+8],10 + jc requalified_label + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz label_made + test byte [ebx+8],8 + jz label_made + mov cx,[current_pass] + cmp cx,[ebx+18] + jne label_made + requalified_label: + or [next_pass_needed],-1 + label_made: + ret + new_label: + or byte [ebx+8],1 + ret + define_constant: + lods dword [esi] + inc esi + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov edx,[eax+8] + push edx + cmp [current_pass],0 + je get_constant_value + test dl,4 + jnz get_constant_value + mov cx,[current_pass] + cmp cx,[eax+16] + je get_constant_value + or dl,4 + mov [eax+8],dl + get_constant_value: + push eax + mov al,byte [esi-1] + push eax + or [size_override],-1 + call get_value + pop ebx + mov ch,bl + pop ebx + pop ecx + test cl,4 + jnz constant_referencing_mode_ok + and byte [ebx+8],not 4 + constant_referencing_mode_ok: + xor cl,cl + mov ch,[value_type] + cmp ch,3 + je invalid_use_of_symbol + make_constant: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov al,[value_sign] + xor al,[ebx+9] + and al,10b + or ah,al + xor [ebx+9],al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + xor edx,edx + cmp edx,[ebx+12] + mov [ebx+12],edx + setne al + or ah,al + or ch,ch + jz constant_symbol_ok + mov edx,[symbol_identifier] + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + constant_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + mov edx,[current_line] + mov [ebx+28],edx + test byte [ebx+8],1 + jz new_constant + cmp cx,[ebx+16] + jne redeclare_constant + test byte [ebx+8],2 + jz symbol_already_defined + or byte [ebx+8],4 + and byte [ebx+9],not 4 + jmp instruction_assembled + redeclare_constant: + btr dword [ebx+8],10 + jc requalified_constant + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz instruction_assembled + test byte [ebx+8],4 + jnz instruction_assembled + test byte [ebx+8],8 + jz instruction_assembled + mov cx,[current_pass] + cmp cx,[ebx+18] + jne instruction_assembled + requalified_constant: + or [next_pass_needed],-1 + jmp instruction_assembled + new_constant: + or byte [ebx+8],1+2 + jmp instruction_assembled + label_addressing_space: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov cx,[current_pass] + test byte [eax+8],1 + jz make_addressing_space_label + cmp cx,[eax+16] + je symbol_already_defined + test byte [eax+9],4 + jnz make_addressing_space_label + or [next_pass_needed],-1 + make_addressing_space_label: + mov dx,[eax+8] + and dx,not (2 or 100h) + or dx,1 or 4 or 400h + mov [eax+8],dx + mov [eax+16],cx + mov edx,[current_line] + mov [eax+28],edx + mov ebx,[addressing_space] + mov [eax],ebx + or byte [ebx+0Ah],2 + jmp continue_line + assemble_instruction: +; mov [operand_size],0 +; mov [size_override],0 +; mov [operand_prefix],0 +; mov [opcode_prefix],0 + and dword [operand_size],0 +; mov [rex_prefix],0 +; mov [vex_required],0 +; mov [vex_register],0 +; mov [immediate_size],0 + and dword [rex_prefix],0 + call instruction_handler + instruction_handler: + movzx ebx,word [esi] + mov al,[esi+2] + add esi,3 + add [esp],ebx + ret + instruction_assembled: + mov al,[esi] + cmp al,0Fh + je line_assembled + or al,al + jnz extra_characters_on_line + line_assembled: + clc + ret + source_end: + dec esi + stc + ret + +org_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + mov cl,[value_type] + test cl,1 + jnz invalid_use_of_symbol + push eax + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + test byte [ebx+0Ah],1 + jnz in_virtual + call init_addressing_space + jmp org_space_ok + in_virtual: + call close_virtual_addressing_space + call init_addressing_space + or byte [ebx+0Ah],1 + org_space_ok: + pop eax + mov [ebx+9],cl + mov cl,[value_sign] + sub [ebx],eax + sbb [ebx+4],edx + sbb byte [ebx+8],cl + jp org_value_ok + call recoverable_overflow + org_value_ok: + mov edx,[symbol_identifier] + mov [ebx+14h],edx + cmp [output_format],1 + ja instruction_assembled + cmp edi,[code_start] + jne instruction_assembled + cmp eax,100h + jne instruction_assembled + bts [format_flags],0 + jmp instruction_assembled +label_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + mov [label_size],0 + lods byte [esi] + cmp al,':' + je get_label_size + dec esi + cmp al,11h + jne label_size_ok + get_label_size: + lods word [esi] + cmp al,11h + jne invalid_argument + mov [label_size],ah + label_size_ok: + cmp byte [esi],80h + je get_free_label_value + call make_label + jmp instruction_assembled + get_free_label_value: + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + push ebx ecx + or byte [ebx+8],4 + cmp byte [esi],'.' + je invalid_value + call get_address_value + or bh,bh + setnz ch + xchg ch,cl + mov bp,cx + shl ebp,16 + xchg bl,bh + mov bp,bx + pop ecx ebx + and byte [ebx+8],not 4 + mov ch,[value_type] + test ch,1 + jnz invalid_use_of_symbol + make_free_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + mov edx,[address_symbol] + mov cl,[label_size] + call finish_label_symbol + jmp instruction_assembled +load_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + push eax + mov al,1 + cmp byte [esi],11h + jne load_size_ok + lods byte [esi] + lods byte [esi] + load_size_ok: + cmp al,8 + ja invalid_value + mov [operand_size],al + and dword [value],0 + and dword [value+4],0 + lods byte [esi] + cmp al,82h + jne invalid_argument + call get_data_point + jc value_loaded + push esi edi + mov esi,ebx + mov edi,value + rep movs byte [edi],[esi] + pop edi esi + value_loaded: + mov [value_sign],0 + mov eax,dword [value] + mov edx,dword [value+4] + pop ebx + xor cx,cx + jmp make_constant + get_data_point: + mov ebx,[addressing_space] + mov ecx,edi + sub ecx,[ebx+18h] + mov [ebx+1Ch],ecx + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],11h + jne get_data_address + cmp word [esi+1+4],'):' + jne get_data_address + inc esi + lods dword [esi] + add esi,2 + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp eax,0Fh + jbe reserved_word_used_as_symbol + mov edx,undefined_symbol + test byte [eax+8],1 + jz addressing_space_unavailable + mov edx,symbol_out_of_scope + mov cx,[eax+16] + cmp cx,[current_pass] + jne addressing_space_unavailable + test byte [eax+9],4 + jz invalid_use_of_symbol + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + or byte [ebx+8],8 + cmp [symbols_file],0 + je get_addressing_space + cmp [next_pass_needed],0 + jne get_addressing_space + call store_label_reference + get_addressing_space: + mov ebx,[ebx] + get_data_address: + push ebx + cmp byte [esi],'.' + je invalid_value + or [size_override],-1 + call get_address_value + pop ebp + call calculate_relative_offset + cmp [next_pass_needed],0 + jne data_address_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + data_address_type_ok: + mov ebx,edi + xor ecx,ecx + add ebx,eax + adc edx,ecx + mov eax,ebx + sub eax,[ds:ebp+18h] + sbb edx,ecx + jnz bad_data_address + mov cl,[operand_size] + add eax,ecx + cmp eax,[ds:ebp+1Ch] + ja bad_data_address + clc + ret + addressing_space_unavailable: + cmp [error_line],0 + jne get_data_address + push [current_line] + pop [error_line] + mov [error],edx + mov [error_info],eax + jmp get_data_address + bad_data_address: + call recoverable_overflow + stc + ret +store_directive: + cmp byte [esi],11h + je sized_store + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_byte_value + xor edx,edx + movzx eax,al + mov [operand_size],1 + jmp store_value_ok + sized_store: + or [size_override],-1 + call get_value + store_value_ok: + cmp [value_type],0 + jne invalid_use_of_symbol + mov dword [value],eax + mov dword [value+4],edx + lods byte [esi] + cmp al,80h + jne invalid_argument + call get_data_point + jc instruction_assembled + push esi edi + mov esi,value + mov edi,ebx + rep movs byte [edi],[esi] + mov eax,edi + pop edi esi + cmp ebx,[undefined_data_end] + jae instruction_assembled + cmp eax,[undefined_data_start] + jbe instruction_assembled + mov [undefined_data_start],eax + jmp instruction_assembled + +display_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],0 + jne display_byte + inc esi + lods dword [esi] + mov ecx,eax + push edi + mov edi,[tagged_blocks] + sub edi,8 + sub edi,eax + cmp edi,[esp] + jbe out_of_memory + mov [tagged_blocks],edi + rep movs byte [edi],[esi] + stos dword [edi] + xor eax,eax + stos dword [edi] + pop edi + inc esi + jmp display_next + display_byte: + call get_byte_value + push edi + mov edi,[tagged_blocks] + sub edi,8+1 + mov [tagged_blocks],edi + stos byte [edi] + mov eax,1 + stos dword [edi] + dec eax + stos dword [edi] + pop edi + display_next: + cmp edi,[tagged_blocks] + ja out_of_memory + lods byte [esi] + cmp al,',' + je display_directive + dec esi + jmp instruction_assembled +show_display_buffer: + mov eax,[tagged_blocks] + or eax,eax + jz display_done + mov esi,[labels_list] + cmp esi,eax + je display_done + display_messages: + sub esi,8 + mov eax,[esi+4] + mov ecx,[esi] + sub esi,ecx + test eax,eax + jnz skip_block + push esi + call display_block + pop esi + skip_block: + cmp esi,[tagged_blocks] + jne display_messages + display_done: + ret + +times_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_times + cmp byte [esi],':' + jne times_argument_ok + inc esi + times_argument_ok: + push [counter] + push [counter_limit] + mov [counter_limit],eax + mov [counter],1 + times_loop: + mov eax,esp + sub eax,100h + jc stack_overflow + cmp eax,[stack_limit] + jb stack_overflow + push esi + or [prefixed_instruction],-1 + call continue_line + mov eax,[counter_limit] + cmp [counter],eax + je times_done + inc [counter] + pop esi + jmp times_loop + times_done: + pop eax + pop [counter_limit] + pop [counter] + jmp instruction_assembled + zero_times: + call skip_symbol + jnc zero_times + jmp instruction_assembled + +virtual_directive: + lods byte [esi] + cmp al,80h + jne virtual_at_current + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_address_value + mov ebp,[address_symbol] + or bh,bh + setnz ch + jmp set_virtual + virtual_at_current: + dec esi + mov ebp,[addressing_space] + mov al,[ds:ebp+9] + mov [value_type],al + mov eax,edi + xor edx,edx + xor cl,cl + sub eax,[ds:ebp] + sbb edx,[ds:ebp+4] + sbb cl,[ds:ebp+8] + mov [address_sign],cl + mov bx,[ds:ebp+10h] + mov cx,[ds:ebp+10h+2] + xchg bh,bl + xchg ch,cl + mov ebp,[ds:ebp+14h] + set_virtual: + xchg bl,bh + xchg cl,ch + shl ecx,16 + mov cx,bx + push ecx eax + call allocate_structure_data + mov word [ebx],virtual_directive-instruction_handler + mov ecx,[addressing_space] + mov [ebx+12],ecx + mov [ebx+8],edi + mov ecx,[current_line] + mov [ebx+4],ecx + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + call init_addressing_space + or byte [ebx+0Ah],1 + pop eax + mov cl,[address_sign] + not eax + not edx + not cl + add eax,1 + adc edx,0 + adc cl,0 + add eax,edi + adc edx,0 + adc cl,0 + mov [ebx],eax + mov [ebx+4],edx + mov [ebx+8],cl + pop dword [ebx+10h] + mov [ebx+14h],ebp + mov al,[value_type] + test al,1 + jnz invalid_use_of_symbol + mov [ebx+9],al + jmp instruction_assembled + allocate_structure_data: + mov ebx,[structures_buffer] + sub ebx,18h + cmp ebx,[free_additional_memory] + jb out_of_memory + mov [structures_buffer],ebx + ret + find_structure_data: + mov ebx,[structures_buffer] + scan_structures: + cmp ebx,[additional_memory_end] + je no_such_structure + cmp ax,[ebx] + je structure_data_found + add ebx,18h + jmp scan_structures + structure_data_found: + ret + no_such_structure: + stc + ret + end_virtual: + call find_structure_data + jc unexpected_instruction + push ebx + call close_virtual_addressing_space + pop ebx + mov eax,[ebx+12] + mov [addressing_space],eax + mov edi,[ebx+8] + remove_structure_data: + push esi edi + mov ecx,ebx + sub ecx,[structures_buffer] + shr ecx,2 + lea esi,[ebx-4] + lea edi,[esi+18h] + std + rep movs dword [edi],[esi] + cld + add [structures_buffer],18h + pop edi esi + ret + close_virtual_addressing_space: + mov ebx,[addressing_space] + mov eax,edi + sub eax,[ebx+18h] + mov [ebx+1Ch],eax + test byte [ebx+0Ah],2 + jz addressing_space_closed + push esi edi ecx edx + mov ecx,eax + mov eax,[tagged_blocks] + mov dword [eax-4],11h + mov dword [eax-8],ecx + sub eax,8 + sub eax,ecx + mov [tagged_blocks],eax + lea edi,[eax+ecx-1] + xchg eax,[ebx+18h] + lea esi,[eax+ecx-1] + mov eax,edi + sub eax,esi + std + shr ecx,1 + jnc virtual_byte_ok + movs byte [edi],[esi] + virtual_byte_ok: + dec esi + dec edi + shr ecx,1 + jnc virtual_word_ok + movs word [edi],[esi] + virtual_word_ok: + sub esi,2 + sub edi,2 + rep movs dword [edi],[esi] + cld + xor edx,edx + add [ebx],eax + adc dword [ebx+4],edx + adc byte [ebx+8],dl + pop edx ecx edi esi + addressing_space_closed: + ret +repeat_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + cmp eax,0 + je zero_repeat + call allocate_structure_data + mov word [ebx],repeat_directive-instruction_handler + xchg eax,[counter_limit] + mov [ebx+10h],eax + mov eax,1 + xchg eax,[counter] + mov [ebx+14h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + end_repeat: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[counter_limit] + inc [counter] + cmp [counter],eax + jbe continue_repeating + stop_repeat: + mov eax,[ebx+10h] + mov [counter_limit],eax + mov eax,[ebx+14h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + continue_repeating: + mov esi,[ebx+8] + jmp instruction_assembled + zero_repeat: + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_repeat + jmp instruction_assembled + find_end_repeat: + call find_structure_end + cmp ax,repeat_directive-instruction_handler + jne unexpected_instruction + ret +while_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call allocate_structure_data + mov word [ebx],while_directive-instruction_handler + mov eax,1 + xchg eax,[counter] + mov [ebx+10h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + do_while: + push ebx + call calculate_logical_expression + or al,al + jnz while_true + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + stop_while: + call find_end_while + pop ebx + mov eax,[ebx+10h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + while_true: + pop ebx + jmp instruction_assembled + end_while: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[ebx+4] + mov [current_line],eax + inc [counter] + jz too_many_repeats + mov esi,[ebx+8] + jmp do_while + find_end_while: + call find_structure_end + cmp ax,while_directive-instruction_handler + jne unexpected_instruction + ret +if_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call calculate_logical_expression + mov dl,al + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or dl,dl + jnz if_true + call find_else + jc instruction_assembled + mov al,[esi] + cmp al,1 + jne else_true + cmp word [esi+1],if_directive-instruction_handler + jne else_true + add esi,4 + jmp if_directive + if_true: + xor al,al + make_if_structure: + call allocate_structure_data + mov word [ebx],if_directive-instruction_handler + mov byte [ebx+2],al + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + else_true: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or al,-1 + jmp make_if_structure + else_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + mov ax,if_directive-instruction_handler + call find_structure_data + jc unexpected_instruction + cmp byte [ebx+2],0 + jne unexpected_instruction + found_else: + mov al,[esi] + cmp al,1 + jne skip_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_else + add esi,4 + call find_else + jnc found_else + call remove_structure_data + jmp instruction_assembled + skip_else: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_if + call remove_structure_data + jmp instruction_assembled + end_if: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + call remove_structure_data + jmp instruction_assembled + find_else: + call find_structure_end + cmp ax,else_directive-instruction_handler + je else_found + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + stc + ret + else_found: + clc + ret + find_end_if: + call find_structure_end + cmp ax,if_directive-instruction_handler + jne unexpected_instruction + ret + find_structure_end: + push [error_line] + mov eax,[current_line] + mov [error_line],eax + find_end_directive: + call skip_symbol + jnc find_end_directive + lods byte [esi] + cmp al,0Fh + jne no_end_directive + lods dword [esi] + mov [current_line],eax + skip_labels: + cmp byte [esi],2 + jne labels_ok + add esi,6 + jmp skip_labels + labels_ok: + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + cmp ax,prefix_instruction-instruction_handler + je find_end_directive + add esi,4 + cmp ax,repeat_directive-instruction_handler + je skip_repeat + cmp ax,while_directive-instruction_handler + je skip_while + cmp ax,if_directive-instruction_handler + je skip_if + cmp ax,else_directive-instruction_handler + je structure_end + cmp ax,end_directive-instruction_handler + jne find_end_directive + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + add esi,4 + cmp ax,repeat_directive-instruction_handler + je structure_end + cmp ax,while_directive-instruction_handler + je structure_end + cmp ax,if_directive-instruction_handler + jne find_end_directive + structure_end: + pop [error_line] + ret + no_end_directive: + mov eax,[error_line] + mov [current_line],eax + jmp missing_end_directive + skip_repeat: + call find_end_repeat + jmp find_end_directive + skip_while: + call find_end_while + jmp find_end_directive + skip_if: + call skip_if_block + jmp find_end_directive + skip_if_block: + call find_else + jc if_block_skipped + cmp byte [esi],1 + jne skip_after_else + cmp word [esi+1],if_directive-instruction_handler + jne skip_after_else + add esi,4 + jmp skip_if_block + skip_after_else: + call find_end_if + if_block_skipped: + ret +end_directive: + lods byte [esi] + cmp al,1 + jne invalid_argument + lods word [esi] + inc esi + cmp ax,virtual_directive-instruction_handler + je end_virtual + cmp ax,repeat_directive-instruction_handler + je end_repeat + cmp ax,while_directive-instruction_handler + je end_while + cmp ax,if_directive-instruction_handler + je end_if + cmp ax,data_directive-instruction_handler + je end_data + jmp invalid_argument +break_directive: + mov ebx,[structures_buffer] + mov al,[esi] + or al,al + jz find_breakable_structure + cmp al,0Fh + jne extra_characters_on_line + find_breakable_structure: + cmp ebx,[additional_memory_end] + je unexpected_instruction + mov ax,[ebx] + cmp ax,repeat_directive-instruction_handler + je break_repeat + cmp ax,while_directive-instruction_handler + je break_while + cmp ax,if_directive-instruction_handler + je break_if + add ebx,18h + jmp find_breakable_structure + break_if: + push [current_line] + mov eax,[ebx+4] + mov [current_line],eax + call remove_structure_data + call skip_if_block + pop [current_line] + mov ebx,[structures_buffer] + jmp find_breakable_structure + break_repeat: + push ebx + call find_end_repeat + pop ebx + jmp stop_repeat + break_while: + push ebx + jmp stop_while + +data_bytes: + call define_data + lods byte [esi] + cmp al,'(' + je get_byte + cmp al,'?' + jne invalid_argument + mov eax,edi + mov byte [edi],0 + inc edi + jmp undefined_data + get_byte: + cmp byte [esi],0 + je get_string + call get_byte_value + stos byte [edi] + ret + get_string: + inc esi + lods dword [esi] + mov ecx,eax + lea eax,[edi+ecx] + cmp eax,[tagged_blocks] + ja out_of_memory + rep movs byte [edi],[esi] + inc esi + ret + undefined_data: + mov ebp,[addressing_space] + test byte [ds:ebp+0Ah],1 + jz mark_undefined_data + ret + mark_undefined_data: + cmp eax,[undefined_data_end] + je undefined_data_ok + mov [undefined_data_start],eax + undefined_data_ok: + mov [undefined_data_end],edi + ret + define_data: + cmp edi,[tagged_blocks] + jae out_of_memory + cmp byte [esi],'(' + jne simple_data_value + mov ebx,esi + inc esi + call skip_expression + xchg esi,ebx + cmp byte [ebx],81h + jne simple_data_value + inc esi + call get_count_value + inc esi + or eax,eax + jz duplicate_zero_times + cmp byte [esi],'{' + jne duplicate_single_data_value + inc esi + duplicate_data: + push eax esi + duplicated_values: + cmp edi,[tagged_blocks] + jae out_of_memory + call near dword [esp+8] + lods byte [esi] + cmp al,',' + je duplicated_values + cmp al,'}' + jne invalid_argument + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_data + duplicate_single_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + push eax esi + call near dword [esp+8] + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_single_data_value + duplicate_zero_times: + cmp byte [esi],'{' + jne skip_single_data_value + inc esi + skip_data_value: + call skip_symbol + jc invalid_argument + cmp byte [esi],'}' + jne skip_data_value + inc esi + jmp data_defined + skip_single_data_value: + call skip_symbol + jmp data_defined + simple_data_value: + cmp edi,[tagged_blocks] + jae out_of_memory + call near dword [esp] + data_defined: + lods byte [esi] + cmp al,',' + je define_data + dec esi + add esp,4 + jmp instruction_assembled +data_unicode: + or [base_code],-1 + jmp define_words +data_words: + mov [base_code],0 + define_words: + call define_data + lods byte [esi] + cmp al,'(' + je get_word + cmp al,'?' + jne invalid_argument + mov eax,edi + and word [edi],0 + scas word [edi] + jmp undefined_data + ret + get_word: + cmp [base_code],0 + je word_data_value + cmp byte [esi],0 + je word_string + word_data_value: + call get_word_value + call mark_relocation + stos word [edi] + ret + word_string: + inc esi + lods dword [esi] + mov ecx,eax + jecxz word_string_ok + lea eax,[edi+ecx*2] + cmp eax,[tagged_blocks] + ja out_of_memory + xor ah,ah + copy_word_string: + lods byte [esi] + stos word [edi] + loop copy_word_string + word_string_ok: + inc esi + ret +data_dwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_dword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_dword: + push esi + call get_dword_value + pop ebx + cmp byte [esi],':' + je complex_dword + call mark_relocation + stos dword [edi] + ret + complex_dword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_word_value + call mark_relocation + stos word [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_pwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_pword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_pword: + push esi + call get_pword_value + pop ebx + cmp byte [esi],':' + je complex_pword + call mark_relocation + stos dword [edi] + mov ax,dx + stos word [edi] + ret + complex_pword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_dword_value + call mark_relocation + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_qwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_qword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + jmp undefined_data + get_qword: + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + ret +data_twords: + call define_data + lods byte [esi] + cmp al,'(' + je get_tword + cmp al,'?' + jne invalid_argument + mov eax,edi + and dword [edi],0 + scas dword [edi] + and dword [edi],0 + scas dword [edi] + and word [edi],0 + scas word [edi] + jmp undefined_data + get_tword: + cmp byte [esi],'.' + jne complex_tword + inc esi + cmp word [esi+8],8000h + je fp_zero_tword + mov eax,[esi] + stos dword [edi] + mov eax,[esi+4] + stos dword [edi] + mov ax,[esi+8] + add ax,3FFFh + jo value_out_of_range + cmp ax,7FFFh + jge value_out_of_range + cmp ax,0 + jg tword_exp_ok + mov cx,ax + neg cx + inc cx + cmp cx,64 + jae value_out_of_range + cmp cx,32 + ja large_shift + mov eax,[esi] + mov edx,[esi+4] + mov ebx,edx + shr edx,cl + shrd eax,ebx,cl + jmp tword_mantissa_shift_done + large_shift: + sub cx,32 + xor edx,edx + mov eax,[esi+4] + shr eax,cl + tword_mantissa_shift_done: + jnc store_shifted_mantissa + add eax,1 + adc edx,0 + store_shifted_mantissa: + mov [edi-8],eax + mov [edi-4],edx + xor ax,ax + test edx,1 shl 31 + jz tword_exp_ok + inc ax + tword_exp_ok: + mov bl,[esi+11] + shl bx,15 + or ax,bx + stos word [edi] + add esi,13 + ret + fp_zero_tword: + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,[esi+11] + shl ax,15 + stos word [edi] + add esi,13 + ret + complex_tword: + call get_word_value + push eax + cmp byte [esi],':' + jne invalid_operand + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_file: + lods word [esi] + cmp ax,'(' + jne invalid_argument + add esi,4 + call open_binary_file + mov eax,[esi-4] + lea esi,[esi+eax+1] + mov al,2 + xor edx,edx + call lseek + push eax + xor edx,edx + cmp byte [esi],':' + jne position_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx + call get_count_value + pop ebx + mov edx,eax + sub [esp],edx + jc value_out_of_range + position_ok: + cmp byte [esi],',' + jne size_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx edx + call get_count_value + pop edx ebx + cmp eax,[esp] + ja value_out_of_range + mov [esp],eax + size_ok: + xor al,al + call lseek + pop ecx + mov edx,edi + add edi,ecx + jc out_of_memory + cmp edi,[tagged_blocks] + ja out_of_memory + call read + jc error_reading_file + call close + lods byte [esi] + cmp al,',' + je data_file + dec esi + jmp instruction_assembled + open_binary_file: + push esi + push edi + mov eax,[current_line] + find_current_source_path: + mov esi,[eax] + test byte [eax+7],80h + jz get_current_path + mov eax,[eax+8] + jmp find_current_source_path + get_current_path: + lodsb + stosb + or al,al + jnz get_current_path + cut_current_path: + cmp edi,[esp] + je current_path_ok + cmp byte [edi-1],'\' + je current_path_ok + cmp byte [edi-1],'/' + je current_path_ok + dec edi + jmp cut_current_path + current_path_ok: + mov esi,[esp+4] + call expand_path + pop edx + mov esi,edx + call open + jnc file_opened + mov edx,[include_paths] + search_in_include_paths: + push edx esi + mov edi,esi + mov esi,[esp+4] + call get_include_directory + mov [esp+4],esi + mov esi,[esp+8] + call expand_path + pop edx + mov esi,edx + call open + pop edx + jnc file_opened + cmp byte [edx],0 + jne search_in_include_paths + mov edi,esi + mov esi,[esp] + push edi + call expand_path + pop edx + mov esi,edx + call open + jc file_not_found + file_opened: + mov edi,esi + pop esi + ret +reserve_bytes: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_bytes + add edi,ecx + jmp reserved_data + zero_bytes: + xor eax,eax + shr ecx,1 + jnc bytes_stosb_ok + stos byte [edi] + bytes_stosb_ok: + shr ecx,1 + jnc bytes_stosw_ok + stos word [edi] + bytes_stosw_ok: + rep stos dword [edi] + reserved_data: + pop eax + call undefined_data + jmp instruction_assembled +reserve_words: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data + zero_words: + xor eax,eax + shr ecx,1 + jnc words_stosw_ok + stos word [edi] + words_stosw_ok: + rep stos dword [edi] + jmp reserved_data +reserve_dwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data + zero_dwords: + xor eax,eax + rep stos dword [edi] + jmp reserved_data +reserve_pwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +reserve_qwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,1 + jc out_of_memory + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data +reserve_twords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov ecx,eax + shl ecx,2 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +align_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_count_value + mov edx,eax + dec edx + test eax,edx + jnz invalid_align_value + or eax,eax + jz invalid_align_value + cmp eax,1 + je instruction_assembled + mov ecx,edi + mov ebp,[addressing_space] + sub ecx,[ds:ebp] + cmp dword [ds:ebp+10h],0 + jne section_not_aligned_enough + cmp byte [ds:ebp+9],0 + je make_alignment + cmp [output_format],3 + je pe_alignment + mov ebx,[ds:ebp+14h] + cmp byte [ebx],0 + jne section_not_aligned_enough + cmp eax,[ebx+10h] + jbe make_alignment + jmp section_not_aligned_enough + pe_alignment: + cmp eax,1000h + ja section_not_aligned_enough + make_alignment: + dec eax + and ecx,eax + jz instruction_assembled + neg ecx + add ecx,eax + inc ecx + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[tagged_blocks] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je nops + add edi,ecx + jmp reserved_data + invalid_align_value: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + jmp instruction_assembled + nops: + mov eax,90909090h + shr ecx,1 + jnc nops_stosb_ok + stos byte [edi] + nops_stosb_ok: + shr ecx,1 + jnc nops_stosw_ok + stos word [edi] + nops_stosw_ok: + rep stos dword [edi] + jmp reserved_data +err_directive: + mov al,[esi] + cmp al,0Fh + je invoked_error + or al,al + jz invoked_error + jmp extra_characters_on_line +assert_directive: + call calculate_logical_expression + or al,al + jnz instruction_assembled + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],assertion_failed + jmp instruction_assembled diff --git a/samples/Assembly/FASM.asm b/samples/Assembly/FASM.asm new file mode 100644 index 00000000..9a2201ae --- /dev/null +++ b/samples/Assembly/FASM.asm @@ -0,0 +1,350 @@ + +; flat assembler interface for Win32 +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + + format PE console + +section '.text' code readable executable + +start: + + mov [con_handle],STD_OUTPUT_HANDLE + mov esi,_logo + call display_string + + call get_params + jc information + + call init_memory + + mov esi,_memory_prefix + call display_string + mov eax,[memory_end] + sub eax,[memory_start] + add eax,[additional_memory_end] + sub eax,[additional_memory] + shr eax,10 + call display_number + mov esi,_memory_suffix + call display_string + + call [GetTickCount] + mov [start_time],eax + + call preprocessor + call parser + call assembler + call formatter + + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + call [GetTickCount] + sub eax,[start_time] + xor edx,edx + mov ebx,100 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov dl,'.' + call display_character + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + jmp exit_program + +information: + mov esi,_usage + call display_string + mov al,1 + jmp exit_program + +get_params: + mov [input_file],0 + mov [output_file],0 + mov [symbols_file],0 + mov [memory_setting],0 + mov [passes_limit],100 + call [GetCommandLine] + mov esi,eax + mov edi,params + find_command_start: + lodsb + cmp al,20h + je find_command_start + cmp al,22h + je skip_quoted_name + skip_name: + lodsb + cmp al,20h + je find_param + or al,al + jz all_params + jmp skip_name + skip_quoted_name: + lodsb + cmp al,22h + je find_param + or al,al + jz all_params + jmp skip_quoted_name + find_param: + lodsb + cmp al,20h + je find_param + cmp al,'-' + je option_param + cmp al,0Dh + je all_params + or al,al + jz all_params + cmp [input_file],0 + jne get_output_file + mov [input_file],edi + jmp process_param + get_output_file: + cmp [output_file],0 + jne bad_params + mov [output_file],edi + process_param: + cmp al,22h + je string_param + copy_param: + stosb + lodsb + cmp al,20h + je param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + jmp copy_param + string_param: + lodsb + cmp al,22h + je string_param_end + cmp al,0Dh + je param_end + or al,al + jz param_end + stosb + jmp string_param + option_param: + lodsb + cmp al,'m' + je memory_option + cmp al,'M' + je memory_option + cmp al,'p' + je passes_option + cmp al,'P' + je passes_option + cmp al,'s' + je symbols_option + cmp al,'S' + je symbols_option + bad_params: + stc + ret + get_option_value: + xor eax,eax + mov edx,eax + get_option_digit: + lodsb + cmp al,20h + je option_value_ok + cmp al,0Dh + je option_value_ok + or al,al + jz option_value_ok + sub al,30h + jc invalid_option_value + cmp al,9 + ja invalid_option_value + imul edx,10 + jo invalid_option_value + add edx,eax + jc invalid_option_value + jmp get_option_digit + option_value_ok: + dec esi + clc + ret + invalid_option_value: + stc + ret + memory_option: + lodsb + cmp al,20h + je memory_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + call get_option_value + or edx,edx + jz bad_params + cmp edx,1 shl (32-10) + jae bad_params + mov [memory_setting],edx + jmp find_param + passes_option: + lodsb + cmp al,20h + je passes_option + cmp al,0Dh + je bad_params + or al,al + jz bad_params + dec esi + call get_option_value + or edx,edx + jz bad_params + cmp edx,10000h + ja bad_params + mov [passes_limit],dx + jmp find_param + symbols_option: + mov [symbols_file],edi + find_symbols_file_name: + lodsb + cmp al,20h + jne process_param + jmp find_symbols_file_name + param_end: + dec esi + string_param_end: + xor al,al + stosb + jmp find_param + all_params: + cmp [input_file],0 + je bad_params + clc + ret + +include 'system.inc' + +include '..\errors.inc' +include '..\symbdump.inc' +include '..\preproce.inc' +include '..\parser.inc' +include '..\exprpars.inc' +include '..\assemble.inc' +include '..\exprcalc.inc' +include '..\formats.inc' +include '..\x86_64.inc' +include '..\avx.inc' + +include '..\tables.inc' +include '..\messages.inc' + +section '.data' data readable writeable + +include '..\version.inc' + +_copyright db 'Copyright (c) 1999-2014, Tomasz Grysztar',0Dh,0Ah,0 + +_logo db 'flat assembler version ',VERSION_STRING,0 +_usage db 0Dh,0Ah + db 'usage: fasm [output]',0Dh,0Ah + db 'optional settings:',0Dh,0Ah + db ' -m set the limit in kilobytes for the available memory',0Dh,0Ah + db ' -p set the maximum allowed number of passes',0Dh,0Ah + db ' -s dump symbolic information for debugging',0Dh,0Ah + db 0 +_memory_prefix db ' (',0 +_memory_suffix db ' kilobytes memory)',0Dh,0Ah,0 +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',0Dh,0Ah,0 + +align 4 + +include '..\variable.inc' + +con_handle dd ? +memory_setting dd ? +start_time dd ? +bytes_count dd ? +displayed_count dd ? +character db ? +last_displayed rb 2 + +params rb 1000h +options rb 1000h +buffer rb 4000h + +stack 10000h + +section '.idata' import data readable writeable + + dd 0,0,0,rva kernel_name,rva kernel_table + dd 0,0,0,0,0 + + kernel_table: + ExitProcess dd rva _ExitProcess + CreateFile dd rva _CreateFileA + ReadFile dd rva _ReadFile + WriteFile dd rva _WriteFile + CloseHandle dd rva _CloseHandle + SetFilePointer dd rva _SetFilePointer + GetCommandLine dd rva _GetCommandLineA + GetEnvironmentVariable dd rva _GetEnvironmentVariable + GetStdHandle dd rva _GetStdHandle + VirtualAlloc dd rva _VirtualAlloc + VirtualFree dd rva _VirtualFree + GetTickCount dd rva _GetTickCount + GetSystemTime dd rva _GetSystemTime + GlobalMemoryStatus dd rva _GlobalMemoryStatus + dd 0 + + kernel_name db 'KERNEL32.DLL',0 + + _ExitProcess dw 0 + db 'ExitProcess',0 + _CreateFileA dw 0 + db 'CreateFileA',0 + _ReadFile dw 0 + db 'ReadFile',0 + _WriteFile dw 0 + db 'WriteFile',0 + _CloseHandle dw 0 + db 'CloseHandle',0 + _SetFilePointer dw 0 + db 'SetFilePointer',0 + _GetCommandLineA dw 0 + db 'GetCommandLineA',0 + _GetEnvironmentVariable dw 0 + db 'GetEnvironmentVariableA',0 + _GetStdHandle dw 0 + db 'GetStdHandle',0 + _VirtualAlloc dw 0 + db 'VirtualAlloc',0 + _VirtualFree dw 0 + db 'VirtualFree',0 + _GetTickCount dw 0 + db 'GetTickCount',0 + _GetSystemTime dw 0 + db 'GetSystemTime',0 + _GlobalMemoryStatus dw 0 + db 'GlobalMemoryStatus',0 + +section '.reloc' fixups data readable discardable diff --git a/samples/Assembly/SYSTEM.inc b/samples/Assembly/SYSTEM.inc new file mode 100644 index 00000000..77a61d29 --- /dev/null +++ b/samples/Assembly/SYSTEM.inc @@ -0,0 +1,503 @@ + +; flat assembler interface for Win32 +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + +CREATE_NEW = 1 +CREATE_ALWAYS = 2 +OPEN_EXISTING = 3 +OPEN_ALWAYS = 4 +TRUNCATE_EXISTING = 5 + +FILE_SHARE_READ = 1 +FILE_SHARE_WRITE = 2 +FILE_SHARE_DELETE = 4 + +GENERIC_READ = 80000000h +GENERIC_WRITE = 40000000h + +STD_INPUT_HANDLE = 0FFFFFFF6h +STD_OUTPUT_HANDLE = 0FFFFFFF5h +STD_ERROR_HANDLE = 0FFFFFFF4h + +MEM_COMMIT = 1000h +MEM_RESERVE = 2000h +MEM_DECOMMIT = 4000h +MEM_RELEASE = 8000h +MEM_FREE = 10000h +MEM_PRIVATE = 20000h +MEM_MAPPED = 40000h +MEM_RESET = 80000h +MEM_TOP_DOWN = 100000h + +PAGE_NOACCESS = 1 +PAGE_READONLY = 2 +PAGE_READWRITE = 4 +PAGE_WRITECOPY = 8 +PAGE_EXECUTE = 10h +PAGE_EXECUTE_READ = 20h +PAGE_EXECUTE_READWRITE = 40h +PAGE_EXECUTE_WRITECOPY = 80h +PAGE_GUARD = 100h +PAGE_NOCACHE = 200h + +init_memory: + xor eax,eax + mov [memory_start],eax + mov eax,esp + and eax,not 0FFFh + add eax,1000h-10000h + mov [stack_limit],eax + mov eax,[memory_setting] + shl eax,10 + jnz allocate_memory + push buffer + call [GlobalMemoryStatus] + mov eax,dword [buffer+20] + mov edx,dword [buffer+12] + cmp eax,0 + jl large_memory + cmp edx,0 + jl large_memory + shr eax,2 + add eax,edx + jmp allocate_memory + large_memory: + mov eax,80000000h + allocate_memory: + mov edx,eax + shr edx,2 + mov ecx,eax + sub ecx,edx + mov [memory_end],ecx + mov [additional_memory_end],edx + push PAGE_READWRITE + push MEM_COMMIT + push eax + push 0 + call [VirtualAlloc] + or eax,eax + jz not_enough_memory + mov [memory_start],eax + add eax,[memory_end] + mov [memory_end],eax + mov [additional_memory],eax + add [additional_memory_end],eax + ret + not_enough_memory: + mov eax,[additional_memory_end] + shl eax,1 + cmp eax,4000h + jb out_of_memory + jmp allocate_memory + +exit_program: + movzx eax,al + push eax + mov eax,[memory_start] + test eax,eax + jz do_exit + push MEM_RELEASE + push 0 + push eax + call [VirtualFree] + do_exit: + call [ExitProcess] + +get_environment_variable: + mov ecx,[memory_end] + sub ecx,edi + cmp ecx,4000h + jbe buffer_for_variable_ok + mov ecx,4000h + buffer_for_variable_ok: + push ecx + push edi + push esi + call [GetEnvironmentVariable] + add edi,eax + cmp edi,[memory_end] + jae out_of_memory + ret + +open: + push 0 + push 0 + push OPEN_EXISTING + push 0 + push FILE_SHARE_READ + push GENERIC_READ + push edx + call [CreateFile] + cmp eax,-1 + je file_error + mov ebx,eax + clc + ret + file_error: + stc + ret +create: + push 0 + push 0 + push CREATE_ALWAYS + push 0 + push FILE_SHARE_READ + push GENERIC_WRITE + push edx + call [CreateFile] + cmp eax,-1 + je file_error + mov ebx,eax + clc + ret +write: + push 0 + push bytes_count + push ecx + push edx + push ebx + call [WriteFile] + or eax,eax + jz file_error + clc + ret +read: + mov ebp,ecx + push 0 + push bytes_count + push ecx + push edx + push ebx + call [ReadFile] + or eax,eax + jz file_error + cmp ebp,[bytes_count] + jne file_error + clc + ret +close: + push ebx + call [CloseHandle] + ret +lseek: + movzx eax,al + push eax + push 0 + push edx + push ebx + call [SetFilePointer] + ret + +display_string: + push [con_handle] + call [GetStdHandle] + mov ebp,eax + mov edi,esi + or ecx,-1 + xor al,al + repne scasb + neg ecx + sub ecx,2 + push 0 + push bytes_count + push ecx + push esi + push ebp + call [WriteFile] + ret +display_character: + push ebx + mov [character],dl + push [con_handle] + call [GetStdHandle] + mov ebx,eax + push 0 + push bytes_count + push 1 + push character + push ebx + call [WriteFile] + pop ebx + ret +display_number: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + push edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + push ecx + call display_character + pop ecx + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz display_loop + pop ebx + ret + +display_user_messages: + mov [displayed_count],0 + call show_display_buffer + cmp [displayed_count],1 + jb line_break_ok + je make_line_break + mov ax,word [last_displayed] + cmp ax,0A0Dh + je line_break_ok + cmp ax,0D0Ah + je line_break_ok + make_line_break: + mov word [buffer],0A0Dh + push [con_handle] + call [GetStdHandle] + push 0 + push bytes_count + push 2 + push buffer + push eax + call [WriteFile] + line_break_ok: + ret +display_block: + add [displayed_count],ecx + cmp ecx,1 + ja take_last_two_characters + jb block_displayed + mov al,[last_displayed+1] + mov ah,[esi] + mov word [last_displayed],ax + jmp block_ok + take_last_two_characters: + mov ax,[esi+ecx-2] + mov word [last_displayed],ax + block_ok: + push ecx + push [con_handle] + call [GetStdHandle] + pop ecx + push 0 + push bytes_count + push ecx + push esi + push eax + call [WriteFile] + block_displayed: + ret + +fatal_error: + mov [con_handle],STD_ERROR_HANDLE + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,0FFh + jmp exit_program +assembler_error: + mov [con_handle],STD_ERROR_HANDLE + call display_user_messages + push dword 0 + mov ebx,[current_line] + get_error_lines: + mov eax,[ebx] + cmp byte [eax],0 + je get_next_error_line + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + get_next_error_line: + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + call display_character + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + jz line_data_displayed + push eax + xor al,al + call lseek + mov ecx,[esp] + mov edx,[additional_memory] + lea eax,[edx+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + call read + call close + pop ecx + mov esi,[additional_memory] + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + display_line_data: + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + line_data_displayed: + mov esi,cr_lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov al,2 + jmp exit_program + +make_timestamp: + push buffer + call [GetSystemTime] + movzx ecx,word [buffer] + mov eax,ecx + sub eax,1970 + mov ebx,365 + mul ebx + mov ebp,eax + mov eax,ecx + sub eax,1969 + shr eax,2 + add ebp,eax + mov eax,ecx + sub eax,1901 + mov ebx,100 + div ebx + sub ebp,eax + mov eax,ecx + xor edx,edx + sub eax,1601 + mov ebx,400 + div ebx + add ebp,eax + movzx ecx,word [buffer+2] + mov eax,ecx + dec eax + mov ebx,30 + mul ebx + add ebp,eax + cmp ecx,8 + jbe months_correction + mov eax,ecx + sub eax,7 + shr eax,1 + add ebp,eax + mov ecx,8 + months_correction: + mov eax,ecx + shr eax,1 + add ebp,eax + cmp ecx,2 + jbe day_correction_ok + sub ebp,2 + movzx ecx,word [buffer] + test ecx,11b + jnz day_correction_ok + xor edx,edx + mov eax,ecx + mov ebx,100 + div ebx + or edx,edx + jnz day_correction + mov eax,ecx + mov ebx,400 + div ebx + or edx,edx + jnz day_correction_ok + day_correction: + inc ebp + day_correction_ok: + movzx eax,word [buffer+6] + dec eax + add eax,ebp + mov ebx,24 + mul ebx + movzx ecx,word [buffer+8] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,word [buffer+10] + add eax,ecx + mov ebx,60 + mul ebx + movzx ecx,word [buffer+12] + add eax,ecx + adc edx,0 + ret + +error_prefix db 'error: ',0 +error_suffix db '.' +cr_lf db 0Dh,0Ah,0 +line_number_start db ' [',0 +line_data_start db ':',0Dh,0Ah,0 diff --git a/samples/Assembly/X86_64.inc b/samples/Assembly/X86_64.inc new file mode 100644 index 00000000..28413065 --- /dev/null +++ b/samples/Assembly/X86_64.inc @@ -0,0 +1,7060 @@ + +; flat assembler core +; Copyright (c) 1999-2014, Tomasz Grysztar. +; All rights reserved. + +simple_instruction_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction: + stos byte [edi] + jmp instruction_assembled +simple_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp simple_instruction +simple_instruction_16bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_16bit: + cmp [code_type],16 + jne size_prefix + stos byte [edi] + jmp instruction_assembled + size_prefix: + mov ah,al + mov al,66h + stos word [edi] + jmp instruction_assembled +simple_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_32bit: + cmp [code_type],16 + je size_prefix + stos byte [edi] + jmp instruction_assembled +iret_instruction: + cmp [code_type],64 + jne simple_instruction +simple_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov ah,al + mov al,48h + stos word [edi] + jmp instruction_assembled +simple_extended_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov byte [edi],48h + inc edi +simple_extended_instruction: + mov ah,al + mov al,0Fh + stos word [edi] + jmp instruction_assembled +prefix_instruction: + stos byte [edi] + or [prefixed_instruction],-1 + jmp continue_line +segment_prefix: + mov ah,al + shr ah,4 + cmp ah,6 + jne illegal_instruction + and al,1111b + mov [segment_register],al + call store_segment_prefix + or [prefixed_instruction],-1 + jmp continue_line +int_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + test eax,eax + jns int_imm_ok + call recoverable_overflow + int_imm_ok: + mov ah,al + mov al,0CDh + stos word [edi] + jmp instruction_assembled +aa_instruction: + cmp [code_type],64 + je illegal_instruction + push eax + mov bl,10 + cmp byte [esi],'(' + jne aa_store + inc esi + xor al,al + xchg al,[operand_size] + cmp al,1 + ja invalid_operand_size + call get_byte_value + mov bl,al + aa_store: + cmp [operand_size],0 + jne invalid_operand + pop eax + mov ah,bl + stos word [edi] + jmp instruction_assembled + +basic_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg + cmp al,'[' + jne invalid_operand + basic_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je basic_mem_imm + cmp al,10h + jne invalid_operand + basic_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je instruction_ready + call operand_autodetect + inc [base_code] + instruction_ready: + call store_instruction + jmp instruction_assembled + basic_mem_imm: + mov al,[operand_size] + cmp al,1 + jb basic_mem_imm_nosize + je basic_mem_imm_8bit + cmp al,2 + je basic_mem_imm_16bit + cmp al,4 + je basic_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_mem_imm_32bit_ok + basic_mem_imm_nosize: + call recoverable_unknown_size + basic_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + mov [base_code],80h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_16bit_store + cmp [size_declared],0 + jne basic_mem_imm_16bit_store + cmp word [value],80h + jb basic_mem_simm_8bit + cmp word [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_16bit_store: + mov [base_code],81h + call store_instruction_with_imm16 + jmp instruction_assembled + basic_mem_simm_8bit: + mov [base_code],83h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_32bit: + call operand_32bit + call get_dword_value + basic_mem_imm_32bit_ok: + mov dword [value],eax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop ecx ebx edx + cmp [value_type],0 + jne basic_mem_imm_32bit_store + cmp [size_declared],0 + jne basic_mem_imm_32bit_store + cmp dword [value],80h + jb basic_mem_simm_8bit + cmp dword [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_32bit_store: + mov [base_code],81h + call store_instruction_with_imm32 + jmp instruction_assembled + get_simm32: + call get_qword_value + mov ecx,edx + cdq + cmp ecx,edx + jne value_out_of_range + cmp [value_type],4 + jne get_simm32_ok + mov [value_type],2 + get_simm32_ok: + ret + basic_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg_reg + cmp al,'(' + je basic_reg_imm + cmp al,'[' + jne invalid_operand + basic_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je basic_reg_mem_8bit + call operand_autodetect + add [base_code],3 + jmp instruction_ready + basic_reg_mem_8bit: + add [base_code],2 + jmp instruction_ready + basic_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je nomem_instruction_ready + call operand_autodetect + inc [base_code] + nomem_instruction_ready: + call store_nomem_instruction + jmp instruction_assembled + basic_reg_imm: + mov al,[operand_size] + cmp al,1 + je basic_reg_imm_8bit + cmp al,2 + je basic_reg_imm_16bit + cmp al,4 + je basic_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + basic_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_reg_imm_32bit_ok + basic_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + or bl,bl + jz basic_al_imm + mov [base_code],80h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_al_imm: + mov al,[base_code] + add al,4 + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_16bit_store + cmp [size_declared],0 + jne basic_reg_imm_16bit_store + cmp dx,80h + jb basic_reg_simm_8bit + cmp dx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_16bit_store: + or bl,bl + jz basic_ax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_16bit: + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + basic_reg_simm_8bit: + mov [base_code],83h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_ax_imm: + add [base_code],5 + call store_instruction_code + jmp basic_store_imm_16bit + basic_reg_imm_32bit: + call operand_32bit + call get_dword_value + basic_reg_imm_32bit_ok: + mov edx,eax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_32bit_store + cmp [size_declared],0 + jne basic_reg_imm_32bit_store + cmp edx,80h + jb basic_reg_simm_8bit + cmp edx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_32bit_store: + or bl,bl + jz basic_eax_imm + mov [base_code],81h + call store_nomem_instruction + basic_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + basic_eax_imm: + add [base_code],5 + call store_instruction_code + jmp basic_store_imm_32bit + recoverable_unknown_size: + cmp [error_line],0 + jne ignore_unknown_size + push [current_line] + pop [error_line] + mov [error],operand_size_not_specified + ignore_unknown_size: + ret +single_operand_instruction: + mov [base_code],0F6h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je single_reg + cmp al,'[' + jne invalid_operand + single_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je single_mem_8bit + jb single_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + single_mem_nosize: + call recoverable_unknown_size + single_mem_8bit: + jmp instruction_ready + single_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je single_reg_8bit + call operand_autodetect + inc [base_code] + single_reg_8bit: + jmp nomem_instruction_ready +mov_instruction: + mov [base_code],88h + lods byte [esi] + call get_size_operator + cmp al,10h + je mov_reg + cmp al,'[' + jne invalid_operand + mov_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je mov_mem_imm + cmp al,10h + jne invalid_operand + mov_mem_reg: + lods byte [esi] + cmp al,60h + jb mov_mem_general_reg + cmp al,70h + jb mov_mem_sreg + mov_mem_general_reg: + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + cmp ah,1 + je mov_mem_reg_8bit + mov al,ah + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_mem_ax + inc [base_code] + jmp instruction_ready + mov_mem_reg_8bit: + or al,bl + or al,bh + jnz instruction_ready + mov_mem_al: + test ch,22h + jnz mov_mem_address16_al + test ch,44h + jnz mov_mem_address32_al + test ch,88h + jnz mov_mem_address64_al + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_al + cmp [code_type],32 + je mov_mem_address32_al + cmp edx,10000h + jb mov_mem_address16_al + mov_mem_address32_al: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A2h + store_mov_address32: + call store_instruction_code + call store_address_32bit_value + jmp instruction_assembled + mov_mem_address16_al: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A2h + store_mov_address16: + cmp [code_type],64 + je invalid_address + call store_instruction_code + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + jmp instruction_assembled + mov_mem_address64_al: + call store_segment_prefix_if_necessary + mov [base_code],0A2h + store_mov_address64: + call store_instruction_code + call store_address_64bit_value + jmp instruction_assembled + mov_mem_ax: + test ch,22h + jnz mov_mem_address16_ax + test ch,44h + jnz mov_mem_address32_ax + test ch,88h + jnz mov_mem_address64_ax + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_ax + cmp [code_type],32 + je mov_mem_address32_ax + cmp edx,10000h + jb mov_mem_address16_ax + mov_mem_address32_ax: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A3h + jmp store_mov_address32 + mov_mem_address16_ax: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A3h + jmp store_mov_address16 + mov_mem_address64_ax: + call store_segment_prefix_if_necessary + mov [base_code],0A3h + jmp store_mov_address64 + mov_mem_sreg: + sub al,61h + mov [postbyte_register],al + pop ecx ebx edx + mov ah,[operand_size] + or ah,ah + jz mov_mem_sreg_store + cmp ah,2 + jne invalid_operand_size + mov_mem_sreg_store: + mov [base_code],8Ch + jmp instruction_ready + mov_mem_imm: + mov al,[operand_size] + cmp al,1 + jb mov_mem_imm_nosize + je mov_mem_imm_8bit + cmp al,2 + je mov_mem_imm_16bit + cmp al,4 + je mov_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp mov_mem_imm_32bit_store + mov_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0C6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + mov_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + mov_mem_imm_nosize: + call recoverable_unknown_size + mov_mem_imm_32bit: + call operand_32bit + call get_dword_value + mov_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0C7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + mov_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_sreg + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_reg_mem + cmp al,'(' + je mov_reg_imm + cmp al,10h + jne invalid_operand + mov_reg_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_reg_sreg + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je mov_reg_reg_8bit + call operand_autodetect + inc [base_code] + mov_reg_reg_8bit: + jmp nomem_instruction_ready + mov_reg_sreg: + mov bl,[postbyte_register] + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,5 + je mov_reg_creg + cmp ah,7 + je mov_reg_dreg + ja mov_reg_treg + dec [postbyte_register] + cmp [operand_size],8 + je mov_reg_sreg64 + cmp [operand_size],4 + je mov_reg_sreg32 + cmp [operand_size],2 + jne invalid_operand_size + call operand_16bit + jmp mov_reg_sreg_store + mov_reg_sreg64: + call operand_64bit + jmp mov_reg_sreg_store + mov_reg_sreg32: + call operand_32bit + mov_reg_sreg_store: + mov [base_code],8Ch + jmp nomem_instruction_ready + mov_reg_treg: + cmp ah,9 + jne invalid_operand + mov [extended_code],24h + jmp mov_reg_xrx + mov_reg_dreg: + mov [extended_code],21h + jmp mov_reg_xrx + mov_reg_creg: + mov [extended_code],20h + mov_reg_xrx: + mov [base_code],0Fh + cmp [code_type],64 + je mov_reg_xrx_64bit + cmp [operand_size],4 + jne invalid_operand_size + cmp [postbyte_register],8 + jne mov_reg_xrx_store + cmp [extended_code],20h + jne mov_reg_xrx_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_reg_xrx_store: + jmp nomem_instruction_ready + mov_reg_xrx_64bit: + cmp [operand_size],8 + jne invalid_operand_size + jmp nomem_instruction_ready + mov_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je mov_reg_mem_8bit + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_ax_mem + add [base_code],3 + jmp instruction_ready + mov_reg_mem_8bit: + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_al_mem + add [base_code],2 + jmp instruction_ready + mov_al_mem: + test ch,22h + jnz mov_al_mem_address16 + test ch,44h + jnz mov_al_mem_address32 + test ch,88h + jnz mov_al_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_al_mem_address64 + cmp [code_type],32 + je mov_al_mem_address32 + cmp edx,10000h + jb mov_al_mem_address16 + mov_al_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A0h + jmp store_mov_address32 + mov_al_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A0h + jmp store_mov_address16 + mov_al_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A0h + jmp store_mov_address64 + mov_ax_mem: + test ch,22h + jnz mov_ax_mem_address16 + test ch,44h + jnz mov_ax_mem_address32 + test ch,88h + jnz mov_ax_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_ax_mem_address64 + cmp [code_type],32 + je mov_ax_mem_address32 + cmp edx,10000h + jb mov_ax_mem_address16 + mov_ax_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A1h + jmp store_mov_address32 + mov_ax_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A1h + jmp store_mov_address16 + mov_ax_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A1h + jmp store_mov_address64 + mov_reg_imm: + mov al,[operand_size] + cmp al,1 + je mov_reg_imm_8bit + cmp al,2 + je mov_reg_imm_16bit + cmp al,4 + je mov_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + mov_reg_imm_64bit: + call operand_64bit + call get_qword_value + mov ecx,edx + cmp [size_declared],0 + jne mov_reg_imm_64bit_store + cmp [value_type],4 + jae mov_reg_imm_64bit_store + cdq + cmp ecx,edx + je mov_reg_64bit_imm_32bit + mov_reg_imm_64bit_store: + push eax ecx + mov al,0B8h + call store_mov_reg_imm_code + pop edx eax + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + mov_reg_imm_8bit: + call get_byte_value + mov dl,al + mov al,0B0h + call store_mov_reg_imm_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + mov_reg_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + mov al,0B8h + call store_mov_reg_imm_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + mov_reg_imm_32bit: + call operand_32bit + call get_dword_value + mov edx,eax + mov al,0B8h + call store_mov_reg_imm_code + mov_store_imm_32bit: + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + store_mov_reg_imm_code: + mov ah,[postbyte_register] + test ah,1000b + jz mov_reg_imm_prefix_ok + or [rex_prefix],41h + mov_reg_imm_prefix_ok: + and ah,111b + add al,ah + mov [base_code],al + call store_instruction_code + ret + mov_reg_64bit_imm_32bit: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0C7h + call store_nomem_instruction + jmp mov_store_imm_32bit + mov_sreg: + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,5 + je mov_creg + cmp ah,7 + je mov_dreg + ja mov_treg + cmp al,2 + je illegal_instruction + dec [postbyte_register] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_sreg_mem + cmp al,10h + jne invalid_operand + mov_sreg_reg: + lods byte [esi] + call convert_register + or ah,ah + jz mov_sreg_reg_size_ok + cmp ah,2 + jne invalid_operand_size + mov bl,al + mov_sreg_reg_size_ok: + mov [base_code],8Eh + jmp nomem_instruction_ready + mov_sreg_mem: + call get_address + mov al,[operand_size] + or al,al + jz mov_sreg_mem_size_ok + cmp al,2 + jne invalid_operand_size + mov_sreg_mem_size_ok: + mov [base_code],8Eh + jmp instruction_ready + mov_treg: + cmp ah,9 + jne invalid_operand + mov [extended_code],26h + jmp mov_xrx + mov_dreg: + mov [extended_code],23h + jmp mov_xrx + mov_creg: + mov [extended_code],22h + mov_xrx: + mov [base_code],0Fh + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + cmp [code_type],64 + je mov_xrx_64bit + cmp ah,4 + jne invalid_operand_size + cmp [postbyte_register],8 + jne mov_xrx_store + cmp [extended_code],22h + jne mov_xrx_store + mov al,0F0h + stos byte [edi] + mov [postbyte_register],0 + mov_xrx_store: + jmp nomem_instruction_ready + mov_xrx_64bit: + cmp ah,8 + je mov_xrx_store + jmp invalid_operand_size +test_instruction: + mov [base_code],84h + lods byte [esi] + call get_size_operator + cmp al,10h + je test_reg + cmp al,'[' + jne invalid_operand + test_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je test_mem_imm + cmp al,10h + jne invalid_operand + test_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je test_mem_reg_8bit + call operand_autodetect + inc [base_code] + test_mem_reg_8bit: + jmp instruction_ready + test_mem_imm: + mov al,[operand_size] + cmp al,1 + jb test_mem_imm_nosize + je test_mem_imm_8bit + cmp al,2 + je test_mem_imm_16bit + cmp al,4 + je test_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + test_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_mem_imm_32bit_store + test_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0F6h + pop ecx ebx edx + call store_instruction_with_imm8 + jmp instruction_assembled + test_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm16 + jmp instruction_assembled + test_mem_imm_nosize: + call recoverable_unknown_size + test_mem_imm_32bit: + call operand_32bit + call get_dword_value + test_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0F7h + pop ecx ebx edx + call store_instruction_with_imm32 + jmp instruction_assembled + test_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,'(' + je test_reg_imm + cmp al,10h + jne invalid_operand + test_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je test_reg_reg_8bit + call operand_autodetect + inc [base_code] + test_reg_reg_8bit: + jmp nomem_instruction_ready + test_reg_imm: + mov al,[operand_size] + cmp al,1 + je test_reg_imm_8bit + cmp al,2 + je test_reg_imm_16bit + cmp al,4 + je test_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + test_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_reg_imm_32bit_store + test_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F6h + or bl,bl + jz test_al_imm + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_al_imm: + mov [base_code],0A8h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_ax_imm + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + test_ax_imm: + mov [base_code],0A9h + call store_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + test_reg_imm_32bit: + call operand_32bit + call get_dword_value + test_reg_imm_32bit_store: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_eax_imm + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + test_eax_imm: + mov [base_code],0A9h + call store_instruction_code + mov eax,edx + stos dword [edi] + jmp instruction_assembled + test_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je test_reg_mem_8bit + call operand_autodetect + inc [base_code] + test_reg_mem_8bit: + jmp instruction_ready +xchg_instruction: + mov [base_code],86h + lods byte [esi] + call get_size_operator + cmp al,10h + je xchg_reg + cmp al,'[' + jne invalid_operand + xchg_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je test_mem_reg + jmp invalid_operand + xchg_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,10h + jne invalid_operand + xchg_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je xchg_reg_reg_8bit + call operand_autodetect + cmp [postbyte_register],0 + je xchg_ax_reg + or bl,bl + jnz xchg_reg_reg_store + mov bl,[postbyte_register] + xchg_ax_reg: + cmp [code_type],64 + jne xchg_ax_reg_ok + cmp ah,4 + jne xchg_ax_reg_ok + or bl,bl + jz xchg_reg_reg_store + xchg_ax_reg_ok: + test bl,1000b + jz xchg_ax_reg_store + or [rex_prefix],41h + and bl,111b + xchg_ax_reg_store: + add bl,90h + mov [base_code],bl + call store_instruction_code + jmp instruction_assembled + xchg_reg_reg_store: + inc [base_code] + xchg_reg_reg_8bit: + jmp nomem_instruction_ready +push_instruction: + mov [push_size],al + push_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je push_reg + cmp al,'(' + je push_imm + cmp al,'[' + jne invalid_operand + push_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je push_mem_16bit + cmp al,4 + je push_mem_32bit + cmp al,8 + je push_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je push_mem_16bit + cmp ah,4 + je push_mem_32bit + cmp ah,8 + je push_mem_64bit + call recoverable_unknown_size + jmp push_mem_store + push_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_mem_store + push_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_mem_store + push_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_mem_store: + mov [base_code],0FFh + mov [postbyte_register],110b + call store_instruction + jmp push_done + push_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz push_sreg + call convert_register + test al,1000b + jz push_reg_ok + or [rex_prefix],41h + and al,111b + push_reg_ok: + add al,50h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je push_reg_16bit + cmp al,4 + je push_reg_32bit + cmp al,8 + jne invalid_operand_size + push_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp push_reg_store + push_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_reg_store + push_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + push_reg_store: + call store_instruction_code + jmp push_done + push_sreg: + mov bl,al + mov dl,[operand_size] + mov dh,[push_size] + cmp dl,2 + je push_sreg16 + cmp dl,4 + je push_sreg32 + cmp dl,8 + je push_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je push_sreg16 + cmp dh,4 + je push_sreg32 + cmp dh,8 + je push_sreg64 + jmp push_sreg_store + push_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_sreg_store + push_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_sreg_store + push_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_sreg_store: + mov al,bl + cmp al,70h + jae invalid_operand + sub al,61h + jc invalid_operand + cmp al,4 + jae push_sreg_386 + shl al,3 + add al,6 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp push_reg_store + push_sreg_386: + sub al,4 + shl al,3 + add al,0A0h + mov [extended_code],al + mov [base_code],0Fh + jmp push_reg_store + push_imm: + mov al,[operand_size] + mov ah,[push_size] + or al,al + je push_imm_size_ok + or ah,ah + je push_imm_size_ok + cmp al,ah + jne invalid_operand_size + push_imm_size_ok: + cmp al,2 + je push_imm_16bit + cmp al,4 + je push_imm_32bit + cmp al,8 + je push_imm_64bit + cmp ah,2 + je push_imm_optimized_16bit + cmp ah,4 + je push_imm_optimized_32bit + cmp ah,8 + je push_imm_optimized_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je push_imm_optimized_16bit + cmp [code_type],32 + je push_imm_optimized_32bit + push_imm_optimized_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_16bit: + call get_word_value + mov dx,ax + call operand_16bit + cmp [value_type],0 + jne push_imm_16bit_store + cmp ax,-80h + jl push_imm_16bit_store + cmp ax,80h + jge push_imm_16bit_store + push_imm_8bit: + mov ah,al + mov [base_code],6Ah + call store_instruction_code + mov al,ah + stos byte [edi] + jmp push_done + push_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + push_imm_16bit_store: + mov [base_code],68h + call store_instruction_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp push_done + push_imm_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + jmp push_imm_32bit_store + push_imm_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + push_imm_32bit_store: + mov [base_code],68h + call store_instruction_code + mov eax,edx + call mark_relocation + stos dword [edi] + push_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled + mov [operand_size],0 + mov [size_override],0 + mov [operand_prefix],0 + mov [rex_prefix],0 + jmp push_next +pop_instruction: + mov [push_size],al + pop_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je pop_reg + cmp al,'[' + jne invalid_operand + pop_mem: + call get_address + mov al,[operand_size] + mov ah,[push_size] + cmp al,2 + je pop_mem_16bit + cmp al,4 + je pop_mem_32bit + cmp al,8 + je pop_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je pop_mem_16bit + cmp ah,4 + je pop_mem_32bit + cmp ah,8 + je pop_mem_64bit + call recoverable_unknown_size + jmp pop_mem_store + pop_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_mem_store + pop_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_mem_store + pop_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_mem_store: + mov [base_code],08Fh + mov [postbyte_register],0 + call store_instruction + jmp pop_done + pop_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz pop_sreg + call convert_register + test al,1000b + jz pop_reg_ok + or [rex_prefix],41h + and al,111b + pop_reg_ok: + add al,58h + mov [base_code],al + mov al,ah + mov ah,[push_size] + cmp al,2 + je pop_reg_16bit + cmp al,4 + je pop_reg_32bit + cmp al,8 + je pop_reg_64bit + jmp invalid_operand_size + pop_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp pop_reg_store + pop_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_reg_store + pop_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + pop_reg_store: + call store_instruction_code + pop_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled + mov [operand_size],0 + mov [size_override],0 + mov [operand_prefix],0 + mov [rex_prefix],0 + jmp pop_next + pop_sreg: + mov dl,[operand_size] + mov dh,[push_size] + cmp al,62h + je pop_cs + mov bl,al + cmp dl,2 + je pop_sreg16 + cmp dl,4 + je pop_sreg32 + cmp dl,8 + je pop_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_sreg16 + cmp dh,4 + je pop_sreg32 + cmp dh,8 + je pop_sreg64 + jmp pop_sreg_store + pop_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_sreg_store + pop_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_sreg_store + pop_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_sreg_store: + mov al,bl + cmp al,70h + jae invalid_operand + sub al,61h + jc invalid_operand + cmp al,4 + jae pop_sreg_386 + shl al,3 + add al,7 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp pop_reg_store + pop_cs: + cmp [code_type],16 + jne illegal_instruction + cmp dl,2 + je pop_cs_store + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_cs_store + or dh,dh + jnz illegal_instruction + pop_cs_store: + test dh,not 2 + jnz invalid_operand_size + mov al,0Fh + stos byte [edi] + jmp pop_done + pop_sreg_386: + sub al,4 + shl al,3 + add al,0A1h + mov [extended_code],al + mov [base_code],0Fh + jmp pop_reg_store +inc_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je inc_reg + cmp al,'[' + je inc_mem + jne invalid_operand + inc_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je inc_mem_8bit + jb inc_mem_nosize + call operand_autodetect + mov al,0FFh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_mem_nosize: + call recoverable_unknown_size + inc_mem_8bit: + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + jmp instruction_ready + inc_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je inc_reg_8bit + call operand_autodetect + cmp [code_type],64 + je inc_reg_long_form + mov al,[postbyte_register] + shl al,3 + add al,bl + add al,40h + mov [base_code],al + call store_instruction_code + jmp instruction_assembled + inc_reg_long_form: + inc [base_code] + inc_reg_8bit: + jmp nomem_instruction_ready +set_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je set_reg + cmp al,'[' + jne invalid_operand + set_mem: + call get_address + cmp [operand_size],1 + ja invalid_operand_size + mov [postbyte_register],0 + jmp instruction_ready + set_reg: + lods byte [esi] + call convert_register + cmp ah,1 + jne invalid_operand_size + mov bl,al + mov [postbyte_register],0 + jmp nomem_instruction_ready +arpl_instruction: + cmp [code_type],64 + je illegal_instruction + mov [base_code],63h + lods byte [esi] + call get_size_operator + cmp al,10h + je arpl_reg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,2 + jne invalid_operand_size + jmp instruction_ready + arpl_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + jmp nomem_instruction_ready +bound_instruction: + cmp [code_type],64 + je illegal_instruction + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je bound_store + cmp al,4 + jne invalid_operand_size + bound_store: + call operand_autodetect + mov [base_code],62h + jmp instruction_ready +enter_instruction: + lods byte [esi] + call get_size_operator + cmp ah,2 + je enter_imm16_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm16_size_ok: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne enter_imm16_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + enter_imm16_ok: + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp ah,1 + je enter_imm8_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm8_size_ok: + cmp al,'(' + jne invalid_operand + call get_byte_value + cmp [next_pass_needed],0 + jne enter_imm8_ok + test eax,eax + js value_out_of_range + enter_imm8_ok: + mov dl,al + pop ebx + mov al,0C8h + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +ret_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp ret_instruction +ret_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +ret_instruction_32bit: + call operand_32bit + jmp ret_instruction +ret_instruction_16bit: + call operand_16bit + jmp ret_instruction +retf_instruction: + cmp [code_type],64 + jne ret_instruction +ret_instruction_64bit: + call operand_64bit +ret_instruction: + mov [base_code],al + lods byte [esi] + dec esi + or al,al + jz simple_ret + cmp al,0Fh + je simple_ret + lods byte [esi] + call get_size_operator + or ah,ah + jz ret_imm + cmp ah,2 + je ret_imm + jmp invalid_operand_size + ret_imm: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne ret_imm_ok + cmp [value_type],0 + jne invalid_use_of_symbol + test eax,eax + js value_out_of_range + ret_imm_ok: + cmp [size_declared],0 + jne ret_imm_store + or ax,ax + jz simple_ret + ret_imm_store: + mov dx,ax + call store_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + simple_ret: + inc [base_code] + call store_instruction_code + jmp instruction_assembled +lea_instruction: + mov [base_code],8Dh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + mov [size_override],-1 + call get_address + pop eax + mov [operand_size],al + call operand_autodetect + jmp instruction_ready +ls_instruction: + or al,al + jz les_instruction + cmp al,3 + jz lds_instruction + add al,0B0h + mov [extended_code],al + mov [base_code],0Fh + jmp ls_code_ok + les_instruction: + mov [base_code],0C4h + jmp ls_short_code + lds_instruction: + mov [base_code],0C5h + ls_short_code: + cmp [code_type],64 + je illegal_instruction + ls_code_ok: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + add [operand_size],2 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je ls_16bit + cmp al,6 + je ls_32bit + cmp al,10 + je ls_64bit + jmp invalid_operand_size + ls_16bit: + call operand_16bit + jmp instruction_ready + ls_32bit: + call operand_32bit + jmp instruction_ready + ls_64bit: + call operand_64bit + jmp instruction_ready +sh_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je sh_reg + cmp al,'[' + jne invalid_operand + sh_mem: + call get_address + push edx ebx ecx + mov al,[operand_size] + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_mem_imm + cmp al,10h + jne invalid_operand + sh_mem_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + cmp al,1 + je sh_mem_cl_8bit + jb sh_mem_cl_nosize + call operand_autodetect + mov [base_code],0D3h + jmp instruction_ready + sh_mem_cl_nosize: + call recoverable_unknown_size + sh_mem_cl_8bit: + mov [base_code],0D2h + jmp instruction_ready + sh_mem_imm: + mov al,[operand_size] + or al,al + jz sh_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + cmp al,1 + je sh_mem_imm_8bit + jb sh_mem_imm_nosize + call operand_autodetect + cmp byte [value],1 + je sh_mem_1 + mov [base_code],0C1h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1: + mov [base_code],0D1h + jmp instruction_ready + sh_mem_imm_nosize: + call recoverable_unknown_size + sh_mem_imm_8bit: + cmp byte [value],1 + je sh_mem_1_8bit + mov [base_code],0C0h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1_8bit: + mov [base_code],0D0h + jmp instruction_ready + sh_reg: + lods byte [esi] + call convert_register + mov bx,ax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_reg_imm + cmp al,10h + jne invalid_operand + sh_reg_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + mov al,bh + cmp al,1 + je sh_reg_cl_8bit + call operand_autodetect + mov [base_code],0D3h + jmp nomem_instruction_ready + sh_reg_cl_8bit: + mov [base_code],0D2h + jmp nomem_instruction_ready + sh_reg_imm: + mov al,[operand_size] + or al,al + jz sh_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_reg_imm_size_ok: + push ebx + call get_byte_value + mov dl,al + pop ebx + mov al,bh + cmp al,1 + je sh_reg_imm_8bit + call operand_autodetect + cmp dl,1 + je sh_reg_1 + mov [base_code],0C1h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1: + mov [base_code],0D1h + jmp nomem_instruction_ready + sh_reg_imm_8bit: + cmp dl,1 + je sh_reg_1_8bit + mov [base_code],0C0h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1_8bit: + mov [base_code],0D0h + jmp nomem_instruction_ready +shd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je shd_reg + cmp al,'[' + jne invalid_operand + shd_mem: + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + mov [operand_size],0 + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_mem_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax ecx ebx edx + call operand_autodetect + inc [extended_code] + jmp instruction_ready + shd_mem_reg_imm: + mov al,[operand_size] + or al,al + jz shd_mem_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_mem_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax ecx ebx edx + call operand_autodetect + call store_instruction_with_imm8 + jmp instruction_assembled + shd_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_reg_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop ebx eax + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready + shd_reg_reg_imm: + mov al,[operand_size] + or al,al + jz shd_reg_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_reg_reg_imm_size_ok: + call get_byte_value + mov dl,al + pop ebx eax + call operand_autodetect + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +movx_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov al,ah + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movx_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov ah,[operand_size] + or ah,ah + jz movx_unknown_size + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_mem_store + cmp ah,2 + jne invalid_operand_size + inc [extended_code] + movx_mem_store: + call operand_autodetect + jmp instruction_ready + movx_unknown_size: + call recoverable_unknown_size + jmp movx_mem_store + movx_reg: + lods byte [esi] + call convert_register + pop ebx + xchg bl,al + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_reg_8bit + cmp ah,2 + je movx_reg_16bit + jmp invalid_operand_size + movx_reg_8bit: + call operand_autodetect + jmp nomem_instruction_ready + movx_reg_16bit: + call operand_autodetect + inc [extended_code] + jmp nomem_instruction_ready +movsxd_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,8 + jne invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movsxd_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je movsxd_mem_store + cmp [operand_size],0 + jne invalid_operand_size + movsxd_mem_store: + call operand_64bit + jmp instruction_ready + movsxd_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + call operand_64bit + jmp nomem_instruction_ready +bt_instruction: + mov [postbyte_register],al + shl al,3 + add al,83h + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je bt_reg + cmp al,'[' + jne invalid_operand + call get_address + push eax ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_mem_imm + cmp byte [esi],11h + jne bt_mem_reg + cmp byte [esi+2],'(' + je bt_mem_imm + bt_mem_reg: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + call operand_autodetect + jmp instruction_ready + bt_mem_imm: + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax + or al,al + jz bt_mem_imm_nosize + call operand_autodetect + bt_mem_imm_store: + pop ecx ebx edx + mov [extended_code],0BAh + call store_instruction_with_imm8 + jmp instruction_assembled + bt_mem_imm_nosize: + call recoverable_unknown_size + jmp bt_mem_imm_store + bt_reg: + lods byte [esi] + call convert_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_reg_imm + cmp byte [esi],11h + jne bt_reg_reg + cmp byte [esi+2],'(' + je bt_reg_imm + bt_reg_reg: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + bt_reg_imm: + xor al,al + xchg al,[operand_size] + push eax ebx + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop ebx eax + call operand_autodetect + bt_reg_imm_store: + mov [extended_code],0BAh + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +bs_instruction: + mov [extended_code],al + mov [base_code],0Fh + call get_reg_mem + jc bs_reg_reg + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + bs_reg_reg: + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + get_reg_mem: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je get_reg_reg + cmp al,'[' + jne invalid_argument + call get_address + clc + ret + get_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + stc + ret + +imul_instruction: + mov [base_code],0F6h + mov [postbyte_register],5 + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg + cmp al,'[' + jne invalid_operand + imul_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je imul_mem_8bit + jb imul_mem_nosize + call operand_autodetect + inc [base_code] + jmp instruction_ready + imul_mem_nosize: + call recoverable_unknown_size + imul_mem_8bit: + jmp instruction_ready + imul_reg: + lods byte [esi] + call convert_register + cmp byte [esi],',' + je imul_reg_ + mov bl,al + mov al,ah + cmp al,1 + je imul_reg_8bit + call operand_autodetect + inc [base_code] + imul_reg_8bit: + jmp nomem_instruction_ready + imul_reg_: + mov [postbyte_register],al + inc esi + cmp byte [esi],'(' + je imul_reg_imm + cmp byte [esi],11h + jne imul_reg_noimm + cmp byte [esi+2],'(' + je imul_reg_imm + imul_reg_noimm: + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg_reg + cmp al,'[' + jne invalid_operand + imul_reg_mem: + call get_address + push edx ebx ecx + cmp byte [esi],',' + je imul_reg_mem_imm + mov al,[operand_size] + call operand_autodetect + pop ecx ebx edx + mov [base_code],0Fh + mov [extended_code],0AFh + jmp instruction_ready + imul_reg_mem_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_mem_imm_16bit + cmp al,4 + je imul_reg_mem_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_mem_imm_32bit_ok + imul_reg_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + cmp [value_type],0 + jne imul_reg_mem_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_16bit_store + cmp ax,-80h + jl imul_reg_mem_imm_16bit_store + cmp ax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_16bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm16 + jmp instruction_assembled + imul_reg_mem_imm_32bit: + call operand_32bit + call get_dword_value + imul_reg_mem_imm_32bit_ok: + mov dword [value],eax + cmp [value_type],0 + jne imul_reg_mem_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_32bit_store + cmp eax,-80h + jl imul_reg_mem_imm_32bit_store + cmp eax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_32bit_store: + pop ecx ebx edx + mov [base_code],69h + call store_instruction_with_imm32 + jmp instruction_assembled + imul_reg_mem_imm_8bit_store: + pop ecx ebx edx + mov [base_code],6Bh + call store_instruction_with_imm8 + jmp instruction_assembled + imul_reg_imm: + mov bl,[postbyte_register] + dec esi + jmp imul_reg_reg_imm + imul_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp byte [esi],',' + je imul_reg_reg_imm + mov al,ah + call operand_autodetect + mov [base_code],0Fh + mov [extended_code],0AFh + jmp nomem_instruction_ready + imul_reg_reg_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_reg_imm_16bit + cmp al,4 + je imul_reg_reg_imm_32bit + cmp al,8 + jne invalid_operand_size + imul_reg_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + push ebx + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_reg_imm_32bit_ok + imul_reg_reg_imm_16bit: + call operand_16bit + push ebx + call get_word_value + pop ebx + mov dx,ax + cmp [value_type],0 + jne imul_reg_reg_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_16bit_store + cmp ax,-80h + jl imul_reg_reg_imm_16bit_store + cmp ax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_16bit_store: + mov [base_code],69h + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + imul_reg_reg_imm_32bit: + call operand_32bit + push ebx + call get_dword_value + imul_reg_reg_imm_32bit_ok: + pop ebx + mov edx,eax + cmp [value_type],0 + jne imul_reg_reg_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_32bit_store + cmp eax,-80h + jl imul_reg_reg_imm_32bit_store + cmp eax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_32bit_store: + mov [base_code],69h + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + imul_reg_reg_imm_8bit_store: + mov [base_code],6Bh + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +in_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + push eax + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je in_imm + cmp al,10h + je in_reg + jmp invalid_operand + in_reg: + lods byte [esi] + cmp al,22h + jne invalid_operand + pop eax + cmp al,1 + je in_al_dx + cmp al,2 + je in_ax_dx + cmp al,4 + jne invalid_operand_size + in_ax_dx: + call operand_autodetect + mov [base_code],0EDh + call store_instruction_code + jmp instruction_assembled + in_al_dx: + mov al,0ECh + stos byte [edi] + jmp instruction_assembled + in_imm: + mov al,[operand_size] + or al,al + jz in_imm_size_ok + cmp al,1 + jne invalid_operand_size + in_imm_size_ok: + call get_byte_value + mov dl,al + pop eax + cmp al,1 + je in_al_imm + cmp al,2 + je in_ax_imm + cmp al,4 + jne invalid_operand_size + in_ax_imm: + call operand_autodetect + mov [base_code],0E5h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + in_al_imm: + mov al,0E4h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +out_instruction: + lods byte [esi] + call get_size_operator + cmp al,'(' + je out_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_dx_al + cmp al,2 + je out_dx_ax + cmp al,4 + jne invalid_operand_size + out_dx_ax: + call operand_autodetect + mov [base_code],0EFh + call store_instruction_code + jmp instruction_assembled + out_dx_al: + mov al,0EEh + stos byte [edi] + jmp instruction_assembled + out_imm: + mov al,[operand_size] + or al,al + jz out_imm_size_ok + cmp al,1 + jne invalid_operand_size + out_imm_size_ok: + call get_byte_value + mov dl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_imm_al + cmp al,2 + je out_imm_ax + cmp al,4 + jne invalid_operand_size + out_imm_ax: + call operand_autodetect + mov [base_code],0E7h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + out_imm_al: + mov al,0E6h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + +call_instruction: + mov [postbyte_register],10b + mov [base_code],0E8h + mov [extended_code],9Ah + jmp process_jmp +jmp_instruction: + mov [postbyte_register],100b + mov [base_code],0E9h + mov [extended_code],0EAh + process_jmp: + lods byte [esi] + call get_jump_operator + call get_size_operator + cmp al,'(' + je jmp_imm + mov [base_code],0FFh + cmp al,10h + je jmp_reg + cmp al,'[' + jne invalid_operand + jmp_mem: + cmp [jump_type],1 + je illegal_instruction + call get_address + mov edx,eax + mov al,[operand_size] + or al,al + jz jmp_mem_size_not_specified + cmp al,2 + je jmp_mem_16bit + cmp al,4 + je jmp_mem_32bit + cmp al,6 + je jmp_mem_48bit + cmp al,8 + je jmp_mem_64bit + cmp al,10 + je jmp_mem_80bit + jmp invalid_operand_size + jmp_mem_size_not_specified: + cmp [jump_type],3 + je jmp_mem_far + cmp [jump_type],2 + je jmp_mem_near + call recoverable_unknown_size + jmp_mem_near: + cmp [code_type],16 + je jmp_mem_16bit + cmp [code_type],32 + je jmp_mem_near_32bit + jmp_mem_64bit: + cmp [jump_type],3 + je invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp instruction_ready + jmp_mem_far: + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_48bit: + call operand_32bit + jmp_mem_far_store: + cmp [jump_type],2 + je invalid_operand_size + inc [postbyte_register] + jmp instruction_ready + jmp_mem_80bit: + call operand_64bit + jmp jmp_mem_far_store + jmp_mem_far_32bit: + call operand_16bit + jmp jmp_mem_far_store + jmp_mem_32bit: + cmp [jump_type],3 + je jmp_mem_far_32bit + cmp [jump_type],2 + je jmp_mem_near_32bit + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_near_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp instruction_ready + jmp_mem_16bit: + cmp [jump_type],3 + je invalid_operand_size + call operand_16bit + jmp instruction_ready + jmp_reg: + test [jump_type],1 + jnz invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,2 + je jmp_reg_16bit + cmp al,4 + je jmp_reg_32bit + cmp al,8 + jne invalid_operand_size + jmp_reg_64bit: + cmp [code_type],64 + jne illegal_instruction + jmp nomem_instruction_ready + jmp_reg_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp nomem_instruction_ready + jmp_reg_16bit: + call operand_16bit + jmp nomem_instruction_ready + jmp_imm: + cmp byte [esi],'.' + je invalid_value + mov ebx,esi + dec esi + call skip_symbol + xchg esi,ebx + cmp byte [ebx],':' + je jmp_far + cmp [jump_type],3 + je invalid_operand + jmp_near: + mov al,[operand_size] + cmp al,2 + je jmp_imm_16bit + cmp al,4 + je jmp_imm_32bit + cmp al,8 + je jmp_imm_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je jmp_imm_16bit + cmp [code_type],64 + je jmp_imm_64bit + jmp_imm_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne jmp_imm_32bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc jmp_short + jmp_imm_32bit_store: + mov edx,eax + sub edx,3 + jno jmp_imm_32bit_ok + cmp [code_type],64 + je relative_jump_out_of_range + jmp_imm_32bit_ok: + mov al,[base_code] + stos byte [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + jmp_imm_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne relative_jump_out_of_range + call check_for_short_jump + jnc jmp_imm_32bit_store + jmp_short: + mov ah,al + mov al,0EBh + stos word [edi] + jmp instruction_assembled + jmp_imm_16bit: + call get_address_word_value + cmp [code_type],16 + je jmp_imm_16bit_prefix_ok + mov byte [edi],66h + inc edi + jmp_imm_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc jmp_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + dec edx + mov al,[base_code] + stos byte [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled + calculate_jump_offset: + add edi,2 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,2 + ret + check_for_short_jump: + cmp [jump_type],1 + je forced_short + ja no_short_jump + cmp [base_code],0E8h + je no_short_jump + cmp [value_type],0 + jne no_short_jump + cmp eax,80h + jb short_jump + cmp eax,-80h + jae short_jump + no_short_jump: + clc + ret + forced_short: + cmp [base_code],0E8h + je illegal_instruction + cmp [next_pass_needed],0 + jne jmp_short_value_type_ok + cmp [value_type],0 + jne invalid_use_of_symbol + jmp_short_value_type_ok: + cmp eax,-80h + jae short_jump + cmp eax,80h + jae jump_out_of_range + short_jump: + stc + ret + jump_out_of_range: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],relative_jump_out_of_range + jmp instruction_assembled + jmp_far: + cmp [jump_type],2 + je invalid_operand + cmp [code_type],64 + je illegal_instruction + mov al,[extended_code] + mov [base_code],al + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax [symbol_identifier] + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,4 + je jmp_far_16bit + cmp al,6 + je jmp_far_32bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + jne jmp_far_32bit + jmp_far_16bit: + call get_word_value + mov ebx,eax + call operand_16bit + call store_instruction_code + mov ax,bx + call mark_relocation + stos word [edi] + jmp_far_segment: + pop [symbol_identifier] eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + jmp instruction_assembled + jmp_far_32bit: + call get_dword_value + mov ebx,eax + call operand_32bit + call store_instruction_code + mov eax,ebx + call mark_relocation + stos dword [edi] + jmp jmp_far_segment +conditional_jump: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],3 + je invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je conditional_jump_16bit + cmp al,4 + je conditional_jump_32bit + cmp al,8 + je conditional_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je conditional_jump_16bit + cmp [code_type],64 + je conditional_jump_64bit + conditional_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne conditional_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_32bit_prefix_ok: + call calculate_jump_offset + cdq + call check_for_short_jump + jc conditional_jump_short + conditional_jump_32bit_store: + mov edx,eax + sub edx,4 + jno conditional_jump_32bit_range_ok + cmp [code_type],64 + je relative_jump_out_of_range + conditional_jump_32bit_range_ok: + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + conditional_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne relative_jump_out_of_range + call check_for_short_jump + jnc conditional_jump_32bit_store + conditional_jump_short: + mov ah,al + mov al,[base_code] + stos word [edi] + jmp instruction_assembled + conditional_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je conditional_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + conditional_jump_16bit_prefix_ok: + call calculate_jump_offset + cwde + cdq + call check_for_short_jump + jc conditional_jump_short + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + sub dx,2 + mov ah,[base_code] + add ah,10h + mov al,0Fh + stos word [edi] + mov eax,edx + stos word [edi] + jmp instruction_assembled +loop_instruction_16bit: + cmp [code_type],64 + je illegal_instruction + cmp [code_type],16 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_32bit: + cmp [code_type],32 + je loop_instruction + mov [operand_prefix],67h + jmp loop_instruction +loop_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction +loop_instruction: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],1 + ja invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,2 + je loop_jump_16bit + cmp al,4 + je loop_jump_32bit + cmp al,8 + je loop_jump_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je loop_jump_16bit + cmp [code_type],64 + je loop_jump_64bit + loop_jump_32bit: + cmp [code_type],64 + je invalid_operand_size + call get_address_dword_value + cmp [code_type],16 + jne loop_jump_32bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_32bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cdq + make_loop_jump: + call check_for_short_jump + jc conditional_jump_short + scas word [edi] + jmp jump_out_of_range + loop_counter_size: + cmp [operand_prefix],0 + je loop_counter_size_ok + push eax + mov al,[operand_prefix] + stos byte [edi] + pop eax + loop_counter_size_ok: + ret + loop_jump_64bit: + cmp [code_type],64 + jne invalid_operand_size + call get_address_qword_value + call loop_counter_size + call calculate_jump_offset + mov ecx,edx + cdq + cmp edx,ecx + jne relative_jump_out_of_range + jmp make_loop_jump + loop_jump_16bit: + call get_address_word_value + cmp [code_type],16 + je loop_jump_16bit_prefix_ok + mov byte [edi],66h + inc edi + loop_jump_16bit_prefix_ok: + call loop_counter_size + call calculate_jump_offset + cwde + cdq + jmp make_loop_jump + +movs_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp [segment_register],1 + ja invalid_address + push ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop edx + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,6 + jne invalid_address + cmp dh,7 + jne invalid_address + cmp al,2 + je movs_address_16bit + cmp al,4 + je movs_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp movs_store + movs_address_32bit: + call address_32bit_prefix + jmp movs_store + movs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + movs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A4h + movs_check_size: + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jnz invalid_operand_size + call recoverable_unknown_size + jmp simple_instruction +lods_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je lods_address_16bit + cmp bh,46h + je lods_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp lods_store + lods_address_32bit: + call address_32bit_prefix + jmp lods_store + lods_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + lods_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0ACh + jmp movs_check_size +stos_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je stos_address_16bit + cmp bh,47h + je stos_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp stos_store + stos_address_32bit: + call address_32bit_prefix + jmp stos_store + stos_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + stos_store: + cmp [segment_register],1 + ja invalid_address + mov al,[base_code] + jmp movs_check_size +cmps_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,[segment_register] + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + pop edx eax + cmp [segment_register],1 + ja invalid_address + mov [segment_register],al + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,7 + jne invalid_address + cmp dh,6 + jne invalid_address + cmp al,2 + je cmps_address_16bit + cmp al,4 + je cmps_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp cmps_store + cmps_address_32bit: + call address_32bit_prefix + jmp cmps_store + cmps_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + cmps_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,0A6h + jmp movs_check_size +ins_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je ins_address_16bit + cmp bh,47h + je ins_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp ins_store + ins_address_32bit: + call address_32bit_prefix + jmp ins_store + ins_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + ins_store: + cmp [segment_register],1 + ja invalid_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + mov al,6Ch + ins_check_size: + cmp [operand_size],8 + jne movs_check_size + jmp invalid_operand_size +outs_instruction: + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je outs_address_16bit + cmp bh,46h + je outs_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp outs_store + outs_address_32bit: + call address_32bit_prefix + jmp outs_store + outs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + outs_store: + xor ebx,ebx + call store_segment_prefix_if_necessary + mov al,6Eh + jmp ins_check_size +xlat_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,23h + je xlat_address_16bit + cmp bh,43h + je xlat_address_32bit + cmp bh,83h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp xlat_store + xlat_address_32bit: + call address_32bit_prefix + jmp xlat_store + xlat_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + xlat_store: + call store_segment_prefix_if_necessary + mov al,0D7h + cmp [operand_size],1 + jbe simple_instruction + jmp invalid_operand_size + +pm_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je pm_reg + pm_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je pm_mem_store + or al,al + jnz invalid_operand_size + pm_mem_store: + jmp instruction_ready + pm_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp ah,2 + jne invalid_operand_size + jmp nomem_instruction_ready +pm_store_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne pm_mem + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +lgdt_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,6 + je lgdt_mem_48bit + cmp al,10 + je lgdt_mem_80bit + or al,al + jnz invalid_operand_size + jmp lgdt_mem_store + lgdt_mem_80bit: + cmp [code_type],64 + jne illegal_instruction + jmp lgdt_mem_store + lgdt_mem_48bit: + cmp [code_type],64 + je illegal_instruction + cmp [postbyte_register],2 + jb lgdt_mem_store + call operand_32bit + lgdt_mem_store: + jmp instruction_ready +lar_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + call operand_autodetect + lods byte [esi] + call get_size_operator + cmp al,10h + je lar_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz lar_reg_mem + cmp al,2 + jne invalid_operand_size + lar_reg_mem: + jmp instruction_ready + lar_reg_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +invlpg_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready +swapgs_instruction: + cmp [code_type],64 + jne illegal_instruction +rdtscp_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + mov bl,al + jmp nomem_instruction_ready + +basic_486_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_486_reg + cmp al,'[' + jne invalid_operand + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,ah + cmp al,1 + je basic_486_mem_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_mem_reg_8bit: + jmp instruction_ready + basic_486_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je basic_486_reg_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_reg_reg_8bit: + jmp nomem_instruction_ready +bswap_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + test al,1000b + jz bswap_reg_code_ok + or [rex_prefix],41h + and al,111b + bswap_reg_code_ok: + add al,0C8h + mov [extended_code],al + mov [base_code],0Fh + cmp ah,8 + je bswap_reg64 + cmp ah,4 + jne invalid_operand_size + call operand_32bit + call store_instruction_code + jmp instruction_assembled + bswap_reg64: + call operand_64bit + call store_instruction_code + jmp instruction_assembled +cmpxchgx_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,1 + xchg [postbyte_register],ah + mov al,[operand_size] + or al,al + jz cmpxchgx_size_ok + cmp al,ah + jne invalid_operand_size + cmpxchgx_size_ok: + cmp ah,16 + jne cmpxchgx_store + call operand_64bit + cmpxchgx_store: + jmp instruction_ready +nop_instruction: + mov ah,[esi] + cmp ah,10h + je extended_nop + cmp ah,11h + je extended_nop + cmp ah,'[' + je extended_nop + stos byte [edi] + jmp instruction_assembled + extended_nop: + mov [base_code],0Fh + mov [extended_code],1Fh + mov [postbyte_register],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je extended_nop_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz extended_nop_store + call operand_autodetect + extended_nop_store: + jmp instruction_ready + extended_nop_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready + +basic_fpu_instruction: + mov [postbyte_register],al + mov [base_code],0D8h + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_fpu_streg + cmp al,'[' + je basic_fpu_mem + dec esi + mov ah,[postbyte_register] + cmp ah,2 + jb invalid_operand + cmp ah,3 + ja invalid_operand + mov bl,1 + jmp nomem_instruction_ready + basic_fpu_mem: + call get_address + mov al,[operand_size] + cmp al,4 + je basic_fpu_mem_32bit + cmp al,8 + je basic_fpu_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + basic_fpu_mem_32bit: + jmp instruction_ready + basic_fpu_mem_64bit: + mov [base_code],0DCh + jmp instruction_ready + basic_fpu_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + mov ah,[postbyte_register] + cmp ah,2 + je basic_fpu_single_streg + cmp ah,3 + je basic_fpu_single_streg + or al,al + jz basic_fpu_st0 + test ah,110b + jz basic_fpu_streg_st0 + xor [postbyte_register],1 + basic_fpu_streg_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + mov [base_code],0DCh + jmp nomem_instruction_ready + basic_fpu_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov bl,al + basic_fpu_single_streg: + mov [base_code],0D8h + jmp nomem_instruction_ready +simple_fpu_instruction: + mov ah,al + or ah,11000000b + mov al,0D9h + stos word [edi] + jmp instruction_assembled +fi_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fi_mem_16bit + cmp al,4 + je fi_mem_32bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fi_mem_32bit: + mov [base_code],0DAh + jmp instruction_ready + fi_mem_16bit: + mov [base_code],0DEh + jmp instruction_ready +fld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je fld_streg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je fld_mem_32bit + cmp al,8 + je fld_mem_64bit + cmp al,10 + je fld_mem_80bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fld_mem_32bit: + mov [base_code],0D9h + jmp instruction_ready + fld_mem_64bit: + mov [base_code],0DDh + jmp instruction_ready + fld_mem_80bit: + mov al,[postbyte_register] + cmp al,0 + je fld_mem_80bit_store + dec [postbyte_register] + cmp al,3 + je fld_mem_80bit_store + jmp invalid_operand_size + fld_mem_80bit_store: + add [postbyte_register],5 + mov [base_code],0DBh + jmp instruction_ready + fld_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + cmp [postbyte_register],2 + jae fst_streg + mov [base_code],0D9h + jmp nomem_instruction_ready + fst_streg: + mov [base_code],0DDh + jmp nomem_instruction_ready +fild_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fild_mem_16bit + cmp al,4 + je fild_mem_32bit + cmp al,8 + je fild_mem_64bit + or al,al + jnz invalid_operand_size + call recoverable_unknown_size + fild_mem_32bit: + mov [base_code],0DBh + jmp instruction_ready + fild_mem_16bit: + mov [base_code],0DFh + jmp instruction_ready + fild_mem_64bit: + mov al,[postbyte_register] + cmp al,1 + je fisttp_64bit_store + jb fild_mem_64bit_store + dec [postbyte_register] + cmp al,3 + je fild_mem_64bit_store + jmp invalid_operand_size + fild_mem_64bit_store: + add [postbyte_register],5 + mov [base_code],0DFh + jmp instruction_ready + fisttp_64bit_store: + mov [base_code],0DDh + jmp instruction_ready +fbld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fbld_mem_80bit + cmp al,10 + je fbld_mem_80bit + jmp invalid_operand_size + fbld_mem_80bit: + mov [base_code],0DFh + jmp instruction_ready +faddp_instruction: + mov [postbyte_register],al + mov [base_code],0DEh + mov edx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je faddp_streg + mov esi,edx + mov bl,1 + jmp nomem_instruction_ready + faddp_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + jmp nomem_instruction_ready +fcompp_instruction: + mov ax,0D9DEh + stos word [edi] + jmp instruction_assembled +fucompp_instruction: + mov ax,0E9DAh + stos word [edi] + jmp instruction_assembled +fxch_instruction: + mov dx,01D9h + jmp fpu_single_operand +ffreep_instruction: + mov dx,00DFh + jmp fpu_single_operand +ffree_instruction: + mov dl,0DDh + mov dh,al + fpu_single_operand: + mov ebx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je fpu_streg + or dh,dh + jz invalid_operand + mov esi,ebx + shl dh,3 + or dh,11000001b + mov ax,dx + stos word [edi] + jmp instruction_assembled + fpu_streg: + lods byte [esi] + call convert_fpu_register + shl dh,3 + or dh,al + or dh,11000000b + mov ax,dx + stos word [edi] + jmp instruction_assembled + +fstenv_instruction: + mov byte [edi],9Bh + inc edi +fldenv_instruction: + mov [base_code],0D9h + jmp fpu_mem +fstenv_instruction_16bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_16bit: + call operand_16bit + jmp fldenv_instruction +fstenv_instruction_32bit: + mov byte [edi],9Bh + inc edi +fldenv_instruction_32bit: + call operand_32bit + jmp fldenv_instruction +fsave_instruction_32bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_32bit: + call operand_32bit + jmp fnsave_instruction +fsave_instruction_16bit: + mov byte [edi],9Bh + inc edi +fnsave_instruction_16bit: + call operand_16bit + jmp fnsave_instruction +fsave_instruction: + mov byte [edi],9Bh + inc edi +fnsave_instruction: + mov [base_code],0DDh + fpu_mem: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + jne invalid_operand_size + jmp instruction_ready +fstcw_instruction: + mov byte [edi],9Bh + inc edi +fldcw_instruction: + mov [postbyte_register],al + mov [base_code],0D9h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fldcw_mem_16bit + cmp al,2 + je fldcw_mem_16bit + jmp invalid_operand_size + fldcw_mem_16bit: + jmp instruction_ready +fstsw_instruction: + mov al,9Bh + stos byte [edi] +fnstsw_instruction: + mov [base_code],0DDh + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,10h + je fstsw_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fstsw_mem_16bit + cmp al,2 + je fstsw_mem_16bit + jmp invalid_operand_size + fstsw_mem_16bit: + jmp instruction_ready + fstsw_reg: + lods byte [esi] + call convert_register + cmp ax,0200h + jne invalid_operand + mov ax,0E0DFh + stos word [edi] + jmp instruction_assembled +finit_instruction: + mov byte [edi],9Bh + inc edi +fninit_instruction: + mov ah,al + mov al,0DBh + stos word [edi] + jmp instruction_assembled +fcmov_instruction: + mov dh,0DAh + jmp fcomi_streg +fcomi_instruction: + mov dh,0DBh + jmp fcomi_streg +fcomip_instruction: + mov dh,0DFh + fcomi_streg: + mov dl,al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + cmp byte [esi],',' + je fcomi_st0_streg + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + fcomi_st0_streg: + or ah,ah + jnz invalid_operand + inc esi + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + +basic_mmx_instruction: + mov [base_code],0Fh + mov [extended_code],al + mmx_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'[' + jne invalid_operand + mmx_mmreg_mem: + call get_address + jmp instruction_ready + mmx_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +mmx_bit_shift_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'(' + je mmx_ps_mmreg_imm8 + cmp al,'[' + je mmx_mmreg_mem + jmp invalid_operand + mmx_ps_mmreg_imm8: + call get_byte_value + mov byte [value],al + test [operand_size],not 1 + jnz invalid_value + mov bl,[extended_code] + mov al,bl + shr bl,4 + and al,1111b + add al,70h + mov [extended_code],al + sub bl,0Ch + shl bl,1 + xchg bl,[postbyte_register] + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +pmovmskb_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + je pmovmskb_reg_size_ok + cmp [code_type],64 + jne invalid_operand_size + cmp ah,8 + jnz invalid_operand_size + pmovmskb_reg_size_ok: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + call make_mmx_prefix + cmp [extended_code],0C5h + je mmx_nomem_imm8 + jmp nomem_instruction_ready + mmx_imm8: + push ebx ecx edx + xor cl,cl + xchg cl,[operand_size] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + mov [operand_size],cl + cmp al,'(' + jne invalid_operand + call get_byte_value + mov byte [value],al + pop edx ecx ebx + call store_instruction_with_imm8 + jmp instruction_assembled + mmx_nomem_imm8: + call store_nomem_instruction + call append_imm8 + jmp instruction_assembled + append_imm8: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + stosb + ret +pinsrw_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsrw_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + cmp [operand_size],2 + jne invalid_operand_size + jmp mmx_imm8 + pinsrw_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp mmx_nomem_imm8 +pshufw_instruction: + mov [mmx_size],8 + mov [opcode_prefix],al + jmp pshuf_instruction +pshufd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],al + pshuf_instruction: + mov [base_code],0Fh + mov [extended_code],70h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pshuf_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + pshuf_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +movd_instruction: + mov [base_code],0Fh + mov [extended_code],7Eh + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + jmp instruction_ready + movd_reg: + lods byte [esi] + cmp al,0B0h + jae movd_mmreg + call convert_register + cmp ah,4 + jne invalid_operand_size + mov [operand_size],0 + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + jmp nomem_instruction_ready + movd_mmreg: + mov [extended_code],6Eh + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + jmp instruction_ready + movd_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready + make_mmx_prefix: + cmp [vex_required],0 + jne mmx_prefix_for_vex + cmp [operand_size],16 + jne no_mmx_prefix + mov [operand_prefix],66h + no_mmx_prefix: + ret + mmx_prefix_for_vex: + cmp [operand_size],16 + jne invalid_operand + mov [opcode_prefix],66h + ret +movq_instruction: + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + cmp ah,16 + je movq_mem_xmmreg + mov [extended_code],7Fh + jmp instruction_ready + movq_mem_xmmreg: + mov [extended_code],0D6h + mov [opcode_prefix],66h + jmp instruction_ready + movq_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg + call convert_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + mov [extended_code],7Eh + call operand_64bit + jmp nomem_instruction_ready + movq_mmreg: + call convert_mmx_register + mov [postbyte_register],al + mov [extended_code],6Fh + mov [mmx_size],ah + cmp ah,16 + jne movq_mmreg_ + mov [extended_code],7Eh + mov [opcode_prefix],0F3h + movq_mmreg_: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_mmreg_reg + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + jmp instruction_ready + movq_mmreg_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg_mmreg + mov [operand_size],0 + call convert_register + cmp ah,8 + jne invalid_operand_size + mov [extended_code],6Eh + mov [opcode_prefix],0 + mov bl,al + cmp [mmx_size],16 + jne movq_mmreg_reg_store + mov [opcode_prefix],66h + movq_mmreg_reg_store: + call operand_64bit + jmp nomem_instruction_ready + movq_mmreg_mmreg: + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +movdq_instruction: + mov [opcode_prefix],al + mov [base_code],0Fh + mov [extended_code],6Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [extended_code],7Fh + jmp instruction_ready + movdq_mmreg: + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + movdq_mmreg_mmreg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +lddqu_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov [postbyte_register],al + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],0F0h + jmp instruction_ready + +movdq2q_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movq2dq_ +movq2dq_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],16 + movq2dq_: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + xor [mmx_size],8+16 + cmp ah,[mmx_size] + jne invalid_operand_size + mov bl,al + mov [base_code],0Fh + mov [extended_code],0D6h + jmp nomem_instruction_ready + +sse_ps_instruction_imm8: + mov [immediate_size],1 +sse_ps_instruction: + mov [mmx_size],16 + jmp sse_instruction +sse_pd_instruction_imm8: + mov [immediate_size],1 +sse_pd_instruction: + mov [mmx_size],16 + mov [opcode_prefix],66h + jmp sse_instruction +sse_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_instruction +sse_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + jmp sse_instruction +cmp_pd_instruction: + mov [opcode_prefix],66h +cmp_ps_instruction: + mov [mmx_size],16 + mov byte [value],al + mov al,0C2h + jmp sse_instruction +cmp_ss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp cmp_sx_instruction +cmpsd_instruction: + mov al,0A7h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov al,-1 +cmp_sd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],0F2h + cmp_sx_instruction: + mov byte [value],al + mov al,0C2h + jmp sse_instruction +comiss_instruction: + mov [mmx_size],4 + jmp sse_instruction +comisd_instruction: + mov [mmx_size],8 + mov [opcode_prefix],66h + jmp sse_instruction +cvtdq2pd_instruction: + mov [opcode_prefix],0F3h +cvtps2pd_instruction: + mov [mmx_size],8 + jmp sse_instruction +cvtpd2dq_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F2h + jmp sse_instruction +movshdup_instruction: + mov [mmx_size],16 + mov [opcode_prefix],0F3h +sse_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + sse_xmmreg: + lods byte [esi] + call convert_xmm_register + sse_reg: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg + sse_reg_mem: + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je sse_mem_size_ok + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + sse_mem_size_ok: + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_mem_ok + cmp ax,443Ah + je sse_cmp_mem_ok + cmp [immediate_size],1 + je mmx_imm8 + cmp [immediate_size],-1 + jne sse_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_ok: + jmp instruction_ready + sse_cmp_mem_ok: + cmp byte [value],-1 + je mmx_imm8 + call store_instruction_with_imm8 + jmp instruction_assembled + sse_xmmreg_xmmreg: + cmp [operand_prefix],66h + jne sse_xmmreg_xmmreg_ok + cmp [extended_code],12h + je invalid_operand + cmp [extended_code],16h + je invalid_operand + sse_xmmreg_xmmreg_ok: + lods byte [esi] + call convert_xmm_register + mov bl,al + mov al,[extended_code] + mov ah,[supplemental_code] + cmp al,0C2h + je sse_cmp_nomem_ok + cmp ax,443Ah + je sse_cmp_nomem_ok + cmp [immediate_size],1 + je mmx_nomem_imm8 + cmp [immediate_size],-1 + jne sse_nomem_ok + call take_additional_xmm0 + mov [immediate_size],0 + sse_nomem_ok: + jmp nomem_instruction_ready + sse_cmp_nomem_ok: + cmp byte [value],-1 + je mmx_nomem_imm8 + call store_nomem_instruction + mov al,byte [value] + stosb + jmp instruction_assembled + take_additional_xmm0: + cmp byte [esi],',' + jne additional_xmm0_ok + inc esi + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + test al,al + jnz invalid_operand + additional_xmm0_ok: + ret + +pslldq_instruction: + mov [postbyte_register],al + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],73h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp mmx_nomem_imm8 +movpd_instruction: + mov [opcode_prefix],66h +movps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],16 + jmp sse_mov_instruction +movss_instruction: + mov [mmx_size],4 + mov [opcode_prefix],0F3h + jmp sse_movs +movsd_instruction: + mov al,0A5h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov [mmx_size],8 + mov [opcode_prefix],0F2h + sse_movs: + mov [base_code],0Fh + mov [extended_code],10h + jmp sse_mov_instruction +sse_mov_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg + sse_mem: + cmp al,'[' + jne invalid_operand + inc [extended_code] + call get_address + cmp [operand_size],0 + je sse_mem_xmmreg + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + mov [operand_size],0 + sse_mem_xmmreg: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready +movlpd_instruction: + mov [opcode_prefix],66h +movlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],8 + lods byte [esi] + call get_size_operator + cmp al,10h + jne sse_mem + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + jmp sse_reg_mem +movhlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand +maskmovq_instruction: + mov cl,8 + jmp maskmov_instruction +maskmovdqu_instruction: + mov cl,16 + mov [opcode_prefix],66h + maskmov_instruction: + mov [base_code],0Fh + mov [extended_code],0F7h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,cl + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp nomem_instruction_ready +movmskpd_instruction: + mov [opcode_prefix],66h +movmskps_instruction: + mov [base_code],0Fh + mov [extended_code],50h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,4 + je movmskps_reg_ok + cmp ah,8 + jne invalid_operand_size + cmp [code_type],64 + jne invalid_operand + movmskps_reg_ok: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand + +cvtpi2pd_instruction: + mov [opcode_prefix],66h +cvtpi2ps_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtpi_xmmreg_xmmreg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtpi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + cvtpi_size_ok: + jmp instruction_ready + cvtpi_xmmreg_xmmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + jmp nomem_instruction_ready +cvtsi2ss_instruction: + mov [opcode_prefix],0F3h + jmp cvtsi_instruction +cvtsi2sd_instruction: + mov [opcode_prefix],0F2h + cvtsi_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + cvtsi_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtsi_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtsi_size_ok + cmp [operand_size],4 + je cvtsi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + call operand_64bit + cvtsi_size_ok: + jmp instruction_ready + cvtsi_xmmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + je cvtsi_xmmreg_reg_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + cvtsi_xmmreg_reg_store: + mov bl,al + jmp nomem_instruction_ready +cvtps2pi_instruction: + mov [mmx_size],8 + jmp cvtpd_instruction +cvtpd2pi_instruction: + mov [opcode_prefix],66h + mov [mmx_size],16 + cvtpd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [operand_size],0 + jmp sse_reg +cvtss2si_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + jmp cvt2si_instruction +cvtsd2si_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + cvt2si_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [operand_size],0 + cmp ah,4 + je sse_reg + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp sse_reg + +ssse3_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + jmp mmx_instruction +palignr_instruction: + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je palignr_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + palignr_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +amd3dnow_instruction: + mov [base_code],0Fh + mov [extended_code],0Fh + mov byte [value],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je amd3dnow_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + call store_instruction_with_imm8 + jmp instruction_assembled + amd3dnow_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + +sse4_instruction_38_xmm0: + mov [immediate_size],-1 +sse4_instruction_38: + mov [mmx_size],16 + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,38h + jmp sse_instruction +sse4_ss_instruction_3a_imm8: + mov [immediate_size],1 + mov [mmx_size],4 + jmp sse4_instruction_3a_setup +sse4_sd_instruction_3a_imm8: + mov [immediate_size],1 + mov [mmx_size],8 + jmp sse4_instruction_3a_setup +sse4_instruction_3a_imm8: + mov [immediate_size],1 + mov [mmx_size],16 + sse4_instruction_3a_setup: + mov [opcode_prefix],66h + mov [supplemental_code],al + mov al,3Ah + jmp sse_instruction +pclmulqdq_instruction: + mov byte [value],al + mov [mmx_size],16 + mov al,44h + jmp sse4_instruction_3a_setup +extractps_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],17h + lods byte [esi] + call get_size_operator + cmp al,10h + je extractps_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je extractps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + extractps_size_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + extractps_reg: + lods byte [esi] + call convert_register + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ebx + mov al,bh + cmp al,4 + je mmx_nomem_imm8 + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp mmx_nomem_imm8 +insertps_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + insertps_xmmreg: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],21h + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je insertps_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je insertps_size_ok + cmp [operand_size],0 + jne invalid_operand_size + insertps_size_ok: + jmp mmx_imm8 + insertps_xmmreg_reg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +pextrq_instruction: + mov [mmx_size],8 + jmp pextr_instruction +pextrd_instruction: + mov [mmx_size],4 + jmp pextr_instruction +pextrw_instruction: + mov [mmx_size],2 + jmp pextr_instruction +pextrb_instruction: + mov [mmx_size],1 + pextr_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je pextr_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[mmx_size] + cmp al,[operand_size] + je pextr_size_ok + cmp [operand_size],0 + jne invalid_operand_size + pextr_size_ok: + cmp al,8 + jne pextr_prefix_ok + call operand_64bit + pextr_prefix_ok: + push edx ebx ecx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pop ecx ebx edx + jmp mmx_imm8 + pextr_reg: + lods byte [esi] + call convert_register + cmp [mmx_size],4 + ja pextrq_reg + cmp ah,4 + je pextr_reg_size_ok + cmp [code_type],64 + jne pextr_invalid_size + cmp ah,8 + je pextr_reg_size_ok + pextr_invalid_size: + jmp invalid_operand_size + pextrq_reg: + cmp ah,8 + jne pextr_invalid_size + call operand_64bit + pextr_reg_size_ok: + mov [operand_size],0 + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov ebx,eax + pop eax + mov [postbyte_register],al + mov al,ah + cmp [mmx_size],2 + jne pextr_reg_store + mov [opcode_prefix],0 + mov [extended_code],0C5h + call make_mmx_prefix + jmp mmx_nomem_imm8 + pextr_reg_store: + cmp bh,16 + jne invalid_operand_size + xchg bl,[postbyte_register] + call operand_autodetect + jmp mmx_nomem_imm8 +pinsrb_instruction: + mov [mmx_size],1 + jmp pinsr_instruction +pinsrd_instruction: + mov [mmx_size],4 + jmp pinsr_instruction +pinsrq_instruction: + mov [mmx_size],8 + call operand_64bit + pinsr_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],3Ah + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + pinsr_xmmreg: + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsr_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + mov al,[mmx_size] + cmp al,[operand_size] + je mmx_imm8 + jmp invalid_operand_size + pinsr_xmmreg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp [mmx_size],8 + je pinsrq_xmmreg_reg + cmp ah,4 + je mmx_nomem_imm8 + jmp invalid_operand_size + pinsrq_xmmreg_reg: + cmp ah,8 + je mmx_nomem_imm8 + jmp invalid_operand_size +pmovsxbw_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxbd_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxbq_instruction: + mov [mmx_size],2 + jmp pmovsx_instruction +pmovsxwd_instruction: + mov [mmx_size],8 + jmp pmovsx_instruction +pmovsxwq_instruction: + mov [mmx_size],4 + jmp pmovsx_instruction +pmovsxdq_instruction: + mov [mmx_size],8 + pmovsx_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je pmovsx_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je instruction_ready + mov al,[mmx_size] + cmp al,[operand_size] + jne invalid_operand_size + jmp instruction_ready + pmovsx_xmmreg_reg: + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready + +fxsave_instruction_64bit: + call operand_64bit +fxsave_instruction: + mov [extended_code],0AEh + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,[operand_size] + or ah,ah + jz fxsave_size_ok + mov al,[postbyte_register] + cmp al,111b + je clflush_size_check + cmp al,10b + jb invalid_operand_size + cmp al,11b + ja invalid_operand_size + cmp ah,4 + jne invalid_operand_size + jmp fxsave_size_ok + clflush_size_check: + cmp ah,1 + jne invalid_operand_size + fxsave_size_ok: + jmp instruction_ready +prefetch_instruction: + mov [extended_code],18h + prefetch_mem_8bit: + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + or ah,ah + jz prefetch_size_ok + cmp ah,1 + jne invalid_operand_size + prefetch_size_ok: + call get_address + jmp instruction_ready +amd_prefetch_instruction: + mov [extended_code],0Dh + jmp prefetch_mem_8bit +fence_instruction: + mov bl,al + mov ax,0AE0Fh + stos word [edi] + mov al,bl + stos byte [edi] + jmp instruction_assembled +pause_instruction: + mov ax,90F3h + stos word [edi] + jmp instruction_assembled +movntq_instruction: + mov [mmx_size],8 + jmp movnt_instruction +movntpd_instruction: + mov [opcode_prefix],66h +movntps_instruction: + mov [mmx_size],16 + movnt_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + jmp instruction_ready + +movntsd_instruction: + mov [opcode_prefix],0F2h + mov [mmx_size],8 + jmp movnts_instruction +movntss_instruction: + mov [opcode_prefix],0F3h + mov [mmx_size],4 + movnts_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,[mmx_size] + je movnts_size_ok + test al,al + jnz invalid_operand_size + movnts_size_ok: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + jmp instruction_ready + +movnti_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + je movnti_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + movnti_store: + mov [postbyte_register],al + jmp instruction_ready +monitor_instruction: + mov [postbyte_register],al + cmp byte [esi],0 + je monitor_instruction_store + cmp byte [esi],0Fh + je monitor_instruction_store + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0400h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0401h + jne invalid_operand + cmp [postbyte_register],0C8h + jne monitor_instruction_store + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0402h + jne invalid_operand + monitor_instruction_store: + mov ax,010Fh + stos word [edi] + mov al,[postbyte_register] + stos byte [edi] + jmp instruction_assembled +movntdqa_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp instruction_ready + +extrq_instruction: + mov [opcode_prefix],66h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je extrq_xmmreg_xmmreg + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + xor bl,bl + xchg bl,[postbyte_register] + call store_nomem_instruction + call get_byte_value + stosb + call append_imm8 + jmp instruction_assembled + extrq_xmmreg_xmmreg: + inc [extended_code] + lods byte [esi] + call convert_xmm_register + mov bl,al + jmp nomem_instruction_ready +insertq_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_xmm_register + mov bl,al + cmp byte [esi],',' + je insertq_with_imm + inc [extended_code] + jmp nomem_instruction_ready + insertq_with_imm: + call store_nomem_instruction + call append_imm8 + call append_imm8 + jmp instruction_assembled + +crc32_instruction: + mov [opcode_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F0h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,8 + je crc32_reg64 + cmp ah,4 + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je crc32_reg32_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + test al,al + jz crc32_unknown_size + cmp al,1 + je crc32_reg32_mem_store + cmp al,4 + ja invalid_operand_size + inc [supplemental_code] + call operand_autodetect + crc32_reg32_mem_store: + jmp instruction_ready + crc32_unknown_size: + call recoverable_unknown_size + jmp crc32_reg32_mem_store + crc32_reg32_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je crc32_reg32_reg_store + cmp al,4 + ja invalid_operand_size + inc [supplemental_code] + call operand_autodetect + crc32_reg32_reg_store: + jmp nomem_instruction_ready + crc32_reg64: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + call operand_64bit + lods byte [esi] + call get_size_operator + cmp al,10h + je crc32_reg64_reg + cmp al,'[' + jne invalid_operand + call get_address + mov ah,[operand_size] + mov al,8 + test ah,ah + jz crc32_unknown_size + cmp ah,1 + je crc32_reg32_mem_store + cmp ah,al + jne invalid_operand_size + inc [supplemental_code] + jmp crc32_reg32_mem_store + crc32_reg64_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,8 + cmp ah,1 + je crc32_reg32_reg_store + cmp ah,al + jne invalid_operand_size + inc [supplemental_code] + jmp crc32_reg32_reg_store +popcnt_instruction: + mov [opcode_prefix],0F3h + jmp bs_instruction +movbe_instruction: + mov [supplemental_code],al + mov [extended_code],38h + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + je movbe_mem + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_argument + call get_address + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready + movbe_mem: + inc [supplemental_code] + call get_address + push edx ebx ecx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop ecx ebx edx + mov al,[operand_size] + call operand_autodetect + jmp instruction_ready +adx_instruction: + mov [base_code],0Fh + mov [extended_code],38h + mov [supplemental_code],0F6h + mov [operand_prefix],al + call get_reg_mem + jc adx_reg_reg + mov al,[operand_size] + cmp al,4 + je instruction_ready + cmp al,8 + jne invalid_operand_size + call operand_64bit + jmp instruction_ready + adx_reg_reg: + cmp ah,4 + je nomem_instruction_ready + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp nomem_instruction_ready + +simple_vmx_instruction: + mov ah,al + mov al,0Fh + stos byte [edi] + mov al,1 + stos word [edi] + jmp instruction_assembled +vmclear_instruction: + mov [opcode_prefix],66h + jmp vmx_instruction +vmxon_instruction: + mov [opcode_prefix],0F3h +vmx_instruction: + mov [postbyte_register],al + mov [extended_code],0C7h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,8 + jne invalid_operand_size + vmx_size_ok: + mov [base_code],0Fh + jmp instruction_ready +vmread_instruction: + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,10h + je vmread_nomem + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + call vmread_check_size + jmp vmx_size_ok + vmread_nomem: + lods byte [esi] + call convert_register + push eax + call vmread_check_size + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + call vmread_check_size + pop ebx + mov [base_code],0Fh + jmp nomem_instruction_ready + vmread_check_size: + cmp [code_type],64 + je vmread_long + cmp [operand_size],4 + jne invalid_operand_size + ret + vmread_long: + cmp [operand_size],8 + jne invalid_operand_size + ret +vmwrite_instruction: + mov [extended_code],79h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je vmwrite_nomem + cmp al,'[' + jne invalid_operand + call get_address + call vmread_check_size + jmp vmx_size_ok + vmwrite_nomem: + lods byte [esi] + call convert_register + mov bl,al + mov [base_code],0Fh + jmp nomem_instruction_ready +vmx_inv_instruction: + mov [opcode_prefix],66h + mov [extended_code],38h + mov [supplemental_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + call vmread_check_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,16 + jne invalid_operand_size + jmp vmx_size_ok +simple_svm_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + simple_svm_detect_size: + cmp ah,2 + je simple_svm_16bit + cmp ah,4 + je simple_svm_32bit + cmp [code_type],64 + jne invalid_operand_size + jmp simple_svm_store + simple_svm_16bit: + cmp [code_type],16 + je simple_svm_store + cmp [code_type],64 + je invalid_operand_size + jmp prefixed_svm_store + simple_svm_32bit: + cmp [code_type],32 + je simple_svm_store + prefixed_svm_store: + mov al,67h + stos byte [edi] + simple_svm_store: + call store_instruction_code + pop eax + stos byte [edi] + jmp instruction_assembled +skinit_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0400h + jne invalid_operand + mov al,0DEh + jmp simple_vmx_instruction +invlpga_instruction: + push eax + mov [base_code],0Fh + mov [extended_code],1 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov bl,ah + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0401h + jne invalid_operand + mov ah,bl + jmp simple_svm_detect_size + +rdrand_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + jmp nomem_instruction_ready +rdfsbase_instruction: + cmp [code_type],64 + jne illegal_instruction + mov [opcode_prefix],0F3h + mov [base_code],0Fh + mov [extended_code],0AEh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp ah,2 + je invalid_operand_size + call operand_autodetect + jmp nomem_instruction_ready + +xabort_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + mov dl,al + mov ax,0F8C6h + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +xbegin_instruction: + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[code_type] + cmp al,64 + je xbegin_64bit + cmp al,32 + je xbegin_32bit + xbegin_16bit: + call get_address_word_value + add edi,4 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,4 + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_32bit: + call get_address_dword_value + jmp xbegin_address_ok + xbegin_64bit: + call get_address_qword_value + xbegin_address_ok: + add edi,5 + mov ebp,[addressing_space] + call calculate_relative_offset + sub edi,5 + mov edx,eax + cwde + cmp eax,edx + jne xbegin_rel32 + mov al,66h + stos byte [edi] + mov eax,edx + shl eax,16 + mov ax,0F8C7h + stos dword [edi] + jmp instruction_assembled + xbegin_rel32: + sub edx,1 + jno xbegin_rel32_ok + cmp [code_type],64 + je relative_jump_out_of_range + xbegin_rel32_ok: + mov ax,0F8C7h + stos word [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + +convert_register: + mov ah,al + shr ah,4 + and al,0Fh + cmp ah,8 + je match_register_size + cmp ah,4 + ja invalid_operand + cmp ah,1 + ja match_register_size + cmp al,4 + jb match_register_size + or ah,ah + jz high_byte_register + or [rex_prefix],40h + match_register_size: + cmp ah,[operand_size] + je register_size_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + register_size_ok: + ret + high_byte_register: + mov ah,1 + or [rex_prefix],80h + jmp match_register_size +convert_fpu_register: + mov ah,al + shr ah,4 + and al,111b + cmp ah,10 + jne invalid_operand + jmp match_register_size +convert_mmx_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + ja invalid_operand + and al,111b + cmp ah,0Bh + jne invalid_operand + mov ah,8 + cmp [vex_required],0 + jne invalid_operand + jmp match_register_size + xmm_register: + and al,0Fh + mov ah,16 + cmp al,8 + jb match_register_size + cmp [code_type],64 + jne invalid_operand + jmp match_register_size +convert_xmm_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + jmp invalid_operand +get_size_operator: + xor ah,ah + cmp al,11h + jne no_size_operator + mov [size_declared],1 + lods word [esi] + xchg al,ah + mov [size_override],1 + cmp ah,[operand_size] + je size_operator_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + size_operator_ok: + ret + no_size_operator: + mov [size_declared],0 + cmp al,'[' + jne size_operator_ok + mov [size_override],0 + ret +get_jump_operator: + mov [jump_type],0 + cmp al,12h + jne jump_operator_ok + lods word [esi] + mov [jump_type],al + mov al,ah + jump_operator_ok: + ret +get_address: + mov [segment_register],0 + mov [address_size],0 + mov [free_address_range],0 + mov al,[code_type] + shr al,3 + mov [value_size],al + mov al,[esi] + and al,11110000b + cmp al,60h + jne get_size_prefix + lods byte [esi] + sub al,60h + mov [segment_register],al + mov al,[esi] + and al,11110000b + get_size_prefix: + cmp al,70h + jne address_size_prefix_ok + lods byte [esi] + sub al,70h + cmp al,2 + jb invalid_address_size + cmp al,8 + ja invalid_address_size + mov [address_size],al + mov [value_size],al + address_size_prefix_ok: + call calculate_address + cmp byte [esi-1],']' + jne invalid_address + mov [address_high],edx + mov edx,eax + cmp [code_type],64 + jne address_ok + or bx,bx + jnz address_ok + test ch,0Fh + jnz address_ok + calculate_relative_address: + mov edx,[address_symbol] + mov [symbol_identifier],edx + mov edx,[address_high] + mov ebp,[addressing_space] + call calculate_relative_offset + mov [address_high],edx + cdq + cmp edx,[address_high] + je address_high_ok + call recoverable_overflow + address_high_ok: + mov edx,eax + ror ecx,16 + mov cl,[value_type] + rol ecx,16 + mov bx,0FF00h + address_ok: + ret +operand_16bit: + cmp [code_type],16 + je size_prefix_ok + mov [operand_prefix],66h + ret +operand_32bit: + cmp [code_type],16 + jne size_prefix_ok + mov [operand_prefix],66h + size_prefix_ok: + ret +operand_64bit: + cmp [code_type],64 + jne illegal_instruction + or [rex_prefix],48h + ret +operand_autodetect: + cmp al,2 + je operand_16bit + cmp al,4 + je operand_32bit + cmp al,8 + je operand_64bit + jmp invalid_operand_size +store_segment_prefix_if_necessary: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,4 + ja segment_prefix_386 + cmp [code_type],64 + je segment_prefix_ok + cmp al,3 + je ss_prefix + jb segment_prefix_86 + cmp bl,25h + je segment_prefix_86 + cmp bh,25h + je segment_prefix_86 + cmp bh,45h + je segment_prefix_86 + cmp bh,44h + je segment_prefix_86 + ret + ss_prefix: + cmp bl,25h + je segment_prefix_ok + cmp bh,25h + je segment_prefix_ok + cmp bh,45h + je segment_prefix_ok + cmp bh,44h + je segment_prefix_ok + jmp segment_prefix_86 +store_segment_prefix: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,5 + jae segment_prefix_386 + segment_prefix_86: + dec al + shl al,3 + add al,26h + stos byte [edi] + jmp segment_prefix_ok + segment_prefix_386: + add al,64h-5 + stos byte [edi] + segment_prefix_ok: + ret +store_instruction_code: + cmp [vex_required],0 + jne store_vex_instruction_code + mov al,[operand_prefix] + or al,al + jz operand_prefix_ok + stos byte [edi] + operand_prefix_ok: + mov al,[opcode_prefix] + or al,al + jz opcode_prefix_ok + stos byte [edi] + opcode_prefix_ok: + mov al,[rex_prefix] + test al,40h + jz rex_prefix_ok + cmp [code_type],64 + jne invalid_operand + test al,0B0h + jnz disallowed_combination_of_registers + stos byte [edi] + rex_prefix_ok: + mov al,[base_code] + stos byte [edi] + cmp al,0Fh + jne instruction_code_ok + store_extended_code: + mov al,[extended_code] + stos byte [edi] + cmp al,38h + je store_supplemental_code + cmp al,3Ah + je store_supplemental_code + instruction_code_ok: + ret + store_supplemental_code: + mov al,[supplemental_code] + stos byte [edi] + ret +store_nomem_instruction: + test [postbyte_register],1000b + jz nomem_reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + nomem_reg_code_ok: + test bl,1000b + jz nomem_rm_code_ok + or [rex_prefix],41h + and bl,111b + nomem_rm_code_ok: + call store_instruction_code + mov al,[postbyte_register] + shl al,3 + or al,bl + or al,11000000b + stos byte [edi] + ret +store_instruction: + mov [current_offset],edi + test [postbyte_register],1000b + jz reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + reg_code_ok: + cmp [code_type],64 + jne address_value_ok + xor eax,eax + bt edx,31 + sbb eax,[address_high] + jz address_value_ok + cmp [address_high],0 + jne address_value_out_of_range + test ch,44h + jnz address_value_ok + test bx,8080h + jz address_value_ok + address_value_out_of_range: + call recoverable_overflow + address_value_ok: + call store_segment_prefix_if_necessary + test [vex_required],4 + jnz address_vsib + or bx,bx + jz address_immediate + cmp bx,0F800h + je address_rip_based + cmp bx,0F400h + je address_eip_based + cmp bx,0FF00h + je address_relative + mov al,bl + or al,bh + and al,11110000b + cmp al,80h + je postbyte_64bit + cmp al,40h + je postbyte_32bit + cmp al,20h + jne invalid_address + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + call store_instruction_code + cmp bl,bh + jbe determine_16bit_address + xchg bl,bh + determine_16bit_address: + cmp bx,2600h + je address_si + cmp bx,2700h + je address_di + cmp bx,2300h + je address_bx + cmp bx,2500h + je address_bp + cmp bx,2625h + je address_bp_si + cmp bx,2725h + je address_bp_di + cmp bx,2723h + je address_bx_di + cmp bx,2623h + jne invalid_address + address_bx_si: + xor al,al + jmp postbyte_16bit + address_bx_di: + mov al,1 + jmp postbyte_16bit + address_bp_si: + mov al,10b + jmp postbyte_16bit + address_bp_di: + mov al,11b + jmp postbyte_16bit + address_si: + mov al,100b + jmp postbyte_16bit + address_di: + mov al,101b + jmp postbyte_16bit + address_bx: + mov al,111b + jmp postbyte_16bit + address_bp: + mov al,110b + postbyte_16bit: + test ch,22h + jnz address_16bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + or dx,dx + jz address + cmp dx,80h + jb address_8bit_value + cmp dx,-80h + jae address_8bit_value + address_16bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + ret + address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + cmp dx,80h + jge value_out_of_range + cmp dx,-80h + jl value_out_of_range + ret + address: + cmp al,110b + je address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_vsib: + mov al,bl + shr al,4 + cmp al,0Ch + je vector_index_ok + cmp al,0Dh + jne invalid_address + vector_index_ok: + mov al,bh + shr al,4 + cmp al,4 + je postbyte_32bit + cmp [code_type],64 + je address_prefix_ok + test al,al + jnz invalid_address + postbyte_32bit: + call address_32bit_prefix + jmp address_prefix_ok + postbyte_64bit: + cmp [code_type],64 + jne invalid_address_size + address_prefix_ok: + cmp bl,44h + je invalid_address + cmp bl,84h + je invalid_address + test bh,1000b + jz base_code_ok + or [rex_prefix],41h + base_code_ok: + test bl,1000b + jz index_code_ok + or [rex_prefix],42h + index_code_ok: + call store_instruction_code + or cl,cl + jz only_base_register + base_and_index: + mov al,100b + xor ah,ah + cmp cl,1 + je scale_ok + cmp cl,2 + je scale_1 + cmp cl,4 + je scale_2 + or ah,11000000b + jmp scale_ok + scale_2: + or ah,10000000b + jmp scale_ok + scale_1: + or ah,01000000b + scale_ok: + or bh,bh + jz only_index_register + and bl,111b + shl bl,3 + or ah,bl + and bh,111b + or ah,bh + sib_ready: + test ch,44h + jnz sib_address_32bit_value + test ch,88h + jnz sib_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp bh,5 + je address_value + or edx,edx + jz sib_address + address_value: + cmp edx,80h + jb sib_address_8bit_value + cmp edx,-80h + jae sib_address_8bit_value + sib_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + sib_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + mov al,dl + stos byte [edi] + cmp edx,80h + jge value_out_of_range + cmp edx,-80h + jl value_out_of_range + ret + sib_address: + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + ret + only_index_register: + or ah,101b + and bl,111b + shl bl,3 + or ah,bl + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + test ch,44h + jnz store_address_32bit_value + test ch,88h + jnz store_address_32bit_value + or ch,ch + jnz invalid_address_size + jmp store_address_32bit_value + zero_index_register: + mov bl,4 + mov cl,1 + jmp base_and_index + only_base_register: + mov al,bh + and al,111b + cmp al,4 + je zero_index_register + test ch,44h + jnz simple_address_32bit_value + test ch,88h + jnz simple_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + or edx,edx + jz simple_address + cmp edx,80h + jb simple_address_8bit_value + cmp edx,-80h + jae simple_address_8bit_value + simple_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + jmp store_address_32bit_value + simple_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + cmp edx,80h + jge value_out_of_range + cmp edx,-80h + jl value_out_of_range + ret + simple_address: + cmp al,5 + je simple_address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_immediate: + cmp [code_type],64 + je address_immediate_sib + test ch,44h + jnz address_immediate_32bit + test ch,88h + jnz address_immediate_32bit + test ch,22h + jnz address_immediate_16bit + or ch,ch + jnz invalid_address_size + cmp [code_type],16 + je addressing_16bit + address_immediate_32bit: + call address_32bit_prefix + call store_instruction_code + store_immediate_address: + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + store_address_32bit_value: + test ch,0F0h + jz address_32bit_relocation_ok + mov eax,ecx + shr eax,16 + cmp al,4 + jne address_32bit_relocation + mov al,2 + address_32bit_relocation: + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_32bit_relocation_ok: + mov eax,edx + stos dword [edi] + ret + store_address_64bit_value: + test ch,0F0h + jz address_64bit_relocation_ok + mov eax,ecx + shr eax,16 + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_64bit_relocation_ok: + mov eax,edx + stos dword [edi] + mov eax,[address_high] + stos dword [edi] + ret + address_immediate_sib: + test ch,44h + jnz address_immediate_sib_32bit + test ch,not 88h + jnz invalid_address_size + address_immediate_sib_store: + call store_instruction_code + mov al,100b + mov ah,100101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + address_immediate_sib_32bit: + test ecx,0FF0000h + jnz address_immediate_sib_nosignextend + test edx,80000000h + jz address_immediate_sib_store + address_immediate_sib_nosignextend: + call address_32bit_prefix + jmp address_immediate_sib_store + address_eip_based: + mov al,67h + stos byte [edi] + address_rip_based: + cmp [code_type],64 + jne invalid_address + call store_instruction_code + jmp store_immediate_address + address_relative: + call store_instruction_code + movzx eax,[immediate_size] + add eax,edi + sub eax,[current_offset] + add eax,5 + sub edx,eax + jo value_out_of_range + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + shr ecx,16 + xchg [value_type],cl + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + mov eax,edx + call mark_relocation + mov [value_type],cl + mov [symbol_identifier],ebx + stos dword [edi] + ret + addressing_16bit: + cmp edx,10000h + jge address_immediate_32bit + cmp edx,-8000h + jl address_immediate_32bit + movzx edx,dx + address_immediate_16bit: + call address_16bit_prefix + call store_instruction_code + mov al,110b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + ret + address_16bit_prefix: + cmp [code_type],16 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + ret + address_32bit_prefix: + cmp [code_type],32 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + instruction_prefix_ok: + ret +store_instruction_with_imm8: + mov [immediate_size],1 + call store_instruction + mov al,byte [value] + stos byte [edi] + ret +store_instruction_with_imm16: + mov [immediate_size],2 + call store_instruction + mov ax,word [value] + call mark_relocation + stos word [edi] + ret +store_instruction_with_imm32: + mov [immediate_size],4 + call store_instruction + mov eax,dword [value] + call mark_relocation + stos dword [edi] + ret diff --git a/samples/Isabelle/HelloWorld.thy b/samples/Isabelle/HelloWorld.thy new file mode 100644 index 00000000..7c814dae --- /dev/null +++ b/samples/Isabelle/HelloWorld.thy @@ -0,0 +1,46 @@ +theory HelloWorld +imports Main +begin + +section{*Playing around with Isabelle*} + +text{* creating a lemma with the name hello_world*} +lemma hello_world: "True" by simp + +(*inspecting it*) +thm hello_world + +text{* defining a string constant HelloWorld *} + +definition HelloWorld :: "string" where + "HelloWorld \ ''Hello World!''" + +(*reversing HelloWorld twice yilds HelloWorld again*) +theorem "rev (rev HelloWorld) = HelloWorld" + by (fact List.rev_rev_ident) + +text{*now we delete the already proven List.rev_rev_ident lema and show it by hand*} +declare List.rev_rev_ident[simp del] +hide_fact List.rev_rev_ident + +(*It's trivial since we can just 'execute' it*) +corollary "rev (rev HelloWorld) = HelloWorld" + apply(simp add: HelloWorld_def) + done + +text{*does it hold in general?*} +theorem rev_rev_ident:"rev (rev l) = l" + proof(induction l) + case Nil thus ?case by simp + next + case (Cons l ls) + assume IH: "rev (rev ls) = ls" + have "rev (l#ls) = (rev ls) @ [l]" by simp + hence "rev (rev (l#ls)) = rev ((rev ls) @ [l])" by simp + also have "\ = [l] @ rev (rev ls)" by simp + finally show "rev (rev (l#ls)) = l#ls" using IH by simp + qed + +corollary "\(l::string). rev (rev l) = l" by(fastforce intro: rev_rev_ident) + +end diff --git a/samples/Prolog/format_spec.pl b/samples/Prolog/format_spec.pl new file mode 100644 index 00000000..1508f3a3 --- /dev/null +++ b/samples/Prolog/format_spec.pl @@ -0,0 +1,260 @@ +:- module(format_spec, [ format_error/2 + , format_spec/2 + , format_spec//1 + , spec_arity/2 + , spec_types/2 + ]). + +:- use_module(library(dcg/basics), [eos//0, integer//1, string_without//2]). +:- use_module(library(error)). +:- use_module(library(when), [when/2]). + +% TODO loading this module is optional +% TODO it's for my own convenience during development +%:- use_module(library(mavis)). + +%% format_error(+Goal, -Error:string) is nondet. +% +% True if Goal exhibits an Error in its format string. The +% Error string describes what is wrong with Goal. Iterates each +% error on backtracking. +% +% Goal may be one of the following predicates: +% +% * format/2 +% * format/3 +% * debug/3 +format_error(format(Format,Args), Error) :- + format_error_(Format, Args,Error). +format_error(format(_,Format,Args), Error) :- + format_error_(Format,Args,Error). +format_error(debug(_,Format,Args), Error) :- + format_error_(Format,Args,Error). + +format_error_(Format,Args,Error) :- + format_spec(Format, Spec), + !, + is_list(Args), + spec_types(Spec, Types), + types_error(Args, Types, Error). +format_error_(Format,_,Error) :- + % \+ format_spec(Format, _), + format(string(Error), "Invalid format string: ~q", [Format]). + +types_error(Args, Types, Error) :- + length(Types, TypesLen), + length(Args, ArgsLen), + TypesLen =\= ArgsLen, + !, + format( string(Error) + , "Wrong argument count. Expected ~d, got ~d" + , [TypesLen, ArgsLen] + ). +types_error(Args, Types, Error) :- + types_error_(Args, Types, Error). + +types_error_([Arg|_],[Type|_],Error) :- + ground(Arg), + \+ is_of_type(Type,Arg), + message_to_string(error(type_error(Type,Arg),_Location),Error). +types_error_([_|Args],[_|Types],Error) :- + types_error_(Args, Types, Error). + + +% check/0 augmentation +:- multifile check:checker/2. +:- dynamic check:checker/2. +check:checker(format_spec:checker, "format/2 strings and arguments"). + +:- dynamic format_fail/3. + +checker :- + prolog_walk_code([ module_class([user]) + , infer_meta_predicates(false) + , autoload(false) % format/{2,3} are always loaded + , undefined(ignore) + , trace_reference(_) + , on_trace(check_format) + ]), + retract(format_fail(Goal,Location,Error)), + print_message(warning, format_error(Goal,Location,Error)), + fail. % iterate all errors +checker. % succeed even if no errors are found + +check_format(Module:Goal, _Caller, Location) :- + predicate_property(Module:Goal, imported_from(Source)), + memberchk(Source, [system,prolog_debug]), + can_check(Goal), + format_error(Goal, Error), + assert(format_fail(Goal, Location, Error)), + fail. +check_format(_,_,_). % succeed to avoid printing goals + +% true if format_error/2 can check this goal +can_check(Goal) :- + once(clause(format_error(Goal,_),_)). + +prolog:message(format_error(Goal,Location,Error)) --> + prolog:message_location(Location), + ['~n In goal: ~q~n ~s'-[Goal,Error]]. + + +%% format_spec(-Spec)// +% +% DCG for parsing format strings. It doesn't yet generate format +% strings from a spec. See format_spec/2 for details. +format_spec([]) --> + eos. +format_spec([escape(Numeric,Modifier,Action)|Rest]) --> + "~", + numeric_argument(Numeric), + modifier_argument(Modifier), + action(Action), + format_spec(Rest). +format_spec([text(String)|Rest]) --> + { when((ground(String);ground(Codes)),string_codes(String, Codes)) }, + string_without("~", Codes), + { Codes \= [] }, + format_spec(Rest). + + +%% format_spec(+Format, -Spec:list) is semidet. +% +% Parse a format string. Each element of Spec is one of the following: +% +% * `text(Text)` - text sent to the output as is +% * `escape(Num,Colon,Action)` - a format escape +% +% `Num` represents the optional numeric portion of an esape. `Colon` +% represents the optional colon in an escape. `Action` is an atom +% representing the action to be take by this escape. +format_spec(Format, Spec) :- + when((ground(Format);ground(Codes)),text_codes(Format, Codes)), + once(phrase(format_spec(Spec), Codes, [])). + +%% spec_arity(+FormatSpec, -Arity:positive_integer) is det. +% +% True if FormatSpec requires format/2 to have Arity arguments. +spec_arity(Spec, Arity) :- + spec_types(Spec, Types), + length(Types, Arity). + + +%% spec_types(+FormatSpec, -Types:list(type)) is det. +% +% True if FormatSpec requires format/2 to have arguments of Types. Each +% value of Types is a type as described by error:has_type/2. This +% notion of types is compatible with library(mavis). +spec_types(Spec, Types) :- + phrase(spec_types(Spec), Types). + +spec_types([]) --> + []. +spec_types([Item|Items]) --> + item_types(Item), + spec_types(Items). + +item_types(text(_)) --> + []. +item_types(escape(Numeric,_,Action)) --> + numeric_types(Numeric), + action_types(Action). + +numeric_types(number(_)) --> + []. +numeric_types(character(_)) --> + []. +numeric_types(star) --> + [number]. +numeric_types(nothing) --> + []. + +action_types(Action) --> + { atom_codes(Action, [Code]) }, + { action_types(Code, Types) }, + phrase(Types). + + +%% text_codes(Text:text, Codes:codes). +text_codes(Var, Codes) :- + var(Var), + !, + string_codes(Var, Codes). +text_codes(Atom, Codes) :- + atom(Atom), + !, + atom_codes(Atom, Codes). +text_codes(String, Codes) :- + string(String), + !, + string_codes(String, Codes). +text_codes(Codes, Codes) :- + is_of_type(codes, Codes). + + +numeric_argument(number(N)) --> + integer(N). +numeric_argument(character(C)) --> + "`", + [C]. +numeric_argument(star) --> + "*". +numeric_argument(nothing) --> + "". + + +modifier_argument(colon) --> + ":". +modifier_argument(no_colon) --> + \+ ":". + + +action(Action) --> + [C], + { is_action(C) }, + { atom_codes(Action, [C]) }. + + +%% is_action(+Action:integer) is semidet. +%% is_action(-Action:integer) is multi. +% +% True if Action is a valid format/2 action character. Iterates all +% acceptable action characters, if Action is unbound. +is_action(Action) :- + action_types(Action, _). + +%% action_types(?Action:integer, ?Types:list(type)) +% +% True if Action consumes arguments matching Types. An action (like +% `~`), which consumes no arguments, has `Types=[]`. For example, +% +% ?- action_types(0'~, Types). +% Types = []. +% ?- action_types(0'a, Types). +% Types = [atom]. +action_types(0'~, []). +action_types(0'a, [atom]). +action_types(0'c, [integer]). % specifically, a code +action_types(0'd, [integer]). +action_types(0'D, [integer]). +action_types(0'e, [float]). +action_types(0'E, [float]). +action_types(0'f, [float]). +action_types(0'g, [float]). +action_types(0'G, [float]). +action_types(0'i, [any]). +action_types(0'I, [integer]). +action_types(0'k, [any]). +action_types(0'n, []). +action_types(0'N, []). +action_types(0'p, [any]). +action_types(0'q, [any]). +action_types(0'r, [integer]). +action_types(0'R, [integer]). +action_types(0's, [text]). +action_types(0'@, [callable]). +action_types(0't, []). +action_types(0'|, []). +action_types(0'+, []). +action_types(0'w, [any]). +action_types(0'W, [any, list]). diff --git a/samples/Prolog/func.pl b/samples/Prolog/func.pl new file mode 100644 index 00000000..944514e2 --- /dev/null +++ b/samples/Prolog/func.pl @@ -0,0 +1,194 @@ +:- module(func, [ op(675, xfy, ($)) + , op(650, xfy, (of)) + , ($)/2 + , (of)/2 + ]). +:- use_module(library(list_util), [xfy_list/3]). +:- use_module(library(function_expansion)). +:- use_module(library(arithmetic)). +:- use_module(library(error)). + + +% true if the module whose terms are being read has specifically +% imported library(func). +wants_func :- + prolog_load_context(module, Module), + Module \== func, % we don't want func sugar ourselves + predicate_property(Module:of(_,_),imported_from(func)). + + +%% compile_function(+Term, -In, -Out, -Goal) is semidet. +% +% True if Term represents a function from In to Out +% implemented by calling Goal. This multifile hook is +% called by $/2 and of/2 to convert a term into a goal. +% It's used at compile time for macro expansion. +% It's used at run time to handle functions which aren't +% known at compile time. +% When called as a hook, Term is guaranteed to be =nonvar=. +% +% For example, to treat library(assoc) terms as functions which +% map a key to a value, one might define: +% +% :- multifile compile_function/4. +% compile_function(Assoc, Key, Value, Goal) :- +% is_assoc(Assoc), +% Goal = get_assoc(Key, Assoc, Value). +% +% Then one could write: +% +% list_to_assoc([a-1, b-2, c-3], Assoc), +% Two = Assoc $ b, +:- multifile compile_function/4. +compile_function(Var, _, _, _) :- + % variables storing functions must be evaluated at run time + % and can't be compiled, a priori, into a goal + var(Var), + !, + fail. +compile_function(Expr, In, Out, Out is Expr) :- + % arithmetic expression of one variable are simply evaluated + \+ string(Expr), % evaluable/1 throws exception with strings + arithmetic:evaluable(Expr), + term_variables(Expr, [In]). +compile_function(F, In, Out, func:Goal) :- + % composed functions + function_composition_term(F), + user:function_expansion(F, func:Functor, true), + Goal =.. [Functor,In,Out]. +compile_function(F, In, Out, Goal) :- + % string interpolation via format templates + format_template(F), + ( atom(F) -> + Goal = format(atom(Out), F, In) + ; string(F) -> + Goal = format(string(Out), F, In) + ; error:has_type(codes, F) -> + Goal = format(codes(Out), F, In) + ; fail % to be explicit + ). +compile_function(Dict, In, Out, Goal) :- + is_dict(Dict), + Goal = get_dict(In, Dict, Out). + +%% $(+Function, +Argument) is det. +% +% Apply Function to an Argument. A Function is any predicate +% whose final argument generates output and whose penultimate argument +% accepts input. +% +% This is realized by expanding function application to chained +% predicate calls at compile time. Function application itself can +% be chained. +% +% == +% Reversed = reverse $ sort $ [c,d,b]. +% == +:- meta_predicate $(2,+). +$(_,_) :- + throw(error(permission_error(call, predicate, ($)/2), + context(_, '$/2 must be subject to goal expansion'))). + +user:function_expansion($(F,X), Y, Goal) :- + wants_func, + ( func:compile_function(F, X, Y, Goal) -> + true + ; var(F) -> Goal = % defer until run time + ( func:compile_function(F, X, Y, P) -> + call(P) + ; call(F, X, Y) + ) + ; Goal = call(F, X, Y) + ). + + +%% of(+F, +G) is det. +% +% Creates a new function by composing F and G. The functions are +% composed at compile time to create a new, compiled predicate which +% behaves like a function. Function composition can be chained. +% Composed functions can also be applied with $/2. +% +% == +% Reversed = reverse of sort $ [c,d,b]. +% == +:- meta_predicate of(2,2). +of(_,_). + + +%% format_template(Format) is semidet. +% +% True if Format is a template string suitable for format/3. +% The current check is very naive and should be improved. +format_template(Format) :- + atom(Format), !, + atom_codes(Format, Codes), + format_template(Codes). +format_template(Format) :- + string(Format), + !, + string_codes(Format, Codes), + format_template(Codes). +format_template(Format) :- + error:has_type(codes, Format), + memberchk(0'~, Format). % ' fix syntax highlighting + + +% True if the argument is a function composition term +function_composition_term(of(_,_)). + +% Converts a function composition term into a list of functions to compose +functions_to_compose(Term, Funcs) :- + functor(Term, Op, 2), + Op = (of), + xfy_list(Op, Term, Funcs). + +% Thread a state variable through a list of functions. This is similar +% to a DCG expansion, but much simpler. +thread_state([], [], Out, Out). +thread_state([F|Funcs], [Goal|Goals], In, Out) :- + ( compile_function(F, In, Tmp, Goal) -> + true + ; var(F) -> + instantiation_error(F) + ; F =.. [Functor|Args], + append(Args, [In, Tmp], NewArgs), + Goal =.. [Functor|NewArgs] + ), + thread_state(Funcs, Goals, Tmp, Out). + +user:function_expansion(Term, func:Functor, true) :- + wants_func, + functions_to_compose(Term, Funcs), + debug(func, 'building composed function for: ~w', [Term]), + variant_sha1(Funcs, Sha), + format(atom(Functor), 'composed_function_~w', [Sha]), + debug(func, ' name: ~s', [Functor]), + ( func:current_predicate(Functor/2) -> + debug(func, ' composed predicate already exists', []) + ; true -> + reverse(Funcs, RevFuncs), + thread_state(RevFuncs, Threaded, In, Out), + xfy_list(',', Body, Threaded), + Head =.. [Functor, In, Out], + func:assert(Head :- Body), + func:compile_predicates([Functor/2]) + ). + + +% support foo(x,~,y) evaluation +user:function_expansion(Term, Output, Goal) :- + wants_func, + compound(Term), + + % has a single ~ argument + setof( X + , ( arg(X,Term,Arg), Arg == '~' ) + , [N] + ), + + % replace ~ with a variable + Term =.. [Name|Args0], + nth1(N, Args0, ~, Rest), + nth1(N, Args, Output, Rest), + Goal =.. [Name|Args]. diff --git a/samples/Python/Cinema4DPythonPlugin.pyp b/samples/Python/Cinema4DPythonPlugin.pyp new file mode 100644 index 00000000..30c2aa78 --- /dev/null +++ b/samples/Python/Cinema4DPythonPlugin.pyp @@ -0,0 +1,241 @@ +# +# Cinema 4D Python Plugin Source file +# https://github.com/nr-plugins/nr-xpresso-alignment-tools +# + +# coding: utf-8 +# +# Copyright (C) 2012, Niklas Rosenstein +# Licensed under the GNU General Public License +# +# XPAT - XPresso Alignment Tools +# ============================== +# +# The XPAT plugin provides tools for aligning nodes in the Cinema 4D +# XPresso Editor, improving readability of complex XPresso set-ups +# immensively. +# +# Requirements: +# - MAXON Cinema 4D R13+ +# - Python `c4dtools` library. Get it from +# http://github.com/NiklasRosenstein/c4dtools +# +# Author: Niklas Rosenstein +# Version: 1.1 (01/06/2012) + +import os +import sys +import json +import c4d +import c4dtools +import itertools + +from c4d.modules import graphview as gv +from c4dtools.misc import graphnode + +res, importer = c4dtools.prepare(__file__, __res__) +settings = c4dtools.helpers.Attributor({ + 'options_filename': res.file('config.json'), +}) + +def align_nodes(nodes, mode, spacing): + r""" + Aligns the passed nodes horizontally and apply the minimum spacing + between them. + """ + + modes = ['horizontal', 'vertical'] + if not nodes: + return + if mode not in modes: + raise ValueError('invalid mode, choices are: ' + ', '.join(modes)) + + get_0 = lambda x: x.x + get_1 = lambda x: x.y + set_0 = lambda x, v: setattr(x, 'x', v) + set_1 = lambda x, v: setattr(x, 'y', v) + + if mode == 'vertical': + get_0, get_1 = get_1, get_0 + set_0, set_1 = set_1, set_0 + + nodes = [graphnode.GraphNode(n) for n in nodes] + nodes.sort(key=lambda n: get_0(n.position)) + midpoint = graphnode.find_nodes_mid(nodes) + + # Apply the spacing between the nodes relative to the coordinate-systems + # origin. We can offset them later because we now the nodes' midpoint + # already. + first_position = nodes[0].position + new_positions = [] + prev_offset = 0 + for node in nodes: + # Compute the relative position of the node. + position = node.position + set_0(position, get_0(position) - get_0(first_position)) + + # Obtain it's size and check if the node needs to be re-placed. + size = node.size + if get_0(position) < prev_offset: + set_0(position, prev_offset) + prev_offset += spacing + get_0(size) + else: + prev_offset = get_0(position) + get_0(size) + spacing + + set_1(position, get_1(midpoint)) + new_positions.append(position) + + # Center the nodes again. + bbox_size = prev_offset - spacing + bbox_size_2 = bbox_size * 0.5 + for node, position in itertools.izip(nodes, new_positions): + # TODO: Here is some issue with offsetting the nodes. Some value + # dependent on the spacing must be added here to not make the nodes + # move horizontally/vertically although they have already been + # aligned. + set_0(position, get_0(midpoint) + get_0(position) - bbox_size_2 + spacing) + node.position = position + +def align_nodes_shortcut(mode, spacing): + master = gv.GetMaster(0) + if not master: + return + + root = master.GetRoot() + if not root: + return + + nodes = graphnode.find_selected_nodes(root) + if nodes: + master.AddUndo() + align_nodes(nodes, mode, spacing) + c4d.EventAdd() + + return True + +class XPAT_Options(c4dtools.helpers.Attributor): + r""" + This class organizes the options for the XPAT plugin, i.e. + validating, loading and saving. + """ + + defaults = { + 'hspace': 50, + 'vspace': 20, + } + + def __init__(self, filename=None): + super(XPAT_Options, self).__init__() + self.load(filename) + + def load(self, filename=None): + r""" + Load the options from file pointed to by filename. If filename + is None, it defaults to the filename defined in options in the + global scope. + """ + + if filename is None: + filename = settings.options_filename + + if os.path.isfile(filename): + self.dict_ = self.defaults.copy() + with open(filename, 'rb') as fp: + self.dict_.update(json.load(fp)) + else: + self.dict_ = self.defaults.copy() + self.save() + + def save(self, filename=None): + r""" + Save the options defined in XPAT_Options instance to HD. + """ + + if filename is None: + filename = settings.options_filename + + values = dict((k, v) for k, v in self.dict_.iteritems() + if k in self.defaults) + with open(filename, 'wb') as fp: + json.dump(values, fp) + +class XPAT_OptionsDialog(c4d.gui.GeDialog): + r""" + This class implements the behavior of the XPAT options dialog, + taking care of storing the options on the HD and loading them + again on startup. + """ + + # c4d.gui.GeDialog + + def CreateLayout(self): + return self.LoadDialogResource(res.DLG_OPTIONS) + + def InitValues(self): + self.SetLong(res.EDT_HSPACE, options.hspace) + self.SetLong(res.EDT_VSPACE, options.vspace) + return True + + def Command(self, id, msg): + if id == res.BTN_SAVE: + options.hspace = self.GetLong(res.EDT_HSPACE) + options.vspace = self.GetLong(res.EDT_VSPACE) + options.save() + self.Close() + return True + +class XPAT_Command_OpenOptionsDialog(c4dtools.plugins.Command): + r""" + This Cinema 4D CommandData plugin opens the XPAT options dialog + when being executed. + """ + + def __init__(self): + super(XPAT_Command_OpenOptionsDialog, self).__init__() + self._dialog = None + + @property + def dialog(self): + if not self._dialog: + self._dialog = XPAT_OptionsDialog() + return self._dialog + + # c4dtools.plugins.Command + + PLUGIN_ID = 1029621 + PLUGIN_NAME = res.string.XPAT_COMMAND_OPENOPTIONSDIALOG() + PLUGIN_HELP = res.string.XPAT_COMMAND_OPENOPTIONSDIALOG_HELP() + + # c4d.gui.CommandData + + def Execute(self, doc): + return self.dialog.Open(c4d.DLG_TYPE_MODAL) + +class XPAT_Command_AlignHorizontal(c4dtools.plugins.Command): + + PLUGIN_ID = 1029538 + PLUGIN_NAME = res.string.XPAT_COMMAND_ALIGNHORIZONTAL() + PLUGIN_ICON = res.file('xpresso-align-h.png') + PLUGIN_HELP = res.string.XPAT_COMMAND_ALIGNHORIZONTAL_HELP() + + def Execute(self, doc): + align_nodes_shortcut('horizontal', options.hspace) + return True + +class XPAT_Command_AlignVertical(c4dtools.plugins.Command): + + PLUGIN_ID = 1029539 + PLUGIN_NAME = res.string.XPAT_COMMAND_ALIGNVERTICAL() + PLUGIN_ICON = res.file('xpresso-align-v.png') + PLUGIN_HELP = res.string.XPAT_COMMAND_ALIGNVERTICAL_HELP() + + def Execute(self, doc): + align_nodes_shortcut('vertical', options.vspace) + return True + +options = XPAT_Options() + +if __name__ == '__main__': + c4dtools.plugins.main() + + diff --git a/samples/STON/Array.ston b/samples/STON/Array.ston new file mode 100644 index 00000000..b5d8bb58 --- /dev/null +++ b/samples/STON/Array.ston @@ -0,0 +1 @@ +[1, 2, 3] diff --git a/samples/STON/Dictionary.ston b/samples/STON/Dictionary.ston new file mode 100644 index 00000000..ae4e2731 --- /dev/null +++ b/samples/STON/Dictionary.ston @@ -0,0 +1 @@ +{#a : 1, #b : 2} diff --git a/samples/STON/Rectangle.ston b/samples/STON/Rectangle.ston new file mode 100644 index 00000000..f9c81b33 --- /dev/null +++ b/samples/STON/Rectangle.ston @@ -0,0 +1,4 @@ +Rectangle { + #origin : Point [ -40, -15 ], + #corner : Point [ 60, 35 ] + } diff --git a/samples/STON/TestDomainObject.ston b/samples/STON/TestDomainObject.ston new file mode 100644 index 00000000..d054f4c5 --- /dev/null +++ b/samples/STON/TestDomainObject.ston @@ -0,0 +1,15 @@ +TestDomainObject { + #created : DateAndTime [ '2012-02-14T16:40:15+01:00' ], + #modified : DateAndTime [ '2012-02-14T16:40:18+01:00' ], + #integer : 39581, + #float : 73.84789359463944, + #description : 'This is a test', + #color : #green, + #tags : [ + #two, + #beta, + #medium + ], + #bytes : ByteArray [ 'afabfdf61d030f43eb67960c0ae9f39f' ], + #boolean : false +} diff --git a/samples/STON/ZNResponse.ston b/samples/STON/ZNResponse.ston new file mode 100644 index 00000000..66378370 --- /dev/null +++ b/samples/STON/ZNResponse.ston @@ -0,0 +1,30 @@ +ZnResponse { + #headers : ZnHeaders { + #headers : ZnMultiValueDictionary { + 'Date' : 'Fri, 04 May 2012 20:09:23 GMT', + 'Modification-Date' : 'Thu, 10 Feb 2011 08:32:30 GMT', + 'Content-Length' : '113', + 'Server' : 'Zinc HTTP Components 1.0', + 'Vary' : 'Accept-Encoding', + 'Connection' : 'close', + 'Content-Type' : 'text/html;charset=utf-8' + } + }, + #entity : ZnStringEntity { + #contentType : ZnMimeType { + #main : 'text', + #sub : 'html', + #parameters : { + 'charset' : 'utf-8' + } + }, + #contentLength : 113, + #string : '\nSmall\n

Small

This is a small HTML document

\n\n', + #encoder : ZnUTF8Encoder { } + }, + #statusLine : ZnStatusLine { + #version : 'HTTP/1.1', + #code : 200, + #reason : 'OK' + } + } diff --git a/samples/STON/methodProperties.ston b/samples/STON/methodProperties.ston new file mode 100644 index 00000000..40a1a0fe --- /dev/null +++ b/samples/STON/methodProperties.ston @@ -0,0 +1,24 @@ +{ + "class" : { + }, + "instance" : { + "clientList:listElement:" : "dkh 03/20/2014 16:27", + "copyObjectMenuAction:selectionIndex:" : "dkh 10/13/2013 10:20", + "definitionForSelection:" : "dkh 10/13/2013 10:15", + "editMenuActionSpec" : "dkh 10/13/2013 10:19", + "itemSelected:listElement:selectedIndex:shiftPressed:" : "dkh 10/20/2013 11:06", + "menuActionSpec:" : "dkh 10/19/2013 17:12", + "repository:" : "dkh 10/19/2013 17:36", + "theList" : "dkh 10/12/2013 15:51", + "versionInfoBlock:" : "dkh 10/19/2013 17:08", + "versionInfoDiffVsSelection:selectedIndex:" : "dkh 10/19/2013 17:48", + "versionInfoDiffVsWorkingCopy:selectedIndex:" : "dkh 10/20/2013 12:36", + "versionInfoSelect:selectedIndex:" : "dkh 10/12/2013 17:04", + "versionInfos" : "dkh 10/19/2013 17:13", + "versionSummaryIsClosing" : "dkh 10/20/2013 10:19", + "windowIsClosing:" : "dkh 10/20/2013 10:39", + "windowLabel" : "dkh 05/20/2014 11:00", + "windowLocation" : "dkh 05/23/2014 10:17", + "windowName" : "dkh 10/12/2013 16:00", + "workingCopy" : "dkh 10/12/2013 16:16", + "workingCopy:" : "dkh 10/12/2013 16:17" } } diff --git a/samples/STON/properties.ston b/samples/STON/properties.ston new file mode 100644 index 00000000..b4aa0206 --- /dev/null +++ b/samples/STON/properties.ston @@ -0,0 +1,19 @@ +{ + "category" : "Topez-Server-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "workingCopy", + "repository", + "versionInfos", + "versionInfoBlock", + "selectedVersionInfo", + "versionInfoSummaryWindowId" ], + "name" : "TDVersionInfoBrowser", + "pools" : [ + ], + "super" : "TDAbstractMonticelloToolBuilder", + "type" : "normal" } diff --git a/samples/Slim/sample.slim b/samples/Slim/sample.slim new file mode 100644 index 00000000..9480a9ff --- /dev/null +++ b/samples/Slim/sample.slim @@ -0,0 +1,31 @@ +doctype html +html + head + title Slim Examples + meta name="keywords" content="template language" + meta name="author" content=author + javascript: + alert('Slim supports embedded javascript!') + + body + h1 Markup examples + + #content + p This example shows you how a basic Slim file looks like. + + == yield + + - unless items.empty? + table + - for item in items do + tr + td.name = item.name + td.price = item.price + - else + p + | No items found. Please add some inventory. + Thank you! + + div id="footer" + = render 'footer' + | Copyright © #{year} #{author} diff --git a/samples/Text/Visual_Battlers.rb b/samples/Text/Visual_Battlers.rb new file mode 100644 index 00000000..74bb0f2c --- /dev/null +++ b/samples/Text/Visual_Battlers.rb @@ -0,0 +1,703 @@ +#============================================================================== +# +# Yanfly Engine Ace - Visual Battlers v1.01 +# -- Last Updated: 2012.07.24 +# -- Level: Easy +# -- Requires: n/a +# +# Modified by: +# -- Yami +# -- Kread-Ex +# -- Archeia_Nessiah +#============================================================================== + +$imported = {} if $imported.nil? +$imported["YEA-VisualBattlers"] = true + +#============================================================================== +# Updates +# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# 2012.12.18 - Added preset views and able to change direction in-game. +# 2012.07.24 - Finished Script. +# 2012.01.05 - Started Script. +# +#============================================================================== +# Introduction +# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# This script provides a visual for all actors by default charsets. The actions +# and movements are alike Final Fantasy 1, only move forward and backward when +# start and finish actions. +# +#============================================================================== +# Instructions +# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# To change the player direction in-game, use the snippet below in a script +# call: +# +# $game_system.party_direction = n +# +# To install this script, open up your script editor and copy/paste this script +# to an open slot below Materials but above Main. Remember to save. +# +#============================================================================== +# Compatibility +# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that +# it will run with RPG Maker VX without adjusting. +# +#============================================================================== + +module YEA + module VISUAL_BATTLERS + + #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + # - Party Location Setting - + #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + # These settings are adjusted for Party Location. Each Actor will have + # coordinates calculated by below formula. There are two samples coordinates + # below, change PARTY_DIRECTION to the base index you want to use. + #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + PARTY_DIRECTION = 6 # This direction is opposite from actual direction. + + PARTY_LOCATION_BASE_COORDINATES ={ + # Index => [base_x, base_y, mod_x, mod_y], + 2 => [ 250, 290, 40, 0], #UP + 4 => [ 150, 280, 20, -20], #LEFT + 3 => [ 460, 280, 30, -10], #RIGHT + 6 => [ 460, 230, 20, 20], #DEFAULT RIGHT + 8 => [ 260, 230, 40, 0], #DOWN + } # Do not remove this. + + PARTY_LOCATION_FORMULA_X = "base_x + index * mod_x" + PARTY_LOCATION_FORMULA_Y = "base_y + index * mod_y" + + end # VISUAL_BATTLERS +end # YEA + +#============================================================================== +# Editting anything past this point may potentially result in causing +# computer damage, incontinence, explosion of user's head, coma, death, and/or +# halitosis so edit at your own risk. +#============================================================================== + +#============================================================================== +# ? Direction +#============================================================================== + +module Direction + + #-------------------------------------------------------------------------- + # self.correct + #-------------------------------------------------------------------------- + def self.correct(direction) + case direction + when 1; return 4 + when 3; return 6 + when 7; return 4 + when 9; return 6 + else; return direction + end + end + + #-------------------------------------------------------------------------- + # self.opposite + #-------------------------------------------------------------------------- + def self.opposite(direction) + case direction + when 1; return 6 + when 2; return 8 + when 3; return 4 + when 4; return 6 + when 6; return 4 + when 7; return 6 + when 8; return 2 + when 9; return 4 + else; return direction + end + end + +end # Direction + +#============================================================================== +# ? Game_System +#============================================================================== + +class Game_System; attr_accessor :party_direction; end + +#============================================================================== +# ? Game_BattleCharacter +#============================================================================== + +class Game_BattleCharacter < Game_Character + + #-------------------------------------------------------------------------- + # initialize + #-------------------------------------------------------------------------- + def initialize(actor) + super() + setup_actor(actor) + @move_x_rate = 0 + @move_y_rate = 0 + end + + #-------------------------------------------------------------------------- + # setup_actor + #-------------------------------------------------------------------------- + def setup_actor(actor) + @actor = actor + @step_anime = true + set_graphic(@actor.character_name, @actor.character_index) + setup_coordinates + dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION + direction = Direction.opposite(dr) + set_direction(Direction.correct(direction)) + end + + #-------------------------------------------------------------------------- + # sprite= + #-------------------------------------------------------------------------- + def sprite=(sprite) + @sprite = sprite + end + + #-------------------------------------------------------------------------- + # setup_coordinates + #-------------------------------------------------------------------------- + def setup_coordinates + location = ($game_system.party_direction || + YEA::VISUAL_BATTLERS::PARTY_DIRECTION) + base_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][0] + base_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][1] + mod_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][2] + mod_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][3] + @actor.screen_x = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_X) + @actor.screen_y = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_Y) + @actor.origin_x = @actor.screen_x + @actor.origin_y = @actor.screen_y + @actor.create_move_to(screen_x, screen_y, 1) + end + + #-------------------------------------------------------------------------- + # index + #-------------------------------------------------------------------------- + def index + return @actor.index + end + + #-------------------------------------------------------------------------- + # screen_x + #-------------------------------------------------------------------------- + def screen_x + return @actor.screen_x + end + + #-------------------------------------------------------------------------- + # screen_y + #-------------------------------------------------------------------------- + def screen_y + return @actor.screen_y + end + + #-------------------------------------------------------------------------- + # screen_z + #-------------------------------------------------------------------------- + def screen_z + return @actor.screen_z + end + +end # Game_BattleCharacter + +#============================================================================== +# ? Game_Battler +#============================================================================== + +class Game_Battler < Game_BattlerBase + + #-------------------------------------------------------------------------- + # public instance variables + #-------------------------------------------------------------------------- + attr_accessor :moved_back + attr_accessor :origin_x + attr_accessor :origin_y + attr_accessor :screen_x + attr_accessor :screen_y + attr_accessor :started_turn + + #-------------------------------------------------------------------------- + # alias method: execute_damage + #-------------------------------------------------------------------------- + alias game_battler_execute_damage_vb execute_damage + def execute_damage(user) + game_battler_execute_damage_vb(user) + if @result.hp_damage > 0 + move_backward(24, 6) unless @moved_back + @moved_back = true + end + end + + #-------------------------------------------------------------------------- + # face_opposing_party + #-------------------------------------------------------------------------- + def face_opposing_party + direction = ($game_system.party_direction || + YEA::VISUAL_BATTLERS::PARTY_DIRECTION) + character.set_direction(Direction.correct(direction)) rescue 0 + end + + #-------------------------------------------------------------------------- + # new method: face_coordinate + #-------------------------------------------------------------------------- + def face_coordinate(destination_x, destination_y) + x1 = Integer(@screen_x) + x2 = Integer(destination_x) + y1 = Graphics.height - Integer(@screen_y) + y2 = Graphics.height - Integer(destination_y) + return if x1 == x2 and y1 == y2 + #--- + angle = Integer(Math.atan2((y2-y1),(x2-x1)) * 1800 / Math::PI) + if (0..225) === angle or (-225..0) === angle + direction = 6 + elsif (226..675) === angle + direction = 9 + elsif (676..1125) === angle + direction = 8 + elsif (1126..1575) === angle + direction = 7 + elsif (1576..1800) === angle or (-1800..-1576) === angle + direction = 4 + elsif (-1575..-1126) === angle + direction = 1 + elsif (-1125..-676) === angle + direction = 2 + elsif (-675..-226) === angle + direction = 3 + end + #--- + character.set_direction(Direction.correct(direction)) rescue 0 + end + + #-------------------------------------------------------------------------- + # create_move_to + #-------------------------------------------------------------------------- + def create_move_to(destination_x, destination_y, frames = 12) + @destination_x = destination_x + @destination_y = destination_y + frames = [frames, 1].max + @move_x_rate = [(@screen_x - @destination_x).abs / frames, 2].max + @move_y_rate = [(@screen_y - @destination_y).abs / frames, 2].max + end + + #-------------------------------------------------------------------------- + # update_move_to + #-------------------------------------------------------------------------- + def update_move_to + @move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil? + @move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil? + value = [(@screen_x - @destination_x).abs, @move_x_rate].min + @screen_x += (@destination_x > @screen_x) ? value : -value + value = [(@screen_y - @destination_y).abs, @move_y_rate].min + @screen_y += (@destination_y > @screen_y) ? value : -value + end + + #-------------------------------------------------------------------------- + # move_forward + #-------------------------------------------------------------------------- + def move_forward(distance = 24, frames = 12) + direction = forward_direction + move_direction(direction, distance, frames) + end + + #-------------------------------------------------------------------------- + # move_backward + #-------------------------------------------------------------------------- + def move_backward(distance = 24, frames = 12) + direction = Direction.opposite(forward_direction) + move_direction(direction, distance, frames) + end + + #-------------------------------------------------------------------------- + # move_direction + #-------------------------------------------------------------------------- + def move_direction(direction, distance = 24, frames = 12) + case direction + when 1; move_x = distance / -2; move_y = distance / 2 + when 2; move_x = distance * 0; move_y = distance * 1 + when 3; move_x = distance / -2; move_y = distance / 2 + when 4; move_x = distance * -1; move_y = distance * 0 + when 6; move_x = distance * 1; move_y = distance * 0 + when 7; move_x = distance / -2; move_y = distance / -2 + when 8; move_x = distance * 0; move_y = distance * -1 + when 9; move_x = distance / 2; move_y = distance / -2 + else; return + end + destination_x = @screen_x + move_x + destination_y = @screen_y + move_y + create_move_to(destination_x, destination_y, frames) + end + + #-------------------------------------------------------------------------- + # forward_direction + #-------------------------------------------------------------------------- + def forward_direction + return ($game_system.party_direction || + YEA::VISUAL_BATTLERS::PARTY_DIRECTION) + end + + #-------------------------------------------------------------------------- + # move_origin + #-------------------------------------------------------------------------- + def move_origin + create_move_to(@origin_x, @origin_y) + face_coordinate(@origin_x, @origin_y) + @moved_back = false + end + + #-------------------------------------------------------------------------- + # moving? + #-------------------------------------------------------------------------- + def moving? + return false if dead? || !exist? + return @move_x_rate != 0 || @move_y_rate != 0 + end + +end # Game_Battler + +#============================================================================== +# ? Game_Actor +#============================================================================== + +class Game_Actor < Game_Battler + + #-------------------------------------------------------------------------- + # overwrite method: use_sprite? + #-------------------------------------------------------------------------- + def use_sprite? + return true + end + + #-------------------------------------------------------------------------- + # new method: screen_x + #-------------------------------------------------------------------------- + def screen_x + return @screen_x rescue 0 + end + + #-------------------------------------------------------------------------- + # new method: screen_y + #-------------------------------------------------------------------------- + def screen_y + return @screen_y rescue 0 + end + + #-------------------------------------------------------------------------- + # new method: screen_z + #-------------------------------------------------------------------------- + def screen_z + return 100 + end + + #-------------------------------------------------------------------------- + # new method: sprite + #-------------------------------------------------------------------------- + def sprite + index = $game_party.battle_members.index(self) + return SceneManager.scene.spriteset.actor_sprites[index] + end + + #-------------------------------------------------------------------------- + # new method: character + #-------------------------------------------------------------------------- + def character + return sprite.character_base + end + + #-------------------------------------------------------------------------- + # face_opposing_party + #-------------------------------------------------------------------------- + def face_opposing_party + dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION + direction = Direction.opposite(dr) + character.set_direction(Direction.correct(direction)) rescue 0 + end + + #-------------------------------------------------------------------------- + # forward_direction + #-------------------------------------------------------------------------- + def forward_direction + return Direction.opposite(($game_system.party_direction || + YEA::VISUAL_BATTLERS::PARTY_DIRECTION)) + end + +end # Game_Actor + +#============================================================================== +# ? Game_Enemy +#============================================================================== + +class Game_Enemy < Game_Battler + + #-------------------------------------------------------------------------- + # new method: sprite + #-------------------------------------------------------------------------- + def sprite + return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index] + end + + #-------------------------------------------------------------------------- + # new method: character + #-------------------------------------------------------------------------- + def character + return sprite + end + +end # Game_Enemy + +#============================================================================== +# ? Game_Troop +#============================================================================== + +class Game_Troop < Game_Unit + + #-------------------------------------------------------------------------- + # alias method: setup + #-------------------------------------------------------------------------- + alias game_troop_setup_vb setup + def setup(troop_id) + game_troop_setup_vb(troop_id) + set_coordinates + end + + #-------------------------------------------------------------------------- + # new method: set_coordinates + #-------------------------------------------------------------------------- + def set_coordinates + for member in members + member.origin_x = member.screen_x + member.origin_y = member.screen_y + member.create_move_to(member.screen_x, member.screen_y, 1) + end + end + +end # Game_Troop + +#============================================================================== +# ? Sprite_Battler +#============================================================================== + +class Sprite_Battler < Sprite_Base + + #-------------------------------------------------------------------------- + # public instance_variable + #-------------------------------------------------------------------------- + attr_accessor :character_base + attr_accessor :character_sprite + + #-------------------------------------------------------------------------- + # alias method: dispose + #-------------------------------------------------------------------------- + alias sprite_battler_dispose_vb dispose + def dispose + dispose_character_sprite + sprite_battler_dispose_vb + end + + #-------------------------------------------------------------------------- + # new method: dispose_character_sprite + #-------------------------------------------------------------------------- + def dispose_character_sprite + @character_sprite.dispose unless @character_sprite.nil? + end + + #-------------------------------------------------------------------------- + # alias method: update + #-------------------------------------------------------------------------- + alias sprite_battler_update_vb update + def update + sprite_battler_update_vb + return if @battler.nil? + update_move_to + update_character_base + update_character_sprite + end + + #-------------------------------------------------------------------------- + # new method: update_character_base + #-------------------------------------------------------------------------- + def update_character_base + return if @character_base.nil? + @character_base.update + end + + #-------------------------------------------------------------------------- + # new method: update_character_sprite + #-------------------------------------------------------------------------- + def update_character_sprite + return if @character_sprite.nil? + @character_sprite.update + end + + #-------------------------------------------------------------------------- + # new method: update_move_to + #-------------------------------------------------------------------------- + def update_move_to + @battler.update_move_to + end + + #-------------------------------------------------------------------------- + # new method: moving? + #-------------------------------------------------------------------------- + def moving? + return false if @battler.nil? + return @battler.moving? + end + +end # Sprite_Battler + +#============================================================================== +# ? Sprite_BattleCharacter +#============================================================================== + +class Sprite_BattleCharacter < Sprite_Character + + #-------------------------------------------------------------------------- + # initialize + #-------------------------------------------------------------------------- + def initialize(viewport, character = nil) + super(viewport, character) + character.sprite = self + end + +end # Sprite_BattleCharacter + +#============================================================================== +# ? Spriteset_Battle +#============================================================================== + +class Spriteset_Battle + + #-------------------------------------------------------------------------- + # public instance_variable + #-------------------------------------------------------------------------- + attr_accessor :actor_sprites + attr_accessor :enemy_sprites + + #-------------------------------------------------------------------------- + # overwrite method: create_actors + #-------------------------------------------------------------------------- + def create_actors + total = $game_party.max_battle_members + @current_party = $game_party.battle_members.clone + @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) } + for actor in $game_party.battle_members + @actor_sprites[actor.index].battler = actor + create_actor_sprite(actor) + end + end + + #-------------------------------------------------------------------------- + # new method: create_actor_sprite + #-------------------------------------------------------------------------- + def create_actor_sprite(actor) + character = Game_BattleCharacter.new(actor) + character_sprite = Sprite_BattleCharacter.new(@viewport1, character) + @actor_sprites[actor.index].character_base = character + @actor_sprites[actor.index].character_sprite = character_sprite + actor.face_opposing_party + end + + #-------------------------------------------------------------------------- + # alias method: update_actors + #-------------------------------------------------------------------------- + alias spriteset_battle_update_actors_vb update_actors + def update_actors + if @current_party != $game_party.battle_members + dispose_actors + create_actors + end + spriteset_battle_update_actors_vb + end + + #-------------------------------------------------------------------------- + # new method: moving? + #-------------------------------------------------------------------------- + def moving? + return battler_sprites.any? {|sprite| sprite.moving? } + end + +end # Spriteset_Battle + +#============================================================================== +# ? Scene_Battle +#============================================================================== + +class Scene_Battle < Scene_Base + + #-------------------------------------------------------------------------- + # public instance variables + #-------------------------------------------------------------------------- + attr_accessor :spriteset + + #-------------------------------------------------------------------------- + # alias method: process_action_end + #-------------------------------------------------------------------------- + alias scene_battle_process_action_end_vb process_action_end + def process_action_end + start_battler_move_origin + scene_battle_process_action_end_vb + end + + #-------------------------------------------------------------------------- + # alias method: execute_action + #-------------------------------------------------------------------------- + alias scene_battle_execute_action_vb execute_action + def execute_action + start_battler_move_forward + scene_battle_execute_action_vb + end + + #-------------------------------------------------------------------------- + # new method: start_battler_move_forward + #-------------------------------------------------------------------------- + def start_battler_move_forward + return if @subject.started_turn + @subject.started_turn = true + @subject.move_forward + wait_for_moving + end + + #-------------------------------------------------------------------------- + # new method: start_battler_move_origin + #-------------------------------------------------------------------------- + def start_battler_move_origin + @subject.started_turn = nil + move_battlers_origin + wait_for_moving + @subject.face_opposing_party rescue 0 + end + + #-------------------------------------------------------------------------- + # new method: move_battlers_origin + #-------------------------------------------------------------------------- + def move_battlers_origin + for member in all_battle_members + next if member.dead? + next unless member.exist? + member.move_origin + end + end + + #-------------------------------------------------------------------------- + # new method: wait_for_moving + #-------------------------------------------------------------------------- + def wait_for_moving + update_for_wait + update_for_wait while @spriteset.moving? + end + +end # Scene_Battle + +#============================================================================== +# +# End of File +# +#============================================================================== diff --git a/samples/XML/sample.nuspec b/samples/XML/sample.nuspec new file mode 100644 index 00000000..238c325a --- /dev/null +++ b/samples/XML/sample.nuspec @@ -0,0 +1,21 @@ + + + + Sample + Sample + 0.101.0 + Hugh Bot + Hugh Bot + A package of nuget + + It just works + + http://hubot.github.com + + https://github.com/github/hubot/LICENSEmd + false + + + + + diff --git a/samples/Xojo/App.xojo_code b/samples/Xojo/App.xojo_code new file mode 100644 index 00000000..4b7d02a5 --- /dev/null +++ b/samples/Xojo/App.xojo_code @@ -0,0 +1,22 @@ +#tag Class +Protected Class App +Inherits Application + #tag Constant, Name = kEditClear, Type = String, Dynamic = False, Default = \"&Delete", Scope = Public + #Tag Instance, Platform = Windows, Language = Default, Definition = \"&Delete" + #Tag Instance, Platform = Linux, Language = Default, Definition = \"&Delete" + #tag EndConstant + + #tag Constant, Name = kFileQuit, Type = String, Dynamic = False, Default = \"&Quit", Scope = Public + #Tag Instance, Platform = Windows, Language = Default, Definition = \"E&xit" + #tag EndConstant + + #tag Constant, Name = kFileQuitShortcut, Type = String, Dynamic = False, Default = \"", Scope = Public + #Tag Instance, Platform = Mac OS, Language = Default, Definition = \"Cmd+Q" + #Tag Instance, Platform = Linux, Language = Default, Definition = \"Ctrl+Q" + #tag EndConstant + + + #tag ViewBehavior + #tag EndViewBehavior +End Class +#tag EndClass diff --git a/samples/Xojo/BillingReport.xojo_report b/samples/Xojo/BillingReport.xojo_report new file mode 100644 index 00000000..fae10085 --- /dev/null +++ b/samples/Xojo/BillingReport.xojo_report @@ -0,0 +1,23 @@ +#tag Report +Begin Report BillingReport + Compatibility = "" + Units = 0 + Width = 8.5 + Begin PageHeader + Type = 1 + Height = 1.0 + End + Begin Body + Type = 3 + Height = 2.0 + End + Begin PageFooter + Type = 5 + Height = 1.0 + End +End +#tag EndReport + +#tag ReportCode +#tag EndReportCode + diff --git a/samples/Xojo/MainMenuBar.xojo_menu b/samples/Xojo/MainMenuBar.xojo_menu new file mode 100644 index 00000000..0634681c --- /dev/null +++ b/samples/Xojo/MainMenuBar.xojo_menu @@ -0,0 +1,112 @@ +#tag Menu +Begin Menu MainMenuBar + Begin MenuItem FileMenu + SpecialMenu = 0 + Text = "&File" + Index = -2147483648 + AutoEnable = True + Visible = True + Begin QuitMenuItem FileQuit + SpecialMenu = 0 + Text = "#App.kFileQuit" + Index = -2147483648 + ShortcutKey = "#App.kFileQuitShortcut" + Shortcut = "#App.kFileQuitShortcut" + AutoEnable = True + Visible = True + End + End + Begin MenuItem EditMenu + SpecialMenu = 0 + Text = "&Edit" + Index = -2147483648 + AutoEnable = True + Visible = True + Begin MenuItem EditUndo + SpecialMenu = 0 + Text = "&Undo" + Index = -2147483648 + ShortcutKey = "Z" + Shortcut = "Cmd+Z" + MenuModifier = True + AutoEnable = True + Visible = True + End + Begin MenuItem EditSeparator1 + SpecialMenu = 0 + Text = "-" + Index = -2147483648 + AutoEnable = True + Visible = True + End + Begin MenuItem EditCut + SpecialMenu = 0 + Text = "Cu&t" + Index = -2147483648 + ShortcutKey = "X" + Shortcut = "Cmd+X" + MenuModifier = True + AutoEnable = True + Visible = True + End + Begin MenuItem EditCopy + SpecialMenu = 0 + Text = "&Copy" + Index = -2147483648 + ShortcutKey = "C" + Shortcut = "Cmd+C" + MenuModifier = True + AutoEnable = True + Visible = True + End + Begin MenuItem EditPaste + SpecialMenu = 0 + Text = "&Paste" + Index = -2147483648 + ShortcutKey = "V" + Shortcut = "Cmd+V" + MenuModifier = True + AutoEnable = True + Visible = True + End + Begin MenuItem EditClear + SpecialMenu = 0 + Text = "#App.kEditClear" + Index = -2147483648 + AutoEnable = True + Visible = True + End + Begin MenuItem EditSeparator2 + SpecialMenu = 0 + Text = "-" + Index = -2147483648 + AutoEnable = True + Visible = True + End + Begin MenuItem EditSelectAll + SpecialMenu = 0 + Text = "Select &All" + Index = -2147483648 + ShortcutKey = "A" + Shortcut = "Cmd+A" + MenuModifier = True + AutoEnable = True + Visible = True + End + Begin MenuItem UntitledSeparator + SpecialMenu = 0 + Text = "-" + Index = -2147483648 + AutoEnable = True + Visible = True + End + Begin AppleMenuItem AboutItem + SpecialMenu = 0 + Text = "About This App..." + Index = -2147483648 + AutoEnable = True + Visible = True + End + End +End +#tag EndMenu diff --git a/samples/Xojo/MyToolbar.xojo_toolbar b/samples/Xojo/MyToolbar.xojo_toolbar new file mode 100644 index 00000000..02dfbf0a --- /dev/null +++ b/samples/Xojo/MyToolbar.xojo_toolbar @@ -0,0 +1,14 @@ +#tag Toolbar +Begin Toolbar MyToolbar + Begin ToolButton FirstItem + Caption = "First Item" + HelpTag = "" + Style = 0 + End + Begin ToolButton SecondItem + Caption = "Second Item" + HelpTag = "" + Style = 0 + End +End +#tag EndToolbar diff --git a/samples/Xojo/Window1.xojo_window b/samples/Xojo/Window1.xojo_window new file mode 100644 index 00000000..c52fd843 --- /dev/null +++ b/samples/Xojo/Window1.xojo_window @@ -0,0 +1,304 @@ +#tag Window +Begin Window Window1 + BackColor = &cFFFFFF00 + Backdrop = 0 + CloseButton = True + Compatibility = "" + Composite = False + Frame = 0 + FullScreen = False + FullScreenButton= False + HasBackColor = False + Height = 400 + ImplicitInstance= True + LiveResize = True + MacProcID = 0 + MaxHeight = 32000 + MaximizeButton = True + MaxWidth = 32000 + MenuBar = 1153981589 + MenuBarVisible = True + MinHeight = 64 + MinimizeButton = True + MinWidth = 64 + Placement = 0 + Resizeable = True + Title = "Sample App" + Visible = True + Width = 600 + Begin PushButton HelloWorldButton + AutoDeactivate = True + Bold = False + ButtonStyle = "0" + Cancel = False + Caption = "Push Me" + Default = True + Enabled = True + Height = 20 + HelpTag = "" + Index = -2147483648 + InitialParent = "" + Italic = False + Left = 260 + LockBottom = False + LockedInPosition= False + LockLeft = True + LockRight = False + LockTop = True + Scope = 0 + TabIndex = 0 + TabPanelIndex = 0 + TabStop = True + TextFont = "System" + TextSize = 0.0 + TextUnit = 0 + Top = 32 + Underline = False + Visible = True + Width = 80 + End +End +#tag EndWindow + +#tag WindowCode +#tag EndWindowCode + +#tag Events HelloWorldButton + #tag Event + Sub Action() + Dim total As Integer + + For i As Integer = 0 To 10 + total = total + i + Next + + MsgBox "Hello World! " + Str(total) + End Sub + #tag EndEvent +#tag EndEvents +#tag ViewBehavior + #tag ViewProperty + Name="BackColor" + Visible=true + Group="Appearance" + InitialValue="&hFFFFFF" + Type="Color" + #tag EndViewProperty + #tag ViewProperty + Name="Backdrop" + Visible=true + Group="Appearance" + Type="Picture" + EditorType="Picture" + #tag EndViewProperty + #tag ViewProperty + Name="CloseButton" + Visible=true + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="Composite" + Visible=true + Group="Appearance" + InitialValue="False" + Type="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="Frame" + Visible=true + Group="Appearance" + InitialValue="0" + Type="Integer" + EditorType="Enum" + #tag EnumValues + "0 - Document" + "1 - Movable Modal" + "2 - Modal Dialog" + "3 - Floating Window" + "4 - Plain Box" + "5 - Shadowed Box" + "6 - Rounded Window" + "7 - Global Floating Window" + "8 - Sheet Window" + "9 - Metal Window" + "10 - Drawer Window" + "11 - Modeless Dialog" + #tag EndEnumValues + #tag EndViewProperty + #tag ViewProperty + Name="FullScreen" + Group="Appearance" + InitialValue="False" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="FullScreenButton" + Visible=true + Group="Appearance" + InitialValue="False" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="HasBackColor" + Visible=true + Group="Appearance" + InitialValue="False" + Type="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="Height" + Visible=true + Group="Position" + InitialValue="400" + Type="Integer" + #tag EndViewProperty + #tag ViewProperty + Name="ImplicitInstance" + Visible=true + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="Interfaces" + Visible=true + Group="ID" + Type="String" + #tag EndViewProperty + #tag ViewProperty + Name="LiveResize" + Visible=true + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="MacProcID" + Visible=true + Group="Appearance" + InitialValue="0" + Type="Integer" + #tag EndViewProperty + #tag ViewProperty + Name="MaxHeight" + Visible=true + Group="Position" + InitialValue="32000" + Type="Integer" + #tag EndViewProperty + #tag ViewProperty + Name="MaximizeButton" + Visible=true + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="MaxWidth" + Visible=true + Group="Position" + InitialValue="32000" + Type="Integer" + #tag EndViewProperty + #tag ViewProperty + Name="MenuBar" + Visible=true + Group="Appearance" + Type="MenuBar" + EditorType="MenuBar" + #tag EndViewProperty + #tag ViewProperty + Name="MenuBarVisible" + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="MinHeight" + Visible=true + Group="Position" + InitialValue="64" + Type="Integer" + #tag EndViewProperty + #tag ViewProperty + Name="MinimizeButton" + Visible=true + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="MinWidth" + Visible=true + Group="Position" + InitialValue="64" + Type="Integer" + #tag EndViewProperty + #tag ViewProperty + Name="Name" + Visible=true + Group="ID" + Type="String" + #tag EndViewProperty + #tag ViewProperty + Name="Placement" + Visible=true + Group="Position" + InitialValue="0" + Type="Integer" + EditorType="Enum" + #tag EnumValues + "0 - Default" + "1 - Parent Window" + "2 - Main Screen" + "3 - Parent Window Screen" + "4 - Stagger" + #tag EndEnumValues + #tag EndViewProperty + #tag ViewProperty + Name="Resizeable" + Visible=true + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="Super" + Visible=true + Group="ID" + Type="String" + #tag EndViewProperty + #tag ViewProperty + Name="Title" + Visible=true + Group="Appearance" + InitialValue="Untitled" + Type="String" + #tag EndViewProperty + #tag ViewProperty + Name="Visible" + Visible=true + Group="Appearance" + InitialValue="True" + Type="Boolean" + EditorType="Boolean" + #tag EndViewProperty + #tag ViewProperty + Name="Width" + Visible=true + Group="Position" + InitialValue="600" + Type="Integer" + #tag EndViewProperty +#tag EndViewBehavior diff --git a/samples/Xojo/database.xojo_script b/samples/Xojo/database.xojo_script new file mode 100644 index 00000000..1f0f59cc --- /dev/null +++ b/samples/Xojo/database.xojo_script @@ -0,0 +1,17 @@ +Dim dbFile As FolderItem +Dim db As New SQLiteDatabase +dbFile = GetFolderItem("Employees.sqlite") +db.DatabaseFile = dbFile +If db.Connect Then + db.SQLExecute("BEGIN TRANSACTION") + db.SQLExecute ("INSERT INTO Employees (Name,Job,YearJoined) VALUES "_ + +"('Dr.Strangelove','Advisor',1962)") + If db.Error then + MsgBox("Error: " + db.ErrorMessage) + db.Rollback + Else + db.Commit + End If +Else + MsgBox("The database couldn't be opened. Error: " + db.ErrorMessage) +End If diff --git a/samples/Zephir/filenames/exception.zep.c b/samples/Zephir/filenames/exception.zep.c new file mode 100644 index 00000000..c1e0bc09 --- /dev/null +++ b/samples/Zephir/filenames/exception.zep.c @@ -0,0 +1,28 @@ + +#ifdef HAVE_CONFIG_H +#include "../../ext_config.h" +#endif + +#include +#include "../../php_ext.h" +#include "../../ext.h" + +#include +#include +#include + +#include "kernel/main.h" + + +/** + * Test\Router\Exception + * + * Exceptions generated by the router + */ +ZEPHIR_INIT_CLASS(Test_Router_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Test\\Router, Exception, test, router_exception, zend_exception_get_default(TSRMLS_C), NULL, 0); + + return SUCCESS; + +} diff --git a/samples/Zephir/filenames/exception.zep.h b/samples/Zephir/filenames/exception.zep.h new file mode 100644 index 00000000..49d56b9c --- /dev/null +++ b/samples/Zephir/filenames/exception.zep.h @@ -0,0 +1,4 @@ + +extern zend_class_entry *test_router_exception_ce; + +ZEPHIR_INIT_CLASS(Test_Router_Exception); diff --git a/samples/Zephir/filenames/exception.zep.php b/samples/Zephir/filenames/exception.zep.php new file mode 100644 index 00000000..f6087a8d --- /dev/null +++ b/samples/Zephir/filenames/exception.zep.php @@ -0,0 +1,8 @@ +