; The following is a routine which will be mved into common memory
; and later executed by SCR RUN ROUTINE. If included within an RSX
; then it is not necessary to move it to comnon (because it will lie
;  there anyway)
;
;
; entry conditions:
;
;   hl=address of data for one line of characters
;    e=character line nunber
;

roller  equ     0B600h
linelen equ     720

docommon:
	push	h
	mvi	h,0
	mov	l,e	;hl=line num
	dad	h	;hl=2*e
	dad	h	;hl=4*e
	dad	h	;hl=8*e
	dad	h	;hl=16*e
	lxi	d,roller
	dad	d	;hl=roller+16*line num
;
	mov	e,m
	inx	h
	mov	d,m	;de=encoded address
;
	mov	a,e	;hold on to bottom few bits
	xchg		;hl=encoded address
	dad	h	;hl=(encoded address)*2
	ani	7	;a=botton 3 bits of original encoded addr.
	ora	l	;combine with bottom of doubled encoded addr.
	mov	l,a	;put this back into hl.
	xchg		;transfer result to de - destination
;
	pop	h	;recover source address
	lxi	b,linelen
	ldir		;move line from buffer to screen
	ret
;

