分享
 
 
 

基于汇编语言的电子琴设计(2)

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

六、程序清单:

主要程序代码如下:

;宏定义

DRAW MACRO START_X,START_Y,END_X,END_Y,COLOR

LOCAL DRAW_NEXT

;local :避免宏重复调用时,标号的重复

;功能:画填充的矩形

;使用条件:START_X < END_X ,START_Y < END_Y

PUSH AX

PUSH BX

PUSH CX

PUSH DX

MOV AH,0CH ;写像素点

MOV AL,COLOR ;设置颜色

MOV BH,0 ;选用页号0

MOV CX,START_X ;列起始点

MOV DX,START_Y ;行起始点

DRAW_NEXT:

INT 10H ;画点

INC CX ;画横线

CMP CX,END_X ;比较行是否画完

JNE DRAW_NEXT ;画另一行

MOV CX, START_X ;另一行的起始点

INC DX

CMP DX,END_Y ;比较列是否画完

JNE DRAW_NEXT ;未完继续画

POP DX

POP CX

POP BX

POP AX

ENDM

DRAWSQRE MACRO START_X,START_Y,END_X,END_Y,COLOR

LOCAL ROW_UP,ROW_DOWN,RANK_LEFT,RANK_RIGHT

;功能:画不填充的矩形

PUSH AX

PUSH BX

PUSH CX

PUSH DX

PUSH SI

MOV AH,0CH

MOV AL,COLOR

MOV BH,0

MOV CX,START_X

MOV DX,START_Y

ROW_UP: ;画上边

INT 10H

INC CX

CMP CX,END_X

JNE ROW_UP

RANK_RIGHT: ;画右边

INT 10H

INC DX

CMP DX,END_Y

JNE RANK_RIGHT

MOV CX, START_X ;下边起始点

MOV SI,END_X

INC SI

ROW_DOWN: ;画下边

INT 10H

INC CX

CMP CX,SI

JNE ROW_DOWN

MOV DX,START_Y ;右边起始点

MOV CX,START_X

RANK_LEFT: ;画右边

INT 10H

INC DX

CMP DX, END_Y

JNE RANK_LEFT

POP SI

POP DX

POP CX

POP BX

POP AX

ENDM

;数据段

DATA SEGMENT

;定义在屏幕绘制字

START_COL DB ? ;存储起始行

TEXT DB 16 ;起始行

DB 2 ;起始列

DB 06H ;字体颜色

DB 'Piano XP',0FFH,'Copyright(c)Auto-5-5th',0FFH,0FFH ;显示字

DB 10 DUP(2 DUP(0DBH),2 DUP(20H)),0FFH ;颜色交叉矩形

DB 10 DUP(2 DUP(20H),2 DUP(0DBH)),0FFH

DB 10 DUP(2 DUP(0DBH),2 DUP(20H)),0FFH

DB 10 DUP(2 DUP(20H),2 DUP(0DBH)),0FFH

DB 10 DUP(2 DUP(0DBH),2 DUP(20H)),0FFH

DB 10 DUP(2 DUP(20H),2 DUP(0DBH)),0FFH

DB 00

;白色琴键坐标

ST_LX DW 50,61,72,83,94,105,116

ST_MX DW 127,138,149,160,171,182,193

ST_HX DW 204,215,226,237,248,259,270

ST_Y DW 50

ED_LX DW 60,71,82,93,104,115,126

ED_MX DW 137,148,159,170,181,192,203

ED_HX DW 214,225,236,247,258,269,280

ED_Y DW 90

;黑色琴键坐标

BT_X DW 57,68,90,101,112

DW 134,145,167,178,189

DW 211,222,244,254,265

BT_Y DW 50

BD_X DW 64,75,97,108,119

DW 141,152,174,185,196

DW 218,229,251,262,273

BD_Y DW 70

;音乐频率值

LOWD DW 131

LOWDD DW 147,165,175,196,220,247

MID DW 262

MIDD DW 294,330,349,392,440,494

HGH DW 523

HGHD DW 587,659,797,783,879,987,1046

KEYFLAG DB 1 ;标记低(0)、中(1)、高(2)音键

KEYNUM DW 1 ;存储1~7

DELAY_TIME DW 7000 ;延时

SONG DW 100 ;保存所选的自动演奏的曲目

TUNE DW 1 ;标记c调或d调

AUDIO DW 1 ;标记低(1)、中(2)、高音(3)

;自动演奏的歌曲频率和延时

MUS_FREQ1 DW 440,392,330,392,523,440,392,440

DW 330,392,440,392,330,262,220,392

DW 330,2 DUP(294),330,2 DUP(392),440,330

DW 294,262,392,330,294,262,220,262,196

DW -1

