¡¡
¡¡¡¡¡¡Àý8.1 SOUND³ÌÐò
¡¡¡¡
¡¡¡¡¡¡TITLE SOUND£­EXAMPLE 8-1 £»Sound£­£­Makes a sound with the speaker

¡¡¡¡¡¡¡¡¡¡¡¡program ¡¡¡¡¡¡¡¡segment
¡¡¡¡¡¡¡¡¡¡¡¡main ¡¡¡¡¡¡¡¡¡¡ proc ¡¡¡¡¡¡¡¡¡¡¡¡far
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡assume cs£ºprogram£¬ds£ºprogram
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡org ¡¡ 100h
¡¡¡¡¡¡¡¡¡¡¡¡start£º ¡¡¡¡¡¡¡¡mov ¡¡ dx£¬1000 ¡¡¡¡£»turn on/off 1000 times
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡in ¡¡¡¡al£¬61h ¡¡¡¡ £»get port 61h
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡and ¡¡ al£¬11111100b£»AND off bits 0£¬1
¡¡¡¡¡¡¡¡¡¡¡¡sound£º ¡¡¡¡¡¡¡¡xor ¡¡ al£¬2 ¡¡¡¡¡¡ £»toggle bit 1
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡out ¡¡ 61h£¬al ¡¡¡¡ £»output to port 61h
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov ¡¡ cx£¬1400h ¡¡ £»value of wait
¡¡¡¡¡¡¡¡¡¡¡¡wait1£º ¡¡¡¡¡¡¡¡loop¡¡ wait1 ¡¡¡¡¡¡ £»delayed a while
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dec ¡¡ dx ¡¡¡¡¡¡¡¡¡¡£»total 100 times
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡jne ¡¡ sound
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov ¡¡ ax£¬4c00h ¡¡ £»return to DOS
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡int¡¡¡¡21h
¡¡¡¡¡¡¡¡¡¡¡¡main ¡¡¡¡¡¡¡¡¡¡ endp
¡¡¡¡¡¡¡¡¡¡¡¡program ¡¡¡¡¡¡¡¡ends
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡end ¡¡ start