flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > fasm.exe

Author
Thread Post new topic Reply to topic
skykrnl



Joined: 17 Nov 2008
Posts: 21
skykrnl 02 Dec 2008, 15:49
Code:

preprocess_file:
  push    [memory_end]
        push    esi
 mov     al,2
        xor     edx,edx
     call    lseek
       push    eax
 xor     al,al
       xor     edx,edx
     call    lseek
       pop     ecx
 mov     edx,[memory_end]
    dec     edx
 mov     byte [edx],1Ah
      sub     edx,ecx
     jc      out_of_memory
       mov     esi,edx
     cmp     edx,edi
     jbe     out_of_memory
       mov     [memory_end],edx
    call    read

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;begin;begin;begin;begin;begin;begin;begin;
;by skykrnl
;2008.12.02
        pushad
      mov     esi,[memory_end]
    lodsd
       and     eax,00FFFFFFh
       cmp     eax,00BFBBEFh
       jne     not_utf8
    mov     edi,[memory_end]
    xor     eax,eax
     stosb
       stosb
       stosb
not_utf8:
      popad
;end;end;end;end;end;end;end;end;end;end;end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

   call    close
       pop     edx
 xor     ecx,ecx
     mov     ebx,esi
      preprocess_source:
     inc     ecx
 mov     [current_line],edi
  mov     eax,edx
     stos    dword [edi]
 mov     eax,ecx
     stos    dword [edi]
 mov     eax,esi
     sub     eax,ebx
     stos    dword [edi]
 xor     eax,eax
     stos    dword [edi]
 push    ebx edx
     call    convert_line
        call    preprocess_line
     pop     edx ebx
      next_line:
     cmp     byte [esi-1],1Ah
    jne     preprocess_source
      file_end:
    pop     [memory_end]
        clc
 ret

    
Post 02 Dec 2008, 15:49
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 02 Dec 2008, 16:09
I guess this patch is intended to skip the BOM header, can anyone confirm that?

I'll move this thread to Compiler Internals.
Post 02 Dec 2008, 16:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.