SETVBV	equ $E45C	; vbi vector
XITVBV	equ $E462 	; vbi exit vector
colpm0	equ $D011	; taken this back 1 byte as loop wrong

	org $0600	; page 6 for the tests

START:	PLA 		; initialize vbi. number of arguments
	LDA #7 		; deferred vbi
	LDY #VBROUT&255 ; lo-byte
	LDX #VBROUT/256 ; hi-byte
	JSR SETVBV 	; enable vbi
	RTS 		; back to BASIC

vbrout:	inc count	; Timing loop
	lda count
	cmp limit
	bne store

rotate: lda #0
        sta count	; reset the timing counter

        ldx ctab	; now rotate values 1 byte from right to left
        lda ctab+1
        sta ctab
        lda ctab+2
        sta ctab+1
        lda ctab+3
        sta ctab+2
        lda ctab+4
        sta ctab+3
        lda ctab+5
        sta ctab+4
        stx ctab+5

store:	ldx #5
loop:	lda ctab,x
	sta COLPM0,x
	dex
	bne loop
	jmp XITVBV

ctab:	.byte $02,$04,$06,$08,$0A,$0C
count:	.byte $0
limit:	.byte $04