"Fossies" - the Fresh Open Source Software Archive

Member "fasm/tools/dos/prepsrc.asm" (9 Feb 2020, 1930 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  MZ
    3     heap    0
    4     stack   8000h
    5     entry   loader:init
    6 
    7 include 'loader.inc'
    8 
    9 segment main use32
   10 
   11   start:
   12 
   13     call    get_params
   14     jnc make_dump
   15 
   16     mov esi,_usage
   17     call    display_string
   18     mov ax,4C02h
   19     int 21h
   20 
   21   make_dump:
   22     call    preprocessed_source
   23     mov ax,4C00h
   24     int 21h
   25 
   26   error:
   27     mov esi,_error_prefix
   28     call    display_string
   29     pop esi
   30     call    display_string
   31     mov esi,_error_suffix
   32     call    display_string
   33     mov ax,4C00h
   34     int 21h
   35 
   36   get_params:
   37     push    ds
   38     mov ds,[psp_selector]
   39     mov esi,81h
   40     mov edi,params
   41     find_param:
   42     lodsb
   43     cmp al,20h
   44     je  find_param
   45     cmp al,0Dh
   46     je  all_params
   47     or  al,al
   48     jz  all_params
   49     cmp [es:input_file],0
   50     jne get_output_file
   51     mov [es:input_file],edi
   52     jmp process_param
   53       get_output_file:
   54     cmp [es:output_file],0
   55     jne bad_params
   56     mov [es:output_file],edi
   57     process_param:
   58     cmp al,22h
   59     je  string_param
   60     copy_param:
   61     stosb
   62     lodsb
   63     cmp al,20h
   64     je  param_end
   65     cmp al,0Dh
   66     je  param_end
   67     or  al,al
   68     jz  param_end
   69     jmp copy_param
   70     string_param:
   71     lodsb
   72     cmp al,22h
   73     je  string_param_end
   74     cmp al,0Dh
   75     je  param_end
   76     or  al,al
   77     jz  param_end
   78     stosb
   79     jmp string_param
   80     bad_params_value:
   81     stc
   82     ret
   83     param_end:
   84     dec esi
   85     string_param_end:
   86     xor al,al
   87     stosb
   88     jmp find_param
   89     all_params:
   90     xor al,al
   91     stosb
   92     pop ds
   93     cmp [input_file],0
   94     je  bad_params
   95     cmp [output_file],0
   96     je  bad_params
   97     clc
   98     ret
   99     bad_params:
  100     stc
  101     ret
  102 
  103   include 'system.inc'
  104 
  105   include '..\prepsrc.inc'
  106 
  107   _usage db 'preprocessed source dumper for flat assembler',0Dh,0Ah
  108      db 'usage: prepsrc <input> <output>',0Dh,0Ah
  109      db 0
  110   _error_prefix db 'error: ',0
  111   _error_suffix db '.',0Dh,0Ah,0
  112 
  113   input_file dd 0
  114   output_file dd 0
  115 
  116   psp_selector dw ?
  117   environment_selector dw ?
  118 
  119   memory_handles_count dd ?
  120   memory_handles rd 400h
  121 
  122   params rb 1000h
  123 
  124 segment buffer_segment
  125 
  126   buffer = (buffer_segment-main) shl 4
  127 
  128   db 1000h dup ?
  129 
  130 segment stack_segment
  131 
  132   stack_bottom = (stack_segment-main) shl 4
  133 
  134   db 4000h dup ?
  135 
  136   stack_top = stack_bottom + $