"Fossies" - the Fresh Open Source Software Archive

Member "fasm/tools/libc/prepsrc.asm" (9 Feb 2020, 1405 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  ELF
    3     public  main
    4 
    5 include 'ccall.inc'
    6 
    7 section '.text' executable align 16
    8 
    9   main:
   10     mov ecx,[esp+4]
   11     mov [argc],ecx
   12     mov ebx,[esp+8]
   13     mov [argv],ebx
   14 
   15     mov [display_handle],1
   16 
   17     call    get_params
   18     jnc make_dump
   19 
   20     mov esi,_usage
   21     call    display_string
   22     ccall   exit,2
   23 
   24   make_dump:
   25     call    preprocessed_source
   26     ccall   exit,0
   27 
   28   error:
   29     mov [display_handle],2
   30     mov esi,_error_prefix
   31     call    display_string
   32     pop esi
   33     call    display_string
   34     mov esi,_error_suffix
   35     call    display_string
   36     ccall   exit,0
   37 
   38   get_params:
   39     mov ecx,[argc]
   40     mov ebx,[argv]
   41     add ebx,4
   42     dec ecx
   43     jz  bad_params
   44       get_param:
   45     mov esi,[ebx]
   46     mov al,[esi]
   47     cmp [input_file],0
   48     jne get_output_file
   49     mov [input_file],esi
   50     jmp next_param
   51       get_output_file:
   52     cmp [output_file],0
   53     jne bad_params
   54     mov [output_file],esi
   55     jmp next_param
   56       bad_params:
   57     stc
   58     ret
   59       next_param:
   60     add ebx,4
   61     dec ecx
   62     jnz get_param
   63     cmp [input_file],0
   64     je  bad_params
   65     cmp [output_file],0
   66     je  bad_params
   67     clc
   68     ret
   69 
   70   include 'system.inc'
   71 
   72   include '..\prepsrc.inc'
   73 
   74 section '.data' writeable align 4
   75 
   76   input_file dd 0
   77   output_file dd 0
   78 
   79   _usage db 'preprocessed source dumper for flat assembler',0Dh,0Ah
   80      db 'usage: prepsrc <input> <output>',0Dh,0Ah
   81      db 0
   82   _error_prefix db 'error: ',0
   83   _error_suffix db '.',0Dh,0Ah,0
   84 
   85 section '.bss' writeable align 4
   86 
   87   argc dd ?
   88   argv dd ?
   89 
   90   display_handle dd ?
   91   character db ?
   92 
   93   params rb 1000h
   94   buffer rb 1000h