flat assembler
Message board for the users of flat assembler.

Index > Main > Notepad utf-8 format BOM Header

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
skykrnl



Joined: 17 Nov 2008
Posts: 21
skykrnl
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, 16:17
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.