home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / dpl.zip / LWRCS.D < prev    next >
Text File  |  1988-07-11  |  1KB  |  55 lines

  1. ; Doug's Programming Language  -- DPL, Version 2.22
  2. ; Copyright (c) 1988 Douglas S. Cody, All rights reserved.
  3. ;--------------------------------
  4. ; LWRCS  --  Convert all ASCIIZ string characters to lowercase
  5. ;
  6. ; Entry Conditions:
  7. ;    AX holds the string offset
  8. ; Exit conditions:
  9. ;    Assume all working registers modified
  10. ;
  11. ; Calling Example:
  12. ;
  13. ;    DEFINE    M00,'THIS IS A TEST...'
  14. ;    ;
  15. ;    CALL    LWRCS M00
  16. ;
  17. ; Calling results:
  18. ;
  19. ;    M00 = 'this is a test...'
  20. ;    
  21. ;
  22. SUBPGM    LWRCS
  23. BEGIN    LWRCS
  24.     PUSH    ES
  25.     PUSH    DS
  26.     POP    ES
  27.     PUSH    SI
  28.     PUSH    DI
  29.     MOV    SI,AX        ; SI WILL LEAD 
  30.     MOV    DI,AX        ; DI WILL FOLLOW UP
  31.     MOV    BX,5A41H
  32. ;
  33. L05:
  34.     LODSB            ; FETCH THE BYTE
  35.     OR    AL,AL        ; EOL?
  36.     JZ    L15        ; YES, EXIT NOW...
  37.     CMP    AL,BL        ; IS IT LESS THAN 'A'?
  38.     JB    L10        ; YES, SKIP CONVERSION
  39.     CMP    AL,BH        ; GREATER THAN 'Z'?
  40.     JA    L10        ; YES, SKIP CONVERSION
  41.     OR    AL,20H        ; SET THE LOWERCASE BIT
  42. ;
  43. L10:
  44.     STOSB            ; SAVE THE CHARACTER
  45.     JMP    SHORT L05    ; CONTINUE TILL DONE
  46. ;
  47. L15:
  48.     POP    DI
  49.     POP    SI
  50.     POP    ES
  51.     RET
  52. ;
  53. ENDPGM    LWRCS
  54. ;
  55.