;; part of WinRes, Copr. 1995 Matthias K"oppe
	
;    $Id: wreschr.asm 1.3 1999/02/09 11:10:27 mkoeppe Exp $
 
;    This library is free software; you can redistribute it and/or
;    modify it under the terms of the GNU Library General Public
;    License as published by the Free Software Foundation; either
;    version 2 of the License, or (at your option) any later version.

;    This library is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;    Library General Public License for more details.

;    You should have received a copy of the GNU Library General Public
;    License along with this library; if not, write to the Free
;    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

	
			LOCALS	@@
		JUMPS

CODE		SEGMENT BYTE PUBLIC

		ASSUME	CS:CODE

		EXTRN	T10070437: NEAR, T04371007: NEAR

		PUBLIC	AnsiTo437, AnsiTo437Buf, AnsiTo437Str, \
			AnsiFrom437, AnsiFrom437Str

AnsiFrom437	PROC 	FAR
		ARG	Buf: DWORD = ArgSize
		MOV	BX, OFFSET T04371007
		jmp     SHORT DoTo
AnsiFrom437	ENDP

AnsiTo437	PROC	FAR
		ARG	Buf: DWORD = ArgSize
		MOV	BX, OFFSET T10070437
DoTo:
		push	bp
		mov	bp, sp
		LES	DI, Buf
		CLD
@@1:		MOV	AL, ES:[DI]
		OR	AL, AL
		JZ	SHORT @@2
		SEGCS	XLAT
		STOSB
		JMP	@@1
@@2:		pop	bp
		retf	ArgSize
AnsiTo437	ENDP

DoAnsiTo437Str	PROC NEAR
		mov	cl, es:[di]
		inc	di
		mov	ch, 0
		jcxz	SHORT @@0
@@1:		mov	al, es:[di]
		segcs	xlat
		stosb
		loop	@@1
@@0:		retn
DoAnsiTo437Str	ENDP

AnsiFrom437Str	PROC	FAR
		ARG	String: DWORD = ArgSize
		mov	bx, OFFSET T04371007
		jmp	SHORT DoToStr
AnsiFrom437Str	ENDP

AnsiTo437Str	PROC 	FAR
		ARG	String: DWORD = ArgSize
		mov	bx, OFFSET T10070437
DoToStr:
		push	bp
		mov	bp, sp
		les	di, String
		mov	ax, es
		or	ax, di
		jz	SHORT @@0
		cld
		call	DoAnsiTo437Str
@@0:		pop	bp
		retf	ArgSize
AnsiTo437Str	ENDP

AnsiTo437Buf	PROC NEAR
		ARG	Buf: DWORD = ArgSize
		push	bp
		mov	bp, sp
		les	di, Buf
		mov	ax, es
		or	ax, di
		jz	SHORT @@0
		cld
		mov	bx, OFFSET T10070437
		mov	dx, 16
@@1:		call	DoAnsiTo437Str
		dec	dx
		jnz	@@1
@@0:		pop	bp
		retn	ArgSize
AnsiTo437Buf	ENDP

CODE		ENDS

		END


