Subversion Repositories Kolibri OS

Rev

Rev 1792 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;---------------------------------------------------------------------
  2. char_toupper:
  3. ; convert character to uppercase, using cp866 encoding
  4. ; in: al=symbol
  5. ; out: al=converted symbol
  6.     cmp     al, 'a'
  7.     jb      .ret
  8.     cmp     al, 'z'
  9.     jbe     .az
  10.     cmp     al, ' '
  11.     jb      .ret
  12.     cmp     al, 'à'
  13.     jb      .rus1
  14.     cmp     al, 'ï'
  15.     ja      .ret
  16. ; 0xE0-0xEF -> 0x90-0x9F
  17.     sub     al, 'à'-''
  18. .ret:
  19.     ret
  20. .rus1:
  21. ; 0xA0-0xAF -> 0x80-0x8F
  22. .az:
  23.     and     al, not 0x20
  24.     ret
  25. ;---------------------------------------------------------------------
  26. char_todown:
  27. ; convert character to lowercase, using cp866 encoding
  28. ; in: al=symbol
  29. ; out: al=converted symbol
  30.         cmp     al, 'A'
  31.         jb      .ret
  32.         cmp     al, 'Z'
  33.         jbe     .az
  34.         cmp     al, '€'
  35.         jb      .ret
  36.         cmp     al, ''
  37.         jb      .rus1
  38.         cmp     al, 'Ÿ'
  39.         ja      .ret
  40. ; 0x90-0x9F -> 0xE0-0xEF
  41.         add     al, 'à'-''
  42. .ret:
  43.         ret
  44. .rus1:
  45. ; 0x80-0x8F -> 0xA0-0xAF
  46. .az:
  47.         add     al, 0x20
  48.         ret
  49. ;---------------------------------------------------------------------