;solution for Example 13-6 MOV AL,0B6H ;control byte:counter2,lsb,msb,binary OUT 43H,AL ;send the control byte to control reg ;load the counter2 value for D3 and play it for 250 ms MOV AX,1FB4H ;for D3 note OUT 42H,AL ;the low byte MOV AL,AH OUT 42H,AL ;the high byte ;turn the speaker on IN AL,61H ;get the current setting of port b MOV AH,AL ;save it OR AL,00000011B ;make pb0 =1 and pb1 =1 OUT 61H,AL ;turn the speaker on CALL DELAY ;play this note for 250 ms MOV AL,AH ;get the original setting of port b OUT 61H,AL ;turn off the speaker CALL DELAY_OFF ;speaker off for this duration ;load the counter2 value for A3 and play it for 500 ms MOV AX,152FH ;for A3 note OUT 42H,AL ;the low byte MOV AL,AH OUT 42H,AL ;the high byte ;turn the speaker on IN AL,61H ;get the current setting of port b MOV AH,AL ;save it OR AL,00000011B ;make PB0 =1 and PB1 =1 OUT 61H,AL ;turn the speaker on CALL DELAY ;play for 250 ms CALL DELAY ;play for another 250 ms MOV AL,AH ;get the original setting of port b OUT 61H,AL ;turn off the speaker CALL DELAY_OFF ;speaker off for this duration ;load the counter2 value for A4 and play it for 500 ms MOV AX,0A97H ;for A4 note OUT 42H,AL ;the low byte MOV AL,AH OUT 42H,AL ;the high byte ;turn the speaker on IN AL,61H ;get the current setting of port b MOV AH,AL ;save it OR AL,00000011B ;make PB0 =1 and PB1 =1 OUT 61H,AL ;turn the speaker on CALL DELAY ;play for 250 ms MOV AL,AH ;get the original setting of port b OUT 61H,AL ;turn off the speaker CALL DELAY_OFF ;speaker off for this duration