; 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	hl
	ld	h,0
	ld	l,e		; Hl=line num
	add	hl,hl		; Hl=2*e
	add	hl,hl		; Hl=4*e
	add	hl,hl		; Hl=8*e
	add	hl,hl		; Hl=16*e
	ld	de,roller
	add	hl,de		; Hl=roller+16*line num
;
	ld	e,(hl)
	inc	hl
	ld	d,(hl)		; De=encoded address
;
	ld	a,e		; Hold on to bottom few bits
	ex	de,hl		; Hl=encoded address
	add	hl,hl		; Hl=(encoded address)*2
	and	7		; A=botton 3 bits of original encoded addr.
	or	l		; Combine with bottom of doubled encoded addr.
	ld	l,a		; Put this back into hl.
	ex	de,hl		; Transfer result to de - destination
;
	pop	hl		; Recover source address
	ld	bc,linelen
	ldir			; Move line from buffer to screen
	ret
;

