     1                                  
     2                                  %if 0
     3                                  
     4                                  lDebug symbol handling
     5                                  
     6                                  Copyright (C) 2008-2026 E. C. Masloch
     7                                  
     8                                  Usage of the works is permitted provided that this
     9                                  instrument is retained with the works, so that any entity
    10                                  that uses the works is notified of this instrument.
    11                                  
    12                                  DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
    13                                  
    14                                  %endif
    15                                  
    16                                  %define SOURCEFILENAME "symbols.asm"
    17                                  %ifidni __OUTPUT_FORMAT__, obj
    18                                   %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
   209                              <2> %else
   210                              <2> 	usesection lDEBUG_CODE
   210          ------------------  <2>  note: 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
   217                              <2>  %else
   218                              <2> 	usesection lDEBUG_CODE
   218          ------------------  <2>  note: 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                              <1> saSegment:	resw 1
   740                              <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                              <1> so16aSegment:	resw 1
   754                              <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                              <1> soaSegment:	resw 1
   778                              <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
    19                                  %endif
    20                                  
    21                                  
    22                                  %if !_LINK || _SYMBOLIC
    23                                  	usesection lDEBUG_DATA_ENTRY
    24                                  
    25                                  	align 4, db 0
    26                                  sym_storage:
    27                                  .clear_on_free.first:
    28                                  .start:		dd 0
    29                                  %if _XMS_SYMBOL_TABLE
    30                                  .main.xms.start:dd 0
    31                                  .hash.xms.start:dd 0
    32                                  .str.xms.start:	dd 0
    33                                  .xms.free:	dd 0
    34                                  .xms.end:	dd 0
    35                                  %endif
    36                                  
    37                                  .first_start:
    38                                  .main.start:	dd 0		; -> SYMMAIN array
    39                                  .hash.start:	dd 0		; -> SYMHASH array
    40                                  .str.start:	dd 0		; -> SYMSTR heap
    41                                  .free:		dd 0		; -> free table space
    42                                  .end:		dd 0		; -> after end of allocated table space
    43                                  .after_start:
    44                                  
    45                                  	; The following are SYMMAIN array indices.
    46                                  .main.end:	dw 0
    47                                  .main.free:	dw 0
    48                                  .minus1_on_free.first:
    49                                  .main.based.base:	dw -1
    50                                  .main.base.first:	dw -1
    51                                  .main.base.last:	dw -1
    52                                  .main.bb.first:		dw -1
    53                                  .main.bb.last:		dw -1
    54                                  .main.nonbased.first:	dw -1
    55                                  .main.nonbased.last:	dw -1
    56                                  .main.reloc.first:	dw -1
    57                                  .main.reloc.last:	dw -1
    58                                  
    59                                  %if _ZZ_INSERT_TEMP
    60                                  	; This is a SYMMAIN array index. However, it
    61                                  	;  should NOT participate in relocation. Must
    62                                  	;  be >= .main.free at all times.
    63                                  .main.temp.first:	dw -1
    64                                  %endif
    65                                  .minus1_on_free.after:
    66                                  %if _ZZ_INSERT_TEMP
    67                                  	; Amount of in-use temporary SYMMAIN entries.
    68                                  .main.temp.amount:	dw 0
    69                                  %endif
    70                                  
    71                                  	; The following are SYMHASH array dword indices.
    72                                  .hash.end:	dw 0
    73                                  .hash.free:	dw 0
    74                                  
    75                                  	; The following are SYMSTR heap dword indices.
    76                                  .str.end:	dw 0
    77                                  .str.free:	dw 0
    78                                  .clear_on_free.after:
    79                                  
    80                                  %if _BOOTLDR
    81                                  	align 16, db 0
    82                                  	; Image identification
    83                                  	; First dword: signature
    84                                  	; Next word: version, two ASCII digits
    85                                  	; Next word: checksum. adding up all words of the paragraph gives zero
    86                                  	; Next word: size of image (including this paragraph)
    87                                  	; Three words reserved, zero.
    88                                  zz_imageident:
    89                                  	db "NSYM00"
    90                                  .check:	dw 0
    91                                  .size:	dw 0
    92                                  	times 3 dw 0
    93                                  %endif
    94                                  
    95                                  %if _XMS_SYMBOL_TABLE
    96                                  	align 16, db 0
    97                                  zz_xms:
    98                                  .16_zeros:		times 16 db 0
    99                                  	align 2, db 0
   100                                  .movestruc:		times XMSMOVE_size db 0
   101                                  	align 4, db 0
   102                                  .entry:			dq 0
   103                                  .transfer_address:	dd 0
   104                                  .transfer_size:		dd XMSTRANSFER_default_size
   105                                  .handle:		dw -1
   106                                  %endif	; _XMS_SYMBOL_TABLE
   107                                  
   108                                  	align 2, db 0
   109                                  zz_saved_strategy:	dw 0
   110                                  zz_saved_umblink:	dw 0
   111                                  zz_flag_existing_default:
   112                                  .symbol:	db insertfExistingBlockDiffering
   113                                  .start:		db insertfExistingKeep
   114                                  
   115                                  
   116                                  	usesection lDEBUG_CODE
   117                                  
   118                                   %if _DUALCODE && _SYMBOLICDUALCODE
   119                                  	usesection lDEBUG_CODE2
   120                                   %endif
   121                                  
   122                                  	overridedef STANDALONE, 0
   123                                  	overridedef INCLUDECOMMON, 0
   124                                  	overridedef DEBUG0, 0
   125                                  	overridedef DEBUG1, 0
   126                                  	overridedef SYMMAINLARGE, 1
   127                                  %include "insert.asm"
   128                                  	resetdef
   129                                  	resetdef
   130                                  	resetdef
   131                                  	resetdef
   132                                  	resetdef
   133                                  
   134                                  
   135                                  		; error handlers used by insert.asm
   136                                  invaliddata:
   137                                  	mov ax, 0500h
   138                                  	nearcall setrc
   139                                  	mov dx, msg.invaliddata
   140                                  exit_error_msg:
   141                                  
   142                                   %if _DUALCODE && _SYMBOLICDUALCODE
   143                                    %define SECTION_OF_exit_error_msg_code_entry lDEBUG_CODE
   144                                  	nearcall exit_error_msg_code_entry
   145                                  
   146                                  	usesection lDEBUG_CODE
   147                                  
   148                                  exit_error_msg_code_entry:
   149                                  	add sp, 6		; discard near + far return address
   150                                   %endif
   151                                  exit_error_msg_code:
   152                                  	 push ss
   153                                  	 pop ds
   154                                  	 push ss
   155                                  	 pop es
   156                                  	call putsz_error
   157                                  	nearcall zz_restore_strat
   158                                  	mov ax, 05FFh
   159                                  	call setrc
   160                                  	jmp near [errret]
   161                                  
   162                                   %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
   163                                  	usesection lDEBUG_CODE2
   164                                  
   165                                    %define SECTION_OF_error_entry lDEBUG_CODE
   166                                  section_of symbolasm_error
   167                                  symbolasm_error: section_of_function
   168                                  	nearcall error_entry
   169                                  
   170                                  	usesection lDEBUG_CODE
   171                                  
   172                                  error_entry:
   173                                  	add sp, 6
   174                                  	jmp error
   175                                   %else
   176                                  	usesection lDEBUG_CODE
   177                                  
   178                                  section_of symbolasm_error
   179                                  check_section_of symbolasm_error
   180                                  symbolasm_error equ error
   181                                   %endif
   182                                  
   183                                  zz:
   184                                   %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
   185                                    %define SECTION_OF_zz_relocated lDEBUG_CODE2
   186                                  	nearcall zz_relocated
   187                                  	retn
   188                                  
   189                                  	usesection lDEBUG_CODE2
   190                                   %endif
   191                                  
   192                                  zz_relocated:
   193                                  	db __TEST_IMM8
   194                                  .:
   195                                  	lodsb
   196                                  	nearcall iseol?
   197                                  	je .end
   198                                  	cmp al, 32
   199                                  	jbe .
   200                                  	cmp al, '-'
   201                                  	je .switch
   202                                  	cmp al, '/'
   203                                  	je .switch
   204                                  
   205                                  	dec si
   206                                  	mov dx, msg.add
   207                                  	nearcall isstring?
   208                                  	je zz_add
   209                                  
   210                                  	mov dx, msg.abort
   211                                  	nearcall isstring?
   212                                  	je zz_abort
   213                                  
   214                                  	nearcall zz_commit_insert
   215                                  
   216                                  
   217                                  	usesection lDEBUG_DATA_ENTRY
   218                                  
   219                                  	align 4, db 0
   220                                  .dispatch:
   221                                  	dw zz_commit
   222                                  	dw msg.commit
   223                                  	dw zz_del
   224                                  	dw msg.del
   225                                  	dw zz_del
   226                                  	dw msg.delete
   227                                  	dw zz_reloc
   228                                  	dw msg.reloc
   229                                  	dw zz_reloc
   230                                  	dw msg.relocate
   231                                  	dw zz_stat
   232                                  	dw msg.stat
   233                                  	dw zz_list
   234                                  	dw msg.list
   235                                  	dw zz_match
   236                                  	dw msg.match
   237                                  	dw 0			; table end marker
   238                                  
   239                                  
   240                                   %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
   241                                  	usesection lDEBUG_CODE2
   242                                   %else
   243                                  	usesection lDEBUG_CODE
   244                                   %endif
   245                                  
   246                                  	mov bx, .dispatch
   247                                  @@:
   248                                  	mov cx, [bx]
   249                                  	mov dx, [bx + 2]
   250                                  	add bx, 4
   251                                  	jcxz @F
   252                                  	nearcall isstring?
   253                                  	jne @B
   254                                  	jmp cx
   255                                  
   256                                  @@:
   257                                  	mov ax, 0501h
   258                                  	nearcall setrc
   259                                  	jmp symbolasm_error
   260                                  
   261                                  .end:
   262                                  	retn
   263                                  
   264                                  .switch:
   265                                  	nearcall zz_commit_insert
   266                                  
   267                                  	lodsb
   268                                  	nearcall capitalise
   269                                  	cmp al, 'S'
   270                                  	jne .unknown_switch
   271                                  	nearcall zz_switch_s
   272                                  	jmp zz_relocated
   273                                  
   274                                  .unknown_switch:
   275                                  	mov ax, 0502h
   276                                  	nearcall setrc
   277                                  
   278                                  	db __TEST_IMM8		; (skip dec)
   279                                  @@:
   280                                  	dec si
   281                                  @@:
   282                                  	jmp symbolasm_error
   283                                  
   284                                  zz_switch_s.error_pop_si:
   285                                  	pop si
   286                                  	jmp @B
   287                                  
   288                                  
   289                                  		; This is a no-op. In the dispatcher however,
   290                                  		;  if this command is matched then the function
   291                                  		;  zz_commit_insert was already called.
   292                                  zz_commit:
   293                                  	lodsb
   294                                  	nearcall chkeol
   295                                  	retn
   296                                  
   297                                  
   298                                  		; This is the only command (other than Z ADD) that
   299                                  		;  is executed without first committing the temporary
   300                                  		;  inserts. It helps if the debugger gets confused, as
   301                                  		;  otherwise all commands will fail during their attempt
   302                                  		;  to commit and the debugger becomes unusable.
   303                                  zz_abort:
   304                                  	lodsb
   305                                  	nearcall chkeol
   306                                  %if _ZZ_INSERT_TEMP
   307                                  	and word [sym_storage.main.temp.amount], 0
   308                                  	or word [sym_storage.main.temp.first], -1
   309                                  %endif
   310                                  	retn
   311                                  
   312                                  
   313                                  zz_reloc:
   314                                  	nearcall skipwhite
   315                                  
   316                                  	lframe
   317                                  	lenter
   318                                  
   319                                  	mov bx, word [reg_cs]	; default segment = cs
   320                                  	nearcall getaddrX
   321                                  
   322                                  	xor cx, cx
   323                                  	lvar dword,	start_offset
   324                                  %if _PM
   325                                  	 push ax
   326                                  	 push ax
   327                                  	dualcall push_cxdx_or_edx
   328                                  %else
   329                                  	push cx
   330                                  	push dx
   331                                  %endif
   332                                  
   333                                  	push ax
   334                                  	nearcall getlinear_32bit
   335                                  	jc symbolasm_error
   336                                  
   337                                  	mov cx, ax
   338                                  	pop ax
   339                                  	lvar dword,	start_source
   340                                  	 push dx
   341                                  	 push cx
   342                                  
   343                                  	nearcall capitalise
   344                                  	cmp al, 'L'
   345                                  	je .l
   346                                  
   347                                  	nearcall getdword
   348                                  	sub dx, word [bp + ?start_offset]
   349                                  	sbb bx, word [bp + ?start_offset + 2]
   350                                  	jc symbolasm_error
   351                                  	add dx, 1
   352                                  	adc bx, 0
   353                                  	jc symbolasm_error
   354                                  	jmp @F
   355                                  
   356                                  .l:
   357                                  	lodsb
   358                                  	nearcall getdword
   359                                  @@:
   360                                  	lvar dword,	length
   361                                  	 push bx
   362                                  	 push dx
   363                                  
   364                                  	mov bx, word [reg_cs]
   365                                  	nearcall getaddrX
   366                                  	nearcall chkeol
   367                                  	nearcall getlinear_32bit
   368                                  	jc symbolasm_error
   369                                  
   370                                  	xchg ax, cx
   371                                  	xchg dx, bx		; bx:cx = start of destination
   372                                  
   373                                  	mov ax, word [bp + ?start_source]
   374                                  	mov dx, word [bp + ?start_source + 2]
   375                                  				; dx:ax = start of source
   376                                  
   377                                  	push word [bp + ?length + 2]
   378                                  	push word [bp + ?length]
   379                                  				; stack = length
   380                                  
   381                                  	dualcall zz_relocate
   382                                  
   383                                  	lleave
   384                                  
   385                                  	mov ax, cx
   386                                  
   387                                  	test ax, ax
   388                                  	jnz @F
   389                                  
   390                                  	mov dx, msg.zz_reloc_amount_none
   391                                  	jmp @FF
   392                                  
   393                                  @@:
   394                                  	mov dx, msg.zz_reloc_amount_1
   395                                  	nearcall disp_message
   396                                  	mov di, line_out
   397                                  	nearcall decword
   398                                  	push ax
   399                                  	nearcall putsline
   400                                  	pop ax
   401                                  	mov dx, msg.zz_reloc_amount_2.plural
   402                                  	cmp ax, 1
   403                                  	jne @F
   404                                  	mov dx, msg.zz_reloc_amount_2.singular
   405                                  @@:
   406                                  	nearcall disp_message
   407                                  	retn
   408                                  
   409                                  
   410                                  zz_del:
   411                                  	nearcall skipwhite
   412                                  
   413                                  	dec si
   414                                  	mov dx, msg.unrefstring
   415                                  	nearcall isstring?
   416                                  	je delete_unref_str
   417                                  	mov dx, msg.range
   418                                  	nearcall isstring?
   419                                  	je zz_del_range
   420                                  	jmp zz_del_match
   421                                  
   422                                  
   423                                  delete_unref_str:
   424                                  	lodsb
   425                                  	nearcall chkeol
   426                                  	xor si, si
   427                                  	jmp .condition
   428                                  
   429                                  .loop:
   430                                  	 push si		; string index
   431                                  	 push ax		; (reserve space, uninitialised)
   432                                  	dualcall getfarpointer.str
   433                                  	 pop di
   434                                  	 pop es
   435                                  
   436                                  	mov cx, word [es:di + ssLength]
   437                                  	cmp ch, 0
   438                                  	mov ch, 0
   439                                  	jne .next
   440                                  
   441                                  	push si
   442                                  	mov bx, si
   443                                  	nearcall zz_delete_string
   444                                  	pop si
   445                                  	jmp .condition
   446                                  
   447                                  .next:
   448                                  		; The maximum length of a SYMSTR is 255 + SYMSTR_size + 3.
   449                                  	nearcall zz_get_symstr_length_indices.ssLength_in_cx
   450                                  
   451                                  		; Due to the maximum length, both the byte index and the
   452                                  		;  SYMSTR_index_size index delta fit into a word each.
   453                                  	add si, cx		; keep count of what index we're at
   454                                  .condition:
   455                                  	cmp si, word [sym_storage.str.free]
   456                                  	jb .loop		; if not yet at free space -->
   457                                  	retn
   458                                  
   459                                  
   460                                  zz_del_match:
   461                                  	nearcall skipwhite
   462                                  
   463                                  	db __TEST_IMM8		; skip stc, NC
   464                                  
   465                                  		; INP:	ss:bx -> symbol name
   466                                  		;	cx = length of name
   467                                  .add_poison_entrypoint:
   468                                  	stc
   469                                  	lframe
   470                                  	lvar word,	string_hash
   471                                  	lenter
   472                                  	lvar word,	string_length
   473                                  	 push cx
   474                                  	lvar word,	bit_0_is_poison
   475                                  	 pushf
   476                                  	lvar dword,	string_pointer
   477                                  	 push ss
   478                                  	 push bx
   479                                  
   480                                  	mov cx, 0
   481                                  
   482                                  	lvar word,	matched_amount
   483                                  	 push cx
   484                                  
   485                                  	jc .poison_skip_1
   486                                  
   487                                  
   488                                  	mov ah, al
   489                                  	cmp al, "'"
   490                                  	je .symbol_quoted
   491                                  	cmp al, '"'
   492                                  	je .symbol_quoted
   493                                  	dec si
   494                                  	mov ah, 0
   495                                  .symbol_quoted:
   496                                  	mov word [bp + ?string_pointer], si
   497                                  .symbol_loop:
   498                                  	lodsb
   499                                  	cmp ah, 0
   500                                  	jne @F
   501                                  	nearcall ifsep
   502                                  	je .symbol_end
   503                                  	jmp .symbol_next
   504                                  @@:
   505                                  	cmp al, 13
   506                                  	je .error
   507                                  	test al, al
   508                                  	jz .error
   509                                  	cmp al, ah
   510                                  	jne @F
   511                                  	lodsb
   512                                  	nearcall ifsep
   513                                  	jne .error
   514                                  	jmp .symbol_end
   515                                  @@:
   516                                  .symbol_next:
   517                                  	inc cx
   518                                  	jmp .symbol_loop
   519                                  
   520                                  .error:
   521                                  	mov ax, 0503h
   522                                  	nearcall setrc
   523                                  	jmp symbolasm_error
   524                                  
   525                                  .symbol_end:
   526                                  	test cx, cx
   527                                  	jz .error
   528                                  	mov word [bp + ?string_length], cx
   529                                  
   530                                  	nearcall chkeol
   531                                  
   532                                  
   533                                  .poison_skip_1:
   534                                  	push ds
   535                                  	lds si, [bp + ?string_pointer]
   536                                  	mov cx, word [bp + ?string_length]
   537                                  	nearcall zz_hash
   538                                  	mov word [bp + ?string_hash], bx
   539                                  	pop ds
   540                                  
   541                                  	lvar word,	inner_main_index
   542                                  	 push ax
   543                                  
   544                                  .loop:
   545                                  		; ?inner_main_index used as parameter
   546                                  	 push word [bp + ?string_pointer + 2]
   547                                  	 push word [bp + ?string_pointer]
   548                                  	 push word [bp + ?string_length]
   549                                  	mov bx, word [bp + ?string_hash]
   550                                  
   551                                  	dualcall zz_match_symbol
   552                                  	jc .none
   553                                  
   554                                  	inc word [bp + ?matched_amount]
   555                                  	push dx
   556                                  	mov bx, word [bp + ?inner_main_index]
   557                                  	nearcall zz_delete_main
   558                                  	pop bx
   559                                  	nearcall zz_delete_hash
   560                                  
   561                                  	jmp .loop
   562                                  
   563                                  .none:
   564                                  	mov ax, word [bp + ?matched_amount]
   565                                  	testopt [bp + ?bit_0_is_poison], 1
   566                                  	lleave
   567                                  	jz @F
   568                                  	test ax, ax
   569                                  	jz .retn
   570                                  @@:
   571                                  
   572                                  zz_del_display_amount:
   573                                  	test ax, ax
   574                                  	jnz @F
   575                                  
   576                                  	mov dx, msg.zz_del_amount_none
   577                                  	jmp @FF
   578                                  
   579                                  @@:
   580                                  	mov dx, msg.zz_del_amount_1
   581                                  	nearcall disp_message
   582                                  	mov di, line_out
   583                                  	nearcall decword
   584                                  	push ax
   585                                  	nearcall putsline
   586                                  	pop ax
   587                                  	mov dx, msg.zz_del_amount_2.plural
   588                                  	cmp ax, 1
   589                                  	jne @F
   590                                  	mov dx, msg.zz_del_amount_2.singular
   591                                  @@:
   592                                  	nearcall disp_message
   593                                  zz_del_match.retn:
   594                                  	retn
   595                                  
   596                                  
   597                                  zz_del_range:
   598                                  	lodsb
   599                                  
   600                                  	lframe
   601                                  	lenter
   602                                  
   603                                  	mov bx, word [reg_cs]	; default segment = cs
   604                                  	nearcall getaddrX
   605                                  
   606                                  	xor cx, cx
   607                                  	lvar dword,	start_offset
   608                                  %if _PM
   609                                  	 push ax
   610                                  	 push ax
   611                                  	dualcall push_cxdx_or_edx
   612                                  %else
   613                                  	push cx
   614                                  	push dx
   615                                  %endif
   616                                  
   617                                  	push ax
   618                                  	nearcall getlinear_32bit
   619                                  	jc symbolasm_error
   620                                  
   621                                  	mov cx, ax
   622                                  	pop ax
   623                                  	lvar dword,	start_source
   624                                  	 push dx
   625                                  	 push cx
   626                                  
   627                                  	nearcall capitalise
   628                                  	cmp al, 'L'
   629                                  	je .l
   630                                  
   631                                  	nearcall getdword
   632                                  	sub dx, word [bp + ?start_offset]
   633                                  	sbb bx, word [bp + ?start_offset + 2]
   634                                  	jc symbolasm_error
   635                                  	add dx, 1
   636                                  	adc bx, 0
   637                                  	jc symbolasm_error
   638                                  	jmp @F
   639                                  
   640                                  .l:
   641                                  	lodsb
   642                                  	nearcall getdword
   643                                  @@:
   644                                  	lvar dword,	length
   645                                  	 push bx
   646                                  	 push dx
   647                                  
   648                                  	nearcall chkeol
   649                                  
   650                                  	mov ax, word [bp + ?start_source]
   651                                  	mov dx, word [bp + ?start_source + 2]
   652                                  				; dx:ax = start
   653                                  
   654                                  	mov bx, ax
   655                                  	mov cx, dx
   656                                  	add bx, word [bp + ?length]
   657                                  	adc cx, word [bp + ?length + 2]
   658                                  	sub bx, 1
   659                                  	sbb cx, 0		; cx:bx = end
   660                                  	nearcall binsearchmain
   661                                  	push cx
   662                                  	jcxz .done
   663                                  	xchg ax, bx		; ax = main index to delete
   664                                  
   665                                  .loop:
   666                                  	push ax			; preserve main index
   667                                  	push cx			; preserve number of entries
   668                                  	nearcall zz_delete_main_and_its_hash
   669                                  	pop cx
   670                                  	pop ax
   671                                  	loop .loop		; do next deletion (same main index) -->
   672                                  	mov word [stack_low_address], str_buffer
   673                                  .done:
   674                                  	pop ax
   675                                  	lleave
   676                                  	jmp zz_del_display_amount
   677                                  
   678                                  
   679                                  zz_stat:
   680                                  	lodsb
   681                                  	nearcall chkeol
   682                                  
   683                                  	nearcall list_sym_storage_usage
   684                                  	retn
   685                                  
   686                                  
   687                                  zz_match:
   688                                  	nearcall skipwhite
   689                                  
   690                                  	lframe
   691                                  	lvar word,	string_length
   692                                  	lvar word,	string_hash
   693                                  	lenter
   694                                  	lequ 1,		flag_is_add
   695                                  	lequ 2,		flag_is_base
   696                                  	lequ 4,		flag_is_single_line
   697                                  	mov bx, ?flag_is_single_line
   698                                  	lvar word,	flags
   699                                  	 push bx
   700                                  	lvar dword,	string_pointer
   701                                  	 push ss
   702                                  	 push bx
   703                                  
   704                                  	dec si
   705                                  	mov dx, msg.add
   706                                  	nearcall isstring?
   707                                  	jne @F
   708                                  
   709                                  	inc byte [bp + ?flags]	; set ?flag_is_add
   710                                  
   711                                  @@:
   712                                  	nearcall skipwhite
   713                                  
   714                                  	dec si
   715                                  	mov dx, msg.base
   716                                  	nearcall isstring?
   717                                  	jne @F
   718                                  
   719                                  	or byte [bp + ?flags], ?flag_is_base
   720                                  
   721                                  @@:
   722                                  	nearcall skipwhite
   723                                  
   724                                  	xor cx, cx
   725                                  	mov ah, al
   726                                  	cmp al, "'"
   727                                  	je .symbol_quoted
   728                                  	cmp al, '"'
   729                                  	je .symbol_quoted
   730                                  	dec si
   731                                  	mov ah, 0
   732                                  .symbol_quoted:
   733                                  	mov word [bp + ?string_pointer], si
   734                                  .symbol_loop:
   735                                  	lodsb
   736                                  	cmp ah, 0
   737                                  	jne @F
   738                                  	nearcall ifsep
   739                                  	je .symbol_end
   740                                  	jmp .symbol_next
   741                                  @@:
   742                                  	cmp al, 13
   743                                  	je .error
   744                                  	test al, al
   745                                  	jz .error
   746                                  	cmp al, ah
   747                                  	jne @F
   748                                  	lodsb
   749                                  	nearcall ifsep
   750                                  	jne .error
   751                                  	jmp .symbol_end
   752                                  @@:
   753                                  .symbol_next:
   754                                  	inc cx
   755                                  	jmp .symbol_loop
   756                                  
   757                                  .error:
   758                                  	mov ax, 0504h
   759                                  	nearcall setrc
   760                                  	jmp symbolasm_error
   761                                  
   762                                  .symbol_end:
   763                                  	test cx, cx
   764                                  	jz .error
   765                                  	mov word [bp + ?string_length], cx
   766                                  
   767                                  	nearcall chkeol
   768                                  
   769                                  
   770                                  	push ds
   771                                  	lds si, [bp + ?string_pointer]
   772                                  	mov cx, word [bp + ?string_length]
   773                                  	nearcall zz_hash
   774                                  	mov word [bp + ?string_hash], bx
   775                                  	pop ds
   776                                  
   777                                  	lvar word,	inner_main_index
   778                                  	 push ax
   779                                  
   780                                  		; ?inner_main_index used as parameter
   781                                  	 push word [bp + ?string_pointer + 2]
   782                                  	 push word [bp + ?string_pointer]
   783                                  	 push word [bp + ?string_length]
   784                                  
   785                                  	dualcall zz_match_symbol
   786                                  	jc .none
   787                                  		; Here, dx, and bx need to be preserved until
   788                                  		;  the next call to zz_match_symbol.
   789                                  	push dx
   790                                  	push bx
   791                                  
   792                                  	 push word [bp + ?inner_main_index]
   793                                  	 push word [bp + ?flags]
   794                                  	dualcall zz_list_symbol.first
   795                                  	jmp .next
   796                                  
   797                                  
   798                                  .loop:
   799                                  		; ?inner_main_index used as parameter
   800                                  	 push word [bp + ?string_pointer + 2]
   801                                  	 push word [bp + ?string_pointer]
   802                                  	 push word [bp + ?string_length]
   803                                  
   804                                  	dualcall zz_match_symbol.continue
   805                                  	jc .end
   806                                  
   807                                  		; Here, dx, and bx need to be preserved until
   808                                  		;  the next call to zz_match_symbol.
   809                                  	push dx
   810                                  	push bx
   811                                  
   812                                  	 push word [bp + ?inner_main_index]
   813                                  	 push word [bp + ?flags]
   814                                  	dualcall zz_list_symbol.subsequent
   815                                  .next:
   816                                  	pop bx
   817                                  	pop dx
   818                                  	jmp .loop
   819                                  
   820                                  
   821                                  .none:
   822                                  	mov dx, msg.zz_match_none
   823                                  	test byte [bp + ?flags], ?flag_is_add
   824                                  	jz @F
   825                                  	mov dx, msg.zz_match_add_none
   826                                  @@:
   827                                  	nearcall disp_message
   828                                  
   829                                  .end:
   830                                  	lleave
   831                                  	retn
   832                                  
   833                                  
   834                                  zz_list:
   835                                  	lframe
   836                                  	lenter
   837                                  	lequ 1,		flag_is_add
   838                                  	lequ 2,		flag_is_base
   839                                  	xor ax, ax
   840                                  	lvar word,	flags
   841                                  	 push ax
   842                                  	lvar dword,	start
   843                                  	 push ax
   844                                  	 push ax
   845                                  	dec ax
   846                                  	lvar dword,	end
   847                                  	 push ax
   848                                  	 push ax
   849                                  
   850                                  	nearcall skipwhite
   851                                  
   852                                  	dec si
   853                                  	mov dx, msg.add
   854                                  	nearcall isstring?
   855                                  	jne @F
   856                                  
   857                                  	inc byte [bp + ?flags]	; set ?flag_is_add
   858                                  
   859                                  @@:
   860                                  	nearcall skipwhite
   861                                  
   862                                  	dec si
   863                                  	mov dx, msg.base
   864                                  	nearcall isstring?
   865                                  	jne @F
   866                                  
   867                                  	or byte [bp + ?flags], ?flag_is_base
   868                                  
   869                                  @@:
   870                                  	nearcall skipwhite
   871                                  
   872                                  	nearcall iseol?
   873                                  	je .do
   874                                  
   875                                  	mov bx, word [reg_cs]
   876                                  	nearcall getlinearaddr
   877                                  	mov word [bp + ?start], dx
   878                                  	mov word [bp + ?start + 2], bx
   879                                  	mov word [bp + ?end], dx
   880                                  	mov word [bp + ?end + 2], bx
   881                                  
   882                                  	nearcall skipwh0
   883                                  	nearcall iseol?
   884                                  	je .do
   885                                  
   886                                  	mov bx, word [reg_cs]
   887                                  	nearcall getlinearaddr
   888                                  	mov word [bp + ?end], dx
   889                                  	mov word [bp + ?end + 2], bx
   890                                  	nearcall chkeol
   891                                  
   892                                  .do:
   893                                  	test byte [bp + ?flags], ?flag_is_add
   894                                  	jz @F
   895                                  	mov dx, msg.zz_list_add_range
   896                                  	nearcall disp_message
   897                                  @@:
   898                                  	mov dx, msg.zz_list_range_first
   899                                  	nearcall disp_message
   900                                  	mov ax, word [bp + ?start + 2]
   901                                  	nearcall disp_ax_hex
   902                                  	mov ax, word [bp + ?start]
   903                                  	nearcall disp_ax_hex
   904                                  	mov dx, msg.zz_list_range_second
   905                                  	nearcall disp_message
   906                                  	mov ax, word [bp + ?end + 2]
   907                                  	nearcall disp_ax_hex
   908                                  	mov ax, word [bp + ?end]
   909                                  	nearcall disp_ax_hex
   910                                  	mov dx, msg.zz_list_range_third
   911                                  	nearcall disp_message
   912                                  
   913                                  	mov dx, word [bp + ?start + 2]
   914                                  	mov ax, word [bp + ?start]
   915                                  	mov cx, word [bp + ?end + 2]
   916                                  	mov bx, word [bp + ?end]
   917                                  
   918                                  	nearcall binsearchmain
   919                                  	jcxz .none
   920                                  
   921                                  	push bx
   922                                  	push word [bp + ?flags]
   923                                  	dualcall zz_list_symbol.first
   924                                  	jmp .next
   925                                  
   926                                  .loop:
   927                                  	push bx
   928                                  	push word [bp + ?flags]
   929                                  	dualcall zz_list_symbol.subsequent
   930                                  .next:
   931                                  	inc bx
   932                                  	loop .loop
   933                                  .end:
   934                                  	mov dx, msg.zz_list_end
   935                                  	nearcall disp_message
   936                                  	jmp .ret
   937                                  
   938                                  .none:
   939                                  	mov dx, msg.zz_list_none
   940                                  	test byte [bp + ?flags], ?flag_is_add
   941                                  	jz @F
   942                                  	mov dx, msg.zz_list_add_none
   943                                  @@:
   944                                  	nearcall disp_message
   945                                  
   946                                  .ret:
   947                                  	lleave
   948                                  	retn
   949                                  
   950                                  
   951                                  		; INP:	word [ss:sp + 2] = main index
   952                                  		;	word [ss:sp] = list flags
   953                                  		; CHG:	ax, dx, es, di
   954                                  dualfunction
   955                                  zz_list_symbol:
   956                                  .first:
   957                                  	db __TEST_IMM8		; (skip stc, NC)
   958                                  .subsequent:
   959                                  	stc
   960                                  	lframe dualdistance
   961                                  	lpar word,	main_index
   962                                  	lequ 1,		flag_is_add
   963                                  	lequ 2,		flag_is_base
   964                                  	lequ 4,		flag_is_single_line
   965                                  	lpar word,	flags
   966                                  	lenter
   967                                  	lvar word,	bit_0_is_subsequent
   968                                  	 pushf
   969                                  	mov ax, -1
   970                                  	lvar word,	base_index
   971                                  	 push ax
   972                                  	push bx
   973                                  
   974                                  	 push word [bp + ?main_index]
   975                                  	 push ax		; (reserve space, uninitialised)
   976                                  	dualcall getfarpointer.main
   977                                  	 pop di
   978                                  	 pop es
   979                                  
   980                                  	test byte [bp + ?bit_0_is_subsequent], 1
   981                                  	jnz .loop
   982                                  
   983                                  	test byte [bp + ?flags], ?flag_is_single_line
   984                                  	jnz .loop_first
   985                                  	mov dx, msg.zz_list_start
   986                                  	nearcall disp_message
   987                                  	jmp .loop_first
   988                                  .loop:
   989                                  	mov dx, msg.zz_list_between
   990                                  	nearcall disp_message
   991                                  .loop_first:
   992                                  	mov dx, msg.zz_list_first
   993                                  	test byte [bp + ?flags], ?flag_is_add
   994                                  	jz @F
   995                                  	mov dx, msg.zz_list_add_first
   996                                  @@:
   997                                  	nearcall disp_message
   998                                  	mov dx, word [es:di + smLinear + 2]
   999                                  	mov ax, word [es:di + smLinear]
  1000                                  
  1001                                  	test byte [bp + ?flags], ?flag_is_base
  1002                                  	jz @F
  1003                                  	sub ax, word [vregs + 1 * 4]
  1004                                  	sbb dx, word [vregs + 1 * 4 + 2]
  1005                                  	jmp .have_base
  1006                                  @@:
  1007                                  
  1008                                  	mov bx, word [es:di + smBase]
  1009                                  	cmp bx, -1
  1010                                  	je .have_base
  1011                                  	mov word [bp + ?base_index], bx
  1012                                  
  1013                                  	 push bx
  1014                                  	 push ax
  1015                                  	dualcall getfarpointer.main
  1016                                  	 pop di
  1017                                  	 pop es
  1018                                  
  1019                                  	sub ax, word [es:di + smLinear]
  1020                                  	sbb dx, word [es:di + smLinear + 2]
  1021                                  
  1022                                  	 push word [bp + ?main_index]
  1023                                  	 push ax		; (reserve space, uninitialised)
  1024                                  	dualcall getfarpointer.main
  1025                                  	 pop di
  1026                                  	 pop es
  1027                                  .have_base:
  1028                                  
  1029                                  	push ax
  1030                                  	mov ax, dx
  1031                                  	test ah, ah
  1032                                  	jz @F
  1033                                  	xchg al, ah
  1034                                  	nearcall disp_al_hex
  1035                                  	xchg al, ah
  1036                                  @@:
  1037                                  	nearcall disp_al_hex
  1038                                  	pop ax
  1039                                  	nearcall disp_ax_hex
  1040                                  
  1041                                  	mov al, 'h'
  1042                                  	test byte [bp + ?flags], ?flag_is_add
  1043                                  	jz @F
  1044                                  	nearcall putc
  1045                                  @@:
  1046                                  
  1047                                  	test byte [bp + ?flags], ?flag_is_base
  1048                                  	jz @F
  1049                                  	mov dx, msg.zz_list_base
  1050                                  	nearcall disp_message
  1051                                  	jmp .displayed_base
  1052                                  @@:
  1053                                  	mov bx, word [bp + ?base_index]
  1054                                  	cmp bx, -1
  1055                                  	je .displayed_base
  1056                                  
  1057                                  	mov dx, msg.zz_list_base_symbol
  1058                                  	nearcall disp_message
  1059                                  
  1060                                  	 push bx
  1061                                  	dualcall displaystring
  1062                                  
  1063                                  	 push word [bp + ?main_index]
  1064                                  	 push ax		; (reserve space, uninitialised)
  1065                                  	dualcall getfarpointer.main
  1066                                  	 pop di
  1067                                  	 pop es
  1068                                  
  1069                                  .displayed_base:
  1070                                  
  1071                                  	mov dx, msg.zz_list_second
  1072                                  	test byte [bp + ?flags], ?flag_is_add
  1073                                  	jz @F
  1074                                  	mov dx, msg.zz_list_add_second
  1075                                  @@:
  1076                                  	nearcall disp_message
  1077                                  	mov ax, word [es:di + smOffset + 2]
  1078                                  	test ax, ax
  1079                                  	jz @F
  1080                                  	nearcall disp_ax_hex
  1081                                  @@:
  1082                                  	mov ax, word [es:di + smOffset]
  1083                                  	nearcall disp_ax_hex
  1084                                  
  1085                                  	mov dx, msg.zz_list_middle
  1086                                  	test byte [bp + ?flags], ?flag_is_add
  1087                                  	jz @F
  1088                                  	mov dx, msg.zz_list_add_middle
  1089                                  @@:
  1090                                  	nearcall disp_message
  1091                                  	 push word [bp + ?main_index]
  1092                                  	dualcall displaystring
  1093                                  	mov dx, msg.zz_list_last
  1094                                  	test byte [bp + ?flags], ?flag_is_add
  1095                                  	jz @F
  1096                                  	mov dx, msg.zz_list_add_last
  1097                                  @@:
  1098                                  	nearcall disp_message
  1099                                  
  1100                                  	pop bx
  1101                                  	lleave
  1102                                  	dualreturn
  1103                                  	lret
  1104                                  
  1105                                  
  1106                                  zz_add:
  1107                                  	nearcall skipwhite
  1108                                  
  1109                                  	xor bx, bx
  1110                                  	lframe
  1111                                  	lenter
  1112                                  	lvar dword,	string_pointer
  1113                                  	 push ss
  1114                                  	 push bx
  1115                                  	lvar word,	string_length
  1116                                  	 push bx
  1117                                  	lvar dword,	linear
  1118                                  	 push bx
  1119                                  	 push bx
  1120                                  	lvar dword,	offset
  1121                                  	 push bx
  1122                                  	 push bx
  1123                                  	lvar word,	insertflags
  1124                                  	 push bx
  1125                                  
  1126                                  	clropt [internalflags2], dif2_poison
  1127                                  	or word [sym_storage.main.based.base], -1
  1128                                  				; set base to none
  1129                                  		; base is set by expression evaluator if any is used
  1130                                  
  1131                                  .loop:
  1132                                  	nearcall iseol?
  1133                                  	jne @F
  1134                                  
  1135                                  		; ?linear used as parameter to zz_insert
  1136                                  		; ?offset used as parameter to zz_insert
  1137                                  		; ?insertflags used as parameter to zz_insert
  1138                                  	les dx, [bp + ?string_pointer]
  1139                                  	mov cx, word [bp + ?string_length]
  1140                                  	test cx, cx
  1141                                  	jz .error
  1142                                  
  1143                                  	testopt [internalflags2], dif2_poison
  1144                                  	jnz .poisoned
  1145                                  
  1146                                  	dualcall zz_insert
  1147                                  
  1148                                  .ret:
  1149                                  	lleave code
  1150                                  	retn
  1151                                  
  1152                                  
  1153                                  		; cx = symbol name length
  1154                                  .poisoned:
  1155                                  	nearcall zz_commit_insert
  1156                                  
  1157                                  	mov ax, 050Dh
  1158                                  	nearcall setrc
  1159                                  	mov dx, msg.poison_block
  1160                                  	nearcall putsz_error
  1161                                  
  1162                                  	mov bx, word [bp + ?string_pointer]
  1163                                  	nearcall zz_del_match.add_poison_entrypoint
  1164                                  	jmp .ret
  1165                                  
  1166                                  
  1167                                  @@:
  1168                                  	dec si
  1169                                  	lodsw			; get single-letter type name, if any
  1170                                  	nearcall capitalise		; uppercase type name letter in al
  1171                                  	cmp ah, ':'
  1172                                  	jne @F
  1173                                  	mov ah, '='
  1174                                  @@:
  1175                                  	dec si			; -> at = or :
  1176                                  	cmp ax, "S="
  1177                                  	je .symbol
  1178                                  	cmp ax, "O="
  1179                                  	je .offset
  1180                                  	cmp ax, "L="
  1181                                  	je .linear
  1182                                  	cmp ax, "F="
  1183                                  	je .flags
  1184                                  	dec si			; -> at first letter of type name
  1185                                  
  1186                                  	mov dx, msg.symbol
  1187                                  	nearcall isstring?
  1188                                  	je .symbol
  1189                                  	mov dx, msg.offset
  1190                                  	nearcall isstring?
  1191                                  	je .offset
  1192                                  	mov dx, msg.linear
  1193                                  	nearcall isstring?
  1194                                  	je .linear
  1195                                  	mov dx, msg.flags
  1196                                  	nearcall isstring?
  1197                                  	je .flags
  1198                                  
  1199                                  	lodsb
  1200                                  	mov bx, word [reg_cs]
  1201                                  	nearcall getaddrX
  1202                                  
  1203                                  	xor cx, cx
  1204                                  %if _PM
  1205                                  	 push ax
  1206                                  	 push ax
  1207                                  	dualcall push_cxdx_or_edx
  1208                                  	pop word [bp + ?offset]
  1209                                  	pop word [bp + ?offset + 2]
  1210                                  %else
  1211                                  	mov word [bp + ?offset + 2], cx
  1212                                  	mov word [bp + ?offset], dx
  1213                                  %endif
  1214                                  	push ax
  1215                                  	nearcall getlinear_32bit
  1216                                  	jc .error
  1217                                  	mov word [bp + ?linear], ax
  1218                                  	mov word [bp + ?linear + 2], dx
  1219                                  	pop ax		; al = next character
  1220                                  	jmp .next
  1221                                  
  1222                                  .skip_equal:
  1223                                  	lodsb
  1224                                  	cmp al, '='
  1225                                  	je @F
  1226                                  	cmp al, ':'
  1227                                  	jne .error
  1228                                  @@:
  1229                                  	lodsb
  1230                                  	retn
  1231                                  
  1232                                  .flags:
  1233                                  	call .skip_equal
  1234                                  	nearcall getword
  1235                                  	mov word [bp + ?insertflags], dx
  1236                                  	jmp .next
  1237                                  
  1238                                  .offset:
  1239                                  	call .skip_equal
  1240                                  	nearcall getexpression	; bx:dx = expression
  1241                                  	mov word [bp + ?offset], dx
  1242                                  	mov word [bp + ?offset + 2], bx
  1243                                  	jmp .next
  1244                                  
  1245                                  .linear:
  1246                                  	call .skip_equal
  1247                                  	nearcall getexpression	; bx:dx = expression
  1248                                  	mov word [bp + ?linear], dx
  1249                                  	mov word [bp + ?linear + 2], bx
  1250                                  	jmp .next
  1251                                  
  1252                                  .symbol:
  1253                                  	call .skip_equal
  1254                                  	xor cx, cx
  1255                                  	mov ah, al
  1256                                  	cmp al, "'"
  1257                                  	je .symbol_quoted
  1258                                  	cmp al, '"'
  1259                                  	je .symbol_quoted
  1260                                  	dec si
  1261                                  	mov ah, 0
  1262                                  .symbol_quoted:
  1263                                  	mov word [bp + ?string_pointer], si
  1264                                  .symbol_loop:
  1265                                  	lodsb
  1266                                  	cmp ah, 0
  1267                                  	jne @F
  1268                                  	nearcall ifsep
  1269                                  	je .symbol_end
  1270                                  	jmp .symbol_next
  1271                                  @@:
  1272                                  	cmp al, 13
  1273                                  	je .error
  1274                                  	test al, al
  1275                                  	jz .error
  1276                                  	cmp al, ah
  1277                                  	jne @F
  1278                                  	lodsb
  1279                                  	nearcall ifsep
  1280                                  	jne .error
  1281                                  	jmp .symbol_end
  1282                                  @@:
  1283                                  .symbol_next:
  1284                                  	inc cx
  1285                                  	jmp .symbol_loop
  1286                                  
  1287                                  .symbol_end:
  1288                                  	jcxz .error
  1289                                  	xchg cx, word [bp + ?string_length]
  1290                                  	test cx, cx
  1291                                  	jnz .error
  1292                                  .next:
  1293                                  	nearcall skipwh0
  1294                                  	jmp .loop
  1295                                  
  1296                                  
  1297                                  .error:
  1298                                  	mov ax, 0505h
  1299                                  	nearcall setrc
  1300                                  	jmp symbolasm_error
  1301                                  
  1302                                  	lleave ctx
  1303                                  
  1304                                  
  1305                                  		; INP:	si -> first character after /S switch start
  1306                                  		; OUT:	al = first character after parsed switch end
  1307                                  		;	si -> next character
  1308                                  zz_switch_s: section_of_function
  1309                                  	lodsb
  1310                                  	nearcall capitalise
  1311                                  	cmp al, 'R'
  1312                                  	jne .notr
  1313                                  	clropt [internalflags2], dif2_sym_req_mask
  1314                                  	setopt [internalflags2], dif2_sym_req_86mm
  1315                                  	jmp @F
  1316                                  .notr:
  1317                                  	cmp al, '*'
  1318                                  	jne .notasterisk
  1319                                  	clropt [internalflags2], dif2_sym_req_mask
  1320                                  	setopt [internalflags2], dif2_sym_req_86mm | dif2_sym_req_xms
  1321                                  	jmp @F
  1322                                  .notasterisk:
  1323                                  	cmp al, 'X'
  1324                                  	jne .notx
  1325                                  	clropt [internalflags2], dif2_sym_req_mask
  1326                                  	setopt [internalflags2], dif2_sym_req_xms
  1327                                  @@:
  1328                                  	lodsb
  1329                                  	cmp al, 32
  1330                                  	push ax
  1331                                  	push si
  1332                                  	ja .x_cont
  1333                                  	jmp .end
  1334                                  .x_cont:
  1335                                  	pop si
  1336                                  	pop ax
  1337                                  .notx:
  1338                                  	cmp al, ':'
  1339                                  	je .skip
  1340                                  	cmp al, '='
  1341                                  	jne symbolasm_error
  1342                                  .skip:
  1343                                  	inc si
  1344                                  	push si
  1345                                  	dec si
  1346                                  	mov dx, msg.max
  1347                                  	nearcall isstring?
  1348                                  	jne @F
  1349                                  	lodsb
  1350                                  	mov dx, -1
  1351                                  	mov bx, dx
  1352                                  	jmp .common
  1353                                  
  1354                                  @@:
  1355                                  	pop ax
  1356                                  	lodsb
  1357                                  	push si
  1358                                  	cmp al, '('
  1359                                  	jne .not_expr
  1360                                  	lodsb
  1361                                  	nearcall getexpression
  1362                                  	nearcall skipwh0
  1363                                  	cmp al, ')'
  1364                                  	lodsb
  1365                                  	jne symbolasm_error
  1366                                  	jmp .common
  1367                                  
  1368                                  .not_expr:
  1369                                  	nearcall zz_get_literal
  1370                                  .common:
  1371                                  	cmp bx, -1
  1372                                  	jne @F
  1373                                  	cmp dx, -1
  1374                                  	je @FFF
  1375                                  @@:
  1376                                  	testopt [internalflags2], dif2_sym_req_86mm
  1377                                  	jnz @F
  1378                                  	test bx, bx
  1379                                  	jnz .error_pop_si
  1380                                  	cmp dx, kib((SYMMAIN_size + SYMHASH_size + SYMSTR_index_size) * 65535)
  1381                                  	ja .error_pop_si
  1382                                  	jmp @FF
  1383                                  
  1384                                  @@:
  1385                                  	test bx, bx
  1386                                  	jnz .error_pop_si
  1387                                  	cmp dx, _86MM_SYMBOL_TABLE_MAX
  1388                                  	ja .error_pop_si
  1389                                  @@:
  1390                                  
  1391                                  	pop cx			; (discard si)
  1392                                  	push ax			; preserve next character
  1393                                  	push si
  1394                                  	xchg ax, dx		; ax = size
  1395                                  	test ax, ax
  1396                                  	jz .free
  1397                                  
  1398                                  	push ax			; on stack: originally requested amount KiB
  1399                                  %if _BOOTLDR
  1400                                  	testopt [internalflags], nodosloaded
  1401                                  	jnz .notxms
  1402                                  %endif
  1403                                  
  1404                                  %if _APPLICATION || _DEVICE
  1405                                  	testopt [internalflags2], dif2_sym_req_xms
  1406                                  	jz .notxms
  1407                                  
  1408                                  	cmp word [zz_xms.entry + 4], 0
  1409                                  	jne @F
  1410                                  	cmp word [zz_xms.entry + 6], 0
  1411                                  	jne @F
  1412                                  	cmp word [zz_xms.entry + 2], 0
  1413                                  	je .no_xms
  1414                                  @@:
  1415                                  
  1416                                  	cmp ax, -1
  1417                                  	jne @F
  1418                                  
  1419                                  	mov ax, kib( 		(SYMHASH_index_size + SYMMAIN_index_size + SYMSTR_index_size) 		 * 64 * 1024)	; ax = how many KiB
  1422                                  @@:
  1423                                  	mov bx, ax
  1424                                  	xor dx, dx
  1425                                  	mov cx, 6
  1426                                  .loop_shl_6:
  1427                                  	shl ax, 1
  1428                                  	rcl dx, 1		; to paragraphs
  1429                                  	loop .loop_shl_6
  1430                                  
  1431                                  @@:
  1432                                  	push dx
  1433                                  	push ax
  1434                                  	mov ah, 09h
  1435                                  	add bx, kib(fromparas(paras(ssString + 255)) + XMSTRANSFER_default_size)
  1436                                  	jc symbolasm_error
  1437                                  	mov dx, bx
  1438                                  	push bx
  1439                                  	nearcall zz_call_xms	; dx = allocated handle
  1440                                  	dec ax
  1441                                  	pop bx			; bx = how many KiB allocated
  1442                                  	pop ax
  1443                                  	pop cx			; cx:ax = how many paragraphs allocated
  1444                                  				;  (not including the XMS transfer buffer)
  1445                                  	jz @F
  1446                                  	mov ax, 0506h
  1447                                  	mov dx, msg.zz_fail_xms_alloc
  1448                                  	jmp .no_xms.error
  1449                                  
  1450                                  @@:
  1451                                  	add sp, 2		; discard ax on stack
  1452                                  	jmp xms_init
  1453                                  
  1454                                  .no_xms:			; no XMS driver
  1455                                  	mov ax, 0507h
  1456                                  	mov dx, msg.zz_no_xms
  1457                                  .no_xms.error:
  1458                                  	nearcall disp_message
  1459                                  	testopt [internalflags2], dif2_sym_req_86mm
  1460                                  	jnz .notxms
  1461                                  	mov dx, msg.empty_message
  1462                                  	nearcall setrc
  1463                                   %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
  1464                                  	jmp exit_error_msg
  1465                                   %else
  1466                                  	jmp exit_error_msg_code
  1467                                   %endif
  1468                                  %endif
  1469                                  
  1470                                  .notxms:
  1471                                  	pop ax			; restore KiB requested (-1 = max)
  1472                                  
  1473                                  	cmp ax, -1		; max ?
  1474                                  	jne @F
  1475                                  	mov ax, _86MM_SYMBOL_TABLE_MAX
  1476                                  				; set maximum size
  1477                                  @@:
  1478                                  
  1479                                  	mov bx, ax
  1480                                  	mov cl, 6
  1481                                  	shl ax, cl		; to paragraphs
  1482                                  
  1483                                  %if _BOOTLDR
  1484                                   %if _APPLICATION || _DEVICE
  1485                                  	testopt [internalflags], nodosloaded
  1486                                  	jz @FF
  1487                                   %endif
  1488                                  	test ax, ax
  1489                                  	jnz @F
  1490                                  	mov dx, msg.zz_switch_s_internal_error
  1491                                  	mov ax, 0509h
  1492                                  	nearcall setrc
  1493                                  	jmp .putsz_end
  1494                                  
  1495                                  @@:
  1496                                  	dec ax			; allow for image ident paragraph
  1497                                  @@:
  1498                                  %endif
  1499                                  
  1500                                  	push bx
  1501                                  	mov cx, ax
  1502                                  	xor bx, bx
  1503                                  	nearcall shift_left_4_bxcx
  1504                                  
  1505                                  	cmp word [zz_xms.handle], -1
  1506                                  	jne @FF
  1507                                  
  1508                                  	cmp word [sym_storage.start + 2], 0
  1509                                  	jne @F
  1510                                  	cmp word [sym_storage.start], 0
  1511                                  	je @FF
  1512                                  @@:
  1513                                  
  1514                                  	 push word [sym_storage.start + 2]
  1515                                  	 push word [sym_storage.start]
  1516                                  	dualcall normalise_pointer_with_displacement_bxcx
  1517                                  	 pop cx
  1518                                  	 pop bx
  1519                                  
  1520                                  	cmp word [sym_storage.end + 2], bx
  1521                                  	jne @F
  1522                                  	cmp word [sym_storage.end], cx
  1523                                  	je .no_size_change
  1524                                  @@:
  1525                                  
  1526                                  	nearcall InDOS
  1527                                  	jz @F
  1528                                  
  1529                                  %if _BOOTLDR
  1530                                   %if _APPLICATION || _DEVICE
  1531                                  	testopt [internalflags], nodosloaded
  1532                                  	jz .notboot1
  1533                                   %endif
  1534                                  	testopt [internalflags2], dif2_boot_loaded_kernel
  1535                                  	jz @F
  1536                                  
  1537                                  	mov dx, msg.zz_switch_s_boot_loaded_kernel
  1538                                  	jmp .putsz_end_pop
  1539                                  
  1540                                  .notboot1:
  1541                                  %endif
  1542                                  
  1543                                  	mov dx, msg.zz_switch_s_indos
  1544                                  .putsz_end_pop:
  1545                                  	pop bx
  1546                                  .putsz_end:
  1547                                  	nearcall putsz_error
  1548                                  	jmp .end
  1549                                  
  1550                                  @@:
  1551                                  
  1552                                  	mov di, ax
  1553                                  
  1554                                  %if _BOOTLDR
  1555                                  	testopt [internalflags], nodosloaded
  1556                                  	jnz @F
  1557                                  %endif
  1558                                  %if _APPLICATION || _DEVICE
  1559                                  	testopt [internalflags2], dif2_createdprocess
  1560                                  	jz @F
  1561                                  
  1562                                  	mov cx, word [created_psp]
  1563                                  	cmp cx, word [pspdbe]	; current PSP the created one ?
  1564                                  	jne @F			; no -->
  1565                                  
  1566                                  	dec cx
  1567                                  %if _PM
  1568                                  	mov ax, cx
  1569                                  	nearcall setes2ax
  1570                                  %else
  1571                                  	mov es, cx		; => MCB
  1572                                  %endif
  1573                                  	inc cx
  1574                                  	cmp word [es:1], cx	; right owner ?
  1575                                  	jne @F			; no -->
  1576                                  	mov cx, word [created_size]
  1577                                  	cmp cx, word [es:3]	; right size ?
  1578                                  	jne @F			; no -->
  1579                                  
  1580                                  	mov cx, word [created_psp]
  1581                                  	mov bx, 1000h
  1582                                  	mov word [created_size], bx
  1583                                  	mov ah, 4Ah
  1584                                  	push cx			; save segment value
  1585                                  	 push cx		; = value for es
  1586                                  	dual2call _doscall_return_es	; resize to 64 KiB
  1587                                  	 pop cx			; (discard)
  1588                                  	pop cx			; = segment
  1589                                  	dec cx
  1590                                  %if _PM
  1591                                  	mov ax, cx
  1592                                  	nearcall setes2ax
  1593                                  %else
  1594                                  	mov es, cx		; => MCB
  1595                                  %endif
  1596                                  	inc cx
  1597                                  	mov word [es:1], cx	; restore owner to debuggee process
  1598                                  %endif
  1599                                  
  1600                                  @@:
  1601                                  	mov ax, di
  1602                                  	pop bx
  1603                                  
  1604                                  .no_size_change:
  1605                                  	 push ss
  1606                                  	 pop es
  1607                                  	 push ss
  1608                                  	 pop ds
  1609                                  	push ax			; size in paragraphs
  1610                                  	mov dx, msg.zz_switch_s_received
  1611                                  	nearcall putsz
  1612                                  	mov di, line_out
  1613                                  	mov ax, bx
  1614                                  	nearcall decword
  1615                                  	mov ax, " K"
  1616                                  	stosw
  1617                                  	mov ax, "iB"
  1618                                  	stosw
  1619                                  	mov al, '.'
  1620                                  	stosb
  1621                                  	nearcall putsline_crlf
  1622                                  
  1623                                  	nearcall zz_compact
  1624                                  	pop cx			; size in paragraphs
  1625                                  
  1626                                  	lframe
  1627                                  	lvar dword,	common_size_bytes
  1628                                  	lenter
  1629                                  	lvar word,	req_size_para
  1630                                  	 push cx
  1631                                  
  1632                                  	mov dx, cx
  1633                                  	xor bx, bx
  1634                                  	nearcall shift_left_4_bxcx	; new size in bytes
  1635                                  
  1636                                  
  1637                                  	cmp word [zz_xms.handle], -1
  1638                                  	je .fromnotxms1
  1639                                  
  1640                                  .fromxms1:
  1641                                  	cmp bx, word [sym_storage.xms.free + 2]
  1642                                  	jne @F
  1643                                  	cmp cx, word [sym_storage.xms.free]
  1644                                  @@:
  1645                                  	jb .new_smaller
  1646                                  	mov bx, word [sym_storage.xms.free + 2]
  1647                                  	mov cx, word [sym_storage.xms.free]
  1648                                  	jmp .fromxms_old_smaller
  1649                                  
  1650                                  .fromnotxms1:
  1651                                  	 push word [sym_storage.start + 2]
  1652                                  	 push word [sym_storage.start]
  1653                                  	dualcall normalise_pointer_with_displacement_bxcx
  1654                                  	 pop cx
  1655                                  	 pop bx			; -> after allocated block, with new size
  1656                                  
  1657                                  	cmp bx, word [sym_storage.free + 2]
  1658                                  	jne @F
  1659                                  	cmp cx, word [sym_storage.free]
  1660                                  @@:
  1661                                  	je .lframe_no_reallocation_needed
  1662                                  	jb .new_smaller
  1663                                  .old_smaller:
  1664                                  	mov bx, word [sym_storage.free + 2]
  1665                                  	mov cx, word [sym_storage.free]
  1666                                  	jmp .got_smaller
  1667                                  
  1668                                  .new_smaller:
  1669                                  ..@new_smaller:
  1670                                  	mov dx, msg.zz_too_full
  1671                                  	nearcall putsz_error
  1672                                  	jmp .lframe_end
  1673                                  
  1674                                  .got_smaller:
  1675                                  	 push bx
  1676                                  	 push cx
  1677                                  	dualcall pointer_to_linear
  1678                                  	xchg dx, bx
  1679                                  	xchg ax, cx		; bx:cx = linear after end
  1680                                  	 push word [sym_storage.start + 2]
  1681                                  	 push word [sym_storage.start]
  1682                                  	dualcall pointer_to_linear	; dx:ax = linear start
  1683                                  	sub cx, ax
  1684                                  	sbb bx, dx		; end - start = size
  1685                                  				; bx:cx = smaller of current size and requested
  1686                                  				;  (in bytes)
  1687                                  .fromxms_old_smaller:
  1688                                  	mov word [bp + ?common_size_bytes], cx
  1689                                  	mov word [bp + ?common_size_bytes + 2], bx
  1690                                  
  1691                                  	nearcall bxcx_to_cx_paragraphs
  1692                                  	mov dx, cx		; dx = smaller in paragraphs
  1693                                  
  1694                                  %if _BOOTLDR
  1695                                   %if _APPLICATION || _DEVICE
  1696                                  	testopt [internalflags], nodosloaded
  1697                                  	jz .notboot2
  1698                                   %endif
  1699                                  
  1700                                  	push dx
  1701                                  	nearcall bootgetmemorysize
  1702                                  	pop bx
  1703                                  	int 12h
  1704                                  	mov cl, 10 - 4
  1705                                  	shl ax, cl
  1706                                  	cmp ax, dx
  1707                                  	je @F
  1708                                  
  1709                                  	mov dx, msg.zz_switch_s_boot_rpl
  1710                                  	jmp .lframe_end_putsz_error
  1711                                  
  1712                                  @@:
  1713                                  	mov dx, [boot_new_memsizekib]
  1714                                  	shl dx, cl
  1715                                  	cmp ax, dx
  1716                                  	je @F
  1717                                  
  1718                                  	mov dx, msg.zz_switch_s_boot_memsize_differ
  1719                                  	jmp .lframe_end_putsz_error
  1720                                  
  1721                                  @@:
  1722                                  	cmp word [zz_xms.handle], -1
  1723                                  	jne .fromxms2
  1724                                  
  1725                                  	mov cx, [bp + ?req_size_para]
  1726                                  	inc cx
  1727                                  	sub ax, cx
  1728                                  				; => transfer buffer
  1729                                  %if 0
  1730                                  new = how much to allocate (?req_size_para + 1 paragraph)
  1731                                  ebda = how large is EBDA
  1732                                  old = how much was allocated
  1733                                  ?common_size_bytes = at most the smaller of new - 16B and old - 16B
  1734                                  transfer area must hold ?common_size_bytes
  1735                                  
  1736                                  transfer area may not overlap old source
  1737                                  transfer area may not overlap ebda source
  1738                                  transfer area may not overlap ebda target
  1739                                  transfer area may not overlap new target
  1740                                  
  1741                                  ebda source and ebda target may overlap
  1742                                  old source and new target may overlap
  1743                                  
  1744                                  
  1745                                  new=100 ebda=1 old=1 memsize=200
  1746                                  98 => transfer
  1747                                  198 => ebda
  1748                                  199 => old
  1749                                  100 => target new
  1750                                  99 => target ebda
  1751                                  
  1752                                  new=1 ebda=1 old=100 memsize=200
  1753                                  98 => transfer
  1754                                  99 => ebda
  1755                                  100 => old
  1756                                  199 => target new
  1757                                  198 => target ebda
  1758                                  
  1759                                  new=2 ebda=100 old=1 memsize=200
  1760                                  97 => transfer
  1761                                  99 => ebda
  1762                                  199 => old
  1763                                  198 => target new
  1764                                  98 => target ebda
  1765                                  
  1766                                  new=50 ebda=50 old=1 memsize=200
  1767                                  99 => transfer
  1768                                  149 => ebda
  1769                                  199 => old
  1770                                  150 => target new
  1771                                  100 => target ebda
  1772                                  
  1773                                  new=1 ebda=50 old=50 memsize=200
  1774                                  99 => transfer
  1775                                  100 => ebda
  1776                                  150 => old
  1777                                  199 => target new
  1778                                  149 => target ebda
  1779                                  
  1780                                  new=40 ebda=1 old=50 memsize=200
  1781                                  109 => transfer
  1782                                  149 => ebda
  1783                                  150 => old
  1784                                  160 => target new
  1785                                  159 => target ebda
  1786                                  %endif
  1787                                  	jc @F
  1788                                  	cmp ax, 1000h
  1789                                  	jae @FF
  1790                                  @@:
  1791                                  	mov dx, msg.zz_switch_s_boot_transfer_too_low
  1792                                  	jmp .lframe_end_putsz_error
  1793                                  
  1794                                  @@:
  1795                                  	mov cx, word [bp + ?common_size_bytes]
  1796                                  	mov bx, word [bp + ?common_size_bytes + 2]
  1797                                  	push ax			; allocated transfer buffer
  1798                                  	nearcall zz_transfer_buffer	; transfer into transfer buffer
  1799                                  	pop word [sym_storage.start + 2]
  1800                                  
  1801                                  .fromxms2:
  1802                                  	mov ax, dx		; => current EBDA
  1803                                  	mov dx, ss
  1804                                  	dec dx			; => NDEB image ident paragraph
  1805                                  	sub dx, [bp + ?req_size_para]
  1806                                  	 push dx
  1807                                  	dec dx			; => target symbol table image ident
  1808                                  	xor cx, cx		; size of EBDA to move (if none)
  1809                                  	push ds
  1810                                  	mov ds, cx
  1811                                  	mov bx, word [40Eh]	; new ref in word [0:40Eh] (if none)
  1812                                  	pop ds
  1813                                  	cmp byte [ boot_ebdaflag ], 0	; any EBDA ?
  1814                                  	jz .noebda
  1815                                  
  1816                                  	push ds
  1817                                  	mov ds, ax		; => EBDA
  1818                                  	xor bx, bx
  1819                                  	mov bl, byte [ 0 ]	; EBDA size in KiB
  1820                                  	mov cl, 6
  1821                                  	shl bx, cl		; *64, to paragraphs
  1822                                  	mov cx, bx		; = size of EBDA to move (in paragraphs)
  1823                                  	sub dx, cx		; => target EBDA
  1824                                  	mov bx, dx		; = new EBDA reference to put in word [0:40Eh]
  1825                                  	pop ds
  1826                                  
  1827                                  .noebda:
  1828                                  
  1829                                  	nearcall movp		; move EBDA
  1830                                  	mov cl, 6
  1831                                  	shr dx, cl		; to KiB
  1832                                  	mov word [ boot_new_memsizekib ], dx
  1833                                  	push ds
  1834                                  	xor cx, cx
  1835                                  	mov ds, cx
  1836                                  	mov word [40Eh], bx	; = new ref in word [0:40Eh]
  1837                                  	mov word [413h], dx
  1838                                  	pop ds
  1839                                  
  1840                                  	 pop ax
  1841                                  	mov cx, word [bp + ?common_size_bytes]
  1842                                  	mov bx, word [bp + ?common_size_bytes + 2]
  1843                                  
  1844                                  
  1845                                  	cmp word [zz_xms.handle], -1
  1846                                  	je .fromnotxms3
  1847                                  
  1848                                  .fromxms3:
  1849                                  	nearcall zz_xms_to_86mm
  1850                                  	nearcall zz_xms_try_free_handle
  1851                                  	jmp .from3common
  1852                                  
  1853                                  .fromnotxms3:
  1854                                  	push ax
  1855                                  	nearcall zz_transfer_buffer		; transfer into target
  1856                                  	pop ax
  1857                                  
  1858                                  .from3common:
  1859                                  	push ax
  1860                                  	dec ax
  1861                                  	mov bx, word [bp + ?req_size_para]
  1862                                  	inc bx				; = how many paragraphs used
  1863                                  	mov es, ax			; => paragraph for imageident
  1864                                  	xor di, di			; -> imageident target
  1865                                  
  1866                                  	mov word [zz_imageident.size], bx
  1867                                  					; set image ident size
  1868                                  	mov word [zz_imageident.check], di
  1869                                  	mov si, zz_imageident
  1870                                  	push si
  1871                                  	mov cx, 8
  1872                                  	xor dx, dx
  1873                                  @@:
  1874                                  	lodsw
  1875                                  	add dx, ax
  1876                                  	loop @B
  1877                                  	pop si
  1878                                  
  1879                                  	neg dx
  1880                                  	mov word [zz_imageident.check], dx
  1881                                  					; set image ident checksum
  1882                                  	mov cl, 8
  1883                                  	rep movsw			; write image ident paragraph
  1884                                  
  1885                                  	push ss
  1886                                  	pop es
  1887                                  
  1888                                  	pop word [sym_storage.start + 2]
  1889                                  
  1890                                  	mov cx, word [bp + ?common_size_bytes]
  1891                                  	mov bx, word [bp + ?common_size_bytes + 2]
  1892                                  	 push word [sym_storage.start + 2]
  1893                                  	 push word [sym_storage.start]
  1894                                  	dualcall normalise_pointer_with_displacement_bxcx
  1895                                  	 pop word [sym_storage.end]
  1896                                  	 pop word [sym_storage.end + 2]
  1897                                  				; size common part
  1898                                  
  1899                                  	jmp .init_tail
  1900                                  
  1901                                  
  1902                                  .notboot2:
  1903                                  %endif
  1904                                  
  1905                                  	cmp word [zz_xms.handle], -1
  1906                                  	jne .fromxms4
  1907                                  
  1908                                  .fromnotxms4:
  1909                                  	mov bx, 1		; enable UMB link
  1910                                  	mov ax, 5803h
  1911                                  	doscall
  1912                                  	mov bx, 80h		; first fit, UMA then LMA
  1913                                  	mov ax, 5801h
  1914                                  	doscall
  1915                                  	jnc @F
  1916                                  	xor bx, bx		; first fit (LMA then UMA)
  1917                                  	mov ax, 5801h
  1918                                  	doscall
  1919                                  @@:
  1920                                  
  1921                                  	mov bx, dx
  1922                                  
  1923                                  	test bx, bx		; prior size was none ?
  1924                                  	jz .no_prefix		; no prefix -->
  1925                                  
  1926                                  	mov ah, 48h
  1927                                  	doscall
  1928                                  	jnc @F
  1929                                  
  1930                                  	mov dx, msg.zz_s_cannot_alloc_transfer
  1931                                  .lframe_end_putsz_error:
  1932                                  	nearcall putsz_error
  1933                                  	jmp .lframe_end_restore_strat
  1934                                  
  1935                                  @@:
  1936                                  	mov cx, word [bp + ?common_size_bytes]
  1937                                  	mov bx, word [bp + ?common_size_bytes + 2]
  1938                                  
  1939                                  	push ax			; allocated transfer buffer
  1940                                  	nearcall zz_transfer_buffer
  1941                                  	 push word [sym_storage.start + 2]
  1942                                  	mov ah, 49h
  1943                                  	dual2call _doscall_return_es	; free prior buffer
  1944                                  	 pop ax			; (discard)
  1945                                  	pop word [sym_storage.start + 2]
  1946                                  				; relocate
  1947                                  
  1948                                  	mov cx, word [bp + ?common_size_bytes]
  1949                                  	mov bx, word [bp + ?common_size_bytes + 2]
  1950                                  	 push word [sym_storage.start + 2]
  1951                                  	 push word [sym_storage.start]
  1952                                  	dualcall normalise_pointer_with_displacement_bxcx
  1953                                  	 pop word [sym_storage.end]
  1954                                  	 pop word [sym_storage.end + 2]
  1955                                  				; size common part
  1956                                  
  1957                                  .no_prefix:
  1958                                  .fromxms4:
  1959                                  	mov bx, 02h		; last fit
  1960                                  	mov ax, 5801h
  1961                                  	doscall
  1962                                  	mov bx, 0		; disable UMB link
  1963                                  	mov ax, 5803h
  1964                                  	doscall
  1965                                  
  1966                                  	mov bx, word [bp + ?req_size_para]
  1967                                  	mov ah, 48h
  1968                                  	doscall			; allocate target buffer
  1969                                  	jnc @F
  1970                                  
  1971                                  	mov dx, msg.zz_s_cannot_alloc_target
  1972                                  	nearcall putsz_error
  1973                                  	jmp .lframe_end_restore_strat
  1974                                  
  1975                                  @@:
  1976                                  	mov cx, word [bp + ?common_size_bytes]
  1977                                  	mov bx, word [bp + ?common_size_bytes + 2]
  1978                                  
  1979                                  	cmp word [zz_xms.handle], -1
  1980                                  	je .fromnotxms5
  1981                                  
  1982                                  .fromxms5:
  1983                                  	nearcall zz_xms_to_86mm
  1984                                  	and word [sym_storage.start], 0
  1985                                  	mov word [sym_storage.start + 2], ax
  1986                                  
  1987                                  	mov cx, word [bp + ?common_size_bytes]
  1988                                  	mov bx, word [bp + ?common_size_bytes + 2]
  1989                                  	 push word [sym_storage.start + 2]
  1990                                  	 push word [sym_storage.start]
  1991                                  	dualcall normalise_pointer_with_displacement_bxcx
  1992                                  	 pop word [sym_storage.end]
  1993                                  	 pop word [sym_storage.end + 2]
  1994                                  				; size common part
  1995                                  	nearcall zz_xms_try_free_handle
  1996                                  	jmp .from5common
  1997                                  
  1998                                  .fromnotxms5:
  1999                                  	push ax			; allocated memory block
  2000                                  	nearcall zz_transfer_buffer
  2001                                  	pop ax			; allocated memory block
  2002                                  	xchg word [sym_storage.start + 2], ax
  2003                                  	test ax, ax
  2004                                  	jz @F
  2005                                  	 push ax		; value for es to int 21h call
  2006                                  	mov ah, 49h
  2007                                  	dual2call _doscall_return_es	; free transfer buffer
  2008                                  	 pop ax			; (discard)
  2009                                  @@:
  2010                                  .from5common:
  2011                                  
  2012                                  .init_tail:
  2013                                  	mov cx, word [bp + ?req_size_para]
  2014                                  	xor bx, bx		; bx:cx = number of paragraphs allocated
  2015                                  	nearcall shift_left_4_bxcx	; = number of bytes allocated
  2016                                  
  2017                                  	sub cx, word [bp + ?common_size_bytes]
  2018                                  	sbb bx, word [bp + ?common_size_bytes + 2]
  2019                                  				; = number of bytes allocated after end
  2020                                  	push word [sym_storage.end + 2]
  2021                                  	push word [sym_storage.end]
  2022                                  	pop di
  2023                                  %if _PM
  2024                                  	 push word [symsel1]
  2025                                  	dualcall segment_to_selector
  2026                                  %endif
  2027                                  	pop es			; es:di -> after end of common part
  2028                                  	xor ax, ax
  2029                                  .init_loop:
  2030                                  	 push es
  2031                                  %if _PM
  2032                                  	dualcall selector_to_segment
  2033                                  %endif
  2034                                  	 push di
  2035                                  	dualcall normalise_pointer
  2036                                  	 pop di
  2037                                  %if _PM
  2038                                  	 push word [symsel1]
  2039                                  	dualcall segment_to_selector
  2040                                  %endif
  2041                                  	 pop es			; normalise pointer
  2042                                  	sub cx, SEGTRANSFER_size
  2043                                  	sbb bx, 0
  2044                                  	jc .init_last
  2045                                  
  2046                                  	push cx
  2047                                  	mov cx, SEGTRANSFER_size >> 1
  2048                                  	rep stosw		; store zeros
  2049                                  	pop cx
  2050                                  	jmp .init_loop
  2051                                  
  2052                                  .init_last:
  2053                                  	add cx, SEGTRANSFER_size
  2054                                  	adc bx, 0
  2055                                  	shr cx, 1
  2056                                  	rep stosw		; store zeros
  2057                                  
  2058                                  	mov cx, word [bp + ?req_size_para]
  2059                                  	xor bx, bx
  2060                                  	nearcall shift_left_4_bxcx	; requested size bytes
  2061                                  	 push word [sym_storage.start + 2]
  2062                                  	 push word [sym_storage.start]
  2063                                  	dualcall normalise_pointer_with_displacement_bxcx
  2064                                  	 pop word [sym_storage.end]
  2065                                  	 pop word [sym_storage.end + 2]
  2066                                  	 			; update .end
  2067                                  
  2068                                  	cmp word [bp + ?common_size_bytes + 2], 0
  2069                                  	jne @F			; if it was an empty table
  2070                                  	cmp word [bp + ?common_size_bytes], 0
  2071                                  	jne @F
  2072                                  
  2073                                  				; initialise pointers
  2074                                  	mov dx, word [sym_storage.start + 2]
  2075                                  	mov ax, word [sym_storage.start]
  2076                                  	mov word [sym_storage.main.start + 2], dx
  2077                                  	mov word [sym_storage.main.start], ax
  2078                                  	mov word [sym_storage.hash.start + 2], dx
  2079                                  	mov word [sym_storage.hash.start], ax
  2080                                  	mov word [sym_storage.str.start + 2], dx
  2081                                  	mov word [sym_storage.str.start], ax
  2082                                  	mov word [sym_storage.free + 2], dx
  2083                                  	mov word [sym_storage.free], ax
  2084                                  @@:
  2085                                  
  2086                                  	nearcall zz_expand
  2087                                  
  2088                                  	cmp word [bp + ?common_size_bytes + 2], 0
  2089                                  	jne @F			; if it was an empty table ...-
  2090                                  	cmp word [bp + ?common_size_bytes], 0
  2091                                  	jne @F
  2092                                  	nearcall zz_store_pre_str	;  -... store the pre strings
  2093                                  @@:
  2094                                  
  2095                                  .lframe_end_restore_strat:
  2096                                  	nearcall zz_restore_strat
  2097                                  
  2098                                  .lframe_end:
  2099                                  .lframe_no_reallocation_needed:
  2100                                  	lleave
  2101                                  	jmp .end
  2102                                  
  2103                                  .end_restore_strat:
  2104                                  	nearcall zz_restore_strat
  2105                                  
  2106                                  .end:
  2107                                  	pop si
  2108                                  	pop ax			; al = next character
  2109                                  	push ss
  2110                                  	pop es
  2111                                  	push ss
  2112                                  	pop ds
  2113                                  	retn
  2114                                  
  2115                                  
  2116                                  .free:
  2117                                  	mov dx, msg.zz_switch_s_freeing
  2118                                  	nearcall putsz
  2119                                  	nearcall zz_free_nonxms
  2120                                  	nearcall zz_xms_try_free_handle
  2121                                  	nearcall zz_free_reset
  2122                                  	jmp .end
  2123                                  
  2124                                  
  2125                                  zz_free_nonxms: section_of_function
  2126                                  %if _BOOTLDR
  2127                                   %if _APPLICATION || _DEVICE
  2128                                  	testopt [internalflags], nodosloaded
  2129                                  	jz .free_notboot
  2130                                   %endif
  2131                                  
  2132                                  	mov dx, msg.zz_switch_s_boot_loaded_kernel
  2133                                  	testopt [internalflags2], dif2_boot_loaded_kernel
  2134                                  	jnz .free_putsz_error_end
  2135                                  
  2136                                  	nearcall bootgetmemorysize
  2137                                  	int 12h
  2138                                  	mov cl, 10 - 4
  2139                                  	shl ax, cl
  2140                                  	cmp ax, dx
  2141                                  	je @F
  2142                                  
  2143                                  	mov dx, msg.zz_switch_s_boot_rpl
  2144                                  	jmp .free_putsz_error_end
  2145                                  
  2146                                  @@:
  2147                                  	mov dx, [boot_new_memsizekib]
  2148                                  	shl dx, cl
  2149                                  	cmp ax, dx
  2150                                  	je @F
  2151                                  
  2152                                  	mov dx, msg.zz_switch_s_boot_memsize_differ
  2153                                  .free_putsz_error_end:
  2154                                  	nearcall putsz_error
  2155                                  	retn
  2156                                  
  2157                                  @@:
  2158                                  				; ax => current EBDA
  2159                                  	mov dx, ss
  2160                                  	dec dx			; => NDEB image ident paragraph
  2161                                  	xor cx, cx		; size of EBDA to move (if none)
  2162                                  	push ds
  2163                                  	mov ds, cx
  2164                                  	mov bx, word [40Eh]	; new ref in word [0:40Eh] (if none)
  2165                                  	pop ds
  2166                                  	cmp byte [ boot_ebdaflag ], 0	; any EBDA ?
  2167                                  	jz .free_noebda
  2168                                  
  2169                                  	push ds
  2170                                  	mov ds, ax		; => EBDA
  2171                                  	xor bx, bx
  2172                                  	mov bl, byte [ 0 ]	; EBDA size in KiB
  2173                                  	mov cl, 6
  2174                                  	shl bx, cl		; *64, to paragraphs
  2175                                  	mov cx, bx		; = size of EBDA to move (in paragraphs)
  2176                                  	sub dx, cx		; => target EBDA
  2177                                  	mov bx, dx		; = new EBDA reference to put in word [0:40Eh]
  2178                                  	pop ds
  2179                                  
  2180                                  .free_noebda:
  2181                                  	nearcall movp		; move EBDA
  2182                                  	mov cl, 6
  2183                                  	shr dx, cl		; to KiB
  2184                                  	mov word [ boot_new_memsizekib ], dx
  2185                                  	push ds
  2186                                  	xor cx, cx
  2187                                  	mov ds, cx
  2188                                  	mov word [40Eh], bx	; = new ref in word [0:40Eh]
  2189                                  	mov word [413h], dx
  2190                                  	pop ds
  2191                                  	retn
  2192                                  
  2193                                  
  2194                                  .free_notboot:
  2195                                  %endif
  2196                                  
  2197                                  %if _APPLICATION || _DEVICE
  2198                                  zz_free_dos: section_of_function
  2199                                  	xor ax, ax
  2200                                  	xchg ax, word [sym_storage.start + 2]
  2201                                  
  2202                                  	test ax, ax
  2203                                  	jz @F
  2204                                  	dec ax
  2205                                  %if _PM
  2206                                  	nearcall setes2ax
  2207                                  %else
  2208                                  	mov es, ax
  2209                                  %endif
  2210                                  	xor ax, ax		; ax = 0
  2211                                  	mov word [es:1], ax	; free MCB
  2212                                  @@:
  2213                                  	retn
  2214                                  %endif
  2215                                  
  2216                                  
  2217                                  zz_free_reset: section_of_function
  2218                                  	push ss
  2219                                  	pop es
  2220                                  
  2221                                  	xor ax, ax
  2222                                  
  2223                                  	mov di, sym_storage.clear_on_free.first
  2224                                  	mov cx, 	 (sym_storage.clear_on_free.after - sym_storage.clear_on_free.first) 	 >> 1
  2227                                  	rep stosw
  2228                                  
  2229                                  	dec ax			; = 0FFFFh
  2230                                  
  2231                                  	mov di, sym_storage.minus1_on_free.first
  2232                                  	mov cx, 	 (sym_storage.minus1_on_free.after - sym_storage.minus1_on_free.first) 	 >> 1
  2235                                  	rep stosw
  2236                                  	retn
  2237                                  
  2238                                  
  2239                                  bxcx_to_cx_paragraphs: section_of_function
  2240                                  	add cx, 15
  2241                                  	adc bx, 0
  2242                                  shift_right_4_bxcx:
  2243                                  %rep 4
  2244                                  	shr bx, 1
  2245                                  	rcr cx, 1		; cx = paragraphs
  2246                                  %endrep
  2247                                  	retn
  2248                                  
  2249                                  
  2250                                  		; INP:	ax => allocated memory
  2251                                  		;	bx:cx = size of compacted table in bytes
  2252                                  		; CHG:	bx, cx, dx, di, si
  2253                                  zz_xms_to_86mm: section_of_function
  2254                                  	mov dx, word [zz_xms.handle]
  2255                                  	mov si, zz_xms.movestruc
  2256                                  	xor di, di
  2257                                  
  2258                                  	mov word [si + xmsmDestHandle], di		; 86M memory
  2259                                  	mov word [si + xmsmDestAddress + 2], ax
  2260                                  	mov word [si + xmsmDestAddress], di		; ax:0 -> memory
  2261                                  	mov word [si + xmsmSourceHandle], dx		; our handle
  2262                                  	mov word [si + xmsmSourceAddress], di
  2263                                  	mov word [si + xmsmSourceAddress + 2], di	; 0 = beginning
  2264                                  	mov word [si + xmsmCount], cx
  2265                                  	mov word [si + xmsmCount + 2], bx		; size of compacted tables
  2266                                  	nearcall call_xms_move
  2267                                  
  2268                                  	mov cx, .table.amount
  2269                                  	mov bx, .table
  2270                                  @@:
  2271                                  	mov si, word [bx]		; -> source xms offset dword
  2272                                  	mov di, word [bx + 2]		; -> dest memory far pointer
  2273                                  	add bx, 4			; -> next .table entry, if any
  2274                                  	push cx
  2275                                  	push bx
  2276                                  	xor cx, cx			; = 0
  2277                                  	 push ax
  2278                                  	 push cx			; -> far to start of memory
  2279                                  	mov cx, word [si]
  2280                                  	mov bx, word [si + 2]		; = xms block offset
  2281                                  	dualcall normalise_pointer_with_displacement_bxcx
  2282                                  	 pop word [di]
  2283                                  	 pop word [di + 2]		; write far pointer
  2284                                  	pop bx				; -> next .table entry
  2285                                  	pop cx				; = loop counter
  2286                                  	loop @B
  2287                                  	retn
  2288                                  
  2289                                  
  2290                                  	usesection lDEBUG_DATA_ENTRY
  2291                                  
  2292                                  	align 4, db 0
  2293                                  .table:
  2294                                  	dw sym_storage.main.xms.start
  2295                                  	dw sym_storage.main.start
  2296                                  
  2297                                  	dw sym_storage.hash.xms.start
  2298                                  	dw sym_storage.hash.start
  2299                                  
  2300                                  	dw sym_storage.str.xms.start
  2301                                  	dw sym_storage.str.start
  2302                                  
  2303                                  	dw sym_storage.xms.free
  2304                                  	dw sym_storage.free
  2305                                  
  2306                                  	dw sym_storage.xms.end
  2307                                  	dw sym_storage.end
  2308                                  .table.amount: equ ($ - .table) >> 2
  2309                                  
  2310                                  
  2311                                   %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
  2312                                  	usesection lDEBUG_CODE2
  2313                                   %else
  2314                                  	usesection lDEBUG_CODE
  2315                                   %endif
  2316                                  
  2317                                  
  2318                                  		; INP:	word [sym_storage.start + 2] => allocated memory
  2319                                  		;	dx = handle of allocated block
  2320                                  		;	bx:cx = size of compacted table in bytes
  2321                                  		; CHG:	ax, bx, cx, dx, di, si
  2322                                  zz_86mm_to_xms: section_of_function
  2323                                  	mov si, zz_xms.movestruc
  2324                                  	xor di, di
  2325                                  
  2326                                  	mov word [si + xmsmSourceHandle], di		; 86M memory
  2327                                  	push word [sym_storage.start + 2]
  2328                                  	pop word [si + xmsmSourceAddress + 2]
  2329                                  	mov word [si + xmsmSourceAddress], di		; .start:0 -> memory
  2330                                  	mov word [si + xmsmDestHandle], dx		; our handle
  2331                                  	mov word [si + xmsmDestAddress], di
  2332                                  	mov word [si + xmsmDestAddress + 2], di		; 0 = beginning
  2333                                  	mov word [si + xmsmCount], cx
  2334                                  	mov word [si + xmsmCount + 2], bx		; size of compacted tables
  2335                                  	nearcall call_xms_move
  2336                                  
  2337                                  	 push word [sym_storage.start + 2]
  2338                                  	 push word [sym_storage.start]
  2339                                  	dualcall pointer_to_linear	; dx:ax = linear start
  2340                                  
  2341                                  	mov cx, zz_xms_to_86mm.table.amount
  2342                                  	mov bx, zz_xms_to_86mm.table
  2343                                  @@:
  2344                                  	mov di, word [bx]	; -> dest xms offset dword
  2345                                  	mov si, word [bx + 2]	; -> source memory far pointer
  2346                                  	add bx, 4		; -> next .table entry, if any
  2347                                  	push cx
  2348                                  	push bx
  2349                                  
  2350                                  	xchg dx, bx
  2351                                  	xchg ax, cx		; bx:cx = linear start
  2352                                  
  2353                                  
  2354                                  	 push word [si + 2]
  2355                                  	 push word [si]
  2356                                  	dualcall pointer_to_linear	; dx:ax = linear of pointer
  2357                                  	sub ax, cx
  2358                                  	sbb dx, bx		; pointer - start = byte offset
  2359                                  	mov word [di], ax
  2360                                  	mov word [di + 2], dx
  2361                                  	xchg dx, bx
  2362                                  	xchg ax, cx		; dx:ax = linear start
  2363                                  
  2364                                  	pop bx			; -> next .table entry
  2365                                  	pop cx			; = loop counter
  2366                                  	loop @B
  2367                                  
  2368                                  	retn
  2369                                  
  2370                                  
  2371                                  		; cx:ax = amount of paragraphs allocated (<= 1.5 MiB/ 2 MiB)
  2372                                  		;	   (not including transfer buffer)
  2373                                  		; bx = amount of KiB allocated
  2374                                  		;	(actual allocation, including transfer buffer)
  2375                                  		; dx = XMS handle
  2376                                  xms_init:
  2377                                  	xor di, di
  2378                                  	lframe near
  2379                                  	lenter
  2380                                  	lvar dword,	common_size_bytes
  2381                                  	 push di
  2382                                  	 push di
  2383                                  	lvar dword,	amountpara
  2384                                  	 push cx
  2385                                  	 push ax
  2386                                  	lvar word,	amountkib
  2387                                  	 push bx
  2388                                  	lvar word,	newhandle
  2389                                  	 push dx
  2390                                  
  2391                                  	push ax
  2392                                  	push bx
  2393                                  	push cx
  2394                                  	push dx
  2395                                  
  2396                                  	nearcall zz_compact
  2397                                  
  2398                                  	mov dx, word [zz_xms.handle]
  2399                                  	cmp dx, -1
  2400                                  	je .notfromxms
  2401                                  
  2402                                  .fromxms:
  2403                                  	mov bx, word [bp + ?amountpara + 2]
  2404                                  	mov cx, word [bp + ?amountpara]
  2405                                  	nearcall shift_left_4_bxcx				; requested size bytes
  2406                                  
  2407                                  	cmp bx, word [sym_storage.xms.free + 2]
  2408                                  	jne @F
  2409                                  	cmp cx, word [sym_storage.xms.free]
  2410                                  @@:
  2411                                  	jae @F
  2412                                  
  2413                                  .new_smaller:
  2414                                  	mov dx, [bp + ?newhandle]
  2415                                  	lleave code
  2416                                  
  2417                                  	nearcall zz_xms_try_free
  2418                                  	jmp ..@new_smaller
  2419                                  
  2420                                  
  2421                                  @@:
  2422                                  	mov bx, word [sym_storage.xms.free + 2]
  2423                                  	mov cx, word [sym_storage.xms.free]
  2424                                  
  2425                                  	mov si, zz_xms.movestruc
  2426                                  	xor di, di
  2427                                  
  2428                                  	push word [bp + ?newhandle]
  2429                                  	pop word [si + xmsmDestHandle]			; new handle
  2430                                  	mov word [si + xmsmDestAddress + 2], di
  2431                                  	mov word [si + xmsmDestAddress], di		; 0
  2432                                  	mov word [si + xmsmSourceHandle], dx		; old handle
  2433                                  	mov word [si + xmsmSourceAddress], di
  2434                                  	mov word [si + xmsmSourceAddress + 2], di	; 0
  2435                                  	mov word [si + xmsmCount], cx
  2436                                  	mov word [si + xmsmCount + 2], bx		; size of compacted tables
  2437                                  
  2438                                  	mov word [bp + ?common_size_bytes], cx
  2439                                  	mov word [bp + ?common_size_bytes + 2], bx
  2440                                  	nearcall call_xms_move
  2441                                  
  2442                                  	nearcall zz_xms_try_free
  2443                                  
  2444                                  	push word [bp + ?newhandle]
  2445                                  	pop word [zz_xms.handle]
  2446                                  
  2447                                  	jmp .fromxmscommon
  2448                                  
  2449                                  
  2450                                  .notfromxms:
  2451                                  	cmp word [sym_storage.start + 2], 0
  2452                                  	je .fromxmscommon
  2453                                  
  2454                                  	mov bx, word [bp + ?amountpara + 2]
  2455                                  	mov cx, word [bp + ?amountpara]
  2456                                  	nearcall shift_left_4_bxcx				; requested size bytes
  2457                                  
  2458                                  	push bx
  2459                                  	push cx
  2460                                  
  2461                                  	 push word [sym_storage.free + 2]
  2462                                  	 push word [sym_storage.free]
  2463                                  	dualcall pointer_to_linear
  2464                                  	xchg dx, bx
  2465                                  	xchg ax, cx		; bx:cx = linear after end
  2466                                  	 push word [sym_storage.start + 2]
  2467                                  	 push word [sym_storage.start]
  2468                                  	dualcall pointer_to_linear	; dx:ax = linear start
  2469                                  	sub cx, ax
  2470                                  	sbb bx, dx		; end - start = size
  2471                                  				; bx:cx = current size (in bytes)
  2472                                  	mov word [bp + ?common_size_bytes], cx
  2473                                  	mov word [bp + ?common_size_bytes + 2], bx
  2474                                  
  2475                                  	pop ax
  2476                                  	pop dx			; = new size
  2477                                  	cmp dx, bx
  2478                                  	jne @F
  2479                                  	cmp ax, cx
  2480                                  @@:
  2481                                  	jb .new_smaller
  2482                                  
  2483                                  	mov dx, word [bp + ?newhandle]
  2484                                  	nearcall zz_86mm_to_xms
  2485                                  
  2486                                  	push word [bp + ?newhandle]
  2487                                  	pop word [zz_xms.handle]
  2488                                  
  2489                                  	nearcall zz_free_nonxms
  2490                                  
  2491                                  .fromxmscommon:
  2492                                  	mov dx, msg.zz_switch_s_received_xms
  2493                                  	nearcall putsz
  2494                                  	mov di, line_out
  2495                                  	mov ax, word [bp + ?amountkib]
  2496                                  	nearcall decword
  2497                                  	mov ax, " K"
  2498                                  	stosw
  2499                                  	mov ax, "iB"
  2500                                  	stosw
  2501                                  	mov al, '.'
  2502                                  	stosb
  2503                                  	nearcall putsline_crlf
  2504                                  
  2505                                  	pop dx
  2506                                  	pop cx
  2507                                  	pop bx
  2508                                  	pop ax
  2509                                  
  2510                                  	mov si, zz_xms.movestruc
  2511                                  
  2512                                  	mov bx, cx
  2513                                  	mov cx, ax
  2514                                  	nearcall shift_left_4_bxcx	; to bytes
  2515                                  
  2516                                  	xor ax, ax
  2517                                  
  2518                                  	cmp word [bp + ?common_size_bytes + 2], ax
  2519                                  	jne @F
  2520                                  	cmp word [bp + ?common_size_bytes], ax
  2521                                  @@:
  2522                                  	jne .no_init_start
  2523                                  
  2524                                  		; Initialise
  2525                                  
  2526                                  	mov word [sym_storage.main.xms.start], ax
  2527                                  	mov word [sym_storage.main.xms.start + 2], ax
  2528                                  
  2529                                  	mov word [sym_storage.hash.xms.start], ax
  2530                                  	mov word [sym_storage.hash.xms.start + 2], ax
  2531                                  
  2532                                  	mov word [sym_storage.str.xms.start], ax
  2533                                  	mov word [sym_storage.str.xms.start + 2], ax
  2534                                  
  2535                                  	mov word [sym_storage.xms.free], ax
  2536                                  	mov word [sym_storage.xms.free + 2], ax
  2537                                  
  2538                                  .no_init_start:
  2539                                  	mov word [sym_storage.xms.end], cx
  2540                                  	mov word [sym_storage.xms.end + 2], bx
  2541                                  
  2542                                  	push word [bp + ?newhandle]
  2543                                  	pop word [zz_xms.handle]
  2544                                  
  2545                                  
  2546                                  
  2547                                  XMSTRAIL_SIZE equ fromkib(kib(fromparas(paras(ssString + 255)) + XMSTRANSFER_default_size))
  2548                                  XMSTRAIL_TRANSFER_OFFSET equ XMSTRAIL_SIZE - XMSTRANSFER_default_size
  2549                                  	add cx, XMSTRAIL_TRANSFER_OFFSET & 0FFFFh
  2550                                  	adc bx, XMSTRAIL_TRANSFER_OFFSET >> 16		; -> transfer buffer
  2551                                  
  2552                                  	mov word [zz_xms.transfer_address], cx
  2553                                  	mov word [zz_xms.transfer_address + 2], bx	; set address
  2554                                  
  2555                                  	mov word [zz_xms.transfer_size], XMSTRANSFER_default_size & 0FFFFh
  2556                                  	mov word [zz_xms.transfer_size + 2], XMSTRANSFER_default_size >> 16
  2557                                  							; set size
  2558                                  
  2559                                  	add cx, XMSTRANSFER_default_size & 0FFFFh
  2560                                  	adc bx, XMSTRANSFER_default_size >> 16		; initialise all memory
  2561                                  
  2562                                  	push word [bp + ?newhandle]
  2563                                  	pop word [si + xmsmDestHandle]			; our handle
  2564                                  	mov dx, word [sym_storage.xms.free + 2]
  2565                                  	mov di, word [sym_storage.xms.free]
  2566                                  	mov word [si + xmsmDestAddress], di
  2567                                  	mov word [si + xmsmDestAddress + 2], dx
  2568                                  	mov word [si + xmsmSourceHandle], ax		; 86M memory
  2569                                  	push ds
  2570                                  %if _PM
  2571                                  	dualcall selector_to_segment
  2572                                  %endif
  2573                                  	pop word [si + xmsmSourceAddress + 2]
  2574                                  	mov word [si + xmsmSourceAddress], zz_xms.16_zeros
  2575                                  
  2576                                  	sub cx, di
  2577                                  	sbb bx, dx
  2578                                  
  2579                                  	mov word [si + xmsmCount + 2], ax
  2580                                  	mov ax, cx
  2581                                  	and ax, 15
  2582                                  	mov word [si + xmsmCount], ax
  2583                                  	jz @F
  2584                                  
  2585                                  	nearcall call_xms_move
  2586                                  	add word [si + xmsmDestAddress], ax
  2587                                  	adc word [si + xmsmDestAddress + 2], 0
  2588                                  	sub cx, ax
  2589                                  	sbb bx, 0
  2590                                  
  2591                                  @@:
  2592                                  	mov byte [si + xmsmCount], 16
  2593                                  
  2594                                  .loop:
  2595                                  	sub cx, 16
  2596                                  	sbb bx, 0
  2597                                  	jc .last
  2598                                  
  2599                                  	nearcall call_xms_move
  2600                                  
  2601                                  	add word [si + xmsmDestAddress], 16
  2602                                  	adc word [si + xmsmDestAddress + 2], 0
  2603                                  
  2604                                  	jmp .loop
  2605                                  
  2606                                  .last:
  2607                                  	add cx, 16
  2608                                  	adc bx, 0
  2609                                  
  2610                                  	jcxz @F
  2611                                  	mov word [si + xmsmCount], cx
  2612                                  
  2613                                  	nearcall call_xms_move
  2614                                  @@:
  2615                                  
  2616                                  	nearcall zz_expand
  2617                                  
  2618                                  	cmp word [bp + ?common_size_bytes + 2], 0
  2619                                  	jne @F			; if it was an empty table ...-
  2620                                  	cmp word [bp + ?common_size_bytes], 0
  2621                                  	jne @F
  2622                                  	nearcall zz_store_pre_str	;  -... store the pre strings
  2623                                  
  2624                                  @@:
  2625                                  	lleave
  2626                                  
  2627                                  	jmp zz_switch_s.end_restore_strat
  2628                                  
  2629                                  
  2630                                  zz_free_xms: section_of_function
  2631                                  	nearcall zz_free_reset
  2632                                  
  2633                                  zz_xms_try_free_handle: section_of_function
  2634                                  	mov dx, -1
  2635                                  	xchg dx, word [zz_xms.handle]
  2636                                  	cmp dx, -1
  2637                                  	je @F
  2638                                  
  2639                                  zz_xms_try_free: section_of_function
  2640                                  	nearcall zz_detect_xms
  2641                                  
  2642                                  	mov ah, 0Ah
  2643                                  	nearcall zz_call_xms
  2644                                  	dec ax
  2645                                  	jz @F
  2646                                  	xchg ax, dx
  2647                                  	mov dx, msg.zz_xms_not_freed_1
  2648                                  	nearcall putsz_error
  2649                                  	nearcall disp_ax_hex
  2650                                  	mov dx, msg.zz_xms_not_freed_2
  2651                                  	nearcall putsz_error
  2652                                  @@:
  2653                                  	retn
  2654                                  
  2655                                  
  2656                                  		; CHG:	ax, ds, es
  2657                                  		; OUT:	ss = es = ds
  2658                                  zz_save_strat: section_of_function
  2659                                  	push ss
  2660                                  	pop ds
  2661                                  	nearcall InDOS
  2662                                  	jnz .indos
  2663                                  	mov ax, 5800h
  2664                                  	int 21h
  2665                                  	mov word [zz_saved_strategy], ax
  2666                                  	mov ax, 5802h
  2667                                  	int 21h
  2668                                  	xor ah, ah
  2669                                  	mov word [zz_saved_umblink], ax
  2670                                  .indos:
  2671                                  	nearcall zz_detect_xms
  2672                                  	push ss
  2673                                  	pop ds
  2674                                  	push ss
  2675                                  	pop es
  2676                                  	retn
  2677                                  
  2678                                  
  2679                                  	; STT:	ss = ds
  2680                                  zz_restore_strat: section_of_function
  2681                                  	nearcall InDOS
  2682                                  	jnz .ret
  2683                                  	mov bx, word [zz_saved_umblink]
  2684                                  	mov ax, 5803h
  2685                                  	int 21h
  2686                                  	mov bx, word [zz_saved_strategy]
  2687                                  	mov ax, 5801h
  2688                                  	int 21h
  2689                                  .ret:
  2690                                  	retn
  2691                                  
  2692                                  
  2693                                  	usesection lDEBUG_CODE
  2694                                  
  2695                                  %if _XMS_SYMBOL_TABLE
  2696                                  		; CHG:	-
  2697                                  		; STT:	ss = ds
  2698                                  zz_detect_xms: section_of_function
  2699                                  	testopt [internalflags2], dif2_xms_detection_done
  2700                                  	jnz .retn
  2701                                  
  2702                                  	_386_o32
  2703                                  	push ax
  2704                                  	_386_o32
  2705                                  	push bx
  2706                                  	_386_o32
  2707                                  	push cx
  2708                                  	_386_o32
  2709                                  	push dx
  2710                                  	_386_o32
  2711                                  	push si
  2712                                  	_386_o32
  2713                                  	push di
  2714                                  	_386_o32
  2715                                  	push bp
  2716                                  
  2717                                  	nearcall InDOS
  2718                                  	jz .notindos
  2719                                  	xor ax, ax
  2720                                  %if _PM
  2721                                  	nearcall setes2ax
  2722                                  %else
  2723                                  	mov es, ax
  2724                                  %endif
  2725                                  	mov bx, 4 * 2Fh
  2726                                  	mov ax, word [es:bx + 2]
  2727                                  	mov bx, word [es:bx]
  2728                                  	call .checkxms
  2729                                  .ret:
  2730                                  	_386_o32
  2731                                  	pop bp
  2732                                  	_386_o32
  2733                                  	pop di
  2734                                  	_386_o32
  2735                                  	pop si
  2736                                  	_386_o32
  2737                                  	pop dx
  2738                                  	_386_o32
  2739                                  	pop cx
  2740                                  	_386_o32
  2741                                  	pop bx
  2742                                  	_386_o32
  2743                                  	pop ax
  2744                                  
  2745                                  	push ss
  2746                                  	pop ds
  2747                                  	push ss
  2748                                  	pop es
  2749                                  .retn:
  2750                                  	retn
  2751                                  
  2752                                  .notindos:
  2753                                  	mov ax, 352Fh
  2754                                  	push word [pspdbg]
  2755                                  	dual2call _doscall_return_es
  2756                                  	pop ax			; returned es
  2757                                  	call .checkxms
  2758                                  	jmp .ret
  2759                                  
  2760                                  .checkxms:
  2761                                  %if _PM
  2762                                  	nearcall ispm
  2763                                  	jnz @F
  2764                                  	testopt [options], zz_no_pm_xms
  2765                                  	jnz .checkxms_via_86m
  2766                                  @@:
  2767                                  %endif
  2768                                  	test ax, ax
  2769                                  	jz .no_xms
  2770                                  	cmp bx, -1
  2771                                  	je .no_xms
  2772                                  %if _PM
  2773                                  	clropt [internalflags2], dif2_no_pm_xms
  2774                                  %endif
  2775                                  	mov ax, 4300h
  2776                                  	int 2Fh
  2777                                  	cmp al, 80h
  2778                                  	je .got_xms
  2779                                  %if _PM
  2780                                  	nearcall ispm
  2781                                  	jnz .no_xms
  2782                                  .checkxms_via_86m:
  2783                                  [cpu 286]
  2784                                  	mov ax, 4300h
  2785                                  	push byte 0
  2786                                  	push byte 2Fh
  2787                                  	call intcall
  2788                                  	cmp al, 80h
  2789                                  	jne .no_xms
  2790                                  
  2791                                  	mov ax, 4310h
  2792                                  	push byte 0		; es value
  2793                                  	push byte 0		; ds value
  2794                                  	push byte 2Fh
  2795                                  	push bp
  2796                                  	call intcall_return_parameter_es_parameter_ds
  2797                                  	pop ax			; discard returned ds
  2798                                  	pop ax			; get returned es
  2799                                  	and word [zz_xms.entry + 4], 0
  2800                                  	and word [zz_xms.entry + 6], 0
  2801                                  	mov word [zz_xms.entry + 2], ax
  2802                                  	mov word [zz_xms.entry], bx
  2803                                  	setopt [internalflags2], dif2_no_pm_xms | dif2_xms_detection_done
  2804                                  	retn
  2805                                  __CPU__
  2806                                  %endif
  2807                                  
  2808                                  .no_xms:
  2809                                  	setopt [internalflags2], dif2_xms_detection_done
  2810                                  	and word [zz_xms.entry], 0
  2811                                  	and word [zz_xms.entry + 2], 0
  2812                                  %if _PM
  2813                                  	and word [zz_xms.entry + 4], 0
  2814                                  	and word [zz_xms.entry + 6], 0
  2815                                  %endif
  2816                                  	retn
  2817                                  
  2818                                  .got_xms:
  2819                                  	setopt [internalflags2], dif2_xms_detection_done
  2820                                  	mov ax, 4310h
  2821                                  	int 2Fh
  2822                                  %if _PM
  2823                                  _386	nearcall ispm
  2824                                  _386	jnz .rm
  2825                                  _386	mov dword [zz_xms.entry], ebx
  2826                                  _386	and word [zz_xms.entry + 6], 0
  2827                                  _386	mov word [zz_xms.entry + 4], es
  2828                                  _386	retn
  2829                                  .rm:
  2830                                  %endif
  2831                                  	mov word [zz_xms.entry], bx
  2832                                  	mov word [zz_xms.entry + 2], es
  2833                                  %if _PM
  2834                                  	and word [zz_xms.entry + 4], 0
  2835                                  	and word [zz_xms.entry + 6], 0
  2836                                  %endif
  2837                                  	retn
  2838                                  
  2839                                  
  2840                                  		; Note:	In dosemu DPMI it seems that 2F.4310 always returns
  2841                                  		;	 a far 32:32 pointer in es:ebx. This must be called
  2842                                  		;	 with a 32-bit stack frame.
  2843                                  zz_call_xms: section_of_function
  2844                                  	cmp word [zz_xms.entry + 2], 0
  2845                                  	jne @F
  2846                                  %if _PM
  2847                                  	cmp word [zz_xms.entry + 4], 0
  2848                                  	jne @F
  2849                                  	cmp word [zz_xms.entry + 6], 0
  2850                                  	jne @F
  2851                                  %endif
  2852                                  
  2853                                  .seterror:
  2854                                  	xor ax, ax			; failure
  2855                                  	mov bl, 80h			; function not implemented
  2856                                  	retn
  2857                                  
  2858                                  @@:
  2859                                  	push ax
  2860                                  	mov ax, 256
  2861                                  	nearcall stack_check.internal
  2862                                  	pop ax
  2863                                  	jb .seterror			; no, error out -->
  2864                                  %if _PM
  2865                                  _386_PM	nearcall ispm
  2866                                  _386_PM	jnz .rm
  2867                                  	testopt [internalflags2], dif2_no_pm_xms
  2868                                  	jz .pm
  2869                                  .86m_via_pm:
  2870                                  	lframe
  2871                                  	lvar 32h, 86m_call_struc
  2872                                  	lenter
  2873                                  	push es
  2874                                  	_386_PM_o32
  2875                                  	mov word [bp + ?86m_call_struc +00h], di	; edi
  2876                                  	_386_PM_o32
  2877                                  	mov word [bp + ?86m_call_struc +04h], si	; esi
  2878                                  	_386_PM_o32
  2879                                  	mov word [bp + ?86m_call_struc +10h], bx	; ebx
  2880                                  	_386_PM_o32
  2881                                  	mov word [bp + ?86m_call_struc +14h], dx	; edx
  2882                                  	_386_PM_o32
  2883                                  	mov word [bp + ?86m_call_struc +18h], cx	; ecx
  2884                                  	_386_PM_o32
  2885                                  	mov word [bp + ?86m_call_struc +1Ch], ax	; eax
  2886                                  	mov ax, word [bp + ?frame_bp]
  2887                                  	mov word [bp + ?86m_call_struc +08h], ax	; bp
  2888                                  	xor ax, ax
  2889                                  	mov word [bp + ?86m_call_struc +20h], ax	; flags
  2890                                  		; Note:	As noted in the RBIL61 Int31.0301 description,
  2891                                  		;	 the DPMI host will provide a stack if the
  2892                                  		;	 passed ss:sp fields are zero. However, this
  2893                                  		;	 stack is documented to be small, 30 words.
  2894                                  		;	XMS specifies that a stack of 128 words should
  2895                                  		;	 be available to it when calling its entrypoint.
  2896                                  		;
  2897                                  		; Here we re-use our (PM) stack with a heuristically
  2898                                  		;  chosen displacement in the hopes that the host will
  2899                                  		;  not use more than that of the stack itself.
  2900                                  XMS_VIA_86M_CALLBACK_STACK_DISPLACEMENT equ 128
  2901                                  	mov ax, sp
  2902                                  	sub ax, XMS_VIA_86M_CALLBACK_STACK_DISPLACEMENT
  2903                                  	mov word [bp + ?86m_call_struc +2Eh], ax	; sp
  2904                                  	mov ax, 256 + XMS_VIA_86M_CALLBACK_STACK_DISPLACEMENT
  2905                                  	nearcall stack_check.internal	; enough for XMS ?
  2906                                  	jb .stackoverflow
  2907                                  
  2908                                  	mov ax, word [pspdbg]
  2909                                  	mov word [bp + ?86m_call_struc +30h], ax	; ss
  2910                                  	mov word [bp + ?86m_call_struc +22h], ax	; es
  2911                                  	mov word [bp + ?86m_call_struc +24h], ax	; ds
  2912                                  		; (ds is used to point to zz_xms.movestruc)
  2913                                  	push word [zz_xms.entry + 2]
  2914                                  	push word [zz_xms.entry]
  2915                                  	pop word [bp + ?86m_call_struc +2Ah]		; ip
  2916                                  	pop word [bp + ?86m_call_struc +2Ch]		; cs
  2917                                  	push ss
  2918                                  	pop es				; => stack
  2919                                  	lea di, [bp + ?86m_call_struc]	; -> 86-Mode call structure
  2920                                  _386	movzx edi, di			; (previously checked b[dpmi32] here)
  2921                                  	xor cx, cx			; copy that many words to 86M stack
  2922                                  	mov ax, 0301h			; far call 86M procedure
  2923                                  	xor bx, bx
  2924                                  	int 31h
  2925                                  	mov ah, byte [bp + ?86m_call_struc +20h]	; flags
  2926                                  	sahf
  2927                                  	mov ax, word [bp + ?86m_call_struc +08h]	; bp
  2928                                  	mov word [bp + ?frame_bp], ax
  2929                                  	_386_PM_o32
  2930                                  	mov di, word [bp + ?86m_call_struc +00h]	; edi
  2931                                  	_386_PM_o32
  2932                                  	mov si, word [bp + ?86m_call_struc +04h]	; esi
  2933                                  	_386_PM_o32
  2934                                  	mov bx, word [bp + ?86m_call_struc +10h]	; ebx
  2935                                  	_386_PM_o32
  2936                                  	mov dx, word [bp + ?86m_call_struc +14h]	; edx
  2937                                  	_386_PM_o32
  2938                                  	mov cx, word [bp + ?86m_call_struc +18h]	; ecx
  2939                                  	_386_PM_o32
  2940                                  	mov ax, word [bp + ?86m_call_struc +1Ch]	; eax
  2941                                  @@:
  2942                                  	pop es
  2943                                  	lleave
  2944                                  	retn
  2945                                  
  2946                                  .stackoverflow:
  2947                                  	call .seterror
  2948                                  	jmp @B
  2949                                  
  2950                                  
  2951                                  .pm:
  2952                                  	_386_PM_o32
  2953                                  .rm:
  2954                                  %endif
  2955                                  	call far [zz_xms.entry]
  2956                                  	retn
  2957                                  
  2958                                  fail_xms_access:
  2959                                  	mov dx, msg.zz_fail_xms_access
  2960                                  	mov ax, 050Bh
  2961                                  	nearcall setrc
  2962                                  	jmp exit_error_msg_code
  2963                                  
  2964                                  call_xms_move: section_of_function
  2965                                  	push ax
  2966                                  	push bx
  2967                                  	push si
  2968                                  	mov si, zz_xms.movestruc
  2969                                  	mov ah, 0Bh
  2970                                  	nearcall zz_call_xms
  2971                                  	dec ax
  2972                                  	jnz fail_xms_access
  2973                                  	pop si
  2974                                  	pop bx
  2975                                  	pop ax
  2976                                  	retn
  2977                                  %endif
  2978                                  
  2979                                  
  2980                                  %if _PM
  2981                                  setes2ax: section_of_function
  2982                                  	mov bx, ax
  2983                                  setes2bx:
  2984                                  	nearcall ispm
  2985                                  	jnz @F
  2986                                  	mov dx, bx
  2987                                  	nearcall setrmsegm
  2988                                  @@:
  2989                                  	mov es, bx
  2990                                  	retn
  2991                                  %endif	; _PM
  2992                                  
  2993                                  
  2994                                   %if _SYMBOLIC && _DUALCODE && _SYMBOLASMDUALCODE
  2995                                  	usesection lDEBUG_CODE2
  2996                                   %endif
  2997                                  
  2998                                  		; INP:	bx:cx = length in bytes
  2999                                  		;	word [sym_storage.start + 2] => source (or 0)
  3000                                  		;	ax => destination
  3001                                  		; CHG:	di, si, cx
  3002                                  		; STT:	ds = es = ss
  3003                                  zz_transfer_buffer: section_of_function
  3004                                  	push cx
  3005                                  	mov di, ax
  3006                                  	mov cx, word [sym_storage.start + 2]
  3007                                  	mov si, sym_storage.first_start
  3008                                  @@:
  3009                                  	lodsw
  3010                                  	lodsw
  3011                                  	sub ax, cx			; x.start - sym_storage.start = para index
  3012                                  	add ax, di			; para index + destination = new seg
  3013                                  	mov word [si - 2], ax
  3014                                  	cmp si, sym_storage.after_start
  3015                                  	jb @B
  3016                                  	mov ax, di
  3017                                  	pop cx
  3018                                  
  3019                                  	push word [sym_storage.start + 2]
  3020                                  	push word [sym_storage.start]
  3021                                  	pop si
  3022                                  %if _PM
  3023                                  	 push word [symsel2]
  3024                                  	dualcall segment_to_selector
  3025                                  %endif
  3026                                  	pop ds			; ds:si -> transfer source
  3027                                  
  3028                                  	push ax
  3029                                  	xor di, di
  3030                                  %if _PM
  3031                                  	 push word [ss:symsel1]
  3032                                  	dualcall segment_to_selector
  3033                                  %endif
  3034                                  	pop es			; es:di -> transfer destination
  3035                                  
  3036                                  .transfer_loop:
  3037                                  	 push es
  3038                                  %if _PM
  3039                                  	dualcall selector_to_segment
  3040                                  %endif
  3041                                  	 push di
  3042                                  	dualcall normalise_pointer
  3043                                  	 pop di
  3044                                  %if _PM
  3045                                  	 push word [ss:symsel1]
  3046                                  	dualcall segment_to_selector
  3047                                  %endif
  3048                                  	 pop es			; normalise pointer
  3049                                  	 push ds
  3050                                  %if _PM
  3051                                  	dualcall selector_to_segment
  3052                                  %endif
  3053                                  	 push si
  3054                                  	dualcall normalise_pointer
  3055                                  	 pop si
  3056                                  %if _PM
  3057                                  	 push word [ss:symsel2]
  3058                                  	dualcall segment_to_selector
  3059                                  %endif
  3060                                  	 pop ds			; normalise pointer
  3061                                  	sub cx, SEGTRANSFER_size
  3062                                  	sbb bx, 0
  3063                                  	jc .transfer_last
  3064                                  
  3065                                  	push cx
  3066                                  	mov cx, SEGTRANSFER_size >> 1
  3067                                  	rep movsw
  3068                                  	pop cx
  3069                                  	jmp .transfer_loop
  3070                                  
  3071                                  .transfer_last:
  3072                                  	add cx, SEGTRANSFER_size
  3073                                  	adc bx, 0
  3074                                  	shr cx, 1
  3075                                  	rep movsw
  3076                                  
  3077                                  	 push ss
  3078                                  	 pop ds
  3079                                  	 push ss
  3080                                  	 pop es
  3081                                  	retn
  3082                                  
  3083                                  
  3084                                  zz_get_literal: section_of_function
  3085                                  	mov ah, 0
  3086                                  	xor bx, bx		; (in case of decimal base shortcut:
  3087                                  	mov dx, 10		;   set base: decimal)
  3088                                  	cmp al, '#'		; shortcut change to decimal base?
  3089                                  	je .lit_base		; yes -->
  3090                                  
  3091                                  .lithex_common:
  3092                                  	call .lit_ishexdigit?	; the first character must be a digit then
  3093                                  	jc .err2
  3094                                  	xor dl, dl		; initialize value
  3095                                  .lithex_loopdigit:
  3096                                  	cmp al, '_'
  3097                                  	je .lithex_skip
  3098                                  	call .lit_ishexdigit?	; was last character ?
  3099                                  	jc .lit_end		; yes -->
  3100                                  	test bh, 0F0h		; would shift bits out ?
  3101                                  	jnz .err2
  3102                                  	nearcall capitalise
  3103                                  	sub al, '0'
  3104                                  	cmp al, 9		; was decimal digit ?
  3105                                  	jbe .lithex_decimaldigit; yes -->
  3106                                  	sub al, 'A'-('9'+1)	; else adjust for hexadecimal digit
  3107                                  .lithex_decimaldigit:
  3108                                  	mov cx, 4
  3109                                  .lithex_loopshift:
  3110                                  	shl dx, 1
  3111                                  	rcl bx, 1
  3112                                  	loop .lithex_loopshift	; *16
  3113                                  	or dl, al		; add in the new digit
  3114                                  .lithex_skip:
  3115                                  	lodsb
  3116                                  	jmp short .lithex_loopdigit
  3117                                  
  3118                                  .lit_end:
  3119                                  	cmp al, '#'		; base change specification?
  3120                                  	je .lit_base		; yes -->
  3121                                  	nearcall isseparator?	; after the number, there must be a separator
  3122                                  	jne .err2		; none here -->
  3123                                  	jmp .term_end		; okay -->
  3124                                  .lit_base:
  3125                                  	test bx, bx		; insure base <= 36
  3126                                  	jnz .err2
  3127                                  	cmp dx, byte 36
  3128                                  	ja .err2
  3129                                  	cmp dx, byte 2		;  and >= 2
  3130                                  	jb .err2		; otherwise error -->
  3131                                  
  3132                                  	lodsb
  3133                                  	mov ah, 0		; (not sure why this)
  3134                                  	cmp dl, 16		; hexadecimal ?
  3135                                  	je .lithex_common	; yes, use specific handling -->
  3136                                  
  3137                                  	mov di, dx		; di = base
  3138                                  	mov cl, dl
  3139                                  	add cl, '0'-1
  3140                                  	cmp cl, '9'
  3141                                  	jbe .lit_basebelow11
  3142                                  	mov cl, '9'
  3143                                  .lit_basebelow11:		; cl = highest decimal digit for base ('1'..'9')
  3144                                  	mov ch, dl
  3145                                  	add ch, 'A'-10-1	; ch = highest letter for base ('A'-x..'Z')
  3146                                  
  3147                                  	call .lit_isdigit?	; first character must be a digit
  3148                                  	jc .err2
  3149                                  	xor dx, dx		; initialize value
  3150                                  .lit_loopdigit:
  3151                                  	cmp al, '_'
  3152                                  	je .lit_skip
  3153                                  	call .lit_isdigit?	; was last character ?
  3154                                  	jc .lit_end		; yes -->
  3155                                  	nearcall capitalise
  3156                                  	sub al, '0'
  3157                                  	cmp al, 9		; was decimal digit ?
  3158                                  	jbe .lit_decimaldigit	; yes -->
  3159                                  	sub al, 'A'-('9'+1)	; else adjust for hexadecimal digit
  3160                                  .lit_decimaldigit:
  3161                                  	push ax
  3162                                  	mov ax, dx
  3163                                  	push bx
  3164                                  	mul di			; multiply low word with base
  3165                                  	mov bx, dx
  3166                                  	mov dx, ax
  3167                                  	pop ax
  3168                                  	push dx
  3169                                  	mul di			; multiply high word with base
  3170                                  	test dx, dx
  3171                                  	pop dx
  3172                                  	jnz .err2		; overflow -->
  3173                                  	add bx, ax		; add them
  3174                                  	pop ax
  3175                                  	jc .err2		; overflow -->
  3176                                  	add dl, al		; add in the new digit
  3177                                  	adc dh, 0
  3178                                  	adc bx, byte 0
  3179                                  	jc .err2		; overflow -->
  3180                                  .lit_skip:
  3181                                  	lodsb
  3182                                  	jmp short .lit_loopdigit
  3183                                  
  3184                                  .term_end:
  3185                                  	retn
  3186                                  
  3187                                  .err2:
  3188                                  	mov ax, 050Ch
  3189                                  	nearcall setrc
  3190                                  	jmp symbolasm_error
  3191                                  
  3192                                  .lit_ishexdigit?:
  3193                                  	nearcall getexpression.lit_ishexdigit?
  3194                                  	retn
  3195                                  
  3196                                  .lit_isdigit?:
  3197                                  	nearcall getexpression.lit_isdigit?
  3198                                  	retn
  3199                                  %endif
