home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / asm_programming / ASMFILES.ZIP / UPPERCAS.ASM < prev    next >
Assembly Source File  |  1985-06-21  |  1KB  |  36 lines

  1. ;ROUTINE TO CONVERT STRING TO UPPER CASE                00000100
  2. ;                                    00000200
  3. uppercase     proc    far                        00000300
  4. ;                                    00000400
  5.           push    bx      ;SAVE    REGISTERS            00000500
  6.           push    cx                        00000600
  7.           push    ax                        00000700
  8. ;                                    00000800
  9. ;GET THE LENTH                                00000900
  10.           mov    cx,[bx]      ;FIRST TWO BYTES CONTAIN THE LENGTH    00001000
  11.           inc    bx      ;POINT TO BEGINNING OF TEXT        00001100
  12.           inc    bx                        00001200
  13. ;                                    00001300
  14. ;LOOP THROUGH THE BYTES    OF THE STRING                    00001400
  15. ;                                    00001500
  16. uppercase1:                                00001600
  17.           mov    al,[bx]      ;GET THE CHARACTER            00001700
  18.           cmp    al,'a'      ;BELOW THE LOWERCASE CHARACTERS?    00001800
  19.           jb    uppercase2    ;SKIP IF SO            00001900
  20.           cmp    al,'z'      ;ABOVE THE LOWERCASE CHARACTERS?    00002000
  21.           ja    uppercase2    ;SKIP IF SO            00002100
  22. ;                                    00002200
  23.           or    al,5fh      ;MASK    OUT BIT    NUMBER 5        00002300
  24. ;                                    00002400
  25. uppercase2:                                00002500
  26.           mov    [bx],al      ;STORE THE CHARACTER            00002600
  27.           inc    bx      ;POINT TO NEXT CHARACTER        00002700
  28.           loop    uppercase1                    00002800
  29. ;                                    00002900
  30.           pop    ax      ;RESTORE REGISTERS            00003000
  31.           pop    cx                        00003100
  32.           pop    bx                        00003200
  33.           ret                            00003300
  34. ;                                    00003400
  35. lowercase     endp                            00003500
  36.