;cartoon.asm

     proc

cartoon1
  lda #0
  sta scrollflag
  sta pirx
  sta fishx
  sta crabx
  lda #127
  sta fishy
  lda #124
  sta piry
  lda #255
  sta pird
  lda #1
  sta scrollpos+1
  lda #0
  sta scrollpos
  inc scrollflag
  ldx #0
  stx fishd
:lp1
  stx fishx
  txa
  sec
  sbc #24
  bcc :nopir1
  sta pirx
:nopir1
  lda 20
  cmp 20
  beq *-2
  and #8
  lsr a
  lsr a
  lsr a
  sta autotail
  inx
  bne :lp1
  lda #0
  sta fishy
  lda 20
  cmp 20
  beq *-2
  lda 20
  cmp 20
  beq *-2
  lda #1
  sta noeraseflag
  sta fishd
  ldx #1
  stx fishd
  stx pird
  ldx #254
  ldy #84
:lp9
  stx pirx
  txa
  clc
  adc #24
  bcs :nof1
  sta fishx
:nof1
  lda 20
  cmp 20
  beq *-2
  lda 20
  cmp 20
  beq *-2
  lda 20
  and #2
  lsr a
  sta autotail
  sty fishy
  tya
  clc
  adc #16
  tay
  cpy #190
  bcc :okf6
  ldy #84
:okf6

;move fish+piranha left (pir 1st)

  dex
  dex
  bne :lp9

  lda #0
  sta 20
:lp2
  lda 20
  cmp #180
  bne :lp2
  lda #0
  sta autotail
  sta noeraseflag
  rts

  eproc

