匯編夢幻鋼琴程序設(shè)計報告_第1頁
匯編夢幻鋼琴程序設(shè)計報告_第2頁
匯編夢幻鋼琴程序設(shè)計報告_第3頁
匯編夢幻鋼琴程序設(shè)計報告_第4頁
匯編夢幻鋼琴程序設(shè)計報告_第5頁
已閱讀5頁,還剩48頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

計實驗報告 鍵盤,以計算機鍵盤的相應(yīng)鍵模擬鋼琴鍵盤進行樂曲的演奏。在PC機鍵盤上按鍵,屏f(1)、屏幕設(shè)置MOVAH,00HMOVAL,0DHINT10HMOVBL,00H(2)、鋼琴繪制,繪制鍵盤時的坐標(biāo)的確定:STLXDW61,72,83,94,105,116;起點橫坐標(biāo)ST_MXDW127,138,149,160,171,182,193ST_HXDW204,215,226,237,248,259,270STYDW;起點縱坐標(biāo)ED_LXDW60,71,82,93,104,115,126;終點縱坐標(biāo)ED_MXDW137,148,159,170,181,192,203ED_HXDW214,225,236,247,258,269,280EDYDW90;終點縱坐標(biāo)BT_XDW57,68,90,101,112;起點橫坐標(biāo)DW134,145,167,178,189DW211,222,244,254,265BT_YDW50;起點縱坐標(biāo)BD_XDW64,75,97,108,119;終點橫坐標(biāo)DW141,152,174,185,196DW218,229,251,262,273BDYDW70;終點縱坐標(biāo)DRAWMACROSTART_X,START_Y,END_X,END_Y,COLORDRAWSQREMACROSTART_X,START_Y,END_X,END_Y,COLOR(3)、琴鍵繪制PIANO_DRAWPROCNEAR(4)、屏幕顯示字符SHOW_CHARPROCNEAR、SHOW_TEXTPROCNEAR(1)、手動演奏GEN_HANDPROCNEAR(2)、自動播放發(fā)聲程序GEN_AUTOPROCNEAR(3)、延時程序WAITFPROCNEAR(4)、自動播放歌曲SCAN_SONGPROCNEAR、PLAY_SONGPROCNEAR(5)、C/D調(diào)及對應(yīng)的低、中、高頻率分別載入LOAD_AUDIOPROCNEARCDSCANTUNEPROCNEAR;需求分析與設(shè)計是透明的,我們只需要調(diào)用顯示驅(qū)動程序INT10H。鋼琴主要是由矩形、直。鋼琴鍵盤的動態(tài)顯示則是同步于鍵盤的按鍵有按下和彈起的動畫。這部分繪制琴鍵:PIANO_DRAWPROCNEARLEADIEDLX琴鍵結(jié)束點有效地址NEXT_DRAW:DRAWSISTYDIEDY,0FH;調(diào)用宏定義畫白鍵DRAW[SI],90,[DI],93,07H;陰影IADDDI,2LEASIBTX;取黑色琴鍵起始點的有效地址LEADIBDX鍵結(jié)束點的有效地址NEXT_BLOCK:DRAWSIBTYDI],BD_Y,00H;調(diào)用宏定義畫黑色琴鍵IADDDI,2GENHANDPROCNEAR奏發(fā)聲程序AXSHBXPUSHCXSHDXDIMOVDX,12H;1.1931Mhz/給定的頻率=12348h/給定頻率=計數(shù)初值UTHALAITLLWAITFINAL,60H;讀取鍵盤掃描碼,按下和放開都有相應(yīng)的掃描碼,放0h>80hTESTALH鍵是否放開POPDI存器狀態(tài)POPDXPOPCXPOPBXOPAXGEN_HANDENDPRMOVCXDELAYTIMEAITFWAITFENDP為1.19318MHz。通過設(shè)置計數(shù)值可以產(chǎn)生各種頻率的聲音。與此同時,許多輸DPROCNEARHMOVDX,12H;1.1931Mhz/給定的頻率=12348h/給定頻率=計數(shù)初值OUTHAL器送處值A(chǔ)ITLLWAITFTESTALH是否放開H間POPDI存器狀態(tài)DXOPCXXHANDENDP(1)、為所要播放的樂曲的定義一個頻率表和節(jié)拍表。MUS_FREQ2DW262,294,330,262,262,294,330,262;兩只老虎DW330,349,392,330,349,392,392,440DW392,349,330,262,392,440,392,349DW330,262,294,196,262,294,196,262DW262,294,330,262,262,294,330,262DW330,349,392,330,349,392,392,440DW392,349,330,262,392,440,392,349DW330,262,294,196,262,294,196,262DW0MUSTIMEDW25,25,25,25,25,25,25,25,25,2512,12,12,25,2512,12,12,12,25,25,25,25,50,25,25,5025,25,25,25,25,2512,12,12,25,2512,12,12,12,25,25,25,25,50,25,25,50(2)、分表將兩個表的偏移地址放入SI和BP中PMUSTIMEIMUSFREQ(3)、從表中讀出的音符頻率放入DI中,取出音符的持續(xù)時間(10s的倍數(shù))放入BX中。MOVDI,[SI]MOVBXBP](4)、最后調(diào)用GEN_AUTO子程序發(fā)出聲音。CDRAWMACROSTART_X,START_Y,END_X,END_Y,COLORLOCALDRAW_NEXTPUSHAXPUSHBXPUSHCXPUSHDXMOVMOVMOVMOVMOVDRAW_NEXT:AH,0CHAL,COLORBH0CX,START_XDX,START_YCX,END_XMOVCXSTART_XXPCXDRAWSQREMACROSTARTXSTARTYENDXEND_Y,COLOROCALROWUPROWDOWNRANKLEFTRANKRIGHTXSHCXDXPUSHSIHCHHCHCOLORBH,0CX,START_XDX,START_YCX,START_XSI,END_XVMOVMOVROWRANK_MOVMOVROW_DOWNWNVTYVTDX,END_Y;比較行是否畫完RANK_LEFT;畫另一邊POPSIXPCXSEGMENTSTART_COLDB?TEXTDB起始行DB始列DBAHDB'*********ThisPianoFFHWelcome!Haveagoodtime!***',0FFHDB'DreamPiano',0FFH,'LiuZhuHuiANDLiuJing',0FFH,0FFH;顯示字DB0FFH,'1a.s.d.f.g.h.jTOMAKEMUSIC'DB0FFH,'2F2~F5TOPLAYAMUISC'DB0FFH,'3shiftand+/-TOup/downTHEMUSIC'DB0FFH,'4L/RSHIFTTOHIGHT/LOW.';DB10DUP(4DUP(0DBH),4DUP(20H)),0FFHPDUP(20H),4DUP(0DBH)),0FFHPDUP(0DBH),2DUP(20H)),0FFHPDUP(20H),2DUP(0DBH)),0FFHPDUP(0DBH),2DUP(20H)),0FFHDUP(2DUP(20H),2DUP(0DBH)),0FFHDB00STLXDW,72,83,94,105,116;起點橫坐標(biāo)ST_MXDW127,138,149,160,171,182,193ST_HXDW204,215,226,237,248,259,270W60,71,82,93,104,115,126;終點縱坐標(biāo)WW8,269,280ED_YDW90;終點縱坐標(biāo)BTXDW7,68,90,101,112DW45,167,178,189DW2,244,254,265BTYDW50;起點縱坐標(biāo)BDXDW4,75,97,108,119;終點橫坐標(biāo)3BDYDWDW131DW221,248,278,294,330,371,416;低音MIDDW262MIDDDW441,495,556,589,661,742,833;中音HGHDW523HGHDDW,990,1112,1178,1322,1484,1665;高音KEYFLAGDB1;標(biāo)記低(0)、中(1)、高(2)音鍵SONGDW演奏的曲目AUDIODW1;標(biāo)記低音{1},中音{2},高音{3}MUS_FREQ1dw196,220dw220,196dw262,220,262dw262,220dw294,330,392dw330dw220,196,220dw220dw440dw196,220dw262dw440dw330,294wdw440dw330,392wdw440dw330,294wdw330dw392dw262dw262,-1MUSTIME1dw40,40dwdw,40dwdw,40dw,40dwdwdwdwdwMUSFREQDW262,294,330,262,262,294,330,262;兩只老虎DW9,392,330,349,392,392,440DW9,330,262,392,440,392,349DW2,294,196,262,294,196,262DW4,330,262,262,294,330,262DW9,392,330,349,392,392,440DW9,330,262,392,440,392,349DW2,294,196,262,294,196,262DW0MUSTIMEDW25,25,25,25,25,25,25,25,25,25DW25,50,12,12,12,12,25,25DW12,12,25,25,25,25,50,25,25,50DW25,25,25,25,25,25,25,25DW25,50,12,12,12,12,25,25DW12,12,25,25,25,25,50,25,25,50MUSFREQDW262,262,294,330,330,349,392,440,392,330DW9,330,294,349,330,294,262DW2,294,330,330,349,392,440,392,330DW9,330,294,330,294,262,196DW9,330,294,196,196,349,330,294,262DW9,330,294,196,196,349,330,294,262DW2,294,330,330,349,392,440,392,330DW9,330,294,330,294,262DW0MUSTIMEDW3DUP(25,2DUP(12)),50DW2PDUP)DW3PDUP0DW2PDUP(12)),2DUP(50)DW3PDUP0DW3PDUP0DW3PDUP0DW2DUP(25,2DUP(12)),50MUSFREQDW262,262,294,330,330,294,262,262,220,196DW4,330,294,262,294DW,330,330,294,294,262,220,220,294,262,262,220,196DW0,220,262,262,294,294,262,220DW0,294,262,262,294,262,220,196,220DW0,262,294,330,392,294,330,262,294,262,220DW4,247,220,196,196DWDUP),330,392,440,440,392,330DWDUP),392,392,330,294DW2,440,392,330,294,330,294,262,220DWDUP),262,220,196DWDUP,392),2DUP(330,294),262,220DWDUP),262,220,392DW0USTIMEDWDUP10,10),5020,10,20,10,10,3DUP(20,10),20,20,8010,10,4020,10,20,20,10,5,5,10,10,40DW2DUP(20,10,10),10,5,5,20USFREQUSTIMESDUP10),40DUP10),4040,100DW2,440,330,392,29492,220,262,330,2940,294,220,2204,247,220,262,1960,196,26223,440,39294,262,292,33094,440,330,3920DWDUP2,75),3DUP(12),25,12,25,6,6,12,75;#1,2DUP12,12,75ENTASSUMEDSDATACS:CODEMAINPROCFARLLINITNEW_SCAN:CALLSCANKEYCMPSONG是否按下了自動播放的歌曲鍵JEHANDPLAY播放CALLPLAYSONG樂JMPNEWSCAN新掃描有無鍵按下PLAYCMPKEYNUM否手動演奏JZNEWSCAN掃描有無鍵按下PUSHBX手動,則進行鍵盤清理OVBXKEYNUMCALLKEYDOWN序中PUSHSIMOVSI,KEYNUMMOVDI,[BX+SI]CALLGENHANDPOPSIPUSHBXMOVBX,KEYNUM;在屏幕上顯示彈起狀態(tài)CALLKEY_UPPOPBXMAINENDPGEN_HANDPROCNEAR;手動演奏發(fā)聲程序PUSHAXPUSHBXPUSHCXPUSHDXPUSHDIMOVDXH.1931Mhz/給定的頻率=12348h/給定頻率=計數(shù)初值UTHALHALAITLLWAITFTESTAL0H;查詢鍵是否放開間POPDI寄存器狀態(tài)POPDXPOPCXPOPBXPOPAXGEN_HANDENDPGEN_AUTOPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXPUSHDIOUT43H,ALMOVDXH.1931Mhz/給定的頻率=12348h/給定頻率=計數(shù)初值LINAL,61HMOVAL,AHOUT42H,ALINAL,61HMOVAH,ALLWAIT:ITFJNZWAIT畢MOVALAH;完畢則關(guān)閉揚聲器POPDI器狀態(tài)XPCXOENDPAITFPROCNEARMOVCXDELAYTIMEAITFWAITFENDPODRAWPROCNEARLEASISTLX點有效地址LEADIEDLX結(jié)束點有效地址EXTDRAWDRAWSISTYDI,ED_Y,0FHDRAWSI[DI],93,07H;陰影ADDSI;下一個鍵ADDDI2LEASIBTX點的有效地址LEADIBDX點的有效地址EXTBLOCKDRAWSIBTYDI],BD_Y,00H;調(diào)用宏定義畫黑色琴鍵ADDSI;下一個鍵ADDDI2ODRAWENDPWNPROCNEARPUSHSIDICALLLOAD上的位置XDRAW[SI+BX],92,[DI+BX],94,07HPOPDIPOPSIKEY_DOWNENDPKEY_UPPROCNEARPUSHSIPUSHDICALLLOAD;載入所彈起鍵在屏幕上的位置DRAW[SI+BX],90,[DI+BX],93,07H;恢復(fù)陰影DRAW[SI+BX],93,[DI+BX],94,05H;恢復(fù)背景色POPDIPOPSIKEY_UPENDPLOADPROCNEARCMPKEYFLAG,00H;判斷是否是低音鍵OADHGHLEASI,ST_LX;載入低音鍵起始坐標(biāo)首地址LEADI,ED_LX;載入低音鍵結(jié)束坐標(biāo)首地址DENDLOAD_HGH:CMPKEYFLAGH斷是否是高音鍵DMIDLEASI,ST_HX;載入高音鍵起始坐標(biāo)首地址LEADI,ED_HX;載入高音鍵結(jié)束坐標(biāo)首地址JMPLOADENDSISTMXDIEDMX鍵結(jié)束坐標(biāo)首地址NEARMOVSI,100MOVDI100MOVKEYNUM00;賦初值MOVAH;讀鍵盤MOVDLAHCALLSCAN_SONG;判斷是否是自動播放鍵(大鍵盤數(shù)字鍵1~5)CMPAHH鍵JNEFLAGSCANLEXITSCANMOVAH2H;讀鍵盤狀態(tài)字節(jié)ANDDH02HSLOWANDDH01HSHGHPSMIDWMOVAUDIOMOVKEYFLAG0JMPKEY理MOVAUDIOMOVKEYFLAG2JMPKEY處理MOVAUDIOKEY_1:KEY_6:GKEY判斷KEYNUM存標(biāo)志KEY_3KEY_4KEY_5KEY_6JNEKEY_7MOVKEYNUM10KEY_7:MOVKEYNUM12NEAR;判斷是否是自動播放鍵(鍵1~5),并保存標(biāo)志變量(song)MOVSONG00;賦初始值ONGENDOVALAHMOVAH0HMOVSONGAX;存入標(biāo)志碼ONGPROCNEARPPUSHSIXDINEGOLEABPMUSTIME據(jù)首地址LEASIMUSFREQ數(shù)據(jù)首地址SONGLIGHTOFFDRAW,257,46,0EHTIMEFREQSONGLIGHTOFFDRAW,263,46,0EHTIMEFREQSONGLIGHTOFFDRAW,269,46,0EHTIMEFREQSONGLIGHTOFFDRAW,275,46,0EHTIMEFREQMOVAH1HCMPAH,1CH;判斷是否為enter鍵(1CH為enter鍵的掃描碼)INUEJMPPLAYEND放NUEMOVAH,0CH;清除鍵盤緩沖區(qū)字符PDIJEPLAYENDGENAUTOADDSI,2ADDBP;下一頻率QPLAYENDCALLS

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論