	title	Module from library HILIB_3 : @RIGHT
	name	('@RIGHT')
	maclib	baselib.lib

; Language : BASIC

; Get RIGHT$ of a string

; Copyright (C)	Werner Cirsovius
;		Hohe Weide 44
;		D-20253 Hamburg
;		Tel.: +49-40-4223247

;		Version 1.0, August 1987

; ENTRY	Reg pair HL points to target
;	Reg pair DE points to substring
;	Reg B holds length of substring

; EXIT	Carry set on position error

	entry	@right

	extrn	@copy,@leng

@right:
	xor	a
	ld	(de),a
	ld	a,b		; Test character
	or	a
	ret	z
	push	bc
	call	@leng
	ld	a,b		; Test length
	pop	bc
	sub	b
	ld	c,a		; Set it
	jp	p,@copr
	ld	c,0		; Else set start
@copr:
	inc	c		; Fix position
	jp	@copy

	end

