;绿岛小夜曲
;硬件:喇叭,放大器,从p0.1输出
org 00h
jmp start
org 0bh
jmp tim0
start: mov tmod,#01h
mov ie,#82h
start0: mov 30h,#00
next: mov a,30h
mov dptr,#table
movc a,@a+dptr
mov r2,a
jz end0
anl a,#0fh
mov r5,a
mov a,r2
swap a
anl a,#0fh
jnz sing
clr tr0
jmp d1
sing: dec a
mov 22h,a
rl a
mov dptr,#table1
movc a,@a+dptr
mov th0,a
mov 21h,a
mov a,22h
rl a
inc a
movc a,@a+dptr
mov tl0,a
mov 20h,a
setb tr0
d1: call delay
inc 30h
jmp next
end0: clr tr0
jmp start0
tim0: push acc
push psw
mov tl0,20h
mov th0,21h
cpl p0.1
pop psw
pop acc
reti
delay: mov r7,#02
d2: mov r4,#187
d3: mov r3,#248
djnz r3,$
djnz r4,d3
djnz r7,d2
djnz r5,delay
ret
table1: dw 64021,64103,64260,64400
dw 64524,64580,64684,64777
dw 64820,64898,64968,65030
dw 65058,65110,65157
table: ;1
db 0a2h,0b2h,0d2h,0b2h,0a4h,0b2h,0d2h
db 0b2h,0a2h,82h,72h,88h
db 72h,82h,0a2h,82h,72h,62h,42h,62h
db 38h,38h
;2
db 0a4h,02h,0b2h,0a4h,84h
db 72h,82h,72h,62h,72h,84h,72h
db 64h,62h,12h,34h,02h,42h
db 38h,38h
;3
db 44h,02h,32h,44h,64h
db 72h,82h,72h,62h,72h,84h,0a2h
db 72h,74h,82h,0a4h,02h,0b2h
db 0a8h,0a8h
;4
db 0b2h,0b4h,0a2h,84h,82h,72h
db 62h,72h,82h,0a2h,88h
db 72h,74h,62h,42h,32h,32h,62h
db 78h,78h
;5
db 82h,84h,72h,82h,0a2h,84h
db 72h,82h,72h,62h,48h
db 32h,0a2h,82h,0f2h,0a2h,0b2h,82h,72h
db 68h,68h
;6
db 0b2h,0b2h,0b2h,0a2h,82h,84h,02h
db 72h,74h,62h,42h,32h,42h,62h
db 78h,78h
db 0a2h,0b2h,0a2h,72h,82h,84h,82h
;7
db 72h,74h,62h,44h,64h
db 0a8h,0a4h,02h,0a2h
db 0a2h,0b1h,0a1h,82h,0a2h,0b4h,0b2h,0c2h
db 0a2h,0b2h,0a2h,0b2h,78h
;8
db 84h,72h,62h,44h,02h,62h
db 72h,81h,71h,62h,72h,84h,02h,0a2h
db 0b4h,02h,82h,74h,82h,72h
db 68h,68h
db 00
end