     1                                  
     2                                  %if 0
     3                                  
     4                                  lDebug U command - Disassembler
     5                                  
     6                                  Copyright (C) 1995-2003 Paul Vojta
     7                                  Copyright (C) 2008-2026 E. C. Masloch
     8                                  
     9                                  Usage of the works is permitted provided that this
    10                                  instrument is retained with the works, so that any entity
    11                                  that uses the works is notified of this instrument.
    12                                  
    13                                  DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    14                                  
    15                                  %endif
    16                                  
    17                                  %define SOURCEFILENAME "uu.asm"
    18                                  %ifidni __OUTPUT_FORMAT__, obj
    19                                   %include "debug.mac"
     1                              <1> [list -]
    14                              <3> [list -]
    14                              <2> [list -]
    86                              <1> [list -]
    86          ------------------  <1>  note: Disable usesection detection
    86          ------------------  <1>  note: usesection lDEBUG_DATA_ENTRY
    86          ------------------  <1>  note: usesection ASMTABLE1
    86          ------------------  <1>  note: usesection ASMTABLE2
    86          ------------------  <1>  note: usesection DATASTACKBASE
    86          ------------------  <1>  note: usesection MESSAGESEGMENT
    86          ------------------  <1>  note: usesection lDEBUG_CODE
    86          ------------------  <1>  note: usesection lDEBUG_CODE2
    86          ------------------  <1>  note: usesection INIT
    86          ------------------  <1>  note: usesection WLEMITALIGNINITEND
    86          ------------------  <1>  note: usesection DEVICESHIM
    86          ------------------  <1>  note: usesection WLEMITALIGNRELOCZERO
    68                              <2> %endif
    69                              <2> 
    70                              <2> 
    71                              <2> 	usesection lDEBUG_CODE
    71          ------------------  <2>  note: usesection lDEBUG_CODE
    72                              <2> section_of puts, trimputs, puts_ext_done, puts_ext_next
    73                              <2> section_of putsz_exthelp, code_retf
    74                              <2> section_of puts_getline_ext_done
    75                              <2> section_of puts_copyoutput_ext_done
    76                              <2> section_of guard_auxbuff, guard_re
    77                              <2> section_of handle_serial_flags_ctrl_c
    78                              <2> section_of hexword_high
    79                              <2> section_of call_int2D
    80                              <2> section_of copy_single_counted_string
    81                              <2> section_of intchk
    82                              <2> section_of IsIISPEntry?
    83                              <2> section_of dd_store
    84                              <2> section_of dohack, getsegmented, hexbyte, hexnyb, iseol?.notsemicolon
    85                              <2> section_of peekc, getc, prephack, readmem, setds2si, setds2bx, setes2dx
    86                              <2> section_of silence_get_start, silence_get_start.have_di, silence_count_zeroes
    87                              <2> section_of setrmlimit, skipcomm0, unhack
    88                              <2> section_of skipequals
    89                              <2> section_of to_errret_pop
    90                              <2> section_of cmd3.have_cx_convenience
    91                              <2> section_of verifysegm, verifysegm_or_error
    92                              <2> section_of pp16, resetmode, resetmode_and_test_d_b_bit
    93                              <2> section_of pp_fix32bitflags, proceedbreakpoint
    94                              <2> section_of putsz, hexword, skipcomma, cmd3, cmd3_not_ext, cmd3_preprocessed
    95                              <2> section_of hexdword
    96                              <2> section_of cmd3_not_inject, cmd3_injected
    97                              <2> section_of aa_not_inject, aa_injected, aa_before_getline, aa_after_getline
    98                              <2> section_of transfer_ext_cx_nearcall_from_code2
    99                              <2> section_of traceone, unexpectedinterrupt, dumpregs_no_disasm
   100                              <2> section_of aa_imm_entry, ia_restore_a_addr, ia_restore_u_addr, disasm
   101                              <2> section_of ia_restore_ds
   102                              <2> %ifn _SYMBOLIC
   103                              <2> section_of selector_to_segment
   104                              <2> %endif
   105                              <2> section_of disp_al, disp_al_hex, disp_al_nybble_hex, disp_ax_dec, disp_ax_hex
   106                              <2> section_of disp_dxax_times_cx_width_bx_size
   107                              <2> section_of disp_dxax_times_cx_width_bx_size.store
   108                              <2> section_of disp_message, disp_message_length_cx
   109                              <2> section_of ispm
   110                              <2> section_of setrc, error
   111                              <2> section_of _doscall, _doscall_return_es, _doscall_return_es_parameter_es_ds
   112                              <2> section_of intcall_ext_return_es, close_ext, doscall_extseg
   113                              <2> section_of yy_reset_buf
   114                              <2> section_of init_bootcmd
   115                              <2> 
   116                              <2> section_of InDOS, bootgetmemorysize
   117                              <2> section_of chkeol, decword, decdword
   118                              <2> section_of dec_dword_minwidth
   119                              <2> section_of getexpression.lit_isdigit?, getexpression.lit_ishexdigit?
   120                              <2> section_of getlinearaddr
   121                              <2> section_of getlinear_d_b
   122                              <2> section_of getlinear_high_limit
   123                              <2> section_of getlinear_32bit
   124                              <2> section_of getlinear_high_limit.do_not_use_test
   125                              <2> section_of getlinear_common
   126                              <2> section_of ifsep, iseol?, isseparator?, isstring?, movp
   127                              <2> section_of putc, putsline, putsline_crlf, putsz_error
   128                              <2> section_of setrmsegm
   129                              <2> section_of skipwh0, skipwhite
   130                              <2> section_of test_d_b_bit, test_high_limit, push_cxdx_or_edx
   131                              <2> section_of capitalise
   132                              <2> section_of setes2ax
   133                              <2> section_of zz_copy_strings_to_str_buffer
   134                              <2> section_of call_xms_move, zz_call_xms, zz_detect_xms
   135                              <2> section_of code2_to_code_ret_to_ext
   136                              <2> section_of yy_dos_parse_name, yy_open_file, yy_check_lfn
   137                              <2> section_of yy_common_parse_name
   138                              <2> section_of yy_common_parse_name_bx_buffer
   139                              <2> section_of retry_open_scriptspath
   140                              <2> section_of yy_boot_read.bx, yy_boot_seek_start.bx, yy_boot_seek_current.bx
   141                              <2> section_of yy_boot_parse_name, yy_boot_open_file
   142                              <2> section_of yy_boot_parse_name_bx_buffer
   143                              <2> section_of near_transfer_ext_return, scan_dir_aux, read_sector
   144                              <2> section_of yy_boot_init_dir, got_yyentry, scan_dir_entry
   145                              <2> section_of ..@yy_filename_empty, boot_parse_fn
   146                              <2> section_of count_store, count_store.maybe_0
   147                              <2> section_of loader_get_resident_address, loader_prepare_resident
   148                              <2> 
   149                              <2> 
   150                              <2>  %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
   151                              <2> 	usesection lDEBUG_CODE2
   152                              <2>  %else
   153                              <2> 	usesection lDEBUG_CODE
   153          ------------------  <2>  note: usesection lDEBUG_CODE
   154                              <2>  %endif
   155                              <2> section_of bxcx_to_cx_paragraphs
   156                              <2> section_of zz_list_symbol.first, zz_list_symbol.subsequent
   157                              <2> section_of zz_xms_to_86mm, zz_xms_try_free, zz_xms_try_free_handle
   158                              <2> section_of zz_86mm_to_xms, zz_del_match.add_poison_entrypoint
   159                              <2> section_of zz_free_nonxms, zz_free_xms, zz_free_reset, zz_free_dos
   160                              <2> section_of zz_get_literal, zz_restore_strat, zz_save_strat
   161                              <2> section_of zz_switch_s, zz_transfer_buffer
   162                              <2> 
   163                              <2> 
   164                              <2> %if _SYMBOLIC
   165                              <2>  %if _DUALCODE && _SYMBOLICDUALCODE
   166                              <2> 	usesection lDEBUG_CODE2
   167                              <2>  %else
   168                              <2> 	usesection lDEBUG_CODE
   169                              <2>  %endif
   170                              <2> section_of shift_left_4_bxcx
   171                              <2> section_of selector_to_segment
   172                              <2> 
   173                              <2> section_of anti_normalise_pointer_with_displacement_bxcx, displaystring
   174                              <2> section_of getfarpointer.hash, getfarpointer.main, getfarpointer.str
   175                              <2> section_of move_delete_farpointer.hash, move_delete_farpointer.hash.sidi
   176                              <2> section_of move_delete_farpointer.main, move_delete_farpointer.str.sidi
   177                              <2> section_of move_insert_farpointer.hash, move_insert_farpointer.hash.sidi
   178                              <2> section_of move_insert_farpointer.main, move_insert_farpointer.main.sidi
   179                              <2> section_of move_insert_farpointer.str.sidi
   180                              <2> section_of normalise_pointer, normalise_pointer_with_displacement_bxcx
   181                              <2> section_of pointer_to_linear
   182                              <2> section_of save_slice_farpointer.hash, save_slice_farpointer.main
   183                              <2> section_of save_slice_farpointer.str
   184                              <2> section_of segment_to_selector
   185                              <2> section_of zz_insert, zz_match_symbol, zz_match_symbol.continue, zz_relocate
   186                              <2> 
   187                              <2> section_of binsearchhash, binsearchmain
   188                              <2> section_of check_second_slice
   189                              <2> section_of disp_size_hash, disp_size_main, disp_size_str
   190                              <2> section_of displayresult, getstring1, getstring2
   191                              <2> section_of increment_ss_ref_count
   192                              <2> section_of list_sym_storage_usage, str_index_to_pointer
   193                              <2> section_of zz_commit_insert, zz_compact, zz_compact_expand_check_nonxms
   194                              <2> section_of zz_compact_expand_check_xms
   195                              <2> section_of zz_delete_hash, zz_delete_main, zz_delete_main_and_its_hash
   196                              <2> section_of zz_delete_string, zz_expand, zz_expand_common
   197                              <2> section_of zz_get_symstr_length_bytes
   198                              <2> section_of zz_get_symstr_length_bytes.ssLength_in_cx
   199                              <2> section_of zz_get_symstr_length_indices
   200                              <2> section_of zz_get_symstr_length_indices.ssLength_in_cx
   201                              <2> section_of zz_hash, zz_hash.bx_init
   202                              <2> section_of zz_insert_main.linklist, zz_reloc_main, zz_reloc_str
   203                              <2> section_of zz_store_pre_str, zz_store_string, zz_store_string.hash_bx
   204                              <2> section_of zz_unlink_main_next
   205                              <2> %endif
   206                              <2> 
   207                              <2> %if _DUALCODE
   208                              <2> 	usesection lDEBUG_CODE2
   208          ------------------  <2>  note: usesection lDEBUG_CODE2
   209                              <2> %else
   210                              <2> 	usesection lDEBUG_CODE
   211                              <2> %endif
   212                              <2> section_of FloatToStr
   213                              <2> 
   214                              <2> 
   215                              <2>  %if _DUALCODE && _EXPRDUALCODE
   216                              <2> 	usesection lDEBUG_CODE2
   216          ------------------  <2>  note: usesection lDEBUG_CODE2
   217                              <2>  %else
   218                              <2> 	usesection lDEBUG_CODE
   219                              <2>  %endif
   220                              <2> 
   221                              <2> section_of getofsforbx, checkpointer, getrangeX
   222                              <2> section_of getrangeX_have_address_need_length
   223                              <2> section_of getrange, getaddr, getofsforbx_remember_bitness
   224                              <2> section_of remember_bitness, getaddr_taken
   225                              <2> section_of getstr, get_length, get_length_keyword
   226                              <2> section_of isbracketorunaryoperator?, isunaryoperator?, isoperator?
   227                              <2> section_of ..@call_operator_dispatchers
   228                              <2> section_of isseparator?, istype?, isunsignedtype?
   229                              <2> section_of handlesegment, handle3byte, handlebyte, handleword
   230                              <2> section_of handledword, handlepointer
   231                              <2> section_of uoh_abs, uoh_minus, calculate_minus_bxdx, uoh_plus
   232                              <2> section_of uoh_not_bitwise, uoh_not_boolean
   233                              <2> section_of od_minus, od_plus, od_multiply, od_divide, od_modulo, od_retn
   234                              <2> section_of od_above, od_below, od_equal, od_not, od_or, od_and, od_xor
   235                              <2> section_of od_cond, od_o, od_a, od_x, od_c, od_string_common
   236                              <2> section_of of_modulo, of_minus, of_plus, or_hhtype, of_multiply
   237                              <2> section_of set_hhtype, of_divide, of_power
   238                              <2> section_of of_compare_below_equal, of_compare_below, of_compare_not_equal
   239                              <2> section_of of_compare_equal, of_compare_above_equal, of_compare_above
   240                              <2> section_of toboolean, of_helper_compare_true, of_rightop, of_helper_compare
   241                              <2> section_of of_shift_right, of_shift_right_signed, of_shift_left
   242                              <2> section_of of_helper_getshiftdata, of_bit_mirror
   243                              <2> section_of of_or_bitwise, or_hhtype_1, of_or_boolean, of_clr_bitwise
   244                              <2> section_of of_and_bitwise, of_and_boolean, of_xor_bitwise, of_xor_boolean
   245                              <2> section_of of_helper_retbool, of_helper_getbool
   246                              <2> 
   247                              <2> section_of var_cip_setup, var_csp_setup, var_lfsr_setup, var_reverselfsr_setup
   248                              <2> section_of var_dpspsel_setup, var_seldbg_setup, var_mt_setup
   249                              <2> section_of var_ioi_setup, var_psps_setup, var_ppr_setup, var_ppi_setup
   250                              <2> section_of var_iok_setup, var_rhcount_setup
   251                              <2> section_of var_get_psp_segment, var_get_psp_selector
   252                              <2> section_of var_bootldpunit_setup, var_bootsdpunit_setup, var_bootydpunit_setup
   253                              <2> section_of var_bootldppart_setup, var_bootsdppart_setup, var_bootydppart_setup
   254                              <2> section_of var_bootunitflags_setup
   255                              <2> 
   256                              <2> section_of issymbol?, isvariable?, var_mm_setup, var_ri_setup, var_ysf_setup
   257                              <2> section_of default_variable_setup
   258                              <2> section_of var_ext_setup
   259                              <2> section_of var_ext_setup_done
   260                              <2> 
   261                              <2> section_of getstmmxdigit
   262                              <2> section_of getexpression.lit_ishexdigit?, getexpression.lit_isdigit?
   263                              <2> section_of of_cond, count_unary_operators, count_unary_operators_restrict
   264                              <2> section_of get3byte.checksignificantbits, getbyte, checksignificantbitscommon
   265                              <2> section_of getnyb, get_value_range
   266                              <2> 
   267                              <2> section_of getaddrX, getword, getdword, getexpression
   268                              <2> 
   269                              <2> section_of getrangeX.lines, getrangeX.ecx_and_0_valid
   270                              <2> section_of getrange.lines, getrange.ecx_and_0_valid, get_length.lines
   271                              <2> section_of getrangeX.lines_and_uu, getrange.lines_and_uu
   272                              <2> section_of isseparator?.except_L_or_dot, isvariable?.return_name
   273                              <2> section_of getword.checksignificantbits, getbyte.checksignificantbits
   274                              <2> 
   275                              <2> section_of seg_bx_to_sel
   276                              <2> section_of getexpression.countsignificantbits
   277                              <2> section_of ..@rr_checksignificantbits, ..@rr_operatordispatchers
   278                              <2> section_of ..@rr_operatorfunctions, ..@parsecm_getaddr
   279                              <2> section_of stack_check.internal
   280                              <2> 
   281                              <2> 
   282                              <2> 	usesection INIT
   282          ------------------  <2>  note: usesection INIT
   283                              <2> section_of init_capitalise
   284                              <2> section_of init_skipwhite, init_skipwh0
   285                              <2> section_of init_skipcomma, init_skipcomm0
   286                              <2> section_of init_skipequals
   287                              <2> 
   288                              <2> 
   289                              <2> 	usesection lDEBUG_DATA_ENTRY
   289          ------------------  <2>  note: usesection lDEBUG_DATA_ENTRY
   290                              <2> section_of entry_retn
   291                              <2> 
   292                              <2> 
   293                              <2> %if _LINK
   294                              <2>  %include "extern.mac"
     1                              <3> 
     2                              <3> ; expr.asm
     3                              <3>  extern PPLEN, PPLEN_ONLY_PREFIXES, a_addr, alloc_seg, alloc_size
     4                              <3>  extern amis_multiplex_number, asm_options, asm_startoptions
     5                              <3>  extern auxbuff_current_size, auxbuff_segorsel, behind_r_u_addr
     6                              <3>  extern bp_offset, code_seg, code_size, d_addr, dcount_addr
     7                              <3>  extern dcpm_addr, dd_default_length, dd_default_lines, dd_text_and
     8                              <3>  extern debuggerfunction, default_pp_count, default_tp_count
     9                              <3>  extern default_tt_count, device_header_address, device_mcb_paragraphs
    10                              <3>  extern dwcount_addr, dz_addr, e_addr, encodedmach87, entryseg_size
    11                              <3>  extern env_size, envseg, erc, errret
    12                              <3>  extern extdata, extdata_size, extdata_used, extseg, extseg_size
    13                              <3>  extern extseg_used, flagbits.amount, flagnames, flagvaron
    14                              <3>  extern getrange_is_uu, getrange_lines, has_mmx, hhresult
    15                              <3>  extern history.segorsel, historyseg_size, immseg, input_file_handles
    16                              <3>  extern input_file_handles.active, internalflags, internalflags2
    17                              <3>  extern internalflags3, intr8_limit, io_columns, io_columns_getline
    18                              <3>  extern io_end_buffer, io_flags, io_levels, io_rows, io_start_buffer
    19                              <3>  extern line_out, line_out_end, linkinfoaddress, load_data
    20                              <3>  extern load_input_file, load_input_file.active, load_unit_flags
    21                              <3>  extern loaddata_loadedfrom, machine, maxmachinetype, messageseg
    22                              <3>  extern messageseg_size, mmxbuff, msg.as, msg.end, msg.executing
    23                              <3>  extern msg.executing_value_range, msg.from, msg.in, msg.length
    24                              <3>  extern msg.linear, msg.lines, msg.lr, msg.nd, msg.nottaken
    25                              <3>  extern msg.nt, msg.or, msg.questionmark, msg.r, msg.stack_overflow
    26                              <3>  extern msg.stack_overflow.caller, msg.stack_overflow.cond
    27                              <3>  extern msg.stack_overflow.indirection, msg.stack_overflow.linear
    28                              <3>  extern msg.stack_overflow.parens, msg.stack_overflow.precedence
    29                              <3>  extern msg.stack_overflow.value_in, msg.t, msg.taken, msg.to
    30                              <3>  extern msg.value, msgtable_value_range, options, options2, parent
    31                              <3>  extern ppbytes, priorrc, psp22, pspdbe, pspdbg
    32                              <3>  extern qqtermcode, rc_count, rc_limit, re_count, re_limit
    33                              <3>  extern reading_access_variables, reg16names, reg8names, reg_cs
    34                              <3>  extern reg_ds, reg_efl, reg_eip, reg_esp, search_results
    35                              <3>  extern serial_columns, serial_fifo_size, serial_keep_timeout
    36                              <3>  extern serial_rows, serial_use_baseport, serial_use_dl
    37                              <3>  extern serial_use_fifo, serial_use_intnum, serial_use_irqmask
    38                              <3>  extern serial_use_params, serial_var_baseport, serial_var_dl
    39                              <3>  extern serial_var_fifo, serial_var_intnum, serial_var_irqmask
    40                              <3>  extern serial_var_params, sscounter, stack, startoptions
    41                              <3>  extern table_length_keywords, throwsp, transfer_ext_cx
    42                              <3>  extern try_amis_multiplex_number, try_debugger_amis_multiplex_number
    43                              <3>  extern types, types.addresses_minus_end, types.end, u_addr
    44                              <3>  extern usertermcode, uu_default_length, uu_default_lines, vregs
    45                              <3>  extern vregs.amount, writing_access_variables
    46                              <3>  extern flagbits, regs
    47                              <3> 
    48                              <3> ; run.asm
    49                              <3>  extern ..@aa_access_end, ..@aa_access_start, ..@dd_access_end
    50                              <3>  extern ..@dd_access_start, ..@ee_access_end, ..@ee_access_start
    51                              <3>  extern ..@ee_interactive_access_end, ..@ee_interactive_access_start
    52                              <3>  extern ..@hh_indirection_memory_access_end
    53                              <3>  extern ..@hh_indirection_memory_access_start
    54                              <3>  extern ..@readmem_fault_skip_4_near_call, ..@rr_access_end
    55                              <3>  extern ..@rr_access_start, ..@rr_variable_read_access_end
    56                              <3>  extern ..@rr_variable_read_access_start
    57                              <3>  extern ..@rr_variable_write_access_end
    58                              <3>  extern ..@rr_variable_write_access_start, ..@sss_access_end
    59                              <3>  extern ..@sss_access_start, ..@uu_access_end, ..@uu_access_start
    60                              <3>  extern ..@uu_referenced_memory_access_end
    61                              <3>  extern ..@uu_referenced_memory_access_start, ..@uu_simulate_cmps_end
    62                              <3>  extern ..@uu_simulate_cmps_start, ..@uu_simulate_scas_end
    63                              <3>  extern ..@uu_simulate_scas_start, InDOS_or_BIOS_IO, PPLEN_ONLY_STRING
    64                              <3>  extern auxbuff_behind_last_silent
    65                              <3>  extern auxbuff_start_silent, bInDbg, b_bplist.bp, b_bplist.counter
    66                              <3>  extern b_bplist.disabled_mask, b_bplist.idbuffer, b_bplist.used_mask
    67                              <3>  extern b_bplist.when, bb_deferred_message_in_lineout_behind
    68                              <3>  extern bp_display_offset, calcpointbit, cmd2_reset_re, cmd_goto
    69                              <3>  extern debug22.cleartraceflag, decbyte, dmycmd, dumpregs_extended
    70                              <3>  extern enable_rh, entry_to_code_seg, entry_to_code_segsel, eqflag
    71                              <3>  extern eqladdr, exccsip, exception_csip, exception_stack, excloc
    72                              <3>  extern g_bplist.bp, g_bplist.used_count, get_set_id_offset_length
    73                              <3>  extern getc_if_any, getcseipbyte, getint2324, getpsp
    74                              <3>  extern gg_deferred_message, gg_first_cseip_linear
    75                              <3>  extern gg_next_cseip_linear, guard_auxbuff.1_or_2, idle, in_getinput
    76                              <3>  extern int19msg, internalflags6, intr8_counter, lastcmd, msg.again
    77                              <3>  extern msg.alreadytsr, msg.area_aa_access, msg.area_dd_access
    78                              <3>  extern msg.area_ee_access, msg.area_ee_interactive_access
    79                              <3>  extern msg.area_hh_indirection_memory_access, msg.area_rr_access
    80                              <3>  extern msg.area_rr_variable_read_access
    81                              <3>  extern msg.area_rr_variable_write_access, msg.area_run_access
    82                              <3>  extern msg.area_sss_access, msg.area_uu_access
    83                              <3>  extern msg.area_uu_referenced_memory_access
    84                              <3>  extern msg.area_uu_simulate_cmps, msg.area_uu_simulate_scas
    85                              <3>  extern msg.bb_hit.1, msg.bb_hit.2.counter, msg.bb_hitpass_id.after
    86                              <3>  extern msg.bb_hitpass_id.long, msg.bb_hitpass_id.short, msg.bb_pass.1
    87                              <3>  extern msg.cant_bp_linear, msg.cant_bp_linear.address1
    88                              <3>  extern msg.cant_bp_reason, msg.cant_bp_reason0, msg.cant_bp_reason1
    89                              <3>  extern msg.cant_bp_reason2, msg.cant_bp_reason3
    90                              <3>  extern msg.cant_bp_reason3.value, msg.cant_bp_reasonu
    91                              <3>  extern msg.cant_bp_restore, msg.cant_bp_restore.value
    92                              <3>  extern msg.cant_bp_the, msg.cant_bp_type_gg
    93                              <3>  extern msg.cant_bp_type_permanent, msg.cant_bp_type_permanent.index
    94                              <3>  extern msg.cant_bp_type_proceed, msg.cant_bp_write, msg.ctrlc
    95                              <3>  extern msg.empty_message, msg.goto, msg.invalidpsp, msg.list
    96                              <3>  extern msg.list_bp.address1, msg.list_bp.first, msg.list_bp.second
    97                              <3>  extern msg.list_bp.third, msg.list_bp.value, msg.list_bp_csip_16
    98                              <3>  extern msg.list_bp_none, msg.list_bp_not_cseip, msg.notyettsr
    99                              <3>  extern msg.nowattached, msg.nowtsr1, msg.nowtsr2, msg.psphooked
   100                              <3>  extern msg.pspnotfound, msg.remember, msg.selfownedpsp, msg.silent
   101                              <3>  extern msg.warnprefix, msg.while, msg.while_not_true
   102                              <3>  extern msg.while_terminated_after, msg.while_terminated_before
   103                              <3>  extern oldcols, oldcrtp, oldcsrpos, oldmr, options3
   104                              <3>  extern options6, pp_instruction, pp_operand, progexit, progtrm
   105                              <3>  extern rc, reg_eax, reg_es, reg_gs, reg_ss
   106                              <3>  extern run_int, run_sp, run_sp_reserve, savesp, setcseipbyte
   107                              <3>  extern setint2324, setpsp, setpspdbg
   108                              <3>  extern showstring, silence_dump, spadjust, swapscreen
   109                              <3>  extern tmode0, tmode1, tmodes, tmodev, tpg_possible_breakpoint
   110                              <3>  extern tpg_proceed_bp, tt_silent_mode_number, vpage, vrows
   111                              <3>  extern while_buffer, while_buffer.length, writemem
   112                              <3> 
   113                              <3>  extern ..@getcseipbyte_fault_skip_2_near_call
   114                              <3>  extern ..@setcseipbyte_fault_skip_2_near_call
   115                              <3>  extern ..@writemem_fault_skip_4_near_call_a
   116                              <3>  extern ..@writemem_fault_skip_4_near_call_b, int0Cmsg, int0Dmsg
   117                              <3>  extern int0msg, int18msg, int1msg, int3msg, int6msg
   118                              <3>  extern int8_kbd_msg, int8msg, runint_ctrlc_msg, serial_flags
   119                              <3> 
   120                              <3> ; bb.asm
   121                              <3>  extern ..@bb_id_length, ..@bb_id_start, ..@bb_saved_linear
   122                              <3>  extern ..@bb_when_length, ..@bb_when_start, b_bplist.id
   123                              <3>  extern b_bplist.idbuffer.free
   124                              <3>  extern b_bplist.whenbuffer, b_bplist.whenbuffer.free
   125                              <3>  extern bootcmd, crlf, msg.all, msg.at
   126                              <3>  extern msg.bb_no_new, msg.bb_when, msg.boot, msg.bp, msg.bpaddress
   127                              <3>  extern msg.bpcontent, msg.bpcounter, msg.bpdisabled, msg.bpenabled
   128                              <3>  extern msg.bpnone, msg.bpnone_at, msg.bpunused, msg.counter
   129                              <3>  extern msg.existing, msg.id, msg.new, msg.notbu, msg.number
   130                              <3>  extern msg.offset, msg.when, prnquit
   131                              <3> 
   132                              <3> ; rr.asm
   133                              <3>  extern InDOS_or_BIOS_output, cmdline_buffer
   134                              <3>  extern cmdline_buffer.end, cmdline_buffer.position, disflags, ee0a
   135                              <3>  extern error_expr, flagbits_for_40, flagbits_for_80, flagsoff
   136                              <3>  extern flagsoff_style2, flagsoff_style3, flagson, flagson_style23
   137                              <3>  extern get_memref_index_bx, getline00, getline_reset_notatty
   138                              <3>  extern guard_rc, hexnyb.common, hhtype, hhvar, in_re
   139                              <3>  extern mask_4byte, masks, memrefs, memrefs.free, msg.3byte
   140                              <3>  extern msg.abort, msg.append, msg.byte, msg.count, msg.dword
   141                              <3>  extern msg.highlight, msg.internal_error_no_mmx, msg.readonly
   142                              <3>  extern msg.readonly_mem, msg.regs386, msg.regs386_off, msg.regs386_on
   143                              <3>  extern msg.replace, msg.rh, msg.rv_mode.before, msg.rv_mode_r86m
   144                              <3>  extern msg.rv_mode_v86m, msg.rvd, msg.rvd_deviceheader
   145                              <3>  extern msg.rvd_not_device, msg.rvd_size, msg.rvm, msg.rvp
   146                              <3>  extern msg.rvp_application, msg.rvp_boot, msg.rvp_device
   147                              <3>  extern msg.rvp_device_attached, msg.rvp_tsr, msg.rvv
   148                              <3>  extern msg.unexpected_auxbuff_guard, msg.unhighlight, msg.vm_auxseg
   149                              <3>  extern msg.vm_codeseg, msg.vm_dataseg, msg.vm_entryseg, msg.vm_hisseg
   150                              <3>  extern msg.vm_messageseg, msg.vp_dparent, msg.vp_dpra
   151                              <3>  extern msg.vp_dpspsegment, msg.vp_parent, msg.vp_pra
   152                              <3>  extern msg.vp_pspsegment, msg.word, operatorfunctions, psp_parent
   153                              <3>  extern psp_pra, puts_break_line_more, putsline_break_line, re_buffer
   154                              <3>  extern re_buffer.end, re_buffer.position, re_sp, regs_prior
   155                              <3>  extern regs_prior.size, retn_expr, rh_count_number
   156                              <3>  extern rh_display_with_count, shortflagbits, shortflagbits.amount
   157                              <3>  extern shortflagsoff, shortflagson, silence_dump.rh
   158                              <3>  extern silence_dump.rh.all, table_getline_prepare_ldebug
   159                              <3>  extern table_getline_prepare_ms_debug, terminate_silent_dump
   160                              <3>  extern terminate_silent_dump.if_nonnull
   161                              <3> 
   162                              <3> ; rr.asm
   163                              <3>  extern flagbits_for_shl, regs_prior.size_w
   164                              <3> 
   165                              <3> ; aa.asm
   166                              <3>  extern REP_LEN, SEGP_LEN, attach
   167                              <3>  extern ext_aa_after_getline_handler, ext_aa_before_getline_handler
   168                              <3>  extern ext_aa_inject_handler, immasm_length, immasm_rel1632_target
   169                              <3>  extern immasm_rel8_target, msg.aa_internal_error, msg.attach
   170                              <3>  extern prefixlist.after_segment, replist, segprfxtab, showmach
   171                              <3>  extern skipalpha, sm1
   172                              <3> 
   173                              <3> ; uu.asm
   174                              <3>  extern A32P_LEN, GROUP7, MN_DB, MN_LOCK, MN_LOOP
   175                              <3>  extern MN_LOOPNZ, MN_LOOPZ, MN_REP, MN_REPE, MN_REPNE
   176                              <3>  extern MN_SEG, MN_WAIT, N_LOCK, N_LTABA, N_LTABO
   177                              <3>  extern N_WTAB, O32P_AMOUNT, OPTYPES_BASE, REP_DIFF_LEN, REP_SAME_LEN
   178                              <3>  extern SFPGROUP3, SGROUP4, SPARSE_BASE, a32prfxtab, dismach
   179                              <3>  extern dmflags, has_87, immasm_far_target, immasm_imm16, locktab
   180                              <3>  extern ltaba1, ltabo1, mach_87, mnlist, mnlist_a_suffix_allowed
   181                              <3>  extern mnlist_o_suffix_allowed, mnlist_o_suffix_required
   182                              <3>  extern msg.condjump, msg.condnotjump, msg.memrefs_invalid_internal
   183                              <3>  extern msg.uninstall, msg.uu_internal_error, msg.uu_too_many_repeat
   184                              <3>  extern needsmath, needsmath_L, needsmsg, needsmsg.digit_6_ofs
   185                              <3>  extern needsmsg.digit_x_ofs, needsmsg_L, o32prfxtab, obsmach
   186                              <3>  extern obsolete, obsolete_L, opindex, opinfo, oplists
   187                              <3>  extern optypes, ppbytes.string, ppbytes.string_amount, reg_ebp
   188                              <3>  extern reg_ebx, reg_ecx, reg_edi, reg_esi, reg_fs
   189                              <3>  extern regmem, rgnam16, rgnam816, segrgnam, sibbyte
   190                              <3>  extern sqztab, tab_to, uninstall, unused, wtab1
   191                              <3> 
   192                              <3> ; uu.asm
   193                              <3>  extern reg_edx
   194                              <3> 
   195                              <3> ; uu.asm
   196                              <3>  extern MN_BSWAP, MN_O32
   197                              <3> 
   198                              <3> ; uu.asm
   199                              <3>  extern MN_A32
   200                              <3> 
   201                              <3> ; amis.asm
   202                              <3>  extern amisintr_offset, deviceshim_size, ext_amis_handler
   203                              <3> 
   204                              <3> ; boot.asm
   205                              <3>  extern boot_remember_seek_handle
   206                              <3>  extern boot_remember_seek_offset, chkeol_or_then, cmd_goto.yy_entry
   207                              <3>  extern display_y_or_ext, ext_cmdline, ext_finish.boot
   208                              <3>  extern if_exists_found_open, if_exists_not_found
   209                              <3>  extern if_exists_then_address, iseol?_or_then, loadoptiontable
   210                              <3>  extern loadoptiontable.incompatible, loadsettings
   211                              <3>  extern msdos7_message_table, msdos7_message_table.size
   212                              <3>  extern msg.boot_access_error, msg.boot_and, msg.boot_auxbuff_crossing
   213                              <3>  extern msg.boot_badchain, msg.boot_badclusters, msg.boot_badfat
   214                              <3>  extern msg.boot_bpb_load_overlap, msg.boot_bpb_too_low
   215                              <3>  extern msg.boot_cannot_set_both, msg.boot_dot_crlf
   216                              <3>  extern msg.boot_file_not_found, msg.boot_file_too_big_error
   217                              <3>  extern msg.boot_file_too_small_error, msg.boot_internal_error
   218                              <3>  extern msg.boot_invalid_filename, msg.boot_invalid_heads
   219                              <3>  extern msg.boot_invalid_sectors, msg.boot_out_of_memory_error
   220                              <3>  extern msg.boot_partition_cycle_error, msg.boot_partition_not_found
   221                              <3>  extern msg.boot_quit_fail, msg.boot_sector_not_power
   222                              <3>  extern msg.boot_sector_too_large, msg.boot_sector_too_small
   223                              <3>  extern msg.boot_segment_too_low, msg.boot_too_many_partitions_error
   224                              <3>  extern msg.bootfail, msg.bootfail_check_mismatch
   225                              <3>  extern msg.bootfail_check_mismatch.check_got
   226                              <3>  extern msg.bootfail_check_mismatch.check_offset
   227                              <3>  extern msg.bootfail_check_mismatch.check_value, msg.bootfail_code
   228                              <3>  extern msg.bootfail_read, msg.bootfail_read_errorcode
   229                              <3>  extern msg.bootfail_secsizediffer, msg.bootfail_sig
   230                              <3>  extern msg.bootfail_sig_parttable, msg.bootfail_stack_underflow
   231                              <3>  extern msg.bpb, msg.checkoffset, msg.checkvalue, msg.dir
   232                              <3>  extern msg.dirinsteadsize, msg.emptydirname, msg.entry
   233                              <3>  extern msg.guard_auxbuff_error, msg.hidden, msg.hiddenadd
   234                              <3>  extern msg.maxpara, msg.minpara, msg.protocol, msg.quit, msg.read
   235                              <3>  extern msg.sector, msg.sector_alt, msg.segment, msg.write
   236                              <3>  extern msg.yy_empty, msg.yy_filename_empty, msg.yy_no_file
   237                              <3>  extern msg.yy_requires_filename, msg.yy_too_large
   238                              <3>  extern msg.yy_too_many_handles, terminator_in_line_in.offset
   239                              <3>  extern terminator_in_line_in.value, throwret
   240                              <3>  extern yy_boot_attempt_open_pathname, yy_boot_attempt_open_stack
   241                              <3>  extern yy_is_script
   242                              <3> 
   243                              <3> ; cc.asm
   244                              <3>  extern count_var, hh.single, msg.clear, msg.clear_sequence
   245                              <3>  extern msg.range, parsecm
   246                              <3> 
   247                              <3> ; dd.asm
   248                              <3>  extern auxbuff_current_size_minus_24, charcounter
   249                              <3>  extern dstringaddr, dstringtype, firstmcb, firstumcb, intaddress
   250                              <3>  extern lastint, lastint_is_86m_and_mcb, msg.di_empty, msg.di_error
   251                              <3>  extern msg.di_freedos_reloc, msg.di_hidden, msg.di_hma, msg.di_iisp
   252                              <3>  extern msg.di_jmpfar, msg.di_jmpfarindirect, msg.di_multiplex.1
   253                              <3>  extern msg.di_multiplex.2, msg.di_multiplex.3, msg.di_nonstd_iisp
   254                              <3>  extern msg.di_system_low, msg.di_system_mcb, msg.di_system_upper
   255                              <3>  extern msg.di_testhook, msg.di_toomany, msg.di_uninst_iisp
   256                              <3>  extern msg.header, msg.header.length, msg.invmcbadr, msg.prefixes
   257                              <3>  extern msg.tableheader, msg.tableheadertop, msg.top, msg.trailer
   258                              <3>  extern msg.trailer.length, smcbmsg_unknown, smcbtypes
   259                              <3> 
   260                              <3> ; debug.asm
   261                              <3>  extern UnhookInterruptForce, UnhookInterruptForceSim, aa
   262                              <3>  extern adusetup, bb, boot_ebdaflag, boot_initcode
   263                              <3>  extern boot_new_memsizekib, boot_old_memsizekib, cc, code_start, ddd
   264                              <3>  extern device_initcode, driveno, dumpregs_extended.exit, ee
   265                              <3>  extern eld_linkcall.call_cmd3, end_of_ldebug_code, entry_int3_retf
   266                              <3>  extern errcarat, ff, get_86m_interrupt_handler_no_dos, get_columns
   267                              <3>  extern getline_close_file, getline_close_file.resetstuff, gg, hh
   268                              <3>  extern hh_depth, hh_depth_of_single_term, hhflag, ia_restore, ii
   269                              <3>  extern immasm, install_86m_interrupt_handler, int22, int2D, intr0
   270                              <3>  extern intr0C, intr0D, intr1, intr18, intr19
   271                              <3>  extern intr3, intr6, intr8, linkinfo, ll
   272                              <3>  extern ll3, ll_copy_cmdline_and_fcbs
   273                              <3>  extern ll_copy_cmdline_and_fcbs.have_cx
   274                              <3>  extern mm, msg.NULblank, msg.asmoptions_1, msg.boothelp
   275                              <3>  extern msg.build_array, msg.build_long_amount, msg.build_short_amount
   276                              <3>  extern msg.build_version_amount, msg.cannot_hook_2D.invalid
   277                              <3>  extern msg.cannot_hook_2D.nofree, msg.cannotbootquit_memsizes
   278                              <3>  extern msg.condhelp, msg.ensure_no_memory, msg.expressionhelp
   279                              <3>  extern msg.flaghelp, msg.flags_1, msg.guard_rc_error
   280                              <3>  extern msg.guard_re_error, msg.help_array, msg.help_array_amount
   281                              <3>  extern msg.help_re, msg.help_run, msg.help_source, msg.keep
   282                              <3>  extern msg.license, msg.line_out_overflow, msg.n_toolongname
   283                              <3>  extern msg.n_toolongtail, msg.nobootsupp, msg.options_array
   284                              <3>  extern msg.options_array_amount, msg.options_pages, msg.options_scan
   285                              <3>  extern msg.options_scan_amount, msg.qq_a_terminated
   286                              <3>  extern msg.qq_a_unterminated, msg.qq_device_no_c, msg.qq_device_no_d
   287                              <3>  extern msg.qq_device_none_selected, msg.qq_unterm
   288                              <3>  extern msg.rc_limit_reached, msg.re, msg.re_limit_reached
   289                              <3>  extern msg.reghelp, msg.rh_disabled, msg.rh_enabled, msg.run
   290                              <3>  extern msg.serial_cannot_hook, msg.serial_cannot_hook.new_int
   291                              <3>  extern msg.serial_cannot_hook.old_int, msg.serial_cannot_unhook
   292                              <3>  extern msg.serial_cannot_unhook.int, msg.serial_cannot_unhook.nowarn
   293                              <3>  extern msg.serial_late_unhook, msg.serial_late_unhook.int
   294                              <3>  extern msg.serial_no_keep_enter, msg.serial_no_keep_timer
   295                              <3>  extern msg.serial_request_keep, msg.source, msg.string_build
   296                              <3>  extern msg.string_options, msg.string_version
   297                              <3>  extern msg.tsr_cannot_terminate_attached, msg.varhelp, oo, ph_msg, pp
   298                              <3>  extern putrunint, putsz_exthelp, rr, run, section.DEVICESHIM.vstart
   299                              <3>  extern serial_clean_up, serial_clear_fifos, serial_eoi
   300                              <3>  extern serial_init_UART, serial_install_interrupt_handler
   301                              <3>  extern serial_interrupt_handler, serial_uninstall_interrupt_handler
   302                              <3>  extern set_irq, setscreen, sleep_delta_limit, sleep_highest_delta
   303                              <3>  extern sss, tpg_initialise_empty_auxbuff.reset
   304                              <3>  extern transfer_to_ext_puts_getline, tt, update_inttab_optional, uu
   305                              <3>  extern vv, vv_disable, vv_set, ww, yy
   306                              <3> 
   307                              <3> ; debug.asm
   308                              <3>  extern eld_linkcall
   309                              <3> 
   310                              <3> ; ee.asm
   311                              <3>  extern bufend, bufnext, fillbuf, fullbsout
   312                              <3>  extern getline_is_input_file?, line_in, linecounter, load_extension
   313                              <3>  extern msg.ext, notatty, prehak1, run2324
   314                              <3> 
   315                              <3> ; hh.asm
   316                              <3>  extern hh_div_active, hh_div_dividend, hh_div_divisor
   317                              <3>  extern msg.base, msg.group, msg.hh_div_remainder, msg.width
   318                              <3> 
   319                              <3> ; iioo.asm
   320                              <3>  extern if_exists_length, if_exists_si, if_exists_sp
   321                              <3>  extern install, msg.exists, msg.install, msg.not, msg.then
   322                              <3>  extern msg.y, resetrc, yy_or_ext_no_guard_re
   323                              <3> 
   324                              <3> ; immasm.asm
   325                              <3>  extern aa_ret, addrr, condmsg, error_mirror, index
   326                              <3>  extern msg.immasm_error_eip, presizeflags, reg32addr, segmnt
   327                              <3>  extern segrgaddr
   328                              <3> 
   329                              <3> ; msg.asm
   330                              <3>  extern ..@boot_scan_dir_return_fat16_root_entry
   331                              <3>  extern ..@boot_scan_dir_return_filenotfound
   332                              <3>  extern ..@boot_scan_dir_return_subdir_or_fat32_entry
   333                              <3>  extern alloc_size_not_reserved, asciitablenames, boot_init_foundname
   334                              <3>  extern configpath, configpath.dir_end, device_quittable_regs, dpmi32
   335                              <3>  extern execblk.cmdline, ext_command_handler, ext_finish.bp_is_set
   336                              <3>  extern ext_handle, ext_inject_handler, ext_preprocess_handler
   337                              <3>  extern ext_puts_copyoutput_handler, ext_puts_getline_handler
   338                              <3>  extern ext_puts_handler, ext_var, ext_var_amount, ext_var_format
   339                              <3>  extern ext_var_size, extcssel, extdssel, handle_scan_dir_entry
   340                              <3>  extern handle_scan_dir_not_found, history.first, history.last
   341                              <3>  extern indirect_array_errfix, init_executable_pathname
   342                              <3>  extern init_executable_pathname.end, internalflags4, internalflags5
   343                              <3>  extern internalflags7, isvariable_morebyte_nameheaders.ext
   344                              <3>  extern lastcmd_transfer_ext_address, lastcmd_transfer_ext_entry
   345                              <3>  extern line_in.end, linkcall_table, load_adr_dirbuf_segment
   346                              <3>  extern load_check_dir_attr, load_data_lowest, load_kernel_name
   347                              <3>  extern load_yy_direntry, load_yyname_input, load_yyname_next
   348                              <3>  extern near_transfer_ext_address, near_transfer_ext_entry
   349                              <3>  extern next_reserved_segment, options4, options5, options7
   350                              <3>  extern patcharea_intrtn, patcharea_intrtn.segment
   351                              <3>  extern patcharea_intrtn.size, patcharea_run, patcharea_run.segment
   352                              <3>  extern patcharea_run.size, pm_2_86m_0, promptlen, reserved_address
   353                              <3>  extern scriptspath, scriptspath.dir_end
   354                              <3>  extern sss_silent_count, sss_silent_count_used, stack_end, swch1
   355                              <3>  extern while_buffer.end
   356                              <3> 
   357                              <3> ; msg.asm
   358                              <3>  extern install_trying
   359                              <3> 
   360                              <3> ; init.asm
   361                              <3>  extern ..@init_behind, ..@init_first
   362                              <3>  extern ..@patch_no386_ds_6_DATA_ENTRY
   363                              <3>  extern ..@patch_no386_ds_code_or_entry
   364                              <3>  extern ..@patch_no386_iret_code_or_entry, behind_code_truncated
   365                              <3>  extern behind_init, behind_messagesegment_nobits
   366                              <3>  extern behind_messagesegment_nobits_truncated, debug22
   367                              <3>  extern device_header.next, devint23, devint24, entry_retf
   368                              <3>  extern execblk.fcb1, execblk.fcb2, ext_data_area, extcall_table.ret
   369                              <3>  extern extcall_table.segsel, fileext, hVdd, immasm_buffer, initcont
   370                              <3>  extern initcont.boot_entry, initcont.device, inttab, inttab.i06
   371                              <3>  extern inttab.i2D, inttab_number_variable, line_out_overflow
   372                              <3>  extern linkcall_table.code1, linkcall_table.entry
   373                              <3>  extern linkcall_table.init, oldmode, pInDOS, pSDA, regs.size
   374                              <3>  extern switchar, trim_overflow, var_addr_entries
   375                              <3>  extern var_addr_entries.amount
   376                              <3> 
   377                              <3> ; install.asm
   378                              <3>  extern installflags, msg.alreadydisabled
   379                              <3>  extern msg.alreadyenabled, msg.toggle, msg.trydisable, msg.tryenable
   380                              <3> 
   381                              <3> ; ints.asm
   382                              <3>  extern debuggeramissig, inttab_optional
   383                              <3> 
   384                              <3> ; lineio.asm
   385                              <3>  extern auxbuff_amount_silent, cmd3_set_options
   386                              <3>  extern determine_quiet_output, eldheader, getc_repeat_idle
   387                              <3>  extern getline_timer_func, handle_ctrl_c, if_exists_found_closed
   388                              <3>  extern if_exists_found_ext_open, indos_remember_seek_function
   389                              <3>  extern indos_remember_seek_handle, indos_remember_seek_offset
   390                              <3>  extern input_file_handles.to_close, msg.configkeyword
   391                              <3>  extern msg.eld_error_code, msg.eld_load_error, msg.emptykeyword
   392                              <3>  extern msg.eof, msg.executablekeyword, msg.ext_error_internal
   393                              <3>  extern msg.ext_error_invalid, msg.ext_error_io, msg.ext_error_oom
   394                              <3>  extern msg.freedos_ctrlc_workaround, msg.goto_empty
   395                              <3>  extern msg.goto_not_file, msg.goto_not_found.1, msg.goto_not_found.2
   396                              <3>  extern msg.history_internal_error, msg.more, msg.more_over
   397                              <3>  extern msg.more_over_size, msg.more_size, msg.rh_step.1
   398                              <3>  extern msg.rh_step.2, msg.scriptskeyword, msg.silent_error, msg.sof
   399                              <3>  extern msg.unexpected_noneol_rc, msg.unexpected_noneol_re
   400                              <3>  extern msg.yy_error_file_open, msg.yy_filename_missing_unquote
   401                              <3>  extern msg.yy_no_dos, qq, section.DATASTACK.vstart
   402                              <3>  extern serial_check_receive_char, serial_receive_char
   403                              <3>  extern serial_send_char, skip_rh, yy_boot
   404                              <3>  extern yy_boot_clear_remember_seek, yy_boot_close_file, yy_boot_read
   405                              <3>  extern yy_boot_remember_seek, yy_boot_seek_current
   406                              <3>  extern yy_boot_seek_start, yy_try_scriptspath
   407                              <3>  extern yy_try_scriptspath.didnotyettry
   408                              <3>  extern yy_try_scriptspath.nokeywordused
   409                              <3> 
   410                              <3> ; ll.asm
   411                              <3>  extern doserr8, ensuredebuggeeloaded, execblk, execblk.csip
   412                              <3>  extern execblk.sssp, msg.hexerror, msg.ll_unterm, msg.not_while_indos
   413                              <3>  extern msg.tsr_cannot_ll, parselw, reading
   414                              <3>  extern terminate_attached_process, ww1, ww15, zeroregs
   415                              <3> 
   416                              <3> ; mm.asm
   417                              <3>  extern has_287, has_copr, msg.c0, msg.cr, msg8088
   418                              <3>  extern msgx86, no_copr, parsecm_have_address
   419                              <3> 
   420                              <3> ; serialp.asm
   421                              <3>  extern baseport, msg.no_progress, rxfifo, rxhead
   422                              <3>  extern rxtail, serial_fcr_setting, serial_installed_intnum
   423                              <3>  extern serial_save_dl, serial_save_ier, serial_save_irq_mask
   424                              <3>  extern serial_save_irq_off, serial_save_lcr, serial_save_mcr, txfifo
   425                              <3>  extern txhead, txtail
   426                              <3> 
   427                              <3> ; ss.asm
   428                              <3>  extern msg.matches, msg.reverse, msg.seconds, msg.sleep
   429                              <3>  extern msg.ticks, sleep_repeat_idle
   430                              <3> 
   431                              <3> ; vv.asm
   432                              <3>  extern csrpos, msg.nokeep, msg.off, msg.on, msg.vv_disabled
   433                              <3>  extern msg.vv_enable_failure, xmsdrv, xmsmove
   434                              <3> 
   435                              <3> ; ww.asm
   436                              <3>  extern diskful, doserr11, doserr2, doserr3, doserr5
   437                              <3>  extern drive, drivenumber, dskerrs, not_while_indos, nowhexe
   438                              <3>  extern nownull, openerr, openerr1, writing, wwmsg1
   439                              <3>  extern wwmsg2
   440                              <3> 
   441                              <3> 
   442                              <3>  extern bCSAttr, lDEBUG_CODE_to_lDEBUG_CODE2_nearcall_helper
   443                              <3> 
   444                              <3>  extern hook2F.not_in_dos
   445                              <3> 
   446                              <3>  extern cmd4.int3, lDEBUG_CODE2_dualret_helper
   447                              <3>  extern lDEBUG_CODE2_to_lDEBUG_CODE_nearcall_helper
   448                              <3>  extern lDEBUG_CODE_to_lDEBUG_CODE2_dualcall_helper, msg.bu
   449                              <3>  extern msg.bu_relocated, msg.bu_relocated.sign
   450                              <3> 
   451                              <3>  extern nopmsupp
   452                              <3> 
   453                              <3>  extern bAddr32
   454                              <3> 
   455                              <3>  extern descriptor, descriptor.attrib, descriptor.base
   456                              <3>  extern descriptor.limit, gatewrong, msg.d.a_error, msg.d.a_error_code
   457                              <3>  extern msg.d.a_success, msg.d.a_success_sel, msg.d.b_error
   458                              <3>  extern msg.d.b_error_code, msg.d.b_success, msg.d.d_error
   459                              <3>  extern msg.d.d_error_code, msg.d.d_success, msg.d.l_error
   460                              <3>  extern msg.d.l_error_code, msg.d.l_success, msg.d.t_error
   461                              <3>  extern msg.d.t_error_code, msg.d.t_success, msg.deschelp, msg.ofs32
   462                              <3>  extern nodesc
   463                              <3> 
   464                              <3>  extern ..@patch_tsr_quit_run, areastruc_entry.qq_entry, cssel
   465                              <3>  extern ddebugareas.next, debug2F, dpmidisable, dpmientry, dpmihook
   466                              <3>  extern dpmihookamis, dpmihookcs, dpmiwatch, end_of_ldebug_code2
   467                              <3>  extern findinstalleddebugger, get_messagesegsel, handle_mode_changed
   468                              <3>  extern i23pm, msg.cannotpmquit, msg.desc, msg.dpmi_no_hook, msg.msdos
   469                              <3>  extern msg.qq_device_pm, msg.qq_still_pm, msg.qqlate_areas_error
   470                              <3>  extern msg.readonly_verifysegm, msg.readonly_verifysegm.selector
   471                              <3>  extern mydpmientry, nodosext, oldi2F, pm_reset_handlers, scratchsel
   472                              <3>  extern sr_state, switchmode, uninstall_areas.qq_entry
   473                              <3> 
   474                              <3>  extern i24pm
   475                              <3> 
   476                              <3>  extern auxbuff_switchbuffer_size, code2_seg, code2_sel, code2_size
   477                              <3>  extern code_sel, daresult, dssel, immsel
   478                              <3>  extern lDEBUG_CODE2_to_lDEBUG_CODE_dualcall_helper
   479                              <3>  extern lDEBUG_CODE_dualret_helper, messagesel, msg.desctype
   480                              <3>  extern msg.stack_overflow.desctype
   481                              <3> 
   482                              <3>  extern cmd3_mirror
   483                              <3> 
   484                              <3>  extern ..@patch_entry_seg, ..@patch_no386_ds_4, ..@patch_no386_ds_5
   485                              <3>  extern ..@patch_no386_ds_entry_pmint21_1
   486                              <3>  extern ..@patch_no386_ds_entry_pmint21_2, areas_fun, areas_sub
   487                              <3>  extern ddebugareas.prev, linkcall_table.code2
   488                              <3> 
   489                              <3>  extern areas_struc, msg.areasalreadyinstalled
   490                              <3>  extern msg.areasalreadyuninstalled, msg.areasinstalled
   491                              <3>  extern msg.areasnodebuggerfound, msg.areasnotinstalled
   492                              <3>  extern msg.areasnotinstalled.code, msg.areasnotsupported
   493                              <3>  extern msg.areasuninstalled, msg.areasuninstalled.code
   494                              <3> 
   495                              <3>  extern intcall_return_parameter_es_parameter_ds
   496                              <3>  extern lDEBUG_CODE_to_lDEBUG_CODE_dualcall_helper, pop_if, push_if
   497                              <3> 
   498                              <3>  extern isextenderavailable, msg.cannotpmload, nodosextinst
   499                              <3> 
   500                              <3>  extern install_areas, patcharea_pm_exc, patcharea_pm_exc.segment
   501                              <3>  extern patcharea_pm_exc.size
   502                              <3> 
   503                              <3>  extern pmint21
   504                              <3> 
   505                              <3>  extern debuggerexception, entry_to_code_sel, exc6msg, excCmsg
   506                              <3>  extern excDmsg, excEmsg, intrtn2_entry, pmintsave.int21
   507                              <3> 
   508                              <3>  extern convsegs, convsegs.amount_fixed, convsegs.end_fixed
   509                              <3>  extern dpmi_pm2rm, dpmi_pmsav, dpmi_rm2pm, dpmi_rmsav, endexctab
   510                              <3>  extern exc_first, exc_second, excsave, exctab, installdpmimsg
   511                              <3>  extern intrtn_entry.from_installdpmi, pmintsave, pminttab
   512                              <3>  extern pminttab.end, setrmaddr, silence_delete_one_string.internal
   513                              <3> 
   514                              <3>  extern msg.rv_mode_dpmi_16, msg.rv_mode_dpmi_32, msg.vm_code2seg
   515                              <3>  extern msg.vm_selector, msg.vp_dpspsel, msg.vp_pspsel, psp_selector
   516                              <3> 
   517                              <3>  extern ..@getcseipbyte_fault_skip_6_near_call
   518                              <3>  extern ..@hh_code1_indirection_memory_access_end
   519                              <3>  extern ..@hh_code1_indirection_memory_access_start
   520                              <3>  extern ..@readmem_fault_skip_2_near_call
   521                              <3>  extern ..@setcseipbyte_fault_skip_6_near_call
   522                              <3>  extern ..@writemem_fault_skip_2_near_call_a
   523                              <3>  extern ..@writemem_fault_skip_2_near_call_b, behind_code
   524                              <3>  extern behind_code2, convsegs.amount, ddebugareas
   525                              <3>  extern getline_extra_int22.cleartraceflag, msg.list_bp_cseip_32
   526                              <3> 
   527                              <3>  extern MN_O16
   528                              <3> 
   529                              <3>  extern MN_A16
   530                              <3> 
   531                              <3>  extern relocatedzero
   532                              <3> 
   533                              <3>  extern msg.bu_disabled
   534                              <3> 
   535                              <3>  extern reset_interrupts, set_interrupts
   536                              <3> 
   537                              <3>  extern startoptions6
   538                              <3> 
   539                              <3>  extern currentposition, msg.loader_bottom_not_allowed
   540                              <3>  extern msg.loader_too_low_load
   541                              <3> 
   542                              <3>  extern intr_loader_18, intr_loader_19, moveloader_hook_ints
   543                              <3> 
   544                              <3>  extern loader_query, loader_transfer_cmd3, loader_transfer_relocate
   545                              <3> 
   546                              <3>  extern cmd3_int_disable.set_bx_to_dx, cmd3_int_enable.set_bx_to_dx
   547                              <3>  extern ldebug_code_size, movesegrefstable, movetable
   548                              <3>  extern movetable.bottom, msg.isalready, msg.isnow, msg.loader_error
   549                              <3>  extern msg.move, msg.move_auxbuff_error, msg.move_auxdown
   550                              <3>  extern msg.move_auxup, msg.move_ebdanottop, msg.move_empty
   551                              <3>  extern msg.move_int_error, msg.move_int_panic
   552                              <3>  extern msg.move_must_be_bottom, msg.move_nottop, msg.move_oom
   553                              <3>  extern msg.move_rpl, msg.move_toolargeebda, msg.unsupportedmove
   554                              <3>  extern qq_int_unhook_sim.set_bx_to_dx
   555                              <3> 
   556                              <3>  extern moveloader.already, moveloader.bottom_to_hidden
   557                              <3>  extern moveloader.bottom_to_top, moveloader.hidden_to_bottom
   558                              <3>  extern moveloader.hidden_to_top, moveloader.top_to_bottom
   559                              <3>  extern moveloader.top_to_hidden
   560                              <3> 
   561                              <3>  extern moveloader.specificerror, moveloader_check_serial, msg.godebug
   562                              <3>  extern msg.loader_extra, msg.loader_flag, msg.loader_loadseg_low
   563                              <3>  extern msg.loader_must_be_hidden, msg.loader_sign, msg.loader_stack
   564                              <3>  extern msg.loadsupportsignature, msg.loadsupportsignature.size
   565                              <3> 
   566                              <3>  extern depack, hshrink_memory_source.offset
   567                              <3>  extern hshrink_memory_source.segment, indirect_hshrink_message_buffer
   568                              <3>  extern msg.hshrink_error, nontruncated_hshrink_message_buffer
   569                              <3> 
   570                              <3>  extern truncated_hshrink_message_buffer
   571                              <3> 
   572                              <3>  extern patch_boothelp_uncompressed
   295                              <2> %endif
   710                              <1> %endif
   711                              <1> [list -]
   714                              <1> 
   715                              <1> %include "eld.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> Extensions for lDebug macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> %ifndef ELD_MAC
    16                              <2> %define ELD_MAC 1
    17                              <2> 
    18                              <2> %include "lmacros3.mac"
     1                              <3> [list -]
    19                              <2> 
    20                              <2> 		; ELD executable header
    21                              <2> 	struc ELD_HEADER
    22 00000000 ????????            <2> eldhSignature:		resb 4	; "ELD1"
    23 00000004 ??????              <2> 			resb 3	; reserved
    24 00000007 ??                  <2> 			resb 1	; 26 (Ctrl-Z)
    25 00000008 ????????            <2> eldhCodeOffset:		resd 1	; position displacement from eldhSignature
    26 0000000C ????                <2> eldhCodeImageLength:	resw 1	; amount bytes, at least 32
    27 0000000E ????                <2> eldhCodeAllocLength:	resw 1	; amount bytes, added to prior. sum < 64 KiB
    28 00000010 ????????            <2> eldhDataOffset:		resd 1
    29 00000014 ????                <2> eldhDataImageLength:	resw 1	; (zero allowed)
    30 00000016 ????                <2> eldhDataAllocLength:	resw 1	; (zero allowed)
    31 00000018 ????                <2> eldhCodeEntrypoint:	resw 1	; within code section, used as displacement
    32 0000001A ????????            <2> eldhReserved:		resb 4	; reserved
    33 0000001E ????                <2> eldhExtensionSize:	resw 1	; from eldhSignature, -> past eldhx fields in use
    34                              <2> 	endstruc
    35                              <2> 	endarea ELD_HEADER, 1
    36                              <2> 
    37                              <2> 	struc ELD_HEADERX
    38 00000000 <res 20h>           <2> eldhxHeader:		resb ELD_HEADER_size
    39 00000020 ????????            <2> eldhxDescriptionOffset:	resd 1	; zero if none, from eldhxHeader. <= 128 Bytes
    40 00000024 ????????            <2> eldhxHelpOffset:	resd 1	; zero if none, from eldhxHeader
    41 00000028 ????????            <2> eldhxLibTable:		resd 1	; zero if none, from eldhxHeader
    42 0000002C ????????            <2> eldhxDateTimeOffset:	resd 1	; zero if none, from eldhxHeader
    43                              <2> 	alignb 16
    44                              <2> 	endstruc
    45                              <2> 
    46                              <2> 	struc ELD_TRAILER_HEADER
    47 00000000 ????????????????    <2> eldthSignature:		resb 8	; "ELD1TAIL"
    48 00000008 ????????            <2> eldthHeaderOffset:	resd 1	; negative displacement from eldthSignature,
    49                              <2> 				;  add this dword to the seek offset
    50 0000000C ????                <2> eldthReserved:		resw 1	; reserved, must be initialised to zero
    51 0000000E ????                <2> eldthChecksum:		resw 1	; sum of all words in trailer header = 0
    52                              <2> 	endstruc
    53                              <2> 	endarea ELD_TRAILER_HEADER, 1
    54                              <2> 
    55                              <2> 	struc ELD_LIBTABLE
    56 00000000 ????                <2> eldltFormat:		resw 1
    57                              <2> 	; 0 = uncompressed
    58                              <2> 	; 2 = heatshrink compressed
    59                              <2> 	; 3 = lzexedat -4 compressed
    60                              <2> 	; 4 = lzexedat -4 -l compressed
    61 00000002 ????                <2> eldltAmount:		resw 1
    62 00000004 ????????            <2> eldltOffset:		resd 1	; from eldhxHeader
    63                              <2> eldltCompressedLength:		; (dword, only present if format 2, 3, or 4)
    64                              <2> 	endstruc
    65                              <2> 	endarea ELD_LIBTABLE, 1
    66                              <2> 
    67                              <2> 		; ELD instance header
    68                              <2> 	struc ELD_INSTANCE
    69 00000000 ????                <2> eldiStartCode:		resw 1	; -> this structure itself (para aligned)
    70 00000002 ????                <2> eldiEndCode:		resw 1	; -> behind memory used by instance (para aligned)
    71 00000004 ????                <2> eldiStartData:		resw 1	; -> data in data entry section (para aligned), or 0
    72 00000006 ????                <2> eldiEndData:		resw 1	; -> behind data (para aligned), or 0
    73 00000008 ????????????????    <2> eldiIdentifier:		resb 8	; blank-filled text
    74 00000010 ????                <2> eldiFlags:		resw 1	; flags
    75                              <2> eldiListing_size equ 14
    76 00000012 <res Eh>            <2> eldiListing:		resb eldiListing_size
    77                              <2> 				; ASCIZ listing file name
    78                              <2> 	endstruc
    79                              <2> 		; flags for eldiFlags:
    80                              <2> eldifResident:		equ 1
    81                              <2> 
    82                              <2> 		; ELD link info header
    83                              <2> 	struc ELD_LINKINFO
    84 00000000 ????                <2> eldlSignature:		resw 1	; 0E1D1h
    85 00000002 ????????            <2> eldlReserved:		resw 2
    86 00000006 ????                <2> eldlUseLinkHash:	resw 1
    87 00000008 ????                <2> eldlDataAmount:		resw 1
    88 0000000A ????                <2> eldlDataPrefixes:	resw 1
    89 0000000C ????                <2> eldlDataEntries:	resw 1
    90 0000000E ????                <2> eldlDataAddresses:	resw 1
    91 00000010 ????                <2> eldlCodeAmount:		resw 1
    92 00000012 ????                <2> eldlCodePrefixes:	resw 1
    93 00000014 ????                <2> eldlCodeEntries:	resw 1
    94 00000016 ????                <2> eldlCodeAddresses:	resw 1
    95                              <2> 	endstruc
    96                              <2> 
    97                              <2> 	numdef ELD_CODE_VSTART, 9001h
    98                              <2> 	numdef ELD_DATA_VSTART, 8000h
    99                              <2> 	numdef ELD_RELOC_VSTART, 8000h
   100                              <2> 
   101                              <2> 	numdef ELD_RECLAIM_HINT, 0
   102                              <2> 	strdef ELD_LISTING, ""
   103                              <2> 	numdef ELD_DATETIME, 0
   104                              <2> 
   105                              <2> %if _ELD_DATETIME
   106                              <2>  %define PUT_ELDHX_DATETIME_OFFSET at eldhxDateTimeOffset, dd DATAOFFSET + datetime - datastart
   107                              <2>  %macro PUT_ELD_DATETIME 0.nolist
   108                              <2> datetime:	asciz __UTC_DATE__,'T',__UTC_TIME__,'Z'
   109                              <2> 		asciz		; for future extension
   110                              <2>  %endmacro
   111                              <2> %else
   112                              <2>  %define PUT_ELDHX_DATETIME_OFFSET
   113                              <2>  %define PUT_ELD_DATETIME
   114                              <2> %endif
   115                              <2> 
   116                              <2> %endif
   716                              <1> 
   717                              <1> %include "install.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug INSTALL command macros
     5                              <2> 
     6                              <2> Copyright (C) 2008-2023 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 	struc INSTALLFLAG
    17 00000000 ????                <2> ifKeyword:	resw 1
    18 00000002 ????                <2> ifDescription:	resw 1
    19 00000004 ????                <2> ifOptions:	resw 1
    20 00000006 ????                <2> ifValue:	resw 1
    21 00000008 ????                <2> ifTrying:	resw 1
    22 0000000A ????                <2> ifReserved:	resw 1
    23                              <2> 	endstruc
    24                              <2> 
   718                              <1> 
   719                              <1> %if _SYMBOLIC
   720                              <1> 	defaulting 0			; disable defaulting
   721                              <1> %include "symbols.mac"
   722                              <1> [list -]
   723                              <1> 		; symbolic branch defines *without* defaulting!
   724                              <1> 	numdef ZZ_INSERT_TEMP, 1
   725                              <1> 	numdef XMS_SYMBOL_TABLE, 1
   726                              <1> 	numdef BUFFER_86MM_SLICE, 0
   727                              <1> 	numdef SECOND_SLICE, 0
   728                              <1> 
   729                              <1> 	defaulting 1			; re-enable defaulting
   730                              <1> 
   731                              <1> 		; symbolic branch defines
   732                              <1> 	numdef 86MM_SYMBOL_TABLE_MAX, 256, 256
   733                              <1> %endif
   734                              <1> 
   735                              <1> 	struc SEGADR
   736 00000000 ????????            <1> saOffset:	resd 1
   737 00000004 ????                <1> saSegSel:	resw 1
   738                              <1> %if _PM
   739 00000006 ????                <1> saSegment:	resw 1
   740 00000008 ????                <1> saSelector:	resw 1
   741                              <1> %endif
   742                              <1> 	endstruc
   743                              <1> 
   744                              <1> 	%macro segmentedaddress 0.nolist
   745                              <1> 	istruc SEGADR
   746                              <1> 	iend
   747                              <1> 	%endmacro
   748                              <1> 
   749                              <1> 	struc SEGOFS16ADR
   750 00000000 ????                <1> so16aOffset:	resw 1
   751 00000002 ????                <1> so16aSegSel:	resw 1
   752                              <1> %if _PM
   753 00000004 ????                <1> so16aSegment:	resw 1
   754 00000006 ????                <1> so16aSelector:	resw 1
   755                              <1> %endif
   756                              <1> 	endstruc
   757                              <1> 
   758                              <1> 	%macro segofs16address 0-1.nolist zero
   759                              <1> 	istruc SEGOFS16ADR
   760                              <1> %ifidni %1,zero
   761                              <1> %elifidni %1,minusone
   762                              <1> at so16aOffset,		dw -1
   763                              <1> at so16aSegSel,		dw -1
   764                              <1>  %if _PM
   765                              <1> at so16aSegment,	dw -1
   766                              <1> at so16aSelector,	dw -1
   767                              <1>  %endif
   768                              <1> %else
   769                              <1>  %error Unexpected initialiser keyword
   770                              <1> %endif
   771                              <1> 	iend
   772                              <1> 	%endmacro
   773                              <1> 
   774                              <1> 	struc SEGONLYADR
   775 00000000 ????                <1> soaSegSel:	resw 1
   776                              <1> %if _PM
   777 00000002 ????                <1> soaSegment:	resw 1
   778 00000004 ????                <1> soaSelector:	resw 1
   779                              <1> %endif
   780                              <1> 	endstruc
   781                              <1> 
   782                              <1> 	%macro segonlyaddress 0.nolist
   783                              <1> 	istruc SEGONLYADR
   784                              <1> 	iend
   785                              <1> 	%endmacro
   786                              <1> 
   787                              <1> 
   788                              <1> %if _LOADER
   789                              <1> 	struc MOVETABLEENTRY
   790                              <1> mteIdentifier:		resw 1
   791                              <1> mteArrayIndex:		resw 1
   792                              <1> mteStatusMessage:	resw 1
   793                              <1> mteFromArray:
   794                              <1> mteFromBottom:		resw 1
   795                              <1> mteFromTop:		resw 1
   796                              <1> mteFromHidden:		resw 1
   797                              <1> 	endstruc
   798                              <1> %endif
   799                              <1> 
   800                              <1> %if _BOOTLDR
   801                              <1>  %include "iniload.mac"
     1                              <2> %if 0
     2                              <2> 
     3                              <2> lDebug iniload/boot interfacing structs and macros
     4                              <2> 
     5                              <2> Copyright (C) 2008-2025 E. C. Masloch
     6                              <2> 
     7                              <2> Usage of the works is permitted provided that this
     8                              <2> instrument is retained with the works, so that any entity
     9                              <2> that uses the works is notified of this instrument.
    10                              <2> 
    11                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    12                              <2> 
    13                              <2> %endif
    14                              <2> 
    15                              <2> 
    16                              <2> 	struc BS
    17 00000000 ??????              <2> bsJump:	resb 3
    18 00000003 ????????????????    <2> bsOEM:	resb 8
    19                              <2> bsBPB:
    20                              <2> 	endstruc
    21                              <2> 
    22                              <2> 	struc EBPB		;        BPB sec
    23 00000000 ????                <2> bpbBytesPerSector:	resw 1	; offset 00h 0Bh
    24 00000002 ??                  <2> bpbSectorsPerCluster:	resb 1	; offset 02h 0Dh
    25 00000003 ????                <2> bpbReservedSectors:	resw 1	; offset 03h 0Eh
    26 00000005 ??                  <2> bpbNumFATs:		resb 1	; offset 05h 10h
    27 00000006 ????                <2> bpbNumRootDirEnts:	resw 1	; offset 06h 11h -- 0 for FAT32
    28 00000008 ????                <2> bpbTotalSectors:	resw 1	; offset 08h 13h
    29 0000000A ??                  <2> bpbMediaID:		resb 1	; offset 0Ah 15h
    30 0000000B ????                <2> bpbSectorsPerFAT:	resw 1	; offset 0Bh 16h -- 0 for FAT32
    31 0000000D ????                <2> bpbCHSSectors:		resw 1	; offset 0Dh 18h
    32 0000000F ????                <2> bpbCHSHeads:		resw 1	; offset 0Fh 1Ah
    33 00000011 ????????            <2> bpbHiddenSectors:	resd 1	; offset 11h 1Ch
    34 00000015 ????????            <2> bpbTotalSectorsLarge:	resd 1	; offset 15h 20h
    35                              <2> bpbNew:				; offset 19h 24h
    36                              <2> 
    37 00000019 ????????            <2> ebpbSectorsPerFATLarge:	resd 1	; offset 19h 24h
    38 0000001D ????                <2> ebpbFSFlags:		resw 1	; offset 1Dh 28h
    39 0000001F ????                <2> ebpbFSVersion:		resw 1	; offset 1Fh 2Ah
    40 00000021 ????????            <2> ebpbRootCluster:	resd 1	; offset 21h 2Ch
    41 00000025 ????                <2> ebpbFSINFOSector:	resw 1	; offset 25h 30h
    42 00000027 ????                <2> ebpbBackupSector:	resw 1	; offset 27h 32h
    43 00000029 <res Ch>            <2> ebpbReserved:		resb 12	; offset 29h 34h
    44                              <2> ebpbNew:			; offset 35h 40h
    45                              <2> 	endstruc
    46                              <2> 
    47                              <2> 	struc BPBN		; ofs B16 S16 B32 S32
    48 00000000 ??                  <2> bpbnBootUnit:		resb 1	; 00h 19h 24h 35h 40h
    49 00000001 ??                  <2> 			resb 1	; 01h 1Ah 25h 36h 41h
    50 00000002 ??                  <2> bpbnExtBPBSignature:	resb 1	; 02h 1Bh 26h 37h 42h -- 29h for valid BPBN
    51 00000003 ????????            <2> bpbnSerialNumber:	resd 1	; 03h 1Ch 27h 38h 43h
    52 00000007 <res Bh>            <2> bpbnVolumeLabel:	resb 11	; 07h 20h 2Bh 3Ch 47h
    53 00000012 ????????????????    <2> bpbnFilesystemID:	resb 8	; 12h 2Bh 36h 47h 52h
    54                              <2> 	endstruc		; 1Ah 33h 3Eh 4Fh 5Ah
    55                              <2> 
    56                              <2> 	struc DIRENTRY
    57 00000000 ????????????????    <2> deName:		resb 8
    58 00000008 ??????              <2> deExt:		resb 3
    59 0000000B ??                  <2> deAttrib:	resb 1
    60 0000000C ??                  <2> dePlusSize:	resb 1
    61 0000000D ??????????????      <2> 		resb 7
    62 00000014 ????                <2> deClusterHigh:	resw 1
    63 00000016 ????                <2> deTime:		resw 1
    64 00000018 ????                <2> deDate:		resw 1
    65 0000001A ????                <2> deClusterLow:	resw 1
    66 0000001C ????????            <2> deSize:		resd 1
    67                              <2> 	endstruc
    68                              <2> 
    69                              <2> ATTR_READONLY	equ 1
    70                              <2> ATTR_HIDDEN	equ 2
    71                              <2> ATTR_SYSTEM	equ 4
    72                              <2> ATTR_VOLLABEL	equ 8
    73                              <2> ATTR_DIRECTORY	equ 10h
    74                              <2> ATTR_ARCHIVE	equ 20h
    75                              <2> 
    76                              <2> lsvclSignature		equ "CL"
    77                              <2> lsvclBufferLength	equ 256
    78                              <2> 
    79                              <2> 	struc LOADSTACKVARS, -10h
    80 FFFFFFF0 ????????            <2> lsvFirstCluster:	resd 1
    81 FFFFFFF4 ????????            <2> lsvFATSector:		resd 1
    82 FFFFFFF8 ????                <2> lsvFATSeg:		resw 1
    83 FFFFFFFA ????                <2> lsvLoadSeg:		resw 1
    84 FFFFFFFC ????????            <2> lsvDataStart:		resd 1
    85                              <2> 	endstruc
    86                              <2> 
    87                              <2> 	struc LOADDATA, LOADSTACKVARS - 10h
    88 FFFFFFE0 ????                <2> ldMemoryTop:	resw 1
    89 FFFFFFE2 ????                <2> ldLoadTop:	resw 1
    90 FFFFFFE4 ????                <2> ldSectorSeg:	resw 1
    91 FFFFFFE6 ??                  <2> ldFATType:	resb 1
    92                              <2> ldFlags:
    93 FFFFFFE7 ??                  <2> ldHasLBA:	resb 1
    94 FFFFFFE8 ????                <2> ldClusterSize:	resw 1
    95 FFFFFFEA ????                <2> ldParaPerSector:resw 1
    96                              <2> ldDirCluster:			; dword
    97                              <2> ldLoadingSeg:		; word
    98                              <2> ldQueryPatchValue:	; word
    99                              <2> lsvCommandLine:		; word
   100                              <2> .start:		equ $ - lsvclBufferLength
   101 FFFFFFEC ????                <2> .signature:	resw 1
   102                              <2> ldLoadUntilSeg:		; word
   103                              <2> lsvExtra:		; word
   104 FFFFFFEE ??                  <2> .partition:	resb 1	; byte
   105 FFFFFFEF ??                  <2> .flags:		resb 1	; byte
   106                              <2> 	endstruc
   107                              <2> 
   108                              <2> ldhlfPreserveLoader	equ 4
   109                              <2> 
   110                              <2> lsvefNoDataStart	equ 1
   111                              <2> lsvefPartitionNumber	equ 2
   112                              <2> lsvefPreserveLoader	equ 4
   113                              <2> 
   114                              <2> %if lsvefPreserveLoader != ldhlfPreserveLoader
   115                              <2>  %error Unexpected flag values
   116                              <2> %endif
   117                              <2> 
   118                              <2> 	struc LOADCMDLINE, LOADDATA - lsvclBufferLength
   119                              <2> ldCommandLine:
   120 FFFFFEE0 <res 100h>          <2> .start:		resb lsvclBufferLength
   121                              <2> 	endstruc
   122                              <2> 
   123                              <2> ldfHasLBA:	equ 1
   124                              <2> ldfFATInvalid:	equ 2
   125                              <2> ldfFATBuffered:	equ 4
   126                              <2> ldfDataBuffered: equ 8
   127                              <2> 
   128                              <2> 	struc LOADDATA2, LOADDATA - 10h
   129 FFFFFFD0 ????????            <2> ldRootSector:		resd 1
   130 FFFFFFD4 ????                <2> ldEntriesPerSector:	resw 1
   131                              <2> ldDataSegment:		; word
   132 FFFFFFD6 ????                <2> ldLastAvailableSector:	resw 1
   133                              <2> ldDataSector:		; dword
   134 FFFFFFD8 ????                <2> ldParasLeft:		resw 1
   135 FFFFFFDA ????                <2> ldParasDone:		resw 1
   136                              <2> 	endstruc
   137                              <2> 
   138                              <2> 	struc LOADDATA3, LOADDATA2 - 10h
   139 FFFFFFC0 ????????            <2> ldMaxCluster:		resd 1
   140 FFFFFFC4 ????????            <2> ldFileSize:		resd 1
   141 FFFFFFC8 ????????            <2> ldCurrentCluster:	resd 1
   142 FFFFFFCC ????????            <2> ldCurrentSeek:		resd 1
   143                              <2> 	endstruc
   144                              <2> 
   145                              <2> 	struc LOADERIMAGEIDENT
   146 00000000 ????????            <2> liiSignature:		resb 4		; "NLDR"
   147 00000004 ????                <2> liiVersion:		resb 2		; "00"
   148 00000006 ????                <2> liiChecksum:		resw 1		; word sum of first 8 words = 0
   149 00000008 ????                <2> liiAmountParagraphs:	resw 1
   150 0000000A ????????????        <2> liiReserved:		resw 3
   151 00000010 ????                <2> liiEntryQuerySize:	resw 1		; 0 if not supported
   152                              <2> 		; INP:	cs => NLDR image ident
   153                              <2> 		;	ip = this word field content
   154                              <2> 		;	ax = 60h
   155                              <2> 		; OUT:	ax => behind memory requested (should be >= 60h)
   156                              <2> 		; CHG:	es, ds, di, si, bx, cx, dx
   157                              <2> 		; STT:	far called, UP, EI
   158 00000012 ????                <2> liiEntryRelocate:	resw 1		; 0 if not supported
   159                              <2> 		; INP:	cs => NLDR image ident
   160                              <2> 		;	ip = this word field content
   161                              <2> 		;	ax = 60h
   162                              <2> 		; OUT:	ax => relocated NLDR segment (usually 60h)
   163                              <2> 		; CHG:	es, ds, di, si, bx, cx, dx
   164                              <2> 		; STT:	far called, UP, EI
   165 00000014 ????                <2> liiEntryDebug:		resw 1		; 0 if not supported
   166                              <2> 		; INP:	es = ds = cs = ss => relocated NLDR
   167                              <2> 		;	ip = this word field content
   168                              <2> 		;	sp = next word field content
   169                              <2> 		; STT:	running as debuggee, UP, EI
   170 00000016 ????                <2> liiStackPointer:	resw 1
   171                              <2> 	endstruc
   172                              <2> 
   173                              <2> 	struc LBAPACKET
   174 00000000 ????                <2> lpSize:		resw 1
   175 00000002 ????                <2> lpCount:	resw 1
   176 00000004 ????????            <2> lpBuffer:	resd 1
   177 00000008 ????????????????    <2> lpSector:	resq 1
   178                              <2> 	endstruc
   179                              <2> 
   180                              <2> 	struc PARTINFO
   181 00000000 ??                  <2> piBoot:		resb 1
   182 00000001 ??????              <2> piStartCHS:	resb 3
   183 00000004 ??                  <2> piType:		resb 1
   184 00000005 ??????              <2> piEndCHS:	resb 3
   185 00000008 ????????            <2> piStart:	resd 1
   186 0000000C ????????            <2> piLength:	resd 1
   187                              <2> 	endstruc
   188                              <2> 
   189                              <2> ptEmpty:		equ 0
   190                              <2> ptFAT12:		equ 1
   191                              <2> ptFAT16_16BIT_CHS:	equ 4
   192                              <2> ptExtendedCHS:		equ 5
   193                              <2> ptFAT16_CHS:		equ 6
   194                              <2> ptFAT32_CHS:		equ 0Bh
   195                              <2> ptFAT32:		equ 0Ch
   196                              <2> ptFAT16:		equ 0Eh
   197                              <2> ptExtended:		equ 0Fh
   198                              <2> ptLinux:		equ 83h
   199                              <2> ptExtendedLinux:	equ 85h
   200                              <2> 
   201                              <2> 
   202                              <2> 		; Flags of load_unit_flags
   203                              <2> lufForceCHS:		equ 1
   204                              <2> lufForceLBA:		equ 2
   205                              <2> lufForceGeometry:	equ 4
   206                              <2> luf_mask_writable equ lufForceCHS | lufForceLBA | lufForceGeometry
   802                              <1> 
   803                              <1> LOAD_INPUT_FILE_SIZE equ fromparas(paras(-LOADDATA3 + bsBPB + ebpbNew + BPBN_size))
   804                              <1> 
   805                              <1> 	struc LOADSETTINGS
   806 00000000 ????                <1> lsKernelName:	resw 1	; -> kernel file default name
   807 00000002 ????                <1> lsAddName:	resw 1	; -> additional file default name, may be empty string
   808 00000004 ????                <1> lsMinPara:	resw 1	; how much to load at least, fail if file smaller
   809 00000006 ????                <1> lsMaxPara:	resw 1	; how much to load at most (will round up to sector size)
   810 00000008 ????                <1> lsOptions:	resw 1	; option flags
   811 0000000A ????                <1> lsSegment:	resw 1	; => where to load file
   812 0000000C ????????            <1> lsEntry:	resd 1	; relative segment for CS, value for IP
   813 00000010 ????????            <1> lsBPB:		resd 1	; segment for BPB (-1 auto-BPB), offset for BPB
   814 00000014 ????                <1> lsCheckOffset:	resw 1	; offset in file segment of word to check
   815 00000016 ????                <1> lsCheckValue:	resw 1	; value to check for word, 0 if unused
   816 00000018 ????????????????    <1> lsName:		resq 1	; ASCIZ load protocol name
   817                              <1> 	endstruc
   818                              <1> 
   819                              <1> 		numdef LUF_DEFAULT_DISKETTE, 0
   820                              <1> 		numdef LUF_DEFAULT_HARDDISK, 0
   821                              <1> %endif
   822                              <1> 
   823                              <1> 
   824                              <1> %include "mzheader.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug MZ .EXE header macros
     5                              <2> 
     6                              <2> Copyright (C) 1995-2003 Paul Vojta
     7                              <2> Copyright (C) 2008-2023 E. C. Masloch
     8                              <2> 
     9                              <2> Usage of the works is permitted provided that this
    10                              <2> instrument is retained with the works, so that any entity
    11                              <2> that uses the works is notified of this instrument.
    12                              <2> 
    13                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    14                              <2> 
    15                              <2> %endif
    16                              <2> 
    17                              <2> 
    18                              <2> 	struc EXEHEADER
    19 00000000 ????                <2> exact_struc_at 00h, exeSignature:	resw 1
    20 00000002 ????                <2> exact_struc_at 02h, exeExtraBytes:	resw 1	; bytes in last page
    21 00000004 ????                <2> exact_struc_at 04h, exePages:		resw 1	; number of 512-byte pages. includes the header!
    22 00000006 ????                <2> exact_struc_at 06h, exeRelocItems:	resw 1	; number of relocation items
    23 00000008 ????                <2> exact_struc_at 08h, exeHeaderSize:	resw 1	; header size in 16-byte paragraphs
    24 0000000A ????                <2> exact_struc_at 0Ah, exeMinAlloc:	resw 1	; minimum (bss) allocation in paragraphs
    25 0000000C ????                <2> exact_struc_at 0Ch, exeMaxAlloc:	resw 1	; maximum (bss) allocation in paragraphs
    26 0000000E ????                <2> exact_struc_at 0Eh, exeInitSS:		resw 1	; init ss (is relocated)
    27 00000010 ????                <2> exact_struc_at 10h, exeInitSP:		resw 1	; init sp
    28 00000012 ????                <2> exact_struc_at 12h, exeChecksum:	resw 1
    29                              <2> exact_struc_at 14h, exeInitCSIP:
    30 00000014 ????                <2> exact_struc_at 14h, exeInitIP:		resw 1	; init ip
    31 00000016 ????                <2> exact_struc_at 16h, exeInitCS:		resw 1	; init cs (is relocated)
    32 00000018 ????                <2> exact_struc_at 18h, exeRelocTable:	resw 1	; byte offset of relocation table
    33                              <2> 		; Each relocation item is a word offset and a word segment.
    34                              <2> 		;  The segment of the item itself is relocated as well.
    35 0000001A ????                <2> exact_struc_at 1Ah, exeOverlayNum:	resw 1
    36                              <2> exact_struc_at 1Ch
    37                              <2> 	endstruc
   825                              <1> 
   826                              <1> 
   827                              <1> 	struc INPUTFILEHANDLE
   828 00000000 ????                <1> ifhHandle:	resw 1
   829 00000002 ????                <1> ifhFlags:	resw 1
   830 00000004 ????????            <1> ifhParentSeek:	resd 1
   831                              <1> 	endstruc
   832                              <1> 
   833                              <1> ifhfIsDup:		equ  100h	; before closing, seek it back
   834                              <1> 	; same value as LBA flag for boot load input files
   835                              <1> ifhfTestReserved1:	equ 1000h
   836                              <1> ifhfTestReserved2:	equ 2000h
   837                              <1> ifhfQuietInput:		equ 4000h	; do not display prompt and input
   838                              <1> ifhfQuietOutput:	equ 8000h	; do not display normal output
   839                              <1> 	; these four are valid for both input file handles and
   840                              <1> 	;  boot load input files.
   841                              <1> 
   842                              <1> 
   843                              <1> 	struc AREASTRUC
   844 00000000 <res 18h>           <1> areastrucEntry:		resb 24
   845 00000018 ????????            <1> areastrucNext:		resd 1
   846 0000001C ????????            <1> areastrucPrev:		resd 1
   847 00000020 ????                <1> areastrucSubAmount:	resw 1
   848 00000022 ????                <1> areastrucSubOffset:	resw 1
   849 00000024 ????                <1> areastrucFunAmount:	resw 1
   850 00000026 ????                <1> areastrucFunOffset:	resw 1
   851                              <1> 	endstruc
   852                              <1> 
   853                              <1> 	struc AREASTRUCSUB
   854 00000000 ????????            <1> areastrucsubLinear:	resd 1
   855 00000004 ????????            <1> areastrucsubLinearEnd:	resd 1
   856 00000008 ????                <1> areastrucsubListOffset:	resw 1
   857 0000000A ????                <1> areastrucsubListAmount:	resw 1
   858                              <1> 	endstruc
   859                              <1> 
   860                              <1> 	struc AREASTRUCFUN
   861 00000000 ????????            <1> areastrucfunLinear:	resd 1
   862 00000004 ????????            <1> areastrucfunLinearEnd:	resd 1
   863 00000008 ????                <1> areastrucfunListOffset:	resw 1
   864 0000000A ????                <1> areastrucfunListAmount:	resw 1
   865                              <1> 	endstruc
   866                              <1> 
   867                              <1> 	struc AREA
   868 00000000 ????                <1> areastart:		resw 1
   869 00000002 ????                <1> areaend:		resw 1
   870 00000004 ????                <1> areamessage:		resw 1
   871 00000006 ????                <1> 			resw 1
   872                              <1> 	endstruc
   873                              <1> 
   874                              <1> 
   875                              <1> %include "isvariab.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug isvariable? function strutures and macros
     5                              <2> 
     6                              <2> Copyright (C) 2008-2025 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 
    17                              <2> 	struc ISVARIABLESTRUC
    18 00000000 ????                <2> ivName:		resw 1		; -> name (up to 13 bytes, but actually only 11)
    19                              <2> 				;  (search for ivfNameLengthLimit for limit)
    20                              <2> 				;  (length given by ivFlags & ivfNameLengthMask)
    21                              <2> 	; The ivName pointer is only used for more-byte names. It actually
    22                              <2> 	;  contains the trailer of the name, excluding the prefix formed by
    23                              <2> 	;  the first two bytes. This suffix can be the empty string if the
    24                              <2> 	;  variable in question has a two-byte name.
    25                              <2> 	; (For one-byte names this field is unused and contains zero.)
    26 00000002 ????                <2> ivFlags:	resw 1
    27 00000004 ????                <2> ivAddress:	resw 1		; default -> variable
    28                              <2> 	; The ivAddress field is used by default_variable_setup as the base
    29                              <2> 	;  address for the variable(s). It is also used by var_ext_setup as
    30                              <2> 	;  the ELD code section offset to transfer control to. Otherwise, it
    31                              <2> 	;  is usually set to zero and unused.
    32 00000006 ????                <2> ivSetup:	resw 1		; -> set up code (in expr code section)
    33                              <2> 	; INP:	ax = array index (0-based)
    34                              <2> 	;	di = 0
    35                              <2> 	;	cl = default size of variable (1..4)
    36                              <2> 	;	ch = length of variable name
    37                              <2> 	;	bx -> ISVARIABLESTRUC structure
    38                              <2> 	; CHG:	ax, bx, cx, dx, si, di
    39                              <2> 	; OUT:	NC if valid,
    40                              <2> 	;	 bx -> var, di = 0 or di -> mask
    41                              <2> 	;	 cl = size of variable (1..4)
    42                              <2> 	;	 ch = length of variable name
    43 00000008 ??                  <2> ivArrayLast:	resb 1		; 0 if no array, FFh = 256 entries
    44                              <2> 	; The ivArrayLast field is used by the dispatcher to determine
    45                              <2> 	;  whether to support array index expressions. It is checked
    46                              <2> 	;  before decrementing the index if ivfArrayOneBased is set.
    47 00000009 ??                  <2> ivArrayBetween: resb 1		; how many bytes to skip for each index
    48                              <2> 	; The ivArrayBetween field is only used by default_variable_setup.
    49                              <2> 	endstruc
    50                              <2> 
    51                              <2> ivfNameLengthMask:	equ 15	; gives name trailer length, 0 to 11
    52                              <2> ivfNameLengthLimit:	equ 13
    53                              <2> ivfVarLengthShift:	equ 4
    54                              <2> ivfVarLengthMask:	equ 3 << ivfVarLengthShift
    55                              <2> 				; gives default variable size minus 1
    56                              <2> ivfReadOnly:		equ 80h	; variable cannot be written at all
    57                              <2> ivfArrayOneBased:	equ 100h; first array entry is 1 not 0 (ivArrayLast > 0)
    58                              <2> ivfArrayOptional:	equ 200h; array index expression is optional
    59                              <2> ivfSeparatorSpecial:	equ 400h; used for RIxxP/L/S/O
    60                              <2> 
    61                              <2> %define ISVARIABLESTRINGS db "",db ""
    62                              <2> %define IVS_ONEBYTE_NAMES ""
    63                              <2> %define IVS_MOREBYTE_NAMEHEADERS ""
    64                              <2> %assign IVS_HAVE_ONEBYTE 0
    65                              <2> %assign IVS_SINGLE_ONEBYTE 1
    66                              <2> 
    67                              <2> 		; %1 = name string
    68                              <2> 		; %2 = default variable length, 1 to 4
    69                              <2> 		; %3 = flags to set (except name length and var length)
    70                              <2> 		; %4 = ivAddress value
    71                              <2> 		; %5 = ivArrayLast, defaults to 0 (no array)
    72                              <2> 		; %6 = ivArrayBetween, defaults to 0 (immediately consecutive)
    73                              <2> 		; %7 = ivSetup, defaults to default_variable_setup
    74                              <2> 	%macro isvariablestruc 4-7.nolist 0, 0, default_variable_setup
    75                              <2> %push
    76                              <2> %strlen %$namelength %1
    77                              <2> %if %$namelength > ivfNameLengthLimit
    78                              <2>  %error Expected at most 13-byte name (or adjust isvariable? code)
    79                              <2> %endif
    80                              <2> %if IVS_ONEBYTE && %$namelength != 1
    81                              <2>  %error Expected a one-byte name
    82                              <2> %elif ! IVS_ONEBYTE && %$namelength < 2
    83                              <2>  %error Expected at least a two-byte name
    84                              <2> %endif
    85                              <2> %if IVS_ONEBYTE
    86                              <2>  %define IVS_SINGLE_ONEBYTE_NAME %1
    87                              <2>  %if IVS_HAVE_ONEBYTE
    88                              <2>   %assign IVS_SINGLE_ONEBYTE 0
    89                              <2>  %endif
    90                              <2>  %assign IVS_HAVE_ONEBYTE 1
    91                              <2>  %assign %$namelength 0
    92                              <2>  %xdefine IVS_ONEBYTE_NAMES IVS_ONEBYTE_NAMES, %1
    93                              <2>  %%name equ 0
    94                              <2> %else
    95                              <2>  %assign %$namelength %$namelength - 2
    96                              <2>  %substr %$nametrailer %1 3,-1
    97                              <2>  %substr %$nameheader %1 1,2
    98                              <2>  %xdefine IVS_MOREBYTE_NAMEHEADERS IVS_MOREBYTE_NAMEHEADERS, %$nameheader
    99                              <2>  %xdefine ISVARIABLESTRINGS ISVARIABLESTRINGS, %%name:, {db %$nametrailer}
   100                              <2> %endif
   101                              <2> 
   102                              <2> %assign %$varlength %2 - 1	; 0 means one byte, 1 means two bytes,
   103                              <2> 				;  2 means three bytes, 3 means four bytes
   104                              <2> 	istruc ISVARIABLESTRUC
   105                              <2> at ivName,		dw %%name
   106                              <2>  IV_NAME_RELOCATION
   107                              <2> at ivFlags,		dw %$$namelength | (%$$varlength << ivfVarLengthShift) | %3
   108                              <2> at ivAddress,		dw %4
   109                              <2>  IV_ADDRESS_RELOCATION
   110                              <2> at ivSetup,		dw %7
   111                              <2>  IV_SETUP_RELOCATION
   112                              <2> at ivArrayLast,		db %5
   113                              <2> at ivArrayBetween,	db %6
   114                              <2> 	iend
   115                              <2> %pop
   116                              <2> %ifndef SECTION_OF_%7
   117                              <2>  %error Unknown target section for symbol %7
   118                              <2> %elifnidni %[SECTION_OF_%7], _EXPR_SECTION
   119                              <2>  %error Wrong section for symbol %7: section_of=SECTION_OF_%7, expr=_EXPR_SECTION
   120                              <2> %endif
   121                              <2> 	%endmacro
   122                              <2> 
   123                              <2> %define IV_NAME_RELOCATION
   124                              <2> %define IV_ADDRESS_RELOCATION
   125                              <2> %define IV_SETUP_RELOCATION
   126                              <2> 
   127                              <2> 	%macro isvariablestrings 2-*.nolist
   128                              <2> %rep %0
   129                              <2>  %1
   130                              <2>  %rotate 1
   131                              <2> %endrep
   132                              <2> 	%endmacro
   876                              <1> 
   877                              <1> 
   878                              <1> %include "386.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug 386 patch macros
     5                              <2> 
     6                              <2> Copyright (C) 2008-2026 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 	numdef LINK, 0
    17                              <2> 
    18                              <2> 	numdef WPT_LABELS, 0
    19                              <2> 		; This used to be required, because CODESECTIONFIXUP used
    20                              <2> 		;  ldebug_data_entry_size, which is not yet defined during
    21                              <2> 		;  assembling of (most) lDEBUG_CODE fragments.
    22                              <2> 		; However, assembling DebugX with this option selected
    23                              <2> 		;  took more than 2 minutes, so the non-label variant
    24                              <2> 		;  is clearly to be preferred when available.
    25                              <2> 		; Now that lDEBUG_CODE has vstart=0 we can use the
    26                              <2> 		;  CODESECTIONFIXUP again and thus disable this option.
    27                              <2> 
    28                              <2> %ifn _LINK
    29                              <2> %define PATCH_NO386_TABLE ""
    30                              <2> %define PATCH_386_TABLE ""
    31                              <2> %define PATCH_NO386_TABLE2 ""
    32                              <2> %define PATCH_386_TABLE2 ""
    33                              <2> %define PATCH_NO386_TABLEENTRY ""
    34                              <2> %define PATCH_386_TABLEENTRY ""
    35                              <2> %endif
    36                              <2> 
    37                              <2> %if _ONLY386
    38                              <2> 		; Default patch macros if only running on 386+.
    39                              <2> %define _386_o32 o32
    40                              <2> %define _386_a32 a32
    41                              <2> %define _386_jmps jmp short
    42                              <2> %define _386_jmpn jmp near
    43                              <2> %define _no386_jmps comment
    44                              <2> %define _no386_jmpn comment
    45                              <2> 	%macro _386 0-1+.nolist
    46                              <2> [cpu 386]			; change CPU type
    47                              <2> 		%1		; write instruction
    48                              <2> __CPU__				; reset CPU type
    49                              <2> 	%endmacro
    50                              <2> %define _no386 comment
    51                              <2> %elif _ONLYNON386
    52                              <2> 		; Default patch macros if only running on non-386.
    53                              <2> %define _386_o32
    54                              <2> %define _386_a32
    55                              <2> %define _386_jmps comment
    56                              <2> %define _386_jmpn comment
    57                              <2> %define _no386_jmps jmp short
    58                              <2> %define _no386_jmpn jmp near
    59                              <2> %define _386 comment
    60                              <2> %define _no386
    61                              <2> %else
    62                              <2> 
    63                              <2> ; These macros are to make DEBUG's 386 support as small as
    64                              <2> ; possible. To achieve this, two patch tables are created
    65                              <2> ; in the initialisation code. One of the tables is used if
    66                              <2> ; the CPU is a 386+, the other one if it isn't. The bytes
    67                              <2> ; pointed to in the used table are over-written with NOP
    68                              <2> ; instructions. (The patched bytes are usually address or
    69                              <2> ; operand size prefixes or jumps that branch to 386/non-386
    70                              <2> ; code.)
    71                              <2> 
    72                              <2> ; There are a few special patches that require the
    73                              <2> ; initialisation code to write specific bytes other than
    74                              <2> ; NOP instructions for lower resident memory usage.
    75                              <2> ; Two are in the run: code, three in pmentry.asm.
    76                              <2> 
    77                              <2> %if _LINK
    78                              <2> 
    79                              <2> %imacro wllist 1-3.nolist
    80                              <2> %ifnempty %3
    81                              <2>  %deftok %%filenametoken %3
    82                              <2> %else
    83                              <2>  %deftok %%filenametoken __FILE__
    84                              <2> %endif
    85                              <2>  global ..@wllist_%1?%[%%l]%[%%filenametoken]
    86                              <2> ..@wllist_%1?%[%%l]%[%%filenametoken]: %2
    87                              <2> %endmacro
    88                              <2> 
    89                              <2> 	%macro patch386 2-3.nolist 1
    90                              <2> %define %%repeat
    91                              <2> %if %3 != 1
    92                              <2>  %define %%repeat r%3_
    93                              <2> %endif
    94                              <2> %ifidn _CURRENT_SECTION, lDEBUG_CODE
    95                              <2>  wllist %[%%repeat]Lpatch_%{1}386_table, %2
    96                              <2> %elifidn _CURRENT_SECTION, lDEBUG_CODE2
    97                              <2>  wllist %[%%repeat]Lpatch_%{1}386_table2, %2
    98                              <2> %elifidn _CURRENT_SECTION, lDEBUG_DATA_ENTRY
    99                              <2>  wllist %[%%repeat]Lpatch_%{1}386_tableentry, %2
   100                              <2> %else
   101                              <2>  %error Wrong section
   102                              <2> %endif
   103                              <2> 	%endmacro
   104                              <2> 
   105                              <2> 		; Operand size 32-bit prefix if 386+ CPU
   106                              <2> 	%macro _386_o32 0-1+.nolist
   107                              <2> _386		o32
   108                              <2> 		%1
   109                              <2> 	%endmacro
   110                              <2> 
   111                              <2> 		; Address size 32-bit prefix if 386+ CPU
   112                              <2> 	%macro _386_a32 0-1+.nolist
   113                              <2> _386		a32
   114                              <2> 		%1
   115                              <2> 	%endmacro
   116                              <2> 
   117                              <2> 		; Short jump if 386+ CPU
   118                              <2> 	%macro _386_jmps 1.nolist
   119                              <2> _386		jmp short %1
   120                              <2> 	%endmacro
   121                              <2> 
   122                              <2> 		; Near jump if 386+ CPU
   123                              <2> 	%macro _386_jmpn 1.nolist
   124                              <2> _386		jmp near %1
   125                              <2> 	%endmacro
   126                              <2> 
   127                              <2> 		; Short jump if no 386+ CPU
   128                              <2> 	%macro _no386_jmps 1.nolist
   129                              <2> _no386		jmp short %1
   130                              <2> 	%endmacro
   131                              <2> 
   132                              <2> 		; Near jump if no 386+ CPU
   133                              <2> 	%macro _no386_jmpn 1.nolist
   134                              <2> _no386		jmp near %1
   135                              <2> 	%endmacro
   136                              <2> 
   137                              <2> 		; Instruction if 386+ CPU
   138                              <2> 	%macro _386 0-1+.nolist
   139                              <2> [cpu 386]			; change CPU type
   140                              <2> %%entry:
   141                              <2> 		%1		; write instruction
   142                              <2> __CPU__				; reset CPU type
   143                              <2> %assign %%length ($ - %%entry)
   144                              <2>  patch386 no, equ %%entry, %%length
   145                              <2> 	%endmacro
   146                              <2> 
   147                              <2> 		; Instruction if no 386+ CPU
   148                              <2> 	%macro _no386 0-1+.nolist
   149                              <2> %%entry:
   150                              <2> 		%1		; write instruction
   151                              <2> %assign %%length ($ - %%entry)
   152                              <2>  patch386 , equ %%entry, %%length
   153                              <2> 	%endmacro
   154                              <2> 
   155                              <2> %else
   156                              <2> 	%macro patch386 2+.nolist
   157                              <2> %ifidn _CURRENT_SECTION, lDEBUG_CODE
   158                              <2>  %define PATCH_%{1}386_TABLE %[PATCH_%{1}386_TABLE], %2
   159                              <2> %elifidn _CURRENT_SECTION, lDEBUG_CODE2
   160                              <2>  %define PATCH_%{1}386_TABLE2 %[PATCH_%{1}386_TABLE2], %2
   161                              <2> %elifidn _CURRENT_SECTION, lDEBUG_DATA_ENTRY
   162                              <2>  %define PATCH_%{1}386_TABLEENTRY %[PATCH_%{1}386_TABLEENTRY], %2
   163                              <2> %else
   164                              <2>  %error Wrong section
   165                              <2> %endif
   166                              <2> 	%endmacro
   167                              <2> 
   168                              <2> %if _WPT_LABELS
   169                              <2> 	; These forms provide verbose info by defining a
   170                              <2> 	; meaningful label for each patch. That fills up
   171                              <2> 	; the map file and might take longer though.
   172                              <2> 		; Operand size 32-bit prefix if 386+ CPU
   173                              <2> 	%macro _386_o32 0-1+.nolist
   174                              <2> %%386_o32:	o32
   175                              <2> patch386 NO, %%386_o32
   176                              <2> 		%1
   177                              <2> 	%endmacro
   178                              <2> 
   179                              <2> 		; Address size 32-bit prefix if 386+ CPU
   180                              <2> 	%macro _386_a32 0-1+.nolist
   181                              <2> %%386_a32:	a32
   182                              <2> patch386 NO, %%386_a32
   183                              <2> 		%1
   184                              <2> 	%endmacro
   185                              <2> 
   186                              <2> 		; Short jump if 386+ CPU
   187                              <2> 	%macro _386_jmps 1.nolist
   188                              <2> %%386_jmps:	jmp short %1
   189                              <2> patch386 NO, %%386_jmps,%%386_jmps+1
   190                              <2> 	%endmacro
   191                              <2> 
   192                              <2> 		; Near jump if 386+ CPU
   193                              <2> 	%macro _386_jmpn 1.nolist
   194                              <2> %%386_jmpn:	jmp near %1
   195                              <2> patch386 NO, %%386_jmpn,%%386_jmpn+1,%%386_jmpn+2
   196                              <2> 	%endmacro
   197                              <2> 
   198                              <2> 		; Short jump if no 386+ CPU
   199                              <2> 	%macro _no386_jmps 1.nolist
   200                              <2> %%no386_jmps:	jmp short %1
   201                              <2> patch386 , %%no386_jmps,%%no386_jmps+1
   202                              <2> 	%endmacro
   203                              <2> 
   204                              <2> 		; Near jump if no 386+ CPU
   205                              <2> 	%macro _no386_jmpn 1.nolist
   206                              <2> %%no386_jmpn:	jmp near %1
   207                              <2> patch386 , %%no386_jmpn,%%no386_jmpn+1,%%no386_jmpn+2
   208                              <2> 	%endmacro
   209                              <2> 
   210                              <2> 		; Instruction if 386+ CPU
   211                              <2> 	%macro _386 0-1+.nolist
   212                              <2> [cpu 386]			; change CPU type
   213                              <2> %%386_instr:	%1		; write instruction
   214                              <2> __CPU__				; reset CPU type
   215                              <2> 
   216                              <2> %assign %%INSTRCOUNT 0
   217                              <2> %rep $-%%386_instr		; count size of instruction
   218                              <2>  patch386 NO, %%386_instr+%[%%INSTRCOUNT]
   219                              <2> 				; write a patch for each byte
   220                              <2>  %assign %%INSTRCOUNT %%INSTRCOUNT+1
   221                              <2> %endrep
   222                              <2> %undef %%INSTRCOUNT
   223                              <2> 	%endmacro
   224                              <2> 
   225                              <2> 		; Instruction if no 386+ CPU
   226                              <2> 	%macro _no386 0-1+.nolist
   227                              <2> %%no386_instr:	%1		; write instruction
   228                              <2> 
   229                              <2> %assign %%INSTRCOUNT 0
   230                              <2> %rep $-%%no386_instr		; count size of instruction
   231                              <2>  patch386 , %%no386_instr+%[%%INSTRCOUNT]
   232                              <2> 				; write a patch for each byte
   233                              <2>  %assign %%INSTRCOUNT %%INSTRCOUNT+1
   234                              <2> %endrep
   235                              <2> %undef %%INSTRCOUNT
   236                              <2> 	%endmacro
   237                              <2> %else	; _WPT_LABELS
   238                              <2> 		; Operand size 32-bit prefix if 386+ CPU
   239                              <2> 	%macro _386_o32 0-1+.nolist
   240                              <2> _386		o32
   241                              <2> 		%1
   242                              <2> 	%endmacro
   243                              <2> 
   244                              <2> 		; Address size 32-bit prefix if 386+ CPU
   245                              <2> 	%macro _386_a32 0-1+.nolist
   246                              <2> _386		a32
   247                              <2> 		%1
   248                              <2> 	%endmacro
   249                              <2> 
   250                              <2> 		; Short jump if 386+ CPU
   251                              <2> 	%macro _386_jmps 1.nolist
   252                              <2> _386		jmp short %1
   253                              <2> 	%endmacro
   254                              <2> 
   255                              <2> 		; Near jump if 386+ CPU
   256                              <2> 	%macro _386_jmpn 1.nolist
   257                              <2> _386		jmp near %1
   258                              <2> 	%endmacro
   259                              <2> 
   260                              <2> 		; Short jump if no 386+ CPU
   261                              <2> 	%macro _no386_jmps 1.nolist
   262                              <2> _no386		jmp short %1
   263                              <2> 	%endmacro
   264                              <2> 
   265                              <2> 		; Near jump if no 386+ CPU
   266                              <2> 	%macro _no386_jmpn 1.nolist
   267                              <2> _no386		jmp near %1
   268                              <2> 	%endmacro
   269                              <2> 
   270                              <2> 		; Instruction if 386+ CPU
   271                              <2> 	%macro _386 0-1+.nolist
   272                              <2> %push
   273                              <2> [cpu 386]			; change CPU type
   274                              <2> %assign %$entry $ + _CURRENT_SECTION %+ FIXUP
   275                              <2> 		%1		; write instruction
   276                              <2> __CPU__				; reset CPU type
   277                              <2> 
   278                              <2> %rep ($ + _CURRENT_SECTION %+ FIXUP) - %$entry
   279                              <2> 				; count size of instruction
   280                              <2>  patch386 NO, %[%$entry]	; write a patch for each byte
   281                              <2>  %assign %$entry %$entry+1
   282                              <2> %endrep
   283                              <2> %pop
   284                              <2> 	%endmacro
   285                              <2> 
   286                              <2> 		; Instruction if no 386+ CPU
   287                              <2> 	%macro _no386 0-1+.nolist
   288                              <2> %push
   289                              <2> %assign %$entry $ + _CURRENT_SECTION %+ FIXUP
   290                              <2> 		%1		; write instruction
   291                              <2> 
   292                              <2> %rep ($ + _CURRENT_SECTION %+ FIXUP) - %$entry
   293                              <2> 				; count size of instruction
   294                              <2>  patch386 , %[%$entry]		; write a patch for each byte
   295                              <2>  %assign %$entry %$entry+1
   296                              <2> %endrep
   297                              <2> %pop
   298                              <2> 	%endmacro
   299                              <2> %endif	; _WPT_LABELS
   300                              <2> %endif	; _LINK
   301                              <2> 
   302                              <2> %endif
   303                              <2> 
   304                              <2> 		; Patch macros but for cases where the 386+
   305                              <2> 		; instructions should only be generated for
   306                              <2> 		; DEBUGX (i.e. for 32-bit DPMI addressing code).
   307                              <2> %if _PM
   308                              <2> %define _386_PM_o32	_386_o32
   309                              <2> %define _386_PM_a32	_386_a32
   310                              <2> %define _386_PM_jmps	_386_jmps
   311                              <2> %define _386_PM_jmpn	_386_jmpn
   312                              <2> %define _386_PM		_386
   313                              <2> %else
   314                              <2> %define _386_PM_o32
   315                              <2> %define _386_PM_a32
   316                              <2> %define _386_PM_jmps	comment
   317                              <2> %define _386_PM_jmpn	comment
   318                              <2> %define _386_PM		comment
   319                              <2> %endif
   320                              <2> 
   321                              <2> 
   322                              <2> %ifn _LINK
   323                              <2> %macro __writepatchtable2 0-*.nolist
   324                              <2> %if %0 & 1
   325                              <2>  %fatal Expected even number of arguments
   326                              <2> %endif
   327                              <2> %rep %0 >> 1
   328                              <2> 	%1 %2
   329                              <2> %rotate 2
   330                              <2> %endrep
   331                              <2> %endmacro
   332                              <2> 
   333                              <2> %macro __patchtable2_entry 0.nolist
   334                              <2>   ; only if this isn't the first (pseudo-)entry
   335                              <2>   %if %$lastcount != 0
   336                              <2>     %assign %$runscount %[%$runscount]+1
   337                              <2>    ; if the offset from %$previous is less than 255
   338                              <2>    %if (%$last-%$previous) < 255
   339                              <2>     %assign %$$method2tablesize %$$method2tablesize+1
   340                              <2>     ; then write a single byte (number of bytes not to patch between)
   341                              <2>     %xdefine %$$method2list %$$method2list,db,%$last-%$previous
   342                              <2>    %else
   343                              <2>     ; otherwise write a 255 ("reposition") and write the 16-bit address afterwards
   344                              <2>     %assign %$$method2tablesize %$$method2tablesize+3
   345                              <2>     %xdefine %$$method2list %$$method2list,db,255,dw,%$last
   346                              <2>     %assign %$reposcount %[%$reposcount]+1
   347                              <2>    %endif
   348                              <2>    %if %$lastcount == 1
   349                              <2>     %assign %$onecount %[%$onecount]+1
   350                              <2>    %endif
   351                              <2>    %assign %$$method2tablesize %$$method2tablesize+1
   352                              <2>    ; and write the number of bytes to be patched
   353                              <2>    %xdefine %$$method2list %$$method2list,db,%$lastcount
   354                              <2>    ; define %$previous for the next entry: it points to the next non-patched byte
   355                              <2>    %define %$previous (%[%$last]+%[%$lastcount])
   356                              <2>   %endif
   357                              <2> %endmacro
   358                              <2> 
   359                              <2> %macro writepatchtable 2-*.nolist
   360                              <2> 
   361                              <2> 	numdef %{1}_FORCE_METHOD, 0
   362                              <2> %push
   363                              <2> 		; Determine length of simple table:
   364                              <2> %assign %$method1tablesize (%0 - 2)*2
   365                              <2> 
   366                              <2> %if !_%{1}_FORCE_METHOD || _%{1}_FORCE_METHOD == 2
   367                              <2> 		; Determine length of complicated table:
   368                              <2> %assign %$method2tablesize 0
   369                              <2> %define %$method2list db,""
   370                              <2> %push
   371                              <2> %if _WPT_LABELS
   372                              <2>  %define %$previous code_start	; if list contains labels
   373                              <2> %else
   374                              <2>  %define %$previous 0
   375                              <2> %endif
   376                              <2> %define %$last %[%$previous]
   377                              <2> %assign %$lastcount 0
   378                              <2> %assign %$onecount 0
   379                              <2> %assign %$reposcount 0
   380                              <2> %assign %$bytescount %0 - 2
   381                              <2> %assign %$runscount 0
   382                              <2> %rotate 1
   383                              <2> %rep %0 - 2
   384                              <2>  %rotate 1
   385                              <2>  ;if  it continues the previous patch   and not too long   and this isn't the first
   386                              <2>  %if ((%$last+%$lastcount) == %1) && (%$lastcount < 255) && (%$lastcount != 0)
   387                              <2>   ; then do not write an entry, just increase the patch's size
   388                              <2>   %assign %$lastcount %[%$lastcount]+1
   389                              <2>  %else
   390                              <2>   ; otherwise write the last entry
   391                              <2>   __patchtable2_entry
   392                              <2>   ; define new %$last to this parameter, %$lastcount to one
   393                              <2>   %define %$last %1
   394                              <2>   %assign %$lastcount 1
   395                              <2>  %endif
   396                              <2> %endrep
   397                              <2> __patchtable2_entry
   398                              <2> 
   399                              <2> ; at the end, there's a patch with offset 0, size 0
   400                              <2> %assign %$$method2tablesize %$$method2tablesize+2
   401                              <2> %xdefine %$$method2list %$$method2list,db,0,db,0
   402                              <2> 
   403                              <2> %assign %$$onecount %$onecount
   404                              <2> %assign %$$reposcount %$reposcount
   405                              <2> %assign %$$bytescount %$bytescount
   406                              <2> %assign %$$runscount %$runscount
   407                              <2> %pop
   408                              <2> %rotate 1
   409                              <2> %endif
   410                              <2> 
   411                              <2> %if _%{1}_FORCE_METHOD == 2
   412                              <2>  %define __%{1}_method 2
   413                              <2> %elif _%{1}_FORCE_METHOD == 1
   414                              <2>  %define __%{1}_method 1
   415                              <2> %else
   416                              <2>  %if _%{1}_FORCE_METHOD
   417                              <2>   %fatal Invalid forced method selected: _%{1}_FORCE_METHOD
   418                              <2>  %endif
   419                              <2>  %if %$method1tablesize > (%$method2tablesize+20)
   420                              <2>   %define __%{1}_method 2
   421                              <2>  %else
   422                              <2>   %define __%{1}_method 1
   423                              <2>  %endif
   424                              <2> %endif
   425                              <2> 
   426                              <2> 
   427                              <2> %1:
   428                              <2> %if __%{1}_method == 2
   429                              <2> 	__writepatchtable2 %$method2list
   430                              <2> 	endarea %1
   431                              <2> %assign %$size %1_size
   432                              <2> %warning %1: %$size bytes (Method 2)
   433                              <2> %warning 1B=%$onecount repo=%$reposcount run=%$runscount byte=%$bytescount
   434                              <2> %else
   435                              <2> %rotate 1
   436                              <2> %rep %0 - 2
   437                              <2> %rotate 1
   438                              <2> 	dw %1
   439                              <2> %endrep
   440                              <2> %rotate 1
   441                              <2> 	endarea %1
   442                              <2> %assign %$size %1_size
   443                              <2> %warning %1: %$size bytes (Method 1)
   444                              <2> %1.amount equ %1_size_w
   445                              <2> %endif
   446                              <2> %pop
   447                              <2> %endmacro
   448                              <2> %endif
   879                              <1> 
   880                              <1> 
   881                              <1> %if _VDD
   882                              <1> ; standard BOPs for communication with DEBXXVDD on NT platforms
   883                              <1> %macro RegisterModule 0.nolist
   884                              <1> 	db 0C4h, 0C4h, 58h, 0
   885                              <1> 	nop
   886                              <1> %endmacro
   887                              <1> %macro UnRegisterModule 0.nolist
   888                              <1> 	db 0C4h, 0C4h, 58h, 1
   889                              <1> 	nop
   890                              <1> %endmacro
   891                              <1> %macro DispatchCall 0.nolist
   892                              <1> 	db 0C4h, 0C4h, 58h, 2
   893                              <1> 	nop
   894                              <1> %endmacro
   895                              <1> %endif
   896                              <1> 
   897                              <1> %assign CODE_INSURE_COUNT 0
   898                              <1> 
   899                              <1> 		; The entry_to_code_seg/_sel dispatcher in lDEBUG_DATA_ENTRY
   900                              <1> 		;  detects mistaken debugger breakpoints in its
   901                              <1> 		;  in-code-parameter by checking for a low-byte
   902                              <1> 		;  value equal to 0CCh (one-byte int3 opcode).
   903                              <1> 		; Therefore, we insure that all destinations jumped to
   904                              <1> 		;  via that dispatcher do not happen to be located
   905                              <1> 		;  on an offset that gives 0CCh in the low byte.
   906                              <1> 	%imacro code_insure_low_byte_not_0CCh 0.nolist
   907                              <1> %ifn _LINK
   908                              <1>  %if (($ - _CURRENT_SECTION %+ _start) & 0FFh) == 0CCh
   909                              <1> 	nop
   910                              <1>   %assign CODE_INSURE_COUNT 1 + CODE_INSURE_COUNT
   911                              <1>  %endif
   912                              <1> %endif
   913                              <1> 	%endmacro
   914                              <1> 
   915                              <1> 
   916                              <1> 		; dual code segments
   917                              <1> %if _DUALCODE && _PM
   918                              <1> 
   919                              <1> %if _DEBUG
   920                              <1> %idefine dualfunction comment
   921                              <1> %else
   922                              <1> %idefine dualfunction code_insure_low_byte_not_0CCh
   923                              <1> %endif
   924                              <1> 
   925                              <1> %idefine dualreturn call _CURRENT_SECTION %+ _dualret_helper
   926                              <1> %idefine dualdistance far
   927                              <1> 	%imacro dualcall 1.nolist
   928                              <1> %ifndef SECTION_OF_%1
   929                              <1>  %error Unknown target section for symbol %1
   930                              <1> %endif
   931                              <1> 	call _CURRENT_SECTION %+ _to_ %+ %[SECTION_OF_%1] %+ _dualcall_helper
   932                              <1>  %if _DEBUG
   933                              <1> 	jmp strict short %%skipdata
   934                              <1>  %endif
   935                              <1> 	dw %1
   936                              <1> %%skipdata:
   937                              <1> 	%endmacro
   938                              <1> 	%imacro nearcall 1.nolist
   939                              <1> %ifndef SECTION_OF_%1
   940                              <1>  %error Unknown target section for symbol %1
   941                              <1> %endif
   942                              <1> %ifidni %[SECTION_OF_%1], _CURRENT_SECTION
   943                              <1> 	call %1
   944                              <1> %else
   945                              <1> 	call _CURRENT_SECTION %+ _to_ %+ %[SECTION_OF_%1] %+ _nearcall_helper
   946                              <1>  %if _DEBUG
   947                              <1> 	jmp strict short %%skipdata
   948                              <1>  %endif
   949                              <1> 	dw %1
   950                              <1> %%skipdata:
   951                              <1> %endif
   952                              <1> 	%endmacro
   953                              <1> 
   954                              <1> %elif _DUALCODE && ! _PM
   955                              <1> 
   956                              <1> %idefine dualfunction comment
   957                              <1> %idefine dualreturn
   958                              <1> %idefine dualdistance far
   959                              <1> 
   960                              <1> %ifn _LINK
   961                              <1> %define PATCH_RELOCATE_FROM_lDEBUG_CODE ""
   962                              <1> %define PATCH_RELOCATE_FROM_lDEBUG_CODE2 ""
   963                              <1> 	%imacro dualcall 1.nolist
   964                              <1> %ifndef SECTION_OF_%1
   965                              <1>  %error Unknown target section for symbol %1
   966                              <1> %endif
   967                              <1> %ifidni %[SECTION_OF_%1], _CURRENT_SECTION
   968                              <1> 	push cs
   969                              <1> 	call %1
   970                              <1> %else
   971                              <1> 	call relocatedzero:%1
   972                              <1> %push
   973                              <1> %assign %$entry ($ + _CURRENT_SECTION %+ FIXUP) - 2
   974                              <1> 	relocatelist _CURRENT_SECTION, %$entry
   975                              <1> %pop
   976                              <1> %endif
   977                              <1> 	%endmacro
   978                              <1> 	%imacro relocatelist 2.nolist
   979                              <1>  %define PATCH_RELOCATE_FROM_%1 %[PATCH_RELOCATE_FROM_%1],%2
   980                              <1> 	%endmacro
   981                              <1> %else		; _LINK
   982                              <1> 	%idefine dualcall dualcall_with_filename __FILE__,
   983                              <1> 	%imacro dualcall_with_filename 2.nolist
   984                              <1> %ifndef SECTION_OF_%2
   985                              <1>  %error Unknown target section for symbol %2
   986                              <1> %endif
   987                              <1> %ifidni %[SECTION_OF_%2], _CURRENT_SECTION
   988                              <1> 	push cs
   989                              <1> 	call %2
   990                              <1> %else
   991                              <1> 	call relocatedzero:%2
   992                              <1> %ifidn _CURRENT_SECTION, lDEBUG_CODE
   993                              <1>  wllist Lrelocate_from_code, equ $ - 2, %1
   994                              <1> %elifidn _CURRENT_SECTION, lDEBUG_CODE2
   995                              <1>  wllist Lrelocate_from_code2, equ $ - 2, %1
   996                              <1> %else
   997                              <1>  %error Wrong section
   998                              <1> %endif
   999                              <1> %endif
  1000                              <1> 	%endmacro
  1001                              <1> %endif		; _LINK
  1002                              <1>  %if _DUALCODENEARDUAL
  1003                              <1> 
  1004                              <1> %if _LINK
  1005                              <1> 	%idefine nearcall nearcall_with_filename __FILE__,
  1006                              <1> 	%imacro nearcall_with_filename 2
  1007                              <1> %ifndef SECTION_OF_%2
  1008                              <1>  %error Unknown target section for symbol %2
  1009                              <1> %endif
  1010                              <1> %ifidni %[SECTION_OF_%2], _CURRENT_SECTION
  1011                              <1> 	call %2
  1012                              <1> %else
  1013                              <1>  %push
  1014                              <1>  %xdefine %$originalsection _CURRENT_SECTION
  1015                              <1>  %xdefine %$targetsection SECTION_OF_%2
  1016                              <1>  %deftok %%filenametoken SOURCEFILENAME
  1017                              <1>   %ifndef NEARCALL_THUNK_TO_%2%[%%filenametoken]
  1018                              <1> 	hiddenusesection %$targetsection
  1019                              <1> %define NEARCALL_THUNK_TO_%2%[%%filenametoken] %%nearcall_thunk_to_%2%[%%filenametoken]
  1020                              <1> section_of %%nearcall_thunk_to_%2%[%%filenametoken]
  1021                              <1> dualfunction
  1022                              <1> %%nearcall_thunk_to_%2%[%%filenametoken]:
  1023                              <1> 	call %2
  1024                              <1> 	dualreturn
  1025                              <1> 	retf
  1026                              <1> 
  1027                              <1> 	hiddenusesection %$originalsection
  1028                              <1>   %endif
  1029                              <1>  %pop
  1030                              <1> 	dualcall_with_filename %1, NEARCALL_THUNK_TO_%2%[%%filenametoken]
  1031                              <1> %endif
  1032                              <1> 	%endmacro
  1033                              <1> %elif _LINK_COMPAT	; _LINK
  1034                              <1> 	%imacro nearcall 1
  1035                              <1> %ifndef SECTION_OF_%1
  1036                              <1>  %error Unknown target section for symbol %1
  1037                              <1> %endif
  1038                              <1> %ifidni %[SECTION_OF_%1], _CURRENT_SECTION
  1039                              <1> 	call %1
  1040                              <1> %else
  1041                              <1>  %push
  1042                              <1>  %xdefine %$originalsection _CURRENT_SECTION
  1043                              <1>  %xdefine %$targetsection SECTION_OF_%1
  1044                              <1>  %deftok %%filenametoken SOURCEFILENAME
  1045                              <1>   %ifndef NEARCALL_THUNK_TO_%1%[%%filenametoken]
  1046                              <1> 	hiddenusesection %$targetsection
  1047                              <1> %define NEARCALL_THUNK_TO_%1%[%%filenametoken] %%nearcall_thunk_to_%1%[%%filenametoken]
  1048                              <1> section_of %%nearcall_thunk_to_%1%[%%filenametoken]
  1049                              <1> dualfunction
  1050                              <1> %%nearcall_thunk_to_%1%[%%filenametoken]:
  1051                              <1> 	call %1
  1052                              <1> 	dualreturn
  1053                              <1> 	retf
  1054                              <1> 
  1055                              <1> 	hiddenusesection %$originalsection
  1056                              <1>   %endif
  1057                              <1>  %pop
  1058                              <1> 	dualcall NEARCALL_THUNK_TO_%1%[%%filenametoken]
  1059                              <1> %endif
  1060                              <1> 	%endmacro
  1061                              <1> %else		; _LINK, _LINK_COMPAT
  1062                              <1> 	%imacro nearcall 1
  1063                              <1> %ifndef SECTION_OF_%1
  1064                              <1>  %error Unknown target section for symbol %1
  1065                              <1> %endif
  1066                              <1> %ifidni %[SECTION_OF_%1], _CURRENT_SECTION
  1067                              <1> 	call %1
  1068                              <1> %else
  1069                              <1>  %push
  1070                              <1>  %xdefine %$originalsection _CURRENT_SECTION
  1071                              <1>  %xdefine %$targetsection SECTION_OF_%1
  1072                              <1>   %ifndef NEARCALL_THUNK_TO_%1
  1073                              <1> 	hiddenusesection %$targetsection
  1074                              <1> %define NEARCALL_THUNK_TO_%1 %%nearcall_thunk_to_%1
  1075                              <1> section_of %%nearcall_thunk_to_%1
  1076                              <1> dualfunction
  1077                              <1> %%nearcall_thunk_to_%1:
  1078                              <1> 	call %1
  1079                              <1> 	dualreturn
  1080                              <1> 	retf
  1081                              <1> 
  1082                              <1> 	hiddenusesection %$originalsection
  1083                              <1>   %endif
  1084                              <1>  %pop
  1085                              <1> 	dualcall NEARCALL_THUNK_TO_%1
  1086                              <1> %endif
  1087                              <1> 	%endmacro
  1088                              <1> %endif		; _LINK, _LINK_COMPAT
  1089                              <1>  %else
  1090                              <1> 	%imacro nearcall 1.nolist
  1091                              <1> %ifndef SECTION_OF_%1
  1092                              <1>  %error Unknown target section for symbol %1
  1093                              <1> %endif
  1094                              <1> %ifidni %[SECTION_OF_%1], _CURRENT_SECTION
  1095                              <1> 	call %1
  1096                              <1> %else
  1097                              <1> 	call _CURRENT_SECTION %+ _to_ %+ %[SECTION_OF_%1] %+ _nearcall_helper
  1098                              <1>  %if _DEBUG
  1099                              <1> 	jmp strict short %%skipdata
  1100                              <1>  %endif
  1101                              <1> 	dw %1
  1102                              <1> %%skipdata:
  1103                              <1> %endif
  1104                              <1> 	%endmacro
  1105                              <1>  %endif
  1106                              <1> %elif ! _DUALCODE
  1107                              <1> 
  1108                              <1> %idefine dualfunction comment
  1109                              <1> %idefine dualreturn
  1110                              <1> %idefine dualdistance near
  1111                              <1> 	%imacro dualcall 1.nolist
  1112                              <1> 	call %1
  1113                              <1> 	%endmacro
  1114                              <1> 	%imacro nearcall 1.nolist
  1115                              <1> 	call %1
  1116                              <1> 	%endmacro
  1117                              <1> %assign _SYMBOLICDUALCODE 0
  1118                              <1> %assign _SYMBOLASMDUALCODE 0
  1119                              <1> 
  1120                              <1> %else
  1121                              <1>  %error Unexpected defines
  1122                              <1> %endif
  1123                              <1> 
  1124                              <1> %ifn _SYMBOLICDUALCODE
  1125                              <1>  %assign _SYMBOLASMDUALCODE 0
  1126                              <1> %endif
  1127                              <1> 
  1128                              <1>  %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
  1129                              <1> %idefine dual2function	dualfunction
  1130                              <1> %idefine dual2return	dualreturn
  1131                              <1> %idefine dual2distance	dualdistance
  1132                              <1> %idefine dual2call	dualcall
  1133                              <1>  %else
  1134                              <1> %idefine dual2function comment
  1135                              <1> %idefine dual2return
  1136                              <1> %idefine dual2distance near
  1137                              <1> 	%imacro dual2call 1.nolist
  1138                              <1> 	call %1
  1139                              <1> 	%endmacro
  1140                              <1>  %endif
  1141                              <1> 
  1142                              <1> 
  1143                              <1> 	numdef CHECKSECTION, 0
  1144                              <1> 	numdef CHECKCALLSECTION, _CHECKSECTION
  1145                              <1> 	numdef CHECKJMPSECTION, _CHECKSECTION
  1146                              <1> 	numdef CHECKJCCSECTION, _CHECKSECTION
  1147                              <1> 
  1148                              <1> %if _CHECKCALLSECTION
  1149                              <1> 	%imacro call 1.nolist
  1150                              <1> 	%? %1
  1151                              <1> checksection %1, %?, call
  1152                              <1> 	%endmacro
  1153                              <1> %endif
  1154                              <1> %if _CHECKJMPSECTION
  1155                              <1> 	%imacro jmp 1.nolist
  1156                              <1> 	%? %1
  1157                              <1> checksection %1, %?, jmp
  1158                              <1> 	%endmacro
  1159                              <1> %endif
  1160                              <1> %if _CHECKJCCSECTION
  1161                              <1> 	%imacro je 1.nolist
  1162                              <1> 	%? %1
  1163                              <1> checksection %1, %?, jcc
  1164                              <1> 	%endmacro
  1165                              <1> 	%imacro jne 1.nolist
  1166                              <1> 	%? %1
  1167                              <1> checksection %1, %?, jcc
  1168                              <1> 	%endmacro
  1169                              <1> 	%imacro jz 1.nolist
  1170                              <1> 	%? %1
  1171                              <1> checksection %1, %?, jcc
  1172                              <1> 	%endmacro
  1173                              <1> 	%imacro jnz 1.nolist
  1174                              <1> 	%? %1
  1175                              <1> checksection %1, %?, jcc
  1176                              <1> 	%endmacro
  1177                              <1> 
  1178                              <1> 	%imacro jb 1.nolist
  1179                              <1> 	%? %1
  1180                              <1> checksection %1, %?, jcc
  1181                              <1> 	%endmacro
  1182                              <1> 	%imacro jnb 1.nolist
  1183                              <1> 	%? %1
  1184                              <1> checksection %1, %?, jcc
  1185                              <1> 	%endmacro
  1186                              <1> 	%imacro jbe 1.nolist
  1187                              <1> 	%? %1
  1188                              <1> checksection %1, %?, jcc
  1189                              <1> 	%endmacro
  1190                              <1> 	%imacro jnbe 1.nolist
  1191                              <1> 	%? %1
  1192                              <1> checksection %1, %?, jcc
  1193                              <1> 	%endmacro
  1194                              <1> 	%imacro jc 1.nolist
  1195                              <1> 	%? %1
  1196                              <1> checksection %1, %?, jcc
  1197                              <1> 	%endmacro
  1198                              <1> 	%imacro jnc 1.nolist
  1199                              <1> 	%? %1
  1200                              <1> checksection %1, %?, jcc
  1201                              <1> 	%endmacro
  1202                              <1> 	%imacro ja 1.nolist
  1203                              <1> 	%? %1
  1204                              <1> checksection %1, %?, jcc
  1205                              <1> 	%endmacro
  1206                              <1> 	%imacro jna 1.nolist
  1207                              <1> 	%? %1
  1208                              <1> checksection %1, %?, jcc
  1209                              <1> 	%endmacro
  1210                              <1> 	%imacro jae 1.nolist
  1211                              <1> 	%? %1
  1212                              <1> checksection %1, %?, jcc
  1213                              <1> 	%endmacro
  1214                              <1> 	%imacro jnae 1.nolist
  1215                              <1> 	%? %1
  1216                              <1> checksection %1, %?, jcc
  1217                              <1> 	%endmacro
  1218                              <1> 
  1219                              <1> 	%imacro jl 1.nolist
  1220                              <1> 	%? %1
  1221                              <1> checksection %1, %?, jcc
  1222                              <1> 	%endmacro
  1223                              <1> 	%imacro jnl 1.nolist
  1224                              <1> 	%? %1
  1225                              <1> checksection %1, %?, jcc
  1226                              <1> 	%endmacro
  1227                              <1> 	%imacro jle 1.nolist
  1228                              <1> 	%? %1
  1229                              <1> checksection %1, %?, jcc
  1230                              <1> 	%endmacro
  1231                              <1> 	%imacro jnle 1.nolist
  1232                              <1> 	%? %1
  1233                              <1> checksection %1, %?, jcc
  1234                              <1> 	%endmacro
  1235                              <1> 	%imacro jg 1.nolist
  1236                              <1> 	%? %1
  1237                              <1> checksection %1, %?, jcc
  1238                              <1> 	%endmacro
  1239                              <1> 	%imacro jng 1.nolist
  1240                              <1> 	%? %1
  1241                              <1> checksection %1, %?, jcc
  1242                              <1> 	%endmacro
  1243                              <1> 	%imacro jge 1.nolist
  1244                              <1> 	%? %1
  1245                              <1> checksection %1, %?, jcc
  1246                              <1> 	%endmacro
  1247                              <1> 	%imacro jnge 1.nolist
  1248                              <1> 	%? %1
  1249                              <1> checksection %1, %?, jcc
  1250                              <1> 	%endmacro
  1251                              <1> 
  1252                              <1> 	%imacro jo 1.nolist
  1253                              <1> 	%? %1
  1254                              <1> checksection %1, %?, jcc
  1255                              <1> 	%endmacro
  1256                              <1> 	%imacro jno 1.nolist
  1257                              <1> 	%? %1
  1258                              <1> checksection %1, %?, jcc
  1259                              <1> 	%endmacro
  1260                              <1> 	%imacro jp 1.nolist
  1261                              <1> 	%? %1
  1262                              <1> checksection %1, %?, jcc
  1263                              <1> 	%endmacro
  1264                              <1> 	%imacro jnp 1.nolist
  1265                              <1> 	%? %1
  1266                              <1> checksection %1, %?, jcc
  1267                              <1> 	%endmacro
  1268                              <1> 	%imacro jpe 1.nolist
  1269                              <1> 	%? %1
  1270                              <1> checksection %1, %?, jcc
  1271                              <1> 	%endmacro
  1272                              <1> 	%imacro jnpe 1.nolist
  1273                              <1> 	%? %1
  1274                              <1> checksection %1, %?, jcc
  1275                              <1> 	%endmacro
  1276                              <1> 	%imacro jpo 1.nolist
  1277                              <1> 	%? %1
  1278                              <1> checksection %1, %?, jcc
  1279                              <1> 	%endmacro
  1280                              <1> 	%imacro jnpo 1.nolist
  1281                              <1> 	%? %1
  1282                              <1> checksection %1, %?, jcc
  1283                              <1> 	%endmacro
  1284                              <1> 	%imacro js 1.nolist
  1285                              <1> 	%? %1
  1286                              <1> checksection %1, %?, jcc
  1287                              <1> 	%endmacro
  1288                              <1> 	%imacro jns 1.nolist
  1289                              <1> 	%? %1
  1290                              <1> checksection %1, %?, jcc
  1291                              <1> 	%endmacro
  1292                              <1> 
  1293                              <1> 	%imacro jcxz 1.nolist
  1294                              <1> 	%? %1
  1295                              <1> checksection %1, %?, jcc
  1296                              <1> 	%endmacro
  1297                              <1> 	%imacro jecxz 1.nolist
  1298                              <1> 	%? %1
  1299                              <1> checksection %1, %?, jcc
  1300                              <1> 	%endmacro
  1301                              <1> 	%imacro loop 1.nolist
  1302                              <1> 	%? %1
  1303                              <1> checksection %1, %?, jcc
  1304                              <1> 	%endmacro
  1305                              <1> 	%imacro loopz 1.nolist
  1306                              <1> 	%? %1
  1307                              <1> checksection %1, %?, jcc
  1308                              <1> 	%endmacro
  1309                              <1> 	%imacro loopnz 1.nolist
  1310                              <1> 	%? %1
  1311                              <1> checksection %1, %?, jcc
  1312                              <1> 	%endmacro
  1313                              <1> 	%imacro loope 1.nolist
  1314                              <1> 	%? %1
  1315                              <1> checksection %1, %?, jcc
  1316                              <1> 	%endmacro
  1317                              <1> 	%imacro loopne 1.nolist
  1318                              <1> 	%? %1
  1319                              <1> checksection %1, %?, jcc
  1320                              <1> 	%endmacro
  1321                              <1> %endif
  1322                              <1> 
  1323                              <1> 	%imacro checksection 3.nolist
  1324                              <1> %push
  1325                              <1>  %defstr %$string %1
  1326                              <1>  %substr %$shortword %$string 1, 5
  1327                              <1>  %substr %$shortsep %$string 6, 1
  1328                              <1>  %substr %$nearword %$string 1, 4
  1329                              <1>  %substr %$nearsep %$string 5, 1
  1330                              <1>  %substr %$farword %$string 1, 3
  1331                              <1>  %substr %$farsep %$string 4, 1
  1332                              <1>  %assign %$isshort 0
  1333                              <1>  %ifidni %$shortword, "short"
  1334                              <1>   %if %$shortsep == 32 || %$shortsep == 9
  1335                              <1>    %assign %$isshort 1
  1336                              <1>    %substr %$string %$string 7, -1
  1337                              <1>   %elif %$shortsep == '['
  1338                              <1>    %assign %$isshort 1
  1339                              <1>    %substr %$string %$string 6, -1
  1340                              <1>   %endif
  1341                              <1>  %endif
  1342                              <1>  %assign %$isnear 0
  1343                              <1>  %ifidni %$nearword, "near"
  1344                              <1>   %if %$nearsep == 32 || %$nearsep == 9
  1345                              <1>    %assign %$isnear 1
  1346                              <1>    %substr %$string %$string 6, -1
  1347                              <1>   %elif %$nearsep == '['
  1348                              <1>    %assign %$isnear 1
  1349                              <1>    %substr %$string %$string 5, -1
  1350                              <1>   %endif
  1351                              <1>  %endif
  1352                              <1>  %assign %$isfar 0
  1353                              <1>  %ifidni %$farword, "far"
  1354                              <1>   %if %$farsep == 32 || %$farsep == 9
  1355                              <1>    %assign %$isfar 1
  1356                              <1>    %substr %$string %$string 5, -1
  1357                              <1>   %elif %$farsep == '['
  1358                              <1>    %assign %$isfar 1
  1359                              <1>    %substr %$string %$string 4, -1
  1360                              <1>   %endif
  1361                              <1>  %endif
  1362                              <1> 
  1363                              <1>  %deftok %$token %$string
  1364                              <1> 
  1365                              <1>  %assign %$size 2
  1366                              <1>  %assign %$isreg 0
  1367                              <1>  %assign %$exit 0
  1368                              <1>  %rep 2
  1369                              <1>   %ifn %$exit
  1370                              <1>    %if %$size == 2
  1371                              <1>     %define %$regnames "ax  cx  dx  bx  sp  bp  si  di  "
  1372                              <1>    %elif %$size == 4
  1373                              <1>     %define %$regnames "eax ecx edx ebx esp ebp esi edi "
  1374                              <1>    %endif
  1375                              <1>    %assign %$index 0
  1376                              <1>    %rep 8
  1377                              <1>     %ifn %$exit
  1378                              <1>      %substr %$reg %$regnames %$index * 4 + 1, 4
  1379                              <1>      %deftok %$reg %$reg
  1380                              <1>      %ifnempty %$reg
  1381                              <1>       %ifidni %$reg, %$token
  1382                              <1>        %assign %$isreg %$size
  1383                              <1>        %assign %$exit 1
  1384                              <1>        %exitrep
  1385                              <1>       %endif
  1386                              <1>      %endif
  1387                              <1>     %endif
  1388                              <1>     %assign %$index %$index + 1
  1389                              <1>    %endrep
  1390                              <1>    %if %$exit
  1391                              <1>     %exitrep
  1392                              <1>    %endif
  1393                              <1>    %assign %$size %$size * 2
  1394                              <1>   %endif
  1395                              <1>  %endrep
  1396                              <1> 
  1397                              <1>  %assign %$ismulti 0
  1398                              <1>  %assign %$ismem 0
  1399                              <1>  %strlen %$length %$string
  1400                              <1>  %assign %$ii 0
  1401                              <1>  %rep %$length
  1402                              <1>   %substr %$point %$string %$ii + 1, 1
  1403                              <1>   %if %$point == 32 || %$point == 9
  1404                              <1>    %assign %$ismulti 1
  1405                              <1>   %endif
  1406                              <1>   %ifidn %$point, '['
  1407                              <1>    %assign %$ismem 1
  1408                              <1>   %endif
  1409                              <1>   %assign %$ii %$ii + 1
  1410                              <1>  %endrep
  1411                              <1> 
  1412                              <1>  %assign %$islocal 0
  1413                              <1>  %substr %$point %$string 1, 1
  1414                              <1>  %substr %$prefix %$string 1, 3
  1415                              <1>  %ifidn %$point, '.'
  1416                              <1>   %ifnidn %$prefix, '..@'
  1417                              <1>    %assign %$islocal 1
  1418                              <1>   %endif
  1419                              <1>  %endif
  1420                              <1> 
  1421                              <1>  %if %$isreg
  1422                              <1>   %if %$isreg == 4
  1423                              <1>    %warning 32-bit reg %3: %2 %1
  1424                              <1>   %else
  1425                              <1>    %warning 16-bit reg %3: %2 %1
  1426                              <1>   %endif
  1427                              <1>  %elif %$ismulti || %$ismem
  1428                              <1>   %warning not single %3: %2 %1
  1429                              <1>  %elif %$islocal
  1430                              <1>   %ifidni %3, call
  1431                              <1>    %warning local %3: %2 %1
  1432                              <1>   %endif
  1433                              <1>  %elifdef SECTION_OF_%[%$token]
  1434                              <1>   %ifnidni SECTION_OF_%[%$token], _CURRENT_SECTION
  1435                              <1>    %error Symbol %$token called wrongly: section_of=SECTION_OF_%[%$token], current=_CURRENT_SECTION
  1436                              <1>   %endif
  1437                              <1>  %endif
  1438                              <1> %pop
  1439                              <1> 	%endmacro
  1440                              <1> 
  1441                              <1> 
  1442                              <1> 	struc MEMREF
  1443 00000000 ????????            <1> mrLinear:		resd 1
  1444 00000004 ????????            <1> mrOffset:		resd 1
  1445 00000008 ????                <1> mrSegmentSelector:	resw 1
  1446 0000000A ????                <1> mrFlags:		resw 1
  1447 0000000C ????????            <1> mrLength:		resd 1
  1448                              <1> 	endstruc
  1449                              <1> 
  1450                              <1> 		; Currently only direct branches are allowed when
  1451                              <1> 		;  disassembling from the U command. (That is,
  1452                              <1> 		;  [disflags] & DIS_F_SHOW is clear.) All other
  1453                              <1> 		;  types of references depend on segment registers
  1454                              <1> 		;  and sometimes base and index registers, which are
  1455                              <1> 		;  not known ahead of time. They are only known for
  1456                              <1> 		;  the R command's disassembly. (DIS_F_SHOW set.)
  1457                              <1> 		; (When a mov ss or pop to ss will change ss, a
  1458                              <1> 		;  subsequent instruction using ss will not be
  1459                              <1> 		;  disassembled with the correct ss value.
  1460                              <1> 		;  This should be rare though. We may at a later
  1461                              <1> 		;  point detect this condition and not display
  1462                              <1> 		;  references with ss then.)
  1463                              <1> mrfBranchDirect:	equ    1
  1464                              <1> mrfMem:			equ    2
  1465                              <1> mrfMemSource:		equ    4
  1466                              <1> mrfMemDest:		equ    8
  1467                              <1> mrfA32:			equ   10h
  1468                              <1> mrfString:		equ   20h
  1469                              <1> mrfStringSource:	equ   40h
  1470                              <1> mrfStringDest:		equ   80h
  1471                              <1> mrfUsesSS:		equ  100h
  1472                              <1> mrfBranchIndirect:	equ  200h
  1473                              <1> 
  1474                              <1> 
  1475                              <1> %if _VXCHG && ! _VXCHGBIOS
  1476                              <1> 	struc XMSM
  1477 00000000 ????????            <1> .size_:		resd 1
  1478 00000004 ????                <1> .srchdl:	resw 1
  1479 00000006 ????????            <1> .srcadr:	resd 1
  1480 0000000A ????                <1> .dsthdl:	resw 1
  1481 0000000C ????????            <1> .dstadr:	resd 1
  1482                              <1> 	endstruc
  1483                              <1> %endif
  1484                              <1> 
  1485                              <1> 
  1486                              <1> 	; doscall is used by symbols.asm and run.asm and in
  1487                              <1> 	;  cmd3_close_handle, so define it prior
  1488                              <1> %if _PM && _NOEXTENDER
  1489                              <1> %macro doscall 0
  1490                              <1> 	nearcall _doscall
  1491                              <1> %endmacro
  1492                              <1> %else
  1493                              <1> 		; When we don't support non-extended DPMI all Int21 calls
  1494                              <1> 		; are either in Real Mode or extended (all are real Int21
  1495                              <1> 		; instructions).
  1496                              <1> %macro doscall 0
  1497                              <1> 	int 21h
  1498                              <1> %endmacro
  1499                              <1> %endif
  1500                              <1> 
  1501                              <1> 
  1502                              <1> %if _LINK
  1503                              <1> %imacro wlcalc 1-2.nolist
  1504                              <1> %deftok %%filenametoken __FILE__
  1505                              <1>  global wlcalc_%1?%[%%l]%[%%filenametoken]
  1506                              <1> wlcalc_%1?%[%%l]%[%%filenametoken]: %2
  1507                              <1> %endmacro
  1508                              <1> %endif
  1509                              <1> 
  1510                              <1> %if _BOOTLDR && _LINK
  1511                              <1> %macro lot_equate 2.nolist
  1512                              <1> LOAD_%2 equ %1
  1513                              <1> %endmacro
  1514                              <1> 
  1515                              <1> 	lot_equate    1, SET_DL_UNIT
  1516                              <1> 	lot_equate    2, SET_BL_UNIT
  1517                              <1> 	lot_equate    4, SET_SIDI_CLUSTER
  1518                              <1> 	lot_equate  10h, SET_DSSI_DPT
  1519                              <1> 	lot_equate  20h, PUSH_DPT
  1520                              <1> 	lot_equate  40h, DATASTART_HIDDEN
  1521                              <1> 	lot_equate  80h, SET_AXBX_DATASTART
  1522                              <1> 	lot_equate 100h, SET_DSBP_BPB
  1523                              <1> 	lot_equate 200h, LBA_SET_TYPE
  1524                              <1> 	lot_equate 400h, MESSAGE_TABLE
  1525                              <1> 	lot_equate 800h, SET_AXBX_ROOT_HIDDEN
  1526                              <1> 	lot_equate 1000h, CMDLINE
  1527                              <1> 	lot_equate 2000h, NO_BPB
  1528                              <1> 	lot_equate 4000h, SET_DSSI_PARTINFO
  1529                              <1> %endif
  1530                              <1> 
  1531                              <1> %if _HELP_COMPRESSED
  1532                              <1>  %assign NONCOMPRESSEDFLAG 1
  1533                              <1> %else
  1534                              <1>  %assign NONCOMPRESSEDFLAG 0
  1535                              <1> %endif
  1536                              <1> 
  1537                              <1> [list +]
  1538                              <1> 
  1539                              <1> %if _LINK
  1540                              <1>  %if _ONLY386
  1541                              <1> 	cpu 386
  1542                              <1>  %else
  1543                              <1> 	cpu 8086
  1544                              <1>  %endif
  1545                              <1> 
  1546                              <1> auxbuff_size: equ (_AUXBUFFSIZE+15) & ~15
  1547                              <1> 	endarea auxbuff, 1
  1548                              <1> 
  1549                              <1> auxbuff_max_size: equ (_AUXBUFFMAXSIZE+15) & ~15
  1550                              <1> 	endarea auxbuff_max, 1
  1551                              <1> 
  1552                              <1> %if _INIT_MAX
  1553                              <1>  auxbuff_init_size: equ (_AUXBUFFMAXSIZE+15) & ~15
  1554                              <1> %else
  1555                              <1>  auxbuff_init_size: equ (_AUXBUFFSIZE+15) & ~15
  1556                              <1> %endif
  1557                              <1> 	endarea auxbuff_init, 1
  1558                              <1> 
  1559                              <1>  %include "options.mac"
     1                              <2> 
     2                              <2> %if 0
     3                              <2> 
     4                              <2> lDebug options and internal flags
     5                              <2> 
     6                              <2> Copyright (C) 2008-2025 E. C. Masloch
     7                              <2> 
     8                              <2> Usage of the works is permitted provided that this
     9                              <2> instrument is retained with the works, so that any entity
    10                              <2> that uses the works is notified of this instrument.
    11                              <2> 
    12                              <2> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                              <2> 
    14                              <2> %endif
    15                              <2> 
    16                              <2> 
    17                              <2> dispregs32	equ	  1	; RX: 32-bit register display (R, T/P/G)
    18                              <2> traceints	equ	  2	; TM: trace into interrupts (T)
    19                              <2> cpdepchars	equ	  4	; allow dumping of CP-dependent characters (D, DX)
    20                              <2> fakeindos	equ	  8	; always assume InDOS flag non-zero (all)
    21                              <2> nonpagingdevice	equ	 10h	; disallow paged output with [more] prompt (all exc. P, T)
    22                              <2> 	; This option was never used anywhere:
    23                              <2> ; pagingdevice	equ	 20h	; allow paged output with [more] prompt (all exc. P, T)
    24                              <2> 				; paged output is by default on if the output device is StdOut, else off
    25                              <2> hexrn		equ	 40h	; display raw hexadecimal content of FPU registers (RN)
    26                              <2> ;novdd		equ	 80h	; don't use a registered NTVDM VDD (L, W)
    27                              <2> nondospaging	equ	100h	; paging: don't use DOS for input when waiting for a key
    28                              <2> opt1_86mnohlt	equ	200h	; (86 Mode:) HLT doesn't work, don't use it
    29                              <2> biosidles	equ	400h	; don't idle with HLT or Int2F.1680, only call BIOS Int16.00
    30                              <2> opt_usegetinput	equ	800h	; use getinput for int 21h interactive input
    31                              <2> use_si_units	equ    1000h	; in disp_*_size use SI units (kB = 1000, etc)
    32                              <2> use_jedec_units	equ    2000h	; in disp_*_size use JEDEC units (kB = 1024)
    33                              <2> enable_serial	equ    4000h	; enable serial I/O (preferred over DOS or BIOS terminal)
    34                              <2> int8_disable_serial equ	   8000h	; disable serial I/O when breaking due to intr8
    35                              <2> gg_do_not_skip_bp equ	 1_0000h	; gg: do not skip a breakpoint (bb or gg)
    36                              <2> gg_no_autorepeat equ	 2_0000h	; gg: do not auto-repeat
    37                              <2> tp_do_not_skip_bp equ	 4_0000h	; T/TP/P: do not skip a (bb) breakpoint
    38                              <2> gg_bb_hit_no_repeat equ	 8_0000h	; gg: do not auto-repeat after bb hit
    39                              <2> tp_bb_hit_no_repeat equ	10_0000h	; T/TP/P: do not auto-repeat after bb hit
    40                              <2> gg_unexpected_no_repeat equ 20_0000h	; gg: do not auto-repeat after unexpectedinterrupt
    41                              <2> tp_unexpected_no_repeat equ 40_0000h	; T/TP/P
    42                              <2> ss_no_dump:		equ 80_0000h
    43                              <2> %if _SYMBOLIC
    44                              <2> dd_no_blanks_sym:	equ 100_0000h
    45                              <2> zz_no_pm_xms:		equ 200_0000h
    46                              <2> %endif
    47                              <2> rr_disasm_no_rept:	equ 1000_0000h
    48                              <2> rr_disasm_no_show:	equ 2000_0000h
    49                              <2> opt_cmdline_quiet_input:equ 4000_0000h
    50                              <2> opt_cmdline_quiet_output:equ 8000_0000h
    51                              <2> %if _SYMBOLIC
    52                              <2> DEFAULTOPTIONS	equ zz_no_pm_xms
    53                              <2> %else
    54                              <2> DEFAULTOPTIONS	equ 0
    55                              <2> %endif
    56                              <2> 
    57                              <2> 
    58                              <2> opt2_db_header:		equ 1
    59                              <2> opt2_db_trailer:	equ 2
    60                              <2> opt2_dw_header:		equ 10h
    61                              <2> opt2_dw_trailer:	equ 20h
    62                              <2> opt2_dd_header:		equ 100h
    63                              <2> opt2_dd_trailer:	equ 200h
    64                              <2> opt2_getinput_dpmi:	equ 800h
    65                              <2> opt2_hh_compat:		equ 1000h
    66                              <2> opt2_getc_idle:		equ 2000h
    67                              <2> opt2_getc_idle_dpmi:	equ 4000h
    68                              <2> opt2_re_cancel_tpg:	equ 8000h
    69                              <2> opt2_nn_compat:		equ 1_0000h
    70                              <2> opt2_nn_capitalise:	equ 2_0000h
    71                              <2> %if _MS_0RANGE_COMPAT
    72                              <2> opt2_0range_compat:	equ 4_0000h
    73                              <2> %endif
    74                              <2> opt2_rr16_compat:	equ 8_0000h
    75                              <2> opt2_r_prompt_compat:	equ 10_0000h
    76                              <2> opt2_r_separate:	equ 20_0000h
    77                              <2> opt2_r_linebreak_always:equ 40_0000h
    78                              <2> opt2_dpminohlt:		equ 8000_0000h	; DPMI doesn't like hlt
    79                              <2> DEFAULTOPTIONS2	equ opt2_dw_header | opt2_dd_header | opt2_getc_idle_dpmi | opt2_dpminohlt
    80                              <2> 
    81                              <2> 
    82                              <2> opt3_tt_no_paging:	equ 1
    83                              <2> opt3_tp_no_paging:	equ 2
    84                              <2> opt3_pp_no_paging:	equ 4
    85                              <2> opt3_gg_no_paging:	equ 8
    86                              <2> opt3_silence_paging_set:equ 100h
    87                              <2> opt3_silence_paging_on:	equ 200h
    88                              <2> opt3_paging_rc:		equ 1000h
    89                              <2> opt3_paging_yy:		equ 2000h
    90                              <2> opt3_paging_re:		equ 4000h
    91                              <2> opt3_r_highlight_diff:	equ 10000h
    92                              <2> opt3_r_highlight_dumb:	equ 20000h
    93                              <2> opt3_r_highlight_full:	equ 40000h
    94                              <2> opt3_r_highlight_eip:	equ 80000h
    95                              <2> %if _PM
    96                              <2> opt3_ss_b_bit_set:	equ   10_0000h
    97                              <2>  %if _BREAK_INSTALLDPMI
    98                              <2> opt3_break_installdpmi:	equ   20_0000h
    99                              <2>  %endif
   100                              <2> %endif
   101                              <2> %if _DHIGHLIGHT
   102                              <2> opt3_d_highlight:	equ   80_0000h
   103                              <2> %endif
   104                              <2> %if _GETLINEHIGHLIGHT
   105                              <2> opt3_getline_highlight:	equ  100_0000h
   106                              <2> %endif
   107                              <2> opt3_no_idle_2F:	equ  200_0000h
   108                              <2> %if _DELAY_BEFORE_BP
   109                              <2> opt3_delay_before_bp:	equ  400_0000h
   110                              <2> %endif
   111                              <2> opt3_no_call_amis:	equ  800_0000h
   112                              <2> opt3_disable_autorepeat:equ 1000_0000h
   113                              <2> opt3_check_ctrlc_keyb:	equ 2000_0000h
   114                              <2> opt3_check_ctrlc_0bh:	equ 4000_0000h
   115                              <2> opt3_tsr_quit_leave_tf:	equ 8000_0000h
   116                              <2> DEFAULTOPTIONS3	equ opt3_tt_no_paging | opt3_tp_no_paging 		| opt3_pp_no_paging | opt3_gg_no_paging 		| opt3_check_ctrlc_keyb | opt3_check_ctrlc_0bh
   119                              <2> 
   120                              <2> 
   121                              <2> opt4_int_2F_hook:	equ 2
   122                              <2> opt4_int_08_hook:	equ 4
   123                              <2> opt4_int_2D_hook:	equ 8
   124                              <2> %if _CATCHINTFAULTCOND
   125                              <2> opt4_int_fault_hook:	equ 10h
   126                              <2> %endif
   127                              <2> opt4_int_serial_force:	equ 1_0000h
   128                              <2> opt4_int_2F_force:	equ 2_0000h
   129                              <2> opt4_int_08_force:	equ 4_0000h
   130                              <2> opt4_int_2D_force:	equ 8_0000h
   131                              <2> %if _CATCHINT0D
   132                              <2> opt4_int_0D_force:	equ   10_0000h
   133                              <2> %endif
   134                              <2> %if _CATCHINT0C
   135                              <2> opt4_int_0C_force:	equ   20_0000h
   136                              <2> %endif
   137                              <2> opt4_int_00_force:	equ  100_0000h
   138                              <2> opt4_int_01_force:	equ  200_0000h
   139                              <2> opt4_int_03_force:	equ  400_0000h
   140                              <2> opt4_int_06_force:	equ  800_0000h
   141                              <2> opt4_int_18_force:	equ 1000_0000h
   142                              <2> opt4_int_19_force:	equ 2000_0000h
   143                              <2> opt4_int_09_force:	equ 4000_0000h	; not used at the same time as 15h
   144                              <2> opt4_int_15_force:	equ 4000_0000h	; not used at the same time as 09h
   145                              <2> opt4_int_07_force:	equ 8000_0000h
   146                              <2> DEFAULTOPTIONS4 equ opt4_int_2F_hook
   147                              <2> 
   148                              <2> 
   149                              <2> %if _VXCHG
   150                              <2> opt6_vv_mode:		equ 1
   151                              <2> opt6_vv_keep:		equ 2
   152                              <2> opt6_vv_int16:		equ 10h
   153                              <2>  %if _VXCHG_DEFAULT_ON
   154                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq | opt6_vv_mode
   155                              <2>  %else
   156                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   157                              <2>  %endif
   158                              <2> %else
   159                              <2> DEFAULTOPTIONS6 equ opt6_share_serial_irq
   160                              <2> %endif
   161                              <2> %if _DEBUG
   162                              <2> opt6_debug_exception_late:	equ  20h
   163                              <2> opt6_debug_exception_early:	equ  40h
   164                              <2>  %if _DEBUG_COND
   165                              <2> opt6_debug_exception:	equ  80h
   166                              <2> opt6_debug_mode:	equ 100h
   167                              <2>  %endif
   168                              <2> %endif
   169                              <2> opt6_bios_output:	equ 200h
   170                              <2> opt6_flat_binary:	equ 400h
   171                              <2> opt6_big_stack:		equ 800h
   172                              <2> opt6_40_columns:	equ 1000h
   173                              <2> opt6_40_indent_odd:	equ 2000h
   174                              <2> opt6_40_dash:		equ 4000h
   175                              <2> opt6_share_serial_irq:	equ 1_0000h
   176                              <2> opt6_serial_EOI_call:	equ 2_0000h
   177                              <2> %if _RH
   178                              <2> opt6_rh_mode:		equ 10_0000h
   179                              <2> %endif
   180                              <2> %if _DEBUG
   181                              <2> opt6_debug_putrunint_early:	equ  40_0000h
   182                              <2>  %if _DEBUG_COND
   183                              <2> opt6_debug_putrunint:		equ  80_0000h
   184                              <2>  %endif
   185                              <2> %endif
   186                              <2> opt6_bios_io:		equ 100_0000h
   187                              <2> opt6_immasm_display_uu:	equ 200_0000h
   188                              <2> opt6_immasm_debug:	equ 400_0000h
   189                              <2> opt6_immasm_flag:	equ 800_0000h
   190                              <2> opt6_immasm_nobranch:	equ 1000_0000h
   191                              <2> opt6_r_flags_style2:	equ 2000_0000h
   192                              <2> opt6_r_flags_style3:	equ 4000_0000h
   193                              <2> opt6_r_linebreak_conditional:	equ 8000_0000h
   194                              <2> 
   195                              <2> 
   196                              <2> DEFAULTOPTIONS7 equ opt7_no_tsr_ll
   197                              <2> opt7_no_free_oneshot_eld:	equ 1
   198                              <2> opt7_debug_optional_link:	equ 2
   199                              <2> opt7_quiet_install:		equ 4
   200                              <2> opt7_quick_run:			equ 8
   201                              <2> opt7_houdini:			equ 100h
   202                              <2> opt7_debug_run:			equ 200h
   203                              <2> opt7_no_ensure:			equ 1000h
   204                              <2> opt7_no_tsr_ll:			equ 2000h
   205                              <2> 
   206                              <2> 
   207                              <2> oldpacket	equ	  1	; Int25/Int26 packet method available (L, W)
   208                              <2> newpacket	equ	  2	; Int21.7305 packet method available (L, W)
   209                              <2> ntpacket	equ	  4	; VDD registered and usable (L, W)
   210                              <2> pagedcommand	equ	  8	; allows paging in puts
   211                              <2> notstdinput	equ	 10h	; DEBUG's StdIn isn't a device with StdIn bit (is file or other device)
   212                              <2> inputfile	equ	 20h	; DEBUG's StdIn is a file, notstdinput also set
   213                              <2> notstdoutput	equ	 40h	; DEBUG's StdOut isn't a device with StdOut bit (is file or other device)
   214                              <2> outputfile	equ	  80h	; DEBUG's StdOut is a file, notstdoutput also set
   215                              <2> hooked2F	equ	 100h	; Int2F hooked
   216                              <2> nohook2F	equ	 200h	; don't hook Int2F.1687 (required for Win9x, DosEmu?)
   217                              <2> unused_dif1_dpminohlt equ 400h	; DPMI doesn't like hlt
   218                              <2> protectedmode	equ	 800h	; in (DPMI) protected mode
   219                              <2> debuggeeA20	equ	1000h	; state of debuggee's A20
   220                              <2> debuggerA20	equ	2000h	; state of debugger's A20 (will be on if possible)
   221                              <2> nodosloaded	equ	4000h	; No DOS loaded currently (Boot loader mode)
   222                              <2> has386		equ	8000h	; CPU is a 386
   223                              <2> usecharcounter	equ    1_0000h	; don't reset charcounter between calls to puts
   224                              <2> runningnt	equ    2_0000h	; running in NTVDM
   225                              <2> canswitchmode	equ    4_0000h	; can switch modes (auxbuff large enough, DPMI mode switch set up)
   226                              <2> modeswitched	equ    8_0000h	; switched mode (now in the mode that we weren't entered in)
   227                              <2> promptwaiting	equ   10_0000h	; puts: any more output needs to display a prompt first
   228                              <2> switchbuffer	equ   20_0000h	; mode switch needs a buffer (auxbuff)
   229                              <2> tsrmode		equ   40_0000h	; in TSR mode; DPI and DPP not valid
   230                              <2> attachedterm	equ   80_0000h	; the attached process terminated
   231                              <2> runningdosemu	equ  100_0000h	; running in dosemu
   232                              <2> ; load_is_ldp	equ  200_0000h	; boot load: partition specified as "ldp"
   233                              <2> tt_while:	equ  400_0000h	; tt: while condition specified
   234                              <2> tt_p:		equ  800_0000h	; tt: proceed past repeated string instructions
   235                              <2> tt_silent_mode:	equ 1000_0000h	; tt: run should be silent (dump at end)
   236                              <2> tt_silence:	equ 2000_0000h	; tt: silent writing (write to auxbuff instead)
   237                              <2> tt_no_bb:	equ 4000_0000h	; tt: do not use bb breakpoints
   238                              <2> tt_no_bb_first:	equ 8000_0000h	; tt: do not use bb breakpoints at first
   239                              <2> 
   240                              <2> 
   241                              <2> dif2_gg_is_first:	equ   1
   242                              <2> dif2_gg_skip_non_cseip:	equ   2
   243                              <2> dif2_gg_skip_cseip:	equ   4
   244                              <2> dif2_gg_is_gg:		equ   8
   245                              <2> dif2_gg_first_detected:	equ  10h
   246                              <2> dif2_gg_again:		equ  20h
   247                              <2> dif2_tpg_proceed_bp_set:equ  40h
   248                              <2> dif2_tpg_keep_proceed_bp: equ 80h
   249                              <2> dif2_tpg_have_bp:	equ 100h
   250                              <2> dif2_tpg_adjusted_cseip:equ 200h
   251                              <2> dif2_tpg_do_not_adjust:	equ 400h
   252                              <2> dif2_bp_failure:	equ 800h
   253                              <2> dif2_is_pp:		equ 1000h
   254                              <2> %if _SYMBOLIC
   255                              <2> dif2_createdprocess:	equ 800_0000h	; created empty debuggee process
   256                              <2> dif2_sym_req_xms:	equ 2000h
   257                              <2> dif2_sym_req_86mm:	equ 4000h
   258                              <2> dif2_sym_req_mask equ dif2_sym_req_86mm | dif2_sym_req_xms
   259                              <2> dif2_no_pm_xms:		equ 1_0000h
   260                              <2> dif2_xms_detection_done:equ 2_0000h
   261                              <2> %endif
   262                              <2> %if _INPUT_FILE_HANDLES
   263                              <2> dif2_input_file:	equ 10_0000h
   264                              <2> dif2_closed_input_file:	equ 20_0000h
   265                              <2> %endif
   266                              <2> dif2_did_getline_file:	equ 40_0000h
   267                              <2> %if _SYMBOLIC
   268                              <2> dif2_poison:		equ 80_0000h
   269                              <2> %endif
   270                              <2> dif2_boot_loaded_kernel:equ 100_0000h
   271                              <2> %if _INPUT_FILE_BOOT
   272                              <2> dif2_input_file_boot:	equ 200_0000h
   273                              <2> dif2_closed_input_file_boot:	equ 400_0000h
   274                              <2> %endif
   275                              <2> dif2_in_silence_dump:	equ 1000_0000h
   276                              <2> dif2_int31_segment:	equ 2000_0000h
   277                              <2> dif2_nn_compat:		equ 4000_0000h
   278                              <2> dif2_nn_capitalise:	equ 8000_0000h
   279                              <2> 
   280                              <2> 
   281                              <2> dif3_load_is_ldp:	equ 1	; boot load: partition specified as "ldp"
   282                              <2> dif3_load_is_sdp:	equ 2	; boot load: partition specified as "sdp"
   283                              <2> dif3_load_is_ydp:	equ 4	; boot load: partition specified as "ydp"
   284                              <2> dif3_load_is_dp:	equ dif3_load_is_ldp 				| dif3_load_is_sdp 				| dif3_load_is_ydp
   287                              <2> dif3_load_dir_dir:	equ 8
   288                              <2> dif3_input_terminal_override:	equ 10h
   289                              <2> dif3_input_serial_override:	equ 20h
   290                              <2> dif3_if_not:		equ 40h
   291                              <2> dif3_partition_changed:	equ 80h
   292                              <2> ;
   293                              <2> dif3_input_cmdline:	equ 100h; input reading from cmdline_buffer
   294                              <2> dif3_input_cmdline_closed: equ 200h
   295                              <2> dif3_at_line_end:	equ 400h
   296                              <2> dif3_quiet_input_single:equ 800h
   297                              <2> dif3_quiet_output:	equ 1000h
   298                              <2> dif3_unquiet_error:	equ 2000h
   299                              <2> dif3_unquiet_prompt:	equ 4000h
   300                              <2> dif3_unquiet:		equ dif3_unquiet_error | dif3_unquiet_prompt
   301                              <2> dif3_return_eof:	equ 8000h
   302                              <2> dif3_highlighting:	equ 1_0000h
   303                              <2> dif3_do_not_highlight:	equ 2_0000h
   304                              <2> dif3_int10_highlight:	equ 2_0000h
   305                              <2> dif3_nosymbols_1:	equ 4_0000h
   306                              <2> dif3_nosymbols_2:	equ 8_0000h
   307                              <2> %if _PM
   308                              <2> dif3_ss_b_bit_set:	equ  10_0000h
   309                              <2> %endif
   310                              <2> dif3_gotint19:		equ  20_0000h
   311                              <2> dif3_prior_pm:		equ  40_0000h
   312                              <2> %if _DELAY_BEFORE_BP
   313                              <2> dif3_delayed		equ  80_0000h
   314                              <2> %endif
   315                              <2> dif3_input_re:		equ 100_0000h	; input reading from re_buffer
   316                              <2> dif3_input_re_closed:	equ 200_0000h
   317                              <2> dif3_accept_getrange_0:	equ 400_0000h
   318                              <2> %if _INPUT_FILE_HANDLES || _INPUT_FILE_BOOT
   319                              <2> dif3_in_if:		equ 800_0000h
   320                              <2> %endif
   321                              <2> dif3_auxbuff_guarded_1:	equ 1000_0000h
   322                              <2> dif3_auxbuff_guarded_2:	equ 2000_0000h
   323                              <2> dif3_auxbuff_guarded_3:	equ 4000_0000h
   324                              <2> dif3_sss_is_reverse:	equ 8000_0000h
   325                              <2> 
   326                              <2> 
   327                              <2> dif4_int_serial_hooked:	equ 1
   328                              <2> dif4_int_2F_hooked:	equ 2
   329                              <2> dif4_int_08_hooked:	equ 4
   330                              <2> dif4_int_2D_hooked:	equ 8
   331                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0D
   332                              <2> dif4_int_0D_hooked:	equ 10h
   333                              <2> %endif
   334                              <2> %if _CATCHINTFAULTCOND && _CATCHINT0C
   335                              <2> dif4_int_0C_hooked:	equ 20h
   336                              <2> %endif
   337                              <2> %if _LOADER
   338                              <2> dif4_int_18_hooked:	equ 1000h
   339                              <2> dif4_int_19_hooked:	equ 2000h
   340                              <2> %endif
   341                              <2> 
   342                              <2> 
   343                              <2> %if _VXCHG
   344                              <2> dif6_vv_mode:		equ 1
   345                              <2> %endif
   346                              <2> dif6_in_hook2F:		equ 2
   347                              <2> dif6_in_amis_hook2F:	equ 4
   348                              <2> dif6_debug_mode:	equ 100h
   349                              <2> dif6_locked:		equ 200h
   350                              <2> dif6_mcp:		equ 400h
   351                              <2> %if _RH
   352                              <2> dif6_rh_mode_was:	equ  8_0000h
   353                              <2> dif6_rh_mode:		equ 10_0000h
   354                              <2> dif6_rh_mode_2:		equ 20_0000h
   355                              <2> %endif
   356                              <2> dif6_device_mode:	equ 40_0000h
   357                              <2> dif6_cpdepchars:	equ 80_0000h
   358                              <2> %if _IMMASM
   359                              <2> dif6_immasm_no_output:	equ 100_0000h
   360                              <2> dif6_immasm:		equ 200_0000h
   361                              <2> dif6_immasm_rel8:	equ 400_0000h
   362                              <2> %endif
   363                              <2> 
   364                              <2> 
   365                              <2> disasm_lowercase	equ 1
   366                              <2> disasm_commablank	equ 2
   367                              <2> disasm_nasm		equ 4
   368                              <2> disasm_lowercase_refmem:equ 8
   369                              <2> disasm_show_short:	equ 10h
   370                              <2> disasm_show_near:	equ 20h
   371                              <2> disasm_show_far:	equ 40h
   372                              <2> disasm_nec:		equ 80h
   373                              <2> disasm_40_columns:	equ 100h
   374                              <2> disasm_no_indent:	equ 200h
   375                              <2> disasm_msdebug_mnemonofs: equ 400h
   376                              <2> disasm_a16_memref:	equ 1000h
   377                              <2> disasm_a32_memref:	equ 2000h
   378                              <2> disasm_a16_string:	equ 4000h
   379                              <2> disasm_a32_string:	equ 8000h
   380                              <2> disasm_hide_modrm:	equ 10000h
   381                              <2> disasm_asize_loop_nasm:	equ 20000h
   382                              <2> disasm_modrm_always:	equ 40000h
   383                              <2> DEFAULTASMOPTIONS equ disasm_lowercase|disasm_commablank|disasm_nasm 	| disasm_a16_memref | disasm_a32_memref 	| disasm_a16_string | disasm_a32_string
   386                              <2> 
   387                              <2> 	; serial_flags values
   388                              <2> sf_init_done:	equ 1
   389                              <2> sf_ctrl_c:	equ 2
   390                              <2> sf_double_ctrl_c:	equ 4
   391                              <2> sf_built_in_fifo:	equ 8
   392                              <2> sf_use_serial:		equ 10h
  1560                              <1> %endif
    20                                   %include "asmops.mac"
     1                              <1> 
     2                              <1> %if 0
     3                              <1> 
     4                              <1> lDebug assembler/disassembler table operands
     5                              <1> 
     6                              <1> Copyright (C) 1995-2003 Paul Vojta
     7                              <1> Copyright (C) 2008-2026 E. C. Masloch
     8                              <1> 
     9                              <1> Usage of the works is permitted provided that this
    10                              <1> instrument is retained with the works, so that any entity
    11                              <1> that uses the works is notified of this instrument.
    12                              <1> 
    13                              <1> DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    14                              <1> 
    15                              <1> %endif
    16                              <1> 
    17                              <1> 
    18                              <1> ;	Equates for instruction operands.
    19                              <1> ;	First the sizes.
    20                              <1> 
    21                              <1> OP_ALL		equ 40h		; byte/word/dword operand (could be 30h but ...)
    22                              <1> OP_1632		equ 50h		; word or dword operand
    23                              <1> OP_8		equ 60h		; byte operand
    24                              <1> OP_16		equ 70h		; word operand
    25                              <1> OP_32		equ 80h		; dword operand
    26                              <1> OP_64		equ 90h		; qword operand
    27                              <1> OP_1632_DEFAULT	equ 0A0h	; word or dword or default opsize
    28                              <1> OP_1632_DEFAULT_ASM	equ 0B0h; asm: word or dword or default opsize,
    29                              <1> 				;  disasm: word or dword
    30                              <1> 
    31                              <1> OP_SIZE	equ OP_ALL		; the lowest of these
    32                              <1> 
    33                              <1> ;	These operand types need to be combined with a size.
    34                              <1> ;	Bits 0 to 3 give one of these types (maximum 15),
    35                              <1> ;	 and bits 4 to 7 specify the size. Table entries
    36                              <1> ;	 for these are identified by detecting that they
    37                              <1> ;	 are above-or-equal OP_SIZE.
    38                              <1> ;	The first parameter to the opsizeditem macro is the
    39                              <1> ;	 name of the item. It has to match the names used in
    40                              <1> ;	 the instr.key and debugtbl.inc files.
    41                              <1> ;	The second parameter is the entry for bittab that
    42                              <1> ;	 is used by aa.asm (the assembler).
    43                              <1> ;	The third parameter is the suffix used to create the
    44                              <1> ;	 entry for asmjmp (prefix aop_) and disjmp2 (dop_).
    45                              <1> 
    46                              <1> %macro opsizeditem 3.nolist
    47                              <1>  %1 equ nextindex
    48                              <1>  %xdefine BITTAB_OPSIZEDITEMS BITTAB_OPSIZEDITEMS,%2
    49                              <1>  %xdefine ASMJMP_OPSIZEDITEMS ASMJMP_OPSIZEDITEMS,aop_%3
    50                              <1>  %xdefine DISJMP2_OPSIZEDITEMS DISJMP2_OPSIZEDITEMS,dop_%3
    51                              <1>  %assign nextindex nextindex + 1
    52                              <1> %endmacro
    53                              <1> %assign nextindex 0
    54                              <1> %define BITTAB_OPSIZEDITEMS ""
    55                              <1> %define ASMJMP_OPSIZEDITEMS ""
    56                              <1> %define DISJMP2_OPSIZEDITEMS ""
    57                              <1> opsizeditem OP_IMM,	ARG_IMMED,	imm	; immediate
    58                              <1> opsizeditem OP_IMM_NOT_EXTEND,	ARG_IMMED,	imm_not_extend	; immediate
    59                              <1> 		; This one is for showing the WORD/DWORD size keyword if the
    60                              <1> 		;  value could fit into an imms8.
    61                              <1> opsizeditem OP_RM,ARG_DEREF+ARG_JUSTREG,rm	; reg/mem
    62                              <1> opsizeditem OP_M,	ARG_DEREF,	m	; mem (but not reg)
    63                              <1> opsizeditem OP_R_MOD,	ARG_JUSTREG,	r_mod	; register, determined from MOD R/M part
    64                              <1> opsizeditem OP_MOFFS,	ARG_DEREF,	moffs	; memory offset; e.g., [1234]
    65                              <1> opsizeditem OP_R,	ARG_JUSTREG,	r	; reg part of reg/mem byte
    66                              <1> opsizeditem OP_R_ADD,	ARG_JUSTREG,	r_add	; register, determined from instruction byte
    67                              <1> opsizeditem OP_AX,	ARG_JUSTREG,	ax	; al or ax or eax
    68                              <1> %if nextindex > 16
    69                              <1>  %error Too many op sized items
    70                              <1> %endif
    71                              <1> 
    72                              <1> ;	These don't need a size.
    73                              <1> ;	Because the size needs to be clear to indicate
    74                              <1> ;	 that one of these is to be used, the maximum
    75                              <1> ;	 value for these is 63 (as 64 is OP_SIZE).
    76                              <1> ;	The minimum value for these is 1 because a 0
    77                              <1> ;	 without size means the end of an op list (OP_END).
    78                              <1> ;	The first parameter to the opitem macro is the name
    79                              <1> ;	 of the item. It has to match the names used in the
    80                              <1> ;	 instr.key and debugtbl.inc files.
    81                              <1> ;	The second parameter is the entry for bittab that
    82                              <1> ;	 is used by aa.asm (the assembler). The third
    83                              <1> ;	 parameter is the entry for asmjmp.
    84                              <1> ;	The fourth parameter is the entry for optab as used
    85                              <1> ;	 by uu.asm (the disassembler).
    86                              <1> ;
    87                              <1> ;	asm_siznum contains entries for OP_M64 to OP_MXX.
    88                              <1> ;	 (The order has to match their opitem order.)
    89                              <1> ;	asm_regnum contains entries for OP_DX to OP_GS.
    90                              <1> ;	 (The order has to match their opitem order.)
    91                              <1> 
    92                              <1> %macro opitem 4.nolist
    93                              <1>  %1 equ nextindex
    94                              <1>  %xdefine BITTAB_OPITEMS BITTAB_OPITEMS,%2
    95                              <1>  %xdefine ASMJMP_OPITEMS ASMJMP_OPITEMS,%3
    96                              <1>  %xdefine OPTAB_OPITEMS OPTAB_OPITEMS,%4
    97                              <1>  %assign nextindex nextindex + 1
    98                              <1> %endmacro
    99                              <1> 	OP_END	equ 0
   100                              <1> %assign nextindex 1
   101                              <1> %define BITTAB_OPITEMS ""
   102                              <1> %define ASMJMP_OPITEMS ""
   103                              <1> %define OPTAB_OPITEMS ""
   104                              <1> 	; order of the following (ao17 entries) must match asm_siznum in aa.asm
   105                              <1> OP_FIRST_ASM_SIZNUM	equ nextindex	; corresponding to asm_siznum start
   106                              <1> opitem OP_M64,		ARG_DEREF,	ao17,dop_m64	; qword memory (obsolete?)
   107                              <1> opitem OP_MFLOAT,	ARG_DEREF,	ao17,dop_mfloat	; float memory
   108                              <1> opitem OP_MDOUBLE,	ARG_DEREF,	ao17,dop_mdouble; double-precision floating memory
   109                              <1> opitem OP_M80,		ARG_DEREF,	ao17,dop_m80	; tbyte memory
   110                              <1> opitem OP_MXX,		ARG_DEREF,	ao17,dop_mxx	; memory (size unknown)
   111                              <1> opitem OP_FARIMM,	ARG_FARADDR,	ao21,dop_farimm	; far16/far32 immediate
   112                              <1> opitem OP_FAR_OFFSET,	ARG_IMMED,	aop_faroffset,da_internal_error	; far offset-only
   113                              <1> opitem OP_REL8,		ARG_IMMED,	ao23,dop_rel8	; byte address relative to IP
   114                              <1> opitem OP_REL1632,	ARG_IMMED,	ao25,dop_rel1632; word or dword address relative to IP
   115                              <1> opitem OP_1CHK,		ARG_WEIRDREG,	ao29,dop49	; check for ST(1)
   116                              <1> opitem OP_STI,		ARG_WEIRDREG,	aop_sti,dop_sti	; ST(I)
   117                              <1> opitem OP_CR,		ARG_WEIRDREG,	aop_cr,dop_cr	; CRx
   118                              <1> opitem OP_DR,		ARG_WEIRDREG,	ao34,dop_dr	; DRx
   119                              <1> opitem OP_TR,		ARG_WEIRDREG,	ao35,dop_tr	; TRx
   120                              <1> opitem OP_SEGREG,	ARG_WEIRDREG,	ao39,dop_segreg	; segment register
   121                              <1> opitem OP_IMMS8,	ARG_IMMED,	ao41,dop_imms8 	; sign extended immediate byte
   122                              <1> opitem OP_IMMS8_EXTEND,	ARG_IMMED,	ao41_extend,dop_imms8		; add etc word/dword r/m, imms8
   123                              <1> opitem OP_IMM8,		ARG_IMMED,	ao42,dop_imm8	; immediate byte (other args may be (d)word)
   124                              <1> opitem OP_IMM8_OPTIONAL,ARG_IMMED,	ao42,dop_imm8_optional
   125                              <1> opitem OP_IMM8_INT,	ARG_IMMED,	ao42,dop_imm8_int		; immediate byte for int
   126                              <1> opitem OP_IMM8_SHIFTROT,ARG_IMMED,	ao42,dop_imm8_shiftrot		; immediate byte for shift/rotate
   127                              <1> opitem OP_MMX,		ARG_WEIRDREG,	aop_mmx,dop_mmx	; MMx
   128                              <1> opitem OP_MMX_MOD,	ARG_WEIRDREG,	aop_mmx_mod,dop_mmx_mod	; MMx, but in ModR/M part
   129                              <1> opitem OP_X,		0FFh,	ao_x,	dop_x		; OPX byte follows
   130                              <1> opitem OP_SHOSIZ,	0FFh,	ao44,	dop_shosiz	; set flag to always show the size
   131                              <1> opitem OP_ASM_MOVX,	0FFh,	ao_movx,dop60a		; enforce next operand size to be specified
   132                              <1> opitem OP_SHORT,	0FFh,	ao_short,dop_short	; allow short keyword
   133                              <1> opitem OP_NEAR,		0FFh,	ao_near,dop_near	; allow near keyword
   134                              <1> opitem OP_FAR,		0FFh,	ao_far,	dop_far		; allow far keyword
   135                              <1> opitem OP_FAR_REQUIRED,	0FFh,	ao_far_required,dop_far_required	; require far keyword
   136                              <1> opitem OP_FAR_M,	0FFh,	ao_modifier_continue,dop_far_m		; les, lds, lss, lfs, lgs, or jmp/call far mem
   137                              <1> opitem OP_DOUBLE_M,	0FFh,	ao_modifier_continue,dop_double_m	; bound
   138                              <1> opitem OP_M_SRC,	0FFh,	ao_modifier_continue,dop_m_src
   139                              <1> opitem OP_M_DST,	0FFh,	ao_modifier_continue,dop_m_dst
   140                              <1> opitem OP_M_SRC_DST,	0FFh,	ao_modifier_continue,dop_m_src_dst
   141                              <1> opitem OP_STACK_PUSH,	0FFh,	ac09_internal_error,dop_stack_push
   142                              <1> opitem OP_STACK_POP,	0FFh,	ac09_internal_error,dop_stack_pop
   143                              <1> opitem OP_STACK_SPECIAL,0FFh,	ac09_internal_error,dop_stack_special
   144                              <1> opitem OP_M_ALWAYS_16,	0FFh,	ao_m_always_16,dop_m_always_16
   145                              <1> opitem OP_E_CX,	ARG_JUSTREG,	aop_e_cx, da_e_cx			; (E)CX
   146                              <1> OP_FIRST_STRING equ nextindex
   147                              <1> opitem OP_1,	ARG_IMMED,	ao46, "1"	; 1 (simple "string" ops from here on)
   148                              <1> opitem OP_3,	ARG_IMMED,	ao47, "3"	; 3
   149                              <1> 	; order of the following (ao48 entries) must match asm_regnum in aa.asm
   150                              <1> OP_FIRST_ASM_REGNUM	equ nextindex	; corresponding to asm_regnum start
   151                              <1> opitem OP_DX,	ARG_JUSTREG,	ao48, "DX"	; DX
   152                              <1> opitem OP_CL,	ARG_JUSTREG,	ao48, "CL"	; CL
   153                              <1> opitem OP_ST,	ARG_WEIRDREG,	ao48, "ST"	; ST (top of coprocessor stack)
   154                              <1> opitem OP_CS,	ARG_WEIRDREG,	ao48, "CS"	; CS
   155                              <1> opitem OP_DS,	ARG_WEIRDREG,	ao48, "DS"	; DS
   156                              <1> opitem OP_ES,	ARG_WEIRDREG,	ao48, "ES"	; ES
   157                              <1> opitem OP_FS,	ARG_WEIRDREG,	ao48, "FS"	; FS
   158                              <1> opitem OP_GS,	ARG_WEIRDREG,	ao48, "GS"	; GS
   159                              <1> opitem OP_SS,	ARG_WEIRDREG,	ao48, "SS"	; SS
   160                              <1> OP_AFTER_LAST equ nextindex
   161                              <1> %if nextindex > OP_SIZE
   162                              <1>  %error Too many op items
   163                              <1> %endif
   164                              <1> OP_AMOUNT_TABLE	equ nextindex + 16 - 1
   165                              <1> 		; nextindex: amount sizeless types
   166                              <1> 		; 16: OP_SIZE combined types
   167                              <1> 		; -1: OP_END does not occur in tables
   168                              <1> 
   169                              <1> ; The following are extensions to sizeless OP_ items.
   170                              <1> ;  After an OP_X operand, a byte giving an index into
   171                              <1> ;  the OPX tables follows in the list. This is never
   172                              <1> ;  used with a size so we can make use of the full
   173                              <1> ;  eight bits. First macro parameter is the name which
   174                              <1> ;  matches the use in instr.key. Second parameter is
   175                              <1> ;  the routine in the assembler to dispatch to. Third
   176                              <1> ;  parameter is the routine in the disassembler.
   177                              <1> ; Only used for some disassembler extensions for now.
   178                              <1> 
   179                              <1> %macro opxitem 3.nolist
   180                              <1>  %1 equ nextindex
   181                              <1>  %xdefine ASMJMP_OPXITEMS ASMJMP_OPXITEMS,%2
   182                              <1>  %xdefine DISJMP_OPXITEMS DISJMP_OPXITEMS,%3
   183                              <1>  %assign nextindex nextindex + 1
   184                              <1> %endmacro
   185                              <1> %assign nextindex 0
   186                              <1> %define ASMJMP_OPXITEMS ""
   187                              <1> %define DISJMP_OPXITEMS ""
   188                              <1> opxitem OPX_NOTHING,	ao_modifier_continue, dop60a
   189                              <1> opxitem OPX_MOD_IF_REG,	ao_modifier_continue, dop_mod_if_reg
   190                              <1> opxitem OPX_MOD_IF_MEMOFFS_AND_OTHER_REG_AL_AX_EAX, ao_modifier_continue, 	dop_mod_if_memoffs_and_other_acc
   192                              <1> opxitem OPX_MOD_IF_OTHER_REG_AX_EAX, ao_modifier_continue, 	dop_mod_if_other_acc_1632
   194                              <1> opxitem OPX_MOD_IF_REG_1632, ao_modifier_continue, 	dop_mod_if_reg_1632
   196                              <1> opxitem OPX_MOD_IF_REG_AL_AX_EAX, ao_modifier_continue, 	dop_mod_if_reg_acc
   198                              <1> opxitem OPX_MOD_IF_REG_AX_EAX, ao_modifier_continue, 	dop_mod_if_reg_acc_1632
   200                              <1> opxitem OPX_MODALWAYS_IF_REG, ao_modifier_continue, 	dop_modalways_if_reg
   202                              <1> opxitem OPX_LOOP_OPTION, ac09_internal_error, dop_loop_option
   203                              <1> opxitem OPX_MOD_FORCE_3, ao_modifier_continue, dop_mod_force_3
   204                              <1> %if nextindex > 256
   205                              <1>  %error Too many opx items
   206                              <1> %endif
    21                                   %define MN_BSWAP %?
    22                                   %define MN_GS %?
    23                                   %define MN_O32 %?
    24                                  %endif
    25                                  
    26                                  
    27                                  	usesection lDEBUG_CODE
    27          ------------------       note: usesection lDEBUG_CODE
    28                                  
    29                                  ..@uu_access_start:
    30                                  		; U command - disassemble.
    31                                  uu:
    32 00000000 4E                      	dec si
    33 00000001 4E                      	dec si
    34 00000002 BA[0000]                	mov dx, msg.uninstall
    35 00000005 E8(0000)                	call isstring?
    36 00000008 AC                      	lodsb
    37 00000009 7503E9(0000)            	je uninstall
    38                                  %if _LOADER
    39                                  	jmp error
    40                                  %else
    41 0000000E AC                      	lodsb
    42                                  
    43 0000000F C706[0000][1A00]        	mov word [lastcmd], lastuu
    44 00000015 E8(0000)                	call iseol?
    45 00000018 7537                    	jne uu1			; if an address was given
    46                                  
    47                                  lastuu:
    48 0000001A 6631C0                  _386_PM	xor eax, eax
    49 0000001D A1[0000]                	mov ax, word [uu_default_lines]
    50                                  				; default length in lines, if nonzero
    51 00000020 85C0                    	test ax, ax
    52 00000022 740C                    	jz @F
    53 00000024 7807                    	js short .error
    54 00000026 A3[0000]                	mov word [getrange_lines], ax
    55 00000029 31C0                    	xor ax, ax
    56 0000002B EB11                    	jmp @FF
    57                                  
    58                                  .error:
    59 0000002D E9(0000)                	jmp error
    60                                  
    61                                  @@:
    62 00000030 C706[0000]0080          	mov word [getrange_lines], 8000h
    63 00000036 A1[0000]                	mov ax, word [uu_default_length]
    64 00000039 85C0                    	test ax, ax
    65 0000003B 74F0                    	jz short .error
    66 0000003D 48                      	dec ax
    67                                  @@:
    68 0000003E 66                      	_386_PM_o32	; mov ecx, dword [u_addr]
    69 0000003F 8B0E[0000]              	mov cx, word [u_addr]
    70 00000043 66                      	_386_PM_o32	; mov edx, ecx
    71 00000044 89CA                    	mov dx, cx
    72 00000046 66                      	_386_PM_o32	; add ecx, byte 1Fh
    73 00000047 01C1                    	add cx, ax
    74 00000049 7304                    	jnc .no_overflow	; if no overflow -->
    75 0000004B 66                      	_386_PM_o32	; or ecx, byte -1
    76 0000004C 83C9FF                  	or cx, byte -1		; til end of segment
    77                                  .no_overflow:
    78 0000004F EB37                    	jmp short uu2
    79                                  
    80                                  uu1:
    81 00000051 8B0E[0000]              	mov cx, word [uu_default_length]
    82                                  				; default length
    83 00000055 8B3E[0000]              	mov di, word [uu_default_lines]
    84                                  				; default length in lines, if nonzero
    85 00000059 8B1E[0000]              	mov bx, word [reg_cs]
    86 0000005D C706[0000]0080          	mov word [getrange_lines], 8000h
    87                                  %if _MS_0RANGE_COMPAT
    88 00000063 C606[0000]FF            	mov byte [getrange_is_uu], -1
    89 00000068 E8(0000)[0000]          	nearcall getrangeX.lines_and_uu	; get address range into bx:(e)dx
    90                                  %else
    91                                  	nearcall getrangeX.lines	; get address range into bx:(e)dx
    92                                  %endif
    93 0000006D E8(0000)                	call chkeol		; expect end of line here
    94 00000070 891E[0400]              	mov word [u_addr + saSegSel], bx
    95                                  %if _PM
    96 00000074 E8(0000)                	call ispm
    97 00000077 7506                    	jnz .86m
    98                                  .pm:
    99 00000079 891E[0800]              	mov word [u_addr + saSelector], bx
   100 0000007D EB04                    	jmp @F
   101                                  .86m:
   102 0000007F 891E[0600]              	mov word [u_addr + saSegment], bx
   103                                  @@:
   104                                  %endif
   105 00000083 66                      	_386_PM_o32		; mov dword [u_addr], edx
   106 00000084 8916[0000]              	mov word [u_addr], dx
   107                                  
   108                                  		; (d)word [u_addr] = offset start address
   109                                  		; word [u_addr + saSegSel] = segment start address
   110                                  		; (e)cx = end address
   111                                  		; (e)dx = start adddress (same as [u_addr])
   112                                  uu2:
   113 00000088 66                      	_386_PM_o32	; inc ecx
   114 00000089 41                      	inc cx
   115                                  uu3:
   116 0000008A E8(0000)                	call handle_serial_flags_ctrl_c
   117 0000008D 66                      	_386_PM_o32	; push ecx
   118 0000008E 51                      	push cx
   119 0000008F 66                      	_386_PM_o32	; push edx
   120 00000090 52                      	push dx
   121 00000091 8326[FE00]00            	and word [disflags], 0
   122 00000096 E82500                  	call disasm		; do it
   123 00000099 66                      	_386_PM_o32	; pop ebx
   124 0000009A 5B                      	pop bx
   125 0000009B 66                      	_386_PM_o32	; pop ecx
   126 0000009C 59                      	pop cx
   127 0000009D 66                      	_386_PM_o32	; mov eax, dword [u_addr]
   128 0000009E A1[0000]                	mov ax, word [u_addr]
   129 000000A1 66                      	_386_PM_o32	; mov edx, eax
   130 000000A2 89C2                    	mov dx, ax
   131 000000A4 66                      	_386_PM_o32	; sub eax, ecx
   132 000000A5 29C8                    	sub ax, cx		; current position - end
   133 000000A7 66                      	_386_PM_o32	; sub ebx, ecx
   134 000000A8 29CB                    	sub bx, cx		; previous position - end
   135                                  
   136 000000AA F606[0100]80            	testopt [getrange_lines], 8000h
   137 000000AF 7406                    	jz @F
   138 000000B1 66                      	_386_PM_o32	; cmp eax, ebx
   139 000000B2 39D8                    	cmp ax, bx
   140 000000B4 73D4                    	jnb uu3			; if we haven't reached the goal
   141 000000B6 C3                      	retn
   142                                  
   143                                  @@:
   144 000000B7 FF0E[0000]              	dec word [getrange_lines]
   145 000000BB 75CD                    	jnz uu3
   146 000000BD C3                      	retn
   147                                  
   148                                  
   149                                  	usesection lDEBUG_DATA_ENTRY
   149          ------------------       note: usesection lDEBUG_DATA_ENTRY
   150                                  %if _LINK_COMPAT
   151                                  	align 16, db 0
   152                                  %endif
   153                                  
   154                                  		; Jump table for displaying sized operands.
   155                                  		;  Entries are defined in the debug.asm opsizeditem list.
   156                                  	align 2, db 0
   157                                  disjmp2:
   158 00000000 [E509][AC09][190A]-     	dw DISJMP2_OPSIZEDITEMS
   158 00000006 [E30C][F00C][0A0A]-
   158 0000000C [F90C][510D][560D] 
   159                                  .end:
   160                                  
   161                                  		; Jump table for displaying operands.
   162                                  		;  Entries are defined in the debug.asm opitem list.
   163                                  	align 2, db 0
   164                                  optab:
   165 00000012 [7D02]                  	dw da_internal_error	; entry for OP_END
   166 00000014 [5A0D][5E0D][6F0D]-     	dw OPTAB_OPITEMS
   166 0000001A [8C0D][A20D][B40D]-
   166 00000020 [7D02][6D0E][AB0E]-
   166 00000026 [7210][8210][9810]-
   166 0000002C [B810][C310][E210]-
   166 00000032 [0A11][0A11][1C11]-
   166 00000038 [3711][2211][3011]-
   166 0000003E [4211][4A11][5B11]-
   166 00000044 [F112][F612][1B13]-
   166 0000004A [3613][4213][4913]-
   166 00000050 [FA12][0113][0813]-
   166 00000056 [1413][0F13][1A12]-
   166 0000005C [4E12][8D12][EA12]-
   166 00000062 [330D]310033004458-
   166 0000006A 434C53544353445345-
   166 00000073 53465347535353     
   167                                  
   168                                  
   169                                  	align 2, db 0
   170                                  disjmp_opx:
   171 0000007A [F612][A011][CD11]-     	dw DISJMP_OPXITEMS
   171 00000080 [F811][9911][1112]-
   171 00000086 [0A12][9011][6511]-
   171 0000008C [8611]             
   172                                  
   173                                  
   174                                  %if _MEMREF_AMOUNT
   175 0000008E 00<rep 2h>              	align 16, db 0
   176 00000090 00<rep 40h>             memrefs:	times MEMREF_size * _MEMREF_AMOUNT db 0
   177 000000D0 0000                    .free:		dw 0
   178                                  
   179 000000D2 00<rep 2h>              	align 4, db 0
   180                                  string_memref_counter:
   181 000000D4 00000000                		dd 0
   182                                  %endif
   183                                  
   184                                  
   185                                  ;	DISASM - Disassemble.
   186                                  
   187                                  %if _SYMBOLIC
   188                                  	align 4, db 0
   189                                  u_lin_start:	dd 0
   190                                  %endif
   191                                  	align 2, db 0
   192                                  %if _40COLUMNS
   193 000000D8 0000                    mnemonofs:	dw 0
   194 000000DA 0000                    trailofs:	dw 0
   195                                  %endif
   196 000000DC 0000                    dis_n:		dw 0		; number of bytes in instruction so far
   197 000000DE 0000                    		dw 0
   198 000000E0 00                      preflags:	db 0		; flags for prefixes found so far (includes OSIZE,ASIZE)
   199 000000E1 00                      preused:	db 0		; flags for prefixes used so far
   200                                  %if _PM
   201 000000E2 00                      presizeflags:	db 0		; O32,A32 flags = (OSIZE,ASIZE) XOR (32-bit cs?)
   202                                  %else
   203                                  presizeflags:	equ preflags	; O32,A32 flags are always equal to OSIZE,ASIZE
   204                                  %endif
   205                                  
   206                                  %if 0	; moved to debug.mac
   207                                  PRESEG	equ 1			; segment prefix
   208                                  PREREP	equ 2			; rep prefixes
   209                                  PREREPZ	equ 4			; F3h, not F2h
   210                                  PRELOCK	equ 8			; lock prefix
   211                                  PREOSIZE equ 10h		; flag for OSIZE prefix
   212                                  PREASIZE equ 20h		; flag for ASIZE prefix
   213                                  PRE32D	equ 10h			; flag for 32-bit data
   214                                  PRE32A	equ 20h			; flag for 32-bit addressing
   215                                  PREWAIT	equ 40h			; prefix wait (not really a prefix)
   216                                  GOTREGM	equ 80h			; set if we have the reg/mem part
   217                                  %endif
   218                                  
   219 000000E3 00                      instru:	db 0			; the main instruction byte
   220 000000E4 00                      disp8:	db 0
   221 000000E5 00                      gotsib:	db 0
   222                                  %if 1
   223                                  		; This handling is commented because it is never needed.
   224                                  		;  Almost all OPX operands that display the MODRM keyword
   225                                  		;  (OPX_MOD_IF_*) have a single condition per oplist, so
   226                                  		;  never need this flag. MOV 8A:F5 is the exception. But
   227                                  		;  its two OPX operands can never both show the keyword as
   228                                  		;  one needs an memoffs in the r/m and the other a reg.
   229                                  		; Update: Enabled now, for XCHG AX, MODRM AX.
   230 000000E6 00                      moddone:db 0			; whether MODRM keyword displayed yet
   231                                  %endif
   232 000000E7 00                      	align 2, db 0
   233 000000E8 0000                    index:	dw 0			; index of the instruction (unsqueezed)
   234 000000EA [0000][0100][0400]      obsinst:dw SFPGROUP3, SFPGROUP3+1, SFPGROUP3+4
   235 000000F0 [2400][2600]            	dw SPARSE_BASE+24h, SPARSE_BASE+26h ; obsolete-instruction values
   236                                  	; This is used to search for obsolete instructions:
   237                                  	; DBE0h:	feni
   238                                  	; DBE1h:	fdisi
   239                                  	; DBE4h:	fsetpm
   240                                  	; 124h:		mov trX, reg
   241                                  	; 126h:		mov reg, trX
   242                                  
   243 000000F4 00                      rmsize:	db 0			; <0 or 0 or >0 means mod r/m is 8 or 16 or 32
   244 000000F5 00                      segmnt:	db 0			; segment determined by prefix (or otherwise)
   245 000000F6 00<rep 2h>              	align 4, db 0
   246 000000F8 00000000                addrr:	dd 0			; address in mod r/m byte
   247 000000FC 0000                    savesp2:dw 0			; save the stack pointer here (used in disasm)
   248                                  
   249                                  	align 2, db 0
   250 000000FE 0000                    disflags:	dw 0		; flags for the disassembler
   251                                  
   252                                  ;--- equates for disflags:
   253                                  
   254                                  %if 0	; moved to debug.mac
   255                                  DIS_F_REPT	equ 1		; repeat after pop ss, etc.
   256                                  DIS_F_SHOW	equ 2		; show memory contents
   257                                  DIS_I_SHOW	equ 4		; there are memory contents to show
   258                                  DIS_I_UNUSED	equ 8		; (internal) print " (unused)"
   259                                  DIS_I_SHOWSIZ	equ 10h		; (internal) always show the operand size
   260                                  DIS_I_KNOWSIZ	equ 20h		; (internal) we know the operand size of instr.
   261                                  DIS_I_MOV_SS	equ 40h		; (internal) note for repetition: mov ss
   262                                  DIS_I_DONTSHOW	equ 80h		; do not show memory contents override
   263                                  DIS_I_NOSIZ	equ 100h	; do not show size
   264                                  DIS_I_FAR_M	equ 200h	; far memory reference, show segment word contents
   265                                  DIS_I_DOUBLE_M	equ 400h	; double memory reference, show second item contents
   266                                  DIS_I_SHOW_A32	equ 800h	; memory contents to show are 32-bit addressed
   267                                  DIS_I_M_SRC    equ 1000h	; memory operand is source
   268                                  DIS_I_M_DST    equ 2000h	; memory operand is destination
   269                                  				; both of the above may be set
   270                                  DIS_I_M_ALWAYS_16 equ 4000h	; mov from or to segreg, display no size
   271                                  				;  and treat as m16 and ignore (but allow) osize
   272                                  %endif
   273                                  
   274 00000100 00                      disflags2:	db 0		; another copy of DIS_I_KNOWSIZ
   275 00000101 00                      disrepeatcount:	db 0
   276                                  
   277                                  	align 2, db 0
   278 00000102 0000                    sizeloc:	dw 0		; address of size words in output line
   279                                  uu_a32_size_byte_keyword:
   280 00000104 0000                    		dw 0
   281                                  uu_a32_size_dword_keyword:
   282 00000106 0000                    		dw 0
   283                                  %if _COND
   284 00000108 0000                    condmsg:	dw 0		; -> conditionals message to display (if R and no mem)
   285                                  %endif
   286                                  
   287                                  		; Jump table for a certain place.
   288                                  		; The size of this table matches OPTYPES_BASE.
   289                                  	align 2, db 0
   290                                  disjmp:
   291 0000010A [6913]                  	dw disbad		; illegal instruction
   292 0000010C [8901]                  	dw da_twobyte		; two-byte instruction
   293 0000010E [9501]                  	dw da_insgrp		; instruction group
   294 00000110 [9C01]                  	dw da_fpuins		; coprocessor instruction
   295 00000112 [B701]                  	dw da_fpugrp		; coprocessor instruction group
   296 00000114 [C001]                  	dw da_insprf		; instruction prefix (including 66h/67h)
   297                                  %ifn _LINK
   298                                  %if ($ - disjmp) != OPTYPES_BASE
   299                                   %error Wrong length of table disjmp
   300                                  %endif
   301                                  %endif
   302                                  
   303                                  		; Table for 16-bit mod r/m addressing.  8 = BX, 4 = BP, 2 = SI, 1 = DI.
   304 00000116 0A09060502010408        rmtab:		db 8+2, 8+1, 4+2, 4+1, 2, 1, 4, 8
   305                                  
   306                                  
   307                                  	align 2, db 0
   308 0000011E [0000][0000][0000]-     reg32addr:	dw reg_eax, reg_ecx, reg_edx, reg_ebx
   308 00000124 [0000]             
   309 00000126 [0000][0000][0000]-     		dw reg_esp, reg_ebp, reg_esi, reg_edi
   309 0000012C [0000]             
   310                                  
   311                                  	align 2, db 0
   312 0000012E [0000][0000][0000]-     segrgaddr:	dw reg_es,reg_cs,reg_ss,reg_ds,reg_fs,reg_gs
   312 00000134 [0000][0000][0000] 
   313                                  
   314                                  ;	Tables for handling of named prefixes.
   315                                  
   316                                  prefixlist:
   317 0000013A 262E363E                .segment:	db 26h,2Eh,36h,3Eh
   318                                  %ifdef MN_GS
   319 0000013E 6465                    		db 64h,65h			; segment prefixes (in order)
   320                                  %endif
   321                                  .after_segment:
   322 00000140 9BF0F2F3                		db 9Bh,0F0h,0F2h,0F3h		; WAIT,LOCK,REPNE,REPE
   323                                  .size:
   324                                  %ifdef MN_O32
   325 00000144 6667                    		db 066h,067h			; OSIZE, ASIZE
   326                                  %endif
   327                                  N_PREFIX:	equ $ - prefixlist
   328                                  
   329                                  	align 2, db 0
   330 00000146 [0000][0000][0000]-     prefixmnem:	dw MN_WAIT,MN_LOCK,MN_REPNE,MN_REPE
   330 0000014C [0000]             
   331                                  %ifdef MN_O32
   332 0000014E [0000][0000]            		dw MN_O32,MN_A32	; in 16-bit CS, OSIZE is O32 and ASIZE is A32
   333                                   %if _PM
   334 00000152 [0000][0000]            		dw MN_O16,MN_A16	; in 32-bit CS, OSIZE is O16 and ASIZE is A16
   335                                   %endif
   336                                  %endif
   337                                  
   338                                  %if _COND
   339                                  	align 2, db 0
   340                                  cond_table:
   341 00000156 0008                    	dw 800h			; OF
   342 00000158 0100                    	dw 1			; CF
   343 0000015A 4000                    	dw 40h			; ZF
   344 0000015C 4100                    	dw 41h			; CF | ZF
   345 0000015E 8000                    	dw 80h			; SF
   346 00000160 0400                    	dw 4			; PF
   347                                  ;	dw cond_L_GE	; handled specifically
   348                                  ;	dw cond_LE_G	; handled specifically
   349                                  %endif
   350                                  
   351                                  single_byte_opcodes_repeat_disassembly:
   352                                  .:
   353 00000162 E6                      	db 0E6h		; out imm8, al
   354 00000163 E7                      	db 0E7h		; out imm8, (e)ax
   355 00000164 EE                      	db 0EEh		; out dx, al
   356 00000165 EF                      	db 0EFh		; out dx, (e)ax
   357 00000166 6E                      	db 06Eh		; outsb
   358 00000167 6F                      	db 06Fh		; outsw/outsd
   359 00000168 E4                      	db 0E4h		; in al, imm8
   360 00000169 E5                      	db 0E5h		; in (e)ax, imm8
   361 0000016A EC                      	db 0ECh		; in al, dx
   362 0000016B ED                      	db 0EDh		; in (e)ax, dx
   363 0000016C 6C                      	db 06Ch		; insb
   364 0000016D 6D                      	db 06Dh		; insw/insd
   365 0000016E F4                      	db 0F4h		; hlt
   366 0000016F FB                      	db 0FBh		; sti
   367 00000170 17                      	db 17h		; pop ss
   368                                  .length: equ $ - .
   369 00000171 1F                      	db 1Fh		; pop ds
   370 00000172 07                      	db 07h		; pop es
   371                                  .length_nec: equ $ - .
   372                                  
   373                                  
   374                                  	usesection lDEBUG_CODE
   374          ------------------       note: usesection lDEBUG_CODE
   375                                  
   376                                  disasm: section_of_function
   377 000000BE C606[0101]00            	mov byte [disrepeatcount], 0	; number of repeated disassembly lines
   378                                  
   379                                  %if _MEMREF_AMOUNT
   380 000000C3 B90400                  	mov cx, _MEMREF_AMOUNT
   381 000000C6 BF[9000]                	mov di, memrefs
   382                                  @@:
   383 000000C9 E8130F                  	call init_one_memref
   384 000000CC E2FB                    	loop @B
   385 000000CE AB                      	stosw				; memrefs.free
   386                                  %endif
   387                                  
   388                                  .preserve_disrepeatcount:
   389                                  %if _COND
   390 000000CF 8326[0801]00            	and word [condmsg], 0		; initialize conditions message
   391                                  %endif
   392                                  .preserve_condmsg_and_disrepeatcount:
   393 000000D4 8926[FC00]              	mov word [savesp2], sp
   394 000000D8 66                      	_386_PM_o32		; xor eax, eax
   395 000000D9 31C0                    	xor ax, ax
   396 000000DB 66                      	_386_PM_o32		; mov dword [dis_n], eax
   397 000000DC A3[DC00]                	mov word [dis_n], ax
   398 000000DF A3[E400]                	mov word [disp8], ax		; clear disp8 and gotsib
   399 000000E2 A3[E000]                	mov word [preflags], ax		; clear preflags and preused
   400 000000E5 A3[0401]                	mov word [uu_a32_size_byte_keyword], ax
   401 000000E8 A3[0601]                	mov word [uu_a32_size_dword_keyword], ax
   402                                  %if 1
   403 000000EB A2[E600]                	mov byte [moddone], al
   404                                  %endif
   405 000000EE C706[F400]8003          	mov word [rmsize], 0380h	; rmsize = 80h don't display any memory,
   406                                  					; segmnt = 3 initially use DS segment
   407                                  %if rmsize + 1 != segmnt
   408                                   %error Unexpected layout
   409                                  %endif
   410 000000F4 A3[0000]                	mov	word [dismach], ax	; no special machine needed, so far
   411 000000F7 8B1E[0400]              	mov bx, word [u_addr + saSegSel]
   412                                  %if _PM
   413 000000FB A2[0000]                	mov byte [bCSAttr], al
   414                                   %if _DISASM_32BIT
   415 000000FE E8(0000)                	call test_d_b_bit
   416 00000101 7405                    	jz .16
   417 00000103 C606[0000]40            	mov byte [bCSAttr], 40h
   418                                  .16:
   419                                   %endif
   420                                  %endif
   421                                  %if _40COLUMNS
   422 00000108 B81C00                  	mov ax, MNEMONOFS
   423 0000010B BA4F00                  	mov dx, 79
   424                                   %if _MS_MNEMON_COMPAT
   425 0000010E F606[0100]04            	testopt [asm_options], disasm_msdebug_mnemonofs
   426 00000113 7403                    	jz .notms
   427 00000115 B81800                  	mov ax, MNEMONOFS_MS
   428                                  .notms:
   429                                   %endif
   430 00000118 F606[0100]01            	testopt [asm_options], disasm_40_columns
   431 0000011D 7406                    	jz .not40
   432 0000011F B81400                  	mov ax, MNEMONOFS_40
   433 00000122 BA2700                  	mov dx, 39
   434                                  .not40:
   435 00000125 A3[D800]                	mov word [mnemonofs], ax
   436 00000128 8916[DA00]              	mov word [trailofs], dx
   437                                  %endif
   438                                  
   439                                  %if _SYMBOLIC
   440                                  	nearcall zz_detect_xms		; re-detect XMS if used after run
   441                                  
   442                                  	testopt [internalflags3], dif3_nosymbols_1 | dif3_nosymbols_2
   443                                  	jnz .no_symbol
   444                                  
   445                                  	_386_PM_o32
   446                                  	mov dx, word [u_addr]
   447                                  	call getlinear_32bit
   448                                  	jc .no_symbol
   449                                  
   450                                  	mov word [u_lin_start], ax
   451                                  	mov word [u_lin_start + 2], dx
   452                                  
   453                                  	mov cx, dx
   454                                  	mov bx, ax
   455                                  	nearcall binsearchmain		; search for matching symbol
   456                                  	jcxz .no_symbol
   457                                  .loop_symbol:
   458                                  	 push bx
   459                                  	dualcall displaystring
   460                                  	 push bx
   461                                  	 push ax
   462                                  	dualcall getfarpointer.main
   463                                  	 pop di
   464                                  	 pop es
   465                                  	xor dx, dx
   466                                  _386_PM	test byte [bCSAttr], 40h
   467                                  _386_PM	jz @F
   468                                  _386_PM	mov dx, word [u_addr + 2]
   469                                  @@:
   470                                  	mov ax, word [u_addr]
   471                                  	cmp dx, word [es:di + smOffset + 2]
   472                                  	mov dx, msg.uu_after_symbol.non_wrt
   473                                  	jne .wrt_symbol
   474                                  	cmp ax, word [es:di + smOffset]
   475                                  	je .non_wrt_symbol
   476                                  .wrt_symbol:
   477                                  	mov dx, msg.uu_between_symbol.wrt
   478                                  	call disp_message
   479                                  	push ss
   480                                  	pop es
   481                                  	mov di, line_out
   482                                  	mov ax, word [u_addr + 4]
   483                                  	call hexword
   484                                  	push bx
   485                                  	push cx
   486                                  	call putsline
   487                                  	pop cx
   488                                  	pop bx
   489                                  	mov dx, msg.uu_after_symbol.wrt
   490                                  .non_wrt_symbol:
   491                                  	call disp_message
   492                                  .next_symbol:
   493                                  	inc bx
   494                                  	loop .loop_symbol
   495                                  
   496                                  .no_symbol:
   497                                  	push ss
   498                                  	pop es
   499                                  	push ss
   500                                  	pop ds
   501                                  %endif
   502                                  
   503 0000012C E84214                  	call disgetbyte			; get a byte of the instruction
   504 0000012F 3C9B                    	cmp	al, 9Bh			; wait instruction (must be the first prefix)
   505 00000131 7508                    	jne	da2			; if not -->
   506                                  
   507                                  ;	The wait instruction is actually a separate instruction as far as
   508                                  ;	the x86 is concerned, but we treat it as a prefix since there are
   509                                  ;	some mnemonics that incorporate it.  But it has to be treated specially
   510                                  ;	since you can't do, e.g., seg cs wait ... but must do wait seg cs ...
   511                                  ;	instead.  We'll catch it later if the wait instruction is not going to
   512                                  ;	be part of a shared mnemonic.
   513                                  
   514 00000133 800E[E000]40            	or byte [preflags], PREWAIT
   515                                  
   516                                  ;	If we've found a prefix, we return here for the actual instruction
   517                                  ;	(or another prefix).
   518                                  
   519                                  da1:
   520 00000138 E83614                  	call disgetbyte
   521                                  da2:
   522 0000013B A2[E300]                	mov	[instru],al	; save away the instruction
   523 0000013E B400                    	mov	ah,0
   524                                  
   525                                  ;	Now we have the sequence number of the instruction in AX.  Look it up.
   526                                  
   527                                  da3:
   528 00000140 89C3                    	mov	bx,ax
   529 00000142 A3[E800]                	mov	[index],ax	; save the compressed index
   530 00000145 3D[0000]                	cmp	ax,SPARSE_BASE
   531 00000148 720A                    	jb	da4		; if it's not from the squeezed part of the table
   532                                   %if _LINK
   533 0000014A 8A9F[0000]              	mov	bl,[word sqztab+bx]
   534                                   wlcalc word_minusext_SPARSE_BASE, equ $ - 2
   535                                   %else
   536                                  	mov	bl,[sqztab+bx-SPARSE_BASE]
   537                                   %endif
   538 0000014E B700                    	mov	bh,0
   539 00000150 81C3[0000]              	add	bx,SPARSE_BASE	; bx = compressed index
   540                                  
   541                                  da4:
   542 00000154 8A8F[0000]              	mov	cl, [optypes+bx]; cx = opcode type
   543 00000158 B500                    	mov	ch, 0
   544 0000015A D1E3                    	shl	bx, 1
   545 0000015C 8B9F[0000]              	mov	bx, [opinfo+bx]	; bx = other info (usually the mnemonic)
   546 00000160 89CE                    	mov	si, cx
   547 00000162 89D8                    	mov	ax, bx
   548 00000164 B10C                    	mov	cl, 12
   549 00000166 D3E8                    	shr	ax, cl
   550 00000168 3A06[0000]              	cmp	al, [dismach]
   551 0000016C 7203                    	jb	da5		; if a higher machine is already required
   552 0000016E A2[0000]                	mov	[dismach], al	; set machine type
   553                                  da5:
   554 00000171 80E70F                  	and	bh, 0Fh		; remove the machine field
   555                                  %if _LINK_COMPAT
   556 00000174 81FE[0000]              	cmp	si, strict word OPTYPES_BASE
   557                                  %else
   558                                  	cmp	si, OPTYPES_BASE
   559                                  %endif
   560 00000178 7360                    	jae	da13_unp	; if this is an actual instruction
   561 0000017A F7C60100                	test si, 1		; check whether valid displacement
   562 0000017E 7403E9FA00              	jnz da_internal_error	; if not -->
   563 00000183 FF94[0A01]              	call [disjmp+si]	; otherwise, do more specific processing
   564 00000187 EBB7                    	jmp s	da3		; back for more
   565                                  
   566                                  ;	Two-byte instruction.
   567                                  
   568                                  da_twobyte:
   569 00000189 E8E513                  	call disgetbyte
   570 0000018C A2[E300]                	mov	[instru],al
   571 0000018F B400                    	mov	ah,0
   572 00000191 05[0000]                	add	ax,SPARSE_BASE
   573 00000194 C3                      	ret
   574                                  
   575                                  ;	Instruction group.
   576                                  
   577                                  da_insgrp:
   578 00000195 E83B12                  	call getregmem_r	; get the middle 3 bits of the R/M byte
   579 00000198 98                      	cbw
   580 00000199 01D8                    	add	ax,bx		; offset
   581 0000019B C3                      	ret
   582                                  
   583                                  ;	Coprocessor instruction.
   584                                  
   585                                  da_fpuins:
   586 0000019C 800E[FE00]10            	or	byte [disflags],DIS_I_SHOWSIZ
   587 000001A1 800E[0000]01            	or	byte [dmflags],DM_COPR
   588 000001A6 E83412                  	call getregmem
   589 000001A9 3CC0                    	cmp	al,0c0h
   590 000001AB 72E8                    	jb	da_insgrp	;range 00-bfh is same as an instruction group
   591 000001AD B103                    	mov	cl,3
   592 000001AF D2E8                    	shr	al,cl		;C0h --> 18h
   593 000001B1 2C10                    	sub	al,18h-8	;18h --> 8
   594 000001B3 98                      	cbw
   595 000001B4 01D8                    	add	ax,bx		;offset
   596 000001B6 C3                      	ret
   597                                  
   598                                  ;	Coprocessor instruction group.
   599                                  
   600                                  da_fpugrp:
   601 000001B7 A0[0000]                	mov	al,[regmem]
   602 000001BA 2407                    	and	al,7
   603 000001BC 98                      	cbw
   604 000001BD 01D8                    	add	ax,bx
   605 000001BF C3                      	ret
   606                                  
   607                                  ;	Instruction prefix.  At this point, bl = prefix bits; bh = segment
   608                                  
   609                                  da_insprf:
   610 000001C0 841E[E000]              	test bl,[preflags]
   611 000001C4 7511                    	jnz	da12		; if there are duplicates
   612 000001C6 081E[E000]              	or [preflags],bl
   613 000001CA F6C301                  	test bl,PRESEG
   614 000001CD 7404                    	jz	da11		; if not a segment
   615 000001CF 883E[F500]              	mov	[segmnt],bh	; save the segment
   616                                  da11:
   617 000001D3 58                      	pop	ax		; discard return address
   618 000001D4 E961FF                  	jmp	da1
   619                                  
   620                                  da12:
   621 000001D7 E98F11                  	jmp	disbad		; we don't allow duplicate prefixes
   622                                  
   623                                  	; si = index into table opindex, + OPTYPES_BASE
   624                                  da13_unp:
   625                                  %if _LINK_COMPAT
   626 000001DA 81EE[0000]              	sub si, strict word OPTYPES_BASE
   627                                  %else
   628                                  	sub si, OPTYPES_BASE	; = offset into opindex
   629                                  %endif
   630 000001DE 31C0                    	xor ax, ax
   631 000001E0 8A84[0000]              	mov al, [si + opindex]	; ax = adjustment (from opindex)
   632 000001E4 01F6                    	add si, si		; take offset twice
   633 000001E6 4E                      	dec si			; subtract one
   634 000001E7 01C6                    	add si, ax		; add in the adjustment
   635                                  
   636                                  ;	OK.  Here we go.  This is an actual instruction.
   637                                  ;	bx = offset of mnemonic in mnlist
   638                                  ;	si = offset of operand list in oplists
   639                                  ;	First print the op mnemonic.
   640                                  
   641                                  da13:
   642                                  %if _PM
   643 000001E9 A0[E000]                	mov al, byte [preflags]
   644 000001EC 2430                    	and al, PREOSIZE | PREASIZE	; get OSIZE,ASIZE status (= O32,A32 in 16-bit cs)
   645                                   %if _DISASM_32BIT
   646 000001EE F606[0000]40            _386	test byte [bCSAttr], 40h	; in a 32-bit segment?
   647 000001F3 7402                    _386	jz .16				; no -->
   648 000001F5 3430                    _386	xor al, PRE32D | PRE32A		; OSIZE,ASIZE present means O16,A16
   649                                  .16:
   650                                   %endif
   651 000001F7 A2[E200]                	mov byte [presizeflags], al	; set O32,A32 status
   652                                  %endif
   653 000001FA 56                      	push si
   654 000001FB 8DB7[0000]              	lea	si,[mnlist+bx]	; offset of mnemonic
   655                                  %ifdef MN_BSWAP
   656                                   %if _LINK
   657 000001FF 81FE[0000]              	cmp	si, strict word mnlist
   658                                   wlcalc word_ext_MN_BSWAP, equ $ - 2
   659                                   %else
   660                                  	cmp	si,mnlist+MN_BSWAP
   661                                   %endif
   662 00000203 7505                    	jne	da13a		; if not BSWAP
   663 00000205 E8F912                  	call dischk32d
   664 00000208 74CD                    	jz	da12		; if no operand-size prefix -->
   665                                  %endif
   666                                  da13a:
   667 0000020A E81812                  	call showop		; print out the op code (at line_out+28)
   668 0000020D 8326[0201]00            	and word [sizeloc], 0	; clear out this flag
   669 00000212 5E                      	pop si			; recover list of operands (offset in oplists)
   670 00000213 81C6[0000]              	add si, oplists		; -> actual oplist entry
   671                                  
   672                                  da14_check_end:
   673 00000217 803C00                  	cmp byte [si], OP_END
   674 0000021A 7503E98E00              	je da_op_end_e		; if we're done -->
   675                                  
   676                                  ;	Loop over operands.  si-> next operand type.
   677                                  ;	Fortunately the operands appear in the instruction in the same
   678                                  ;	order as they appear in the disassembly output.
   679                                  
   680                                  da14:
   681 0000021F C606[0001]00            	mov byte [disflags2], 0	; clear out size-related flags
   682 00000224 AC                      	lodsb			; get the operand type
   683 00000225 3C40                    	cmp	al,OP_SIZE
   684 00000227 7263                    	jb	da18		; if it's not size dependent
   685 00000229 C606[0001]20            	mov	byte [disflags2],DIS_I_KNOWSIZ	;indicate variable size
   686 0000022E 3CB0                    	cmp	al,OP_1632_DEFAULT_ASM
   687 00000230 7323                    	jae	da15
   688 00000232 3CA0                    	cmp	al,OP_1632_DEFAULT
   689 00000234 7313                    	jae	da15_default
   690 00000236 3C60                    	cmp	al,OP_8
   691 00000238 7329                    	jae	da16		; if the size is fixed (8, 16, 32, 64)
   692 0000023A 3C50                    	cmp	al,OP_1632
   693 0000023C 7317                    	jae	da15		; if word or dword (or segreg mov)
   694                                  		; OP_ALL here. This has a width of 2.
   695                                  		;  If the low bit is clear, this means
   696                                  		;  8 bit, else 16/32 bits.
   697 0000023E B4FF                    	mov	ah,-1
   698 00000240 F606[E300]01            	test byte [instru],1
   699 00000245 7424                    	jz	da17		; if byte -->
   700 00000247 EB0C                    	jmp da15
   701                                  
   702                                  da15_default:
   703                                   %if _DISASM_32BIT
   704 00000249 F606[E000]10            	test byte [preflags], PREOSIZE
   705 0000024E 7505                    	jnz da15
   706                                   %endif
   707 00000250 800E[FF00]01            	setopt [disflags], DIS_I_NOSIZ
   708                                  da15:
   709 00000255 800E[E100]10            	or byte [preused],PRE32D; mark this flag as used
   710                                  .no_use_osize:
   711 0000025A 8A26[E200]              	mov	ah,[presizeflags]
   712 0000025E 80E410                  	and	ah,PRE32D	;this will be 10h for dword, 00h for word
   713 00000261 EB08                    	jmp s	da17		;done
   714                                  
   715                                  da16:
   716 00000263 88C4                    	mov	ah,al		;OP_8, OP_16, OP_32 or OP_64 (we know which)
   717 00000265 80E4F0                  	and	ah,0f0h		;this converts ah to <0 for byte, =0 for word,
   718 00000268 80EC70                  	sub	ah,OP_16	;and >0 for dword (byte=F0h, word=00h, dword=10h, qword=20h)
   719                                  
   720                                  ;	Now we know the size (in ah); branch off to do the operand itself.
   721                                  
   722                                  da17:
   723 0000026B 88C3                    	mov bl, al
   724 0000026D 83E30F                  	and bx, 0Fh		; 8 entries (IMM, RM, M, R_MOD, M_OFFS, R, R_ADD, AX)
   725 00000270 D1E3                    	shl bx, 1
   726 00000272 83FB12                  	cmp bx, disjmp2.end - disjmp2
   727 00000275 7306                    	jae @F
   728 00000277 FF97[0000]              	call [disjmp2 + bx]	; print out the operand
   729 0000027B EB2D                    	jmp short da20		; done with operand
   730                                  
   731                                  @@:
   732                                  da_internal_error:
   733 0000027D B80E01                  	mov ax, 010Eh
   734 00000280 E8(0000)                	call setrc
   735 00000283 BA[0000]                	mov dx, msg.uu_internal_error
   736 00000286 E8(0000)                	call putsz
   737 00000289 E9(0000)                	jmp cmd3
   738                                  
   739                                  
   740                                  ;	Sizeless operands.
   741                                  
   742                                  da18:
   743 0000028C 98                      	cbw
   744 0000028D 93                      	xchg ax, bx		; bx = index
   745 0000028E D1E3                    	shl bx, 1
   746 00000290 8B87[1200]              	mov ax, [optab + bx]
   747 00000294 83FB52                  	cmp bx, OP_FIRST_STRING << 1
   748 00000297 720F                    	jb	da19		; if it's not a string
   749 00000299 83FB68                  	cmp bx, OP_AFTER_LAST << 1
   750 0000029C 73DF                    	jae @B
   751 0000029E E8ED11                  	call	dis_stosw_lowercase
   752 000002A1 84E4                    	test	ah, ah
   753 000002A3 7505                    	jnz	da20		; if it's two characters
   754 000002A5 4F                      	dec	di
   755 000002A6 EB02                    	jmp s	da20		; done with operand
   756                                  
   757                                  da19:
   758 000002A8 FFD0                    	call ax			; otherwise, do something else
   759                                  
   760                                  		; Operand done, check if there's another one.
   761                                  da20:
   762 000002AA 803C00                  	cmp	byte [si], OP_END
   763                                  da_op_end_e:
   764 000002AD 7410                    	je da_op_end		; if we're done -->
   765 000002AF B02C                    	mov	al,','
   766 000002B1 AA                      	stosb
   767 000002B2 F606[0000]02            	testopt [asm_options], disasm_commablank
   768 000002B7 7403                    	jz .nospace
   769 000002B9 B020                    	mov al, 32
   770 000002BB AA                      	stosb
   771                                  .nospace:
   772 000002BC E960FF                  	jmp	da14		;another operand
   773                                  
   774                                  
   775                                  		; All operands done. Now handle prefixes:
   776                                  		; OPSIZE (66h), ADDRSIZE (67h), WAIT, segment, REP, LOCK
   777                                  da_op_end:
   778                                  
   779                                  		; Now check whether O32 or A32 modifies the opcode.
   780                                  da_modify_opcode_osize_asize:
   781                                   %if _DISASM_32BIT
   782 000002BF B9[0000]                	mov	cx, N_LTABO
   783 000002C2 BB[0000]                	mov	bx, ltabo1
   784                                  %ifn _LINK
   785                                  	mov	dx, 2*N_LTABO-2
   786                                  %else
   787 000002C5 BA[FEFF]                	mov	dx, N_LTABO-2
   788                                   wlcalc word_ext_N_LTABO, equ $ - 2
   789                                  %endif
   790 000002C8 B410                    	mov	ah, PRE32D
   791 000002CA E8A600                  	call da23_osize_asize
   792                                  
   793 000002CD B9[0000]                	mov	cx, N_LTABA
   794 000002D0 BB[0000]                	mov	bx, ltaba1
   795                                  %ifn _LINK
   796                                  	mov	dx, 2*N_LTABA-2
   797                                  %else
   798 000002D3 BA[FEFF]                	mov	dx, N_LTABA-2
   799                                   wlcalc word_ext_N_LTABA, equ $ - 2
   800                                  %endif
   801 000002D6 B420                    	mov	ah, PRE32A
   802 000002D8 E89800                  	call da23_osize_asize
   803                                  %endif
   804                                  
   805                                  		; Now check and loop for unused prefixes.
   806                                  da21:
   807 000002DB A0[E100]                	mov	al, [preused]	; = flags that are used
   808 000002DE F6D0                    	not	al		; = flags that are not used
   809 000002E0 2206[E000]              	and	al, [preflags]	; = flags that are not used but present
   810 000002E4 7503E96801              	jz	da28		; if all present flags were used -->
   811                                  
   812 000002E9 B9[0000]                	mov	cx, N_WTAB
   813 000002EC BB[0000]                	mov	bx, wtab1
   814                                  %ifn _LINK
   815                                  	mov	dx, 2*N_WTAB-2
   816                                  %else
   817 000002EF BA[FEFF]                	mov	dx, N_WTAB-2
   818                                   wlcalc word_ext_N_WTAB, equ $ - 2
   819                                  %endif
   820 000002F2 B440                    	mov	ah, PREWAIT
   821 000002F4 84E0                    	test	al, ah
   822 000002F6 740A                    	jz @F
   823                                  				; if there's a WAIT prefix hanging
   824 000002F8 E87400                  	call da23_wait
   825 000002FB 7403E99A00              	jne disbad2
   826 00000300 EBD9                    	jmp da21
   827                                  
   828                                  @@:
   829                                   %if _DISASM_32BIT
   830 00000302 B420                    	mov	ah, PREASIZE
   831 00000304 84E0                    	test	al, ah
   832 00000306 7518                    	jnz	da21_asize	; if it is a 67h prefix -->
   833                                  
   834 00000308 B410                    	mov ah, PREOSIZE
   835 0000030A 84E0                    	test al, ah
   836 0000030C 7503E98C00              	jz da24			; if not osize -->
   837                                  da21_osize:
   838                                  		; check whether OSIZE applies (segreg push/pop)
   839 00000311 57                      	push di
   840 00000312 50                      	push ax
   841 00000313 A1[E800]                	mov ax, [index]
   842                                  %if 0
   843                                  	mov di, .msg_number
   844                                  	call hexword
   845                                  	push dx
   846                                  	mov dx, .msg
   847                                  	call putsz
   848                                  	pop dx
   849                                  	jmp .skipmsg
   850                                  	usesection lDEBUG_DATA_ENTRY
   851                                  .msg:	db "Index="
   852                                  .msg_number:
   853                                  	asciz "----h, base=",_4digitshex(SPARSE_BASE),"h.",13,10
   854                                  	usesection lDEBUG_CODE
   855                                  .skipmsg:
   856                                  %endif
   857 00000316 BF[0000]                	mov di, o32prfxtab
   858 00000319 B9[0000]                	mov cx, O32P_AMOUNT
   859 0000031C F2AF                    	repne scasw
   860 0000031E EB16                    	jmp da21_a_o_common
   861                                  
   862                                  da21_asize:
   863                                  		; check whether ASIZE applies to an implicit operand
   864 00000320 57                      	push	di
   865 00000321 50                      	push	ax
   866 00000322 A1[E800]                	mov	ax, [index]
   867 00000325 84E4                    	test	ah, ah
   868 00000327 750D                    	jnz	da21_nota32prfx_nz
   869                                  				; opcode index > FF, not in this list -->
   870 00000329 BF[0000]                	mov	di, a32prfxtab
   871 0000032C AE                      	scasb			; xlatb ?
   872 0000032D 7407                    	je	@F		; yes --> (ZR)
   873 0000032F 24FE                    	and	al, ~1		; clear the low bit (MOVSW -> MOVSB)
   874 00000331 B9[FFFF]                	mov	cx, A32P_LEN - 1
   875 00000334 F2AE                    	repne	scasb		; scan table (low bit cleared)
   876                                  @@:
   877                                  da21_a_o_common:
   878                                  da21_nota32prfx_nz:
   879 00000336 58                      	pop	ax
   880 00000337 5F                      	pop	di
   881 00000338 7560                    	jne	da21_notprfx	; not in the list -->
   882                                  
   883 0000033A 0826[E100]              	or	[preused], ah	; mark it as used
   884 0000033E B104                    	mov	cl, 4		; (ch = 0 because A32P_LEN / O32P_AMOUNT < 256)
   885                                  %ifn _LINK
   886                                  %if A32P_LEN > 255 || O32P_AMOUNT > 255
   887                                   %error Remove optimisation
   888                                  %endif
   889                                  %endif
   890 00000340 E88012                  	call	moveover	; make space for "A32 " (or a16, osize)
   891 00000343 50                      _386_PM	push ax
   892 00000344 80FC10                  	cmp ah, PREOSIZE	; is it OSIZE ?
   893 00000347 B84133                  	mov	ax, "A3"	;  start of "A32"
   894 0000034A 7502                    	jne @F			; no -->
   895 0000034C B04F                    	mov al, 'O'		; make it OSIZE (O32/O16)
   896                                  @@:
   897 0000034E E8A910                  	call	dis_lowercase	; al = "a"/"o" if lowercase option specified
   898                                  %if _40COLUMNS
   899 00000351 8B36[D800]              	mov si, word [mnemonofs]
   900 00000355 8984[0000]              	mov	word [line_out + si], ax
   901 00000359 C784[0200]3220          	mov	word [line_out + si + 2], "2 "
   902                                  				; trail of A32/O32
   903 0000035F 58                      _386_PM	pop ax
   904 00000360 8426[E200]              _386_PM	test byte [presizeflags], ah
   905                                  _386_PM				; do we have 32-bit ASIZE/OSIZE ?
   906 00000364 7506                    _386_PM	jnz da21_j0		; yes, keep a32/o32 (in 16-bit cs) -->
   907 00000366 C784[0100]3136          _386_PM	mov word [line_out + si + 1], "16"
   908                                  				; no, make it a16/o16 (in 32-bit cs)
   909                                  %else
   910                                  	mov	word [line_out+MNEMONOFS], ax
   911                                  	mov	word [line_out+MNEMONOFS+2], "2 "
   912                                  				; trail of A32/O32
   913                                  _386_PM	pop ax
   914                                  _386_PM	test byte [presizeflags], ah
   915                                  _386_PM				; do we have 32-bit ASIZE/OSIZE ?
   916                                  _386_PM	jnz da21_j0		; yes, keep a32/o32 (in 16-bit cs) -->
   917                                  _386_PM	mov word [line_out + MNEMONOFS + 1], "16"
   918                                  				; no, make it a16/o16 (in 32-bit cs)
   919                                  %endif
   920                                   %else
   921                                  	jmp da24
   922                                   %endif
   923                                  
   924                                  da21_j0:
   925 0000036C E96CFF                  	jmp da21
   926                                  
   927                                  da21_notprfx: equ disbad2
   928                                  
   929                                  
   930                                  da23_osize_asize: equ da23
   931                                  
   932                                  da23_wait:
   933                                  %if _PM
   934 0000036F 0826[E200]              	or byte [presizeflags], ah
   935                                  		; Fake that this flag is set for da23's check.
   936                                  		;  If not _PM then presizeflags == preflags and
   937                                  		;  PREWAIT is already set in that variable.
   938                                  %endif
   939                                  
   940                                  		; INP:	bx -> array of words to match against word [index]
   941                                  		;	cx = number of array entries
   942                                  		;	ah = preused flag to mark as used if match
   943                                  		;	ah = presizeflags flag to check if in use
   944                                  		;	dx = offset to add to di -> behind matched word
   945                                  		; OUT:	ZR if one of the array entries matched,
   946                                  		;	 byte [preused] |= INP:ah
   947                                  		;	 if also flag in byte [presizeflags] was set,
   948                                  		;	  mnemonic replaced
   949                                  		;	NZ if no entry matched
   950                                  		; CHG:	ax, cx, si
   951                                  		;
   952                                  		; Note:	If this is called with a 32-bit CS then the
   953                                  		;	 OSIZE/ASIZE value in the byte [preflags] is
   954                                  		;	 inverted to that in the byte [presizeflags].
   955                                  		;	As we check the latter, for O16/A16 we will
   956                                  		;	 not modify the mnemonics (keeping the 16-bit
   957                                  		;	 default mnemonics) but will mark the prefix
   958                                  		;	 as used by setting the flag in byte [preused].
   959                                  		;	If there is no OSIZE/ASIZE in 32-bit CS then
   960                                  		;	 the preused flag is also set (which does no
   961                                  		;	 harm) and the 32-bit mnemonic is selected.
   962                                  		;	Operation in 16-bit CS has the same result as
   963                                  		;	 the prior handling, though it will always
   964                                  		;	 scan for the affected opcodes, and set the
   965                                  		;	 preused flag even if no prefix is used.
   966                                  da23:
   967 00000373 57                      	push di
   968 00000374 89DF                    	mov di, bx
   969 00000376 50                      	 push ax
   970 00000377 0C01                    	or al, 1		; NZ, in case cx == 0
   971 00000379 A1[E800]                	mov ax, [index]
   972 0000037C F2AF                    	repne scasw
   973 0000037E 58                      	 pop ax
   974 0000037F 7517                    	jne .ret		; if not found in the list --> (NZ)
   975 00000381 0826[E100]              	or byte [preused], ah	; mark this (OSIZE, ASIZE or WAIT) prefix as used
   976 00000385 8426[E200]              	test byte [presizeflags], ah
   977                                  				; is it O32, A32, or is WAIT present ?
   978 00000389 740D                    	jz .ret			; no, do not modify mnemonic -->
   979 0000038B 01D7                    	add di, dx		; replace the mnemonic with the modified name
   980 0000038D 8B35                    	mov si, [di]
   981 0000038F 81C6[0000]              	add si, mnlist
   982 00000393 E88F10                  	call showop		; copy instruction mnemonic
   983 00000396 38C0                    	cmp al, al		; ZR
   984                                  .ret:
   985 00000398 5F                      	pop di
   986 00000399 C3                      	retn
   987                                  
   988                                  
   989                                  da21_j1: equ da21_j0
   990                                  
   991                                  disbad2:
   992 0000039A E9CC0F                  	jmp	disbad
   993                                  
   994                                  da24:
   995 0000039D A801                    	test	al, PRESEG
   996 0000039F 7438                    	jz	da25		; if not because of a segment prefix -->
   997 000003A1 A1[E800]                	mov	ax, [index]
   998 000003A4 84E4                    	test	ah, ah
   999 000003A6 75F2                    	jnz	disbad2		; if index > 256, it's none of these -->
  1000 000003A8 57                      	push	di
  1001 000003A9 B9[0000]                	mov	cx, SEGP_LEN
  1002 000003AC BF[0000]                	mov	di, segprfxtab
  1003 000003AF F2AE                    	repne	scasb
  1004 000003B1 5F                      	pop	di
  1005 000003B2 75E6                    	jne	disbad2		; if it's not on the list -->
  1006 000003B4 B90300                  	mov	cx, 3
  1007 000003B7 E80912                  	call	moveover
  1008 000003BA 57                      	push	di
  1009                                  %if _40COLUMNS
  1010 000003BB BF[0000]                	mov di, line_out
  1011 000003BE 033E[D800]              	add di, word [mnemonofs]
  1012                                  %else
  1013                                  	mov	di, line_out+MNEMONOFS
  1014                                  %endif
  1015 000003C2 E8C610                  	call	showseg		; show segment register
  1016 000003C5 B03A                    	mov	al, ':'
  1017 000003C7 F606[0000]04            	testopt [asm_options], disasm_nasm
  1018 000003CC 7402                    	jz	.notnasm
  1019 000003CE B020                    	mov	al, 32
  1020                                  .notnasm:
  1021 000003D0 AA                      	stosb
  1022 000003D1 5F                      	pop	di
  1023 000003D2 800E[E100]01            	or	byte [preused], PRESEG	; mark it as used
  1024                                  da21_j2:
  1025 000003D7 EB93                    	jmp s	da21_j1
  1026                                  
  1027                                  da25:
  1028 000003D9 A802                    	test	al, PREREP
  1029 000003DB 7435                    	jz	da26		; if not a REP prefix
  1030 000003DD 2406                    	and	al, PREREP|PREREPZ
  1031 000003DF 0806[E100]              	or	[preused], al
  1032 000003E3 A1[E800]                	mov	ax, [index]
  1033 000003E6 84E4                    	test	ah, ah
  1034 000003E8 7525                    	jnz	disbad3		; if not in the first 256 bytes
  1035 000003EA 24FE                    	and	al, ~1		; clear the low bit (MOVSW -> MOVSB)
  1036 000003EC 57                      	push	di
  1037 000003ED BF[0000]                	mov	di, replist
  1038 000003F0 B9[0000]                	mov	cx, REP_SAME_LEN; scan those for REP first
  1039 000003F3 F2AE                    	repne	scasb
  1040                                   %if _LINK
  1041 000003F5 BE[0000]                	mov	si, mnlist
  1042                                   wlcalc word_ext_MN_REP, equ $ - 2
  1043                                   %else
  1044                                  	mov	si, mnlist+MN_REP
  1045                                   %endif
  1046 000003F8 7439                    	je	da27		; if one of the REP instructions -->
  1047                                   %if _LINK
  1048 000003FA B100                    	mov cl, 0
  1049                                    wlcalc byte_ext_REP_DIFF_LEN, equ $ - 1
  1050                                   %else
  1051                                  	mov	cl, REP_DIFF_LEN; (ch = 0)
  1052                                   %endif
  1053 000003FC F2AE                    	repne	scasb
  1054 000003FE 750F                    	jne	disbad3		; if not one of the REPE/REPNE instructions
  1055                                   %if _LINK
  1056 00000400 BE[0000]                	mov	si, mnlist
  1057                                   wlcalc word_ext_MN_REPE, equ $ - 2
  1058                                   %else
  1059                                  	mov	si, mnlist+MN_REPE
  1060                                   %endif
  1061 00000403 F606[E100]04            	test	byte [preused], PREREPZ
  1062 00000408 7529                    	jnz	da27		; if REPE
  1063                                   %if _LINK
  1064 0000040A BE[0000]                	mov	si, mnlist
  1065                                   wlcalc word_ext_MN_REPNE, equ $ - 2
  1066                                   %else
  1067                                  	mov	si, mnlist+MN_REPNE
  1068                                   %endif
  1069 0000040D EB24                    	jmp s	da27		; it's REPNE
  1070                                  
  1071                                  disbad3:
  1072 0000040F E9570F                  	jmp	disbad
  1073                                  
  1074                                  da26:
  1075 00000412 A808                    	test	al, PRELOCK
  1076 00000414 74F9                    	jz	disbad3		; if not a lock prefix, either -->
  1077 00000416 57                      	push	di
  1078 00000417 A1[E800]                	mov	ax, [index]
  1079 0000041A BF[0000]                	mov	di, locktab
  1080 0000041D B9[0000]                	mov	cx, N_LOCK
  1081 00000420 F2AF                    	repne	scasw
  1082 00000422 75EB                    	jne	disbad3		; if not in the approved list -->
  1083 00000424 F606[E100]01            	test	byte [preused], PRESEG
  1084 00000429 74E4                    	jz	disbad3		; if memory was not accessed -->
  1085                                   %if _LINK
  1086 0000042B BE[0000]                	mov	si, mnlist
  1087                                   wlcalc word_ext_MN_LOCK, equ $ - 2
  1088                                   %else
  1089                                  	mov	si, mnlist+MN_LOCK
  1090                                   %endif
  1091 0000042E 800E[E100]08            	or	byte [preused], PRELOCK
  1092                                  
  1093                                  ;	Slip in another mnemonic (REP or LOCK).
  1094                                  ;	SI = offset of mnemonic, what should be
  1095                                  ;	DI is on the stack.
  1096                                  
  1097                                  da27:
  1098 00000433 5F                      	pop	di
  1099 00000434 B90800                  	mov	cx, 8
  1100                                  %if _40COLUMNS
  1101                                  		; We cheat: Instead of moving things back after showop,
  1102                                  		;  which obtains the final true length of the mnemonic,
  1103                                  		;  we get the length here separately. This only works because
  1104                                  		;  the REP and LOCK prefixes are never suffixed by a W or D,
  1105                                  		;  so the length found here matches what showop will get.
  1106 00000437 F606[0100]02            	testopt [asm_options], disasm_no_indent
  1107 0000043C 7407                    	jz @F
  1108 0000043E 8B4CFE                  	mov cx, word [si - 2]	; get mnemonic length in low 4 bits
  1109 00000441 83E10F                  	and cx, 15		; extract the length
  1110 00000444 41                      	inc cx			; allow for one blank
  1111                                  @@:
  1112                                  %endif
  1113 00000445 56                      	push	si
  1114 00000446 E87A11                  	call	moveover
  1115 00000449 5E                      	pop	si
  1116 0000044A 57                      	push	di
  1117 0000044B E8D70F                  	call	showop
  1118 0000044E 5F                      	pop	di
  1119 0000044F EB86                    	jmp	da21_j2
  1120                                  
  1121                                  ;	Done with instruction.  Erase the size indicator, if appropriate.
  1122                                  
  1123                                  da28:
  1124 00000451 8B0E[0201]              	mov	cx, [sizeloc]	; -> size keyword, or zero if none
  1125 00000455 E324                    	jcxz	da28b		; if there was no size given -->
  1126 00000457 A0[FE00]                	mov	al, [disflags]
  1127 0000045A A810                    	test al, DIS_I_SHOWSIZ
  1128 0000045C 751D                    	jnz	da28b		; if we need to show the size -->
  1129 0000045E A820                    	test al, DIS_I_KNOWSIZ
  1130 00000460 7419                    	jz	da28b		; if the size is not known already -->
  1131 00000462 87CF                    	xchg cx, di		; di -> size keyword, cx -> behind disassembly
  1132 00000464 89FE                    	mov	si,di		; si -> size keyword
  1133 00000466 B020                    	mov	al, 32		; scan for next blank
  1134                                  da28a:
  1135 00000468 AE                      	scasb			; skip size name
  1136 00000469 75FD                    	jne	da28a		; if not done yet -->
  1137                                  		; (The above is the same as repne scasb, but
  1138                                  		;  has no effect on cx.)
  1139 0000046B F606[0000]04            	testopt [asm_options], disasm_nasm
  1140 00000470 7503                    	jnz .nasm
  1141 00000472 83C704                  	add	di, byte 4	; skip 'PTR '
  1142                                  .nasm:
  1143 00000475 87F7                    	xchg si, di		; di -> size keyword, si -> after size keyword
  1144 00000477 29F1                    	sub	cx, si		; behind disassembly - after size keyword
  1145                                  				;  = length of disassembly part after keyword
  1146 00000479 F3A4                    	rep	movsb		; move the remainder of the line
  1147                                  				; di -> behind disassembly (size keyword deleted)
  1148                                  
  1149                                  ;	Now we're really done.  Print out the bytes on the left.
  1150                                  
  1151                                  		; di -> behind disassembly
  1152                                  da28b:
  1153 0000047B 57                      	push di
  1154 0000047C BF[0000]                	mov	di, line_out	; print start of disassembly line
  1155 0000047F A1[0400]                	mov	ax, [u_addr + saSegSel]
  1156                                  				; print address
  1157 00000482 E8(0000)                	call hexword		; segment/selector
  1158 00000485 B03A                    	mov	al, ':'
  1159 00000487 AA                      	stosb			; colon
  1160 00000488 66                      	_386_PM_o32	; mov eax, dword [u_addr]
  1161 00000489 A1[0000]                	mov ax, word [u_addr]
  1162                                  %if _PM && _DISASM_32BIT
  1163 0000048C F606[0000]40            	test byte [bCSAttr], 40h
  1164 00000491 7403                    	jz .16
  1165 00000493 E8(0000)                	call hexword_high
  1166                                  .16:
  1167                                  %endif
  1168 00000496 E8(0000)                	call hexword		; offset
  1169 00000499 B020                    	mov	al, 32
  1170 0000049B AA                      	stosb			; one blank
  1171 0000049C 8B1E[DC00]              	mov	bx, [dis_n]
  1172                                  da28c:
  1173                                  %if _40COLUMNS
  1174 000004A0 BE[FFFF]                	mov si, line_out - 1
  1175 000004A3 0336[D800]              	add si, word [mnemonofs]
  1176                                  %else
  1177                                  	mov si,line_out+MNEMONOFS - 1
  1178                                  %endif
  1179 000004A7 29FE                    	sub si, di		; how many columns available for machine code
  1180 000004A9 D1EE                    	shr si, 1		; how many bytes can be dumped
  1181 000004AB 39F3                    	cmp bx, si
  1182 000004AD 7619                    	jbe da29		; if it's a short instruction which fits in one line
  1183 000004AF 29F3                    	sub bx, si		; bx = how many bytes to defer to next line(s)
  1184 000004B1 53                      	push bx
  1185 000004B2 89F3                    	mov bx, si		; bx = how many bytes fit in this line
  1186 000004B4 57                      	push di
  1187 000004B5 E8F210                  	call disshowbytes	; dump bytes on this line
  1188 000004B8 E8(0000)                	call putsline_crlf	; append CR LF and display line
  1189                                  		; Note that MNEMONOFS is always even, and so is the length
  1190                                  		;  of the prefix (segment + colon + offset 4 or 8 + blank).
  1191                                  		; We determined how many bytes to dump by using line_out
  1192                                  		;  plus mnemonofs minus 1. Therefore we will always actually
  1193                                  		;  have two bytes left before the disassembly here. This is
  1194                                  		;  crucial for this call as it appends two bytes to the line.
  1195                                  		; We do not want the CR or LF to overwrite the disassembly
  1196                                  		;  text in the line_out buffer so we need two bytes of space.
  1197 000004BB 59                      	pop cx			; -> at column after segmented address
  1198 000004BC 5B                      	pop bx			; = how many bytes left for subsequent line(s)
  1199 000004BD BF[0000]                	mov di, line_out	; reset di
  1200 000004C0 29F9                    	sub cx, di		; = how many columns to skip
  1201 000004C2 B020                    	mov al, 32
  1202 000004C4 F3AA                    	rep stosb		; fill with blanks
  1203 000004C6 EBD8                    	jmp short da28c		; loop for subsequent line(s) -->
  1204                                  da29:
  1205 000004C8 E8DF10                  	call disshowbytes	; dunp remaining bytes
  1206                                  da30:
  1207 000004CB B020                    	mov	al, 32		; pad to op code
  1208                                  %if _40COLUMNS
  1209 000004CD B9[0000]                	mov cx, line_out
  1210 000004D0 030E[D800]              	add cx, word [mnemonofs]
  1211                                  %else
  1212                                  	mov	cx,line_out+MNEMONOFS
  1213                                  %endif
  1214 000004D4 29F9                    	sub	cx,di
  1215 000004D6 7202                    	jc  da30_1		; (shouldn't happen)
  1216 000004D8 F3AA                    	rep	stosb
  1217                                  da30_1:
  1218 000004DA 5F                      	pop	di		; -> behind disassembly
  1219 000004DB F606[FE00]08            	test byte [disflags],DIS_I_UNUSED
  1220 000004E0 740D                    	jz	da32		; if we don't print ` (unused)'
  1221 000004E2 BE[0000]                	mov	si,unused
  1222 000004E5 807DFF20                	cmp	byte [di-1], 32
  1223 000004E9 7501                    	jne	da31		; if there's already a space here
  1224 000004EB 46                      	inc	si
  1225                                  da31:
  1226 000004EC E8(0000)                	call showstring
  1227                                  
  1228                                  ;	Print info on minimal processor needed.
  1229                                  
  1230                                  da32:
  1231 000004EF A0[0000]                	mov al, [dismach]
  1232 000004F2 3A06[0000]              	cmp al, [maxmachinetype]
  1233 000004F6 7603                    	jbe @F
  1234 000004F8 A2[0000]                	mov [maxmachinetype], al
  1235                                  @@:
  1236 000004FB 57                      	push di
  1237 000004FC BF[EA00]                	mov di, obsinst
  1238 000004FF 8B0E[E800]              	mov cx, word [index]
  1239 00000503 E80610                  	call showmach	;show the machine type, if needed
  1240 00000506 5F                      	pop di
  1241 00000507 E313                    	jcxz da32f_j1		; if no message -->
  1242                                  
  1243                                  ;	Print a message on the far right.
  1244                                  
  1245                                  da32_tabto:
  1246                                  %if _40COLUMNS
  1247 00000509 B8[0000]                	mov ax, line_out
  1248 0000050C 0306[DA00]              	add ax, word [trailofs]
  1249                                  %else
  1250                                  	mov	ax, line_out+79
  1251                                  %endif
  1252 00000510 29C8                    	sub	ax, cx
  1253 00000512 51                      	push	cx
  1254 00000513 E8(0000)                	call	tab_to		; tab out to the location
  1255 00000516 59                      	pop	cx
  1256 00000517 F3A4                    	rep	movsb		; copy the string
  1257                                  da32z_j1:
  1258 00000519 E99202                  	jmp	da32z		; done
  1259                                  
  1260                                  da32f_j1:
  1261 0000051C EB72                    	jmp da32f
  1262                                  
  1263                                  %if _COND
  1264                                  		; Try dumping a condition status.
  1265                                  da32_cond:
  1266                                   %if _COND_RDUMP_ONLY
  1267 0000051E A802                    	test al, DIS_F_SHOW	; (! DIS_F_SHOW|DIS_I_SHOW is negated here)
  1268 00000520 75F7                    	jnz da32z_j1		; not showing conditionals message -->
  1269                                   %endif
  1270 00000522 8B36[0801]              	mov si, word [condmsg]
  1271 00000526 85F6                    	test si, si		; stored a message here ?
  1272 00000528 74EF                    	jz da32z_j1		; no -->
  1273 0000052A 57                      	push di
  1274 0000052B 89F7                    	mov di, si
  1275 0000052D B9FFFF                  	mov cx, -1
  1276 00000530 31C0                    	xor ax, ax
  1277 00000532 F2AE                    	repne scasb
  1278 00000534 F7D1                    	not cx
  1279 00000536 49                      	dec cx			; get string length
  1280 00000537 5F                      	pop di
  1281 00000538 EBCF                    	jmp short da32_tabto
  1282                                  %else
  1283                                  da32_cond: equ da32z_j1
  1284                                  %endif
  1285                                  
  1286                                  da32_xlatb:
  1287 0000053A A802                    	test al, DIS_F_SHOW	; (! DIS_F_SHOW|DIS_I_SHOW is negated here)
  1288 0000053C 75E0                    	jnz da32_cond
  1289 0000053E 803E[F500]03            _no386	cmp byte [segmnt], 3
  1290 00000543 77D9                    _no386	ja da32_cond		; if FS or GS on non-386 --> (invalid)
  1291 00000545 F606[E200]20            _no386	test byte [presizeflags], PRE32A
  1292 0000054A 75D2                    _no386	jnz da32_cond
  1293 0000054C 803E[F500]05            	cmp byte [segmnt], 5
  1294 00000551 77CB                    	ja da32_cond		; if invalid segment -->
  1295 00000553 813E[E800]D700          	cmp word [index], 0D7h	; xlatb ?
  1296 00000559 75C3                    	jne da32_cond
  1297 0000055B A1[0000]                	mov ax, word [reg_ebx]
  1298 0000055E A3[F800]                	mov word [addrr], ax
  1299 00000561 A1[0200]                	mov ax, word [reg_ebx + 2]
  1300 00000564 A3[FA00]                	mov word [addrr + 2], ax; get address in (e)bx
  1301 00000567 A0[0000]                	mov al, byte [reg_eax]
  1302 0000056A 0006[F800]              	add byte [addrr], al
  1303 0000056E 8016[F900]00            	adc byte [addrr + 1], 0
  1304 00000573 8316[FA00]00            	adc word [addrr + 2], 0	; add al
  1305 00000578 C606[F400]80            	mov byte [rmsize], 80h	; byte size
  1306                                  %if _MEMREF_AMOUNT
  1307 0000057D 800E[FF00]10            	setopt [disflags], DIS_I_M_SRC
  1308                                  %endif
  1309                                   %if _DISASM_32BIT
  1310 00000582 F606[E200]20            	test byte [presizeflags], PRE32A
  1311 00000587 7425                    	jz @F
  1312 00000589 800E[FF00]08            	setopt [disflags], DIS_I_SHOW_A32
  1313                                  				; set flag if 32-bit
  1314                                   %endif
  1315 0000058E EB1E                    	jmp @F
  1316                                  
  1317                                  
  1318                                  ;	Dump referenced memory location.
  1319                                  
  1320                                  da32f:
  1321 00000590 A0[FE00]                	mov	al,[disflags]
  1322 00000593 3406                    	xor	al, DIS_F_SHOW | DIS_I_SHOW
  1323 00000595 A886                    	test	al, DIS_F_SHOW | DIS_I_SHOW | DIS_I_DONTSHOW
  1324                                  		; (NZ if either _SHOW is clear, or _DONTSHOW is set)
  1325 00000597 75A1                    	jnz	da32_xlatb	; if there is no memory location to show -->
  1326 00000599 803E[F500]03            _no386	cmp byte [segmnt], 3
  1327 0000059E 779A                    _no386	ja da32_xlatb		; if FS or GS on non-386 --> (invalid)
  1328 000005A0 F606[FF00]08            _no386	testopt [disflags], DIS_I_SHOW_A32
  1329 000005A5 7593                    _no386	jnz da32_xlatb
  1330 000005A7 803E[F500]05            	cmp byte [segmnt], 5
  1331 000005AC 778C                    	ja da32_xlatb		; if invalid segment -->
  1332                                  @@:
  1333                                  %if _PM
  1334 000005AE 50                      	push ax
  1335                                  %endif
  1336 000005AF A0[F500]                	mov al, [segmnt]	; segment number
  1337 000005B2 98                      	cbw
  1338 000005B3 D1E0                    	shl ax, 1
  1339 000005B5 93                      	xchg ax, bx		; mov bx, ax
  1340 000005B6 8B9F[2E01]              	mov bx, [segrgaddr + bx]; get address of value
  1341                                  %if _PM
  1342 000005BA 58                      	pop ax
  1343 000005BB E8(0000)                	call ispm
  1344 000005BE 7508                    	jnz @F			; if 86 Mode, all segments readable -->
  1345                                  [cpu 286]
  1346 000005C0 0F0027                  	verr word [bx]
  1347 000005C3 7403E956FF              	jnz da32_cond		; (NOT to da32_xlatb)
  1348                                  __CPU__
  1349                                  @@:
  1350                                  %endif
  1351 000005C8 53                      	push bx
  1352                                  %if _MEMREF_AMOUNT
  1353 000005C9 FF37                    	push word [bx]		; = segment/selector value
  1354 000005CB E8BC09                  	call get_free_memref	; memrefs + bx -> the memref structure
  1355 000005CE 8F87[9800]              	pop word [memrefs + bx + mrSegmentSelector]
  1356 000005D2 808F[9A00]02            	or byte [memrefs + bx + mrFlags], mrfMem
  1357 000005D7 F606[FF00]10            	testopt [disflags], DIS_I_M_SRC
  1358 000005DC 7405                    	jz @F
  1359 000005DE 808F[9A00]04            	or byte [memrefs + bx + mrFlags], mrfMemSource
  1360                                  @@:
  1361 000005E3 F606[FF00]20            	testopt [disflags], DIS_I_M_DST
  1362 000005E8 7405                    	jz @F
  1363 000005EA 808F[9A00]08            	or byte [memrefs + bx + mrFlags], mrfMemDest
  1364                                  @@:
  1365                                  %endif
  1366                                  
  1367                                  %if _40COLUMNS
  1368 000005EF B8[F8FF]                	mov ax, line_out - 8
  1369 000005F2 0306[DA00]              	add ax, word [trailofs]
  1370                                  %else
  1371                                  	mov ax, line_out + 79 - 8
  1372                                  %endif
  1373                                  		; 8 is composed of:
  1374                                  		;	3 segreg name + colon
  1375                                  		;	4 low word offset
  1376                                  		;	1 equals sign
  1377                                  		; 79 means we write to the very right of an 80-columns
  1378                                  		;  display, up to the second-to-last column.
  1379 000005F6 B90200                  	mov cx, 2		; if byte then content uses 2 digits
  1380                                  %if _MEMREF_AMOUNT
  1381 000005F9 C687[9C00]01            	mov byte [memrefs + bx + mrLength], 1
  1382                                  				; if byte then length = 1
  1383                                  %endif
  1384 000005FE 803E[F400]00            	cmp	byte [rmsize],0
  1385 00000603 7C10                    	jl	da32h		; if byte
  1386 00000605 7408                    	jz	da32g		; if word
  1387                                  %if _MEMREF_AMOUNT
  1388 00000607 8087[9C00]02            	add byte [memrefs + bx + mrLength], 2
  1389                                  				; add 2 bytes to length for high half of dword
  1390                                  %endif
  1391 0000060C 83C104                  	add cx, byte 4		; add 4 digits for high half of dword
  1392                                  da32g:
  1393                                  %if _MEMREF_AMOUNT
  1394 0000060F FE87[9C00]              	inc byte [memrefs + bx + mrLength]
  1395                                  				; add 1 byte to length for the high byte
  1396                                  %endif
  1397 00000613 41                      	inc cx
  1398 00000614 41                      	inc cx			; add 2 digits for the high byte
  1399                                  da32h:
  1400 00000615 F606[FF00]04            	testopt [disflags], DIS_I_DOUBLE_M
  1401 0000061A 740B                    	jz @F
  1402                                  %if _MEMREF_AMOUNT
  1403 0000061C 8A97[9C00]              	mov dl, byte [memrefs + bx + mrLength]
  1404 00000620 0097[9C00]              	add byte [memrefs + bx + mrLength], dl
  1405                                  				; double the amount of bytes
  1406                                  %endif
  1407 00000624 01C9                    	add cx, cx		; double the amount of digits
  1408 00000626 41                      	inc cx			; plus one slot for the comma
  1409                                  @@:
  1410 00000627 F606[FF00]02            	testopt [disflags], DIS_I_FAR_M
  1411 0000062C 7408                    	jz @F
  1412                                  %if _MEMREF_AMOUNT
  1413 0000062E 8087[9C00]02            	add byte [memrefs + bx + mrLength], 2
  1414                                  				; add 2 bytes to the length for the segment
  1415                                  %endif
  1416 00000633 83C105                  	add cx, 5		; 4 digits for segment plus 1 colon
  1417                                  @@:
  1418                                  %if _MEMREF_AMOUNT
  1419 00000636 FF36[F800]              	push word [addrr]
  1420 0000063A 8F87[9400]              	pop word [memrefs + bx + mrOffset]
  1421                                  %endif
  1422                                   %if _DISASM_32BIT
  1423 0000063E F606[FF00]08            	testopt [disflags], DIS_I_SHOW_A32
  1424 00000643 7410                    	jz @F
  1425                                  %if _MEMREF_AMOUNT
  1426 00000645 FF36[FA00]              	push word [addrr + 2]
  1427 00000649 8F87[9600]              	pop word [memrefs + bx + mrOffset + 2]
  1428 0000064D 808F[9A00]10            	or byte [memrefs + bx + mrFlags], mrfA32
  1429                                  %endif
  1430 00000652 83C104                  	add cx, 4		; add 4 digits for high word offset
  1431                                  @@:
  1432                                   %endif
  1433                                  %if _MEMREF_AMOUNT
  1434 00000655 E85309                  	call calc_linear_memref_and_mark_nonfree
  1435                                  %endif
  1436 00000658 29C8                    	sub ax, cx
  1437 0000065A E8(0000)                	call tab_to		; CHG: ax, bx, cx, dx, di
  1438 0000065D E81F0E                  	call showseg_uppercase_ax
  1439                                  				; ax = segment register name
  1440 00000660 E8A90D                  	call dis_lowercase_refmem_w
  1441 00000663 AB                      	stosw
  1442 00000664 B03A                    	mov al, ':'
  1443 00000666 AA                      	stosb
  1444                                   %if _DISASM_32BIT
  1445 00000667 F606[FF00]08            	testopt [disflags], DIS_I_SHOW_A32
  1446 0000066C 7406                    	jz @F
  1447 0000066E A1[FA00]                	mov ax, [addrr + 2]
  1448 00000671 E8(0000)                	call hexword		; show high word of offset
  1449                                  @@:
  1450                                   %endif
  1451 00000674 A1[F800]                	mov ax, [addrr]
  1452 00000677 E8(0000)                	call hexword		; show offset
  1453                                  
  1454                                   %if _DISASM_32BIT
  1455 0000067A F606[FF00]08            	testopt [disflags], DIS_I_SHOW_A32
  1456 0000067F 7407                    	jz .isa16option		; if 16-bit addressing -->
  1457 00000681 F606[0100]20            	testopt [asm_options], disasm_a32_memref
  1458 00000686 EB05                    	jmp .commonoption
  1459                                  .isa16option:
  1460                                   %endif
  1461 00000688 F606[0100]10            	testopt [asm_options], disasm_a16_memref
  1462                                  .commonoption:
  1463 0000068D 7504                    	jnz @F
  1464 0000068F 5B                      	pop bx
  1465 00000690 E91B01                  	jmp da32z
  1466                                  @@:
  1467                                  
  1468 00000693 B03D                    	mov	al,'='
  1469 00000695 AA                      	stosb
  1470 00000696 E8(0000)                	call putsline
  1471 00000699 BF[0000]                	mov di, line_out
  1472                                  ..@uu_referenced_memory_access_start:
  1473 0000069C 5B                      	pop bx
  1474 0000069D 06                      	push es
  1475 0000069E 8E07                    	mov es, [bx]
  1476 000006A0 66                      	_386_o32
  1477 000006A1 8B1E[F800]              	mov bx, [addrr]
  1478                                  
  1479 000006A5 F606[FF00]02            	testopt [disflags], DIS_I_FAR_M
  1480 000006AA 743D                    	jz .no_far_m
  1481 000006AC BE0100                  	mov si, 1
  1482 000006AF 803E[F400]00            	cmp byte [rmsize], 0
  1483 000006B4 7C08                    	jl @F
  1484 000006B6 BE0200                  	mov si, 2
  1485 000006B9 7403                    	jz @F
  1486 000006BB BE0400                  	mov si, 4
  1487                                  @@:
  1488                                   %if _DISASM_32BIT
  1489 000006BE F606[FF00]08            	testopt [disflags], DIS_I_SHOW_A32
  1490 000006C3 7411                    	jz @F
  1491                                  [cpu 386]
  1492 000006C5 660FB7F6                	movzx esi, si
  1493 000006C9 26678A0433              	mov al, byte [es:ebx + esi]
  1494 000006CE 26678A643301            	mov ah, byte [es:ebx + esi + 1]
  1495                                  __CPU__
  1496 000006D4 EB07                    	jmp @FF
  1497                                  @@:
  1498                                   %endif
  1499 000006D6 268A00                  	mov al, byte [es:bx + si]
  1500 000006D9 268A6001                	mov ah, byte [es:bx + si + 1]
  1501                                  @@:
  1502 000006DD 8CC6                    	mov si, es
  1503 000006DF 07                      	pop es
  1504 000006E0 06                      	push es
  1505 000006E1 E8(0000)                	call hexword
  1506 000006E4 B03A                    	mov al, ':'
  1507 000006E6 AA                      	stosb
  1508 000006E7 8EC6                    	mov es, si
  1509                                  .no_far_m:
  1510                                  
  1511 000006E9 8CC6                    	mov si, es
  1512                                   %if _DISASM_32BIT
  1513 000006EB F606[FF00]08            	testopt [disflags], DIS_I_SHOW_A32
  1514 000006F0 741E                    	jz @F
  1515                                  [cpu 386]
  1516 000006F2 26678A03                	mov al, [es:ebx]	; avoid a "mov ax,[-1]"
  1517 000006F6 803E[F400]00            	cmp byte [rmsize], 0
  1518 000006FB 7C38                    	jl .displaybyte		; if byte -->
  1519 000006FD 26678A6301              	mov ah, [es:ebx + 1]
  1520 00000702 742B                    	jz .displayword		; if word -->
  1521 00000704 26678A5302              	mov dl, [es:ebx + 2]	; avoid a "mov dx,[-1]"
  1522 00000709 26678A7303              	mov dh, [es:ebx + 3]
  1523                                  __CPU__
  1524 0000070E EB18                    	jmp .displaydword	; is dword -->
  1525                                  @@:
  1526                                   %endif
  1527 00000710 268A07                  	mov al, [es:bx]		; avoid a "mov ax,[-1]"
  1528 00000713 803E[F400]00            	cmp byte [rmsize], 0
  1529 00000718 7C1B                    	jl .displaybyte		; if byte
  1530 0000071A 268A6701                	mov ah, [es:bx + 1]
  1531 0000071E 740F                    	jz .displayword		; if word
  1532 00000720 268A5702                	mov dl, [es:bx + 2]	; avoid a "mov dx,[-1]"
  1533 00000724 268A7703                	mov dh, [es:bx + 3]
  1534                                  .displaydword:
  1535 00000728 07                      	pop es
  1536 00000729 92                      	xchg ax, dx
  1537 0000072A E8(0000)                	call hexword
  1538 0000072D 92                      	xchg ax, dx
  1539 0000072E A8                      	db __TEST_IMM8		; (skip pop)
  1540                                  .displayword:
  1541 0000072F 07                      	pop es
  1542 00000730 E8(0000)                	call hexword
  1543 00000733 EB04                    	jmp short .displayed	; done
  1544                                  .displaybyte:
  1545 00000735 07                      	pop es
  1546 00000736 E8(0000)                	call hexbyte		; display byte
  1547                                  .displayed:
  1548                                  
  1549 00000739 F606[FF00]04            	testopt [disflags], DIS_I_DOUBLE_M
  1550 0000073E 746E                    	jz .no_double_m
  1551                                  
  1552 00000740 B02C                    	mov al, ','
  1553 00000742 AA                      	stosb
  1554                                  
  1555 00000743 06                      	push es
  1556 00000744 8EC6                    	mov es, si
  1557                                  
  1558 00000746 BE0100                  	mov si, 1
  1559 00000749 803E[F400]00            	cmp byte [rmsize], 0
  1560 0000074E 7C08                    	jl @F
  1561 00000750 BE0200                  	mov si, 2
  1562 00000753 7403                    	jz @F
  1563 00000755 BE0400                  	mov si, 4
  1564                                  @@:
  1565                                   %if _DISASM_32BIT
  1566 00000758 F606[FF00]08            	testopt [disflags], DIS_I_SHOW_A32
  1567 0000075D 7426                    	jz @F
  1568                                  [cpu 386]
  1569 0000075F 660FB7F6                	movzx esi, si
  1570 00000763 26678A0433              	mov al, [es:ebx + esi]	; avoid a "mov ax,[-1]"
  1571 00000768 803E[F400]00            	cmp byte [rmsize], 0
  1572 0000076D 7C3B                    	jl .double_displaybyte	; if byte -->
  1573 0000076F 26678A643301            	mov ah, [es:ebx + esi + 1]
  1574 00000775 742D                    	jz .double_displayword	; if word -->
  1575 00000777 26678A543302            	mov dl, [es:ebx + esi + 2]
  1576                                  				; avoid a "mov dx,[-1]"
  1577 0000077D 26678A743303            	mov dh, [es:ebx + esi + 3]
  1578                                  __CPU__
  1579 00000783 EB18                    	jmp .double_displaydword
  1580                                  @@:
  1581                                   %endif
  1582 00000785 268A00                  	mov al, [es:bx + si]	; avoid a "mov ax,[-1]"
  1583 00000788 803E[F400]00            	cmp byte [rmsize], 0
  1584 0000078D 7C1B                    	jl .double_displaybyte	; if byte -->
  1585 0000078F 268A6001                	mov ah, [es:bx + si + 1]
  1586 00000793 740F                    	jz .double_displayword	; if word -->
  1587 00000795 268A5002                	mov dl, [es:bx + si + 2]; avoid a "mov dx,[-1]"
  1588 00000799 268A7003                	mov dh, [es:bx + si + 3]
  1589                                  .double_displaydword:
  1590 0000079D 07                      	pop es
  1591 0000079E 92                      	xchg ax, dx
  1592 0000079F E8(0000)                	call hexword
  1593 000007A2 92                      	xchg ax, dx
  1594 000007A3 A8                      	db __TEST_IMM8		; (skip pop)
  1595                                  .double_displayword:
  1596 000007A4 07                      	pop es
  1597 000007A5 E8(0000)                	call hexword
  1598 000007A8 EB04                    	jmp short .double_displayed
  1599                                  .double_displaybyte:
  1600 000007AA 07                      	pop es
  1601 000007AB E8(0000)                	call hexbyte		; display byte
  1602                                  .double_displayed:
  1603                                  .no_double_m:
  1604                                  ..@uu_referenced_memory_access_end:
  1605                                  
  1606                                  da32z:
  1607 000007AE E8(0000)                	call	trimputs	; done with operand list
  1608                                  
  1609                                  %if _MEMREF_AMOUNT
  1610                                  set_string_memref:
  1611 000007B1 F606[FE00]02            	test byte [disflags], DIS_F_SHOW
  1612 000007B6 7503                    	jnz @F
  1613                                  .none_j:
  1614 000007B8 E91E01                  	jmp .none
  1615                                  @@:
  1616                                  
  1617 000007BB A1[E800]                	mov ax, [index]
  1618 000007BE 84E4                    	test ah, ah
  1619 000007C0 75F6                    	jnz .none_j
  1620 000007C2 BF[0000]                	mov di, ppbytes.string	; list of string opcodes
  1621 000007C5 B9[0000]                	mov cx, ppbytes.string_amount
  1622 000007C8 F2AE                    	repne scasb
  1623 000007CA 75EC                    	jne .none_j		; if not one of these -->
  1624                                  		; last entries are: 0A6h,0A7h,0AEh,0AFh
  1625                                  		;  corresponding to cmpsb, cmpsw/d, scasb, scasw/d
  1626                                  		; so cx = 0 means scasw, = 1 scasb, = 2 cmpsw, = 3 cmpsb
  1627                                  %if _LINK_COMPAT
  1628 000007CC 8A85[FFFF]              	mov al,byte [word di+PPLEN-1]; get corresponding byte in ppinfo
  1629                                  %else
  1630                                  	mov al,byte [di+PPLEN-1]; get corresponding byte in ppinfo
  1631                                  %endif
  1632                                  
  1633 000007D0 31D2                    	xor dx, dx
  1634 000007D2 FF36[0000]              	push word [reg_ecx]
  1635 000007D6 8F06[D400]              	pop word [string_memref_counter]
  1636                                   %if _DISASM_32BIT
  1637 000007DA F606[E200]20            	test byte [presizeflags], PRE32A
  1638 000007DF 7404                    	jz @F			; if 16-bit addressing -->
  1639 000007E1 8B16[0200]              	mov dx, [reg_ecx + 2]	; = ecxh value
  1640                                  @@:
  1641                                   %endif
  1642 000007E5 8916[D600]              	mov word [string_memref_counter + 2], dx
  1643                                  
  1644 000007E9 80F904                  	cmp cl, 4		; repetition differs for memory content ?
  1645 000007EC 7203E9A000              	jae @F			; no -->
  1646 000007F1 F606[E000]02            	test byte [preflags], PREREP
  1647 000007F6 7503E99600              	jz @F			; if not repeated -->
  1648                                  
  1649                                   %if _DISASM_32BIT
  1650 000007FB F606[E200]20            	test byte [presizeflags], PRE32A
  1651 00000800 7407                    	jz .isa16option		; if 16-bit addressing -->
  1652 00000802 F606[0100]80            	testopt [asm_options], disasm_a32_string
  1653 00000807 EB05                    	jmp .commonoption
  1654                                  .isa16option:
  1655                                   %endif
  1656 00000809 F606[0100]40            	testopt [asm_options], disasm_a16_string
  1657                                  .commonoption:
  1658 0000080E 750D                    	jnz .optiondone
  1659 00000810 C706[D400]0100          	mov word [string_memref_counter], 1
  1660 00000816 8326[D600]00            	and word [string_memref_counter + 2], 0
  1661 0000081B EB74                    	jmp @F
  1662                                  
  1663                                  .optiondone:
  1664                                  
  1665 0000081D 01C9                    	add cx, cx		; 0 = scasd, 2 = scasb, 4 = cmpsd, 6 = cmpsb
  1666                                   %if _DISASM_32BIT
  1667 0000081F F606[E200]10            	test byte [presizeflags], PRE32D
  1668 00000824 7501                    	jnz .iso32
  1669                                   %endif
  1670 00000826 41                      	inc cx			; point to word entry, not dword
  1671                                  .iso32:
  1672                                  
  1673 00000827 01C9                    	add cx, cx		; table entries are words, so 0..14
  1674                                  
  1675 00000829 F606[E000]04            	test byte [preflags], PREREPZ
  1676 0000082E 7403                    	jz .isrepne
  1677 00000830 83C110                  	add cx, simulate_rep_sca_cmp.table_repe_offset
  1678                                  				; from 0..14 to 16..30
  1679                                  .isrepne:
  1680                                  
  1681 00000833 89CB                    	mov bx, cx		; = index into table
  1682 00000835 8B97[7401]              	mov dx, word [bx + simulate_rep_sca_cmp.table]
  1683                                  				; function to call
  1684                                   %if _DISASM_32BIT
  1685 00000839 F606[E200]20            	test byte [presizeflags], PRE32A
  1686 0000083E 7401                    	jz .isa16		; if 16-bit addressing -->
  1687 00000840 4A                      	dec dx			; a32 prefix is 1 byte lower than table entry
  1688                                  .isa16:
  1689                                   %endif
  1690                                  
  1691 00000841 66                      	_386_o32
  1692 00000842 8B36[0000]              	mov si, word [reg_esi]
  1693 00000846 66                      	_386_o32
  1694 00000847 8B3E[0000]              	mov di, word [reg_edi]
  1695 0000084B 66                      	_386_o32
  1696 0000084C 8B0E[0000]              	mov cx, word [reg_ecx]
  1697 00000850 8E06[0000]              	mov es, word [reg_es]
  1698 00000854 50                      	push ax
  1699 00000855 A810                    	test al, PP_STRSRC	; cmps ?
  1700 00000857 740D                    	jz .issca		; no, no need to load ds -->
  1701                                  
  1702 00000859 A0[F500]                	mov al, [segmnt]	; segment number
  1703 0000085C 98                      	cbw
  1704 0000085D D1E0                    	shl ax, 1
  1705 0000085F 93                      	xchg ax, bx		; mov bx, ax
  1706 00000860 8B9F[2E01]              	mov bx, word [segrgaddr + bx]
  1707                                  				; si = address of segment/selector reg
  1708 00000864 8E1F                    	mov ds, [bx]
  1709                                  
  1710                                  .issca:
  1711 00000866 66                      	_386_o32
  1712 00000867 36A1[0000]              	mov ax, word [ss:reg_eax]
  1713                                  
  1714 0000086B 36F606[0100]04          	testopt [ss:reg_efl], 400h
  1715                                  				; DF set ?
  1716 00000871 7401                    	jz .up
  1717 00000873 FD                      	std
  1718                                  .up:
  1719 00000874 FFD2                    	call dx			; simulate the repeated string op
  1720 00000876 FC                      	cld
  1721 00000877 16                      	 push ss
  1722 00000878 1F                      	 pop ds
  1723 00000879 16                      	 push ss
  1724 0000087A 07                      	 pop es
  1725                                  
  1726 0000087B 6651                    _386	push ecx
  1727 0000087D 59                      _386	pop cx
  1728 0000087E 5A                      _386	pop dx
  1729                                  
  1730                                   %if _DISASM_32BIT
  1731 0000087F F606[E200]20            _386	test byte [presizeflags], PRE32A
  1732 00000884 7502                    _386	jnz .count32		; if 32-bit addressing -->
  1733                                   %endif
  1734 00000886 31D2                    	xor dx, dx
  1735                                  .count32:
  1736 00000888 290E[D400]              	sub word [string_memref_counter], cx
  1737 0000088C 1916[D600]              	sbb word [string_memref_counter + 2], dx
  1738                                  
  1739 00000890 58                      	pop ax
  1740                                  @@:
  1741                                  
  1742 00000891 A810                    	test al, PP_STRSRC
  1743 00000893 7429                    	jz .no_src
  1744                                  
  1745 00000895 803E[F500]03            _no386	cmp byte [segmnt], 3
  1746 0000089A 7722                    _no386	ja .no_src		; if FS or GS on non-386 --> (invalid)
  1747 0000089C 803E[F500]05            	cmp byte [segmnt], 5
  1748 000008A1 771B                    	ja .no_src		; if invalid segment -->
  1749                                  
  1750 000008A3 50                      	push ax
  1751 000008A4 A0[F500]                	mov al, [segmnt]	; segment number
  1752 000008A7 98                      	cbw
  1753 000008A8 D1E0                    	shl ax, 1
  1754 000008AA 93                      	xchg ax, bx		; mov bx, ax
  1755 000008AB 58                      	pop ax
  1756 000008AC 8BB7[2E01]              	mov si, word [segrgaddr + bx]
  1757                                  				; si = address of segment/selector reg
  1758 000008B0 BF[0000]                	mov di, reg_esi		; di = address of offset reg
  1759 000008B3 E83607                  	call init_string_memref
  1760                                  @@:			; entry: set memref to string source and mark
  1761                                  			;  (jump to .none afterwards if al is zero)
  1762 000008B6 808F[9A00]60            	or byte [memrefs + bx + mrFlags], mrfString | mrfStringSource
  1763 000008BB E8ED06                  	call calc_linear_memref_and_mark_nonfree
  1764                                  
  1765                                  .no_src:
  1766 000008BE A828                    	test al, PP_STRDEST | PP_STRSRC2
  1767 000008C0 7417                    	jz .none
  1768 000008C2 BE[0000]                	mov si, reg_es		; si = address of segment/selector reg
  1769 000008C5 BF[0000]                	mov di, reg_edi		; di = address of offset reg
  1770 000008C8 E82107                  	call init_string_memref
  1771 000008CB A808                    	test al, PP_STRSRC2	; alternative string source ?
  1772 000008CD B000                    	mov al, 0		; (cause conditional branch to jump)
  1773 000008CF 75E5                    	jnz @B			; yes, set as string source -->
  1774 000008D1 808F[9A00]A0            	or byte [memrefs + bx + mrFlags], mrfString | mrfStringDest
  1775 000008D6 E8D206                  	call calc_linear_memref_and_mark_nonfree
  1776                                  
  1777                                  .none:
  1778                                  
  1779                                  %if _SYMBOLIC
  1780                                  display_symbol_memrefs:
  1781                                  	testopt [internalflags3], dif3_nosymbols_1 | dif3_nosymbols_2
  1782                                  	jnz .none_memref
  1783                                  
  1784                                  	mov cx, [memrefs.free]
  1785                                  	test cx, cx
  1786                                  	jz .none_memref
  1787                                  
  1788                                  	xor si, si
  1789                                  .loop_memref:
  1790                                  	push cx
  1791                                  	push si
  1792                                  
  1793                                  	mov bx, si
  1794                                  	call get_memref_index_bx
  1795                                  	mov ax, word [memrefs + bx + mrFlags]
  1796                                  	mov dx, msg.memrefs_branchdirect
  1797                                  	test al, mrfBranchDirect
  1798                                  	jnz .gotmsg
  1799                                  
  1800                                  	test byte [disflags], DIS_F_SHOW
  1801                                  	jz .next_memref
  1802                                  
  1803                                  	mov dx, msg.memrefs_stringsource
  1804                                  	test al, mrfStringSource
  1805                                  	jnz .gotmsg
  1806                                  	mov dx, msg.memrefs_stringdest
  1807                                  	test al, mrfStringDest
  1808                                  	jnz .gotmsg
  1809                                  	mov dl, al
  1810                                  	and dl, mrfMemSource | mrfMemDest
  1811                                  	cmp dl, mrfMemSource | mrfMemDest
  1812                                  	mov dx, msg.memrefs_memsourcedest
  1813                                  	je .gotmsg
  1814                                  	mov dx, msg.memrefs_memsource
  1815                                  	test al, mrfMemSource
  1816                                  	jnz .gotmsg
  1817                                  	mov dx, msg.memrefs_memdest
  1818                                  	test al, mrfMemDest
  1819                                  	jnz .gotmsg
  1820                                  	mov dx, msg.memrefs_mem_unknown
  1821                                  	test al, mrfMem
  1822                                  	jnz .gotmsg
  1823                                  	mov dx, msg.memrefs_unknown
  1824                                  .gotmsg:
  1825                                  
  1826                                  	; We do not call zz_detect_xms here because that is
  1827                                  	;  already done unconditionally during the initialisation
  1828                                  	;  of the function disasm.
  1829                                  
  1830                                  	 push dx
  1831                                  	mov ax, [memrefs + bx + mrLinear]
  1832                                  	mov dx, [memrefs + bx + mrLinear + 2]
  1833                                  
  1834                                  	mov cx, dx
  1835                                  	mov bx, ax
  1836                                  	nearcall binsearchmain		; search for matching symbol
  1837                                  	 pop dx
  1838                                  	jcxz .no_symbol
  1839                                  .loop_symbol:
  1840                                  	call putsz
  1841                                  	 push bx
  1842                                  	dualcall displaystring
  1843                                  	 push bx
  1844                                  	 push ax
  1845                                  	dualcall getfarpointer.main
  1846                                  	 pop di
  1847                                  	 pop es
  1848                                  
  1849                                  	pop si
  1850                                  	push si
  1851                                  
  1852                                  	push dx
  1853                                  
  1854                                  	 push bx
  1855                                  	mov bx, si
  1856                                  	call get_memref_index_bx
  1857                                  	mov dx, word [memrefs + bx + mrOffset + 2]
  1858                                  	mov ax, word [memrefs + bx + mrOffset]
  1859                                  
  1860                                  	cmp dx, word [es:di + smOffset + 2]
  1861                                  	mov dx, msg.memref_after_symbol.non_wrt
  1862                                  	jne .wrt_symbol
  1863                                  	cmp ax, word [es:di + smOffset]
  1864                                  	je .non_wrt_symbol
  1865                                  .wrt_symbol:
  1866                                  	mov dx, msg.memref_between_symbol.wrt
  1867                                  	call disp_message
  1868                                  	push ss
  1869                                  	pop es
  1870                                  	mov di, line_out
  1871                                  	mov ax, word [memrefs + bx + mrSegmentSelector]
  1872                                  	call hexword
  1873                                  	push bx
  1874                                  	push cx
  1875                                  	call putsline
  1876                                  	pop cx
  1877                                  	pop bx
  1878                                  	mov dx, msg.memref_after_symbol.wrt
  1879                                  .non_wrt_symbol:
  1880                                  	call disp_message
  1881                                  
  1882                                  	 pop bx
  1883                                  	pop dx
  1884                                  .next_symbol:
  1885                                  	inc bx
  1886                                  	loop .loop_symbol
  1887                                  
  1888                                  .no_symbol:
  1889                                  	push ss
  1890                                  	pop es
  1891                                  	push ss
  1892                                  	pop ds
  1893                                  
  1894                                  .next_memref:
  1895                                  	pop si
  1896                                  	pop cx
  1897                                  	inc si
  1898                                  	loop .loop_memref_j
  1899                                  	jmp .none_memref
  1900                                  
  1901                                  .loop_memref_j:
  1902                                  	jmp .loop_memref
  1903                                  
  1904                                  .none_memref:
  1905                                  %endif
  1906                                  
  1907                                  %if _DEBUG2
  1908                                  display_memrefs:
  1909                                  	mov cx, [memrefs.free]
  1910                                  	test cx, cx
  1911                                  	jz .none
  1912                                  	xor si, si
  1913                                  .loop:
  1914                                  	mov bx, si
  1915                                  	call get_memref_index_bx
  1916                                  	mov ax, word [memrefs + bx + mrFlags]
  1917                                  	mov dx, msg.memrefs_branchdirect
  1918                                  	test al, mrfBranchDirect
  1919                                  	jnz .gotmsg
  1920                                  	mov dx, msg.memrefs_stringsource
  1921                                  	test al, mrfStringSource
  1922                                  	jnz .gotmsg
  1923                                  	mov dx, msg.memrefs_stringdest
  1924                                  	test al, mrfStringDest
  1925                                  	jnz .gotmsg
  1926                                  	mov dl, al
  1927                                  	and dl, mrfMemSource | mrfMemDest
  1928                                  	cmp dl, mrfMemSource | mrfMemDest
  1929                                  	mov dx, msg.memrefs_memsourcedest
  1930                                  	je .gotmsg
  1931                                  	mov dx, msg.memrefs_memsource
  1932                                  	test al, mrfMemSource
  1933                                  	jnz .gotmsg
  1934                                  	mov dx, msg.memrefs_memdest
  1935                                  	test al, mrfMemDest
  1936                                  	jnz .gotmsg
  1937                                  	mov dx, msg.memrefs_mem_unknown
  1938                                  	test al, mrfMem
  1939                                  	jnz .gotmsg
  1940                                  	mov dx, msg.memrefs_unknown
  1941                                  .gotmsg:
  1942                                  	call putsz
  1943                                  
  1944                                  	mov di, line_out
  1945                                  	mov ax, word [memrefs + bx + mrSegmentSelector]
  1946                                  	call hexword
  1947                                  	push word [memrefs + bx + mrOffset]
  1948                                  	mov al, ':'
  1949                                  	stosb
  1950                                  %if 1 || _PM
  1951                                  	mov ax, word [memrefs + bx + mrOffset + 2]
  1952                                  	test byte [memrefs + bx + mrFlags], mrfA32
  1953                                  	jz .16
  1954                                  	call hexword
  1955                                  .16:
  1956                                  %endif
  1957                                  	pop ax
  1958                                  	call hexword
  1959                                  	push si
  1960                                  	push cx
  1961                                  	mov si, msg.memrefs_length
  1962                                  	call copy_single_counted_string
  1963                                  	mov ax, word [memrefs + bx + mrLength + 2]
  1964                                  	test ax, ax
  1965                                  	jz @F
  1966                                  	call hexword
  1967                                  @@:
  1968                                  	mov ax, word [memrefs + bx + mrLength]
  1969                                  	call hexword
  1970                                  	call putsline_crlf
  1971                                  	pop cx
  1972                                  	pop si
  1973                                  
  1974                                  	inc si
  1975                                  	dec cx
  1976                                  	jnz .loop
  1977                                  .none:
  1978                                  %endif	; _DEBUG2
  1979                                  %endif	; _MEMREF_AMOUNT
  1980                                  
  1981                                  
  1982                                  da_repeat:
  1983                                  %if _SYMBOLIC
  1984                                  	testopt [internalflags3], dif3_nosymbols_1 | dif3_nosymbols_2
  1985                                  	jnz .no_sym_between
  1986                                  
  1987                                  	mov bx, word [u_addr + 4]
  1988                                  	_386_PM_o32
  1989                                  	mov dx, word [u_addr]
  1990                                  	call getlinear_32bit
  1991                                  	jc .no_sym_between
  1992                                  
  1993                                  	; push dx
  1994                                  	push ax			; linear after instruction
  1995                                  
  1996                                  	xchg dx, cx
  1997                                  	xchg ax, bx
  1998                                  
  1999                                  	sub bx, 1
  2000                                  	sbb cx, 0		; cx:bx = end of range
  2001                                  
  2002                                  	mov dx, word [u_lin_start + 2]
  2003                                  	mov ax, word [u_lin_start]
  2004                                  	add ax, 1
  2005                                  	adc dx, 0		; dx:ax = start of range
  2006                                  
  2007                                  	nearcall binsearchmain
  2008                                  	pop ax
  2009                                  	; pop dx		; dx:ax = linear after instruction
  2010                                  	jcxz .no_sym_between
  2011                                  
  2012                                  .loop_sym_between:
  2013                                  	; push dx
  2014                                  	push ax
  2015                                  	 push bx
  2016                                  	dualcall displaystring
  2017                                  	pop ax
  2018                                  	; pop dx
  2019                                  
  2020                                  	 push bx
  2021                                  	 push ax		; (reserve space, uninitialised)
  2022                                  	dualcall getfarpointer.main
  2023                                  	 pop di
  2024                                  	 pop es
  2025                                  
  2026                                  	; push dx
  2027                                  	push ax
  2028                                  	sub ax, word [es:di + smLinear]
  2029                                  	; sbb dx, word [es:di + smLinear + 2]
  2030                                  
  2031                                  	; push dx
  2032                                  	push ax
  2033                                  	xor dx, dx
  2034                                  	add ax, word [es:di + smOffset]
  2035                                  	adc dx, word [es:di + smOffset + 2]
  2036                                  	cmp word [u_addr + 2], dx
  2037                                  	mov dx, msg.uu_after_symbol_between_1.non_wrt
  2038                                  	jne .sym_between.wrt
  2039                                  	cmp word [u_addr], ax
  2040                                  	je .sym_between.not_wrt
  2041                                  .sym_between.wrt:
  2042                                  	mov dx, msg.uu_after_symbol_between_1.wrt
  2043                                  	call disp_message
  2044                                  
  2045                                  	push ss
  2046                                  	pop es
  2047                                  	mov di, line_out
  2048                                  	mov ax, word [u_addr + 4]
  2049                                  	call hexword
  2050                                  	push bx
  2051                                  	push cx
  2052                                  	call putsline
  2053                                  	pop cx
  2054                                  	pop bx
  2055                                  
  2056                                  	mov dx, msg.uu_after_symbol_between_2.wrt
  2057                                  .sym_between.not_wrt:
  2058                                  	call disp_message
  2059                                  	pop ax
  2060                                  	; pop dx
  2061                                  
  2062                                  	push ss
  2063                                  	pop es
  2064                                  	push di
  2065                                  	push bx
  2066                                  	push cx
  2067                                  	mov di, line_out
  2068                                  	call decword
  2069                                  	call putsline
  2070                                  	pop cx
  2071                                  	pop bx
  2072                                  	pop di
  2073                                  	pop ax
  2074                                  	; pop dx
  2075                                  
  2076                                  	; push dx
  2077                                  	mov dx, msg.uu_after_symbol_between_3
  2078                                  	call disp_message
  2079                                  	; pop dx
  2080                                  
  2081                                  	inc bx
  2082                                  	loop .loop_sym_between
  2083                                  .no_sym_between:
  2084                                  	push ss
  2085                                  	pop es
  2086                                  %endif
  2087                                  
  2088 000008D9 A0[FE00]                	mov	al, [disflags]
  2089                                  %if _IMMASM
  2090 000008DC F606[0300]02            	testopt [internalflags6], dif6_immasm
  2091 000008E1 7404                    	jz .notimmasm
  2092 000008E3 A808                    	test	al, DIS_I_UNUSED
  2093 000008E5 753E                    	jnz	@F		; if " (unused)" was displayed -->
  2094                                  .notimmasm:
  2095                                  %endif
  2096 000008E7 A801                    	test	al, DIS_F_REPT
  2097 000008E9 7453                    	jz	@FF		; if not repeating -->
  2098 000008EB A808                    	test	al, DIS_I_UNUSED
  2099 000008ED 7536                    	jnz	@F		; if " (unused)" was displayed -->
  2100 000008EF A840                    	test	al, DIS_I_MOV_SS
  2101 000008F1 A1[E800]                	mov	ax, [index]
  2102 000008F4 740C                    	jz	.not_mov_to_ss	; not mov to ss -->
  2103                                  
  2104 000008F6 F606[0000]80            	testopt [asm_options], disasm_nec
  2105 000008FB 7528                    	jnz @F			; allow mov from or to any segreg
  2106                                  		; DIS_I_MOV_SS is set, check for wo[index] == 8Eh;
  2107                                  		;  as we only want to match move *to* ss, not from (8Ch).
  2108 000008FD 3D8E00                  	cmp	ax, 8Eh		; move to seg reg?
  2109 00000900 7423                    	je	@F		; yes, it is mov to ss -->
  2110                                  .not_mov_to_ss:
  2111                                  
  2112 00000902 3D[0000]                	cmp ax, SGROUP4 + 0	; pop r/m ?
  2113 00000905 7507                    	jne .not_pop_rm
  2114 00000907 803E[0000]C0            	cmp byte [regmem], 1100_0000b
  2115                                  				; long-form pop reg ?
  2116 0000090C 7317                    	jae @F			; yes -->
  2117                                  .not_pop_rm:
  2118                                  
  2119 0000090E 84E4                    	test ah, ah
  2120 00000910 752D                    	jnz .not_single_byte_opcode
  2121                                  
  2122 00000912 BF[6201]                	mov di, single_byte_opcodes_repeat_disassembly
  2123 00000915 B90F00                  	mov cx, single_byte_opcodes_repeat_disassembly.length
  2124 00000918 F606[0000]80            	testopt [asm_options], disasm_nec
  2125 0000091D 7402                    	jz .not_nec
  2126                                  %if single_byte_opcodes_repeat_disassembly.length_nec      == single_byte_opcodes_repeat_disassembly.length + 2
  2128 0000091F 41                      	inc cx
  2129 00000920 41                      	inc cx
  2130                                  %else
  2131                                  	mov cx, single_byte_opcodes_repeat_disassembly.length_nec
  2132                                  %endif
  2133                                  .not_nec:
  2134 00000921 F2AE                    	repne scasb
  2135 00000923 751A                    	jne	@FFF
  2136                                  @@:
  2137 00000925 8326[FE00]03            	and	word [disflags], DIS_F_REPT|DIS_F_SHOW
  2138 0000092A FE06[0101]              	inc	byte [disrepeatcount]
  2139 0000092E 803E[0101]10            	cmp	byte [disrepeatcount], 16
  2140 00000933 7303E997F7              	jb	disasm.preserve_disrepeatcount
  2141                                  
  2142 00000938 BA[0000]                	mov dx, msg.uu_too_many_repeat
  2143 0000093B E8(0000)                	call putsz
  2144                                  @@:
  2145 0000093E C3                      	retn
  2146                                  
  2147                                  @@:
  2148                                  .not_single_byte_opcode:
  2149                                  
  2150 0000093F 8A3E[E400]              	mov	bh, byte [disp8]
  2151 00000943 3DEB00                  	cmp	ax, 0EBh	; unconditional short jump ?
  2152 00000946 74F6                    	je	@BB		; yes, return -->
  2153 00000948 66                      	_386_PM_o32	; and dword [dis_n], byte 0
  2154 00000949 8326[DC00]00            	and	word [dis_n], byte 0
  2155 0000094E E8200C                  	call	disgetbyte
  2156 00000951 B302                    	mov	bl, 2		; displacement to skip a jmp short
  2157 00000953 3CEB                    	cmp	al, 0EBh	; jmp short ?
  2158 00000955 740F                    	je	@F		; yes -->
  2159 00000957 B303                    	mov	bl, 3		; displacement to skip a 16-bit jmp near
  2160 00000959 3CE9                    	cmp	al, 0E9h	; jmp near ?
  2161 0000095B 75E1                    	jne	@BB		; no, return -->
  2162                                  %if _PM
  2163                                   %if _DISASM_32BIT
  2164 0000095D F606[0000]40            	test	byte [bCSAttr], 40h	; 32-bit code segment ?
  2165 00000962 7402                    	jz	@F		; no, 16-bit, use displacement 3 -->
  2166 00000964 B305                    	mov	bl, 5		; displacement to skip a 32-bit jmp near
  2167                                   %endif
  2168                                  %endif
  2169                                  @@:
  2170 00000966 38DF                    	cmp	bh, bl		; right displacement ?
  2171 00000968 75D4                    	jne	@BBB		; no -->
  2172                                  
  2173 0000096A 8326[FE00]03            	and	word [disflags], DIS_F_REPT|DIS_F_SHOW
  2174                                   %if _LINK
  2175 0000096F 8136[0801][0000]        	xor	word [condmsg], strict word msg.condnotjump
  2176                                   wlcalc word_opext_xor_msg.condjump, equ $ - 2
  2177                                   %elif _LINK_COMPAT
  2178                                  	xor	word [condmsg], strict word 	    (msg.condnotjump + DATASECTIONFIXUP) ^ (msg.condjump + DATASECTIONFIXUP)
  2180                                   %else
  2181                                  	xor	word [condmsg], 	    (msg.condnotjump + DATASECTIONFIXUP) ^ (msg.condjump + DATASECTIONFIXUP)
  2183                                   %endif
  2184 00000975 E95CF7                  	jmp	disasm.preserve_condmsg_and_disrepeatcount
  2185                                  
  2186                                  
  2187                                  %if _MEMREF_AMOUNT
  2188                                  simulate_rep_sca_cmp:
  2189                                  
  2190                                  ..@uu_simulate_scas_start:
  2191 00000978 67                      	_386_a32
  2192                                  .repne_scasd:
  2193 00000979 66                      	_386_o32
  2194 0000097A F2                      	repne
  2195 0000097B AF                      	scasw
  2196 0000097C C3                      	retn
  2197                                  
  2198 0000097D 67                      	_386_a32
  2199                                  .repne_scasw:
  2200 0000097E F2AF                    	repne scasw
  2201 00000980 C3                      	retn
  2202                                  
  2203 00000981 67                      	_386_a32
  2204                                  .repne_scasb:
  2205 00000982 F2AE                    	repne scasb
  2206 00000984 C3                      	retn
  2207                                  
  2208 00000985 67                      	_386_a32
  2209                                  .repe_scasd:
  2210 00000986 66                      	_386_o32
  2211 00000987 F3                      	repe
  2212 00000988 AF                      	scasw
  2213 00000989 C3                      	retn
  2214                                  
  2215 0000098A 67                      	_386_a32
  2216                                  .repe_scasw:
  2217 0000098B F3AF                    	repe scasw
  2218 0000098D C3                      	retn
  2219                                  
  2220 0000098E 67                      	_386_a32
  2221                                  .repe_scasb:
  2222 0000098F F3AE                    	repe scasb
  2223 00000991 C3                      	retn
  2224                                  ..@uu_simulate_scas_end:
  2225                                  
  2226                                  ..@uu_simulate_cmps_start:
  2227 00000992 67                      	_386_a32
  2228                                  .repne_cmpsd:
  2229 00000993 66                      	_386_o32
  2230 00000994 F2                      	repne
  2231 00000995 A7                      	cmpsw
  2232 00000996 C3                      	retn
  2233                                  
  2234 00000997 67                      	_386_a32
  2235                                  .repne_cmpsw:
  2236 00000998 F2A7                    	repne cmpsw
  2237 0000099A C3                      	retn
  2238                                  
  2239 0000099B 67                      	_386_a32
  2240                                  .repne_cmpsb:
  2241 0000099C F2A6                    	repne cmpsb
  2242 0000099E C3                      	retn
  2243                                  
  2244 0000099F 67                      	_386_a32
  2245                                  .repe_cmpsd:
  2246 000009A0 66                      	_386_o32
  2247 000009A1 F3                      	repe
  2248 000009A2 A7                      	cmpsw
  2249 000009A3 C3                      	retn
  2250                                  
  2251 000009A4 67                      	_386_a32
  2252                                  .repe_cmpsw:
  2253 000009A5 F3A7                    	repe cmpsw
  2254 000009A7 C3                      	retn
  2255                                  
  2256 000009A8 67                      	_386_a32
  2257                                  .repe_cmpsb:
  2258 000009A9 F3A6                    	repe cmpsb
  2259 000009AB C3                      	retn
  2260                                  ..@uu_simulate_cmps_end:
  2261                                  
  2262                                  
  2263                                  	usesection lDEBUG_DATA_ENTRY
  2263          ------------------       note: usesection lDEBUG_DATA_ENTRY
  2264 00000173 00                      	align 2, db 0
  2265                                  .table:
  2266 00000174 [7909]                  	dw .repne_scasd
  2267 00000176 [7E09]                  	dw .repne_scasw
  2268 00000178 [8209]                  	dw .repne_scasb
  2269 0000017A [8209]                  	dw .repne_scasb
  2270 0000017C [9309]                  	dw .repne_cmpsd
  2271 0000017E [9809]                  	dw .repne_cmpsw
  2272 00000180 [9C09]                  	dw .repne_cmpsb
  2273 00000182 [9C09]                  	dw .repne_cmpsb
  2274                                  .table_repe_offset: equ $ - .table
  2275 00000184 [8609]                  	dw .repe_scasd
  2276 00000186 [8B09]                  	dw .repe_scasw
  2277 00000188 [8F09]                  	dw .repe_scasb
  2278 0000018A [8F09]                  	dw .repe_scasb
  2279 0000018C [A009]                  	dw .repe_cmpsd
  2280 0000018E [A509]                  	dw .repe_cmpsw
  2281 00000190 [A909]                  	dw .repe_cmpsb
  2282 00000192 [A909]                  	dw .repe_cmpsb
  2283                                  
  2284                                  	usesection lDEBUG_CODE
  2284          ------------------       note: usesection lDEBUG_CODE
  2285                                  %endif
  2286                                  
  2287                                  
  2288                                  ;	Here are the routines for printing out the operands themselves.
  2289                                  ;	Immediate data (OP_IMM)
  2290                                  
  2291                                  dop_imm_not_extend:
  2292 000009AC F606[FE00]10            	test byte [disflags], DIS_I_SHOWSIZ
  2293 000009B1 7532                    	jnz dop_imm
  2294 000009B3 84E4                    	test ah, ah
  2295 000009B5 782E                    	js dop_imm		; if byte -->
  2296 000009B7 91                      	xchg ax, cx		; ch = size
  2297 000009B8 741E                    	je .16
  2298                                  .32:
  2299 000009BA E8D00B                  	call disgetword		; ax = low word
  2300 000009BD 92                      	xchg ax, dx		; dx = low word
  2301 000009BE E8CC0B                  	call disgetword		; ax = high word
  2302 000009C1 92                      	xchg ax, dx		; dx:ax = dword
  2303                                  
  2304 000009C2 50                      	push ax			; stack -> low word
  2305 000009C3 E80B00                  	call .checkword
  2306 000009C6 7502                    	jne @F			; cannot be imms8
  2307 000009C8 39D0                    	cmp ax, dx
  2308                                  @@:
  2309 000009CA E8C60A                  	call showsize_ch_flag_ZR; if can be imms8, show size keyword
  2310 000009CD 92                      	xchg ax, dx		; ax = high word
  2311 000009CE E91A0B                  	jmp disp32.stack
  2312                                  
  2313                                  .checkword:
  2314 000009D1 B107                    	mov cl, 7
  2315 000009D3 D2F8                    	sar al, cl		; = -1 if negative imms8, 0 if positive
  2316 000009D5 38E0                    	cmp al, ah		; ZR if imms16 in imms8 range
  2317 000009D7 C3                      	retn
  2318                                  
  2319                                  .16:
  2320 000009D8 E8B20B                  	call disgetword		; ax = word
  2321 000009DB 50                      	push ax			; stack -> word
  2322 000009DC E8F2FF                  	call .checkword
  2323 000009DF E8B10A                  	call showsize_ch_flag_ZR; if can be imms8, show size keyword
  2324 000009E2 E9090B                  	jmp disp32.low_stack
  2325                                  
  2326                                  
  2327                                  dop_imm:
  2328 000009E5 80FC00                  	cmp	ah, 0
  2329 000009E8 7C1A                    	jl	dop03		; if just a byte -->
  2330 000009EA 9C                      	pushf
  2331 000009EB F606[FE00]10            	test	byte [disflags], DIS_I_SHOWSIZ
  2332 000009F0 7403                    	jz	.nosize		; if we don't need to show the size -->
  2333 000009F2 E8A60A                  	call	showsize
  2334                                  .nosize:
  2335 000009F5 E8950B                  	call	disgetword
  2336                                  %if _IMMASM
  2337 000009F8 A3[0000]                	mov word [immasm_imm16], ax
  2338                                  %endif
  2339 000009FB 9D                      	popf			; ZF
  2340 000009FC 7503E9(0000)            	je	hexword		; if just a word
  2341 00000A01 E9E30A                  	jmp	disp32.ax
  2342                                  
  2343                                  dop03:
  2344 00000A04 E86A0B                  	call	disgetbyte	; print immediate byte
  2345 00000A07 E9(0000)                	jmp	hexbyte
  2346                                  
  2347                                  
  2348                                  ;	Memory offset reference (OP_MOFFS)
  2349                                  
  2350                                  dop_moffs:
  2351 00000A0A B005                    	mov	al, 5
  2352                                   %if _DISASM_32BIT
  2353 00000A0C F606[E200]20            	test	byte [presizeflags], PRE32A
  2354 00000A11 7501                    	jnz	.32		; if 32-bit addressing -->
  2355                                   %endif
  2356 00000A13 40                      	inc	ax
  2357                                  .32:
  2358 00000A14 A2[0000]                	mov	[regmem], al
  2359 00000A17 EB13                    	jmp s	dop05
  2360                                  
  2361                                  
  2362                                  ;	MOD R/M (OP_RM)
  2363                                  
  2364                                  dop_rm:
  2365 00000A19 E8C109                  	call getregmem
  2366 00000A1C 3CC0                    	cmp	al,0c0h
  2367 00000A1E 7203E9D902              	jae	dop33		; if pure register reference -->
  2368                                  
  2369 00000A23 F606[FF00]40            	testopt [disflags], DIS_I_M_ALWAYS_16
  2370 00000A28 7402                    	jz @F
  2371 00000A2A B400                    	mov ah, 0		; word size (m16)
  2372                                  @@:
  2373                                  
  2374                                  dop05:			; <--- used by OP_M, OP_M64, OP_M80, OP_MOFFS
  2375 00000A2C 8826[F400]              	mov byte [rmsize], ah	; save r/m size
  2376 00000A30 F606[FF00]01            	testopt [disflags], DIS_I_NOSIZ
  2377 00000A35 7506                    	jnz @F
  2378 00000A37 E8610A                  	call showsize		; print out size
  2379 00000A3A E8950A                  	call showptr		; append "PTR " (if not NASM syntax)
  2380                                  @@:
  2381                                  dop06:			; <--- used by OP_MXX, OP_MFLOAT, OP_MDOUBLE
  2382 00000A3D 800E[E100]01            	or	byte [preused],PRESEG	; needed even if there's no segment override
  2383                                  					; because handling of LOCK prefix relies on it
  2384 00000A42 B05B                    	mov	al, '['
  2385 00000A44 E89302                  	call	stosb_nasm
  2386                                  
  2387 00000A47 F606[E000]01            	test byte [preflags],PRESEG
  2388 00000A4C 7406                    	jz	dop07			;if no segment override
  2389 00000A4E E83A0A                  	call showseg		;print segment name
  2390 00000A51 B03A                    	mov	al,':'
  2391 00000A53 AA                      	stosb
  2392                                  dop07:
  2393 00000A54 A0[0000]                	mov	al,[regmem]
  2394 00000A57 24C7                    	and	al,0c7h
  2395 00000A59 800E[E100]20            	or	byte [preused],PREASIZE
  2396                                   %if _DISASM_32BIT
  2397 00000A5E F606[E200]20            	test	byte [presizeflags],PRE32A
  2398 00000A63 7403E9EA00              	jnz	dop18		;if 32-bit addressing
  2399                                   %endif
  2400 00000A68 800E[FE00]04            	or	byte [disflags],DIS_I_SHOW	;we'd like to show this address
  2401 00000A6D 8326[F800]00            	and word [addrr], 0	; zero out the address initially
  2402 00000A72 93                      	xchg	ax,bx		;mov bx,ax
  2403 00000A73 E85702                  	call	store_opensqubracket
  2404 00000A76 80FB06                  	cmp	bl,6
  2405 00000A79 7503E9B200              	je	dop16		;if [xxxx]
  2406 00000A7E 83E307                  	and	bx,7
  2407 00000A81 8A9F[1601]              	mov	bl,[rmtab+bx]
  2408 00000A85 F6C308                  	test	bl,8
  2409 00000A88 7525                    	jnz	dop09		;if BX
  2410 00000A8A F6C304                  	test	bl,4
  2411 00000A8D 7436                    	jz	dop11		;if not BP
  2412 00000A8F B84250                  	mov	ax,'BP'
  2413 00000A92 8B0E[0000]              	mov	cx,[reg_ebp]
  2414 00000A96 E80A00                  	call da_set_default_ss
  2415 00000A99 EB1B                    	jmp dop10
  2416                                  
  2417                                  
  2418                                  		; INP:	al = 2 * register number
  2419                                  		;	[preflags] & PRESEG set if segment overridden
  2420                                  		;	else,
  2421                                  		;	 byte [segmnt] = initialised to 3 (ds)
  2422                                  		; OUT:	no action if register number not for esp or ebp
  2423                                  		;	no action if segment overridden
  2424                                  		;	otherwise,
  2425                                  		;	 byte [segmnt] -= 1, resulting in 2 (ss)
  2426                                  da_set_default_ss_if_esp_ebp:
  2427 00000A9B 3C08                    	cmp al, 2 * 4
  2428 00000A9D 7404                    	je @F
  2429 00000A9F 3C0A                    	cmp al, 2 * 5
  2430 00000AA1 750B                    	jne @FF
  2431                                  @@:
  2432                                  da_set_default_ss:
  2433 00000AA3 F606[E000]01            	test byte [preflags], PRESEG
  2434 00000AA8 7504                    	jnz @F			; if segment override -->
  2435 00000AAA FE0E[F500]              	dec byte [segmnt]	; default is now SS
  2436                                  @@:
  2437 00000AAE C3                      	retn
  2438                                  
  2439                                  
  2440                                  dop09:
  2441 00000AAF B84258                  	mov	ax,'BX'		;BX
  2442 00000AB2 8B0E[0000]              	mov	cx,[reg_ebx]
  2443                                  
  2444                                  dop10:
  2445 00000AB6 890E[F800]              	mov	[addrr],cx	;print it out, etc.
  2446 00000ABA E8D109                  	call	dis_stosw_lowercase
  2447 00000ABD F6C303                  	test	bl,2+1
  2448 00000AC0 741C                    	jz	dop13		;if done
  2449 00000AC2 B02B                    	mov	al,'+'
  2450 00000AC4 AA                      	stosb
  2451                                  dop11:
  2452 00000AC5 B85349                  	mov	ax,'SI'
  2453 00000AC8 8B0E[0000]              	mov	cx,[reg_esi]
  2454 00000ACC F6C301                  	test	bl,1
  2455 00000ACF 7406                    	jz	dop12		;if SI
  2456 00000AD1 B044                    	mov	al,'D'		;DI
  2457 00000AD3 8B0E[0000]              	mov	cx,[reg_edi]
  2458                                  
  2459                                  dop12:
  2460 00000AD7 010E[F800]              	add	[addrr], cx	; print it out, etc.
  2461 00000ADB E8B009                  	call	dis_stosw_lowercase
  2462                                  dop13:
  2463 00000ADE F606[0000]C0            	test	byte [regmem], 0C0h
  2464 00000AE3 7455                    	jz s	dop17		; if no displacement -->
  2465 00000AE5 F606[0000]80            	test	byte [regmem], 80h
  2466 00000AEA 752D                    	jnz	dop15		; if word displacement -->
  2467 00000AEC E8820A                  	call	disgetbyte
  2468 00000AEF 98                      	cbw
  2469 00000AF0 0106[F800]              	add	[addrr], ax
  2470                                  
  2471 00000AF4 80FB04                  	cmp bl, 4		; BP only ?
  2472 00000AF7 740E                    	je @F			; yes, do not display "BYTE" size -->
  2473 00000AF9 84C0                    	test al, al
  2474 00000AFB 750A                    	jnz @F
  2475 00000AFD B02B                    	mov al, '+'
  2476 00000AFF AA                      	stosb
  2477 00000B00 E8AC09                  	call showsize.byte
  2478 00000B03 B000                    	mov al, 0
  2479 00000B05 EB0D                    	jmp @FF
  2480                                  @@:
  2481                                  
  2482 00000B07 3C00                    	cmp	al, 0
  2483 00000B09 B42B                    	mov	ah, '+'
  2484 00000B0B 7D04                    	jge	dop14		; if not negative -->
  2485 00000B0D B42D                    	mov	ah, '-'
  2486 00000B0F F6D8                    	neg	al
  2487                                  dop14:
  2488 00000B11 8825                    	mov	[di], ah
  2489 00000B13 47                      	inc	di
  2490                                  @@:
  2491 00000B14 E8(0000)                	call	hexbyte		; print the byte displacement
  2492 00000B17 EB21                    	jmp s	dop17		; done -->
  2493                                  
  2494                                  dop15:
  2495 00000B19 B02B                    	mov	al, '+'
  2496 00000B1B AA                      	stosb
  2497                                  
  2498 00000B1C E86E0A                  	call disgetword
  2499 00000B1F 83F87F                  	cmp ax, 127
  2500 00000B22 7F0A                    	jg @F
  2501 00000B24 83F880                  	cmp ax, -128
  2502 00000B27 7C05                    	jl @F
  2503 00000B29 50                      	push ax
  2504 00000B2A E89309                  	call showsize.word
  2505 00000B2D 58                      	pop ax
  2506                                  @@:
  2507 00000B2E EB03                    	jmp @F
  2508                                  dop16:
  2509 00000B30 E85A0A                  	call	disgetword
  2510                                  @@:
  2511 00000B33 0106[F800]              	add	[addrr], ax
  2512 00000B37 E8(0000)                	call	hexword		; print word displacement
  2513                                  
  2514                                  dop17:
  2515 00000B3A B05D                    	mov	al, ']'
  2516 00000B3C AA                      	stosb
  2517 00000B3D C3                      	retn
  2518                                  
  2519                                  
  2520                                  getsibbyte:
  2521 00000B3E A0[0000]                	mov al, [sibbyte]	; init if we already read it
  2522 00000B41 D006[E500]              	rol byte [gotsib], 1	; have it already ?
  2523 00000B45 720A                    	jc .ret			; yes -->
  2524 00000B47 F616[E500]              	not byte [gotsib]	; save that we have it
  2525 00000B4B E8230A                  	call disgetbyte		; get SIB byte
  2526 00000B4E A2[0000]                	mov [sibbyte], al	; save it
  2527                                  .ret:
  2528 00000B51 C3                      	retn
  2529                                  
  2530                                  
  2531                                   %if _DISASM_32BIT
  2532                                  ;	32-bit MOD REG R/M addressing.
  2533                                  
  2534                                  dop18:
  2535 00000B52 810E[FE00]0408          	or word [disflags], DIS_I_SHOW | DIS_I_SHOW_A32
  2536 00000B58 8326[F800]00            	and word [addrr], 0
  2537 00000B5D 8326[FA00]00            	and word [addrr + 2], 0	; zero out the address initially
  2538 00000B62 3C05                    	cmp al, 5		; mod=0 and r/m=5 ?
  2539 00000B64 7503E9AF00              	je dop19		; yes, just a disp32 address -->
  2540 00000B69 50                      	push	ax
  2541 00000B6A 2407                    	and	al, 7
  2542 00000B6C 3C04                    	cmp	al, 4
  2543 00000B6E 7503                    	jne	dop20		; if no SIB -->
  2544 00000B70 E8CBFF                  	call getsibbyte
  2545                                  dop20:
  2546 00000B73 58                      	pop	ax
  2547 00000B74 A880                    	test	al, 80h
  2548 00000B76 754C                    	jnz	dop22		; if disp32 -->
  2549 00000B78 A840                    	test	al, 40h
  2550 00000B7A 7467                    	jz	dop23		; if no disp8 -->
  2551                                  
  2552 00000B7C E8F209                  	call disgetbyte
  2553 00000B7F 84C0                    	test al, al
  2554 00000B81 7509                    	jnz @F
  2555 00000B83 50                      	push ax
  2556 00000B84 893E[0401]              	mov word [uu_a32_size_byte_keyword], di
  2557 00000B88 E82409                  	call showsize.byte
  2558 00000B8B 58                      	pop ax
  2559                                  @@:
  2560                                  
  2561 00000B8C 98                      	cbw
  2562 00000B8D 99                      	cwd
  2563 00000B8E 0106[F800]              	add word [addrr], ax
  2564 00000B92 1116[FA00]              	adc word [addrr + 2], dx
  2565                                  
  2566 00000B96 3C00                    	cmp	al, 0
  2567 00000B98 7D06                    	jge	dop21		; if not negative -->
  2568 00000B9A F6D8                    	neg	al
  2569 00000B9C C6052D                  	mov	byte [di], '-'
  2570 00000B9F 47                      	inc	di
  2571                                  dop21:
  2572 00000BA0 E8(0000)                	call	hexbyte
  2573 00000BA3 EB3B                    	jmp s	dop22a		; done -->
  2574                                  
  2575                                  
  2576                                  disp32_add_to_addrr_dword_size:
  2577 00000BA5 893E[0601]              	mov word [uu_a32_size_dword_keyword], di
  2578 00000BA9 E80E09                  	call showsize.dword
  2579                                  disp32_add_to_addrr:
  2580 00000BAC E8DE09                  	call disgetword
  2581 00000BAF 0106[F800]              	add word [addrr], ax
  2582 00000BB3 50                      	push ax
  2583 00000BB4 9C                      	pushf
  2584 00000BB5 E8D509                  	call disgetword
  2585 00000BB8 9D                      	popf
  2586 00000BB9 1106[FA00]              	adc word [addrr + 2], ax
  2587 00000BBD E8(0000)                	call hexword
  2588 00000BC0 58                      	pop ax
  2589 00000BC1 E9(0000)                	jmp hexword
  2590                                  
  2591                                  dop22:
  2592 00000BC4 E8DEFF                  	call disp32_add_to_addrr_dword_size
  2593                                  				; print disp32
  2594 00000BC7 83F87F                  	cmp ax, 127
  2595 00000BCA 7F14                    	jg @F
  2596 00000BCC 83F880                  	cmp ax, -128
  2597 00000BCF 7C0F                    	jl @F
  2598 00000BD1 B10F                    	mov cl, 15
  2599 00000BD3 D3F8                    	sar ax, cl
  2600 00000BD5 3906[FA00]              	cmp word [addrr + 2], ax
  2601 00000BD9 7505                    	jne @F
  2602 00000BDB 8326[0601]00            	and word [uu_a32_size_dword_keyword], 0
  2603                                  @@:
  2604                                  
  2605                                  dop22a:
  2606 00000BE0 E8F500                  	call	store_plus
  2607                                  
  2608                                  dop23:
  2609 00000BE3 A0[0000]                	mov	al,[regmem]
  2610 00000BE6 2407                    	and	al,7
  2611 00000BE8 3C04                    	cmp	al,4
  2612 00000BEA 7403E9CD00              	jne	dop28		;if no SIB
  2613 00000BEF A0[0000]                	mov al, [sibbyte]
  2614 00000BF2 88C4                    	mov ah, al
  2615 00000BF4 250738                  	and ax, 00_111_000_00_000_111b
  2616                                  				; ah = index << 3, al = base
  2617 00000BF7 80FC20                  	cmp ah, 4 << 3		; index encodes esp ?
  2618 00000BFA 7414                    	je dop_sib_index_4	; yes, use base only -->
  2619                                  		; When this branch is taken, the scale is ignored.
  2620                                  		; This is typically used only for encoding [esp]
  2621                                  		;  and [esp + x] but is a valid encoding even for
  2622                                  		;  other base registers. So better support it.
  2623                                  		; (This used to be a special case for SIB == 24h
  2624                                  		;  only because it doesn't usually occur else.
  2625                                  		;  The other cases were rejected in dop25.)
  2626                                  
  2627 00000BFC E80700                  	call dop_is_mod_0_and_base_5
  2628 00000BFF 7559                    	jnz dop24		; if not mod=0 base=5 -->
  2629 00000C01 E8A8FF                  	call disp32_add_to_addrr; show 32-bit displacement instead of [EBP]
  2630 00000C04 EB5C                    	jmp dop25		; and handle the scale and index -->
  2631                                  
  2632                                  
  2633                                  		; INP:	al = low 3 bits of SIB byte (= base)
  2634                                  		;	byte [regmem] = ModR/M byte
  2635                                  		; OUT:	NZ if not mod=0 base=5 special case
  2636                                  		;	ZR else
  2637                                  		; REM:	base=5 usually encodes [ebp], and mod=0
  2638                                  		;	 usually encodes no displacement field.
  2639                                  		;	 If both are true however, then the
  2640                                  		;	 special case is true: there is no base
  2641                                  		;	 register and a 32-bit displacement.
  2642                                  dop_is_mod_0_and_base_5:
  2643 00000C06 3C05                    	cmp al, 5
  2644 00000C08 7505                    	jne @F			; NZ if not base=5 -->
  2645 00000C0A F606[0000]C0            	test byte [regmem], 1100_0000b
  2646                                  				; NZ if not mod=0
  2647                                  @@:
  2648 00000C0F C3                      	retn
  2649                                  
  2650                                  
  2651                                  dop_sib_index_4:
  2652                                  		; The mod=0 base=5 special case and the
  2653                                  		;  index=4 special case can occur both
  2654                                  		;  together. That is a SIB encoding of
  2655                                  		;  a 32-bit displacement without any
  2656                                  		;  index or base registers.
  2657                                  		;
  2658                                  		; This was noted on stackoverflow.com by
  2659                                  		;  Peter Cordes: "x86-32 has 2 redundant
  2660                                  		;  ways to encode [0x123456], i.e. no-base
  2661                                  		;  + disp32: with or without a SIB byte,
  2662                                  		;  because SIB has an encoding for no-base
  2663                                  		;  and no-index." (There is a use for this
  2664                                  		;  distinction and thus the SIB form only
  2665                                  		;  in 64-bit mode but it is accepted as a
  2666                                  		;  valid alternative encoding even for us.)
  2667                                  		;
  2668                                  		; - https://stackoverflow.com/questions/48124293/can-rip-be-used-with-another-register-with-rip-relative-addressing/48125453#48125453
  2669 00000C10 E8F3FF                  	call dop_is_mod_0_and_base_5
  2670 00000C13 7403E9A400              	jnz dop28		; if not mod=0 base=5 -->
  2671                                  		; fall through to dop19
  2672                                  
  2673                                  dop19:
  2674 00000C18 E8B200                  	call store_opensqubracket
  2675 00000C1B E887FF                  	call disp32_add_to_addrr_dword_size
  2676                                  				; display 32-bit offset
  2677 00000C1E 833E[FA00]01            	cmp word [addrr + 2], 1	; >= 64 KiB ?
  2678 00000C23 7305                    	jae @F			; yes, delete keyword -->
  2679 00000C25 8326[0601]00            	and word [uu_a32_size_dword_keyword], 0
  2680                                  				; no, do not delete keyword
  2681                                  @@:
  2682 00000C2A EB6E                    	jmp dop27
  2683                                  
  2684                                  dop_store_and_add_base_reg32:
  2685 00000C2C E89200                  	call store_opensqubracket_e
  2686 00000C2F E8C008                  	call showreg16
  2687 00000C32 E866FE                  	call da_set_default_ss_if_esp_ebp
  2688 00000C35 3C0A                    	cmp al, 5 * 2		; ebp ?
  2689 00000C37 7405                    	je @F			; yes, delete BYTE -->
  2690 00000C39 8326[0401]00            	and word [uu_a32_size_byte_keyword], 0
  2691                                  				; do not delete BYTE
  2692                                  @@:
  2693                                  add_reg32_to_addrr:
  2694 00000C3E B90100                  	mov cx, 1
  2695                                  add_reg32_times_cx_to_addrr:
  2696 00000C41 50                      	push ax
  2697 00000C42 53                      	push bx
  2698 00000C43 93                      	xchg ax, bx
  2699 00000C44 8B9F[1E01]              	mov bx, word [reg32addr + bx]
  2700                                  @@:
  2701 00000C48 8B07                    	mov ax, word [bx]
  2702 00000C4A 0106[F800]              	add word [addrr], ax
  2703 00000C4E 8B4702                  	mov ax, word [bx + 2]
  2704 00000C51 1106[FA00]              	adc word [addrr + 2], ax
  2705 00000C55 E2F1                    	loop @B
  2706 00000C57 5B                      	pop bx
  2707 00000C58 58                      	pop ax
  2708 00000C59 C3                      	retn
  2709                                  
  2710                                  dop24:
  2711 00000C5A E8CFFF                  	call dop_store_and_add_base_reg32
  2712 00000C5D B05D                    	mov	al, ']'
  2713 00000C5F E86D00                  	call	stosb_notnasm
  2714                                  dop25:
  2715 00000C62 E87300                  	call	store_plus
  2716                                  
  2717 00000C65 A0[0000]                	mov al, [sibbyte]
  2718 00000C68 E86B07                  	call da_get_bits_3_to_5	; al = index
  2719                                  		; (In dop23 we already checked this is not = 4
  2720                                  		;  which is a special escaping encoding.)
  2721                                  
  2722 00000C6B E85300                  	call store_opensqubracket_e
  2723                                  
  2724 00000C6E 8A26[0000]              	mov ah, [sibbyte]
  2725 00000C72 B90100                  	mov cx, 1
  2726 00000C75 F6C4C0                  	test ah, 0C0h
  2727 00000C78 740F                    	jz @F
  2728 00000C7A 41                      	inc cx
  2729 00000C7B F6C480                  	test ah, 80h
  2730 00000C7E 7409                    	jz @F
  2731 00000C80 B104                    	mov cl, 4
  2732 00000C82 F6C440                  	test ah, 40h
  2733 00000C85 7402                    	jz @F
  2734 00000C87 B108                    	mov cl, 8
  2735                                  @@:
  2736                                  
  2737 00000C89 E86608                  	call showreg16
  2738 00000C8C 51                      	push cx
  2739 00000C8D E8B1FF                  	call add_reg32_times_cx_to_addrr
  2740 00000C90 59                      	pop cx
  2741 00000C91 49                      	dec cx			; = 0-based scale
  2742                                  	; jz dop27		; if scale == 1 (S=00b) -->
  2743 00000C92 B02A                    	mov al, '*'
  2744 00000C94 AA                      	stosb
  2745 00000C95 88C8                    	mov al, cl
  2746 00000C97 0431                    	add al, '1'		; from 0-based to '1'-based
  2747                                  dop26:
  2748 00000C99 AA                      	stosb
  2749                                  dop27:
  2750 00000C9A 8B0E[0401]              	mov cx, word [uu_a32_size_byte_keyword]
  2751                                  				; -> size keyword, or zero if none
  2752 00000C9E E302                    	jcxz @F			; if there was no size given -->
  2753 00000CA0 EB06                    	jmp .delete
  2754                                  @@:
  2755 00000CA2 8B0E[0601]              	mov cx, word [uu_a32_size_dword_keyword]
  2756                                  				; -> size keyword, or zero if none
  2757 00000CA6 E311                    	jcxz @F			; if there was no size given -->
  2758                                  .delete:
  2759 00000CA8 56                      	push si
  2760 00000CA9 87CF                    	xchg cx, di		; di -> size keyword, cx -> behind disassembly
  2761 00000CAB 89FE                    	mov si, di		; si -> size keyword
  2762 00000CAD B020                    	mov al, 32		; scan for next blank
  2763                                  .da28a:
  2764 00000CAF AE                      	scasb			; skip size name
  2765 00000CB0 75FD                    	jne .da28a		; if not done yet -->
  2766                                  		; (The above is the same as repne scasb, but
  2767                                  		;  has no effect on cx.)
  2768 00000CB2 87F7                    	xchg si, di		; di -> size keyword, si -> after size keyword
  2769 00000CB4 29F1                    	sub cx, si		; behind disassembly - after size keyword
  2770                                  				;  = length of disassembly part after keyword
  2771 00000CB6 F3A4                    	rep movsb		; move the remainder of the line
  2772                                  				; di -> behind disassembly (size keyword deleted)
  2773 00000CB8 5E                      	pop si
  2774                                  @@:
  2775                                  dop17_j2:
  2776 00000CB9 E97EFE                  	jmp dop17
  2777                                  
  2778                                  ;	32-bit addressing without SIB
  2779                                  
  2780                                  dop28:
  2781 00000CBC E86DFF                  	call dop_store_and_add_base_reg32
  2782 00000CBF EBD9                    	jmp short dop27
  2783                                  
  2784                                  
  2785                                  		; Store '[' if not NASM syntax,
  2786                                  		;  then (regardless of syntax) store 'E'
  2787                                  		; INP:	di-> buffer
  2788                                  		; OUT:	di-> behind "[E" or 'E'
  2789                                  		; CHG:	-
  2790                                  		;
  2791                                  		; The 'E' is lowercased if that option is selected.
  2792                                  store_opensqubracket_e:
  2793 00000CC1 50                      	push ax
  2794 00000CC2 E80800                  	call store_opensqubracket
  2795 00000CC5 B045                    	mov al, 'E'
  2796 00000CC7 E83007                  	call dis_lowercase
  2797 00000CCA AA                      	stosb
  2798 00000CCB 58                      	pop ax
  2799 00000CCC C3                      	retn
  2800                                   %endif
  2801                                  
  2802                                  		; Store '[' if not NASM syntax
  2803                                  		; INP:	di-> buffer
  2804                                  		; OUT:	di-> behind '[' if not NASM syntax
  2805                                  		; CHG:	al
  2806                                  store_opensqubracket:
  2807 00000CCD B05B                    	mov	al, '['
  2808                                  
  2809                                  		; Store al if not NASM syntax
  2810                                  		; INP:	di-> buffer
  2811                                  		; OUT:	di-> behind stored byte if not NASM syntax
  2812                                  		; CHG:	-
  2813                                  stosb_notnasm:
  2814 00000CCF F606[0000]04            	testopt [asm_options], disasm_nasm
  2815 00000CD4 7501                    	jnz	.ret
  2816 00000CD6 AA                      	stosb
  2817 00000CD7 C3                      .ret:	retn
  2818                                  
  2819                                  		; Store '+' if NASM syntax
  2820                                  		; INP:	di-> buffer
  2821                                  		; OUT:	di-> behind '+' if NASM syntax
  2822                                  		; CHG:	al
  2823                                  store_plus:
  2824 00000CD8 B02B                    	mov	al, '+'
  2825                                  
  2826                                  		; Store al if NASM syntax
  2827                                  		; INP:	di-> buffer
  2828                                  		; OUT:	di-> behind stored byte if NASM syntax
  2829                                  		; CHG:	-
  2830                                  stosb_nasm:
  2831 00000CDA F606[0000]04            	testopt [asm_options], disasm_nasm
  2832 00000CDF 7401                    	jz	.ret
  2833 00000CE1 AA                      	stosb
  2834 00000CE2 C3                      .ret:	retn
  2835                                  
  2836                                  
  2837                                  ;	Memory-only reference (OP_M)
  2838                                  
  2839                                  dop_m:
  2840 00000CE3 E8F706                  	call	getregmem
  2841 00000CE6 3CC0                    	cmp	al, 0C0h
  2842 00000CE8 7303E93FFD              	jb	dop05		; if it's what we expect -->
  2843                                  
  2844                                  		; it's a register reference
  2845 00000CED E97906                  disbad1:jmp	disbad		; this is not supposed to happen -->
  2846                                  
  2847                                  ;	Register reference from MOD R/M part (OP_R_MOD)
  2848                                  
  2849                                  dop_r_mod:
  2850 00000CF0 E8EA06                  	call getregmem
  2851 00000CF3 3CC0                    	cmp	al,0c0h
  2852 00000CF5 72F6                    	jb	disbad1		;if it's a memory reference
  2853 00000CF7 EB03                    	jmp s	dop33
  2854                                  
  2855                                  ;	Pure register reference (OP_R)
  2856                                  
  2857                                  dop_r:
  2858 00000CF9 E8D706                  	call getregmem_r
  2859                                  
  2860                                  dop33:				; <--- used by OP_RM, OP_R_MOD and OP_R_ADD
  2861 00000CFC 2407                    	and	al,7			;entry point for regs from MOD R/M, and others
  2862 00000CFE 8A0E[0001]              	mov	cl,[disflags2]
  2863 00000D02 080E[FE00]              	or	[disflags],cl	;if it was variable size operand, the size
  2864                                  						;should now be marked as known.
  2865 00000D06 80FC00                  	cmp	ah,0
  2866 00000D09 7C11                    	jl	dop35			;if byte register
  2867 00000D0B 740D                    	jz	dop34			;if word register
  2868                                  dop33a:
  2869 00000D0D 80FC20                  	cmp ah, 20h		; qword register (MMX) ?
  2870 00000D10 7415                    	je dop35_1		; -->
  2871                                  dop33b:
  2872 00000D12 50                      	push ax
  2873 00000D13 B045                    	mov al, 'E'
  2874 00000D15 E8E206                  	call dis_lowercase
  2875 00000D18 AA                      	stosb
  2876 00000D19 58                      	pop ax
  2877                                  	;mov	byte [di],'E'	;enter here from OP_ECX
  2878                                  	;inc	di
  2879                                  dop34:
  2880 00000D1A 0408                    	add	al,8
  2881                                  dop35:
  2882 00000D1C 98                      	cbw
  2883 00000D1D D1E0                    	shl	ax,1
  2884 00000D1F 93                      	xchg ax,bx			;mov bx,ax
  2885 00000D20 8B87[0000]              	mov	ax,[rgnam816+bx];get the register name
  2886 00000D24 E96707                  	jmp	dis_stosw_lowercase
  2887                                  
  2888                                  dop35_1:
  2889 00000D27 50                      	push ax
  2890 00000D28 B84D4D                  	mov ax, "MM"
  2891 00000D2B E86007                  	call dis_stosw_lowercase
  2892 00000D2E 58                      	pop ax
  2893 00000D2F 0430                    	add al, '0'
  2894 00000D31 AA                      	stosb
  2895 00000D32 C3                      	retn
  2896                                  
  2897                                  
  2898                                  da_e_cx:
  2899 00000D33 800E[E100]20            	or byte [preused], PREASIZE
  2900 00000D38 F606[E000]20            	test byte [preflags], PREASIZE
  2901 00000D3D 740B                    	jz .deleteparameter
  2902 00000D3F B001                    	mov al, 1
  2903                                  %if _PM
  2904 00000D41 F606[E200]20            	test byte [presizeflags], PRE32A
  2905 00000D46 74D2                    	jz dop34
  2906                                  %endif
  2907 00000D48 EBC8                    	jmp dop33b
  2908                                  
  2909                                  .deleteparameter:
  2910                                  @@:
  2911 00000D4A 4F                      	dec di
  2912 00000D4B 803D2C                  	cmp byte [di], ','
  2913 00000D4E 75FA                    	jne @B
  2914 00000D50 C3                      	retn
  2915                                  
  2916                                  
  2917                                  ;	Register number embedded in the instruction (OP_R_ADD)
  2918                                  
  2919                                  dop_r_add:
  2920 00000D51 A0[E300]                	mov	al,[instru]
  2921 00000D54 EBA6                    	jmp s	dop33
  2922                                  
  2923                                  ;	AL or AX or EAX (OP_AX)
  2924                                  
  2925                                  dop_ax:
  2926 00000D56 B000                    	mov	al,0
  2927 00000D58 EBA2                    	jmp s	dop33
  2928                                  
  2929                                  		; QWORD mem (OP_M64)
  2930                                  		; This operand type is used by CMPXCHG8B, FILD and FISTP.
  2931                                  dop_m64:
  2932                                  	;mov ax, 'Q'		; print "QWORD"
  2933 00000D5A B420                    	mov ah, 20h		; size QWORD
  2934 00000D5C EB35                    	jmp s dop40
  2935                                  
  2936                                  		; FLOAT (=REAL4) mem (OP_MFLOAT)
  2937                                  dop_mfloat:
  2938 00000D5E B8464C                  	mov	ax, "FL"
  2939 00000D61 E82A07                  	call	dis_stosw_lowercase
  2940 00000D64 B84F41                  	mov	ax, "OA"
  2941 00000D67 E82407                  	call	dis_stosw_lowercase
  2942 00000D6A B85420                  	mov	ax, "T "
  2943 00000D6D EB15                    	jmp short dop38c
  2944                                  
  2945                                  ;	DOUBLE (=REAL8) mem (OP_MDOUBLE).
  2946                                  
  2947                                  dop_mdouble:
  2948 00000D6F B8444F                  	mov	ax, "DO"
  2949 00000D72 E81907                  	call	dis_stosw_lowercase
  2950 00000D75 B85542                  	mov	ax, "UB"
  2951 00000D78 E81307                  	call	dis_stosw_lowercase
  2952 00000D7B B04C                    	mov	al, 'L'
  2953 00000D7D E87A06                  	call	dis_lowercase
  2954 00000D80 AA                      	stosb
  2955 00000D81 B84520                  	mov	ax, "E "
  2956                                   dop38c:
  2957 00000D84 E80707                  	call	dis_stosw_lowercase
  2958 00000D87 E84807                  	call	showptr
  2959 00000D8A EB1B                    	jmp s	dop42a
  2960                                  
  2961                                  ;	TBYTE (=REAL10) mem (OP_M80).
  2962                                  
  2963                                  dop_m80:
  2964 00000D8C B854FF                  	mov	ax,0FF00h+'T'	;print 'T' + "BYTE"
  2965 00000D8F E86806                  	call dis_lowercase
  2966 00000D92 AA                      	stosb
  2967                                  dop40:
  2968 00000D93 E84706                  	call getregmem
  2969 00000D96 3CC0                    	cmp	al,0c0h
  2970 00000D98 7317                    	jae	disbad5		; if it's a register reference
  2971 00000D9A 800E[FE00]80            	or	byte [disflags], DIS_I_DONTSHOW
  2972                                  				; don't show this
  2973 00000D9F E98AFC                  	jmp	dop05
  2974                                  
  2975                                  %if 0
  2976                                  	; Far memory (OP_FARMEM).
  2977                                  	; This is either a FAR16 (DWORD) or FAR32 (FWORD) pointer.
  2978                                  dop_farmem:
  2979                                  	call	dischk32d
  2980                                  	jz	dop41a		; if not dword far
  2981                                  	call	showdword
  2982                                  dop41a:
  2983                                  	mov	ax, "FA"	; store "FAR "
  2984                                  	call	dis_stosw_lowercase
  2985                                  	mov	ax, "R "
  2986                                  	call	dis_stosw_lowercase
  2987                                  %endif
  2988                                  
  2989                                  ;	mem (OP_MXX).
  2990                                  
  2991                                  dop_mxx:
  2992 00000DA2 800E[FE00]80            	or	byte [disflags], DIS_I_DONTSHOW
  2993                                  				; don't show this
  2994                                  dop42a:
  2995 00000DA7 E83306                  	call	getregmem
  2996 00000DAA 3CC0                    	cmp	al,0c0h
  2997 00000DAC 7303E98CFC              	jb	dop06		; mem ref, don't show size -->
  2998                                  disbad5:
  2999 00000DB1 E9B505                  	jmp	disbad
  3000                                  
  3001                                  	; Far immediate (OP_FARP). Either FAR16 or FAR32.
  3002                                  dop_farimm:
  3003 00000DB4 E8D607                  	call disgetword
  3004 00000DB7 50                      	push ax
  3005                                   %if _DISASM_32BIT
  3006 00000DB8 E84607                  	call dischk32d
  3007 00000DBB 7410                    	jz dop44_word		; if not 32-bit address
  3008                                  
  3009                                  dop44_dword:
  3010                                  %if _PM
  3011 00000DBD F606[0000]40            	test byte [bCSAttr],40h	; for 16-bit code segments
  3012 00000DC2 7503                    	jnz @F			; no need to display "WORD "
  3013                                  %endif
  3014 00000DC4 E8F306                  	call showdword
  3015                                  @@:
  3016                                  
  3017 00000DC7 E8C307                  	call disgetword
  3018 00000DCA 50                      	push ax
  3019 00000DCB EB0A                    	jmp dop44_common
  3020                                   %endif
  3021                                  
  3022                                  dop44_word:
  3023                                  %if _PM
  3024                                   %if _DISASM_32BIT
  3025 00000DCD F606[0000]40            	test byte [bCSAttr],40h	; for 32-bit code segments
  3026 00000DD2 7403                    	jz @F			; no need to display "DWORD "
  3027 00000DD4 E8E906                  	call showword
  3028                                  @@:
  3029                                   %endif
  3030                                  %endif
  3031                                  
  3032                                  dop44_common:
  3033 00000DD7 E8B307                  	call disgetword
  3034                                  %if _MEMREF_AMOUNT
  3035 00000DDA E8AD01                  	call get_free_memref
  3036 00000DDD 8987[9800]              	mov word [memrefs + bx + mrSegmentSelector], ax
  3037                                  %endif
  3038 00000DE1 E8(0000)                	call hexword
  3039                                  %if _IMMASM
  3040 00000DE4 A3[0400]                	mov word [immasm_far_target + 4], ax
  3041 00000DE7 31C0                    	xor ax, ax
  3042 00000DE9 A3[0200]                	mov word [immasm_far_target + 2], ax
  3043                                  %endif
  3044 00000DEC B03A                    	mov	al,':'
  3045 00000DEE AA                      	stosb
  3046                                   %if _DISASM_32BIT
  3047 00000DEF E80F07                  	call dischk32d
  3048 00000DF2 7410                    	jz	dop45		;if not 32-bit address
  3049 00000DF4 58                      	pop	ax
  3050                                  %if _IMMASM
  3051 00000DF5 A3[0200]                	mov word [immasm_far_target + 2], ax
  3052                                  %endif
  3053                                  %if _MEMREF_AMOUNT
  3054 00000DF8 8987[9600]              	mov word [memrefs + bx + mrOffset + 2], ax
  3055 00000DFC 808F[9A00]10            	or byte [memrefs + bx + mrFlags], mrfA32
  3056                                  %endif
  3057 00000E01 E8(0000)                	call hexword
  3058                                  dop45:
  3059                                   %endif
  3060 00000E04 58                      	pop	ax
  3061                                  %if _IMMASM
  3062 00000E05 A3[0000]                	mov word [immasm_far_target], ax
  3063                                  %endif
  3064                                  %if _MEMREF_AMOUNT
  3065 00000E08 8987[9400]              	mov word [memrefs + bx + mrOffset], ax
  3066 00000E0C 808F[9A00]01            	or byte [memrefs + bx + mrFlags], mrfBranchDirect
  3067 00000E11 E89701                  	call calc_linear_memref_and_mark_nonfree
  3068                                  %endif
  3069 00000E14 E9(0000)                	jmp hexword
  3070                                  
  3071                                  
  3072                                  %if _COND
  3073                                  		; INP:	[presizeflags] & PRE32A, d[reg_ecx]
  3074                                  		; OUT:	dx:ax = (e)cx
  3075                                  cond_get_ecx:
  3076 00000E17 A1[0000]                	mov ax, word [reg_ecx]
  3077                                   %if _DISASM_32BIT
  3078 00000E1A F606[E200]20            	test byte [presizeflags], PRE32A	; A32 ?
  3079 00000E1F 8B16[0200]              	mov dx, word [reg_ecx+2]
  3080 00000E23 7502                    	jnz .ecx
  3081                                   %endif
  3082 00000E25 31D2                    	xor dx, dx
  3083                                  .ecx:
  3084 00000E27 C3                      	retn
  3085                                  
  3086                                  		; INP:	ax = 0..15 condition code, else invalid
  3087                                  		; OUT:	w[condmsg] set as appropriate
  3088                                  cond_handle:
  3089 00000E28 83F80F                  	cmp ax, 15
  3090 00000E2B 7738                    	ja .return
  3091 00000E2D 8B0E[0000]              	mov cx, word [reg_efl]	; get flags
  3092 00000E31 89C3                    	mov bx, ax
  3093 00000E33 80E3FE                  	and bl, ~1		; make even
  3094 00000E36 2401                    	and al, 1		; 1 if negated condition
  3095 00000E38 80FB0C                  	cmp bl, 12		; L/GE or LE/G?
  3096 00000E3B 7306                    	jae .specific		; yes -->
  3097                                  
  3098 00000E3D 858F[5601]              	test cx, [cond_table+bx]; flag(s) set ?
  3099 00000E41 EB14                    	jmp short .jump_ZF	; NZ if (normal) condition true -->
  3100                                  
  3101                                  .specific:
  3102 00000E43 80FB0E                  	cmp bl, 14
  3103 00000E46 7205                    	jb .L_GE
  3104                                  
  3105                                  		; Handle LE/NG and G/NLE conditions.
  3106                                  		; The former says ZF | (OF ^ SF).
  3107                                  .LE_G:
  3108 00000E48 F6C140                  	test cl, 40h		; ZF | ..
  3109 00000E4B 750C                    	jnz .jump_true
  3110                                  
  3111                                  		; Handle L/NGE and GE/NL conditions.
  3112                                  		; The former says OF ^ SF.
  3113                                  .L_GE:
  3114 00000E4D 81E18008                	and cx, 880h		; OF ^ SF
  3115 00000E51 7408                    	jz .jump_false		; both clear -->
  3116 00000E53 81F18008                	xor cx, 880h
  3117                                  .jump_ZF:
  3118 00000E57 7402                    	jz .jump_false		; both set --> (or ZR: (normal) condition false)
  3119                                  .jump_true:
  3120 00000E59 3401                    	xor al, 1		; (negating ^ raw truth) = cooked truth
  3121                                  .jump_false:
  3122 00000E5B 84C0                    	test al, al		; true ?
  3123 00000E5D 7507                    	jnz .msg_jumping	; yes -->
  3124                                  
  3125                                  .msg_notjumping:
  3126 00000E5F C706[0801][0000]        	mov word [condmsg], msg.condnotjump
  3127                                  .return:
  3128 00000E65 C3                      	retn
  3129                                  
  3130                                  .msg_jumping:
  3131 00000E66 C706[0801][0000]        	mov word [condmsg], msg.condjump
  3132 00000E6C C3                      	retn
  3133                                  %endif
  3134                                  
  3135                                  
  3136                                  ;	8-bit relative jump (OP_REL8)
  3137                                  
  3138                                  dop_rel8:
  3139                                  %if _COND
  3140 00000E6D A1[E800]                	mov ax, word [index]
  3141 00000E70 3DE300                  	cmp ax, 0E3h
  3142 00000E73 772C                    	ja .cond_done		; no conditional jump -->
  3143 00000E75 7211                    	jb .cond_noncx		; not jcxz, check for other -->
  3144                                  
  3145 00000E77 E89DFF                  	call cond_get_ecx
  3146 00000E7A 09D0                    	or ax, dx
  3147 00000E7C 7405                    	jz .cond_msg_jumping
  3148                                  .cond_msg_notjumping:
  3149 00000E7E E8DEFF                  	call cond_handle.msg_notjumping
  3150 00000E81 EB1E                    	jmp short .cond_done
  3151                                  
  3152                                  .cond_msg_jumping:
  3153 00000E83 E8E0FF                  	call cond_handle.msg_jumping
  3154 00000E86 EB19                    	jmp short .cond_done
  3155                                  
  3156                                  .cond_noncx:
  3157 00000E88 3CE0                    	cmp al, 0E0h
  3158 00000E8A 7210                    	jb .cond_nonloop	; not loop, check for other -->
  3159                                  
  3160 00000E8C 50                      	push ax
  3161 00000E8D E887FF                  	call cond_get_ecx
  3162 00000E90 48                      	dec ax			; = 0 if cx is 1
  3163 00000E91 09D0                    	or ax, dx		; = 0 if cx is 1 and ecx is cx
  3164 00000E93 58                      	pop ax
  3165 00000E94 74E8                    	jz .cond_msg_notjumping	; if (e)cx is 1 -->
  3166 00000E96 3CE2                    	cmp al, 0E2h
  3167 00000E98 74E9                    	je .cond_msg_jumping	; loop without additional condition -->
  3168 00000E9A 3495                    	xor al, 0E0h^75h	; E0h (loopnz) to 75h (jnz),
  3169                                  				;  E1h (loopz) to 74h (jz)
  3170                                  
  3171                                  .cond_nonloop:
  3172 00000E9C 2C70                    	sub al, 70h		; (ah = 0)
  3173 00000E9E E887FF                  	call cond_handle	; call common code (checks for ax < 16)
  3174                                  .cond_done:
  3175                                  %endif
  3176 00000EA1 E8CD06                  	call disgetbyte
  3177 00000EA4 98                      	cbw
  3178 00000EA5 A2[E400]                	mov byte [disp8], al
  3179 00000EA8 E99E00                  	jmp dop48
  3180                                  
  3181                                  ;	16/32-bit relative jump (OP_REL1632)
  3182                                  
  3183                                  dop_rel1632:
  3184                                  %if _COND
  3185 00000EAB A1[E800]                	mov ax, word [index]
  3186 00000EAE 2D[8000]                	sub ax, SPARSE_BASE+80h
  3187 00000EB1 E874FF                  	call cond_handle
  3188                                  %endif
  3189 00000EB4 E8D606                  	call disgetword
  3190                                   %if _DISASM_32BIT
  3191 00000EB7 E84706                  	call dischk32d
  3192 00000EBA 7465                    	jz dop48_near		; if not 32-bit offset
  3193 00000EBC 92                      	xchg ax, dx	; mov dx, ax
  3194 00000EBD E8CD06                  	call disgetword
  3195                                  
  3196 00000EC0 813E[E800]E800          	cmp word [index], 00E8h
  3197 00000EC6 7429                    	je .not_show_keyword	; no need to distinguish NEAR call -->
  3198                                  		; ax:dx between FFFFh:FF80h (-128) .. 0000h:007Fh (127):
  3199                                  		; == show "NEAR" keyword
  3200                                  		;
  3201                                  		; Note:	This is not entirely correct. If a jump short is
  3202                                  		;	 used, the actual opcode is shorter, thus the
  3203                                  		;	 exact distance that can be reached by the jump short
  3204                                  		;	 differs from what the jump near can reach with
  3205                                  		;	 a rel16/32 displacement between -128..127.
  3206 00000EC8 83F8FF                  	cmp ax, -1
  3207 00000ECB 7410                    	je .checkminus
  3208 00000ECD 85C0                    	test ax, ax
  3209 00000ECF 7520                    	jnz .not_show_keyword
  3210                                  .checkplus:
  3211 00000ED1 83FA7F                  	cmp dx, byte 127
  3212 00000ED4 7F1B                    	jg .not_show_keyword
  3213 00000ED6 83FA00                  	cmp dx, 0
  3214 00000ED9 7C16                    	jl .not_show_keyword
  3215 00000EDB EB0A                    	jmp .show_keyword
  3216                                  
  3217                                  .checkminus:
  3218 00000EDD 83FA80                  	cmp dx, byte -128
  3219 00000EE0 7C0F                    	jl .not_show_keyword
  3220 00000EE2 83FA00                  	cmp dx, 0
  3221 00000EE5 7D0A                    	jge .not_show_keyword
  3222                                  
  3223                                  .show_keyword:
  3224 00000EE7 F606[0000]20            	testopt [asm_options], disasm_show_near
  3225 00000EEC 7503                    	jnz .not_show_keyword
  3226 00000EEE E86604                  	call dop_show_near
  3227                                  .not_show_keyword:
  3228                                  
  3229                                  %if _PM
  3230 00000EF1 F606[0000]40            	test byte [bCSAttr],40h	; for 32-bit code segments
  3231 00000EF6 7505                    	jnz @F			; no need to display "DWORD "
  3232                                  %endif
  3233 00000EF8 50                      	push ax
  3234 00000EF9 E8BE05                  	call showdword
  3235 00000EFC 58                      	pop ax
  3236                                  @@:
  3237                                  
  3238 00000EFD 8B1E[0000]              	mov	bx,[u_addr+0]
  3239 00000F01 031E[DC00]              	add	bx,[dis_n]
  3240 00000F05 1306[DE00]              	adc	ax,[dis_n + 2]
  3241 00000F09 01DA                    	add	dx,bx
  3242                                  %if _PM
  3243 00000F0B 1306[0200]              	adc	ax,[u_addr+2]
  3244                                  %else
  3245                                  	adc	ax, 0
  3246                                  %endif
  3247                                  %if _MEMREF_AMOUNT
  3248 00000F0F E87800                  	call get_free_memref
  3249 00000F12 8987[9600]              	mov word [memrefs + bx + mrOffset + 2], ax
  3250 00000F16 808F[9A00]10            	or byte [memrefs + bx + mrFlags], mrfA32
  3251                                  %endif
  3252 00000F1B E8(0000)                	call hexword
  3253 00000F1E 92                      	xchg ax,dx
  3254 00000F1F EB4F                    	jmp s	dop_branch_word
  3255                                   %endif
  3256                                  
  3257                                  dop48_near:
  3258 00000F21 813E[E800]E800          	cmp word [index], 00E8h
  3259 00000F27 7414                    	je @F			; no need to distinguish NEAR call -->
  3260                                  		; ax between FF80h (-128) .. 007Fh (127):
  3261                                  		; == show "NEAR" keyword
  3262                                  		;
  3263                                  		; Note:	This is not entirely correct. If a jump short is
  3264                                  		;	 used, the actual opcode is shorter, thus the
  3265                                  		;	 exact distance that can be reached by the jump short
  3266                                  		;	 differs from what the jump near can reach with
  3267                                  		;	 a rel16/32 displacement between -128..127.
  3268 00000F29 83F880                  	cmp ax, byte -128
  3269 00000F2C 7C0F                    	jl @F
  3270 00000F2E 83F87F                  	cmp ax, byte 127
  3271 00000F31 7F0A                    	jg @F
  3272 00000F33 F606[0000]20            	testopt [asm_options], disasm_show_near
  3273 00000F38 7503                    	jnz @F
  3274 00000F3A E81A04                  	call dop_show_near
  3275                                  @@:
  3276                                  
  3277                                  %if _PM && _DISASM_32BIT
  3278 00000F3D F606[0000]40            	test byte [bCSAttr],40h	; for 16-bit code segments
  3279 00000F42 7405                    	jz @F			; no need to display "WORD "
  3280 00000F44 50                      	push ax
  3281 00000F45 E87805                  	call showword
  3282 00000F48 58                      	pop ax
  3283                                  @@:
  3284                                  %endif
  3285                                  
  3286                                  dop48:
  3287 00000F49 99                      	cwd
  3288 00000F4A 0306[0000]              	add ax, word [u_addr]
  3289                                  %if _PM
  3290 00000F4E 1316[0200]              	adc dx, word [u_addr + 2]
  3291                                  %else
  3292                                  	adc dx, 0
  3293                                  %endif
  3294 00000F52 0306[DC00]              	add ax, word [dis_n]
  3295 00000F56 1316[DE00]              	adc dx, word [dis_n + 2]
  3296                                   %if _DISASM_32BIT
  3297 00000F5A E8A405                  	call dischk32d		; 32-bit opsize ?
  3298 00000F5D 7411                    	jz .16			; no -->
  3299 00000F5F 92                      	xchg ax, dx
  3300 00000F60 E8(0000)                	call hexword		; yes, display high word
  3301 00000F63 92                      	xchg ax, dx
  3302                                  %if _MEMREF_AMOUNT
  3303 00000F64 E82300                  	call get_free_memref
  3304 00000F67 8997[9600]              	mov word [memrefs + bx + mrOffset + 2], dx
  3305 00000F6B 808F[9A00]10            	or byte [memrefs + bx + mrFlags], mrfA32
  3306                                  %endif
  3307                                  .16:
  3308                                   %endif
  3309                                  
  3310                                  dop_branch_word:
  3311                                  %if _MEMREF_AMOUNT
  3312 00000F70 E81700                  	call get_free_memref
  3313 00000F73 8987[9400]              	mov word [memrefs + bx + mrOffset], ax
  3314 00000F77 FF36[0400]              	push word [u_addr + saSegSel]
  3315 00000F7B 8F87[9800]              	pop word [memrefs + bx + mrSegmentSelector]
  3316 00000F7F 808F[9A00]01            	or byte [memrefs + bx + mrFlags], mrfBranchDirect
  3317 00000F84 E82400                  	call calc_linear_memref_and_mark_nonfree
  3318                                  %endif
  3319 00000F87 E9(0000)                	jmp hexword		; call hexword and return
  3320                                  
  3321                                  
  3322                                  %if _MEMREF_AMOUNT
  3323                                  		; INP:	word [memrefs.free]
  3324                                  		; OUT:	bx = byte index into memref array
  3325                                  		; CHG:	-
  3326                                  		; STT:	ss = ds = es
  3327                                  get_free_memref:
  3328 00000F8A 8B1E[D000]              	mov bx, [memrefs.free]
  3329                                  get_memref_index_bx:
  3330 00000F8E 83FB04                  	cmp bx, _MEMREF_AMOUNT
  3331 00000F91 7309                    	jae @F
  3332 00000F93 01DB                    	add bx, bx
  3333 00000F95 01DB                    	add bx, bx
  3334 00000F97 01DB                    	add bx, bx
  3335 00000F99 01DB                    	add bx, bx
  3336                                  %if MEMREF_size != 16
  3337                                   %error Adjust multiplication
  3338                                  %endif
  3339 00000F9B C3                      	retn
  3340                                  
  3341                                  @@:
  3342 00000F9C B83901                  	mov ax, 0139h
  3343 00000F9F E8(0000)                	call setrc
  3344 00000FA2 BA[0000]                	mov dx, msg.memrefs_invalid_internal
  3345 00000FA5 E8(0000)                	call putsz
  3346 00000FA8 E9(0000)                	jmp cmd3
  3347                                  
  3348                                  
  3349                                  		; INP:	word [memrefs.free]
  3350                                  		;	[memrefs] array entry
  3351                                  		; OUT:	NC if valid segmented address (getlinear succeeded),
  3352                                  		;	 dword [memrefs + x + mrLinear] filled
  3353                                  		;	 word [memrefs.free] incremented
  3354                                  		;	CY if invalid address,
  3355                                  		;	 [memrefs + x] re-initialised
  3356                                  		;	 word [memrefs.free] left unmodified
  3357                                  		; CHG:	-
  3358                                  		; STT:	ss = ds = es
  3359                                  calc_linear_memref_and_mark_nonfree:
  3360 00000FAB 50                      	push ax
  3361 00000FAC 53                      	push bx
  3362 00000FAD 66                      	_386_PM_o32
  3363 00000FAE 52                      	push dx
  3364 00000FAF E8D8FF                  	call get_free_memref
  3365 00000FB2 53                      	push bx
  3366 00000FB3 66                      	_386_PM_o32
  3367 00000FB4 8B97[9400]              	mov dx, word [memrefs + bx + mrOffset]
  3368 00000FB8 8B9F[9800]              	mov bx, word [memrefs + bx + mrSegmentSelector]
  3369 00000FBC E8(0000)                	call getlinear_32bit
  3370 00000FBF 5B                      	pop bx
  3371 00000FC0 7211                    	jc .error
  3372                                  
  3373 00000FC2 8987[9000]              	mov word [memrefs + bx + mrLinear], ax
  3374 00000FC6 8997[9200]              	mov word [memrefs + bx + mrLinear + 2], dx
  3375 00000FCA FF06[D000]              	inc word [memrefs.free]
  3376                                  
  3377                                  	; clc
  3378                                  .return:
  3379 00000FCE 66                      	_386_PM_o32
  3380 00000FCF 5A                      	pop dx
  3381 00000FD0 5B                      	pop bx
  3382 00000FD1 58                      	pop ax
  3383 00000FD2 C3                      	retn
  3384                                  
  3385                                  .error:
  3386 00000FD3 57                      	push di
  3387 00000FD4 8DBF[9000]              	lea di, [memrefs + bx]
  3388 00000FD8 E80400                  	call init_one_memref
  3389 00000FDB 5F                      	pop di
  3390 00000FDC F9                      	stc
  3391 00000FDD EBEF                    	jmp .return
  3392                                  
  3393                                  
  3394                                  		; INP:	di -> memref to initialise
  3395                                  		; OUT:	ax = 0
  3396                                  		;	di -> past initialised memref
  3397                                  		; CHG:	-
  3398                                  		; STT:	ss = ds = es
  3399                                  init_one_memref:
  3400 00000FDF 31C0                    	xor ax, ax
  3401                                  
  3402                                  		; INP:	di -> memref to initialise
  3403                                  		;	ax = 0
  3404                                  		; OUT:	di -> past initialised memref
  3405                                  		; CHG:	-
  3406                                  		; STT:	ss = ds = es
  3407                                  .ax_already_zero:
  3408 00000FE1 AB                      	stosw				; zero-initialise all memrefs
  3409 00000FE2 AB                      	stosw				; mrLinear
  3410 00000FE3 AB                      	stosw
  3411 00000FE4 AB                      	stosw				; mrOffset
  3412 00000FE5 AB                      	stosw				; mrSegmentSelector
  3413 00000FE6 AB                      	stosw				; mrFlags
  3414 00000FE7 40                      	inc ax
  3415 00000FE8 AB                      	stosw
  3416 00000FE9 48                      	dec ax
  3417 00000FEA AB                      	stosw				; mrLength = 1
  3418 00000FEB C3                      	retn
  3419                                  
  3420                                  
  3421                                  		; INP:	si = address of segreg (reg_cs, reg_ds, etc)
  3422                                  		;	di = address of index reg (reg_esi or reg_edi)
  3423                                  		;	[memrefs]
  3424                                  		;	[presizeflags]
  3425                                  		;	byte [index] = which opcode
  3426                                  		;	[reg_ecx]
  3427                                  		;	[reg_efl] & 400h = Direction Flag
  3428                                  		; OUT:	memrefs + bx -> current memref (partially filled)
  3429                                  		; CHG:	bx, si, di, cx, dx
  3430                                  init_string_memref:
  3431 00000FEC E89BFF                  	call get_free_memref
  3432 00000FEF FF34                    	push word [si]		; get segment/selector
  3433 00000FF1 8F87[9800]              	pop word [memrefs + bx + mrSegmentSelector]
  3434                                  				; store segment/selector
  3435 00000FF5 FF35                    	push word [di]
  3436 00000FF7 8F87[9400]              	pop word [memrefs + bx + mrOffset]
  3437                                  				; store low word of offset
  3438 00000FFB 8B0E[D600]              	mov cx, word [string_memref_counter + 2]
  3439 00000FFF 8B16[D400]              	mov dx, word [string_memref_counter]
  3440                                  
  3441 00001003 F606[E200]20            	test byte [presizeflags], PRE32A
  3442 00001008 740C                    	jz @F			; if 16-bit addressing -->
  3443 0000100A FF7502                  	push word [di + 2]
  3444 0000100D 8F87[9600]              	pop word [memrefs + bx + mrOffset + 2]
  3445                                  				; store high word of offset
  3446 00001011 808F[9A00]10            	or byte [memrefs + bx + mrFlags], mrfA32
  3447                                  				; remember that it is a32
  3448                                  @@:
  3449                                  
  3450 00001016 F606[E000]02            	test byte [preflags], PREREP
  3451 0000101B 7505                    	jnz @F			; if to take (e)cx repetitions -->
  3452 0000101D BA0100                  	mov dx, 1
  3453 00001020 31C9                    	xor cx, cx		; cx:dx = 1, just one element
  3454                                  @@:
  3455                                  
  3456 00001022 50                      	push ax
  3457 00001023 B80100                  	mov ax, 1
  3458 00001026 F606[E800]01            	test byte [index], 1	; element size is byte ?
  3459 0000102B 740A                    	jz @F			; yes, ax = 1
  3460 0000102D 40                      	inc ax			; = 2
  3461                                   %if _DISASM_32BIT
  3462 0000102E F606[E200]10            	test byte [presizeflags], PRE32D
  3463                                  				; element size is word ?
  3464 00001033 7402                    	jz @F			; yes, ax = 2
  3465 00001035 01C0                    	add ax, ax		; = 4
  3466                                   %endif
  3467                                  @@:
  3468                                  
  3469 00001037 3C01                    	cmp al, 1		; byte size ?
  3470 00001039 7415                    	je @F			; yes, do not multiply -->
  3471 0000103B 01D2                    	add dx, dx
  3472 0000103D 11C9                    	adc cx, cx		; * 2, word to byte
  3473 0000103F 720A                    	jc .carry_counter
  3474 00001041 3C02                    	cmp al, 2		; word size ?
  3475 00001043 740B                    	je @F			; yes, done multiplying -->
  3476 00001045 01D2                    	add dx, dx
  3477 00001047 11C9                    	adc cx, cx		; * 4, dword to byte
  3478 00001049 7305                    	jnc @F
  3479                                  .carry_counter:
  3480 0000104B BAFFFF                  	mov dx, -1
  3481 0000104E 89D1                    	mov cx, dx		; in case the counter is large
  3482                                  		; A carry out of an a16 address is not yet handled.
  3483                                  		;  Note that eg cx=8000h a16 movsw may be valid to
  3484                                  		;  copy exactly 64 KiB. Likewise, technically a
  3485                                  		;  size of exactly 4 GiB is valid; however, our
  3486                                  		;  memref format cannot store that.
  3487                                  @@:
  3488 00001050 8997[9C00]              	mov word [memrefs + bx + mrLength], dx
  3489 00001054 898F[9E00]              	mov word [memrefs + bx + mrLength + 2], cx
  3490                                  
  3491 00001058 F606[0100]04            	testopt [reg_efl], 400h	; DF set ?
  3492 0000105D 7411                    	jz @F
  3493                                  
  3494 0000105F 0187[9400]              	add word [memrefs + bx + mrOffset], ax
  3495 00001063 8397[9600]00            	adc word [memrefs + bx + mrOffset + 2], 0
  3496 00001068 2997[9400]              	sub word [memrefs + bx + mrOffset], dx
  3497 0000106C 198F[9600]              	sbb word [memrefs + bx + mrOffset + 2], cx
  3498                                  
  3499                                  @@:
  3500 00001070 58                      	pop ax
  3501 00001071 C3                      	retn
  3502                                  %endif
  3503                                  
  3504                                  
  3505                                  ;	Check for ST(1) (OP_1CHK).
  3506                                  
  3507                                  dop49:
  3508 00001072 58                      	pop	ax		;discard return address
  3509 00001073 A0[0000]                	mov	al,[regmem]
  3510 00001076 2407                    	and	al,7
  3511 00001078 3C01                    	cmp	al,1
  3512 0000107A 7403                    	je	dop50		;if it's ST(1)
  3513 0000107C E9A0F1                  	jmp	da14		;another operand (but no comma)
  3514                                  
  3515                                  dop50:
  3516 0000107F E93DF2                  	jmp	da_op_end	; end of list -->
  3517                                  
  3518                                  ;	ST(I) (OP_STI).
  3519                                  
  3520                                  dop_sti:
  3521 00001082 A0[0000]                	mov al, byte [regmem]
  3522 00001085 2407                    	and al, 7
  3523 00001087 93                      	xchg ax, bx		;mov bx,ax
  3524 00001088 B85354                  	mov ax, 'ST'
  3525 0000108B E80004                  	call dis_stosw_lowercase; store ST(bl)
  3526 0000108E B028                    	mov al, '('
  3527 00001090 AA                      	stosb
  3528 00001091 B83029                  	mov ax, '0)'
  3529 00001094 08D8                    	or al, bl
  3530 00001096 AB                      	stosw
  3531 00001097 C3                      	retn
  3532                                  
  3533                                  ;	CRx (OP_CR).
  3534                                  
  3535                                  dop_cr:
  3536 00001098 BB4352                  	mov	bx,'CR'
  3537 0000109B E83503                  	call getregmem_r
  3538 0000109E 3C04                    	cmp	al,4
  3539 000010A0 7713                    	ja	disbad4		;if too large
  3540 000010A2 7505                    	jne	dop52a
  3541 000010A4 C606[0000]05            	mov	byte [dismach],5	;CR4 is new to the 586
  3542                                  dop52a:
  3543 000010A9 813E[E800][2200]        	cmp	word [index],SPARSE_BASE+22h
  3544 000010AF 7528                    	jne	dop55		;if not MOV CRx,xx
  3545 000010B1 3C01                    	cmp	al,1
  3546 000010B3 7524                    	jne	dop55		;if not CR1
  3547                                  
  3548 000010B5 E9B102                  disbad4:jmp	disbad		;can't MOV CR1,xx
  3549                                  
  3550                                  ;	DRx (OP_DR).
  3551                                  
  3552                                  dop_dr:
  3553 000010B8 E81803                  	call getregmem_r
  3554 000010BB BB4452                  	mov	bx,'DR'
  3555 000010BE B9FFFF                  	mov	cx,-1		;no max or illegal value
  3556 000010C1 EB16                    	jmp s	dop55
  3557                                  
  3558                                  ;	TRx (OP_TR).
  3559                                  
  3560                                  dop_tr:
  3561 000010C3 E80D03                  	call getregmem_r
  3562 000010C6 3C03                    	cmp	al,3
  3563 000010C8 7303E99C02              	jb	disbad		;if too small
  3564 000010CD 3C06                    	cmp	al,6
  3565 000010CF 7305                    	jae	dop54a		;if TR6-7
  3566 000010D1 C606[0000]04            	mov	byte [dismach],4	;TR3-5 are new to the 486
  3567                                  dop54a:
  3568 000010D6 BB5452                  	mov	bx,'TR'
  3569                                  
  3570                                  dop55:
  3571 000010D9 93                      	xchg ax, bx
  3572 000010DA E8B103                  	call dis_stosw_lowercase; store XX
  3573 000010DD 93                      	xchg ax, bx
  3574 000010DE 0C30                    	or al, '0'
  3575 000010E0 AA                      	stosb
  3576 000010E1 C3                      	retn
  3577                                  
  3578                                  ;	Segment register (OP_SEGREG).
  3579                                  
  3580                                  dop_segreg:
  3581 000010E2 E8EE02                  	call getregmem_r
  3582 000010E5 3C06                    	cmp	al,6
  3583 000010E7 7203E97D02              	jae	disbad		; if not a segment register -->
  3584 000010EC F606[0000]80            	testopt [asm_options], disasm_nec
  3585 000010F1 7504                    	jnz	.nec		; allow mov from or to any segreg
  3586 000010F3 3C02                    	cmp	al,2
  3587 000010F5 7505                    	jne	@F		; if not SS -->
  3588                                  .nec:
  3589 000010F7 800E[FE00]40            	or	byte [disflags], DIS_I_MOV_SS	; note this
  3590                                  @@:
  3591 000010FC 3C04                    	cmp	al,4
  3592 000010FE 7205                    	jb dop57a		;if not FS or GS
  3593 00001100 C606[0000]03            	mov	byte [dismach],3;(no new 486-686 instructions involve seg regs)
  3594                                  dop57a:
  3595 00001105 0410                    	add	al,16
  3596 00001107 E912FC                  	jmp	dop35		;go print it out
  3597                                  
  3598                                  ;	Sign-extended immediate byte (OP_IMMS8). "push xx"
  3599                                  
  3600                                  dop_imms8:
  3601 0000110A E86404                  	call disgetbyte
  3602 0000110D 3C00                    	cmp	al,0
  3603 0000110F 93                      	xchg ax,bx		;mov bl,al
  3604 00001110 B02B                    	mov	al,'+'
  3605 00001112 7D04                    	jge	dop58a		;if >= 0
  3606 00001114 F6DB                    	neg	bl
  3607 00001116 B02D                    	mov	al,'-'
  3608                                  dop58a:
  3609 00001118 AA                      	stosb
  3610 00001119 93                      	xchg ax,bx		;mov al,bl
  3611 0000111A EB03                    	jmp s	dop59a		;call hexbyte and return
  3612                                  
  3613                                  
  3614                                  ;	Immediate byte (OP_IMM8).
  3615                                  
  3616                                  dop_imm8:
  3617 0000111C E85204                  	call disgetbyte
  3618                                  dop59a:
  3619 0000111F E9(0000)                	jmp	hexbyte		;call hexbyte and return
  3620                                  
  3621                                  
  3622                                  dop_imm8_int:
  3623 00001122 E84C04                  	call disgetbyte
  3624 00001125 3C03                    	cmp al, 3
  3625                                  @@:
  3626 00001127 75F6                    	jne dop59a
  3627 00001129 50                      	push ax
  3628 0000112A E88203                  	call showsize.byte
  3629 0000112D 58                      	pop ax
  3630 0000112E EBEF                    	jmp dop59a
  3631                                  
  3632                                  dop_imm8_shiftrot:
  3633 00001130 E83E04                  	call disgetbyte
  3634 00001133 3C01                    	cmp al, 1
  3635 00001135 EBF0                    	jmp @B
  3636                                  
  3637                                  dop_imm8_optional:
  3638 00001137 E83704                  	call disgetbyte
  3639 0000113A 3C0A                    	cmp al, 10
  3640 0000113C 75E1                    	jne dop59a
  3641 0000113E 58                      	pop ax
  3642 0000113F E97DF1                  	jmp da_op_end
  3643                                  
  3644                                  
  3645                                  	; Show MMx reg (OP_MMX; previously was "Show ECX if 32-bit LOOPxx").
  3646                                  dop_mmx:
  3647 00001142 BB4D4D                  	mov bx, "MM"
  3648 00001145 E88B02                  	call getregmem_r
  3649                                  dop55_j:
  3650 00001148 EB8F                    	jmp short dop55
  3651                                  
  3652                                  	; MMX register (in ModR/M part)
  3653                                  dop_mmx_mod:
  3654 0000114A BB4D4D                  	mov bx, "MM"
  3655 0000114D E88D02                  	call getregmem
  3656 00001150 3CC0                    	cmp al, 0C0h
  3657 00001152 7303E91202              	jb disbad		; needs to be encoded as register -->
  3658 00001157 2407                    	and al, 7
  3659 00001159 EBED                    	jmp short dop55_j
  3660                                  
  3661                                  
  3662                                  dop_x:
  3663 0000115B AC                      	lodsb
  3664 0000115C B400                    	mov ah, 0
  3665 0000115E 93                      	xchg bx, ax
  3666 0000115F 01DB                    	add bx, bx
  3667 00001161 FFA7[7A00]              	jmp [disjmp_opx + bx]
  3668                                  
  3669                                  
  3670                                  dop_loop_option:
  3671 00001165 F606[0200]02            	testopt [asm_options], disasm_asize_loop_nasm
  3672 0000116A 745E                    	jz dop60a_3
  3673 0000116C 58                      	pop ax
  3674                                   %if _LINK
  3675 0000116D BE[0000]                	mov si, mnlist
  3676                                   wlcalc word_ext_MN_LOOP, equ $ - 2
  3677                                   %else
  3678                                  	mov si, mnlist+MN_LOOP
  3679                                   %endif
  3680 00001170 803E[E300]E1            	cmp byte [instru], 0E1h
  3681 00001175 7708                    	ja @F
  3682                                   %if _LINK
  3683 00001177 BE[0000]                	mov si, mnlist
  3684                                   wlcalc word_ext_MN_LOOPZ, equ $ - 2
  3685                                   %else
  3686                                  	mov si, mnlist+MN_LOOPZ
  3687                                   %endif
  3688 0000117A 7403                    	je @F
  3689                                   %if _LINK
  3690 0000117C BE[0000]                	mov si, mnlist
  3691                                   wlcalc word_ext_MN_LOOPNZ, equ $ - 2
  3692                                   %else
  3693                                  	mov si, mnlist+MN_LOOPNZ
  3694                                   %endif
  3695                                  @@:
  3696                                   %if _LINK
  3697 0000117F B8[0E00]                	mov ax, fake_oplist.op_loop_nasm
  3698                                   wlcalc word_minusext_oplists, equ $ - 2
  3699                                   %else
  3700                                  	mov ax, fake_oplist.op_loop_nasm - oplists
  3701                                   %endif
  3702 00001182 50                      	push ax
  3703 00001183 E984F0                  	jmp da13a
  3704                                  
  3705                                  
  3706                                  dop_mod_force_3:
  3707                                  ; This is used for mov to/from CRx, DRx, TRx.
  3708                                  ; Reference: https://stackoverflow.com/questions/79870726/does-move-to-from-control-debug-registers-ignore-the-mod-field
  3709 00001186 E85402                  	call getregmem		; get our ModR/M
  3710 00001189 800E[0000]C0            	or byte [regmem], 0C0h	; force it to look like a register (Mod = 3)
  3711 0000118E EB3A                    	jmp dop60a_3
  3712                                  
  3713                                  
  3714                                  dop_modalways_if_reg:
  3715 00001190 F606[0200]04            	testopt [asm_options], disasm_modrm_always
  3716 00001195 7433                    	jz dop_no_mod
  3717                                  %if 0
  3718                                  	call getregmem		; get our ModR/M
  3719                                  	cmp al, 0C0h		; is it a register?
  3720                                  	jb dop_no_mod		; no -->
  3721                                  	mov ah, al
  3722                                  	and ax, 00_111_000_00_000_111b
  3723                                  	shr ah, 1
  3724                                  	shr ah, 1
  3725                                  	shr ah, 1
  3726                                  	cmp al, ah
  3727                                  	je dop_no_mod
  3728                                  	jmp dop_mod
  3729                                  %else
  3730 00001197 EB07                    	jmp dop_mod_if_reg
  3731                                  %endif
  3732                                  
  3733                                  		; Used for inc and dec, that could be encoded using
  3734                                  		;  the single byte forms.
  3735                                  dop_mod_if_reg_1632:
  3736 00001199 F606[E300]01            	test byte [instru], 1	; byte size ?
  3737 0000119E 742A                    	jz dop_no_mod		; yes, no MODRM keyword -->
  3738                                  		; fall through
  3739                                  
  3740                                  		; Used for push, pop, and insts with r,r that we would
  3741                                  		;  encode in the opposite order. Also used for mov r,imm
  3742                                  		;  when the r is encoded using ModR/M rather than the
  3743                                  		;  available one-byte non-ModR/M opcodes.
  3744                                  dop_mod_if_reg:
  3745 000011A0 E83A02                  	call getregmem		; get our ModR/M
  3746 000011A3 3CC0                    	cmp al, 0C0h		; is it a register?
  3747 000011A5 7223                    	jb dop_no_mod		; no -->
  3748                                  
  3749                                  dop_mod:
  3750 000011A7 F606[0200]01            	testopt [asm_options], disasm_hide_modrm
  3751 000011AC 751C                    	jnz dop_no_mod
  3752                                  %if 1
  3753 000011AE D006[E600]              	rol byte [moddone], 1	; already displayed ?
  3754 000011B2 7216                    	jc dop_no_mod		; yes -->
  3755 000011B4 F616[E600]              	not byte [moddone]	; indicate we displayed it
  3756                                  %endif
  3757 000011B8 B84D4F                  	mov ax, "MO"
  3758 000011BB E8D002                  	call dis_stosw_lowercase
  3759 000011BE B84452                  	mov ax, "DR"
  3760 000011C1 E8CA02                  	call dis_stosw_lowercase
  3761 000011C4 B84D20                  	mov ax, "M "
  3762 000011C7 E8C402                  	call dis_stosw_lowercase
  3763                                  dop_no_mod:
  3764                                  dop60a_3:
  3765 000011CA E92901                  	jmp dop60a
  3766                                  
  3767                                  		; Used for disp-only memory access with acc operand,
  3768                                  		;  which could use the single-byte form (no ModR/M).
  3769                                  dop_mod_if_memoffs_and_other_acc:
  3770 000011CD E80D02                  	call getregmem		; get our ModR/M
  3771 000011D0 A838                    	test al, 111b << 3	; al/ax/eax ?
  3772 000011D2 75F6                    	jnz dop_no_mod		; no -->
  3773 000011D4 3C40                    	cmp al, 40h		; is it a register or mem with displacement ?
  3774 000011D6 73F2                    	jae dop_no_mod		; yes -->
  3775 000011D8 2407                    	and al, 7
  3776 000011DA F606[E200]20            	test byte [presizeflags], PRE32A
  3777 000011DF 7506                    	jnz .a32
  3778                                  .a16:
  3779 000011E1 3C06                    	cmp al, 6		; [disp16] without address registers ?
  3780                                  dop_mod_if_ZR: equ $
  3781 000011E3 75E5                    	jne dop_no_mod		; no -->
  3782 000011E5 EBC0                    	jmp dop_mod		; yes -->
  3783                                  
  3784                                  .a32:
  3785 000011E7 3C05                    	cmp al, 5		; trivial [disp32] ?
  3786 000011E9 74F8                    	je dop_mod_if_ZR
  3787 000011EB 3C04                    	cmp al, 4		; SIB byte present ?
  3788 000011ED 75F4                    	jne dop_mod_if_ZR
  3789 000011EF E84CF9                  	call getsibbyte
  3790 000011F2 243F                    	and al, ~0C0h		; mask off the scale
  3791 000011F4 3C25                    	cmp al, 100_101b	; index=4 base=5 special case [disp32] ?
  3792 000011F6 EBEB                    	jmp dop_mod_if_ZR
  3793                                  
  3794                                  		; Used for xchg, which could use the single-byte xchg
  3795                                  		;  with ax or eax forms.
  3796                                  dop_mod_if_other_acc_1632:
  3797 000011F8 F606[E300]01            	test byte [instru], 1	; byte size ?
  3798 000011FD 74CB                    	jz dop_no_mod		; yes, no MODRM keyword -->
  3799 000011FF E8DB01                  	call getregmem		; get our ModR/M
  3800 00001202 3CC0                    	cmp al, 0C0h		; this a memory operand ?
  3801 00001204 72C4                    	jb dop_no_mod		; yes, do not show MODRM -->
  3802 00001206 A838                    	test al, 111b << 3	; al/ax/eax ?
  3803 00001208 EBD9                    	jmp dop_mod_if_ZR
  3804                                  
  3805                                  		; Used for xchg, which could use the single-byte xchg
  3806                                  		;  with ax or eax forms.
  3807                                  dop_mod_if_reg_acc_1632:
  3808 0000120A F606[E300]01            	test byte [instru], 1	; byte size ?
  3809 0000120F 74B9                    	jz dop_no_mod		; yes, no MODRM keyword -->
  3810                                  		; fall through
  3811                                  
  3812                                  		; Used for ALU insts that could be the acc shortform.
  3813                                  dop_mod_if_reg_acc:
  3814 00001211 E8C901                  	call getregmem		; get our ModR/M
  3815 00001214 24C7                    	and al, 0C7h		; isolate mod and r/m
  3816 00001216 3CC0                    	cmp al, 0C0h		; mod=11b and r/m=000b ?
  3817 00001218 EBC9                    	jmp dop_mod_if_ZR
  3818                                  
  3819                                  
  3820                                  %if _MEMREF_AMOUNT
  3821                                  dop_stack_push:
  3822 0000121A B80200                  	mov ax, 2
  3823                                  .special:
  3824                                   %if _DISASM_32BIT
  3825 0000121D F606[E200]10            	test byte [presizeflags], PRE32D
  3826                                  .iso16_if_ZR:
  3827 00001222 7402                    	jz .iso16
  3828 00001224 01C0                    	add ax, ax
  3829                                   %endif
  3830                                  .iso16:
  3831 00001226 E861FD                  	call get_free_memref	; memrefs + bx -> the memref structure
  3832                                  
  3833 00001229 8987[9C00]              	mov word [memrefs + bx + mrLength], ax
  3834 0000122D 8B0E[0200]              	mov cx, word [reg_esp + 2]
  3835 00001231 8B16[0000]              	mov dx, word [reg_esp]
  3836 00001235 29C2                    	sub dx, ax
  3837 00001237 83D900                  	sbb cx, 0
  3838                                  
  3839 0000123A 8997[9400]              	mov word [memrefs + bx + mrOffset], dx
  3840                                  
  3841 0000123E B20A                    	mov dl, mrfMemDest | mrfMem
  3842                                  
  3843 00001240 EB2D                    	jmp dop_stack_common
  3844                                  
  3845                                  %if _PM && _DISASM_32BIT
  3846                                  .special_int:
  3847 00001242 E8(0000)                	call ispm
  3848 00001245 75DF                    	jnz .iso16
  3849 00001247 803E[0000]00            	cmp byte [dpmi32], 0
  3850 0000124C EBD4                    	jmp .iso16_if_ZR
  3851                                  %else
  3852                                  .special_int: equ .iso16
  3853                                  %endif
  3854                                  
  3855                                  dop_stack_pop:
  3856 0000124E B80200                  	mov ax, 2
  3857                                  .special:
  3858 00001251 8B0E[0200]              	mov cx, word [reg_esp + 2]
  3859 00001255 8B16[0000]              	mov dx, word [reg_esp]
  3860                                  .leave:
  3861                                   %if _DISASM_32BIT
  3862 00001259 F606[E200]10            	test byte [presizeflags], PRE32D
  3863 0000125E 7402                    	jz .iso16
  3864 00001260 01C0                    	add ax, ax
  3865                                  .iso16:
  3866                                   %endif
  3867 00001262 E825FD                  	call get_free_memref	; memrefs + bx -> the memref structure
  3868                                  
  3869 00001265 8987[9C00]              	mov word [memrefs + bx + mrLength], ax
  3870                                  
  3871 00001269 8997[9400]              	mov word [memrefs + bx + mrOffset], dx
  3872                                  
  3873 0000126D B206                    	mov dl, mrfMemSource | mrfMem
  3874                                  
  3875                                  dop_stack_common:
  3876 0000126F A1[0000]                	mov ax, word [reg_ss]	; get ss selector into ax
  3877 00001272 8987[9800]              	mov word [memrefs + bx + mrSegmentSelector], ax
  3878                                  
  3879                                   %if _DISASM_32BIT
  3880 00001276 93                      _386_PM	xchg ax, bx		; selector in bx
  3881 00001277 E8(0000)                _386_PM	call test_d_b_bit	; check whether a 32-bit ss
  3882 0000127A 93                      _386_PM	xchg ax, bx
  3883 0000127B 7407                    _386_PM	jz .isstack16
  3884 0000127D 80CA10                  _386_PM	or dl, mrfA32
  3885 00001280 898F[9600]              _386_PM	mov word [memrefs + bx + mrOffset + 2], cx
  3886                                  .isstack16:
  3887                                   %endif
  3888                                  
  3889 00001284 0897[9A00]              	or byte [memrefs + bx + mrFlags], dl
  3890 00001288 E820FD                  	call calc_linear_memref_and_mark_nonfree
  3891 0000128B EB59                    	jmp dop_continue_maybe_end
  3892                                  
  3893                                  
  3894                                  dop_stack_special:
  3895 0000128D A1[E800]                	mov ax, [index]
  3896 00001290 3D[0300]                	cmp ax, GROUP7 + 3	; call far [mem] ?
  3897 00001293 7414                    	je .callfar
  3898 00001295 84E4                    	test ah, ah
  3899 00001297 754A                    	jnz .error
  3900 00001299 57                      	push di
  3901 0000129A BF[9401]                	mov di, .bytes		; list of opcodes
  3902 0000129D B90B00                  	mov cx, .bytes_amount
  3903 000012A0 F2AE                    	repne scasb
  3904 000012A2 8A450A                  	mov al, [di + .bytes_amount - 1]
  3905 000012A5 5F                      	pop di
  3906 000012A6 753B                    	jne .error		; if not one of these -->
  3907                                  
  3908 000012A8 A9                      	db __TEST_IMM16		; (skip mov)
  3909                                  .callfar:
  3910 000012A9 B044                    	mov al, 40h + 4
  3911                                  
  3912                                  .haveinfo:
  3913 000012AB 89C3                    	mov bx, ax
  3914 000012AD 83E01F                  	and ax, 1Fh
  3915 000012B0 80FB80                  	cmp bl, 80h
  3916 000012B3 739C                    	jae dop_stack_pop.special
  3917 000012B5 80FB40                  	cmp bl, 40h
  3918 000012B8 7203E960FF              	jae dop_stack_push.special
  3919 000012BD 80FB20                  	cmp bl, 20h
  3920 000012C0 7380                    	jae dop_stack_push.special_int
  3921 000012C2 84C0                    	test al, al
  3922 000012C4 740F                    	jz .leave
  3923 000012C6 3C01                    	cmp al, 1
  3924 000012C8 7519                    	jne .error
  3925                                  .into:
  3926 000012CA F606[0100]08            	testopt [reg_efl], 800h
  3927 000012CF 7415                    	jz .none
  3928 000012D1 B026                    	mov al, 20h + 6
  3929 000012D3 EBD6                    	jmp .haveinfo
  3930                                  
  3931                                  .leave:
  3932 000012D5 B80200                  	mov ax, 2		; pop size = 1 word or 1 dword
  3933 000012D8 8B0E[0200]              	mov cx, word [reg_ebp + 2]
  3934 000012DC 8B16[0000]              	mov dx, word [reg_ebp]	; pop from address in (e)bp, not (e)sp
  3935 000012E0 E976FF                  	jmp dop_stack_pop.leave
  3936                                  
  3937                                  .error:
  3938 000012E3 E997EF                  	jmp da_internal_error
  3939                                  
  3940                                  	usesection lDEBUG_DATA_ENTRY
  3940          ------------------       note: usesection lDEBUG_DATA_ENTRY
  3941                                  
  3942                                  .bytes:
  3943 00000194 CDCE                    	db 0CDh, 0CEh		; int, into
  3944 00000196 CCF1                    	db 0CCh, 0F1h		; int3, int1
  3945 00000198 9A                      	db 9Ah			; call far imm:imm
  3946 00000199 CFCACB                  	db 0CFh, 0CAh, 0CBh	; iret, retf imm, retf
  3947 0000019C 60                      	db 60h			; pusha
  3948 0000019D 61                      	db 61h			; popa
  3949 0000019E C9                      	db 0C9h			; leave
  3950                                  .bytes_amount: equ $ - .bytes
  3951                                  
  3952                                  		; In this table the bits have the following meaning:
  3953                                  		;
  3954                                  		; flag 80h: special pop
  3955                                  		; flag 40h: special push
  3956                                  		; flag 20h: special push for int
  3957                                  		; if neither flag set: unusual, for leave and into
  3958                                  		; else: masked with 1Fh gives amount of bytes to push/pop
  3959                                  		;	 in o16, which needs to be doubled to get the amount
  3960                                  		;	 to push/pop in o32 instead.
  3961                                  .info:
  3962 0000019F 26                      	db 20h + 6	; int
  3963 000001A0 01                      	db 1		; into
  3964 000001A1 26                      	db 20h + 6	; int3
  3965 000001A2 26                      	db 20h + 6	; int1
  3966 000001A3 44                      	db 40h + 4	; call far imm:imm
  3967 000001A4 86                      	db 80h + 6	; iret
  3968 000001A5 84                      	db 80h + 4	; retf imm
  3969 000001A6 84                      	db 80h + 4	; retf
  3970 000001A7 50                      	db 40h + 16	; pusha
  3971 000001A8 90                      	db 80h + 16	; popa
  3972 000001A9 00                      	db 0		; leave
  3973                                  
  3974                                  	usesection lDEBUG_CODE
  3974          ------------------       note: usesection lDEBUG_CODE
  3975                                  
  3976                                  .none:
  3977                                  %else
  3978                                  dop_stack_push:
  3979                                  dop_stack_pop:
  3980                                  dop_stack_special:
  3981                                  %endif
  3982                                  dop_continue_maybe_end:
  3983 000012E6 58                      	pop	ax		; discard return address
  3984 000012E7 E92DEF                  	jmp	da14_check_end	; next -->
  3985                                  
  3986                                  
  3987                                  dop_m_always_16:
  3988 000012EA 800E[FF00]41            	setopt [disflags], DIS_I_M_ALWAYS_16 | DIS_I_NOSIZ
  3989 000012EF EBF5                    	jmp dop_continue_maybe_end
  3990                                  
  3991                                  
  3992                                  	; Set flag to always show size (OP_SHOSIZ).
  3993                                  dop_shosiz:
  3994 000012F1 800E[FE00]10            	or	byte [disflags],DIS_I_SHOWSIZ
  3995                                  dop60a:
  3996 000012F6 58                      	pop	ax		; discard return address
  3997 000012F7 E925EF                  	jmp	da14		; next...
  3998                                  
  3999                                  dop_far_m:
  4000 000012FA 800E[FF00]02            	setopt [disflags], DIS_I_FAR_M
  4001 000012FF EBF5                    	jmp dop60a
  4002                                  
  4003                                  dop_double_m:
  4004 00001301 800E[FF00]04            	setopt [disflags], DIS_I_DOUBLE_M
  4005 00001306 EBEE                    	jmp dop60a
  4006                                  
  4007                                  
  4008                                  %if _MEMREF_AMOUNT
  4009                                  dop_m_src:
  4010 00001308 800E[FF00]10            	setopt [disflags], DIS_I_M_SRC
  4011 0000130D EBE7                    	jmp dop60a
  4012                                  
  4013                                  dop_m_src_dst:
  4014 0000130F 800E[FF00]10            	setopt [disflags], DIS_I_M_SRC
  4015                                  dop_m_dst:
  4016 00001314 800E[FF00]20            	setopt [disflags], DIS_I_M_DST
  4017 00001319 EBDB                    	jmp dop60a
  4018                                  %else
  4019                                  dop_m_src: equ dop60a
  4020                                  dop_m_src_dst: equ dop60a
  4021                                  dop_m_dst: equ dop60a
  4022                                  %endif
  4023                                  
  4024                                  
  4025                                  dop_short:
  4026 0000131B F606[0000]10            	testopt [asm_options], disasm_show_short
  4027 00001320 74D4                    	jz dop60a
  4028 00001322 B85348                  	mov ax, "SH"
  4029 00001325 E86601                  	call dis_stosw_lowercase
  4030 00001328 B84F52                  	mov ax, "OR"
  4031 0000132B E86001                  	call dis_stosw_lowercase
  4032 0000132E B85420                  	mov ax, "T "
  4033 00001331 E85A01                  	call dis_stosw_lowercase
  4034                                  dop60a_1:
  4035 00001334 EBC0                    	jmp dop60a
  4036                                  
  4037                                  dop_near:
  4038 00001336 F606[0000]20            	testopt [asm_options], disasm_show_near
  4039 0000133B 74F7                    	jz dop60a_1
  4040 0000133D E81700                  	call dop_show_near
  4041                                  dop60a_2:
  4042 00001340 EBF2                    	jmp dop60a_1
  4043                                  
  4044                                  dop_far:
  4045 00001342 F606[0000]40            	testopt [asm_options], disasm_show_far
  4046 00001347 74F7                    	jz dop60a_2
  4047                                  dop_far_required:
  4048 00001349 B84641                  	mov	ax, "FA"	; store "FAR "
  4049 0000134C E83F01                  	call	dis_stosw_lowercase
  4050 0000134F B85220                  	mov	ax, "R "
  4051 00001352 E83901                  	call	dis_stosw_lowercase
  4052 00001355 EBE9                    	jmp	dop60a_2
  4053                                  
  4054                                  dop_show_near:
  4055 00001357 50                      	push ax
  4056 00001358 B84E45                  	mov ax, "NE"
  4057 0000135B E83001                  	call dis_stosw_lowercase
  4058 0000135E B84152                  	mov ax, "AR"
  4059 00001361 E82A01                  	call dis_stosw_lowercase
  4060 00001364 B020                    	mov al, " "
  4061 00001366 AA                      	stosb
  4062 00001367 58                      	pop ax
  4063 00001368 C3                      	retn
  4064                                  
  4065                                  
  4066                                  disbad:
  4067 00001369 8B26[FC00]              	mov	sp,[savesp2]	;pop junk off stack
  4068 0000136D B8[E901]                	mov	ax, da13
  4069 00001370 50                      	push	ax
  4070 00001371 66                      	_386_PM_o32	; xor eax, eax
  4071 00001372 31C0                    	xor	ax, ax
  4072 00001374 66                      	_386_PM_o32	; mov dword [dis_n], eax
  4073 00001375 A3[DC00]                	mov	word [dis_n], ax
  4074 00001378 A3[E000]                	mov	word [preflags], ax	; clear preflags and preused
  4075                                  %if _COND
  4076 0000137B A3[0801]                	mov	word [condmsg], ax	; initialize conditions message
  4077                                  %endif
  4078 0000137E C606[F400]80            	mov	byte [rmsize], 80h	; don't display any memory
  4079 00001383 A3[0000]                	mov	word [dismach], ax	; forget about the machine type
  4080 00001386 8026[FE00]FB            	and	byte [disflags],~DIS_I_SHOW	;and flags
  4081 0000138B E8E301                  	call disgetbyte
  4082 0000138E BF[3A01]                	mov	di,prefixlist
  4083 00001391 B90C00                  	mov	cx,N_PREFIX
  4084 00001394 F2AE                    	repne scasb
  4085 00001396 740C                    	je	.namedprefix	;if it's a named prefix
  4086 00001398 66                      	_386_PM_o32	; dec dword [dis_n]
  4087 00001399 FF0E[DC00]              	dec	word [dis_n]
  4088 0000139D BB[0000]                	mov	bx,MN_DB	;offset of 'DB' mnemonic
  4089                                   %if _LINK
  4090 000013A0 BE[0000]                	mov si, fake_oplist.op_imm8
  4091                                   wlcalc word_minusext_oplists, equ $ - 2
  4092                                   %else
  4093                                  	mov si, fake_oplist.op_imm8 - oplists
  4094                                   %endif
  4095 000013A3 C3                      	retn
  4096                                  
  4097                                  .namedprefix:
  4098 000013A4 800E[FE00]08            	or	byte [disflags],DIS_I_UNUSED	;print special flag
  4099 000013A9 BB0B00                  	mov	bx,N_PREFIX - 1
  4100 000013AC 29CB                    	sub	bx,cx
  4101 000013AE D1E3                    	shl	bx,1
  4102 000013B0 83FB0C                  	cmp	bx, byte (prefixlist.after_segment - prefixlist) *2
  4103 000013B3 7216                    	jb	.segprefix	; if SEG directive -->
  4104                                  %if _PM
  4105 000013B5 83FB14                  	cmp	bx, byte (prefixlist.size - prefixlist) *2
  4106 000013B8 720A                    	jb	.non16prefix	; if not OSIZE or ASIZE -->
  4107 000013BA F606[0000]40            	test byte [bCSAttr], 40h; 32-bit code segment ?
  4108 000013BF 7403                    	jz .non16prefix		; no, O32 or A32 -->
  4109 000013C1 83C304                  	add	bx, byte 4	; yes, change to O16 or A16
  4110                                  .non16prefix:
  4111                                  %endif
  4112 000013C4 8B9F[3A01]              	mov	bx,[prefixmnem+bx-(prefixlist.after_segment - prefixlist) *2]
  4113 000013C8 31F6                    	xor si, si		; no operand (empty oplist)
  4114 000013CA C3                      	retn
  4115                                  
  4116                                  .segprefix:
  4117                                   %if _LINK
  4118 000013CB 8DB7[0200]              	lea si, [word bx + fake_oplist.op_segments]
  4119                                   wlcalc word_minusext_oplists, equ $ - 2
  4120                                   %else
  4121                                  	lea si, [bx + fake_oplist.op_segments - oplists]
  4122                                   %endif
  4123                                  
  4124                                  				; -> fake OPLIST for segments
  4125 000013CF BB[0000]                	mov	bx,MN_SEG
  4126 000013D2 C3                      	retn
  4127                                  
  4128                                  
  4129                                  usesection ASMTABLE1
  4129          ------------------       note: usesection ASMTABLE1
  4130                                  fake_oplist:
  4131                                  .op_imm8:
  4132 00000000 1200                    	db OP_IMM8, 0
  4133                                  .op_segments:
  4134 00000002 3000                    	db OP_ES, 0
  4135 00000004 2E00                    	db OP_CS, 0
  4136 00000006 3300                    	db OP_SS, 0
  4137 00000008 2F00                    	db OP_DS, 0
  4138                                  %ifdef MN_GS
  4139 0000000A 3100                    	db OP_FS, 0
  4140 0000000C 3200                    	db OP_GS, 0
  4141                                  %endif
  4142                                  .op_loop_nasm:
  4143 0000000E 1B082800                	db OP_SHORT, OP_REL8, OP_E_CX, 0
  4144                                  
  4145                                  usesection lDEBUG_CODE
  4145          ------------------       note: usesection lDEBUG_CODE
  4146                                  
  4147                                  
  4148                                  ;	GETREGMEM_R - Get the reg part of the reg/mem part of the instruction
  4149                                  ;	Uses	CL
  4150                                  
  4151                                  getregmem_r:
  4152 000013D3 E80700                  	call	getregmem
  4153                                  
  4154                                  		; INP:	al = bits 3 to 5 has value to extract
  4155                                  		; OUT:	al = (INP:al >> 3) & 7
  4156                                  		; CHG:	cl
  4157                                  da_get_bits_3_to_5:
  4158 000013D6 B103                    	mov	cl,3
  4159 000013D8 D2E8                    	shr	al,cl
  4160 000013DA 2407                    	and	al,7
  4161 000013DC C3                      	ret
  4162                                  
  4163                                  ;	GETREGMEM - Get the reg/mem part of the instruction
  4164                                  
  4165                                  getregmem:
  4166 000013DD F606[E100]80            	test byte [preused],GOTREGM
  4167 000013E2 750B                    	jnz	grm1		;if we have it already
  4168 000013E4 800E[E100]80            	or	byte [preused],GOTREGM
  4169 000013E9 E88501                  	call disgetbyte	;get the byte
  4170 000013EC A2[0000]                	mov	[regmem],al	;save it away
  4171                                  
  4172 000013EF A0[0000]                grm1:	mov	al,[regmem]
  4173 000013F2 C3                      	ret
  4174                                  
  4175                                  dis_lowercase_w:
  4176 000013F3 86C4                    	xchg al, ah
  4177 000013F5 E80200                  	call dis_lowercase
  4178 000013F8 86C4                    	xchg al, ah
  4179                                  dis_lowercase:
  4180 000013FA 3C41                    	cmp al, 'A'
  4181 000013FC 720D                    	jb .not
  4182 000013FE 3C5A                    	cmp al, 'Z'
  4183 00001400 7709                    	ja .not
  4184 00001402 F606[0000]01            	testopt [asm_options], disasm_lowercase
  4185 00001407 7402                    	jz .not
  4186 00001409 0C20                    	or al, 20h
  4187                                  .not:
  4188 0000140B C3                      	retn
  4189                                  
  4190                                  
  4191                                  dis_lowercase_refmem_w:
  4192 0000140C 86C4                    	xchg al, ah
  4193 0000140E E80200                  	call dis_lowercase_refmem
  4194 00001411 86C4                    	xchg al, ah
  4195                                  dis_lowercase_refmem:
  4196 00001413 3C41                    	cmp al, 'A'
  4197 00001415 720D                    	jb .not
  4198 00001417 3C5A                    	cmp al, 'Z'
  4199 00001419 7709                    	ja .not
  4200 0000141B F606[0000]08            	testopt [asm_options], disasm_lowercase_refmem
  4201 00001420 7402                    	jz .not
  4202 00001422 0C20                    	or al, 20h
  4203                                  .not:
  4204 00001424 C3                      	retn
  4205                                  
  4206                                  
  4207                                  		; Show the opcode mnemonic
  4208                                  		;
  4209                                  		; INP:	si-> Opcode mnemonic string of an mnlist entry.
  4210                                  		;	w[si-2] & 0Fh = Length of that string.
  4211                                  		; OUT:	di-> next available byte in output line
  4212                                  		;	     (>= line_out + 32 due to padding)
  4213                                  		; CHG:	ax, cx, si
  4214                                  showop:
  4215                                  %if _40COLUMNS
  4216 00001425 BF[0000]                	mov di, line_out
  4217 00001428 033E[D800]              	add di, word [mnemonofs]
  4218                                  %else
  4219                                  	mov di, line_out+MNEMONOFS
  4220                                  %endif
  4221 0000142C 56                      	push si
  4222                                  
  4223 0000142D 8B4CFE                  	mov cx, [si-2]
  4224 00001430 83E10F                  	and cx, 0Fh
  4225                                  .loop:
  4226 00001433 AC                      	lodsb
  4227 00001434 E8C3FF                  	call dis_lowercase
  4228 00001437 AA                      	stosb
  4229 00001438 E2F9                    	loop .loop
  4230                                  
  4231 0000143A 58                      	pop ax				; ax-> mnemonic
  4232 0000143B 3D[0000]                	cmp ax, mnlist_a_suffix_allowed	; non-suffixed mnemonic ?
  4233 0000143E 7227                    	jb .nosuffix			; yes -->
  4234 00001440 3D[0000]                	cmp ax, mnlist_o_suffix_allowed	; optional address size suffix ?
  4235 00001443 7208                    	jb .a_suffix_allowed		; yes -->
  4236 00001445 3D[0000]                	cmp ax, mnlist_o_suffix_required; optional operand size suffix ?
  4237 00001448 B410                    	 mov ah, PREOSIZE		; (OSIZE: check OSIZE/O32)
  4238 0000144A 7309                    	jae .suffix_decide		; no, it's required -->
  4239 0000144C A9                      	db __TEST_IMM16			; (skip mov)
  4240                                  .a_suffix_allowed:
  4241 0000144D B420                    	 mov ah, PREASIZE		; optional ASIZE: check ASIZE/A32
  4242                                  
  4243                                  .suffix_decide_optional:	; check whether the suffix is necessary
  4244 0000144F 8426[E000]              	test byte [preflags], ah	; check if such a prefix occured (ZR if not)
  4245 00001453 740E                    	jz .suffix_invisible		; no, is default form --> (hide suffix)
  4246                                  
  4247                                  .suffix_decide:			; suffix will be displayed, now only decide which
  4248 00001455 B057                    	mov al, 'W'
  4249 00001457 8426[E200]              	test byte [presizeflags], ah	; 32-bit form ?
  4250 0000145B 7402                    	jz .got_suffix			; no -->
  4251 0000145D B044                    	mov al, 'D'
  4252                                  .got_suffix:
  4253 0000145F E898FF                  	call dis_lowercase
  4254 00001462 AA                      	stosb				; store suffix
  4255                                  
  4256                                  .suffix_invisible:		; notional suffix either displayed or left hidden,
  4257 00001463 0826[E100]              	or byte [preused], ah		; in any case, mark opcode prefix as used
  4258                                  
  4259                                  .nosuffix:
  4260                                  
  4261                                  		; Store blanks to pad to 8 characters, but at least one
  4262                                  %if _40COLUMNS
  4263 00001467 BE[0800]                	mov si, line_out + 8
  4264 0000146A 0336[D800]              	add si, word [mnemonofs]
  4265                                  %endif
  4266 0000146E B020                    	mov al, 32
  4267                                  
  4268                                  %if _40COLUMNS
  4269 00001470 F606[0100]02            	testopt [asm_options], disasm_no_indent
  4270 00001475 7506                    	jnz @F
  4271                                  %endif
  4272                                  .pad:
  4273 00001477 AA                      	stosb			; store a blank
  4274                                  %if _40COLUMNS
  4275 00001478 39F7                    	cmp di, si		; past 8 columns already ?
  4276                                  %else
  4277                                  	cmp di, line_out+MNEMONOFS+8
  4278                                  %endif
  4279 0000147A 72FB                    	jb .pad			; not yet, loop -->
  4280                                  
  4281 0000147C C3                      	retn
  4282                                  
  4283                                  %if _40COLUMNS
  4284                                  @@:
  4285 0000147D AA                      	stosb			; store a single blank
  4286 0000147E C3                      	retn
  4287                                  %endif
  4288                                  
  4289                                  
  4290                                  		; INP:	byte [segmnt] = number of segment register
  4291                                  		;	[segrgnam] = uppercase segment register names
  4292                                  		; CHG:	bx, ax
  4293                                  		; OUT:	ax = uppercase segment register name
  4294                                  showseg_uppercase_ax:
  4295 0000147F A0[F500]                	mov	al,[segmnt]	;segment number
  4296 00001482 98                      	cbw
  4297 00001483 D1E0                    	shl	ax,1
  4298 00001485 93                      	xchg	ax,bx		;mov bx,ax
  4299 00001486 8B87[0000]              	mov	ax,[segrgnam+bx] ;get register name
  4300 0000148A C3                      	retn
  4301                                  
  4302                                  ;	SHOWSEG - Show the segment descriptor in SEGMNT
  4303                                  ;	Entry	DI	Where to put it
  4304                                  ;	Exit	DI	Updated
  4305                                  ;	Uses	AX, BX
  4306                                  
  4307                                  showseg:
  4308 0000148B E8F1FF                  	call showseg_uppercase_ax
  4309                                  dis_stosw_lowercase:
  4310 0000148E E862FF                  	call	dis_lowercase_w
  4311 00001491 AB                      	stosw
  4312 00001492 C3                      	retn
  4313                                  
  4314                                  
  4315                                  		; Write a size specifier to the buffer
  4316                                  		;  and set some flags
  4317                                  		; INP:	ah = r/m size value,
  4318                                  		;		F0h byte (less than zero)
  4319                                  		;		00h word (equal to zero)
  4320                                  		;		10h dword (greater than zero, but != 20h)
  4321                                  		;		20h qword (greater than zero, == 20h)
  4322                                  		;	di-> buffer
  4323                                  		; OUT:	di-> behind size specifier in buffer
  4324                                  		;	by[rmsize] set
  4325                                  		;	wo[sizeloc]-> size specifier in buffer
  4326                                  		; CHG:	ax
  4327                                  		;
  4328                                  		; Size specifiers are BYTE, WORD, DWORD, and QWORD. One
  4329                                  		; blank is appended to the size specifier.
  4330                                  		;
  4331                                  		; Size specifiers are lowercased if that option is selected.
  4332                                  showsize_ch_flag_ZR:
  4333 00001493 753C                    	jnz showsize.retn
  4334 00001495 800E[FE00]10            	or byte [disflags], DIS_I_SHOWSIZ
  4335 0000149A 91                      	xchg ax, cx
  4336                                  showsize:
  4337 0000149B 8826[F400]              	mov	[rmsize], ah	; save r/m size
  4338 0000149F 893E[0201]              	mov	[sizeloc], di	; save where we're putting this
  4339 000014A3 B051                    	mov	al, 'Q'
  4340 000014A5 80FC20                  	cmp	ah, 20h		; QWORD ?
  4341 000014A8 7412                    	je	.qword		; yes -->
  4342 000014AA 80FC00                  	cmp	ah, 0
  4343 000014AD 7D09                    	jge	.notbyte	; if word or dword -->
  4344                                  .byte:
  4345 000014AF B85445                  	mov	ax, "TE"
  4346 000014B2 50                      	push	ax
  4347 000014B3 B84259                  	mov	ax, "BY"
  4348 000014B6 EB0F                    	jmp s	.common
  4349                                  
  4350                                  .notbyte:
  4351 000014B8 7406                    	je	.word		; if word
  4352                                  .dword:
  4353 000014BA B044                    	mov	al, 'D'
  4354                                  .qword:
  4355 000014BC E83BFF                  	call	dis_lowercase
  4356 000014BF AA                      	stosb
  4357                                  .word:
  4358 000014C0 B85244                  	mov	ax, "RD"
  4359 000014C3 50                      	push	ax
  4360 000014C4 B8574F                  	mov	ax, "WO"
  4361                                  .common:
  4362 000014C7 E8C4FF                  	call	dis_stosw_lowercase
  4363 000014CA 58                      	pop	ax
  4364 000014CB E8C0FF                  	call	dis_stosw_lowercase
  4365 000014CE B020                    	mov	al, 32
  4366 000014D0 AA                      	stosb
  4367                                  .retn:
  4368                                   showptr.ret:
  4369 000014D1 C3                      	retn
  4370                                  
  4371                                  		; Write "PTR " to a buffer if NASM syntax is not selected.
  4372                                  		; INP:	di-> buffer
  4373                                  		; OUT:	di-> behind written string "PTR " (or unchanged)
  4374                                  		; CHG:	ax
  4375                                  		;
  4376                                  		; The string is lowercased if that option is selected.
  4377                                  showptr:
  4378 000014D2 F606[0000]04            	testopt [asm_options], disasm_nasm
  4379 000014D7 75F8                    	jnz	.ret
  4380 000014D9 B85054                  	mov	ax, "PT"
  4381 000014DC E8AFFF                  	call	dis_stosw_lowercase
  4382 000014DF B85220                  	mov	ax, "R "
  4383 000014E2 EBAA                    	jmp s	dis_stosw_lowercase
  4384                                  
  4385                                  		; Write "DWORD " to a buffer
  4386                                  		; INP:	di-> buffer
  4387                                  		; OUT:	di-> behind written string "DWORD "
  4388                                  		; CHG:	ax
  4389                                  		;
  4390                                  		; The string is lowercased if that option is selected.
  4391                                  showdword: equ showsize.dword
  4392                                  showword: equ showsize.word
  4393                                  
  4394                                  ;	DISP32 - Print 32-bit displacement for addressing modes.
  4395                                  ;	Entry	None
  4396                                  ;	Exit	None
  4397                                  ;	Uses	AX
  4398                                  
  4399                                  disp32:
  4400 000014E4 E8A600                  	call disgetword
  4401                                  .ax:
  4402 000014E7 50                      	push ax
  4403 000014E8 E8A200                  	call disgetword
  4404                                  		; INP:	stack -> low word
  4405                                  		;	ax = high word
  4406                                  .stack:
  4407 000014EB E8(0000)                	call hexword
  4408                                  .low_stack:
  4409 000014EE 58                      	pop ax
  4410 000014EF E9(0000)                	jmp hexword
  4411                                  
  4412                                  		; SHOWREG16 - Show 16-bit register name.
  4413                                  		;
  4414                                  		; INP:	al = register number, 0 to 7
  4415                                  		;	di -> buffer
  4416                                  		; OUT:	register name stored to buffer
  4417                                  		;	ax = INP:al * 2
  4418                                  showreg16:
  4419 000014F2 98                      	cbw
  4420 000014F3 D1E0                    	shl	ax,1
  4421 000014F5 93                      	xchg ax,bx
  4422 000014F6 50                      	push ax
  4423 000014F7 8B87[0000]              	mov	ax,[rgnam16+bx]
  4424 000014FB E890FF                  	call	dis_stosw_lowercase
  4425 000014FE 58                      	pop	ax
  4426 000014FF 93                      	xchg ax,bx
  4427 00001500 C3                      	ret
  4428                                  
  4429                                  
  4430                                   %if _DISASM_32BIT
  4431                                  		; DISCHK32D - Check for O32 (32-bit operand size).
  4432                                  dischk32d:
  4433 00001501 800E[E100]10            	or byte [preused], PREOSIZE
  4434 00001506 F606[E200]10            	test byte [presizeflags], PRE32D
  4435 0000150B C3                      	retn
  4436                                   %endif
  4437                                  
  4438                                  
  4439                                  ;	SHOWMACH - Return string "[needs math coprocessor]", etc.
  4440                                  ;	Entry   di -> table of 5 words
  4441                                  ;		cx = instruction
  4442                                  ;	Exit	si	Address of string
  4443                                  ;		cx	Length of string, or 0 if not needed
  4444                                  ;	Uses	al, di
  4445                                  
  4446                                  showmach:
  4447                                  %if _LINK_COMPAT
  4448                                   %define FORCEWORD word
  4449                                  %else
  4450                                   %define FORCEWORD
  4451                                  %endif
  4452 0000150C BE[0000]                	mov	si,needsmsg	; candidate message
  4453 0000150F F606[0000]01            	test byte [dmflags],DM_COPR
  4454 00001514 741F                    	jz	sm1		; if not a coprocessor instruction
  4455 00001516 C684[0000]37            	mov byte [FORCEWORD si + needsmsg.digit_6_ofs], '7'
  4456                                  				; change message text
  4457 0000151B A0[0000]                	mov	al,[mach_87]
  4458 0000151E 803E[0000]00            	cmp	byte [has_87],0
  4459 00001523 751B                    	jnz	sm2		; if it has a coprocessor
  4460 00001525 A0[0000]                	mov	al,[machine]
  4461 00001528 3A06[0000]              	cmp	al,[dismach]
  4462 0000152C 7218                    	jb	sm3		; if we display the message
  4463 0000152E BE[0000]                	mov	si,needsmath	; print this message instead
  4464 00001531 B9[0000]                	mov	cx,needsmath_L
  4465 00001534 C3                      	retn
  4466                                  
  4467                                  sm1:
  4468 00001535 BE[0000]                	mov	si,needsmsg	; candidate message
  4469 00001538 C684[0000]36            	mov byte [FORCEWORD si + needsmsg.digit_6_ofs], '6'
  4470                                  				; reset message text
  4471 0000153D A0[0000]                	mov	al,[machine]
  4472                                  sm2:
  4473 00001540 3A06[0000]              	cmp	al,[dismach]
  4474 00001544 730D                    	jae	sm4		; if no message (so far)
  4475                                  sm3:
  4476 00001546 A0[0000]                	mov	al,[dismach]
  4477 00001549 0430                    	add	al,'0'
  4478 0000154B 8884[0000]              	mov byte [FORCEWORD si + needsmsg.digit_x_ofs], al
  4479 0000154F B9[0000]                	mov	cx,needsmsg_L	; length of the message
  4480 00001552 C3                      	retn
  4481                                  
  4482                                  		; Check for obsolete instruction.
  4483                                  sm4:
  4484 00001553 BE[0000]                	mov	si, obsolete	; candidate message
  4485 00001556 89C8                    	mov	ax, cx		; get info on this instruction
  4486 00001558 B90500                  	mov	cx, 5
  4487 0000155B F2AF                    	repne scasw
  4488 0000155D 7511                    	jne	sm6		; if no matches
  4489 0000155F BF[0400]                	mov	di, obsmach + 5 - 1
  4490 00001562 29CF                    	sub	di, cx
  4491 00001564 31C9                    	xor	cx, cx		; clear CX: no message
  4492 00001566 A0[0000]                	mov	al, byte [mach_87]
  4493 00001569 3A05                    	cmp	al, byte [di]
  4494 0000156B 7E03                    	jle	sm5		; if this machine is OK
  4495 0000156D B9[0000]                	mov	cx, obsolete_L
  4496                                  sm5:
  4497 00001570 C3                      	retn
  4498                                  
  4499                                  sm6: equ sm5
  4500                                  
  4501                                  
  4502                                  ;	DISGETBYTE - Get byte for disassembler.
  4503                                  ;	Entry	None
  4504                                  ;	Exit	AL	Next byte in instruction stream
  4505                                  ;	Uses	None
  4506                                  
  4507                                  disgetbyte:
  4508 00001571 1E                      	push ds
  4509 00001572 66                      	_386_PM_o32		; push esi
  4510 00001573 56                      	push si				; save ds, (e)si
  4511 00001574 66                      	_386_PM_o32		; mov esi, dword [u_addr]
  4512 00001575 8B36[0000]              	mov si, word [u_addr]
  4513 00001579 66                      	_386_PM_o32		; add esi, dword [dis_n]
  4514 0000157A 0336[DC00]              	add si, word [dis_n]		; index to the right byte
  4515 0000157E 8E1E[0400]              	mov ds, word [u_addr + saSegSel]
  4516 00001582 67                      	_386_PM_a32
  4517 00001583 AC                      	lodsb 				; get the byte
  4518 00001584 66                      	_386_PM_o32		; pop esi
  4519 00001585 5E                      	pop si
  4520 00001586 1F                      	pop ds				; restore regs
  4521 00001587 66                      	_386_PM_o32		; inc dword [dis_n]
  4522 00001588 FF06[DC00]              	inc word [dis_n]		; indicate that we've gotten this byte
  4523 0000158C C3                      	retn
  4524                                  
  4525                                  
  4526                                  ;	DISGETWORD - Get word for disassembler.
  4527                                  ;	Entry	None
  4528                                  ;	Exit	AX	Next word
  4529                                  ;	Uses	None
  4530                                  
  4531                                  disgetword:
  4532 0000158D 1E                      	push ds
  4533 0000158E 66                      	_386_PM_o32		; push esi
  4534 0000158F 56                      	push si				; save ds, (e)si
  4535 00001590 66                      	_386_PM_o32		; mov esi, dword [u_addr]
  4536 00001591 8B36[0000]              	mov si, word [u_addr]
  4537 00001595 66                      	_386_PM_o32		; add esi, dword [dis_n]
  4538 00001596 0336[DC00]              	add si, word [dis_n]		; index to the right byte
  4539 0000159A 8E1E[0400]              	mov ds, word [u_addr + saSegSel]
  4540 0000159E 67                      	_386_PM_a32
  4541 0000159F AD                      	lodsw 				; get the word
  4542 000015A0 66                      	_386_PM_o32		; pop esi
  4543 000015A1 5E                      	pop si
  4544 000015A2 1F                      	pop ds				; restore regs
  4545 000015A3 66                      	_386_PM_o32		; add dword [dis_n], byte 2
  4546 000015A4 8306[DC00]02            	add word [dis_n], byte 2	; indicate that we've gotten this word
  4547 000015A9 C3                      	retn
  4548                                  
  4549                                  
  4550                                  ;	DISSHOWBYTES - Show bytes for the disassembler.
  4551                                  ;	Entry	BX	Number of bytes (must be > 0)
  4552                                  ;		di-> output line
  4553                                  ;	Exit		u_addr updated
  4554                                  ;	Uses	BX, (E)SI.
  4555                                  
  4556                                  disshowbytes:
  4557 000015AA 66                      	_386_PM_o32		; mov esi, dword [u_addr]
  4558 000015AB 8B36[0000]              	mov si, word [u_addr]
  4559 000015AF 8E1E[0400]              	mov ds, word [u_addr + saSegSel]
  4560                                  .loop:
  4561 000015B3 67                      	_386_PM_a32
  4562 000015B4 AC                      	lodsb
  4563 000015B5 E8(0000)                	call hexbyte
  4564 000015B8 4B                      	dec bx
  4565 000015B9 75F8                    	jnz .loop
  4566 000015BB 16                      	push ss
  4567 000015BC 1F                      	pop ds
  4568 000015BD 66                      	_386_PM_o32		; mov dword [u_addr], esi
  4569 000015BE 8936[0000]              	mov word [u_addr], si
  4570 000015C2 C3                      	retn
  4571                                  
  4572                                  		; MOVEOVER - Move the line to the right.
  4573                                  		; Entry	DI	Last address + 1 of line so far
  4574                                  		;	CX	Number of bytes to move
  4575                                  		; Exit	DI	Updated
  4576                                  		; Uses	SI
  4577                                  moveover:
  4578 000015C3 833E[0201]00            	cmp word [sizeloc], byte 0
  4579 000015C8 7404                    	je mo1			; if sizeloc not saved
  4580 000015CA 010E[0201]              	add word [sizeloc], cx
  4581                                  
  4582                                  mo1:
  4583 000015CE 89FE                    	mov si, di
  4584 000015D0 01CF                    	add di, cx
  4585 000015D2 89F9                    	mov cx, di
  4586                                  %if _40COLUMNS
  4587 000015D4 81E9[0000]              	sub cx, line_out
  4588 000015D8 2B0E[D800]              	sub cx, word [mnemonofs]
  4589                                  %else
  4590                                  	sub cx, line_out+MNEMONOFS
  4591                                  %endif
  4592 000015DC 57                      	push di
  4593 000015DD FD                      	std			; _AMD_ERRATUM_109_WORKAROUND as below
  4594 000015DE 4E                      	dec si
  4595 000015DF 4F                      	dec di
  4596                                  
  4597                                  
  4598                                  	numdef AMD_ERRATUM_109_WORKAROUND, 1
  4599                                  		; Refer to comment in init.asm init_movp.
  4600                                  
  4601                                  %if _AMD_ERRATUM_109_WORKAROUND
  4602 000015E0 E308                    	jcxz @FF
  4603 000015E2 83F914                  	cmp cx, 20
  4604 000015E5 7703                    	ja @FF
  4605                                  @@:
  4606 000015E7 A4                      	movsb
  4607 000015E8 E2FD                    	loop @B
  4608                                  @@:
  4609                                  %endif
  4610 000015EA F3A4                    	rep movsb
  4611 000015EC 5F                      	pop di
  4612 000015ED FC                      	cld
  4613 000015EE C3                      	retn
  4614                                  %endif	; _LOADER
  4615                                  
  4616                                  ..@uu_access_end:
