; part of WinRes, Copr. 1995 Matthias K"oppe

;    $Id: wresstr.asm 1.3 1999/02/09 11:11:35 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

		PUBLIC	GetStringFromBlock

TSTRINGBLOCK	STRUC
  sbIndex	DW	?
  sbSize	DW	?
  sbNext	DD	?
  sbData	DB	?
TSTRINGBLOCK	ENDS

CODE		SEGMENT BYTE PUBLIC

		ASSUME	CS: CODE

GetStringFromBlock	PROC FAR
		ARG	Index: WORD, Block: DWORD = ArgSize
		push	bp
		mov	bp, sp
		mov	dx, Index
		mov	cx, dx
		shr	dx, 4
		inc	dx
		les	si, Block
@@2:		mov	ax, es
		or	ax, si
		jz	SHORT @@3
		cmp	dx, es:[si].TSTRINGBLOCK.sbIndex
		jz	SHORT @@1
		les	si, es:[si].TSTRINGBLOCK.sbNext
		jmp	@@2
@@1:		add	si, TSTRINGBLOCK.sbData
		and	cx, 000Fh
		cld
		mov	ah, 0
		jz	SHORT @@3
@@4:		seges lodsb
		add	si, ax
		loop	@@4
@@3:		mov	dx, es
		mov	ax, si
		pop	bp
		retf	ArgSize
GetStringFromBlock	ENDP

CODE		ENDS

		END
