请你编程

Author: 郭继展 Date: 1997-01-01

  程序用键盘当琴,弹奏乐曲,适用于IBM  PC及其兼容机。程序用8088汇编语言写成,音域宽阔,悠扬悦耳,犹如美声。几与钢琴媲美。用户运行程序,轻敲几键,往往便爱不释手,甚至发现自己多年来的音乐才能被埋没。
  TYPE GQASM
  DATA SEGMENT
  A DW 44 DUP(60)
  DW 69,1388,78,85,1320,524,588,660,694,784,880,988,1048
  DW 1176,170,170,69,1568,78,85,588,131,98,83,165,330,174
  DW 196,220,278,247,139,156,124,110,312,338,262,347,147
  DW 392,494,87,294,74,440,65,370,467,416,880,1388,509
  DATA ENDS
  CODE SEGMENT
  ASSUME CS:CODE,DS:DATA
  START:MOV AX,DATA
  MOV DS,AX
  MOV WORD PTR[A+16],1760
  MOV WORD PTR[A+26],208
  MOV WORD PTR[A+78],185
  B:MOV AH,07
  INT 21H
  CMP AL,1BH
  JZ I
  CMP AL,20h
  JZ B
  CMP AL,96
  JNG C
  SUB AL,32
  C:SHL AL,1
  CBW
  MOV AH,0
  MOV BX,AX
  MOV AX,0
  MOV DX,12H
  DIV WORD PTR[BX+A]
  MOV BX,AX
  MOV AL,0B6H
  OUT 43H,AL
  MOV AX,BX
  OUT 42H,AL
  MOV AL,AH
  OUT 42H,AL
  IN AL,61H
  OR AL,3
  OUT 61H,AL
  MOV BX,0FFFFH
  D:MOV CX,0FFH
  E:LOOP E
  F:MOV AH,0BH
  INT 21H
  CMP AL,00 JNZ G
  DEC BX
  JNZ D
  G:IN AL,61H
  AND AL,0FCH
  OUT 61H,AL
  MOV CX,0FFFFH
  H:LOOP H
  JMP B
  I:MOV AH,4CH
  INT 21H
  CODE ENDS
  END START
  键盘最上排键1~7为中音,8再向右高8度;向下各排依次低8度,每排左数第8个键向右为本排左7键的升调、上一排左7键的降调。后一键按下,前一键发音立停,改发后键音。程序编译连接后,即可运行。按空格键休止,ESC键退出。