; Doug's Programming Language  -- DPL, Version 2.22
; Copyright (c) 1988 Douglas S. Cody, All rights reserved.
;--------------------------------
; LWRCS  --  Convert all ASCIIZ string characters to lowercase
;
; Entry Conditions:
;	AX holds the string offset
; Exit conditions:
;	Assume all working registers modified
;
; Calling Example:
;
;	DEFINE	M00,'THIS IS A TEST...'
;	;
;	CALL	LWRCS M00
;
; Calling results:
;
;	M00 = 'this is a test...'
;	
;
SUBPGM	LWRCS
BEGIN	LWRCS
	PUSH	ES
	PUSH	DS
	POP	ES
	PUSH	SI
	PUSH	DI
	MOV	SI,AX		; SI WILL LEAD 
	MOV	DI,AX		; DI WILL FOLLOW UP
	MOV	BX,5A41H
;
L05:
	LODSB			; FETCH THE BYTE
	OR	AL,AL		; EOL?
	JZ	L15		; YES, EXIT NOW...
	CMP	AL,BL		; IS IT LESS THAN 'A'?
	JB	L10		; YES, SKIP CONVERSION
	CMP	AL,BH		; GREATER THAN 'Z'?
	JA	L10		; YES, SKIP CONVERSION
	OR	AL,20H		; SET THE LOWERCASE BIT
;
L10:
	STOSB			; SAVE THE CHARACTER
	JMP	SHORT L05	; CONTINUE TILL DONE
;
L15:
	POP	DI
	POP	SI
	POP	ES
	RET
;
ENDPGM	LWRCS
;
