home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / LOWERCAS.ASM < prev    next >
Assembly Source File  |  1992-03-02  |  3KB  |  83 lines

  1.         page    ,132
  2.         title   Character Translation Routines
  3.         subttl  Copyright (C) 1988 by IBM (Written 5/88 by Jim Christensen)
  4.  
  5.         .386
  6. _TEXT   SEGMENT  DWORD USE32 PUBLIC 'CODE'
  7. _TEXT      ENDS
  8. _DATA   SEGMENT  DWORD USE32 PUBLIC 'DATA'
  9. _DATA      ENDS
  10.         ASSUME   CS: FLAT, DS: FLAT, SS: FLAT, ES: FLAT
  11. _DATA   segment dword public USE32 'DATA'
  12.  
  13. ;  The translation table for upper case to lower case, for US and world trade.
  14. xlctab  label   byte
  15.    db   00h,01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh  ;00-0F
  16.    db   10h,11h,12h,13h,14h,15h,16h,17h,18h,19h,1Ah,1Bh,1Ch,1Dh,1Eh,1Fh  ;10-1F
  17.    db   20h,21h,22h,23h,24h,25h,26h,27h,28h,29h,2Ah,2Bh,2Ch,2Dh,2Eh,2Fh  ;20-2F
  18.    db   30h,31h,32h,33h,34h,35h,36h,37h,38h,39h,3Ah,3Bh,3Ch,3Dh,3Eh,3Fh  ;30-3F
  19.    db   40h,61h,62h,63h,64h,65h,66h,67h,68h,69h,6Ah,6Bh,6Ch,6Dh,6Eh,6Fh  ;40-4F
  20.    db   70h,71h,72h,73h,74h,75h,76h,77h,78h,79h,7Ah,5Bh,5Ch,5Dh,5Eh,5Fh  ;50-5F
  21.    db   60h,61h,62h,63h,64h,65h,66h,67h,68h,69h,6Ah,6Bh,6Ch,6Dh,6Eh,6Fh  ;60-6F
  22.    db   70h,71h,72h,73h,74h,75h,76h,77h,78h,79h,7Ah,7Bh,7Ch,7Dh,7Eh,7Fh  ;70-7F
  23.  
  24.    db   87h,81h,82h,83h,84h,85h,86h,87h,88h,89h,8Ah,8Bh,8Ch,8Dh,84h,86h  ;80-8F
  25.    db   82h,91h,92h,93h,94h,95h,96h,97h,98h,94h,81h,9Bh,9Ch,9Dh,94h,96h  ;90-9F
  26.    db   160,161,162,163,164,164,166,167,168,169,170,171,172,173,174,175  ;A0-AF
  27.    db   176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191  ;B0-BF
  28.    db   192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207  ;C0-CF
  29.    db   208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223  ;D0-DF
  30.    db   224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239  ;E0-EF
  31.    db   240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255  ;F0-FF
  32.  
  33.         align 4
  34. _DATA   ends
  35. PUBLIC  LowerCase
  36. _TEXT   SEGMENT  DWORD USE32 PUBLIC 'CODE'
  37.  
  38. ;------------------------------------------------------------------------------;
  39. ; name          LowerCase -- translate to lower case
  40. ;
  41. ; synopsis      void LowerCase( inbuf, outbuf );
  42. ;
  43. ;               char *inbuf;            /* char array to translate */
  44. ;               char *outbuf;           /* char array for result */
  45. ;
  46. ; description   This function translates characters to lower case.
  47. ;------------------------------------------------------------------------------;
  48.  
  49. InBuf  = 8
  50. OutBuf = 12
  51.  
  52. LowerCase PROC NEAR
  53.         push    ebp
  54.         mov     ebp,esp
  55.         push    eax
  56.         push    ebx
  57.         push    esi
  58.         push    edi
  59.  
  60.         mov     esi, [ebp+InBuf]
  61.         mov     edi, [ebp+OutBuf]
  62.         mov     ebx, OFFSET FLAT:xlctab
  63.         jmp     short lc20
  64. lc10:
  65.         xlat
  66.         stosb
  67. lc20:
  68.         lodsb
  69.         or      al, al
  70.         jnz     lc10
  71.  
  72.         pop     edi
  73.         pop     esi
  74.         pop     ebx
  75.         pop     eax
  76.         leave
  77.         ret
  78.  
  79. LowerCase endp
  80.  
  81. _TEXT   ends
  82.         end
  83.