
	org	840Ch	;Bypass colour card
	jp	87CAh
;
; Replace the original 'draw-an-object' subroutine with this one.
; 
	org	944Eh
	call	wobble
;
; This code can go anywhere. I put it at 97C3h so it can coexist with the
; "wibble" upside-down patch.
;
	org	97C3h

wobble:
	ld	a,(85CBh)	;Object colour change ticker
	and	1
	jp	z,969Bh		;Drawing normally. 
;
; Drawing in "wobbled" state
;
	ld	a,e
	and	1Fh		;If at right-hand edge of 
	cp	1Fh		;screen, don't rotate right column of object
	jr	z,wob7		;onto next row.
wob8:	ld	a,(hl)		;Object graphic
	ld	c,0
	srl	a
	rr	c		;A holds left 7 bits. C holds rightmost bit.
	ld	(de),a		;Store leftmost 7.
	inc	e
	ld	a,(de)		;Move right 1 column
	and	7Fh		;Mask out leftmost column of graphic
	or	c		;Draw rightmost column of item
	ld	(de),a
	dec	e
	inc	d		;Go left one, then down one.
	inc	hl
	djnz	wob8
	ret

wob7:	ld	a,(hl)		;If so, shift it right 1 pixel.
	srl	a
	ld	(de),a
	inc	d
	inc	hl
	djnz	wob7 
	ret 
;
	end

