
 .include "atari.inc"

 .import _bell_type
 .export _bell

DISTVOL = $a8
PITCH = $40
JIFFIES = $03
FLASH_COLOR = $08

_bell:
 lda #<bell_callback
 sta CDTMA2
 lda #>bell_callback
 sta CDTMA2+1
 lda _bell_type
 beq done
 lda #JIFFIES
 sta CDTMV2
 lda _bell_type
 and #1
 beq check_flash
 lda #DISTVOL
 sta AUDC1
 lda #PITCH
 sta AUDF1
check_flash:
 lda _bell_type
 and #2
 beq done
 lda #FLASH_COLOR
 sta COLOR4
done:
 rts

bell_callback:
 lda #0
 sta AUDC1
 sta AUDF1
 sta COLOR4
 rts
