
	load 'macros.dump'
	include 'driver.equ'

;-----------------------------------------------
;
;   Imported addresses
;
;-----------------------------------------------

	IMPORT	T_GetParPtr
	IMPORT	T_LineCount
	IMPORT	T_LineInfoSize
	IMPORT	T_LinesHdl
	IMPORT	T_MulLine


;------------------------------------------------------------------------------
;
; T_OffsetLines (ParagNo:w,LineNo:w,CharCount:w)
;

T_OffsetLines	PROC		EXPORT
			;Using T_Data
			;Using T_TextEqu

		INPUT ParagNo:w,LineNo:w,CharCount:w
		LOCAL ParagPtr:l,LinesHdl:l,LinePtr:l,LineCount:w

		BEGIN

		rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax)

		movelong [ParagPtr]:#T_LinesHdl,LinesHdl
		movelong [LinesHdl],LinePtr
		moveword [ParagPtr]:#T_LineCount,LineCount

		rcall T_MulLine,in=(LineNo:a),out=(a:a)
		addwl a,LinePtr

		ldx LineNo

LLoop	inx
		cpx LineCount
		bge EndLLoop
		addwl #T_LineInfoSize,LinePtr
		addword CharCount,[LinePtr],[LinePtr]
		bra LLoop
EndLLoop


		RETURN
		ENDP
		END

