Subversion Repositories Kolibri OS

Rev

Rev 5363 | Rev 6468 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5363 Rev 6262
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 5363 $
8
$Revision: 6262 $
9
 
9
 
10
;-----------------------------------------------------------------------------
10
;-----------------------------------------------------------------------------
11
uglobal
11
uglobal
Line 829... Line 829...
829
        pop     edi eax
829
        pop     edi eax
830
        add     esp, 4
830
        add     esp, 4
831
        inc     esi
831
        inc     esi
832
        clc
832
        clc
833
        ret
833
        ret
834
;-----------------------------------------------------------------------------
-
 
835
char_todown:
-
 
836
; convert character to uppercase, using cp866 encoding
-
 
837
; in: al=symbol
-
 
838
; out: al=converted symbol
-
 
839
        cmp     al, 'A'
-
 
840
        jb      .ret
-
 
841
 
-
 
842
        cmp     al, 'Z'
-
 
843
        jbe     .az
-
 
844
 
-
 
845
        cmp     al, 0x80 ; 'А'
-
 
846
        jb      .ret
-
 
847
 
-
 
848
        cmp     al, 0x90 ; 'Р'
-
 
849
        jb      .rus1
-
 
850
 
-
 
851
        cmp     al, 0x9F ; 'Я'
-
 
852
        ja      .ret
-
 
853
; 0x90-0x9F -> 0xE0-0xEF
-
 
854
        add     al, 0xE0-0x90
-
 
855
;--------------------------------------
-
 
856
.ret:
-
 
857
        ret
-
 
858
;--------------------------------------
-
 
859
.rus1:
-
 
860
; 0x80-0x8F -> 0xA0-0xAF
-
 
861
.az:
-
 
862
        add     al, 0x20
-
 
863
        ret
-
 
864
;-----------------------------------------------------------------------------
-
 
865
uni2ansi_char:
-
 
866
; convert UNICODE character in al to ANSI character in ax, using cp866 encoding
-
 
867
; in: ax=UNICODE character
-
 
868
; out: al=converted ANSI character
-
 
869
        cmp     ax, 0x80
-
 
870
        jb      .ascii
-
 
871
 
-
 
872
        cmp     ax, 0x401
-
 
873
        jz      .yo1
-
 
874
 
-
 
875
        cmp     ax, 0x451
-
 
876
        jz      .yo2
-
 
877
 
-
 
878
        cmp     ax, 0x410
-
 
879
        jb      .unk
-
 
880
 
-
 
881
        cmp     ax, 0x440
-
 
882
        jb      .rus1
-
 
883
 
-
 
884
        cmp     ax, 0x450
-
 
885
        jb      .rus2
-
 
886
;--------------------------------------
-
 
887
.unk:
-
 
888
        mov     al, '_'
-
 
889
        jmp     .doit
-
 
890
;--------------------------------------
-
 
891
.yo1:
-
 
892
        mov     al, 0xF0 ; 'Ё' in cp866
-
 
893
        jmp     .doit
-
 
894
;--------------------------------------
-
 
895
.yo2:
-
 
896
        mov     al, 0xF1 ; 'ё' in cp866
-
 
897
        jmp     .doit
-
 
898
;--------------------------------------
-
 
899
.rus1:
-
 
900
; 0x410-0x43F -> 0x80-0xAF
-
 
901
        add     al, 0x70
-
 
902
        jmp     .doit
-
 
903
;--------------------------------------
-
 
904
.rus2:
-
 
905
; 0x440-0x44F -> 0xE0-0xEF
-
 
906
        add     al, 0xA0
-
 
907
;--------------------------------------
-
 
908
.ascii:
-
 
909
.doit:
-
 
910
        ret
-
 
911
;-----------------------------------------------------------------------------
-