"Fossies" - the Fresh Open Source Software Archive

Member "fasm/tools/win32/symbols.asm" (9 Feb 2020, 2150 Bytes) of package /linux/misc/fasm-1.73.22.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Generic Assembler source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 format PE console 4.0
    3 entry start
    4 
    5 include 'win32a.inc'
    6 
    7 section '.data' data readable writeable
    8 
    9   _usage db 'symbols dumper for flat assembler',0Dh,0Ah
   10      db 'usage: symbols <input> <output>',0Dh,0Ah
   11      db 0
   12   _error_prefix db 'error: ',0
   13   _error_suffix db '.',0Dh,0Ah,0
   14 
   15   input_file dd 0
   16   output_file dd 0
   17 
   18   input dd ?
   19   output_buffer dd ?
   20   output_handle dd ?
   21 
   22   display_handle dd ?
   23   bytes_count dd ?
   24 
   25   params rb 1000h
   26 
   27 section '.text' code readable executable
   28 
   29   start:
   30 
   31     mov [display_handle],STD_OUTPUT_HANDLE
   32 
   33     call    get_params
   34     jnc make_dump
   35 
   36     mov esi,_usage
   37     call    display_string
   38     invoke  ExitProcess,2
   39 
   40   make_dump:
   41     call    symbols
   42     invoke  ExitProcess,0
   43 
   44   error:
   45     mov [display_handle],STD_ERROR_HANDLE
   46     mov esi,_error_prefix
   47     call    display_string
   48     pop esi
   49     call    display_string
   50     mov esi,_error_suffix
   51     call    display_string
   52     invoke  ExitProcess,1
   53 
   54   get_params:
   55     invoke  GetCommandLine
   56     mov esi,eax
   57     mov edi,params
   58     find_command_start:
   59     lodsb
   60     cmp al,20h
   61     je  find_command_start
   62     cmp al,22h
   63     je  skip_quoted_name
   64     skip_name:
   65     lodsb
   66     cmp al,20h
   67     je  find_param
   68     or  al,al
   69     jz  all_params
   70     jmp skip_name
   71     skip_quoted_name:
   72     lodsb
   73     cmp al,22h
   74     je  find_param
   75     or  al,al
   76     jz  all_params
   77     jmp skip_quoted_name
   78     find_param:
   79     lodsb
   80     cmp al,20h
   81     je  find_param
   82     cmp al,0Dh
   83     je  all_params
   84     or  al,al
   85     jz  all_params
   86     cmp [input_file],0
   87     jne get_output_file
   88     mov [input_file],edi
   89     jmp process_param
   90       get_output_file:
   91     cmp [output_file],0
   92     jne bad_params
   93     mov [output_file],edi
   94     process_param:
   95     cmp al,22h
   96     je  string_param
   97     copy_param:
   98     stosb
   99     lodsb
  100     cmp al,20h
  101     je  param_end
  102     cmp al,0Dh
  103     je  param_end
  104     or  al,al
  105     jz  param_end
  106     jmp copy_param
  107     string_param:
  108     lodsb
  109     cmp al,22h
  110     je  string_param_end
  111     cmp al,0Dh
  112     je  param_end
  113     or  al,al
  114     jz  param_end
  115     stosb
  116     jmp string_param
  117     bad_params:
  118     stc
  119     ret
  120     param_end:
  121     dec esi
  122     string_param_end:
  123     xor al,al
  124     stosb
  125     jmp find_param
  126     all_params:
  127     cmp [input_file],0
  128     je  bad_params
  129     cmp [output_file],0
  130     je  bad_params
  131     clc
  132     ret
  133 
  134   include 'system.inc'
  135 
  136   include '..\symbols.inc'
  137 
  138 section '.idata' import data readable writeable
  139 
  140   library kernel32,'KERNEL32.DLL'
  141 
  142   include 'api\kernel32.inc'