MUS_TIME1 DW 37,12,3 DUP(25),2 DUP(12),50

DW 25,2 DUP(12 ),2 DUP(25),4 DUP(12 ),50

DW 37 ,12 ,25,2 DUP(12 ),2 DUP(25),50

DW 37 ,5 DUP(12 ),100

MUS_FREQ2 DW 392,523,392,330,2 DUP(262,330,392),2 DUP(523)

DW 349,3 DUP(440),330,3 DUP(392),294,349,330,294,262

DW 392,523,392,330,2 DUP(262,330,392),2 DUP(523)

DW 349,3 DUP(440),330,3 DUP(392),294,349,330,294,262

DW 392,3 DUP(523),494,587,392,392,3 DUP(587),523,659,392

DW 3 DUP(523),330,3 DUP(392),294,349,330,294,262

DW -1

MUS_TIME2 DW 12 ,3 DUP(25,2 DUP(12 )),2 DUP(25)

DW 2 DUP(19,6,2 DUP(12 )),4 DUP(12 )

DW 25,12 ,3 DUP(25,2 DUP(12 )),2 DUP(25)

DW 2 DUP(19,6,2 DUP(12 )),5 DUP(12 )

DW 2 DUP(19,6,4 DUP(12 ),25)

DW 25,2 DUP(12 ),19,6,6 DUP(12 ),25

MUS_FREQ3 DW 262,262,294,330,330,349,392,440,392,330

DW 392,349,330,294,349,330,294,262

DW 262,262,294,330,330,349,392,440,392,330

DW 392,349,330,294,330,294,262,196

DW 392,349,330,294,196,196,349,330,294,262

DW 392,349,330,294,196,196,349,330,294,262

DW 262,262,294,330,330,349,392,440,392,330

DW 392,349,330,294,330,294,262

DW -1

MUS_TIME3 DW 3 DUP(25,2 DUP(12)),50

DW 2 DUP(25,2 DUP(12),50)

DW 3 DUP(25,2 DUP(12)),50

DW 2 DUP(25,2 DUP(12)),2 DUP (50)

DW 3 DUP(25,2 DUP(12)),50

DW 3 DUP(25,2 DUP(12)),50

DW 3 DUP(25,2 DUP(12)),50

DW 2 DUP(25,2 DUP(12)),50

MUS_FREQ4 DW 262,262,294,330,330,294,262,262,220,196

DW 262,294,330,294,262,294

DW 262,294,330,330,294,294,262,220,220,294,262,262,220,196

DW 196,220,220,262,262,294,294,262,220

DW 294,330,294,262,262,294,262,220,196,220

DW 196,220,262,294,330,392,294,330,262,294,262,220

DW 220,294,247,220,196,196

DW 4 DUP(392),330,392,440,440,392,330

DW 5 DUP(440),392,392,330,294

DW 440,392,440,392,330,294,330,294,262,220

DW 4 DUP(294),262,220,196

DW 2 DUP(440,392),2 DUP(330,294),262,220

DW 3 DUP(294),262,220,392

DW -1

MUS_TIME4 DW 3 DUP(20,10,10),50

DW 20,10,20,10,10,80

DW 20,10,20,10,10,3 DUP(20,10),20,20,80

DW 20,10,10,20,20,20,10,10,40

DW 20,10,20,20,10,5,5,10,10,40

DW 20,10,2 DUP(20,10,10),10,5,5,20

DW 20,20,20,10,10,80

DW 10,20,10,20,10,10,40,10,10,20

DW 8 DUP(10),80

DW 20,10,10,20,20,4 DUP(10),40

DW 15,5,10,10,20,20,80

DW 20,10,10,20,20,4 DUP(10),40

DW 40,20,20,40,40,100

MUS_FREQ5 DW 330,392,440,330,392,294

DW 330,392,440,523,440,392,220,262,330,294

DW 294,330,392,294,330,294,220,220

DW 220,262,294,330,294,247,220,262,196

DW 294,330,294,247,220,196,262

DW 523,523,440,523,440,523,440,392

DW 392,330,440,392,262,294,262,292,330

DW 330,330,294,330

DW 523,523,494,440

DW 330,330,294,330,523,494,440,330,392

DW -1

MUS_TIME5 DW 2 DUP(12,12,75),3 DUP(12),25,12,25,6,6,12,75 ;#1,2

DW 12,12,75,4 DUP(12),75,12,12,37,5 DUP(12),75

DW 37,12,12,12,12,12,50

DW 12,12,12,50,12,12,12,75

DW 12,12,37,12,25,6,6,12,50,12,12,12,50,12,12,12,75

DW 12,12,37,12,12,12,12,12,75

DATA ENDS

〈未完〉

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有