browser

korobeiniki.xyw

korobeiniki.xyw
calendarsave
; Korobeiniki - Traditional Russian folk song
; Main melody - "Type A"  (Tetris Theme)

.include "lib/macros.xyw"

; Note duration macros
.macro n2 $00C0 ; half note
.macro n4 $0060 ; quarter note
.macro n8 $0030 ; eighth note

; Store address of start song in xw
start-song POPxw

; Process <length> <pitch> pairs until end-song
; a16 b16 -[xw]-
.label play
    ; Set length
    LDWxw beeper.length STW
    ; Go to next word
    INCxw INCxw
    ; Set pitch
    LDWxw beeper.pitch STW
    ; Go to next word
    INCxw INCxw
    ; Set volume to play the note
    $01 beeper.level STB
    ; Repeat unless we are at the end of the song
    PSHxw end-song LTHw play JCNw
    ; Terminate
    HLT

.label start-song

; Main theme - Part A
; E5 B4 C5 D5 | C5 B4 A4 A4 | C5 E5 D5 C5 | B4 B4 C5 D5 | E5 C5 A4 A4

.byte n4 e5 n8 b4 n8 c5 n4 d5 
.byte n8 c5 n8 b4 n4 a4 n8 a4 
.byte n8 c5 n4 e5 n8 d5 n8 c5
.byte n4 b4 n8 b4 n8 c5 n4 d5
.byte n4 e5 n4 c5 n4 a4 n2 a4

.byte n4 ps ; pause between parts

; Main theme - Part B
; D5 F5 A5 G5 | F5 E5 ps  C5 | E5 D5 C5 B4 | B4 C5 D5 E5 | C5 A4 A4

.byte n4 d5 n8 f5 n4 a5 n8 g5
.byte n8 f5 n4 e5 n8 ps n8 c5
.byte n4 e5 n8 d5 n8 c5 n4 b4
.byte n8 b4 n8 c5 n4 d5 n4 e5
.byte n4 c5 n4 a4 n2 a4

.label end-song