; A1 output Power key on/off Monitor ; A2 input button BELL ; A3 input state monitor (ON = 1) .include "ATxmega32A4def.inc" .def temp = R16 ; temp .def counter = R17 ; counter timerINT .def tick = R18 ; .def data = R19 ; .def note1 = R20 ; note number .def note2 = R21 ; note number .def note3 = R22 ; note number .def MelNum = R23 .def status = R24 ; bit0=1 melody is playing .def amp = R25 ; summ 3 canals ; X time counter display ON ; Y for RAM data ; Z for ROM data .dseg ;Data segment: 4Kb RAM with stack .org SRAM_START Notes: .byte (2+3+1+1)*3 .equ note_freq = 0 ; Divider 2 bytes .equ note_count = 2 ; Counter 3 bytes .equ note_envl = 5 ; Level (Envelope 0 ~ 255) .equ note_dura = 6 ; Duration 32 = 1sec .cseg .org PROGMEM_START rjmp start ;============================================================================== ;Interrupt ;============================================================================== .org PORTA_INT0_vect ; 132 External Interrupt 0 A2 input button BELL rjmp BELL .org TCD1_OVF_vect ; 166 Overflow Interrupt Timer TCD1 rjmp overflow_TCD1 BELL: push temp lds temp, CPU_SREG push temp ldi temp, 1<