	.LA	1000

	MOV	#1000,R5

SCRL:	MOV	#40000,R0
	MOV	#30,R1
	MOV	#100,R2
	CALL	ScrollRight
	SOB	R5,SCRL
	HALT

; R0 - screen address
; R1 - width in words
; R2 - height in rows

ScrollRight:
	ASL	R1
	NEG	R1
	ADD	#100,R1	;R1=64-(width*2)
ROLL:	MOV	R0,R3	;save scr addr
ROLL1:	ADD	R1,PC

	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+	; scroll row
	ROL (R0)+
	ROL (R0)+
	ROL (R0)+

	MOV	R3,R0	; restore scr addr
	ADC	(R0)	; shift from last word to 1st
	INC	PC
	BR	ROLL1
	ADD	#100,R0
	SOB	R2,ROLL
	RET
	
	.END
