;256b intro rndlife 1 by terric/meta 2010-11-28
;compiled with 64tass 1.46

        *=$0801
	.byte $0c,$08,$0a,$00,$9e,$20,$32,$30,$36,$34
	.byte $00,$00,$00,$00   
	*=$0810
	sei
	lda #$00

	sta $d020
	sta $d021

	lda #$01
	sta $0286
	jsr $e544

	lda #$11
	sta $d412
	lda #$40
	sta $d40e
	lda #$30
	sta $d40f
	lda #$00
	sta $f8
	sta $f9	


-
	lda #199
ra
	cmp $d012
	bne ra
rw
	cmp $d012
	beq rw
	dey
	cpy #$00
	bne +
	ldy $d41b
	ldx $d41b
+
	txa
	and #%00000100
	bne +
	lda $f8
	cmp #39
	beq +
	inc $f8
+	
	txa
	and #%00001000
	bne +
	lda $f8
	beq +
	dec $f8
+	
	txa
	and #%00000001
	bne +
	lda $f9
	cmp #0
	beq +
	dec $f9

+	

	txa
	and #%00000010
	bne +

	lda $f9
	cmp #24
	beq +
	inc $f9
+
	tya
	pha
	txa
	pha
	lda $f9

	sta $f0
	lda #$00
	sta $f1
	lda $f8
	sta $f4
	lda #$00
	sta $f5
	lda #$04
	sta $f7
	lda #$00
	sta $f6
	jsr raddlohi
	

	
	ldx #$00
	lda $d41b
	sta ($f0,x)
	pla
	tax
	pla
	tay
	jmp -
asloop
	asl $f0,x
	rol $f1,x
	dey
	bpl asloop
	rts
addxyt
	txa
	tay
-	iny
	iny
	lda $f0,x
	clc
	adc $f0,y
	sta $f0,x
	bcc +
	inc $f1
+
	
	cpy #$06
	bcc -
	rts
raddlohi
	ldx #$00
	ldy #$02
	jsr asloop
	lda $f0
	sta $f2
	lda $f1
	sta $f3
	ldx #$00
	ldy #$01
	jsr asloop
	jsr addxyt
	inx
	jsr addxyt
	rts